mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-21 05:45:50 +00:00
ITOTEAM-597 remove atendess from list
This commit is contained in:
@@ -353,9 +353,9 @@
|
||||
<ion-label class="width-100 d-block list" >
|
||||
<p class="d-flex ion-justify-content-between">
|
||||
<span class="attach-title-item">{{document.subject || document.Description || document.SourceName || document.sourceName || 'Sem título'}}</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>
|
||||
<span class="app-name" *ngIf="document.applicationId == 8 || document.ApplicationId == 8"> Correspondencia </span>
|
||||
<span class="app-name" *ngIf="document.applicationId == 386 || document.ApplicationId == 386"> AccoesPresidenciais </span>
|
||||
<span class="app-name" *ngIf="document.applicationId == 361 || document.ApplicationId == 361 "> ArquivoDespachoElect </span>
|
||||
<span class="close-button text-black cursor-pointer" (click)="deleteAttachment(document, i)" >
|
||||
<ion-icon class="font-20" src="assets/images/icons-delete-25.svg"></ion-icon>
|
||||
</span>
|
||||
|
||||
@@ -17,6 +17,7 @@ import { ThemeService } from 'src/app/services/theme.service'
|
||||
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
|
||||
import { AgendaDataRepositoryService } from 'src/app/services/Repositorys/Agenda/agenda-data-repository.service';
|
||||
import { TracingType, XTracerAsync } from 'src/app/services/monitoring/opentelemetry/tracer';
|
||||
import { AttendeesLIstChangeDetector } from 'src/app/services/Repositorys/Agenda/async/change/attendeesLIstChangeDetector';
|
||||
|
||||
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
|
||||
parse: {
|
||||
@@ -154,33 +155,34 @@ export class EditEventToApprovePage implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@XTracerAsync({name:'edit-event-approve/getTask', bugPrint: true})
|
||||
async getTask(tracing?: TracingType) {
|
||||
|
||||
const res = await this.agendaDataRepository.getEventToApproveById(this.serialNumber)
|
||||
if(res.isOk()) {
|
||||
console.log('evento to apro to edit', res.value)
|
||||
this.eventProcess = res.value as any;
|
||||
|
||||
|
||||
this.eventProcess.workflowInstanceDataFields.LastOccurrence = new Date(this.eventProcess.workflowInstanceDataFields.LastOccurrence)
|
||||
|
||||
|
||||
this.restoreDatepickerData()
|
||||
|
||||
|
||||
// description
|
||||
|
||||
|
||||
try {
|
||||
let body: any = this.eventProcess.workflowInstanceDataFields?.Body?.replace(/<[^>]+>/g, '')
|
||||
this.eventProcess.workflowInstanceDataFields.Body = body
|
||||
|
||||
|
||||
} catch (error) {}
|
||||
|
||||
|
||||
this.eventProcess.workflowInstanceDataFields.Category = this.setEventType(this.eventProcess.workflowInstanceDataFields.EventType)
|
||||
this.InstanceId = this.eventProcess.workflowInstanceDataFields.InstanceId
|
||||
this.loadedAttachments = res.value.Attachments;
|
||||
console.log(this.loadedAttachments)
|
||||
|
||||
|
||||
this.setOtherData()
|
||||
|
||||
|
||||
this.saveTemporaryData()
|
||||
tracing.setAttribute('outcome', 'success')
|
||||
|
||||
@@ -189,7 +191,7 @@ export class EditEventToApprovePage implements OnInit {
|
||||
tracing.bugFlag()
|
||||
this.httpErroHalde.httpStatusHandle(res.error)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
getRecurrenceTypes() {
|
||||
@@ -337,11 +339,10 @@ export class EditEventToApprovePage implements OnInit {
|
||||
|
||||
if (this.Form.invalid) return false
|
||||
|
||||
// set dates to eventProcess object
|
||||
const serverCurrentList = this.eventProcess.workflowInstanceDataFields.ParticipantsList
|
||||
|
||||
this.dateControlStart = new FormControl(moment(new Date(this.eventProcess.workflowInstanceDataFields.StartDate)).add(1, 'hours'));
|
||||
this.dateControlEnd = new FormControl(moment(new Date(this.eventProcess.workflowInstanceDataFields.EndDate)).add(1, 'hours'));
|
||||
// this.restoreDatepickerData()
|
||||
// this.getDatepickerData()
|
||||
|
||||
this.taskParticipantsCc.forEach(e => {
|
||||
e.IsRequired = false
|
||||
@@ -399,12 +400,32 @@ export class EditEventToApprovePage implements OnInit {
|
||||
tracing.setAttribute('outcome', 'failed')
|
||||
}));
|
||||
|
||||
this.agendaDataRepository.addEventAttendee(this.eventProcess.serialNumber, this.eventProcess.workflowInstanceDataFields.ParticipantsList).subscribe((value) => {
|
||||
console.log(value)
|
||||
}, ((error) => {
|
||||
console.log('add Attendee error: ', error)
|
||||
tracing.setAttribute('failed.attendees', 'true')
|
||||
}));
|
||||
console.log({serverCurrentList, list: this.eventProcess.workflowInstanceDataFields.ParticipantsList, e: this.eventProcess})
|
||||
|
||||
const { insert, remove } = AttendeesLIstChangeDetector(serverCurrentList as any, this.eventProcess.workflowInstanceDataFields.ParticipantsList as any)
|
||||
|
||||
console.log({insert, remove})
|
||||
|
||||
if(insert.length >= 1) {
|
||||
this.agendaDataRepository.addEventAttendee(this.eventProcess.serialNumber, insert).subscribe((value) => {
|
||||
console.log(value)
|
||||
}, ((error) => {
|
||||
console.log('add Attendee error: ', error)
|
||||
tracing.setAttribute('failed.attendees', 'true')
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
if(remove.length >= 1) {
|
||||
|
||||
this.agendaDataRepository.removeEventAttendee(this.eventProcess.serialNumber, remove).subscribe((value) => {
|
||||
|
||||
}, ((error) => {
|
||||
console.log('add Attendee error: ', error)
|
||||
tracing.setAttribute('failed.attendees', 'true')
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
if (this.addedAttachmentsList.length > 0) {
|
||||
this.agendaDataRepository.addEventAttachment(this.eventProcess.serialNumber, this.loadedAttachments, tracing).subscribe((value) => {
|
||||
@@ -435,24 +456,24 @@ export class EditEventToApprovePage implements OnInit {
|
||||
this.toastService._badRequest('Evento não editado');
|
||||
}
|
||||
|
||||
this.loadedAttachments.forEach((document: any) => {
|
||||
if (document['action'] == 'add') {
|
||||
delete document.action
|
||||
this.attachmentsService.setEventAttachmentById(document).subscribe(() => {
|
||||
window['edit-approve-event-desktop']()
|
||||
}, error => {
|
||||
this.toastService.badRequest();
|
||||
});
|
||||
} else if (document['action'] == 'delete') {
|
||||
delete document.action
|
||||
this.attachmentsService.deleteEventAttachmentById(document.Id).subscribe(res => {
|
||||
window['edit-approve-event-desktop']()
|
||||
}, error => {
|
||||
this.toastService.badRequest()
|
||||
})
|
||||
}
|
||||
// this.loadedAttachments.forEach((document: any) => {
|
||||
// if (document['action'] == 'add') {
|
||||
// delete document.action
|
||||
// this.attachmentsService.setEventAttachmentById(document).subscribe(() => {
|
||||
// window['edit-approve-event-desktop']()
|
||||
// }, error => {
|
||||
// this.toastService.badRequest();
|
||||
// });
|
||||
// } else if (document['action'] == 'delete') {
|
||||
// delete document.action
|
||||
// this.attachmentsService.deleteEventAttachmentById(document.Id).subscribe(res => {
|
||||
// window['edit-approve-event-desktop']()
|
||||
// }, error => {
|
||||
// this.toastService.badRequest()
|
||||
// })
|
||||
// }
|
||||
|
||||
})
|
||||
// })
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ import { Observable } from 'rxjs';
|
||||
import { TableSharedCalendar } from 'src/app/services/Repositorys/Agenda/agenda-local-data-source.service';
|
||||
import { RoleIdService } from 'src/app/services/role-id.service'
|
||||
import { XTracerAsync, TracingType } from 'src/app/services/monitoring/opentelemetry/tracer';
|
||||
import { AttendeesLIstChangeDetector } from 'src/app/services/Repositorys/Agenda/async/change/attendeesLIstChangeDetector';
|
||||
@Component({
|
||||
selector: 'app-edit-event',
|
||||
templateUrl: './edit-event.page.html',
|
||||
@@ -423,6 +424,8 @@ export class EditEventPage implements OnInit {
|
||||
return false
|
||||
}
|
||||
|
||||
const serverCurrentList = this._postEvent.Attendees
|
||||
|
||||
this._postEvent.Attendees = this.taskParticipants.concat(this.taskParticipantsCc);
|
||||
|
||||
|
||||
@@ -448,15 +451,35 @@ export class EditEventPage implements OnInit {
|
||||
tracing.setAttribute('outcome', 'failed')
|
||||
}));
|
||||
|
||||
this.agendaDataRepository.addEventAttendee(this._postEvent.EventId, this._postEvent.Attendees).subscribe((value) => {
|
||||
console.log(value)
|
||||
}, ((error) => {
|
||||
tracing.setAttribute('failed.attendees', 'true')
|
||||
console.log('add Attendee error: ', error)
|
||||
}));
|
||||
console.log({serverCurrentList, Attendees: this._postEvent.Attendees})
|
||||
|
||||
const { insert, remove } = AttendeesLIstChangeDetector(serverCurrentList as any, this._postEvent.Attendees as any)
|
||||
|
||||
console.log({ insert, remove });
|
||||
|
||||
if(insert.length >= 1) {
|
||||
this.agendaDataRepository.addEventAttendee(this._postEvent.EventId, insert).subscribe((value) => {
|
||||
console.log(value)
|
||||
}, ((error) => {
|
||||
tracing.setAttribute('failed.attendees', 'true')
|
||||
console.log('add Attendee error: ', error)
|
||||
}));
|
||||
|
||||
}
|
||||
|
||||
if(remove.length >= 1) {
|
||||
|
||||
this.agendaDataRepository.removeEventAttendee(this._postEvent.EventId, remove).subscribe((value) => {
|
||||
console.log(value)
|
||||
}, ((error) => {
|
||||
tracing.setAttribute('failed.attendees', 'true')
|
||||
console.log('add Attendee error: ', error)
|
||||
}));
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (this.addedAttachmentsList.length > 0) {
|
||||
if (this.addedAttachmentsList.length >= 1) {
|
||||
this.agendaDataRepository.addEventAttachment(this._postEvent.EventId, this.loadedEventAttachments, tracing).subscribe((value) => {
|
||||
console.log(value)
|
||||
}, ((error) => {
|
||||
@@ -466,7 +489,7 @@ export class EditEventPage implements OnInit {
|
||||
}));
|
||||
}
|
||||
|
||||
if (this.deletedAttachmentsList.length > 0) {
|
||||
if (this.deletedAttachmentsList.length >= 1) {
|
||||
this.agendaDataRepository.removeEventAttachment(this._postEvent.EventId, { attachments: this.deletedAttachmentsList }).subscribe((value) => {
|
||||
console.log(value)
|
||||
}, ((error) => {
|
||||
@@ -518,7 +541,7 @@ export class EditEventPage implements OnInit {
|
||||
postEvent: this._postEvent,
|
||||
eventBody: this.eventBody,
|
||||
segment: this.segment,
|
||||
loadedEventAttachments: this.loadedEventAttachments
|
||||
loadedEventAttachments: this.loadedEventAttachments,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -687,13 +710,19 @@ export class EditEventPage implements OnInit {
|
||||
}
|
||||
|
||||
setEventType(eventType) {
|
||||
var selectedEventType = {
|
||||
1: 'Meeting',
|
||||
2: 'Travel',
|
||||
3: 'Conference',
|
||||
4: 'Encontro'
|
||||
|
||||
if(typeof eventType == 'number') {
|
||||
var selectedEventType = {
|
||||
1: 'Meeting',
|
||||
2: 'Travel',
|
||||
3: 'Conference',
|
||||
4: 'Encontro'
|
||||
}
|
||||
return selectedEventType[eventType];
|
||||
} else {
|
||||
return this._postEvent.Category
|
||||
}
|
||||
return selectedEventType[eventType];
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -292,9 +292,9 @@
|
||||
<ion-label class="width-100 d-block list">
|
||||
<p class="d-flex ion-justify-content-between">
|
||||
<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 == 386"> AccoesPresidenciais </span>
|
||||
<span class="app-name" *ngIf="document.ApplicationId == 361 "> ArquivoDespachoElect </span>
|
||||
<span class="app-name" *ngIf="document.applicationId == 8 || document.ApplicationId == 8"> Correspondencia </span>
|
||||
<span class="app-name" *ngIf="document.applicationId == 386 || document.ApplicationId == 386"> AccoesPresidenciais </span>
|
||||
<span class="app-name" *ngIf="document.applicationId == 361 || document.ApplicationId == 361 "> ArquivoDespachoElect </span>
|
||||
<span class="close-button text-black cursor-pointer" (click)="deleteAttachment(document, i)" >
|
||||
<ion-icon class="font-20" src="assets/images/icons-delete-25.svg"></ion-icon>
|
||||
</span>
|
||||
|
||||
@@ -16,6 +16,7 @@ import { ThemeService } from 'src/app/services/theme.service'
|
||||
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service'
|
||||
import { AgendaDataRepositoryService } from 'src/app/services/Repositorys/Agenda/agenda-data-repository.service';
|
||||
import { TracingType, XTracerAsync } from 'src/app/services/monitoring/opentelemetry/tracer';
|
||||
import { AttendeesLIstChangeDetector } from 'src/app/services/Repositorys/Agenda/async/change/attendeesLIstChangeDetector';
|
||||
|
||||
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
|
||||
parse: {
|
||||
@@ -115,12 +116,8 @@ export class EditEventToApproveComponent implements OnInit {
|
||||
constructor(
|
||||
private modalController: ModalController,
|
||||
private navParams: NavParams,
|
||||
private eventsService: EventsService,
|
||||
public alertController: AlertController,
|
||||
private attachmentsService: AttachmentsService,
|
||||
private processes: ProcessesService,
|
||||
private toastService: ToastService,
|
||||
private router: Router,
|
||||
public ThemeService: ThemeService,
|
||||
private httpErroHalde: HttpErrorHandle,
|
||||
private agendaDataRepository: AgendaDataRepositoryService
|
||||
@@ -169,9 +166,9 @@ export class EditEventToApproveComponent implements OnInit {
|
||||
|
||||
let body: any = this.eventProcess.workflowInstanceDataFields.Body.replace(/<[^>]+>/g, '')
|
||||
this.eventProcess.workflowInstanceDataFields.Body = body
|
||||
|
||||
|
||||
} catch (error) {}
|
||||
|
||||
|
||||
this.Location = this.eventProcess.workflowInstanceDataFields.Location
|
||||
|
||||
this.InstanceId = this.eventProcess.workflowInstanceDataFields.InstanceId
|
||||
@@ -280,6 +277,7 @@ export class EditEventToApproveComponent implements OnInit {
|
||||
e.IsRequired = false
|
||||
})
|
||||
|
||||
const serverCurrentList = this.eventProcess.workflowInstanceDataFields.ParticipantsList
|
||||
this.eventProcess.workflowInstanceDataFields.ParticipantsList = this.taskParticipants.concat(this.taskParticipantsCc)
|
||||
|
||||
this.eventProcess.workflowInstanceDataFields.ParticipantsList.forEach(e => {
|
||||
@@ -334,12 +332,32 @@ export class EditEventToApproveComponent implements OnInit {
|
||||
tracing.setAttribute('outcome', 'failed')
|
||||
}));
|
||||
|
||||
this.agendaDataRepository.addEventAttendee(this.eventProcess.serialNumber, this.eventProcess.workflowInstanceDataFields.ParticipantsList).subscribe((value) => {
|
||||
console.log({serverCurrentList, ParticipantsList:this.eventProcess.workflowInstanceDataFields.ParticipantsList})
|
||||
const { insert, remove } = AttendeesLIstChangeDetector(serverCurrentList as any, this.eventProcess.workflowInstanceDataFields.ParticipantsList as any)
|
||||
|
||||
console.log({insert, remove})
|
||||
|
||||
if(insert.length >= 1) {
|
||||
|
||||
this.agendaDataRepository.addEventAttendee(this.eventProcess.serialNumber, insert).subscribe((value) => {
|
||||
|
||||
}, ((error) => {
|
||||
console.log('add Attendee error: ', error)
|
||||
tracing.setAttribute('failed.attendees', 'true')
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
if(remove.length >= 1) {
|
||||
|
||||
this.agendaDataRepository.removeEventAttendee(this.eventProcess.serialNumber, remove).subscribe((value) => {
|
||||
|
||||
}, ((error) => {
|
||||
console.log('add Attendee error: ', error)
|
||||
tracing.setAttribute('failed.attendees', 'true')
|
||||
}));
|
||||
}
|
||||
|
||||
}, ((error) => {
|
||||
console.log('add Attendee error: ', error)
|
||||
tracing.setAttribute('failed.attendees', 'true')
|
||||
}));
|
||||
|
||||
|
||||
if (this.addedAttachmentsList.length > 0) {
|
||||
|
||||
Reference in New Issue
Block a user