This commit is contained in:
tiago.kayaya
2021-05-28 16:00:01 +01:00
21 changed files with 472 additions and 102 deletions
@@ -223,7 +223,7 @@ export class CreateProcessPage implements OnInit {
}
}
executado(){
async executado(){
let body = {
"serialNumber": this.task.serialNumber,
"action": "Conhecimento",
@@ -234,7 +234,14 @@ export class CreateProcessPage implements OnInit {
"AttachmentList" :null,
}
this.processes.CompleteTask(body);
try {
await this.processes.CompleteTask(body).toPromise()
this.successMessage()
} catch (error) {
this.badRequest()
}
}
async addParticipants() {
+49 -3
View File
@@ -3,6 +3,8 @@ import { ModalController, NavParams } from '@ionic/angular';
import { SearchDocument } from 'src/app/models/search-document';
import { SearchPage } from 'src/app/pages/search/search.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({
selector: 'app-dar-parecer',
@@ -34,7 +36,7 @@ export class DarParecerPage implements OnInit {
this.modalController.dismiss();
}
save() {
async save() {
const DocumentToSave = this.documents.map((e) => {
return {
@@ -58,8 +60,16 @@ export class DarParecerPage implements OnInit {
"AttachmentList": docs,
}
console.log(body);
this.processes.CompleteTask(body);
this.modalController.dismiss();
try {
await this.processes.CompleteTask(body).toPromise()
this.modalController.dismiss();
this.successMessage()
} catch (error) {
this.badRequest()
}
}
removeAttachment(index: number){
@@ -84,4 +94,40 @@ export class DarParecerPage implements OnInit {
}
});
}
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)
}
}
@@ -78,7 +78,7 @@ export class ApproveEventModalPage implements OnInit {
}
try {
await this.processes.PostTaskAction(body);
await this.processes.PostTaskAction(body).toPromise()
this.router.navigate(['/home/gabinete-digital/event-list']);
this.modalController.dismiss(null);
this.successMessage()
@@ -106,7 +106,7 @@ export class ApproveEventModalPage implements OnInit {
let body = { "serialNumber": serialNumber, "action": "Rejeitar" }
try {
await this.processes.PostTaskAction(body);
await this.processes.PostTaskAction(body).toPromise()
this.router.navigate(['/home/gabinete-digital/event-list']);
this.modalController.dismiss(null);
this.successMessage()
@@ -150,15 +150,22 @@ export class ApproveEventModalPage implements OnInit {
await modal.present();
modal.onDidDismiss().then(res => {
if(res.data !== ''){
if(res.data !== '') {
let body = { "serialNumber": serialNumber,
"action": "Emendar",
"dataFields": {
"ReviewerUseComment": res.data,
"action": "Emendar",
"dataFields": {
"ReviewerUseComment": res.data,
}
}
try {
this.processes.PostTaskAction(body).toPromise()
this.router.navigate(['/home/gabinete-digital/event-list']);
this.successMessage()
} catch (error) {
this.badRequest()
}
this.processes.PostTaskAction(body);
this.router.navigate(['/home/gabinete-digital/event-list']);
}
else{
//this.alertService.presentAlert('Operação cancelada!');
@@ -3,6 +3,8 @@ import { Router } from '@angular/router';
import { ModalController, NavParams, PopoverController } from '@ionic/angular';
import { ProcessesService } from 'src/app/services/processes.service';
import { EditEventToApproveComponent } from 'src/app/shared/gabinete-digital/edit-event-to-approve/edit-event.page';
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({
selector: 'app-event-actions-popover',
@@ -36,17 +38,34 @@ export class EventActionsPopoverPage implements OnInit {
approveTask(serialNumber:string){
let body = { "serialNumber": serialNumber, "action": "Aprovar" }
console.log(body);
this.processes.PostTaskAction(body);
this.router.navigate(['/home/gabinete-digital/event-list']);
this.modalController.dismiss(null);
try {
this.processes.PostTaskAction(body).toPromise()
this.router.navigate(['/home/gabinete-digital/event-list']);
this.modalController.dismiss(null);
this.successMessage()
} catch (error) {
this.badRequest()
}
}
emendarTask(serialNumber:string){
let body = { "serialNumber": serialNumber, "action": "Rejeitar" }
console.log(body);
this.processes.PostTaskAction(body);
this.router.navigate(['/home/gabinete-digital/event-list']);
this.modalController.dismiss(null);
try {
this.processes.PostTaskAction(body).toPromise()
this.router.navigate(['/home/gabinete-digital/event-list']);
this.modalController.dismiss(null);
this.successMessage()
} catch (error) {
this.badRequest()
}
}
deleteTask(){
@@ -72,4 +91,39 @@ export class EventActionsPopoverPage implements OnInit {
}
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(message?: string) {
const modal = await this.modalController.create({
component: BadRequestComponent,
componentProps: {
message: message || 'Processo não efetuado' ,
},
cssClass: 'modal modal-desktop'
});
modal.present()
setTimeout(()=>{
modal.dismiss()
},3000)
}
}
@@ -185,7 +185,7 @@ export class DespachoPrPage implements OnInit {
}
try {
await this.processes.CompleteTask(body);
await this.processes.CompleteTask(body).toPromise()
this.close();
this.successMessage()
} catch(error) {
@@ -204,7 +204,7 @@ export class DespachoPrPage implements OnInit {
"AttachmentList" :documents,
}
try {
await this.processes.CompleteTask(body);
await this.processes.CompleteTask(body).toPromise()
this.successMessage()
this.close();
} catch (error) {
@@ -225,7 +225,7 @@ export class DespachoPrPage implements OnInit {
}
try {
await this.processes.CompleteTask(body);
await this.processes.CompleteTask(body).toPromise()
this.successMessage()
this.close();
} catch (error) {
@@ -245,7 +245,7 @@ export class DespachoPrPage implements OnInit {
"AttachmentList" :documents,
}
try {
await this.processes.CompleteTask(body);
await this.processes.CompleteTask(body).toPromise()
this.successMessage()
this.close();
} catch (error) {
@@ -266,7 +266,7 @@ export class DespachoPrPage implements OnInit {
"AttachmentList" :documents,
}
try {
await this.processes.CompleteTask(body);
await this.processes.CompleteTask(body).toPromise()
this.successMessage()
this.close();
} catch (error) {
@@ -195,7 +195,7 @@ export class DespachoPage implements OnInit {
}
try {
await this.processes.CompleteTask(body);
await this.processes.CompleteTask(body).toPromise()
this.close();
this.successMessage()
} catch(error) {
@@ -214,7 +214,7 @@ export class DespachoPage implements OnInit {
"AttachmentList" :documents,
}
try {
await this.processes.CompleteTask(body);
await this.processes.CompleteTask(body).toPromise()
this.successMessage()
this.close();
} catch (error) {
@@ -235,9 +235,10 @@ export class DespachoPage implements OnInit {
}
try {
await this.processes.CompleteTask(body);
this.close();
await this.processes.CompleteTask(body).toPromise()
this.successMessage()
this.close();
} catch (error) {
this.badRequest()
}
@@ -142,7 +142,7 @@ export class DiplomaAssinarPage implements OnInit {
"AttachmentList": [],
}
try {
await this.processes.CompleteTask(body);
await this.processes.CompleteTask(body).toPromise()
this.goBack();
this.successMessage()
} catch (error) {
@@ -150,7 +150,7 @@ export class DiplomaPage implements OnInit {
"AttachmentList" :documents,
}
try {
await this.processes.CompleteTask(body);
await this.processes.CompleteTask(body).toPromise()
this.close();
this.successMessage()
} catch (error) {
@@ -170,7 +170,7 @@ export class DiplomaPage implements OnInit {
}
try {
await this.processes.CompleteTask(body);
await this.processes.CompleteTask(body).toPromise()
this.close();
this.successMessage()
} catch (error) {
@@ -93,13 +93,20 @@ export class ApproveEventModalPage implements OnInit {
});
}
approveTask(serialNumber:string){
async approveTask(serialNumber:string){
console.log('approveTask SERIALNUMBER: ', serialNumber)
let body = { "serialNumber": serialNumber, "action": "Aprovar" }
console.log(body);
this.processes.PostTaskAction(body);
this.router.navigate(['/home/gabinete-digital/event-list']);
this.modalController.dismiss(null);
try {
await this.processes.PostTaskAction(body).toPromise()
this.router.navigate(['/home/gabinete-digital/event-list']);
this.modalController.dismiss(null);
this.successMessage()
} catch (error) {
this.badRequest()
}
}
emendTask(serialNumber:string){
@@ -116,7 +123,7 @@ export class ApproveEventModalPage implements OnInit {
// console.log(body);
try {
await this.processes.PostTaskAction(body);
await this.processes.PostTaskAction(body).toPromise()
this.router.navigate(['/home/gabinete-digital/event-list']);
this.successMessage()
@@ -171,7 +178,7 @@ export class ApproveEventModalPage implements OnInit {
//console.log(body);
try {
await this.processes.PostTaskAction(body);
await this.processes.PostTaskAction(body).toPromise()
this.router.navigate(['/home/gabinete-digital/event-list']);
this.successMessage()
} catch (error) {
@@ -9,6 +9,8 @@ import { EmendMessageModalPage } from 'src/app/pages/agenda/emend-message-modal/
import { EventActionsPopoverPage } from 'src/app/pages/agenda/event-actions-popover/event-actions-popover.page';
import { InAppBrowser } from '@ionic-native/in-app-browser/ngx';
import { EditEventToApproveComponent } from 'src/app/shared/gabinete-digital/edit-event-to-approve/edit-event.page';
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({
selector: 'app-approve-event',
@@ -57,23 +59,23 @@ export class ApproveEventPage implements OnInit {
this.getTask();
}
notImplemented(){
notImplemented() {
this.alertService.presentAlert('Funcionalidade em desenvolvimento');
}
close(){
close() {
/* this.router.navigate(['/home/gabinete-digital/event-list']); */
this.closeEventToApprove.emit();
this.modalController.dismiss();
}
goBack(){
goBack() {
let navigationExtras: NavigationExtras = {
queryParams: {
"eventos": true,
"eventos": true,
}
};
if( window.innerWidth < 801){
if( window.innerWidth < 801) {
this.router.navigate(['/home/gabinete-digital/event-list']);
} else {
this.router.navigate(['/home/gabinete-digital'], navigationExtras);
@@ -90,11 +92,28 @@ export class ApproveEventPage implements OnInit {
this.getAttachments(instanceId);
}
approveTask(serialNumber:string){
async approveTask(serialNumber:string){
let body = { "serialNumber": serialNumber, "action": "Aprovar" }
console.log(body);
this.processes.PostTaskAction(body);
this.goBack();
try {
await this.processes.PostTaskAction(body).toPromise()
this.successMessage()
this.goBack();
} catch (error) {
this.badRequest()
}
/* this.approveEventDismiss.emit({
"serialNumber": serialNumber,
"action": "Aprovar",
"saveData": {
loadedEvent: this.loadedEvent,
today: this.today,
customDate: this.customDate
}
}); */
}
emendTask(serialNumber:string){
@@ -104,12 +123,19 @@ export class ApproveEventPage implements OnInit {
this.goBack();
}
rejectTask(serialNumber:string){
async rejectTask(serialNumber:string){
let body = { "serialNumber": serialNumber, "action": "Rejeitar" }
console.log(body);
this.processes.PostTaskAction(body);
this.goBack();
try {
this.processes.PostTaskAction(body).toPromise()
this.goBack();
await this.successMessage()
} catch (error) {
this.badRequest()
}
}
async getAttachments(instanceId:string){
@@ -154,7 +180,7 @@ export class ApproveEventPage implements OnInit {
await modal.present();
modal.onDidDismiss().then(res => {
modal.onDidDismiss().then( async (res) => {
console.log(res.data);
if(res.data !== ''){
@@ -165,9 +191,17 @@ export class ApproveEventPage implements OnInit {
}
}
console.log(body);
this.processes.PostTaskAction(body);
//this.router.navigate(['/home/gabinete-digital/event-list']);
this.goToEventsToApprove();
try {
await this.processes.PostTaskAction(body).toPromise()
//this.router.navigate(['/home/gabinete-digital/event-list']);
this.goToEventsToApprove();
this.successMessage()
} catch (error) {
this.badRequest()
}
}
else{
//this.alertService.presentAlert('Operação cancelada!');
@@ -206,4 +240,40 @@ export class ApproveEventPage implements OnInit {
}
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(message?: string) {
const modal = await this.modalController.create({
component: BadRequestComponent,
componentProps: {
message: message || 'Processo não efetuado' ,
},
cssClass: 'modal modal-desktop'
});
modal.present()
setTimeout(()=>{
modal.dismiss()
},3000)
}
}
@@ -225,7 +225,7 @@ export class ExpedienteDetailPage implements OnInit {
});
await modal.present();
modal.onDidDismiss().then(res=>{
modal.onDidDismiss().then( async (res)=>{
console.log(res['data']);
console.log(body);
@@ -239,7 +239,14 @@ export class ExpedienteDetailPage implements OnInit {
"Note": "",
}
}
this.processes.CompleteTask(otherbody);
try {
await this.processes.CompleteTask(otherbody).toPromise()
this.successMessage()
} catch (error) {
this.badRequest()
}
}
else if(res['data'] == 'No'){
//Do nothing
@@ -247,14 +254,26 @@ export class ExpedienteDetailPage implements OnInit {
}
else{
if(res['data']== 'Yes'){
this.processes.CompleteTask(body);
try {
await this.processes.CompleteTask(body).toPromise()
this.successMessage()
} catch (error) {
this.badRequest()
}
this.goBack();
}
else if(res['data'] == 'No'){
console.log('Update');
this.processes.UpdateTaskStatus(this.task.FolderId);
try {
await this.processes.UpdateTaskStatus(this.task.FolderId);
this.successMessage()
} catch (error) {
this.badRequest()
}
}
}
});
@@ -197,7 +197,7 @@ export class ExpedientePrPage implements OnInit {
}
try {
await this.processes.CompleteTask(body);
await this.processes.CompleteTask(body).toPromise()
this.close();
this.successMessage()
} catch(error) {
@@ -217,7 +217,7 @@ export class ExpedientePrPage implements OnInit {
}
try {
await this.processes.CompleteTask(body);
await this.processes.CompleteTask(body).toPromise()
this.close();
this.successMessage()
} catch(error) {
@@ -311,7 +311,7 @@ export class ExpedientePrPage implements OnInit {
});
await modal.present();
modal.onDidDismiss().then(res=>{
modal.onDidDismiss().then( async (res)=>{
console.log(res['data']);
console.log(body);
@@ -325,7 +325,15 @@ export class ExpedientePrPage implements OnInit {
"Note": "",
}
}
this.processes.CompleteTask(otherbody);
try {
await this.processes.CompleteTask(otherbody).toPromise()
this.successMessage()
} catch (error) {
this.badRequest()
}
}
else if(res['data'] == 'No'){
//Do nothing
@@ -333,14 +341,30 @@ export class ExpedientePrPage implements OnInit {
}
else{
if(res['data']== 'Yes'){
this.processes.CompleteTask(body);
try {
await this.processes.CompleteTask(body).toPromise()
this.successMessage()
this.goBack();
} catch (error) {
this.badRequest()
}
this.goBack();
}
else if(res['data'] == 'No'){
console.log('Update');
this.processes.UpdateTaskStatus(this.task.FolderId);
try {
await this.processes.UpdateTaskStatus(this.task.FolderId);
this.successMessage()
} catch (error) {
this.badRequest()
}
}
}
});
@@ -22,6 +22,8 @@ import { OptsExpedientePage } from 'src/app/shared/popover/opts-expediente/opts-
import { RequestOptionsPage } from 'src/app/shared/popover/request-options/request-options.page';
import { AuthService } from 'src/app/services/auth.service';
import { User } from 'src/app/models/user.model';
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({
selector: 'app-pedido',
@@ -188,7 +190,7 @@ export class PedidoPage implements OnInit {
}
repreciar(note:string, documents:any) {
async repreciar(note:string, documents:any) {
let body = {
"serialNumber": this.serialnumber,
"action": "Reapreciação",
@@ -198,11 +200,19 @@ export class PedidoPage implements OnInit {
},
"AttachmentList" :documents,
}
this.processes.CompleteTask(body);
this.close();
try {
await this.processes.CompleteTask(body).toPromise()
this.successMessage()
this.close();
} catch (error) {
this.badRequest()
}
}
arquivar(note:string, documents:any) {
async arquivar(note:string, documents:any) {
let body = {
"serialNumber": this.serialnumber,
"action": "Arquivo",
@@ -212,8 +222,17 @@ export class PedidoPage implements OnInit {
},
"AttachmentList" :documents,
}
this.processes.CompleteTask(body);
this.close();
try {
await this.processes.CompleteTask(body).toPromise()
this.successMessage()
this.close();
} catch (error) {
this.badRequest()
}
}
sendExpedienteToPending(){
@@ -402,4 +421,41 @@ export class PedidoPage implements OnInit {
}
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)
}
}
+2 -2
View File
@@ -137,7 +137,7 @@ export class ProcessesService {
let options = {
headers: this.headers,
};
return this.http.post<any>(`${geturl}`, body, options).toPromise()
return this.http.post<any>(`${geturl}`, body, options)
}
CompleteTask(body:any){
const geturl = environment.apiURL + 'Tasks/CompleteTask';
@@ -145,7 +145,7 @@ export class ProcessesService {
let options = {
headers: this.headers,
};
return this.http.post<any>(`${geturl}`, body, options).toPromise()
return this.http.post<any>(`${geturl}`, body, options)
}
UpdateTaskStatus(FolderId:string): Observable<any>{
@@ -84,7 +84,7 @@ export class ApproveEventComponent implements OnInit {
console.log(body);
try {
this.processes.PostTaskAction(body);
await this.processes.PostTaskAction(body).toPromise()
this.modalController.dismiss(serialNumber);
this.successMessage()
} catch (error) {
@@ -115,13 +115,13 @@ export class ApproveEventComponent implements OnInit {
}
async rejectTask(serialNumber:string){
async rejectTask(serialNumber:string) {
let body = { "serialNumber": serialNumber, "action": "Rejeitar" }
console.log(body);
try {
await this.processes.PostTaskAction(body);
await this.processes.PostTaskAction(body).toPromise()
this.router.navigate(['/home/gabinete-digital/event-list']);
this.modalController.dismiss(null);
this.successMessage()
@@ -167,11 +167,11 @@ export class ApproveEventComponent implements OnInit {
},
cssClass: 'emend-message-modal',
backdropDismiss: false
});
});-
await modal.present();
modal.onDidDismiss().then(res => {
modal.onDidDismiss().then( async (res) => {
console.log(res.data);
if(res.data !== ''){
@@ -182,9 +182,18 @@ export class ApproveEventComponent implements OnInit {
}
}
console.log(body);
this.processes.PostTaskAction(body);
//this.router.navigate(['/home/gabinete-digital/event-list']);
this.goToEventsToApprove();
try {
await this.processes.PostTaskAction(body).toPromise()
//this.router.navigate(['/home/gabinete-digital/event-list']);
this.goToEventsToApprove();
this.successMessage()
} catch (error) {
this.badRequest()
}
}
else{
//this.alertService.presentAlert('Operação cancelada!');
@@ -169,7 +169,7 @@ export class NewEventPage implements OnInit {
if(this.profile=='mdgpr') {
this.eventService.postEventMd(this.postEvent, this.postEvent.CalendarName).subscribe(
(id) => {
async (id) => {
const eventId: string = id;
@@ -186,7 +186,7 @@ export class NewEventPage implements OnInit {
};
});
DocumentToSave.forEach((attachments, i) => {
await DocumentToSave.forEach((attachments, i) => {
this.attachmentsService.setEventAttachmentById(attachments).subscribe((res) =>{
if(DocumentToSave.length == (i+1)){
@@ -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)
}
}