Merge branch 'feature/agenda-new-api-eudes' of bitbucket.org:equilibriumito/gabinete-digital-fo into feature/agenda-new-api-peter

This commit is contained in:
Peter Maquiran
2024-05-31 15:50:00 +01:00
6 changed files with 73 additions and 14 deletions
@@ -74,6 +74,7 @@ export class EventToApproveDetailsMapper {
EmailAddress: e.emailAddress,
IsRequired: e.attendeeType == '0' ? true : false,
UserType: "GD",
wxUserId: e.wxUserId
}))
],
//"EventOrganizer": "{\"$type\":\"GabineteDigital.k2RESTidentifier_EventPerson, GabineteDigital, 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}",
@@ -103,11 +104,11 @@ export class EventToApproveDetailsMapper {
"Documents": null,
"PrivateMessage": null,
Attachments: dto.attachments.map( e => ({
DocId: '',
Description: '',
DocId: e.docId,
Description: e.sourceName,
Stakeholders: '',
CreateDate: '',
ApplicationId: 0,
ApplicationId: e.applicationId,
}))
}
}
@@ -84,6 +84,7 @@ export class ApproveEventPage implements OnInit {
if(res.isOk()) {
this.loadedEvent = res.value;
console.log('attachment',res.value)
this.loadedAttachments = this.loadedEvent.Attachments
this.today = new Date(res.value.workflowInstanceDataFields.StartDate);
//
@@ -350,9 +350,9 @@
<div class="d-flex container-div width-100" >
<ion-list class="width-100 ">
<ion-item class="width-100" *ngFor="let document of loadedAttachments; let i = index">
<ion-label class="width-100 d-block list" *ngIf="document.action != 'delete' ">
<ion-label class="width-100 d-block list" >
<p class="d-flex ion-justify-content-between">
<span class="attach-title-item">{{document.SourceName}}</span>
<span class="attach-title-item">{{document.Description}}</span>
<span class="app-name" *ngIf="document.ApplicationId == 8"> Correspondencia </span>
<span class="app-name" *ngIf="document.ApplicationId == 386"> AccoesPresidenciais </span>
<span class="app-name" *ngIf="document.ApplicationId == 361 "> ArquivoDespachoElect </span>
@@ -155,6 +155,7 @@ export class EditEventToApprovePage implements OnInit {
async getTask() {
const res: any = await this.agendaDataRepository.getEventToApproveById(this.serialNumber)
console.log('evento to apro to edit', res.value)
this.eventProcess = res.value;
this.eventProcess.workflowInstanceDataFields.LastOccurrence = new Date(this.eventProcess.workflowInstanceDataFields.LastOccurrence)
@@ -167,6 +168,8 @@ export class EditEventToApprovePage implements OnInit {
this.eventProcess.workflowInstanceDataFields.Category = this.eventProcess.workflowInstanceDataFields.EventType
this.InstanceId = this.eventProcess.workflowInstanceDataFields.InstanceId
this.loadedAttachments = res.value.Attachments;
console.log(this.loadedAttachments)
this.getAttachments()
this.setOtherData()
@@ -340,11 +343,6 @@ export class EditEventToApprovePage implements OnInit {
}
})
console.log(this.eventProcess.workflowInstanceDataFields.ParticipantsList)
return
const event: EventToApproveEdit = {
SerialNumber: this.eventProcess.serialNumber,
Body: this.eventProcess.workflowInstanceDataFields.Body,
@@ -377,6 +375,25 @@ export class EditEventToApprovePage implements OnInit {
console.log('edit event error: ', error)
}));
this.agendaDataRepository.addEventAttendee(this.eventProcess.serialNumber, { attendees: this.attendeesAdded(this.eventProcess.workflowInstanceDataFields.ParticipantsList) }).subscribe((value) => {
console.log(value)
}, ((error) => {
console.log('add Attendee error: ', error)
}));
this.agendaDataRepository.addEventAttachment(this.eventProcess.serialNumber, { attachments: this.documentAdded(this.loadedAttachments) }).subscribe((value) => {
console.log(value)
}, ((error) => {
this.showLoader = false
console.log('add attachment error: ', error)
}));
this.agendaDataRepository.removeEventAttachment(this.eventProcess.serialNumber, { attachments: [] }).subscribe((value) => {
console.log(value)
}, ((error) => {
this.showLoader = false
console.log('remove attachment error: ', error)
}));
this.close()
@@ -408,6 +425,39 @@ export class EditEventToApprovePage implements OnInit {
}
documentAdded(documents: any[]) {
console.log('document added', documents)
return documents.map((element) => {
return {
docId: parseInt(element.SourceId),
sourceName: element.SourceName,
description: "",
applicationId: parseInt(element.ApplicationId)
};
});
}
atendeesSeletedType(type) {
var selectedType = {
'true': 1,
'false': 2,
'other': 3,
}
return selectedType[type];
}
attendeesAdded(taskParticipants: any[]) {
return taskParticipants.map((e) => {
return {
name: e.Name,
emailAddress: e.EmailAddress,
attendeeType: this.atendeesSeletedType(JSON.stringify(e.IsRequired)),
wxUserId: e.wxUserId,
}
});
}
async gravasAction() {
await this.save();
@@ -522,7 +572,7 @@ export class EditEventToApprovePage implements OnInit {
}
deleteAttachment(attachment: Attachment, index) {
console.log(attachment)
this.loadedAttachments[index]['action'] = 'delete'
}
@@ -541,7 +591,7 @@ export class EditEventToApprovePage implements OnInit {
if(res){
const data: SearchList = res.data.selected;
console.log(data)
const DocumentToSave: any = {
SourceTitle: data.Assunto,
ParentId: this.InstanceId,
@@ -631,6 +631,7 @@ export class EditEventPage implements OnInit {
this.loadedEventAttachments = this.loadedEventAttachments.filter((e, i) => i != index)
} else {
this.loadedEventAttachments[index]['remove'] = true
console.log(id)
this.deletedAttachmentsList.push(id)
}
@@ -164,11 +164,17 @@ export class ViewEventPage implements OnInit {
deleteEvent_v2() {
console.log(this.loadedEvent.EventId)
const loader = this.toastService.loading()
this.agendaDataRepository.deleteEvent(this.loadedEvent.EventId).subscribe(() => {
console.log()
},((error) => {
this.httpErrorHandle.httpsSucessMessagge('delete event')
this.close();
},(error) => {
console.log('delete event error: ',error)
}))
this.httpErrorHandle.httpStatusHandle(error)
},()=>{
loader.remove();
});
}
async deleteEvent() {