Fixe merge and improve sucess message

This commit is contained in:
Peter Maquiran
2021-05-28 15:45:41 +01:00
21 changed files with 322 additions and 87 deletions
@@ -96,7 +96,7 @@ export class DeplomaOptionsPage implements OnInit {
}
try {
await this.processes.CompleteTask(body);
await this.processes.CompleteTask(body).toPromise()
this.close();
this.successMessage()
} catch (error) {
@@ -135,7 +135,7 @@ export class DeplomaOptionsPage implements OnInit {
"AttachmentList" :documents,
}
try {
await this.processes.CompleteTask(body);
await this.processes.CompleteTask(body).toPromise()
this.close();
this.successMessage()
} catch (error) {
@@ -173,7 +173,7 @@ export class DespachosOptionsPage implements OnInit {
}
try {
await this.processes.CompleteTask(body);
await this.processes.CompleteTask(body).toPromise()
this.successMessage()
this.close();
} catch (error) {
@@ -248,7 +248,7 @@ export class DespachosOptionsPage implements OnInit {
"AttachmentList" :documents,
}
try {
await this.processes.CompleteTask(body);
await this.processes.CompleteTask(body).toPromise()
this.successMessage()
this.close();
} catch (error) {
@@ -270,7 +270,7 @@ export class DespachosOptionsPage implements OnInit {
}
try {
await this.processes.CompleteTask(body);
await this.processes.CompleteTask(body).toPromise()
this.close();
this.successMessage()
} catch(error) {
@@ -327,7 +327,7 @@ export class DespachosOptionsPage implements OnInit {
"AttachmentList" :documents,
}
try {
await this.processes.CompleteTask(body);
await this.processes.CompleteTask(body).toPromise()
this.successMessage()
this.close();
} catch (error) {
@@ -174,7 +174,7 @@ export class DespachosPrOptionsPage implements OnInit {
}
try {
await this.processes.CompleteTask(body);
await this.processes.CompleteTask(body).toPromise()
this.successMessage()
this.close();
} catch (error) {
@@ -249,7 +249,7 @@ export class DespachosPrOptionsPage implements OnInit {
"AttachmentList" :documents,
}
try {
await this.processes.CompleteTask(body);
await this.processes.CompleteTask(body).toPromise()
this.successMessage()
this.close();
} catch (error) {
@@ -271,7 +271,7 @@ export class DespachosPrOptionsPage implements OnInit {
}
try {
await this.processes.CompleteTask(body);
await this.processes.CompleteTask(body).toPromise()
this.close();
this.successMessage()
} catch(error) {
@@ -328,7 +328,7 @@ export class DespachosPrOptionsPage implements OnInit {
"AttachmentList" :documents,
}
try {
await this.processes.CompleteTask(body);
await this.processes.CompleteTask(body).toPromise()
this.successMessage()
this.close();
} catch (error) {
@@ -117,7 +117,7 @@ export class OptsExpedientePrPage implements OnInit {
}
try {
await this.processes.CompleteTask(body);
await this.processes.CompleteTask(body).toPromise()
this.close();
this.successMessage()
} catch(error) {
@@ -139,11 +139,20 @@ export class OptsExpedientePrPage implements OnInit {
});
await modal.present();
modal.onDidDismiss().then(res=>{
modal.onDidDismiss().then( async (res)=>{
console.log(res['data']);
if(res['data']== 'Yes'){
this.processes.CompleteTask(body);
this.goBack();
try {
await this.processes.CompleteTask(body).toPromise()
this.successMessage()
this.goBack();
} catch (error) {
this.badRequest()
}
}
else if(res['data'] == 'No'){
let otherbody = {
@@ -154,7 +163,15 @@ export class OptsExpedientePrPage implements OnInit {
"Note": "",
}
}
this.processes.CompleteTask(otherbody);
try {
await this.processes.CompleteTask(otherbody).toPromise()
this.successMessage()
} catch (error) {
this.badRequest()
}
}
//Volta na lista principal
this.goBack();
@@ -8,6 +8,8 @@ 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 { ExpedientTaskModalPage } from 'src/app/pages/gabinete-digital/expediente/expedient-task-modal/expedient-task-modal.page';
import { ProcessesService } from 'src/app/services/processes.service';
import { BadRequestComponent } from 'src/app/shared/popover/bad-request/bad-request.component';
import { SuccessMessageComponent } from 'src/app/shared/popover/success-message/success-message.component';
@Component({
@@ -149,7 +151,7 @@ export class RequestOptionsPage implements OnInit {
});
}
repreciar(note:string, documents:any) {
async repreciar(note:string, documents:any) {
let body = {
"serialNumber": this.serialnumber,
"action": "Reapreciação",
@@ -159,8 +161,15 @@ export class RequestOptionsPage implements OnInit {
},
"AttachmentList" :documents,
}
this.processes.CompleteTask(body);
this.close();
try {
await this.processes.CompleteTask(body).toPromise()
this.close();
this.successMessage()
} catch (error) {
this.badRequest()
}
}
async openAddNoteModal(actionName:string) {
@@ -208,7 +217,7 @@ export class RequestOptionsPage implements OnInit {
});
}
arquivar(note:string, documents:any) {
async arquivar(note:string, documents:any) {
let body = {
"serialNumber": this.serialnumber,
"action": "Arquivo",
@@ -218,8 +227,16 @@ export class RequestOptionsPage implements OnInit {
},
"AttachmentList" :documents,
}
this.processes.CompleteTask(body);
this.close();
try {
await this.processes.CompleteTask(body).toPromise()
this.close();
this.successMessage()
} catch (error) {
this.badRequest()
}
}
async openDarParecer(task: any) {
@@ -265,4 +282,40 @@ export class RequestOptionsPage implements OnInit {
modal.onDidDismiss();
}
async successMessage(message?: string) {
const modal = await this.modalController.create({
component: SuccessMessageComponent,
componentProps: {
message: message || 'Processo efetuado' ,
},
cssClass: 'modal modal-desktop'
});
modal.present()
setTimeout(()=>{
modal.dismiss()
},3000)
}
async badRequest() {
const modal = await this.modalController.create({
component: BadRequestComponent,
componentProps: {
message: 'hello',
},
cssClass: 'modal modal-desktop'
});
modal.present()
setTimeout(()=>{
modal.dismiss()
},1000)
}
}