2021-08-05 16:08:49 +01:00
|
|
|
import { Injectable } from '@angular/core';
|
|
|
|
|
import { ProcessesService } from '../services/processes.service';
|
2022-03-28 15:46:07 +01:00
|
|
|
import { PermissionService } from '../services/permission.service';
|
2021-08-05 16:08:49 +01:00
|
|
|
|
|
|
|
|
@Injectable({
|
|
|
|
|
providedIn: 'root'
|
|
|
|
|
})
|
|
|
|
|
export class PedidoService {
|
|
|
|
|
|
|
|
|
|
constructor(
|
|
|
|
|
private processes: ProcessesService,
|
|
|
|
|
public p: PermissionService
|
|
|
|
|
) { }
|
|
|
|
|
|
|
|
|
|
createParecer(body: any) {
|
|
|
|
|
if(this.p.userRole(['PR'])) {
|
|
|
|
|
return this.processes.postParecerPr(body)
|
|
|
|
|
} else {
|
|
|
|
|
return this.processes.postParecer(body)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
createDeferimento(body: any) {
|
|
|
|
|
|
2022-03-28 15:46:07 +01:00
|
|
|
if(this.p.userRole(['PR'])) {
|
2021-08-05 16:08:49 +01:00
|
|
|
throw('PR cant create Deferimento')
|
|
|
|
|
}
|
2022-03-28 15:46:07 +01:00
|
|
|
|
2021-08-05 16:08:49 +01:00
|
|
|
return this.processes.postDeferimento(body)
|
|
|
|
|
}
|
|
|
|
|
|
2022-06-03 16:53:50 +01:00
|
|
|
taskCompleteParecer({serialNumber, note}) {
|
2021-08-05 16:08:49 +01:00
|
|
|
const body = {
|
|
|
|
|
"serialNumber": serialNumber,
|
|
|
|
|
"action": "Parecer",
|
|
|
|
|
"ActionTypeId": 92, // Pedido de parece
|
|
|
|
|
"dataFields": {
|
2022-06-03 16:53:50 +01:00
|
|
|
"ReviewUserComment": note,
|
2021-08-05 16:08:49 +01:00
|
|
|
},
|
|
|
|
|
"AttachmentList" :null,
|
|
|
|
|
}
|
|
|
|
|
return this.processes.CompleteTask(body)
|
|
|
|
|
}
|
|
|
|
|
|
2022-06-24 16:57:35 +01:00
|
|
|
taskCompleteDeferimento({serialNumber, note}) {
|
2021-08-05 16:08:49 +01:00
|
|
|
|
|
|
|
|
const body = {
|
|
|
|
|
"serialNumber": serialNumber,
|
2021-08-16 16:46:57 +01:00
|
|
|
"action": "Deferimento",
|
2021-08-05 16:08:49 +01:00
|
|
|
"ActionTypeId": 93, // Pedido de deferimento
|
|
|
|
|
"dataFields": {
|
2022-06-24 16:57:35 +01:00
|
|
|
"ReviewUserComment": note,
|
2021-08-05 16:08:49 +01:00
|
|
|
},
|
|
|
|
|
"AttachmentList" :null,
|
|
|
|
|
}
|
|
|
|
|
return this.processes.CompleteTask(body)
|
|
|
|
|
}
|
|
|
|
|
|
2021-08-20 15:43:37 +01:00
|
|
|
arquivar({note = "", serialNumber, documents= [] }) {
|
2022-03-28 15:46:07 +01:00
|
|
|
let body = {
|
|
|
|
|
"serialNumber": serialNumber,
|
2021-08-20 15:43:37 +01:00
|
|
|
"action": "Arquivo",
|
|
|
|
|
"ActionTypeId": 95,
|
|
|
|
|
"dataFields": {
|
|
|
|
|
"ReviewUserComment": note,
|
|
|
|
|
},
|
|
|
|
|
"AttachmentList" :documents,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return this.processes.CompleteTask(body)
|
|
|
|
|
}
|
2021-08-05 16:08:49 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|