mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-21 05:45:50 +00:00
Gabinete digital offline complete
This commit is contained in:
@@ -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,34 +3,38 @@ 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',
|
||||
styleUrls: ['./diplomas.page.scss'],
|
||||
})
|
||||
export class DiplomasPage implements OnInit, OnDestroy {
|
||||
list:DailyWorkTask[] = [];
|
||||
diplomasList:DailyWorkTask[] = [];
|
||||
diplomasAssinadoList:DailyWorkTask[] = [];
|
||||
list: DailyWorkTask[] = [];
|
||||
diplomasList: DailyWorkTask[] = [];
|
||||
diplomasAssinadoList: DailyWorkTask[] = [];
|
||||
showLoader: boolean;
|
||||
totalDocs:any;
|
||||
serialNumber:string;
|
||||
totalDocs: any;
|
||||
serialNumber: string;
|
||||
|
||||
segment:string;
|
||||
segment: string;
|
||||
|
||||
skeletonLoader = true
|
||||
|
||||
constructor(
|
||||
private processes:ProcessesService,
|
||||
private processes: ProcessesService,
|
||||
private router: Router,
|
||||
private activatedRoute: ActivatedRoute,
|
||||
private sqliteservice: SqliteService
|
||||
) {
|
||||
this.diplomasList = [];
|
||||
//Inicializar segment
|
||||
this.segment = 'validar';
|
||||
|
||||
this.activatedRoute.queryParams.subscribe(params => {
|
||||
if(params['validar'] == 'true') {
|
||||
if (params['validar'] == 'true') {
|
||||
this.segment = 'validar';
|
||||
} else if (params['assinados'] == 'true') {
|
||||
this.segment = 'assinados';
|
||||
@@ -43,27 +47,14 @@ export class DiplomasPage implements OnInit, OnDestroy {
|
||||
//this.segment = 'validar';
|
||||
this.activatedRoute.queryParams.subscribe(params => {
|
||||
|
||||
if(params['segment'] == 'validar') {
|
||||
if (params['segment'] == 'validar') {
|
||||
this.segment = 'validar';
|
||||
} else if (params['segment'] == 'assinados') {
|
||||
this.segment = 'assinados';
|
||||
}
|
||||
});
|
||||
|
||||
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()
|
||||
|
||||
}
|
||||
|
||||
@@ -141,7 +132,7 @@ export class DiplomasPage implements OnInit, OnDestroy {
|
||||
});
|
||||
} */
|
||||
|
||||
async getTotalDocs(DocId:any) {
|
||||
async getTotalDocs(DocId: any) {
|
||||
let res = await this.processes.GetDocumentDetails(DocId, '361').toPromise();
|
||||
console.log(res.DocumentsTotal);
|
||||
return res.DocumentsTotal;
|
||||
@@ -155,7 +146,7 @@ export class DiplomasPage implements OnInit, OnDestroy {
|
||||
this.LoadList();
|
||||
}
|
||||
|
||||
goToDiploma(serialNumber:any) {
|
||||
goToDiploma(serialNumber: any) {
|
||||
this.router.navigate(['/home/gabinete-digital/diplomas', serialNumber, 'gabinete-digital']);
|
||||
}
|
||||
|
||||
@@ -192,11 +183,54 @@ 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);
|
||||
|
||||
let taskDate = date.getFullYear()+"-"+ date.getMonth()+"-"+date.getDate()+" "+date.getHours()+":"+date.getMinutes()+ ":"+date.getSeconds();
|
||||
let taskDate = date.getFullYear() + "-" + date.getMonth() + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
|
||||
return {
|
||||
"SerialNumber": element.serialNumber,
|
||||
"Folio": element.workflowInstanceDataFields.Subject,
|
||||
@@ -212,8 +246,28 @@ 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 myArray.sort(function (a, b) {
|
||||
return (a.CreateDate < b.CreateDate) ? -1 : ((a.CreateDate > b.CreateDate) ? 1 : 0);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user