Improve notification

This commit is contained in:
Peter Maquiran
2021-06-15 15:09:20 +01:00
parent bfb81fd84f
commit c856cc2927
32 changed files with 218 additions and 1447 deletions
+1 -1
View File
@@ -77,7 +77,7 @@ export class AddNotePage implements OnInit {
` `
document.body.append(notification) document.body.append(notification)
notification.querySelector('.text').innerHTML = message notification.querySelector('.text').innerHTML = message || 'Processo efetuado'
setTimeout(()=>{ setTimeout(()=>{
notification.remove() notification.remove()
},7000) },7000)
@@ -3,6 +3,7 @@ import { AnimationController, ModalController, NavParams } from '@ionic/angular'
import { SearchDocument } from 'src/app/models/search-document'; import { SearchDocument } from 'src/app/models/search-document';
import { SearchPage } from 'src/app/pages/search/search.page'; import { SearchPage } from 'src/app/pages/search/search.page';
import { ProcessesService } from 'src/app/services/processes.service'; import { ProcessesService } from 'src/app/services/processes.service';
import { ToastService } from 'src/app/services/toast.service';
import { BadRequestPage } from 'src/app/shared/popover/bad-request/bad-request.page'; import { BadRequestPage } from 'src/app/shared/popover/bad-request/bad-request.page';
import { SuccessMessagePage } from 'src/app/shared/popover/success-message/success-message.page'; import { SuccessMessagePage } from 'src/app/shared/popover/success-message/success-message.page';
@@ -22,6 +23,7 @@ export class DarParecerPage implements OnInit {
private modalController: ModalController, private modalController: ModalController,
private navParams: NavParams, private navParams: NavParams,
private animationController: AnimationController, private animationController: AnimationController,
private toastService: ToastService,
) { ) {
this.serialNumber = this.navParams.get('serialNumber'); this.serialNumber = this.navParams.get('serialNumber');
this.instanceId = this.navParams.get('ProcessInstanceID'); this.instanceId = this.navParams.get('ProcessInstanceID');
@@ -65,9 +67,9 @@ export class DarParecerPage implements OnInit {
try { try {
await this.processes.CompleteTask(body).toPromise(); await this.processes.CompleteTask(body).toPromise();
this.modalController.dismiss(); this.modalController.dismiss();
this.successMessage('Pedido de Parecer solicitado') this.toastService.successMessage('Pedido de Parecer solicitado')
} catch (error) { } catch (error) {
this.badRequest("Pedido de Parecer não solicitado") this.toastService.badRequest("Pedido de Parecer não solicitado")
} }
+4 -2
View File
@@ -13,6 +13,7 @@ import { DiscartExpedientModalPage } from 'src/app/pages/gabinete-digital/discar
import { AlertService } from 'src/app/services/alert.service'; import { AlertService } from 'src/app/services/alert.service';
import { BadRequestPage } from 'src/app/shared/popover/bad-request/bad-request.page'; import { BadRequestPage } from 'src/app/shared/popover/bad-request/bad-request.page';
import { SuccessMessagePage } from 'src/app/shared/popover/success-message/success-message.page'; import { SuccessMessagePage } from 'src/app/shared/popover/success-message/success-message.page';
import { ToastService } from 'src/app/services/toast.service';
@Component({ @Component({
selector: 'app-delegar', selector: 'app-delegar',
@@ -48,6 +49,7 @@ export class DelegarPage implements OnInit {
public alertController: AlertController, public alertController: AlertController,
private alertService: AlertService, private alertService: AlertService,
private animationController: AnimationController, private animationController: AnimationController,
private toastService: ToastService,
) { ) {
this.task = this.navParams.get('task'); this.task = this.navParams.get('task');
this.postData = new Event(); this.postData = new Event();
@@ -97,10 +99,10 @@ export class DelegarPage implements OnInit {
console.log(body); console.log(body);
this.processes.DelegateTask(body).subscribe(res=>{ this.processes.DelegateTask(body).subscribe(res=>{
console.log(res); console.log(res);
this.successMessage('Processo delegado') this.toastService.successMessage('Processo delegado')
}, },
(error)=>{ (error)=>{
this.badRequest("Processo não delegado") this.toastService.badRequest("Processo não delegado")
}); });
} }
} }
@@ -6,6 +6,7 @@ import { EventPerson } from 'src/app/models/eventperson.model';
import { AlertService } from 'src/app/services/alert.service'; import { AlertService } from 'src/app/services/alert.service';
import { AttachmentsService } from 'src/app/services/attachments.service'; import { AttachmentsService } from 'src/app/services/attachments.service';
import { EventsService } from 'src/app/services/events.service'; import { EventsService } from 'src/app/services/events.service';
import { ToastService } from 'src/app/services/toast.service';
import { BadRequestPage } from 'src/app/shared/popover/bad-request/bad-request.page'; import { BadRequestPage } from 'src/app/shared/popover/bad-request/bad-request.page';
import { SuccessMessagePage } from 'src/app/shared/popover/success-message/success-message.page'; import { SuccessMessagePage } from 'src/app/shared/popover/success-message/success-message.page';
import { Event } from '../../../models/event.model'; import { Event } from '../../../models/event.model';
@@ -47,6 +48,7 @@ export class EditEventPage implements OnInit {
public alertController: AlertController, public alertController: AlertController,
private attachmentsService: AttachmentsService, private attachmentsService: AttachmentsService,
private animationController: AnimationController, private animationController: AnimationController,
private toastService: ToastService,
) { ) {
this.isEventEdited = false; this.isEventEdited = false;
this.postEvent = this.navParams.get('event'); this.postEvent = this.navParams.get('event');
@@ -116,16 +118,16 @@ export class EditEventPage implements OnInit {
}); });
await alert.present(); */ await alert.present(); */
this.successMessage() this.toastService.successMessage()
}, error => { }, error => {
this.badRequest() this.toastService.badRequest()
}); });
this.isEventEdited = true; this.isEventEdited = true;
this.modalController.dismiss(this.isEventEdited); this.modalController.dismiss(this.isEventEdited);
} catch (error) { } catch (error) {
this.badRequest() this.toastService.badRequest()
} }
} }
@@ -2,6 +2,7 @@ import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { AnimationController, ModalController, NavParams, PopoverController } from '@ionic/angular'; import { AnimationController, ModalController, NavParams, PopoverController } from '@ionic/angular';
import { ProcessesService } from 'src/app/services/processes.service'; import { ProcessesService } from 'src/app/services/processes.service';
import { ToastService } from 'src/app/services/toast.service';
import { EditEventToApproveComponent } from 'src/app/shared/gabinete-digital/edit-event-to-approve/edit-event.page'; import { EditEventToApproveComponent } from 'src/app/shared/gabinete-digital/edit-event-to-approve/edit-event.page';
import { BadRequestPage } from 'src/app/shared/popover/bad-request/bad-request.page'; import { BadRequestPage } from 'src/app/shared/popover/bad-request/bad-request.page';
import { SuccessMessagePage } from 'src/app/shared/popover/success-message/success-message.page'; import { SuccessMessagePage } from 'src/app/shared/popover/success-message/success-message.page';
@@ -21,7 +22,8 @@ export class EventActionsPopoverPage implements OnInit {
private router:Router, private router:Router,
private modalController: ModalController, private modalController: ModalController,
private popoverController: PopoverController, private popoverController: PopoverController,
private animationController: AnimationController,) { private animationController: AnimationController,
private toastService: ToastService,) {
this.serialNumber = this.navParams.get('serialNumber'); this.serialNumber = this.navParams.get('serialNumber');
this.instanceId = this.navParams.get('InstanceId'); this.instanceId = this.navParams.get('InstanceId');
} }
@@ -45,9 +47,9 @@ export class EventActionsPopoverPage implements OnInit {
this.processes.PostTaskAction(body).toPromise() this.processes.PostTaskAction(body).toPromise()
this.router.navigate(['/home/gabinete-digital/event-list']); this.router.navigate(['/home/gabinete-digital/event-list']);
this.modalController.dismiss(null); this.modalController.dismiss(null);
this.successMessage() this.toastService.successMessage()
} catch (error) { } catch (error) {
this.badRequest() this.toastService.badRequest()
} }
} }
@@ -61,9 +63,9 @@ export class EventActionsPopoverPage implements OnInit {
this.processes.PostTaskAction(body).toPromise() this.processes.PostTaskAction(body).toPromise()
this.router.navigate(['/home/gabinete-digital/event-list']); this.router.navigate(['/home/gabinete-digital/event-list']);
this.modalController.dismiss(null); this.modalController.dismiss(null);
this.successMessage() this.toastService.successMessage()
} catch (error) { } catch (error) {
this.badRequest() this.toastService.badRequest()
} }
@@ -6,6 +6,7 @@ import { EventPerson } from 'src/app/models/eventperson.model';
import { SearchDocument } from 'src/app/models/search-document'; import { SearchDocument } from 'src/app/models/search-document';
import { AttachmentsService } from 'src/app/services/attachments.service'; import { AttachmentsService } from 'src/app/services/attachments.service';
import { EventsService } from 'src/app/services/events.service'; import { EventsService } from 'src/app/services/events.service';
import { ToastService } from 'src/app/services/toast.service';
import { BadRequestPage } from 'src/app/shared/popover/bad-request/bad-request.page'; import { BadRequestPage } from 'src/app/shared/popover/bad-request/bad-request.page';
import { SuccessMessagePage } from 'src/app/shared/popover/success-message/success-message.page'; import { SuccessMessagePage } from 'src/app/shared/popover/success-message/success-message.page';
import { Event } from '../../../models/event.model'; import { Event } from '../../../models/event.model';
@@ -41,6 +42,7 @@ export class NewEventPage implements OnInit {
private eventService: EventsService, private eventService: EventsService,
private attachmentsService: AttachmentsService, private attachmentsService: AttachmentsService,
private animationController: AnimationController, private animationController: AnimationController,
private toastService: ToastService,
) { ) {
this.postEvent = new Event(); this.postEvent = new Event();
this.eventBody = { BodyType : "1", Text : ""}; this.eventBody = { BodyType : "1", Text : ""};
@@ -158,12 +160,12 @@ export class NewEventPage implements OnInit {
}); });
this.successMessage() this.toastService.successMessage()
this.modalController.dismiss(this.postEvent); this.modalController.dismiss(this.postEvent);
} catch (error) { } catch (error) {
this.badRequest() this.toastService.badRequest()
} }
} }
@@ -21,6 +21,7 @@ import { OptsExpedientePage } from 'src/app/shared/popover/opts-expediente/opts-
import { BadRequestPage } from 'src/app/shared/popover/bad-request/bad-request.page'; import { BadRequestPage } from 'src/app/shared/popover/bad-request/bad-request.page';
import { SuccessMessagePage } from 'src/app/shared/popover/success-message/success-message.page'; import { SuccessMessagePage } from 'src/app/shared/popover/success-message/success-message.page';
import { DespachosPrOptionsPage } from 'src/app/shared/popover/despachos-pr-options/despachos-pr-options.page'; import { DespachosPrOptionsPage } from 'src/app/shared/popover/despachos-pr-options/despachos-pr-options.page';
import { ToastService } from 'src/app/services/toast.service';
@Component({ @Component({
selector: 'app-despacho-pr', selector: 'app-despacho-pr',
@@ -53,7 +54,8 @@ export class DespachoPrPage implements OnInit {
private alertService: AlertService, private alertService: AlertService,
public popoverController: PopoverController, public popoverController: PopoverController,
private activatedRoute: ActivatedRoute, private activatedRoute: ActivatedRoute,
private animationController: AnimationController) { private animationController: AnimationController,
private toastService: ToastService,) {
this.activatedRoute.queryParams.subscribe(params => { this.activatedRoute.queryParams.subscribe(params => {
if(params["serialNumber"]) { if(params["serialNumber"]) {
this.serialnumber = params["serialNumber"]; this.serialnumber = params["serialNumber"];
@@ -188,9 +190,9 @@ export class DespachoPrPage implements OnInit {
try { try {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
this.close(); this.close();
this.successMessage() this.toastService.successMessage()
} catch(error) { } catch(error) {
this.badRequest() this.toastService.badRequest()
} }
} }
@@ -206,10 +208,10 @@ export class DespachoPrPage implements OnInit {
} }
try { try {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
this.successMessage('Processo arquivado') this.toastService.successMessage('Processo arquivado')
this.close(); this.close();
} catch (error) { } catch (error) {
this.badRequest('Processo não arquivado') this.toastService.badRequest('Processo não arquivado')
} }
} }
@@ -227,10 +229,10 @@ export class DespachoPrPage implements OnInit {
try { try {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
this.successMessage('Processo criado') this.toastService.successMessage('Processo criado')
this.close(); this.close();
} catch (error) { } catch (error) {
this.badRequest('Processo não criado') this.toastService.badRequest('Processo não criado')
} }
} }
@@ -247,10 +249,10 @@ export class DespachoPrPage implements OnInit {
} }
try { try {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
this.successMessage('') this.toastService.successMessage('')
this.close(); this.close();
} catch (error) { } catch (error) {
this.badRequest() this.toastService.badRequest()
} }
} }
@@ -268,10 +270,10 @@ export class DespachoPrPage implements OnInit {
} }
try { try {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
this.successMessage() this.toastService.successMessage()
this.close(); this.close();
} catch (error) { } catch (error) {
this.badRequest() this.toastService.badRequest()
} }
} }
@@ -281,7 +283,7 @@ export class DespachoPrPage implements OnInit {
console.log(res); console.log(res);
this.close(); this.close();
this.successMessage('Processo enviado para pendentes') this.toastService.successMessage('Processo enviado para pendentes')
}); });
} }
@@ -21,6 +21,7 @@ import { OptsExpedientePage } from 'src/app/shared/popover/opts-expediente/opts-
import { BadRequestPage } from 'src/app/shared/popover/bad-request/bad-request.page'; import { BadRequestPage } from 'src/app/shared/popover/bad-request/bad-request.page';
import { SuccessMessagePage } from 'src/app/shared/popover/success-message/success-message.page'; import { SuccessMessagePage } from 'src/app/shared/popover/success-message/success-message.page';
import { DespachosOptionsPage } from 'src/app/shared/popover/despachos-options/despachos-options.page'; import { DespachosOptionsPage } from 'src/app/shared/popover/despachos-options/despachos-options.page';
import { ToastService } from 'src/app/services/toast.service';
@Component({ @Component({
selector: 'app-despacho', selector: 'app-despacho',
@@ -54,6 +55,7 @@ export class DespachoPage implements OnInit {
private activatedRoute: ActivatedRoute, private activatedRoute: ActivatedRoute,
private router: Router, private router: Router,
private animationController: AnimationController, private animationController: AnimationController,
private toastService: ToastService,
) { ) {
this.activatedRoute.queryParams.subscribe(params => { this.activatedRoute.queryParams.subscribe(params => {
@@ -194,9 +196,9 @@ export class DespachoPage implements OnInit {
try { try {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
this.close(); this.close();
this.successMessage('Processo criado') this.toastService.successMessage('Processo criado')
} catch(error) { } catch(error) {
this.badRequest("Processo não criado") this.toastService.badRequest("Processo não criado")
} }
} }
@@ -212,10 +214,10 @@ export class DespachoPage implements OnInit {
} }
try { try {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
this.successMessage('Processo descartado') this.toastService.successMessage('Processo descartado')
this.close(); this.close();
} catch (error) { } catch (error) {
this.badRequest("Processo não descartado") this.toastService.badRequest("Processo não descartado")
} }
} }
@@ -232,10 +234,10 @@ export class DespachoPage implements OnInit {
} }
try { try {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
this.successMessage() this.toastService.successMessage()
this.close(); this.close();
} catch (error) { } catch (error) {
this.badRequest() this.toastService.badRequest()
} }
} }
@@ -252,11 +254,11 @@ export class DespachoPage implements OnInit {
try { try {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
this.successMessage() this.toastService.successMessage()
this.close(); this.close();
} catch (error) { } catch (error) {
this.badRequest() this.toastService.badRequest()
} }
} }
@@ -265,10 +267,10 @@ export class DespachoPage implements OnInit {
this.processes.SetTaskToPending(this.serialnumber).subscribe(res=>{ this.processes.SetTaskToPending(this.serialnumber).subscribe(res=>{
console.log(res); console.log(res);
this.close(); this.close();
this.successMessage('Processo enviado para despacho') this.toastService.successMessage('Processo enviado para despacho')
}, },
error => { error => {
this.badRequest("Processo não enviado para despacho") this.toastService.badRequest("Processo não enviado para despacho")
}); });
} }
@@ -11,6 +11,7 @@ import { BookMeetingModalPage } from '../../expediente/book-meeting-modal/book-m
import { BadRequestPage } from 'src/app/shared/popover/bad-request/bad-request.page'; import { BadRequestPage } from 'src/app/shared/popover/bad-request/bad-request.page';
import { SuccessMessagePage } from 'src/app/shared/popover/success-message/success-message.page'; import { SuccessMessagePage } from 'src/app/shared/popover/success-message/success-message.page';
import { DeplomaOptionsPage } from 'src/app/shared/popover/deploma-options/deploma-options.page'; import { DeplomaOptionsPage } from 'src/app/shared/popover/deploma-options/deploma-options.page';
import { ToastService } from 'src/app/services/toast.service';
@Component({ @Component({
selector: 'app-diploma-assinar', selector: 'app-diploma-assinar',
@@ -38,6 +39,7 @@ export class DiplomaAssinarPage implements OnInit {
private activatedRoute: ActivatedRoute, private activatedRoute: ActivatedRoute,
private router: Router, private router: Router,
private animationController: AnimationController, private animationController: AnimationController,
private toastService: ToastService
) { ) {
this.activatedRoute.queryParams.subscribe(params => { this.activatedRoute.queryParams.subscribe(params => {
if(params["serialNumber"]) { if(params["serialNumber"]) {
@@ -151,11 +153,11 @@ export class DiplomaAssinarPage implements OnInit {
try { try {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
this.successMessage(false, ()=>{ this.toastService.successMessage(false, ()=>{
this.goBack(); this.goBack();
}) })
} catch (error) { } catch (error) {
this.badRequest() this.toastService.badRequest()
} }
} }
@@ -163,52 +165,7 @@ export class DiplomaAssinarPage implements OnInit {
this.modalController.dismiss(); this.modalController.dismiss();
} }
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?) { async badRequest(message?: string, callback?) {
const enterAnimation = (baseEl: any) => { const enterAnimation = (baseEl: any) => {
@@ -11,6 +11,7 @@ import { BookMeetingModalPage } from '../../expediente/book-meeting-modal/book-m
import { BadRequestPage } from 'src/app/shared/popover/bad-request/bad-request.page'; import { BadRequestPage } from 'src/app/shared/popover/bad-request/bad-request.page';
import { SuccessMessagePage } from 'src/app/shared/popover/success-message/success-message.page'; import { SuccessMessagePage } from 'src/app/shared/popover/success-message/success-message.page';
import { DeplomaOptionsPage } from 'src/app/shared/popover/deploma-options/deploma-options.page'; import { DeplomaOptionsPage } from 'src/app/shared/popover/deploma-options/deploma-options.page';
import { ToastService } from 'src/app/services/toast.service';
@Component({ @Component({
selector: 'app-diploma', selector: 'app-diploma',
@@ -38,7 +39,8 @@ export class DiplomaPage implements OnInit {
private iab: InAppBrowser, private iab: InAppBrowser,
private activatedRoute: ActivatedRoute, private activatedRoute: ActivatedRoute,
private router: Router, private router: Router,
private animationController: AnimationController private animationController: AnimationController,
private toastService: ToastService,
) { ) {
this.activatedRoute.queryParams.subscribe(params => { this.activatedRoute.queryParams.subscribe(params => {
if(params["serialNumber"]) { if(params["serialNumber"]) {
@@ -154,12 +156,12 @@ export class DiplomaPage implements OnInit {
try { try {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
this.successMessage(false, ()=>{ this.toastService.successMessage(false, ()=>{
this.close(); this.close();
}) })
} catch (error) { } catch (error) {
this.badRequest() this.toastService.badRequest()
} }
} }
@@ -176,9 +178,9 @@ export class DiplomaPage implements OnInit {
try { try {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
this.successMessage() this.toastService.successMessage()
} catch (error) { } catch (error) {
this.badRequest() this.toastService.badRequest()
} }
} }
@@ -195,9 +197,9 @@ export class DiplomaPage implements OnInit {
} }
try { try {
await this.processes.CompleteTask(body).toPromise(); await this.processes.CompleteTask(body).toPromise();
this.successMessage('Processo concluído') this.toastService.successMessage('Processo concluído')
} catch (error) { } catch (error) {
this.badRequest() this.toastService.badRequest()
} }
} }
@@ -275,52 +277,7 @@ export class DiplomaPage implements OnInit {
this.modalController.dismiss(); this.modalController.dismiss();
} }
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?) { async badRequest(message?: string, callback?) {
const enterAnimation = (baseEl: any) => { const enterAnimation = (baseEl: any) => {
@@ -105,13 +105,13 @@ export class ApproveEventModalPage implements OnInit {
try { try {
await this.processes.PostTaskAction(body).toPromise() await this.processes.PostTaskAction(body).toPromise()
this.successMessage('Evento aprovado', ()=>{ this.toastService.successMessage('Evento aprovado', ()=>{
this.router.navigate(['/home/gabinete-digital/event-list']); this.router.navigate(['/home/gabinete-digital/event-list']);
this.modalController.dismiss(null); this.modalController.dismiss(null);
}) })
} catch (error) { } catch (error) {
this.badRequest('Evento não aprovado') this.toastService.badRequest('Evento não aprovado')
} }
} }
@@ -187,9 +187,9 @@ export class ApproveEventModalPage implements OnInit {
try { try {
await this.processes.PostTaskAction(body).toPromise() await this.processes.PostTaskAction(body).toPromise()
this.router.navigate(['/home/gabinete-digital/event-list']); this.router.navigate(['/home/gabinete-digital/event-list']);
this.successMessage() this.toastService.successMessage()
} catch (error) { } catch (error) {
this.badRequest() this.toastService.badRequest()
this.router.navigate(['/home/gabinete-digital/event-list']); this.router.navigate(['/home/gabinete-digital/event-list']);
} }
@@ -220,52 +220,7 @@ export class ApproveEventModalPage 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?) { async badRequest(message?: string, callback?) {
const enterAnimation = (baseEl: any) => { const enterAnimation = (baseEl: any) => {
@@ -97,13 +97,13 @@ export class ApproveEventPage implements OnInit {
try { try {
await this.processes.PostTaskAction(body).toPromise() await this.processes.PostTaskAction(body).toPromise()
this.successMessage() this.toastService.successMessage()
this.toastService.successMessage('Evento aprovado', ()=>{ this.toastService.successMessage('Evento aprovado', ()=>{
this.goBack(); this.goBack();
}); });
} catch (error) { } catch (error) {
this.badRequest() this.toastService.badRequest()
} }
@@ -126,16 +126,16 @@ export class ApproveEventPage implements OnInit {
async rejeitar(serialNumber:string){ async rejeitar(serialNumber:string){
let body = { "serialNumber": serialNumber, "action": "Rejeitar" } let body = { "serialNumber": serialNumber, "action": "Rejeitar" }
console.log(body); console.log(body);
this.successMessage('Process'); this.toastService.successMessage('Process');
try { try {
this.processes.PostTaskAction(body).toPromise(); this.processes.PostTaskAction(body).toPromise();
await this.successMessage('Processo rejeitado'); await this.toastService.successMessage('Processo rejeitado');
await this.toastService.successMessage('Processo rejeitado', ()=>{ await this.toastService.successMessage('Processo rejeitado', ()=>{
this.goBack(); this.goBack();
}); });
} catch (error) { } catch (error) {
this.badRequest() this.toastService.badRequest()
} }
} }
@@ -196,10 +196,10 @@ export class ApproveEventPage implements OnInit {
try { try {
await this.processes.PostTaskAction(body).toPromise(); await this.processes.PostTaskAction(body).toPromise();
this.successMessage(); this.toastService.successMessage();
this.goBack(); this.goBack();
} catch (error) { } catch (error) {
this.badRequest(); this.toastService.badRequest();
} }
} }
else{ else{
@@ -241,52 +241,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?) { async badRequest(message?: string, callback?) {
const enterAnimation = (baseEl: any) => { const enterAnimation = (baseEl: any) => {
@@ -17,6 +17,7 @@ import { SuccessMessagePage } from 'src/app/shared/popover/success-message/succe
import { User } from 'src/app/models/user.model'; import { User } from 'src/app/models/user.model';
import { AuthService } from 'src/app/services/auth.service'; import { AuthService } from 'src/app/services/auth.service';
import { AttendeesPage } from 'src/app/pages/events/attendees/attendees.page'; import { AttendeesPage } from 'src/app/pages/events/attendees/attendees.page';
import { ToastService } from 'src/app/services/toast.service';
@Component({ @Component({
selector: 'app-book-meeting-modal', selector: 'app-book-meeting-modal',
@@ -53,7 +54,8 @@ export class BookMeetingModalPage implements OnInit {
private attachmentsService: AttachmentsService, private attachmentsService: AttachmentsService,
private calendarService: EventsService, private calendarService: EventsService,
authService: AuthService, authService: AuthService,
private animationController: AnimationController private animationController: AnimationController,
private toastService: ToastService,
) { ) {
this.loggeduser = authService.ValidatedUser; this.loggeduser = authService.ValidatedUser;
this.task = this.navParams.get('task'); this.task = this.navParams.get('task');
@@ -138,9 +140,9 @@ export class BookMeetingModalPage implements OnInit {
} }
this.distartExpedientModal(); this.distartExpedientModal();
this.successMessage('Reunião criada') this.toastService.successMessage('Reunião criada')
} catch (error) { } catch (error) {
this.badRequest('Reunião não criada') this.toastService.badRequest('Reunião não criada')
} }
@@ -157,12 +159,12 @@ export class BookMeetingModalPage implements OnInit {
break; break;
} }
this.successMessage('Reunião criada', ()=>{ this.toastService.successMessage('Reunião criada', ()=>{
this.close(); this.close();
}) })
} catch (error) { } catch (error) {
this.badRequest() this.toastService.badRequest()
} }
} }
@@ -56,7 +56,7 @@ export class ExpedienteDetailPage implements OnInit {
public popoverController: PopoverController, public popoverController: PopoverController,
private activatedRoute: ActivatedRoute, private activatedRoute: ActivatedRoute,
private toastService: ToastService, private toastService: ToastService,
private animationController: AnimationController private animationController: AnimationController,
) { ) {
this.activateRoute.paramMap.subscribe(params => { this.activateRoute.paramMap.subscribe(params => {
@@ -120,14 +120,14 @@ export class ExpedienteDetailPage implements OnInit {
}); });
} }
sendExpedienteToPending(){ sendExpedienteToPending() {
this.processes.SetTaskToPending(this.serialnumber).subscribe(res=>{ this.processes.SetTaskToPending(this.serialnumber).subscribe(res=>{
console.log(res); console.log(res);
this.successMessage('Processo enviado para pendentes') this.toastService.successMessage('Processo enviado para pendentes')
this.goBack(); this.goBack();
}, },
(error)=>{ (error)=>{
this.badRequest('Processo não enviado para pendentes') this.toastService.badRequest('Processo não enviado para pendentes')
}); });
} }
@@ -266,10 +266,10 @@ export class ExpedienteDetailPage implements OnInit {
try { try {
await this.processes.CompleteTask(otherbody).toPromise() await this.processes.CompleteTask(otherbody).toPromise()
this.successMessage('Processo descartado'); this.toastService.successMessage('Processo descartado');
this.goBack(); this.goBack();
} catch (error) { } catch (error) {
this.badRequest('Processo não descartado') this.toastService.badRequest('Processo não descartado')
} }
} }
@@ -281,10 +281,10 @@ export class ExpedienteDetailPage implements OnInit {
if(res['data']== 'Yes'){ if(res['data']== 'Yes'){
try { try {
await this.processes.CompleteTask(body).toPromise(); await this.processes.CompleteTask(body).toPromise();
this.successMessage('Processo descartado'); this.toastService.successMessage('Processo descartado');
this.goBack(); this.goBack();
} catch (error) { } catch (error) {
this.badRequest('Processo não descartado') this.toastService.badRequest('Processo não descartado')
} }
this.goBack(); this.goBack();
} }
@@ -292,10 +292,10 @@ export class ExpedienteDetailPage implements OnInit {
console.log('Update'); console.log('Update');
try { try {
await this.processes.UpdateTaskStatus(this.task.FolderId).toPromise(); await this.processes.UpdateTaskStatus(this.task.FolderId).toPromise();
this.successMessage(); this.toastService.successMessage();
this.goBack(); this.goBack();
} catch (error) { } catch (error) {
this.badRequest() this.toastService.badRequest()
} }
} }
} }
@@ -361,52 +361,7 @@ export class ExpedienteDetailPage 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?) { async badRequest(message?: string, callback?) {
const enterAnimation = (baseEl: any) => { const enterAnimation = (baseEl: any) => {
@@ -21,6 +21,7 @@ import { AddNotePage } from 'src/app/modals/add-note/add-note.page';
import { BadRequestPage } from 'src/app/shared/popover/bad-request/bad-request.page'; import { BadRequestPage } from 'src/app/shared/popover/bad-request/bad-request.page';
import { SuccessMessagePage } from 'src/app/shared/popover/success-message/success-message.page'; import { SuccessMessagePage } from 'src/app/shared/popover/success-message/success-message.page';
import { OptsExpedientePrPage } from 'src/app/shared/popover/opts-expediente-pr/opts-expediente-pr.page'; import { OptsExpedientePrPage } from 'src/app/shared/popover/opts-expediente-pr/opts-expediente-pr.page';
import { ToastService } from 'src/app/services/toast.service';
@Component({ @Component({
selector: 'app-expediente-pr', selector: 'app-expediente-pr',
@@ -56,6 +57,7 @@ export class ExpedientePrPage implements OnInit {
private activatedRoute: ActivatedRoute, private activatedRoute: ActivatedRoute,
private userAuth: AuthService, private userAuth: AuthService,
private animationController: AnimationController, private animationController: AnimationController,
private toastService: ToastService,
) { ) {
this.loggeduser = userAuth.ValidatedUser; this.loggeduser = userAuth.ValidatedUser;
@@ -102,11 +104,11 @@ export class ExpedientePrPage implements OnInit {
sendExpedienteToPending(){ sendExpedienteToPending(){
this.processes.SetTaskToPending(this.serialnumber).subscribe(res=>{ this.processes.SetTaskToPending(this.serialnumber).subscribe(res=>{
console.log(res); console.log(res);
this.successMessage('Processo enviado para pendentes') this.toastService.successMessage('Processo enviado para pendentes')
this.goBack(); this.goBack();
}, },
(error)=>{ (error)=>{
this.badRequest('Processo não enviado para pendentes') this.toastService.badRequest('Processo não enviado para pendentes')
}); });
} }
@@ -201,9 +203,9 @@ export class ExpedientePrPage implements OnInit {
try { try {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
this.close(); this.close();
this.successMessage('Processo aprovado') this.toastService.successMessage('Processo aprovado')
} catch(error) { } catch(error) {
this.badRequest('Processo não aprovado') this.toastService.badRequest('Processo não aprovado')
} }
} }
@@ -221,9 +223,9 @@ export class ExpedientePrPage implements OnInit {
try { try {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
this.close(); this.close();
this.successMessage() this.toastService.successMessage()
} catch(error) { } catch(error) {
this.badRequest() this.toastService.badRequest()
} }
} }
@@ -329,9 +331,9 @@ export class ExpedientePrPage implements OnInit {
try { try {
await this.processes.CompleteTask(otherbody).toPromise(); await this.processes.CompleteTask(otherbody).toPromise();
this.successMessage('Processo descartado') this.toastService.successMessage('Processo descartado')
} catch (error) { } catch (error) {
this.badRequest('Processo não descartado') this.toastService.badRequest('Processo não descartado')
} }
@@ -345,10 +347,10 @@ export class ExpedientePrPage implements OnInit {
try { try {
//await this.processes.CompleteTask(body).toPromise() //await this.processes.CompleteTask(body).toPromise()
this.successMessage() this.toastService.successMessage()
this.goBack(); this.goBack();
} catch (error) { } catch (error) {
this.badRequest() this.toastService.badRequest()
} }
@@ -360,9 +362,9 @@ export class ExpedientePrPage implements OnInit {
try { try {
await this.processes.UpdateTaskStatus(this.task.FolderId); await this.processes.UpdateTaskStatus(this.task.FolderId);
this.successMessage() this.toastService.successMessage()
} catch (error) { } catch (error) {
this.badRequest() this.toastService.badRequest()
} }
@@ -440,52 +442,7 @@ export class ExpedientePrPage implements OnInit {
return await popover.present(); return await popover.present();
} }
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?) { async badRequest(message?: string, callback?) {
const enterAnimation = (baseEl: any) => { const enterAnimation = (baseEl: any) => {
@@ -24,6 +24,7 @@ import { AuthService } from 'src/app/services/auth.service';
import { User } from 'src/app/models/user.model'; import { User } from 'src/app/models/user.model';
import { BadRequestPage } from 'src/app/shared/popover/bad-request/bad-request.page'; import { BadRequestPage } from 'src/app/shared/popover/bad-request/bad-request.page';
import { SuccessMessagePage } from 'src/app/shared/popover/success-message/success-message.page'; import { SuccessMessagePage } from 'src/app/shared/popover/success-message/success-message.page';
import { ToastService } from 'src/app/services/toast.service';
@Component({ @Component({
selector: 'app-pedido', selector: 'app-pedido',
@@ -56,7 +57,8 @@ export class PedidoPage implements OnInit {
private alertService: AlertService, private alertService: AlertService,
public popoverController: PopoverController, public popoverController: PopoverController,
authService: AuthService, authService: AuthService,
private animationController: AnimationController) { private animationController: AnimationController,
private toastService: ToastService,) {
this.loggeduser = authService.ValidatedUser; this.loggeduser = authService.ValidatedUser;
this.activatedRoute.queryParams.subscribe(params => { this.activatedRoute.queryParams.subscribe(params => {
if(params["serialNumber"]) { if(params["serialNumber"]) {
@@ -199,10 +201,10 @@ export class PedidoPage implements OnInit {
try { try {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
this.successMessage() this.toastService.successMessage()
this.close(); this.close();
} catch (error) { } catch (error) {
this.badRequest() this.toastService.badRequest()
} }
@@ -221,10 +223,10 @@ export class PedidoPage implements OnInit {
try { try {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
this.successMessage('Processo arquivado') this.toastService.successMessage('Processo arquivado')
this.close(); this.close();
} catch (error) { } catch (error) {
this.badRequest() this.toastService.badRequest()
} }
@@ -418,52 +420,7 @@ export class PedidoPage 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?) { async badRequest(message?: string, callback?) {
const enterAnimation = (baseEl: any) => { const enterAnimation = (baseEl: any) => {
+3 -47
View File
@@ -50,6 +50,7 @@ export class LoginPage implements OnInit {
public alertController: AlertController, public alertController: AlertController,
private modalController: ModalController, private modalController: ModalController,
private animationController: AnimationController, private animationController: AnimationController,
//private fcm: FCM //private fcm: FCM
) { ) {
@@ -186,10 +187,10 @@ export class LoginPage implements OnInit {
const encrypted = crypto.SHA1(code) const encrypted = crypto.SHA1(code)
if( encrypted == localStorage.getItem('PIN')) { if( encrypted == localStorage.getItem('PIN')) {
//this.successMessage() //this.toastService.successMessage()
this.router.navigate(['/home/events']); this.router.navigate(['/home/events']);
} else { } else {
this.badRequest('Pin incorreto') this.toastService.badRequest('Pin incorreto')
this.code = [] this.code = []
} }
@@ -206,52 +207,7 @@ export class LoginPage 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?) { async badRequest(message?: string, callback?) {
@@ -2,6 +2,7 @@ import { Component, OnInit } from '@angular/core';
import { AnimationController, ModalController } from '@ionic/angular'; import { AnimationController, ModalController } from '@ionic/angular';
import { PublicationFolder } from 'src/app/models/publicationfolder'; import { PublicationFolder } from 'src/app/models/publicationfolder';
import { PublicationsService } from 'src/app/services/publications.service'; import { PublicationsService } from 'src/app/services/publications.service';
import { ToastService } from 'src/app/services/toast.service';
import { BadRequestPage } from 'src/app/shared/popover/bad-request/bad-request.page'; import { BadRequestPage } from 'src/app/shared/popover/bad-request/bad-request.page';
import { SuccessMessagePage } from 'src/app/shared/popover/success-message/success-message.page'; import { SuccessMessagePage } from 'src/app/shared/popover/success-message/success-message.page';
@@ -19,6 +20,7 @@ export class NewActionPage implements OnInit {
private modalController: ModalController, private modalController: ModalController,
private publication: PublicationsService, private publication: PublicationsService,
private animationController: AnimationController, private animationController: AnimationController,
private toastService: ToastService
) { ) {
this.folder = new PublicationFolder(); this.folder = new PublicationFolder();
@@ -45,10 +47,10 @@ export class NewActionPage implements OnInit {
try { try {
await this.publication.CreatePublicationFolder(this.folder).toPromise() await this.publication.CreatePublicationFolder(this.folder).toPromise()
this.successMessage("Ação presidencial criado") this.toastService.successMessage("Ação presidencial criado")
this.close(); this.close();
} catch (error) { } catch (error) {
this.badRequest("Ação presidencial não criado") this.toastService.badRequest("Ação presidencial não criado")
} }
} }
@@ -56,96 +58,8 @@ export class NewActionPage implements OnInit {
this.modalController.dismiss(); this.modalController.dismiss();
} }
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)
}
} }
@@ -2,6 +2,7 @@ import { Component, OnInit } from '@angular/core';
import { AnimationController, ModalController, NavParams } from '@ionic/angular'; import { AnimationController, ModalController, NavParams } from '@ionic/angular';
import { Publication } from 'src/app/models/publication'; import { Publication } from 'src/app/models/publication';
import { PublicationsService } from 'src/app/services/publications.service'; import { PublicationsService } from 'src/app/services/publications.service';
import { ToastService } from 'src/app/services/toast.service';
import { BadRequestPage } from 'src/app/shared/popover/bad-request/bad-request.page'; import { BadRequestPage } from 'src/app/shared/popover/bad-request/bad-request.page';
import { SuccessMessagePage } from 'src/app/shared/popover/success-message/success-message.page'; import { SuccessMessagePage } from 'src/app/shared/popover/success-message/success-message.page';
import { ImageModalPage } from '../gallery/image-modal/image-modal.page'; import { ImageModalPage } from '../gallery/image-modal/image-modal.page';
@@ -23,7 +24,8 @@ export class PublicationDetailPage implements OnInit {
private modalController: ModalController, private modalController: ModalController,
private navParams:NavParams, private navParams:NavParams,
private publications:PublicationsService, private publications:PublicationsService,
private animationController: AnimationController private animationController: AnimationController,
private toastService: ToastService
) { ) {
this.publicationId = this.navParams.get('publicationId'); this.publicationId = this.navParams.get('publicationId');
/* this.folderId = this.navParams.get('folderIdId'); */ /* this.folderId = this.navParams.get('folderIdId'); */
@@ -83,10 +85,10 @@ export class PublicationDetailPage implements OnInit {
try { try {
await this.publications.DeletePublication(this.folderId, this.publicationId).toPromise(); await this.publications.DeletePublication(this.folderId, this.publicationId).toPromise();
this.successMessage('Publicação eliminado') this.toastService.successMessage('Publicação eliminado')
this.close(); this.close();
} catch (error) { } catch (error) {
this.badRequest('Publicação não eliminado') this.toastService.badRequest('Publicação não eliminado')
} }
} }
@@ -122,95 +124,7 @@ export class PublicationDetailPage 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 não realizado com sucesso',
},
cssClass: 'notification-modal'
});
modal.present()
setTimeout(()=>{
if (callback) {
callback()
}
modal.dismiss()
},7000)
}
} }
@@ -2,6 +2,7 @@ import { Component, OnInit } from '@angular/core';
import { AnimationController, ModalController, NavParams } from '@ionic/angular'; import { AnimationController, ModalController, NavParams } from '@ionic/angular';
import { Publication } from 'src/app/models/publication'; import { Publication } from 'src/app/models/publication';
import { PublicationsService } from 'src/app/services/publications.service'; import { PublicationsService } from 'src/app/services/publications.service';
import { ToastService } from 'src/app/services/toast.service';
import { BadRequestPage } from 'src/app/shared/popover/bad-request/bad-request.page'; import { BadRequestPage } from 'src/app/shared/popover/bad-request/bad-request.page';
import { SuccessMessagePage } from 'src/app/shared/popover/success-message/success-message.page'; import { SuccessMessagePage } from 'src/app/shared/popover/success-message/success-message.page';
import { ImageModalPage } from '../../gallery/image-modal/image-modal.page'; import { ImageModalPage } from '../../gallery/image-modal/image-modal.page';
@@ -22,7 +23,8 @@ export class PublicationDetailPage implements OnInit {
private modalController: ModalController, private modalController: ModalController,
private navParams:NavParams, private navParams:NavParams,
private publications:PublicationsService, private publications:PublicationsService,
private animationController: AnimationController private animationController: AnimationController,
private toastService: ToastService,
) { ) {
this.publicationId = this.navParams.get('publicationId'); this.publicationId = this.navParams.get('publicationId');
this.folderId = this.navParams.get('folderId'); this.folderId = this.navParams.get('folderId');
@@ -83,13 +85,13 @@ export class PublicationDetailPage implements OnInit {
try { try {
await this.publications.DeletePublication(this.folderId, this.publicationId).toPromise(); await this.publications.DeletePublication(this.folderId, this.publicationId).toPromise();
this.successMessage('Publicaçao eliminado') this.toastService.successMessage('Publicaçao eliminado')
this.close(); this.close();
//this.goBackToViewPublications.emit(); //this.goBackToViewPublications.emit();
} catch (error) { } catch (error) {
this.badRequest('Publicaçao não eliminado') this.toastService.badRequest('Publicaçao não eliminado')
} }
} }
@@ -124,96 +126,8 @@ export class PublicationDetailPage 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: 'Processo não realizado com sucesso',
},
cssClass: 'notification-modal'
});
modal.present()
setTimeout(()=>{
if (callback) {
callback()
}
modal.dismiss()
},7000)
}
} }
@@ -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 { EditEventToApproveComponent } from '../../gabinete-digital/edit-event-to-approve/edit-event.page';
import { BadRequestPage } from '../../popover/bad-request/bad-request.page'; import { BadRequestPage } from '../../popover/bad-request/bad-request.page';
import { SuccessMessagePage} from '../../popover/success-message/success-message.page'; import { SuccessMessagePage} from '../../popover/success-message/success-message.page';
import { ToastService } from 'src/app/services/toast.service';
@Component({ @Component({
@@ -47,7 +48,8 @@ export class ApproveEventPage implements OnInit {
private menu: MenuController, private menu: MenuController,
private alertService: AlertService, private alertService: AlertService,
private iab: InAppBrowser, private iab: InAppBrowser,
private animationController: AnimationController private animationController: AnimationController,
private toastService: ToastService
) { ) {
// $$$ // $$$
@@ -88,9 +90,9 @@ export class ApproveEventPage implements OnInit {
try { try {
await this.processes.PostTaskAction(body).toPromise() await this.processes.PostTaskAction(body).toPromise()
this.modalController.dismiss(serialNumber); this.modalController.dismiss(serialNumber);
this.successMessage() this.toastService.successMessage()
} catch (error) { } catch (error) {
this.badRequest() this.toastService.badRequest()
} }
/* this.approveEventDismiss.emit({ /* this.approveEventDismiss.emit({
@@ -112,7 +114,7 @@ export class ApproveEventPage implements OnInit {
await this.openEmendMessageModal(serialNumber); await this.openEmendMessageModal(serialNumber);
this.modalController.dismiss(null); this.modalController.dismiss(null);
} catch (error) { } catch (error) {
this.badRequest() this.toastService.badRequest()
} }
} }
@@ -126,9 +128,9 @@ export class ApproveEventPage implements OnInit {
await this.processes.PostTaskAction(body).toPromise() await this.processes.PostTaskAction(body).toPromise()
this.router.navigate(['/home/gabinete-digital/event-list']); this.router.navigate(['/home/gabinete-digital/event-list']);
this.modalController.dismiss(null); this.modalController.dismiss(null);
this.successMessage('Evento rejeitado') this.toastService.successMessage('Evento rejeitado')
} catch (error) { } 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() await this.processes.PostTaskAction(body).toPromise()
//this.router.navigate(['/home/gabinete-digital/event-list']); //this.router.navigate(['/home/gabinete-digital/event-list']);
this.goToEventsToApprove(); this.goToEventsToApprove();
this.successMessage() this.toastService.successMessage()
} catch (error) { } 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?) { async badRequest(message?: string, callback?) {
const enterAnimation = (baseEl: any) => { 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 { EventAttachment } from 'src/app/models/attachment.model';
import { BadRequestPage } from '../../popover/bad-request/bad-request.page'; import { BadRequestPage } from '../../popover/bad-request/bad-request.page';
import { SuccessMessagePage} from '../../popover/success-message/success-message.page'; import { SuccessMessagePage} from '../../popover/success-message/success-message.page';
import { ToastService } from 'src/app/services/toast.service';
@Component({ @Component({
@@ -49,6 +50,7 @@ export class NewEventPage implements OnInit {
private eventService: EventsService, private eventService: EventsService,
private attachmentsService: AttachmentsService, private attachmentsService: AttachmentsService,
private animationController: AnimationController, private animationController: AnimationController,
private toastService: ToastService
) {} ) {}
@@ -206,11 +208,11 @@ export class NewEventPage implements OnInit {
this.afterSave(); this.afterSave();
} }
this.successMessage('Evento criado') this.toastService.successMessage('Evento criado')
}, },
error => { error => {
this.badRequest('Evento não criado') this.toastService.badRequest('Evento não criado')
}); });
} }
else if(this.profile=='pr') { else if(this.profile=='pr') {
@@ -247,7 +249,7 @@ export class NewEventPage implements OnInit {
this.afterSave(); 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'] = {} 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)
}
} }
@@ -59,12 +59,12 @@ export class FingerprintPage implements OnInit {
// }) // })
// .then((FingerPrintHash: any) => { // .then((FingerPrintHash: any) => {
// this.successMessage() // this.toastService.successMessage()
// localStorage.setItem('FingerPrintHash', FingerPrintHash) // localStorage.setItem('FingerPrintHash', FingerPrintHash)
// }) // })
// .catch((error: any) => { // .catch((error: any) => {
// this.badRequest() // this.toastService.badRequest()
// }); // });
} }
+5 -84
View File
@@ -3,6 +3,7 @@ import { AnimationController, ModalController } from '@ionic/angular';
import { BadRequestPage } from '../popover/bad-request/bad-request.page'; import { BadRequestPage } from '../popover/bad-request/bad-request.page';
import { SuccessMessagePage } from '../popover/success-message/success-message.page'; import { SuccessMessagePage } from '../popover/success-message/success-message.page';
import crypto from 'crypto-js' import crypto from 'crypto-js'
import { ToastService } from 'src/app/services/toast.service';
@Component({ @Component({
selector: 'app-pin', selector: 'app-pin',
templateUrl: './pin.page.html', templateUrl: './pin.page.html',
@@ -12,7 +13,8 @@ export class PinPage implements OnInit {
code = [] code = []
constructor( private modalController: ModalController, constructor( private modalController: ModalController,
private animationController: AnimationController) { } private animationController: AnimationController,
private toastService: ToastService) { }
ngOnInit() { ngOnInit() {
} }
@@ -41,7 +43,7 @@ export class PinPage implements OnInit {
if(this.code.length == 4) { if(this.code.length == 4) {
this.close() this.close()
//this.successMessage() //this.toastService.successMessage()
const code = this.code.join('') const code = this.code.join('')
const encrypted = crypto.SHA1(code) const encrypted = crypto.SHA1(code)
@@ -49,94 +51,13 @@ export class PinPage implements OnInit {
localStorage.setItem('PIN', encrypted) localStorage.setItem('PIN', encrypted)
} else { } else {
this.badRequest() this.toastService.badRequest()
} }
} }
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()
modal.dismiss()
}
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(()=>{
this.close()
modal.dismiss()
},3000)
}
} }
@@ -4,6 +4,7 @@ import { AnimationController, ModalController, PopoverController } from '@ionic/
import { AddNotePage } from 'src/app/modals/add-note/add-note.page'; import { AddNotePage } from 'src/app/modals/add-note/add-note.page';
import { BookMeetingModalPage } from 'src/app/pages/gabinete-digital/expediente/book-meeting-modal/book-meeting-modal.page'; import { BookMeetingModalPage } from 'src/app/pages/gabinete-digital/expediente/book-meeting-modal/book-meeting-modal.page';
import { ProcessesService } from 'src/app/services/processes.service'; import { ProcessesService } from 'src/app/services/processes.service';
import { ToastService } from 'src/app/services/toast.service';
import { BadRequestPage } from '../bad-request/bad-request.page'; import { BadRequestPage } from '../bad-request/bad-request.page';
import { SuccessMessagePage } from '../success-message/success-message.page'; import { SuccessMessagePage } from '../success-message/success-message.page';
@@ -25,7 +26,8 @@ export class DeplomaOptionsPage implements OnInit {
private modalController: ModalController, private modalController: ModalController,
private activatedRoute: ActivatedRoute, private activatedRoute: ActivatedRoute,
private processes: ProcessesService, private processes: ProcessesService,
private animationController: AnimationController) { private animationController: AnimationController,
private toastService: ToastService) {
this.activatedRoute.queryParams.subscribe(params => { this.activatedRoute.queryParams.subscribe(params => {
if(params["serialNumber"]) { if(params["serialNumber"]) {
this.serialnumber = params["serialNumber"]; this.serialnumber = params["serialNumber"];
@@ -99,9 +101,9 @@ export class DeplomaOptionsPage implements OnInit {
try { try {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
this.close(); this.close();
this.successMessage() this.toastService.successMessage()
} catch (error) { } catch (error) {
this.badRequest() this.toastService.badRequest()
} }
} }
@@ -138,9 +140,9 @@ export class DeplomaOptionsPage implements OnInit {
try { try {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
this.close(); this.close();
this.successMessage() this.toastService.successMessage()
} catch (error) { } catch (error) {
this.badRequest() this.toastService.badRequest()
} }
} }
@@ -17,6 +17,7 @@ import { BadRequestPage } from 'src/app/shared/popover/bad-request/bad-request.p
import { SuccessMessagePage } from 'src/app/shared/popover/success-message/success-message.page'; import { SuccessMessagePage } from 'src/app/shared/popover/success-message/success-message.page';
import { BookMeetingModalPage } from 'src/app/pages/gabinete-digital/expediente/book-meeting-modal/book-meeting-modal.page'; import { BookMeetingModalPage } from 'src/app/pages/gabinete-digital/expediente/book-meeting-modal/book-meeting-modal.page';
import { DiscartExpedientModalPage } from 'src/app/pages/gabinete-digital/discart-expedient-modal/discart-expedient-modal.page'; import { DiscartExpedientModalPage } from 'src/app/pages/gabinete-digital/discart-expedient-modal/discart-expedient-modal.page';
import { ToastService } from 'src/app/services/toast.service';
@Component({ @Component({
@@ -43,7 +44,8 @@ export class DespachosOptionsPage implements OnInit {
public popoverController: PopoverController, public popoverController: PopoverController,
private activatedRoute: ActivatedRoute, private activatedRoute: ActivatedRoute,
private animationController: AnimationController, private animationController: AnimationController,
private navParams: NavParams) { private navParams: NavParams,
private toastService: ToastService) {
this.task = this.navParams.get('task') this.task = this.navParams.get('task')
this.fulltask = this.navParams.get('fulltask') this.fulltask = this.navParams.get('fulltask')
@@ -181,10 +183,10 @@ export class DespachosOptionsPage implements OnInit {
try { try {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
this.successMessage() this.toastService.successMessage()
this.close(); this.close();
} catch (error) { } catch (error) {
this.badRequest() this.toastService.badRequest()
} }
} }
@@ -254,10 +256,10 @@ export class DespachosOptionsPage implements OnInit {
} }
try { try {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
this.successMessage('Processo arquivado') this.toastService.successMessage('Processo arquivado')
this.close(); this.close();
} catch (error) { } catch (error) {
this.badRequest('Processo não arquivado') this.toastService.badRequest('Processo não arquivado')
} }
} }
@@ -277,60 +279,15 @@ export class DespachosOptionsPage implements OnInit {
try { try {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
this.close(); this.close();
this.successMessage() this.toastService.successMessage()
} catch(error) { } catch(error) {
this.badRequest() this.toastService.badRequest()
} }
} }
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?) { async badRequest(message?: string, callback?) {
const modal = await this.modalController.create({ const modal = await this.modalController.create({
@@ -365,10 +322,10 @@ export class DespachosOptionsPage implements OnInit {
} }
try { try {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
this.successMessage() this.toastService.successMessage()
this.close(); this.close();
} catch (error) { } catch (error) {
this.badRequest() this.toastService.badRequest()
} }
} }
@@ -17,6 +17,7 @@ import { BadRequestPage } from 'src/app/shared/popover/bad-request/bad-request.p
import { SuccessMessagePage } from 'src/app/shared/popover/success-message/success-message.page'; import { SuccessMessagePage } from 'src/app/shared/popover/success-message/success-message.page';
import { BookMeetingModalPage } from 'src/app/pages/gabinete-digital/expediente/book-meeting-modal/book-meeting-modal.page'; import { BookMeetingModalPage } from 'src/app/pages/gabinete-digital/expediente/book-meeting-modal/book-meeting-modal.page';
import { DiscartExpedientModalPage } from 'src/app/pages/gabinete-digital/discart-expedient-modal/discart-expedient-modal.page'; import { DiscartExpedientModalPage } from 'src/app/pages/gabinete-digital/discart-expedient-modal/discart-expedient-modal.page';
import { ToastService } from 'src/app/services/toast.service';
@Component({ @Component({
@@ -43,7 +44,8 @@ export class DespachosPrOptionsPage implements OnInit {
private alertService: AlertService, private alertService: AlertService,
public popoverController: PopoverController, public popoverController: PopoverController,
private activatedRoute: ActivatedRoute, private activatedRoute: ActivatedRoute,
private animationController: AnimationController) { } private animationController: AnimationController,
private toastService: ToastService) { }
ngOnInit() { ngOnInit() {
@@ -176,10 +178,10 @@ export class DespachosPrOptionsPage implements OnInit {
try { try {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
this.successMessage() this.toastService.successMessage()
this.close(); this.close();
} catch (error) { } catch (error) {
this.badRequest() this.toastService.badRequest()
} }
} }
@@ -251,10 +253,10 @@ export class DespachosPrOptionsPage implements OnInit {
} }
try { try {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
this.successMessage('Processo arquivado') this.toastService.successMessage('Processo arquivado')
this.close(); this.close();
} catch (error) { } catch (error) {
this.badRequest('Processo não arquivado') this.toastService.badRequest('Processo não arquivado')
} }
} }
@@ -274,60 +276,15 @@ export class DespachosPrOptionsPage implements OnInit {
try { try {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
this.close(); this.close();
this.successMessage() this.toastService.successMessage()
} catch(error) { } catch(error) {
this.badRequest() this.toastService.badRequest()
} }
} }
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?) { async badRequest(message?: string, callback?) {
const modal = await this.modalController.create({ const modal = await this.modalController.create({
@@ -362,10 +319,10 @@ export class DespachosPrOptionsPage implements OnInit {
} }
try { try {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
this.successMessage() this.toastService.successMessage()
this.close(); this.close();
} catch (error) { } catch (error) {
this.badRequest() this.toastService.badRequest()
} }
} }
@@ -11,6 +11,7 @@ import { AttachmentsService } from 'src/app/services/attachments.service';
import { AuthService } from 'src/app/services/auth.service'; import { AuthService } from 'src/app/services/auth.service';
import { EventsService } from 'src/app/services/events.service'; import { EventsService } from 'src/app/services/events.service';
import { ProcessesService } from 'src/app/services/processes.service'; import { ProcessesService } from 'src/app/services/processes.service';
import { ToastService } from 'src/app/services/toast.service';
import { BadRequestPage } from '../bad-request/bad-request.page'; import { BadRequestPage } from '../bad-request/bad-request.page';
import { SuccessMessagePage } from '../success-message/success-message.page'; import { SuccessMessagePage } from '../success-message/success-message.page';
@@ -43,7 +44,8 @@ export class OptsExpedientePrPage implements OnInit {
private userAuth: AuthService, private userAuth: AuthService,
private navParams: NavParams, private navParams: NavParams,
private animationController: AnimationController, private animationController: AnimationController,
private router: Router private router: Router,
private toastService: ToastService
) { ) {
@@ -122,9 +124,9 @@ export class OptsExpedientePrPage implements OnInit {
try { try {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
this.close(); this.close();
this.successMessage() this.toastService.successMessage()
} catch(error) { } catch(error) {
this.badRequest() this.toastService.badRequest()
} }
} }
@@ -148,11 +150,11 @@ export class OptsExpedientePrPage implements OnInit {
try { try {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
this.successMessage() this.toastService.successMessage()
this.goBack(); this.goBack();
} catch (error) { } catch (error) {
this.badRequest() this.toastService.badRequest()
} }
@@ -169,9 +171,9 @@ export class OptsExpedientePrPage implements OnInit {
try { try {
await this.processes.CompleteTask(otherbody).toPromise() await this.processes.CompleteTask(otherbody).toPromise()
this.successMessage() this.toastService.successMessage()
} catch (error) { } catch (error) {
this.badRequest() this.toastService.badRequest()
} }
@@ -198,9 +200,9 @@ export class OptsExpedientePrPage implements OnInit {
try { try {
await this.processes.CompleteTask(body); await this.processes.CompleteTask(body);
this.close(); this.close();
this.successMessage() this.toastService.successMessage()
} catch(error) { } catch(error) {
this.badRequest() this.toastService.badRequest()
} }
} }
@@ -289,52 +291,7 @@ export class OptsExpedientePrPage 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?) { async badRequest(message?: string, callback?) {
const modal = await this.modalController.create({ const modal = await this.modalController.create({
@@ -8,6 +8,7 @@ import { DiscartExpedientModalPage } from 'src/app/pages/gabinete-digital/discar
import { BookMeetingModalPage } from 'src/app/pages/gabinete-digital/expediente/book-meeting-modal/book-meeting-modal.page'; import { BookMeetingModalPage } from 'src/app/pages/gabinete-digital/expediente/book-meeting-modal/book-meeting-modal.page';
import { ExpedientTaskModalPage } from 'src/app/pages/gabinete-digital/expediente/expedient-task-modal/expedient-task-modal.page'; import { ExpedientTaskModalPage } from 'src/app/pages/gabinete-digital/expediente/expedient-task-modal/expedient-task-modal.page';
import { ProcessesService } from 'src/app/services/processes.service'; import { ProcessesService } from 'src/app/services/processes.service';
import { ToastService } from 'src/app/services/toast.service';
import { BadRequestPage } from 'src/app/shared/popover/bad-request/bad-request.page'; import { BadRequestPage } from 'src/app/shared/popover/bad-request/bad-request.page';
import { SuccessMessagePage } from 'src/app/shared/popover/success-message/success-message.page'; import { SuccessMessagePage } from 'src/app/shared/popover/success-message/success-message.page';
@@ -31,7 +32,8 @@ export class RequestOptionsPage implements OnInit {
private navParams: NavParams, private navParams: NavParams,
private processes: ProcessesService, private processes: ProcessesService,
private activatedRoute: ActivatedRoute, private activatedRoute: ActivatedRoute,
private animationController: AnimationController private animationController: AnimationController,
private toastService: ToastService
) { ) {
this.task = this.navParams.get('task'); this.task = this.navParams.get('task');
this.fulltask = this.navParams.get('fulltask'); this.fulltask = this.navParams.get('fulltask');
@@ -166,9 +168,9 @@ export class RequestOptionsPage implements OnInit {
try { try {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
this.close(); this.close();
this.successMessage() this.toastService.successMessage()
} catch (error) { } catch (error) {
this.badRequest() this.toastService.badRequest()
} }
} }
@@ -232,9 +234,9 @@ export class RequestOptionsPage implements OnInit {
try { try {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
this.close(); this.close();
this.successMessage('Processo arquivado') this.toastService.successMessage('Processo arquivado')
} catch (error) { } catch (error) {
this.badRequest('Processo não arquivado') this.toastService.badRequest('Processo não arquivado')
} }
@@ -285,52 +287,7 @@ export class RequestOptionsPage 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?) { async badRequest(message?: string, callback?) {
const enterAnimation = (baseEl: any) => { const enterAnimation = (baseEl: any) => {
@@ -2,6 +2,7 @@ import { Component, EventEmitter, OnInit, Output } from '@angular/core';
import { AnimationController, ModalController } from '@ionic/angular'; import { AnimationController, ModalController } from '@ionic/angular';
import { PublicationFolder } from 'src/app/models/publicationfolder'; import { PublicationFolder } from 'src/app/models/publicationfolder';
import { PublicationsService } from 'src/app/services/publications.service'; import { PublicationsService } from 'src/app/services/publications.service';
import { ToastService } from 'src/app/services/toast.service';
import { BadRequestPage } from '../../popover/bad-request/bad-request.page'; import { BadRequestPage } from '../../popover/bad-request/bad-request.page';
import { SuccessMessagePage} from '../../popover/success-message/success-message.page'; import { SuccessMessagePage} from '../../popover/success-message/success-message.page';
@@ -20,7 +21,8 @@ export class NewActionPage implements OnInit {
constructor( constructor(
private modalController: ModalController, private modalController: ModalController,
private publication: PublicationsService, private publication: PublicationsService,
private animationController: AnimationController private animationController: AnimationController,
private toastService: ToastService
) { ) {
this.folder = new PublicationFolder(); this.folder = new PublicationFolder();
} }
@@ -47,9 +49,9 @@ export class NewActionPage implements OnInit {
try { try {
await this.publication.CreatePublicationFolder(this.folder).toPromise() await this.publication.CreatePublicationFolder(this.folder).toPromise()
this.close(); this.close();
this.successMessage('Publicação criado') this.toastService.successMessage('Publicação criado')
} catch (error) { } catch (error) {
this.badRequest('Publicação não criado') this.toastService.badRequest('Publicação não criado')
} }
} }
@@ -59,96 +61,8 @@ export class NewActionPage 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: 'Processo não realizado com sucesso',
},
cssClass: 'notification-modal'
});
modal.present()
setTimeout(()=>{
if (callback) {
callback()
}
modal.dismiss()
},7000)
}
} }
@@ -18,6 +18,7 @@ import { ViewPublicationsPage } from '../view-publications/view-publications.pag
import { LoadingService } from 'src/app/services/loading.service'; import { LoadingService } from 'src/app/services/loading.service';
import { BadRequestPage } from '../../popover/bad-request/bad-request.page'; import { BadRequestPage } from '../../popover/bad-request/bad-request.page';
import { SuccessMessagePage} from '../../popover/success-message/success-message.page'; import { SuccessMessagePage} from '../../popover/success-message/success-message.page';
import { ToastService } from 'src/app/services/toast.service';
@Component({ @Component({
selector: 'app-new-publication', selector: 'app-new-publication',
@@ -57,7 +58,8 @@ export class NewPublicationPage implements OnInit {
public photoService: PhotoService, public photoService: PhotoService,
private publications: PublicationsService, private publications: PublicationsService,
private camera: Camera, private camera: Camera,
private animationController: AnimationController private animationController: AnimationController,
private toastService: ToastService,
) { ) {
this.publicationTitle = 'Nova Publicação'; this.publicationTitle = 'Nova Publicação';
} }
@@ -159,11 +161,11 @@ export class NewPublicationPage implements OnInit {
console.log(this.publication); console.log(this.publication);
await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise() await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise()
this.successMessage("Publicação criado") this.toastService.successMessage("Publicação criado")
this.goBack(); this.goBack();
} catch (error) { } catch (error) {
this.badRequest("Publicação não criado") this.toastService.badRequest("Publicação não criado")
} }
} }
@@ -183,11 +185,11 @@ export class NewPublicationPage implements OnInit {
try { try {
console.log(this.publication); console.log(this.publication);
await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise() await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise()
this.successMessage("Publicação criado") this.toastService.successMessage("Publicação criado")
this.goBack(); this.goBack();
} catch (error) { } catch (error) {
this.badRequest("Publicação não criado") this.toastService.badRequest("Publicação não criado")
} }
} }
@@ -209,11 +211,11 @@ export class NewPublicationPage implements OnInit {
try { try {
console.log(this.publication); console.log(this.publication);
await this.publications.CreatePublication(this.folderId, this.publication).toPromise() await this.publications.CreatePublication(this.folderId, this.publication).toPromise()
this.successMessage("Publicação criado") this.toastService.successMessage("Publicação criado")
this.goBackToViewPublications.emit(); this.goBackToViewPublications.emit();
} catch (error) { } catch (error) {
this.badRequest("Publicação não criado") this.toastService.badRequest("Publicação não criado")
} }
} }
@@ -275,96 +277,8 @@ export class NewPublicationPage 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: 'Processo não realizado com sucesso',
},
cssClass: 'notification-modal'
});
modal.present()
setTimeout(()=>{
if (callback) {
callback()
}
modal.dismiss()
},7000)
}
} }
@@ -4,6 +4,7 @@ import { Publication } from 'src/app/models/publication';
import { ImageModalPage } from 'src/app/pages/publications/gallery/image-modal/image-modal.page'; import { ImageModalPage } from 'src/app/pages/publications/gallery/image-modal/image-modal.page';
import { NewPublicationPage } from 'src/app/pages/publications/new-publication/new-publication.page'; import { NewPublicationPage } from 'src/app/pages/publications/new-publication/new-publication.page';
import { PublicationsService } from 'src/app/services/publications.service'; import { PublicationsService } from 'src/app/services/publications.service';
import { ToastService } from 'src/app/services/toast.service';
import { BadRequestPage } from 'src/app/shared/popover/bad-request/bad-request.page'; import { BadRequestPage } from 'src/app/shared/popover/bad-request/bad-request.page';
import { SuccessMessagePage } from 'src/app/shared/popover/success-message/success-message.page'; import { SuccessMessagePage } from 'src/app/shared/popover/success-message/success-message.page';
@@ -26,7 +27,8 @@ export class PublicationDetailPage implements OnInit {
constructor( constructor(
private modalController: ModalController, private modalController: ModalController,
private publications:PublicationsService, private publications:PublicationsService,
private animationController: AnimationController private animationController: AnimationController,
private toastService: ToastService,
) { ) {
/* this.folderId = this.navParams.get('folderIdId'); */ /* this.folderId = this.navParams.get('folderIdId'); */
@@ -88,10 +90,10 @@ export class PublicationDetailPage implements OnInit {
try { try {
await this.publications.DeletePublication(this.folderId, this.publicationId).toPromise(); await this.publications.DeletePublication(this.folderId, this.publicationId).toPromise();
this.successMessage("Publicação eliminado") this.toastService.successMessage("Publicação eliminado")
this.goBackToViewPublications.emit(); this.goBackToViewPublications.emit();
} catch (error) { } catch (error) {
this.badRequest("Publicação não eliminado") this.toastService.badRequest("Publicação não eliminado")
} }
} }
@@ -141,96 +143,8 @@ export class PublicationDetailPage 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: 'Processo não realizado com sucesso',
},
cssClass: 'notification-modal'
});
modal.present()
setTimeout(()=>{
if (callback) {
callback()
}
modal.dismiss()
},7000)
}
} }