Uncomment all method that use k2 service

This commit is contained in:
Peter Maquiran
2021-04-21 14:27:55 +01:00
parent 7d882d3a11
commit ef1c260f77
9 changed files with 98 additions and 63 deletions
@@ -41,12 +41,12 @@ export class EventListPage implements OnInit {
} }
// this.LoadToApproveEvents(); this.LoadToApproveEvents();
this.router.events.forEach((event) => { this.router.events.forEach((event) => {
if(event instanceof NavigationEnd && event.url == this.router.url) { if(event instanceof NavigationEnd && event.url == this.router.url) {
// this.LoadToApproveEvents(); this.LoadToApproveEvents();
} }
}); });
@@ -123,14 +123,14 @@
<!-- Aside right --> <!-- Aside right -->
<div class="aside-content d-none flex-column height-100"> <div class="aside-content d-none flex-column height-100">
<!--
<app-empty-container [texto]="emptyTextDescription" *ngIf="showEmptyContainer" class="d-flex height-100 flex-column"></app-empty-container> <app-empty-container [texto]="emptyTextDescription" *ngIf="showEmptyContainer" class="d-flex height-100 flex-column"></app-empty-container>
<app-events-to-approve [profile]="'MDGPR'" *ngIf="showEventsToApprove" class="d-flex height-100 flex-column"></app-events-to-approve> <app-events-to-approve [profile]="'MDGPR'" *ngIf="showEventsToApprove" class="d-flex height-100 flex-column"></app-events-to-approve>
<app-expedients (openExpedientDetail)="openExpedientPage($event)" [profile]="profile" class="d-flex height-100 flex-column" *ngIf="showExpedients"></app-expedients> <app-expedients (openExpedientDetail)="openExpedientPage($event)" [profile]="profile" class="d-flex height-100 flex-column" *ngIf="showExpedients"></app-expedients>
<app-expediente (openExpedientList)="openExpedientListPage()" [profile]="profile" [serialNumber]="serialNumber" class="d-flex height-100 flex-column" *ngIf="showExpedientDetail"></app-expediente> <app-expediente (openExpedientList)="openExpedientListPage()" [profile]="profile" [serialNumber]="serialNumber" class="d-flex height-100 flex-column" *ngIf="showExpedientDetail"></app-expediente>
-->
</div> </div>
</div> </div>
@@ -1,7 +1,6 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { ProcessesService } from 'src/app/services/processes.service'; import { ProcessesService } from 'src/app/services/processes.service';
import { AlertService } from 'src/app/services/alert.service'; import { AlertService } from 'src/app/services/alert.service';
import { EventsService } from 'src/app/services/events.service';
import { ModalController } from '@ionic/angular'; import { ModalController } from '@ionic/angular';
import { EventListPage } from './event-list/event-list.page'; import { EventListPage } from './event-list/event-list.page';
import { ExpedientePage } from './expediente/expediente.page'; import { ExpedientePage } from './expediente/expediente.page';
@@ -59,16 +58,22 @@ export class GabineteDigitalPage implements OnInit {
}; };
this.activatedRoute.queryParams.subscribe(params => { this.activatedRoute.queryParams.subscribe(params => {
if(params["show"]){ if(params["show"]) {
// this.openExpedientListPage(); this.openExpedientListPage();
this.selectedElement='Correspondence'
} }
else if(params["events"]){ else if(params["events"]) {
// this.openEventsToApprovePage("MDGPR"); this.openEventsToApprovePage("MDGPR");
this.selectedElement='approval'
} else {
this.openEventsToApprovePage('MDGPR');
this.selectedElement='approval'
} }
}); });
}
}
closeAllDesktopComponent(){ closeAllDesktopComponent(){
this.desktopComponent = { this.desktopComponent = {
@@ -83,11 +88,11 @@ export class GabineteDigitalPage implements OnInit {
this.router.events.forEach((event) => { this.router.events.forEach((event) => {
if(event instanceof NavigationEnd && event.url == this.router.url) { if(event instanceof NavigationEnd && event.url == this.router.url) {
//this.LoadCounts(); this.LoadCounts();
} }
}); });
// this.LoadCounts(); this.LoadCounts();
/* this.eventService.getAllMdEvents.subscribe(res=>{ /* this.eventService.getAllMdEvents.subscribe(res=>{
console.log(res); console.log(res);
@@ -54,6 +54,7 @@ export class EditEventComponent implements OnInit {
ngOnInit() { ngOnInit() {
if(!this.restoreTemporaryData()){ if(!this.restoreTemporaryData()){
// clear
if(this.postEvent){ if(this.postEvent){
if( this.postEvent.Body){ if( this.postEvent.Body){
@@ -118,7 +119,11 @@ export class EditEventComponent implements OnInit {
header: 'Evento actualizado', header: 'Evento actualizado',
buttons: ['OK'] buttons: ['OK']
}); });
await alert.present();
setTimeout(()=>{
alert.dismiss();
}, 1500);
}); });
@@ -44,11 +44,11 @@ export class EventListComponent implements OnInit {
this.profile = 'PR' this.profile = 'PR'
} }
// this.LoadToApproveEvents(); this.LoadToApproveEvents();
this.router.events.forEach((event) => { this.router.events.forEach((event) => {
if(event instanceof NavigationEnd && event.url == this.router.url) { if(event instanceof NavigationEnd && event.url == this.router.url) {
// this.LoadToApproveEvents(); this.LoadToApproveEvents();
} }
}); });
} }
@@ -29,7 +29,7 @@ export class NewEventPage implements OnInit {
@Output() setIntervenient = new EventEmitter<any>(); @Output() setIntervenient = new EventEmitter<any>();
@Output() setIntervenientCC = new EventEmitter<any>(); @Output() setIntervenientCC = new EventEmitter<any>();
@Input() postEvent: Event; postEvent: Event;
@Output() onAddEvent = new EventEmitter<any>(); @Output() onAddEvent = new EventEmitter<any>();
@Output() openAttendeesComponent = new EventEmitter<any>(); @Output() openAttendeesComponent = new EventEmitter<any>();
@Output() clearContact = new EventEmitter<any>(); @Output() clearContact = new EventEmitter<any>();
@@ -49,6 +49,7 @@ export class NewEventPage implements OnInit {
ngOnInit() { ngOnInit() {
if(!this.restoreTemporaryData()){ if(!this.restoreTemporaryData()){
// clear
this.postEvent = new Event(); this.postEvent = new Event();
this.eventBody = { BodyType : "1", Text : ""}; this.eventBody = { BodyType : "1", Text : ""};
@@ -124,7 +125,6 @@ export class NewEventPage implements OnInit {
this.setIntervenientCC.emit(this.taskParticipantsCc); this.setIntervenientCC.emit(this.taskParticipantsCc);
} }
} }
async getDoc(){ async getDoc(){
@@ -154,14 +154,12 @@ export class NewEventPage implements OnInit {
this.setIntervenientCC.emit([]); this.setIntervenientCC.emit([]);
} }
async save(){ async save(){
this.postEvent.Attendees = this.taskParticipants.concat(this.taskParticipantsCc); this.postEvent.Attendees = this.taskParticipants.concat(this.taskParticipantsCc);
if(this.documents.length >= 0){ if(this.documents.length >= 0) {
this.postEvent.HasAttachments = true; this.postEvent.HasAttachments = true;
} }
@@ -184,8 +182,14 @@ export class NewEventPage implements OnInit {
}; };
}); });
DocumentToSave.forEach((attachments) => { DocumentToSave.forEach((attachments, i) => {
this.attachmentsService.setEventAttachmentById(attachments).subscribe(); this.attachmentsService.setEventAttachmentById(attachments).subscribe((res) =>{
if(DocumentToSave.length == (i+1)){
this.close();
}
});
}); });
}); });
@@ -196,7 +200,7 @@ export class NewEventPage implements OnInit {
const eventId: string = id; const eventId: string = id;
const toDocumentTosSave: EventAttachment[] = this.documents.map((e) => { const DocumentToSave: EventAttachment[] = this.documents.map((e) => {
return { return {
SourceTitle: e.Assunto, SourceTitle: e.Assunto,
ParentId: eventId, ParentId: eventId,
@@ -209,12 +213,21 @@ export class NewEventPage implements OnInit {
}; };
}); });
toDocumentTosSave.forEach((attachments) => { DocumentToSave.forEach((attachments, i) => {
this.attachmentsService.setEventAttachmentById(attachments); this.attachmentsService.setEventAttachmentById(attachments).subscribe((res) =>{
if(DocumentToSave.length == (i+1)){
this.close();
}
});
}); });
}); });
} }
this.close();
} }
removeAttachment(index: number){ removeAttachment(index: number){
@@ -30,10 +30,10 @@
</ion-list> </ion-list>
<hr/> <hr/>
<ion-list lines="none" *ngIf="taskParticipants.length >= 1 && adding == 'intervenient' " class="flex-grow-1 overflow-y-auto height-100 pb-0" > <ion-list lines="none" *ngIf="LtaskParticipants.length >= 1 && adding == 'intervenient' " class="flex-grow-1 overflow-y-auto height-100 pb-0" >
<div class="px-20 font-15 pt-20" style="border-top:1px solid #ebebeb;font-weight: 500;" *ngIf="taskParticipants.length >= 1 || taskParticipantsCc.length >= 1" > Destinatário</div> <div class="px-20 font-15 pt-20" style="border-top:1px solid #ebebeb;font-weight: 500;" *ngIf="LtaskParticipants.length >= 1 || LtaskParticipantsCc.length >= 1" > Destinatário</div>
<ion-item-sliding class="px-20"> <ion-item-sliding class="px-20">
<ion-item *ngFor="let attendee of taskParticipants;" class="d-flex"> <ion-item *ngFor="let attendee of LtaskParticipants;" class="d-flex">
<div class="pr-10"> <div class="pr-10">
<ion-icon class="font-35" src="assets/images/icons-userprofile.svg"></ion-icon> <ion-icon class="font-35" src="assets/images/icons-userprofile.svg"></ion-icon>
</div> </div>
@@ -47,11 +47,11 @@
</ion-item> </ion-item>
</ion-item-sliding> </ion-item-sliding>
</ion-list> </ion-list>
<ion-list lines="none" *ngIf="taskParticipantsCc.length >= 1 && adding == 'CC' " class="flex-grow-1 overflow-y-auto height-100 pb-0" > <ion-list lines="none" *ngIf="LtaskParticipantsCc.length >= 1 && adding == 'CC' " class="flex-grow-1 overflow-y-auto height-100 pb-0" >
<div class="px-20 font-15 pt-20" style="border-top:1px solid #ebebeb;font-weight: 500;" *ngIf="taskParticipants.length >= 1 || taskParticipantsCc.length >= 1" > Destinatário</div> <div class="px-20 font-15 pt-20" style="border-top:1px solid #ebebeb;font-weight: 500;" *ngIf="LtaskParticipants.length >= 1 || LtaskParticipantsCc.length >= 1" > Destinatário</div>
<ion-item-sliding class="px-20"> <ion-item-sliding class="px-20">
<ion-item *ngFor="let attendee of taskParticipantsCc;" class="d-flex"> <ion-item *ngFor="let attendee of LtaskParticipantsCc;" class="d-flex">
<div class="pr-10"> <div class="pr-10">
<ion-icon class="font-35" src="assets/images/icons-userprofile.svg"></ion-icon> <ion-icon class="font-35" src="assets/images/icons-userprofile.svg"></ion-icon>
</div> </div>
@@ -15,14 +15,6 @@ export class AttendeeModalPage implements OnInit {
showLoader: boolean = false; showLoader: boolean = false;
eventPersons: EventPerson[]; eventPersons: EventPerson[];
@Input() taskParticipants:EventPerson[] = [];
@Input() taskParticipantsCc:EventPerson[] = [];
constructor(
private modalCtrl: ModalController,
private contactsService: ContactsService ) {
}
@Output() closeComponent = new EventEmitter<any>(); @Output() closeComponent = new EventEmitter<any>();
@@ -30,6 +22,23 @@ export class AttendeeModalPage implements OnInit {
@Output() setIntervenientCC = new EventEmitter<any>(); @Output() setIntervenientCC = new EventEmitter<any>();
@Output() dynamicSetIntervenient = new EventEmitter<any>(); @Output() dynamicSetIntervenient = new EventEmitter<any>();
@Input() taskParticipants:EventPerson[] = [];
@Input() taskParticipantsCc:EventPerson[] = [];
LtaskParticipants: EventPerson[] = [];
LtaskParticipantsCc: EventPerson[] = [];
constructor(
private modalCtrl: ModalController,
private contactsService: ContactsService ) {
this.LtaskParticipants = this.taskParticipants;
this.LtaskParticipantsCc = this.taskParticipantsCc;
}
currentPath = window.location.pathname; currentPath = window.location.pathname;
@Input() adding: "intervenient" | "CC"; @Input() adding: "intervenient" | "CC";
@@ -37,12 +46,12 @@ export class AttendeeModalPage implements OnInit {
this.fetchContacts(""); this.fetchContacts("");
if(this.taskParticipants == null || this.taskParticipants == undefined) { if(this.LtaskParticipants == null || this.LtaskParticipants == undefined) {
this.taskParticipants = []; this.LtaskParticipants = [];
} }
if(this.taskParticipantsCc == null || this.taskParticipantsCc == undefined) { if(this.LtaskParticipantsCc == null || this.LtaskParticipantsCc == undefined) {
this.taskParticipantsCc = []; this.LtaskParticipantsCc = [];
} }
} }
@@ -52,23 +61,26 @@ export class AttendeeModalPage implements OnInit {
} }
save(){ save(){
this.setIntervenient.emit(this.taskParticipants); this.setIntervenient.emit(this.LtaskParticipants);
this.setIntervenientCC.emit(this.taskParticipantsCc); this.setIntervenientCC.emit(this.LtaskParticipantsCc);
this.closeComponent.emit(); this.closeComponent.emit();
} }
setContactWithClose(){ setContactWithClose() {
if(this.currentPath == '/home/gabinete-digital'){
this.setIntervenient.emit(this.taskParticipants); if(this.currentPath == '/home/gabinete-digital') {
this.setIntervenientCC.emit(this.taskParticipantsCc); console.log('set!!!!! ')
this.setIntervenient.emit(this.LtaskParticipants);
this.setIntervenientCC.emit(this.LtaskParticipantsCc);
} }
console.log('data', this.taskParticipants, this.taskParticipantsCc ); /* console.log('data', this.LtaskParticipants, this.LtaskParticipantsCc ); */
this.dynamicSetIntervenient.emit({ this.dynamicSetIntervenient.emit({
taskParticipants: this.taskParticipants, LtaskParticipants: this.LtaskParticipants,
taskParticipantsCc: this.taskParticipantsCc LtaskParticipantsCc: this.LtaskParticipantsCc
}) })
} }
async selectContact(itm: EventPerson){ async selectContact(itm: EventPerson){
@@ -76,12 +88,12 @@ export class AttendeeModalPage implements OnInit {
if(this.adding == "intervenient") { if(this.adding == "intervenient") {
itm.IsRequired = true; itm.IsRequired = true;
this.taskParticipants.push(itm); this.LtaskParticipants.push(itm);
} else if (this.adding == "CC") { } else if (this.adding == "CC") {
itm.IsRequired = false; itm.IsRequired = false;
this.taskParticipantsCc.push(itm); this.LtaskParticipantsCc.push(itm);
} else { } else {
// alert('bug') // alert('bug')
} }
@@ -101,7 +113,7 @@ export class AttendeeModalPage implements OnInit {
filterSearchList(itm: EventPerson): boolean { filterSearchList(itm: EventPerson): boolean {
const result1 = this.taskParticipants.find((contact, index)=>{ const result1 = this.LtaskParticipants.find((contact, index)=>{
if(contact.Name == itm.Name && contact.EmailAddress == itm.EmailAddress){ if(contact.Name == itm.Name && contact.EmailAddress == itm.EmailAddress){
index = index; index = index;
@@ -115,7 +127,7 @@ export class AttendeeModalPage implements OnInit {
} }
const result2 = this.taskParticipantsCc.find((contact, index)=>{ const result2 = this.LtaskParticipantsCc.find((contact, index)=>{
if(contact.Name == itm.Name && contact.EmailAddress == itm.EmailAddress){ if(contact.Name == itm.Name && contact.EmailAddress == itm.EmailAddress){
index = index; index = index;
@@ -137,7 +149,7 @@ export class AttendeeModalPage implements OnInit {
if(this.adding == "intervenient"){ if(this.adding == "intervenient"){
this.taskParticipants = this.taskParticipants.filter((contact, index) =>{ this.LtaskParticipants = this.LtaskParticipants.filter((contact, index) =>{
if(contact.Name != itm.Name && contact.EmailAddress != itm.EmailAddress){ if(contact.Name != itm.Name && contact.EmailAddress != itm.EmailAddress){
return contact; return contact;
@@ -148,7 +160,7 @@ export class AttendeeModalPage implements OnInit {
} else if (this.adding == "CC") { } else if (this.adding == "CC") {
this.taskParticipantsCc = this.taskParticipantsCc.filter((contact, index) =>{ this.LtaskParticipantsCc = this.LtaskParticipantsCc.filter((contact, index) =>{
if(contact.Name != itm.Name && contact.EmailAddress != itm.EmailAddress){ if(contact.Name != itm.Name && contact.EmailAddress != itm.EmailAddress){
return contact; return contact;