Sqlite Bug presenting details on web fixed

This commit is contained in:
Eudes Inácio
2021-10-20 11:48:09 +01:00
parent 6819f413a8
commit de29ff978d
7 changed files with 294 additions and 221 deletions
@@ -19,7 +19,7 @@ import { ToastService } from 'src/app/services/toast.service';
import { Location } from '@angular/common' import { Location } from '@angular/common'
import { DespachoService } from 'src/app/Rules/despacho.service'; import { DespachoService } from 'src/app/Rules/despacho.service';
import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page'; import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
import { Platform } from '@ionic/angular';
import { SqliteService } from 'src/app/services/sqlite.service'; import { SqliteService } from 'src/app/services/sqlite.service';
import { BackgroundService } from 'src/app/services/background.service'; import { BackgroundService } from 'src/app/services/background.service';
@@ -57,7 +57,8 @@ export class DespachoPrPage implements OnInit {
private location: Location, private location: Location,
private despachoService: DespachoService, private despachoService: DespachoService,
private sqliteservice: SqliteService, private sqliteservice: SqliteService,
private backgroundservice: BackgroundService private backgroundservice: BackgroundService,
private platform: Platform,
) { ) {
this.activatedRoute.paramMap.subscribe(params => { this.activatedRoute.paramMap.subscribe(params => {
if (params["params"].SerialNumber) { if (params["params"].SerialNumber) {
@@ -123,16 +124,14 @@ export class DespachoPrPage implements OnInit {
console.log(this.task); console.log(this.task);
console.log('GetTask', res); console.log('GetTask', res);
this.sqliteservice.updateProcess(res) this.updateProcessOnDB(res);
let thedate = new Date(this.task.CreateDate); let thedate = new Date(this.task.CreateDate);
this.customDate = this.days[thedate.getDay()] + ", " + thedate.getDate() + " de " + (this.months[thedate.getMonth()]); this.customDate = this.days[thedate.getDay()] + ", " + thedate.getDate() + " de " + (this.months[thedate.getMonth()]);
this.processes.GetTaskParticipants(this.task.FolderId).subscribe(users => { this.processes.GetTaskParticipants(this.task.FolderId).subscribe(users => {
this.sqliteservice.updateProcessInterveners(JSON.stringify(this.serialNumber), JSON.stringify(users)).then(() => { this.updateProcessInterveners(users)
console.log('internen despacho pr ')
})
this.intervenientes = users.filter(user => { this.intervenientes = users.filter(user => {
return user.Type == 'I'; return user.Type == 'I';
}); });
@@ -162,6 +161,19 @@ export class DespachoPrPage implements OnInit {
}); });
} }
updateProcessOnDB(res) {
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
} else {
this.sqliteservice.updateProcess(res);
}
}
updateProcessInterveners(users) {
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
} else {
this.sqliteservice.updateProcessInterveners(JSON.stringify(this.serialNumber), JSON.stringify(users))
}
}
getFromDB() { getFromDB() {
this.sqliteservice.getProcessById(this.serialNumber).then((process: any[]) => { this.sqliteservice.getProcessById(this.serialNumber).then((process: any[]) => {
@@ -144,14 +144,14 @@ export class DespachoPage implements OnInit {
"Status": res.workflowInstanceDataFields.Status, "Status": res.workflowInstanceDataFields.Status,
} }
this.sqliteservice.updateProcess(res); this.updateProcessOnDB(res);
this.fulltask = res; this.fulltask = res;
let thedate = new Date(this.task.CreateDate); let thedate = new Date(this.task.CreateDate);
this.customDate = this.days[thedate.getDay()] + ", " + thedate.getDate() + " de " + (this.months[thedate.getMonth()]); this.customDate = this.days[thedate.getDay()] + ", " + thedate.getDate() + " de " + (this.months[thedate.getMonth()]);
this.processes.GetTaskParticipants(this.task.FolderID).subscribe(users => { this.processes.GetTaskParticipants(this.task.FolderID).subscribe(users => {
this.sqliteservice.updateProcessInterveners(JSON.stringify(this.serialnumber), JSON.stringify(users)) this.updateProcessInterveners(users)
console.log('interveniers online', users) console.log('interveniers online', users)
this.intervenientes = users.filter(user => { this.intervenientes = users.filter(user => {
@@ -177,72 +177,88 @@ export class DespachoPage implements OnInit {
}); });
} }
updateProcessOnDB(res) {
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
} else {
this.sqliteservice.updateProcess(res);
}
}
updateProcessInterveners(users) {
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
} else {
this.sqliteservice.updateProcessInterveners(JSON.stringify(this.serialnumber), JSON.stringify(users))
}
}
getFromDb() { getFromDb() {
this.platform.ready().then(() => { this.platform.ready().then(() => {
this.sqliteservice.getProcessById(this.serialnumber).then((process) => { if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
} else {
this.sqliteservice.getProcessById(this.serialnumber).then((process) => {
var workflow = JSON.parse(process[0].workflowInstanceDataFields); var workflow = JSON.parse(process[0].workflowInstanceDataFields);
var intervine = JSON.parse(process[0].interveners) var intervine = JSON.parse(process[0].interveners)
var origina var origina
if (process[0].originator === "undefined") { if (process[0].originator === "undefined") {
origina = "" origina = ""
} else { } else {
origina = JSON.parse(process[0].originator) origina = JSON.parse(process[0].originator)
} }
console.log('sqlite', process) console.log('sqlite', process)
this.task = { this.task = {
"SerialNumber": process[0].serialNumber, "SerialNumber": process[0].serialNumber,
"Folio": workflow.Subject, "Folio": workflow.Subject,
"Senders": origina.email || process[0].originator, "Senders": origina.email || process[0].originator,
"CreateDate": momentG(new Date(process[0].taskStartDate), 'yyyy-MM-dd HH:mm:ss'), "CreateDate": momentG(new Date(process[0].taskStartDate), 'yyyy-MM-dd HH:mm:ss'),
"DocumentURL": workflow.ViewerRequest, "DocumentURL": workflow.ViewerRequest,
"Remetente": workflow.Sender, "Remetente": workflow.Sender,
"Note": workflow.TaskMessage || workflow.Note, "Note": workflow.TaskMessage || workflow.Note,
"FolderId": workflow.FolderID, "FolderId": workflow.FolderID,
"FsId": workflow.FsId, "FsId": workflow.FsId,
"DocId": workflow.DocID, "DocId": workflow.DocID,
"DocumentsQty": process[0].DocumentsQty, "DocumentsQty": process[0].DocumentsQty,
"WorkflowName": process[0].workflowDisplayName, "WorkflowName": process[0].workflowDisplayName,
"DeadlineType": workflow.DeadlineType, "DeadlineType": workflow.DeadlineType,
"activityInstanceName": process[0].activityInstanceName, "activityInstanceName": process[0].activityInstanceName,
"Status": workflow.Status, "Status": workflow.Status,
} }
let thedate = new Date(this.task.CreateDate); let thedate = new Date(this.task.CreateDate);
this.customDate = this.days[thedate.getDay()] + ", " + thedate.getDate() + " de " + (this.months[thedate.getMonth()]); this.customDate = this.days[thedate.getDay()] + ", " + thedate.getDate() + " de " + (this.months[thedate.getMonth()]);
let fulltak = { let fulltak = {
Documents: JSON.parse(process[0].Documents), Documents: JSON.parse(process[0].Documents),
actions: JSON.parse(process[0].actions), actions: JSON.parse(process[0].actions),
activityInstanceName: process[0].activityInstanceName, activityInstanceName: process[0].activityInstanceName,
formURL: process[0].formURL, formURL: process[0].formURL,
originator: JSON.parse(process[0].originator), originator: JSON.parse(process[0].originator),
serialNumber: process[0].serialNumber, serialNumber: process[0].serialNumber,
taskStartDate: process[0].taskStartDate, taskStartDate: process[0].taskStartDate,
totalDocuments: process[0].totalDocuments, totalDocuments: process[0].totalDocuments,
workflowDisplayName: process[0].workflowDisplayName, workflowDisplayName: process[0].workflowDisplayName,
workflowID: process[0].workflowID, workflowID: process[0].workflowID,
workflowInstanceDataFields: JSON.parse(process[0].workflowInstanceDataFields), workflowInstanceDataFields: JSON.parse(process[0].workflowInstanceDataFields),
workflowInstanceFolio: process[0].workflowInstanceFolio, workflowInstanceFolio: process[0].workflowInstanceFolio,
workflowInstanceID: process[0].workflowInstanceID, workflowInstanceID: process[0].workflowInstanceID,
workflowName: process[0].workflowName workflowName: process[0].workflowName
} }
this.fulltask = fulltak; this.fulltask = fulltak;
console.log('interveniers offline', intervine) console.log('interveniers offline', intervine)
this.intervenientes = intervine.filter(user => { this.intervenientes = intervine.filter(user => {
console.log('interveniers offline 2', user) console.log('interveniers offline 2', user)
return user.Type == 'I'; return user.Type == 'I';
}); });
this.cc = intervine.filter(user => { this.cc = intervine.filter(user => {
console.log('interveniers offline 3', user) console.log('interveniers offline 3', user)
return user.Type == 'CC'; return user.Type == 'CC';
}); });
}) })
}
}) })
} }
@@ -76,32 +76,35 @@ export class DespachosPage implements OnInit {
getFromDb() { getFromDb() {
this.platform.ready().then(() => { this.platform.ready().then(() => {
this.sqliteservice.getprocessByworkflow('Despacho').then((process: any[]) => { if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
var listtopresent = []; } else {
process.forEach(element => { this.sqliteservice.getprocessByworkflow('Despacho').then((process: any[]) => {
var workflow = JSON.parse(element.workflowInstanceDataFields); var listtopresent = [];
let task = { process.forEach(element => {
"CreateDate": element.taskStartDate, var workflow = JSON.parse(element.workflowInstanceDataFields);
"DocId": workflow.DispatchDocID, let task = {
"DocumentURL": undefined, "CreateDate": element.taskStartDate,
"DocumentsQty": element.totalDocuments, "DocId": workflow.DispatchDocID,
"FolderID": workflow.FolderID, "DocumentURL": undefined,
"Folio": workflow.Subject, "DocumentsQty": element.totalDocuments,
"Remetente": undefined, "FolderID": workflow.FolderID,
"Senders": workflow.Sender, "Folio": workflow.Subject,
"SerialNumber": element.serialNumber, "Remetente": undefined,
"Status": workflow.Status, "Senders": workflow.Sender,
"WorkflowName": element.workflowDisplayName "SerialNumber": element.serialNumber,
} "Status": workflow.Status,
"WorkflowName": element.workflowDisplayName
}
listtopresent.push(task); listtopresent.push(task);
}); });
this.listToPresent = listtopresent; this.listToPresent = listtopresent;
console.log('Tarefas de despach', this.listToPresent) console.log('Tarefas de despach', this.listToPresent)
}) })
}
}) })
} }
@@ -12,7 +12,7 @@ import { DeplomaOptionsPage } from 'src/app/shared/popover/deploma-options/deplo
import { ToastService } from 'src/app/services/toast.service'; import { ToastService } from 'src/app/services/toast.service';
import { Location } from '@angular/common'; import { Location } from '@angular/common';
import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page'; import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
import { Platform } from '@ionic/angular';
import { SqliteService } from 'src/app/services/sqlite.service'; import { SqliteService } from 'src/app/services/sqlite.service';
import { BackgroundService } from 'src/app/services/background.service'; import { BackgroundService } from 'src/app/services/background.service';
@@ -47,7 +47,8 @@ export class DiplomaPage implements OnInit {
private toastService: ToastService, private toastService: ToastService,
private location: Location, private location: Location,
private sqliteservice: SqliteService, private sqliteservice: SqliteService,
private backgroundservice: BackgroundService private backgroundservice: BackgroundService,
private platform: Platform,
) { ) {
this.activatedRoute.paramMap.subscribe(params => { this.activatedRoute.paramMap.subscribe(params => {
// console.log(params["params"]); // console.log(params["params"]);
@@ -134,15 +135,13 @@ export class DiplomaPage implements OnInit {
"activityInstanceName": res.activityInstanceName, "activityInstanceName": res.activityInstanceName,
} }
this.fulltask = res; this.fulltask = res;
this.sqliteservice.updateProcess(res) this.updateProcessOnDB(res)
let thedate = new Date(this.task.CreateDate); let thedate = new Date(this.task.CreateDate);
this.customDate = this.days[thedate.getDay()] + ", " + thedate.getDate() + " de " + (this.months[thedate.getMonth()]); this.customDate = this.days[thedate.getDay()] + ", " + thedate.getDate() + " de " + (this.months[thedate.getMonth()]);
this.processes.GetTaskParticipants(this.task.FolderId).subscribe(users => { this.processes.GetTaskParticipants(this.task.FolderId).subscribe(users => {
this.sqliteservice.updateProcessInterveners(JSON.stringify(this.serialNumber), JSON.stringify(users)).then(() => { this.updateProcessInterveners(users)
console.log('internen diploma ')
})
this.intervenientes = users.filter(user => { this.intervenientes = users.filter(user => {
return user.Type == 'I'; return user.Type == 'I';
}); });
@@ -167,6 +166,19 @@ export class DiplomaPage implements OnInit {
} }
updateProcessOnDB(res) {
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
} else {
this.sqliteservice.updateProcess(res);
}
}
updateProcessInterveners(users) {
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
} else {
this.sqliteservice.updateProcessInterveners(JSON.stringify(this.serialNumber), JSON.stringify(users))
}
}
getFromDb() { getFromDb() {
this.sqliteservice.getProcessById(this.serialNumber).then((process) => { this.sqliteservice.getProcessById(this.serialNumber).then((process) => {
@@ -268,27 +268,31 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
addProcessToDB(data) { addProcessToDB(data) {
this.platform.ready().then(() => { this.platform.ready().then(() => {
data.forEach(element => { if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
let process = { } else {
"serialNumber": element.serialNumber, data.forEach(element => {
"workflowInstanceFolio": element.workflowInstanceFolio,
"Documents": element.Documents,
"actions": element.actions,
"activityInstanceName": element.activityInstanceName,
"formURL": element.formURL,
"originator": element.originator,
"taskStartDate": element.taskStartDate,
"totalDocuments": element.totalDocuments,
"workflowDisplayName": element.workflowDisplayName,
"workflowID": element.workflowID,
"workflowInstanceDataFields": element.workflowInstanceDataFields,
"workflowInstanceID": element.workflowInstanceID,
"workflowName": element.workflowName
}
this.sqliteservice.addProcess(process); let process = {
}); "serialNumber": element.serialNumber,
"workflowInstanceFolio": element.workflowInstanceFolio,
"Documents": element.Documents,
"actions": element.actions,
"activityInstanceName": element.activityInstanceName,
"formURL": element.formURL,
"originator": element.originator,
"taskStartDate": element.taskStartDate,
"totalDocuments": element.totalDocuments,
"workflowDisplayName": element.workflowDisplayName,
"workflowID": element.workflowID,
"workflowInstanceDataFields": element.workflowInstanceDataFields,
"workflowInstanceID": element.workflowInstanceID,
"workflowName": element.workflowName
}
this.sqliteservice.addProcess(process);
});
}
}); });
} }
@@ -16,7 +16,7 @@ import { AuthService } from 'src/app/services/auth.service';
import { LoginUserRespose } from 'src/app/models/user.model'; import { LoginUserRespose } from 'src/app/models/user.model';
import { ToastService } from 'src/app/services/toast.service'; import { ToastService } from 'src/app/services/toast.service';
import { ForwardPage } from 'src/app/modals/forward/forward.page'; import { ForwardPage } from 'src/app/modals/forward/forward.page';
import { Platform } from '@ionic/angular';
import { Location } from '@angular/common'; import { Location } from '@angular/common';
import { PedidoService } from 'src/app/Rules/pedido.service'; import { PedidoService } from 'src/app/Rules/pedido.service';
@@ -62,7 +62,8 @@ export class PedidoPage implements OnInit {
private location: Location, private location: Location,
private pedidoService: PedidoService, private pedidoService: PedidoService,
private sqliteservice: SqliteService, private sqliteservice: SqliteService,
private backgroundservices: BackgroundService private backgroundservices: BackgroundService,
private platform: Platform
) { ) {
this.loggeduser = authService.ValidatedUser; this.loggeduser = authService.ValidatedUser;
@@ -127,7 +128,7 @@ export class PedidoPage implements OnInit {
"Status": res.workflowInstanceDataFields.Status, "Status": res.workflowInstanceDataFields.Status,
} }
console.log(this.task); console.log(this.task);
this.sqliteservice.updateProcess(res); this.updateProcess(res);
} }
else if (res.workflowDisplayName == 'Pedido de Deferimento') { else if (res.workflowDisplayName == 'Pedido de Deferimento') {
@@ -152,16 +153,14 @@ export class PedidoPage implements OnInit {
"activityInstanceName": res.activityInstanceName, "activityInstanceName": res.activityInstanceName,
"Status": res.workflowInstanceDataFields.Status, "Status": res.workflowInstanceDataFields.Status,
} }
this.sqliteservice.updateProcess(res); this.updateProcess(res)
} }
let thedate = new Date(res.taskStartDate); let thedate = new Date(res.taskStartDate);
this.customDate = this.days[thedate.getDay()] + ", " + thedate.getDate() + " de " + (this.months[thedate.getMonth()]); this.customDate = this.days[thedate.getDay()] + ", " + thedate.getDate() + " de " + (this.months[thedate.getMonth()]);
this.processes.GetTaskParticipants(res.workflowInstanceDataFields.FolderID).subscribe(users => { this.processes.GetTaskParticipants(res.workflowInstanceDataFields.FolderID).subscribe(users => {
this.sqliteservice.updateProcessInterveners(JSON.stringify(this.serialnumber), JSON.stringify(users)).then(() => { this.updateProcessInterveners(users)
console.log('Pedido ')
})
this.intervenientes = users.filter(user => { this.intervenientes = users.filter(user => {
return user.Type == 'I'; return user.Type == 'I';
}); });
@@ -186,93 +185,109 @@ export class PedidoPage implements OnInit {
}); });
} }
updateProcess(res) {
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
} else {
this.sqliteservice.updateProcess(res);
}
}
updateProcessInterveners(users) {
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
} else {
this.sqliteservice.updateProcessInterveners(JSON.stringify(this.serialnumber), JSON.stringify(users));
}
}
getfromDb() { getfromDb() {
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
} else {
this.sqliteservice.getProcessById(this.serialnumber).then((process) => {
this.sqliteservice.getProcessById(this.serialnumber).then((process) => { console.log('PROCESS BY ID', process, this.serialnumber)
console.log('PROCESS BY ID', process, this.serialnumber) let fulltak = {
Documents: JSON.parse(process[0].Documents) || [],
let fulltak = { actions: JSON.parse(process[0].actions),
Documents: JSON.parse(process[0].Documents) || [], activityInstanceName: process[0].activityInstanceName,
actions: JSON.parse(process[0].actions), formURL: process[0].formURL,
activityInstanceName: process[0].activityInstanceName, originator: JSON.parse(process[0].originator),
formURL: process[0].formURL, serialNumber: process[0].serialNumber,
originator: JSON.parse(process[0].originator), taskStartDate: process[0].taskStartDate,
serialNumber: process[0].serialNumber, totalDocuments: process[0].totalDocuments,
taskStartDate: process[0].taskStartDate, workflowDisplayName: process[0].workflowDisplayName,
totalDocuments: process[0].totalDocuments, workflowID: process[0].workflowID,
workflowDisplayName: process[0].workflowDisplayName, workflowInstanceDataFields: JSON.parse(process[0].workflowInstanceDataFields),
workflowID: process[0].workflowID, workflowInstanceFolio: process[0].workflowInstanceFolio,
workflowInstanceDataFields: JSON.parse(process[0].workflowInstanceDataFields), workflowInstanceID: process[0].workflowInstanceID,
workflowInstanceFolio: process[0].workflowInstanceFolio, workflowName: process[0].workflowName
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); this.fulltask = fulltak;
} else if (process[0].workflowDisplayName == 'Pedido de Deferimento') { console.log('FULLTAK OFFLINE', this.fulltask);
let date = new Date(process[0].taskStartDate); if (process[0].workflowDisplayName == 'Pedido de Parecer' || process[0].workflowDisplayName == 'Pedido de Parecer do Presidente') {
date.setMonth(date.getMonth() + 1); let date = new Date(process[0].taskStartDate);
let taskDate = date.getFullYear() + "-" + date.getMonth() + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds(); date.setMonth(date.getMonth() + 1);
this.task = { let taskDate = date.getFullYear() + "-" + date.getMonth() + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
"SerialNumber": process[0].serialNumber,
"Folio": JSON.parse(process[0].workflowInstanceDataFields).Subject, this.task = {
"Senders": JSON.parse(process[0].workflowInstanceDataFields).Sender, "SerialNumber": process[0].serialNumber,
"CreateDate": taskDate, "Folio": JSON.parse(process[0].workflowInstanceDataFields).Subject,
"DocumentURL": JSON.parse(process[0].workflowInstanceDataFields).ViewerRequest, "Senders": JSON.parse(process[0].workflowInstanceDataFields).Sender,
"Remetente": JSON.parse(process[0].workflowInstanceDataFields).Sender, "CreateDate": taskDate,
"Note": JSON.parse(process[0].workflowInstanceDataFields).TaskMessage, "DocumentURL": JSON.parse(process[0].workflowInstanceDataFields).ViewerRequest,
"FolderId": JSON.parse(process[0].workflowInstanceDataFields).FolderID, "Remetente": JSON.parse(process[0].workflowInstanceDataFields).Sender,
"FsId": '361', "Note": JSON.parse(process[0].workflowInstanceDataFields).TaskMessage,
"DocId": JSON.parse(process[0].workflowInstanceDataFields).DocIdDeferimento, "FolderId": JSON.parse(process[0].workflowInstanceDataFields).FolderID,
"WorkflowName": process[0].workflowDisplayName, "FsId": '361',
"DeadlineType": JSON.parse(process[0].workflowInstanceDataFields).DeadlineType, "DocId": JSON.parse(process[0].workflowInstanceDataFields).DocIdDeferimento,
"ProcessInstanceID": JSON.parse(process[0].workflowInstanceDataFields).InstanceID, "WorkflowName": process[0].workflowDisplayName,
"activityInstanceName": process[0].activityInstanceName, "DeadlineType": JSON.parse(process[0].workflowInstanceDataFields).DeadlineType,
"Status": JSON.parse(process[0].workflowInstanceDataFields).Status, "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);
} }
this.attachments = JSON.parse(process[0].Documents);
}
let thedate = new Date(process[0].taskStartDate); let thedate = new Date(process[0].taskStartDate);
this.customDate = this.days[thedate.getDay()] + ", " + thedate.getDate() + " de " + (this.months[thedate.getMonth()]); this.customDate = this.days[thedate.getDay()] + ", " + thedate.getDate() + " de " + (this.months[thedate.getMonth()]);
this.intervenientes = JSON.parse(process[0].interveners).filter(user => { this.intervenientes = JSON.parse(process[0].interveners).filter(user => {
return user.Type == 'I'; return user.Type == 'I';
}); });
this.cc = JSON.parse(process[0].interveners).filter(user => { this.cc = JSON.parse(process[0].interveners).filter(user => {
return user.Type == 'CC'; return user.Type == 'CC';
}); });
this.getDocumentDetails(JSON.parse(process[0].workflowInstanceDataFields).FolderID, '361'); this.getDocumentDetails(JSON.parse(process[0].workflowInstanceDataFields).FolderID, '361');
}) })
}
} }
getDocumentDetails(forlderId: string, applicationId: string) { getDocumentDetails(forlderId: string, applicationId: string) {
+36 -25
View File
@@ -1,6 +1,6 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { Router, NavigationEnd } from '@angular/router'; import { Router, NavigationEnd } from '@angular/router';
import { ModalController } from '@ionic/angular'; import { ModalController, Platform } from '@ionic/angular';
import { PublicationFolder } from 'src/app/models/publicationfolder'; import { PublicationFolder } from 'src/app/models/publicationfolder';
import { PublicationsService } from 'src/app/services/publications.service'; import { PublicationsService } from 'src/app/services/publications.service';
import { NewActionPage } from './new-action/new-action.page'; import { NewActionPage } from './new-action/new-action.page';
@@ -65,7 +65,8 @@ export class PublicationsPage implements OnInit {
private publications: PublicationsService, private publications: PublicationsService,
private toastService: ToastService, private toastService: ToastService,
private sqliteservice: SqliteService, private sqliteservice: SqliteService,
private backgroundservice: BackgroundService private backgroundservice: BackgroundService,
private platform: Platform
) { ) {
this.months = ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"]; this.months = ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"];
this.days = ["Domingo", "Segunda-feira", "Terça-feira", "Quarta-feira", "Quinta-feira", "Sexta-feira", "Sábado"]; this.days = ["Domingo", "Segunda-feira", "Terça-feira", "Quarta-feira", "Quinta-feira", "Sexta-feira", "Sábado"];
@@ -150,7 +151,7 @@ export class PublicationsPage implements OnInit {
ActionType: data.ActionType, ActionType: data.ActionType,
} }
this.sqliteservice.addactions(folder); this.addActionToDB(folder)
if (data.ActionType == "Evento") { if (data.ActionType == "Evento") {
console.log('Evento', folder) console.log('Evento', folder)
@@ -172,35 +173,45 @@ export class PublicationsPage implements OnInit {
}); });
} }
addActionToDB(folder) {
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
} else {
this.sqliteservice.addactions(folder);
}
}
getFromDB() { getFromDB() {
this.sqliteservice.getAllActions().then((actions: any[]) => { if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
} else {
this.sqliteservice.getAllActions().then((actions: any[]) => {
console.log('offline publi', actions) console.log('offline publi', actions)
this.publicationsEventFolderList = new Array(); this.publicationsEventFolderList = new Array();
this.publicationsTravelFolderList = new Array(); this.publicationsTravelFolderList = new Array();
actions.forEach(data => { actions.forEach(data => {
let folder: PublicationFolder = { let folder: PublicationFolder = {
ProcessId: data.ProcessId, ProcessId: data.ProcessId,
Description: data.Description, Description: data.Description,
Detail: data.Detail, Detail: data.Detail,
DateBegin: data.DateBegin, DateBegin: data.DateBegin,
DateEnd: data.DateEnd, DateEnd: data.DateEnd,
ActionType: data.ActionType, ActionType: data.ActionType,
} }
if (data.ActionType == "Evento") { if (data.ActionType == "Evento") {
this.publicationsEventFolderList.push(folder); this.publicationsEventFolderList.push(folder);
} }
else { else {
this.publicationsTravelFolderList.push(folder); this.publicationsTravelFolderList.push(folder);
} }
this.showLoader = false; this.showLoader = false;
}); });
}) })
}
} }
async editAction(folderId?: string) { async editAction(folderId?: string) {