This commit is contained in:
tiago.kayaya
2021-06-15 11:55:36 +01:00
parent 4eabda4ae7
commit dd813618f6
9 changed files with 67 additions and 179 deletions
@@ -1,6 +1,7 @@
<ion-header class="ion-no-border px-20">
<ion-toolbar class="px-10">
<ion-title class="pa-0">Adicionar intervenientes</ion-title>
<ion-title>Agenda Desktop</ion-title>
</ion-toolbar>
<ion-searchbar class="attendee-search-bar" (ionChange)="onChange($event)" placeholder="Insira email para adicionar destinatário"></ion-searchbar><!-- [(ngModel)]="searchCountryString" -->
<ion-progress-bar type="indeterminate" *ngIf="showLoader"></ion-progress-bar>
@@ -16,7 +16,7 @@
<ion-content>
<ion-item-group>
<ion-button class="btn-ok-no-width" fill="clear" color="#fff" shape="round" (click)="addAttendees()" expand="block">
<ion-label>Adicionar participantes</ion-label>
<ion-label>Adicionar participantes XV</ion-label>
</ion-button>
</ion-item-group>
<ion-item-group [ngSwitch]="segment" *ngFor="let attendee of eventAttendees">
@@ -8,6 +8,7 @@ import { SearchPage } from 'src/app/pages/search/search.page';
import { AttachmentsService } from 'src/app/services/attachments.service';
import { EventsService } from 'src/app/services/events.service';
import { ProcessesService } from 'src/app/services/processes.service';
import { ToastService } from 'src/app/services/toast.service';
import { Event, EventToApproveEdit } from '../../../models/event.model';
import { BadRequestPage } from '../../popover/bad-request/bad-request.page';
import { SuccessMessagePage} from '../../popover/success-message/success-message.page';
@@ -140,7 +141,8 @@ export class EditEventToApproveComponent implements OnInit {
public alertController: AlertController,
private attachmentsService: AttachmentsService,
private processes:ProcessesService,
private animationController: AnimationController
private animationController: AnimationController,
private toastService: ToastService,
) {
this.serialNumber = this.navParams.get('serialNumber');
@@ -253,9 +255,9 @@ export class EditEventToApproveComponent implements OnInit {
}
this.eventsService.postEventToApproveEdit(event).subscribe(()=>{
this.successMessage('Evento editado')
this.toastService.successMessage('Evento editado');
}, error =>{
this.badRequest('Evento não editado')
this.toastService.badRequest('Evento não editado');
})
@@ -263,16 +265,16 @@ export class EditEventToApproveComponent implements OnInit {
if(document['action'] == 'add') {
delete document.action
this.attachmentsService.setEventAttachmentById(document).subscribe(()=>{
//this.successMessage()
this.toastService.successMessage();
}, error =>{
this.badRequest()
this.toastService.badRequest();
});
} else if(document['action'] == 'delete') {
delete document.action
this.attachmentsService.deleteEventAttachmentById(document.Id).subscribe( res=>{
//this.successMessage()
this.toastService.successMessage()
}, error =>{
this.badRequest()
this.toastService.badRequest()
})
}
@@ -407,96 +409,4 @@ export class EditEventToApproveComponent implements OnInit {
});
}
async successMessage(message?: any, callback?) {
const enterAnimation = (baseEl: any) => {
const backdropAnimation = this.animationController.create()
.addElement(baseEl.querySelector('ion-backdrop')!)
.fromTo('opacity', '0.01', 'var(--backdrop-opacity)');
const wrapperAnimation = this.animationController.create()
.addElement(baseEl.querySelector('.modal-wrapper')!)
.keyframes([
{ offset: 0, opacity: '1', right: '-100%' },
{ offset: 1, opacity: '1', right: '0px' }
]);
return this.animationController.create()
.addElement(baseEl)
.easing('ease-out')
.duration(500)
.addAnimation([backdropAnimation, wrapperAnimation]);
}
const leaveAnimation = (baseEl: any) => {
return enterAnimation(baseEl).direction('reverse');
}
const modal = await this.modalController.create({
enterAnimation,
leaveAnimation,
component: SuccessMessagePage,
componentProps: {
message: message || 'Processo efetuado' ,
},
cssClass: 'notification-modal'
});
modal.present()
setTimeout(()=>{
if (callback) {
callback()
}
modal.dismiss()
},7000)
}
async badRequest(message?: string, callback?) {
const enterAnimation = (baseEl: any) => {
const backdropAnimation = this.animationController.create()
.addElement(baseEl.querySelector('ion-backdrop')!)
.fromTo('opacity', '0.01', 'var(--backdrop-opacity)');
const wrapperAnimation = this.animationController.create()
.addElement(baseEl.querySelector('.modal-wrapper')!)
.keyframes([
{ offset: 0, opacity: '1', right: '-100%' },
{ offset: 1, opacity: '1', right: '0px' }
]);
return this.animationController.create()
.addElement(baseEl)
.easing('ease-out')
.duration(500)
.addAnimation([backdropAnimation, wrapperAnimation]);
}
const leaveAnimation = (baseEl: any) => {
return enterAnimation(baseEl).direction('reverse');
}
const modal = await this.modalController.create({
enterAnimation,
leaveAnimation,
component: BadRequestPage,
componentProps: {
message: message || 'Processo efetuado' ,
},
cssClass: 'notification-modal'
});
modal.present()
setTimeout(()=>{
if (callback) {
callback()
}
modal.dismiss()
},7000)
}
}