mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
Improve notification
This commit is contained in:
@@ -98,69 +98,6 @@ export class DarParecerPage implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
async successMessage(message?: any, callback?) {
|
||||
|
||||
var notification = document.createElement('div')
|
||||
notification.id = 'notification'
|
||||
notification.innerHTML = `
|
||||
|
||||
<div class="main-content width-100 pa-20">
|
||||
<p class="message d-flex align-center">
|
||||
<ion-icon slot="end" class="title-icon pr-10" src="/assets/images/nofitication-success.svg"></ion-icon>
|
||||
<p class="text">{{ message }}</p>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
`
|
||||
|
||||
document.body.append(notification)
|
||||
notification.querySelector('.text').innerHTML = message || 'Processo efetuado'
|
||||
setTimeout(()=>{
|
||||
notification.remove()
|
||||
},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(()=>{
|
||||
modal.dismiss()
|
||||
},1000)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user