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
@@ -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>