Merge branch 'developer-c' of https://bitbucket.org/equilibriumito/gabinete-digital into developer

This commit is contained in:
tiago.kayaya
2021-04-08 14:00:58 +01:00
10 changed files with 128 additions and 84 deletions
+3
View File
@@ -349,9 +349,12 @@
></app-new-event>
<!-- Edit -->
<app-edit-event *ngIf="mobileComponent.showEditEvent"
[taskParticipants]="taskParticipants"
[taskParticipantsCc]="taskParticipantsCc"
[profile]="profile"
[selectedSegment]="segment"
[postEvent]="postEvent"
(clearPostEvent)="clearPostEvent"
(clearContact)="clearContact()"
(openAttendeesComponent)="openAttendeesComponent($event)"
(setContact)="setContact($event)"
+12 -8
View File
@@ -94,11 +94,11 @@ export class AgendaPage implements OnInit {
selectedEventId: string | number;
postEvent: any;
// temporary data
taskParticipants: any = [];
taskParticipantsCc: any = [];
adding: "intervenient" | "CC" = "intervenient";
@ViewChild(CalendarComponent) myCal: CalendarComponent;
segment: "Combinado" | "Pessoal" | "Oficial";
@@ -209,6 +209,11 @@ export class AgendaPage implements OnInit {
// show information about the clicked event in timeline
eventClicked({ event }: { event: CalendarEvent }): void {
/* console.log('Event clicked', event); */
//clear
this.setIntervenient([]);
this.setIntervenientCC([]);
this.clearPostEvent();
this.IsEvent= "view";
@@ -995,12 +1000,7 @@ export class AgendaPage implements OnInit {
// open component
async openAttendeesComponent(data) {
if(Array.isArray(data)){
if(data.length >= 1){
this.contacts = data ;
}
}
this.adding = data.type
this.cloneAllmobileComponent();
this.mobileComponent.showAttendees = true;
@@ -1061,4 +1061,8 @@ export class AgendaPage implements OnInit {
this.adding = adding;
}
async clearPostEvent(){
this.postEvent = false;
}
}
@@ -1,4 +1,5 @@
<ion-content>
<!-- Edit event for Inicio -->
<div class="main-content height-100">
<div class="content d-flex flex-column width-md-100 height-100">
@@ -224,7 +225,7 @@
[taskParticipants]="taskParticipants"
[taskParticipantsCc]="taskParticipantsCc"
[adding]="adding"
(dynamicSetIntervenient)="dynamicSetIntervenient($event)"
></app-attendee-modal>
</div>
@@ -44,17 +44,20 @@ export class EditEventPage implements OnInit {
this.postEvent.Body.Text = this.postEvent.Body.Text.replace(/<[^>]+>/g, '');
}
this.taskParticipants = [];
this.taskParticipantsCc = [];
if(this.postEvent.Attendees == null){
this.taskParticipants = []
} else {
this.taskParticipants = this.postEvent.Attendees;
this.postEvent.Attendees.forEach(e =>{
if(e.IsRequired){
this.taskParticipants.push(e);
} else {
this.taskParticipantsCc.push(e);
}
})
}
this.taskParticipantsCc = [];
if(this.postEvent.IsRecurring == false){
this.isRecurring = "Não se repete";
}
@@ -80,7 +83,9 @@ export class EditEventPage implements OnInit {
}
save(){
this.postEvent.Attendees = this.taskParticipants.concat(this.taskParticipantsCc)
this.eventsService.editEvent(this.postEvent, 2, 3).subscribe(async () => {
const alert = await this.alertController.create({
cssClass: 'my-custom-class',
@@ -122,7 +127,6 @@ export class EditEventPage implements OnInit {
}
});
}
}
setIntervenient(data){
@@ -145,4 +149,10 @@ export class EditEventPage implements OnInit {
this.openAttendees();
}
dynamicSetIntervenient({taskParticipants, taskParticipantsCc}){
this.taskParticipants = taskParticipants;
this.taskParticipantsCc = taskParticipantsCc;
}
}
@@ -114,6 +114,7 @@
</ion-list>
</div>
</div>
<div class="aside-right flex-column height-100">
<app-empty-container
@@ -132,9 +133,7 @@
(setIntervenientCC)="setIntervenientCC($event)"
(setContact)="setContact($event)"
></app-attendee-modal>
</div>
</div>
</div>
</ion-content>
@@ -108,11 +108,9 @@ export class ExpedientTaskModalPage implements OnInit {
}
cancelTask(){
this.modalController.dismiss(null);
//this.viewExpedientDetail();
}
saveTask(){
/* console.log(this.taskType); */
switch (this.taskType)
{
@@ -244,7 +242,6 @@ export class ExpedientTaskModalPage implements OnInit {
}
async distartExpedientModal(){
console.log(this.task.serialNumber);
const modal = await this.modalController.create({
component: DiscartExpedientModalPage,
componentProps: {
@@ -3,7 +3,7 @@
<div class="main-header">
<div class="title-content">
<div class="middle">
<ion-label class="title">Editar Evento</ion-label>
<ion-label class="title">Editar Evento agenda</ion-label>
</div>
</div>
</div>
@@ -130,43 +130,43 @@
</div>
</div>
<div class="container-div d-flex">
<div class="ion-item-class-2 width-100 d-flex">
<div class=" d-flex width-100">
<div class="ion-item-class-2 width-100">
<div class="ion-icon-class">
<ion-icon slot="start" src="assets/images/icons-person.svg"></ion-icon>
</div>
<div (click)="openAttendees()" class="ion-input-class d-flex flex-grow-1 width-100 overflow-hidden ">
<div class="list-people flex-grow-1">
<div class="ion-input-class-no-height">
<div class="list-people">
<ion-item lines="none">
<ion-list>
<ion-label class="list-people-title">Ver ou editar participantes</ion-label>
<ion-label hidden >Text</ion-label>
<ion-label *ngIf="taskParticipants.length == 0" class="list-people-title">Adicionar intervenientes</ion-label>
<ion-label *ngFor="let participant of taskParticipants">{{participant.Name}}</ion-label>
</ion-list>
</ion-item>
</div>
<div class="d-flex justify-center align-center font-35">
<ion-icon slot="start" src="assets/images/icons-arrow-forward.svg"></ion-icon>
<div class="add-people">
<ion-icon (click)="addParticipants()" class="font-35" slot="start" src="assets/images/icons-arrow-forward.svg"></ion-icon>
</div>
</div>
</div>
</div>
<div hidden class="container-div d-flex">
<div class="ion-item-class-2 width-100 d-flex">
<div class=" d-flex width-100">
<div class="ion-item-class-2 width-100">
<div class="ion-icon-class">
<ion-icon slot="start" src="assets/images/icons-people-cc.svg"></ion-icon>
</div>
<div class="ion-input-class d-flex flex-grow-1 width-100 overflow-hidden">
<div class="list-people flex-grow-1">
<div class="ion-input-class-no-height">
<div class="list-people">
<ion-item lines="none">
<ion-list>
<ion-label class="list-people-title">Com conhecimento</ion-label>
<ion-label hidden >Text</ion-label>
<ion-label *ngIf="taskParticipantsCc.length == 0" class="list-people-title">Como conhecido</ion-label>
<ion-label *ngFor="let participant of taskParticipantsCc">{{participant.Name}}</ion-label>
</ion-list>
</ion-item>
</div>
<div class="d-flex justify-center align-center font-35">
<ion-icon slot="start" src="assets/images/icons-arrow-forward.svg"></ion-icon>
<div class="add-people">
<ion-icon (click)="addParticipantsCc()" class="font-35" slot="start" src="assets/images/icons-arrow-forward.svg"></ion-icon>
</div>
</div>
</div>
@@ -22,25 +22,25 @@ export class EditEventComponent implements OnInit {
eventAttendees: EventPerson[];
minDate: string;
@Input() taskParticipants: EventPerson[];
@Input() taskParticipantsCc: any = [];
@Input() profile:string;
@Input() selectedSegment: string;
@Input() postEvent: any;
@Output() clearContact = new EventEmitter<any>();
@Output() openAttendeesComponent = new EventEmitter<any>();
@Output() closeComponent = new EventEmitter<any>();
@Output() setIntervenient = new EventEmitter<any>();
@Output() setIntervenientCC = new EventEmitter<any>();
@Output() clearPostEvent = new EventEmitter<any>();
constructor(
private modalController: ModalController,
private eventsService: EventsService,
public alertController: AlertController,
)
{
) {
}
@@ -48,8 +48,18 @@ export class EditEventComponent implements OnInit {
if(this.postEvent){
this.postEvent.Body.Text = this.postEvent.Body.Text.replace(/<[^>]+>/g, '');
}
console.log(this.postEvent);
// attendees list
if(this.postEvent.Attendees != null) {
this.postEvent.Attendees.forEach(e =>{
if(e.IsRequired){
this.taskParticipants.push(e);
} else {
this.taskParticipantsCc.push(e);
}
})
}
this.isEventEdited = false;
if(this.postEvent.IsRecurring == false){
@@ -61,32 +71,45 @@ export class EditEventComponent implements OnInit {
}
close(){
console.log('!!!!!!!!!!!!!!!!! close')
this.closeComponent.emit();
this.setIntervenient.emit([]);
this.setIntervenientCC.emit([]);
this.clearContact.emit();
}
save(){
this.eventsService.editEvent(this.postEvent, 2, 3).subscribe(async () => {
async save(){
this.postEvent.Attendees = this.taskParticipants.concat(this.taskParticipantsCc)
await this.eventsService.editEvent(this.postEvent, 2, 3).subscribe(async () => {
const alert = await this.alertController.create({
cssClass: 'my-custom-class',
header: 'Evento actualizado',
buttons: ['OK']
});
await alert.present();
});
this.clearPostEvent.emit();
this.closeComponent.emit();
this.clearContact.emit();
this.setIntervenient.emit([]);
this.setIntervenientCC.emit([]);
this.close();
}
async openAttendees() {
async addParticipants() {
this.openAttendeesComponent.emit({
type: "intervenient"
});
this.clearContact.emit();
}
async addParticipantsCc() {
this.openAttendeesComponent.emit({
type: "CC"
});
this.openAttendeesComponent.emit();
this.clearContact.emit();
}
@@ -69,7 +69,7 @@
<!-- Hide footer in gabinete-digital -->
<ion-footer class="ion-no-border" *ngIf="currentPath != '/home/gabinete-digital' ">
<ion-toolbar class="width-100 d-flex justify-space-between px-20">
<ion-toolbar *ngIf="currentPath != '/home/events'" class="width-100 d-flex justify-space-between px-20">
<ion-buttons slot="start">
<ion-button class="btn-cancel" fill="clear" color="#061b52" (click)="close()">
<ion-label>Cancelar</ion-label>
@@ -13,13 +13,16 @@ export class AttendeeModalPage implements OnInit {
// Defined by the API
contacts: EventPerson[];
showLoader: boolean = false;
selectedContact: EventPerson[] =[];
eventPersons: EventPerson[];
@Input() taskParticipants:EventPerson[] = [];
@Input() taskParticipantsCc:EventPerson[] = [];
constructor(private modalCtrl: ModalController, private contactsService: ContactsService) { }
constructor(
private modalCtrl: ModalController,
private contactsService: ContactsService ) {
}
@Output() closeComponent = new EventEmitter<any>();
@@ -46,7 +49,6 @@ export class AttendeeModalPage implements OnInit {
ngOnChanges(event){}
save(){
this.setIntervenient.emit(this.taskParticipants);
this.setIntervenientCC.emit(this.taskParticipantsCc);
@@ -61,8 +63,6 @@ export class AttendeeModalPage implements OnInit {
}
close(){
// this.modalCtrl.dismiss(null);
this.selectedContact = [];
this.closeComponent.emit();
}
@@ -72,29 +72,36 @@ export class AttendeeModalPage implements OnInit {
filterSearchList(itm: EventPerson): boolean {
if(this.adding == "intervenient"){
const result = this.taskParticipants.find((contact, index)=>{
if(contact.Name == itm.Name && contact.EmailAddress == itm.EmailAddress){
index = index;
return contact;
}
});
return undefined == result;
} else if (this.adding == "CC") {
const result = this.taskParticipantsCc.find((contact, index)=>{
const result1 = this.taskParticipants.find((contact, index)=>{
if(contact.Name == itm.Name && contact.EmailAddress == itm.EmailAddress){
index = index;
return contact;
}
});
index = index;
return contact;
}
});
return undefined == result;
// if to show
if(undefined != result1){
return false;
}
const result2 = this.taskParticipantsCc.find((contact, index)=>{
if(contact.Name == itm.Name && contact.EmailAddress == itm.EmailAddress){
index = index;
return contact;
}
});
// if to show
if(undefined != result2){
return false;
}
// don't show
return true;
}
remove(itm: EventPerson){
@@ -110,8 +117,6 @@ export class AttendeeModalPage implements OnInit {
});
} else if (this.adding == "CC") {
this.taskParticipantsCc = this.taskParticipantsCc.filter((contact, index) =>{
@@ -138,10 +143,12 @@ export class AttendeeModalPage implements OnInit {
if(this.adding == "intervenient"){
itm.IsRequired = true;
this.taskParticipants.push(itm);
} else if (this.adding == "CC") {
itm.IsRequired = false;
this.taskParticipantsCc.push(itm);
}