Fix multiples API calls and methods

This commit is contained in:
Tiago Kayaya
2020-11-25 11:25:08 +01:00
parent 029d1e3e28
commit d1214e0313
7 changed files with 41 additions and 19 deletions
@@ -27,7 +27,7 @@ export class AttachmentsPage implements OnInit {
loadAttachments(eventid:string)
{
this.attachamentsService.getEventAttachments(eventid).subscribe(attachments => {
this.attachamentsService.getAttachmentsById(eventid).subscribe(attachments => {
this.loadedEventAttachments = attachments;
this.pageId = eventid;
});
@@ -177,6 +177,10 @@ export class EventDetailModalPage implements OnInit {
/* this.attachamentsService.getEventAttachments(this.pageId).subscribe(attachments => {
this.loadedEventAttachments = attachments;
}); */
this.attachamentsService.getAttachmentsById(this.pageId).subscribe(res => {
console.log(res);
});
}
async viewDocument(documenturl:string)
{
@@ -186,10 +186,12 @@ export class EventDetailPage implements OnInit {
loadAttachments()
{
console.log(this.pageId);
/* console.log(this.pageId); */
this.attachamentsService.getEventAttachments(this.pageId).subscribe(attachments => {
this.loadedEventAttachments = attachments;
this.attachamentsService.getAttachmentsById(this.pageId).subscribe(res => {
this.loadedEventAttachments = res;
console.log(res);
});
}
async viewDocument(documenturl:string)
@@ -36,7 +36,7 @@ export class BookMeetingModalPage implements OnInit {
) {
this.task = this.navParams.get('task');
this.postData = new Event();
this.eventBody = new EventBody;
this.eventBody = { BodyType : "1", Text : ""};
this.postData.Body = this.eventBody;
/* Initialize 'Subject' with the title of the expedient */
@@ -63,7 +63,7 @@ export class BookMeetingModalPage implements OnInit {
}
saveTask(){
this.eventBody={
BodyType: '0',
BodyType: '1',
Text: this.postData.Body.Text,
}
this.postData = {
@@ -89,7 +89,7 @@ export class BookMeetingModalPage implements OnInit {
this.processes.FindTaskDocId(this.task.SerialNumber).subscribe(res =>{
if(res){
this.calendarService.postExpedientEvent(res, this.postData, "md");
this.calendarService.postExpedientEvent(res, this.postData, "md",this.task.SerialNumber);
}
});
this.distartExpedientModal();
@@ -100,8 +100,9 @@ export class BookMeetingModalPage implements OnInit {
const modal = await this.modalController.create({
component: AddParticipantsModalPage,
componentProps: {
eventPersons: this.eventAttendees
},
cssClass: 'add-participants-modal',
cssClass: 'book-meeting-modal',
backdropDismiss: false
});
@@ -110,8 +111,6 @@ export class BookMeetingModalPage implements OnInit {
modal.onDidDismiss().then((res) => {
this.taskParticipants = res.data;
let newattendees: EventPerson[] = res['data'];
if (newattendees != null)
{
newattendees.forEach(newattendee => {
@@ -135,6 +134,7 @@ export class BookMeetingModalPage implements OnInit {
const modal = await this.modalController.create({
component: AddParticipantsCcModalPage,
componentProps: {
eventPersons: this.eventAttendees
},
cssClass: 'add-participants-cc-modal',
backdropDismiss: false
@@ -57,7 +57,7 @@ export class ExpedienteDetailPage implements OnInit {
"DocumentURL": result.formURL
}
this.fulltask = result;
console.log(result);
/* console.log(result); */
});
}
@@ -66,14 +66,15 @@ export class ExpedienteDetailPage implements OnInit {
{
if (this.eventsList == null)
{
this.attachments.getAttachments(2, serial).subscribe(result => {
result.forEach(att =>{
if (this.eventsList == null)
{
this.attachments.getAttachmentsBySerial(serial).subscribe(res => {
console.log(res);
res.forEach(att =>{
if (this.eventsList == null){
this.eventsList = new Array();
}
this.events.getEvent(att.ParentId).subscribe(event => {
this.eventsList.push(event);
console.log(this.eventsList);
});
});
});