diff --git a/src/app/models/attachment.model.ts b/src/app/models/attachment.model.ts index ac1f8ca87..f3d459083 100644 --- a/src/app/models/attachment.model.ts +++ b/src/app/models/attachment.model.ts @@ -1,7 +1,6 @@ export class Attachment { Id: number; ParentId: string; - Sources: Sources; Source?: Sources; ApplicationId: number CreateDate: string diff --git a/src/app/models/event.model.ts b/src/app/models/event.model.ts index 8f3e88770..11927ec8a 100644 --- a/src/app/models/event.model.ts +++ b/src/app/models/event.model.ts @@ -22,4 +22,27 @@ export class Event{ Categories: string[]; HasAttachments: boolean; // documents?: SearchDocument[] +} + +export class EventToApproveEdit { + "serialNumber": "9296_86" + "Body": "Testando" + "Location": "Testland" + "Subject": "Teste 0123" + "StartDate": "2021-05-12T10:30:00" + "EndDate": "2021-05-12T11:30:00" + "Private": false + "ReviewerComments": "" + "MDName": "Paulo Pinto" + "MDEmail": "paulo.pinto@gabinetedigital.local" + "Agenda": "Oficial" | "Pessoal" + "EventType": "Reunião" + "IsRecurring": false + "IsAllDayEvent": true + "ParticipantsList": { + "EmailAddress": "gilson.manuel@gabinetedigital.local", + "Name": "Gilson Manuel", + "IsRequired": true + }[] + "Message": "Recebeu um novo" } \ No newline at end of file diff --git a/src/app/services/events.service.ts b/src/app/services/events.service.ts index d2c63d8e2..e5f70536f 100644 --- a/src/app/services/events.service.ts +++ b/src/app/services/events.service.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { Event } from '../models/event.model'; +import { Event, EventToApproveEdit } from '../models/event.model'; import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http'; import { Observable } from 'rxjs'; import { environment } from 'src/environments/environment'; @@ -223,4 +223,14 @@ export class EventsService { console.log(res); }); } + + postEventToApproveEdit(body: EventToApproveEdit) { + const geturl = environment.apiURL + 'Tasks/EditEventTask'; + + let options = { + headers: this.headers, + }; + + return this.http.post(`${geturl}`, body, options) + } } diff --git a/src/app/shared/gabinete-digital/edit-event-to-approve/edit-event.page.html b/src/app/shared/gabinete-digital/edit-event-to-approve/edit-event.page.html index 21c3b379b..9641ce6ff 100644 --- a/src/app/shared/gabinete-digital/edit-event-to-approve/edit-event.page.html +++ b/src/app/shared/gabinete-digital/edit-event-to-approve/edit-event.page.html @@ -14,7 +14,7 @@ - + {{ eventProcess.serialNumber }}
diff --git a/src/app/shared/gabinete-digital/edit-event-to-approve/edit-event.page.ts b/src/app/shared/gabinete-digital/edit-event-to-approve/edit-event.page.ts index 2102d225e..e9a729e0f 100644 --- a/src/app/shared/gabinete-digital/edit-event-to-approve/edit-event.page.ts +++ b/src/app/shared/gabinete-digital/edit-event-to-approve/edit-event.page.ts @@ -2,12 +2,13 @@ import { Component, OnInit } from '@angular/core'; import { AlertController, ModalController, NavParams } from '@ionic/angular'; import { Attachment } from 'src/app/models/attachment.model'; import { EventPerson } from 'src/app/models/eventperson.model'; +import { SearchDocument } from 'src/app/models/search-document'; import { AttendeesPage } from 'src/app/pages/events/attendees/attendees.page'; import { SearchPage } from 'src/app/pages/search/search.page'; import { AttachmentsService } from 'src/app/services/attachments.service'; import { EventsService } from 'src/app/services/events.service'; import { ProcessesService } from 'src/app/services/processes.service'; -import { Event } from '../../../models/event.model'; +import { Event, EventToApproveEdit } from '../../../models/event.model'; @Component({ @@ -22,6 +23,7 @@ export class EditEventToApproveComponent implements OnInit { eventProcess = { + serialNumber: "", taskStartDate: "", workflowInstanceDataFields:{ Body: "", @@ -31,10 +33,86 @@ export class EditEventToApproveComponent implements OnInit { EndDate: '', Location: '', Subject: '', - InstanceId: '' + InstanceId: '', + EventType: '', + StartDate: '', + MDEmail: '', + MDName: '', + IsAllDayEvent: '', + Message: '' } } + // event ={ + // "serialNumber":"9073_118", + // "originator":{ + // "email":"gilson.manuel@gabinetedigital.local", + // "manager":"", + // "displayName":"", + // "fqn":"K2:GABINETEDIGITAL\\gilson.manuel", + // "username":"GABINETEDIGITAL\\gilson.manuel" + // }, + // "actions":null, + // "workflowInstanceFolio":"Final do sprint", + // "taskStartDate":"4/30/2021 9:06:48 AM", + // "workflowID":4365, + // "workflowInstanceID":9073, + // "workflowName":"MDGPR\\Agenda Oficial MDGPR", + // "workflowDisplayName":"Agenda Oficial MDGPR", + // "formURL":"http://bpmdev.gabinetedigital.local/Runtime/Runtime/Form/Exchange+Calendar+Meeting+Approval/?SerialNo=9073_118", + // "workflowInstanceDataFields": { + // "Body":"Será fechado o sprint 1 - 26 Abr - 30 Abr", + // "Location":"Equilibrium - Sala de reuniões", + // "Subject":"Final do sprint", + // "StartDate":"2021-04-30T15:00:00", + // "EndDate":"2021-04-30T15:30:00", + // "Participants":"gilson.manuel@gabinetedigital.local;tiago.kayaya@gabinetedigital.local;solange.vandunem@gabinetedigital.local", + // "CC":"", + // "ReviewerComments":"teste", + // "Role":0, + // "MDName":"Paulo Pinto", + // "MDEmail":"paulo.pinto@gabinetedigital.local", + // "PREmail":"", + // "OriginatorComments":"", + // "Status":"Active", + // "TimeZone":"W. Central Africa Standard Time", + // "Agenda":"Oficial", + // "EventType":"Reunião", + // "EventID":"", + // "IsRecurring":false, + // "ParticipantsList":[ + // { + // "$type":null, + // "EmailAddress":"gilson.manuel@gabinetedigital.local", + // "Name":"Gilson Manuel", + // "IsRequired":true + // }, + // { + // "$type":null, + // "EmailAddress":"tiago.kayaya@gabinetedigital.local", + // "Name":"Tiago Kayaya", + // "IsRequired":true + // }, + // { + // "$type":null, + // "EmailAddress":"solange.vandunem@gabinetedigital.local", + // "Name":"Solange Van-Dúnem", + // "IsRequired":true + // } + // ], + // "EventOrganizer":"{\"$type\":\"Gabinete.k2RESTidentifier_EventPerson, Gabinete, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null\",\"EmailAddress\":\"agenda.mdgpr@gabinetedigital.local\",\"Name\":\"Agenda do Ministro e Director do Gabinete do PR\",\"IsRequired\":true}", + // "CreateEvent":"", + // "IsAllDayEvent":false, + // "SerializedItem":"{\"$type\":\"GabineteDigitalV4.k2RESTidentifier_NotificationData[], GabineteDigitalV4, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null\",\"$values\":[{\"$type\":\"GabineteDigitalV4.k2RESTidentifier_NotificationData, GabineteDigitalV4, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null\",\"Service\":\"gabinete-digital\",\"Object\":\"event-list\",\"idObject\":\"9073_118\"}]}", + // "MDwxUserID":261, + // "DeserializedItem":"{\"$type\":\"GabineteDigitalV4.k2RESTidentifier_NotificationData, GabineteDigitalV4, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null\",\"Service\":\"gabinete-digital\",\"Object\":\"event-list\",\"idObject\":\"9073_118\"}", + // "Message":"Foi actualizado o", + // "InstanceId":"R0RfR0FCSU5FVEVESUdJVEFMXGdpbHNvbi5tYW51ZWxfMjAyMS0wNC0zMCAwODowNDoyN1o=", + // "For Each Result":"", + // "For Each Index":0 + // } + // } + show = false postEvent: Event; @@ -79,7 +157,6 @@ export class EditEventToApproveComponent implements OnInit { const result = await this.processes.GetTask(this.serialNumber).subscribe( result =>{ this.eventProcess = result - console.log('this.eventProcess', this.eventProcess); console.log(this.eventProcess.workflowInstanceDataFields.Subject) @@ -141,10 +218,41 @@ export class EditEventToApproveComponent implements OnInit { this.modalController.dismiss(); } - save() { + save() { + this.taskParticipantsCc.forEach(e => { + e.is + }); + + + this.taskParticipantsCc.forEach(e=>{ + e.IsRequired = false + }) + this.eventProcess.workflowInstanceDataFields.ParticipantsList = this.taskParticipants.concat(this.taskParticipantsCc) + + const event: any = { + Agenda: this.eventProcess.workflowInstanceDataFields.Agenda, + Body: this.eventProcess.workflowInstanceDataFields.Body, + EndDate: this.eventProcess.workflowInstanceDataFields.EndDate, + EventType: this.eventProcess.workflowInstanceDataFields.EventType, + IsAllDayEvent: this.eventProcess.workflowInstanceDataFields.IsAllDayEvent, + IsRecurring: this.eventProcess.workflowInstanceDataFields.IsRecurring, + Location: this.eventProcess.workflowInstanceDataFields.Location, + Subject: this.eventProcess.workflowInstanceDataFields.Subject, + serialNumber: this.eventProcess.serialNumber, + StartDate: this.eventProcess.workflowInstanceDataFields.StartDate, + MDEmail: this.eventProcess.workflowInstanceDataFields.MDEmail, + MDName: this.eventProcess.workflowInstanceDataFields.MDName, + Message: this.eventProcess.workflowInstanceDataFields.Message, + ParticipantsList: this.eventProcess.workflowInstanceDataFields.ParticipantsList, + Private: false, + ReviewerComments: '' + } + + this.eventsService.postEventToApproveEdit(event).subscribe() + alert('save') } async openAttendees() { @@ -208,17 +316,27 @@ export class EditEventToApproveComponent implements OnInit { async getAttachments() { - this.loadedAttachments = await this.attachmentsService.getAttachmentsById(this.InstanceId).toPromise(); - console.log('this.loadedAttachments', this.loadedAttachments) + let result: any = await this.attachmentsService.getAttachmentsById(this.InstanceId).toPromise(); + + result.forEach((e)=>{ + e.action = false + }) + + this.loadedAttachments = result + + console.log('this.loadedAttachments', this.loadedAttachments, result) } - deleteAttachment(attachmentID: string) { + deleteAttachment(attachmentID) { + + const AttachmentToDelete = this.loadedAttachments.filter(e => e.Id == attachmentID)[0] this.attachmentsService.deleteEventAttachmentById(attachmentID).subscribe( res=>{ this.loadedAttachments = this.loadedAttachments.filter(e=> e.Id.toString() != attachmentID); }) + } async getDoc() { @@ -235,23 +353,31 @@ export class EditEventToApproveComponent implements OnInit { modal.onDidDismiss().then( async (res)=>{ if(res){ - const data = res.data; + const data: SearchDocument = res.data.selected; - const DocumentToSave = { - SourceTitle: data.selected.Assunto, + const DocumentToSave: any = { + SourceTitle: data.Assunto, ParentId: this.InstanceId, Source: '1', - SourceId: data.selected.Id, - ApplicationId: data.selected.ApplicationType.toString(), + SourceId: data.Id, + ApplicationId: data.ApplicationType.toString(), Id: '', Link: '', SerialNumber: '', - toAdd: true + action: 'add', + CreateDate: data.Data, + Data: data.Data, + Description: data.DocTypeDesc, + SourceName: data.Assunto, + Stakeholders: data.EntidadeOrganicaNome, }; - await this.attachmentsService.setEventAttachmentById(DocumentToSave).subscribe(()=>{ - this.getAttachments(); - }); + + this.loadedAttachments.push(DocumentToSave) + + // await this.attachmentsService.setEventAttachmentById(DocumentToSave).subscribe(()=>{ + // this.getAttachments(); + // }); } });