mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 21:35:50 +00:00
Improve notification
This commit is contained in:
@@ -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 { 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 { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-despacho-pr',
|
||||
@@ -53,7 +54,8 @@ export class DespachoPrPage implements OnInit {
|
||||
private alertService: AlertService,
|
||||
public popoverController: PopoverController,
|
||||
private activatedRoute: ActivatedRoute,
|
||||
private animationController: AnimationController) {
|
||||
private animationController: AnimationController,
|
||||
private toastService: ToastService,) {
|
||||
this.activatedRoute.queryParams.subscribe(params => {
|
||||
if(params["serialNumber"]) {
|
||||
this.serialnumber = params["serialNumber"];
|
||||
@@ -188,9 +190,9 @@ export class DespachoPrPage implements OnInit {
|
||||
try {
|
||||
await this.processes.CompleteTask(body).toPromise()
|
||||
this.close();
|
||||
this.successMessage()
|
||||
this.toastService.successMessage()
|
||||
} catch(error) {
|
||||
this.badRequest()
|
||||
this.toastService.badRequest()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -206,10 +208,10 @@ export class DespachoPrPage implements OnInit {
|
||||
}
|
||||
try {
|
||||
await this.processes.CompleteTask(body).toPromise()
|
||||
this.successMessage('Processo arquivado')
|
||||
this.toastService.successMessage('Processo arquivado')
|
||||
this.close();
|
||||
} 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 {
|
||||
await this.processes.CompleteTask(body).toPromise()
|
||||
this.successMessage('Processo criado')
|
||||
this.toastService.successMessage('Processo criado')
|
||||
this.close();
|
||||
} 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 {
|
||||
await this.processes.CompleteTask(body).toPromise()
|
||||
this.successMessage('')
|
||||
this.toastService.successMessage('')
|
||||
this.close();
|
||||
} catch (error) {
|
||||
this.badRequest()
|
||||
this.toastService.badRequest()
|
||||
}
|
||||
|
||||
}
|
||||
@@ -268,10 +270,10 @@ export class DespachoPrPage implements OnInit {
|
||||
}
|
||||
try {
|
||||
await this.processes.CompleteTask(body).toPromise()
|
||||
this.successMessage()
|
||||
this.toastService.successMessage()
|
||||
this.close();
|
||||
} catch (error) {
|
||||
this.badRequest()
|
||||
this.toastService.badRequest()
|
||||
}
|
||||
|
||||
}
|
||||
@@ -281,7 +283,7 @@ export class DespachoPrPage implements OnInit {
|
||||
console.log(res);
|
||||
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 { SuccessMessagePage } from 'src/app/shared/popover/success-message/success-message.page';
|
||||
import { DespachosOptionsPage } from 'src/app/shared/popover/despachos-options/despachos-options.page';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-despacho',
|
||||
@@ -54,6 +55,7 @@ export class DespachoPage implements OnInit {
|
||||
private activatedRoute: ActivatedRoute,
|
||||
private router: Router,
|
||||
private animationController: AnimationController,
|
||||
private toastService: ToastService,
|
||||
) {
|
||||
|
||||
this.activatedRoute.queryParams.subscribe(params => {
|
||||
@@ -194,9 +196,9 @@ export class DespachoPage implements OnInit {
|
||||
try {
|
||||
await this.processes.CompleteTask(body).toPromise()
|
||||
this.close();
|
||||
this.successMessage('Processo criado')
|
||||
this.toastService.successMessage('Processo criado')
|
||||
} 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 {
|
||||
await this.processes.CompleteTask(body).toPromise()
|
||||
this.successMessage('Processo descartado')
|
||||
this.toastService.successMessage('Processo descartado')
|
||||
this.close();
|
||||
} 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 {
|
||||
await this.processes.CompleteTask(body).toPromise()
|
||||
this.successMessage()
|
||||
this.toastService.successMessage()
|
||||
this.close();
|
||||
} catch (error) {
|
||||
this.badRequest()
|
||||
this.toastService.badRequest()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -252,11 +254,11 @@ export class DespachoPage implements OnInit {
|
||||
|
||||
try {
|
||||
await this.processes.CompleteTask(body).toPromise()
|
||||
this.successMessage()
|
||||
this.toastService.successMessage()
|
||||
this.close();
|
||||
|
||||
} catch (error) {
|
||||
this.badRequest()
|
||||
this.toastService.badRequest()
|
||||
}
|
||||
|
||||
}
|
||||
@@ -265,10 +267,10 @@ export class DespachoPage implements OnInit {
|
||||
this.processes.SetTaskToPending(this.serialnumber).subscribe(res=>{
|
||||
console.log(res);
|
||||
this.close();
|
||||
this.successMessage('Processo enviado para despacho')
|
||||
this.toastService.successMessage('Processo enviado para despacho')
|
||||
},
|
||||
error => {
|
||||
this.badRequest("Processo não enviado para despacho")
|
||||
this.toastService.badRequest("Processo não enviado para despacho")
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
+4
-47
@@ -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 { SuccessMessagePage } from 'src/app/shared/popover/success-message/success-message.page';
|
||||
import { DeplomaOptionsPage } from 'src/app/shared/popover/deploma-options/deploma-options.page';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-diploma-assinar',
|
||||
@@ -38,6 +39,7 @@ export class DiplomaAssinarPage implements OnInit {
|
||||
private activatedRoute: ActivatedRoute,
|
||||
private router: Router,
|
||||
private animationController: AnimationController,
|
||||
private toastService: ToastService
|
||||
) {
|
||||
this.activatedRoute.queryParams.subscribe(params => {
|
||||
if(params["serialNumber"]) {
|
||||
@@ -151,11 +153,11 @@ export class DiplomaAssinarPage implements OnInit {
|
||||
try {
|
||||
await this.processes.CompleteTask(body).toPromise()
|
||||
|
||||
this.successMessage(false, ()=>{
|
||||
this.toastService.successMessage(false, ()=>{
|
||||
this.goBack();
|
||||
})
|
||||
} catch (error) {
|
||||
this.badRequest()
|
||||
this.toastService.badRequest()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,52 +165,7 @@ export class DiplomaAssinarPage implements OnInit {
|
||||
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) => {
|
||||
|
||||
@@ -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 { SuccessMessagePage } from 'src/app/shared/popover/success-message/success-message.page';
|
||||
import { DeplomaOptionsPage } from 'src/app/shared/popover/deploma-options/deploma-options.page';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-diploma',
|
||||
@@ -38,7 +39,8 @@ export class DiplomaPage implements OnInit {
|
||||
private iab: InAppBrowser,
|
||||
private activatedRoute: ActivatedRoute,
|
||||
private router: Router,
|
||||
private animationController: AnimationController
|
||||
private animationController: AnimationController,
|
||||
private toastService: ToastService,
|
||||
) {
|
||||
this.activatedRoute.queryParams.subscribe(params => {
|
||||
if(params["serialNumber"]) {
|
||||
@@ -154,12 +156,12 @@ export class DiplomaPage implements OnInit {
|
||||
try {
|
||||
await this.processes.CompleteTask(body).toPromise()
|
||||
|
||||
this.successMessage(false, ()=>{
|
||||
this.toastService.successMessage(false, ()=>{
|
||||
this.close();
|
||||
})
|
||||
|
||||
} catch (error) {
|
||||
this.badRequest()
|
||||
this.toastService.badRequest()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -176,9 +178,9 @@ export class DiplomaPage implements OnInit {
|
||||
|
||||
try {
|
||||
await this.processes.CompleteTask(body).toPromise()
|
||||
this.successMessage()
|
||||
this.toastService.successMessage()
|
||||
} catch (error) {
|
||||
this.badRequest()
|
||||
this.toastService.badRequest()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -195,9 +197,9 @@ export class DiplomaPage implements OnInit {
|
||||
}
|
||||
try {
|
||||
await this.processes.CompleteTask(body).toPromise();
|
||||
this.successMessage('Processo concluído')
|
||||
this.toastService.successMessage('Processo concluído')
|
||||
} catch (error) {
|
||||
this.badRequest()
|
||||
this.toastService.badRequest()
|
||||
}
|
||||
|
||||
}
|
||||
@@ -275,52 +277,7 @@ export class DiplomaPage implements OnInit {
|
||||
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) => {
|
||||
|
||||
+4
-49
@@ -105,13 +105,13 @@ export class ApproveEventModalPage implements OnInit {
|
||||
try {
|
||||
await this.processes.PostTaskAction(body).toPromise()
|
||||
|
||||
this.successMessage('Evento aprovado', ()=>{
|
||||
this.toastService.successMessage('Evento aprovado', ()=>{
|
||||
this.router.navigate(['/home/gabinete-digital/event-list']);
|
||||
this.modalController.dismiss(null);
|
||||
})
|
||||
|
||||
} 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 {
|
||||
await this.processes.PostTaskAction(body).toPromise()
|
||||
this.router.navigate(['/home/gabinete-digital/event-list']);
|
||||
this.successMessage()
|
||||
this.toastService.successMessage()
|
||||
} catch (error) {
|
||||
this.badRequest()
|
||||
this.toastService.badRequest()
|
||||
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?) {
|
||||
const enterAnimation = (baseEl: any) => {
|
||||
|
||||
@@ -97,13 +97,13 @@ export class ApproveEventPage implements OnInit {
|
||||
|
||||
try {
|
||||
await this.processes.PostTaskAction(body).toPromise()
|
||||
this.successMessage()
|
||||
this.toastService.successMessage()
|
||||
this.toastService.successMessage('Evento aprovado', ()=>{
|
||||
this.goBack();
|
||||
});
|
||||
|
||||
} catch (error) {
|
||||
this.badRequest()
|
||||
this.toastService.badRequest()
|
||||
}
|
||||
|
||||
|
||||
@@ -126,16 +126,16 @@ export class ApproveEventPage implements OnInit {
|
||||
async rejeitar(serialNumber:string){
|
||||
let body = { "serialNumber": serialNumber, "action": "Rejeitar" }
|
||||
console.log(body);
|
||||
this.successMessage('Process');
|
||||
this.toastService.successMessage('Process');
|
||||
try {
|
||||
this.processes.PostTaskAction(body).toPromise();
|
||||
await this.successMessage('Processo rejeitado');
|
||||
await this.toastService.successMessage('Processo rejeitado');
|
||||
await this.toastService.successMessage('Processo rejeitado', ()=>{
|
||||
this.goBack();
|
||||
});
|
||||
|
||||
} catch (error) {
|
||||
this.badRequest()
|
||||
this.toastService.badRequest()
|
||||
}
|
||||
|
||||
}
|
||||
@@ -196,10 +196,10 @@ export class ApproveEventPage implements OnInit {
|
||||
|
||||
try {
|
||||
await this.processes.PostTaskAction(body).toPromise();
|
||||
this.successMessage();
|
||||
this.toastService.successMessage();
|
||||
this.goBack();
|
||||
} catch (error) {
|
||||
this.badRequest();
|
||||
this.toastService.badRequest();
|
||||
}
|
||||
}
|
||||
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?) {
|
||||
const enterAnimation = (baseEl: any) => {
|
||||
|
||||
+7
-5
@@ -17,6 +17,7 @@ import { SuccessMessagePage } from 'src/app/shared/popover/success-message/succe
|
||||
import { User } from 'src/app/models/user.model';
|
||||
import { AuthService } from 'src/app/services/auth.service';
|
||||
import { AttendeesPage } from 'src/app/pages/events/attendees/attendees.page';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-book-meeting-modal',
|
||||
@@ -53,7 +54,8 @@ export class BookMeetingModalPage implements OnInit {
|
||||
private attachmentsService: AttachmentsService,
|
||||
private calendarService: EventsService,
|
||||
authService: AuthService,
|
||||
private animationController: AnimationController
|
||||
private animationController: AnimationController,
|
||||
private toastService: ToastService,
|
||||
) {
|
||||
this.loggeduser = authService.ValidatedUser;
|
||||
this.task = this.navParams.get('task');
|
||||
@@ -138,9 +140,9 @@ export class BookMeetingModalPage implements OnInit {
|
||||
}
|
||||
|
||||
this.distartExpedientModal();
|
||||
this.successMessage('Reunião criada')
|
||||
this.toastService.successMessage('Reunião criada')
|
||||
} 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;
|
||||
}
|
||||
|
||||
this.successMessage('Reunião criada', ()=>{
|
||||
this.toastService.successMessage('Reunião criada', ()=>{
|
||||
this.close();
|
||||
})
|
||||
|
||||
} catch (error) {
|
||||
this.badRequest()
|
||||
this.toastService.badRequest()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+10
-55
@@ -56,7 +56,7 @@ export class ExpedienteDetailPage implements OnInit {
|
||||
public popoverController: PopoverController,
|
||||
private activatedRoute: ActivatedRoute,
|
||||
private toastService: ToastService,
|
||||
private animationController: AnimationController
|
||||
private animationController: AnimationController,
|
||||
) {
|
||||
|
||||
this.activateRoute.paramMap.subscribe(params => {
|
||||
@@ -120,14 +120,14 @@ export class ExpedienteDetailPage implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
sendExpedienteToPending(){
|
||||
sendExpedienteToPending() {
|
||||
this.processes.SetTaskToPending(this.serialnumber).subscribe(res=>{
|
||||
console.log(res);
|
||||
this.successMessage('Processo enviado para pendentes')
|
||||
this.toastService.successMessage('Processo enviado para pendentes')
|
||||
this.goBack();
|
||||
},
|
||||
(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 {
|
||||
await this.processes.CompleteTask(otherbody).toPromise()
|
||||
this.successMessage('Processo descartado');
|
||||
this.toastService.successMessage('Processo descartado');
|
||||
this.goBack();
|
||||
} 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'){
|
||||
try {
|
||||
await this.processes.CompleteTask(body).toPromise();
|
||||
this.successMessage('Processo descartado');
|
||||
this.toastService.successMessage('Processo descartado');
|
||||
this.goBack();
|
||||
} catch (error) {
|
||||
this.badRequest('Processo não descartado')
|
||||
this.toastService.badRequest('Processo não descartado')
|
||||
}
|
||||
this.goBack();
|
||||
}
|
||||
@@ -292,10 +292,10 @@ export class ExpedienteDetailPage implements OnInit {
|
||||
console.log('Update');
|
||||
try {
|
||||
await this.processes.UpdateTaskStatus(this.task.FolderId).toPromise();
|
||||
this.successMessage();
|
||||
this.toastService.successMessage();
|
||||
this.goBack();
|
||||
} 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?) {
|
||||
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 { 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 { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-expediente-pr',
|
||||
@@ -56,6 +57,7 @@ export class ExpedientePrPage implements OnInit {
|
||||
private activatedRoute: ActivatedRoute,
|
||||
private userAuth: AuthService,
|
||||
private animationController: AnimationController,
|
||||
private toastService: ToastService,
|
||||
|
||||
) {
|
||||
this.loggeduser = userAuth.ValidatedUser;
|
||||
@@ -102,11 +104,11 @@ export class ExpedientePrPage implements OnInit {
|
||||
sendExpedienteToPending(){
|
||||
this.processes.SetTaskToPending(this.serialnumber).subscribe(res=>{
|
||||
console.log(res);
|
||||
this.successMessage('Processo enviado para pendentes')
|
||||
this.toastService.successMessage('Processo enviado para pendentes')
|
||||
this.goBack();
|
||||
},
|
||||
(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 {
|
||||
await this.processes.CompleteTask(body).toPromise()
|
||||
this.close();
|
||||
this.successMessage('Processo aprovado')
|
||||
this.toastService.successMessage('Processo aprovado')
|
||||
} 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 {
|
||||
await this.processes.CompleteTask(body).toPromise()
|
||||
this.close();
|
||||
this.successMessage()
|
||||
this.toastService.successMessage()
|
||||
} catch(error) {
|
||||
this.badRequest()
|
||||
this.toastService.badRequest()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -329,9 +331,9 @@ export class ExpedientePrPage implements OnInit {
|
||||
|
||||
try {
|
||||
await this.processes.CompleteTask(otherbody).toPromise();
|
||||
this.successMessage('Processo descartado')
|
||||
this.toastService.successMessage('Processo descartado')
|
||||
} 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 {
|
||||
//await this.processes.CompleteTask(body).toPromise()
|
||||
this.successMessage()
|
||||
this.toastService.successMessage()
|
||||
this.goBack();
|
||||
} catch (error) {
|
||||
this.badRequest()
|
||||
this.toastService.badRequest()
|
||||
}
|
||||
|
||||
|
||||
@@ -360,9 +362,9 @@ export class ExpedientePrPage implements OnInit {
|
||||
|
||||
try {
|
||||
await this.processes.UpdateTaskStatus(this.task.FolderId);
|
||||
this.successMessage()
|
||||
this.toastService.successMessage()
|
||||
} catch (error) {
|
||||
this.badRequest()
|
||||
this.toastService.badRequest()
|
||||
}
|
||||
|
||||
|
||||
@@ -440,52 +442,7 @@ export class ExpedientePrPage implements OnInit {
|
||||
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?) {
|
||||
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 { BadRequestPage } from 'src/app/shared/popover/bad-request/bad-request.page';
|
||||
import { SuccessMessagePage } from 'src/app/shared/popover/success-message/success-message.page';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-pedido',
|
||||
@@ -56,7 +57,8 @@ export class PedidoPage implements OnInit {
|
||||
private alertService: AlertService,
|
||||
public popoverController: PopoverController,
|
||||
authService: AuthService,
|
||||
private animationController: AnimationController) {
|
||||
private animationController: AnimationController,
|
||||
private toastService: ToastService,) {
|
||||
this.loggeduser = authService.ValidatedUser;
|
||||
this.activatedRoute.queryParams.subscribe(params => {
|
||||
if(params["serialNumber"]) {
|
||||
@@ -199,10 +201,10 @@ export class PedidoPage implements OnInit {
|
||||
try {
|
||||
await this.processes.CompleteTask(body).toPromise()
|
||||
|
||||
this.successMessage()
|
||||
this.toastService.successMessage()
|
||||
this.close();
|
||||
} catch (error) {
|
||||
this.badRequest()
|
||||
this.toastService.badRequest()
|
||||
}
|
||||
|
||||
|
||||
@@ -221,10 +223,10 @@ export class PedidoPage implements OnInit {
|
||||
|
||||
try {
|
||||
await this.processes.CompleteTask(body).toPromise()
|
||||
this.successMessage('Processo arquivado')
|
||||
this.toastService.successMessage('Processo arquivado')
|
||||
this.close();
|
||||
} 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?) {
|
||||
const enterAnimation = (baseEl: any) => {
|
||||
|
||||
Reference in New Issue
Block a user