This commit is contained in:
tiago.kayaya
2021-07-28 16:27:48 +01:00
19 changed files with 352 additions and 173 deletions
@@ -15,6 +15,9 @@ import { DelegarPage } from 'src/app/modals/delegar/delegar.page';
import { AddNotePage } from 'src/app/modals/add-note/add-note.page';
import { DespachosOptionsPage } from 'src/app/shared/popover/despachos-options/despachos-options.page';
import { ToastService } from 'src/app/services/toast.service';
import { DespachoMdService } from 'src/app/Rules/despacho-md.service'
import { NavigationService } from 'src/app/services/navigation.service';
import { Location } from '@angular/common'
@Component({
selector: 'app-despacho',
@@ -50,6 +53,10 @@ export class DespachoPage implements OnInit {
private router: Router,
private animationController: AnimationController,
private toastService: ToastService,
private despachoMdService: DespachoMdService,
private navigationService: NavigationService,
private location: Location
) {
this.activatedRoute.paramMap.subscribe(params => {
if(params["params"].SerialNumber) {
@@ -80,31 +87,35 @@ export class DespachoPage implements OnInit {
}
goBack() {
if(this.task.Status == "Pending" && this.caller == 'gabinete-digital'){
if (window.innerWidth < 801) {
this.router.navigate(['/home/gabinete-digital/pendentes']);
}
else {
let navigationExtras: NavigationExtras = {
queryParams: {
"pendentes": true,
}
}
this.router.navigate(['/home/gabinete-digital'], navigationExtras);
}
}
else{
if (window.innerWidth < 801) {
this.router.navigate(['/home/gabinete-digital/despachos']);
} else {
let navigationExtras: NavigationExtras = {
queryParams: {
'despachos': true
}
}
this.router.navigate(['/home/gabinete-digital'], navigationExtras);
}
}
//this.navigationService.back()
this.location.back();
// if(this.task.Status == "Pending" && this.caller == 'gabinete-digital'){
// if (window.innerWidth < 801) {
// this.router.navigate(['/home/gabinete-digital/pendentes']);
// }
// else {
// let navigationExtras: NavigationExtras = {
// queryParams: {
// "pendentes": true,
// }
// }
// this.router.navigate(['/home/gabinete-digital'], navigationExtras);
// }
// }
// else{
// if (window.innerWidth < 801) {
// this.router.navigate(['/home/gabinete-digital/despachos']);
// } else {
// let navigationExtras: NavigationExtras = {
// queryParams: {
// 'despachos': true
// }
// }
// this.router.navigate(['/home/gabinete-digital'], navigationExtras);
// }
// }
}
async LoadTaskDetail(serial: string) {
@@ -188,21 +199,12 @@ export class DespachoPage implements OnInit {
this.modalController.dismiss();
}
async executado(note:string, documents:any){
let body = {
"serialNumber": this.serialnumber,
"action": "Conhecimento",
"ActionTypeId": 104,
"dataFields": {
"ReviewUserComment": note,
},
"AttachmentList" :documents,
}
async executado(note:string, documents:any) {
const loader = this.toastService.loading()
try {
await this.processes.CompleteTask(body).toPromise()
await this.despachoMdService.executado(note, documents, this.serialnumber)
this.toastService.successMessage('Processo criado')
this.close();
} catch(error) {
@@ -213,7 +215,7 @@ export class DespachoPage implements OnInit {
}
}
async arquivar(note:string, documents:any){
async arquivar(note:string, documents:any) {
let body = {
"serialNumber": this.serialnumber,
"action": "Arquivo",
@@ -236,6 +238,7 @@ export class DespachoPage implements OnInit {
loader.remove()
}
}
async reencaminhar(note:string, documents:any) {
@@ -296,13 +299,15 @@ export class DespachoPage implements OnInit {
}
async sendExpedienteToPending() {
this.processes.SetTaskToPending(this.serialnumber).subscribe(res=>{
this.despachoMdService.sendExpedienteToPending(this.serialnumber).subscribe(res=>{
this.goBack();
this.toastService.successMessage('Processo enviado para despacho')
},
error => {
this.toastService.badRequest("Processo não enviado para despacho")
});
}
async openAddNoteModal(actionName:string) {
@@ -270,7 +270,7 @@ export class ExpedienteDetailPage implements OnInit {
const loader = this.toastService.loading()
try {
await this.processes.CompleteTask(otherbody).toPromise()
await this.processes.CompleteTask(otherbody)
this.toastService.successMessage('Processo descartado');
this.goBack();
} catch (error) {