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
}
});
docs.Attachments = DocumentToSave;
this.dispatchFolder.SubjectTypes = this.selectedTypes;
if(this.taskParticipants.length > 0) {
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: [],
}
// console.log('this.postData', this.postData, this.taskType);
try {
switch(this.loggeduser.Profile){
case 'MDGPR':
switch (this.loggeduser.Profile) {
case 'MDGPR':
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.postDespatcho(this.postData).toPromise();
let action_despacho = {
"serialNumber": this.task.serialNumber,
"action": "Tratado",
"ActionTypeId": 94,
"dataFields": {
"Note": "",
}
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;
case 'PR':
let action_despacho_pr = {
"serialNumber": this.task.serialNumber,
"action": "Tratado",
"ActionTypeId": 99999881 ,
"dataFields": {
"Note": "",
}
}
this.modalController.dismiss(action_despacho);
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 = {
"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();
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;
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 {
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);
default:
break;
}
}