mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
Event to aprove and Expediente already have offline mode
This commit is contained in:
+1
-1
@@ -3,7 +3,7 @@
|
||||
<name>gabinete digital</name>
|
||||
<description>An awesome Ionic/Cordova app.</description>
|
||||
<author email="hi@ionicframework.com" href="http://ionicframework.com/">Ionic Framework Team</author>
|
||||
<content original-src="index.html" src="http://localhost:8100" />
|
||||
<content src="index.html" />
|
||||
<access origin="*" />
|
||||
<allow-navigation href="http://*/*" />
|
||||
<allow-navigation href="https://*/*" />
|
||||
|
||||
@@ -12,6 +12,10 @@ import { EditEventToApproveComponent } from 'src/app/shared/gabinete-digital/edi
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
import { Location } from '@angular/common';
|
||||
|
||||
import { SqliteService } from '../../../../services/sqlite.service';
|
||||
import { synchro } from '../../../../services/socket/synchro.service';
|
||||
import { Platform } from '@ionic/angular';
|
||||
|
||||
@Component({
|
||||
selector: 'app-approve-event',
|
||||
templateUrl: './approve-event.page.html',
|
||||
@@ -19,28 +23,30 @@ import { Location } from '@angular/common';
|
||||
})
|
||||
export class ApproveEventPage implements OnInit {
|
||||
event: Event;
|
||||
loadedEvent:any = false
|
||||
loadedAttachments:any;
|
||||
customDate:any;
|
||||
today:any;
|
||||
loadedEvent: any = false
|
||||
loadedAttachments: any;
|
||||
customDate: any;
|
||||
today: any;
|
||||
show: boolean = false;
|
||||
|
||||
months = ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"];
|
||||
days = ["Domingo", "Segunda-feira", "Terça-feira", "Quarta-feira", "Quinta-feira", "Sexta-feira", "Sábado"];
|
||||
|
||||
serialNumber:string;
|
||||
caller:string;
|
||||
@Input() InstanceId:string;
|
||||
serialNumber: string;
|
||||
caller: string;
|
||||
@Input() InstanceId: string;
|
||||
|
||||
@Output() approveEventDismiss = new EventEmitter<any>();
|
||||
@Output() closeEventToApprove = new EventEmitter<any>();
|
||||
@Output() AproveEventEditEvent = new EventEmitter<any>();
|
||||
|
||||
synch = synchro;
|
||||
|
||||
constructor(
|
||||
private router:Router,
|
||||
private router: Router,
|
||||
private activatedRoute: ActivatedRoute,
|
||||
private modalController: ModalController,
|
||||
private processes:ProcessesService,
|
||||
private processes: ProcessesService,
|
||||
private attachmentsService: AttachmentsService,
|
||||
private popoverController: PopoverController,
|
||||
private menu: MenuController,
|
||||
@@ -49,14 +55,16 @@ export class ApproveEventPage implements OnInit {
|
||||
private animationController: AnimationController,
|
||||
private toastService: ToastService,
|
||||
private location: Location,
|
||||
private sqliteservice: SqliteService,
|
||||
private platform: Platform
|
||||
) {
|
||||
this.activatedRoute.paramMap.subscribe(params => {
|
||||
// console.log(params["params"]);
|
||||
|
||||
if(params["params"].serialNumber) {
|
||||
if (params["params"].serialNumber) {
|
||||
this.serialNumber = params["params"].serialNumber;
|
||||
}
|
||||
if(params["params"].caller){
|
||||
if (params["params"].caller) {
|
||||
this.caller = params["params"].caller;
|
||||
}
|
||||
});
|
||||
@@ -70,7 +78,7 @@ export class ApproveEventPage implements OnInit {
|
||||
ngOnInit() {
|
||||
console.log(this.serialNumber);
|
||||
console.log(this.caller);
|
||||
|
||||
this.getProcessFromDB();
|
||||
this.getTask();
|
||||
}
|
||||
|
||||
@@ -89,19 +97,97 @@ export class ApproveEventPage implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
addProcessToDB(data) {
|
||||
this.platform.ready().then(() => {
|
||||
this.sqliteservice.updateProcess(data);
|
||||
});
|
||||
}
|
||||
|
||||
getProcessFromDB() {
|
||||
|
||||
synchro.registerCallback('Offline', () => {
|
||||
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')
|
||||
})
|
||||
}
|
||||
|
||||
async getTask() {
|
||||
this.loadedEvent = await this.processes.GetTask(this.serialNumber).toPromise();
|
||||
console.log(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()]);
|
||||
this.customDate = this.days[this.today.getDay()] + ", " + this.today.getDate() + " de " + (this.months[this.today.getMonth()]);
|
||||
|
||||
let instanceId = this.loadedEvent.workflowInstanceDataFields.InstanceId;
|
||||
this.getAttachments(instanceId);
|
||||
|
||||
this.addProcessToDB(this.loadedEvent)
|
||||
}
|
||||
|
||||
async approveTask(serialNumber:string) {
|
||||
async approveTask(serialNumber: string) {
|
||||
let body = { "serialNumber": serialNumber, "action": "Aprovar" }
|
||||
console.log(body);
|
||||
|
||||
@@ -131,12 +217,12 @@ export class ApproveEventPage implements OnInit {
|
||||
}); */
|
||||
}
|
||||
|
||||
async emendTask(serialNumber:string){
|
||||
async emendTask(serialNumber: string) {
|
||||
console.log('Desktop');
|
||||
|
||||
const modal = await this.modalController.create({
|
||||
component: EmendMessageModalPage,
|
||||
componentProps:{
|
||||
componentProps: {
|
||||
},
|
||||
cssClass: 'emend-message-modal',
|
||||
backdropDismiss: false
|
||||
@@ -145,41 +231,42 @@ export class ApproveEventPage implements OnInit {
|
||||
await modal.present();
|
||||
|
||||
modal.onDidDismiss()
|
||||
.then( async (res) => {
|
||||
console.log(res.data);
|
||||
.then(async (res) => {
|
||||
console.log(res.data);
|
||||
|
||||
if(res.data !== ''){
|
||||
let body = { "serialNumber": serialNumber,
|
||||
"action": "Emendar",
|
||||
if (res.data !== '') {
|
||||
let body = {
|
||||
"serialNumber": serialNumber,
|
||||
"action": "Emendar",
|
||||
"dataFields": {
|
||||
"ReviewUserComment": res.data,
|
||||
"ReviewUserComment": res.data,
|
||||
}
|
||||
}
|
||||
console.log(body);
|
||||
|
||||
const loader = this.toastService.loading()
|
||||
|
||||
try {
|
||||
await this.processes.PostTaskAction(body).toPromise();
|
||||
this.toastService.successMessage('Pedido enviado');
|
||||
this.goBack();
|
||||
} catch (error) {
|
||||
this.toastService.badRequest();
|
||||
} finally {
|
||||
loader.remove()
|
||||
}
|
||||
|
||||
}
|
||||
console.log(body);
|
||||
|
||||
const loader = this.toastService.loading()
|
||||
|
||||
try {
|
||||
await this.processes.PostTaskAction(body).toPromise();
|
||||
this.toastService.successMessage('Pedido enviado');
|
||||
this.goBack();
|
||||
} catch (error) {
|
||||
this.toastService.badRequest();
|
||||
} finally {
|
||||
loader.remove()
|
||||
else {
|
||||
//this.alertService.presentAlert('Operação cancelada!');
|
||||
}
|
||||
|
||||
}
|
||||
else{
|
||||
//this.alertService.presentAlert('Operação cancelada!');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
//this.openEmendMessageModal(serialNumber);
|
||||
//this.goBack();
|
||||
}
|
||||
|
||||
async rejeitar(serialNumber:string){
|
||||
async rejeitar(serialNumber: string) {
|
||||
let body = { "serialNumber": serialNumber, "action": "Rejeitar" }
|
||||
console.log(body);
|
||||
const loader = this.toastService.loading()
|
||||
@@ -195,10 +282,12 @@ export class ApproveEventPage implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
async getAttachments(instanceId:string) {
|
||||
async getAttachments(instanceId: string) {
|
||||
|
||||
try {
|
||||
this.loadedAttachments = await this.attachmentsService.getAttachmentsById(instanceId).toPromise();
|
||||
this.sqliteservice.updateUser(JSON.stringify(this.serialNumber),JSON.stringify(this.loadedAttachments))
|
||||
console.log('Attatara', this.loadedAttachments)
|
||||
|
||||
} catch (error) {
|
||||
|
||||
@@ -206,23 +295,23 @@ export class ApproveEventPage implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
viewDocument(sourceId){
|
||||
this.processes.GetDocumentUrl(sourceId, '8').subscribe(res=>{
|
||||
viewDocument(sourceId) {
|
||||
this.processes.GetDocumentUrl(sourceId, '8').subscribe(res => {
|
||||
/* console.log(res); */
|
||||
const url: string = res.replace("webTRIX.Viewer","webTRIX.Viewer.Branch1");
|
||||
const browser = this.iab.create(url,"_blank");
|
||||
const url: string = res.replace("webTRIX.Viewer", "webTRIX.Viewer.Branch1");
|
||||
const browser = this.iab.create(url, "_blank");
|
||||
browser.show();
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
async openOptions(ev:any) {
|
||||
async openOptions(ev: any) {
|
||||
const popover = await this.popoverController.create({
|
||||
component: EventActionsPopoverPage,
|
||||
cssClass: 'events-options',
|
||||
event: ev,
|
||||
translucent: true,
|
||||
componentProps:{
|
||||
componentProps: {
|
||||
serialNumber: ev.serialNumber,
|
||||
InstanceId: ev.workflowInstanceDataFields.InstanceId,
|
||||
},
|
||||
@@ -233,10 +322,10 @@ export class ApproveEventPage implements OnInit {
|
||||
openMenu() {
|
||||
this.menu.open();
|
||||
}
|
||||
async openEmendMessageModal(serialNumber:string) {
|
||||
async openEmendMessageModal(serialNumber: string) {
|
||||
const modal = await this.modalController.create({
|
||||
component: EmendMessageModalPage,
|
||||
componentProps:{
|
||||
componentProps: {
|
||||
},
|
||||
cssClass: 'emend-message-modal',
|
||||
backdropDismiss: false
|
||||
@@ -244,13 +333,14 @@ export class ApproveEventPage implements OnInit {
|
||||
|
||||
await modal.present();
|
||||
|
||||
modal.onDidDismiss().then( async (res) => {
|
||||
modal.onDidDismiss().then(async (res) => {
|
||||
console.log(res.data);
|
||||
|
||||
if(res.data !== ''){
|
||||
let body = { "serialNumber": serialNumber,
|
||||
"action": "Emendar",
|
||||
"dataFields": {
|
||||
if (res.data !== '') {
|
||||
let body = {
|
||||
"serialNumber": serialNumber,
|
||||
"action": "Emendar",
|
||||
"dataFields": {
|
||||
"ReviewUserComment": res.data,
|
||||
}
|
||||
}
|
||||
@@ -264,18 +354,18 @@ export class ApproveEventPage implements OnInit {
|
||||
this.goBack();
|
||||
} catch (error) {
|
||||
this.toastService.badRequest();
|
||||
} finally {
|
||||
} finally {
|
||||
loader.remove()
|
||||
}
|
||||
|
||||
}
|
||||
else{
|
||||
else {
|
||||
//this.alertService.presentAlert('Operação cancelada!');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
goToEventsToApprove(){
|
||||
goToEventsToApprove() {
|
||||
let navigationExtras: NavigationExtras = {
|
||||
queryParams: {
|
||||
"eventos": true,
|
||||
@@ -290,7 +380,7 @@ export class ApproveEventPage implements OnInit {
|
||||
component: EditEventToApproveComponent,
|
||||
componentProps: {
|
||||
serialNumber: serialNumber,
|
||||
InstanceId:this.InstanceId
|
||||
InstanceId: this.InstanceId
|
||||
},
|
||||
cssClass: 'modal modal-desktop',
|
||||
// backdropDismiss: false
|
||||
|
||||
@@ -8,6 +8,10 @@ import { NavigationStart, Router } from '@angular/router';
|
||||
import { EventoAprovacaoStore } from 'src/app/store/eventoaprovacao-store.service';
|
||||
import { Location } from '@angular/common';
|
||||
|
||||
import { SqliteService } from '../../../services/sqlite.service';
|
||||
import { synchro } from '../../../services/socket/synchro.service';
|
||||
import { Platform } from '@ionic/angular';
|
||||
|
||||
@Component({
|
||||
selector: 'app-event-list',
|
||||
templateUrl: './event-list.page.html',
|
||||
@@ -29,12 +33,16 @@ export class EventListPage implements OnInit {
|
||||
skeletonLoader = true
|
||||
eventaprovacaostore = EventoAprovacaoStore;
|
||||
|
||||
synch = synchro;
|
||||
|
||||
|
||||
constructor(
|
||||
private processes:ProcessesService,
|
||||
private modalController: ModalController,
|
||||
private router: Router,
|
||||
private location: Location
|
||||
private location: Location,
|
||||
private sqliteservice: SqliteService,
|
||||
private platform: Platform
|
||||
) { }
|
||||
|
||||
ngOnInit() {
|
||||
@@ -43,6 +51,9 @@ export class EventListPage implements OnInit {
|
||||
const location = window.location
|
||||
const pathname = location.pathname + location.search
|
||||
|
||||
this.getEventToAproveFromDB();
|
||||
|
||||
|
||||
this.LoadToApproveEvents()
|
||||
|
||||
this.router.events.forEach((event) => {
|
||||
@@ -65,6 +76,25 @@ export class EventListPage implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
getEventToAproveFromDB() {
|
||||
|
||||
synchro.registerCallback('Offline', () => {
|
||||
this.platform.ready().then(() => {
|
||||
|
||||
this.sqliteservice.getListOfEventAprove('Agenda Oficial MDGPR','Agenda Pessoal MDGPR' ).then((event: any[]) => {
|
||||
this.eventsMDGPRList = event
|
||||
console.log("All evento to aprove from db ", event)
|
||||
})
|
||||
|
||||
this.sqliteservice.getListOfEventAprove('Agenda Oficial PR','Agenda Pessoal PR' ).then((event: any[]) => {
|
||||
this.eventsPRList = event
|
||||
console.log("All evento to aprove from db ", event)
|
||||
})
|
||||
})
|
||||
console.log('Offlineee')
|
||||
})
|
||||
}
|
||||
|
||||
segmentChanged(ev: any) {
|
||||
this.LoadToApproveEvents();
|
||||
}
|
||||
@@ -78,7 +108,8 @@ export class EventListPage implements OnInit {
|
||||
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);
|
||||
console.log(this.eventsMDGPRList);
|
||||
console.log('Event aprove',this.eventsMDGPRList);
|
||||
|
||||
|
||||
this.eventaprovacaostore.resetmd(this.eventsMDGPRList);
|
||||
}
|
||||
@@ -92,6 +123,10 @@ export class EventListPage implements OnInit {
|
||||
this.skeletonLoader = false
|
||||
}
|
||||
|
||||
getEventToaproveFromDB() {
|
||||
|
||||
}
|
||||
|
||||
async openApproveModal(eventSerialNumber, event){
|
||||
const modal = await this.modalController.create({
|
||||
component: ApproveEventModalPage,
|
||||
|
||||
+54
-2
@@ -23,6 +23,10 @@ import { ExpedienteService } from 'src/app/Rules/expediente.service';
|
||||
import { expedienteTask } from 'src/app/models/dailyworktask.model';
|
||||
import { TaskService } from 'src/app/Rules/task.service';
|
||||
|
||||
import { SqliteService } from 'src/app/services/sqlite.service';
|
||||
import { Platform } from '@ionic/angular';
|
||||
import { synchro } from 'src/app/services/socket/synchro.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-expediente-detail',
|
||||
templateUrl: './expediente-detail.page.html',
|
||||
@@ -49,6 +53,9 @@ export class ExpedienteDetailPage implements OnInit {
|
||||
hideSendToPendentes = true
|
||||
searchDocumentPipe = new SearchDocumentPipe()
|
||||
|
||||
synch = synchro
|
||||
onlinecheck: boolean;
|
||||
|
||||
constructor(
|
||||
private processes: ProcessesService,
|
||||
private iab: InAppBrowser,
|
||||
@@ -63,7 +70,9 @@ export class ExpedienteDetailPage implements OnInit {
|
||||
private attachmentsService: AttachmentsService,
|
||||
public p: PermissionService,
|
||||
private taskService: TaskService,
|
||||
private expedienteService: ExpedienteService
|
||||
private expedienteService: ExpedienteService,
|
||||
public platform: Platform,
|
||||
private sqliteservice: SqliteService,
|
||||
) {
|
||||
this.activatedRoute.paramMap.subscribe(params => {
|
||||
if(params["params"].SerialNumber) {
|
||||
@@ -76,7 +85,10 @@ export class ExpedienteDetailPage implements OnInit {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.LoadTaskDetail(this.serialNumber);
|
||||
this.getFromDB();
|
||||
if(this.onlinecheck) {
|
||||
this.LoadTaskDetail(this.serialNumber);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -88,6 +100,45 @@ export class ExpedienteDetailPage implements OnInit {
|
||||
this.toastService.presentToast('Não foi possível fazer login"');
|
||||
}
|
||||
|
||||
getFromDB() {
|
||||
|
||||
synchro.registerCallback('Online', () => {
|
||||
this.onlinecheck = true;
|
||||
})
|
||||
|
||||
|
||||
synchro.registerCallback('Offline', () => {
|
||||
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 = JSON.parse(process[0].originator)
|
||||
|
||||
this.task = {
|
||||
"SerialNumber": process[0].serialNumber,
|
||||
"Folio": workflow.Subject,
|
||||
"Senders": origina.email,
|
||||
"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
|
||||
}
|
||||
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
async approve(note:string, documents:any) {
|
||||
let body = {
|
||||
@@ -261,6 +312,7 @@ export class ExpedienteDetailPage implements OnInit {
|
||||
}
|
||||
|
||||
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()]);
|
||||
|
||||
@@ -65,13 +65,13 @@
|
||||
</ion-list>
|
||||
|
||||
<div
|
||||
*ngIf="!skeletonLoader && expedienteGdStore.list.length == 0 && expedienteGdStore.list.length == 0"
|
||||
*ngIf="!skeletonLoader && listToPresent.length == 0 && listToPresent.length == 0"
|
||||
class="empty-list d-flex height-100 align-center justify-content-center"
|
||||
>
|
||||
<span>Lista vazia</span>
|
||||
</div>
|
||||
|
||||
<div *ngIf="skeletonLoader && expedienteGdStore.list.length == 0">
|
||||
<div *ngIf="skeletonLoader && listToPresent.length == 0">
|
||||
|
||||
<ion-list>
|
||||
<ion-item>
|
||||
|
||||
@@ -25,6 +25,8 @@ export class ExpedientePage implements OnInit {
|
||||
|
||||
expedienteGdStore = ExpedienteGdStore
|
||||
expedienteTaskPipe = new ExpedienteTaskPipe()
|
||||
onlinecheck: boolean;
|
||||
|
||||
listToPresent;
|
||||
synch = synchro
|
||||
constructor(
|
||||
@@ -40,20 +42,22 @@ export class ExpedientePage implements OnInit {
|
||||
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.getEventsFromLocalDb();
|
||||
|
||||
if (this.onlinecheck) {
|
||||
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()
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async LoadList() {
|
||||
@@ -72,8 +76,8 @@ export class ExpedientePage implements OnInit {
|
||||
this.taskslist.push(task);
|
||||
});
|
||||
|
||||
this.SqliteAddExpediente(this.taskslist)
|
||||
this.expedienteGdStore.reset(this.taskslist);
|
||||
this.listToPresent = this.taskslist
|
||||
console.log('expediente list', this.listToPresent)
|
||||
|
||||
} catch (error) {
|
||||
this.toastService.badRequest('Processo não encontrado')
|
||||
@@ -132,19 +136,38 @@ export class ExpedientePage implements OnInit {
|
||||
|
||||
getEventsFromLocalDb() {
|
||||
|
||||
|
||||
|
||||
synchro.registerCallback('Online', () => {
|
||||
this.listToPresent = this.expedienteGdStore.list;
|
||||
console.log('Onlineee')
|
||||
|
||||
this.onlinecheck = true;
|
||||
})
|
||||
|
||||
|
||||
|
||||
synchro.registerCallback('Offline', () => {
|
||||
this.platform.ready().then(() => {
|
||||
this.sqliteservice.getAllExpedientes().then((expediente) => {
|
||||
this.listToPresent = expediente
|
||||
this.onlinecheck = false;
|
||||
this.taskslist = new Array();
|
||||
this.sqliteservice.getprocessByworkflow("Expediente").then((expediente: any[]) => {
|
||||
|
||||
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
|
||||
console.log("All expedientes from local,", expediente)
|
||||
})
|
||||
console.log('Offlineee')
|
||||
|
||||
@@ -95,7 +95,7 @@
|
||||
<fa-icon class="icon-selected" icon="align-justify"></fa-icon>
|
||||
</div>
|
||||
<p class="text-center exp-card-title ">Todas as tarefas</p>
|
||||
<p class="text-center exp-card-content">{{ totalDocumentStore.count }} <span class="title1">Documentos</span></p>
|
||||
<p class="text-center exp-card-content">{{ allProcessesList.length }} <span class="title1">Documentos</span></p>
|
||||
</div>
|
||||
|
||||
<div (click)="openEventsToApprovePage();selectedElement='approval'" [class.active]="selectedElement == 'approval'" class="box-hover exp-card d-flex flex-column" *ngIf="loggeduser.Profile == 'MDGPR'" >
|
||||
|
||||
@@ -22,39 +22,43 @@ import { CustomTaskPipe } from 'src/app/pipes/custom-task.pipe';
|
||||
import { NotificationsService } from 'src/app/services/notifications.service';
|
||||
import { DespachoService } from 'src/app/Rules/despacho.service';
|
||||
|
||||
import { SqliteService } from '../../services/sqlite.service';
|
||||
import { synchro } from '../../services/socket/synchro.service';
|
||||
import { Platform } from '@ionic/angular';
|
||||
|
||||
@Component({
|
||||
selector: 'app-gabinete-digital',
|
||||
templateUrl: './gabinete-digital.page.html',
|
||||
styleUrls: ['./gabinete-digital.page.scss'],
|
||||
})
|
||||
|
||||
export class GabineteDigitalPage implements OnInit, DoCheck {
|
||||
export class GabineteDigitalPage implements OnInit, DoCheck {
|
||||
|
||||
segment:string;
|
||||
segmentVista:string;
|
||||
segment: string;
|
||||
segmentVista: string;
|
||||
showLoader: boolean;
|
||||
public profile:string;
|
||||
public profile: string;
|
||||
|
||||
allProcessesList: any = new Array();
|
||||
skeletonLoader: boolean;
|
||||
|
||||
count_exp_dailywork=0;
|
||||
count_exp_pr =0
|
||||
count_desp_dailywork=0;
|
||||
count_desp_pending=0;
|
||||
count_par_dailywork=0;
|
||||
count_par_pending=0;
|
||||
count_def_dailywork=0;
|
||||
count_def_pending=0;
|
||||
count_exp_pp : string;
|
||||
count_exp_pd : string;
|
||||
count_dip_apr : string;
|
||||
count_dip_as_pr =0
|
||||
count_dip_pv=0;
|
||||
count_exp_dailywork = 0;
|
||||
count_exp_pr = 0
|
||||
count_desp_dailywork = 0;
|
||||
count_desp_pending = 0;
|
||||
count_par_dailywork = 0;
|
||||
count_par_pending = 0;
|
||||
count_def_dailywork = 0;
|
||||
count_def_pending = 0;
|
||||
count_exp_pp: string;
|
||||
count_exp_pd: string;
|
||||
count_dip_apr: string;
|
||||
count_dip_as_pr = 0
|
||||
count_dip_pv = 0;
|
||||
count_dip_as = 0;
|
||||
count_de_pr = 0;
|
||||
count_ev_apr=0;
|
||||
count_ev_md=0;
|
||||
count_ev_apr = 0;
|
||||
count_ev_md = 0;
|
||||
count_total_pending = 0;
|
||||
count_desp_pr_active = 0;
|
||||
count_all_processes = 0;
|
||||
@@ -63,7 +67,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
|
||||
|
||||
desktopComponent: any = {
|
||||
showEventList: false,
|
||||
showExpediente : false,
|
||||
showExpediente: false,
|
||||
}
|
||||
|
||||
showAllProcesses = false;
|
||||
@@ -81,7 +85,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
|
||||
showSignedDiploma = false;
|
||||
emptyTextDescription = 'Sem opção selecionada';
|
||||
|
||||
serialNumber:string;
|
||||
serialNumber: string;
|
||||
|
||||
loggeduser: LoginUserRespose;
|
||||
mdgpr = "MDGPR";
|
||||
@@ -102,6 +106,8 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
|
||||
//
|
||||
// pipe
|
||||
|
||||
synch = synchro;
|
||||
|
||||
|
||||
customTaskPipe = new CustomTaskPipe()
|
||||
|
||||
@@ -110,7 +116,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
|
||||
@ViewChild(EventsToApprovePage) eventsToApprove: EventsToApprovePage;
|
||||
|
||||
constructor(
|
||||
private processesbackend:ProcessesService,
|
||||
private processesbackend: ProcessesService,
|
||||
private modalController: ModalController,
|
||||
private activatedRoute: ActivatedRoute,
|
||||
private router: Router,
|
||||
@@ -118,26 +124,28 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
|
||||
public p: PermissionService,
|
||||
public waitForDomService: WaitForDomService,
|
||||
private notificationsService: NotificationsService,
|
||||
private despachoRule: DespachoService
|
||||
) {
|
||||
private despachoRule: DespachoService,
|
||||
private sqliteservice: SqliteService,
|
||||
private platform: Platform
|
||||
) {
|
||||
|
||||
this.loggeduser = authService.ValidatedUser;
|
||||
window.onresize = (event) => {
|
||||
// if not mobile remove all component
|
||||
if( window.innerWidth < 701){
|
||||
this.modalController.dismiss();
|
||||
this.segmentVista = "listview";
|
||||
}
|
||||
else{
|
||||
this.segmentVista = "boxview";
|
||||
}
|
||||
};
|
||||
this.checkRoutes();
|
||||
this.loggeduser = authService.ValidatedUser;
|
||||
window.onresize = (event) => {
|
||||
// if not mobile remove all component
|
||||
if (window.innerWidth < 701) {
|
||||
this.modalController.dismiss();
|
||||
this.segmentVista = "listview";
|
||||
}
|
||||
else {
|
||||
this.segmentVista = "boxview";
|
||||
}
|
||||
};
|
||||
this.checkRoutes();
|
||||
|
||||
|
||||
// this.eventoaprovacaostore.resetmd([])
|
||||
// this.eventoaprovacaostore.resetpr([])
|
||||
|
||||
// this.eventoaprovacaostore.resetmd([])
|
||||
// this.eventoaprovacaostore.resetpr([])
|
||||
|
||||
}
|
||||
|
||||
ngDoCheck(): void {
|
||||
@@ -159,22 +167,24 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
if( window.innerWidth < 701) {
|
||||
if (window.innerWidth < 701) {
|
||||
this.segmentVista = "listview";
|
||||
}
|
||||
else{
|
||||
else {
|
||||
this.segmentVista = "boxview"
|
||||
}
|
||||
|
||||
const pathname = window.location.pathname
|
||||
|
||||
this.getAllProcessFromDB()
|
||||
|
||||
|
||||
this.router.events.forEach((event) => {
|
||||
if(event instanceof NavigationEnd && event.url == pathname) {
|
||||
if (event instanceof NavigationEnd && event.url == pathname) {
|
||||
|
||||
this.waitForDomService.selector({
|
||||
selector: 'app-gabinete-digital ion-content .aside-wrapper',
|
||||
callback: ()=> {
|
||||
callback: () => {
|
||||
this.checkRoutes();
|
||||
this.LoadCounts();
|
||||
}
|
||||
@@ -186,7 +196,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
|
||||
|
||||
this.waitForDomService.selector({
|
||||
selector: 'app-gabinete-digital ion-content .aside-wrapper',
|
||||
callback: ()=> {
|
||||
callback: () => {
|
||||
this.loadAllProcesses();
|
||||
}
|
||||
})
|
||||
@@ -194,16 +204,17 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
|
||||
}
|
||||
|
||||
async loadAllProcesses() {
|
||||
let allProcessesList = await this.processesbackend.GetTasksList("", false).toPromise();
|
||||
let allProcessesList = await this.processesbackend.GetTasksList("", false).toPromise();
|
||||
|
||||
if(!this.p.userRole(['PR'])) {
|
||||
allProcessesList = allProcessesList.filter( element => element.activityInstanceName != 'Assinar Diplomas')
|
||||
if (!this.p.userRole(['PR'])) {
|
||||
allProcessesList = allProcessesList.filter(element => element.activityInstanceName != 'Assinar Diplomas')
|
||||
} else if (this.p.userRole(['PR'])) {
|
||||
allProcessesList = allProcessesList.filter( element => element.activityInstanceName != 'Diploma Assinado')
|
||||
allProcessesList = allProcessesList.filter(element => element.activityInstanceName != 'Diploma Assinado')
|
||||
}
|
||||
|
||||
console.log(allProcessesList);
|
||||
|
||||
this.addProcessToDB(allProcessesList)
|
||||
this.skeletonLoader = true;
|
||||
|
||||
this.allProcessesList = [];
|
||||
@@ -211,7 +222,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
|
||||
allProcessesList.forEach(element => {
|
||||
let date = new Date(element.taskStartDate);
|
||||
date.setMonth(date.getMonth() + 1);
|
||||
let taskDate = date.getFullYear()+"-"+ date.getMonth()+"-"+date.getDate()+" "+date.getHours()+":"+date.getMinutes()+ ":"+date.getSeconds();
|
||||
let taskDate = date.getFullYear() + "-" + date.getMonth() + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
|
||||
|
||||
let task = {
|
||||
"SerialNumber": element.serialNumber,
|
||||
@@ -230,117 +241,194 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
|
||||
"customDate": this.setFormatDate(new Date(element.workflowInstanceDataFields.StartDate), new Date(element.workflowInstanceDataFields.EndDate), element.workflowInstanceDataFields.IsAllDayEvent),
|
||||
}
|
||||
|
||||
this.allProcessesList.push(task);
|
||||
this.allProcessesList = removeDuplicate( this.allProcessesList)
|
||||
this.allProcessesList = this.sortArrayISODate(this.allProcessesList).reverse();
|
||||
this.allProcessesList.push(task);
|
||||
this.allProcessesList = removeDuplicate(this.allProcessesList)
|
||||
this.allProcessesList = this.sortArrayISODate(this.allProcessesList).reverse();
|
||||
|
||||
this.totalDocumentStore.resetCount(this.allProcessesList.length)
|
||||
|
||||
this.totalDocumentStore.resetCount( this.allProcessesList.length)
|
||||
});
|
||||
|
||||
this.skeletonLoader = false;
|
||||
|
||||
}
|
||||
|
||||
sortArrayISODate(myArray: any){
|
||||
return myArray.sort(function(a, b) {
|
||||
addProcessToDB(data) {
|
||||
this.platform.ready().then(() => {
|
||||
data.forEach(element => {
|
||||
|
||||
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);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
getAllProcessFromDB() {
|
||||
|
||||
synchro.registerCallback('Online', () => {
|
||||
this.platform.ready().then(() => {
|
||||
this.loadAllProcesses();
|
||||
})
|
||||
})
|
||||
|
||||
synchro.registerCallback('Offline', () => {
|
||||
this.platform.ready().then(() => {
|
||||
|
||||
this.sqliteservice.getAllProcess().then((allprocess: any[]) => {
|
||||
allprocess.forEach(element => {
|
||||
let date = new Date(element.taskStartDate);
|
||||
date.setMonth(date.getMonth() + 1);
|
||||
let taskDate = date.getFullYear() + "-" + date.getMonth() + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
|
||||
|
||||
var workflowInstanceDataFields = JSON.parse(element.workflowInstanceDataFields);
|
||||
console.log("WORKFLOW all process", workflowInstanceDataFields)
|
||||
|
||||
let task = {
|
||||
"SerialNumber": element.serialNumber,
|
||||
"Folio": workflowInstanceDataFields.Subject,
|
||||
"Senders": workflowInstanceDataFields.Sender,
|
||||
"CreateDate": taskDate,
|
||||
"DocumentURL": workflowInstanceDataFields.ViewerRequest,
|
||||
"Remetente": workflowInstanceDataFields.Remetente,
|
||||
"DocumentsQty": element.totalDocuments,
|
||||
"DocId": workflowInstanceDataFields.DispatchDocId,
|
||||
"FolderID": workflowInstanceDataFields.FolderID,
|
||||
"WorkflowName": element.workflowDisplayName,
|
||||
"activityInstanceName": element.activityInstanceName,
|
||||
"Status": workflowInstanceDataFields.Status,
|
||||
"Agenda": workflowInstanceDataFields.Agenda,
|
||||
"customDate": this.setFormatDate(new Date(workflowInstanceDataFields.StartDate), new Date(workflowInstanceDataFields.EndDate), workflowInstanceDataFields.IsAllDayEvent),
|
||||
}
|
||||
|
||||
this.allProcessesList.push(task);
|
||||
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) {
|
||||
return myArray.sort(function (a, b) {
|
||||
return (a.CreateDate < b.CreateDate) ? -1 : ((a.CreateDate > b.CreateDate) ? 1 : 0);
|
||||
});
|
||||
}
|
||||
|
||||
setFormatDate(start:any, end:any, allday:boolean){
|
||||
setFormatDate(start: any, end: any, allday: boolean) {
|
||||
let customDate;
|
||||
/* start = new Date();
|
||||
end= new Date("2021-08-04T18:01:04.753Z"); */
|
||||
//end = new Date("2021-09-04T18:01:04.753Z");
|
||||
|
||||
const totalSeconds = Math.floor((end - (start))/1000);;
|
||||
const totalMinutes = Math.floor(totalSeconds/60);
|
||||
const totalHours = Math.floor(totalMinutes/60);
|
||||
const totalDays = Math.floor(totalHours/24);
|
||||
const totalSeconds = Math.floor((end - (start)) / 1000);;
|
||||
const totalMinutes = Math.floor(totalSeconds / 60);
|
||||
const totalHours = Math.floor(totalMinutes / 60);
|
||||
const totalDays = Math.floor(totalHours / 24);
|
||||
|
||||
const hours = totalHours - ( totalDays * 24 );
|
||||
const minutes = totalMinutes - ( totalDays * 24 * 60 ) - ( hours * 60 );
|
||||
const seconds = totalSeconds - ( totalDays * 24 * 60 * 60 ) - ( hours * 60 * 60 ) - ( minutes * 60 );
|
||||
const hours = totalHours - (totalDays * 24);
|
||||
const minutes = totalMinutes - (totalDays * 24 * 60) - (hours * 60);
|
||||
const seconds = totalSeconds - (totalDays * 24 * 60 * 60) - (hours * 60 * 60) - (minutes * 60);
|
||||
|
||||
let diffDays = totalDays;
|
||||
let diffMinutes = minutes;
|
||||
|
||||
if(totalDays == 0){
|
||||
if(allday){
|
||||
customDate = this.getCustomDate(start)+", "+this.getCustomHours(start)+" (todo dia)";
|
||||
if (totalDays == 0) {
|
||||
if (allday) {
|
||||
customDate = this.getCustomDate(start) + ", " + this.getCustomHours(start) + " (todo dia)";
|
||||
console.log(customDate);
|
||||
return customDate;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
//customDate = this.getCustomDate(start)+","+this.getCustomHours(start)+" ("+minutes+" mins)";
|
||||
customDate = this.getCustomDate(start)+", "+this.getCustomHours(start)+" | "+this.getCustomHours(end);
|
||||
customDate = this.getCustomDate(start) + ", " + this.getCustomHours(start) + " | " + this.getCustomHours(end);
|
||||
return customDate;
|
||||
}
|
||||
}
|
||||
else{
|
||||
customDate = this.getCustomDate(start)+","+this.getCustomHours(start)+
|
||||
" (termina:"+ this.getCustomDate(end)+","+this.getCustomHours(end)+")";
|
||||
else {
|
||||
customDate = this.getCustomDate(start) + "," + this.getCustomHours(start) +
|
||||
" (termina:" + this.getCustomDate(end) + "," + this.getCustomHours(end) + ")";
|
||||
return customDate;
|
||||
}
|
||||
}
|
||||
|
||||
getCustomDate(thedate: Date){
|
||||
getCustomDate(thedate: Date) {
|
||||
return thedate.getDate() + "/" +
|
||||
(thedate.getMonth()+1) + "/" +
|
||||
thedate.getFullYear();
|
||||
(thedate.getMonth() + 1) + "/" +
|
||||
thedate.getFullYear();
|
||||
}
|
||||
getCustomHours(thedate: Date){
|
||||
getCustomHours(thedate: Date) {
|
||||
return thedate.getHours() + ":" +
|
||||
thedate.getMinutes();
|
||||
thedate.getMinutes();
|
||||
}
|
||||
|
||||
goToProcess(serialNumber:string, workflowName:string, activityName:string){
|
||||
if(workflowName == 'Despacho') {
|
||||
if(activityName == 'Tarefa de Despacho'){
|
||||
this.router.navigate(['/home/gabinete-digital/despachos',serialNumber,'gabinete-digital']);
|
||||
goToProcess(serialNumber: string, workflowName: string, activityName: string) {
|
||||
if (workflowName == 'Despacho') {
|
||||
if (activityName == 'Tarefa de Despacho') {
|
||||
this.router.navigate(['/home/gabinete-digital/despachos', serialNumber, 'gabinete-digital']);
|
||||
}
|
||||
}
|
||||
else if(workflowName == 'Despacho do Presidente da República') {
|
||||
if(activityName == 'Tarefa de Despacho'){
|
||||
this.router.navigate(['/home/gabinete-digital/despachos-pr',serialNumber,'gabinete-digital']);
|
||||
else if (workflowName == 'Despacho do Presidente da República') {
|
||||
if (activityName == 'Tarefa de Despacho') {
|
||||
this.router.navigate(['/home/gabinete-digital/despachos-pr', serialNumber, 'gabinete-digital']);
|
||||
}
|
||||
else if(activityName == 'Revisar Diploma' || activityName == 'Assinar Diploma'){
|
||||
this.router.navigate(['/home/gabinete-digital/diplomas',serialNumber,'gabinete-digital']);
|
||||
else if (activityName == 'Revisar Diploma' || activityName == 'Assinar Diploma') {
|
||||
this.router.navigate(['/home/gabinete-digital/diplomas', serialNumber, 'gabinete-digital']);
|
||||
}
|
||||
else if(activityName == 'Diploma Assinado'){
|
||||
this.router.navigate(['/home/gabinete-digital/diplomas-assinar',serialNumber,'gabinete-digital']);
|
||||
else if (activityName == 'Diploma Assinado') {
|
||||
this.router.navigate(['/home/gabinete-digital/diplomas-assinar', serialNumber, 'gabinete-digital']);
|
||||
}
|
||||
}
|
||||
else if(workflowName == 'Pedido de Parecer' || workflowName == 'Pedido de Deferimento') {
|
||||
this.router.navigate(['/home/gabinete-digital/pedidos',serialNumber,'gabinete-digital']);
|
||||
else if (workflowName == 'Pedido de Parecer' || workflowName == 'Pedido de Deferimento') {
|
||||
this.router.navigate(['/home/gabinete-digital/pedidos', serialNumber, 'gabinete-digital']);
|
||||
}
|
||||
else if(workflowName == 'Expediente') {
|
||||
this.router.navigate(['/home/gabinete-digital/expediente',serialNumber,'gabinete-digital']);
|
||||
else if (workflowName == 'Expediente') {
|
||||
this.router.navigate(['/home/gabinete-digital/expediente', serialNumber, 'gabinete-digital']);
|
||||
}
|
||||
else if(workflowName == 'Expediente' && this.loggeduser.Profile == 'PR') {
|
||||
this.router.navigate(['/home/gabinete-digital/expedientes-pr',serialNumber,'gabinete-digital']);
|
||||
else if (workflowName == 'Expediente' && this.loggeduser.Profile == 'PR') {
|
||||
this.router.navigate(['/home/gabinete-digital/expedientes-pr', serialNumber, 'gabinete-digital']);
|
||||
}
|
||||
else if (workflowName == "Pedido de Parecer do Presidente") {
|
||||
this.router.navigate(['/home/gabinete-digital/pedidos',serialNumber,'gabinete-digital']);
|
||||
this.router.navigate(['/home/gabinete-digital/pedidos', serialNumber, 'gabinete-digital']);
|
||||
}
|
||||
/* else if (workflowName == "Expediente") {
|
||||
this.router.navigate(['/home/gabinete-digital/pedidos',serialNumber,'gabinete-digital']);
|
||||
} */
|
||||
else if(workflowName == 'Agenda Pessoal PR' || workflowName == 'Agenda Oficial PR' || workflowName == 'Agenda Oficial MDGPR' || workflowName == 'Agenda Pessoal MDGPR') {
|
||||
this.router.navigate(['/home/gabinete-digital/event-list/approve-event',serialNumber, 'gabinete-digital']);
|
||||
else if (workflowName == 'Agenda Pessoal PR' || workflowName == 'Agenda Oficial PR' || workflowName == 'Agenda Oficial MDGPR' || workflowName == 'Agenda Pessoal MDGPR') {
|
||||
this.router.navigate(['/home/gabinete-digital/event-list/approve-event', serialNumber, 'gabinete-digital']);
|
||||
}
|
||||
else {
|
||||
else {
|
||||
console.log('cant find page for this task')
|
||||
}
|
||||
}
|
||||
|
||||
onSegmentVistaChange(){
|
||||
onSegmentVistaChange() {
|
||||
|
||||
}
|
||||
|
||||
checkUser(){
|
||||
this.selectedElement='allProcessesTag';
|
||||
checkUser() {
|
||||
this.selectedElement = 'allProcessesTag';
|
||||
this.showAllProcesses = true;
|
||||
/* switch(this.loggeduser.Profile){
|
||||
case 'MDGPR':
|
||||
@@ -352,77 +440,77 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
|
||||
} */
|
||||
}
|
||||
|
||||
hideRefreshButton(){
|
||||
hideRefreshButton() {
|
||||
window.onresize = (event) => {
|
||||
if( window.innerWidth < 701) {
|
||||
if (window.innerWidth < 701) {
|
||||
this.hideRefreshBtn = false;
|
||||
this.hideInMobile = false;
|
||||
this.segmentVista = "listview";
|
||||
}
|
||||
else{
|
||||
else {
|
||||
this.hideRefreshBtn = true;
|
||||
this.hideInMobile = true;
|
||||
this.segmentVista = "boxview";
|
||||
}
|
||||
}
|
||||
if(window.innerWidth < 701){
|
||||
if (window.innerWidth < 701) {
|
||||
this.hideRefreshBtn = false;
|
||||
this.hideInMobile = false;
|
||||
this.segmentVista = "listview";
|
||||
}
|
||||
else{
|
||||
else {
|
||||
this.hideRefreshBtn = true;
|
||||
this.hideInMobile = true;
|
||||
this.segmentVista = "boxview";
|
||||
}
|
||||
}
|
||||
|
||||
checkRoutes(){
|
||||
checkRoutes() {
|
||||
this.closeAllDesktopComponents();
|
||||
if(this.router.url == '/home/gabinete-digital?processes=true'){
|
||||
if (this.router.url == '/home/gabinete-digital?processes=true') {
|
||||
this.openAllProcessesPage();
|
||||
this.selectedElement='allProcessesTag';
|
||||
this.selectedElement = 'allProcessesTag';
|
||||
}
|
||||
if(this.router.url == '/home/gabinete-digital?eventos=true'){
|
||||
if (this.router.url == '/home/gabinete-digital?eventos=true') {
|
||||
this.openEventsToApprovePage();
|
||||
this.selectedElement='approval';
|
||||
this.selectedElement = 'approval';
|
||||
}
|
||||
else if(this.router.url == '/home/gabinete-digital?expedientes=true'){
|
||||
else if (this.router.url == '/home/gabinete-digital?expedientes=true') {
|
||||
this.openExpedientListPage();
|
||||
if(this.loggeduser.Profile == 'MDGPR'){
|
||||
this.selectedElement='Correspondence';
|
||||
if (this.loggeduser.Profile == 'MDGPR') {
|
||||
this.selectedElement = 'Correspondence';
|
||||
}
|
||||
else{
|
||||
this.selectedElement='Expediente Presidente'
|
||||
else {
|
||||
this.selectedElement = 'Expediente Presidente'
|
||||
}
|
||||
}
|
||||
else if(this.router.url == '/home/gabinete-digital?pendentes=true'){
|
||||
else if (this.router.url == '/home/gabinete-digital?pendentes=true') {
|
||||
this.openPendentesPage('');
|
||||
this.selectedElement='Pending';
|
||||
this.selectedElement = 'Pending';
|
||||
}
|
||||
else if(this.router.url == '/home/gabinete-digital?despachos=true'){
|
||||
else if (this.router.url == '/home/gabinete-digital?despachos=true') {
|
||||
this.openDespachosPage('');
|
||||
this.selectedElement='Dispatches';
|
||||
this.selectedElement = 'Dispatches';
|
||||
}
|
||||
else if(this.router.url == '/home/gabinete-digital?pedidos=true'){
|
||||
else if (this.router.url == '/home/gabinete-digital?pedidos=true') {
|
||||
this.openPedidosPage('parecer');
|
||||
this.selectedElement='RequestsForOpinion';
|
||||
this.selectedElement = 'RequestsForOpinion';
|
||||
}
|
||||
else if(this.router.url == '/home/gabinete-digital?expedientespr=true'){
|
||||
else if (this.router.url == '/home/gabinete-digital?expedientespr=true') {
|
||||
this.openExpedientesPrPage();
|
||||
this.selectedElement='Expediente Presidente'
|
||||
this.selectedElement = 'Expediente Presidente'
|
||||
}
|
||||
else if(this.router.url == '/home/gabinete-digital?despachospr=true'){
|
||||
else if (this.router.url == '/home/gabinete-digital?despachospr=true') {
|
||||
this.openDespachosPrPage('');
|
||||
this.selectedElement='DispatchesPr'
|
||||
this.selectedElement = 'DispatchesPr'
|
||||
}
|
||||
else if(this.router.url == '/home/gabinete-digital?diplomas=true'){
|
||||
else if (this.router.url == '/home/gabinete-digital?diplomas=true') {
|
||||
this.openDiplomasPage('validar');
|
||||
this.selectedElement='DiplomasPorValidar';
|
||||
this.selectedElement = 'DiplomasPorValidar';
|
||||
}
|
||||
else if(this.router.url == '/home/gabinete-digital?diplomasassinar=true'){
|
||||
this. openDiplomasAssinarPage();
|
||||
this.selectedElement='DiplomasAssinar';
|
||||
else if (this.router.url == '/home/gabinete-digital?diplomasassinar=true') {
|
||||
this.openDiplomasAssinarPage();
|
||||
this.selectedElement = 'DiplomasAssinar';
|
||||
}
|
||||
else if (this.router.url == '/home/gabinete-digital?parecer=true') {
|
||||
this.openPedidosPage('parecer')
|
||||
@@ -430,7 +518,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
|
||||
else if (this.router.url == '/home/gabinete-digital?deferimento=true') {
|
||||
this.openPedidosPage('deferimento')
|
||||
}
|
||||
else{
|
||||
else {
|
||||
this.checkUser();
|
||||
}
|
||||
}
|
||||
@@ -464,8 +552,8 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
|
||||
this.expedientegbstore.count = expedientes.length
|
||||
|
||||
|
||||
let despachos = await this.despachoRule.getList({updateStore: true})
|
||||
if(despachos) {
|
||||
let despachos = await this.despachoRule.getList({ updateStore: true })
|
||||
if (despachos) {
|
||||
this.despachoStore.reset(despachos)
|
||||
}
|
||||
|
||||
@@ -481,7 +569,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
|
||||
this.count_def_dailywork = Object.keys(deferimentos.filter(data => data.workflowInstanceDataFields.Status == "Active")).length;
|
||||
this.pedidosstore.countdeferimento = this.count_def_dailywork;
|
||||
|
||||
let pendentes =await this.processesbackend.GetPendingTasks(false).toPromise();
|
||||
let pendentes = await this.processesbackend.GetPendingTasks(false).toPromise();
|
||||
this.count_total_pending = Object.keys(pendentes).length;
|
||||
this.pendentesstore.count = this.count_total_pending;
|
||||
|
||||
@@ -531,7 +619,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
|
||||
this.count_dip_as_pr = Object.keys(diplomasAssinados).length;
|
||||
this.deplomasStore.resetDiplomasAssinadoList(diplomasAssinados)
|
||||
|
||||
this.processesbackend.GetToApprovedEvents('Agenda','true').subscribe(res=>{
|
||||
this.processesbackend.GetToApprovedEvents('Agenda', 'true').subscribe(res => {
|
||||
this.count_ev_apr = res;
|
||||
});
|
||||
|
||||
@@ -547,55 +635,55 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
|
||||
console.log(event);
|
||||
|
||||
// this.closeAllDesktopComponents();
|
||||
/* switch(this.loggeduser.Profile){
|
||||
case 'MDGPR':
|
||||
this.selectedElement='Correspondence';
|
||||
this.showExpedients = true;
|
||||
this.expedientesPage.doRefresh();
|
||||
break;
|
||||
case 'PR':
|
||||
this.selectedElement='ExpedientesPr';
|
||||
this.showExpedientesPr = true;
|
||||
break;
|
||||
} */
|
||||
/* switch(this.loggeduser.Profile){
|
||||
case 'MDGPR':
|
||||
this.selectedElement='Correspondence';
|
||||
this.showExpedients = true;
|
||||
this.expedientesPage.doRefresh();
|
||||
break;
|
||||
case 'PR':
|
||||
this.selectedElement='ExpedientesPr';
|
||||
this.showExpedientesPr = true;
|
||||
break;
|
||||
} */
|
||||
this.LoadCounts();
|
||||
//this.refreshExpedientes();
|
||||
|
||||
if(event){
|
||||
if (event) {
|
||||
setTimeout(() => {
|
||||
event.target.complete();
|
||||
}, 2000);
|
||||
}
|
||||
else{
|
||||
else {
|
||||
console.log('null');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
selectedElementF(element:string) {
|
||||
selectedElementF(element: string) {
|
||||
if (window.innerWidth > 701) {
|
||||
return element == this.selectedElement
|
||||
return element == this.selectedElement
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
openAllProcessesPage() {
|
||||
this.closeAllDesktopComponents();
|
||||
let navigationExtras: NavigationExtras = { queryParams: {"processes": true,}};
|
||||
if( window.innerWidth < 701) {
|
||||
let navigationExtras: NavigationExtras = { queryParams: { "processes": true, } };
|
||||
if (window.innerWidth < 701) {
|
||||
this.router.navigate(['/home/gabinete-digital']);
|
||||
}
|
||||
else {
|
||||
this.router.navigate(['/home/gabinete-digital'], navigationExtras);
|
||||
this.showAllProcesses = true;
|
||||
this.selectedElement="allProcessesTag";
|
||||
this.selectedElement = "allProcessesTag";
|
||||
}
|
||||
}
|
||||
|
||||
openEventsToApprovePage() {
|
||||
this.closeAllDesktopComponents();
|
||||
let navigationExtras: NavigationExtras = { queryParams: {"eventos": true,}};
|
||||
if( window.innerWidth < 701) {
|
||||
let navigationExtras: NavigationExtras = { queryParams: { "eventos": true, } };
|
||||
if (window.innerWidth < 701) {
|
||||
//this.openEventsToApproveList(profile);
|
||||
this.router.navigate(['/home/gabinete-digital/event-list']);
|
||||
}
|
||||
@@ -608,26 +696,26 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
|
||||
|
||||
openExpedientListPage() {
|
||||
this.closeAllDesktopComponents();
|
||||
switch(this.loggeduser.Profile){
|
||||
switch (this.loggeduser.Profile) {
|
||||
case 'MDGPR':
|
||||
if( window.innerWidth < 701) {
|
||||
if (window.innerWidth < 701) {
|
||||
//this.openExpedientList();
|
||||
this.router.navigate(['/home/gabinete-digital/expediente']);
|
||||
}
|
||||
else {
|
||||
this.selectedElement='Correspondence'
|
||||
let navigationExtras: NavigationExtras = { queryParams: {"expedientes": true,}};
|
||||
this.selectedElement = 'Correspondence'
|
||||
let navigationExtras: NavigationExtras = { queryParams: { "expedientes": true, } };
|
||||
this.router.navigate(['/home/gabinete-digital'], navigationExtras);
|
||||
this.showExpedients = true;
|
||||
}
|
||||
break;
|
||||
case 'PR':
|
||||
if( window.innerWidth < 701) {
|
||||
if (window.innerWidth < 701) {
|
||||
this.router.navigate(['/home/gabinete-digital/expedientes-pr']);
|
||||
}
|
||||
else {
|
||||
this.selectedElement='ExpedientesPr'
|
||||
let navigationExtras: NavigationExtras = { queryParams: {"expedientes": true,}};
|
||||
this.selectedElement = 'ExpedientesPr'
|
||||
let navigationExtras: NavigationExtras = { queryParams: { "expedientes": true, } };
|
||||
this.router.navigate(['/home/gabinete-digital'], navigationExtras);
|
||||
this.showExpedientesPr = true;
|
||||
}
|
||||
@@ -636,20 +724,20 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
|
||||
|
||||
}
|
||||
|
||||
openPedidosPage(segment:string) {
|
||||
openPedidosPage(segment: string) {
|
||||
this.closeAllDesktopComponents();
|
||||
|
||||
let navigationExtras: NavigationExtras;
|
||||
|
||||
if (segment == 'deferimento') {
|
||||
navigationExtras= { queryParams: {"deferimento": true,}};
|
||||
navigationExtras = { queryParams: { "deferimento": true, } };
|
||||
this.segment = 'deferimento'
|
||||
} else if (segment == 'parecer') {
|
||||
navigationExtras = { queryParams: {"parecer": true,}};
|
||||
navigationExtras = { queryParams: { "parecer": true, } };
|
||||
this.segment = 'parecer'
|
||||
}
|
||||
|
||||
if( window.innerWidth < 701) {
|
||||
if (window.innerWidth < 701) {
|
||||
this.router.navigate(['/home/gabinete-digital/pedidos'], navigationExtras);
|
||||
}
|
||||
else {
|
||||
@@ -659,78 +747,78 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
|
||||
if (segment == 'deferimento') {
|
||||
this.selectedElement = 'RequestForApproval'
|
||||
} else if (segment == 'parecer') {
|
||||
this.selectedElement='RequestsForOpinion'
|
||||
this.selectedElement = 'RequestsForOpinion'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
openDespachosPage(segment?:string) {
|
||||
openDespachosPage(segment?: string) {
|
||||
this.closeAllDesktopComponents();
|
||||
if( window.innerWidth < 701){
|
||||
if (window.innerWidth < 701) {
|
||||
this.router.navigate(['/home/gabinete-digital/despachos']);
|
||||
}
|
||||
else{
|
||||
let navigationExtras: NavigationExtras = {queryParams: {"despachos": true,}};
|
||||
else {
|
||||
let navigationExtras: NavigationExtras = { queryParams: { "despachos": true, } };
|
||||
this.router.navigate(['/home/gabinete-digital'], navigationExtras);
|
||||
this.showDespachos = true;
|
||||
}
|
||||
}
|
||||
|
||||
openDespachosPrPage(segment?:string) {
|
||||
openDespachosPrPage(segment?: string) {
|
||||
this.closeAllDesktopComponents();
|
||||
if( window.innerWidth < 701){
|
||||
if (window.innerWidth < 701) {
|
||||
this.router.navigate(['/home/gabinete-digital/despachos-pr']);
|
||||
}
|
||||
else{
|
||||
let navigationExtras: NavigationExtras = {queryParams: {"despachospr": true,}};
|
||||
else {
|
||||
let navigationExtras: NavigationExtras = { queryParams: { "despachospr": true, } };
|
||||
this.router.navigate(['/home/gabinete-digital'], navigationExtras);
|
||||
this.showDespachosPr = true;
|
||||
}
|
||||
}
|
||||
|
||||
openPendentesPage(segment?:string){
|
||||
openPendentesPage(segment?: string) {
|
||||
this.closeAllDesktopComponents();
|
||||
if( window.innerWidth < 701){
|
||||
if (window.innerWidth < 701) {
|
||||
this.router.navigate(['/home/gabinete-digital/pendentes']);
|
||||
}
|
||||
else{
|
||||
let navigationExtras: NavigationExtras = { queryParams: {"pendentes": true,}};
|
||||
else {
|
||||
let navigationExtras: NavigationExtras = { queryParams: { "pendentes": true, } };
|
||||
this.router.navigate(['/home/gabinete-digital'], navigationExtras);
|
||||
this.showPendentes = true;
|
||||
}
|
||||
}
|
||||
|
||||
openExpedientesPrPage(segment?:string){
|
||||
openExpedientesPrPage(segment?: string) {
|
||||
this.closeAllDesktopComponents();
|
||||
if( window.innerWidth < 701) {
|
||||
if (window.innerWidth < 701) {
|
||||
this.router.navigate(['/home/gabinete-digital/expedientes-pr']);
|
||||
}
|
||||
else {
|
||||
this.selectedElement='ExpedientesPr'
|
||||
let navigationExtras: NavigationExtras = { queryParams: {"expedientespr": true,}};
|
||||
this.selectedElement = 'ExpedientesPr'
|
||||
let navigationExtras: NavigationExtras = { queryParams: { "expedientespr": true, } };
|
||||
this.router.navigate(['/home/gabinete-digital'], navigationExtras);
|
||||
this.showExpedientesPr = true;
|
||||
}
|
||||
}
|
||||
|
||||
openDiplomasPage(segment:string) {
|
||||
openDiplomasPage(segment: string) {
|
||||
let navigationExtras: NavigationExtras;
|
||||
|
||||
if (segment == 'validar') {
|
||||
navigationExtras= { queryParams: {"validar": true,}};
|
||||
navigationExtras = { queryParams: { "validar": true, } };
|
||||
} else if (segment == 'assinados') {
|
||||
navigationExtras = { queryParams: {"assinados": true,}};
|
||||
navigationExtras = { queryParams: { "assinados": true, } };
|
||||
}
|
||||
|
||||
this.segment = segment;
|
||||
|
||||
if( window.innerWidth < 701){
|
||||
if (window.innerWidth < 701) {
|
||||
this.router.navigate(['/home/gabinete-digital/diplomas'], navigationExtras);
|
||||
}
|
||||
else{
|
||||
else {
|
||||
this.closeAllDesktopComponents();
|
||||
this.segment = segment;
|
||||
let navigationExtras: NavigationExtras = { queryParams: {"diplomas": true,}};
|
||||
let navigationExtras: NavigationExtras = { queryParams: { "diplomas": true, } };
|
||||
this.router.navigate(['/home/gabinete-digital'], navigationExtras);
|
||||
this.showDiplomas = true;
|
||||
}
|
||||
@@ -738,14 +826,14 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
|
||||
|
||||
openDiplomasAssinarPage() {
|
||||
this.closeAllDesktopComponents();
|
||||
if( window.innerWidth < 701){
|
||||
this.router.navigate(['/home/gabinete-digital/diplomas-assinar']);
|
||||
}
|
||||
else{
|
||||
let navigationExtras: NavigationExtras = { queryParams: {"diplomasassinar": true,}};
|
||||
this.router.navigate(['/home/gabinete-digital'], navigationExtras);
|
||||
this.showDiplomasAssinar = true;
|
||||
}
|
||||
if (window.innerWidth < 701) {
|
||||
this.router.navigate(['/home/gabinete-digital/diplomas-assinar']);
|
||||
}
|
||||
else {
|
||||
let navigationExtras: NavigationExtras = { queryParams: { "diplomasassinar": true, } };
|
||||
this.router.navigate(['/home/gabinete-digital'], navigationExtras);
|
||||
this.showDiplomasAssinar = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ export class LoginPage implements OnInit {
|
||||
|
||||
if (attempt.UserId == SessionStore.user.UserId) {
|
||||
await this.authService.SetSession(attempt, this.userattempt);
|
||||
//await this.authService.loginChat(this.userattempt);
|
||||
await this.authService.loginChat(this.userattempt);
|
||||
this.getToken();
|
||||
SessionStore.setInativity(true);
|
||||
|
||||
|
||||
@@ -11,8 +11,11 @@ export class SqliteService {
|
||||
readonly db_name: string = "gabinetedigital.db";
|
||||
readonly events: string = "Events";
|
||||
readonly expedientes: string = "Expedientes";
|
||||
readonly allprocess: string = "ALLPROCESS";
|
||||
EVENTS: Array<any>;
|
||||
EXPEDIENTES: Array<any>;
|
||||
ALLPROCESS: Array<any>;
|
||||
PROCESS: Array<any>;
|
||||
|
||||
constructor(private platform: Platform,
|
||||
private sqlite: SQLite) {
|
||||
@@ -75,6 +78,28 @@ export class SqliteService {
|
||||
console.log("Sucess Espedientes Table created: ", res)
|
||||
})
|
||||
.catch((error) => console.log(JSON.stringify(error)));
|
||||
|
||||
await sqLite.executeSql(`
|
||||
CREATE TABLE IF NOT EXISTS ${this.allprocess} (
|
||||
serialNumber varchar(255) PRIMARY KEY,
|
||||
workflowInstanceFolio varchar(255),
|
||||
Documents Text,
|
||||
actions Text,
|
||||
activityInstanceName varchar(255),
|
||||
formURL varchar(255),
|
||||
originator Text,
|
||||
taskStartDate varchar(255),
|
||||
totalDocuments INTERGER,
|
||||
workflowDisplayName varchar(255),
|
||||
workflowID INTERGER,
|
||||
workflowInstanceDataFields Text,
|
||||
workflowInstanceID INTERGER,
|
||||
workflowName varchar(255)
|
||||
)`, [])
|
||||
.then((res) => {
|
||||
console.log("Sucess AllProcess Table created: ", res)
|
||||
})
|
||||
.catch((error) => console.log(JSON.stringify(error)));
|
||||
})
|
||||
.catch((error) => console.log(JSON.stringify(error)));
|
||||
});
|
||||
@@ -107,6 +132,42 @@ export class SqliteService {
|
||||
console.log(JSON.stringify(e.err));
|
||||
});
|
||||
}
|
||||
|
||||
//addprocess
|
||||
public addProcess(data) {
|
||||
this.dbInstance.executeSql(`
|
||||
INSERT OR IGNORE INTO ${this.allprocess} (serialNumber,workflowInstanceFolio,Documents,actions,activityInstanceName,formURL,originator,taskStartDate,totalDocuments,workflowDisplayName,workflowID,workflowInstanceDataFields,workflowInstanceID,workflowName)
|
||||
VALUES ('${data.serialNumber}','${data.workflowInstanceFolio}', '${JSON.stringify(data.Documents)}','${JSON.stringify(data.actions)}','${data.activityInstanceName}','${data.formURL}','${JSON.stringify(data.originator)}','${data.taskStartDate}','${data.totalDocuments}','${data.workflowDisplayName}','${data.workflowID}',
|
||||
'${JSON.stringify(data.workflowInstanceDataFields)}','${data.workflowInstanceID}','${data.workflowName}')`, [])
|
||||
.then(() => {
|
||||
console.log("process add with Success");
|
||||
|
||||
}, (e) => {
|
||||
console.log(JSON.stringify(e.err));
|
||||
});
|
||||
}
|
||||
|
||||
//updateprocess
|
||||
public updateProcess(data) {
|
||||
this.dbInstance.executeSql(`
|
||||
INSERT OR REPLACE INTO ${this.allprocess} (serialNumber,workflowInstanceFolio,Documents,actions,activityInstanceName,formURL,originator,taskStartDate,totalDocuments,workflowDisplayName,workflowID,workflowInstanceDataFields,workflowInstanceID,workflowName)
|
||||
VALUES ('${data.serialNumber}','${data.workflowInstanceFolio}', '${JSON.stringify(data.Documents)}','${JSON.stringify(data.actions)}','${data.activityInstanceName}','${data.formURL}','${JSON.stringify(data.originator)}','${data.taskStartDate}','${data.totalDocuments}','${data.workflowDisplayName}','${data.workflowID}',
|
||||
'${JSON.stringify(data.workflowInstanceDataFields)}','${data.workflowInstanceID}','${data.workflowName}')`, [])
|
||||
.then(() => {
|
||||
console.log("process add with Success");
|
||||
|
||||
}, (e) => {
|
||||
console.log(JSON.stringify(e.err));
|
||||
});
|
||||
}
|
||||
|
||||
//updateAttachment
|
||||
updateUser(id, document,) {
|
||||
let data = [document];
|
||||
return this.dbInstance.executeSql(`UPDATE ${this.allprocess} SET Documents = ? WHERE serialNumber = ${id}`, [document]).then(() => {
|
||||
console.log("process attachment updated")
|
||||
})
|
||||
}
|
||||
//getAllEvents
|
||||
getAllEvents() {
|
||||
var hashattachment = false;
|
||||
@@ -174,6 +235,64 @@ export class SqliteService {
|
||||
});
|
||||
}
|
||||
|
||||
getAllProcess() {
|
||||
return this.dbInstance.executeSql(`SELECT * FROM ${this.allprocess}`, []).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));
|
||||
});
|
||||
}
|
||||
|
||||
//getlistOfEventAprove
|
||||
getListOfEventAprove(process, type) {
|
||||
return this.dbInstance.executeSql(`SELECT * FROM ${this.allprocess} WHERE workflowDisplayName = ? OR workflowDisplayName = ? `, [process,type]).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) => {
|
||||
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 = [];
|
||||
if (res.rows.length > 0) {
|
||||
for (var i = 0; i < res.rows.length; i++) {
|
||||
this.PROCESS.push(res.rows.item(i))
|
||||
}
|
||||
return this.PROCESS;
|
||||
}
|
||||
}, (e) => {
|
||||
console.log(" Get process by serial error", JSON.stringify(e));
|
||||
});
|
||||
}
|
||||
|
||||
//getEventBy id
|
||||
getEventById(id) {
|
||||
|
||||
@@ -234,7 +353,7 @@ export class SqliteService {
|
||||
IsMeeting: ismeeting,
|
||||
IsRecurring: isrecurring,
|
||||
IsAllDayEvent: isallday,
|
||||
Body: res.rows.item(i).Body,
|
||||
Body: res.rows.item(i).Body,
|
||||
AppointmentState: res.rows.item(i).AppointmentState,
|
||||
TimeZone: res.rows.item(i).TimeZone,
|
||||
Organizer: res.rows.item(i).Organizer,
|
||||
|
||||
@@ -4,6 +4,9 @@ import { LoginUserRespose } from 'src/app/models/user.model';
|
||||
import { AuthService } from 'src/app/services/auth.service';
|
||||
import { ProcessesService } from 'src/app/services/processes.service';
|
||||
import { removeDuplicate } from 'src/plugin/removeDuplicate.js';
|
||||
import { SqliteService } from '../../../services/sqlite.service';
|
||||
import { synchro } from '../../../services/socket/synchro.service';
|
||||
import { Platform } from '@ionic/angular';
|
||||
|
||||
@Component({
|
||||
selector: 'app-all-processes',
|
||||
@@ -13,29 +16,55 @@ import { removeDuplicate } from 'src/plugin/removeDuplicate.js';
|
||||
export class AllProcessesPage implements OnInit {
|
||||
|
||||
skeletonLoader = true;
|
||||
allProcessesList:any[] = [];
|
||||
allProcessesList: any[] = [];
|
||||
loggeduser: LoginUserRespose;
|
||||
|
||||
synch = synchro;
|
||||
|
||||
constructor(
|
||||
private processesService: ProcessesService,
|
||||
private router: Router,
|
||||
private authService: AuthService,
|
||||
private sqliteservice: SqliteService,
|
||||
private platform: Platform
|
||||
) {
|
||||
this.loggeduser = authService.ValidatedUser;
|
||||
}
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
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();
|
||||
}
|
||||
}
|
||||
});
|
||||
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')
|
||||
}) */
|
||||
}
|
||||
|
||||
doRefresh() {
|
||||
@@ -52,9 +81,10 @@ export class AllProcessesPage implements OnInit {
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
async loadAllProcesses(){
|
||||
let allProcessesList = await this.processesService.GetTasksList("", false).toPromise();
|
||||
async loadAllProcesses() {
|
||||
let allProcessesList = await this.processesService.GetTasksList("", false).toPromise();
|
||||
console.log(allProcessesList);
|
||||
this.addProcessToDB(allProcessesList)
|
||||
|
||||
this.skeletonLoader = true;
|
||||
|
||||
@@ -63,7 +93,8 @@ export class AllProcessesPage implements OnInit {
|
||||
allProcessesList.forEach(element => {
|
||||
let date = new Date(element.taskStartDate);
|
||||
date.setMonth(date.getMonth() + 1);
|
||||
let taskDate = date.getFullYear()+"-"+ date.getMonth()+"-"+date.getDate()+" "+date.getHours()+":"+date.getMinutes()+ ":"+date.getSeconds();
|
||||
let taskDate = date.getFullYear() + "-" + date.getMonth() + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
|
||||
|
||||
|
||||
let task = {
|
||||
"SerialNumber": element.serialNumber,
|
||||
@@ -81,104 +112,194 @@ export class AllProcessesPage implements OnInit {
|
||||
"Agenda": element.workflowInstanceDataFields.Agenda,
|
||||
"customDate": this.setFormatDate(new Date(element.workflowInstanceDataFields.StartDate), new Date(element.workflowInstanceDataFields.EndDate), element.workflowInstanceDataFields.IsAllDayEvent),
|
||||
}
|
||||
this.allProcessesList.push(task);
|
||||
this.allProcessesList = removeDuplicate( this.allProcessesList)
|
||||
this.allProcessesList = this.sortArrayISODate(this.allProcessesList).reverse();
|
||||
this.allProcessesList.push(task);
|
||||
this.allProcessesList = removeDuplicate(this.allProcessesList)
|
||||
this.allProcessesList = this.sortArrayISODate(this.allProcessesList).reverse();
|
||||
|
||||
});
|
||||
|
||||
this.skeletonLoader = false;
|
||||
}
|
||||
|
||||
sortArrayISODate(myArray: any){
|
||||
return myArray.sort(function(a, b) {
|
||||
|
||||
addProcessToDB(data) {
|
||||
|
||||
data.forEach(element => {
|
||||
|
||||
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);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
getAllProcessFromDB() {
|
||||
|
||||
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[]) => {
|
||||
allprocess.forEach(element => {
|
||||
let date = new Date(element.taskStartDate);
|
||||
date.setMonth(date.getMonth() + 1);
|
||||
let taskDate = date.getFullYear() + "-" + date.getMonth() + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
|
||||
|
||||
var workflowInstanceDataFields = JSON.parse(element.workflowInstanceDataFields);
|
||||
console.log("WORKFLOW all process", workflowInstanceDataFields)
|
||||
|
||||
let task = {
|
||||
"SerialNumber": element.serialNumber,
|
||||
"Folio": workflowInstanceDataFields.Subject,
|
||||
"Senders": workflowInstanceDataFields.Sender,
|
||||
"CreateDate": taskDate,
|
||||
"DocumentURL": workflowInstanceDataFields.ViewerRequest,
|
||||
"Remetente": workflowInstanceDataFields.Remetente,
|
||||
"DocumentsQty": element.totalDocuments,
|
||||
"DocId": workflowInstanceDataFields.DispatchDocId,
|
||||
"FolderID": workflowInstanceDataFields.FolderID,
|
||||
"WorkflowName": element.workflowDisplayName,
|
||||
"activityInstanceName": element.activityInstanceName,
|
||||
"Status": workflowInstanceDataFields.Status,
|
||||
"Agenda": workflowInstanceDataFields.Agenda,
|
||||
"customDate": this.setFormatDate(new Date(workflowInstanceDataFields.StartDate), new Date(workflowInstanceDataFields.EndDate), workflowInstanceDataFields.IsAllDayEvent),
|
||||
}
|
||||
|
||||
this.allProcessesList.push(task);
|
||||
this.allProcessesList = removeDuplicate(this.allProcessesList)
|
||||
this.allProcessesList = this.sortArrayISODate(this.allProcessesList).reverse();
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
this.allProcessesList = allprocess;
|
||||
console.log("All process from db ", allprocess)
|
||||
})
|
||||
})
|
||||
console.log('Offlineee')
|
||||
})
|
||||
}
|
||||
|
||||
sortArrayISODate(myArray: any) {
|
||||
return myArray.sort(function (a, b) {
|
||||
return (a.CreateDate < b.CreateDate) ? -1 : ((a.CreateDate > b.CreateDate) ? 1 : 0);
|
||||
});
|
||||
}
|
||||
|
||||
setFormatDate(start:any, end:any, allday:boolean){
|
||||
setFormatDate(start: any, end: any, allday: boolean) {
|
||||
let customDate;
|
||||
/* start = new Date();
|
||||
end= new Date("2021-08-04T18:01:04.753Z"); */
|
||||
//end = new Date("2021-09-04T18:01:04.753Z");
|
||||
|
||||
const totalSeconds = Math.floor((end - (start))/1000);;
|
||||
const totalMinutes = Math.floor(totalSeconds/60);
|
||||
const totalHours = Math.floor(totalMinutes/60);
|
||||
const totalDays = Math.floor(totalHours/24);
|
||||
const totalSeconds = Math.floor((end - (start)) / 1000);;
|
||||
const totalMinutes = Math.floor(totalSeconds / 60);
|
||||
const totalHours = Math.floor(totalMinutes / 60);
|
||||
const totalDays = Math.floor(totalHours / 24);
|
||||
|
||||
const hours = totalHours - ( totalDays * 24 );
|
||||
const minutes = totalMinutes - ( totalDays * 24 * 60 ) - ( hours * 60 );
|
||||
const seconds = totalSeconds - ( totalDays * 24 * 60 * 60 ) - ( hours * 60 * 60 ) - ( minutes * 60 );
|
||||
const hours = totalHours - (totalDays * 24);
|
||||
const minutes = totalMinutes - (totalDays * 24 * 60) - (hours * 60);
|
||||
const seconds = totalSeconds - (totalDays * 24 * 60 * 60) - (hours * 60 * 60) - (minutes * 60);
|
||||
|
||||
let diffDays = totalDays;
|
||||
let diffMinutes = minutes;
|
||||
|
||||
if(totalDays == 0) {
|
||||
if(allday) {
|
||||
customDate = this.getCustomDate(start)+", "+this.getCustomHours(start)+" (todo dia)";
|
||||
if (totalDays == 0) {
|
||||
if (allday) {
|
||||
customDate = this.getCustomDate(start) + ", " + this.getCustomHours(start) + " (todo dia)";
|
||||
console.log(customDate);
|
||||
return customDate;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
//customDate = this.getCustomDate(start)+","+this.getCustomHours(start)+" ("+minutes+" mins)";
|
||||
customDate = this.getCustomDate(start)+", "+this.getCustomHours(start)+" | "+this.getCustomHours(end);
|
||||
customDate = this.getCustomDate(start) + ", " + this.getCustomHours(start) + " | " + this.getCustomHours(end);
|
||||
return customDate;
|
||||
}
|
||||
}
|
||||
else{
|
||||
customDate = this.getCustomDate(start)+","+this.getCustomHours(start)+
|
||||
" (termina:"+ this.getCustomDate(end)+","+this.getCustomHours(end)+")";
|
||||
else {
|
||||
customDate = this.getCustomDate(start) + "," + this.getCustomHours(start) +
|
||||
" (termina:" + this.getCustomDate(end) + "," + this.getCustomHours(end) + ")";
|
||||
return customDate;
|
||||
}
|
||||
}
|
||||
|
||||
getCustomDate(thedate: Date){
|
||||
return (thedate.getDay()+1) + "/" +
|
||||
(thedate.getMonth()+1) + "/" +
|
||||
thedate.getFullYear();
|
||||
getCustomDate(thedate: Date) {
|
||||
return (thedate.getDay() + 1) + "/" +
|
||||
(thedate.getMonth() + 1) + "/" +
|
||||
thedate.getFullYear();
|
||||
}
|
||||
getCustomHours(thedate: Date){
|
||||
getCustomHours(thedate: Date) {
|
||||
return thedate.getHours() + ":" +
|
||||
thedate.getMinutes();
|
||||
thedate.getMinutes();
|
||||
}
|
||||
|
||||
goToProcess(serialNumber:string, workflowName:string, activityName:string){
|
||||
if(workflowName == 'Despacho') {
|
||||
if(activityName == 'Tarefa de Despacho'|| activityName == 'Concluir Despacho'){
|
||||
this.router.navigate(['/home/gabinete-digital/despachos',serialNumber,'gabinete-digital']);
|
||||
goToProcess(serialNumber: string, workflowName: string, activityName: string) {
|
||||
if (workflowName == 'Despacho') {
|
||||
if (activityName == 'Tarefa de Despacho' || activityName == 'Concluir Despacho') {
|
||||
this.router.navigate(['/home/gabinete-digital/despachos', serialNumber, 'gabinete-digital']);
|
||||
}
|
||||
}
|
||||
else if(workflowName == 'Despacho do Presidente da República') {
|
||||
if(activityName == 'Tarefa de Despacho' || activityName == 'Concluir Despacho'){
|
||||
this.router.navigate(['/home/gabinete-digital/despachos-pr',serialNumber,'gabinete-digital']);
|
||||
else if (workflowName == 'Despacho do Presidente da República') {
|
||||
if (activityName == 'Tarefa de Despacho' || activityName == 'Concluir Despacho') {
|
||||
this.router.navigate(['/home/gabinete-digital/despachos-pr', serialNumber, 'gabinete-digital']);
|
||||
}
|
||||
else if(activityName == 'Revisar Diploma' || activityName == 'Assinar Diploma'){
|
||||
this.router.navigate(['/home/gabinete-digital/diplomas',serialNumber,'gabinete-digital']);
|
||||
else if (activityName == 'Revisar Diploma' || activityName == 'Assinar Diploma') {
|
||||
this.router.navigate(['/home/gabinete-digital/diplomas', serialNumber, 'gabinete-digital']);
|
||||
}
|
||||
else if(activityName == 'Diploma Assinado'){
|
||||
this.router.navigate(['/home/gabinete-digital/diplomas-assinar',serialNumber,'gabinete-digital']);
|
||||
else if (activityName == 'Diploma Assinado') {
|
||||
this.router.navigate(['/home/gabinete-digital/diplomas-assinar', serialNumber, 'gabinete-digital']);
|
||||
}
|
||||
}
|
||||
else if(workflowName == 'Pedido de Parecer' || workflowName == 'Pedido de Deferimento') {
|
||||
this.router.navigate(['/home/gabinete-digital/pedidos',serialNumber,'gabinete-digital']);
|
||||
else if (workflowName == 'Pedido de Parecer' || workflowName == 'Pedido de Deferimento') {
|
||||
this.router.navigate(['/home/gabinete-digital/pedidos', serialNumber, 'gabinete-digital']);
|
||||
}
|
||||
else if(workflowName == 'Expediente') {
|
||||
this.router.navigate(['/home/gabinete-digital/expediente',serialNumber,'gabinete-digital']);
|
||||
else if (workflowName == 'Expediente') {
|
||||
this.router.navigate(['/home/gabinete-digital/expediente', serialNumber, 'gabinete-digital']);
|
||||
}
|
||||
else if(workflowName == 'Expediente' && this.loggeduser.Profile == 'PR') {
|
||||
this.router.navigate(['/home/gabinete-digital/expedientes-pr',serialNumber,'gabinete-digital']);
|
||||
else if (workflowName == 'Expediente' && this.loggeduser.Profile == 'PR') {
|
||||
this.router.navigate(['/home/gabinete-digital/expedientes-pr', serialNumber, 'gabinete-digital']);
|
||||
}
|
||||
else if (workflowName == "Pedido de Parecer do Presidente") {
|
||||
this.router.navigate(['/home/gabinete-digital/pedidos',serialNumber,'gabinete-digital']);
|
||||
this.router.navigate(['/home/gabinete-digital/pedidos', serialNumber, 'gabinete-digital']);
|
||||
}
|
||||
/* else if (workflowName == "Expediente") {
|
||||
this.router.navigate(['/home/gabinete-digital/pedidos',serialNumber,'gabinete-digital']);
|
||||
} */
|
||||
else if(workflowName == 'Agenda Pessoal PR' || workflowName == 'Agenda Oficial PR' || workflowName == 'Agenda Oficial MDGPR' || workflowName == 'Agenda Pessoal MDGPR') {
|
||||
this.router.navigate(['/home/gabinete-digital/event-list/approve-event',serialNumber, 'gabinete-digital']);
|
||||
else if (workflowName == 'Agenda Pessoal PR' || workflowName == 'Agenda Oficial PR' || workflowName == 'Agenda Oficial MDGPR' || workflowName == 'Agenda Pessoal MDGPR') {
|
||||
this.router.navigate(['/home/gabinete-digital/event-list/approve-event', serialNumber, 'gabinete-digital']);
|
||||
}
|
||||
else {
|
||||
else {
|
||||
console.log('cant find page for this task')
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user