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
+63 -10
View File
@@ -1,7 +1,7 @@
import { Component, OnInit } from '@angular/core';
import { ModalController } from '@ionic/angular';
import { BadRequestComponent } from '../popover/bad-request/bad-request.component';
import { SuccessMessageComponent } from '../popover/success-message/success-message.component';
import { AnimationController, ModalController } from '@ionic/angular';
import { BadRequestPage } from '../popover/bad-request/bad-request.page';
import { SuccessMessagePage } from '../popover/success-message/success-message.page';
import crypto from 'crypto-js'
@Component({
selector: 'app-pin',
@@ -11,7 +11,8 @@ import crypto from 'crypto-js'
export class PinPage implements OnInit {
code = []
constructor( private modalController: ModalController,) { }
constructor( private modalController: ModalController,
private animationController: AnimationController) { }
ngOnInit() {
}
@@ -55,12 +56,38 @@ export class PinPage 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()
@@ -70,12 +97,38 @@ export class PinPage implements OnInit {
}
async badRequest(message?: string) {
let modal = await this.modalController.create({
component: BadRequestComponent,
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 não efetuado' ,
message: message || 'Processo efetuado' ,
},
cssClass: 'modal modal-desktop'
cssClass: 'notification-modal'
});
modal.present()