teste mobile done!

This commit is contained in:
Eudes Inácio
2024-06-04 09:38:11 +01:00
parent 9265622e65
commit 9fcf116102
19 changed files with 468 additions and 281 deletions
@@ -389,11 +389,11 @@
</div> </div>
<div class="d-flex container-div width-100" *ngFor="let document of loadedEventAttachments; let i = index" > <div class="d-flex container-div width-100" *ngFor="let document of loadedEventAttachments; let i = index" >
<ion-list class="width-100 list" *ngIf="!document.remove"> <ion-list class="width-100 list">
<ion-item class="width-100 ion-no-border ion-no-padding"> <ion-item class="width-100 ion-no-border ion-no-padding">
<ion-label class="width-100"> <ion-label class="width-100">
<p class="p-item-title d-flex ion-justify-content-between"> <p class="p-item-title d-flex ion-justify-content-between">
<span class="attach-title-item">{{document.SourceName}}</span> <span class="attach-title-item">{{document.subject || document.SourceName || document.sourceName}}</span>
<span class="close-button text-black" (click)="deleteAttachment(document.Id, i)" > <span class="close-button text-black" (click)="deleteAttachment(document.Id, i)" >
<ion-icon class="font-20" src="assets/images/icons-delete-25.svg"></ion-icon> <ion-icon class="font-20" src="assets/images/icons-delete-25.svg"></ion-icon>
</span> </span>
@@ -435,7 +435,7 @@
<ion-footer class="ion-no-border"> <ion-footer class="ion-no-border">
<ion-toolbar class="footer-toolbar px-20"> <ion-toolbar class="footer-toolbar px-20">
<ion-buttons slot="start"> <ion-buttons slot="start">
<button class="btn-ok" fill="clear" color="#fff" (click)="save()"> <button class="btn-ok" fill="clear" color="#fff" (click)="save_v2()">
<ion-label>Gravar</ion-label> <ion-label>Gravar</ion-label>
</button> </button>
</ion-buttons> </ion-buttons>
@@ -19,6 +19,7 @@ import { HttpErrorHandle } from 'src/app/services/http-error-handle.service'
import { environment } from 'src/environments/environment'; import { environment } from 'src/environments/environment';
import { ContactsService } from 'src/app/services/contacts.service'; import { ContactsService } from 'src/app/services/contacts.service';
import { DomSanitizerService } from 'src/app/services/DomSanitizer.service'; import { DomSanitizerService } from 'src/app/services/DomSanitizer.service';
import { AgendaDataRepositoryService } from 'src/app/services/Repositorys/Agenda/agenda-data-repository.service';
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = { const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
parse: { parse: {
@@ -89,6 +90,8 @@ export class EditEventPage implements OnInit {
sesseionStora = SessionStore sesseionStora = SessionStore
environment = environment environment = environment
allDayCheck: boolean = false; allDayCheck: boolean = false;
deletedAttachmentsList = [];
addedAttachmentsList = [];
constructor( constructor(
private modalController: ModalController, private modalController: ModalController,
@@ -101,7 +104,8 @@ export class EditEventPage implements OnInit {
public ThemeService: ThemeService, public ThemeService: ThemeService,
private httpErrorHandle: HttpErrorHandle, private httpErrorHandle: HttpErrorHandle,
private contactsService: ContactsService, private contactsService: ContactsService,
private domSanitazerService: DomSanitizerService private domSanitazerService: DomSanitizerService,
private agendaDataRepository: AgendaDataRepositoryService
) { ) {
/* this.postEvent = new Event(); */ /* this.postEvent = new Event(); */
@@ -123,6 +127,8 @@ export class EditEventPage implements OnInit {
this.postEvent.Attendees[index].UserType = userData.UserType this.postEvent.Attendees[index].UserType = userData.UserType
} }
console.log('jhv',this.postEvent.Category)
} }
@@ -155,15 +161,15 @@ export class EditEventPage implements OnInit {
this.isRecurring = "Repete"; this.isRecurring = "Repete";
} }
this.getAttachments(this.postEvent.EventId); this.loadedEventAttachments = this.postEvent?.Attachments
this.CalendarNameOwnerName = this.eventsService.detectCalendarNameByCalendarId(this.postEvent.CalendarId) this.CalendarNameOwnerName = this.eventsService.detectCalendarNameByCalendarId(this.postEvent.CalendarId)
this.changeAgenda() this.changeAgenda()
} }
ngOnInit() { ngOnInit() {
console.log(this.postEvent?.Attachments)
console.log(this.loadedEventAttachments)
window.onresize = (event) => { window.onresize = (event) => {
// if not mobile remove all component // if not mobile remove all component
if (window.innerWidth >= 1024) { if (window.innerWidth >= 1024) {
@@ -202,7 +208,7 @@ export class EditEventPage implements OnInit {
} }
cancel() { cancel() {
this.modalController.dismiss({action:'cancel'}); this.modalController.dismiss({ action: 'cancel' });
} }
goBack() { goBack() {
@@ -358,6 +364,59 @@ export class EditEventPage implements OnInit {
} }
} }
async save_v2() {
this.injectValidation()
this.runValidation()
if (this.Form.invalid) {
return false
}
this.postEvent.Attendees = this.taskParticipants.concat(this.taskParticipantsCc);
try {
this.agendaDataRepository.updateEvent(this.postEvent.EventId, this.postEvent).subscribe((value) => {
console.log(value)
}, ((error) => {
console.log('edit event error: ', error)
}));
this.agendaDataRepository.addEventAttendee(this.postEvent.EventId, this.postEvent.Attendees).subscribe((value) => {
console.log(value)
}, ((error) => {
console.log('add Attendee error: ', error)
}));
await this.saveDocument()
if (this.addedAttachmentsList.length > 0) {
this.agendaDataRepository.addEventAttachment(this.postEvent.EventId, this.loadedEventAttachments).subscribe((value) => {
console.log(value)
}, ((error) => {
console.log('add attachment error: ', error)
}));
}
if (this.deletedAttachmentsList.length > 0) {
this.agendaDataRepository.removeEventAttachment(this.postEvent.EventId, { attachments: this.deletedAttachmentsList }).subscribe((value) => {
console.log(value)
}, ((error) => {
console.log('remove attachment error: ', error)
}));
}
this.isEventEdited = true;
this.goBack();
this.httpErrorHandle.httpsSucessMessagge('Editar evento')
} catch (error) {
this.httpErrorHandle.httpStatusHandle(error)
console.log('edit: ', error)
}
}
async save() { async save() {
@@ -403,7 +462,7 @@ export class EditEventPage implements OnInit {
this.httpErrorHandle.httpStatusHandle(error) this.httpErrorHandle.httpStatusHandle(error)
}); });
} else { } else {
console.log('edid calendar id',this.postEvent.CalendarId); console.log('edid calendar id', this.postEvent.CalendarId);
this.eventsService.editEvent(this.postEvent, 2, 3, this.postEvent.CalendarId).subscribe(async () => { this.eventsService.editEvent(this.postEvent, 2, 3, this.postEvent.CalendarId).subscribe(async () => {
if (window['reloadCalendar']) { if (window['reloadCalendar']) {
@@ -568,12 +627,13 @@ export class EditEventPage implements OnInit {
deleteAttachment(attachmentID: string, index) { deleteAttachment(attachmentID: string, index) {
const id: any = this.loadedEventAttachments[index].Id const id: any = this.loadedEventAttachments[index].Id
this.deletedAttachmentsList.push(id)
if (id == 'add') { /* if (id == 'add') {
this.loadedEventAttachments = this.loadedEventAttachments.filter((e, i) => i != index) this.loadedEventAttachments = this.loadedEventAttachments.filter((e, i) => i != index)
} else { } else {
this.loadedEventAttachments[index]['remove'] = true this.loadedEventAttachments[index]['remove'] = true
} } */
} }
@@ -585,6 +645,7 @@ export class EditEventPage implements OnInit {
componentProps: { componentProps: {
type: 'AccoesPresidenciais & ArquivoDespachoElect', type: 'AccoesPresidenciais & ArquivoDespachoElect',
showSearchInput: true, showSearchInput: true,
eventAgenda: true,
select: true, select: true,
} }
}); });
@@ -593,7 +654,7 @@ export class EditEventPage implements OnInit {
if (res) { if (res) {
const data = res.data; const data = res.data;
const ApplicationIdDocumentToSave: any = { /* const ApplicationIdDocumentToSave: any = {
SourceName: data.selected.Assunto, SourceName: data.selected.Assunto,
ParentId: this.postEvent.EventId, ParentId: this.postEvent.EventId,
SourceId: data.selected.Id, SourceId: data.selected.Id,
@@ -606,11 +667,11 @@ export class EditEventPage implements OnInit {
Source: '1', Source: '1',
Link: '', Link: '',
SerialNumber: '', SerialNumber: '',
} } */
this.loadedEventAttachments.push(ApplicationIdDocumentToSave) this.loadedEventAttachments.push(data.selected)
this.postEvent.Attachments = this.loadedEventAttachments; this.addedAttachmentsList.push(data.selected)
} }
}) })
@@ -8,6 +8,7 @@ import { ThemeService } from 'src/app/services/theme.service'
import { RouteService } from 'src/app/services/route.service'; import { RouteService } from 'src/app/services/route.service';
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service'; import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
import { TaskService } from 'src/app/services/task.service' import { TaskService } from 'src/app/services/task.service'
import { AgendaDataRepositoryService } from 'src/app/services/Repositorys/Agenda/agenda-data-repository.service';
@Component({ @Component({
@@ -16,20 +17,21 @@ import { TaskService } from 'src/app/services/task.service'
styleUrls: ['./event-actions-popover.page.scss'], styleUrls: ['./event-actions-popover.page.scss'],
}) })
export class EventActionsPopoverPage implements OnInit { export class EventActionsPopoverPage implements OnInit {
serialNumber:string; serialNumber: string;
instanceId: string; instanceId: string;
activityInstanceName: string activityInstanceName: string
constructor( constructor(
private navParams: NavParams, private navParams: NavParams,
private processes:ProcessesService, private processes: ProcessesService,
private modalController: ModalController, private modalController: ModalController,
private popoverController: PopoverController, private popoverController: PopoverController,
private toastService: ToastService, private toastService: ToastService,
private RouteService: RouteService, private RouteService: RouteService,
private httpErrorHandle: HttpErrorHandle, private httpErrorHandle: HttpErrorHandle,
public ThemeService: ThemeService, public ThemeService: ThemeService,
public TaskService: TaskService) { public TaskService: TaskService,
private agendaDataRepository: AgendaDataRepositoryService) {
this.serialNumber = this.navParams.get('serialNumber'); this.serialNumber = this.navParams.get('serialNumber');
this.instanceId = this.navParams.get('InstanceId'); this.instanceId = this.navParams.get('InstanceId');
this.activityInstanceName = this.navParams.get('InstanceId'); this.activityInstanceName = this.navParams.get('InstanceId');
@@ -37,7 +39,7 @@ export class EventActionsPopoverPage implements OnInit {
ngOnInit() { ngOnInit() {
window.onresize = (event) => { window.onresize = (event) => {
if( window.innerWidth >= 800){ if (window.innerWidth >= 800) {
this.popoverController.dismiss(); this.popoverController.dismiss();
} }
}; };
@@ -56,13 +58,20 @@ export class EventActionsPopoverPage implements OnInit {
async approveTask() { async approveTask() {
let body = { "serialNumber": this.serialNumber, "action": "Aprovar" } let body = { "serialNumber": this.serialNumber, "action": "Aprovar" }
const loader = this.toastService.loading() const loader = this.toastService.loading()
try { try {
await this.processes.PostTaskAction(body).toPromise() /* await this.processes.PostTaskAction(body).toPromise() */
this.agendaDataRepository.eventToaprovalStatus(this.serialNumber, 'Approved').subscribe((value) => {
console.log(value)
this.TaskService.loadEventosParaAprovacao() this.TaskService.loadEventosParaAprovacao()
this.httpErrorHandle.httpsSucessMessagge('Evento aprovação') this.httpErrorHandle.httpsSucessMessagge('Evento aprovação')
this.goBack(); this.goBack();
}, ((error) => {
console.log('aprove event error: ', error)
this.httpErrorHandle.httpStatusHandle(error)
}))
} catch (error) { } catch (error) {
this.httpErrorHandle.httpStatusHandle(error) this.httpErrorHandle.httpStatusHandle(error)
} }
@@ -96,7 +105,7 @@ export class EventActionsPopoverPage implements OnInit {
const modal = await this.modalController.create({ const modal = await this.modalController.create({
component: EmendMessageModalPage, component: EmendMessageModalPage,
componentProps:{ componentProps: {
}, },
cssClass: 'emend-message-modal', cssClass: 'emend-message-modal',
backdropDismiss: false backdropDismiss: false
@@ -104,11 +113,12 @@ export class EventActionsPopoverPage implements OnInit {
modal.onDidDismiss() modal.onDidDismiss()
.then( async (res) => { .then(async (res) => {
if(res.data.option == 'save') { if (res.data.option == 'save') {
let body = { "serialNumber": this.serialNumber, let body = {
"serialNumber": this.serialNumber,
"action": "Emendar", "action": "Emendar",
"dataFields": { "dataFields": {
"ReviewUserComment": res.data, "ReviewUserComment": res.data,
@@ -119,10 +129,15 @@ export class EventActionsPopoverPage implements OnInit {
const loader = this.toastService.loading() const loader = this.toastService.loading()
try { try {
await this.processes.PostTaskAction(body).toPromise(); /* await this.processes.PostTaskAction(body).toPromise(); */
this.agendaDataRepository.eventToaprovalStatus(this.serialNumber, 'Revision').subscribe((value) => {
this.httpErrorHandle.httpsSucessMessagge('Rever') this.httpErrorHandle.httpsSucessMessagge('Rever')
this.TaskService.loadEventosParaAprovacao() this.TaskService.loadEventosParaAprovacao()
this.goBack(); this.goBack();
}, ((error) => {
console.log('send event to revision error: ', error)
this.httpErrorHandle.httpStatusHandle(error)
}));
} catch (error) { } catch (error) {
this.httpErrorHandle.httpStatusHandle(error) this.httpErrorHandle.httpStatusHandle(error)
} }
@@ -144,10 +159,15 @@ export class EventActionsPopoverPage implements OnInit {
const loader = this.toastService.loading(); const loader = this.toastService.loading();
try { try {
await this.processes.PostTaskAction(body).toPromise(); /* await this.processes.PostTaskAction(body).toPromise(); */
this.agendaDataRepository.eventToaprovalStatus(this.serialNumber, 'Declined').subscribe((value) => {
this.TaskService.loadEventosParaAprovacao() this.TaskService.loadEventosParaAprovacao()
this.httpErrorHandle.httpsSucessMessagge('Rejeitar') this.httpErrorHandle.httpsSucessMessagge('Rejeitar')
this.goBack(); this.goBack();
}, ((error) => {
console.log('reject event error: ', error)
this.httpErrorHandle.httpStatusHandle(error)
}))
} catch (error) { } catch (error) {
this.httpErrorHandle.httpStatusHandle(error) this.httpErrorHandle.httpStatusHandle(error)
} }
@@ -171,7 +191,7 @@ export class EventActionsPopoverPage implements OnInit {
}); });
modal.onDidDismiss().then(res => {}); modal.onDidDismiss().then(res => { });
await modal.present(); await modal.present();
@@ -95,7 +95,7 @@
<ion-item *ngFor="let attach of loadedEvent.Attachments; let i = index" class="width-100" class="ion-no-margin ion-no-padding"> <ion-item *ngFor="let attach of loadedEvent.Attachments; let i = index" class="width-100" class="ion-no-margin ion-no-padding">
<ion-label class="width-100 d-flex " (click)="docIndex(i);LoadDocumentDetails()"> <ion-label class="width-100 d-flex " (click)="docIndex(i);LoadDocumentDetails()">
<p class="flex-grow-1" > <p class="flex-grow-1" >
<span class="attach-title-item d-block">{{attach.SourceName || 'Sem título'}}</span> <span class="attach-title-item d-block">{{attach.SourceName || attach.subject || attach.sourceName || 'Sem título'}}</span>
<span class="span-left d-block">{{attach.Stakeholders}}</span> <span class="span-left d-block">{{attach.Stakeholders}}</span>
</p> </p>
@@ -16,7 +16,7 @@ import { StorageService } from 'src/app/services/storage.service';
import { ThemeService } from 'src/app/services/theme.service' import { ThemeService } from 'src/app/services/theme.service'
import { RouteService } from 'src/app/services/route.service'; import { RouteService } from 'src/app/services/route.service';
import { SessionStore } from 'src/app/store/session.service'; import { SessionStore } from 'src/app/store/session.service';
import { HttpErrorHandle} from 'src/app/services/http-error-handle.service' import { HttpErrorHandle } from 'src/app/services/http-error-handle.service'
import { AttachmentsService } from 'src/app/services/attachments.service'; import { AttachmentsService } from 'src/app/services/attachments.service';
import { DateService } from 'src/app/services/date.service'; import { DateService } from 'src/app/services/date.service';
import { AgendaDataRepositoryService } from 'src/app/services/Repositorys/Agenda/agenda-data-repository.service'; import { AgendaDataRepositoryService } from 'src/app/services/Repositorys/Agenda/agenda-data-repository.service';
@@ -155,7 +155,7 @@ export class ViewEventPage implements OnInit {
// }); // });
// } // }
openOptions() {} openOptions() { }
close() { close() {
this.modalController.dismiss(this.isEventEdited); this.modalController.dismiss(this.isEventEdited);
@@ -194,7 +194,7 @@ export class ViewEventPage implements OnInit {
let res = await this.agendaDataRepository.getEventById(this.eventId) let res = await this.agendaDataRepository.getEventById(this.eventId)
if(res.isOk()) { if (res.isOk()) {
console.log('Loaded Event', res.value) console.log('Loaded Event', res.value)
loader.remove() loader.remove()
let changeDate = this.dateService.fixDate(res.value as any) as any let changeDate = this.dateService.fixDate(res.value as any) as any
@@ -210,7 +210,7 @@ export class ViewEventPage implements OnInit {
} }
loadEvent1() { /* loadEvent1() {
if(this.sesseionStora.user.Profile == 'MDGPR' || this.sesseionStora.user.Profile == 'PR') { if(this.sesseionStora.user.Profile == 'MDGPR' || this.sesseionStora.user.Profile == 'PR') {
@@ -239,7 +239,7 @@ export class ViewEventPage implements OnInit {
} }
} } */
deleteYesOrNo() { deleteYesOrNo() {
this.alertController.create({ this.alertController.create({
@@ -268,7 +268,31 @@ export class ViewEventPage implements OnInit {
const loader = this.toastService.loading() const loader = this.toastService.loading()
if(this.sesseionStora.user.Profile == 'MDGPR' || this.sesseionStora.user.Profile == 'PR') {
console.log(this.loadedEvent.EventId)
this.agendaDataRepository.deleteEvent(this.loadedEvent.EventId).subscribe(async () => {
const alert = await this.alertController.create({
cssClass: 'my-custom-class',
header: 'Evento removido',
buttons: ['OK']
});
setTimeout(() => {
alert.dismiss();
}, 1500);
this.goBack();
this.httpErrorHandle.httpsSucessMessagge('delete event')
}, (error) => {
console.log('delete event error: ', error)
this.httpErrorHandle.httpStatusHandle(error)
}, () => {
loader.remove();
});
/* if (this.sesseionStora.user.Profile == 'MDGPR' || this.sesseionStora.user.Profile == 'PR') {
this.eventsService.deleteEvent(this.loadedEvent.EventId, 0, this.loadedEvent.CalendarName).subscribe(async () => { this.eventsService.deleteEvent(this.loadedEvent.EventId, 0, this.loadedEvent.CalendarName).subscribe(async () => {
const alert = await this.alertController.create({ const alert = await this.alertController.create({
cssClass: 'my-custom-class', cssClass: 'my-custom-class',
@@ -308,7 +332,7 @@ export class ViewEventPage implements OnInit {
}); });
} } */
} }
@@ -360,8 +384,8 @@ export class ViewEventPage implements OnInit {
if (res) { if (res) {
setTimeout(() => { setTimeout(() => {
/* this.loadEvent(); */ this.loadEvent();
this.loadEvent1() /* this.loadEvent1() */
}, 250); }, 250);
this.isEventEdited = true; this.isEventEdited = true;
console.log('res', res, res.data?.action, 'cancel') console.log('res', res, res.data?.action, 'cancel')
@@ -394,13 +418,13 @@ export class ViewEventPage implements OnInit {
if (res.data?.action == 'cancel') { if (res.data?.action == 'cancel') {
setTimeout(() => { setTimeout(() => {
/* this.loadEvent(); */ this.loadEvent();
this.loadEvent1() /* this.loadEvent1() */
}, 250); }, 250);
this.isEventEdited = true; this.isEventEdited = true;
if(res.data.Attendees?.length >= 1) { if (res.data.Attendees?.length >= 1) {
this.loadedEvent.HasAttachments = true this.loadedEvent.HasAttachments = true
this.getAttachments() this.getAttachments()
} }
@@ -413,7 +437,7 @@ export class ViewEventPage implements OnInit {
}, 250); }, 250);
this.isEventEdited = true; this.isEventEdited = true;
if(res.data.Attendees?.length >= 1) { if (res.data.Attendees?.length >= 1) {
this.loadedEvent.HasAttachments = true this.loadedEvent.HasAttachments = true
this.getAttachments() this.getAttachments()
} }
@@ -432,11 +456,11 @@ export class ViewEventPage implements OnInit {
getAttachments() { getAttachments() {
if(this.loadedEvent.HasAttachments) { if (this.loadedEvent.HasAttachments) {
this.attachmentsService.getAttachmentsById(this.loadedEvent.EventId).subscribe(res=>{ this.attachmentsService.getAttachmentsById(this.loadedEvent.EventId).subscribe(res => {
this.loadedEvent.Attachments = res; this.loadedEvent.Attachments = res;
},((erro) => { }, ((erro) => {
console.error('editgetAttchament', erro) console.error('editgetAttchament', erro)
})); }));
} }
@@ -95,7 +95,7 @@
*ngFor="let attachment of loadedAttachments" *ngFor="let attachment of loadedAttachments"
(click)="viewDocument(attachment.DocId, attachment)"> (click)="viewDocument(attachment.DocId, attachment)">
<ion-label> <ion-label>
<p class="attach-title-item d-block">{{attachment.Description || 'Sem título'}}</p> <p class="attach-title-item d-block">{{attachment.sourceName || attachment.Description || 'Sem título'}}</p>
<p><span class="span-left">{{attachment.Stakeholders}}</span><span class="span-right">{{ attachment.CreateDate | date: 'dd-MM-yyyy HH:mm' }}</span></p> <p><span class="span-left">{{attachment.Stakeholders}}</span><span class="span-right">{{ attachment.CreateDate | date: 'dd-MM-yyyy HH:mm' }}</span></p>
</ion-label> </ion-label>
</ion-item> </ion-item>
@@ -95,15 +95,16 @@ export class ApproveEventPage implements OnInit {
} }
async getTask () { async getTask() {
const res = await this.AgendaDataRepositoryService.getEventToApproveById(this.serialNumber) const res = await this.AgendaDataRepositoryService.getEventToApproveById(this.serialNumber)
console.log(res)
if(res.isOk()) { if (res.isOk()) {
this.loadedEvent = res.value; this.loadedEvent = res.value;
this.today = new Date(res.value.workflowInstanceDataFields.StartDate); this.today = new Date(res.value.workflowInstanceDataFields.StartDate);
// //
this.customDate = this.days[this.today.getDay()]+ ", " + this.today.getDate() +" de " + ( this.months[this.today.getMonth()]); this.customDate = this.days[this.today.getDay()] + ", " + this.today.getDate() + " de " + (this.months[this.today.getMonth()]);
this.loadedAttachments = res.value.Attachments
} else { } else {
console.log(res.error.status) console.log(res.error.status)
this.httpErrorHandle.httpStatusHandle(res.error) this.httpErrorHandle.httpStatusHandle(res.error)
@@ -117,11 +118,19 @@ export class ApproveEventPage implements OnInit {
const loader = this.toastService.loading() const loader = this.toastService.loading()
try { try {
this.AgendaDataRepositoryService.eventToaprovalStatus(serialNumber, 'Approved').subscribe(async (value) => {
await this.processes.PostTaskAction(body).toPromise() await this.processes.PostTaskAction(body).toPromise()
this.goBack(); this.goBack();
this.httpErrorHandle.httpsSucessMessagge('Evento aprovação') this.httpErrorHandle.httpsSucessMessagge('Evento aprovação')
this.TaskService.loadEventosParaAprovacao(); this.TaskService.loadEventosParaAprovacao();
}, ((error) => {
console.log('aprove event error: ', error)
this.httpErrorHandle.httpStatusHandle(error)
}))
} catch (error) { } catch (error) {
this.httpErrorHandle.httpStatusHandle(error) this.httpErrorHandle.httpStatusHandle(error)
} }
@@ -147,7 +156,7 @@ export class ApproveEventPage implements OnInit {
modal.onDidDismiss() modal.onDidDismiss()
.then(async (res) => { .then(async (res) => {
if(res.data.option == 'save') { if (res.data.option == 'save') {
let body = { let body = {
"serialNumber": serialNumber, "serialNumber": serialNumber,
@@ -161,14 +170,17 @@ export class ApproveEventPage implements OnInit {
const loader = this.toastService.loading() const loader = this.toastService.loading()
try { try {
await this.processes.PostTaskAction(body).toPromise()
.catch(() => {
this.offlineManager.storeRequestData('event-listRever', body); this.AgendaDataRepositoryService.eventToaprovalStatus(serialNumber, 'Revision').subscribe((value) => {
});
this.httpErrorHandle.httpsSucessMessagge('Rever') this.httpErrorHandle.httpsSucessMessagge('Rever')
this.TaskService.loadEventosParaAprovacao(); this.TaskService.loadEventosParaAprovacao();
this.goBack(); this.goBack();
}, ((error) => {
console.log('send event to revision error: ', error)
this.httpErrorHandle.httpStatusHandle(error)
this.offlineManager.storeRequestData('event-listRever', body);
}));
} catch (error) { } catch (error) {
this.httpErrorHandle.httpStatusHandle(error) this.httpErrorHandle.httpStatusHandle(error)
} finally { } finally {
@@ -190,10 +202,15 @@ export class ApproveEventPage implements OnInit {
const loader = this.toastService.loading() const loader = this.toastService.loading()
try { try {
await this.processes.PostTaskAction(body).toPromise(); /* await this.processes.PostTaskAction(body).toPromise(); */
this.AgendaDataRepositoryService.eventToaprovalStatus(serialNumber, 'Declined').subscribe((value) => {
this.httpErrorHandle.httpsSucessMessagge('Rejeitar') this.httpErrorHandle.httpsSucessMessagge('Rejeitar')
this.TaskService.loadEventosParaAprovacao(); this.TaskService.loadEventosParaAprovacao();
this.goBack(); this.goBack();
}, ((error) => {
console.log('reject event error: ', error)
this.httpErrorHandle.httpStatusHandle(error)
}))
} catch (error) { } catch (error) {
this.httpErrorHandle.httpStatusHandle(error) this.httpErrorHandle.httpStatusHandle(error)
} }
@@ -262,7 +279,7 @@ export class ApproveEventPage implements OnInit {
modal.onDidDismiss().then(async (res) => { modal.onDidDismiss().then(async (res) => {
if(res.data.option == 'save') { if (res.data.option == 'save') {
let body = { let body = {
"serialNumber": serialNumber, "serialNumber": serialNumber,
@@ -337,7 +354,7 @@ export class ApproveEventPage implements OnInit {
this.loadedAttachments = await this.attachmentsService.getAttachmentsById(this.loadedEvent.workflowInstanceDataFields.InstanceId).toPromise(); this.loadedAttachments = await this.attachmentsService.getAttachmentsById(this.loadedEvent.workflowInstanceDataFields.InstanceId).toPromise();
console.log(this.loadedAttachments) console.log(this.loadedAttachments)
} catch (error) { } catch (error) {
console.error('getAttchaments',error) console.error('getAttchaments', error)
} }
@@ -173,6 +173,7 @@ export class EventListPage implements OnInit {
} }
async LoadToApproveEvents() { async LoadToApproveEvents() {
console.log('aprove event')
this.showLoader = true; this.showLoader = true;
this.skeletonLoader = true this.skeletonLoader = true
@@ -25,6 +25,8 @@ export class AgendaDataRepositoryService {
try { try {
const result = await this.agendaDataService.getEvent(id).pipe( const result = await this.agendaDataService.getEvent(id).pipe(
map((response) => { map((response) => {
console.log('Response',response.data)
console.log('Output',EventMapper.toDomain(response.data))
return EventMapper.toDomain(response.data) return EventMapper.toDomain(response.data)
}) })
).toPromise() ).toPromise()
@@ -91,7 +93,7 @@ export class AgendaDataRepositoryService {
type: this.utils.calendarTypeSeleted(eventData.Category), type: this.utils.calendarTypeSeleted(eventData.Category),
category: this.utils.calendarCategorySeleted(eventData.CalendarName), category: this.utils.calendarCategorySeleted(eventData.CalendarName),
attendees: this.utils.attendeesAdded(eventData.Attendees), attendees: this.utils.attendeesAdded(eventData.Attendees),
attachments: documents, attachments: this.utils.documentAdded(documents),
recurrence: { recurrence: {
frequency: 0, frequency: 0,
occurrences: 0, occurrences: 0,
@@ -130,7 +132,7 @@ export class AgendaDataRepositoryService {
} }
addEventAttachment(id,attachmentData) { addEventAttachment(id,attachmentData) {
return this.agendaDataService.addEventAttachment(id,attachmentData); return this.agendaDataService.addEventAttachment(id,{ attachments: this.utils.documentAdded(attachmentData) });
} }
deleteEvent(eventId) { deleteEvent(eventId) {
@@ -25,10 +25,10 @@ export class EventMapper {
wxUserId: e.wxUserId, wxUserId: e.wxUserId,
EmailAddress: e.emailAddress, EmailAddress: e.emailAddress,
Name: e.name, Name: e.name,
IsRequired: e.attendeeType == '0' ? true : false, IsRequired: e.attendeeType == 'Required',
UserType: "GD", UserType: "GD",
// "IsPR": false, // "IsPR": false,
Acknowledgment: e.attendeeType == '0' ? true : false, attendeeType: e.attendeeType
// "RoleDescription": null, // "RoleDescription": null,
// "RoleId": 0 // "RoleId": 0
})), })),
@@ -72,9 +72,10 @@ export class EventToApproveDetailsMapper {
...dto.attendees.map( e => ({ ...dto.attendees.map( e => ({
Name: e.name, Name: e.name,
EmailAddress: e.emailAddress, EmailAddress: e.emailAddress,
IsRequired: e.attendeeType == '0' ? true : false, IsRequired: e.attendeeType == 'Required',
UserType: "GD", UserType: "GD",
wxUserId: e.wxUserId wxUserId: e.wxUserId,
attendeeType: e.attendeeType
})) }))
], ],
//"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}", //"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}",
@@ -104,6 +105,7 @@ export class EventToApproveDetailsMapper {
"Documents": null, "Documents": null,
"PrivateMessage": null, "PrivateMessage": null,
Attachments: dto.attachments.map( e => ({ Attachments: dto.attachments.map( e => ({
id: e.id,
DocId: e.docId, DocId: e.docId,
Description: e.sourceName, Description: e.sourceName,
Stakeholders: '', Stakeholders: '',
@@ -7,7 +7,7 @@ export const AttachmentInputDTOSchema = z.object({
description: z.string().nullable(), description: z.string().nullable(),
applicationId: z.number().int(), applicationId: z.number().int(),
}).strict(); }).strict();
const EAttendeeTypeDTO = z.enum(["0", "1", "2"]); const EAttendeeTypeDTO = z.enum(["Required", "Acknowledgment", "Optional"]);
const CommentSchema = z.object({ const CommentSchema = z.object({
+3 -3
View File
@@ -64,10 +64,10 @@ export class Utils {
console.log('added doc create event',documents) console.log('added doc create event',documents)
return documents.map((e) => { return documents.map((e) => {
return { return {
docId: parseInt(e.Id), docId: e.docId,
sourceName: e.Assunto, sourceName: e.subject || e.sourceNames,
description: "", description: "",
applicationId: parseInt(JSON.stringify(e.ApplicationType)) applicationId: e.applicationId
}; };
}); });
+1 -1
View File
@@ -55,7 +55,7 @@ export class DateService {
const month = String(date.getMonth() + 1).padStart(2,'0'); const month = String(date.getMonth() + 1).padStart(2,'0');
const fullYear = date.getFullYear(); const fullYear = date.getFullYear();
const formattedDate = `${fullYear}-${month}-${_date} 23:59`; const formattedDate = `${fullYear}-${month}-${_date} 23:59`;
res.EndDate = formattedDate res.EndDate = new Date(formattedDate).toISOString();
} }
@@ -129,9 +129,14 @@ export class ApproveEventPage implements OnInit {
const loader = this.toastService.loading() const loader = this.toastService.loading()
try { try {
await this.processes.PostTaskAction(body).toPromise() /* await this.processes.PostTaskAction(body).toPromise() */
this.agendaDataRepository.eventToaprovalStatus(serialNumber, 'Declined').subscribe((value) => {
this.httpErroHandle.httpsSucessMessagge('Rejeitar'); this.httpErroHandle.httpsSucessMessagge('Rejeitar');
this.TaskService.loadEventosParaAprovacao(); this.TaskService.loadEventosParaAprovacao();
}, ((error) => {
console.log('reject event error: ', error)
this.httpErroHandle.httpStatusHandle(error)
}))
} catch (error) { } catch (error) {
this.httpErroHandle.httpStatusHandle(error) this.httpErroHandle.httpStatusHandle(error)
@@ -143,7 +143,7 @@ export class EditEventToApprovePage implements OnInit {
} }
ngOnInit() { ngOnInit() {
console.log('here!!!')
if (this.restoreTemporaryData()) { if (this.restoreTemporaryData()) {
this.setOtherData() this.setOtherData()
} else { } else {
@@ -384,7 +384,7 @@ export class EditEventToApprovePage implements OnInit {
})); }));
if (this.addedAttachmentsList.length > 0) { if (this.addedAttachmentsList.length > 0) {
this.agendaDataRepository.addEventAttachment(this.eventProcess.serialNumber, { attachments: this.loadedAttachments }).subscribe((value) => { this.agendaDataRepository.addEventAttachment(this.eventProcess.serialNumber, this.loadedAttachments).subscribe((value) => {
console.log(value) console.log(value)
}, ((error) => { }, ((error) => {
this.showLoader = false this.showLoader = false
@@ -393,7 +393,7 @@ export class EditEventToApprovePage implements OnInit {
} }
if (this.deletedAttachmentsList.length > 0) { if (this.deletedAttachmentsList.length > 0) {
this.agendaDataRepository.removeEventAttachment(this.eventProcess.serialNumber, { attachments: [] }).subscribe((value) => { this.agendaDataRepository.removeEventAttachment(this.eventProcess.serialNumber, { attachments: this.deletedAttachmentsList }).subscribe((value) => {
console.log(value) console.log(value)
}, ((error) => { }, ((error) => {
this.showLoader = false this.showLoader = false
@@ -578,11 +578,13 @@ export class EditEventToApprovePage implements OnInit {
} }
deleteAttachment(attachment: Attachment, index) { deleteAttachment(attachment: Attachment, index) {
if (this.loadedEventAttachments[index].Id) {
const id: any = this.loadedEventAttachments[index].Id const id: any = this.loadedEventAttachments[index].Id
console.log(attachment) console.log(attachment)
this.loadedAttachments[index]['action'] = 'delete' this.loadedAttachments[index]['action'] = 'delete'
this.deletedAttachmentsList.push(id) this.deletedAttachmentsList.push(id)
} }
}
async getDoc() { async getDoc() {
const modal = await this.modalController.create({ const modal = await this.modalController.create({
@@ -374,7 +374,7 @@ export class EditEventPage implements OnInit {
await this.saveDocument() await this.saveDocument()
if (this.addedAttachmentsList.length > 0) { if (this.addedAttachmentsList.length > 0) {
this.agendaDataRepository.addEventAttachment(this._postEvent.EventId, { "attachments": this._postEvent.Attachments }).subscribe((value) => { this.agendaDataRepository.addEventAttachment(this._postEvent.EventId, this._postEvent.Attachments).subscribe((value) => {
console.log(value) console.log(value)
}, ((error) => { }, ((error) => {
this.showLoader = false this.showLoader = false
@@ -288,9 +288,9 @@
<div class="d-flex container-div width-100" > <div class="d-flex container-div width-100" >
<ion-list class="width-100 "> <ion-list class="width-100 ">
<ion-item class="width-100" *ngFor="let document of loadedAttachments; let i = index"> <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"> <p class="d-flex ion-justify-content-between">
<span class="attach-title-item">{{document.SourceName}}</span> <span class="attach-title-item">{{document.subject || document.Description || 'Sem título'}}</span>
<span class="app-name" *ngIf="document.ApplicationId == 8"> Correspondencia </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 == 386"> AccoesPresidenciais </span>
<span class="app-name" *ngIf="document.ApplicationId == 361 "> ArquivoDespachoElect </span> <span class="app-name" *ngIf="document.ApplicationId == 361 "> ArquivoDespachoElect </span>
@@ -298,7 +298,7 @@
<ion-icon class="font-20" src="assets/images/icons-delete-25.svg"></ion-icon> <ion-icon class="font-20" src="assets/images/icons-delete-25.svg"></ion-icon>
</span> </span>
</p> </p>
<p><span class="span-left" *ngIf="document.Stakeholders != false">{{document.Stakeholders}}</span><span class="span-right" *ngIf="document.CreateDate != false"> {{document.CreateDate }} </span></p> <p><span class="span-left" *ngIf="document.Stakeholders != false">{{document.Stakeholders}}</span><span class="span-right" *ngIf="document.dateEntry != false"> {{document.dateEntry }} </span></p>
</ion-label> </ion-label>
</ion-item> </ion-item>
</ion-list> </ion-list>
@@ -14,6 +14,7 @@ import { NgxMatDateFormats, NGX_MAT_DATE_FORMATS } from '@angular-material-compo
import { NavigationExtras, Router } from '@angular/router'; import { NavigationExtras, Router } from '@angular/router';
import { ThemeService } from 'src/app/services/theme.service' import { ThemeService } from 'src/app/services/theme.service'
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service' import { HttpErrorHandle } from 'src/app/services/http-error-handle.service'
import { AgendaDataRepositoryService } from 'src/app/services/Repositorys/Agenda/agenda-data-repository.service';
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = { const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
parse: { parse: {
@@ -44,7 +45,7 @@ export class EditEventToApproveComponent implements OnInit {
public showSeconds = false; public showSeconds = false;
public touchUi = false; public touchUi = false;
public enableMeridian = false; public enableMeridian = false;
public minDate = new Date().toISOString().slice(0,10) public minDate = new Date().toISOString().slice(0, 10)
public endMinDate = new Date(new Date().getTime() + 15 * 60000); public endMinDate = new Date(new Date().getTime() + 15 * 60000);
public maxDate: any; public maxDate: any;
public stepHour = 1; public stepHour = 1;
@@ -62,12 +63,14 @@ export class EditEventToApproveComponent implements OnInit {
@ViewChild('picker1') picker1: any; @ViewChild('picker1') picker1: any;
serialNumber: string serialNumber: string
loadedAttachments: Attachment[]= [] loadedAttachments: any[] = []
addedAttachmentsList: any[] = []
deletedAttachmentsList: any[] = []
eventProcess = { eventProcess = {
serialNumber: "", serialNumber: "",
taskStartDate: "", taskStartDate: "",
workflowInstanceDataFields:{ workflowInstanceDataFields: {
Body: "", Body: "",
OccurrenceType: '', OccurrenceType: '',
Category: '', Category: '',
@@ -91,10 +94,10 @@ export class EditEventToApproveComponent implements OnInit {
show = false show = false
postEvent: Event; postEvent: Event;
isRecurring:string; isRecurring: string;
isEventEdited: boolean; isEventEdited: boolean;
segment:string = "true"; segment: string = "true";
profile:string; profile: string;
eventAttendees: EventPerson[]; eventAttendees: EventPerson[];
startDate: Date; startDate: Date;
endDate: Date; endDate: Date;
@@ -115,11 +118,12 @@ export class EditEventToApproveComponent implements OnInit {
private eventsService: EventsService, private eventsService: EventsService,
public alertController: AlertController, public alertController: AlertController,
private attachmentsService: AttachmentsService, private attachmentsService: AttachmentsService,
private processes:ProcessesService, private processes: ProcessesService,
private toastService: ToastService, private toastService: ToastService,
private router:Router, private router: Router,
public ThemeService: ThemeService, public ThemeService: ThemeService,
private httpErroHalde: HttpErrorHandle private httpErroHalde: HttpErrorHandle,
private agendaDataRepository: AgendaDataRepositoryService
) { ) {
// Edit event to approve // Edit event to approve
this.serialNumber = this.navParams.get('serialNumber'); this.serialNumber = this.navParams.get('serialNumber');
@@ -129,6 +133,7 @@ export class EditEventToApproveComponent implements OnInit {
ngOnInit() { ngOnInit() {
console.log('Here you ares')
this.getTask() this.getTask()
this.getRecurrenceTypes(); this.getRecurrenceTypes();
} }
@@ -138,8 +143,8 @@ export class EditEventToApproveComponent implements OnInit {
} }
myInterval = setInterval(() => { myInterval = setInterval(() => {
document.querySelectorAll('.ngx-mat-timepicker input').forEach((e :any) => { document.querySelectorAll('.ngx-mat-timepicker input').forEach((e: any) => {
if(e) { if (e) {
e.disabled = true; e.disabled = true;
} }
}) })
@@ -147,31 +152,30 @@ export class EditEventToApproveComponent implements OnInit {
async getTask() { async getTask() {
const result = await this.processes.GetTask(this.serialNumber).toPromise(); /* const result = await this.processes.GetTask(this.serialNumber).toPromise(); */
const res = await this.agendaDataRepository.getEventToApproveById(this.serialNumber)
if (res.isOk()) {
console.log('Loaded Event', res.value)
this.eventProcess = result this.eventProcess = res.value as any
this.eventProcess.workflowInstanceDataFields.Category = result.workflowInstanceDataFields.EventType this.eventProcess.workflowInstanceDataFields.Category = res.value.workflowInstanceDataFields.EventType
this.eventProcess.workflowInstanceDataFields.LastOccurrence = new Date(this.eventProcess.workflowInstanceDataFields.LastOccurrence) this.eventProcess.workflowInstanceDataFields.LastOccurrence = new Date(this.eventProcess.workflowInstanceDataFields.LastOccurrence)
this.startDate = new Date(this.eventProcess.workflowInstanceDataFields.StartDate); this.startDate = new Date(this.eventProcess.workflowInstanceDataFields.StartDate);
this.endDate = new Date(this.eventProcess.workflowInstanceDataFields.EndDate); this.endDate = new Date(this.eventProcess.workflowInstanceDataFields.EndDate);
// description // description
let body : any =this.eventProcess.workflowInstanceDataFields.Body.replace(/<[^>]+>/g, '') let body: any = this.eventProcess.workflowInstanceDataFields.Body.replace(/<[^>]+>/g, '')
this.eventProcess.workflowInstanceDataFields.Body = body this.eventProcess.workflowInstanceDataFields.Body = body
this.Location = this.eventProcess.workflowInstanceDataFields.Location this.Location = this.eventProcess.workflowInstanceDataFields.Location
this.InstanceId = this.eventProcess.workflowInstanceDataFields.InstanceId this.InstanceId = this.eventProcess.workflowInstanceDataFields.InstanceId
try {
this.getAttachments()
} catch (error) { this.loadedAttachments = res.value.Attachments
this.httpErroHalde.httpStatusHandle(error) /* this.getAttachments()
} */
if (this.eventProcess.workflowInstanceDataFields.IsRecurring == false) {
if(this.eventProcess.workflowInstanceDataFields.IsRecurring == false) {
this.isRecurring = "Não se repete"; this.isRecurring = "Não se repete";
} }
else { else {
@@ -179,48 +183,55 @@ export class EditEventToApproveComponent implements OnInit {
} }
this.eventProcess.workflowInstanceDataFields.ParticipantsList.forEach(e => { this.eventProcess.workflowInstanceDataFields.ParticipantsList.forEach(e => {
if(e.IsRequired) { if (e.IsRequired) {
this.taskParticipants.push(e); this.taskParticipants.push(e);
} else { } else {
this.taskParticipantsCc.push(e); this.taskParticipantsCc.push(e);
} }
}) })
} else {
this.httpErroHalde.httpStatusHandle(res.error)
}
/* }) */ /* }) */
} }
getRecurrenceTypes() { getRecurrenceTypes() {
this.eventsService.getRecurrenceTypes().subscribe(res=>{ this.eventsService.getRecurrenceTypes().subscribe(res => {
this.recurringTypes = res; this.recurringTypes = res;
}); });
} }
onSelectedRecurringChanged(ev:any){ onSelectedRecurringChanged(ev: any) {
this.calculetedLastOccurrence(ev); this.calculetedLastOccurrence(ev);
if(ev.length > 1){ if (ev.length > 1) {
this.postEvent.EventRecurrence.Type = ev.filter(data => data != '-1'); this.postEvent.EventRecurrence.Type = ev.filter(data => data != '-1');
} }
if(ev.length == 0){ if (ev.length == 0) {
this.postEvent.EventRecurrence.Type = "-1"; this.postEvent.EventRecurrence.Type = "-1";
} }
} }
calculetedLastOccurrence(type:number){ calculetedLastOccurrence(type: number) {
var valor; var valor;
var opcao: boolean; var opcao: boolean;
if (type == 0) { if (type == 0) {
valor = 7; valor = 7;
opcao = true; opcao = true;
} else if(type == 1){ } else if (type == 1) {
valor = 30; valor = 30;
opcao = true; opcao = true;
} else if(type == 2){ } else if (type == 2) {
valor = 1; valor = 1;
opcao = false; opcao = false;
}else if(type == 3){ } else if (type == 3) {
valor = 5; valor = 5;
opcao = false; opcao = false;
} }
@@ -228,7 +239,7 @@ export class EditEventToApproveComponent implements OnInit {
} }
defineLastOccurrence(valor:number, opcao:boolean){ defineLastOccurrence(valor: number, opcao: boolean) {
var time = new Date(this.endDate); var time = new Date(this.endDate);
if (opcao == true) { if (opcao == true) {
time.setDate(time.getDate() + valor); time.setDate(time.getDate() + valor);
@@ -248,7 +259,7 @@ export class EditEventToApproveComponent implements OnInit {
openLastOccurrence() { openLastOccurrence() {
let input: any = document.querySelector('#last-occurrence') let input: any = document.querySelector('#last-occurrence')
if(input) { if (input) {
input.click() input.click()
} }
} }
@@ -262,15 +273,15 @@ export class EditEventToApproveComponent implements OnInit {
save() { save() {
// set dates to eventProcess object // set dates to eventProcess object
this.taskParticipantsCc.forEach(e=>{ this.taskParticipantsCc.forEach(e => {
e.IsRequired = false e.IsRequired = false
}) })
this.eventProcess.workflowInstanceDataFields.ParticipantsList = this.taskParticipants.concat(this.taskParticipantsCc) this.eventProcess.workflowInstanceDataFields.ParticipantsList = this.taskParticipants.concat(this.taskParticipantsCc)
this.eventProcess.workflowInstanceDataFields.ParticipantsList.forEach(e=>{ this.eventProcess.workflowInstanceDataFields.ParticipantsList.forEach(e => {
if(e.hasOwnProperty('$type')) { if (e.hasOwnProperty('$type')) {
delete e.$type delete e.$type
} }
}) })
@@ -306,15 +317,47 @@ export class EditEventToApproveComponent implements OnInit {
} }
this.eventsService.postEventToApproveEdit(event).subscribe(()=>{ /* this.eventsService.postEventToApproveEdit(event).subscribe(()=>{
this.httpErroHalde.httpsSucessMessagge('Editar evento') this.httpErroHalde.httpsSucessMessagge('Editar evento')
window['approve-event-getTask']() window['approve-event-getTask']()
}, error =>{ }, error =>{
this.httpErroHalde.httpStatusHandle(error) this.httpErroHalde.httpStatusHandle(error)
}) }) */
this.agendaDataRepository.updateEvent(this.eventProcess.serialNumber, event).subscribe((value) => {
console.log(value)
}, ((error) => {
console.log('edit event error: ', error)
}));
this.agendaDataRepository.addEventAttendee(this.eventProcess.serialNumber, this.eventProcess.workflowInstanceDataFields.ParticipantsList).subscribe((value) => {
console.log(value)
}, ((error) => {
console.log('add Attendee error: ', error)
}));
this.loadedAttachments.forEach((document:any)=>{ if (this.addedAttachmentsList.length > 0) {
this.agendaDataRepository.addEventAttachment(this.eventProcess.serialNumber, this.loadedAttachments).subscribe((value) => {
console.log(value)
}, ((error) => {
this.showLoader = false
console.log('add attachment error: ', error)
}));
}
if (this.deletedAttachmentsList.length > 0) {
this.agendaDataRepository.removeEventAttachment(this.eventProcess.serialNumber, { attachments: this.deletedAttachmentsList }).subscribe((value) => {
console.log(value)
}, ((error) => {
this.showLoader = false
console.log('remove attachment error: ', error)
}));
}
/* this.loadedAttachments.forEach((document:any)=>{
if(document['action'] == 'add') { if(document['action'] == 'add') {
delete document.action delete document.action
this.attachmentsService.setEventAttachmentById(document).subscribe(()=>{ this.attachmentsService.setEventAttachmentById(document).subscribe(()=>{
@@ -343,14 +386,14 @@ export class EditEventToApproveComponent implements OnInit {
}) })
} }
}) }) */
this.close(); this.close();
} }
async openAttendees() { async openAttendees() {
if(window.innerWidth <= 1024) { if (window.innerWidth <= 1024) {
const modal = await this.modalController.create({ const modal = await this.modalController.create({
component: AttendeesPageModal, component: AttendeesPageModal,
componentProps: { componentProps: {
@@ -366,7 +409,7 @@ export class EditEventToApproveComponent implements OnInit {
modal.onDidDismiss().then((data) => { modal.onDidDismiss().then((data) => {
if(data) { if (data) {
data = data['data']; data = data['data'];
const newAttendees: EventPerson[] = data['taskParticipants']; const newAttendees: EventPerson[] = data['taskParticipants'];
@@ -402,7 +445,7 @@ export class EditEventToApproveComponent implements OnInit {
this.openAttendees(); this.openAttendees();
} }
dynamicSetIntervenient({taskParticipants, taskParticipantsCc}) { dynamicSetIntervenient({ taskParticipants, taskParticipantsCc }) {
this.taskParticipants = taskParticipants; this.taskParticipants = taskParticipants;
this.taskParticipantsCc = taskParticipantsCc; this.taskParticipantsCc = taskParticipantsCc;
} }
@@ -416,7 +459,7 @@ export class EditEventToApproveComponent implements OnInit {
console.error('getAttachments', error) console.error('getAttachments', error)
} }
result.forEach((e)=>{ result.forEach((e) => {
e.action = false e.action = false
}) })
@@ -426,8 +469,16 @@ export class EditEventToApproveComponent implements OnInit {
} }
deleteAttachment(attachment: Attachment, index) { deleteAttachment(attachment: Attachment, index) {
console.log( this.loadedAttachments)
const id: any = this.loadedAttachments[index].id
let update = this.removeItemById(this.loadedAttachments, id)
this.loadedAttachments = update
console.log( update)
this.deletedAttachmentsList.push(id)
}
this.loadedAttachments[index]['action'] = 'delete' removeItemById(array, id) {
return array.filter(item => item.id !== id);
} }
async getDoc() { async getDoc() {
@@ -437,16 +488,17 @@ export class EditEventToApproveComponent implements OnInit {
componentProps: { componentProps: {
type: 'AccoesPresidenciais & ArquivoDespachoElect', type: 'AccoesPresidenciais & ArquivoDespachoElect',
showSearchInput: true, showSearchInput: true,
eventAgenda: true,
select: true, select: true,
} }
}); });
modal.onDidDismiss().then( async (res)=>{ modal.onDidDismiss().then(async (res) => {
if(res){ if (res) {
const data: SearchList = res.data.selected; const data: SearchList = res.data.selected;
console.log(data)
const DocumentToSave: any = { /* const DocumentToSave: any = {
SourceTitle: data.Assunto, SourceTitle: data.Assunto,
ParentId: this.InstanceId, ParentId: this.InstanceId,
Source: '1', Source: '1',
@@ -461,10 +513,11 @@ export class EditEventToApproveComponent implements OnInit {
Description: data.DocTypeDesc, Description: data.DocTypeDesc,
SourceName: data.Assunto, SourceName: data.Assunto,
Stakeholders: data.EntidadeOrganicaNome, Stakeholders: data.EntidadeOrganicaNome,
}; }; */
this.loadedAttachments.push(DocumentToSave) this.loadedAttachments.push(data)
this.addedAttachmentsList.push(data)
// await this.attachmentsService.setEventAttachmentById(DocumentToSave).subscribe(()=>{ // await this.attachmentsService.setEventAttachmentById(DocumentToSave).subscribe(()=>{