mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 12:37:53 +00:00
Refactoring made on offline
This commit is contained in:
@@ -10,7 +10,6 @@ import { AlertController, Platform } from '@ionic/angular';
|
||||
import { Router, ActivatedRoute } from '@angular/router';
|
||||
import { ToDayEventStorage } from '../store/to-day-event-storage.service';
|
||||
import { TotalDocumentStore } from '../store/total-document.service';
|
||||
import { synchro } from '../services/socket/synchro.service';
|
||||
import { DespachoService } from '../Rules/despacho.service';
|
||||
import { ExpedienteGdStore } from '../store/expedientegd-store.service';
|
||||
import { InativityService } from '../services/inativity.service';
|
||||
@@ -66,8 +65,6 @@ export class HomePage implements OnInit {
|
||||
postEvent: any;
|
||||
folderId: string;
|
||||
|
||||
synchro = synchro
|
||||
|
||||
status: string = "";
|
||||
audioName: string = "";
|
||||
constructor(
|
||||
@@ -118,15 +115,16 @@ export class HomePage implements OnInit {
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
window.addEventListener('online', () => {
|
||||
console.log('Became online')
|
||||
this.backgroundservice.online()
|
||||
});
|
||||
window.addEventListener('offline', () => {
|
||||
console.log('Became offline')
|
||||
this.backgroundservice.offline()
|
||||
});
|
||||
|
||||
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
||||
window.addEventListener('online', () => {
|
||||
console.log('Became online')
|
||||
this.backgroundservice.online()
|
||||
});
|
||||
window.addEventListener('offline', () => {
|
||||
console.log('Became offline')
|
||||
this.backgroundservice.offline()
|
||||
});
|
||||
this.webnotification.webconnection();
|
||||
this.webnotification.register();
|
||||
} else {
|
||||
@@ -147,18 +145,6 @@ export class HomePage implements OnInit {
|
||||
console.log('Became offline',off)
|
||||
this.backgroundservice.offline()
|
||||
});
|
||||
if(synchro.connected === true) {
|
||||
//this.offlinemanager.checkForEvents().subscribe();
|
||||
this.storage.get('storedreq').then((req) =>{
|
||||
console.log('STORED REQUEST', req)
|
||||
req.forEach(element => {
|
||||
this.eventservice.editEvent(element,2,3).subscribe((res) =>{
|
||||
console.log('REQUEST RESULT', res)
|
||||
})
|
||||
});
|
||||
|
||||
})
|
||||
}
|
||||
this.mobilefirstConnect();
|
||||
this.notificationsService.onReceviNotification();
|
||||
}
|
||||
@@ -220,37 +206,6 @@ export class HomePage implements OnInit {
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
synchro.registerCallback('Online', () => {
|
||||
console.log('Onlineee')
|
||||
|
||||
})
|
||||
|
||||
|
||||
synchro.registerCallback('Offline',()=>{
|
||||
|
||||
})
|
||||
|
||||
synchro.conected
|
||||
|
||||
synchro.registerCallback('Notification', (DataArray) => {
|
||||
|
||||
this.webNotificationPopupService.sendNotification(DataArray)
|
||||
|
||||
this.storageService.get('Notifications').then((data:any)=>{
|
||||
data.push(DataArray)
|
||||
this.storageService.store("Notifications", data)
|
||||
}).catch(() => {
|
||||
|
||||
const a = []
|
||||
a.push(DataArray)
|
||||
this.storageService.store("Notifications", a)
|
||||
})
|
||||
|
||||
}, 'any')
|
||||
|
||||
|
||||
|
||||
document.addEventListener('pause', function () {
|
||||
// console.log('App going to background');
|
||||
});
|
||||
|
||||
@@ -30,7 +30,7 @@ import { ListBoxService } from 'src/app/services/agenda/list-box.service';
|
||||
import { ChangeProfileService } from 'src/app/services/change-profile.service';
|
||||
|
||||
import { SqliteService } from 'src/app/services/sqlite.service';
|
||||
import { synchro } from 'src/app/services/socket/synchro.service';
|
||||
import { BackgroundService } from 'src/app/services/background.service';
|
||||
|
||||
|
||||
@Component({
|
||||
@@ -175,7 +175,8 @@ export class AgendaPage implements OnInit {
|
||||
private listBoxService: ListBoxService,
|
||||
private changeProfileService: ChangeProfileService,
|
||||
private sqliteservice: SqliteService,
|
||||
private platform: Platform
|
||||
private platform: Platform,
|
||||
private backgroundservice: BackgroundService
|
||||
) {
|
||||
|
||||
this.dateAdapter.setLocale('es');
|
||||
@@ -229,7 +230,23 @@ export class AgendaPage implements OnInit {
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
this.getFromDB()
|
||||
const pathname = window.location.pathname
|
||||
let realoadCounter = 0
|
||||
this.router.events.forEach((event) => {
|
||||
if (event instanceof NavigationEnd && event.url == pathname) {
|
||||
if (this.segment == null) {
|
||||
this.segment = "Combinado";
|
||||
}
|
||||
if (realoadCounter != 0) {
|
||||
this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
|
||||
}
|
||||
realoadCounter++;
|
||||
}
|
||||
});
|
||||
|
||||
this.backgroundservice.registerBackService('Online', () => {
|
||||
this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
|
||||
});
|
||||
|
||||
window.onresize = (event) => {
|
||||
// if not table remove all component
|
||||
@@ -490,7 +507,7 @@ export class AgendaPage implements OnInit {
|
||||
// loop
|
||||
this.CalendarStore.pushEvent(response, 'md');
|
||||
|
||||
console.log('CALENDAR STORE',this.CalendarStore.eventSource)
|
||||
console.log('CALENDAR STORE', this.CalendarStore.eventSource)
|
||||
|
||||
let array = []
|
||||
response.forEach(element => {
|
||||
@@ -507,7 +524,7 @@ export class AgendaPage implements OnInit {
|
||||
});
|
||||
|
||||
this.listToPresent = array;
|
||||
console.log('LIST TO PRESET',this.listToPresent)
|
||||
console.log('LIST TO PRESET', this.listToPresent)
|
||||
|
||||
this.TimelineMDList = this.listBoxService.list(this.listToPresent, 'md', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
|
||||
|
||||
@@ -517,13 +534,16 @@ export class AgendaPage implements OnInit {
|
||||
this.showLoader = false;
|
||||
this.showTimeline = true;
|
||||
|
||||
}).finally(() => {
|
||||
}).catch((error) => {
|
||||
this.getFromDB();
|
||||
})
|
||||
.finally(() => {
|
||||
this.showLoader = false;
|
||||
})
|
||||
|
||||
}
|
||||
// view PR calendar with MDGPR profile
|
||||
else if(this.profile == "pr" && this.loggeduser.Profile == 'MDGPR') {
|
||||
else if (this.profile == "pr" && this.loggeduser.Profile == 'MDGPR') {
|
||||
|
||||
this.eventService.getAllSharedEvents(momentG(new Date(startTime), 'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime), 'yyyy-MM-dd 23:59:59')).then((response: any) => {
|
||||
|
||||
@@ -556,7 +576,7 @@ export class AgendaPage implements OnInit {
|
||||
// startTime = 1, endTime = 31
|
||||
this.CalendarStore.removeRange(startTime, endTime, 'pr')
|
||||
this.CalendarStore.pushEvent(response, 'pr');
|
||||
let array = []
|
||||
let array = []
|
||||
response.array.forEach(element => {
|
||||
let event = {
|
||||
startTime: new Date(element.StartDate),
|
||||
@@ -585,7 +605,10 @@ export class AgendaPage implements OnInit {
|
||||
this.showTimeline = true;
|
||||
|
||||
|
||||
}).finally(() => {
|
||||
}).catch((error) => {
|
||||
this.getFromDB()
|
||||
})
|
||||
.finally(() => {
|
||||
this.showLoader = false;
|
||||
})
|
||||
}
|
||||
@@ -596,7 +619,7 @@ export class AgendaPage implements OnInit {
|
||||
let counter = 0;
|
||||
|
||||
// view MDGPR calendar with MDGPR profile
|
||||
if(this.loggeduser.Profile == 'MDGPR') {
|
||||
if (this.loggeduser.Profile == 'MDGPR') {
|
||||
|
||||
this.eventService.getAllMdEvents(momentG(new Date(startTime), 'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime), 'yyyy-MM-dd 23:59:59')).then((response: any) => {
|
||||
|
||||
@@ -633,9 +656,9 @@ export class AgendaPage implements OnInit {
|
||||
let eventsList = response;
|
||||
|
||||
// clear the current month only
|
||||
this.CalendarStore.removeRange(startTime, endTime, 'pr')
|
||||
/* this.CalendarStore.removeRange(startTime, endTime, 'pr')
|
||||
|
||||
this.CalendarStore.pushEvent(eventsList, 'pr');
|
||||
this.CalendarStore.pushEvent(eventsList, 'pr'); */
|
||||
this.listToPresent = eventsList;
|
||||
|
||||
this.TimelinePRList = this.listBoxService.list(this.listToPresent, 'pr', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
|
||||
@@ -660,8 +683,8 @@ export class AgendaPage implements OnInit {
|
||||
|
||||
} else {
|
||||
|
||||
// view PR calendar with PR profile
|
||||
this.eventService.getAllPrEvents(momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59')).then((response:any) => {
|
||||
// view PR calendar with PR profile
|
||||
this.eventService.getAllPrEvents(momentG(new Date(startTime), 'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime), 'yyyy-MM-dd 23:59:59')).then((response: any) => {
|
||||
|
||||
let eventsList;
|
||||
if (this.segment == 'Oficial') {
|
||||
@@ -729,44 +752,34 @@ export class AgendaPage implements OnInit {
|
||||
}
|
||||
|
||||
getFromDB() {
|
||||
|
||||
if (synchro.connected === true) {
|
||||
const pathname = window.location.pathname
|
||||
let realoadCounter = 0
|
||||
this.router.events.forEach((event) => {
|
||||
if (event instanceof NavigationEnd && event.url == pathname) {
|
||||
if (this.segment == null) {
|
||||
this.segment = "Combinado";
|
||||
}
|
||||
if (realoadCounter != 0) {
|
||||
this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
|
||||
}
|
||||
realoadCounter++;
|
||||
console.log('ALL EVENTS FROM DB AGENDA OFFLINE')
|
||||
this.sqliteservice.getAllEvents().then((events: any[]) => {
|
||||
console.log('ALL EVENTS FROM DB', events)
|
||||
let eventArray = [];
|
||||
events.forEach(element => {
|
||||
let event = {
|
||||
startTime: new Date(element.StartDate),
|
||||
endTime: new Date(element.EndDate),
|
||||
allDay: false,
|
||||
event: element,
|
||||
calendarName: element.CalendarName,
|
||||
profile: element.Profile,
|
||||
id: element.EventId,
|
||||
}
|
||||
eventArray.push(event);
|
||||
});
|
||||
console.log('LISTTOPRESENT', this.listToPresent)
|
||||
|
||||
} else {
|
||||
console.log('ALL EVENTS FROM DB AGENDA OFFLINE')
|
||||
this.sqliteservice.getAllEvents().then((events: any[]) => {
|
||||
let eventArray = [];
|
||||
events.forEach(element => {
|
||||
let event = {
|
||||
startTime: new Date(element.StartDate),
|
||||
endTime: new Date(element.EndDate),
|
||||
allDay: false,
|
||||
event: element,
|
||||
calendarName: element.CalendarName,
|
||||
profile: element.profile,
|
||||
id: element.EventId,
|
||||
}
|
||||
eventArray.push(event);
|
||||
});
|
||||
console.log('ALL EVENTS FROM DB', events)
|
||||
this.listToPresent = eventArray
|
||||
this.listToPresent = eventArray
|
||||
this.updateEventListBox()
|
||||
|
||||
})
|
||||
}
|
||||
this.myCal.update();
|
||||
this.myCal.loadEvents();
|
||||
|
||||
this.showLoader = false;
|
||||
this.showTimeline = true;
|
||||
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
updateEventListBox() {
|
||||
|
||||
@@ -13,11 +13,11 @@ import { ToastService } from 'src/app/services/toast.service';
|
||||
import { EliminateEventPage } from 'src/app/modals/eliminate-event/eliminate-event.page';
|
||||
import { Location } from '@angular/common'
|
||||
import { SqliteService } from 'src/app/services/sqlite.service';
|
||||
import { synchro } from '../../../services/socket/synchro.service';
|
||||
import { ExpedientTaskModalPageNavParamsTask } from 'src/app/models/ExpedientTaskModalPage';
|
||||
import { DocumentSetUpMeetingPage } from 'src/app/modals/document-set-up-meeting/document-set-up-meeting.page';
|
||||
import { ExpedientTaskModalPage } from '../../gabinete-digital/expediente/expedient-task-modal/expedient-task-modal.page';
|
||||
import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
|
||||
import { BackgroundService } from 'src/app/services/background.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-view-event',
|
||||
@@ -30,17 +30,17 @@ export class ViewEventPage implements OnInit {
|
||||
loadedEvent: Event;
|
||||
isEventEdited: boolean;
|
||||
eventBody: EventBody;
|
||||
loadedAttachments:any;
|
||||
loadedAttachments: any;
|
||||
pageId: string;
|
||||
showLoader: boolean;
|
||||
|
||||
minDate: Date;
|
||||
|
||||
profile:string;
|
||||
eventId:string;
|
||||
caller:string;
|
||||
customDate:any;
|
||||
today:any;
|
||||
profile: string;
|
||||
eventId: string;
|
||||
caller: string;
|
||||
customDate: any;
|
||||
today: any;
|
||||
|
||||
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"];
|
||||
@@ -48,13 +48,12 @@ export class ViewEventPage implements OnInit {
|
||||
dicIndex = 0;
|
||||
isModal = false
|
||||
header = true
|
||||
synch = synchro;
|
||||
task: ExpedientTaskModalPageNavParamsTask;
|
||||
LoadedDocument:any = null;
|
||||
LoadedDocument: any = null;
|
||||
|
||||
constructor(
|
||||
private modalController: ModalController,
|
||||
/* private navParams: NavParams, */
|
||||
/* private navParams: NavParams, */
|
||||
private eventsService: EventsService,
|
||||
private attachmentsService: AttachmentsService,
|
||||
public alertController: AlertController,
|
||||
@@ -66,26 +65,24 @@ export class ViewEventPage implements OnInit {
|
||||
private toastService: ToastService,
|
||||
private location: Location,
|
||||
public platform: Platform,
|
||||
private sqliteservice: SqliteService
|
||||
|
||||
|
||||
)
|
||||
{
|
||||
private sqliteservice: SqliteService,
|
||||
private backgroundservice: BackgroundService
|
||||
) {
|
||||
this.isEventEdited = false;
|
||||
this.loadedEvent = new Event();
|
||||
this.eventBody = { BodyType : "1", Text : ""};
|
||||
this.eventBody = { BodyType: "1", Text: "" };
|
||||
this.loadedEvent.Body = this.eventBody;
|
||||
this.activatedRoute.paramMap.subscribe(params =>{
|
||||
this.activatedRoute.paramMap.subscribe(params => {
|
||||
this.eventId = params['params'].eventId;
|
||||
if(params["params"].caller){
|
||||
if (params["params"].caller) {
|
||||
this.caller = (params["params"].caller);
|
||||
}
|
||||
|
||||
if(params["params"].isModal) {
|
||||
if (params["params"].isModal) {
|
||||
this.isModal = params["params"].isModal
|
||||
}
|
||||
|
||||
if(params["params"].header) {
|
||||
if (params["params"].header) {
|
||||
this.header = params["params"].header
|
||||
}
|
||||
});
|
||||
@@ -100,41 +97,44 @@ export class ViewEventPage implements OnInit {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.getFromDb();
|
||||
|
||||
this.loadEvent();
|
||||
|
||||
this.backgroundservice.registerBackService('Online', () => {
|
||||
this.loadEvent();
|
||||
});
|
||||
|
||||
window.onresize = (event) => {
|
||||
// if not mobile remove all component
|
||||
if( window.innerWidth >= 1024) {
|
||||
if (window.innerWidth >= 1024) {
|
||||
this.modalController.dismiss(this.isEventEdited);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
close(){
|
||||
close() {
|
||||
|
||||
this.modalController.dismiss(this.isEventEdited);
|
||||
}
|
||||
|
||||
goBack() {
|
||||
|
||||
if(this.isModal) {
|
||||
if (this.isModal) {
|
||||
this.close()
|
||||
} else {
|
||||
this.activatedRoute.paramMap.subscribe(params => {
|
||||
if(params["params"].caller == 'expediente'){
|
||||
window.history.back();
|
||||
}
|
||||
else{
|
||||
this.router.navigate(['/home',params["params"].caller]);
|
||||
}
|
||||
this.activatedRoute.paramMap.subscribe(params => {
|
||||
if (params["params"].caller == 'expediente') {
|
||||
window.history.back();
|
||||
}
|
||||
else {
|
||||
this.router.navigate(['/home', params["params"].caller]);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
doRefresh(ev){
|
||||
doRefresh(ev) {
|
||||
this.loadEvent();
|
||||
ev.target.complete();
|
||||
}
|
||||
@@ -148,39 +148,40 @@ export class ViewEventPage implements OnInit {
|
||||
/* this.today = new Date(res.StartDate);
|
||||
this.customDate = this.days[this.today.getDay()]+ ", " + this.today.getDate() +" de " + ( this.months[this.today.getMonth()]); */
|
||||
loader.remove()
|
||||
}, (error)=>{
|
||||
}, (error) => {
|
||||
|
||||
if(error.status == 0) {
|
||||
this.toastService.badRequest('Não é possível vizualizar este evento no modo offline')
|
||||
console.log('errorstatus',error.status)
|
||||
|
||||
if (error.status == 0) {
|
||||
this.getFromDb();
|
||||
} else {
|
||||
this.toastService.badRequest('Este evento já não existe na sua agenda')
|
||||
loader.remove()
|
||||
this.modalController.dismiss('Eevent not Foud');
|
||||
this.location.back();
|
||||
}
|
||||
|
||||
loader.remove()
|
||||
this.modalController.dismiss('Eevent not Foud');
|
||||
this.location.back();
|
||||
});
|
||||
}
|
||||
|
||||
deleteEvent(){
|
||||
deleteEvent() {
|
||||
|
||||
const loader = this.toastService.loading()
|
||||
|
||||
this.eventsService.deleteEvent(this.loadedEvent.EventId, 0, this.loadedEvent.CalendarName).subscribe(async () =>
|
||||
{
|
||||
const alert = await this.alertController.create({
|
||||
cssClass: 'my-custom-class',
|
||||
header: 'Evento removido',
|
||||
buttons: ['OK']
|
||||
});
|
||||
this.eventsService.deleteEvent(this.loadedEvent.EventId, 0, this.loadedEvent.CalendarName).subscribe(async () => {
|
||||
const alert = await this.alertController.create({
|
||||
cssClass: 'my-custom-class',
|
||||
header: 'Evento removido',
|
||||
buttons: ['OK']
|
||||
});
|
||||
|
||||
setTimeout(()=>{
|
||||
alert.dismiss();
|
||||
}, 1500);
|
||||
this.goBack();
|
||||
this.toastService.successMessage('Evento apagado');
|
||||
}, ()=>{},
|
||||
()=>{
|
||||
setTimeout(() => {
|
||||
alert.dismiss();
|
||||
}, 1500);
|
||||
this.goBack();
|
||||
this.toastService.successMessage('Evento apagado');
|
||||
}, () => { },
|
||||
() => {
|
||||
loader.remove();
|
||||
});
|
||||
}
|
||||
@@ -201,7 +202,7 @@ export class ViewEventPage implements OnInit {
|
||||
modal.onDidDismiss().then((res) => {
|
||||
console.log(res);
|
||||
|
||||
if(res){
|
||||
if (res) {
|
||||
setTimeout(() => {
|
||||
/* this.loadEvent(); */
|
||||
this.loadEvent()
|
||||
@@ -228,7 +229,7 @@ export class ViewEventPage implements OnInit {
|
||||
modal.onDidDismiss().then((res) => {
|
||||
console.log(res);
|
||||
|
||||
if(res){
|
||||
if (res) {
|
||||
setTimeout(() => {
|
||||
/* this.loadEvent(); */
|
||||
this.loadEvent()
|
||||
@@ -243,15 +244,15 @@ export class ViewEventPage implements OnInit {
|
||||
console.log(this.loadedEvent);
|
||||
|
||||
let classs;
|
||||
if( window.innerWidth <= 800){
|
||||
if (window.innerWidth <= 800) {
|
||||
classs = 'modal modal-desktop'
|
||||
} else {
|
||||
} else {
|
||||
classs = 'modal modal-desktop showAsideOptions'
|
||||
}
|
||||
|
||||
const modal = await this.modalController.create({
|
||||
component: EditEventPage,
|
||||
componentProps:{
|
||||
componentProps: {
|
||||
event: this.loadedEvent,
|
||||
caller: this.caller,
|
||||
},
|
||||
@@ -261,7 +262,7 @@ export class ViewEventPage implements OnInit {
|
||||
modal.onDidDismiss().then((res) => {
|
||||
console.log(res);
|
||||
|
||||
if(res){
|
||||
if (res) {
|
||||
setTimeout(() => {
|
||||
/* this.loadEvent(); */
|
||||
this.loadEvent()
|
||||
@@ -271,15 +272,15 @@ export class ViewEventPage implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
docIndex(index: number){
|
||||
docIndex(index: number) {
|
||||
this.dicIndex = index
|
||||
}
|
||||
|
||||
async LoadDocumentDetails() {
|
||||
|
||||
const docId = this.loadedEvent.Attachments[ this.dicIndex].SourceId
|
||||
const applicationId: any = this.loadedEvent.Attachments[ this.dicIndex].ApplicationId
|
||||
const selectedDoc = this.loadedEvent.Attachments[ this.dicIndex]
|
||||
|
||||
const docId = this.loadedEvent.Attachments[this.dicIndex].SourceId
|
||||
const applicationId: any = this.loadedEvent.Attachments[this.dicIndex].ApplicationId
|
||||
const selectedDoc = this.loadedEvent.Attachments[this.dicIndex]
|
||||
|
||||
console.log('selectedDoc', selectedDoc)
|
||||
|
||||
@@ -307,7 +308,7 @@ export class ViewEventPage implements OnInit {
|
||||
url: '',
|
||||
title_link: '',
|
||||
},
|
||||
Document: this.loadedEvent.Attachments[ this.dicIndex],
|
||||
Document: this.loadedEvent.Attachments[this.dicIndex],
|
||||
applicationId: this.task.workflowInstanceDataFields.SourceSecFsID,
|
||||
docId: selectedDoc.SourceId,
|
||||
folderId: '',
|
||||
@@ -321,33 +322,33 @@ export class ViewEventPage implements OnInit {
|
||||
async openBookMeetingModal() {
|
||||
|
||||
let classs;
|
||||
if( window.innerWidth < 701) {
|
||||
if (window.innerWidth < 701) {
|
||||
classs = 'book-meeting-modal modal modal-desktop'
|
||||
} else {
|
||||
} else {
|
||||
classs = 'modal modal-desktop showAsideOptions'
|
||||
}
|
||||
const modal = await this.modalController.create({
|
||||
component: DocumentSetUpMeetingPage,
|
||||
componentProps: {
|
||||
subject: this.task.workflowInstanceDataFields.Subject,
|
||||
document: this.loadedEvent.Attachments[ this.dicIndex],
|
||||
document: this.loadedEvent.Attachments[this.dicIndex],
|
||||
},
|
||||
cssClass: classs,
|
||||
backdropDismiss: false
|
||||
});
|
||||
await modal.present();
|
||||
modal.onDidDismiss().then(res=>{
|
||||
modal.onDidDismiss().then(res => {
|
||||
//this.location.back();
|
||||
});
|
||||
}
|
||||
|
||||
// efetuar despacho
|
||||
async openExpedientActionsModal( taskAction: any) {
|
||||
async openExpedientActionsModal(taskAction: any) {
|
||||
|
||||
let classs;
|
||||
if( window.innerWidth < 701) {
|
||||
if (window.innerWidth < 701) {
|
||||
classs = 'modal modal-desktop'
|
||||
} else {
|
||||
} else {
|
||||
classs = 'modal modal-desktop showAsideOptions'
|
||||
}
|
||||
const modal = await this.modalController.create({
|
||||
@@ -355,74 +356,74 @@ export class ViewEventPage implements OnInit {
|
||||
componentProps: {
|
||||
taskAction: taskAction,
|
||||
task: this.task,
|
||||
seachDocuments: this.loadedEvent.Attachments[ this.dicIndex],
|
||||
aplicationId: this.loadedEvent.Attachments[ this.dicIndex].ApplicationId || this.loadedEvent.Attachments[ this.dicIndex]['ApplicationID']
|
||||
seachDocuments: this.loadedEvent.Attachments[this.dicIndex],
|
||||
aplicationId: this.loadedEvent.Attachments[this.dicIndex].ApplicationId || this.loadedEvent.Attachments[this.dicIndex]['ApplicationID']
|
||||
},
|
||||
cssClass: classs,
|
||||
});
|
||||
await modal.present();
|
||||
modal.onDidDismiss().then( async(res)=>{});
|
||||
modal.onDidDismiss().then(async (res) => { });
|
||||
|
||||
}
|
||||
|
||||
|
||||
addEventToDb(data) {
|
||||
let event = {
|
||||
Attendees: JSON.stringify(data.Attendees) || JSON.stringify(''),
|
||||
Body: JSON.stringify(data.Body) || JSON.stringify(''),
|
||||
CalendarId: data.CalendarId,
|
||||
CalendarName: data.CalendarName,
|
||||
Category: data.Category,
|
||||
EndDate: data.EndDate,
|
||||
EventId: data.EventId,
|
||||
EventRecurrence: JSON.stringify(data.EventRecurrence) || JSON.stringify(''),
|
||||
EventType: data.EventType,
|
||||
HasAttachments: data.HasAttachments,
|
||||
IsAllDayEvent: data.IsAllDayEvent,
|
||||
IsMeeting: data.IsMeeting,
|
||||
IsRecurring: data.IsRecurring,
|
||||
Location: data.Location,
|
||||
Organizer: JSON.stringify(data.Organizer) || JSON.stringify(''),
|
||||
StartDate: data.StartDate,
|
||||
Subject: data.Subject,
|
||||
TimeZone: data.TimeZone
|
||||
}
|
||||
|
||||
this.sqliteservice.updateEvent(event);
|
||||
addEventToDb(data) {
|
||||
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
||||
} else {
|
||||
let event = {
|
||||
Attendees: JSON.stringify(data.Attendees) || JSON.stringify(''),
|
||||
Body: JSON.stringify(data.Body) || JSON.stringify(''),
|
||||
CalendarId: data.CalendarId,
|
||||
CalendarName: data.CalendarName,
|
||||
Category: data.Category,
|
||||
EndDate: data.EndDate,
|
||||
EventId: data.EventId,
|
||||
EventRecurrence: JSON.stringify(data.EventRecurrence) || JSON.stringify(''),
|
||||
EventType: data.EventType,
|
||||
HasAttachments: data.HasAttachments,
|
||||
IsAllDayEvent: data.IsAllDayEvent,
|
||||
IsMeeting: data.IsMeeting,
|
||||
IsRecurring: data.IsRecurring,
|
||||
Location: data.Location,
|
||||
Organizer: JSON.stringify(data.Organizer) || JSON.stringify(''),
|
||||
StartDate: data.StartDate,
|
||||
Subject: data.Subject,
|
||||
TimeZone: data.TimeZone
|
||||
}
|
||||
|
||||
this.sqliteservice.updateEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
getFromDb() {
|
||||
if (synchro.connected === true) {
|
||||
this.loadEvent();
|
||||
console.log('Onlineee view-event')
|
||||
} else {
|
||||
this.sqliteservice.getEventById(this.eventId).then((event) => {
|
||||
let arrayevent = [];
|
||||
let elemet = {
|
||||
Attendees: JSON.parse(event[0].Attendees) || "",
|
||||
Body: JSON.parse(event[0].Body) || "",
|
||||
CalendarId: event[0].CalendarId,
|
||||
CalendarName: event[0].CalendarName,
|
||||
Category: event[0].Category,
|
||||
EndDate: event[0].EndDate,
|
||||
EventId: event[0].EventId,
|
||||
EventRecurrence: JSON.parse(event[0].EventRecurrence) || "",
|
||||
EventType: event[0].EventType,
|
||||
HasAttachments: event[0].HasAttachments,
|
||||
IsAllDayEvent: event[0].IsAllDayEvent,
|
||||
IsMeeting: event[0].IsMeeting,
|
||||
IsRecurring: event[0].IsRecurring,
|
||||
Location: event[0].Location,
|
||||
Organizer: JSON.parse(event[0].Organizer) || "",
|
||||
StartDate: event[0].StartDate,
|
||||
Subject: event[0].Subject,
|
||||
TimeZone: event[0].TimeZone
|
||||
}
|
||||
arrayevent.push(elemet);
|
||||
this.loadedEvent = arrayevent[0];
|
||||
console.log("Event ditails local,", elemet)
|
||||
})
|
||||
console.log('Offlineee')
|
||||
}
|
||||
}}
|
||||
const loader = this.toastService.loading();
|
||||
this.sqliteservice.getEventById(this.eventId).then((event) => {
|
||||
let arrayevent = [];
|
||||
let elemet = {
|
||||
Attendees: JSON.parse(event[0].Attendees) || "",
|
||||
Body: JSON.parse(event[0].Body) || "",
|
||||
CalendarId: event[0].CalendarId,
|
||||
CalendarName: event[0].CalendarName,
|
||||
Category: event[0].Category,
|
||||
EndDate: event[0].EndDate,
|
||||
EventId: event[0].EventId,
|
||||
EventRecurrence: JSON.parse(event[0].EventRecurrence) || "",
|
||||
EventType: event[0].EventType,
|
||||
HasAttachments: event[0].HasAttachments,
|
||||
IsAllDayEvent: event[0].IsAllDayEvent,
|
||||
IsMeeting: event[0].IsMeeting,
|
||||
IsRecurring: event[0].IsRecurring,
|
||||
Location: event[0].Location,
|
||||
Organizer: JSON.parse(event[0].Organizer) || "",
|
||||
StartDate: event[0].StartDate,
|
||||
Subject: event[0].Subject,
|
||||
TimeZone: event[0].TimeZone
|
||||
}
|
||||
arrayevent.push(elemet);
|
||||
this.loadedEvent = arrayevent[0];
|
||||
console.log("Event ditails local,", elemet)
|
||||
})
|
||||
loader.remove()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ import { ExpedienteGdStore } from 'src/app/store/expedientegd-store.service';
|
||||
import { SqliteService } from 'src/app/services/sqlite.service';
|
||||
import { synchro } from '../../services/socket/synchro.service';
|
||||
import { NetworkConnectionService } from 'src/app/services/network-connection.service'
|
||||
import { BackgroundService } from 'src/app/services/background.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-events',
|
||||
@@ -93,7 +94,8 @@ export class EventsPage implements OnInit {
|
||||
private screenOrientation: ScreenOrientation,
|
||||
public platform: Platform,
|
||||
private sqliteservice: SqliteService,
|
||||
private networkconnection: NetworkConnectionService
|
||||
private networkconnection: NetworkConnectionService,
|
||||
private backgroundservice: BackgroundService,
|
||||
) {
|
||||
this.existingScreenOrientation = this.screenOrientation.type;
|
||||
console.log(this.existingScreenOrientation);
|
||||
@@ -135,6 +137,13 @@ export class EventsPage implements OnInit {
|
||||
});
|
||||
this.hideSearch();
|
||||
|
||||
this.backgroundservice.registerBackService('Online', () => {
|
||||
this.showGreeting();
|
||||
this.RefreshEvents();
|
||||
this.LoadList();
|
||||
this.hideSearch();
|
||||
});
|
||||
|
||||
//this.getEventsFromLocalDb();
|
||||
|
||||
//this.checkScreenOrientation();
|
||||
|
||||
@@ -22,6 +22,7 @@ import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.pag
|
||||
|
||||
import { SqliteService } from 'src/app/services/sqlite.service';
|
||||
import { synchro } from 'src/app/services/socket/synchro.service';
|
||||
import { BackgroundService } from 'src/app/services/background.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-despacho-pr',
|
||||
@@ -56,7 +57,8 @@ export class DespachoPrPage implements OnInit {
|
||||
private toastService: ToastService,
|
||||
private location: Location,
|
||||
private despachoService: DespachoService,
|
||||
private sqliteservice: SqliteService
|
||||
private sqliteservice: SqliteService,
|
||||
private backgroundservice: BackgroundService
|
||||
) {
|
||||
this.activatedRoute.paramMap.subscribe(params => {
|
||||
if (params["params"].SerialNumber) {
|
||||
@@ -73,7 +75,21 @@ export class DespachoPrPage implements OnInit {
|
||||
ngOnInit() {
|
||||
this.profile = "mdgpr";
|
||||
console.log(this.serialNumber);
|
||||
this.getFromDB();
|
||||
|
||||
this.activateRoute.paramMap.subscribe(paramMap => {
|
||||
if (!paramMap.has('SerialNumber')) {
|
||||
return;
|
||||
}
|
||||
/* this.serialNumber = paramMap.get('SerialNumber'); */
|
||||
this.LoadTaskDetail(this.serialNumber);
|
||||
// this.LoadRelatedEvents(this.serialNumber);
|
||||
});
|
||||
this.LoadTaskDetail(this.serialNumber);
|
||||
// this.LoadRelatedEvents(this.serialNumber);
|
||||
|
||||
this.backgroundservice.registerBackService('Online', () => {
|
||||
this.LoadTaskDetail(this.serialNumber);
|
||||
});
|
||||
}
|
||||
|
||||
close() {
|
||||
@@ -123,93 +139,81 @@ export class DespachoPrPage implements OnInit {
|
||||
return user.Type == 'CC';
|
||||
}) || []
|
||||
|
||||
if(!this.cc) {
|
||||
if (!this.cc) {
|
||||
this.cc = []
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}, (error) => {
|
||||
try {
|
||||
this.goBack()
|
||||
} catch (e) {
|
||||
window.history.back();
|
||||
} finally {
|
||||
if (error.status == 0) {
|
||||
this.toastService.badRequest('Não é possível visualizar este processo no modo offline')
|
||||
} else {
|
||||
this.toastService.badRequest('Processo não encontrado')
|
||||
|
||||
if (error.status == 0) {
|
||||
this.getFromDB()
|
||||
} else {
|
||||
try {
|
||||
this.goBack()
|
||||
} catch (e) {
|
||||
window.history.back();
|
||||
}
|
||||
this.toastService.badRequest('Processo não encontrado')
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
getFromDB() {
|
||||
if (synchro.connected === true) {
|
||||
this.activateRoute.paramMap.subscribe(paramMap => {
|
||||
if (!paramMap.has('SerialNumber')) {
|
||||
return;
|
||||
}
|
||||
/* this.serialNumber = paramMap.get('SerialNumber'); */
|
||||
this.LoadTaskDetail(this.serialNumber);
|
||||
// this.LoadRelatedEvents(this.serialNumber);
|
||||
|
||||
this.sqliteservice.getProcessById(this.serialNumber).then((process: any[]) => {
|
||||
console.log('OFFLINE', process)
|
||||
this.task = {
|
||||
"SerialNumber": process[0].serialNumber,
|
||||
"Folio": JSON.parse(process[0].workflowInstanceDataFields).Subject,
|
||||
"Senders": JSON.parse(process[0].originator).email,
|
||||
"CreateDate": momentG(new Date(process[0].taskStartDate), 'yyyy-MM-dd HH:mm:ss'),
|
||||
"DocumentURL": JSON.parse(process[0].workflowInstanceDataFields).ViewerRequest,
|
||||
"Remetente": JSON.parse(process[0].workflowInstanceDataFields).Sender,
|
||||
"Note": JSON.parse(process[0].workflowInstanceDataFields).TaskMessage || JSON.parse(process[0].workflowInstanceDataFields).Note,
|
||||
"FolderId": JSON.parse(process[0].workflowInstanceDataFields).FolderID,
|
||||
"FsId": '361',
|
||||
"DocId": JSON.parse(process[0].workflowInstanceDataFields).DispatchDocId,
|
||||
"WorkflowName": process[0].workflowDisplayName,
|
||||
"DeadlineType": JSON.parse(process[0].workflowInstanceDataFields).DeadlineType,
|
||||
"activityInstanceName": process[0].activityInstanceName,
|
||||
}
|
||||
console.log("OFFLINE TASK", this.task)
|
||||
let fulltak = {
|
||||
Documents: JSON.parse(process[0].Documents),
|
||||
actions: JSON.parse(process[0].actions),
|
||||
activityInstanceName: process[0].activityInstanceName,
|
||||
formURL: process[0].formURL,
|
||||
originator: JSON.parse(process[0].originator),
|
||||
serialNumber: process[0].serialNumber,
|
||||
taskStartDate: process[0].taskStartDate,
|
||||
totalDocuments: process[0].totalDocuments,
|
||||
workflowDisplayName: process[0].workflowDisplayName,
|
||||
workflowID: process[0].workflowID,
|
||||
workflowInstanceDataFields: JSON.parse(process[0].workflowInstanceDataFields),
|
||||
workflowInstanceFolio: process[0].workflowInstanceFolio,
|
||||
workflowInstanceID: process[0].workflowInstanceID,
|
||||
workflowName: process[0].workflowName
|
||||
}
|
||||
this.fulltask = fulltak;
|
||||
console.log(this.task);
|
||||
|
||||
let thedate = new Date(this.task.CreateDate);
|
||||
this.customDate = this.days[thedate.getDay()] + ", " + thedate.getDate() + " de " + (this.months[thedate.getMonth()]);
|
||||
|
||||
this.intervenientes = JSON.parse(process[0].interveners).filter(user => {
|
||||
return user.Type == 'I';
|
||||
});
|
||||
this.cc = JSON.parse(process[0].interveners).filter(user => {
|
||||
return user.Type == 'CC';
|
||||
});
|
||||
this.LoadTaskDetail(this.serialNumber);
|
||||
// this.LoadRelatedEvents(this.serialNumber);
|
||||
|
||||
} else {
|
||||
this.sqliteservice.getProcessById(this.serialNumber).then((process: any[]) => {
|
||||
console.log('OFFLINE', process)
|
||||
this.task = {
|
||||
"SerialNumber": process[0].serialNumber,
|
||||
"Folio": JSON.parse(process[0].workflowInstanceDataFields).Subject,
|
||||
"Senders": JSON.parse(process[0].originator).email,
|
||||
"CreateDate": momentG(new Date(process[0].taskStartDate), 'yyyy-MM-dd HH:mm:ss'),
|
||||
"DocumentURL": JSON.parse(process[0].workflowInstanceDataFields).ViewerRequest,
|
||||
"Remetente": JSON.parse(process[0].workflowInstanceDataFields).Sender,
|
||||
"Note": JSON.parse(process[0].workflowInstanceDataFields).TaskMessage || JSON.parse(process[0].workflowInstanceDataFields).Note,
|
||||
"FolderId": JSON.parse(process[0].workflowInstanceDataFields).FolderID,
|
||||
"FsId": '361',
|
||||
"DocId": JSON.parse(process[0].workflowInstanceDataFields).DispatchDocId,
|
||||
"WorkflowName": process[0].workflowDisplayName,
|
||||
"DeadlineType": JSON.parse(process[0].workflowInstanceDataFields).DeadlineType,
|
||||
"activityInstanceName": process[0].activityInstanceName,
|
||||
}
|
||||
console.log("OFFLINE TASK", this.task)
|
||||
let fulltak = {
|
||||
Documents: JSON.parse(process[0].Documents),
|
||||
actions: JSON.parse(process[0].actions),
|
||||
activityInstanceName: process[0].activityInstanceName,
|
||||
formURL: process[0].formURL,
|
||||
originator: JSON.parse(process[0].originator),
|
||||
serialNumber: process[0].serialNumber,
|
||||
taskStartDate: process[0].taskStartDate,
|
||||
totalDocuments: process[0].totalDocuments,
|
||||
workflowDisplayName: process[0].workflowDisplayName,
|
||||
workflowID: process[0].workflowID,
|
||||
workflowInstanceDataFields: JSON.parse(process[0].workflowInstanceDataFields),
|
||||
workflowInstanceFolio: process[0].workflowInstanceFolio,
|
||||
workflowInstanceID: process[0].workflowInstanceID,
|
||||
workflowName: process[0].workflowName
|
||||
}
|
||||
this.fulltask = fulltak;
|
||||
console.log(this.task);
|
||||
|
||||
let thedate = new Date(this.task.CreateDate);
|
||||
this.customDate = this.days[thedate.getDay()] + ", " + thedate.getDate() + " de " + (this.months[thedate.getMonth()]);
|
||||
|
||||
this.intervenientes = JSON.parse(process[0].interveners).filter(user => {
|
||||
return user.Type == 'I';
|
||||
});
|
||||
this.cc = JSON.parse(process[0].interveners).filter(user => {
|
||||
return user.Type == 'CC';
|
||||
});
|
||||
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
async viewDocument(DocId:string, Document) {
|
||||
async viewDocument(DocId: string, Document) {
|
||||
|
||||
const modal = await this.modalController.create({
|
||||
component: ViewDocumentPage,
|
||||
|
||||
@@ -19,6 +19,7 @@ import { DespachosprStore } from 'src/app/store/despachospr-store.service';
|
||||
|
||||
import { SqliteService } from 'src/app/services/sqlite.service';
|
||||
import { synchro } from 'src/app/services/socket/synchro.service';
|
||||
import { BackgroundService } from 'src/app/services/background.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-despachos-pr',
|
||||
@@ -59,7 +60,8 @@ export class DespachosPrPage implements OnInit {
|
||||
private alertService: AlertService,
|
||||
private authService: AuthService,
|
||||
private router: Router,
|
||||
private sqliteservice: SqliteService
|
||||
private sqliteservice: SqliteService,
|
||||
private backgroundservice: BackgroundService
|
||||
) {
|
||||
|
||||
this.loggeduser = authService.ValidatedUser;
|
||||
@@ -70,7 +72,25 @@ export class DespachosPrPage implements OnInit {
|
||||
ngOnInit() {
|
||||
//Inicializar segment
|
||||
this.segment = "despachos";
|
||||
this.getFromDB();
|
||||
|
||||
const location = window.location
|
||||
const pathname = location.pathname + location.search
|
||||
|
||||
this.LoadList()
|
||||
|
||||
this.router.events.forEach((event) => {
|
||||
if (event instanceof NavigationStart && event.url.startsWith(pathname)) {
|
||||
if (window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) {
|
||||
this.doRefresh()
|
||||
} else {
|
||||
this.LoadList()
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.backgroundservice.registerBackService('Online', () => {
|
||||
this.LoadList()
|
||||
});
|
||||
}
|
||||
|
||||
segmentChanged(ev: any) {
|
||||
@@ -92,116 +112,106 @@ export class DespachosPrPage implements OnInit {
|
||||
|
||||
async LoadList() {
|
||||
|
||||
this.skeletonLoader = true
|
||||
this.processes.GetTasksList("Despacho do Presidente da República", false).subscribe(async res => {
|
||||
|
||||
let result = await this.processes.GetTasksList("Despacho do Presidente da República", false).toPromise();
|
||||
this.despachoList = [];
|
||||
this.skeletonLoader = false;
|
||||
console.log(result);
|
||||
this.skeletonLoader = true
|
||||
|
||||
let despachosPr;
|
||||
switch (this.loggeduser.Profile) {
|
||||
case 'MDGPR':
|
||||
despachosPr = await result.reverse().filter(data => data.activityInstanceName == "Tarefa de Despacho");
|
||||
break;
|
||||
case 'PR':
|
||||
console.log(result);
|
||||
|
||||
despachosPr = await result.reverse().filter(data => data.activityInstanceName == "Concluir Despacho");
|
||||
break;
|
||||
}
|
||||
|
||||
console.log(despachosPr);
|
||||
despachosPr = despachosPr.filter(data => data.workflowInstanceDataFields.Status == "Active");
|
||||
|
||||
despachosPr.forEach((element, index) => {
|
||||
|
||||
let date = new Date(element.taskStartDate);
|
||||
date.setMonth(date.getMonth() + 1);
|
||||
let taskDate = date.getFullYear() + "-" + date.getMonth() + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
|
||||
|
||||
let task = {
|
||||
"SerialNumber": element.serialNumber,
|
||||
"Folio": element.workflowInstanceDataFields.Subject,
|
||||
"Senders": element.workflowInstanceDataFields.Sender,
|
||||
"CreateDate": taskDate,
|
||||
"DocumentURL": element.workflowInstanceDataFields.ViewerRequest,
|
||||
"Remetente": element.workflowInstanceDataFields.Remetente,
|
||||
"DocumentsQty": element.totalDocuments,
|
||||
"DocId": element.workflowInstanceDataFields.DocIdDiferimento,
|
||||
"WorkflowName": element.workflowDisplayName,
|
||||
"activityInstanceName": element.activityInstanceName,
|
||||
let result = await this.processes.GetTasksList("Despacho do Presidente da República", false).toPromise();
|
||||
this.despachoList = [];
|
||||
this.skeletonLoader = false;
|
||||
console.log(result);
|
||||
|
||||
let despachosPr;
|
||||
switch (this.loggeduser.Profile) {
|
||||
case 'MDGPR':
|
||||
despachosPr = await result.reverse().filter(data => data.activityInstanceName == "Tarefa de Despacho");
|
||||
break;
|
||||
case 'PR':
|
||||
console.log(result);
|
||||
|
||||
despachosPr = await result.reverse().filter(data => data.activityInstanceName == "Concluir Despacho");
|
||||
break;
|
||||
}
|
||||
|
||||
console.log(despachosPr);
|
||||
despachosPr = despachosPr.filter(data => data.workflowInstanceDataFields.Status == "Active");
|
||||
|
||||
despachosPr.forEach((element, index) => {
|
||||
|
||||
let date = new Date(element.taskStartDate);
|
||||
date.setMonth(date.getMonth() + 1);
|
||||
let taskDate = date.getFullYear() + "-" + date.getMonth() + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
|
||||
|
||||
let task = {
|
||||
"SerialNumber": element.serialNumber,
|
||||
"Folio": element.workflowInstanceDataFields.Subject,
|
||||
"Senders": element.workflowInstanceDataFields.Sender,
|
||||
"CreateDate": taskDate,
|
||||
"DocumentURL": element.workflowInstanceDataFields.ViewerRequest,
|
||||
"Remetente": element.workflowInstanceDataFields.Remetente,
|
||||
"DocumentsQty": element.totalDocuments,
|
||||
"DocId": element.workflowInstanceDataFields.DocIdDiferimento,
|
||||
"WorkflowName": element.workflowDisplayName,
|
||||
"activityInstanceName": element.activityInstanceName,
|
||||
}
|
||||
|
||||
this.despachoList.push(task);
|
||||
console.log(this.despachoList);
|
||||
});
|
||||
this.listToPresent = this.despachoList
|
||||
|
||||
this.despachoList.push(task);
|
||||
console.log(this.despachoList);
|
||||
});
|
||||
this.listToPresent = this.despachoList
|
||||
}, (error) => {
|
||||
this.getFromDB()
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
getFromDB() {
|
||||
if (synchro.connected === true) {
|
||||
const location = window.location
|
||||
const pathname = location.pathname + location.search
|
||||
|
||||
this.LoadList()
|
||||
this.sqliteservice.getAllProcess().then((all) => {
|
||||
console.log('DESPACHO PR ALL', all)
|
||||
})
|
||||
this.sqliteservice.getprocessByworkflow('Despacho do Presidente da República').then(async (process: any[]) => {
|
||||
console.log('DESPACHO PR', process)
|
||||
|
||||
this.router.events.forEach((event) => {
|
||||
if (event instanceof NavigationStart && event.url.startsWith(pathname)) {
|
||||
if (window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) {
|
||||
this.doRefresh()
|
||||
} else {
|
||||
this.LoadList()
|
||||
}
|
||||
let despachosPr;
|
||||
switch (this.loggeduser.Profile) {
|
||||
case 'MDGPR':
|
||||
despachosPr = await process.reverse().filter(data => data.activityInstanceName == "Tarefa de Despacho");
|
||||
break;
|
||||
case 'PR':
|
||||
console.log(process);
|
||||
|
||||
despachosPr = await process.reverse().filter(data => data.activityInstanceName == "Concluir Despacho");
|
||||
break;
|
||||
}
|
||||
|
||||
despachosPr = despachosPr.filter(data => JSON.parse(data.workflowInstanceDataFields).Status == "Active");
|
||||
despachosPr.forEach((element, index) => {
|
||||
|
||||
let date = new Date(element.taskStartDate);
|
||||
date.setMonth(date.getMonth() + 1);
|
||||
let taskDate = date.getFullYear() + "-" + date.getMonth() + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
|
||||
|
||||
let task = {
|
||||
"SerialNumber": element.serialNumber,
|
||||
"Folio": JSON.parse(element.workflowInstanceDataFields).Subject,
|
||||
"Senders": JSON.parse(element.workflowInstanceDataFields).Sender,
|
||||
"CreateDate": taskDate,
|
||||
"DocumentURL": JSON.parse(element.workflowInstanceDataFields).ViewerRequest,
|
||||
"Remetente": JSON.parse(element.workflowInstanceDataFields).Remetente,
|
||||
"DocumentsQty": element.totalDocuments,
|
||||
"DocId": JSON.parse(element.workflowInstanceDataFields).DocIdDiferimento,
|
||||
"WorkflowName": element.workflowDisplayName,
|
||||
"activityInstanceName": element.activityInstanceName,
|
||||
}
|
||||
|
||||
this.despachoList.push(task);
|
||||
console.log(this.despachoList);
|
||||
});
|
||||
} else {
|
||||
this.sqliteservice.getAllProcess().then((all) => {
|
||||
console.log('DESPACHO PR ALL', all)
|
||||
})
|
||||
this.sqliteservice.getprocessByworkflow('Despacho do Presidente da República').then(async (process: any[]) => {
|
||||
console.log('DESPACHO PR', process)
|
||||
this.listToPresent = this.despachoList;
|
||||
|
||||
let despachosPr;
|
||||
switch (this.loggeduser.Profile) {
|
||||
case 'MDGPR':
|
||||
despachosPr = await process.reverse().filter(data => data.activityInstanceName == "Tarefa de Despacho");
|
||||
break;
|
||||
case 'PR':
|
||||
console.log(process);
|
||||
|
||||
despachosPr = await process.reverse().filter(data => data.activityInstanceName == "Concluir Despacho");
|
||||
break;
|
||||
}
|
||||
|
||||
despachosPr = despachosPr.filter(data => JSON.parse(data.workflowInstanceDataFields).Status == "Active");
|
||||
despachosPr.forEach((element, index) => {
|
||||
|
||||
let date = new Date(element.taskStartDate);
|
||||
date.setMonth(date.getMonth() + 1);
|
||||
let taskDate = date.getFullYear() + "-" + date.getMonth() + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
|
||||
|
||||
let task = {
|
||||
"SerialNumber": element.serialNumber,
|
||||
"Folio": JSON.parse(element.workflowInstanceDataFields).Subject,
|
||||
"Senders": JSON.parse(element.workflowInstanceDataFields).Sender,
|
||||
"CreateDate": taskDate,
|
||||
"DocumentURL": JSON.parse(element.workflowInstanceDataFields).ViewerRequest,
|
||||
"Remetente": JSON.parse(element.workflowInstanceDataFields).Remetente,
|
||||
"DocumentsQty": element.totalDocuments,
|
||||
"DocId": JSON.parse(element.workflowInstanceDataFields).DocIdDiferimento,
|
||||
"WorkflowName": element.workflowDisplayName,
|
||||
"activityInstanceName": element.activityInstanceName,
|
||||
}
|
||||
|
||||
this.despachoList.push(task);
|
||||
console.log(this.despachoList);
|
||||
});
|
||||
this.listToPresent = this.despachoList;
|
||||
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
sortArrayISODate(myArray: any) {
|
||||
|
||||
@@ -22,6 +22,7 @@ import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.pag
|
||||
import { synchro } from 'src/app/services/socket/synchro.service';
|
||||
import { SqliteService } from 'src/app/services/sqlite.service';
|
||||
import { Platform } from '@ionic/angular';
|
||||
import { BackgroundService } from 'src/app/services/background.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-despacho',
|
||||
@@ -60,7 +61,8 @@ export class DespachoPage implements OnInit {
|
||||
private location: Location,
|
||||
public p: PermissionService,
|
||||
private sqliteservice: SqliteService,
|
||||
private platform: Platform
|
||||
private platform: Platform,
|
||||
private backgroundservice: BackgroundService
|
||||
|
||||
|
||||
) {
|
||||
@@ -81,6 +83,12 @@ export class DespachoPage implements OnInit {
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
this.backgroundservice.registerBackService('Online', () => {
|
||||
this.LoadTaskDetail(this.serialnumber)
|
||||
});
|
||||
|
||||
|
||||
this.getFromDb()
|
||||
|
||||
}
|
||||
@@ -177,80 +185,75 @@ export class DespachoPage implements OnInit {
|
||||
}
|
||||
|
||||
getFromDb() {
|
||||
if (synchro.connected === true) {
|
||||
this.LoadTaskDetail(this.serialnumber)
|
||||
}
|
||||
|
||||
if (synchro.connected === false) {
|
||||
this.platform.ready().then(() => {
|
||||
this.sqliteservice.getProcessById(this.serialnumber).then((process) => {
|
||||
this.platform.ready().then(() => {
|
||||
this.sqliteservice.getProcessById(this.serialnumber).then((process) => {
|
||||
|
||||
var workflow = JSON.parse(process[0].workflowInstanceDataFields);
|
||||
var intervine = JSON.parse(process[0].interveners)
|
||||
var origina
|
||||
if (process[0].originator === "undefined") {
|
||||
origina = ""
|
||||
} else {
|
||||
origina = JSON.parse(process[0].originator)
|
||||
}
|
||||
var workflow = JSON.parse(process[0].workflowInstanceDataFields);
|
||||
var intervine = JSON.parse(process[0].interveners)
|
||||
var origina
|
||||
if (process[0].originator === "undefined") {
|
||||
origina = ""
|
||||
} else {
|
||||
origina = JSON.parse(process[0].originator)
|
||||
}
|
||||
|
||||
console.log('sqlite', process)
|
||||
console.log('sqlite', process)
|
||||
|
||||
this.task = {
|
||||
"SerialNumber": process[0].serialNumber,
|
||||
"Folio": workflow.Subject,
|
||||
"Senders": origina.email || process[0].originator,
|
||||
"CreateDate": momentG(new Date(process[0].taskStartDate), 'yyyy-MM-dd HH:mm:ss'),
|
||||
"DocumentURL": workflow.ViewerRequest,
|
||||
"Remetente": workflow.Sender,
|
||||
"Note": workflow.TaskMessage || workflow.Note,
|
||||
"FolderId": workflow.FolderID,
|
||||
"FsId": workflow.FsId,
|
||||
"DocId": workflow.DocID,
|
||||
"DocumentsQty": process[0].DocumentsQty,
|
||||
"WorkflowName": process[0].workflowDisplayName,
|
||||
"DeadlineType": workflow.DeadlineType,
|
||||
"activityInstanceName": process[0].activityInstanceName,
|
||||
"Status": workflow.Status,
|
||||
}
|
||||
this.task = {
|
||||
"SerialNumber": process[0].serialNumber,
|
||||
"Folio": workflow.Subject,
|
||||
"Senders": origina.email || process[0].originator,
|
||||
"CreateDate": momentG(new Date(process[0].taskStartDate), 'yyyy-MM-dd HH:mm:ss'),
|
||||
"DocumentURL": workflow.ViewerRequest,
|
||||
"Remetente": workflow.Sender,
|
||||
"Note": workflow.TaskMessage || workflow.Note,
|
||||
"FolderId": workflow.FolderID,
|
||||
"FsId": workflow.FsId,
|
||||
"DocId": workflow.DocID,
|
||||
"DocumentsQty": process[0].DocumentsQty,
|
||||
"WorkflowName": process[0].workflowDisplayName,
|
||||
"DeadlineType": workflow.DeadlineType,
|
||||
"activityInstanceName": process[0].activityInstanceName,
|
||||
"Status": workflow.Status,
|
||||
}
|
||||
|
||||
let thedate = new Date(this.task.CreateDate);
|
||||
this.customDate = this.days[thedate.getDay()] + ", " + thedate.getDate() + " de " + (this.months[thedate.getMonth()]);
|
||||
let thedate = new Date(this.task.CreateDate);
|
||||
this.customDate = this.days[thedate.getDay()] + ", " + thedate.getDate() + " de " + (this.months[thedate.getMonth()]);
|
||||
|
||||
let fulltak = {
|
||||
Documents: JSON.parse(process[0].Documents),
|
||||
actions: JSON.parse(process[0].actions),
|
||||
activityInstanceName: process[0].activityInstanceName,
|
||||
formURL: process[0].formURL,
|
||||
originator: JSON.parse(process[0].originator),
|
||||
serialNumber: process[0].serialNumber,
|
||||
taskStartDate: process[0].taskStartDate,
|
||||
totalDocuments: process[0].totalDocuments,
|
||||
workflowDisplayName: process[0].workflowDisplayName,
|
||||
workflowID: process[0].workflowID,
|
||||
workflowInstanceDataFields: JSON.parse(process[0].workflowInstanceDataFields),
|
||||
workflowInstanceFolio: process[0].workflowInstanceFolio,
|
||||
workflowInstanceID: process[0].workflowInstanceID,
|
||||
workflowName: process[0].workflowName
|
||||
}
|
||||
this.fulltask = fulltak;
|
||||
let fulltak = {
|
||||
Documents: JSON.parse(process[0].Documents),
|
||||
actions: JSON.parse(process[0].actions),
|
||||
activityInstanceName: process[0].activityInstanceName,
|
||||
formURL: process[0].formURL,
|
||||
originator: JSON.parse(process[0].originator),
|
||||
serialNumber: process[0].serialNumber,
|
||||
taskStartDate: process[0].taskStartDate,
|
||||
totalDocuments: process[0].totalDocuments,
|
||||
workflowDisplayName: process[0].workflowDisplayName,
|
||||
workflowID: process[0].workflowID,
|
||||
workflowInstanceDataFields: JSON.parse(process[0].workflowInstanceDataFields),
|
||||
workflowInstanceFolio: process[0].workflowInstanceFolio,
|
||||
workflowInstanceID: process[0].workflowInstanceID,
|
||||
workflowName: process[0].workflowName
|
||||
}
|
||||
this.fulltask = fulltak;
|
||||
|
||||
console.log('interveniers offline', intervine)
|
||||
this.intervenientes = intervine.filter(user => {
|
||||
console.log('interveniers offline 2', user)
|
||||
return user.Type == 'I';
|
||||
});
|
||||
this.cc = intervine.filter(user => {
|
||||
console.log('interveniers offline 3', user)
|
||||
return user.Type == 'CC';
|
||||
});
|
||||
console.log('interveniers offline', intervine)
|
||||
this.intervenientes = intervine.filter(user => {
|
||||
console.log('interveniers offline 2', user)
|
||||
return user.Type == 'I';
|
||||
});
|
||||
this.cc = intervine.filter(user => {
|
||||
console.log('interveniers offline 3', user)
|
||||
return user.Type == 'CC';
|
||||
});
|
||||
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
async viewDocument(docId:string, Document) {
|
||||
async viewDocument(docId: string, Document) {
|
||||
|
||||
|
||||
console.log(this.fulltask)
|
||||
|
||||
@@ -7,6 +7,7 @@ import { SqliteService } from 'src/app/services/sqlite.service';
|
||||
import { synchro } from 'src/app/services/socket/synchro.service';
|
||||
import { Platform } from '@ionic/angular';
|
||||
import { isThisHour } from 'date-fns';
|
||||
import { BackgroundService } from 'src/app/services/background.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-despachos',
|
||||
@@ -24,14 +25,33 @@ export class DespachosPage implements OnInit {
|
||||
private router: Router,
|
||||
private despachoRule: DespachoService,
|
||||
private sqliteservice: SqliteService,
|
||||
private platform: Platform
|
||||
private platform: Platform,
|
||||
private backgroundservice: BackgroundService
|
||||
) {
|
||||
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
this.getFromDb()
|
||||
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.backgroundservice.registerBackService('Online', () => {
|
||||
this.LoadList();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
async refreshing() {
|
||||
@@ -49,57 +69,42 @@ export class DespachosPage implements OnInit {
|
||||
await this.despachoRule.getList({ updateStore: true }).then((pre) => {
|
||||
this.listToPresent = pre;
|
||||
console.log('despachooo', pre)
|
||||
}).catch(() => {
|
||||
this.getFromDb()
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
getFromDb() {
|
||||
if (synchro.connected === true) {
|
||||
const location = window.location
|
||||
const pathname = location.pathname + location.search
|
||||
|
||||
this.LoadList()
|
||||
|
||||
this.router.events.forEach((event) => {
|
||||
if (event instanceof NavigationStart && event.url.startsWith(pathname)) {
|
||||
if (window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) {
|
||||
this.refreshing()
|
||||
} else {
|
||||
this.LoadList()
|
||||
this.platform.ready().then(() => {
|
||||
this.sqliteservice.getprocessByworkflow('Despacho').then((process: any[]) => {
|
||||
var listtopresent = [];
|
||||
process.forEach(element => {
|
||||
var workflow = JSON.parse(element.workflowInstanceDataFields);
|
||||
let task = {
|
||||
"CreateDate": element.taskStartDate,
|
||||
"DocId": workflow.DispatchDocID,
|
||||
"DocumentURL": undefined,
|
||||
"DocumentsQty": element.totalDocuments,
|
||||
"FolderID": workflow.FolderID,
|
||||
"Folio": workflow.Subject,
|
||||
"Remetente": undefined,
|
||||
"Senders": workflow.Sender,
|
||||
"SerialNumber": element.serialNumber,
|
||||
"Status": workflow.Status,
|
||||
"WorkflowName": element.workflowDisplayName
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (synchro.connected === false) {
|
||||
this.platform.ready().then(() => {
|
||||
this.sqliteservice.getDespachosProcess('Tarefa de Despacho').then((process: any[]) => {
|
||||
var listtopresent = [];
|
||||
process.forEach(element => {
|
||||
var workflow = JSON.parse(element.workflowInstanceDataFields);
|
||||
let task = {
|
||||
"CreateDate": element.taskStartDate,
|
||||
"DocId": workflow.DispatchDocID,
|
||||
"DocumentURL": undefined,
|
||||
"DocumentsQty": element.totalDocuments,
|
||||
"FolderID": workflow.FolderID,
|
||||
"Folio": workflow.Subject,
|
||||
"Remetente": undefined,
|
||||
"Senders": workflow.Sender,
|
||||
"SerialNumber": element.serialNumber,
|
||||
"Status": workflow.Status,
|
||||
"WorkflowName": element.workflowDisplayName
|
||||
}
|
||||
listtopresent.push(task);
|
||||
|
||||
listtopresent.push(task);
|
||||
});
|
||||
|
||||
});
|
||||
this.listToPresent = listtopresent;
|
||||
console.log('Tarefas de despach', this.listToPresent)
|
||||
|
||||
this.listToPresent = listtopresent;
|
||||
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
get skeletonLoader(): boolean {
|
||||
|
||||
@@ -3,7 +3,7 @@ import { AnimationController, ModalController, PopoverController } from '@ionic/
|
||||
import { AddNotePage } from 'src/app/modals/add-note/add-note.page';
|
||||
import { ProcessesService } from 'src/app/services/processes.service';
|
||||
import { OptsExpedientePage } from 'src/app/shared/popover/opts-expediente/opts-expediente.page';
|
||||
import { momentG } from 'src/plugin/momentG';
|
||||
import { momentG } from 'src/plugin/momentG';
|
||||
|
||||
import { InAppBrowser } from '@ionic-native/in-app-browser/ngx';
|
||||
import { ActivatedRoute, NavigationExtras, Router } from '@angular/router';
|
||||
@@ -15,6 +15,7 @@ import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.pag
|
||||
|
||||
import { SqliteService } from 'src/app/services/sqlite.service';
|
||||
import { synchro } from 'src/app/services/socket/synchro.service';
|
||||
import { BackgroundService } from 'src/app/services/background.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-diploma',
|
||||
@@ -27,13 +28,13 @@ export class DiplomaPage implements OnInit {
|
||||
days = ["Domingo", "Segunda-feira", "Terça-feira", "Quarta-feira", "Quinta-feira", "Sexta-feira", "Sábado"];
|
||||
|
||||
serialNumber: string;
|
||||
caller:string;
|
||||
caller: string;
|
||||
profile: string;
|
||||
task: any
|
||||
fulltask: any
|
||||
intervenientes: any;
|
||||
cc: any = [];
|
||||
attachments:any;
|
||||
attachments: any;
|
||||
customDate: any
|
||||
|
||||
constructor(
|
||||
@@ -46,15 +47,16 @@ export class DiplomaPage implements OnInit {
|
||||
private animationController: AnimationController,
|
||||
private toastService: ToastService,
|
||||
private location: Location,
|
||||
private sqliteservice: SqliteService
|
||||
private sqliteservice: SqliteService,
|
||||
private backgroundservice: BackgroundService
|
||||
) {
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -64,7 +66,10 @@ export class DiplomaPage implements OnInit {
|
||||
|
||||
ngOnInit() {
|
||||
this.profile = "mdgpr";
|
||||
this.getFromDb();
|
||||
this.LoadTaskDetail(this.serialNumber);
|
||||
this.backgroundservice.registerBackService('Online', () => {
|
||||
this.LoadTaskDetail(this.serialNumber);
|
||||
});
|
||||
}
|
||||
|
||||
goBack() {
|
||||
@@ -104,7 +109,7 @@ export class DiplomaPage implements OnInit {
|
||||
serialNumber: this.serialNumber,
|
||||
task: this.task,
|
||||
fulltask: this.fulltask,
|
||||
taskAction:taskAction,
|
||||
taskAction: taskAction,
|
||||
showEnviarPendentes: false
|
||||
},
|
||||
translucent: true
|
||||
@@ -118,7 +123,7 @@ export class DiplomaPage implements OnInit {
|
||||
"SerialNumber": res.serialNumber,
|
||||
"Folio": res.workflowInstanceDataFields.Subject,
|
||||
"Senders": res.originator.email,
|
||||
"CreateDate": momentG(new Date(res.taskStartDate),'yyyy-MM-dd HH:mm:ss'),
|
||||
"CreateDate": momentG(new Date(res.taskStartDate), 'yyyy-MM-dd HH:mm:ss'),
|
||||
"DocumentURL": res.workflowInstanceDataFields.ViewerRequest,
|
||||
"Remetente": res.workflowInstanceDataFields.Sender,
|
||||
"Note": res.workflowInstanceDataFields.TaskMessage || res.workflowInstanceDataFields.Note,
|
||||
@@ -133,94 +138,90 @@ export class DiplomaPage implements OnInit {
|
||||
this.sqliteservice.updateProcess(res)
|
||||
|
||||
let thedate = new Date(this.task.CreateDate);
|
||||
this.customDate = this.days[thedate.getDay()]+ ", " + thedate.getDate() +" de " + ( this.months[thedate.getMonth()]);
|
||||
this.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(() => {
|
||||
console.log('internen diploma ')
|
||||
})
|
||||
this.intervenientes = users.filter(user=>{
|
||||
this.intervenientes = users.filter(user => {
|
||||
return user.Type == 'I';
|
||||
});
|
||||
this.cc = users.filter(user=>{
|
||||
this.cc = users.filter(user => {
|
||||
return user.Type == 'CC';
|
||||
});
|
||||
});
|
||||
this.getDocumentDetails(this.task.FolderId, '361');
|
||||
|
||||
}, (error)=>{
|
||||
try {
|
||||
this.goBack()
|
||||
} catch (e) {
|
||||
window.history.back();
|
||||
} finally {
|
||||
if(error.status == 0) {
|
||||
this.toastService.badRequest('Não é possível visualizar este processo no modo offline')
|
||||
} else {
|
||||
this.toastService.badRequest('Processo não encontrado')
|
||||
}, (error) => {
|
||||
if (error.status == 0) {
|
||||
this.getFromDb();
|
||||
} else {
|
||||
try {
|
||||
this.goBack()
|
||||
} catch (e) {
|
||||
window.history.back();
|
||||
}
|
||||
this.toastService.badRequest('Processo não encontrado')
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
getFromDb() {
|
||||
if(synchro.connected === true) {
|
||||
this.LoadTaskDetail(this.serialNumber);
|
||||
} else {
|
||||
this.sqliteservice.getProcessById(this.serialNumber).then((process) => {
|
||||
|
||||
this.task = {
|
||||
"SerialNumber": process[0].serialNumber,
|
||||
"Folio": JSON.parse(process[0].workflowInstanceDataFields).Subject,
|
||||
"Senders": JSON.parse(process[0].originator).email,
|
||||
"CreateDate": momentG(new Date(process[0].taskStartDate),'yyyy-MM-dd HH:mm:ss'),
|
||||
"DocumentURL": JSON.parse(process[0].workflowInstanceDataFields).ViewerRequest,
|
||||
"Remetente": JSON.parse(process[0].workflowInstanceDataFields).Sender,
|
||||
"Note": JSON.parse(process[0].workflowInstanceDataFields).TaskMessage || JSON.parse(process[0].workflowInstanceDataFields).Note,
|
||||
"FolderId": JSON.parse(process[0].workflowInstanceDataFields).FolderID,
|
||||
"FsId": '361',
|
||||
"DocId": JSON.parse(process[0].workflowInstanceDataFields).DispatchDocId,
|
||||
"WorkflowName": process[0].workflowDisplayName,
|
||||
"DeadlineType": JSON.parse(process[0].workflowInstanceDataFields).DeadlineType,
|
||||
"activityInstanceName": process[0].activityInstanceName,
|
||||
}
|
||||
this.sqliteservice.getProcessById(this.serialNumber).then((process) => {
|
||||
|
||||
let fulltak = {
|
||||
Documents: JSON.parse(process[0].Documents),
|
||||
actions: JSON.parse(process[0].actions),
|
||||
activityInstanceName: process[0].activityInstanceName,
|
||||
formURL: process[0].formURL,
|
||||
originator: JSON.parse(process[0].originator),
|
||||
serialNumber: process[0].serialNumber,
|
||||
taskStartDate: process[0].taskStartDate,
|
||||
totalDocuments: process[0].totalDocuments,
|
||||
workflowDisplayName: process[0].workflowDisplayName,
|
||||
workflowID: process[0].workflowID,
|
||||
workflowInstanceDataFields: JSON.parse(process[0].workflowInstanceDataFields),
|
||||
workflowInstanceFolio: process[0].workflowInstanceFolio,
|
||||
workflowInstanceID: process[0].workflowInstanceID,
|
||||
workflowName: process[0].workflowName
|
||||
}
|
||||
this.fulltask = fulltak
|
||||
this.task = {
|
||||
"SerialNumber": process[0].serialNumber,
|
||||
"Folio": JSON.parse(process[0].workflowInstanceDataFields).Subject,
|
||||
"Senders": JSON.parse(process[0].originator).email,
|
||||
"CreateDate": momentG(new Date(process[0].taskStartDate), 'yyyy-MM-dd HH:mm:ss'),
|
||||
"DocumentURL": JSON.parse(process[0].workflowInstanceDataFields).ViewerRequest,
|
||||
"Remetente": JSON.parse(process[0].workflowInstanceDataFields).Sender,
|
||||
"Note": JSON.parse(process[0].workflowInstanceDataFields).TaskMessage || JSON.parse(process[0].workflowInstanceDataFields).Note,
|
||||
"FolderId": JSON.parse(process[0].workflowInstanceDataFields).FolderID,
|
||||
"FsId": '361',
|
||||
"DocId": JSON.parse(process[0].workflowInstanceDataFields).DispatchDocId,
|
||||
"WorkflowName": process[0].workflowDisplayName,
|
||||
"DeadlineType": JSON.parse(process[0].workflowInstanceDataFields).DeadlineType,
|
||||
"activityInstanceName": process[0].activityInstanceName,
|
||||
}
|
||||
|
||||
let thedate = new Date(this.task.CreateDate);
|
||||
this.customDate = this.days[thedate.getDay()]+ ", " + thedate.getDate() +" de " + ( this.months[thedate.getMonth()]);
|
||||
let fulltak = {
|
||||
Documents: JSON.parse(process[0].Documents),
|
||||
actions: JSON.parse(process[0].actions),
|
||||
activityInstanceName: process[0].activityInstanceName,
|
||||
formURL: process[0].formURL,
|
||||
originator: JSON.parse(process[0].originator),
|
||||
serialNumber: process[0].serialNumber,
|
||||
taskStartDate: process[0].taskStartDate,
|
||||
totalDocuments: process[0].totalDocuments,
|
||||
workflowDisplayName: process[0].workflowDisplayName,
|
||||
workflowID: process[0].workflowID,
|
||||
workflowInstanceDataFields: JSON.parse(process[0].workflowInstanceDataFields),
|
||||
workflowInstanceFolio: process[0].workflowInstanceFolio,
|
||||
workflowInstanceID: process[0].workflowInstanceID,
|
||||
workflowName: process[0].workflowName
|
||||
}
|
||||
this.fulltask = fulltak
|
||||
|
||||
this.intervenientes = JSON.parse(process[0].interveners).filter(user=>{
|
||||
let thedate = new Date(this.task.CreateDate);
|
||||
this.customDate = this.days[thedate.getDay()] + ", " + thedate.getDate() + " de " + (this.months[thedate.getMonth()]);
|
||||
|
||||
this.intervenientes = JSON.parse(process[0].interveners).filter(user => {
|
||||
return user.Type == 'I';
|
||||
});
|
||||
this.cc = JSON.parse(process[0].interveners).filter(user=>{
|
||||
this.cc = JSON.parse(process[0].interveners).filter(user => {
|
||||
return user.Type == 'CC';
|
||||
});
|
||||
|
||||
this.attachments = JSON.parse(process[0].Documents)
|
||||
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
async viewDocument(DocId:string, Document) {
|
||||
async viewDocument(DocId: string, Document) {
|
||||
|
||||
const modal = await this.modalController.create({
|
||||
component: ViewDocumentPage,
|
||||
@@ -243,15 +244,15 @@ export class DiplomaPage implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
getDocumentDetails(forlderId:string, applicationId:string) {
|
||||
this.processes.GetDocumentDetails(forlderId,applicationId).subscribe(res=>{
|
||||
getDocumentDetails(forlderId: string, applicationId: string) {
|
||||
this.processes.GetDocumentDetails(forlderId, applicationId).subscribe(res => {
|
||||
this.attachments = res.Documents;
|
||||
console.log(res['Documents']);
|
||||
console.log(this.attachments);
|
||||
})
|
||||
}
|
||||
|
||||
async askSignature(note:string, documents:any){
|
||||
async askSignature(note: string, documents: any) {
|
||||
let body = {
|
||||
"serialNumber": this.serialNumber,
|
||||
"action": "Aprovar",
|
||||
@@ -259,7 +260,7 @@ export class DiplomaPage implements OnInit {
|
||||
"dataFields": {
|
||||
"ReviewUserComment": note,
|
||||
},
|
||||
"AttachmentList" :documents,
|
||||
"AttachmentList": documents,
|
||||
}
|
||||
|
||||
const loader = this.toastService.loading()
|
||||
@@ -267,7 +268,7 @@ export class DiplomaPage implements OnInit {
|
||||
try {
|
||||
await this.processes.CompleteTask(body).toPromise()
|
||||
|
||||
this.toastService.successMessage(false, ()=>{
|
||||
this.toastService.successMessage(false, () => {
|
||||
this.close();
|
||||
})
|
||||
|
||||
@@ -279,7 +280,7 @@ export class DiplomaPage implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
async askToChange(note:string, documents:any){
|
||||
async askToChange(note: string, documents: any) {
|
||||
let body = {
|
||||
"serialNumber": this.serialNumber,
|
||||
"action": "Retificar",
|
||||
@@ -287,7 +288,7 @@ export class DiplomaPage implements OnInit {
|
||||
"dataFields": {
|
||||
"ReviewUserComment": note,
|
||||
},
|
||||
"AttachmentList" :documents,
|
||||
"AttachmentList": documents,
|
||||
}
|
||||
|
||||
const loader = this.toastService.loading()
|
||||
@@ -303,7 +304,7 @@ export class DiplomaPage implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
async finish(note:string, documents:any){
|
||||
async finish(note: string, documents: any) {
|
||||
|
||||
let body = {
|
||||
"serialNumber": this.serialNumber,
|
||||
@@ -312,7 +313,7 @@ export class DiplomaPage implements OnInit {
|
||||
"dataFields": {
|
||||
"ReviewUserComment": note,
|
||||
},
|
||||
"AttachmentList" :documents,
|
||||
"AttachmentList": documents,
|
||||
}
|
||||
|
||||
const loader = this.toastService.loading()
|
||||
@@ -333,16 +334,16 @@ export class DiplomaPage implements OnInit {
|
||||
return new Date(e).toDateString()
|
||||
}
|
||||
|
||||
async openAddNoteModal(actionName:string) {
|
||||
async openAddNoteModal(actionName: string) {
|
||||
let classs;
|
||||
if( window.innerWidth <= 800){
|
||||
if (window.innerWidth <= 800) {
|
||||
classs = 'modal modal-desktop'
|
||||
} else {
|
||||
} else {
|
||||
classs = 'add-note-modal'
|
||||
}
|
||||
const modal = await this.modalController.create({
|
||||
component: AddNotePage,
|
||||
componentProps:{
|
||||
componentProps: {
|
||||
},
|
||||
cssClass: classs,
|
||||
backdropDismiss: true
|
||||
@@ -351,7 +352,7 @@ export class DiplomaPage implements OnInit {
|
||||
await modal.present();
|
||||
|
||||
modal.onDidDismiss().then(async (res) => {
|
||||
if(res.data){
|
||||
if (res.data) {
|
||||
|
||||
|
||||
const DocumentToSave = res.data.documents.map((e) => {
|
||||
@@ -367,15 +368,15 @@ export class DiplomaPage implements OnInit {
|
||||
}
|
||||
|
||||
|
||||
if(actionName == 'Solicitar assinatura'){
|
||||
if (actionName == 'Solicitar assinatura') {
|
||||
await this.askSignature(res.data.note, docs);
|
||||
this.goBack();
|
||||
}
|
||||
else if(actionName == 'Solicitar alteração'){
|
||||
else if (actionName == 'Solicitar alteração') {
|
||||
await this.askToChange(res.data.note, docs);
|
||||
this.goBack();
|
||||
}
|
||||
else if(actionName == 'Concluir diploma'){
|
||||
else if (actionName == 'Concluir diploma') {
|
||||
await this.finish(res.data.note, docs);
|
||||
this.goBack();
|
||||
}
|
||||
@@ -385,9 +386,9 @@ export class DiplomaPage implements OnInit {
|
||||
|
||||
async openBookMeetingModal(task: any) {
|
||||
let classs;
|
||||
if( window.innerWidth <= 800){
|
||||
if (window.innerWidth <= 800) {
|
||||
classs = 'book-meeting-modal modal modal-desktop'
|
||||
} else {
|
||||
} else {
|
||||
classs = 'modal modal-desktop showAsideOptions'
|
||||
}
|
||||
const modal = await this.modalController.create({
|
||||
@@ -402,7 +403,7 @@ export class DiplomaPage implements OnInit {
|
||||
modal.onDidDismiss();
|
||||
}
|
||||
|
||||
close(){
|
||||
close() {
|
||||
this.modalController.dismiss();
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import { ProcessesService } from 'src/app/services/processes.service';
|
||||
|
||||
import { SqliteService } from 'src/app/services/sqlite.service';
|
||||
import { synchro } from 'src/app/services/socket/synchro.service';
|
||||
import { BackgroundService } from 'src/app/services/background.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-diplomas',
|
||||
@@ -27,7 +28,8 @@ export class DiplomasPage implements OnInit, OnDestroy {
|
||||
private processes: ProcessesService,
|
||||
private router: Router,
|
||||
private activatedRoute: ActivatedRoute,
|
||||
private sqliteservice: SqliteService
|
||||
private sqliteservice: SqliteService,
|
||||
private backgroundservice: BackgroundService
|
||||
) {
|
||||
this.diplomasList = [];
|
||||
//Inicializar segment
|
||||
@@ -54,7 +56,24 @@ export class DiplomasPage implements OnInit, OnDestroy {
|
||||
}
|
||||
});
|
||||
|
||||
this.getFromDb()
|
||||
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.backgroundservice.registerBackService('Online', () => {
|
||||
this.LoadList();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@@ -152,78 +171,68 @@ export class DiplomasPage implements OnInit, OnDestroy {
|
||||
|
||||
async LoadList() {
|
||||
|
||||
this.skeletonLoader = true
|
||||
this.processes.GetTasksList("Despacho do Presidente da República", false).subscribe(async res => {
|
||||
|
||||
let diplomas = await this.processes.GetTasksList("Despacho do Presidente da República", false).toPromise();
|
||||
this.skeletonLoader = true
|
||||
|
||||
this.skeletonLoader = false
|
||||
this.showLoader = false;
|
||||
let diplomas = await this.processes.GetTasksList("Despacho do Presidente da República", false).toPromise();
|
||||
|
||||
this.skeletonLoader = false
|
||||
this.showLoader = false;
|
||||
|
||||
|
||||
let diplomasValidar = diplomas.filter(data => data.activityInstanceName == "Revisar Diploma");
|
||||
let diplomasList = [];
|
||||
diplomasValidar.forEach(async element => {
|
||||
|
||||
let task = this.pipeTask(element)
|
||||
diplomasList.push(task);
|
||||
|
||||
});
|
||||
this.diplomasList = this.sortArrayISODate(diplomasList.reverse());
|
||||
|
||||
|
||||
let diplomasAssinados = diplomas.reverse().filter(data => data.activityInstanceName == "Diploma Assinado");
|
||||
let diplomasAssinadoList = []
|
||||
diplomasAssinados.forEach(async element => {
|
||||
|
||||
let task = this.pipeTask(element)
|
||||
diplomasAssinadoList.push(task);
|
||||
});
|
||||
console.log('diplomasAssinados', diplomasAssinados)
|
||||
this.diplomasAssinadoList = this.sortArrayISODate(diplomasAssinadoList).reverse();
|
||||
|
||||
|
||||
let diplomasValidar = diplomas.filter(data => data.activityInstanceName == "Revisar Diploma");
|
||||
let diplomasList = [];
|
||||
diplomasValidar.forEach(async element => {
|
||||
|
||||
let task = this.pipeTask(element)
|
||||
diplomasList.push(task);
|
||||
|
||||
});
|
||||
this.diplomasList = this.sortArrayISODate(diplomasList.reverse());
|
||||
|
||||
|
||||
let diplomasAssinados = diplomas.reverse().filter(data => data.activityInstanceName == "Diploma Assinado");
|
||||
let diplomasAssinadoList = []
|
||||
diplomasAssinados.forEach(async element => {
|
||||
|
||||
let task = this.pipeTask(element)
|
||||
diplomasAssinadoList.push(task);
|
||||
});
|
||||
console.log('diplomasAssinados', diplomasAssinados)
|
||||
this.diplomasAssinadoList = this.sortArrayISODate(diplomasAssinadoList).reverse();
|
||||
}, (error) => {
|
||||
this.getFromDb()
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
getFromDb() {
|
||||
if (synchro.connected === true) {
|
||||
const location = window.location
|
||||
const pathname = location.pathname + location.search
|
||||
|
||||
this.LoadList()
|
||||
this.sqliteservice.getprocessByworkflow("Despacho do Presidente da República").then((process: any[]) => {
|
||||
|
||||
let diplomasValidar = process.filter(data => data.activityInstanceName == "Revisar Diploma");
|
||||
let diplomasList = [];
|
||||
diplomasValidar.forEach(async element => {
|
||||
|
||||
let task = this.pipeTaskOffline(element)
|
||||
diplomasList.push(task);
|
||||
|
||||
this.router.events.forEach((event) => {
|
||||
if (event instanceof NavigationStart && event.url.startsWith(pathname)) {
|
||||
if (window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) {
|
||||
this.refreshing()
|
||||
} else {
|
||||
this.LoadList()
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.sqliteservice.getprocessByworkflow("Despacho do Presidente da República").then((process: any[]) => {
|
||||
this.diplomasList = this.sortArrayISODate(diplomasList.reverse());
|
||||
|
||||
let diplomasValidar = process.filter(data => data.activityInstanceName == "Revisar Diploma");
|
||||
let diplomasList = [];
|
||||
diplomasValidar.forEach(async element => {
|
||||
let diplomasAssinados = process.reverse().filter(data => data.activityInstanceName == "Diploma Assinado");
|
||||
let diplomasAssinadoList = []
|
||||
diplomasAssinados.forEach(async element => {
|
||||
|
||||
let task = this.pipeTaskOffline(element)
|
||||
diplomasList.push(task);
|
||||
let task = this.pipeTaskOffline(element)
|
||||
diplomasAssinadoList.push(task);
|
||||
});
|
||||
console.log('diplomasAssinados', diplomasAssinados)
|
||||
this.diplomasAssinadoList = this.sortArrayISODate(diplomasAssinadoList).reverse();
|
||||
|
||||
});
|
||||
this.diplomasList = this.sortArrayISODate(diplomasList.reverse());
|
||||
|
||||
let diplomasAssinados = process.reverse().filter(data => data.activityInstanceName == "Diploma Assinado");
|
||||
let diplomasAssinadoList = []
|
||||
diplomasAssinados.forEach(async element => {
|
||||
|
||||
let task = this.pipeTaskOffline(element)
|
||||
diplomasAssinadoList.push(task);
|
||||
});
|
||||
console.log('diplomasAssinados', diplomasAssinados)
|
||||
this.diplomasAssinadoList = this.sortArrayISODate(diplomasAssinadoList).reverse();
|
||||
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
pipeTask(element) {
|
||||
|
||||
@@ -14,7 +14,7 @@ import { Location } from '@angular/common';
|
||||
import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
|
||||
|
||||
import { SqliteService } from '../../../../services/sqlite.service';
|
||||
import { synchro } from '../../../../services/socket/synchro.service';
|
||||
import { BackgroundService } from '../../../../services/background.service';
|
||||
import { Platform } from '@ionic/angular';
|
||||
|
||||
@Component({
|
||||
@@ -33,18 +33,16 @@ export class ApproveEventPage implements OnInit {
|
||||
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;
|
||||
attachments:any;
|
||||
serialNumber: string;
|
||||
caller: string;
|
||||
attachments: any;
|
||||
|
||||
@Input() InstanceId: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 activatedRoute: ActivatedRoute,
|
||||
@@ -59,7 +57,8 @@ export class ApproveEventPage implements OnInit {
|
||||
private toastService: ToastService,
|
||||
private location: Location,
|
||||
private sqliteservice: SqliteService,
|
||||
private platform: Platform
|
||||
private platform: Platform,
|
||||
private backgroundservice: BackgroundService
|
||||
) {
|
||||
this.activatedRoute.paramMap.subscribe(params => {
|
||||
// console.log(params["params"]);
|
||||
@@ -81,7 +80,11 @@ export class ApproveEventPage implements OnInit {
|
||||
ngOnInit() {
|
||||
console.log(this.serialNumber);
|
||||
console.log(this.caller);
|
||||
this.getProcessFromDB();
|
||||
|
||||
this.getTask();
|
||||
this.backgroundservice.registerBackService('Online', () => {
|
||||
this.getTask();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@@ -102,91 +105,91 @@ export class ApproveEventPage implements OnInit {
|
||||
|
||||
addProcessToDB(data) {
|
||||
this.platform.ready().then(() => {
|
||||
this.sqliteservice.updateProcess(data);
|
||||
this.sqliteservice.updateProcess(data);
|
||||
});
|
||||
}
|
||||
|
||||
getProcessFromDB() {
|
||||
|
||||
if (synchro.connected === true) {
|
||||
this.getTask();
|
||||
}
|
||||
this.platform.ready().then(() => {
|
||||
|
||||
synchro.registerCallback('Offline', () => {
|
||||
this.platform.ready().then(() => {
|
||||
this.sqliteservice.getProcessById(this.serialNumber).then((process) => {
|
||||
console.log('event aprove serial', process)
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
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].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)
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
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.loadedEvent = task
|
||||
console.log('offline event',this.loadedEvent);
|
||||
this.today = new Date(this.loadedEvent.workflowInstanceDataFields.StartDate);
|
||||
|
||||
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.loadedAttachments = this.loadedEvent.Documents;
|
||||
console.log('Attatara', this.loadedAttachments)
|
||||
|
||||
let instanceId = this.loadedEvent.workflowInstanceDataFields.InstanceId;
|
||||
this.loadedAttachments = this.loadedEvent.Documents;
|
||||
console.log('Attatara', this.loadedAttachments)
|
||||
|
||||
})
|
||||
})
|
||||
console.log('Offlineee')
|
||||
})
|
||||
console.log('Offlineee')
|
||||
}
|
||||
|
||||
async getTask() {
|
||||
this.loadedEvent = await this.processes.GetTask(this.serialNumber).toPromise();
|
||||
console.log(this.loadedEvent);
|
||||
this.processes.GetTask(this.serialNumber).subscribe(async res => {
|
||||
|
||||
this.today = new Date(this.loadedEvent.workflowInstanceDataFields.StartDate);
|
||||
this.loadedEvent = await this.processes.GetTask(this.serialNumber).toPromise();
|
||||
console.log(this.loadedEvent);
|
||||
|
||||
this.customDate = this.days[this.today.getDay()]+ ", " + this.today.getDate() +" de " + ( this.months[this.today.getMonth()]);
|
||||
this.today = new Date(this.loadedEvent.workflowInstanceDataFields.StartDate);
|
||||
|
||||
this.customDate = this.days[this.today.getDay()] + ", " + this.today.getDate() + " de " + (this.months[this.today.getMonth()]);
|
||||
|
||||
}, (error) => {
|
||||
this.getProcessFromDB();
|
||||
})
|
||||
}
|
||||
|
||||
async approveTask(serialNumber: string) {
|
||||
@@ -284,7 +287,7 @@ export class ApproveEventPage implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
async viewDocument(DocId:string, Document) {
|
||||
async viewDocument(DocId: string, Document) {
|
||||
|
||||
const modal = await this.modalController.create({
|
||||
component: ViewDocumentPage,
|
||||
|
||||
@@ -9,7 +9,7 @@ import { EventoAprovacaoStore } from 'src/app/store/eventoaprovacao-store.servic
|
||||
import { Location } from '@angular/common';
|
||||
|
||||
import { SqliteService } from '../../../services/sqlite.service';
|
||||
import { synchro } from '../../../services/socket/synchro.service';
|
||||
import { BackgroundService } from '../../../services/background.service';
|
||||
import { Platform } from '@ionic/angular';
|
||||
|
||||
@Component({
|
||||
@@ -20,39 +20,55 @@ import { Platform } from '@ionic/angular';
|
||||
export class EventListPage implements OnInit {
|
||||
// [desktop] event list to approve
|
||||
|
||||
profile:string;
|
||||
segment:string;
|
||||
profile: string;
|
||||
segment: string;
|
||||
showLoader: boolean;
|
||||
eventsPRList: any = []
|
||||
eventsMDGPRList: any = []
|
||||
eventPerson: EventPerson;
|
||||
eventBody: EventBody;
|
||||
categories: string[];
|
||||
serialnumber:string;
|
||||
serialnumber: string;
|
||||
|
||||
skeletonLoader = true
|
||||
eventaprovacaostore = EventoAprovacaoStore;
|
||||
|
||||
synch = synchro;
|
||||
|
||||
|
||||
constructor(
|
||||
private processes:ProcessesService,
|
||||
private processes: ProcessesService,
|
||||
private modalController: ModalController,
|
||||
private router: Router,
|
||||
private location: Location,
|
||||
private sqliteservice: SqliteService,
|
||||
private platform: Platform
|
||||
private platform: Platform,
|
||||
private backgroundservice: BackgroundService
|
||||
) { }
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
this.segment = 'MDGPR';
|
||||
this.getEventToAproveFromDB();
|
||||
this.segment = 'MDGPR';
|
||||
|
||||
const location = window.location
|
||||
const pathname = location.pathname + location.search
|
||||
|
||||
this.LoadToApproveEvents()
|
||||
|
||||
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.LoadToApproveEvents()
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.backgroundservice.registerBackService('Online', () => {
|
||||
this.LoadToApproveEvents();
|
||||
});
|
||||
|
||||
window.onresize = (event) => {
|
||||
// if not mobile remove all component
|
||||
if( window.innerWidth <= 800){
|
||||
if (window.innerWidth <= 800) {
|
||||
this.modalController.dismiss();
|
||||
}
|
||||
};
|
||||
@@ -61,76 +77,59 @@ export class EventListPage implements OnInit {
|
||||
|
||||
getEventToAproveFromDB() {
|
||||
|
||||
if( synchro.connected === true) {
|
||||
const location = window.location
|
||||
const pathname = location.pathname + location.search
|
||||
|
||||
this.LoadToApproveEvents()
|
||||
|
||||
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.LoadToApproveEvents()
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
this.platform.ready().then(() => {
|
||||
|
||||
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)
|
||||
})
|
||||
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')
|
||||
})
|
||||
console.log('Offlineee')
|
||||
}
|
||||
|
||||
segmentChanged(ev: any) {
|
||||
this.LoadToApproveEvents();
|
||||
}
|
||||
|
||||
async LoadToApproveEvents(){
|
||||
this.showLoader = true;
|
||||
this.skeletonLoader = true
|
||||
async LoadToApproveEvents() {
|
||||
|
||||
console.log(this.segment);
|
||||
if(this.segment == 'MDGPR'){
|
||||
let mdEventsOficial = await this.processes.GetTasksList('Agenda Oficial MDGPR', false).toPromise();
|
||||
let mdEventsPessoal = await this.processes.GetTasksList('Agenda Pessoal MDGPR', false).toPromise();
|
||||
this.eventsMDGPRList = mdEventsOficial.concat(mdEventsPessoal);
|
||||
console.log('Event aprove',this.eventsMDGPRList);
|
||||
this.processes.GetTasksList('Agenda Oficial MDGPR', false).subscribe(async res => {
|
||||
this.showLoader = true;
|
||||
this.skeletonLoader = true
|
||||
|
||||
console.log(this.segment);
|
||||
if (this.segment == 'MDGPR') {
|
||||
let mdEventsOficial = await this.processes.GetTasksList('Agenda Oficial MDGPR', false).toPromise();
|
||||
let mdEventsPessoal = await this.processes.GetTasksList('Agenda Pessoal MDGPR', false).toPromise();
|
||||
this.eventsMDGPRList = mdEventsOficial.concat(mdEventsPessoal);
|
||||
console.log('Event aprove', this.eventsMDGPRList);
|
||||
|
||||
|
||||
this.eventaprovacaostore.resetmd(this.eventsMDGPRList);
|
||||
}
|
||||
else if (this.segment == 'PR') {
|
||||
let prEventsOficial = await this.processes.GetTasksList('Agenda Oficial PR', false).toPromise();
|
||||
let prEventsPessoal = await this.processes.GetTasksList('Agenda Pessoal PR', false).toPromise();
|
||||
this.eventsPRList = prEventsOficial.concat(prEventsPessoal);
|
||||
this.eventaprovacaostore.resetpr(this.eventsPRList);
|
||||
}
|
||||
this.showLoader = false;
|
||||
this.skeletonLoader = false
|
||||
|
||||
|
||||
this.eventaprovacaostore.resetmd(this.eventsMDGPRList);
|
||||
}
|
||||
else if(this.segment == 'PR'){
|
||||
let prEventsOficial = await this.processes.GetTasksList('Agenda Oficial PR', false).toPromise();
|
||||
let prEventsPessoal = await this.processes.GetTasksList('Agenda Pessoal PR', false).toPromise();
|
||||
this.eventsPRList = prEventsOficial.concat(prEventsPessoal);
|
||||
this.eventaprovacaostore.resetpr(this.eventsPRList);
|
||||
}
|
||||
this.showLoader = false;
|
||||
this.skeletonLoader = false
|
||||
}, (error) => {
|
||||
this.getEventToAproveFromDB();
|
||||
})
|
||||
}
|
||||
|
||||
getEventToaproveFromDB() {
|
||||
|
||||
}
|
||||
|
||||
async openApproveModal(eventSerialNumber, event){
|
||||
async openApproveModal(eventSerialNumber, event) {
|
||||
const modal = await this.modalController.create({
|
||||
component: ApproveEventModalPage,
|
||||
componentProps:{
|
||||
componentProps: {
|
||||
serialNumber: eventSerialNumber,
|
||||
},
|
||||
cssClass: 'event-list cal-modal modal modal-desktop',
|
||||
@@ -139,7 +138,7 @@ export class EventListPage implements OnInit {
|
||||
await modal.present();
|
||||
}
|
||||
|
||||
goToEventToApproveDetail(serialNumber:string){
|
||||
goToEventToApproveDetail(serialNumber: string) {
|
||||
console.log(serialNumber);
|
||||
|
||||
/* let navigationExtras: NavigationExtras = {
|
||||
@@ -148,11 +147,11 @@ export class EventListPage implements OnInit {
|
||||
}
|
||||
}; */
|
||||
|
||||
if(this.router.url == '/home/agenda/event-list'){
|
||||
this.router.navigate(['/home/agenda/event-list/approve-event',serialNumber, 'agenda'])
|
||||
if (this.router.url == '/home/agenda/event-list') {
|
||||
this.router.navigate(['/home/agenda/event-list/approve-event', serialNumber, 'agenda'])
|
||||
}
|
||||
else if(this.router.url == '/home/gabinete-digital/event-list'){
|
||||
this.router.navigate(['/home/gabinete-digital/event-list/approve-event',serialNumber, 'gabinete-digital'])
|
||||
else if (this.router.url == '/home/gabinete-digital/event-list') {
|
||||
this.router.navigate(['/home/gabinete-digital/event-list/approve-event', serialNumber, 'gabinete-digital'])
|
||||
}
|
||||
|
||||
//this.router.navigate(['/home/gabinete-digital/event-list/approve-event'], navigationExtras)
|
||||
@@ -172,7 +171,7 @@ export class EventListPage implements OnInit {
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
close(){
|
||||
close() {
|
||||
this.modalController.dismiss(null);
|
||||
}
|
||||
goBack() {
|
||||
|
||||
+45
-48
@@ -28,7 +28,7 @@ import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.pag
|
||||
|
||||
import { SqliteService } from 'src/app/services/sqlite.service';
|
||||
import { Platform } from '@ionic/angular';
|
||||
import { synchro } from 'src/app/services/socket/synchro.service';
|
||||
import { BackgroundService } from 'src/app/services/background.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-expediente-detail',
|
||||
@@ -56,7 +56,6 @@ export class ExpedienteDetailPage implements OnInit {
|
||||
hideSendToPendentes = true
|
||||
searchDocumentPipe = new SearchDocumentPipe()
|
||||
|
||||
synch = synchro
|
||||
onlinecheck: boolean;
|
||||
|
||||
constructor(
|
||||
@@ -76,6 +75,7 @@ export class ExpedienteDetailPage implements OnInit {
|
||||
private expedienteService: ExpedienteService,
|
||||
public platform: Platform,
|
||||
private sqliteservice: SqliteService,
|
||||
private backgroundservice: BackgroundService
|
||||
) {
|
||||
this.activatedRoute.paramMap.subscribe(params => {
|
||||
if (params["params"].SerialNumber) {
|
||||
@@ -88,7 +88,11 @@ export class ExpedienteDetailPage implements OnInit {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.getFromDB();
|
||||
|
||||
this.LoadTaskDetail(this.serialNumber);
|
||||
this.backgroundservice.registerBackService('Online', () => {
|
||||
this.LoadTaskDetail(this.serialNumber);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@@ -102,44 +106,37 @@ export class ExpedienteDetailPage implements OnInit {
|
||||
|
||||
getFromDB() {
|
||||
|
||||
if(synchro.connected === true) {
|
||||
this.LoadTaskDetail(this.serialNumber);
|
||||
}
|
||||
this.platform.ready().then(() => {
|
||||
this.onlinecheck = false;
|
||||
this.sqliteservice.getProcessById(this.serialNumber).then((process) => {
|
||||
console.log("expedient ditail", process)
|
||||
|
||||
var workflow = JSON.parse(process[0].workflowInstanceDataFields);
|
||||
var origina
|
||||
if (process[0].originator === "undefined") {
|
||||
origina = ""
|
||||
} else {
|
||||
origina = JSON.parse(process[0].originator)
|
||||
}
|
||||
|
||||
synchro.registerCallback('Offline', () => {
|
||||
this.platform.ready().then(() => {
|
||||
this.onlinecheck = false;
|
||||
this.sqliteservice.getProcessById(this.serialNumber).then((process) => {
|
||||
console.log("expedient ditail", process)
|
||||
this.task = {
|
||||
"SerialNumber": process[0].serialNumber,
|
||||
"Folio": workflow.Subject,
|
||||
"Senders": origina.email || process[0].originator,
|
||||
"CreateDate": momentG(new Date(process[0].taskStartDate), 'yyyy-MM-dd HH:mm:ss'),
|
||||
"DocumentURL": workflow.ViewerRequest,
|
||||
"Remetente": workflow.Sender,
|
||||
"Note": workflow.TaskMessage || workflow.Note,
|
||||
"FolderId": workflow.FolderID,
|
||||
"FsId": workflow.FsId,
|
||||
"DocId": workflow.DocID,
|
||||
"WorkflowName": process[0].workflowDisplayName,
|
||||
"Status": workflow.Status,
|
||||
"DispatchNumber": workflow.DispatchNumber,
|
||||
"AttachmentsProcessLastInstanceID": workflow.AttachmentsProcessLastInstanceID,
|
||||
"InstanceID": workflow.InstanceID
|
||||
}
|
||||
|
||||
var workflow = JSON.parse(process[0].workflowInstanceDataFields);
|
||||
var origina
|
||||
if (process[0].originator === "undefined") {
|
||||
origina = ""
|
||||
} else {
|
||||
origina = JSON.parse(process[0].originator)
|
||||
}
|
||||
|
||||
this.task = {
|
||||
"SerialNumber": process[0].serialNumber,
|
||||
"Folio": workflow.Subject,
|
||||
"Senders": origina.email || process[0].originator,
|
||||
"CreateDate": momentG(new Date(process[0].taskStartDate), 'yyyy-MM-dd HH:mm:ss'),
|
||||
"DocumentURL": workflow.ViewerRequest,
|
||||
"Remetente": workflow.Sender,
|
||||
"Note": workflow.TaskMessage || workflow.Note,
|
||||
"FolderId": workflow.FolderID,
|
||||
"FsId": workflow.FsId,
|
||||
"DocId": workflow.DocID,
|
||||
"WorkflowName": process[0].workflowDisplayName,
|
||||
"Status": workflow.Status,
|
||||
"DispatchNumber": workflow.DispatchNumber,
|
||||
"AttachmentsProcessLastInstanceID": workflow.AttachmentsProcessLastInstanceID,
|
||||
"InstanceID": workflow.InstanceID
|
||||
}
|
||||
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
@@ -336,17 +333,17 @@ export class ExpedienteDetailPage implements OnInit {
|
||||
console.log('this.task.DocumentURL', this.task.DocumentURL)
|
||||
|
||||
}, (error) => {
|
||||
try {
|
||||
this.toastService.badRequest('Processo não encontrado')
|
||||
this.goBack()
|
||||
} catch (e) {
|
||||
window.history.back();
|
||||
} finally {
|
||||
if (error.status == 0) {
|
||||
this.toastService.badRequest('Não é possível visualizar este processo no modo offline')
|
||||
} else {
|
||||
|
||||
if (error.status == 0) {
|
||||
this.getFromDB();
|
||||
} else {
|
||||
try {
|
||||
this.toastService.badRequest('Processo não encontrado')
|
||||
this.goBack()
|
||||
} catch (e) {
|
||||
window.history.back();
|
||||
}
|
||||
this.toastService.badRequest('Processo não encontrado')
|
||||
}
|
||||
});
|
||||
|
||||
@@ -358,7 +355,7 @@ export class ExpedienteDetailPage implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
async viewDocument(DocId:string, Document) {
|
||||
async viewDocument(DocId: string, Document) {
|
||||
|
||||
// this.expedienteService.viewDocument({ApplicationId:'361', DocId})
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import { ExpedienteGdStore } from 'src/app/store/expedientegd-store.service';
|
||||
import { ExpedienteTaskPipe } from 'src/app/pipes/expediente-task.pipe';
|
||||
import { SqliteService } from 'src/app/services/sqlite.service';
|
||||
import { Platform } from '@ionic/angular';
|
||||
import { synchro } from '../../../services/socket/synchro.service';
|
||||
import { BackgroundService } from '../../../services/background.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-expediente',
|
||||
@@ -28,48 +28,69 @@ export class ExpedientePage implements OnInit {
|
||||
onlinecheck: boolean;
|
||||
|
||||
listToPresent;
|
||||
synch = synchro
|
||||
constructor(
|
||||
private processes: ProcessesService,
|
||||
private router: Router,
|
||||
private toastService: ToastService,
|
||||
public platform: Platform,
|
||||
private sqliteservice: SqliteService,
|
||||
private backgroundservice: BackgroundService
|
||||
) { }
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
this.getEventsFromLocalDb();
|
||||
console.log("segrsgre")
|
||||
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.backgroundservice.registerBackService('Online', () => {
|
||||
this.LoadList();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
async LoadList() {
|
||||
this.skeletonLoader = true
|
||||
|
||||
try {
|
||||
const expediente: object[] = await this.processes.GetTaskListExpediente(false).toPromise()
|
||||
const result = expediente
|
||||
this.processes.GetTaskListExpediente(false).subscribe(async res => {
|
||||
this.skeletonLoader = true
|
||||
|
||||
this.taskslist = new Array();
|
||||
let res = result.reverse().filter((data: any) => data.workflowInstanceDataFields.Status == "Active");
|
||||
try {
|
||||
const expediente: object[] = await this.processes.GetTaskListExpediente(false).toPromise()
|
||||
const result = expediente
|
||||
|
||||
res.forEach((element: any) => {
|
||||
this.taskslist = new Array();
|
||||
let res = result.reverse().filter((data: any) => data.workflowInstanceDataFields.Status == "Active");
|
||||
|
||||
let task = this.expedienteTaskPipe.transform(element)
|
||||
this.taskslist.push(task);
|
||||
this.sqliteservice.addProcess(task);
|
||||
});
|
||||
res.forEach((element: any) => {
|
||||
|
||||
this.listToPresent = this.taskslist
|
||||
console.log('expediente list', this.listToPresent)
|
||||
let task = this.expedienteTaskPipe.transform(element)
|
||||
this.taskslist.push(task);
|
||||
this.sqliteservice.addProcess(task);
|
||||
});
|
||||
|
||||
} catch (error) {
|
||||
this.toastService.badRequest('Processo não encontrado')
|
||||
this.goBack()
|
||||
} finally {
|
||||
this.skeletonLoader = false;
|
||||
}
|
||||
this.listToPresent = this.taskslist
|
||||
console.log('expediente list', this.listToPresent)
|
||||
|
||||
} catch (error) {
|
||||
this.toastService.badRequest('Processo não encontrado')
|
||||
this.goBack()
|
||||
} finally {
|
||||
this.skeletonLoader = false;
|
||||
}
|
||||
}, (error) => {
|
||||
this.getEventsFromLocalDb();
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
@@ -121,49 +142,32 @@ export class ExpedientePage implements OnInit {
|
||||
|
||||
getEventsFromLocalDb() {
|
||||
|
||||
if (synchro.connected === true) {
|
||||
const location = window.location
|
||||
const pathname = location.pathname + location.search
|
||||
this.taskslist = new Array();
|
||||
this.sqliteservice.getprocessByworkflow("Expediente").then((expediente: any[]) => {
|
||||
console.log("All expedientes from local,", expediente)
|
||||
|
||||
this.LoadList()
|
||||
expediente.forEach((element) => {
|
||||
|
||||
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()
|
||||
}
|
||||
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)
|
||||
|
||||
});
|
||||
} else {
|
||||
this.taskslist = new Array();
|
||||
this.sqliteservice.getprocessByworkflow("Expediente").then((expediente: any[]) => {
|
||||
console.log("All expedientes from local,", expediente)
|
||||
|
||||
expediente.forEach((element) => {
|
||||
this.listToPresent = this.taskslist
|
||||
|
||||
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
|
||||
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ import { PermissionService } from 'src/app/services/worker/permission.service';
|
||||
import { SqliteService } from '../../services/sqlite.service';
|
||||
import { synchro } from '../../services/socket/synchro.service';
|
||||
import { Platform } from '@ionic/angular';
|
||||
import { BackgroundService } from 'src/app/services/background.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-gabinete-digital',
|
||||
@@ -130,7 +131,8 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
|
||||
private despachoRule: DespachoService,
|
||||
private sqliteservice: SqliteService,
|
||||
private platform: Platform,
|
||||
private changeProfileService: ChangeProfileService
|
||||
private changeProfileService: ChangeProfileService,
|
||||
private backgroundservice: BackgroundService
|
||||
) {
|
||||
|
||||
this.loggeduser = authService.ValidatedUser;
|
||||
@@ -178,57 +180,91 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
|
||||
this.segmentVista = "boxview"
|
||||
}
|
||||
|
||||
this.getAllProcessFromDB()
|
||||
const pathname = window.location.pathname
|
||||
this.router.events.forEach((event) => {
|
||||
if (event instanceof NavigationEnd && event.url == pathname) {
|
||||
|
||||
this.waitForDomService.selector({
|
||||
selector: 'app-gabinete-digital ion-content .aside-wrapper',
|
||||
callback: () => {
|
||||
this.checkRoutes();
|
||||
this.LoadCounts();
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
this.hideRefreshButton();
|
||||
|
||||
this.waitForDomService.selector({
|
||||
selector: 'app-gabinete-digital ion-content .aside-wrapper',
|
||||
callback: () => {
|
||||
this.loadAllProcesses();
|
||||
}
|
||||
})
|
||||
|
||||
this.backgroundservice.registerBackService('Online', () => {
|
||||
this.loadAllProcesses();
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
async loadAllProcesses() {
|
||||
let allProcessesList = await this.processesbackend.GetTasksList("", false).toPromise();
|
||||
|
||||
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')
|
||||
}
|
||||
this.processesbackend.GetTasksList("", false).subscribe(async res => {
|
||||
|
||||
console.log('allProcessesList', allProcessesList);
|
||||
let allProcessesList = await this.processesbackend.GetTasksList("", false).toPromise();
|
||||
|
||||
this.addProcessToDB(allProcessesList)
|
||||
this.skeletonLoader = true;
|
||||
|
||||
this.allProcessesList = [];
|
||||
|
||||
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 task = {
|
||||
"SerialNumber": element.serialNumber,
|
||||
"Folio": element.workflowInstanceDataFields.Subject,
|
||||
"Senders": element.workflowInstanceDataFields.Sender,
|
||||
//"CreateDate": taskDate,
|
||||
"CreateDate": new Date(element.taskStartDate),
|
||||
"DocumentURL": element.workflowInstanceDataFields.ViewerRequest,
|
||||
"Remetente": element.workflowInstanceDataFields.Remetente,
|
||||
"DocumentsQty": element.totalDocuments,
|
||||
"DocId": element.workflowInstanceDataFields.DispatchDocId,
|
||||
"FolderID": element.workflowInstanceDataFields.FolderID,
|
||||
"WorkflowName": element.workflowDisplayName,
|
||||
"activityInstanceName": element.activityInstanceName,
|
||||
"Status": element.workflowInstanceDataFields.Status,
|
||||
"Agenda": element.workflowInstanceDataFields.Agenda,
|
||||
"customDate": this.setFormatDate(new Date(element.workflowInstanceDataFields.StartDate), new Date(element.workflowInstanceDataFields.EndDate), element.workflowInstanceDataFields.IsAllDayEvent),
|
||||
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')
|
||||
}
|
||||
|
||||
this.allProcessesList.push(task);
|
||||
this.allProcessesList = removeDuplicate(this.allProcessesList)
|
||||
this.allProcessesList = this.sortArrayISODate(this.allProcessesList).reverse();
|
||||
console.log('allProcessesList', allProcessesList);
|
||||
|
||||
|
||||
this.addProcessToDB(allProcessesList)
|
||||
this.skeletonLoader = true;
|
||||
|
||||
});
|
||||
this.allProcessesList = [];
|
||||
|
||||
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 task = {
|
||||
"SerialNumber": element.serialNumber,
|
||||
"Folio": element.workflowInstanceDataFields.Subject,
|
||||
"Senders": element.workflowInstanceDataFields.Sender,
|
||||
//"CreateDate": taskDate,
|
||||
"CreateDate": new Date(element.taskStartDate),
|
||||
"DocumentURL": element.workflowInstanceDataFields.ViewerRequest,
|
||||
"Remetente": element.workflowInstanceDataFields.Remetente,
|
||||
"DocumentsQty": element.totalDocuments,
|
||||
"DocId": element.workflowInstanceDataFields.DispatchDocId,
|
||||
"FolderID": element.workflowInstanceDataFields.FolderID,
|
||||
"WorkflowName": element.workflowDisplayName,
|
||||
"activityInstanceName": element.activityInstanceName,
|
||||
"Status": element.workflowInstanceDataFields.Status,
|
||||
"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();
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
}, (error) => {
|
||||
console.log('gabinete digital offline', error)
|
||||
this.getAllProcessFromDB();
|
||||
})
|
||||
|
||||
this.skeletonLoader = false;
|
||||
|
||||
@@ -254,7 +290,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
|
||||
"workflowInstanceID": element.workflowInstanceID,
|
||||
"workflowName": element.workflowName
|
||||
}
|
||||
|
||||
|
||||
this.sqliteservice.addProcess(process);
|
||||
});
|
||||
});
|
||||
@@ -262,65 +298,40 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
|
||||
|
||||
getAllProcessFromDB() {
|
||||
|
||||
if (synchro.connected === true ) {
|
||||
const pathname = window.location.pathname
|
||||
this.router.events.forEach((event) => {
|
||||
if (event instanceof NavigationEnd && event.url == pathname) {
|
||||
|
||||
this.waitForDomService.selector({
|
||||
selector: 'app-gabinete-digital ion-content .aside-wrapper',
|
||||
callback: () => {
|
||||
this.checkRoutes();
|
||||
this.LoadCounts();
|
||||
}
|
||||
})
|
||||
this.hideRefreshButton();
|
||||
|
||||
this.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);
|
||||
|
||||
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.hideRefreshButton();
|
||||
|
||||
this.waitForDomService.selector({
|
||||
selector: 'app-gabinete-digital ion-content .aside-wrapper',
|
||||
callback: () => {
|
||||
this.loadAllProcesses();
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.hideRefreshButton();
|
||||
|
||||
this.sqliteservice.getAllProcess().then((allprocess: any[]) => {
|
||||
allprocess.forEach(element => {
|
||||
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);
|
||||
|
||||
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();
|
||||
|
||||
});
|
||||
console.log("All process from db ", allprocess)
|
||||
})
|
||||
}
|
||||
console.log("All process from db ", allprocess)
|
||||
})
|
||||
}
|
||||
|
||||
sortArrayISODate(myArray: any) {
|
||||
@@ -376,15 +387,15 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
|
||||
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']);
|
||||
@@ -538,7 +549,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
|
||||
|
||||
let allPreocesses_ = await this.processesbackend.GetTasksList("", false).toPromise();
|
||||
let count_all_processes = Object.keys(allPreocesses_).length;
|
||||
|
||||
|
||||
|
||||
let expedientes = await this.processesbackend.GetTaskListExpediente(false).toPromise();
|
||||
expedientes = expedientes.filter(data => data.workflowInstanceDataFields.Status == "Active")
|
||||
|
||||
@@ -21,7 +21,7 @@ import { Location } from '@angular/common';
|
||||
import { PedidoService } from 'src/app/Rules/pedido.service';
|
||||
|
||||
import { SqliteService } from 'src/app/services/sqlite.service';
|
||||
import { synchro } from 'src/app/services/socket/synchro.service';
|
||||
import { BackgroundService } from 'src/app/services/background.service';
|
||||
|
||||
import { PermissionService } from 'src/app/services/worker/permission.service';
|
||||
import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
|
||||
@@ -62,6 +62,7 @@ export class PedidoPage implements OnInit {
|
||||
private location: Location,
|
||||
private pedidoService: PedidoService,
|
||||
private sqliteservice: SqliteService,
|
||||
private backgroundservices: BackgroundService
|
||||
) {
|
||||
this.loggeduser = authService.ValidatedUser;
|
||||
|
||||
@@ -79,7 +80,10 @@ export class PedidoPage implements OnInit {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.getfromDb()
|
||||
this.LoadTaskDetail(this.serialnumber);
|
||||
this.backgroundservices.registerBackService('Online', () => {
|
||||
this.LoadTaskDetail(this.serialnumber);
|
||||
});
|
||||
}
|
||||
|
||||
close() {
|
||||
@@ -155,7 +159,7 @@ export class PedidoPage implements OnInit {
|
||||
this.customDate = this.days[thedate.getDay()] + ", " + thedate.getDate() + " de " + (this.months[thedate.getMonth()]);
|
||||
|
||||
this.processes.GetTaskParticipants(res.workflowInstanceDataFields.FolderID).subscribe(users => {
|
||||
this.sqliteservice.updateProcessInterveners(JSON.stringify(this.serialnumber), JSON.stringify(users)).then(() =>{
|
||||
this.sqliteservice.updateProcessInterveners(JSON.stringify(this.serialnumber), JSON.stringify(users)).then(() => {
|
||||
console.log('Pedido ')
|
||||
})
|
||||
this.intervenientes = users.filter(user => {
|
||||
@@ -167,114 +171,108 @@ export class PedidoPage implements OnInit {
|
||||
});
|
||||
this.getDocumentDetails(res.workflowInstanceDataFields.FolderID, '361');
|
||||
}, (error) => {
|
||||
try {
|
||||
this.goBack()
|
||||
this.close()
|
||||
} catch (e) {
|
||||
window.history.back();
|
||||
} finally {
|
||||
if (error.status == 0) {
|
||||
this.toastService.badRequest('Não é possível visualizar este processo no modo offline')
|
||||
} else {
|
||||
this.toastService.badRequest('Processo não encontrado')
|
||||
if (error.status == 0) {
|
||||
this.getfromDb();
|
||||
} else {
|
||||
try {
|
||||
this.goBack()
|
||||
this.close()
|
||||
} catch (e) {
|
||||
window.history.back();
|
||||
}
|
||||
this.toastService.badRequest('Processo não encontrado')
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
getfromDb() {
|
||||
if (synchro.connected === true) {
|
||||
this.LoadTaskDetail(this.serialnumber);
|
||||
}
|
||||
|
||||
if (synchro.connected === false) {
|
||||
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),
|
||||
actions: JSON.parse(process[0].actions),
|
||||
activityInstanceName: process[0].activityInstanceName,
|
||||
formURL: process[0].formURL,
|
||||
originator: JSON.parse(process[0].originator),
|
||||
serialNumber: process[0].serialNumber,
|
||||
taskStartDate: process[0].taskStartDate,
|
||||
totalDocuments: process[0].totalDocuments,
|
||||
workflowDisplayName: process[0].workflowDisplayName,
|
||||
workflowID: process[0].workflowID,
|
||||
workflowInstanceDataFields: JSON.parse(process[0].workflowInstanceDataFields),
|
||||
workflowInstanceFolio: process[0].workflowInstanceFolio,
|
||||
workflowInstanceID: process[0].workflowInstanceID,
|
||||
workflowName: process[0].workflowName
|
||||
let fulltak = {
|
||||
Documents: JSON.parse(process[0].Documents) || [],
|
||||
actions: JSON.parse(process[0].actions),
|
||||
activityInstanceName: process[0].activityInstanceName,
|
||||
formURL: process[0].formURL,
|
||||
originator: JSON.parse(process[0].originator),
|
||||
serialNumber: process[0].serialNumber,
|
||||
taskStartDate: process[0].taskStartDate,
|
||||
totalDocuments: process[0].totalDocuments,
|
||||
workflowDisplayName: process[0].workflowDisplayName,
|
||||
workflowID: process[0].workflowID,
|
||||
workflowInstanceDataFields: JSON.parse(process[0].workflowInstanceDataFields),
|
||||
workflowInstanceFolio: process[0].workflowInstanceFolio,
|
||||
workflowInstanceID: process[0].workflowInstanceID,
|
||||
workflowName: process[0].workflowName
|
||||
}
|
||||
|
||||
this.fulltask = fulltak;
|
||||
console.log('FULLTAK OFFLINE', this.fulltask);
|
||||
|
||||
if (process[0].workflowDisplayName == 'Pedido de Parecer' || process[0].workflowDisplayName == 'Pedido de Parecer do Presidente') {
|
||||
let date = new Date(process[0].taskStartDate);
|
||||
date.setMonth(date.getMonth() + 1);
|
||||
let taskDate = date.getFullYear() + "-" + date.getMonth() + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
|
||||
|
||||
this.task = {
|
||||
"SerialNumber": process[0].serialNumber,
|
||||
"Folio": JSON.parse(process[0].workflowInstanceDataFields).Subject,
|
||||
"Senders": JSON.parse(process[0].workflowInstanceDataFields).Sender,
|
||||
"CreateDate": taskDate,
|
||||
"DocumentURL": JSON.parse(process[0].workflowInstanceDataFields).ViewerRequest,
|
||||
"Remetente": JSON.parse(process[0].workflowInstanceDataFields).Sender,
|
||||
"Note": JSON.parse(process[0].workflowInstanceDataFields).TaskMessage,
|
||||
"FolderId": JSON.parse(process[0].workflowInstanceDataFields).FolderID,
|
||||
"FsId": '361',
|
||||
"DocId": JSON.parse(process[0].workflowInstanceDataFields).DocIdDeferimento,
|
||||
"WorkflowName": process[0].workflowDisplayName,
|
||||
"DeadlineType": JSON.parse(process[0].workflowInstanceDataFields).DeadlineType,
|
||||
"ProcessInstanceID": JSON.parse(process[0].workflowInstanceDataFields).InstanceID,
|
||||
"activityInstanceName": process[0].activityInstanceName,
|
||||
"Status": JSON.parse(process[0].workflowInstanceDataFields).Status,
|
||||
}
|
||||
|
||||
this.fulltask = fulltak;
|
||||
console.log('FULLTAK OFFLINE', this.fulltask);
|
||||
this.attachments = JSON.parse(process[0].Documents);
|
||||
} else if (process[0].workflowDisplayName == 'Pedido de Deferimento') {
|
||||
|
||||
if (process[0].workflowDisplayName == 'Pedido de Parecer' || process[0].workflowDisplayName == 'Pedido de Parecer do Presidente') {
|
||||
let date = new Date(process[0].taskStartDate);
|
||||
date.setMonth(date.getMonth() + 1);
|
||||
let taskDate = date.getFullYear() + "-" + date.getMonth() + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
|
||||
|
||||
this.task = {
|
||||
"SerialNumber": process[0].serialNumber,
|
||||
"Folio": JSON.parse(process[0].workflowInstanceDataFields).Subject,
|
||||
"Senders": JSON.parse(process[0].workflowInstanceDataFields).Sender,
|
||||
"CreateDate": taskDate,
|
||||
"DocumentURL": JSON.parse(process[0].workflowInstanceDataFields).ViewerRequest,
|
||||
"Remetente": JSON.parse(process[0].workflowInstanceDataFields).Sender,
|
||||
"Note": JSON.parse(process[0].workflowInstanceDataFields).TaskMessage,
|
||||
"FolderId": JSON.parse(process[0].workflowInstanceDataFields).FolderID,
|
||||
"FsId": '361',
|
||||
"DocId": JSON.parse(process[0].workflowInstanceDataFields).DocIdDeferimento,
|
||||
"WorkflowName": process[0].workflowDisplayName,
|
||||
"DeadlineType": JSON.parse(process[0].workflowInstanceDataFields).DeadlineType,
|
||||
"ProcessInstanceID": JSON.parse(process[0].workflowInstanceDataFields).InstanceID,
|
||||
"activityInstanceName": process[0].activityInstanceName,
|
||||
"Status": JSON.parse(process[0].workflowInstanceDataFields).Status,
|
||||
}
|
||||
|
||||
this.attachments = JSON.parse(process[0].Documents);
|
||||
} else if (process[0].workflowDisplayName == 'Pedido de Deferimento') {
|
||||
|
||||
let date = new Date(process[0].taskStartDate);
|
||||
date.setMonth(date.getMonth() + 1);
|
||||
let taskDate = date.getFullYear() + "-" + date.getMonth() + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
|
||||
this.task = {
|
||||
"SerialNumber": process[0].serialNumber,
|
||||
"Folio": JSON.parse(process[0].workflowInstanceDataFields).Subject,
|
||||
"Senders": JSON.parse(process[0].workflowInstanceDataFields).Sender,
|
||||
"CreateDate": taskDate,
|
||||
"DocumentURL": JSON.parse(process[0].workflowInstanceDataFields).ViewerRequest,
|
||||
"Remetente": JSON.parse(process[0].workflowInstanceDataFields).Sender,
|
||||
"Note": JSON.parse(process[0].workflowInstanceDataFields).TaskMessage,
|
||||
"FolderId": JSON.parse(process[0].workflowInstanceDataFields).FolderID,
|
||||
"FsId": '361',
|
||||
"DocId": JSON.parse(process[0].workflowInstanceDataFields).DocIdDeferimento,
|
||||
"WorkflowName": process[0].workflowDisplayName,
|
||||
"DeadlineType": JSON.parse(process[0].workflowInstanceDataFields).DeadlineType,
|
||||
"ProcessInstanceID": JSON.parse(process[0].workflowInstanceDataFields).InstanceID,
|
||||
"activityInstanceName": process[0].activityInstanceName,
|
||||
"Status": JSON.parse(process[0].workflowInstanceDataFields).Status,
|
||||
}
|
||||
this.attachments = JSON.parse(process[0].Documents);
|
||||
let date = new Date(process[0].taskStartDate);
|
||||
date.setMonth(date.getMonth() + 1);
|
||||
let taskDate = date.getFullYear() + "-" + date.getMonth() + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
|
||||
this.task = {
|
||||
"SerialNumber": process[0].serialNumber,
|
||||
"Folio": JSON.parse(process[0].workflowInstanceDataFields).Subject,
|
||||
"Senders": JSON.parse(process[0].workflowInstanceDataFields).Sender,
|
||||
"CreateDate": taskDate,
|
||||
"DocumentURL": JSON.parse(process[0].workflowInstanceDataFields).ViewerRequest,
|
||||
"Remetente": JSON.parse(process[0].workflowInstanceDataFields).Sender,
|
||||
"Note": JSON.parse(process[0].workflowInstanceDataFields).TaskMessage,
|
||||
"FolderId": JSON.parse(process[0].workflowInstanceDataFields).FolderID,
|
||||
"FsId": '361',
|
||||
"DocId": JSON.parse(process[0].workflowInstanceDataFields).DocIdDeferimento,
|
||||
"WorkflowName": process[0].workflowDisplayName,
|
||||
"DeadlineType": JSON.parse(process[0].workflowInstanceDataFields).DeadlineType,
|
||||
"ProcessInstanceID": JSON.parse(process[0].workflowInstanceDataFields).InstanceID,
|
||||
"activityInstanceName": process[0].activityInstanceName,
|
||||
"Status": JSON.parse(process[0].workflowInstanceDataFields).Status,
|
||||
}
|
||||
this.attachments = JSON.parse(process[0].Documents);
|
||||
}
|
||||
|
||||
let thedate = new Date(process[0].taskStartDate);
|
||||
this.customDate = this.days[thedate.getDay()] + ", " + thedate.getDate() + " de " + (this.months[thedate.getMonth()]);
|
||||
let thedate = new Date(process[0].taskStartDate);
|
||||
this.customDate = this.days[thedate.getDay()] + ", " + thedate.getDate() + " de " + (this.months[thedate.getMonth()]);
|
||||
|
||||
this.intervenientes = JSON.parse(process[0].interveners).filter(user => {
|
||||
return user.Type == 'I';
|
||||
});
|
||||
this.cc = JSON.parse(process[0].interveners).filter(user => {
|
||||
return user.Type == 'CC';
|
||||
});
|
||||
this.getDocumentDetails(JSON.parse(process[0].workflowInstanceDataFields).FolderID, '361');
|
||||
this.intervenientes = JSON.parse(process[0].interveners).filter(user => {
|
||||
return user.Type == 'I';
|
||||
});
|
||||
this.cc = JSON.parse(process[0].interveners).filter(user => {
|
||||
return user.Type == 'CC';
|
||||
});
|
||||
this.getDocumentDetails(JSON.parse(process[0].workflowInstanceDataFields).FolderID, '361');
|
||||
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
getDocumentDetails(forlderId: string, applicationId: string) {
|
||||
@@ -284,7 +282,7 @@ export class PedidoPage implements OnInit {
|
||||
})
|
||||
}
|
||||
|
||||
async viewDocument(DocId:string, Document) {
|
||||
async viewDocument(DocId: string, Document) {
|
||||
|
||||
const modal = await this.modalController.create({
|
||||
component: ViewDocumentPage,
|
||||
@@ -329,7 +327,7 @@ export class PedidoPage implements OnInit {
|
||||
|
||||
popover.onDidDismiss().then((res => {
|
||||
|
||||
if( res['data'] == 'close') {
|
||||
if (res['data'] == 'close') {
|
||||
this.goBack()
|
||||
}
|
||||
|
||||
@@ -478,7 +476,7 @@ export class PedidoPage implements OnInit {
|
||||
// });
|
||||
// }
|
||||
|
||||
async distartExpedientModal(){
|
||||
async distartExpedientModal() {
|
||||
console.log(this.fulltask);
|
||||
const modal = await this.modalController.create({
|
||||
component: DiscartExpedientModalPage,
|
||||
|
||||
@@ -9,7 +9,7 @@ import { PedidosStore } from 'src/app/store/pedidos-store.service';
|
||||
import { ModalService } from 'src/app/services/modal.service';
|
||||
|
||||
import { SqliteService } from 'src/app/services/sqlite.service';
|
||||
import { synchro } from 'src/app/services/socket/synchro.service';
|
||||
import { BackgroundService } from 'src/app/services/background.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-pedidos',
|
||||
@@ -18,40 +18,41 @@ import { synchro } from 'src/app/services/socket/synchro.service';
|
||||
})
|
||||
export class PedidosPage implements OnInit {
|
||||
|
||||
@ViewChild(CalendarComponent) myCal: CalendarComponent;
|
||||
@ViewChild(CalendarComponent) myCal: CalendarComponent;
|
||||
|
||||
taskslist:DailyWorkTask[] = [];
|
||||
parecerList:any[] = [];
|
||||
listToPresentparecerList: any[] = [];
|
||||
listToPresentdeferimentoList: any[] = [];
|
||||
fulltask:any;
|
||||
taskslist: DailyWorkTask[] = [];
|
||||
parecerList: any[] = [];
|
||||
listToPresentparecerList: any[] = [];
|
||||
listToPresentdeferimentoList: any[] = [];
|
||||
fulltask: any;
|
||||
|
||||
parecerListResult:customTask[] = [];
|
||||
deferimentoListResult:customTask[] = [];
|
||||
parecerListResult: customTask[] = [];
|
||||
deferimentoListResult: customTask[] = [];
|
||||
|
||||
deferimentoList:any[] = [];
|
||||
taskType: string;
|
||||
serialNumber:string;
|
||||
skeletonLoader = true
|
||||
pedidosstorage = PedidosStore;
|
||||
deferimentoList: any[] = [];
|
||||
taskType: string;
|
||||
serialNumber: string;
|
||||
skeletonLoader = true
|
||||
pedidosstorage = PedidosStore;
|
||||
|
||||
segment:string;
|
||||
@Output() openExpedientDetail:EventEmitter<any> = new EventEmitter<any>();
|
||||
segment: string;
|
||||
@Output() openExpedientDetail: EventEmitter<any> = new EventEmitter<any>();
|
||||
|
||||
constructor(
|
||||
constructor(
|
||||
private router: Router,
|
||||
private processes:ProcessesService,
|
||||
private processes: ProcessesService,
|
||||
private modalController: ModalController,
|
||||
private alertService: AlertService,
|
||||
private activatedRoute: ActivatedRoute,
|
||||
private modalService: ModalService,
|
||||
private sqliteservice: SqliteService
|
||||
) {
|
||||
//Inicializar segment
|
||||
private sqliteservice: SqliteService,
|
||||
private backgroundservice: BackgroundService
|
||||
) {
|
||||
//Inicializar segment
|
||||
this.segment = 'parecer';
|
||||
|
||||
this.activatedRoute.queryParams.subscribe(params => {
|
||||
if(params['deferimento'] == 'true') {
|
||||
if (params['deferimento'] == 'true') {
|
||||
this.segment = 'deferimento';
|
||||
} else if (params['parecer'] == 'true') {
|
||||
this.segment = 'parecer';
|
||||
@@ -59,12 +60,30 @@ export class PedidosPage implements OnInit {
|
||||
});
|
||||
|
||||
|
||||
const modal = this.modalService.BookMeetingModalPage({task: ''},{})
|
||||
const modal = this.modalService.BookMeetingModalPage({ task: '' }, {})
|
||||
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.getFromDb();
|
||||
|
||||
this.LoadList()
|
||||
|
||||
this.router.events.forEach((event) => {
|
||||
if(event instanceof NavigationStart && '/home/gabinete-digital/pedidos?parecer=true'.startsWith(event.url) ||
|
||||
event instanceof NavigationStart && '/home/gabinete-digital/pedidos?deferimento=true'.startsWith(event.url)
|
||||
) {
|
||||
|
||||
if(window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) {
|
||||
this.refreshing()
|
||||
} else {
|
||||
this.LoadList()
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.backgroundservice.registerBackService('Online', () => {
|
||||
this.getFromDb();
|
||||
});
|
||||
}
|
||||
|
||||
goBack() {
|
||||
@@ -86,8 +105,8 @@ export class PedidosPage implements OnInit {
|
||||
// this.LoadList();
|
||||
} */
|
||||
|
||||
goToPedido(serialNumber:any) {
|
||||
this.router.navigate(['/home/gabinete-digital/pedidos',serialNumber,'gabinete-digital']);
|
||||
goToPedido(serialNumber: any) {
|
||||
this.router.navigate(['/home/gabinete-digital/pedidos', serialNumber, 'gabinete-digital']);
|
||||
}
|
||||
|
||||
notImplemented() {
|
||||
@@ -100,27 +119,30 @@ export class PedidosPage implements OnInit {
|
||||
}
|
||||
|
||||
async LoadList() {
|
||||
this.skeletonLoader = true
|
||||
|
||||
if(this.segment == 'parecer') {
|
||||
this.taskType = "Pedido de Parecer";
|
||||
this.processes.GetTasksList("Pedido de Parecer", false).subscribe(async res => {
|
||||
|
||||
let parecer = await this.processes.GetTasksList("Pedido de Parecer", false).toPromise();
|
||||
let parecerPr = await this.processes.GetTasksList("Pedido de Parecer do Presidente", false).toPromise();
|
||||
this.skeletonLoader = true
|
||||
|
||||
this.skeletonLoader = false
|
||||
|
||||
let allParecer = parecer.concat(parecerPr).reverse().filter(data => data.workflowInstanceDataFields.Status == "Active")
|
||||
|
||||
this.parecerList =[];
|
||||
|
||||
allParecer.filter(data => data.workflowInstanceDataFields.Status == "Active").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 task = {
|
||||
if (this.segment == 'parecer') {
|
||||
this.taskType = "Pedido de Parecer";
|
||||
|
||||
let parecer = await this.processes.GetTasksList("Pedido de Parecer", false).toPromise();
|
||||
let parecerPr = await this.processes.GetTasksList("Pedido de Parecer do Presidente", false).toPromise();
|
||||
|
||||
this.skeletonLoader = false
|
||||
|
||||
let allParecer = parecer.concat(parecerPr).reverse().filter(data => data.workflowInstanceDataFields.Status == "Active")
|
||||
|
||||
this.parecerList = [];
|
||||
|
||||
allParecer.filter(data => data.workflowInstanceDataFields.Status == "Active").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 task = {
|
||||
"SerialNumber": element.serialNumber,
|
||||
"Folio": element.workflowInstanceDataFields.Subject,
|
||||
"Senders": element.workflowInstanceDataFields.Sender,
|
||||
@@ -131,32 +153,32 @@ export class PedidosPage implements OnInit {
|
||||
"DocId": element.workflowInstanceDataFields.DocIdDiferimento,
|
||||
"WorkflowName": element.workflowDisplayName,
|
||||
"activityInstanceName": element.activityInstanceName,
|
||||
}
|
||||
this.parecerList.push(task);
|
||||
});
|
||||
this.sqliteservice.addProcess(this.parecerList);
|
||||
this.listToPresentparecerList = this.parecerList
|
||||
|
||||
}
|
||||
else if(this.segment == 'deferimento') {
|
||||
this.taskType = "Pedido de Deferimento";
|
||||
this.processes.GetTasksList("Pedido de Deferimento", false).subscribe(result => {
|
||||
|
||||
this.skeletonLoader = false
|
||||
|
||||
console.log(result);
|
||||
|
||||
this.deferimentoList = [];
|
||||
|
||||
let res = result.filter(data => data.workflowInstanceDataFields.Status == "Active")
|
||||
res = res.reverse()
|
||||
|
||||
res.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 task = {
|
||||
}
|
||||
this.parecerList.push(task);
|
||||
});
|
||||
this.sqliteservice.addProcess(this.parecerList);
|
||||
this.listToPresentparecerList = this.parecerList
|
||||
|
||||
}
|
||||
else if (this.segment == 'deferimento') {
|
||||
this.taskType = "Pedido de Deferimento";
|
||||
this.processes.GetTasksList("Pedido de Deferimento", false).subscribe(result => {
|
||||
|
||||
this.skeletonLoader = false
|
||||
|
||||
console.log(result);
|
||||
|
||||
this.deferimentoList = [];
|
||||
|
||||
let res = result.filter(data => data.workflowInstanceDataFields.Status == "Active")
|
||||
res = res.reverse()
|
||||
|
||||
res.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 task = {
|
||||
"SerialNumber": element.serialNumber,
|
||||
"Folio": element.workflowInstanceDataFields.Subject,
|
||||
"Senders": element.workflowInstanceDataFields.Sender,
|
||||
@@ -167,98 +189,83 @@ export class PedidosPage implements OnInit {
|
||||
"DocId": element.workflowInstanceDataFields.DocIdDiferimento,
|
||||
"WorkflowName": element.workflowDisplayName,
|
||||
"activityInstanceName": element.activityInstanceName,
|
||||
}
|
||||
|
||||
if(element.workflowInstanceDataFields.Status == "Active") {
|
||||
this.deferimentoList.push(task);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (element.workflowInstanceDataFields.Status == "Active") {
|
||||
this.deferimentoList.push(task);
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
this.sqliteservice.addProcess(this.deferimentoList);
|
||||
this.listToPresentdeferimentoList = this.deferimentoList
|
||||
|
||||
|
||||
});
|
||||
this.sqliteservice.addProcess(this.deferimentoList);
|
||||
this.listToPresentdeferimentoList = this.deferimentoList
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}, (error) => {
|
||||
this.getFromDb()
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
getFromDb() {
|
||||
if(synchro.connected === true) {
|
||||
this.LoadList()
|
||||
|
||||
this.router.events.forEach((event) => {
|
||||
if(event instanceof NavigationStart && '/home/gabinete-digital/pedidos?parecer=true'.startsWith(event.url) ||
|
||||
event instanceof NavigationStart && '/home/gabinete-digital/pedidos?deferimento=true'.startsWith(event.url)
|
||||
) {
|
||||
|
||||
if(window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) {
|
||||
this.refreshing()
|
||||
} else {
|
||||
this.LoadList()
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if(synchro.connected === false) {
|
||||
let parecerlist = [];
|
||||
let deferimentolist = []
|
||||
this.sqliteservice.getprocessByworkflowpedido("Pedido de Parecer", "Pedido de Parecer do Presidente").then((process: any[]) => {
|
||||
|
||||
process.forEach((element) => {
|
||||
if(JSON.parse(element.workflowInstanceDataFields).Status == "Active") {
|
||||
let date = new Date(element.taskStartDate);
|
||||
let parecerlist = [];
|
||||
let deferimentolist = []
|
||||
this.sqliteservice.getprocessByworkflowpedido("Pedido de Parecer", "Pedido de Parecer do Presidente").then((process: any[]) => {
|
||||
|
||||
process.forEach((element) => {
|
||||
if (JSON.parse(element.workflowInstanceDataFields).Status == "Active") {
|
||||
let date = new Date(element.taskStartDate);
|
||||
date.setMonth(date.getMonth() + 1);
|
||||
let taskDate = date.getFullYear()+"-"+ date.getMonth()+"-"+date.getDate()+" "+date.getHours()+":"+date.getMinutes()+ ":"+date.getSeconds();
|
||||
let taskDate = date.getFullYear() + "-" + date.getMonth() + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
|
||||
|
||||
let task = {
|
||||
"SerialNumber": element.serialNumber,
|
||||
"Folio": JSON.parse(element.workflowInstanceDataFields).Subject,
|
||||
"Senders": JSON.parse(element.workflowInstanceDataFields).Sender,
|
||||
"CreateDate": taskDate,
|
||||
"DocumentURL": JSON.parse(element.workflowInstanceDataFields).ViewerRequest,
|
||||
"Remetente": JSON.parse(element.workflowInstanceDataFields).Remetente,
|
||||
"DocumentsQty": element.totalDocuments,
|
||||
"DocId": JSON.parse(element.workflowInstanceDataFields).DocIdDiferimento,
|
||||
"WorkflowName": element.workflowDisplayName,
|
||||
"activityInstanceName": element.activityInstanceName,
|
||||
let task = {
|
||||
"SerialNumber": element.serialNumber,
|
||||
"Folio": JSON.parse(element.workflowInstanceDataFields).Subject,
|
||||
"Senders": JSON.parse(element.workflowInstanceDataFields).Sender,
|
||||
"CreateDate": taskDate,
|
||||
"DocumentURL": JSON.parse(element.workflowInstanceDataFields).ViewerRequest,
|
||||
"Remetente": JSON.parse(element.workflowInstanceDataFields).Remetente,
|
||||
"DocumentsQty": element.totalDocuments,
|
||||
"DocId": JSON.parse(element.workflowInstanceDataFields).DocIdDiferimento,
|
||||
"WorkflowName": element.workflowDisplayName,
|
||||
"activityInstanceName": element.activityInstanceName,
|
||||
}
|
||||
parecerlist.push(task)
|
||||
}
|
||||
})
|
||||
this.listToPresentparecerList = parecerlist;
|
||||
console.log('parecer',process)
|
||||
parecerlist.push(task)
|
||||
}
|
||||
})
|
||||
this.listToPresentparecerList = parecerlist;
|
||||
console.log('parecer', process)
|
||||
})
|
||||
|
||||
this.sqliteservice.getprocessByworkflow("Pedido de Deferimento").then((process: any[]) => {
|
||||
process.forEach((element) => {
|
||||
if(JSON.parse(element.workflowInstanceDataFields).Status == "Active") {
|
||||
let date = new Date(element.taskStartDate);
|
||||
date.setMonth(date.getMonth() + 1);
|
||||
let taskDate = date.getFullYear()+"-"+ date.getMonth()+"-"+date.getDate()+" "+date.getHours()+":"+date.getMinutes()+ ":"+date.getSeconds();
|
||||
|
||||
let task = {
|
||||
"SerialNumber": element.serialNumber,
|
||||
"Folio": JSON.parse(element.workflowInstanceDataFields).Subject,
|
||||
"Senders": JSON.parse(element.workflowInstanceDataFields).Sender,
|
||||
"CreateDate": taskDate,
|
||||
"DocumentURL": JSON.parse(element.workflowInstanceDataFields).ViewerRequest,
|
||||
"Remetente": JSON.parse(element.workflowInstanceDataFields).Remetente,
|
||||
"DocumentsQty": element.totalDocuments,
|
||||
"DocId": JSON.parse(element.workflowInstanceDataFields).DocIdDiferimento,
|
||||
"WorkflowName": element.workflowDisplayName,
|
||||
"activityInstanceName": element.activityInstanceName,
|
||||
}
|
||||
deferimentolist.push(task)
|
||||
this.sqliteservice.getprocessByworkflow("Pedido de Deferimento").then((process: any[]) => {
|
||||
process.forEach((element) => {
|
||||
if (JSON.parse(element.workflowInstanceDataFields).Status == "Active") {
|
||||
let date = new Date(element.taskStartDate);
|
||||
date.setMonth(date.getMonth() + 1);
|
||||
let taskDate = date.getFullYear() + "-" + date.getMonth() + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
|
||||
|
||||
let task = {
|
||||
"SerialNumber": element.serialNumber,
|
||||
"Folio": JSON.parse(element.workflowInstanceDataFields).Subject,
|
||||
"Senders": JSON.parse(element.workflowInstanceDataFields).Sender,
|
||||
"CreateDate": taskDate,
|
||||
"DocumentURL": JSON.parse(element.workflowInstanceDataFields).ViewerRequest,
|
||||
"Remetente": JSON.parse(element.workflowInstanceDataFields).Remetente,
|
||||
"DocumentsQty": element.totalDocuments,
|
||||
"DocId": JSON.parse(element.workflowInstanceDataFields).DocIdDiferimento,
|
||||
"WorkflowName": element.workflowDisplayName,
|
||||
"activityInstanceName": element.activityInstanceName,
|
||||
}
|
||||
})
|
||||
this.listToPresentdeferimentoList = deferimentolist;
|
||||
console.log('deferimento',process)
|
||||
deferimentolist.push(task)
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
this.listToPresentdeferimentoList = deferimentolist;
|
||||
console.log('deferimento', process)
|
||||
})
|
||||
}
|
||||
|
||||
segmentChanged(ev: any) {
|
||||
|
||||
@@ -11,7 +11,7 @@ import { AuthService } from 'src/app/services/auth.service';
|
||||
import { CustomTaskPipe } from 'src/app/pipes/custom-task.pipe';
|
||||
|
||||
import { SqliteService } from 'src/app/services/sqlite.service';
|
||||
import { synchro } from 'src/app/services/socket/synchro.service';
|
||||
import { BackgroundService } from 'src/app/services/background.service';
|
||||
import { Platform } from '@ionic/angular';
|
||||
|
||||
|
||||
@@ -36,8 +36,6 @@ export class PendentesPage implements OnInit {
|
||||
customTaskPipe = new CustomTaskPipe()
|
||||
listToPresent = [];
|
||||
|
||||
synch = synchro
|
||||
|
||||
constructor(
|
||||
private processes: ProcessesService,
|
||||
private alertService: AlertService,
|
||||
@@ -45,7 +43,8 @@ export class PendentesPage implements OnInit {
|
||||
private authService: AuthService,
|
||||
private activatedRoute: ActivatedRoute,
|
||||
private sqliteservice: SqliteService,
|
||||
private platform: Platform
|
||||
private platform: Platform,
|
||||
private backgroundservices: BackgroundService
|
||||
) {
|
||||
this.loggeduser = authService.ValidatedUser;
|
||||
this.profile = 'mdgpr';
|
||||
@@ -54,7 +53,24 @@ export class PendentesPage implements OnInit {
|
||||
ngOnInit() {
|
||||
//Inicializar segment
|
||||
this.segment = "despachos";
|
||||
this.getFromDb();
|
||||
const location = window.location
|
||||
const pathname = location.pathname + location.search
|
||||
|
||||
this.LoadList()
|
||||
|
||||
this.router.events.forEach((event) => {
|
||||
if (event instanceof NavigationEnd && event.url.startsWith(pathname)) {
|
||||
if (window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) {
|
||||
this.refreshing()
|
||||
} else {
|
||||
this.LoadList()
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.backgroundservices.registerBackService('Online', () => {
|
||||
this.LoadList();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@@ -72,20 +88,25 @@ export class PendentesPage implements OnInit {
|
||||
|
||||
async LoadList() {
|
||||
|
||||
this.skeletonLoader = true;
|
||||
this.processes.GetPendingTasks(false).subscribe(async res => {
|
||||
this.skeletonLoader = true;
|
||||
|
||||
let pendentes = await this.processes.GetPendingTasks(false).toPromise();
|
||||
let pendentesList = [];
|
||||
let pendentes = await this.processes.GetPendingTasks(false).toPromise();
|
||||
let pendentesList = [];
|
||||
|
||||
pendentes.forEach(element => {
|
||||
let task: customTask = this.customTaskPipe.transform(element);
|
||||
pendentesList.push(task);
|
||||
});
|
||||
pendentes.forEach(element => {
|
||||
let task: customTask = this.customTaskPipe.transform(element);
|
||||
pendentesList.push(task);
|
||||
});
|
||||
|
||||
pendentesList = removeDuplicate(pendentesList)
|
||||
pendentesList = this.sortArrayISODate(pendentesList);
|
||||
this.listToPresent = pendentesList;
|
||||
this.skeletonLoader = false;
|
||||
pendentesList = removeDuplicate(pendentesList)
|
||||
pendentesList = this.sortArrayISODate(pendentesList);
|
||||
this.listToPresent = pendentesList;
|
||||
this.skeletonLoader = false;
|
||||
|
||||
}, (error) => {
|
||||
this.getFromDb();
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
@@ -97,50 +118,31 @@ export class PendentesPage implements OnInit {
|
||||
|
||||
getFromDb() {
|
||||
|
||||
if (synchro.connected === true) {
|
||||
const location = window.location
|
||||
const pathname = location.pathname + location.search
|
||||
this.platform.ready().then(() => {
|
||||
this.sqliteservice.getAllProcess().then((process: any[]) => {
|
||||
var pendingList = []
|
||||
process.forEach(element => {
|
||||
var workflow = JSON.parse(element.workflowInstanceDataFields);
|
||||
if (workflow.Status === "Pending") {
|
||||
let task = {
|
||||
"CreateDate": element.taskStartDate,
|
||||
"DocumentsQty": element.totalDocuments,
|
||||
"FolderID": workflow.FolderID,
|
||||
"Folio": workflow.Subject,
|
||||
"Senders": workflow.Sender,
|
||||
"SerialNumber": element.serialNumber,
|
||||
"Status": workflow.Status,
|
||||
"WorkflowName": element.workflowDisplayName
|
||||
|
||||
this.LoadList()
|
||||
|
||||
this.router.events.forEach((event) => {
|
||||
if (event instanceof NavigationEnd && event.url.startsWith(pathname)) {
|
||||
if (window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) {
|
||||
this.refreshing()
|
||||
} else {
|
||||
this.LoadList()
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
synchro.registerCallback('Offline', () => {
|
||||
this.platform.ready().then(() => {
|
||||
this.sqliteservice.getAllProcess().then((process: any[]) => {
|
||||
var pendingList = []
|
||||
process.forEach(element => {
|
||||
var workflow = JSON.parse(element.workflowInstanceDataFields);
|
||||
if (workflow.Status === "Pending") {
|
||||
let task = {
|
||||
"CreateDate": element.taskStartDate,
|
||||
"DocumentsQty": element.totalDocuments,
|
||||
"FolderID": workflow.FolderID,
|
||||
"Folio": workflow.Subject,
|
||||
"Senders": workflow.Sender,
|
||||
"SerialNumber": element.serialNumber,
|
||||
"Status": workflow.Status,
|
||||
"WorkflowName": element.workflowDisplayName
|
||||
|
||||
}
|
||||
pendingList.push(task)
|
||||
}
|
||||
});
|
||||
|
||||
pendingList = this.sortArrayISODate(pendingList);
|
||||
this.listToPresent = pendingList;
|
||||
console.log('pendentes', pendingList)
|
||||
|
||||
})
|
||||
pendingList.push(task)
|
||||
}
|
||||
});
|
||||
|
||||
pendingList = this.sortArrayISODate(pendingList);
|
||||
this.listToPresent = pendingList;
|
||||
console.log('pendentes', pendingList)
|
||||
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
@@ -5,6 +5,12 @@ import { Injectable } from '@angular/core';
|
||||
})
|
||||
export class BackgroundService {
|
||||
|
||||
callBacks: {
|
||||
type: 'Offline' | 'Online',
|
||||
object?: string
|
||||
funx: Function
|
||||
}[] = []
|
||||
|
||||
constructor() { }
|
||||
|
||||
online() {
|
||||
@@ -13,6 +19,11 @@ export class BackgroundService {
|
||||
document.body.style.setProperty(`--color3`, "#0782C9");
|
||||
document.body.style.setProperty(`--color4`, "#0782c9f0");
|
||||
document.body.style.setProperty(`--color5`, "#45BAFF");
|
||||
this.callBacks.forEach((e) => {
|
||||
if (e.type == 'Online') {
|
||||
e.funx()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
offline() {
|
||||
@@ -21,5 +32,18 @@ export class BackgroundService {
|
||||
document.body.style.setProperty(`--color3`, "#ffb703");
|
||||
document.body.style.setProperty(`--color4`, "#ffb703");
|
||||
document.body.style.setProperty(`--color5`, "#ffb703");
|
||||
this.callBacks.forEach((e) => {
|
||||
if (e.type == 'Offline') {
|
||||
e.funx()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
registerBackService(type: 'Offline' | 'Online', funx: Function, object = '') {
|
||||
this.callBacks.push({
|
||||
type,
|
||||
funx,
|
||||
object
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ class SynchroService {
|
||||
|
||||
|
||||
//if (this._connected === true) {
|
||||
this.BackgroundService.online()
|
||||
//this.BackgroundService.online()
|
||||
console.log('Online', this._connected)
|
||||
this.callBacks.forEach((e) => {
|
||||
if (e.type == 'Online') {
|
||||
@@ -183,7 +183,7 @@ class SynchroService {
|
||||
|
||||
|
||||
// if (this._connected === false) {
|
||||
this.BackgroundService.offline();
|
||||
// this.BackgroundService.offline();
|
||||
console.log('Offline', this._connected)
|
||||
this.callBacks.forEach((e) => {
|
||||
if (e.type == 'Offline') {
|
||||
|
||||
Reference in New Issue
Block a user