mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 21:06:06 +00:00
improve
This commit is contained in:
@@ -17,6 +17,8 @@ import { ToastService } from 'src/app/services/toast.service';
|
||||
import { FormControl, FormGroup, Validators } from '@angular/forms';
|
||||
import { NgxMatDateFormats } from '@angular-material-components/datetime-picker';
|
||||
import { NGX_MAT_DATE_FORMATS } from '@angular-material-components/datetime-picker';
|
||||
import { PermissionService } from 'src/app/OtherService/permission.service';
|
||||
import { DespachoService } from 'src/app/Rules/despacho.service';
|
||||
|
||||
|
||||
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
|
||||
@@ -91,6 +93,8 @@ export class CreateProcessPage implements OnInit {
|
||||
private userAuth: AuthService,
|
||||
private animationController: AnimationController,
|
||||
private toastService: ToastService,
|
||||
public p: PermissionService,
|
||||
private despachoService: DespachoService
|
||||
) {
|
||||
this.loggeduser = userAuth.ValidatedUser;
|
||||
this.task = this.navParams.get('task');
|
||||
@@ -193,11 +197,13 @@ export class CreateProcessPage implements OnInit {
|
||||
|
||||
async saveTask() {
|
||||
|
||||
this.injectValidation()
|
||||
this.runValidation()
|
||||
|
||||
if(this.Form.invalid) return false
|
||||
|
||||
if(!this.p.userRole(['PR'])) {
|
||||
this.injectValidation()
|
||||
this.runValidation()
|
||||
if(this.Form.invalid) return false
|
||||
}
|
||||
|
||||
|
||||
if(this.postData.Priority=='99999861') {
|
||||
this.dispatchFolder.DeadlineType = 'Normal';
|
||||
@@ -232,11 +238,12 @@ export class CreateProcessPage implements OnInit {
|
||||
this.dispatchFolder.SubjectTypes = this.selectedTypes;
|
||||
const loader = this.toastService.loading()
|
||||
|
||||
|
||||
switch (this.loggeduser.Profile) {
|
||||
case 'MDGPR':
|
||||
|
||||
switch (this.taskType) {
|
||||
case '0':
|
||||
case '0': // Despacho
|
||||
this.postData = {
|
||||
DistributionType: "Paralelo",
|
||||
CountryCode: 'AO',
|
||||
@@ -252,6 +259,7 @@ export class CreateProcessPage implements OnInit {
|
||||
await this.FinalizarDespacho(loader, 'Despacho criado');
|
||||
} catch (error) {
|
||||
this.toastService.badRequest('Processo não efectuado');
|
||||
loader.remove()
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -272,6 +280,7 @@ export class CreateProcessPage implements OnInit {
|
||||
}
|
||||
catch (error) {
|
||||
this.toastService.badRequest('Processo não efectuado');
|
||||
loader.remove()
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -292,10 +301,10 @@ export class CreateProcessPage implements OnInit {
|
||||
}
|
||||
catch (error) {
|
||||
this.toastService.badRequest('Processo não efectuado');
|
||||
loader.remove()
|
||||
}
|
||||
break;
|
||||
}
|
||||
this.modalController.dismiss();
|
||||
|
||||
break;
|
||||
|
||||
@@ -313,10 +322,14 @@ export class CreateProcessPage implements OnInit {
|
||||
console.log('this.postData', this.postData, this.taskType);
|
||||
|
||||
try {
|
||||
await this.processes.postDespatcho(this.postData).toPromise();
|
||||
await this.executado(loader, 'Despacho criado');
|
||||
await this.despachoService.createDespacho(this.postData).toPromise();
|
||||
await this.despachoService.CompleteTask({serialNumber: this.task.serialNumber}).toPromise();
|
||||
this.modalController.dismiss();
|
||||
this.toastService.successMessage('Despacho criado');
|
||||
} catch (error) {
|
||||
this.toastService.badRequest('Processo não efectuado');
|
||||
} finally {
|
||||
loader.remove()
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -337,6 +350,7 @@ export class CreateProcessPage implements OnInit {
|
||||
this.toastService.successMessage('Pedido de Parecer criado');
|
||||
}
|
||||
catch (error) {
|
||||
loader.remove()
|
||||
this.toastService.badRequest('Processo não efectuado');
|
||||
}
|
||||
|
||||
@@ -358,12 +372,12 @@ export class CreateProcessPage implements OnInit {
|
||||
this.toastService.successMessage('Pedido de Deferimento criado');
|
||||
}
|
||||
catch (error) {
|
||||
loader.remove()
|
||||
this.toastService.badRequest('Processo não efectuado');
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
this.modalController.dismiss();
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -387,6 +401,16 @@ export class CreateProcessPage implements OnInit {
|
||||
}
|
||||
else if(this.task.activityInstanceName =='Concluir Despacho' || this.task.activityInstanceName == 'Concluir Parecer') {
|
||||
|
||||
body = {
|
||||
"serialNumber": this.task.serialNumber,
|
||||
"action": "Despacho",
|
||||
"ActionTypeId": 94,
|
||||
"dataFields": {
|
||||
"ReviewUserComment": '',
|
||||
},
|
||||
"AttachmentList" :null,
|
||||
}
|
||||
} else {
|
||||
body = {
|
||||
"serialNumber": this.task.serialNumber,
|
||||
"action": "Despacho",
|
||||
@@ -401,8 +425,11 @@ export class CreateProcessPage implements OnInit {
|
||||
try {
|
||||
await this.processes.CompleteTask(body).toPromise();
|
||||
this.toastService.successMessage(message);
|
||||
this.modalController.dismiss();
|
||||
} catch (error) {
|
||||
this.toastService.badRequest('Processo não efectuado');
|
||||
} finally {
|
||||
loader.remove()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -53,10 +53,10 @@
|
||||
|
||||
<div *ngIf="LoadedDocument" class="aside-right flex-column height-100">
|
||||
<div class="buttons">
|
||||
<button (click)="openExpedientActionsModal('0')" class="btn-ok" shape="round" >Efectuar Despacho</button>
|
||||
<button (click)="openExpedientActionsModal('0')" class="btn-ok" shape="round" >Marcar Despacho</button>
|
||||
<div class="solid"></div>
|
||||
<button (click)="openExpedientActionsModal('0')" class="btn-cancel" shape="round" >Solicitar Parecer</button>
|
||||
<button (click)="openExpedientActionsModal('2')" class="btn-cancel" shape="round" >Pedido de Deferimento</button>
|
||||
<button *ngIf="!p.userRole(['PR'])" (click)="openExpedientActionsModal('2')" class="btn-cancel" shape="round" >Pedido de Deferimento</button>
|
||||
<button (click)="openBookMeetingModal()" class="btn-cancel" shape="round" >Marcar Reunião</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -4,10 +4,10 @@ import { AlertService } from 'src/app/services/alert.service';
|
||||
import { ProcessesService } from 'src/app/services/processes.service';
|
||||
import { InAppBrowser } from '@ionic-native/in-app-browser/ngx';
|
||||
import { ExpedientTaskModalPage } from 'src/app/pages/gabinete-digital/expediente/expedient-task-modal/expedient-task-modal.page';
|
||||
import { BookMeetingModalPage } from 'src/app/pages/gabinete-digital/expediente/book-meeting-modal/book-meeting-modal.page';
|
||||
import { DocumentSetUpMeetingPage } from '../document-set-up-meeting/document-set-up-meeting.page';
|
||||
import { FromSearchDocument, SearchFolder } from 'src/app/models/search-document';
|
||||
import { ExpedientTaskModalPageNavParamsTask } from 'src/app/models/ExpedientTaskModalPage';
|
||||
import { PermissionService } from 'src/app/OtherService/permission.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-document-detail',
|
||||
@@ -35,6 +35,7 @@ export class DocumentDetailPage implements OnInit {
|
||||
private processes: ProcessesService,
|
||||
private menu: MenuController,
|
||||
private iab: InAppBrowser,
|
||||
public p: PermissionService,
|
||||
) {
|
||||
this.docId = this.navParams.get('docId');
|
||||
this.applicationId = this.navParams.get('applicationId');
|
||||
|
||||
Reference in New Issue
Block a user