improve gabinete digital add ..

This commit is contained in:
Peter Maquiran
2021-04-01 15:26:26 +01:00
parent e6ec9af049
commit 3d229ade11
4 changed files with 88 additions and 67 deletions
@@ -7,7 +7,6 @@ import { Participant } from 'src/app/models/participant.model';
import { Folder } from 'src/app/models/folder.model';
import { AuthService } from 'src/app/services/auth.service';
import { ProcessesService } from 'src/app/services/processes.service';
import { StorageService } from 'src/app/services/storage.service';
import { AddParticipantsCcModalPage } from '../add-participants-cc-modal/add-participants-cc-modal.page';
import { AddParticipantsModalPage } from '../add-participants-modal/add-participants-modal.page';
import { environment } from 'src/environments/environment';
@@ -40,10 +39,11 @@ export class ExpedientTaskModalPage implements OnInit {
dispatchFolder: Folder;
participants: Participant[];
contacts: EventPerson[] = [];
contacts= [];
// trigger hide and show for attendee component
showAttendees= false;
adding: "intervenient" | "CC"
constructor(
private modalController: ModalController,
@@ -78,17 +78,8 @@ export class ExpedientTaskModalPage implements OnInit {
ngOnInit() {
this.taskDate = new Date(this.task.taskStartDate);
/* this.authService.userData$.subscribe((res:any)=>{
console.log(res);
});
console.log(this.user); */
/* console.log(this.task) */
/* console.log(this.task.serialNumber); */
this.getAttachments();
/* console.log(this.getSubjectType()); */
this.getAttachments();
}
close(){
@@ -159,63 +150,78 @@ export class ExpedientTaskModalPage implements OnInit {
}
async addParticipants(){
const modal = await this.modalController.create({
component: AddParticipantsModalPage,
componentProps: {
eventPersons: this.participants
},
cssClass: 'add-participants-modal',
backdropDismiss: false
});
await modal.present();
modal.onDidDismiss().then((res) => {
this.taskParticipants = res.data;
let newattendees: EventPerson[] = res['data'];
if(newattendees!= null){
newattendees.forEach(newattendee => {
let att = {
'UserEmail': newattendee.EmailAddress,
'UserType': 'I',
};
if(this.participants == null){
this.participants = new Array();
}
this.participants.push(att);
this.adding = "intervenient";
this.contacts = this.taskParticipants;
if(window.innerWidth <=1024){
const modal = await this.modalController.create({
component: AddParticipantsModalPage,
componentProps: {
eventPersons: this.participants
},
cssClass: 'add-participants-modal',
backdropDismiss: false
});
}
this.postData.UsersSelected = this.participants;
console.log(this.postData);
});
await modal.present();
modal.onDidDismiss().then((res) => {
this.taskParticipants = res.data;
let newattendees: EventPerson[] = res['data'];
if(newattendees!= null){
newattendees.forEach(newattendee => {
let att = {
'UserEmail': newattendee.EmailAddress,
'UserType': 'I',
};
if(this.participants == null){
this.participants = new Array();
}
this.participants.push(att);
});
}
this.postData.UsersSelected = this.participants;
console.log(this.postData);
});
} else {
}
}
async addParticipantsCc(){
const modal = await this.modalController.create({
component: AddParticipantsCcModalPage,
componentProps: {
eventPersons: this.participants
},
cssClass: 'add-participants-cc-modal',
backdropDismiss: false
});
await modal.present();
modal.onDidDismiss().then((res) => {
this.taskParticipantsCc = res.data;
let newattendees: EventPerson[] = res['data'];
if(newattendees!= null){
newattendees.forEach(newattendee => {
let att = {
'UserEmail': newattendee.EmailAddress,
'UserType': 'CC',
};
if(this.participants == null){
this.participants = new Array();
}
this.participants.push(att);
this.adding = "CC";
this.contacts = this.taskParticipantsCc;
if(window.innerWidth <=1024){
const modal = await this.modalController.create({
component: AddParticipantsCcModalPage,
componentProps: {
eventPersons: this.participants
},
cssClass: 'add-participants-cc-modal',
backdropDismiss: false
});
}
this.postData.UsersSelected = this.participants;
console.log(this.postData);
});
await modal.present();
modal.onDidDismiss().then((res) => {
this.taskParticipantsCc = res.data;
let newattendees: EventPerson[] = res['data'];
if(newattendees!= null){
newattendees.forEach(newattendee => {
let att = {
'UserEmail': newattendee.EmailAddress,
'UserType': 'CC',
};
if(this.participants == null){
this.participants = new Array();
}
this.participants.push(att);
});
}
this.postData.UsersSelected = this.participants;
console.log(this.postData);
});
}
}
async distartExpedientModal(){
@@ -236,7 +242,17 @@ export class ExpedientTaskModalPage implements OnInit {
}
async setContact(data:EventPerson[]){
this.contacts = data;
if(this.adding == "intervenient"){
console.log('intervenient')
this.contacts = data;
this.taskParticipants = data;
} else if (this.adding == "CC") {
console.log('CCCC')
this.taskParticipantsCc = data;
}
}
async closeComponent(){
@@ -134,7 +134,7 @@
<div class="list-people">
<ion-item lines="none">
<ion-list>
<ion-label *ngIf="!eventAttendees" class="list-people-title">Adicionar intervenientes</ion-label>
<ion-label *ngIf="eventAttendees.length ==0" class="list-people-title">Adicionar intervenientes</ion-label>
<ion-label *ngFor="let participant of eventAttendees">{{participant.Name}}</ion-label>
</ion-list>
</ion-item>
@@ -10,6 +10,7 @@ import { EventPerson } from 'src/app/models/eventperson.model';
})
export class AttendeeModalPage implements OnInit {
// Defined by the API
contacts: EventPerson[];
showLoader: boolean = false;
selectedContact: EventPerson[] =[];
@@ -28,6 +29,10 @@ export class AttendeeModalPage implements OnInit {
this.fetchContacts("");
this.selectedContact = this.eventAttendees;
}
ngOnChanges(){
console.log('change !!!')
}
save(){
// set data to agenda component
@@ -39,7 +39,7 @@
<div class="tab mr-20 d-flex align-center" (click)="changeRoute('/home/publications')" [class.active]="locationPathname() == '/home/publications'">
<ion-icon class="font-40" src='assets/images/icons-nav-a-es-inactive.svg'></ion-icon>
<span>Ações</span>
<span>Acções</span>
</div>