This commit is contained in:
tiago.kayaya
2021-05-26 09:13:52 +01:00
parent 3aaa268eea
commit 8dcd8aae64
@@ -174,149 +174,161 @@ export class ExpedientTaskModalPage implements OnInit {
SourceId: e.Id SourceId: e.Id
} }
}); });
docs.Attachments = DocumentToSave; docs.Attachments = DocumentToSave;
this.dispatchFolder.SubjectTypes = this.selectedTypes; this.dispatchFolder.SubjectTypes = this.selectedTypes;
if(this.taskParticipants.length > 0) { if(this.taskParticipants.length > 0) {
switch (this.taskType) { switch (this.loggeduser.Profile) {
case '0': case 'MDGPR':
this.postData = { switch (this.taskType) {
DistributionType: "Paralelo", case '0':
CountryCode: 'AO', this.postData = {
Priority: this.postData.Priority, DistributionType: "Paralelo",
UserEmail: this.user, CountryCode: 'AO',
UsersSelected: attendees, Priority: this.postData.Priority,
DispatchFolder: this.dispatchFolder, UserEmail: this.user,
AttachmentList: docs, UsersSelected: attendees,
//SubjectTypes: [], DispatchFolder: this.dispatchFolder,
AttachmentList: docs,
} //SubjectTypes: [],
}
// console.log('this.postData', this.postData, this.taskType); try {
try {
switch(this.loggeduser.Profile){
case 'MDGPR':
this.taskResult = await this.processes.postDespatcho(this.postData).toPromise(); this.taskResult = await this.processes.postDespatcho(this.postData).toPromise();
let action_despacho = { await this.successMessage('Processo efetuado')
"serialNumber": this.task.serialNumber, } catch (error) {
"action": "Tratado", await this.badRequest('Processo não efetuado')
"ActionTypeId": 94, }
"dataFields": { console.log('this.taskResult', this.taskResult);
"Note": "", let action_despacho = {
} "serialNumber": this.task.serialNumber,
"action": "Tratado",
"ActionTypeId": 94,
"dataFields": {
"Note": "",
} }
}
this.modalController.dismiss(action_despacho); this.modalController.dismiss(action_despacho);
break; break;
case 'PR':
let action_despacho_pr = { case '1':
"serialNumber": this.task.serialNumber, this.postData = {
"action": "Tratado", DistributionType: "Paralelo",
"ActionTypeId": 99999881 , CountryCode: 'AO',
"dataFields": { Priority: this.postData.Priority,
"Note": "", UserEmail: this.user,
} UsersSelected: attendees,
DispatchFolder: this.dispatchFolder,
AttachmentList: docs
}
try {
await this.successMessage('Processo efetuado')
} catch (error) {
await this.badRequest('Processo não efetuado')
}
let action_parecer = {
"serialNumber": this.task.serialNumber,
"action": "Tratado",
"ActionTypeId": 92,
"dataFields": {
"Note": "",
} }
}
this.modalController.dismiss(action_despacho_pr); this.modalController.dismiss(action_parecer);
break;
case '2':
this.postData = {
DistributionType: "Paralelo",
CountryCode: 'AO',
Priority: this.postData.Priority,
UserEmail: this.user,
UsersSelected: attendees,
DispatchFolder: this.dispatchFolder,
AttachmentList: docs
}
//console.log(this.postData);
try {
this.taskResult = await this.processes.postDeferimento(this.postData).toPromise()
await this.successMessage('Processo efetuado')
} catch (error) {
await this.badRequest('Processo não efetuado')
}
console.log('this.taskResult', this.taskResult);
let action_deferimento = {
"serialNumber": this.task.serialNumber,
"action": "Tratado",
"ActionTypeId": 93,
"dataFields": {
"Note": "",
}
}
this.modalController.dismiss(action_deferimento);
break;
}
break;
case 'PR':
switch (this.taskType) {
case '0':
this.postData = {
DistributionType: "Paralelo",
CountryCode: 'AO',
Priority: this.postData.Priority,
UserEmail: this.user,
UsersSelected: attendees,
DispatchFolder: this.dispatchFolder,
AttachmentList: docs,
//SubjectTypes: [],
}
try {
this.taskResult = await this.processes.postDespatchoPr(this.postData).toPromise(); this.taskResult = await this.processes.postDespatchoPr(this.postData).toPromise();
break; await this.successMessage('Processo efetuado')
} catch (error) {
await this.badRequest('Processo não efetuado')
}
console.log('this.taskResult', this.taskResult);
let action_despacho_pr = {
"serialNumber": this.task.serialNumber,
"action": "Tratado",
"ActionTypeId": 99999881 ,
"dataFields": {
"Note": "",
}
}
this.modalController.dismiss(action_despacho_pr);
break;
case '1':
this.postData = {
DistributionType: "Paralelo",
CountryCode: 'AO',
Priority: this.postData.Priority,
UserEmail: this.user,
UsersSelected: attendees,
DispatchFolder: this.dispatchFolder,
AttachmentList: docs
}
try {
await this.successMessage('Processo efetuado')
} catch (error) {
await this.badRequest('Processo não efetuado')
}
let action_parecer_pr = {
"serialNumber": this.task.serialNumber,
"action": "Tratado",
"ActionTypeId": 99999881,
"dataFields": {
"Note": "",
}
}
this.modalController.dismiss(action_parecer_pr);
break;
} }
await this.successMessage('Processo efetuado')
} catch (error) {
await this.badRequest('Processo não efetuado')
}
console.log('this.taskResult', this.taskResult);
/* let action_despacho = {
"serialNumber": this.task.serialNumber,
"action": "Tratado",
"ActionTypeId": 94,
"dataFields": {
"Note": "",
}
}
this.modalController.dismiss(action_despacho); */
break; break;
case '1':
this.postData = {
DistributionType: "Paralelo",
CountryCode: 'AO',
Priority: this.postData.Priority,
UserEmail: this.user,
UsersSelected: attendees,
DispatchFolder: this.dispatchFolder,
AttachmentList: docs
}
//console.log(this.postData);
try { default:
switch(this.loggeduser.Profile){
case 'MDGPR':
this.taskResult = await this.processes.postParecer(this.postData).toPromise();
break;
case 'PR':
this.taskResult = await this.processes.postParecerPr(this.postData).toPromise();
break;
}
await this.successMessage('Processo efetuado')
} catch (error) {
await this.badRequest('Processo não efetuado')
}
// console.log('this.taskResult', this.taskResult);
let action_parecer = {
"serialNumber": this.task.serialNumber,
"action": "Tratado",
"ActionTypeId": 92,
"dataFields": {
"Note": "",
}
}
this.modalController.dismiss(action_parecer);
break;
case '2':
this.postData = {
DistributionType: "Paralelo",
CountryCode: 'AO',
Priority: this.postData.Priority,
UserEmail: this.user,
UsersSelected: attendees,
DispatchFolder: this.dispatchFolder,
AttachmentList: docs
}
//console.log(this.postData);
try {
this.taskResult = await this.processes.postDeferimento(this.postData).toPromise()
await this.successMessage('Processo efetuado')
} catch (error) {
await this.badRequest('Processo não efetuado')
}
console.log('this.taskResult', this.taskResult);
let action_deferimento = {
"serialNumber": this.task.serialNumber,
"action": "Tratado",
"ActionTypeId": 93,
"dataFields": {
"Note": "",
}
}
this.modalController.dismiss(action_deferimento);
break; break;
} }
} }