mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
Improve notification
This commit is contained in:
@@ -11,6 +11,7 @@ import { InAppBrowser } from '@ionic-native/in-app-browser/ngx';
|
||||
import { EditEventToApproveComponent } from '../../gabinete-digital/edit-event-to-approve/edit-event.page';
|
||||
import { BadRequestPage } from '../../popover/bad-request/bad-request.page';
|
||||
import { SuccessMessagePage} from '../../popover/success-message/success-message.page';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
|
||||
@Component({
|
||||
@@ -47,7 +48,8 @@ export class ApproveEventPage implements OnInit {
|
||||
private menu: MenuController,
|
||||
private alertService: AlertService,
|
||||
private iab: InAppBrowser,
|
||||
private animationController: AnimationController
|
||||
private animationController: AnimationController,
|
||||
private toastService: ToastService
|
||||
) {
|
||||
// $$$
|
||||
|
||||
@@ -88,9 +90,9 @@ export class ApproveEventPage implements OnInit {
|
||||
try {
|
||||
await this.processes.PostTaskAction(body).toPromise()
|
||||
this.modalController.dismiss(serialNumber);
|
||||
this.successMessage()
|
||||
this.toastService.successMessage()
|
||||
} catch (error) {
|
||||
this.badRequest()
|
||||
this.toastService.badRequest()
|
||||
}
|
||||
|
||||
/* this.approveEventDismiss.emit({
|
||||
@@ -112,7 +114,7 @@ export class ApproveEventPage implements OnInit {
|
||||
await this.openEmendMessageModal(serialNumber);
|
||||
this.modalController.dismiss(null);
|
||||
} catch (error) {
|
||||
this.badRequest()
|
||||
this.toastService.badRequest()
|
||||
}
|
||||
|
||||
}
|
||||
@@ -126,9 +128,9 @@ export class ApproveEventPage implements OnInit {
|
||||
await this.processes.PostTaskAction(body).toPromise()
|
||||
this.router.navigate(['/home/gabinete-digital/event-list']);
|
||||
this.modalController.dismiss(null);
|
||||
this.successMessage('Evento rejeitado')
|
||||
this.toastService.successMessage('Evento rejeitado')
|
||||
} catch (error) {
|
||||
this.badRequest('Evento não rejeitado')
|
||||
this.toastService.badRequest('Evento não rejeitado')
|
||||
}
|
||||
|
||||
}
|
||||
@@ -189,9 +191,9 @@ export class ApproveEventPage implements OnInit {
|
||||
await this.processes.PostTaskAction(body).toPromise()
|
||||
//this.router.navigate(['/home/gabinete-digital/event-list']);
|
||||
this.goToEventsToApprove();
|
||||
this.successMessage()
|
||||
this.toastService.successMessage()
|
||||
} catch (error) {
|
||||
this.badRequest()
|
||||
this.toastService.badRequest()
|
||||
}
|
||||
|
||||
|
||||
@@ -236,52 +238,7 @@ export class ApproveEventPage 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) => {
|
||||
|
||||
@@ -11,6 +11,7 @@ import { SearchDocument } from "src/app/models/search-document";
|
||||
import { EventAttachment } from 'src/app/models/attachment.model';
|
||||
import { BadRequestPage } from '../../popover/bad-request/bad-request.page';
|
||||
import { SuccessMessagePage} from '../../popover/success-message/success-message.page';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
|
||||
@Component({
|
||||
@@ -49,6 +50,7 @@ export class NewEventPage implements OnInit {
|
||||
private eventService: EventsService,
|
||||
private attachmentsService: AttachmentsService,
|
||||
private animationController: AnimationController,
|
||||
private toastService: ToastService
|
||||
|
||||
) {}
|
||||
|
||||
@@ -206,11 +208,11 @@ export class NewEventPage implements OnInit {
|
||||
this.afterSave();
|
||||
}
|
||||
|
||||
this.successMessage('Evento criado')
|
||||
this.toastService.successMessage('Evento criado')
|
||||
|
||||
},
|
||||
error => {
|
||||
this.badRequest('Evento não criado')
|
||||
this.toastService.badRequest('Evento não criado')
|
||||
});
|
||||
}
|
||||
else if(this.profile=='pr') {
|
||||
@@ -247,7 +249,7 @@ export class NewEventPage implements OnInit {
|
||||
this.afterSave();
|
||||
}
|
||||
|
||||
this.successMessage('Evento criado')
|
||||
this.toastService.successMessage('Evento criado')
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -315,97 +317,9 @@ export class NewEventPage implements OnInit {
|
||||
window['temp.path:/home/agenda/new-event.component.ts'] = {}
|
||||
}
|
||||
|
||||
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 não realizado com sucesso',
|
||||
},
|
||||
cssClass: 'notification-modal'
|
||||
});
|
||||
|
||||
modal.present()
|
||||
|
||||
setTimeout(()=>{
|
||||
if (callback) {
|
||||
callback()
|
||||
}
|
||||
modal.dismiss()
|
||||
},7000)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user