mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
improve
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
## I’m Peter, a computer technician, doing my first year of electronics and telecommunications college
|
||||
____
|
||||
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
|
||||
<div style="display:flex">
|
||||
<div style="width:100px;">
|
||||
<img style="width:100px;" src="https://drive.google.com/uc?export=view&id=1TGGfel3FvbYK04BohwmQxeHZHU0oHJA5" >
|
||||
</div>
|
||||
<div >
|
||||
<h3 style="margin-top:0px">Most frequently used design pattern</h3>
|
||||
<ul>
|
||||
<li><a href="https://refactoring.guru/design-patterns/singleton">Singleton</a></li>
|
||||
<li><a href="https://medium.com/angular-in-depth/the-page-pattern-9f437ec99d7b">Page</a>
|
||||
<li><a href="https://refactoring.guru/design-patterns/strategy">Strategy</a></li>
|
||||
<ul>
|
||||
</div>
|
||||
<div/>
|
||||
@@ -11,27 +11,23 @@ export class PermissionService {
|
||||
constructor() { }
|
||||
|
||||
userRole(args) {
|
||||
let data: string[] = []
|
||||
|
||||
if(!Array.isArray(args) && typeof(args) == 'string') {
|
||||
data = [args]
|
||||
} else {
|
||||
data = args
|
||||
if(!Array.isArray(args)) {
|
||||
args = [args]
|
||||
}
|
||||
|
||||
return data.includes(this.userStore.user.Profile)
|
||||
return args.includes(this.userStore.user.Profile)
|
||||
}
|
||||
|
||||
role(args: any) {
|
||||
|
||||
|
||||
let UserRoleIsValid = this.userRole(args)
|
||||
|
||||
return {
|
||||
permissionAnyOf(role) {
|
||||
|
||||
if(!Array.isArray(args) && typeof(args) == 'string') {
|
||||
role = [args]
|
||||
if(!Array.isArray(role)) {
|
||||
role = [role]
|
||||
}
|
||||
|
||||
if(!UserRoleIsValid) {return false }
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { PermissionService } from '../OtherService/permission.service';
|
||||
import { ProcessesService } from '../services/processes.service';
|
||||
|
||||
@Injectable({
|
||||
@@ -16,6 +17,7 @@ export class DespachoService {
|
||||
|
||||
constructor(
|
||||
private processes: ProcessesService,
|
||||
public p: PermissionService
|
||||
) { }
|
||||
|
||||
arquivar(note:string, documents:any, serialnumber) {
|
||||
@@ -63,8 +65,37 @@ export class DespachoService {
|
||||
return this.processes.CompleteTask(body)
|
||||
}
|
||||
|
||||
sendExpedienteToPending(serialnumber) {
|
||||
CompleteTask({serialNumber}) {
|
||||
|
||||
const body = {
|
||||
"serialNumber": serialNumber,
|
||||
"action": "Despacho",
|
||||
"ActionTypeId": 94,
|
||||
"dataFields": {
|
||||
"ReviewUserComment": '',
|
||||
},
|
||||
"AttachmentList" :null,
|
||||
}
|
||||
|
||||
return this.processes.CompleteTask(body)
|
||||
}
|
||||
|
||||
sendExpedienteToPending(serialnumber) {
|
||||
return this.processes.SetTaskToPending(serialnumber)
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param body any
|
||||
* @returns promise
|
||||
* @description for both profile PR and MDGPR
|
||||
*/
|
||||
createDespacho(body: any) {
|
||||
if(this.p.userRole(['PR'])) {
|
||||
return this.processes.postDespatchoPr(body)
|
||||
} else {
|
||||
return this.processes.postDespatcho(body)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -111,16 +111,14 @@ export class ViewEventPage implements OnInit {
|
||||
if(this.isModal) {
|
||||
this.close()
|
||||
} else {
|
||||
// this.activatedRoute.paramMap.subscribe(params => {
|
||||
// if(params["params"].caller == 'expediente'){
|
||||
// window.history.back();
|
||||
// }
|
||||
// else{
|
||||
// this.router.navigate(['/home',params["params"].caller]);
|
||||
// }
|
||||
// });
|
||||
|
||||
this.location.back();
|
||||
this.activatedRoute.paramMap.subscribe(params => {
|
||||
if(params["params"].caller == 'expediente'){
|
||||
window.history.back();
|
||||
}
|
||||
else{
|
||||
this.router.navigate(['/home',params["params"].caller]);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+7
-3
@@ -20,6 +20,7 @@ import { FormControl, FormGroup, Validators } from '@angular/forms';
|
||||
import { NGX_MAT_DATE_FORMATS } from '@angular-material-components/datetime-picker';
|
||||
import { NgxMatDateFormats } from '@angular-material-components/datetime-picker';
|
||||
import { task } from 'src/app/models/ExpedientTaskModalPage';
|
||||
import { DespachoService } from 'src/app/Rules/despacho.service';
|
||||
|
||||
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
|
||||
parse: {
|
||||
@@ -101,11 +102,14 @@ export class ExpedientTaskModalPage implements OnInit {
|
||||
private userAuth: AuthService,
|
||||
private animationController: AnimationController,
|
||||
private toastService: ToastService,
|
||||
private despachoService: DespachoService
|
||||
) {
|
||||
|
||||
this.loggeduser = userAuth.ValidatedUser;
|
||||
this.task = this.navParams.get('task');
|
||||
|
||||
console.log(this.task)
|
||||
|
||||
this.taskType = this.navParams.get('taskAction');
|
||||
|
||||
this.selectedTypes = ['99999850'];
|
||||
@@ -371,7 +375,7 @@ export class ExpedientTaskModalPage implements OnInit {
|
||||
break;
|
||||
case 'PR':
|
||||
switch (this.taskType) {
|
||||
case '0':
|
||||
case '0': // despacho
|
||||
this.postData = {
|
||||
DistributionType: "Paralelo",
|
||||
CountryCode: 'AO',
|
||||
@@ -393,7 +397,7 @@ export class ExpedientTaskModalPage implements OnInit {
|
||||
}
|
||||
|
||||
try {
|
||||
this.taskResult = await this.processes.postDespatchoPr(this.postData).toPromise();
|
||||
this.taskResult = await this.despachoService.createDespacho(this.postData).toPromise();
|
||||
await this.toastService.successMessage('Processo efetuado');
|
||||
this.modalController.dismiss(action_despacho_pr);
|
||||
} catch (error) {
|
||||
@@ -437,7 +441,7 @@ export class ExpedientTaskModalPage implements OnInit {
|
||||
loader.remove()
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,7 +79,8 @@
|
||||
<button (click)="openAddNoteModal('Arquivar')" class="btn-cancel" shape="round" >Arquivar</button>
|
||||
<button (click)="openDelegarModal(task)" class="btn-cancel" shape="round" >Delegar</button>
|
||||
<div class="solid"></div>
|
||||
<button (click)="openExpedientActionsModal('0',fulltask)" class="btn-ok" shape="round" >Efectuar Despacho</button>
|
||||
<button *ngIf="p.userRole(['MDGPR'])" (click)="openExpedientActionsModal('0',fulltask)" class="btn-ok" shape="round" >Efectuar Despacho</button>
|
||||
<button *ngIf="p.userRole(['PR'])" (click)="openExpedientActionsModal('0',fulltask)" class="btn-ok" shape="round" >Marcar para Despacho</button>
|
||||
<button *ngIf="loggeduser.Profile == 'MDGPR'" (click)="openExpedientActionsModal('2',fulltask)" class="btn-cancel" shape="round" >Pedido de Deferimento</button>
|
||||
<button (click)="openBookMeetingModal(task)" class="btn-cancel" shape="round" >Marcar Reunião</button>
|
||||
<button (click)="sendExpedienteToPending()" *ngIf="task.Status != 'Pending'" class="btn-cancel" shape="round" >Enviar para Pendentes</button>
|
||||
@@ -88,7 +89,8 @@
|
||||
<button (click)="openAddNoteModal('Arquivar')" class="btn-cancel" shape="round" >Arquivar</button>
|
||||
<button (click)="openDelegarModal(task)" class="btn-cancel" shape="round" >Delegar</button>
|
||||
<div class="solid"></div>
|
||||
<button (click)="openExpedientActionsModal('0',fulltask)" class="btn-ok" shape="round" >Efectuar Despacho</button>
|
||||
<button *ngIf="p.userRole(['MDGPR'])" (click)="openExpedientActionsModal('0',fulltask)" class="btn-ok" shape="round" >Efectuar Despacho</button>
|
||||
<button *ngIf="p.userRole(['PR'])" (click)="openExpedientActionsModal('0',fulltask)" class="btn-ok" shape="round" >Marcar para Despacho</button>
|
||||
<button *ngIf="loggeduser.Profile == 'MDGPR'" (click)="openExpedientActionsModal('2',fulltask)" class="btn-cancel" shape="round" >Pedido de Deferimento</button>
|
||||
<button (click)="openBookMeetingModal(task)" class="btn-cancel" shape="round" >Marcar Reunião</button>
|
||||
<button (click)="sendExpedienteToPending()" *ngIf="task.Status != 'Pending'" class="btn-cancel" shape="round" >Enviar para Pendentes</button>
|
||||
@@ -97,7 +99,8 @@
|
||||
<button (click)="openAddNoteModal('Arquivar')" class="btn-cancel" shape="round" >Arquivar</button>
|
||||
<button (click)="openDelegarModal(task)" class="btn-cancel" shape="round" >Delegar</button>
|
||||
<div class="solid"></div>
|
||||
<button (click)="openExpedientActionsModal('0',fulltask)" class="btn-ok" shape="round" >Efectuar Despacho</button>
|
||||
<button *ngIf="p.userRole(['MDGPR'])" (click)="openExpedientActionsModal('0',fulltask)" class="btn-ok" shape="round" >Efectuar Despacho</button>
|
||||
<button *ngIf="p.userRole(['PR'])" (click)="openExpedientActionsModal('0',fulltask)" class="btn-ok" shape="round" >Marcar para Despacho</button>
|
||||
<button hidden (click)="openExpedientActionsModal('1',fulltask)" class="btn-cancel" shape="round" >Solicitar Parecer</button>
|
||||
<button (click)="openAddNoteModal('Solicitar Reapreciação')" class="btn-cancel" shape="round" >Solicitar Reapreciação</button>
|
||||
<button (click)="openBookMeetingModal(task)" class="btn-cancel" shape="round" >Marcar Reunião</button>
|
||||
|
||||
@@ -23,6 +23,7 @@ import { BadRequestPage } from 'src/app/shared/popover/bad-request/bad-request.p
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
import { ForwardPage } from 'src/app/modals/forward/forward.page';
|
||||
import { async } from '@angular/core/testing';
|
||||
import { PermissionService } from 'src/app/OtherService/permission.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-pedido',
|
||||
@@ -58,7 +59,9 @@ export class PedidoPage implements OnInit {
|
||||
public popoverController: PopoverController,
|
||||
authService: AuthService,
|
||||
private animationController: AnimationController,
|
||||
private toastService: ToastService,) {
|
||||
private toastService: ToastService,
|
||||
public p: PermissionService,
|
||||
) {
|
||||
this.loggeduser = authService.ValidatedUser;
|
||||
|
||||
this.activatedRoute.paramMap.subscribe(params => {
|
||||
|
||||
Reference in New Issue
Block a user