Edit event to aprove

This commit is contained in:
Peter Maquiran
2021-05-14 14:37:38 +01:00
parent ca85464749
commit e0a91ddbd1
5 changed files with 177 additions and 19 deletions
@@ -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();
// });
}
});