Improve loader

This commit is contained in:
Peter Maquiran
2021-07-12 11:13:29 +01:00
parent c526426aec
commit 507ebd691a
34 changed files with 400 additions and 32 deletions
+6 -1
View File
@@ -24,6 +24,7 @@ import { NewEventPage } from './new-event/new-event.page';
import { AuthService } from 'src/app/services/auth.service'; 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 { DateAdapter } from '@angular/material/core'; import { DateAdapter } from '@angular/material/core';
import { ToastService } from 'src/app/services/toast.service';
@Component({ @Component({
selector: 'app-agenda', selector: 'app-agenda',
@@ -158,7 +159,8 @@ export class AgendaPage implements OnInit {
private alertController: AlertService, private alertController: AlertService,
private sanitizer: DomSanitizer, private sanitizer: DomSanitizer,
authService: AuthService, authService: AuthService,
private dateAdapter: DateAdapter<any> private dateAdapter: DateAdapter<any>,
private toastService: ToastService
) { ) {
this.dateAdapter.setLocale('es'); this.dateAdapter.setLocale('es');
@@ -181,6 +183,9 @@ export class AgendaPage implements OnInit {
} }
ngOnInit() { ngOnInit() {
const loader = this.toastService.loading()
this.profile = "mdgpr"; this.profile = "mdgpr";
const pathname = window.location.pathname const pathname = window.location.pathname
@@ -60,13 +60,20 @@ export class EventActionsPopoverPage implements OnInit {
let body = { "serialNumber": this.serialNumber, "action": "Aprovar" } let body = { "serialNumber": this.serialNumber, "action": "Aprovar" }
console.log(body); console.log(body);
const loader = this.toastService.loading()
try { try {
this.processes.PostTaskAction(body).toPromise() this.processes.PostTaskAction(body).toPromise()
this.toastService.successMessage(); this.toastService.successMessage();
this.goBack(); this.goBack();
} catch (error) { } catch (error) {
this.toastService.badRequest() this.toastService.badRequest()
} }
finally {
loader.remove()
}
} }
async emendarTask() { async emendarTask() {
@@ -95,6 +102,8 @@ export class EventActionsPopoverPage implements OnInit {
} }
console.log(body); console.log(body);
const loader = this.toastService.loading()
try { try {
await this.processes.PostTaskAction(body).toPromise(); await this.processes.PostTaskAction(body).toPromise();
this.toastService.successMessage('Pedido enviado'); this.toastService.successMessage('Pedido enviado');
@@ -102,6 +111,9 @@ export class EventActionsPopoverPage implements OnInit {
} catch (error) { } catch (error) {
this.toastService.badRequest(); this.toastService.badRequest();
} }
finally {
loader.remove()
}
} }
else{ else{
//this.alertService.presentAlert('Operação cancelada!'); //this.alertService.presentAlert('Operação cancelada!');
@@ -112,13 +124,21 @@ export class EventActionsPopoverPage implements OnInit {
async rejeitar(){ async rejeitar(){
let body = { "serialNumber": this.serialNumber, "action": "Rejeitar" } let body = { "serialNumber": this.serialNumber, "action": "Rejeitar" }
console.log(body); console.log(body);
const loader = this.toastService.loading()
try { try {
this.processes.PostTaskAction(body).toPromise(); this.processes.PostTaskAction(body).toPromise();
await this.toastService.successMessage('Processo rejeitado'); await this.toastService.successMessage('Processo rejeitado');
this
this.goBack(); this.goBack();
} catch (error) { } catch (error) {
this.toastService.badRequest() this.toastService.badRequest()
} }
finally {
loader.remove()
}
} }
async editTask() { async editTask() {
@@ -270,7 +270,7 @@ export class NewEventPage implements OnInit {
try { try {
await this.attachmentsService.setEventAttachmentById(attachments).toPromise(); await this.attachmentsService.setEventAttachmentById(attachments).toPromise();
} catch(error) { } catch(error) {
alert('document error') console.log('document not save')
} }
}); });
@@ -140,6 +140,8 @@ export class ViewEventPage implements OnInit {
} }
getAttachments() { getAttachments() {
const loader = this.toastService.loading()
try { try {
this.attachmentsService.getAttachmentsById(this.eventId).subscribe(res=>{ this.attachmentsService.getAttachmentsById(this.eventId).subscribe(res=>{
this.loadedAttachments = res; this.loadedAttachments = res;
@@ -148,6 +150,10 @@ export class ViewEventPage implements OnInit {
} catch (error) { } catch (error) {
} }
finally {
loader.remove()
}
} }
async editEventDetail() { async editEventDetail() {
@@ -5,6 +5,7 @@ import { ContactsPage } from 'src/app/pages/chat/messages/contacts/contacts.page
import { AlertService } from 'src/app/services/alert.service'; import { AlertService } from 'src/app/services/alert.service';
import { AuthService } from 'src/app/services/auth.service'; import { AuthService } from 'src/app/services/auth.service';
import { ChatService } from 'src/app/services/chat.service'; import { ChatService } from 'src/app/services/chat.service';
import { ToastService } from 'src/app/services/toast.service';
import { ChatOptionsPopoverPage } from 'src/app/shared/popover/chat-options-popover/chat-options-popover.page'; import { ChatOptionsPopoverPage } from 'src/app/shared/popover/chat-options-popover/chat-options-popover.page';
import { MessagesOptionsPage } from 'src/app/shared/popover/messages-options/messages-options.page'; import { MessagesOptionsPage } from 'src/app/shared/popover/messages-options/messages-options.page';
@@ -34,6 +35,7 @@ export class MessagesPage implements OnInit, AfterViewChecked {
private chatService: ChatService, private chatService: ChatService,
private authService: AuthService, private authService: AuthService,
private alertService: AlertService, private alertService: AlertService,
private toastService: ToastService,
) { ) {
this.roomId = this.navParams.get('roomId'); this.roomId = this.navParams.get('roomId');
} }
@@ -73,9 +75,11 @@ export class MessagesPage implements OnInit, AfterViewChecked {
this.scrollToBottom(); this.scrollToBottom();
} }
scrollToBottom(): void { scrollToBottom(): void {
try { try {
this.myScrollContainer.nativeElement.scrollTop = this.myScrollContainer.nativeElement.scrollHeight; this.myScrollContainer.nativeElement.scrollTop = this.myScrollContainer.nativeElement.scrollHeight;
} catch(err) { } } catch(err) { }
} }
loadMoreMessages(ev:any){ loadMoreMessages(ev:any){
@@ -190,6 +190,8 @@ export class DespachoPrPage implements OnInit {
"AttachmentList" :documents, "AttachmentList" :documents,
} }
const loader = this.toastService.loading()
try { try {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
this.close(); this.close();
@@ -197,6 +199,10 @@ export class DespachoPrPage implements OnInit {
} catch(error) { } catch(error) {
this.toastService.badRequest() this.toastService.badRequest()
} }
finally {
loader.remove()
}
} }
async arquivar(note:string, documents:any){ async arquivar(note:string, documents:any){
@@ -209,6 +215,9 @@ export class DespachoPrPage implements OnInit {
}, },
"AttachmentList" :documents, "AttachmentList" :documents,
} }
const loader = this.toastService.loading()
try { try {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
this.toastService.successMessage('Processo arquivado') this.toastService.successMessage('Processo arquivado')
@@ -216,6 +225,10 @@ export class DespachoPrPage implements OnInit {
} catch (error) { } catch (error) {
this.toastService.badRequest('Processo não arquivado') this.toastService.badRequest('Processo não arquivado')
} }
finally {
loader.remove()
}
} }
@@ -230,6 +243,8 @@ export class DespachoPrPage implements OnInit {
"AttachmentList" :documents, "AttachmentList" :documents,
} }
const loader = this.toastService.loading()
try { try {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
this.toastService.successMessage('Processo criado') this.toastService.successMessage('Processo criado')
@@ -237,6 +252,9 @@ export class DespachoPrPage implements OnInit {
} catch (error) { } catch (error) {
this.toastService.badRequest('Processo não criado') this.toastService.badRequest('Processo não criado')
} }
finally {
loader.remove()
}
} }
@@ -187,6 +187,8 @@ export class DespachoPage implements OnInit {
"AttachmentList" :documents, "AttachmentList" :documents,
} }
const loader = this.toastService.loading()
try { try {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
this.close(); this.close();
@@ -194,6 +196,9 @@ export class DespachoPage implements OnInit {
} catch(error) { } catch(error) {
this.toastService.badRequest("Processo não criado") this.toastService.badRequest("Processo não criado")
} }
finally {
loader.remove()
}
} }
async arquivar(note:string, documents:any){ async arquivar(note:string, documents:any){
@@ -206,6 +211,8 @@ export class DespachoPage implements OnInit {
}, },
"AttachmentList" :documents, "AttachmentList" :documents,
} }
const loader = this.toastService.loading()
try { try {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
this.toastService.successMessage('Processo descartado') this.toastService.successMessage('Processo descartado')
@@ -213,6 +220,9 @@ export class DespachoPage implements OnInit {
} catch (error) { } catch (error) {
this.toastService.badRequest("Processo não descartado") this.toastService.badRequest("Processo não descartado")
} }
finally {
loader.remove()
}
} }
@@ -226,6 +236,9 @@ export class DespachoPage implements OnInit {
}, },
"AttachmentList" :documents, "AttachmentList" :documents,
} }
const loader = this.toastService.loading()
try { try {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
this.toastService.successMessage() this.toastService.successMessage()
@@ -233,6 +246,10 @@ export class DespachoPage implements OnInit {
} catch (error) { } catch (error) {
this.toastService.badRequest() this.toastService.badRequest()
} }
finally {
loader.remove()
}
} }
async reexecute(note:string, documents:any) { async reexecute(note:string, documents:any) {
@@ -246,6 +263,8 @@ export class DespachoPage implements OnInit {
"AttachmentList" :documents, "AttachmentList" :documents,
} }
const loader = this.toastService.loading()
try { try {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
this.toastService.successMessage() this.toastService.successMessage()
@@ -254,6 +273,9 @@ export class DespachoPage implements OnInit {
} catch (error) { } catch (error) {
this.toastService.badRequest() this.toastService.badRequest()
} }
finally {
loader.remove()
}
} }
@@ -154,6 +154,9 @@ export class DiplomaAssinarPage implements OnInit {
}, },
"AttachmentList": [], "AttachmentList": [],
} }
const loader = this.toastService.loading()
try { try {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
@@ -163,6 +166,10 @@ export class DiplomaAssinarPage implements OnInit {
} catch (error) { } catch (error) {
this.toastService.badRequest() this.toastService.badRequest()
} }
finally {
loader.remove()
}
} }
close() { close() {
@@ -168,6 +168,9 @@ export class DiplomaPage implements OnInit {
}, },
"AttachmentList" :documents, "AttachmentList" :documents,
} }
const loader = this.toastService.loading()
try { try {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
@@ -178,6 +181,9 @@ export class DiplomaPage implements OnInit {
} catch (error) { } catch (error) {
this.toastService.badRequest() this.toastService.badRequest()
} }
finally {
loader.remove()
}
} }
async askToChange(note:string, documents:any){ async askToChange(note:string, documents:any){
@@ -191,12 +197,17 @@ export class DiplomaPage implements OnInit {
"AttachmentList" :documents, "AttachmentList" :documents,
} }
const loader = this.toastService.loading()
try { try {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
this.toastService.successMessage() this.toastService.successMessage()
} catch (error) { } catch (error) {
this.toastService.badRequest() this.toastService.badRequest()
} }
finally {
loader.remove()
}
} }
async finish(note:string, documents:any){ async finish(note:string, documents:any){
@@ -210,12 +221,18 @@ export class DiplomaPage implements OnInit {
}, },
"AttachmentList" :documents, "AttachmentList" :documents,
} }
const loader = this.toastService.loading()
try { try {
await this.processes.CompleteTask(body).toPromise(); await this.processes.CompleteTask(body).toPromise();
this.toastService.successMessage('Processo concluído') this.toastService.successMessage('Processo concluído')
} catch (error) { } catch (error) {
this.toastService.badRequest() this.toastService.badRequest()
} }
finally {
loader.remove()
}
} }
@@ -102,6 +102,9 @@ export class ApproveEventModalPage implements OnInit {
console.log('approveTask SERIALNUMBER: ', serialNumber) console.log('approveTask SERIALNUMBER: ', serialNumber)
let body = { "serialNumber": serialNumber, "action": "Aprovar" } let body = { "serialNumber": serialNumber, "action": "Aprovar" }
console.log(body); console.log(body);
const loader = this.toastService.loading()
try { try {
await this.processes.PostTaskAction(body).toPromise() await this.processes.PostTaskAction(body).toPromise()
@@ -113,6 +116,9 @@ export class ApproveEventModalPage implements OnInit {
} catch (error) { } catch (error) {
this.toastService.badRequest('Evento não aprovado') this.toastService.badRequest('Evento não aprovado')
} }
finally {
loader.remove()
}
} }
@@ -128,6 +134,8 @@ export class ApproveEventModalPage implements OnInit {
let body = { "serialNumber": serialNumber, "action": "Rejeitar" } let body = { "serialNumber": serialNumber, "action": "Rejeitar" }
const loader = this.toastService.loading()
try { try {
await this.processes.PostTaskAction(body).toPromise() await this.processes.PostTaskAction(body).toPromise()
@@ -137,6 +145,9 @@ export class ApproveEventModalPage implements OnInit {
} catch (error) { } catch (error) {
this.toastService.badRequest('Evento não rejeitado') this.toastService.badRequest('Evento não rejeitado')
} }
finally {
loader.remove()
}
this.modalController.dismiss(null); this.modalController.dismiss(null);
} }
@@ -183,6 +194,7 @@ export class ApproveEventModalPage implements OnInit {
} }
//console.log(body); //console.log(body);
const loader = this.toastService.loading()
try { try {
await this.processes.PostTaskAction(body).toPromise() await this.processes.PostTaskAction(body).toPromise()
@@ -192,6 +204,9 @@ export class ApproveEventModalPage implements OnInit {
this.toastService.badRequest() this.toastService.badRequest()
this.router.navigate(['/home/gabinete-digital/event-list']); this.router.navigate(['/home/gabinete-digital/event-list']);
} }
finally {
loader.remove()
}
} }
else { else {
@@ -97,6 +97,8 @@ export class ApproveEventPage implements OnInit {
let body = { "serialNumber": serialNumber, "action": "Aprovar" } let body = { "serialNumber": serialNumber, "action": "Aprovar" }
console.log(body); console.log(body);
const loader = this.toastService.loading()
try { try {
await this.processes.PostTaskAction(body).toPromise() await this.processes.PostTaskAction(body).toPromise()
this.toastService.successMessage(); this.toastService.successMessage();
@@ -105,6 +107,9 @@ export class ApproveEventPage implements OnInit {
} catch (error) { } catch (error) {
this.toastService.badRequest() this.toastService.badRequest()
} }
finally {
loader.remove()
}
/* this.approveEventDismiss.emit({ /* this.approveEventDismiss.emit({
@@ -144,13 +149,18 @@ export class ApproveEventPage implements OnInit {
} }
console.log(body); console.log(body);
const loader = this.toastService.loading()
try { try {
await this.processes.PostTaskAction(body).toPromise(); await this.processes.PostTaskAction(body).toPromise();
this.toastService.successMessage('Pedido enviado'); this.toastService.successMessage('Pedido enviado');
this.goBack(); this.goBack();
} catch (error) { } catch (error) {
this.toastService.badRequest(); this.toastService.badRequest();
} finally {
loader.remove()
} }
} }
else{ else{
//this.alertService.presentAlert('Operação cancelada!'); //this.alertService.presentAlert('Operação cancelada!');
@@ -164,6 +174,7 @@ 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);
const loader = this.toastService.loading()
try { try {
this.processes.PostTaskAction(body).toPromise(); this.processes.PostTaskAction(body).toPromise();
await this.toastService.successMessage('Processo rejeitado'); await this.toastService.successMessage('Processo rejeitado');
@@ -171,9 +182,14 @@ export class ApproveEventPage implements OnInit {
} catch (error) { } catch (error) {
this.toastService.badRequest() this.toastService.badRequest()
} }
finally {
loader.remove()
}
} }
async getAttachments(instanceId:string){ async getAttachments(instanceId:string){
const loader = this.toastService.loading()
try { try {
this.loadedAttachments = await this.attachmentsService.getAttachmentsById(instanceId).toPromise(); this.loadedAttachments = await this.attachmentsService.getAttachmentsById(instanceId).toPromise();
@@ -233,13 +249,18 @@ export class ApproveEventPage implements OnInit {
} }
console.log(body); console.log(body);
const loader = this.toastService.loading()
try { try {
await this.processes.PostTaskAction(body).toPromise(); await this.processes.PostTaskAction(body).toPromise();
this.toastService.successMessage(); this.toastService.successMessage();
this.goBack(); this.goBack();
} catch (error) { } catch (error) {
this.toastService.badRequest(); this.toastService.badRequest();
} finally {
loader.remove()
} }
} }
else{ else{
//this.alertService.presentAlert('Operação cancelada!'); //this.alertService.presentAlert('Operação cancelada!');
@@ -252,7 +252,7 @@ export class BookMeetingModalPage implements OnInit {
console.log(this.postData); console.log(this.postData);
if(this.task.FsId == '8') { if(this.task.FsId == '8') {
const loader = this.toastService.loading()
try { try {
switch (this.loggeduser.Profile) { switch (this.loggeduser.Profile) {
case 'MDGPR': case 'MDGPR':
@@ -271,10 +271,14 @@ export class BookMeetingModalPage implements OnInit {
} catch (error) { } catch (error) {
this.toastService.badRequest('Reunião não criada') this.toastService.badRequest('Reunião não criada')
} }
finally {
loader.remove()
}
} }
else if(this.task.FsId == '361') { else if(this.task.FsId == '361') {
const loader = this.toastService.loading()
try { try {
switch (this.loggeduser.Profile) { switch (this.loggeduser.Profile) {
case 'MDGPR': case 'MDGPR':
@@ -290,7 +294,10 @@ export class BookMeetingModalPage implements OnInit {
} catch (error) { } catch (error) {
this.toastService.badRequest() this.toastService.badRequest()
} finally {
loader.remove()
} }
} }
} }
@@ -271,6 +271,8 @@ export class ExpedientTaskModalPage implements OnInit {
DispatchFolder: this.dispatchFolder, DispatchFolder: this.dispatchFolder,
AttachmentList: docs, AttachmentList: docs,
} }
const loader = this.toastService.loading()
try { try {
let action_despacho = { let action_despacho = {
"serialNumber": this.task.serialNumber, "serialNumber": this.task.serialNumber,
@@ -291,6 +293,8 @@ export class ExpedientTaskModalPage implements OnInit {
} catch (error) { } catch (error) {
loader.remove() loader.remove()
await this.toastService.badRequest('Processo não efetuado') await this.toastService.badRequest('Processo não efetuado')
} finally {
loader.remove()
} }
console.log('this.taskResult', this.taskResult); console.log('this.taskResult', this.taskResult);
break; break;
@@ -336,6 +340,8 @@ export class ExpedientTaskModalPage implements OnInit {
AttachmentList: docs AttachmentList: docs
} }
//console.log(this.postData); //console.log(this.postData);
const loader1 = this.toastService.loading()
try { try {
let action_deferimento = { let action_deferimento = {
"serialNumber": this.task.serialNumber, "serialNumber": this.task.serialNumber,
@@ -346,14 +352,15 @@ export class ExpedientTaskModalPage implements OnInit {
} }
} }
this.taskResult = await this.processes.postDeferimento(this.postData).toPromise(); this.taskResult = await this.processes.postDeferimento(this.postData).toPromise();
loader.remove()
await this.toastService.successMessage('Processo efetuado'); await this.toastService.successMessage('Processo efetuado');
this.modalController.dismiss(action_deferimento); this.modalController.dismiss(action_deferimento);
} catch (error) { } catch (error) {
loader.remove()
await this.toastService.badRequest('Processo não efetuado') await this.toastService.badRequest('Processo não efetuado')
} finally {
loader1.remove()
} }
console.log('this.taskResult', this.taskResult); console.log('this.taskResult', this.taskResult);
break; break;
} }
@@ -375,6 +382,8 @@ export class ExpedientTaskModalPage implements OnInit {
AttachmentList: docs, AttachmentList: docs,
} }
console.log(this.postData); console.log(this.postData);
const loader = this.toastService.loading()
try { try {
let action_despacho_pr = { let action_despacho_pr = {
"serialNumber": this.task.serialNumber, "serialNumber": this.task.serialNumber,
@@ -394,7 +403,10 @@ export class ExpedientTaskModalPage implements OnInit {
} catch (error) { } catch (error) {
loader.remove() loader.remove()
await this.toastService.badRequest('Processo não efetuado') await this.toastService.badRequest('Processo não efetuado')
} finally {
loader.remove()
} }
console.log('this.taskResult', this.taskResult); console.log('this.taskResult', this.taskResult);
break; break;
@@ -409,6 +421,8 @@ export class ExpedientTaskModalPage implements OnInit {
AttachmentList: docs AttachmentList: docs
} }
const loader2 = this.toastService.loading()
try { try {
let action_parecer_pr = { let action_parecer_pr = {
"serialNumber": this.task.serialNumber, "serialNumber": this.task.serialNumber,
@@ -418,15 +432,17 @@ export class ExpedientTaskModalPage implements OnInit {
"Note": "", "Note": "",
} }
} }
loader.remove()
this.taskResult = await this.processes.postParecerPr(this.postData).toPromise(); this.taskResult = await this.processes.postParecerPr(this.postData).toPromise();
await this.toastService.badRequest('Processo não efetuado'); await this.toastService.badRequest('Processo não efetuado');
this.modalController.dismiss(action_parecer_pr); this.modalController.dismiss(action_parecer_pr);
} catch (error) { } catch (error) {
loader.remove()
await this.toastService.badRequest('Processo não efetuado') await this.toastService.badRequest('Processo não efetuado')
} finally {
loader2.remove()
} }
break; break;
} }
@@ -246,12 +246,16 @@ export class ExpedienteDetailPage implements OnInit {
} }
} }
const loader = this.toastService.loading()
try { try {
await this.processes.CompleteTask(otherbody).toPromise() await this.processes.CompleteTask(otherbody).toPromise()
this.toastService.successMessage('Processo descartado'); this.toastService.successMessage('Processo descartado');
this.goBack(); this.goBack();
} catch (error) { } catch (error) {
this.toastService.badRequest('Processo não descartado') this.toastService.badRequest('Processo não descartado')
} finally {
loader.remove()
} }
} }
@@ -261,23 +265,30 @@ export class ExpedienteDetailPage implements OnInit {
} }
else{ else{
if(res['data']== 'Yes'){ if(res['data']== 'Yes'){
const loader = this.toastService.loading()
try { try {
await this.processes.CompleteTask(body).toPromise(); await this.processes.CompleteTask(body).toPromise();
this.toastService.successMessage('Processo descartado'); this.toastService.successMessage('Processo descartado');
this.goBack(); this.goBack();
} catch (error) { } catch (error) {
this.toastService.badRequest('Processo não descartado') this.toastService.badRequest('Processo não descartado')
} finally {
loader.remove()
} }
this.goBack(); this.goBack();
} }
else if(res['data'] == 'No'){ else if(res['data'] == 'No'){
console.log('Update'); console.log('Update');
const loader = this.toastService.loading()
try { try {
await this.processes.UpdateTaskStatus(this.task.FolderId).toPromise(); await this.processes.UpdateTaskStatus(this.task.FolderId).toPromise();
this.toastService.successMessage(); this.toastService.successMessage();
this.goBack(); this.goBack();
} catch (error) { } catch (error) {
this.toastService.badRequest() this.toastService.badRequest()
} finally {
loader.remove()
} }
} }
} }
@@ -231,13 +231,18 @@ export class ExpedientePrPage implements OnInit {
console.log(body); console.log(body);
const loader = this.toastService.loading()
try { try {
await this.processes.CompleteTask(body).toPromise(); await this.processes.CompleteTask(body).toPromise();
this.close(); this.close();
this.toastService.successMessage('Processo aprovado') this.toastService.successMessage('Processo aprovado')
} catch(error) { } catch(error) {
this.toastService.badRequest('Processo não aprovado') this.toastService.badRequest('Processo não aprovado')
} finally {
loader.remove()
} }
} }
async sendToReview(note:string, documents:any){ async sendToReview(note:string, documents:any){
@@ -251,12 +256,16 @@ export class ExpedientePrPage implements OnInit {
"AttachmentList" :documents, "AttachmentList" :documents,
} }
const loader = this.toastService.loading()
try { try {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
this.close(); this.close();
this.toastService.successMessage() this.toastService.successMessage()
} catch(error) { } catch(error) {
this.toastService.badRequest() this.toastService.badRequest()
} finally {
loader.remove()
} }
} }
@@ -360,12 +369,16 @@ export class ExpedientePrPage implements OnInit {
} }
} }
const loader = this.toastService.loading()
try { try {
await this.processes.CompleteTask(otherbody).toPromise() await this.processes.CompleteTask(otherbody).toPromise()
this.toastService.successMessage('Processo descartado'); this.toastService.successMessage('Processo descartado');
this.goBack(); this.goBack();
} catch (error) { } catch (error) {
this.toastService.badRequest('Processo não descartado') this.toastService.badRequest('Processo não descartado')
} finally {
loader.remove()
} }
} }
@@ -375,23 +388,34 @@ export class ExpedientePrPage implements OnInit {
} }
else{ else{
if(res['data']== 'Yes'){ if(res['data']== 'Yes'){
const loader = this.toastService.loading()
try { try {
await this.processes.CompleteTask(body).toPromise(); await this.processes.CompleteTask(body).toPromise();
this.toastService.successMessage('Processo descartado'); this.toastService.successMessage('Processo descartado');
this.goBack(); this.goBack();
} catch (error) { } catch (error) {
this.toastService.badRequest('Processo não descartado') this.toastService.badRequest('Processo não descartado')
} finally {
loader.remove()
} }
this.goBack(); this.goBack();
} }
else if(res['data'] == 'No'){ else if(res['data'] == 'No'){
console.log('Update'); console.log('Update');
const loader = this.toastService.loading()
try { try {
await this.processes.UpdateTaskStatus(this.task.FolderId).toPromise(); await this.processes.UpdateTaskStatus(this.task.FolderId).toPromise();
this.toastService.successMessage(); this.toastService.successMessage();
this.goBack(); this.goBack();
} catch (error) { } catch (error) {
this.toastService.badRequest() this.toastService.badRequest()
} finally {
loader.remove()
} }
} }
} }
@@ -199,6 +199,9 @@ export class PedidoPage implements OnInit {
}, },
"AttachmentList" :documents, "AttachmentList" :documents,
} }
const loader = this.toastService.loading()
try { try {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
@@ -206,6 +209,8 @@ export class PedidoPage implements OnInit {
this.close(); this.close();
} catch (error) { } catch (error) {
this.toastService.badRequest() this.toastService.badRequest()
} finally {
loader.remove()
} }
} }
@@ -220,13 +225,18 @@ export class PedidoPage implements OnInit {
"AttachmentList" :documents, "AttachmentList" :documents,
} }
const loader = this.toastService.loading()
try { try {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
this.toastService.successMessage('Processo arquivado') this.toastService.successMessage('Processo arquivado')
this.close(); this.close();
} catch (error) { } catch (error) {
this.toastService.badRequest() this.toastService.badRequest()
} finally {
loader.remove()
} }
} }
async assignar(note:string, documents:any) { async assignar(note:string, documents:any) {
@@ -240,13 +250,18 @@ export class PedidoPage implements OnInit {
"AttachmentList" :documents, "AttachmentList" :documents,
} }
const loader = this.toastService.loading()
try { try {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
this.toastService.successMessage('Processo arquivado') this.toastService.successMessage('Processo arquivado')
this.close(); this.close();
} catch (error) { } catch (error) {
this.toastService.badRequest() this.toastService.badRequest()
} finally {
loader.remove()
} }
} }
sendExpedienteToPending() { sendExpedienteToPending() {
@@ -98,6 +98,7 @@ export class EditActionPage implements OnInit {
ActionType: this.folder.ActionType, ActionType: this.folder.ActionType,
} }
console.log(body); console.log(body);
const loader = this.toastService.loading()
try { try {
await this.publicationsService.UpdatePresidentialAction(body).toPromise() await this.publicationsService.UpdatePresidentialAction(body).toPromise()
@@ -106,6 +107,9 @@ export class EditActionPage implements OnInit {
this.toastService.successMessage('Acção presidencial atualizada') this.toastService.successMessage('Acção presidencial atualizada')
} catch (error) { } catch (error) {
this.toastService.badRequest('Não foi possivel atualizar a acção presidencial') this.toastService.badRequest('Não foi possivel atualizar a acção presidencial')
} } finally {
loader.remove()
}
} }
} }
@@ -136,20 +136,21 @@ export class NewActionPage implements OnInit {
} }
let loader = this.toastService.loading() const loader = this.toastService.loading()
try { try {
await this.publication.CreatePublicationFolder(this.folder).toPromise(); await this.publication.CreatePublicationFolder(this.folder).toPromise();
loader.remove()
this.toastService.successMessage("Ação presidencial criado"); this.toastService.successMessage("Ação presidencial criado");
this.close(); this.close();
} catch (error) { } catch (error) {
loader.remove()
this.toastService.badRequest("Ação presidencial não criado"); this.toastService.badRequest("Ação presidencial não criado");
} finally {
loader.remove()
} }
} }
close(){ close(){
@@ -164,6 +164,8 @@ export class NewPublicationPage implements OnInit {
FileExtension: 'jpeg', FileExtension: 'jpeg',
} }
const loader = this.toastService.loading()
try { try {
console.log(this.publication); console.log(this.publication);
@@ -173,6 +175,8 @@ export class NewPublicationPage implements OnInit {
this.close(); this.close();
} catch (error) { } catch (error) {
this.toastService.badRequest("Publicação não criado") this.toastService.badRequest("Publicação não criado")
} finally {
loader.remove()
} }
} }
@@ -190,6 +194,9 @@ export class NewPublicationPage implements OnInit {
} }
/* console.log('Edit - keep image'); /* console.log('Edit - keep image');
console.log(this.publication); */ console.log(this.publication); */
const loader = this.toastService.loading()
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()
@@ -198,6 +205,8 @@ export class NewPublicationPage implements OnInit {
this.close(); this.close();
} catch (error) { } catch (error) {
this.toastService.badRequest("Publicação não criado") this.toastService.badRequest("Publicação não criado")
} finally {
loader.remove()
} }
} }
@@ -215,6 +224,8 @@ export class NewPublicationPage implements OnInit {
FileExtension: 'jpeg', FileExtension: 'jpeg',
} }
const loader = this.toastService.loading()
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();
@@ -225,6 +236,8 @@ export class NewPublicationPage implements OnInit {
this.close(); this.close();
} catch (error) { } catch (error) {
this.toastService.badRequest("Publicação não criado") this.toastService.badRequest("Publicação não criado")
} finally {
loader.remove()
} }
} }
@@ -83,12 +83,16 @@ export class PublicationDetailPage implements OnInit {
async deletePost(){ async deletePost(){
const loader = this.toastService.loading()
try { try {
await this.publications.DeletePublication(this.folderId, this.publicationId).toPromise(); await this.publications.DeletePublication(this.folderId, this.publicationId).toPromise();
this.toastService.successMessage('Publicação eliminado') this.toastService.successMessage('Publicação eliminado')
this.close(); this.close();
} catch (error) { } catch (error) {
this.toastService.badRequest('Publicação não eliminado') this.toastService.badRequest('Publicação não eliminado')
} finally {
loader.remove()
} }
} }
@@ -94,6 +94,8 @@ export class PublicationDetailPage implements OnInit {
async deletePost(){ async deletePost(){
const loader = this.toastService.loading()
try { try {
await this.publications.DeletePublication(this.folderId, this.publicationId).toPromise(); await this.publications.DeletePublication(this.folderId, this.publicationId).toPromise();
this.toastService.successMessage('Publicaçao eliminado') this.toastService.successMessage('Publicaçao eliminado')
@@ -103,6 +105,8 @@ export class PublicationDetailPage implements OnInit {
} catch (error) { } catch (error) {
this.toastService.badRequest('Publicaçao não eliminado') this.toastService.badRequest('Publicaçao não eliminado')
} finally {
loader.remove()
} }
} }
+5 -1
View File
@@ -14,6 +14,10 @@ export class ToastService {
private modalController: ModalController, private modalController: ModalController,
) { } ) { }
ngOnInit() {
const loader = this.loading()
}
async presentToast(infoMessage: string) { async presentToast(infoMessage: string) {
const toast = await this.toastController.create({ const toast = await this.toastController.create({
message: infoMessage, message: infoMessage,
@@ -132,7 +136,7 @@ export class ToastService {
<div class="loading-blocker"> <div class="loading-blocker">
<div class="loading-blocker-container"> <div class="loading-blocker-container">
<img src="/assets/images/Blocks-loader.gif" width="250" /> <img src="/assets/images/Blocks-loader.gif" />
</div> </div>
</div> </div>
` `
@@ -81,12 +81,16 @@ export class ApproveEventPage implements OnInit {
async approveTask(serialNumber:string) { async approveTask(serialNumber:string) {
let body = { "serialNumber": serialNumber, "action": "Aprovar" } let body = { "serialNumber": serialNumber, "action": "Aprovar" }
const loader = this.toastService.loading()
try { try {
await this.processes.PostTaskAction(body).toPromise() await this.processes.PostTaskAction(body).toPromise()
this.modalController.dismiss(serialNumber); this.modalController.dismiss(serialNumber);
this.toastService.successMessage() this.toastService.successMessage()
} catch (error) { } catch (error) {
this.toastService.badRequest() this.toastService.badRequest()
} finally {
loader.remove()
} }
/* this.approveEventDismiss.emit({ /* this.approveEventDismiss.emit({
@@ -105,12 +109,16 @@ export class ApproveEventPage implements OnInit {
let body = { "serialNumber": serialNumber, "action": "Rejeitar" } let body = { "serialNumber": serialNumber, "action": "Rejeitar" }
console.log(body); console.log(body);
const loader = this.toastService.loading()
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.toastService.successMessage('Evento rejeitado') this.toastService.successMessage('Evento rejeitado')
} catch (error) { } catch (error) {
this.toastService.badRequest('Processo não efectuado') this.toastService.badRequest('Processo não efectuado')
} finally {
loader.remove()
} }
} }
@@ -165,6 +173,7 @@ export class ApproveEventPage implements OnInit {
} }
} }
console.log(body); console.log(body);
const loader = this.toastService.loading()
try { try {
await this.processes.PostTaskAction(body).toPromise(); await this.processes.PostTaskAction(body).toPromise();
@@ -172,6 +181,8 @@ export class ApproveEventPage implements OnInit {
this.close(); this.close();
} catch (error) { } catch (error) {
this.toastService.badRequest(); this.toastService.badRequest();
} finally {
loader.remove()
} }
} }
else{ else{
@@ -4,6 +4,7 @@ import { Status } from 'src/app/models/chat/status.model';
import { AlertService } from 'src/app/services/alert.service'; import { AlertService } from 'src/app/services/alert.service';
import { AuthService } from 'src/app/services/auth.service'; import { AuthService } from 'src/app/services/auth.service';
import { ChatService } from 'src/app/services/chat.service'; import { ChatService } from 'src/app/services/chat.service';
import { ToastService } from 'src/app/services/toast.service';
import { ChatOptionsPopoverPage } from 'src/app/shared/popover/chat-options-popover/chat-options-popover.page'; import { ChatOptionsPopoverPage } from 'src/app/shared/popover/chat-options-popover/chat-options-popover.page';
import { MessagesOptionsPage } from 'src/app/shared/popover/messages-options/messages-options.page'; import { MessagesOptionsPage } from 'src/app/shared/popover/messages-options/messages-options.page';
import { ProfileComponent } from '../../headers/header-no-search/profile/profile.page'; import { ProfileComponent } from '../../headers/header-no-search/profile/profile.page';
@@ -37,6 +38,7 @@ export class MessagesPage implements OnInit, AfterViewChecked, OnChanges {
private authService: AuthService, private authService: AuthService,
private animationController: AnimationController, private animationController: AnimationController,
private alertService: AlertService, private alertService: AlertService,
private toastService: ToastService,
) { ) {
/* this.dm = this.navParams.get('dm'); */ /* this.dm = this.navParams.get('dm'); */
} }
@@ -84,9 +86,15 @@ export class MessagesPage implements OnInit, AfterViewChecked, OnChanges {
console.log(this.roomId); console.log(this.roomId);
} }
scrollToBottom(): void { scrollToBottom(): void {
const loader = this.toastService.loading()
try { try {
this.myScrollContainer.nativeElement.scrollTop = this.myScrollContainer.nativeElement.scrollHeight; this.myScrollContainer.nativeElement.scrollTop = this.myScrollContainer.nativeElement.scrollHeight;
} catch(err) { } } catch(err) { }
finally {
loader.remove()
}
} }
loadMoreMessages(ev:any){ loadMoreMessages(ev:any){
@@ -95,13 +95,18 @@ export class DeplomaOptionsPage implements OnInit {
"AttachmentList" :documents, "AttachmentList" :documents,
} }
const loader = this.toastService.loading()
try { try {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
this.close(); this.close();
this.toastService.successMessage() this.toastService.successMessage()
} catch (error) { } catch (error) {
this.toastService.badRequest() this.toastService.badRequest()
} finally {
loader.remove()
} }
} }
@@ -135,13 +140,19 @@ export class DeplomaOptionsPage implements OnInit {
}, },
"AttachmentList" :documents, "AttachmentList" :documents,
} }
const loader = this.toastService.loading()
try { try {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
this.close(); this.close();
this.toastService.successMessage() this.toastService.successMessage()
} catch (error) { } catch (error) {
this.toastService.badRequest() this.toastService.badRequest()
} finally {
loader.remove()
} }
} }
@@ -146,12 +146,16 @@ export class DespachosOptionsPage implements OnInit {
"AttachmentList" :documents, "AttachmentList" :documents,
} }
const loader = this.toastService.loading()
try { try {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
this.toastService.successMessage() this.toastService.successMessage()
this.close(); this.close();
} catch (error) { } catch (error) {
this.toastService.badRequest() this.toastService.badRequest()
} finally {
loader.remove()
} }
} }
@@ -220,14 +224,20 @@ export class DespachosOptionsPage implements OnInit {
}, },
"AttachmentList" :documents, "AttachmentList" :documents,
} }
const loader = this.toastService.loading()
try { try {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
this.toastService.successMessage('Processo arquivado') this.toastService.successMessage('Processo arquivado')
this.close(); this.close();
} catch (error) { } catch (error) {
this.toastService.badRequest('Processo não arquivado') this.toastService.badRequest('Processo não arquivado')
} finally {
loader.remove()
} }
} }
@@ -242,13 +252,18 @@ export class DespachosOptionsPage implements OnInit {
"AttachmentList" :documents, "AttachmentList" :documents,
} }
const loader = this.toastService.loading()
try { try {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
this.close(); this.close();
this.toastService.successMessage() this.toastService.successMessage()
} catch(error) { } catch(error) {
this.toastService.badRequest() this.toastService.badRequest()
} finally {
loader.remove()
} }
} }
@@ -263,12 +278,17 @@ export class DespachosOptionsPage implements OnInit {
}, },
"AttachmentList" :documents, "AttachmentList" :documents,
} }
const loader = this.toastService.loading()
try { try {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
this.toastService.successMessage() this.toastService.successMessage()
this.close(); this.close();
} catch (error) { } catch (error) {
this.toastService.badRequest() this.toastService.badRequest()
} finally {
loader.remove()
} }
} }
@@ -179,12 +179,16 @@ export class DespachosPrOptionsPage implements OnInit {
"AttachmentList" :documents, "AttachmentList" :documents,
} }
const loader = this.toastService.loading()
try { try {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
this.toastService.successMessage() this.toastService.successMessage()
this.close(); this.close();
} catch (error) { } catch (error) {
this.toastService.badRequest() this.toastService.badRequest()
} finally {
loader.remove()
} }
} }
@@ -255,12 +259,17 @@ export class DespachosPrOptionsPage implements OnInit {
}, },
"AttachmentList" :documents, "AttachmentList" :documents,
} }
const loader = this.toastService.loading()
try { try {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
this.toastService.successMessage('Processo arquivado') this.toastService.successMessage('Processo arquivado')
this.close(); this.close();
} catch (error) { } catch (error) {
this.toastService.badRequest('Processo não arquivado') this.toastService.badRequest('Processo não arquivado')
} finally {
loader.remove()
} }
} }
@@ -277,13 +286,18 @@ export class DespachosPrOptionsPage implements OnInit {
"AttachmentList" :documents, "AttachmentList" :documents,
} }
const loader = this.toastService.loading()
try { try {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
this.close(); this.close();
this.toastService.successMessage() this.toastService.successMessage()
} catch(error) { } catch(error) {
this.toastService.badRequest() this.toastService.badRequest()
} finally {
loader.remove()
} }
} }
@@ -297,12 +311,17 @@ export class DespachosPrOptionsPage implements OnInit {
}, },
"AttachmentList" :documents, "AttachmentList" :documents,
} }
const loader = this.toastService.loading()
try { try {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
this.toastService.successMessage() this.toastService.successMessage()
this.close(); this.close();
} catch (error) { } catch (error) {
this.toastService.badRequest() this.toastService.badRequest()
} finally {
loader.remove()
} }
} }
@@ -128,12 +128,16 @@ export class OptsExpedientePrPage implements OnInit {
"AttachmentList" :documents, "AttachmentList" :documents,
} }
const loader = this.toastService.loading()
try { try {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
this.close(); this.close();
this.toastService.successMessage() this.toastService.successMessage()
} catch(error) { } catch(error) {
this.toastService.badRequest() this.toastService.badRequest()
} finally {
loader.remove()
} }
} }
@@ -162,12 +166,16 @@ export class OptsExpedientePrPage implements OnInit {
} }
} }
const loader = this.toastService.loading()
try { try {
await this.processes.CompleteTask(otherbody).toPromise() await this.processes.CompleteTask(otherbody).toPromise()
this.toastService.successMessage('Processo descartado'); this.toastService.successMessage('Processo descartado');
this.goBack(); this.goBack();
} catch (error) { } catch (error) {
this.toastService.badRequest('Processo não descartado') this.toastService.badRequest('Processo não descartado')
} finally {
loader.remove()
} }
} }
@@ -177,23 +185,31 @@ export class OptsExpedientePrPage implements OnInit {
} }
else{ else{
if(res['data']== 'Yes'){ if(res['data']== 'Yes'){
const loader = this.toastService.loading()
try { try {
await this.processes.CompleteTask(body).toPromise(); await this.processes.CompleteTask(body).toPromise();
this.toastService.successMessage('Processo descartado'); this.toastService.successMessage('Processo descartado');
this.goBack(); this.goBack();
} catch (error) { } catch (error) {
this.toastService.badRequest('Processo não descartado'); this.toastService.badRequest('Processo não descartado');
} finally {
loader.remove()
} }
this.goBack(); this.goBack();
} }
else if(res['data'] == 'No'){ else if(res['data'] == 'No'){
console.log('Update'); console.log('Update');
const loader = this.toastService.loading()
try { try {
await this.processes.UpdateTaskStatus(this.task.FolderId).toPromise(); await this.processes.UpdateTaskStatus(this.task.FolderId).toPromise();
this.toastService.successMessage(); this.toastService.successMessage();
this.goBack(); this.goBack();
} catch (error) { } catch (error) {
this.toastService.badRequest(); this.toastService.badRequest();
} finally {
loader.remove()
} }
} }
} }
@@ -212,13 +228,18 @@ export class OptsExpedientePrPage implements OnInit {
"AttachmentList" :documents, "AttachmentList" :documents,
} }
const loader = this.toastService.loading()
try { try {
await this.processes.CompleteTask(body).toPromise(); await this.processes.CompleteTask(body).toPromise();
this.close(); this.close();
this.toastService.successMessage() this.toastService.successMessage()
} catch(error) { } catch(error) {
this.toastService.badRequest() this.toastService.badRequest()
} finally {
loader.remove()
} }
} }
sendExpedienteToPending(){ sendExpedienteToPending(){
@@ -187,14 +187,19 @@ export class OptsExpedientePage implements OnInit {
} }
} }
const loader = this.toastService.loading()
try { try {
await this.processes.CompleteTask(otherbody).toPromise() await this.processes.CompleteTask(otherbody).toPromise()
this.toastService.successMessage('Processo descartado'); this.toastService.successMessage('Processo descartado');
this.goBack(); this.goBack();
} catch (error) { } catch (error) {
this.toastService.badRequest('Processo não descartado') this.toastService.badRequest('Processo não descartado')
} finally {
loader.remove()
} }
} }
else if(res['data'] == 'No'){ else if(res['data'] == 'No'){
//Do nothing //Do nothing
@@ -202,23 +207,31 @@ export class OptsExpedientePage implements OnInit {
} }
else{ else{
if(res['data']== 'Yes'){ if(res['data']== 'Yes'){
const loader = this.toastService.loading()
try { try {
await this.processes.CompleteTask(body).toPromise(); await this.processes.CompleteTask(body).toPromise();
this.toastService.successMessage('Processo descartado'); this.toastService.successMessage('Processo descartado');
this.goBack(); this.goBack();
} catch (error) { } catch (error) {
this.toastService.badRequest('Processo não descartado') this.toastService.badRequest('Processo não descartado')
} finally {
loader.remove()
} }
this.goBack(); this.goBack();
} }
else if(res['data'] == 'No'){ else if(res['data'] == 'No'){
console.log('Update'); console.log('Update');
const loader = this.toastService.loading()
try { try {
await this.processes.UpdateTaskStatus(this.task.FolderId).toPromise(); await this.processes.UpdateTaskStatus(this.task.FolderId).toPromise();
this.toastService.successMessage(); this.toastService.successMessage();
this.goBack(); this.goBack();
} catch (error) { } catch (error) {
this.toastService.badRequest() this.toastService.badRequest()
} finally {
loader.remove()
} }
} }
} }
@@ -166,6 +166,8 @@ export class RequestOptionsPage implements OnInit {
"AttachmentList" :documents, "AttachmentList" :documents,
} }
const loader = this.toastService.loading()
try { try {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
this.close(); this.close();
@@ -173,6 +175,9 @@ export class RequestOptionsPage implements OnInit {
} catch (error) { } catch (error) {
this.toastService.badRequest() this.toastService.badRequest()
} }
finally {
loader.remove()
}
} }
@@ -96,6 +96,8 @@ export class EditActionPage implements OnInit {
} }
console.log(body); console.log(body);
const loader = this.toastService.loading()
try { try {
await this.publicationsService.UpdatePresidentialAction(body).toPromise() await this.publicationsService.UpdatePresidentialAction(body).toPromise()
this.close(); this.close();
@@ -103,6 +105,9 @@ export class EditActionPage implements OnInit {
this.toastService.successMessage('Acção presidencial atualizada') this.toastService.successMessage('Acção presidencial atualizada')
} catch (error) { } catch (error) {
this.toastService.badRequest('Não foi possivel atualizar a acção presidencial') this.toastService.badRequest('Não foi possivel atualizar a acção presidencial')
} } finally {
loader.remove()
}
} }
} }
@@ -110,13 +110,18 @@ export class NewActionPage implements OnInit {
} }
console.log(this.folder); console.log(this.folder);
const loader = this.toastService.loading()
try { try {
await this.publication.CreatePublicationFolder(this.folder).toPromise() await this.publication.CreatePublicationFolder(this.folder).toPromise()
this.close(); this.close();
this.toastService.successMessage('Acção presidencial criada') this.toastService.successMessage('Acção presidencial criada')
} catch (error) { } catch (error) {
this.toastService.badRequest('Não foi possivel criar a acção presidencial') this.toastService.badRequest('Não foi possivel criar a acção presidencial')
} finally {
loader.remove()
} }
} }
close(){ close(){
@@ -1,17 +1,10 @@
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'; import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
import { AlertController, AnimationController, ModalController, NavParams } from '@ionic/angular'; import { AnimationController, ModalController } from '@ionic/angular';
import { SafeResourceUrl } from '@angular/platform-browser';
/* import {Plugins, CameraResultType, CameraSource} from '@capacitor/core'; */
import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser';
import { PublicationsService } from 'src/app/services/publications.service'; import { PublicationsService } from 'src/app/services/publications.service';
import { Publication } from 'src/app/models/publication'; import { Publication } from 'src/app/models/publication';
import { Image } from 'src/app/models/image'; import { Image } from 'src/app/models/image';
import { ThrowStmt } from '@angular/compiler';
import { PhotoService } from 'src/app/services/photo.service'; import { PhotoService } from 'src/app/services/photo.service';
//Capacitor
/* const { Camera } = Plugins; */
//Cordova
import { Camera, CameraOptions } from '@ionic-native/camera/ngx'; import { Camera, CameraOptions } from '@ionic-native/camera/ngx';
import { ToastService } from 'src/app/services/toast.service'; import { ToastService } from 'src/app/services/toast.service';
import { FormControl, FormGroup, Validators } from '@angular/forms'; import { FormControl, FormGroup, Validators } from '@angular/forms';
@@ -177,6 +170,7 @@ export class NewPublicationPage implements OnInit {
} }
console.log('Edit change image'); console.log('Edit change image');
console.log(this.publication); console.log(this.publication);
const loader = this.toastService.loading()
try { try {
console.log(this.publication); console.log(this.publication);
@@ -187,6 +181,8 @@ export class NewPublicationPage implements OnInit {
this.goBack(); this.goBack();
} catch (error) { } catch (error) {
this.toastService.badRequest("Publicação não criado") this.toastService.badRequest("Publicação não criado")
} finally {
loader.remove()
} }
} }
@@ -202,6 +198,7 @@ export class NewPublicationPage implements OnInit {
FileBase64: this.publication.FileBase64, FileBase64: this.publication.FileBase64,
FileExtension: 'jpeg', FileExtension: 'jpeg',
} }
const loader = this.toastService.loading()
try { try {
console.log(this.publication); console.log(this.publication);
@@ -211,6 +208,8 @@ export class NewPublicationPage implements OnInit {
this.goBack(); this.goBack();
} catch (error) { } catch (error) {
this.toastService.badRequest("Publicação não criado") this.toastService.badRequest("Publicação não criado")
} finally {
loader.remove()
} }
} }
@@ -229,6 +228,8 @@ export class NewPublicationPage implements OnInit {
FileExtension: 'jpeg', FileExtension: 'jpeg',
} }
const loader = this.toastService.loading()
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()
@@ -237,6 +238,8 @@ export class NewPublicationPage implements OnInit {
this.goBackToViewPublications.emit(); this.goBackToViewPublications.emit();
} catch (error) { } catch (error) {
this.toastService.badRequest("Publicação não criado") this.toastService.badRequest("Publicação não criado")
} finally {
loader.remove()
} }
} }
+9
View File
@@ -1049,6 +1049,15 @@ ngx-mat-datetime-content{
background-color: #0000006b; background-color: #0000006b;
.loading-blocker-container { .loading-blocker-container {
width: 100px;
}
}
@media only screen and (min-width: 665px) {
.loading-blocker {
.loading-blocker-container {
width: 250px;
}
} }
} }