Add success message

This commit is contained in:
Peter Maquiran
2021-06-08 15:59:06 +01:00
parent 8ff7458b98
commit 1089628ef3
54 changed files with 2351 additions and 478 deletions
+62 -9
View File
@@ -1,10 +1,10 @@
import { Component, OnInit } from '@angular/core';
import { ModalController, NavParams } from '@ionic/angular';
import { AnimationController, ModalController, NavParams } from '@ionic/angular';
import { SearchDocument } from 'src/app/models/search-document';
import { SearchPage } from 'src/app/pages/search/search.page';
import { ProcessesService } from 'src/app/services/processes.service';
import { BadRequestComponent } from 'src/app/shared/popover/bad-request/bad-request.component';
import { SuccessMessageComponent } from 'src/app/shared/popover/success-message/success-message.component';
import { BadRequestPage } from 'src/app/shared/popover/bad-request/bad-request.page';
import { SuccessMessagePage } from 'src/app/shared/popover/success-message/success-message.page';
@Component({
selector: 'app-dar-parecer',
@@ -21,6 +21,7 @@ export class DarParecerPage implements OnInit {
private processes: ProcessesService,
private modalController: ModalController,
private navParams: NavParams,
private animationController: AnimationController,
) {
this.serialNumber = this.navParams.get('serialNumber');
this.instanceId = this.navParams.get('ProcessInstanceID');
@@ -98,12 +99,38 @@ export class DarParecerPage implements OnInit {
async successMessage(message?: string) {
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({
component: SuccessMessageComponent,
enterAnimation,
leaveAnimation,
component: SuccessMessagePage,
componentProps: {
message: message || 'Processo efetuado' ,
},
cssClass: 'modal modal-desktop'
cssClass: 'notification-modal'
});
modal.present()
@@ -114,13 +141,39 @@ export class DarParecerPage implements OnInit {
}
async badRequest() {
async badRequest(message?) {
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({
component: BadRequestComponent,
enterAnimation,
leaveAnimation,
component: BadRequestPage,
componentProps: {
message: 'hello',
message: message || 'Processo efetuado' ,
},
cssClass: 'modal modal-desktop'
cssClass: 'notification-modal'
});
modal.present()