This commit is contained in:
tiago.kayaya
2021-07-14 15:23:45 +01:00
parent 732fff2025
commit 9a39b767dd
18 changed files with 196 additions and 146 deletions
+1 -1
View File
@@ -134,7 +134,7 @@
</mfp:windows10> </mfp:windows10>
<mfp:appChecksum>0</mfp:appChecksum> <mfp:appChecksum>0</mfp:appChecksum>
</mfp:windows> </mfp:windows>
<mfp:platformVersion>8.0.0.00-20210308-063916</mfp:platformVersion> <mfp:platformVersion>8.0.0.00-20210214-154410</mfp:platformVersion>
<mfp:clientCustomInit enabled="false" /> <mfp:clientCustomInit enabled="false" />
<mfp:server runtime="mfp" url="http://gpr-dev-10.gabinetedigital.local:9080" /> <mfp:server runtime="mfp" url="http://gpr-dev-10.gabinetedigital.local:9080" />
<mfp:serverUri url="" /> <mfp:serverUri url="" />
+4 -2
View File
@@ -20,7 +20,7 @@ export class Event{
TimeZone: string; TimeZone: string;
Organizer: string; Organizer: string;
Categories: string[]; Categories: string[];
HasAttachments: boolean; HasAttachments: boolean;
EventRecurrence?: EventRecurrence; EventRecurrence?: EventRecurrence;
/* public Event(){ /* public Event(){
@@ -38,6 +38,8 @@ export class EventToApproveEdit {
"Private": false "Private": false
"ReviewUserComment": "" "ReviewUserComment": ""
"MDName": "Paulo Pinto" "MDName": "Paulo Pinto"
"OccurrenceType": "-1"
"LastOccurrence": "2021-07-14"
"MDEmail": "paulo.pinto@gabinetedigital.local" "MDEmail": "paulo.pinto@gabinetedigital.local"
"Agenda": "Oficial" | "Pessoal" "Agenda": "Oficial" | "Pessoal"
"EventType": "Reunião" "EventType": "Reunião"
@@ -49,4 +51,4 @@ export class EventToApproveEdit {
"IsRequired": true "IsRequired": true
}[] }[]
"Message": "Recebeu um novo" "Message": "Recebeu um novo"
} }
@@ -141,18 +141,6 @@ export class DespachosPrPage implements OnInit {
}); });
console.log(this.despachoList); console.log(this.despachoList);
this.despachoList = this.sortArrayISODate(this.despachoList).reverse()
this.despachoList.forEach( (element, index) => {
// let aplicationId = element.workflowInstanceDataFields.SourceSecFsID;
let FolderID = element['FolderID'];
this.processes.GetDocumentDetails(FolderID, '361').subscribe(res=>{
element.DocumentsQty = res.DocumentsTotal
})
});
this.loading = false; this.loading = false;
} }
@@ -100,7 +100,7 @@ export class DespachosPage implements OnInit {
"CreateDate": taskDate, "CreateDate": taskDate,
"DocumentURL": element.workflowInstanceDataFields.ViewerRequest, "DocumentURL": element.workflowInstanceDataFields.ViewerRequest,
"Remetente": element.workflowInstanceDataFields.Remetente, "Remetente": element.workflowInstanceDataFields.Remetente,
"DocumentsQty": 0, "DocumentsQty": element.totalDocuments,
"DocId": element.workflowInstanceDataFields.DispatchDocId, "DocId": element.workflowInstanceDataFields.DispatchDocId,
"WorkflowName": element.workflowDisplayName, "WorkflowName": element.workflowDisplayName,
"activityInstanceName": element.activityInstanceName, "activityInstanceName": element.activityInstanceName,
@@ -108,16 +108,6 @@ export class DespachosPage implements OnInit {
this.despachoList.push(task) this.despachoList.push(task)
}); });
this.despachoList = this.sortArrayISODate(this.despachoList).reverse() this.despachoList = this.sortArrayISODate(this.despachoList).reverse()
this.despachoList.forEach( (element, index) => {
// let aplicationId = element.workflowInstanceDataFields.SourceSecFsID;
let FolderID = element['FolderID'];
this.processes.GetDocumentDetails(FolderID, '361').subscribe(res=>{
element.DocumentsQty = res.DocumentsTotal
})
});
} }
sortArrayISODate(myArray: any) { sortArrayISODate(myArray: any) {
@@ -80,7 +80,7 @@ export class DiplomasAssinarPage implements OnInit {
"CreateDate": formatDate(new Date(element.taskStartDate), 'yyyy-MM-dd HH:mm', 'pt'), "CreateDate": formatDate(new Date(element.taskStartDate), 'yyyy-MM-dd HH:mm', 'pt'),
"DocumentURL": element.workflowInstanceDataFields.ViewerRequest, "DocumentURL": element.workflowInstanceDataFields.ViewerRequest,
"Remetente": element.workflowInstanceDataFields.Remetente, "Remetente": element.workflowInstanceDataFields.Remetente,
"DocumentsQty": this.totalDocs, "DocumentsQty": element.totalDocuments,
"DocId": element.workflowInstanceDataFields.DocId, "DocId": element.workflowInstanceDataFields.DocId,
"WorkflowName": element.workflowDisplayName, "WorkflowName": element.workflowDisplayName,
"activityInstanceName": element.activityInstanceName, "activityInstanceName": element.activityInstanceName,
@@ -96,7 +96,7 @@ export class DiplomasAssinarPage implements OnInit {
"CreateDate": formatDate(new Date(element.taskStartDate), 'yyyy-MM-dd HH:mm', 'pt'), "CreateDate": formatDate(new Date(element.taskStartDate), 'yyyy-MM-dd HH:mm', 'pt'),
"DocumentURL": element.workflowInstanceDataFields.ViewerRequest, "DocumentURL": element.workflowInstanceDataFields.ViewerRequest,
"Remetente": element.workflowInstanceDataFields.Remetente, "Remetente": element.workflowInstanceDataFields.Remetente,
"DocumentsQty": 0, "DocumentsQty": element.totalDocuments,
"DocId": element.workflowInstanceDataFields.DocId, "DocId": element.workflowInstanceDataFields.DocId,
"WorkflowName": element.workflowDisplayName, "WorkflowName": element.workflowDisplayName,
"activityInstanceName": element.activityInstanceName, "activityInstanceName": element.activityInstanceName,
@@ -168,7 +168,7 @@ constructor(
"CreateDate": taskDate, "CreateDate": taskDate,
"DocumentURL": element.workflowInstanceDataFields.ViewerRequest, "DocumentURL": element.workflowInstanceDataFields.ViewerRequest,
"Remetente": element.workflowInstanceDataFields.Remetente, "Remetente": element.workflowInstanceDataFields.Remetente,
"DocumentsQty": this.totalDocs, "DocumentsQty": element.totalDocuments,
"DocId": element.workflowInstanceDataFields.DocIdDiferimento, "DocId": element.workflowInstanceDataFields.DocIdDiferimento,
"WorkflowName": element.workflowDisplayName, "WorkflowName": element.workflowDisplayName,
"activityInstanceName": element.activityInstanceName, "activityInstanceName": element.activityInstanceName,
@@ -200,7 +200,7 @@ constructor(
"CreateDate": taskDate, "CreateDate": taskDate,
"DocumentURL": element.workflowInstanceDataFields.ViewerRequest, "DocumentURL": element.workflowInstanceDataFields.ViewerRequest,
"Remetente": element.workflowInstanceDataFields.Remetente, "Remetente": element.workflowInstanceDataFields.Remetente,
"DocumentsQty": this.totalDocs, "DocumentsQty": element.totalDocuments,
"DocId": element.workflowInstanceDataFields.DocIdDiferimento, "DocId": element.workflowInstanceDataFields.DocIdDiferimento,
"WorkflowName": element.workflowDisplayName, "WorkflowName": element.workflowDisplayName,
"activityInstanceName": element.activityInstanceName, "activityInstanceName": element.activityInstanceName,
@@ -293,6 +293,7 @@ export class ApproveEventPage implements OnInit {
modal.onDidDismiss().then(res => { modal.onDidDismiss().then(res => {
this.getTask(); this.getTask();
this.goBack();
}); });
} }
@@ -33,11 +33,10 @@ export class EventListPage implements OnInit {
ngOnInit() { ngOnInit() {
this.segment = 'MDGPR'; this.segment = 'MDGPR';
this.LoadToApproveEvents(); this.refreshing();
const pathname = window.location.pathname const pathname = window.location.pathname
this.router.events.forEach((event) => { this.router.events.forEach((event) => {
if(event instanceof NavigationEnd && event.url == pathname) { if(event instanceof NavigationEnd && event.url == pathname) {
this.LoadToApproveEvents(); this.LoadToApproveEvents();
@@ -55,7 +54,7 @@ export class EventListPage implements OnInit {
LoadToApproveEvents(){ LoadToApproveEvents(){
this.showLoader = true; this.showLoader = true;
this.processes.GetToApprovedEvents('PR','false').subscribe(res=>{ this.processes.GetToApprovedEvents('PR','false').subscribe(res=>{
this.showLoader = false; this.showLoader = false;
this.eventsPRList = res; this.eventsPRList = res;
@@ -80,7 +79,7 @@ export class EventListPage implements OnInit {
goToEventToApproveDetail(serialNumber:string){ goToEventToApproveDetail(serialNumber:string){
console.log(serialNumber); console.log(serialNumber);
/* let navigationExtras: NavigationExtras = { /* let navigationExtras: NavigationExtras = {
queryParams: { queryParams: {
"serialNumber": serialNumber, "serialNumber": serialNumber,
@@ -97,6 +96,12 @@ export class EventListPage implements OnInit {
//this.router.navigate(['/home/gabinete-digital/event-list/approve-event'], navigationExtras) //this.router.navigate(['/home/gabinete-digital/event-list/approve-event'], navigationExtras)
} }
refreshing() {
setTimeout(() => {
this.LoadToApproveEvents();
}, 1500);
}
doRefresh(event) { doRefresh(event) {
this.LoadToApproveEvents(); this.LoadToApproveEvents();
setTimeout(() => { setTimeout(() => {
@@ -314,7 +314,9 @@ export class ExpedienteDetailPage implements OnInit {
backdropDismiss: false backdropDismiss: false
}); });
await modal.present(); await modal.present();
modal.onDidDismiss(); modal.onDidDismiss().then(res=>{
this.goBack();
});
} }
goToEvent(eventId:any){ goToEvent(eventId:any){
@@ -53,7 +53,7 @@ export class ExpedientePage implements OnInit {
"CreateDate": taskDate, "CreateDate": taskDate,
"DocumentURL": element.workflowInstanceDataFields.ViewerRequest, "DocumentURL": element.workflowInstanceDataFields.ViewerRequest,
"Remetente": element.workflowInstanceDataFields.Remetente, "Remetente": element.workflowInstanceDataFields.Remetente,
"DocumentsQty": 0, "DocumentsQty": element.totalDocuments,
"WorkflowName": element.workflowDisplayName, "WorkflowName": element.workflowDisplayName,
"activityInstanceName": element.activityInstanceName, "activityInstanceName": element.activityInstanceName,
"Status": element.workflowInstanceDataFields.Status, "Status": element.workflowInstanceDataFields.Status,
@@ -96,7 +96,7 @@ export class ExpedientesPrPage implements OnInit {
"CreateDate": taskDate, "CreateDate": taskDate,
"DocumentURL": element.workflowInstanceDataFields.ViewerRequest, "DocumentURL": element.workflowInstanceDataFields.ViewerRequest,
"Remetente": element.workflowInstanceDataFields.Remetente, "Remetente": element.workflowInstanceDataFields.Remetente,
"DocumentsQty": 0, "DocumentsQty": element.totalDocuments,
"WorkflowName": element.workflowDisplayName, "WorkflowName": element.workflowDisplayName,
"activityInstanceName": element.activityInstanceName, "activityInstanceName": element.activityInstanceName,
"Status": element.workflowInstanceDataFields.Status, "Status": element.workflowInstanceDataFields.Status,
@@ -117,7 +117,7 @@ export class PedidosPage implements OnInit {
"CreateDate": taskDate, "CreateDate": taskDate,
"DocumentURL": element.workflowInstanceDataFields.ViewerRequest, "DocumentURL": element.workflowInstanceDataFields.ViewerRequest,
"Remetente": element.workflowInstanceDataFields.Remetente, "Remetente": element.workflowInstanceDataFields.Remetente,
"DocumentsQty": 0, "DocumentsQty": element.totalDocuments,
"DocId": element.workflowInstanceDataFields.DocIdDiferimento, "DocId": element.workflowInstanceDataFields.DocIdDiferimento,
"WorkflowName": element.workflowDisplayName, "WorkflowName": element.workflowDisplayName,
"activityInstanceName": element.activityInstanceName, "activityInstanceName": element.activityInstanceName,
@@ -147,7 +147,7 @@ export class PedidosPage implements OnInit {
"CreateDate": taskDate, "CreateDate": taskDate,
"DocumentURL": element.workflowInstanceDataFields.ViewerRequest, "DocumentURL": element.workflowInstanceDataFields.ViewerRequest,
"Remetente": element.workflowInstanceDataFields.Remetente, "Remetente": element.workflowInstanceDataFields.Remetente,
"DocumentsQty": 0, "DocumentsQty": element.totalDocuments,
"DocId": element.workflowInstanceDataFields.DocIdDiferimento, "DocId": element.workflowInstanceDataFields.DocIdDiferimento,
"WorkflowName": element.workflowDisplayName, "WorkflowName": element.workflowDisplayName,
"activityInstanceName": element.activityInstanceName, "activityInstanceName": element.activityInstanceName,
@@ -68,6 +68,8 @@ export class EditEventToApprovePage implements OnInit {
taskStartDate: "", taskStartDate: "",
workflowInstanceDataFields:{ workflowInstanceDataFields:{
Body: "", Body: "",
OccurrenceType: '',
LastOccurrence: '',
IsRecurring: false, IsRecurring: false,
ParticipantsList: [], ParticipantsList: [],
Agenda: '', Agenda: '',
@@ -125,7 +127,7 @@ export class EditEventToApprovePage implements OnInit {
ngOnInit() { ngOnInit() {
if(this.restoreTemporaryData()){ if(this.restoreTemporaryData()){
this.setOtherData() this.setOtherData()
} else { } else {
this.getTask(); this.getTask();
@@ -138,22 +140,22 @@ export class EditEventToApprovePage implements OnInit {
this.processes.GetTask(this.serialNumber).subscribe( result =>{ this.processes.GetTask(this.serialNumber).subscribe( result =>{
this.eventProcess = result this.eventProcess = result
this.restoreDatepickerData() this.restoreDatepickerData()
// 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.InstanceId = this.eventProcess.workflowInstanceDataFields.InstanceId this.InstanceId = this.eventProcess.workflowInstanceDataFields.InstanceId
this.getAttachments() this.getAttachments()
this.setOtherData() this.setOtherData()
this.saveTemporaryData() this.saveTemporaryData()
}) })
} }
setOtherData() { setOtherData() {
if(this.eventProcess.workflowInstanceDataFields.ParticipantsList) { if(this.eventProcess.workflowInstanceDataFields.ParticipantsList) {
this.eventProcess.workflowInstanceDataFields.ParticipantsList.forEach(e => { this.eventProcess.workflowInstanceDataFields.ParticipantsList.forEach(e => {
@@ -167,7 +169,7 @@ export class EditEventToApprovePage implements OnInit {
this.taskParticipants = removeDuplicate(this.taskParticipants) this.taskParticipants = removeDuplicate(this.taskParticipants)
this.taskParticipantsCc = removeDuplicate(this.taskParticipantsCc) this.taskParticipantsCc = removeDuplicate(this.taskParticipantsCc)
if(this.eventProcess.workflowInstanceDataFields.IsRecurring == false) { if(this.eventProcess.workflowInstanceDataFields.IsRecurring == false) {
this.isRecurring = "Não se repete"; this.isRecurring = "Não se repete";
} }
@@ -183,7 +185,7 @@ export class EditEventToApprovePage implements OnInit {
close() { close() {
window['temp.path:/shared/agenda/edit-event-to-approve.ts'] = {} window['temp.path:/shared/agenda/edit-event-to-approve.ts'] = {}
this.closeComponent.emit(); this.closeComponent.emit();
/* this.setIntervenient.emit([]); /* this.setIntervenient.emit([]);
this.setIntervenientCC.emit([]); this.setIntervenientCC.emit([]);
@@ -233,18 +235,18 @@ export class EditEventToApprovePage implements OnInit {
this.runValidation() this.runValidation()
if(this.Form.invalid) return false if(this.Form.invalid) return false
// set dates to eventProcess object // set dates to eventProcess object
this.getDatepickerData() this.getDatepickerData()
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
} }
@@ -264,12 +266,16 @@ export class EditEventToApprovePage implements OnInit {
MDEmail: this.eventProcess.workflowInstanceDataFields.MDEmail, MDEmail: this.eventProcess.workflowInstanceDataFields.MDEmail,
MDName: this.eventProcess.workflowInstanceDataFields.MDName, MDName: this.eventProcess.workflowInstanceDataFields.MDName,
Message: this.eventProcess.workflowInstanceDataFields.Message, Message: this.eventProcess.workflowInstanceDataFields.Message,
EventRecurrence: {
Type: this.eventProcess.workflowInstanceDataFields.OccurrenceType,
LastOccurrence: this.eventProcess.workflowInstanceDataFields.LastOccurrence,
},
ParticipantsList: this.eventProcess.workflowInstanceDataFields.ParticipantsList, ParticipantsList: this.eventProcess.workflowInstanceDataFields.ParticipantsList,
Private: false, Private: false,
ReviewUserComment: '' ReviewUserComment: ''
} }
this.eventsService.postEventToApproveEdit(event).subscribe(()=>{ this.eventsService.postEventToApproveEdit(event).subscribe(()=>{
this.toastService.successMessage('Evento editado'); this.toastService.successMessage('Evento editado');
}, error =>{ }, error =>{
@@ -303,7 +309,7 @@ export class EditEventToApprovePage implements OnInit {
// this.taskParticipants = data; // this.taskParticipants = data;
// this.postEvent.Attendees = data; // this.postEvent.Attendees = data;
// } // }
// setIntervenientCC(data) { // setIntervenientCC(data) {
// this.taskParticipantsCc = data; // this.taskParticipantsCc = data;
// } // }
@@ -315,7 +321,7 @@ export class EditEventToApprovePage implements OnInit {
// } // }
// addParticipantsCC(){ // addParticipantsCC(){
// this.adding = 'CC' // this.adding = 'CC'
// this.openAttendees(); // this.openAttendees();
// } // }
@@ -348,7 +354,7 @@ export class EditEventToApprovePage implements OnInit {
} }
saveTemporaryData() { saveTemporaryData() {
this.getDatepickerData() this.getDatepickerData()
window['temp.path:/shared/agenda/edit-event-to-approve.ts'] = { window['temp.path:/shared/agenda/edit-event-to-approve.ts'] = {
@@ -372,7 +378,7 @@ export class EditEventToApprovePage implements OnInit {
return false; return false;
} }
} }
async getAttachments() { async getAttachments() {
@@ -405,7 +411,7 @@ export class EditEventToApprovePage implements OnInit {
await modal.present(); await modal.present();
modal.onDidDismiss().then( async (res)=>{ modal.onDidDismiss().then( async (res)=>{
if(res){ if(res){
const data: SearchDocument = res.data.selected; const data: SearchDocument = res.data.selected;
const DocumentToSave: any = { const DocumentToSave: any = {
@@ -440,14 +446,14 @@ export class EditEventToApprovePage implements OnInit {
this.dateControlStart = new FormControl(moment(new Date(this.eventProcess.workflowInstanceDataFields.StartDate))); this.dateControlStart = new FormControl(moment(new Date(this.eventProcess.workflowInstanceDataFields.StartDate)));
this.dateControlEnd = new FormControl(moment(new Date(this.eventProcess.workflowInstanceDataFields.EndDate))); this.dateControlEnd = new FormControl(moment(new Date(this.eventProcess.workflowInstanceDataFields.EndDate)));
} }
getDatepickerData() { getDatepickerData() {
this.eventProcess.workflowInstanceDataFields.StartDate = this.dateStart this.eventProcess.workflowInstanceDataFields.StartDate = this.dateStart
this.eventProcess.workflowInstanceDataFields.EndDate = this.dateEnd this.eventProcess.workflowInstanceDataFields.EndDate = this.dateEnd
} }
} }
@@ -110,7 +110,7 @@ export class DespachosPage implements OnInit {
"CreateDate": taskDate, "CreateDate": taskDate,
"DocumentURL": element.workflowInstanceDataFields.ViewerRequest, "DocumentURL": element.workflowInstanceDataFields.ViewerRequest,
"Remetente": element.workflowInstanceDataFields.Remetente, "Remetente": element.workflowInstanceDataFields.Remetente,
"DocumentsQty": 0, "DocumentsQty": element.totalDocuments,
"DocId": element.workflowInstanceDataFields.DispatchDocId, "DocId": element.workflowInstanceDataFields.DispatchDocId,
"FolderID": element.workflowInstanceDataFields.FolderID, "FolderID": element.workflowInstanceDataFields.FolderID,
"WorkflowName": element.workflowDisplayName, "WorkflowName": element.workflowDisplayName,
@@ -122,18 +122,7 @@ export class DespachosPage implements OnInit {
}); });
this.despachoList = this.sortArrayISODate(this.despachoList).reverse() this.despachoList = this.sortArrayISODate(this.despachoList).reverse();
this.despachoList.forEach( (element, index) => {
// let aplicationId = element.workflowInstanceDataFields.SourceSecFsID;
let FolderID = element['FolderID'];
this.processes.GetDocumentDetails(FolderID, '361').subscribe(res=>{
element.DocumentsQty = res.DocumentsTotal
})
});
} }
@@ -82,7 +82,7 @@ serialNumber:string;
"CreateDate": taskDate, "CreateDate": taskDate,
"DocumentURL": element.workflowInstanceDataFields.ViewerRequest, "DocumentURL": element.workflowInstanceDataFields.ViewerRequest,
"Remetente": element.workflowInstanceDataFields.Remetente, "Remetente": element.workflowInstanceDataFields.Remetente,
"DocumentsQty": 0, "DocumentsQty": element.totalDocuments,
"DocId": element.workflowInstanceDataFields.DispatchDocID, "DocId": element.workflowInstanceDataFields.DispatchDocID,
"FolderID": element.workflowInstanceDataFields.FolderID, "FolderID": element.workflowInstanceDataFields.FolderID,
"WorkflowName": element.workflowDisplayName, "WorkflowName": element.workflowDisplayName,
@@ -103,7 +103,7 @@ serialNumber:string;
"CreateDate": taskDate, "CreateDate": taskDate,
"DocumentURL": element.workflowInstanceDataFields.ViewerRequest, "DocumentURL": element.workflowInstanceDataFields.ViewerRequest,
"Remetente": element.workflowInstanceDataFields.Sender, "Remetente": element.workflowInstanceDataFields.Sender,
"DocumentsQty": 0, "DocumentsQty": element.totalDocuments,
"DocId": element.workflowInstanceDataFields.DispatchDocID, "DocId": element.workflowInstanceDataFields.DispatchDocID,
"FolderID": element.workflowInstanceDataFields.FolderID, "FolderID": element.workflowInstanceDataFields.FolderID,
"WorkflowName": element.workflowDisplayName, "WorkflowName": element.workflowDisplayName,
@@ -22,6 +22,7 @@ import { NgxMatMomentModule } from '@angular-material-components/moment-adapter'
import { MAT_DATE_LOCALE } from '@angular/material/core'; import { MAT_DATE_LOCALE } from '@angular/material/core';
import { MatDatepickerModule } from '@angular/material/datepicker'; import { MatDatepickerModule } from '@angular/material/datepicker';
import { MatInputModule } from '@angular/material/input'; import { MatInputModule } from '@angular/material/input';
import { MatDialogModule } from '@angular/material/dialog';
@NgModule({ @NgModule({
imports: [ imports: [
@@ -40,7 +41,8 @@ import { MatInputModule } from '@angular/material/input';
NgxMatMomentModule, NgxMatMomentModule,
MatSelectModule, MatSelectModule,
MatButtonModule, MatButtonModule,
ReactiveFormsModule ReactiveFormsModule,
MatDialogModule,
], ],
declarations: [ declarations: [
EditEventToApproveComponent EditEventToApproveComponent
@@ -8,7 +8,7 @@
<ion-header> <ion-header>
<div class="title-content"> <div class="title-content">
<div class="middle"> <div class="middle">
<ion-label class="title">Editar evento por aprovar MOB</ion-label> <ion-label class="title">Editar evento por aprovar</ion-label>
</div> </div>
</div> </div>
</ion-header> </ion-header>
@@ -77,7 +77,7 @@
<ion-datetime <ion-datetime
class="d-block d-md-none" class="d-block d-md-none"
placeholder="Início" placeholder="Início"
[(ngModel)]="dateControlEnd" [(ngModel)]="eventProcess.workflowInstanceDataFields.StartDate"
displayFormat="D MMM YYYY H:mm" displayFormat="D MMM YYYY H:mm"
minuteValues="0,15,30,45" minuteValues="0,15,30,45"
monthShortNames="Jan, Fev, Mar, Abr, Mai, Jun, Jul, Aug, Sep, Out, Nov, Dez" monthShortNames="Jan, Fev, Mar, Abr, Mai, Jun, Jul, Aug, Sep, Out, Nov, Dez"
@@ -86,10 +86,11 @@
> >
</ion-datetime> </ion-datetime>
<mat-form-field appearance="none" class="width-100 date-hour-picker d-none d-md-block"> <mat-form-field appearance="none"
class="width-100 date-hour-picker d-none d-md-block">
<input matInput [ngxMatDatetimePicker]="picker1" <input matInput [ngxMatDatetimePicker]="picker1"
placeholder="Choose a date" placeholder="Choose a date"
[formControl]="dateControlStart" [(ngModel)]="eventProcess.workflowInstanceDataFields.StartDate"
[min]="minDate" [max]="maxDate" [min]="minDate" [max]="maxDate"
[disabled]="disabled" [disabled]="disabled"
> >
@@ -111,9 +112,9 @@
<div class="ion-icon-class"> <div class="ion-icon-class">
<ion-icon slot="start" src="assets/images/icons-calendar.svg"></ion-icon> <ion-icon slot="start" src="assets/images/icons-calendar.svg"></ion-icon>
</div> </div>
<div class="ion-input-class"> <div class="ion-input-class width-100">
<ion-datetime <ion-datetime
class="d-none d-md-none" class="d-block d-md-none"
placeholder="Fim" placeholder="Fim"
[(ngModel)]="eventProcess.workflowInstanceDataFields.EndDate" [(ngModel)]="eventProcess.workflowInstanceDataFields.EndDate"
displayFormat="D MMM YYYY H:mm" displayFormat="D MMM YYYY H:mm"
@@ -124,10 +125,11 @@
> >
</ion-datetime> </ion-datetime>
<mat-form-field class="width-100 date-hour-picker d-none d-md-block"> <mat-form-field appearance="none"
class="width-100 date-hour-picker d-none d-md-block">
<input matInput [ngxMatDatetimePicker]="fim" <input matInput [ngxMatDatetimePicker]="fim"
placeholder="Choose a date" placeholder="Choose a date"
[formControl]="dateControlEnd" [(ngModel)]="eventProcess.workflowInstanceDataFields.EndDate"
[min]="minDate" [max]="maxDate" [min]="minDate" [max]="maxDate"
[disabled]="disabled" [disabled]="disabled"
> >
@@ -154,12 +156,11 @@
<ion-select <ion-select
placeholder="Selecione repetição" placeholder="Selecione repetição"
class="d-block d-md-none" class="d-block d-md-none"
[(ngModel)]="eventProcess.workflowInstanceDataFields.IsRecurring" [(ngModel)]="eventProcess.workflowInstanceDataFields.OccurrenceType"
selectedText="{{isRecurring}}" (ngModelChange)="onSelectedRecurringChanged($event)"
interface="action-sheet" interface="action-sheet"
Cancel-text="Cancelar" required> Cancel-text="Cancelar" required>
<ion-select-option value="false">Não se repete</ion-select-option> <ion-select-option *ngFor="let recurring of recurringTypes" value="{{recurring.Code}}">{{recurring.Description}}</ion-select-option>
<ion-select-option value="true">Repete</ion-select-option>
</ion-select> </ion-select>
<mat-form-field <mat-form-field
@@ -170,12 +171,13 @@
required required
appearance="none" appearance="none"
> >
<mat-select [(value)]="eventProcess.workflowInstanceDataFields.IsRecurring"> <mat-select [(ngModel)]="eventProcess.workflowInstanceDataFields.OccurrenceType"
<mat-option value="false"> (ngModelChange)="onSelectedRecurringChanged($event)"
Não se repete >
</mat-option> <mat-option
<mat-option value="true"> *ngFor="let recurring of recurringTypes" value="{{recurring.Code}}"
Repete >
{{recurring.Description}}
</mat-option> </mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
@@ -184,7 +186,46 @@
</div> </div>
</div> </div>
<div *ngIf="eventProcess.workflowInstanceDataFields.OccurrenceType != '-1'"
class="container-div width-100">
<div class="ion-item-class-2 d-flex">
<div class="ion-icon-class">
<ion-icon slot="start" src="assets/images/icons-calendar.svg"></ion-icon>
</div>
<div class="ion-input-class flex-grow-1">
<ion-datetime
class="d-block d-md-none"
placeholder="Última ocorrência"
[(ngModel)]="eventProcess.workflowInstanceDataFields.LastOccurrence"
displayFormat="D MMM YYYY H:mm"
minuteValues="0,15,30,45"
monthShortNames="Jan, Fev, Mar, Abr, Mai, Jun, Jul, Aug, Sep, Out, Nov, Dez"
min="2021"
max="2025"
>
</ion-datetime>
<mat-form-field class="date-hour-picker d-none d-md-block">
<input matInput [ngxMatDatetimePicker]="occurrrence"
placeholder="Choose a date"
[(ngModel)]="eventProcess.workflowInstanceDataFields.LastOccurrence"
[disabled]="disabled"
>
<mat-datepicker-toggle id="last-occurrence" matSuffix [for]="occurrrence"></mat-datepicker-toggle>
<ngx-mat-datetime-picker #occurrrence
[showSpinners]="showSpinners"
[showSeconds]="showSeconds"
[stepHour]="stepHour" [stepMinute]="stepMinute"
[stepSecond]="stepSecond"
[touchUi]="touchUi"
>
</ngx-mat-datetime-picker>
</mat-form-field>
</div>
</div>
</div>
<div class="container-div width-100"> <div class="container-div width-100">
<div class="ion-item-class-2"> <div class="ion-item-class-2">
@@ -50,25 +50,16 @@ export class EditEventToApproveComponent implements OnInit {
public stepHour = 1; public stepHour = 1;
public stepMinute = 5; public stepMinute = 5;
public stepSecond = 5; public stepSecond = 5;
recurringTypes: any;
public dateControlStart = new FormControl(moment("DD MM YYYY hh")); selectedRecurringType: any;
public dateControlEnd = new FormControl(moment("DD MM YYYY hh"));
showLoader = false showLoader = false
get dateStart () {
return this.dateControlStart.value
}
get dateEnd () {
return this.dateControlEnd.value
}
@ViewChild('picker') picker: any; @ViewChild('picker') picker: any;
@ViewChild('fim') fim: any; @ViewChild('fim') fim: any;
@ViewChild('inicio') inicio: any; @ViewChild('inicio') inicio: any;
@ViewChild('picker1') picker1: any; @ViewChild('picker1') picker1: any;
serialNumber: string serialNumber: string
loadedAttachments: Attachment[]= [] loadedAttachments: Attachment[]= []
@@ -77,6 +68,8 @@ export class EditEventToApproveComponent implements OnInit {
taskStartDate: "", taskStartDate: "",
workflowInstanceDataFields:{ workflowInstanceDataFields:{
Body: "", Body: "",
OccurrenceType: '',
LastOccurrence: '',
IsRecurring: false, IsRecurring: false,
ParticipantsList: [], ParticipantsList: [],
Agenda: '', Agenda: '',
@@ -128,41 +121,55 @@ export class EditEventToApproveComponent implements OnInit {
this.isEventEdited = false; this.isEventEdited = false;
this.dateControlStart = new FormControl(moment(new Date()));
this.dateControlEnd = new FormControl(moment(new Date()));
} }
ngOnInit() { ngOnInit() {
this.getTask() this.getTask()
console.log('HERE'); console.log('HERE');
this.getRecurrenceTypes();
this.selectedRecurringType = this.eventProcess.workflowInstanceDataFields.OccurrenceType;
setTimeout(() => {
this.selectedRecurringType = this.eventProcess.workflowInstanceDataFields.OccurrenceType;
console.log(this.selectedRecurringType);
}, 1000);
} }
async getTask() { async getTask() {
const result = await this.processes.GetTask(this.serialNumber).subscribe( result =>{ const result = await this.processes.GetTask(this.serialNumber).toPromise();
console.log(result);
this.eventProcess = result this.eventProcess = result
this.restoreDatepickerData()
// 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
this.getAttachments() try {
this.getAttachments()
} catch (error) {
}
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 {
this.isRecurring = "Repete"; this.isRecurring = "Repete";
} }
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);
@@ -170,27 +177,51 @@ export class EditEventToApproveComponent implements OnInit {
this.taskParticipantsCc.push(e); this.taskParticipantsCc.push(e);
} }
}) })
}) /* }) */
} }
getRecurrenceTypes() {
this.eventsService.getRecurrenceTypes().subscribe(res=>{
console.log(res);
this.recurringTypes = res;
});
}
onSelectedRecurringChanged(ev:any){
/* console.log(ev);
if(ev.length > 1){
console.log(ev.filter(data => data != '-1'));
this.selectedRecurringType = ev.filter(data => data != '-1');
}
if(ev.length == 0){
this.selectedRecurringType = "-1";
} */
}
openLastOccurrence() {
let input: any = document.querySelector('#last-occurrence')
if(input) {
input.click()
}
}
close() { close() {
this.modalController.dismiss(); this.modalController.dismiss();
} }
save() { save() {
// set dates to eventProcess object // set dates to eventProcess object
this.getDatepickerData()
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
} }
@@ -205,18 +236,22 @@ export class EditEventToApproveComponent implements OnInit {
IsRecurring: this.eventProcess.workflowInstanceDataFields.IsRecurring, IsRecurring: this.eventProcess.workflowInstanceDataFields.IsRecurring,
Location: this.eventProcess.workflowInstanceDataFields.Location, Location: this.eventProcess.workflowInstanceDataFields.Location,
Subject: this.eventProcess.workflowInstanceDataFields.Subject, Subject: this.eventProcess.workflowInstanceDataFields.Subject,
serialNumber: this.eventProcess.serialNumber, SerialNumber: this.eventProcess.serialNumber,
StartDate: this.eventProcess.workflowInstanceDataFields.StartDate, StartDate: this.eventProcess.workflowInstanceDataFields.StartDate,
MDEmail: this.eventProcess.workflowInstanceDataFields.MDEmail, MDEmail: this.eventProcess.workflowInstanceDataFields.MDEmail,
MDName: this.eventProcess.workflowInstanceDataFields.MDName, MDName: this.eventProcess.workflowInstanceDataFields.MDName,
Message: this.eventProcess.workflowInstanceDataFields.Message, Message: this.eventProcess.workflowInstanceDataFields.Message,
EventRecurrence: {
Type: this.eventProcess.workflowInstanceDataFields.OccurrenceType,
LastOccurrence: this.eventProcess.workflowInstanceDataFields.LastOccurrence,
},
ParticipantsList: this.eventProcess.workflowInstanceDataFields.ParticipantsList, ParticipantsList: this.eventProcess.workflowInstanceDataFields.ParticipantsList,
Private: false, Private: false,
ReviewUserComment: '' ReviewUserComment: ''
} }
console.log(event); console.log(event);
this.eventsService.postEventToApproveEdit(event).subscribe(()=>{ this.eventsService.postEventToApproveEdit(event).subscribe(()=>{
this.toastService.successMessage('Evento editado'); this.toastService.successMessage('Evento editado');
}, error =>{ }, error =>{
@@ -244,7 +279,7 @@ export class EditEventToApproveComponent implements OnInit {
}) })
this.modalController.dismiss(); //this.modalController.dismiss();
} }
@@ -261,11 +296,11 @@ export class EditEventToApproveComponent implements OnInit {
cssClass: 'attendee modal modal-desktop', cssClass: 'attendee modal modal-desktop',
backdropDismiss: false backdropDismiss: false
}); });
await modal.present(); await modal.present();
modal.onDidDismiss().then((data) => { modal.onDidDismiss().then((data) => {
if(data){ if(data){
data = data['data']; data = data['data'];
@@ -285,7 +320,7 @@ export class EditEventToApproveComponent implements OnInit {
this.taskParticipants = data; this.taskParticipants = data;
this.postEvent.Attendees = data; this.postEvent.Attendees = data;
} }
setIntervenientCC(data) { setIntervenientCC(data) {
this.taskParticipantsCc = data; this.taskParticipantsCc = data;
} }
@@ -297,7 +332,7 @@ export class EditEventToApproveComponent implements OnInit {
} }
addParticipantsCC(){ addParticipantsCC(){
this.adding = 'CC' this.adding = 'CC'
this.openAttendees(); this.openAttendees();
} }
@@ -339,7 +374,7 @@ export class EditEventToApproveComponent implements OnInit {
await modal.present(); await modal.present();
modal.onDidDismiss().then( async (res)=>{ modal.onDidDismiss().then( async (res)=>{
if(res){ if(res){
const data: SearchDocument = res.data.selected; const data: SearchDocument = res.data.selected;
const DocumentToSave: any = { const DocumentToSave: any = {
@@ -370,18 +405,7 @@ export class EditEventToApproveComponent implements OnInit {
}); });
} }
restoreDatepickerData() {
this.dateControlStart = new FormControl(moment(new Date(this.eventProcess.workflowInstanceDataFields.StartDate)));
this.dateControlEnd = new FormControl(moment(new Date(this.eventProcess.workflowInstanceDataFields.EndDate)));
}
getDatepickerData() {
this.eventProcess.workflowInstanceDataFields.StartDate = this.dateStart }
this.eventProcess.workflowInstanceDataFields.EndDate = this.dateEnd
}
}