This commit is contained in:
tiago.kayaya
2021-08-05 14:10:18 +01:00
parent f4c6fa91fe
commit 659a61577d
12 changed files with 580 additions and 17 deletions
+4
View File
@@ -163,6 +163,10 @@ const routes = [
{
path: 'profile',
loadChildren: () => import('./modals/profile/profile.module').then( m => m.ProfilePageModule)
},
{
path: 'all-processes',
loadChildren: () => import('./shared/gabinete-digital/all-processes/all-processes.module').then( m => m.AllProcessesPageModule)
},
@@ -34,6 +34,7 @@ import { DiplomasAssinarPageModule } from 'src/app/shared/gabinete-digital/diplo
import { HeaderPageModule } from 'src/app/shared/header/header.module';
import { BtnModalDismissPageModule } from 'src/app/shared/btn-modal-dismiss/btn-modal-dismiss.module';
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
import { AllProcessesPageModule } from 'src/app/shared/gabinete-digital/all-processes/all-processes.module';
@NgModule({
imports: [
@@ -45,6 +46,7 @@ import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
//
HeaderPageModule,
EmptyContainerPageModule,
AllProcessesPageModule,
EventsToApprovePageModule,
ExpedientsPageModule,
PedidosPageModule,
@@ -23,7 +23,7 @@
<div *ngIf="!hideRefreshBtn" class="title-icons">
<ion-segment [(ngModel)]="segmentVista" (ionChange)="onSegmentVistaChange()">
<ion-segment-button value="listview" class="ion-segment-button-no-border">
<fa-icon icon="stream"></fa-icon>
<fa-icon icon="align-justify"></fa-icon>
</ion-segment-button>
<ion-segment-button value="boxview" class="ion-segment-button-no-border">
<fa-icon icon="th-large"></fa-icon>
@@ -41,7 +41,7 @@
<div
class="item-wrapper ion-no-padding cursor-pointer"
*ngFor = "let task of allProcessesList"
(click)="viewProcessDetails(task.SerialNumber, task.WorkflowName, task.activityInstanceName)">
(click)="goToProcess(task.SerialNumber, task.WorkflowName, task.activityInstanceName)">
<div class="item width-100">
<div class="item-top-detail">
<div class="item-subject">
@@ -89,6 +89,15 @@
<!-- This is the box view -->
<div *ngSwitchCase="'boxview'" class="aside overflow-y-auto d-flex flex-wrap width-100 height-100">
<div (click)="openAllProcessesPage()" [class.active]="selectedElement == 'allProcessesTag'" class="exp-card d-flex flex-column" >
<div class="d-flex justify-center">
<!-- <ion-icon src="assets/images/icons-agenda.svg"></ion-icon> -->
<fa-icon icon="align-justify"></fa-icon>
</div>
<p class="text-center exp-card-title ">Todas as tarefas</p>
<p class="text-center exp-card-content">{{count_all_processes}}<span class="title1">Documentos</span></p>
</div>
<div (click)="openEventsToApprovePage();selectedElement='approval'" [class.active]="selectedElement == 'approval'" class="exp-card d-flex flex-column" *ngIf="loggeduser.Profile == 'MDGPR'" >
<div class="d-flex justify-center">
<ion-icon src="assets/images/icons-agenda.svg"></ion-icon>
@@ -218,6 +227,7 @@
<div class="aside-content d-none flex-column height-100">
<app-empty-container [texto]="emptyTextDescription" [style.display]="showEmptyContainer ? 'flex' : 'none'" class="height-100 flex-column"></app-empty-container>
<app-all-processes [profile]="profile" class=" height-100 flex-column" [style.display]="showAllProcesses ? 'flex' : 'none'" ></app-all-processes>
<app-events-to-approve [profile]="'MDGPR'" [style.display]="showEventsToApprove ? 'flex' : 'none'" class=" height-100 flex-column"></app-events-to-approve>
<app-expedients [profile]="profile" class=" height-100 flex-column" [style.display]="showExpedients ? 'flex' : 'none'" ></app-expedients>
@@ -188,7 +188,14 @@ ion-segment-button{
margin: 0 auto;
}
.exp-card ion-icon{
font-size: 48px;
font-size: 48px !important;
}
.exp-card fa-icon{
font-size: 30px;
padding: 0 1px 0 1px;
margin: 6px;
//border: 1px solid #ccc;
color: #797979;
}
.exp-card-title{
font-size: 15px;
@@ -57,6 +57,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
count_ev_md=0;
count_total_pending = 0;
count_desp_pr_active = 0;
count_all_processes = 0;
selectedElement = "";
@@ -65,6 +66,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
showExpediente : false,
}
showAllProcesses = false;
showEventsToApprove = false;
showEmptyContainer = false;
showExpedients = false;
@@ -125,12 +127,12 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
}
ngDoCheck(): void {
if( window.innerWidth < 701) {
/* if( window.innerWidth < 701) {
this.segmentVista = "listview";
}
else{
this.segmentVista = "boxview";
}
} */
}
closeAllDesktopComponent(){
@@ -260,7 +262,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
thedate.getMinutes();
}
viewProcessDetails(serialNumber:string, workflowName:string, activityName:string){
goToProcess(serialNumber:string, workflowName:string, activityName:string){
if(workflowName == 'Despacho') {
if(activityName == 'Tarefa de Despacho'){
this.router.navigate(['/home/gabinete-digital/despachos',serialNumber,'gabinete-digital']);
@@ -305,15 +307,16 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
}
checkUser(){
this.selectedElement='Correspondence';
switch(this.loggeduser.Profile){
this.selectedElement='allProcessesTag';
this.showAllProcesses = true;
/* switch(this.loggeduser.Profile){
case 'MDGPR':
this.showExpedients = true;
break;
case 'PR':
this.showExpedientesPr = true;
break;
}
} */
}
hideRefreshButton(){
@@ -332,6 +335,10 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
checkRoutes(){
this.closeAllDesktopComponents();
if(this.router.url == '/home/gabinete-digital?processes=true'){
this.openAllProcessesPage();
this.selectedElement='allProcessesTag';
}
if(this.router.url == '/home/gabinete-digital?eventos=true'){
this.openEventsToApprovePage();
this.selectedElement='approval';
@@ -386,6 +393,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
closeAllDesktopComponents() {
this.showEmptyContainer = false;
this.showAllProcesses = false;
this.showEventsToApprove = false;
this.showExpedients = false;
this.showPedidos = false;
@@ -403,6 +411,9 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
this.showLoader = true;
let allPreocesses_ = await this.processesbackend.GetTasksList("", false).toPromise();
this.count_all_processes = Object.keys(allPreocesses_).length;
let expedientes = await this.processesbackend.GetTasksList("Expediente", false).toPromise();
this.count_exp_dailywork = Object.keys(expedientes.filter(data => data.workflowInstanceDataFields.Status == "Active")).length;
this.expedientegbstore.count = this.count_exp_dailywork;
@@ -503,6 +514,19 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
return false;
}
openAllProcessesPage() {
this.closeAllDesktopComponents();
let navigationExtras: NavigationExtras = { queryParams: {"processes": true,}};
if( window.innerWidth <= 801) {
this.router.navigate(['/home/gabinete-digital']);
}
else {
this.router.navigate(['/home/gabinete-digital'], navigationExtras);
this.showAllProcesses = true;
this.selectedElement="allProcessesTag";
}
}
openEventsToApprovePage() {
this.closeAllDesktopComponents();
let navigationExtras: NavigationExtras = { queryParams: {"eventos": true,}};
@@ -0,0 +1,17 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { AllProcessesPage } from './all-processes.page';
const routes: Routes = [
{
path: '',
component: AllProcessesPage
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
export class AllProcessesPageRoutingModule {}
@@ -0,0 +1,21 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { IonicModule } from '@ionic/angular';
import { AllProcessesPageRoutingModule } from './all-processes-routing.module';
import { AllProcessesPage } from './all-processes.page';
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
AllProcessesPageRoutingModule
],
exports: [AllProcessesPage],
declarations: [AllProcessesPage]
})
export class AllProcessesPageModule {}
@@ -0,0 +1,117 @@
<ion-header class="ion-no-border">
<div class="title">
<div class="thetitle"><ion-label >Todas as Tarefas</ion-label></div>
<div class="theicon">
<button class="btn-no-color" (click)="doRefresh()">
<ion-icon slot="end" class="title-icon" name="reload-circle"></ion-icon>
</button>
</div>
</div>
</ion-header>
<ion-content>
<ion-refresher name="refresher" slot="fixed" (ionRefresh)="doRefresh()">
<ion-refresher-content
pullingIcon="chevron-down-circle-outline"
pullingText="deslize para actualizar"
refreshingSpinner="circles"
refreshingText="A actualizar...">
</ion-refresher-content>
</ion-refresher>
<div class="overflow-y-auto height-100 width-100">
<ion-progress-bar type="indeterminate" *ngIf="skeletonLoader"></ion-progress-bar>
<div *ngIf="allProcessesList.length >= 0">
<ion-item-sliding class="overflow-y-auto height-100">
<div class="listview">
<ion-list *ngIf="allProcessesList">
<div
class="item-wrapper ion-no-padding cursor-pointer"
*ngFor = "let task of allProcessesList"
(click)="goToProcess(task.SerialNumber, task.WorkflowName, task.activityInstanceName)">
<div class="item width-100">
<div class="item-top-detail">
<div class="item-subject">
<ion-label>{{ task.Folio }}</ion-label>
</div>
<div *ngIf="task.DocumentsQty != 0" class="item-icon">
<ion-icon src="assets/images/icons-expediente-attachment.svg"></ion-icon>
<label>{{task.DocumentsQty}}</label>
</div>
</div>
<div class="item-middle-detail">
<div class="item-remetente">
<ion-label>{{task.Senders}}</ion-label>
</div>
</div>
<div *ngIf="task.Agenda" class="item-middle-detail">
<div class="item-remetente">
<ion-label>{{task.customDate}}</ion-label>
</div>
</div>
<div *ngIf="task.Agenda" class="item-middle-detail-extra">
<div class="item-middle-detail-extra-text">
<ion-label *ngIf=" task.WorkflowName == 'Agenda Oficial PR' || task.WorkflowName == 'Agenda Pessoal PR'">
Agenda {{task.Agenda}} do Presidente da República
</ion-label>
<ion-label *ngIf=" task.WorkflowName == 'Agenda Oficial MDGPR' || task.WorkflowName == 'Agenda Pessoal MDGPR'">
A sua agenda {{task.Agenda}}
</ion-label>
</div>
</div>
<div class="item-bottom-detail d-flex align-items-center">
<div class="item-workflow">
<span class="label">{{task.activityInstanceName}}</span>
</div>
<div class="item-date">
<ion-label>{{ task.CreateDate | date: 'dd-MM-yy' }}</ion-label>
</div>
</div>
</div>
</div>
</ion-list>
</div>
</ion-item-sliding>
</div>
<div
*ngIf="!skeletonLoader && allProcessesList.length == 0"
class="empty-list d-flex height-100 align-center justify-content-center"
>
<span>Lista vazia</span>
</div>
<div *ngIf="skeletonLoader && allProcessesList.length == 0">
<ion-list>
<ion-item>
<ion-thumbnail slot="end">
<ion-skeleton-text animated></ion-skeleton-text>
</ion-thumbnail>
<ion-label>
<h3><ion-skeleton-text animated style="width: 50%"></ion-skeleton-text></h3>
<p><ion-skeleton-text animated style="width: 80%"></ion-skeleton-text></p>
<p><ion-skeleton-text animated style="width: 60%"></ion-skeleton-text></p>
</ion-label>
</ion-item>
<ion-item>
<ion-thumbnail slot="end">
<ion-skeleton-text animated></ion-skeleton-text>
</ion-thumbnail>
<ion-label>
<h3><ion-skeleton-text animated style="width: 50%"></ion-skeleton-text></h3>
<p><ion-skeleton-text animated style="width: 80%"></ion-skeleton-text></p>
<p><ion-skeleton-text animated style="width: 60%"></ion-skeleton-text></p>
</ion-label>
</ion-item>
</ion-list>
</div>
</div>
</ion-content>
@@ -0,0 +1,166 @@
@import '~src/function.scss';
/* CONTENT */
:host{
//padding: 30px 20px 0 20px !important;
margin: 0;
}
.title{
padding: 30px 20px 0 20px !important;
font-family: Roboto;
font-size: 25px;
color:#000;
overflow: auto;
.thetitle{
width: fit-content;
float: left;
}
.theicon{
width: fit-content;
float: right;
}
}
.listview{
width: 100%t;
padding: 0px 20px 15px 20px !important;
overflow: auto;
}
ion-list{
background: transparent;
}
.item-wrapper{
border-radius: 15px;
box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.07);
border:1px solid #e9e9e9 !important;
background-color: #fff !important;
margin-bottom: 10px !important;
padding: 15px;
.item{
background-color: var(--white);
margin: 0 auto;
overflow: hidden;
.item-top-detail{
width: 100%;
float: left;
font-family: Roboto;
font-size: 12pt;
font-weight: 700;
color: #0d89d1;
padding-left: 3px;
.item-subject{
width: 84%;
float: left;
ion-label{
margin: 0 !important;
padding: 2.5px 10.5px 2.5px 10.5px;
}
}
.item-icon{
width: fit-content;
float: right;
/* font-size: 13px; */
margin: 0 !important;
padding: 0 !important;
ion-icon{
font-size: 12pt;
color: #42b9fe;
float: left;
}
label{
font-size: 10pt;
}
}
}
.item-middle-detail{
font-size: 10pt;
width: 100%;
overflow: auto;
padding-left: 3px;
//border: 1px solid red;
margin: 0 !important;
.item-remetente{
//width: 200px;
font-family: Roboto;
/* font-size: 13px; */
font-weight: normal;
color: #000000;
float: left;
/* border: 1px solid red; */
ion-label{
padding: 2.5px 10.5px 2.5px 10.5px;
margin: 0 !important;
}
}
}
.item-middle-detail-extra{
font-size: 10pt;
padding-left: 3px;
//border: 1px solid red;
.item-middle-detail-extra-text{
//border: 1px solid blue;
ion-label{
padding: 2.5px 10.5px 2.5px 10.5px;
margin: 0 !important;
}
}
}
.item-bottom-detail{
font-size: 12pt;
width: 100%;
overflow: auto;
margin-top: 10px;
padding-bottom: 0 !important;
.item-workflow{
float: left;
margin: 0 !important;
align-self: flex-start;
.label{
border-radius: 15px;
background: #ffb703;
/* font-size: 12px; */
float: right;
padding: 2.5px 13.5px 2.5px 13.5px;
color: #fff;
}
}
.item-date{
width: auto;
font-family: Roboto;
font-size: 10pt;
font-weight: normal;
font-stretch: normal;
font-style: normal;
line-height: normal;
letter-spacing: normal;
color: #797979;
text-align: right;
flex-grow: 1;
ion-label{
margin: 0 !important;
padding: 0 !important;
}
}
}
.item-middle-detail, .item-bottom-detail{
margin-bottom: 5px;
}
}
}
@@ -0,0 +1,24 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular';
import { AllProcessesPage } from './all-processes.page';
describe('AllProcessesPage', () => {
let component: AllProcessesPage;
let fixture: ComponentFixture<AllProcessesPage>;
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ AllProcessesPage ],
imports: [IonicModule.forRoot()]
}).compileComponents();
fixture = TestBed.createComponent(AllProcessesPage);
component = fixture.componentInstance;
fixture.detectChanges();
}));
it('should create', () => {
expect(component).toBeTruthy();
});
});
@@ -0,0 +1,171 @@
import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { User } from 'src/app/models/user.model';
import { AuthService } from 'src/app/services/auth.service';
import { ProcessesService } from 'src/app/services/processes.service';
import { removeDuplicate } from 'src/plugin/removeDuplicate.js';
@Component({
selector: 'app-all-processes',
templateUrl: './all-processes.page.html',
styleUrls: ['./all-processes.page.scss'],
})
export class AllProcessesPage implements OnInit {
skeletonLoader = true;
allProcessesList:any[] = [];
loggeduser: User;
constructor(
private processesService: ProcessesService,
private router: Router,
private authService: AuthService,
) {
this.loggeduser = authService.ValidatedUser;
}
ngOnInit() {
this.loadAllProcesses();
}
doRefresh() {
setTimeout(() => {
this.loadAllProcesses();
}, 1000);
}
async loadAllProcesses(){
let allProcessesList = await this.processesService.GetTasksList("", false).toPromise();
console.log(allProcessesList);
this.skeletonLoader = true;
this.allProcessesList = [];
allProcessesList.forEach(element => {
let date = new Date(element.taskStartDate);
date.setMonth(date.getMonth() + 1);
let taskDate = date.getFullYear()+"-"+ date.getMonth()+"-"+date.getDate()+" "+date.getHours()+":"+date.getMinutes()+ ":"+date.getSeconds();
let task = {
"SerialNumber": element.serialNumber,
"Folio": element.workflowInstanceDataFields.Subject,
"Senders": element.workflowInstanceDataFields.Sender,
"CreateDate": taskDate,
"DocumentURL": element.workflowInstanceDataFields.ViewerRequest,
"Remetente": element.workflowInstanceDataFields.Remetente,
"DocumentsQty": element.totalDocuments,
"DocId": element.workflowInstanceDataFields.DispatchDocId,
"FolderID": element.workflowInstanceDataFields.FolderID,
"WorkflowName": element.workflowDisplayName,
"activityInstanceName": element.activityInstanceName,
"Status": element.workflowInstanceDataFields.Status,
"Agenda": element.workflowInstanceDataFields.Agenda,
"customDate": this.setFormatDate(new Date(element.workflowInstanceDataFields.StartDate), new Date(element.workflowInstanceDataFields.EndDate), element.workflowInstanceDataFields.IsAllDayEvent),
}
this.allProcessesList.push(task);
this.allProcessesList = removeDuplicate( this.allProcessesList)
this.allProcessesList = this.sortArrayISODate(this.allProcessesList).reverse();
});
//this.pendentesstore.reset(this.allProcessesList);
this.skeletonLoader = false;
}
sortArrayISODate(myArray: any){
return myArray.sort(function(a, b) {
return (a.CreateDate < b.CreateDate) ? -1 : ((a.CreateDate > b.CreateDate) ? 1 : 0);
});
}
setFormatDate(start:any, end:any, allday:boolean){
let customDate;
/* start = new Date();
end= new Date("2021-08-04T18:01:04.753Z"); */
//end = new Date("2021-09-04T18:01:04.753Z");
const totalSeconds = Math.floor((end - (start))/1000);;
const totalMinutes = Math.floor(totalSeconds/60);
const totalHours = Math.floor(totalMinutes/60);
const totalDays = Math.floor(totalHours/24);
const hours = totalHours - ( totalDays * 24 );
const minutes = totalMinutes - ( totalDays * 24 * 60 ) - ( hours * 60 );
const seconds = totalSeconds - ( totalDays * 24 * 60 * 60 ) - ( hours * 60 * 60 ) - ( minutes * 60 );
let diffDays = totalDays;
let diffMinutes = minutes;
console.log(allday);
if(totalDays == 0){
if(allday){
customDate = this.getCustomDate(start)+", "+this.getCustomHours(start)+" (todo dia)";
console.log(customDate);
return customDate;
}
else
{
//customDate = this.getCustomDate(start)+","+this.getCustomHours(start)+" ("+minutes+" mins)";
customDate = this.getCustomDate(start)+", "+this.getCustomHours(start)+" | "+this.getCustomHours(end);
return customDate;
}
}
else{
customDate = this.getCustomDate(start)+","+this.getCustomHours(start)+
" (termina:"+ this.getCustomDate(end)+","+this.getCustomHours(end)+")";
return customDate;
}
}
getCustomDate(thedate: Date){
return (thedate.getDay()+1) + "/" +
(thedate.getMonth()+1) + "/" +
thedate.getFullYear();
}
getCustomHours(thedate: Date){
return thedate.getHours() + ":" +
thedate.getMinutes();
}
goToProcess(serialNumber:string, workflowName:string, activityName:string){
if(workflowName == 'Despacho') {
if(activityName == 'Tarefa de Despacho'){
this.router.navigate(['/home/gabinete-digital/despachos',serialNumber,'gabinete-digital']);
}
}
else if(workflowName == 'Despacho do Presidente da República') {
if(activityName == 'Tarefa de Despacho'){
this.router.navigate(['/home/gabinete-digital/despachos-pr',serialNumber,'gabinete-digital']);
}
else if(activityName == 'Revisar Diploma' || activityName == 'Assinar Diploma'){
this.router.navigate(['/home/gabinete-digital/diplomas',serialNumber,'gabinete-digital']);
}
else if(activityName == 'Diploma Assinado'){
this.router.navigate(['/home/gabinete-digital/diplomas-assinar',serialNumber,'gabinete-digital']);
}
}
else if(workflowName == 'Pedido de Parecer' || workflowName == 'Pedido de Deferimento') {
this.router.navigate(['/home/gabinete-digital/pedidos',serialNumber,'gabinete-digital']);
}
else if(workflowName == 'Expediente') {
this.router.navigate(['/home/gabinete-digital/expediente',serialNumber,'gabinete-digital']);
}
else if(workflowName == 'Expediente do Presidente' && this.loggeduser.Profile == 'PR') {
this.router.navigate(['/home/gabinete-digital/expedientes-pr',serialNumber,'gabinete-digital']);
}
else if (workflowName == "Pedido de Parecer do Presidente") {
this.router.navigate(['/home/gabinete-digital/pedidos',serialNumber,'gabinete-digital']);
}
/* else if (workflowName == "Expediente") {
this.router.navigate(['/home/gabinete-digital/pedidos',serialNumber,'gabinete-digital']);
} */
else if(workflowName == 'Agenda Pessoal PR' || workflowName == 'Agenda Oficial PR' || workflowName == 'Agenda Oficial MDGPR' || workflowName == 'Agenda Pessoal MDGPR') {
this.router.navigate(['/home/gabinete-digital/event-list/approve-event',serialNumber, 'gabinete-digital']);
}
else {
console.log('cant find page for this task')
}
}
}
@@ -17,16 +17,16 @@
refreshingSpinner="circles"
refreshingText="A actualizar...">
</ion-refresher-content>
</ion-refresher>
<div class="overflow-y-auto height-100 width-100">
<ion-progress-bar type="indeterminate" *ngIf="skeletonLoader"></ion-progress-bar>
<div *ngIf="despachoStore.list.length >= 0">
<ion-list part="divo">
<div
class="expediente ion-no-padding ion-no-margin cursor-pointer"
class="expediente ion-no-padding ion-no-margin cursor-pointer"
*ngFor = "let task of despachoStore.list; let i = index"
(click)="goToDespacho(task.SerialNumber)"
>
@@ -59,15 +59,15 @@
</ion-list>
</div>
<div
*ngIf="!skeletonLoader && despachoStore.list.length == 0"
<div
*ngIf="!skeletonLoader && despachoStore.list.length == 0"
class="empty-list d-flex height-100 align-center justify-content-center"
>
<span>Lista vazia</span>
</div>
<div *ngIf="skeletonLoader && despachoStore.list.length == 0">
<ion-list>
<ion-item>
<ion-thumbnail slot="end">
@@ -94,6 +94,6 @@
</div>
</ion-content>