merge with branchBug

This commit is contained in:
Eudes Inácio
2021-09-29 17:10:18 +01:00
24 changed files with 1329 additions and 735 deletions
+1 -1
View File
@@ -90,7 +90,7 @@
</div>
<div class="content overflow-y-auto flex-grow-1 height-100">
<ion-list>
<ion-item class="item-hover cursor-pointer" lines="none" *ngFor = "let task of expedienteGdStore.list"
<ion-item class="item-hover cursor-pointer" lines="none" *ngFor = "let task of listToPresentexpediente"
(click)="goToExpediente(task.SerialNumber)">
<div class="item-exp d-flex">
<div class="schedule-date">
+44 -38
View File
@@ -67,9 +67,8 @@ export class EventsPage implements OnInit {
toDayEventStorage = ToDayEventStorage
expedienteGdStore = ExpedienteGdStore
pdfSrc = "https://www.tabularium.pt/file-upload/FSovLiyEa8Hqy2iDA/TK-Justificativo.pdf";
listToPresent
listToPresent = [];
listToPresentexpediente =[]
expedienteTaskPipe = new ExpedienteTaskPipe()
@@ -120,18 +119,6 @@ export class EventsPage implements OnInit {
this.segment = "Combinada";
this.profile = "mdgpr";
this.showGreeting();
this.router.events.forEach((event) => {
if (event instanceof NavigationEnd && event.url == '/home/events') {
this.RefreshEvents();
setTimeout(()=>{
this.LoadList();
}, 1500)
}
});
this.hideSearch();
this.getEventsFromLocalDb();
//this.checkScreenOrientation();
@@ -199,17 +186,16 @@ export class EventsPage implements OnInit {
const list = mdOficialEvents.concat(mdPessoalEvents);
console.log("getAllMdOficialPessoalEvents", list)
this.SqliteAddEvent(list);
this.listToPresent = this.toDayEventStorage.eventsList
this.toDayEventStorage.reset(list)
this.listToPresent = list
if (this.toDayEventStorage.eventsList.length > 0) {
this.currentEvent = this.toDayEventStorage.eventsList[0].Subject;
this.currentHoursMinutes = this.toDayEventStorage.eventsList[0].StartDate;
if (list.length > 0) {
this.currentEvent = list[0].Subject;
this.currentHoursMinutes = list[0].StartDate;
}
this.totalEvent = this.toDayEventStorage.eventsList.length;
this.totalEvent = list.length;
this.showLoader = false;
}
@@ -221,15 +207,14 @@ export class EventsPage implements OnInit {
const list = prOficialEvents.concat(prPessoalEvents);
console.log("getAllPrOficialPessoalEvents", list)
this.SqliteAddEvent(list);
this.toDayEventStorage.reset(list)
if (this.toDayEventStorage.eventsList.length > 0) {
this.currentEvent = this.toDayEventStorage.eventsList[0].Subject;
this.currentHoursMinutes = this.toDayEventStorage.eventsList[0].StartDate;
if (list.length > 0) {
this.currentEvent = list[0].Subject;
this.currentHoursMinutes = list[0].StartDate;
}
this.listToPresent = this.toDayEventStorage.eventsList;
this.totalEvent = this.toDayEventStorage.eventsList.length;
this.listToPresent = list;
this.totalEvent = list.length;
this.showLoader = false;
}
@@ -339,32 +324,50 @@ export class EventsPage implements OnInit {
getEventsFromLocalDb() {
synchro.registerCallback('Online', () => {
if (synchro.connected === true) {
this.showGreeting();
this.router.events.forEach((event) => {
if (event instanceof NavigationEnd && event.url == '/home/events') {
this.RefreshEvents();
setTimeout(() => {
this.LoadList();
}, 1500)
}
});
console.log('Onlineee')
})
synchro.registerCallback('Offline', () => {
this.platform.ready().then(() => {
this.sqliteservice.getAllEvents().then((event) => {
this.hideSearch();
} else {
this.sqliteservice.getAllEvents().then((event:any[]) => {
this.listToPresent = event
this.totalEvent = this.listToPresent.length
this.currentEvent = this.listToPresent[0].Subject
this.currentHoursMinutes = this.listToPresent[0].StartDate
console.log("All events from local,", event)
})
console.log('Offlineee')
this.sqliteservice.getprocessByworkflow("Expediente").then((process: any[]) => {
var expedientlist = [];
process.forEach((element) => {
let task = {
CreateDate: element.taskStartDate,
DocumentsQty: element.totalDocuments,
Senders: JSON.parse(element.workflowInstanceDataFields).Sender,
SerialNumber: element.serialNumber,
Status: JSON.parse(element.workflowInstanceDataFields).Status,
Subject: JSON.parse(element.workflowInstanceDataFields).Subject,
WorkflowName: element.workflowDisplayName,
activityInstanceName: element.activityInstanceName,
taskStartDate: element.taskStartDate,
}
expedientlist.push(task);
})
const ExpedienteTask = expedientlist.map(e => this.expedienteTaskPipe.transform(e))
this.listToPresentexpediente = ExpedienteTask;
})
}
}
@@ -421,10 +424,13 @@ export class EventsPage implements OnInit {
LoadList() {
this.processes.GetTaskListExpediente(false).subscribe(result => {
console.log("Expediente", result);
this.sqliteservice.addProcess(result)
const ExpedienteTask = result.map(e => this.expedienteTaskPipe.transform(e))
this.expedienteGdStore.reset(ExpedienteTask)
console.log("Expediente 2", ExpedienteTask);
this.listToPresentexpediente = ExpedienteTask;
});
}
@@ -19,6 +19,9 @@ import { ToastService } from 'src/app/services/toast.service';
import { Location } from '@angular/common'
import { DespachoService } from 'src/app/Rules/despacho.service';
import { SqliteService } from 'src/app/services/sqlite.service';
import { synchro } from 'src/app/services/socket/synchro.service';
@Component({
selector: 'app-despacho-pr',
templateUrl: './despacho-pr.page.html',
@@ -51,7 +54,8 @@ export class DespachoPrPage implements OnInit {
private activatedRoute: ActivatedRoute,
private toastService: ToastService,
private location: Location,
private despachoService: DespachoService
private despachoService: DespachoService,
private sqliteservice: SqliteService
) {
this.activatedRoute.paramMap.subscribe(params => {
if (params["params"].SerialNumber) {
@@ -68,17 +72,7 @@ export class DespachoPrPage implements OnInit {
ngOnInit() {
this.profile = "mdgpr";
console.log(this.serialNumber);
this.activateRoute.paramMap.subscribe(paramMap => {
if (!paramMap.has('SerialNumber')) {
return;
}
/* this.serialNumber = paramMap.get('SerialNumber'); */
this.LoadTaskDetail(this.serialNumber);
// this.LoadRelatedEvents(this.serialNumber);
});
this.LoadTaskDetail(this.serialNumber);
// this.LoadRelatedEvents(this.serialNumber);
this.getFromDB();
}
close() {
@@ -111,12 +105,16 @@ export class DespachoPrPage implements OnInit {
console.log(this.task);
console.log('GetTask', res);
this.sqliteservice.updateProcess(res)
let thedate = new Date(this.task.CreateDate);
this.customDate = this.days[thedate.getDay()] + ", " + thedate.getDate() + " de " + (this.months[thedate.getMonth()]);
this.processes.GetTaskParticipants(this.task.FolderId).subscribe(users => {
this.sqliteservice.updateProcessInterveners(JSON.stringify(this.serialNumber), JSON.stringify(users)).then(() => {
console.log('internen despacho pr ')
})
this.intervenientes = users.filter(user => {
return user.Type == 'I';
});
@@ -145,6 +143,71 @@ export class DespachoPrPage implements OnInit {
});
}
getFromDB() {
if (synchro.connected === true) {
this.activateRoute.paramMap.subscribe(paramMap => {
if (!paramMap.has('SerialNumber')) {
return;
}
/* this.serialNumber = paramMap.get('SerialNumber'); */
this.LoadTaskDetail(this.serialNumber);
// this.LoadRelatedEvents(this.serialNumber);
});
this.LoadTaskDetail(this.serialNumber);
// this.LoadRelatedEvents(this.serialNumber);
} else {
this.sqliteservice.getProcessById(this.serialNumber).then((process: any[]) => {
console.log('OFFLINE', process)
this.task = {
"SerialNumber": process[0].serialNumber,
"Folio": JSON.parse(process[0].workflowInstanceDataFields).Subject,
"Senders": JSON.parse(process[0].originator).email,
"CreateDate": momentG(new Date(process[0].taskStartDate), 'yyyy-MM-dd HH:mm:ss'),
"DocumentURL": JSON.parse(process[0].workflowInstanceDataFields).ViewerRequest,
"Remetente": JSON.parse(process[0].workflowInstanceDataFields).Sender,
"Note": JSON.parse(process[0].workflowInstanceDataFields).TaskMessage || JSON.parse(process[0].workflowInstanceDataFields).Note,
"FolderId": JSON.parse(process[0].workflowInstanceDataFields).FolderID,
"FsId": '361',
"DocId": JSON.parse(process[0].workflowInstanceDataFields).DispatchDocId,
"WorkflowName": process[0].workflowDisplayName,
"DeadlineType": JSON.parse(process[0].workflowInstanceDataFields).DeadlineType,
"activityInstanceName": process[0].activityInstanceName,
}
console.log("OFFLINE TASK", this.task)
let fulltak = {
Documents: JSON.parse(process[0].Documents),
actions: JSON.parse(process[0].actions),
activityInstanceName: process[0].activityInstanceName,
formURL: process[0].formURL,
originator: JSON.parse(process[0].originator),
serialNumber: process[0].serialNumber,
taskStartDate: process[0].taskStartDate,
totalDocuments: process[0].totalDocuments,
workflowDisplayName: process[0].workflowDisplayName,
workflowID: process[0].workflowID,
workflowInstanceDataFields: JSON.parse(process[0].workflowInstanceDataFields),
workflowInstanceFolio: process[0].workflowInstanceFolio,
workflowInstanceID: process[0].workflowInstanceID,
workflowName: process[0].workflowName
}
this.fulltask = fulltak;
console.log(this.task);
let thedate = new Date(this.task.CreateDate);
this.customDate = this.days[thedate.getDay()] + ", " + thedate.getDate() + " de " + (this.months[thedate.getMonth()]);
this.intervenientes = JSON.parse(process[0].interveners).filter(user => {
return user.Type == 'I';
});
this.cc = JSON.parse(process[0].interveners).filter(user => {
return user.Type == 'CC';
});
})
}
}
viewDocument(docId: string) {
this.processes.GetDocumentUrl(docId, '361').subscribe(res => {
console.log(res);
@@ -33,7 +33,7 @@
<ion-list>
<div
class="expediente ion-no-padding ion-no-margin cursor-pointer"
*ngFor = "let task of despachoprstore.list; let i = index"
*ngFor = "let task of listToPresent; let i = index"
(click)="goToDespachoPr(task.SerialNumber)"
>
<!-- [routerLink]="['/home/gabinete-digital/expediente',task.SerialNumber]" -->
@@ -67,13 +67,13 @@
</div>
<div
*ngIf="!skeletonLoader && despachoprstore.list.length == 0"
*ngIf="!skeletonLoader && listToPresent.length == 0"
class="empty-list d-flex height-100 align-center justify-content-center"
>
<span>Lista vazia</span>
</div>
<div *ngIf="skeletonLoader && despachoprstore.list.length == 0">
<div *ngIf="skeletonLoader && listToPresent.length == 0">
<ion-list>
<ion-item>
<ion-thumbnail slot="end">
@@ -17,6 +17,9 @@ import { NavigationEnd, NavigationExtras, NavigationStart, Router } from '@angul
import { __awaiter } from 'tslib';
import { DespachosprStore } from 'src/app/store/despachospr-store.service';
import { SqliteService } from 'src/app/services/sqlite.service';
import { synchro } from 'src/app/services/socket/synchro.service';
@Component({
selector: 'app-despachos-pr',
templateUrl: './despachos-pr.page.html',
@@ -48,6 +51,7 @@ export class DespachosPrPage implements OnInit {
loggeduser: LoginUserRespose;
skeletonLoader = true
despachoprstore = DespachosprStore
listToPresent = [];
constructor(
private processes: ProcessesService,
@@ -55,6 +59,7 @@ export class DespachosPrPage implements OnInit {
private alertService: AlertService,
private authService: AuthService,
private router: Router,
private sqliteservice: SqliteService
) {
this.loggeduser = authService.ValidatedUser;
@@ -65,22 +70,7 @@ export class DespachosPrPage implements OnInit {
ngOnInit() {
//Inicializar segment
this.segment = "despachos";
const location = window.location
const pathname = location.pathname + location.search
this.LoadList()
this.router.events.forEach((event) => {
if (event instanceof NavigationStart && event.url.startsWith(pathname)) {
if(window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) {
this.doRefresh()
} else {
this.LoadList()
}
}
});
this.getFromDB();
}
segmentChanged(ev: any) {
@@ -146,10 +136,74 @@ export class DespachosPrPage implements OnInit {
this.despachoList.push(task);
console.log(this.despachoList);
});
this.despachoprstore.reset(this.despachoList);
this.listToPresent = this.despachoList
}
getFromDB() {
if (synchro.connected === true) {
const location = window.location
const pathname = location.pathname + location.search
this.LoadList()
this.router.events.forEach((event) => {
if (event instanceof NavigationStart && event.url.startsWith(pathname)) {
if (window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) {
this.doRefresh()
} else {
this.LoadList()
}
}
});
} else {
this.sqliteservice.getAllProcess().then((all) => {
console.log('DESPACHO PR ALL', all)
})
this.sqliteservice.getprocessByworkflow('Despacho do Presidente da República').then(async (process: any[]) => {
console.log('DESPACHO PR', process)
let despachosPr;
switch (this.loggeduser.Profile) {
case 'MDGPR':
despachosPr = await process.reverse().filter(data => data.activityInstanceName == "Tarefa de Despacho");
break;
case 'PR':
console.log(process);
despachosPr = await process.reverse().filter(data => data.activityInstanceName == "Concluir Despacho");
break;
}
despachosPr = despachosPr.filter(data => JSON.parse(data.workflowInstanceDataFields).Status == "Active");
despachosPr.forEach((element, index) => {
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": JSON.parse(element.workflowInstanceDataFields).Subject,
"Senders": JSON.parse(element.workflowInstanceDataFields).Sender,
"CreateDate": taskDate,
"DocumentURL": JSON.parse(element.workflowInstanceDataFields).ViewerRequest,
"Remetente": JSON.parse(element.workflowInstanceDataFields).Remetente,
"DocumentsQty": element.totalDocuments,
"DocId": JSON.parse(element.workflowInstanceDataFields).DocIdDiferimento,
"WorkflowName": element.workflowDisplayName,
"activityInstanceName": element.activityInstanceName,
}
this.despachoList.push(task);
console.log(this.despachoList);
});
this.listToPresent = this.despachoList;
})
}
}
sortArrayISODate(myArray: any) {
return myArray.sort(function (a, b) {
return (a.CreateDate < b.CreateDate) ? -1 : ((a.CreateDate > b.CreateDate) ? 1 : 0);
@@ -33,8 +33,8 @@
<h5 *ngIf="intervenientes">Intervenientes</h5>
<ion-item class="ion-no-margin ion-no-padding">
<ion-label>
<div *ngFor="let interveniente of intervenientes">
<p>{{interveniente.Name}}</p>
<div *ngFor="let task of intervenientes">
<p>{{task.Name}}</p>
</div>
</ion-label>
</ion-item>
@@ -18,6 +18,10 @@ import { fullTask } from 'src/app/models/dailyworktask.model';
import { AttachmentList } from 'src/app/models/Excludetask';
import { PermissionService } from 'src/app/OtherService/permission.service';
import { synchro } from 'src/app/services/socket/synchro.service';
import { SqliteService } from 'src/app/services/sqlite.service';
import { Platform } from '@ionic/angular';
@Component({
selector: 'app-despacho',
templateUrl: './despacho.page.html',
@@ -41,6 +45,8 @@ export class DespachoPage implements OnInit {
intervenientes: any;
cc: any = [];
synch = synchro;
constructor(private activateRoute: ActivatedRoute,
private processes: ProcessesService,
private iab: InAppBrowser,
@@ -51,8 +57,12 @@ export class DespachoPage implements OnInit {
private toastService: ToastService,
private despachoService: DespachoService,
private location: Location,
public p: PermissionService) {
public p: PermissionService,
private sqliteservice: SqliteService,
private platform: Platform
) {
this.activatedRoute.paramMap.subscribe(params => {
if (params["params"].SerialNumber) {
this.serialnumber = params["params"].SerialNumber;
@@ -70,8 +80,8 @@ export class DespachoPage implements OnInit {
return;
}
});
this.getFromDb()
this.LoadTaskDetail(this.serialnumber)
}
close() {
@@ -112,6 +122,7 @@ export class DespachoPage implements OnInit {
async LoadTaskDetail(serial: string) {
this.processes.GetTask(serial).subscribe((res: fullTask) => {
console.log('despacho detail', res)
this.task = {
"SerialNumber": res.serialNumber,
"Folio": res.workflowInstanceDataFields.Subject,
@@ -129,17 +140,23 @@ export class DespachoPage implements OnInit {
"activityInstanceName": res.activityInstanceName,
"Status": res.workflowInstanceDataFields.Status,
}
this.sqliteservice.updateProcess(res);
this.fulltask = res;
let thedate = new Date(this.task.CreateDate);
this.customDate = this.days[thedate.getDay()] + ", " + thedate.getDate() + " de " + (this.months[thedate.getMonth()]);
this.processes.GetTaskParticipants(this.task.FolderID).subscribe(users => {
this.sqliteservice.updateProcessInterveners(JSON.stringify(this.serialnumber), JSON.stringify(users))
console.log('interveniers online', users)
this.intervenientes = users.filter(user => {
console.log('interveniers online 2', users)
return user.Type == 'I';
});
this.cc = users.filter(user => {
console.log('interveniers online 3', users)
return user.Type == 'CC';
});
});
@@ -158,10 +175,84 @@ export class DespachoPage implements OnInit {
});
}
getFromDb() {
if (synchro.connected === true) {
this.LoadTaskDetail(this.serialnumber)
}
if (synchro.connected === false) {
this.platform.ready().then(() => {
this.sqliteservice.getProcessById(this.serialnumber).then((process) => {
var workflow = JSON.parse(process[0].workflowInstanceDataFields);
var intervine = JSON.parse(process[0].interveners)
var origina
if (process[0].originator === "undefined") {
origina = ""
} else {
origina = JSON.parse(process[0].originator)
}
console.log('sqlite', process)
this.task = {
"SerialNumber": process[0].serialNumber,
"Folio": workflow.Subject,
"Senders": origina.email || process[0].originator,
"CreateDate": momentG(new Date(process[0].taskStartDate), 'yyyy-MM-dd HH:mm:ss'),
"DocumentURL": workflow.ViewerRequest,
"Remetente": workflow.Sender,
"Note": workflow.TaskMessage || workflow.Note,
"FolderId": workflow.FolderID,
"FsId": workflow.FsId,
"DocId": workflow.DocID,
"DocumentsQty": process[0].DocumentsQty,
"WorkflowName": process[0].workflowDisplayName,
"DeadlineType": workflow.DeadlineType,
"activityInstanceName": process[0].activityInstanceName,
"Status": workflow.Status,
}
let thedate = new Date(this.task.CreateDate);
this.customDate = this.days[thedate.getDay()] + ", " + thedate.getDate() + " de " + (this.months[thedate.getMonth()]);
let fulltak = {
Documents: JSON.parse(process[0].Documents),
actions: JSON.parse(process[0].actions),
activityInstanceName: process[0].activityInstanceName,
formURL: process[0].formURL,
originator: JSON.parse(process[0].originator),
serialNumber: process[0].serialNumber,
taskStartDate: process[0].taskStartDate,
totalDocuments: process[0].totalDocuments,
workflowDisplayName: process[0].workflowDisplayName,
workflowID: process[0].workflowID,
workflowInstanceDataFields: JSON.parse(process[0].workflowInstanceDataFields),
workflowInstanceFolio: process[0].workflowInstanceFolio,
workflowInstanceID: process[0].workflowInstanceID,
workflowName: process[0].workflowName
}
this.fulltask = fulltak;
console.log('interveniers offline', intervine)
this.intervenientes = intervine.filter(user => {
console.log('interveniers offline 2', user)
return user.Type == 'I';
});
this.cc = intervine.filter(user => {
console.log('interveniers offline 3', user)
return user.Type == 'CC';
});
})
})
}
}
viewDocument(docId: string) {
this.processes.GetDocumentUrl(docId, '361').subscribe(res => {
const url: string = res.replace("webTRIX.Viewer", "webTRIX.Viewer.Branch1");
const browser = this.iab.create('https://equilibrium.dyndns.info/FileShare/pdfjs/web/viewer.html?file=https://equilibrium.dyndns.info/FileShare/merged_fastview.pdf', "_blank", 'location=yes,x=0,y=200,width=437,height=650,fullscreen=no');
const browser = this.iab.create(url, "_blank");
browser.show();
});
}
@@ -33,7 +33,7 @@
<ion-list>
<div
class="expediente ion-no-padding ion-no-margin cursor-pointer"
*ngFor = "let task of despachoStore.list; let i = index"
*ngFor = "let task of listToPresent; let i = index"
(click)="GoToDespacho(task.SerialNumber)"
>
<!-- [routerLink]="['/home/gabinete-digital/expediente',task.SerialNumber]" -->
@@ -68,13 +68,13 @@
</div>
<div
*ngIf="!skeletonLoader && despachoStore.list.length == 0"
*ngIf="!skeletonLoader && listToPresent.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">
<div *ngIf="skeletonLoader && listToPresent.length == 0">
<ion-list>
<ion-item>
@@ -3,6 +3,11 @@ import { NavigationStart, Router } from '@angular/router';
import { DespachoService } from 'src/app/Rules/despacho.service';
import { DespachoStore } from 'src/app/store/despacho-store.service';
import { SqliteService } from 'src/app/services/sqlite.service';
import { synchro } from 'src/app/services/socket/synchro.service';
import { Platform } from '@ionic/angular';
import { isThisHour } from 'date-fns';
@Component({
selector: 'app-despachos',
templateUrl: './despachos.page.html',
@@ -12,31 +17,21 @@ import { DespachoStore } from 'src/app/store/despacho-store.service';
export class DespachosPage implements OnInit {
despachoStore = DespachoStore;
synch = synchro;
listToPresent = [];
constructor(
private router: Router,
private despachoRule: DespachoService
private despachoRule: DespachoService,
private sqliteservice: SqliteService,
private platform: Platform
) {
}
ngOnInit() {
const location = window.location
const pathname = location.pathname + location.search
this.LoadList()
this.router.events.forEach((event) => {
if (event instanceof NavigationStart && event.url.startsWith(pathname)) {
if(window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) {
this.refreshing()
} else {
this.LoadList()
}
}
});
this.getFromDb()
}
async refreshing() {
@@ -51,7 +46,60 @@ export class DespachosPage implements OnInit {
async LoadList() {
await this.despachoRule.getList({updateStore: true})
await this.despachoRule.getList({ updateStore: true }).then((pre) => {
this.listToPresent = pre;
console.log('despachooo', pre)
})
}
getFromDb() {
if (synchro.connected === true) {
const location = window.location
const pathname = location.pathname + location.search
this.LoadList()
this.router.events.forEach((event) => {
if (event instanceof NavigationStart && event.url.startsWith(pathname)) {
if (window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) {
this.refreshing()
} else {
this.LoadList()
}
}
});
}
if (synchro.connected === false) {
this.platform.ready().then(() => {
this.sqliteservice.getDespachosProcess('Tarefa de Despacho').then((process: any[]) => {
var listtopresent = [];
process.forEach(element => {
var workflow = JSON.parse(element.workflowInstanceDataFields);
let task = {
"CreateDate": element.taskStartDate,
"DocId": workflow.DispatchDocID,
"DocumentURL": undefined,
"DocumentsQty": element.totalDocuments,
"FolderID": workflow.FolderID,
"Folio": workflow.Subject,
"Remetente": undefined,
"Senders": workflow.Sender,
"SerialNumber": element.serialNumber,
"Status": workflow.Status,
"WorkflowName": element.workflowDisplayName
}
listtopresent.push(task);
});
this.listToPresent = listtopresent;
})
})
}
}
get skeletonLoader(): boolean {
@@ -67,7 +115,6 @@ export class DespachosPage implements OnInit {
}
async GoToDespacho(serialNumber: any) {
console.log('Despachos serial',serialNumber)
this.router.navigate(['/home/gabinete-digital/despachos', serialNumber, 'gabinete-digital']);
}
@@ -12,6 +12,9 @@ import { DeplomaOptionsPage } from 'src/app/shared/popover/deploma-options/deplo
import { ToastService } from 'src/app/services/toast.service';
import { Location } from '@angular/common';
import { SqliteService } from 'src/app/services/sqlite.service';
import { synchro } from 'src/app/services/socket/synchro.service';
@Component({
selector: 'app-diploma',
templateUrl: './diploma.page.html',
@@ -42,6 +45,7 @@ export class DiplomaPage implements OnInit {
private animationController: AnimationController,
private toastService: ToastService,
private location: Location,
private sqliteservice: SqliteService
) {
this.activatedRoute.paramMap.subscribe(params => {
// console.log(params["params"]);
@@ -59,7 +63,7 @@ export class DiplomaPage implements OnInit {
ngOnInit() {
this.profile = "mdgpr";
this.LoadTaskDetail(this.serialNumber);
this.getFromDb();
}
goBack() {
@@ -125,11 +129,15 @@ export class DiplomaPage implements OnInit {
"activityInstanceName": res.activityInstanceName,
}
this.fulltask = res;
this.sqliteservice.updateProcess(res)
let thedate = new Date(this.task.CreateDate);
this.customDate = this.days[thedate.getDay()]+ ", " + thedate.getDate() +" de " + ( this.months[thedate.getMonth()]);
this.processes.GetTaskParticipants(this.task.FolderId).subscribe(users=>{
this.sqliteservice.updateProcessInterveners(JSON.stringify(this.serialNumber), JSON.stringify(users)).then(() => {
console.log('internen diploma ')
})
this.intervenientes = users.filter(user=>{
return user.Type == 'I';
});
@@ -155,6 +163,62 @@ export class DiplomaPage implements OnInit {
}
getFromDb() {
if(synchro.connected === true) {
this.LoadTaskDetail(this.serialNumber);
} else {
this.sqliteservice.getProcessById(this.serialNumber).then((process) => {
this.task = {
"SerialNumber": process[0].serialNumber,
"Folio": JSON.parse(process[0].workflowInstanceDataFields).Subject,
"Senders": JSON.parse(process[0].originator).email,
"CreateDate": momentG(new Date(process[0].taskStartDate),'yyyy-MM-dd HH:mm:ss'),
"DocumentURL": JSON.parse(process[0].workflowInstanceDataFields).ViewerRequest,
"Remetente": JSON.parse(process[0].workflowInstanceDataFields).Sender,
"Note": JSON.parse(process[0].workflowInstanceDataFields).TaskMessage || JSON.parse(process[0].workflowInstanceDataFields).Note,
"FolderId": JSON.parse(process[0].workflowInstanceDataFields).FolderID,
"FsId": '361',
"DocId": JSON.parse(process[0].workflowInstanceDataFields).DispatchDocId,
"WorkflowName": process[0].workflowDisplayName,
"DeadlineType": JSON.parse(process[0].workflowInstanceDataFields).DeadlineType,
"activityInstanceName": process[0].activityInstanceName,
}
let fulltak = {
Documents: JSON.parse(process[0].Documents),
actions: JSON.parse(process[0].actions),
activityInstanceName: process[0].activityInstanceName,
formURL: process[0].formURL,
originator: JSON.parse(process[0].originator),
serialNumber: process[0].serialNumber,
taskStartDate: process[0].taskStartDate,
totalDocuments: process[0].totalDocuments,
workflowDisplayName: process[0].workflowDisplayName,
workflowID: process[0].workflowID,
workflowInstanceDataFields: JSON.parse(process[0].workflowInstanceDataFields),
workflowInstanceFolio: process[0].workflowInstanceFolio,
workflowInstanceID: process[0].workflowInstanceID,
workflowName: process[0].workflowName
}
this.fulltask = fulltak
let thedate = new Date(this.task.CreateDate);
this.customDate = this.days[thedate.getDay()]+ ", " + thedate.getDate() +" de " + ( this.months[thedate.getMonth()]);
this.intervenientes = JSON.parse(process[0].interveners).filter(user=>{
return user.Type == 'I';
});
this.cc = JSON.parse(process[0].interveners).filter(user=>{
return user.Type == 'CC';
});
this.attachments = JSON.parse(process[0].Documents)
})
}
}
viewDocument(docId:string){
this.processes.GetDocumentUrl(docId, '361').subscribe(res=>{
const url: string = res.replace("webTRIX.Viewer","webTRIX.Viewer.Branch1");
@@ -3,6 +3,9 @@ import { ActivatedRoute, NavigationEnd, NavigationError, NavigationExtras, Navig
import { DailyWorkTask } from '../../../models/dailyworktask.model';
import { ProcessesService } from 'src/app/services/processes.service';
import { SqliteService } from 'src/app/services/sqlite.service';
import { synchro } from 'src/app/services/socket/synchro.service';
@Component({
selector: 'app-diplomas',
templateUrl: './diplomas.page.html',
@@ -24,6 +27,7 @@ export class DiplomasPage implements OnInit, OnDestroy {
private processes: ProcessesService,
private router: Router,
private activatedRoute: ActivatedRoute,
private sqliteservice: SqliteService
) {
this.diplomasList = [];
//Inicializar segment
@@ -50,20 +54,7 @@ export class DiplomasPage implements OnInit, OnDestroy {
}
});
const location = window.location
const pathname = location.pathname + location.search
this.LoadList()
this.router.events.forEach((event) => {
if (event instanceof NavigationStart && event.url.startsWith(pathname)) {
if(window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) {
this.refreshing()
} else {
this.LoadList()
}
}
});
this.getFromDb()
}
@@ -192,6 +183,49 @@ export class DiplomasPage implements OnInit, OnDestroy {
}
getFromDb() {
if (synchro.connected === true) {
const location = window.location
const pathname = location.pathname + location.search
this.LoadList()
this.router.events.forEach((event) => {
if (event instanceof NavigationStart && event.url.startsWith(pathname)) {
if (window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) {
this.refreshing()
} else {
this.LoadList()
}
}
});
} else {
this.sqliteservice.getprocessByworkflow("Despacho do Presidente da República").then((process: any[]) => {
let diplomasValidar = process.filter(data => data.activityInstanceName == "Revisar Diploma");
let diplomasList = [];
diplomasValidar.forEach(async element => {
let task = this.pipeTaskOffline(element)
diplomasList.push(task);
});
this.diplomasList = this.sortArrayISODate(diplomasList.reverse());
let diplomasAssinados = process.reverse().filter(data => data.activityInstanceName == "Diploma Assinado");
let diplomasAssinadoList = []
diplomasAssinados.forEach(async element => {
let task = this.pipeTaskOffline(element)
diplomasAssinadoList.push(task);
});
console.log('diplomasAssinados', diplomasAssinados)
this.diplomasAssinadoList = this.sortArrayISODate(diplomasAssinadoList).reverse();
})
}
}
pipeTask(element) {
let date = new Date(element.taskStartDate);
date.setMonth(date.getMonth() + 1);
@@ -212,6 +246,26 @@ export class DiplomasPage implements OnInit, OnDestroy {
}
}
pipeTaskOffline(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();
return {
"SerialNumber": element.serialNumber,
"Folio": JSON.parse(element.workflowInstanceDataFields).Subject,
"Senders": JSON.parse(element.workflowInstanceDataFields).Sender,
"CreateDate": taskDate,
"DocumentURL": JSON.parse(element.workflowInstanceDataFields).ViewerRequest,
"Remetente": JSON.parse(element.workflowInstanceDataFields).Remetente,
"DocumentsQty": element.totalDocuments,
"DocId": JSON.parse(element.workflowInstanceDataFields).DocIdDiferimento,
"WorkflowName": element.workflowDisplayName,
"activityInstanceName": element.activityInstanceName,
"Status": JSON.parse(element.workflowInstanceDataFields).Status,
}
}
sortArrayISODate(myArray: any) {
return myArray.sort(function (a, b) {
return (a.CreateDate < b.CreateDate) ? -1 : ((a.CreateDate > b.CreateDate) ? 1 : 0);
@@ -79,8 +79,7 @@ export class ApproveEventPage implements OnInit {
console.log(this.serialNumber);
console.log(this.caller);
this.getProcessFromDB();
console.log("Aprove enet")
//this.getTask();
}
goBack() {
@@ -106,6 +105,10 @@ export class ApproveEventPage implements OnInit {
getProcessFromDB() {
if (synchro.connected === true) {
this.getTask();
}
synchro.registerCallback('Offline', () => {
this.platform.ready().then(() => {
@@ -46,13 +46,24 @@ export class EventListPage implements OnInit {
) { }
ngOnInit() {
this.segment = 'MDGPR';
const location = window.location
const pathname = location.pathname + location.search
this.getEventToAproveFromDB();
window.onresize = (event) => {
// if not mobile remove all component
if( window.innerWidth <= 800){
this.modalController.dismiss();
}
};
}
getEventToAproveFromDB() {
if( synchro.connected === true) {
const location = window.location
const pathname = location.pathname + location.search
this.LoadToApproveEvents()
@@ -65,18 +76,7 @@ export class EventListPage implements OnInit {
}
}
});
window.onresize = (event) => {
// if not mobile remove all component
if( window.innerWidth <= 800){
this.modalController.dismiss();
}
};
}
getEventToAproveFromDB() {
synchro.registerCallback('Offline', () => {
this.platform.ready().then(() => {
@@ -86,9 +86,6 @@ export class ExpedienteDetailPage implements OnInit {
ngOnInit() {
this.getFromDB();
if(this.onlinecheck) {
this.LoadTaskDetail(this.serialNumber);
}
}
@@ -102,9 +99,9 @@ export class ExpedienteDetailPage implements OnInit {
getFromDB() {
synchro.registerCallback('Online', () => {
this.onlinecheck = true;
})
if(synchro.connected === true) {
this.LoadTaskDetail(this.serialNumber);
}
synchro.registerCallback('Offline', () => {
@@ -114,12 +111,17 @@ export class ExpedienteDetailPage implements OnInit {
console.log("expedient ditail", process)
var workflow = JSON.parse(process[0].workflowInstanceDataFields);
var origina = JSON.parse(process[0].originator)
var origina
if (process[0].originator === "undefined") {
origina = ""
} else {
origina = JSON.parse(process[0].originator)
}
this.task = {
"SerialNumber": process[0].serialNumber,
"Folio": workflow.Subject,
"Senders": origina.email,
"Senders": origina.email || process[0].originator,
"CreateDate": momentG(new Date(process[0].taskStartDate), 'yyyy-MM-dd HH:mm:ss'),
"DocumentURL": workflow.ViewerRequest,
"Remetente": workflow.Sender,
@@ -39,12 +39,10 @@ export class ExpedientePage implements OnInit {
ngOnInit() {
const location = window.location
const pathname = location.pathname + location.search
this.getEventsFromLocalDb();
console.log("segrsgre")
<<<<<<< HEAD
this.LoadList()
@@ -58,6 +56,8 @@ export class ExpedientePage implements OnInit {
}
});
=======
>>>>>>> branchBug
}
async LoadList() {
@@ -74,6 +74,7 @@ export class ExpedientePage implements OnInit {
let task = this.expedienteTaskPipe.transform(element)
this.taskslist.push(task);
this.sqliteservice.addProcess(task);
});
this.listToPresent = this.taskslist
@@ -136,17 +137,25 @@ export class ExpedientePage implements OnInit {
getEventsFromLocalDb() {
synchro.registerCallback('Online', () => {
this.onlinecheck = true;
})
if (synchro.connected === true) {
const location = window.location
const pathname = location.pathname + location.search
this.LoadList()
synchro.registerCallback('Offline', () => {
this.platform.ready().then(() => {
this.onlinecheck = false;
this.router.events.forEach((event) => {
if (event instanceof NavigationStart && event.url.startsWith(pathname)) {
if (window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) {
this.refreshing()
} else {
this.LoadList()
}
}
});
} else {
this.taskslist = new Array();
this.sqliteservice.getprocessByworkflow("Expediente").then((expediente: any[]) => {
console.log("All expedientes from local,", expediente)
expediente.forEach((element) => {
@@ -168,12 +177,9 @@ export class ExpedientePage implements OnInit {
});
this.listToPresent = this.taskslist
console.log("All expedientes from local,", expediente)
})
console.log('Offlineee')
})
})
}
}
}
@@ -176,33 +176,9 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
this.segmentVista = "boxview"
}
const pathname = window.location.pathname
this.getAllProcessFromDB()
this.router.events.forEach((event) => {
if (event instanceof NavigationEnd && event.url == pathname) {
this.waitForDomService.selector({
selector: 'app-gabinete-digital ion-content .aside-wrapper',
callback: () => {
this.checkRoutes();
this.LoadCounts();
}
})
}
});
this.hideRefreshButton();
this.waitForDomService.selector({
selector: 'app-gabinete-digital ion-content .aside-wrapper',
callback: () => {
this.loadAllProcesses();
}
})
}
async loadAllProcesses() {
@@ -247,7 +223,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
this.allProcessesList = removeDuplicate(this.allProcessesList)
this.allProcessesList = this.sortArrayISODate(this.allProcessesList).reverse();
this.totalDocumentStore.resetCount(this.allProcessesList.length)
});
@@ -283,14 +259,31 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
getAllProcessFromDB() {
synchro.registerCallback('Online', () => {
this.platform.ready().then(() => {
this.loadAllProcesses();
})
})
if (synchro.connected === true ) {
const pathname = window.location.pathname
this.router.events.forEach((event) => {
if (event instanceof NavigationEnd && event.url == pathname) {
synchro.registerCallback('Offline', () => {
this.platform.ready().then(() => {
this.waitForDomService.selector({
selector: 'app-gabinete-digital ion-content .aside-wrapper',
callback: () => {
this.checkRoutes();
this.LoadCounts();
}
})
}
});
this.hideRefreshButton();
this.waitForDomService.selector({
selector: 'app-gabinete-digital ion-content .aside-wrapper',
callback: () => {
this.loadAllProcesses();
}
})
} else {
this.hideRefreshButton();
this.sqliteservice.getAllProcess().then((allprocess: any[]) => {
allprocess.forEach(element => {
@@ -299,7 +292,6 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
let taskDate = date.getFullYear() + "-" + date.getMonth() + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
var workflowInstanceDataFields = JSON.parse(element.workflowInstanceDataFields);
console.log("WORKFLOW all process", workflowInstanceDataFields)
let task = {
"SerialNumber": element.serialNumber,
@@ -322,14 +314,10 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
this.allProcessesList = removeDuplicate(this.allProcessesList)
this.allProcessesList = this.sortArrayISODate(this.allProcessesList).reverse();
this.totalDocumentStore.resetCount(this.allProcessesList.length)
});
console.log("All process from db ", allprocess)
})
})
console.log('Offlineee')
})
}
}
sortArrayISODate(myArray: any) {
@@ -547,7 +535,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
let allPreocesses_ = await this.processesbackend.GetTasksList("", false).toPromise();
let count_all_processes = Object.keys(allPreocesses_).length;
this.totalDocumentStore.resetCount(count_all_processes)
let expedientes = await this.processesbackend.GetTaskListExpediente(false).toPromise();
expedientes = expedientes.filter(data => data.workflowInstanceDataFields.Status == "Active")
@@ -20,6 +20,9 @@ import { PermissionService } from 'src/app/OtherService/permission.service';
import { Location } from '@angular/common';
import { PedidoService } from 'src/app/Rules/pedido.service';
import { SqliteService } from 'src/app/services/sqlite.service';
import { synchro } from 'src/app/services/socket/synchro.service';
@Component({
selector: 'app-pedido',
@@ -55,7 +58,8 @@ export class PedidoPage implements OnInit {
private toastService: ToastService,
public p: PermissionService,
private location: Location,
private pedidoService: PedidoService
private pedidoService: PedidoService,
private sqliteservice: SqliteService,
) {
this.loggeduser = authService.ValidatedUser;
@@ -73,7 +77,7 @@ export class PedidoPage implements OnInit {
}
ngOnInit() {
this.LoadTaskDetail(this.serialnumber);
this.getfromDb()
}
close() {
@@ -91,6 +95,7 @@ export class PedidoPage implements OnInit {
this.processes.GetTask(this.serialnumber).subscribe(res => {
this.fulltask = res
console.log('FULLTAK ONLINe', this.fulltask);
if (res.workflowDisplayName == 'Pedido de Parecer' || res.workflowDisplayName == 'Pedido de Parecer do Presidente') {
@@ -116,6 +121,7 @@ export class PedidoPage implements OnInit {
"Status": res.workflowInstanceDataFields.Status,
}
console.log(this.task);
this.sqliteservice.updateProcess(res);
}
else if (res.workflowDisplayName == 'Pedido de Deferimento') {
@@ -140,12 +146,16 @@ export class PedidoPage implements OnInit {
"activityInstanceName": res.activityInstanceName,
"Status": res.workflowInstanceDataFields.Status,
}
this.sqliteservice.updateProcess(res);
}
let thedate = new Date(res.taskStartDate);
this.customDate = this.days[thedate.getDay()] + ", " + thedate.getDate() + " de " + (this.months[thedate.getMonth()]);
this.processes.GetTaskParticipants(res.workflowInstanceDataFields.FolderID).subscribe(users => {
this.sqliteservice.updateProcessInterveners(JSON.stringify(this.serialnumber), JSON.stringify(users)).then(() =>{
console.log('Pedido ')
})
this.intervenientes = users.filter(user => {
return user.Type == 'I';
});
@@ -171,10 +181,104 @@ export class PedidoPage implements OnInit {
});
}
getfromDb() {
if (synchro.connected === true) {
this.LoadTaskDetail(this.serialnumber);
}
if (synchro.connected === false) {
this.sqliteservice.getProcessById(this.serialnumber).then((process) => {
console.log('PROCESS BY ID', process,this.serialnumber )
let fulltak = {
Documents: JSON.parse(process[0].Documents),
actions: JSON.parse(process[0].actions),
activityInstanceName: process[0].activityInstanceName,
formURL: process[0].formURL,
originator: JSON.parse(process[0].originator),
serialNumber: process[0].serialNumber,
taskStartDate: process[0].taskStartDate,
totalDocuments: process[0].totalDocuments,
workflowDisplayName: process[0].workflowDisplayName,
workflowID: process[0].workflowID,
workflowInstanceDataFields: JSON.parse(process[0].workflowInstanceDataFields),
workflowInstanceFolio: process[0].workflowInstanceFolio,
workflowInstanceID: process[0].workflowInstanceID,
workflowName: process[0].workflowName
}
this.fulltask = fulltak;
console.log('FULLTAK OFFLINE', this.fulltask);
if (process[0].workflowDisplayName == 'Pedido de Parecer' || process[0].workflowDisplayName == 'Pedido de Parecer do Presidente') {
let date = new Date(process[0].taskStartDate);
date.setMonth(date.getMonth() + 1);
let taskDate = date.getFullYear() + "-" + date.getMonth() + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
this.task = {
"SerialNumber": process[0].serialNumber,
"Folio": JSON.parse(process[0].workflowInstanceDataFields).Subject,
"Senders": JSON.parse(process[0].workflowInstanceDataFields).Sender,
"CreateDate": taskDate,
"DocumentURL": JSON.parse(process[0].workflowInstanceDataFields).ViewerRequest,
"Remetente": JSON.parse(process[0].workflowInstanceDataFields).Sender,
"Note": JSON.parse(process[0].workflowInstanceDataFields).TaskMessage,
"FolderId": JSON.parse(process[0].workflowInstanceDataFields).FolderID,
"FsId": '361',
"DocId": JSON.parse(process[0].workflowInstanceDataFields).DocIdDeferimento,
"WorkflowName": process[0].workflowDisplayName,
"DeadlineType": JSON.parse(process[0].workflowInstanceDataFields).DeadlineType,
"ProcessInstanceID": JSON.parse(process[0].workflowInstanceDataFields).InstanceID,
"activityInstanceName": process[0].activityInstanceName,
"Status": JSON.parse(process[0].workflowInstanceDataFields).Status,
}
this.attachments = JSON.parse(process[0].Documents);
} else if (process[0].workflowDisplayName == 'Pedido de Deferimento') {
let date = new Date(process[0].taskStartDate);
date.setMonth(date.getMonth() + 1);
let taskDate = date.getFullYear() + "-" + date.getMonth() + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
this.task = {
"SerialNumber": process[0].serialNumber,
"Folio": JSON.parse(process[0].workflowInstanceDataFields).Subject,
"Senders": JSON.parse(process[0].workflowInstanceDataFields).Sender,
"CreateDate": taskDate,
"DocumentURL": JSON.parse(process[0].workflowInstanceDataFields).ViewerRequest,
"Remetente": JSON.parse(process[0].workflowInstanceDataFields).Sender,
"Note": JSON.parse(process[0].workflowInstanceDataFields).TaskMessage,
"FolderId": JSON.parse(process[0].workflowInstanceDataFields).FolderID,
"FsId": '361',
"DocId": JSON.parse(process[0].workflowInstanceDataFields).DocIdDeferimento,
"WorkflowName": process[0].workflowDisplayName,
"DeadlineType": JSON.parse(process[0].workflowInstanceDataFields).DeadlineType,
"ProcessInstanceID": JSON.parse(process[0].workflowInstanceDataFields).InstanceID,
"activityInstanceName": process[0].activityInstanceName,
"Status": JSON.parse(process[0].workflowInstanceDataFields).Status,
}
this.attachments = JSON.parse(process[0].Documents);
}
let thedate = new Date(process[0].taskStartDate);
this.customDate = this.days[thedate.getDay()] + ", " + thedate.getDate() + " de " + (this.months[thedate.getMonth()]);
this.intervenientes = JSON.parse(process[0].interveners).filter(user => {
return user.Type == 'I';
});
this.cc = JSON.parse(process[0].interveners).filter(user => {
return user.Type == 'CC';
});
this.getDocumentDetails(JSON.parse(process[0].workflowInstanceDataFields).FolderID, '361');
})
}
}
getDocumentDetails(forlderId: string, applicationId: string) {
this.processes.GetDocumentDetails(forlderId, applicationId).subscribe(res => {
this.attachments = res.Documents;
// console.log(res['Documents']);
console.log('Attachment',this.attachments);
})
}
@@ -247,7 +351,8 @@ export class PedidoPage implements OnInit {
const loader = this.toastService.loading()
try {
await this.pedidoService.arquivar({serialNumber: this.serialnumber,
await this.pedidoService.arquivar({
serialNumber: this.serialnumber,
documents,
note
}).toPromise()
@@ -38,13 +38,13 @@
<div class="width-100" [ngSwitch]="segment">
<ion-progress-bar type="indeterminate" *ngIf="skeletonLoader"></ion-progress-bar>
<div *ngIf="pedidosstorage.listparecer">
<div *ngIf="listToPresentparecerList">
<ion-list *ngSwitchCase="'parecer'">
<!-- *ngFor = "let task of pedidosstorage.listparecer; let i = index"
(click)="viewExpedientDetail(task.SerialNumber)" -->
<div
class="expediente ion-no-padding ion-no-margin cursor-pointer"
*ngFor = "let task of pedidosstorage.listparecer"
*ngFor = "let task of listToPresentparecerList"
(click)="goToPedido(task.SerialNumber)"
>
<!-- (click)="viewExpedientDetail(task.SerialNumber)" -->
@@ -77,11 +77,11 @@
</ion-list>
</div>
<div *ngIf="pedidosstorage.listdeferimento">
<div *ngIf="listToPresentdeferimentoList">
<ion-list *ngSwitchCase="'deferimento'">
<div
class="expediente ion-no-padding ion-no-margin cursor-pointer"
*ngFor = "let task of pedidosstorage.listdeferimento"
*ngFor = "let task of listToPresentdeferimentoList"
(click)="goToPedido(task.SerialNumber)"
>
<!-- (click)="viewExpedientDetail(task.SerialNumber)" -->
@@ -7,6 +7,10 @@ import { ModalController, NavParams } from '@ionic/angular';
import { AlertService } from 'src/app/services/alert.service';
import { PedidosStore } from 'src/app/store/pedidos-store.service';
import { ModalService } from 'src/app/services/modal.service';
import { SqliteService } from 'src/app/services/sqlite.service';
import { synchro } from 'src/app/services/socket/synchro.service';
@Component({
selector: 'app-pedidos',
templateUrl: './pedidos.page.html',
@@ -18,6 +22,8 @@ export class PedidosPage implements OnInit {
taskslist:DailyWorkTask[] = [];
parecerList:any[] = [];
listToPresentparecerList: any[] = [];
listToPresentdeferimentoList: any[] = [];
fulltask:any;
parecerListResult:customTask[] = [];
@@ -38,7 +44,8 @@ export class PedidosPage implements OnInit {
private modalController: ModalController,
private alertService: AlertService,
private activatedRoute: ActivatedRoute,
private modalService: ModalService
private modalService: ModalService,
private sqliteservice: SqliteService
) {
//Inicializar segment
this.segment = 'parecer';
@@ -57,21 +64,7 @@ export class PedidosPage implements OnInit {
}
ngOnInit() {
this.LoadList()
this.router.events.forEach((event) => {
if(event instanceof NavigationStart && '/home/gabinete-digital/pedidos?parecer=true'.startsWith(event.url) ||
event instanceof NavigationStart && '/home/gabinete-digital/pedidos?deferimento=true'.startsWith(event.url)
) {
if(window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) {
this.refreshing()
} else {
this.LoadList()
}
}
});
this.getFromDb();
}
goBack() {
@@ -141,7 +134,8 @@ export class PedidosPage implements OnInit {
}
this.parecerList.push(task);
});
this.pedidosstorage.resetparecer(this.parecerList);
this.sqliteservice.addProcess(this.parecerList);
this.listToPresentparecerList = this.parecerList
}
else if(this.segment == 'deferimento') {
@@ -181,7 +175,8 @@ export class PedidosPage implements OnInit {
});
this.pedidosstorage.resetdeferimento(this.deferimentoList);
this.sqliteservice.addProcess(this.deferimentoList);
this.listToPresentdeferimentoList = this.deferimentoList
});
@@ -189,6 +184,83 @@ export class PedidosPage implements OnInit {
}
getFromDb() {
if(synchro.connected === true) {
this.LoadList()
this.router.events.forEach((event) => {
if(event instanceof NavigationStart && '/home/gabinete-digital/pedidos?parecer=true'.startsWith(event.url) ||
event instanceof NavigationStart && '/home/gabinete-digital/pedidos?deferimento=true'.startsWith(event.url)
) {
if(window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) {
this.refreshing()
} else {
this.LoadList()
}
}
});
}
if(synchro.connected === false) {
let parecerlist = [];
let deferimentolist = []
this.sqliteservice.getprocessByworkflowpedido("Pedido de Parecer", "Pedido de Parecer do Presidente").then((process: any[]) => {
process.forEach((element) => {
if(JSON.parse(element.workflowInstanceDataFields).Status == "Active") {
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": JSON.parse(element.workflowInstanceDataFields).Subject,
"Senders": JSON.parse(element.workflowInstanceDataFields).Sender,
"CreateDate": taskDate,
"DocumentURL": JSON.parse(element.workflowInstanceDataFields).ViewerRequest,
"Remetente": JSON.parse(element.workflowInstanceDataFields).Remetente,
"DocumentsQty": element.totalDocuments,
"DocId": JSON.parse(element.workflowInstanceDataFields).DocIdDiferimento,
"WorkflowName": element.workflowDisplayName,
"activityInstanceName": element.activityInstanceName,
}
parecerlist.push(task)
}
})
this.listToPresentparecerList = parecerlist;
console.log('parecer',process)
})
this.sqliteservice.getprocessByworkflow("Pedido de Deferimento").then((process: any[]) => {
process.forEach((element) => {
if(JSON.parse(element.workflowInstanceDataFields).Status == "Active") {
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": JSON.parse(element.workflowInstanceDataFields).Subject,
"Senders": JSON.parse(element.workflowInstanceDataFields).Sender,
"CreateDate": taskDate,
"DocumentURL": JSON.parse(element.workflowInstanceDataFields).ViewerRequest,
"Remetente": JSON.parse(element.workflowInstanceDataFields).Remetente,
"DocumentsQty": element.totalDocuments,
"DocId": JSON.parse(element.workflowInstanceDataFields).DocIdDiferimento,
"WorkflowName": element.workflowDisplayName,
"activityInstanceName": element.activityInstanceName,
}
deferimentolist.push(task)
}
})
this.listToPresentdeferimentoList = deferimentolist;
console.log('deferimento',process)
})
}
}
segmentChanged(ev: any) {
this.LoadList();
}
@@ -27,7 +27,7 @@
</ion-refresher>
<app-task-list class="height-100"
[taskList] = pendentesstore.list
[taskList] = listToPresent
[skeletonLoader] = skeletonLoader
(viewTaskDetail)="viewTaskDetails($event)"
> </app-task-list>
@@ -10,6 +10,10 @@ import { LoginUserRespose } from 'src/app/models/user.model';
import { AuthService } from 'src/app/services/auth.service';
import { CustomTaskPipe } from 'src/app/pipes/custom-task.pipe';
import { SqliteService } from 'src/app/services/sqlite.service';
import { synchro } from 'src/app/services/socket/synchro.service';
import { Platform } from '@ionic/angular';
@Component({
selector: 'app-pendentes',
@@ -30,6 +34,9 @@ export class PendentesPage implements OnInit {
skeletonLoader = true
pendentesstore = PendentesStore;
customTaskPipe = new CustomTaskPipe()
listToPresent = [];
synch = synchro
constructor(
private processes: ProcessesService,
@@ -37,6 +44,8 @@ export class PendentesPage implements OnInit {
private router: Router,
private authService: AuthService,
private activatedRoute: ActivatedRoute,
private sqliteservice: SqliteService,
private platform: Platform
) {
this.loggeduser = authService.ValidatedUser;
this.profile = 'mdgpr';
@@ -45,21 +54,7 @@ export class PendentesPage implements OnInit {
ngOnInit() {
//Inicializar segment
this.segment = "despachos";
const location = window.location
const pathname = location.pathname + location.search
this.LoadList()
this.router.events.forEach((event) => {
if (event instanceof NavigationEnd && event.url.startsWith(pathname)) {
if(window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) {
this.refreshing()
} else {
this.LoadList()
}
}
});
this.getFromDb();
}
@@ -89,8 +84,7 @@ export class PendentesPage implements OnInit {
pendentesList = removeDuplicate(pendentesList)
pendentesList = this.sortArrayISODate(pendentesList);
this.pendentesstore.reset(pendentesList);
this.listToPresent = pendentesList;
this.skeletonLoader = false;
}
@@ -101,6 +95,56 @@ export class PendentesPage implements OnInit {
});
}
getFromDb() {
if (synchro.connected === true) {
const location = window.location
const pathname = location.pathname + location.search
this.LoadList()
this.router.events.forEach((event) => {
if (event instanceof NavigationEnd && event.url.startsWith(pathname)) {
if (window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) {
this.refreshing()
} else {
this.LoadList()
}
}
});
}
synchro.registerCallback('Offline', () => {
this.platform.ready().then(() => {
this.sqliteservice.getAllProcess().then((process: any[]) => {
var pendingList = []
process.forEach(element => {
var workflow = JSON.parse(element.workflowInstanceDataFields);
if (workflow.Status === "Pending") {
let task = {
"CreateDate": element.taskStartDate,
"DocumentsQty": element.totalDocuments,
"FolderID": workflow.FolderID,
"Folio": workflow.Subject,
"Senders": workflow.Sender,
"SerialNumber": element.serialNumber,
"Status": workflow.Status,
"WorkflowName": element.workflowDisplayName
}
pendingList.push(task)
}
});
pendingList = this.sortArrayISODate(pendingList);
this.listToPresent = pendingList;
console.log('pendentes', pendingList)
})
})
})
}
async refreshing() {
setTimeout(() => {
this.LoadList();
+6 -9
View File
@@ -85,21 +85,17 @@ class SynchroService {
//if(!this._connected) {
if(!this._connected === true) {
this.BackgroundService.online()
console.log('Online',this._connected)
this.callBacks.forEach((e)=>{
if(e.type == 'Online') {
e.funx()
}
})
//}
}
console.log('open ======================= welcome to socket server')
this.eventtrigger.publishSomeData({
internet: "online"
})
this._connected = true
@@ -185,14 +181,15 @@ class SynchroService {
// if(this._connected){
if(this._connected === false){
this.BackgroundService.offline();
console.log('Offline',this._connected)
this.callBacks.forEach((e)=>{
if(e.type == 'Offline') {
e.funx()
}
})
//}
}
// status
+39 -1
View File
@@ -94,7 +94,8 @@ export class SqliteService {
workflowID INTERGER,
workflowInstanceDataFields Text,
workflowInstanceID INTERGER,
workflowName varchar(255)
workflowName varchar(255),
interveners Text
)`, [])
.then((res) => {
console.log("Sucess AllProcess Table created: ", res)
@@ -168,6 +169,13 @@ export class SqliteService {
console.log("process attachment updated")
})
}
//updateAttachment
updateProcessInterveners(id, interveners,) {
let data = [document];
return this.dbInstance.executeSql(`UPDATE ${this.allprocess} SET interveners = ? WHERE serialNumber = ${id}`, [interveners]).then(() => {
console.log("process interveners updated")
})
}
//getAllEvents
getAllEvents() {
var hashattachment = false;
@@ -264,6 +272,21 @@ export class SqliteService {
});
}
//getDespachosProcess
getDespachosProcess(process) {
return this.dbInstance.executeSql(`SELECT * FROM ${this.allprocess} WHERE activityInstanceName = ?`, [process]).then((res) => {
this.ALLPROCESS = [];
if (res.rows.length > 0) {
for (var i = 0; i < res.rows.length; i++) {
this.ALLPROCESS.push(res.rows.item(i));
}
return this.ALLPROCESS;
}
}, (e) => {
console.log(" Get all process error", JSON.stringify(e));
});
}
//getprocessByworkflow
getprocessByworkflow(process) {
return this.dbInstance.executeSql(`SELECT * FROM ${this.allprocess} WHERE workflowDisplayName = ? `, [process]).then((res) => {
@@ -279,6 +302,21 @@ export class SqliteService {
});
}
//getprocessByworkflowpedido
getprocessByworkflowpedido(process, process2) {
return this.dbInstance.executeSql(`SELECT * FROM ${this.allprocess} WHERE workflowDisplayName = ? OR workflowDisplayName = ? `, [process, process2]).then((res) => {
this.ALLPROCESS = [];
if (res.rows.length > 0) {
for (var i = 0; i < res.rows.length; i++) {
this.ALLPROCESS.push(res.rows.item(i));
}
return this.ALLPROCESS;
}
}, (e) => {
console.log(" Get all process error", JSON.stringify(e));
});
}
getProcessById(serial) {
return this.dbInstance.executeSql(`SELECT * FROM ${this.allprocess} WHERE serialNumber = ? `, [serial]).then((res) => {
this.PROCESS = [];
@@ -33,38 +33,7 @@ export class AllProcessesPage implements OnInit {
ngOnInit() {
this.sqliteservice.getAllProcess().then((allprocess: any[]) => {
this.allProcessesList = allprocess;
console.log("All process from db ", allprocess)
})
/* synchro.registerCallback('Online', () => {
this.platform.ready().then(() => {
this.loadAllProcesses();
this.router.events.forEach((event) => {
if (event instanceof NavigationStart && event.url.startsWith('/home/gabinete-digital')) {
if (window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) {
this.refreshing();
} else {
this.loadAllProcesses();
}
}
});
})
})
synchro.registerCallback('Offline', () => {
this.platform.ready().then(() => {
this.sqliteservice.getAllProcess().then((allprocess: any[]) => {
this.allProcessesList = allprocess;
console.log("All process from db ", allprocess)
})
})
console.log('Offlineee')
}) */
this.getAllProcessFromDB()
}
doRefresh() {
@@ -150,8 +119,7 @@ export class AllProcessesPage implements OnInit {
getAllProcessFromDB() {
synchro.registerCallback('Online', () => {
this.platform.ready().then(() => {
if(synchro.connected === true) {
this.loadAllProcesses();
this.router.events.forEach((event) => {
@@ -163,12 +131,7 @@ export class AllProcessesPage implements OnInit {
}
}
});
})
})
synchro.registerCallback('Offline', () => {
this.platform.ready().then(() => {
} else {
this.sqliteservice.getAllProcess().then((allprocess: any[]) => {
allprocess.forEach(element => {
let date = new Date(element.taskStartDate);
@@ -176,7 +139,6 @@ export class AllProcessesPage implements OnInit {
let taskDate = date.getFullYear() + "-" + date.getMonth() + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
var workflowInstanceDataFields = JSON.parse(element.workflowInstanceDataFields);
console.log("WORKFLOW all process", workflowInstanceDataFields)
let task = {
"SerialNumber": element.serialNumber,
@@ -206,9 +168,7 @@ export class AllProcessesPage implements OnInit {
this.allProcessesList = allprocess;
console.log("All process from db ", allprocess)
})
})
console.log('Offlineee')
})
}
}
sortArrayISODate(myArray: any) {