mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 12:37:53 +00:00
Web offline
This commit is contained in:
@@ -19,6 +19,7 @@ import { Platform } from '@ionic/angular';
|
||||
import { ThemeService } from 'src/app/services/theme.service'
|
||||
import { OfflineManagerService } from 'src/app/services/offline-manager.service';
|
||||
import { RouteService } from 'src/app/services/route.service';
|
||||
import { Storage } from '@ionic/storage';
|
||||
|
||||
@Component({
|
||||
selector: 'app-approve-event',
|
||||
@@ -63,7 +64,8 @@ export class ApproveEventPage implements OnInit {
|
||||
private platform: Platform,
|
||||
private backgroundservice: BackgroundService,
|
||||
public ThemeService: ThemeService,
|
||||
private offlineManager: OfflineManagerService
|
||||
private offlineManager: OfflineManagerService,
|
||||
private storage: Storage
|
||||
) {
|
||||
this.activatedRoute.paramMap.subscribe(params => {
|
||||
// console.log(params["params"]);
|
||||
@@ -110,6 +112,9 @@ export class ApproveEventPage implements OnInit {
|
||||
|
||||
addProcessToDB(data) {
|
||||
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
||||
this.storage.set('approve_event_detils', data).then(() => {
|
||||
console.log('APPROVE EVENT DETAILS SAVED')
|
||||
})
|
||||
} else {
|
||||
this.sqliteservice.updateProcess(data);
|
||||
}
|
||||
@@ -117,69 +122,85 @@ export class ApproveEventPage implements OnInit {
|
||||
|
||||
getProcessFromDB() {
|
||||
|
||||
this.platform.ready().then(() => {
|
||||
|
||||
this.sqliteservice.getProcessById(this.serialNumber).then((process) => {
|
||||
console.log('event aprove serial', process)
|
||||
|
||||
var doc;
|
||||
var action = [];
|
||||
var origi = [];
|
||||
var wordafi = {};
|
||||
if (process[0].Documents === "null" || process[0].Documents === "undefined") {
|
||||
doc = []
|
||||
} else {
|
||||
doc = JSON.parse(process[0].Documents)
|
||||
}
|
||||
|
||||
if (process[0].actions === "null" || process[0].actions === "undefined") {
|
||||
action = []
|
||||
} else {
|
||||
action = JSON.parse(process[0].Documents)
|
||||
}
|
||||
|
||||
if (process[0].originator === "null" || process[0].originator === "undefined") {
|
||||
origi = []
|
||||
} else {
|
||||
origi = JSON.parse(process[0].Documents)
|
||||
}
|
||||
if (process[0].workflowInstanceDataFields === "null" || process[0].workflowInstanceDataFields === "undefined") {
|
||||
wordafi = []
|
||||
} else {
|
||||
wordafi = JSON.parse(process[0].workflowInstanceDataFields)
|
||||
}
|
||||
|
||||
let task = {
|
||||
"Documents": doc,
|
||||
"actions": action,
|
||||
"activityInstanceName": process[0].activityInstanceName,
|
||||
"formURL": process[0].formURL,
|
||||
"originator": origi,
|
||||
"serialNumber": process[0].serialNumber,
|
||||
"taskStartDate": process[0].taskStartDate,
|
||||
"totalDocuments": process[0].totalDocuments,
|
||||
"workflowDisplayName": process[0].workflowDisplayName,
|
||||
"workflowID": process[0].workflowID,
|
||||
"workflowInstanceDataFields": wordafi,
|
||||
"workflowInstanceFolio": process[0].workflowInstanceFolio,
|
||||
"workflowInstanceID": process[0].workflowInstanceID,
|
||||
"workflowName": process[0].workflowInstanceID
|
||||
|
||||
}
|
||||
|
||||
this.loadedEvent = task
|
||||
console.log('offline event', this.loadedEvent);
|
||||
|
||||
this.today = new Date(this.loadedEvent.workflowInstanceDataFields.StartDate);
|
||||
|
||||
this.customDate = this.days[this.today.getDay()] + ", " + this.today.getDate() + " de " + (this.months[this.today.getMonth()]);
|
||||
|
||||
let instanceId = this.loadedEvent.workflowInstanceDataFields.InstanceId;
|
||||
this.loadedAttachments = this.loadedEvent.Documents;
|
||||
console.log('Attatara', this.loadedAttachments)
|
||||
|
||||
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
||||
this.storage.get('approve_event_detils').then((event) => {
|
||||
this.loadedEvent = event
|
||||
console.log('offline event', this.loadedEvent);
|
||||
|
||||
this.today = new Date(this.loadedEvent.workflowInstanceDataFields.StartDate);
|
||||
|
||||
this.customDate = this.days[this.today.getDay()] + ", " + this.today.getDate() + " de " + (this.months[this.today.getMonth()]);
|
||||
|
||||
let instanceId = this.loadedEvent.workflowInstanceDataFields.InstanceId;
|
||||
this.loadedAttachments = this.loadedEvent.Documents;
|
||||
console.log('Attatara', this.loadedAttachments)
|
||||
})
|
||||
})
|
||||
} else {
|
||||
this.platform.ready().then(() => {
|
||||
|
||||
this.sqliteservice.getProcessById(this.serialNumber).then((process) => {
|
||||
console.log('event aprove serial', process)
|
||||
|
||||
var doc;
|
||||
var action = [];
|
||||
var origi = [];
|
||||
var wordafi = {};
|
||||
if (process[0].Documents === "null" || process[0].Documents === "undefined") {
|
||||
doc = []
|
||||
} else {
|
||||
doc = JSON.parse(process[0].Documents)
|
||||
}
|
||||
|
||||
if (process[0].actions === "null" || process[0].actions === "undefined") {
|
||||
action = []
|
||||
} else {
|
||||
action = JSON.parse(process[0].Documents)
|
||||
}
|
||||
|
||||
if (process[0].originator === "null" || process[0].originator === "undefined") {
|
||||
origi = []
|
||||
} else {
|
||||
origi = JSON.parse(process[0].Documents)
|
||||
}
|
||||
if (process[0].workflowInstanceDataFields === "null" || process[0].workflowInstanceDataFields === "undefined") {
|
||||
wordafi = []
|
||||
} else {
|
||||
wordafi = JSON.parse(process[0].workflowInstanceDataFields)
|
||||
}
|
||||
|
||||
let task = {
|
||||
"Documents": doc,
|
||||
"actions": action,
|
||||
"activityInstanceName": process[0].activityInstanceName,
|
||||
"formURL": process[0].formURL,
|
||||
"originator": origi,
|
||||
"serialNumber": process[0].serialNumber,
|
||||
"taskStartDate": process[0].taskStartDate,
|
||||
"totalDocuments": process[0].totalDocuments,
|
||||
"workflowDisplayName": process[0].workflowDisplayName,
|
||||
"workflowID": process[0].workflowID,
|
||||
"workflowInstanceDataFields": wordafi,
|
||||
"workflowInstanceFolio": process[0].workflowInstanceFolio,
|
||||
"workflowInstanceID": process[0].workflowInstanceID,
|
||||
"workflowName": process[0].workflowInstanceID
|
||||
|
||||
}
|
||||
|
||||
this.loadedEvent = task
|
||||
console.log('offline event', this.loadedEvent);
|
||||
|
||||
this.today = new Date(this.loadedEvent.workflowInstanceDataFields.StartDate);
|
||||
|
||||
this.customDate = this.days[this.today.getDay()] + ", " + this.today.getDate() + " de " + (this.months[this.today.getMonth()]);
|
||||
|
||||
let instanceId = this.loadedEvent.workflowInstanceDataFields.InstanceId;
|
||||
this.loadedAttachments = this.loadedEvent.Documents;
|
||||
console.log('Attatara', this.loadedAttachments)
|
||||
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
console.log('Offlineee')
|
||||
}
|
||||
|
||||
|
||||
@@ -85,22 +85,37 @@ export class EventListPage implements OnInit {
|
||||
|
||||
getEventToAproveFromDB() {
|
||||
|
||||
this.platform.ready().then(() => {
|
||||
|
||||
|
||||
this.sqliteservice.getListOfEventAprove('Agenda Oficial MDGPR', 'Agenda Pessoal MDGPR').then((event: any[]) => {
|
||||
|
||||
this.eventsMDGPRList = this.sortService.sortDate(this.transformaDataDB(event), 'taskStartDate')
|
||||
//this.eventsMDGPRList = this.eventsMDGPRList.filter(element => element.interveners != null)
|
||||
console.log('MD event to aprove', this.eventsMDGPRList)
|
||||
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
||||
this.storage.get('event-to-aproveMD').then((events) => {
|
||||
this.eventsMDGPRList = events
|
||||
})
|
||||
|
||||
this.storage.get('event-to-aprovePR').then((events) => {
|
||||
this.eventsPRList = events
|
||||
})
|
||||
} else {
|
||||
this.platform.ready().then(() => {
|
||||
|
||||
this.sqliteservice.getListOfEventAprove('Agenda Oficial MDGPR', 'Agenda Pessoal MDGPR').then((event: any[]) => {
|
||||
|
||||
this.eventsMDGPRList = this.sortService.sortDate(this.transformaDataDB(event), 'taskStartDate')
|
||||
//this.eventsMDGPRList = this.eventsMDGPRList.filter(element => element.interveners != null)
|
||||
console.log('MD event to aprove', this.eventsMDGPRList)
|
||||
|
||||
})
|
||||
|
||||
this.sqliteservice.getListOfEventAprove('Agenda Oficial PR', 'Agenda Pessoal PR').then((event: any[]) => {
|
||||
this.eventsPRList = this.sortService.sortDate(this.transformaDataDB(event), 'taskStartDate')
|
||||
console.log('PR event to aprove', this.eventsPRList)
|
||||
|
||||
})
|
||||
})
|
||||
|
||||
this.sqliteservice.getListOfEventAprove('Agenda Oficial PR', 'Agenda Pessoal PR').then((event: any[]) => {
|
||||
this.eventsPRList = this.sortService.sortDate(this.transformaDataDB(event), 'taskStartDate')
|
||||
console.log('PR event to aprove', this.eventsPRList)
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
})
|
||||
console.log('Offlineee')
|
||||
}
|
||||
|
||||
@@ -145,16 +160,24 @@ export class EventListPage implements OnInit {
|
||||
let mdEventsPessoal = await this.processes.GetTasksList('Agenda Pessoal MDGPR', false).toPromise();
|
||||
this.eventsMDGPRList = mdEventsOficial.concat(mdEventsPessoal);
|
||||
this.eventsMDGPRList = this.sortService.sortDate(this.eventsMDGPRList, 'taskStartDate')
|
||||
this.eventsMDGPRList = this.sortService.sortArrayByDate(this.eventsMDGPRList)
|
||||
console.log('MD EVENT TO APROVE ONLINE',this.eventsMDGPRList)
|
||||
this.eventaprovacaostore.resetmd(this.sortService.sortArrayByDate(this.eventsMDGPRList).reverse());
|
||||
this.storage.set('event-to-aproveMD',this.eventsMDGPRList).then(() => {
|
||||
console.log(' EVENTMD TO APROVE SAVED')
|
||||
})
|
||||
//this.eventaprovacaostore.resetmd(this.sortService.sortArrayByDate(this.eventsMDGPRList).reverse());
|
||||
}
|
||||
else if (this.segment == 'PR') {
|
||||
let prEventsOficial = await this.processes.GetTasksList('Agenda Oficial PR', false).toPromise();
|
||||
let prEventsPessoal = await this.processes.GetTasksList('Agenda Pessoal PR', false).toPromise();
|
||||
this.eventsPRList = prEventsOficial.concat(prEventsPessoal);
|
||||
this.eventsPRList = this.sortService.sortDate(this.eventsPRList, 'taskStartDate')
|
||||
this.eventsPRList = this.sortService.sortArrayByDate(this.eventsPRList)
|
||||
console.log('PR EVENT TO APROVE ONLINE',this.eventsPRList)
|
||||
this.eventaprovacaostore.resetpr(this.sortService.sortArrayByDate(this.eventsPRList).reverse());
|
||||
this.storage.set('event-to-aprovePR',this.eventsPRList).then(() => {
|
||||
console.log(' EVENTPR TO APROVE SAVED')
|
||||
})
|
||||
//this.eventaprovacaostore.resetpr(this.sortService.sortArrayByDate(this.eventsPRList).reverse());
|
||||
}
|
||||
this.showLoader = false;
|
||||
this.skeletonLoader = false
|
||||
@@ -164,6 +187,8 @@ export class EventListPage implements OnInit {
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
async openApproveModal(eventSerialNumber, event) {
|
||||
const modal = await this.modalController.create({
|
||||
component: ApproveEventModalPage,
|
||||
|
||||
+91
-46
@@ -33,6 +33,7 @@ import { BackgroundService } from 'src/app/services/background.service';
|
||||
import { NewGroupPage } from 'src/app/pages/chat/new-group/new-group.page';
|
||||
import { DataService } from 'src/app/services/data.service';
|
||||
import { RouteService } from 'src/app/services/route.service';
|
||||
import { Storage } from '@ionic/storage';
|
||||
|
||||
@Component({
|
||||
selector: 'app-expediente-detail',
|
||||
@@ -82,6 +83,7 @@ export class ExpedienteDetailPage implements OnInit {
|
||||
private backgroundservice: BackgroundService,
|
||||
public ThemeService: ThemeService,
|
||||
private dataService: DataService,
|
||||
private storage: Storage
|
||||
) {
|
||||
this.activatedRoute.paramMap.subscribe(params => {
|
||||
if (params["params"].SerialNumber) {
|
||||
@@ -112,63 +114,106 @@ export class ExpedienteDetailPage implements OnInit {
|
||||
|
||||
updateProcessDB(res) {
|
||||
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
||||
this.storage.set('expediente_details',res).then(() =>{
|
||||
console.log('EXPEDIENTE DETAILS SAVED')
|
||||
})
|
||||
} else {
|
||||
this.sqliteservice.updateProcess(res)
|
||||
}
|
||||
}
|
||||
getFromDB() {
|
||||
|
||||
this.platform.ready().then(() => {
|
||||
this.onlinecheck = false;
|
||||
this.sqliteservice.getProcessById(this.serialNumber).then((process) => {
|
||||
console.log("expedient ditail", process)
|
||||
|
||||
var workflow = JSON.parse(process[0].workflowInstanceDataFields);
|
||||
var origina
|
||||
if (process[0].originator === "undefined") {
|
||||
origina = ""
|
||||
} else {
|
||||
origina = JSON.parse(process[0].originator)
|
||||
}
|
||||
|
||||
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
||||
this.storage.get('expediente_details').then((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,
|
||||
"WorkflowName": process[0].workflowDisplayName,
|
||||
"Status": workflow.Status,
|
||||
"DispatchNumber": workflow.DispatchNumber,
|
||||
"AttachmentsProcessLastInstanceID": workflow.AttachmentsProcessLastInstanceID,
|
||||
"InstanceID": workflow.InstanceID
|
||||
"SerialNumber": process.serialNumber,
|
||||
"Folio": process.workflowInstanceDataFields.Subject,
|
||||
"Senders": process.originator || process.originator,
|
||||
"CreateDate": momentG(new Date(process.taskStartDate), 'yyyy-MM-dd HH:mm:ss'),
|
||||
"DocumentURL": process.workflowInstanceDataFields.ViewerRequest,
|
||||
"Remetente": process.workflowInstanceDataFields.Sender,
|
||||
"Note": process.workflowInstanceDataFields.TaskMessage || process.workflowInstanceDataFields.Note,
|
||||
"FolderId": process.workflowInstanceDataFields.FolderID,
|
||||
"FsId": process.workflowInstanceDataFields.FsId,
|
||||
"DocId": process.workflowInstanceDataFields.DocID,
|
||||
"WorkflowName": process.workflowDisplayName,
|
||||
"Status": process.workflowInstanceDataFields.Status,
|
||||
"DispatchNumber": process.workflowInstanceDataFields.DispatchNumber,
|
||||
"AttachmentsProcessLastInstanceID": process.workflowInstanceDataFields.AttachmentsProcessLastInstanceID,
|
||||
"InstanceID": process.workflowInstanceDataFields.InstanceID
|
||||
}
|
||||
|
||||
this.fulltask = {
|
||||
Documents: JSON.parse(process[0].Documents),
|
||||
actions: JSON.parse(process[0].actions),
|
||||
activityInstanceName: process[0].activityInstanceName,
|
||||
formURL: process[0].formURL,
|
||||
interveners: process[0].interveners,
|
||||
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,
|
||||
Documents: process.Documents,
|
||||
actions: process.actions,
|
||||
activityInstanceName: process.activityInstanceName,
|
||||
formURL: process.formURL,
|
||||
interveners: process.interveners,
|
||||
originator: process.originator,
|
||||
serialNumber: process.serialNumber,
|
||||
taskStartDate: process.taskStartDate,
|
||||
totalDocuments: process.totalDocuments,
|
||||
workflowDisplayName: process.workflowDisplayName,
|
||||
workflowID: process.workflowID,
|
||||
workflowInstanceDataFields: process.workflowInstanceDataFields,
|
||||
workflowInstanceFolio: process.workflowInstanceFolio,
|
||||
workflowInstanceID: process.workflowInstanceID,
|
||||
workflowName: process.workflowName,
|
||||
}
|
||||
|
||||
})
|
||||
})
|
||||
} else {
|
||||
this.platform.ready().then(() => {
|
||||
this.onlinecheck = false;
|
||||
this.sqliteservice.getProcessById(this.serialNumber).then((process) => {
|
||||
console.log("expedient ditail", process)
|
||||
|
||||
var workflow = JSON.parse(process[0].workflowInstanceDataFields);
|
||||
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 || 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,
|
||||
"WorkflowName": process[0].workflowDisplayName,
|
||||
"Status": workflow.Status,
|
||||
"DispatchNumber": workflow.DispatchNumber,
|
||||
"AttachmentsProcessLastInstanceID": workflow.AttachmentsProcessLastInstanceID,
|
||||
"InstanceID": workflow.InstanceID
|
||||
}
|
||||
|
||||
this.fulltask = {
|
||||
Documents: JSON.parse(process[0].Documents),
|
||||
actions: JSON.parse(process[0].actions),
|
||||
activityInstanceName: process[0].activityInstanceName,
|
||||
formURL: process[0].formURL,
|
||||
interveners: process[0].interveners,
|
||||
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,
|
||||
}
|
||||
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import { Platform } from '@ionic/angular';
|
||||
import { BackgroundService } from '../../../services/background.service';
|
||||
import { ThemeService } from 'src/app/services/theme.service'
|
||||
import { SortService } from 'src/app/services/functions/sort.service';
|
||||
import {Storage } from '@ionic/storage';
|
||||
|
||||
@Component({
|
||||
selector: 'app-expediente',
|
||||
@@ -40,6 +41,7 @@ export class ExpedientePage implements OnInit {
|
||||
private backgroundservice: BackgroundService,
|
||||
public ThemeService: ThemeService,
|
||||
private sortService: SortService,
|
||||
private storage: Storage
|
||||
) { }
|
||||
|
||||
ngOnInit() {
|
||||
@@ -112,63 +114,48 @@ export class ExpedientePage implements OnInit {
|
||||
|
||||
addProcessTODb(task) {
|
||||
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
||||
this.storage.set('gabinete-expediente',task).then(() => {
|
||||
console.log('GABINETE EXPEDIENTE SAVED')
|
||||
})
|
||||
} else {
|
||||
this.sqliteservice.addProcess(task);
|
||||
}
|
||||
}
|
||||
|
||||
SqliteAddExpediente(list) {
|
||||
list.forEach((expediente) => {
|
||||
let data = {
|
||||
serialNumber: expediente.serialNumber,
|
||||
workflowInstanceFolio: expediente.workflowInstanceFolio,
|
||||
Documents: expediente.Documents,
|
||||
actions: expediente.actions,
|
||||
activityInstanceName: expediente.activityInstanceName,
|
||||
formURL: expediente.formURL,
|
||||
originator: expediente.originator,
|
||||
taskStartDate: expediente.taskStartDate,
|
||||
totalDocuments: expediente.totalDocuments,
|
||||
workflowDisplayName: expediente.workflowDisplayName,
|
||||
workflowID: expediente.workflowID,
|
||||
workflowInstanceDataFields: expediente.workflowInstanceDataFields,
|
||||
workflowInstanceID: expediente.workflowInstanceID,
|
||||
workflowName: expediente.workflowName
|
||||
}
|
||||
|
||||
this.sqliteservice.addExpediente(data);
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
getEventsFromLocalDb() {
|
||||
|
||||
this.taskslist = new Array();
|
||||
this.sqliteservice.getprocessByworkflow("Expediente").then((expediente: any[]) => {
|
||||
console.log("All expedientes from local,", expediente)
|
||||
|
||||
expediente.forEach((element) => {
|
||||
|
||||
var workflow = JSON.parse(element.workflowInstanceDataFields);
|
||||
|
||||
let exped = {
|
||||
"CreateDate": element.taskStartDate,
|
||||
"DocumentsQty": element.totalDocuments,
|
||||
"Senders": workflow.Senders,
|
||||
"SerialNumber": element.serialNumber,
|
||||
"Status": workflow.Status,
|
||||
"Subject": workflow.Subject,
|
||||
"WorkflowName": element.workflowDisplayName,
|
||||
"activityInstanceName": element.activityInstanceName
|
||||
}
|
||||
|
||||
this.taskslist.push(exped)
|
||||
|
||||
});
|
||||
|
||||
this.listToPresent = this.taskslist
|
||||
|
||||
})
|
||||
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
||||
this.storage.get('gabinete-expediente').then((expediente) => {
|
||||
this.listToPresent = expediente
|
||||
})
|
||||
} else {
|
||||
this.taskslist = new Array();
|
||||
this.sqliteservice.getprocessByworkflow("Expediente").then((expediente: any[]) => {
|
||||
console.log("All expedientes from local,", expediente)
|
||||
|
||||
expediente.forEach((element) => {
|
||||
|
||||
var workflow = JSON.parse(element.workflowInstanceDataFields);
|
||||
|
||||
let exped = {
|
||||
"CreateDate": element.taskStartDate,
|
||||
"DocumentsQty": element.totalDocuments,
|
||||
"Senders": workflow.Senders,
|
||||
"SerialNumber": element.serialNumber,
|
||||
"Status": workflow.Status,
|
||||
"Subject": workflow.Subject,
|
||||
"WorkflowName": element.workflowDisplayName,
|
||||
"activityInstanceName": element.activityInstanceName
|
||||
}
|
||||
|
||||
this.taskslist.push(exped)
|
||||
|
||||
});
|
||||
|
||||
this.listToPresent = this.taskslist
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import { SqliteService } from 'src/app/services/sqlite.service';
|
||||
import { BackgroundService } from 'src/app/services/background.service';
|
||||
import { Platform } from '@ionic/angular';
|
||||
import { SortService } from 'src/app/services/functions/sort.service';
|
||||
import { Storage } from '@ionic/storage';
|
||||
|
||||
|
||||
@Component({
|
||||
@@ -47,6 +48,7 @@ export class PendentesPage implements OnInit {
|
||||
private platform: Platform,
|
||||
private backgroundservices: BackgroundService,
|
||||
private sortService: SortService,
|
||||
private storage: Storage
|
||||
) {
|
||||
this.loggeduser = authService.ValidatedUser;
|
||||
this.profile = 'mdgpr';
|
||||
@@ -104,6 +106,9 @@ export class PendentesPage implements OnInit {
|
||||
pendentesList = removeDuplicate(pendentesList)
|
||||
pendentesList = this.sortService.sortDate(pendentesList, 'CreateDate');
|
||||
this.listToPresent = pendentesList;
|
||||
this.storage.set('pendente-list',pendentesList).then(() => {
|
||||
console.log('Pendente list SAVED')
|
||||
})
|
||||
this.skeletonLoader = false;
|
||||
|
||||
}, (error) => {
|
||||
@@ -116,34 +121,41 @@ export class PendentesPage implements OnInit {
|
||||
|
||||
getFromDb() {
|
||||
|
||||
this.platform.ready().then(() => {
|
||||
this.sqliteservice.getAllProcess().then((process: any[]) => {
|
||||
var pendingList = []
|
||||
console.log('Pendentes off off',process )
|
||||
process.forEach(element => {
|
||||
var workflow = JSON.parse(element.workflowInstanceDataFields);
|
||||
if (workflow.Status === "Pending") {
|
||||
let task = {
|
||||
"CreateDate": new Date(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.sortService.sortDate(pendingList, 'CreateDate');
|
||||
this.listToPresent = pendingList;
|
||||
console.log('pendentes', pendingList)
|
||||
|
||||
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
||||
this.storage.get('pendente-list').then((pendentes) => {
|
||||
this.listToPresent =pendentes
|
||||
})
|
||||
})
|
||||
} else {
|
||||
|
||||
this.platform.ready().then(() => {
|
||||
this.sqliteservice.getAllProcess().then((process: any[]) => {
|
||||
var pendingList = []
|
||||
console.log('Pendentes off off',process )
|
||||
process.forEach(element => {
|
||||
var workflow = JSON.parse(element.workflowInstanceDataFields);
|
||||
if (workflow.Status === "Pending") {
|
||||
let task = {
|
||||
"CreateDate": new Date(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.sortService.sortDate(pendingList, 'CreateDate');
|
||||
this.listToPresent = pendingList;
|
||||
console.log('pendentes', pendingList)
|
||||
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
async refreshing() {
|
||||
|
||||
@@ -28,12 +28,12 @@
|
||||
|
||||
<div *ngSwitchCase="'MDGPR'" class="height-100">
|
||||
|
||||
<div *ngIf="eventaprovacaostore.listmd.length != 0">
|
||||
<div *ngIf="eventsMDGPRList.length != 0">
|
||||
|
||||
<ion-list class="width-100" >
|
||||
<div
|
||||
class="expediente item-hover ion-no-padding ion-no-margin cursor-pointer"
|
||||
*ngFor="let event of eventaprovacaostore.listmd"
|
||||
*ngFor="let event of eventsMDGPRList"
|
||||
(click)="goToEventDetail(event)"
|
||||
>
|
||||
<!-- (click)="openApproveModal(event)" -->
|
||||
@@ -52,7 +52,7 @@
|
||||
</ion-list>
|
||||
</div>
|
||||
|
||||
<div *ngIf="eventaprovacaostore.listmd.length == 0" class="centered-div">
|
||||
<div *ngIf="eventsMDGPRList.length == 0" class="centered-div">
|
||||
<div *ngSwitchCase="'MDGPR'" >
|
||||
<div class="d-flex height-90 align-center justify-content-center"
|
||||
>
|
||||
@@ -62,12 +62,12 @@
|
||||
</div>
|
||||
</div>
|
||||
<div *ngSwitchCase="'PR'">
|
||||
<div *ngIf="eventaprovacaostore.listpr.length != 0">
|
||||
<div *ngIf="eventsPRList.length != 0">
|
||||
<ion-list class="width-100" *ngSwitchCase="'PR'">
|
||||
<div class="width-100" *ngIf="eventaprovacaostore.listpr">
|
||||
<div class="width-100" *ngIf="eventsPRList">
|
||||
<div
|
||||
class="expediente item-hover ion-no-padding ion-no-margin cursor-pointer"
|
||||
*ngFor="let event of eventaprovacaostore.listpr"
|
||||
*ngFor="let event of eventsPRList"
|
||||
(click)="goToEventDetail(event)"
|
||||
>
|
||||
<div class="item event-pr-{{event.workflowInstanceDataFields.Agenda}} width-100">
|
||||
@@ -87,10 +87,10 @@
|
||||
|
||||
</div>
|
||||
|
||||
<div *ngIf="eventaprovacaostore.listpr.length == 0" class="centered-div d-flex height-90 align-center justify-content-center">
|
||||
<div *ngIf="eventsPRList.length == 0" class="centered-div d-flex height-90 align-center justify-content-center">
|
||||
<div *ngSwitchCase="'PR'" >
|
||||
<div class="d-flex align-center justify-content-center"
|
||||
*ngIf="eventaprovacaostore.listpr.length < 1">
|
||||
*ngIf="eventsPRList.length < 1">
|
||||
Lista vazia
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -8,6 +8,7 @@ import { LoginUserRespose } from 'src/app/models/user.model';
|
||||
import { AuthService } from 'src/app/services/auth.service';
|
||||
import { EventoAprovacaoStore } from 'src/app/store/eventoaprovacao-store.service';
|
||||
import { SortService } from 'src/app/services/functions/sort.service';
|
||||
import { Storage } from '@ionic/storage';
|
||||
|
||||
@Component({
|
||||
selector: 'app-events-to-approve',
|
||||
@@ -33,6 +34,7 @@ export class EventsToApprovePage implements OnInit {
|
||||
private router: Router,
|
||||
private userAuth: AuthService,
|
||||
private sortService: SortService,
|
||||
private storage: Storage
|
||||
)
|
||||
{
|
||||
this.loggeduser = userAuth.ValidatedUser;
|
||||
@@ -63,25 +65,46 @@ export class EventsToApprovePage implements OnInit {
|
||||
async LoadToApproveEvents() {
|
||||
this.showLoader = true;
|
||||
console.log(this.segment);
|
||||
this.getFromDB();
|
||||
if(this.segment == 'MDGPR'){
|
||||
let mdEventsOficial = await this.processes.GetTasksList('Agenda Oficial MDGPR', false).toPromise();
|
||||
let mdEventsPessoal = await this.processes.GetTasksList('Agenda Pessoal MDGPR', false).toPromise();
|
||||
this.eventsMDGPRList = mdEventsOficial.concat(mdEventsPessoal);
|
||||
this.eventsMDGPRList = this.sortService.sortArrayByDate(this.eventsMDGPRList)
|
||||
console.log(this.sortService.sortArrayByDate(this.eventsMDGPRList));
|
||||
|
||||
this.eventaprovacaostore.resetmd(this.sortService.sortDate(this.eventsMDGPRList, 'CreateDate'));
|
||||
this.storage.set('event-to-aproveMD',this.eventsMDGPRList).then(() => {
|
||||
console.log(' EVENTMD TO APROVE SAVED')
|
||||
})
|
||||
|
||||
//this.eventaprovacaostore.resetmd(this.sortService.sortDate(this.eventsMDGPRList, 'CreateDate'));
|
||||
}
|
||||
else if(this.segment == 'PR'){
|
||||
let prEventsOficial = await this.processes.GetTasksList('Agenda Oficial PR', false).toPromise();
|
||||
let prEventsPessoal = await this.processes.GetTasksList('Agenda Pessoal PR', false).toPromise();
|
||||
this.eventsPRList = prEventsOficial.concat(prEventsPessoal);
|
||||
this.eventsPRList = this.sortService.sortArrayByDate(this.eventsPRList)
|
||||
|
||||
this.eventaprovacaostore.resetpr(this.sortService.sortDate(this.eventsPRList, 'CreateDate'));
|
||||
this.storage.set('event-to-aprovePR',this.eventsPRList).then(() => {
|
||||
console.log(' EVENTPR TO APROVE SAVED')
|
||||
})
|
||||
//this.eventaprovacaostore.resetpr(this.sortService.sortDate(this.eventsPRList, 'CreateDate'));
|
||||
}
|
||||
this.showLoader = false;
|
||||
}
|
||||
|
||||
|
||||
getFromDB() {
|
||||
this.storage.get('event-to-aproveMD').then((events) => {
|
||||
this.eventsMDGPRList = events
|
||||
})
|
||||
|
||||
this.storage.get('event-to-aprovePR').then((events) => {
|
||||
this.eventsPRList = events
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
toDateString(e) {
|
||||
return new Date(e).toDateString()
|
||||
}
|
||||
|
||||
@@ -22,10 +22,10 @@
|
||||
<div class="content width-100 overflow-y-auto height-100" >
|
||||
<div >
|
||||
|
||||
<ion-list *ngIf="expedientegbstore.list.length >=0">
|
||||
<ion-list *ngIf="taskslist.length >=0">
|
||||
<div
|
||||
class="expediente item-hover ion-no-padding ion-no-margin cursor-pointer"
|
||||
*ngFor = "let task of expedientegbstore.list"
|
||||
*ngFor = "let task of taskslist"
|
||||
(click)="goToExpediente(task.SerialNumber)"
|
||||
>
|
||||
<div class="item width-100">
|
||||
@@ -58,13 +58,13 @@
|
||||
</div>
|
||||
|
||||
<div
|
||||
*ngIf="!skeletonLoader && expedientegbstore.list.length == 0 && expedientegbstore.list.length == 0"
|
||||
*ngIf="!skeletonLoader && taskslist.length == 0 && taskslist.length == 0"
|
||||
class="empty-list d-flex height-100 align-center justify-content-center"
|
||||
>
|
||||
<span>Lista vazia</span>
|
||||
</div>
|
||||
|
||||
<div *ngIf="skeletonLoader && expedientegbstore.list.length == 0">
|
||||
<div *ngIf="skeletonLoader && taskslist.length == 0">
|
||||
|
||||
<ion-list>
|
||||
<ion-item>
|
||||
|
||||
@@ -6,6 +6,7 @@ import { ExpedienteGdStore } from 'src/app/store/expedientegd-store.service';
|
||||
import { ExpedienteTaskPipe } from 'src/app/pipes/expediente-task.pipe';
|
||||
import { ThemeService } from 'src/app/services/theme.service'
|
||||
import { SortService } from 'src/app/services/functions/sort.service';
|
||||
import { Storage } from '@ionic/storage';
|
||||
|
||||
@Component({
|
||||
selector: 'app-expedients',
|
||||
@@ -13,27 +14,28 @@ import { SortService } from 'src/app/services/functions/sort.service';
|
||||
styleUrls: ['./expedients.page.scss'],
|
||||
})
|
||||
export class ExpedientsPage implements OnInit {
|
||||
segment:string;
|
||||
segment: string;
|
||||
|
||||
taskslist = [];
|
||||
serialNumber:string;
|
||||
serialNumber: string;
|
||||
|
||||
@Input() profile:string;
|
||||
@Input() profile: string;
|
||||
skeletonLoader = true
|
||||
expedientegbstore = ExpedienteGdStore
|
||||
|
||||
expedienteTaskPipe = new ExpedienteTaskPipe()
|
||||
|
||||
constructor(
|
||||
private processes:ProcessesService,
|
||||
private processes: ProcessesService,
|
||||
private alertService: AlertService,
|
||||
private router: Router,
|
||||
public ThemeService: ThemeService,
|
||||
private sortService: SortService,
|
||||
) {
|
||||
this.profile = 'mdgpr';
|
||||
private storage: Storage
|
||||
) {
|
||||
this.profile = 'mdgpr';
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
//Inicializar segment
|
||||
@@ -43,11 +45,11 @@ export class ExpedientsPage implements OnInit {
|
||||
this.router.events.forEach((event) => {
|
||||
if (event instanceof NavigationStart &&
|
||||
event.url.startsWith('/home/gabinete-digital?expedientes=true')) {
|
||||
if(window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) {
|
||||
this.doRefresh()
|
||||
} else {
|
||||
this.LoadList()
|
||||
}
|
||||
if (window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) {
|
||||
this.doRefresh()
|
||||
} else {
|
||||
this.LoadList()
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -75,21 +77,35 @@ export class ExpedientsPage implements OnInit {
|
||||
this.taskslist.push(task);
|
||||
|
||||
});
|
||||
|
||||
this.taskslist = this.sortService.sortDate(this.taskslist, 'CreateDate')
|
||||
this.addProcessTODb(this.taskslist);
|
||||
this.expedientegbstore.reset(this.taskslist);
|
||||
}, (error) => {
|
||||
this.getEventsFromLocalDb();
|
||||
});
|
||||
}
|
||||
|
||||
doRefresh() {
|
||||
setTimeout(()=>{
|
||||
this.LoadList();
|
||||
}, 1000)
|
||||
|
||||
addProcessTODb(task) {
|
||||
this.storage.set('gabinete-expediente', task).then(() => {
|
||||
console.log('GABINETE EXPEDIENTE SAVED')
|
||||
})
|
||||
}
|
||||
|
||||
goToExpediente(serialNumber:any){
|
||||
this.router.navigate(['/home/gabinete-digital/expediente',serialNumber,'gabinete-digital']);
|
||||
getEventsFromLocalDb() {
|
||||
this.storage.get('gabinete-expediente').then((expediente) => {
|
||||
this.taskslist = expediente
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
doRefresh() {
|
||||
setTimeout(() => {
|
||||
this.LoadList();
|
||||
}, 1000)
|
||||
|
||||
}
|
||||
|
||||
goToExpediente(serialNumber: any) {
|
||||
this.router.navigate(['/home/gabinete-digital/expediente', serialNumber, 'gabinete-digital']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
</ion-refresher>
|
||||
|
||||
<app-task-list
|
||||
[taskList] = pendentesstore.list
|
||||
[taskList] = listToPresent
|
||||
[skeletonLoader] = skeletonLoader
|
||||
(viewTaskDetail)="viewTaskDetails($event)"
|
||||
> </app-task-list>
|
||||
|
||||
@@ -8,6 +8,7 @@ import { PendentesStore } from 'src/app/store/pendestes-store.service';
|
||||
import { LoginUserRespose } from 'src/app/models/user.model';
|
||||
import { CustomTaskPipe } from 'src/app/pipes/custom-task.pipe';
|
||||
import { SortService } from 'src/app/services/functions/sort.service';
|
||||
import { Storage } from '@ionic/storage';
|
||||
|
||||
@Component({
|
||||
selector: 'app-pendentes',
|
||||
@@ -20,6 +21,7 @@ export class PendentesPage implements OnInit {
|
||||
pendentesstore = PendentesStore;
|
||||
customTaskPipe = new CustomTaskPipe()
|
||||
loggeduser: LoginUserRespose;
|
||||
listToPresent = [];
|
||||
|
||||
@Input() profile:string;
|
||||
segment:string;
|
||||
@@ -30,6 +32,7 @@ export class PendentesPage implements OnInit {
|
||||
private authService: AuthService,
|
||||
private router: Router,
|
||||
private sortService: SortService,
|
||||
private storage: Storage
|
||||
) {
|
||||
this.loggeduser = authService.ValidatedUser;
|
||||
}
|
||||
@@ -52,7 +55,7 @@ export class PendentesPage implements OnInit {
|
||||
|
||||
async LoadList(){
|
||||
this.skeletonLoader = true;
|
||||
|
||||
this.processes.GetPendingTasks(false).subscribe(async res => {
|
||||
let pendentes = await this.processes.GetPendingTasks(false).toPromise();
|
||||
let pendentesList = [];
|
||||
|
||||
@@ -64,9 +67,24 @@ export class PendentesPage implements OnInit {
|
||||
pendentesList = removeDuplicate( pendentesList)
|
||||
pendentesList = this.sortService.sortDate(pendentesList, 'CreateDate')
|
||||
|
||||
this.listToPresent = pendentesList
|
||||
this.pendentesstore.reset(pendentesList);
|
||||
this.storage.set('pendente-list',pendentesList).then(() => {
|
||||
console.log('Pendente list SAVED')
|
||||
})
|
||||
this.skeletonLoader = false;
|
||||
}
|
||||
}, (error) => {
|
||||
if(error.status == 0){
|
||||
this.getFromDb();
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
getFromDb() {
|
||||
this.storage.get('pendente-list').then((pendentes) => {
|
||||
this.listToPresent =pendentes
|
||||
})
|
||||
}
|
||||
|
||||
doRefresh() {
|
||||
setTimeout(()=>{
|
||||
|
||||
Reference in New Issue
Block a user