mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-21 05:45:50 +00:00
Add loader and notification message
This commit is contained in:
@@ -58,7 +58,7 @@
|
||||
<ion-icon class="right-icons" src="assets/images/icons-received-event.svg"></ion-icon>
|
||||
</button>
|
||||
|
||||
<button class="btn-no-color" (click)="clearContact();openAddEvent();">
|
||||
<button class="btn-no-color cy-add-event" (click)="clearContact();openAddEvent();">
|
||||
<ion-icon class="right-icons" src="assets/images/icons-add-new-event.svg" ></ion-icon>
|
||||
</button>
|
||||
|
||||
|
||||
+127
-144
@@ -255,120 +255,11 @@ export class ExpedientTaskModalPage implements OnInit {
|
||||
|
||||
|
||||
this.dispatchFolder.SubjectTypes = this.selectedTypes;
|
||||
|
||||
switch (this.loggeduser.Profile) {
|
||||
case 'MDGPR':
|
||||
if(this.taskParticipants.length > 0) {
|
||||
switch (this.taskType) {
|
||||
case '0':
|
||||
this.postData = {
|
||||
DistributionType: "Paralelo",
|
||||
CountryCode: 'AO',
|
||||
Priority: this.postData.Priority,
|
||||
UserEmail: this.loggeduser.Email,
|
||||
UsersSelected: attendees,
|
||||
DispatchFolder: this.dispatchFolder,
|
||||
AttachmentList: docs,
|
||||
}
|
||||
const loader = this.toastService.loading()
|
||||
|
||||
const loader = this.toastService.loading()
|
||||
try {
|
||||
let action_despacho = {
|
||||
"serialNumber": this.task.serialNumber,
|
||||
"action": "Tratado",
|
||||
"ActionTypeId": 94,
|
||||
"dataFields": {
|
||||
"Note": "",
|
||||
}
|
||||
}
|
||||
console.log(this.postData);
|
||||
|
||||
this.taskResult = await this.processes.postDespatcho(this.postData).toPromise();
|
||||
|
||||
loader.remove()
|
||||
await this.toastService.successMessage('Processo efetuado');
|
||||
this.modalController.dismiss();
|
||||
|
||||
} catch (error) {
|
||||
loader.remove()
|
||||
await this.toastService.badRequest('Processo não efetuado')
|
||||
} finally {
|
||||
loader.remove()
|
||||
}
|
||||
console.log('this.taskResult', this.taskResult);
|
||||
break;
|
||||
|
||||
case '1':
|
||||
this.postData = {
|
||||
DistributionType: "Paralelo",
|
||||
CountryCode: 'AO',
|
||||
Priority: this.postData.Priority,
|
||||
UserEmail: this.loggeduser.Email,
|
||||
UsersSelected: attendees,
|
||||
DispatchFolder: this.dispatchFolder,
|
||||
AttachmentList: docs
|
||||
}
|
||||
|
||||
try {
|
||||
let action_parecer = {
|
||||
"serialNumber": this.task.serialNumber,
|
||||
"action": "Tratado",
|
||||
"ActionTypeId": 92,
|
||||
"dataFields": {
|
||||
"Note": "",
|
||||
}
|
||||
}
|
||||
this.taskResult = await this.processes.postParecer(this.postData).toPromise();
|
||||
loader.remove()
|
||||
await this.toastService.successMessage('Pedido enviado');
|
||||
this.modalController.dismiss(action_parecer);
|
||||
|
||||
} catch (error) {
|
||||
loader.remove()
|
||||
await this.toastService.badRequest('Processo não efetuado')
|
||||
}
|
||||
break;
|
||||
case '2':
|
||||
this.postData = {
|
||||
DistributionType: "Paralelo",
|
||||
CountryCode: 'AO',
|
||||
Priority: this.postData.Priority,
|
||||
UserEmail: this.loggeduser.Email,
|
||||
UsersSelected: attendees,
|
||||
DispatchFolder: this.dispatchFolder,
|
||||
AttachmentList: docs
|
||||
}
|
||||
//console.log(this.postData);
|
||||
const loader1 = this.toastService.loading()
|
||||
|
||||
try {
|
||||
let action_deferimento = {
|
||||
"serialNumber": this.task.serialNumber,
|
||||
"action": "Tratado",
|
||||
"ActionTypeId": 93,
|
||||
"dataFields": {
|
||||
"Note": "",
|
||||
}
|
||||
}
|
||||
this.taskResult = await this.processes.postDeferimento(this.postData).toPromise();
|
||||
await this.toastService.successMessage('Processo efetuado');
|
||||
this.modalController.dismiss(action_deferimento);
|
||||
} catch (error) {
|
||||
|
||||
await this.toastService.badRequest('Processo não efetuado')
|
||||
} finally {
|
||||
loader1.remove()
|
||||
}
|
||||
|
||||
console.log('this.taskResult', this.taskResult);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.alertController.presentAlert("Lista de i-ntervenientes vazia. Por favor, adicione 1 ou mais intervenientes.");
|
||||
}
|
||||
break;
|
||||
case 'PR':
|
||||
switch (this.loggeduser.Profile) {
|
||||
case 'MDGPR':
|
||||
if(this.taskParticipants.length > 0) {
|
||||
switch (this.taskType) {
|
||||
case '0':
|
||||
this.postData = {
|
||||
@@ -380,27 +271,16 @@ export class ExpedientTaskModalPage implements OnInit {
|
||||
DispatchFolder: this.dispatchFolder,
|
||||
AttachmentList: docs,
|
||||
}
|
||||
|
||||
console.log(this.postData);
|
||||
const loader = this.toastService.loading()
|
||||
|
||||
try {
|
||||
let action_despacho_pr = {
|
||||
"serialNumber": this.task.serialNumber,
|
||||
"action": "Tratado",
|
||||
"ActionTypeId": 99999881 ,
|
||||
"dataFields": {
|
||||
"Note": "",
|
||||
}
|
||||
}
|
||||
|
||||
loader.remove()
|
||||
this.taskResult = await this.processes.postDespatchoPr(this.postData).toPromise();
|
||||
|
||||
this.taskResult = await this.processes.postDespatcho(this.postData).toPromise();
|
||||
await this.toastService.successMessage('Processo efetuado');
|
||||
this.modalController.dismiss(action_despacho_pr);
|
||||
|
||||
this.modalController.dismiss();
|
||||
|
||||
} catch (error) {
|
||||
loader.remove()
|
||||
await this.toastService.badRequest('Processo não efetuado')
|
||||
} finally {
|
||||
loader.remove()
|
||||
@@ -420,33 +300,136 @@ export class ExpedientTaskModalPage implements OnInit {
|
||||
AttachmentList: docs
|
||||
}
|
||||
|
||||
const loader2 = this.toastService.loading()
|
||||
let action_parecer = {
|
||||
"serialNumber": this.task.serialNumber,
|
||||
"action": "Tratado",
|
||||
"ActionTypeId": 92,
|
||||
"dataFields": {
|
||||
"Note": "",
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
let action_parecer_pr = {
|
||||
"serialNumber": this.task.serialNumber,
|
||||
"action": "Tratado",
|
||||
"ActionTypeId": 99999881,
|
||||
"dataFields": {
|
||||
"Note": "",
|
||||
}
|
||||
}
|
||||
|
||||
this.taskResult = await this.processes.postParecerPr(this.postData).toPromise();
|
||||
this.taskResult = await this.processes.postParecer(this.postData).toPromise();
|
||||
await this.toastService.successMessage('Pedido enviado');
|
||||
this.modalController.dismiss(action_parecer);
|
||||
|
||||
await this.toastService.badRequest('Processo não efetuado');
|
||||
this.modalController.dismiss(action_parecer_pr);
|
||||
|
||||
} catch (error) {
|
||||
|
||||
await this.toastService.badRequest('Processo não efetuado')
|
||||
} finally {
|
||||
loader2.remove()
|
||||
loader.remove()
|
||||
}
|
||||
break;
|
||||
case '2':
|
||||
this.postData = {
|
||||
DistributionType: "Paralelo",
|
||||
CountryCode: 'AO',
|
||||
Priority: this.postData.Priority,
|
||||
UserEmail: this.loggeduser.Email,
|
||||
UsersSelected: attendees,
|
||||
DispatchFolder: this.dispatchFolder,
|
||||
AttachmentList: docs
|
||||
}
|
||||
//console.log(this.postData);
|
||||
let action_deferimento = {
|
||||
"serialNumber": this.task.serialNumber,
|
||||
"action": "Tratado",
|
||||
"ActionTypeId": 93,
|
||||
"dataFields": {
|
||||
"Note": "",
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
this.taskResult = await this.processes.postDeferimento(this.postData).toPromise();
|
||||
this.toastService.successMessage('Processo efetuado');
|
||||
this.modalController.dismiss(action_deferimento);
|
||||
} catch (error) {
|
||||
await this.toastService.badRequest('Processo não efetuado')
|
||||
} finally {
|
||||
loader.remove()
|
||||
}
|
||||
|
||||
console.log('this.taskResult', this.taskResult);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.alertController.presentAlert("Lista de i-ntervenientes vazia. Por favor, adicione 1 ou mais intervenientes.");
|
||||
}
|
||||
break;
|
||||
case 'PR':
|
||||
switch (this.taskType) {
|
||||
case '0':
|
||||
this.postData = {
|
||||
DistributionType: "Paralelo",
|
||||
CountryCode: 'AO',
|
||||
Priority: this.postData.Priority,
|
||||
UserEmail: this.loggeduser.Email,
|
||||
UsersSelected: attendees,
|
||||
DispatchFolder: this.dispatchFolder,
|
||||
AttachmentList: docs,
|
||||
}
|
||||
console.log(this.postData);
|
||||
|
||||
let action_despacho_pr = {
|
||||
"serialNumber": this.task.serialNumber,
|
||||
"action": "Tratado",
|
||||
"ActionTypeId": 99999881 ,
|
||||
"dataFields": {
|
||||
"Note": "",
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
this.taskResult = await this.processes.postDespatchoPr(this.postData).toPromise();
|
||||
await this.toastService.successMessage('Processo efetuado');
|
||||
this.modalController.dismiss(action_despacho_pr);
|
||||
} catch (error) {
|
||||
await this.toastService.badRequest('Processo não efetuado')
|
||||
} finally {
|
||||
loader.remove()
|
||||
}
|
||||
|
||||
console.log('this.taskResult', this.taskResult);
|
||||
break;
|
||||
|
||||
case '1':
|
||||
this.postData = {
|
||||
DistributionType: "Paralelo",
|
||||
CountryCode: 'AO',
|
||||
Priority: this.postData.Priority,
|
||||
UserEmail: this.loggeduser.Email,
|
||||
UsersSelected: attendees,
|
||||
DispatchFolder: this.dispatchFolder,
|
||||
AttachmentList: docs
|
||||
}
|
||||
|
||||
let action_parecer_pr = {
|
||||
"serialNumber": this.task.serialNumber,
|
||||
"action": "Tratado",
|
||||
"ActionTypeId": 99999881,
|
||||
"dataFields": {
|
||||
"Note": "",
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
this.taskResult = await this.processes.postParecerPr(this.postData).toPromise();
|
||||
await this.toastService.badRequest('Processo não efetuado');
|
||||
this.modalController.dismiss(action_parecer_pr);
|
||||
} catch (error) {
|
||||
|
||||
await this.toastService.badRequest('Processo não efetuado')
|
||||
} finally {
|
||||
loader.remove()
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
getAttachments() {
|
||||
|
||||
Reference in New Issue
Block a user