mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
Fix
This commit is contained in:
@@ -43,9 +43,15 @@
|
||||
<ion-icon slot="start" src="assets/images/icons-calendar.svg"></ion-icon>
|
||||
</div>
|
||||
<div class="ion-input-class">
|
||||
<ion-select placeholder="Tipo" [(ngModel)]="selectedTypes" multiple="true" interface="action-sheet" Cancel-text="Cancelar" required>
|
||||
<ion-item class="ion-no-border ion-no-padding ion-no-margin">
|
||||
<ion-label>Tipo de assunto</ion-label>
|
||||
<ion-select
|
||||
[(ngModel)]="selectedTypes"
|
||||
(ngModelChange)="onSelectedTypesChanged($event)"
|
||||
multiple="true" interface="alert" Cancel-text="Cancelar" required>
|
||||
<ion-select-option *ngFor="let type of subjectTypes" value="{{type.Code}}">{{type.Description}}</ion-select-option>
|
||||
</ion-select>
|
||||
</ion-item>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -20,6 +20,7 @@ import { BadRequestPage } from 'src/app/shared/popover/bad-request/bad-request.p
|
||||
import { SuccessMessagePage } from 'src/app/shared/popover/success-message/success-message.page';
|
||||
import { User } from 'src/app/models/user.model';
|
||||
import { AttendeesPage } from 'src/app/pages/events/attendees/attendees.page';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-create-process',
|
||||
@@ -73,6 +74,7 @@ export class CreateProcessPage implements OnInit {
|
||||
private authService: AuthService,
|
||||
private userAuth: AuthService,
|
||||
private animationController: AnimationController,
|
||||
private toastService: ToastService,
|
||||
) {
|
||||
this.loggeduser = userAuth.ValidatedUser;
|
||||
this.user = environment.defaultuser +'@'+ environment.domain;
|
||||
@@ -84,6 +86,9 @@ export class CreateProcessPage implements OnInit {
|
||||
|
||||
this.postData = new Despacho();
|
||||
this.participants = this.participants = new Array();
|
||||
//Initialize SubjectTypes Array with the value "Indefinido"
|
||||
this.selectedTypes = ['99999850'];
|
||||
|
||||
this.dispatchFolder = {
|
||||
Nad: 30,
|
||||
Subject: '',
|
||||
@@ -92,7 +97,7 @@ export class CreateProcessPage implements OnInit {
|
||||
SourceType: 'DOC', //FOLDER
|
||||
SourceId: this.task.workflowInstanceDataFields.SourceID, //FolderId
|
||||
DeadlineType: '',
|
||||
SubjectTypes: ['99999844'],
|
||||
SubjectTypes: this.selectedTypes,
|
||||
NumberPDPP: this.task.workflowInstanceDataFields.DispatchNumber,
|
||||
|
||||
};
|
||||
@@ -111,8 +116,25 @@ export class CreateProcessPage implements OnInit {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
console.log(this.postData.DispatchFolder.SubjectTypes);
|
||||
this.taskDate = new Date(this.task.taskStartDate);
|
||||
this.getSubjectType();
|
||||
|
||||
if(this.selectedTypes.length > 1){
|
||||
console.log('Yes');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
onSelectedTypesChanged(ev:any){
|
||||
console.log(ev);
|
||||
if(ev.length > 1){
|
||||
console.log(ev.filter(data => data != '99999850'));
|
||||
this.selectedTypes = ev.filter(data => data != '99999850');
|
||||
}
|
||||
if(ev.length == 0){
|
||||
this.selectedTypes = ["99999850"];
|
||||
}
|
||||
}
|
||||
|
||||
close(){
|
||||
@@ -177,10 +199,11 @@ export class CreateProcessPage implements OnInit {
|
||||
console.log('this.postData', this.postData, this.taskType);
|
||||
|
||||
try {
|
||||
await this.processes.postDespatcho(this.postData).toPromise()
|
||||
//this.successMessage('')
|
||||
await this.processes.postDespatcho(this.postData).toPromise();
|
||||
this.FinalizarDespacho();
|
||||
this.toastService.badRequest('Despacho criado');
|
||||
} catch (error) {
|
||||
this.badRequest()
|
||||
this.toastService.badRequest('Processo não efectuado');
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -194,13 +217,14 @@ export class CreateProcessPage implements OnInit {
|
||||
DispatchFolder: this.dispatchFolder,
|
||||
}
|
||||
console.log(this.postData);
|
||||
await this.processes.postParecer(this.postData).toPromise()
|
||||
|
||||
try {
|
||||
await this.processes.postParecer(this.postData).toPromise()
|
||||
// this.successMessage()
|
||||
} catch (error) {
|
||||
this.badRequest()
|
||||
await this.processes.postParecer(this.postData).toPromise();
|
||||
this.FinalizarParecer();
|
||||
this.toastService.successMessage('Pedido de Parecer criado');
|
||||
}
|
||||
catch (error) {
|
||||
this.toastService.badRequest('Processo não efectuado');
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -216,19 +240,19 @@ export class CreateProcessPage implements OnInit {
|
||||
console.log(this.postData);
|
||||
|
||||
try {
|
||||
await this.processes.postDeferimento(this.postData).toPromise()
|
||||
// this.successMessage()
|
||||
} catch (error) {
|
||||
this.badRequest()
|
||||
await this.processes.postDeferimento(this.postData).toPromise();
|
||||
this.executado();
|
||||
this.toastService.successMessage('Pedido de Deferimento criado');
|
||||
}
|
||||
catch (error) {
|
||||
this.toastService.badRequest('Processo não efectuado');
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
this.executado();
|
||||
this.modalController.dismiss();
|
||||
}
|
||||
else {
|
||||
this.alertController.presentAlert("Lista de intervenientes vazia. Por favor, adicione 1 ou mais intervenientes.");
|
||||
this.toastService.badRequest('Lista de intervenientes vazia. Por favor, adicione 1 ou mais intervenientes.');
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -247,10 +271,11 @@ export class CreateProcessPage implements OnInit {
|
||||
console.log('this.postData', this.postData, this.taskType);
|
||||
|
||||
try {
|
||||
await this.processes.postDespatcho(this.postData).toPromise()
|
||||
// this.successMessage()
|
||||
await this.processes.postDespatcho(this.postData).toPromise();
|
||||
this.executado();
|
||||
this.toastService.successMessage('Despacho criado');
|
||||
} catch (error) {
|
||||
this.badRequest()
|
||||
this.toastService.badRequest('Processo não efectuado');
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -264,13 +289,14 @@ export class CreateProcessPage implements OnInit {
|
||||
DispatchFolder: this.dispatchFolder,
|
||||
}
|
||||
console.log(this.postData);
|
||||
await this.processes.postParecer(this.postData).toPromise()
|
||||
|
||||
try {
|
||||
await this.processes.postParecer(this.postData).toPromise()
|
||||
// this.successMessage()
|
||||
} catch (error) {
|
||||
this.badRequest()
|
||||
await this.processes.postParecer(this.postData).toPromise();
|
||||
this.executado();
|
||||
this.toastService.successMessage('Pedido de Parecer criado');
|
||||
}
|
||||
catch (error) {
|
||||
this.toastService.badRequest('Processo não efectuado');
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -286,22 +312,22 @@ export class CreateProcessPage implements OnInit {
|
||||
console.log(this.postData);
|
||||
|
||||
try {
|
||||
await this.processes.postDeferimento(this.postData).toPromise()
|
||||
// this.successMessage()
|
||||
} catch (error) {
|
||||
this.badRequest()
|
||||
await this.processes.postDeferimento(this.postData).toPromise();
|
||||
this.executado();
|
||||
this.toastService.successMessage('Pedido de Deferimento criado');
|
||||
}
|
||||
catch (error) {
|
||||
this.toastService.badRequest('Processo não efectuado');
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
this.executado();
|
||||
this.modalController.dismiss();
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
async executado() {
|
||||
let body = {
|
||||
"serialNumber": this.task.serialNumber,
|
||||
@@ -311,20 +337,37 @@ export class CreateProcessPage implements OnInit {
|
||||
"ReviewUserComment": '',
|
||||
},
|
||||
"AttachmentList" :null,
|
||||
}
|
||||
await this.processes.CompleteTask(body).toPromise();
|
||||
}
|
||||
|
||||
}
|
||||
try {
|
||||
await this.processes.CompleteTask(body).toPromise()
|
||||
this.successMessage()
|
||||
} catch (error) {
|
||||
this.badRequest()
|
||||
}
|
||||
|
||||
async FinalizarDespacho() {
|
||||
let body = {
|
||||
"serialNumber": this.task.serialNumber,
|
||||
"action": "Despacho",
|
||||
"ActionTypeId": 94,
|
||||
"dataFields": {
|
||||
"ReviewUserComment": '',
|
||||
},
|
||||
"AttachmentList" :null,
|
||||
}
|
||||
await this.processes.CompleteTask(body).toPromise();
|
||||
}
|
||||
|
||||
async FinalizarParecer() {
|
||||
let body = {
|
||||
"serialNumber": this.task.serialNumber,
|
||||
"action": "Parecer",
|
||||
"ActionTypeId": 92,
|
||||
"dataFields": {
|
||||
"ReviewUserComment": '',
|
||||
},
|
||||
"AttachmentList" :null,
|
||||
}
|
||||
await this.processes.CompleteTask(body).toPromise();
|
||||
}
|
||||
|
||||
async addParticipants() {
|
||||
/* console.log('HERES'); */
|
||||
|
||||
this.adding = "intervenient";
|
||||
this.contacts = this.taskParticipants;
|
||||
|
||||
Reference in New Issue
Block a user