Merge branch 'feature/chatStorage' of https://bitbucket.org/equilibriumito/gabinete-digital into developer

This commit is contained in:
Eudes Inácio
2022-02-01 10:27:36 +01:00
23 changed files with 688 additions and 353 deletions
+27
View File
@@ -3079,6 +3079,13 @@
"integrity": "sha512-Xeabtfjw/OCa8tZUh3yVqomVNMztwmg0hXYrcX18r3+Zq0XYRSgNtsBHrye1rBgNkXYqblWQHZQErwrAC2UNxQ==",
"requires": {
"@types/cordova": "^0.0.34"
},
"dependencies": {
"@types/cordova": {
"version": "0.0.34",
"resolved": "https://registry.npmjs.org/@types/cordova/-/cordova-0.0.34.tgz",
"integrity": "sha1-6nrd907Ow9dimCegw54smt3HPQQ="
}
}
},
"@ionic-native/local-notifications": {
@@ -11805,6 +11812,26 @@
"resolved": "https://registry.npmjs.org/ionic-angular/-/ionic-angular-3.9.10.tgz",
"integrity": "sha512-4nmGrdpu4Zy3SZwF0AaS/3gDrbFGU1dV+zn1eqInFgFj9q20N1cIITgvyIcoxUI/IoqYiohsJX1rGY5vB/HrhQ=="
},
"ionic-image-loader": {
"version": "6.3.3",
"resolved": "https://registry.npmjs.org/ionic-image-loader/-/ionic-image-loader-6.3.3.tgz",
"integrity": "sha512-X7AbaY3Yt3q0+kOjodjqYwTkXNhRTs3/P/afffaWLBPk5frsd7JCNaFae9U8iErwfOIbJ7VZmCHYMApBZ3Aqew=="
},
"ionic-image-loader-v5": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/ionic-image-loader-v5/-/ionic-image-loader-v5-1.0.2.tgz",
"integrity": "sha512-SsFRVjA4p6nloF+xljMctj3Uc1a74rG7HA4nDQ3zJNZgLa8S/6GqR9fr8qDb7/L3441i4ICrdQSKyfAkddbELQ==",
"requires": {
"tslib": "^1.9.0"
},
"dependencies": {
"tslib": {
"version": "1.14.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",
"integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg=="
}
}
},
"ionic-selectable": {
"version": "4.9.0",
"resolved": "https://registry.npmjs.org/ionic-selectable/-/ionic-selectable-4.9.0.tgz",
+3 -1
View File
@@ -66,7 +66,7 @@
"@ionic-native/http": "^5.31.1",
"@ionic-native/image-picker": "^5.36.0",
"@ionic-native/in-app-browser": "^5.28.0",
"@ionic-native/ionic-webview": "^5.35.0",
"@ionic-native/ionic-webview": "^5.36.0",
"@ionic-native/local-notifications": "^4.20.0",
"@ionic-native/media": "^5.36.0",
"@ionic-native/media-capture": "^5.36.0",
@@ -120,6 +120,8 @@
"hammerjs": "^2.0.8",
"http-server": "^0.12.3",
"ionic-angular": "^3.9.10",
"ionic-image-loader": "^6.3.3",
"ionic-image-loader-v5": "^1.0.2",
"ionic-selectable": "^4.7.1",
"ionic2-alpha-scroll": "^2.0.1",
"ionic2-calendar": "^0.6.6",
+4
View File
@@ -67,6 +67,7 @@ import { StreamingMedia } from '@ionic-native/streaming-media/ngx';
import { PhotoViewer } from '@ionic-native/photo-viewer/ngx';
import {NgxImageCompressService} from 'ngx-image-compress';
import { CustomImageCachePageRoutingModule } from './services/file/custom-image-cache/custom-image-cache-routing.module';
import { IonicImageLoaderComponent, IonicImageLoaderModule } from 'ionic-image-loader-v5';
/* import { FCM } from '@ionic-native/fcm/ngx';
import { FirebaseX } from '@ionic-native/firebase-x/ngx'; */
@@ -82,10 +83,13 @@ import { FirebaseX } from '@ionic-native/firebase-x/ngx'; */
provide: DateAdapter,
useFactory: adapterFactory
}),
IonicImageLoaderModule,
IonicModule.forRoot({animated: false}),
IonicStorageModule.forRoot({
name: '__mydb',
driverOrder: ['indexeddb', 'sqlite', 'websql']
}),
AppRoutingModule,
+53 -16
View File
@@ -9,6 +9,7 @@ import { momentG } from 'src/plugin/momentG';
import { DomSanitizer } from "@angular/platform-browser";
import { EventPerson } from 'src/app/models/eventperson.model';
import { removeDuplicate } from 'src/plugin/removeDuplicate.js';
import { Storage } from '@ionic/storage';
// showTimeline
import { setHours, setMinutes } from 'date-fns';
@@ -179,7 +180,8 @@ export class AgendaPage implements OnInit {
private sqliteservice: SqliteService,
private platform: Platform,
private backgroundservice: BackgroundService,
public ThemeService: ThemeService
public ThemeService: ThemeService,
private storage:Storage
) {
this.dateAdapter.setLocale('es');
@@ -770,6 +772,27 @@ export class AgendaPage implements OnInit {
addEventToDB(response, profile) {
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
let responseArray = [];
response.forEach(element => {
let event = {
CalendarId: element.CalendarId,
CalendarName: element.CalendarName,
EndDate: element.EndDate,
EventId: element.EventId,
HasAttachments: element.HasAttachments,
HumanDate: element.HumanDate,
IsAllDayEvent: element.IsAllDayEvent,
Location: element.Location,
StartDate: element.StartDate,
Subject: element.Subject,
Profile: profile
}
responseArray.push(event)
});
this.storage.set('agendaResponse',responseArray).then(() => {
console.log('Agenda data saved')
})
} else {
if (response.length > 0) {
@@ -796,21 +819,35 @@ export class AgendaPage implements OnInit {
getFromDB() {
console.log('ALL EVENTS FROM DB AGENDA OFFLINE')
this.sqliteservice.getAllEvents().then((events: any[]) => {
console.log('ALL EVENTS FROM DB', events)
let eventArray = [];
this.trasnformDataDB(events)
this.updateEventListBox()
this.myCal.update();
this.myCal.loadEvents();
this.showLoader = false;
this.showTimeline = true;
})
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
this.storage.get('agendaResponse').then((events) => {
this.trasnformDataDB(events)
this.updateEventListBox()
this.myCal.update();
this.myCal.loadEvents();
this.showLoader = false;
this.showTimeline = true;
})
} else {
this.sqliteservice.getAllEvents().then((events: any[]) => {
console.log('ALL EVENTS FROM DB', events)
let eventArray = [];
this.trasnformDataDB(events)
this.updateEventListBox()
this.myCal.update();
this.myCal.loadEvents();
this.showLoader = false;
this.showTimeline = true;
})
}
}
updateEventListBox() {
@@ -21,6 +21,7 @@ import { BackgroundService } from 'src/app/services/background.service';
import { StorageService } from 'src/app/services/storage.service';
import { ThemeService } from 'src/app/services/theme.service'
import { RouteService } from 'src/app/services/route.service';
import { Storage } from '@ionic/storage';
@Component({
@@ -74,6 +75,7 @@ export class ViewEventPage implements OnInit {
private storage: StorageService,
public ThemeService: ThemeService,
private RouteService: RouteService,
private ionicStorage: Storage
) {
this.isEventEdited = false;
this.loadedEvent = new Event();
@@ -394,6 +396,9 @@ export class ViewEventPage implements OnInit {
addEventToDb(data) {
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
this.ionicStorage.set('eventDetails', data).then(() => {
console.log('Details event saved')
})
} else {
let event = {
Attendees: JSON.stringify(data.Attendees) || JSON.stringify(''),
@@ -423,33 +428,40 @@ export class ViewEventPage implements OnInit {
getFromDb() {
const loader = this.toastService.loading();
this.sqliteservice.getEventById(this.eventId).then((event) => {
let arrayevent = [];
console.log('EVENT ATTENDEES',event[0].Attendees)
let elemet = {
Attendees: (typeof JSON.parse(event[0].Attendees) === 'undefined') ? "" : 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)
})
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
this.ionicStorage.get('eventDetails').then((events) =>{
this.loadedEvent = events;
})
} else {
this.sqliteservice.getEventById(this.eventId).then((event) => {
let arrayevent = [];
console.log('EVENT ATTENDEES',event[0].Attendees)
let elemet = {
Attendees: (typeof JSON.parse(event[0].Attendees) === 'undefined') ? "" : 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()
}
}
+26 -1
View File
@@ -21,6 +21,7 @@ import { NetworkConnectionService } from 'src/app/services/network-connection.se
import { BackgroundService } from 'src/app/services/background.service';
import { momentG } from 'src/plugin/momentG';
import { ThemeService } from 'src/app/services/theme.service'
import { Storage } from '@ionic/storage';
@Component({
selector: 'app-events',
templateUrl: './events.page.html',
@@ -95,7 +96,8 @@ export class EventsPage implements OnInit {
private sqliteservice: SqliteService,
private networkconnection: NetworkConnectionService,
private backgroundservice: BackgroundService,
public ThemeService: ThemeService
public ThemeService: ThemeService,
private storage: Storage
) {
/* this.existingScreenOrientation = this.screenOrientation.type;
console.log(this.existingScreenOrientation); */
@@ -317,6 +319,9 @@ export class EventsPage implements OnInit {
addEventToDb(list) {
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
this.storage.set('events', list).then(() => {
console.log('Init events saved')
})
} else {
if (list.length > 0) {
list.forEach(element => {
@@ -359,6 +364,9 @@ export class EventsPage implements OnInit {
addProcessToDb(list) {
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
this.storage.set('process', list).then(() => {
console.log('Init process saved')
})
} else {
if (list.length > 0) {
list.forEach(element => {
@@ -376,6 +384,23 @@ export class EventsPage implements OnInit {
let dateToday = date.getFullYear() + "-" + month + "-" + date.getDate();
console.log('dateeeeee', dateToday)
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
this.storage.get('events').then((events: any[]) => {
console.log('Today events',events)
let todayEvents = new Array()
this.listToPresent = events
this.totalEvent = this.listToPresent.length
this.currentEvent = this.listToPresent[0].Subject
this.currentHoursMinutes = this.listToPresent[0].StartDate
console.log("All events from local,", events)
})
this.storage.get('process').then((process: any[]) => {
console.log('OFOFOFOOF22222', process)
const ExpedienteTask = process.map(e => this.expedienteTaskPipe.transform(e))
this.listToPresentexpediente = ExpedienteTask;
})
this.showLoader = false;
} else {
this.sqliteservice.getAllEvents().then((event: any[]) => {
@@ -19,6 +19,7 @@ import { Platform } from '@ionic/angular';
import { ThemeService } from 'src/app/services/theme.service'
import { OfflineManagerService } from 'src/app/services/offline-manager.service';
import { RouteService } from 'src/app/services/route.service';
import { Storage } from '@ionic/storage';
@Component({
selector: 'app-approve-event',
@@ -63,7 +64,8 @@ export class ApproveEventPage implements OnInit {
private platform: Platform,
private backgroundservice: BackgroundService,
public ThemeService: ThemeService,
private offlineManager: OfflineManagerService
private offlineManager: OfflineManagerService,
private storage: Storage
) {
this.activatedRoute.paramMap.subscribe(params => {
// console.log(params["params"]);
@@ -110,6 +112,9 @@ export class ApproveEventPage implements OnInit {
addProcessToDB(data) {
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
this.storage.set('approve_event_detils', data).then(() => {
console.log('APPROVE EVENT DETAILS SAVED')
})
} else {
this.sqliteservice.updateProcess(data);
}
@@ -117,69 +122,85 @@ export class ApproveEventPage implements OnInit {
getProcessFromDB() {
this.platform.ready().then(() => {
this.sqliteservice.getProcessById(this.serialNumber).then((process) => {
console.log('event aprove serial', process)
var doc;
var action = [];
var origi = [];
var wordafi = {};
if (process[0].Documents === "null" || process[0].Documents === "undefined") {
doc = []
} else {
doc = JSON.parse(process[0].Documents)
}
if (process[0].actions === "null" || process[0].actions === "undefined") {
action = []
} else {
action = JSON.parse(process[0].Documents)
}
if (process[0].originator === "null" || process[0].originator === "undefined") {
origi = []
} else {
origi = JSON.parse(process[0].Documents)
}
if (process[0].workflowInstanceDataFields === "null" || process[0].workflowInstanceDataFields === "undefined") {
wordafi = []
} else {
wordafi = JSON.parse(process[0].workflowInstanceDataFields)
}
let task = {
"Documents": doc,
"actions": action,
"activityInstanceName": process[0].activityInstanceName,
"formURL": process[0].formURL,
"originator": origi,
"serialNumber": process[0].serialNumber,
"taskStartDate": process[0].taskStartDate,
"totalDocuments": process[0].totalDocuments,
"workflowDisplayName": process[0].workflowDisplayName,
"workflowID": process[0].workflowID,
"workflowInstanceDataFields": wordafi,
"workflowInstanceFolio": process[0].workflowInstanceFolio,
"workflowInstanceID": process[0].workflowInstanceID,
"workflowName": process[0].workflowInstanceID
}
this.loadedEvent = task
console.log('offline event', this.loadedEvent);
this.today = new Date(this.loadedEvent.workflowInstanceDataFields.StartDate);
this.customDate = this.days[this.today.getDay()] + ", " + this.today.getDate() + " de " + (this.months[this.today.getMonth()]);
let instanceId = this.loadedEvent.workflowInstanceDataFields.InstanceId;
this.loadedAttachments = this.loadedEvent.Documents;
console.log('Attatara', this.loadedAttachments)
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
this.storage.get('approve_event_detils').then((event) => {
this.loadedEvent = event
console.log('offline event', this.loadedEvent);
this.today = new Date(this.loadedEvent.workflowInstanceDataFields.StartDate);
this.customDate = this.days[this.today.getDay()] + ", " + this.today.getDate() + " de " + (this.months[this.today.getMonth()]);
let instanceId = this.loadedEvent.workflowInstanceDataFields.InstanceId;
this.loadedAttachments = this.loadedEvent.Documents;
console.log('Attatara', this.loadedAttachments)
})
})
} else {
this.platform.ready().then(() => {
this.sqliteservice.getProcessById(this.serialNumber).then((process) => {
console.log('event aprove serial', process)
var doc;
var action = [];
var origi = [];
var wordafi = {};
if (process[0].Documents === "null" || process[0].Documents === "undefined") {
doc = []
} else {
doc = JSON.parse(process[0].Documents)
}
if (process[0].actions === "null" || process[0].actions === "undefined") {
action = []
} else {
action = JSON.parse(process[0].Documents)
}
if (process[0].originator === "null" || process[0].originator === "undefined") {
origi = []
} else {
origi = JSON.parse(process[0].Documents)
}
if (process[0].workflowInstanceDataFields === "null" || process[0].workflowInstanceDataFields === "undefined") {
wordafi = []
} else {
wordafi = JSON.parse(process[0].workflowInstanceDataFields)
}
let task = {
"Documents": doc,
"actions": action,
"activityInstanceName": process[0].activityInstanceName,
"formURL": process[0].formURL,
"originator": origi,
"serialNumber": process[0].serialNumber,
"taskStartDate": process[0].taskStartDate,
"totalDocuments": process[0].totalDocuments,
"workflowDisplayName": process[0].workflowDisplayName,
"workflowID": process[0].workflowID,
"workflowInstanceDataFields": wordafi,
"workflowInstanceFolio": process[0].workflowInstanceFolio,
"workflowInstanceID": process[0].workflowInstanceID,
"workflowName": process[0].workflowInstanceID
}
this.loadedEvent = task
console.log('offline event', this.loadedEvent);
this.today = new Date(this.loadedEvent.workflowInstanceDataFields.StartDate);
this.customDate = this.days[this.today.getDay()] + ", " + this.today.getDate() + " de " + (this.months[this.today.getMonth()]);
let instanceId = this.loadedEvent.workflowInstanceDataFields.InstanceId;
this.loadedAttachments = this.loadedEvent.Documents;
console.log('Attatara', this.loadedAttachments)
})
})
}
console.log('Offlineee')
}
@@ -14,6 +14,7 @@ import { Platform } from '@ionic/angular';
import { SortService } from 'src/app/services/functions/sort.service';
import { ThemeService } from 'src/app/services/theme.service'
import { RouteService } from 'src/app/services/route.service';
import { Storage } from '@ionic/storage';
@Component({
selector: 'app-event-list',
@@ -46,7 +47,8 @@ export class EventListPage implements OnInit {
private sortService: SortService,
private backgroundservice: BackgroundService,
public ThemeService: ThemeService,
private RouteService: RouteService
private RouteService: RouteService,
private storage: Storage
) { }
ngOnInit() {
@@ -83,22 +85,37 @@ export class EventListPage implements OnInit {
getEventToAproveFromDB() {
this.platform.ready().then(() => {
this.sqliteservice.getListOfEventAprove('Agenda Oficial MDGPR', 'Agenda Pessoal MDGPR').then((event: any[]) => {
this.eventsMDGPRList = this.sortService.sortDate(this.transformaDataDB(event), 'taskStartDate')
//this.eventsMDGPRList = this.eventsMDGPRList.filter(element => element.interveners != null)
console.log('MD event to aprove', this.eventsMDGPRList)
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
this.storage.get('event-to-aproveMD').then((events) => {
this.eventsMDGPRList = events
})
this.storage.get('event-to-aprovePR').then((events) => {
this.eventsPRList = events
})
} else {
this.platform.ready().then(() => {
this.sqliteservice.getListOfEventAprove('Agenda Oficial MDGPR', 'Agenda Pessoal MDGPR').then((event: any[]) => {
this.eventsMDGPRList = this.sortService.sortDate(this.transformaDataDB(event), 'taskStartDate')
//this.eventsMDGPRList = this.eventsMDGPRList.filter(element => element.interveners != null)
console.log('MD event to aprove', this.eventsMDGPRList)
})
this.sqliteservice.getListOfEventAprove('Agenda Oficial PR', 'Agenda Pessoal PR').then((event: any[]) => {
this.eventsPRList = this.sortService.sortDate(this.transformaDataDB(event), 'taskStartDate')
console.log('PR event to aprove', this.eventsPRList)
})
})
this.sqliteservice.getListOfEventAprove('Agenda Oficial PR', 'Agenda Pessoal PR').then((event: any[]) => {
this.eventsPRList = this.sortService.sortDate(this.transformaDataDB(event), 'taskStartDate')
console.log('PR event to aprove', this.eventsPRList)
}
})
})
console.log('Offlineee')
}
@@ -143,16 +160,24 @@ export class EventListPage implements OnInit {
let mdEventsPessoal = await this.processes.GetTasksList('Agenda Pessoal MDGPR', false).toPromise();
this.eventsMDGPRList = mdEventsOficial.concat(mdEventsPessoal);
this.eventsMDGPRList = this.sortService.sortDate(this.eventsMDGPRList, 'taskStartDate')
this.eventsMDGPRList = this.sortService.sortArrayByDate(this.eventsMDGPRList)
console.log('MD EVENT TO APROVE ONLINE',this.eventsMDGPRList)
this.eventaprovacaostore.resetmd(this.sortService.sortArrayByDate(this.eventsMDGPRList).reverse());
this.storage.set('event-to-aproveMD',this.eventsMDGPRList).then(() => {
console.log(' EVENTMD TO APROVE SAVED')
})
//this.eventaprovacaostore.resetmd(this.sortService.sortArrayByDate(this.eventsMDGPRList).reverse());
}
else if (this.segment == 'PR') {
let prEventsOficial = await this.processes.GetTasksList('Agenda Oficial PR', false).toPromise();
let prEventsPessoal = await this.processes.GetTasksList('Agenda Pessoal PR', false).toPromise();
this.eventsPRList = prEventsOficial.concat(prEventsPessoal);
this.eventsPRList = this.sortService.sortDate(this.eventsPRList, 'taskStartDate')
this.eventsPRList = this.sortService.sortArrayByDate(this.eventsPRList)
console.log('PR EVENT TO APROVE ONLINE',this.eventsPRList)
this.eventaprovacaostore.resetpr(this.sortService.sortArrayByDate(this.eventsPRList).reverse());
this.storage.set('event-to-aprovePR',this.eventsPRList).then(() => {
console.log(' EVENTPR TO APROVE SAVED')
})
//this.eventaprovacaostore.resetpr(this.sortService.sortArrayByDate(this.eventsPRList).reverse());
}
this.showLoader = false;
this.skeletonLoader = false
@@ -162,6 +187,8 @@ export class EventListPage implements OnInit {
})
}
async openApproveModal(eventSerialNumber, event) {
const modal = await this.modalController.create({
component: ApproveEventModalPage,
@@ -33,6 +33,7 @@ import { BackgroundService } from 'src/app/services/background.service';
import { NewGroupPage } from 'src/app/pages/chat/new-group/new-group.page';
import { DataService } from 'src/app/services/data.service';
import { RouteService } from 'src/app/services/route.service';
import { Storage } from '@ionic/storage';
@Component({
selector: 'app-expediente-detail',
@@ -82,6 +83,7 @@ export class ExpedienteDetailPage implements OnInit {
private backgroundservice: BackgroundService,
public ThemeService: ThemeService,
private dataService: DataService,
private storage: Storage
) {
this.activatedRoute.paramMap.subscribe(params => {
if (params["params"].SerialNumber) {
@@ -112,63 +114,106 @@ export class ExpedienteDetailPage implements OnInit {
updateProcessDB(res) {
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
this.storage.set('expediente_details',res).then(() =>{
console.log('EXPEDIENTE DETAILS SAVED')
})
} else {
this.sqliteservice.updateProcess(res)
}
}
getFromDB() {
this.platform.ready().then(() => {
this.onlinecheck = false;
this.sqliteservice.getProcessById(this.serialNumber).then((process) => {
console.log("expedient ditail", process)
var workflow = JSON.parse(process[0].workflowInstanceDataFields);
var origina
if (process[0].originator === "undefined") {
origina = ""
} else {
origina = JSON.parse(process[0].originator)
}
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
this.storage.get('expediente_details').then((process) => {
this.task = {
"SerialNumber": process[0].serialNumber,
"Folio": workflow.Subject,
"Senders": origina.email || process[0].originator,
"CreateDate": momentG(new Date(process[0].taskStartDate), 'yyyy-MM-dd HH:mm:ss'),
"DocumentURL": workflow.ViewerRequest,
"Remetente": workflow.Sender,
"Note": workflow.TaskMessage || workflow.Note,
"FolderId": workflow.FolderID,
"FsId": workflow.FsId,
"DocId": workflow.DocID,
"WorkflowName": process[0].workflowDisplayName,
"Status": workflow.Status,
"DispatchNumber": workflow.DispatchNumber,
"AttachmentsProcessLastInstanceID": workflow.AttachmentsProcessLastInstanceID,
"InstanceID": workflow.InstanceID
"SerialNumber": process.serialNumber,
"Folio": process.workflowInstanceDataFields.Subject,
"Senders": process.originator || process.originator,
"CreateDate": momentG(new Date(process.taskStartDate), 'yyyy-MM-dd HH:mm:ss'),
"DocumentURL": process.workflowInstanceDataFields.ViewerRequest,
"Remetente": process.workflowInstanceDataFields.Sender,
"Note": process.workflowInstanceDataFields.TaskMessage || process.workflowInstanceDataFields.Note,
"FolderId": process.workflowInstanceDataFields.FolderID,
"FsId": process.workflowInstanceDataFields.FsId,
"DocId": process.workflowInstanceDataFields.DocID,
"WorkflowName": process.workflowDisplayName,
"Status": process.workflowInstanceDataFields.Status,
"DispatchNumber": process.workflowInstanceDataFields.DispatchNumber,
"AttachmentsProcessLastInstanceID": process.workflowInstanceDataFields.AttachmentsProcessLastInstanceID,
"InstanceID": process.workflowInstanceDataFields.InstanceID
}
this.fulltask = {
Documents: JSON.parse(process[0].Documents),
actions: JSON.parse(process[0].actions),
activityInstanceName: process[0].activityInstanceName,
formURL: process[0].formURL,
interveners: process[0].interveners,
originator: JSON.parse(process[0].originator),
serialNumber: process[0].serialNumber,
taskStartDate: process[0].taskStartDate,
totalDocuments: process[0].totalDocuments,
workflowDisplayName: process[0].workflowDisplayName,
workflowID: process[0].workflowID,
workflowInstanceDataFields: JSON.parse(process[0].workflowInstanceDataFields),
workflowInstanceFolio: process[0].workflowInstanceFolio,
workflowInstanceID: process[0].workflowInstanceID,
workflowName: process[0].workflowName,
Documents: process.Documents,
actions: process.actions,
activityInstanceName: process.activityInstanceName,
formURL: process.formURL,
interveners: process.interveners,
originator: process.originator,
serialNumber: process.serialNumber,
taskStartDate: process.taskStartDate,
totalDocuments: process.totalDocuments,
workflowDisplayName: process.workflowDisplayName,
workflowID: process.workflowID,
workflowInstanceDataFields: process.workflowInstanceDataFields,
workflowInstanceFolio: process.workflowInstanceFolio,
workflowInstanceID: process.workflowInstanceID,
workflowName: process.workflowName,
}
})
})
} else {
this.platform.ready().then(() => {
this.onlinecheck = false;
this.sqliteservice.getProcessById(this.serialNumber).then((process) => {
console.log("expedient ditail", process)
var workflow = JSON.parse(process[0].workflowInstanceDataFields);
var origina
if (process[0].originator === "undefined") {
origina = ""
} else {
origina = JSON.parse(process[0].originator)
}
this.task = {
"SerialNumber": process[0].serialNumber,
"Folio": workflow.Subject,
"Senders": origina.email || process[0].originator,
"CreateDate": momentG(new Date(process[0].taskStartDate), 'yyyy-MM-dd HH:mm:ss'),
"DocumentURL": workflow.ViewerRequest,
"Remetente": workflow.Sender,
"Note": workflow.TaskMessage || workflow.Note,
"FolderId": workflow.FolderID,
"FsId": workflow.FsId,
"DocId": workflow.DocID,
"WorkflowName": process[0].workflowDisplayName,
"Status": workflow.Status,
"DispatchNumber": workflow.DispatchNumber,
"AttachmentsProcessLastInstanceID": workflow.AttachmentsProcessLastInstanceID,
"InstanceID": workflow.InstanceID
}
this.fulltask = {
Documents: JSON.parse(process[0].Documents),
actions: JSON.parse(process[0].actions),
activityInstanceName: process[0].activityInstanceName,
formURL: process[0].formURL,
interveners: process[0].interveners,
originator: JSON.parse(process[0].originator),
serialNumber: process[0].serialNumber,
taskStartDate: process[0].taskStartDate,
totalDocuments: process[0].totalDocuments,
workflowDisplayName: process[0].workflowDisplayName,
workflowID: process[0].workflowID,
workflowInstanceDataFields: JSON.parse(process[0].workflowInstanceDataFields),
workflowInstanceFolio: process[0].workflowInstanceFolio,
workflowInstanceID: process[0].workflowInstanceID,
workflowName: process[0].workflowName,
}
})
})
}
}
@@ -9,6 +9,7 @@ import { Platform } from '@ionic/angular';
import { BackgroundService } from '../../../services/background.service';
import { ThemeService } from 'src/app/services/theme.service'
import { SortService } from 'src/app/services/functions/sort.service';
import {Storage } from '@ionic/storage';
@Component({
selector: 'app-expediente',
@@ -40,6 +41,7 @@ export class ExpedientePage implements OnInit {
private backgroundservice: BackgroundService,
public ThemeService: ThemeService,
private sortService: SortService,
private storage: Storage
) { }
ngOnInit() {
@@ -112,63 +114,48 @@ export class ExpedientePage implements OnInit {
addProcessTODb(task) {
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
this.storage.set('gabinete-expediente',task).then(() => {
console.log('GABINETE EXPEDIENTE SAVED')
})
} else {
this.sqliteservice.addProcess(task);
}
}
SqliteAddExpediente(list) {
list.forEach((expediente) => {
let data = {
serialNumber: expediente.serialNumber,
workflowInstanceFolio: expediente.workflowInstanceFolio,
Documents: expediente.Documents,
actions: expediente.actions,
activityInstanceName: expediente.activityInstanceName,
formURL: expediente.formURL,
originator: expediente.originator,
taskStartDate: expediente.taskStartDate,
totalDocuments: expediente.totalDocuments,
workflowDisplayName: expediente.workflowDisplayName,
workflowID: expediente.workflowID,
workflowInstanceDataFields: expediente.workflowInstanceDataFields,
workflowInstanceID: expediente.workflowInstanceID,
workflowName: expediente.workflowName
}
this.sqliteservice.addExpediente(data);
})
}
getEventsFromLocalDb() {
this.taskslist = new Array();
this.sqliteservice.getprocessByworkflow("Expediente").then((expediente: any[]) => {
console.log("All expedientes from local,", expediente)
expediente.forEach((element) => {
var workflow = JSON.parse(element.workflowInstanceDataFields);
let exped = {
"CreateDate": element.taskStartDate,
"DocumentsQty": element.totalDocuments,
"Senders": workflow.Senders,
"SerialNumber": element.serialNumber,
"Status": workflow.Status,
"Subject": workflow.Subject,
"WorkflowName": element.workflowDisplayName,
"activityInstanceName": element.activityInstanceName
}
this.taskslist.push(exped)
});
this.listToPresent = this.taskslist
})
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
this.storage.get('gabinete-expediente').then((expediente) => {
this.listToPresent = expediente
})
} else {
this.taskslist = new Array();
this.sqliteservice.getprocessByworkflow("Expediente").then((expediente: any[]) => {
console.log("All expedientes from local,", expediente)
expediente.forEach((element) => {
var workflow = JSON.parse(element.workflowInstanceDataFields);
let exped = {
"CreateDate": element.taskStartDate,
"DocumentsQty": element.totalDocuments,
"Senders": workflow.Senders,
"SerialNumber": element.serialNumber,
"Status": workflow.Status,
"Subject": workflow.Subject,
"WorkflowName": element.workflowDisplayName,
"activityInstanceName": element.activityInstanceName
}
this.taskslist.push(exped)
});
this.listToPresent = this.taskslist
})
}
}
}
@@ -31,6 +31,7 @@ import { Platform } from '@ionic/angular';
import { BackgroundService } from 'src/app/services/background.service';
import { SortService } from 'src/app/services/functions/sort.service';
import { DataService } from 'src/app/services/data.service';
import { Storage } from '@ionic/storage';
@Component({
selector: 'app-gabinete-digital',
@@ -135,6 +136,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
public ThemeService: ThemeService,
private sortService: SortService,
private dataService: DataService,
private storage: Storage
) {
this.loggeduser = authService.ValidatedUser;
@@ -215,7 +217,9 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
addProcessToDB(data) {
this.platform.ready().then(() => {
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
this.storage.set('GabineteProcess', data).then(() => {
console.log('Gabinete process saved')
})
} else {
data.forEach(element => {
@@ -245,39 +249,77 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
getAllProcessFromDB() {
this.hideRefreshButton();
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
this.storage.get('GabineteProcess').then((allprocess: any[]) => {
console.log('ALL PROCESS WEB',allprocess )
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();
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.sortService.sortDate(this.allProcessesList, 'CreateDate')
});
})
} else {
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.sortService.sortDate(this.allProcessesList, 'CreateDate')
});
console.log("All process from db ", allprocess)
})
}
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);
dataTranform(data) {
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.sortService.sortDate(this.allProcessesList, 'CreateDate')
});
console.log("All process from db ", allprocess)
})
}
sortArrayISODate(myArray: any) {
@@ -495,6 +537,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
let allProcessesList = allPreocesses_;
allProcessesList = allProcessesList.filter(element => element.activityInstanceName != 'Conhecimento')
allProcessesList = allProcessesList.filter(element => element.activityInstanceName != 'Revisar Diploma')
if (!this.p.userRole(['PR'])) {
allProcessesList = allProcessesList.filter(element => element.activityInstanceName != 'Assinar Diplomas')
@@ -14,6 +14,7 @@ import { SqliteService } from 'src/app/services/sqlite.service';
import { BackgroundService } from 'src/app/services/background.service';
import { Platform } from '@ionic/angular';
import { SortService } from 'src/app/services/functions/sort.service';
import { Storage } from '@ionic/storage';
@Component({
@@ -47,6 +48,7 @@ export class PendentesPage implements OnInit {
private platform: Platform,
private backgroundservices: BackgroundService,
private sortService: SortService,
private storage: Storage
) {
this.loggeduser = authService.ValidatedUser;
this.profile = 'mdgpr';
@@ -104,6 +106,9 @@ export class PendentesPage implements OnInit {
pendentesList = removeDuplicate(pendentesList)
pendentesList = this.sortService.sortDate(pendentesList, 'CreateDate');
this.listToPresent = pendentesList;
this.storage.set('pendente-list',pendentesList).then(() => {
console.log('Pendente list SAVED')
})
this.skeletonLoader = false;
}, (error) => {
@@ -116,34 +121,41 @@ export class PendentesPage implements OnInit {
getFromDb() {
this.platform.ready().then(() => {
this.sqliteservice.getAllProcess().then((process: any[]) => {
var pendingList = []
console.log('Pendentes off off',process )
process.forEach(element => {
var workflow = JSON.parse(element.workflowInstanceDataFields);
if (workflow.Status === "Pending") {
let task = {
"CreateDate": new Date(element.taskStartDate),
"DocumentsQty": element.totalDocuments,
"FolderID": workflow.FolderID,
"Folio": workflow.Subject,
"Senders": workflow.Sender,
"SerialNumber": element.serialNumber,
"Status": workflow.Status,
"WorkflowName": element.workflowDisplayName
}
pendingList.push(task)
}
});
pendingList = this.sortService.sortDate(pendingList, 'CreateDate');
this.listToPresent = pendingList;
console.log('pendentes', pendingList)
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
this.storage.get('pendente-list').then((pendentes) => {
this.listToPresent =pendentes
})
})
} else {
this.platform.ready().then(() => {
this.sqliteservice.getAllProcess().then((process: any[]) => {
var pendingList = []
console.log('Pendentes off off',process )
process.forEach(element => {
var workflow = JSON.parse(element.workflowInstanceDataFields);
if (workflow.Status === "Pending") {
let task = {
"CreateDate": new Date(element.taskStartDate),
"DocumentsQty": element.totalDocuments,
"FolderID": workflow.FolderID,
"Folio": workflow.Subject,
"Senders": workflow.Sender,
"SerialNumber": element.serialNumber,
"Status": workflow.Status,
"WorkflowName": element.workflowDisplayName
}
pendingList.push(task)
}
});
pendingList = this.sortService.sortDate(pendingList, 'CreateDate');
this.listToPresent = pendingList;
console.log('pendentes', pendingList)
})
})
}
}
async refreshing() {
@@ -38,11 +38,15 @@
*ngFor="let publication of getpublication"
(click)="goToPublicationDetail(publication.DocumentId)"
>
<div *ngIf="publication.FileBase64.length > 30" class="post-img">
<ion-img src="{{publication.FileBase64}}" alt="image"></ion-img>
</div>
<div *ngIf="publication.FileBase64.length < 30" class="post-img">
<img src="/assets/icon/icon-no-image.svg" alt="image">
<div *ngIf="publication.FileBase64 != null">
<div *ngIf="publication.FileBase64.length < 30; else imageLoaded" class="post-img">
<img src="/assets/icon/icon-no-image.svg">
</div>
<ng-template #imageLoaded>
<div *ngIf="publication.FileBase64.length > 30" class="post-img">
<img src="{{publication.FileBase64}}">
</div>
</ng-template>
</div>
<div class="post-content px-20">
<div class="post-title-time">
@@ -68,15 +68,16 @@ export class ViewPublicationsPage implements OnInit {
if (typeof (this.folderId) == 'object') {
this.folderId = this.folderId['ProcessId']
}
this.testForkJoin()
//this.testForkJoin()
this.getPublicationDetail();
setTimeout(() => {
this.getPublicationsIds();
/* setTimeout(() => {
this.getPublicationsIds();
}, 1000);
}, 1000); */
this.backgroundservice.registerBackService('Online', () => {
this.getPublicationDetail();
this.testForkJoin()
//this.testForkJoin()
})
@@ -91,16 +92,16 @@ export class ViewPublicationsPage implements OnInit {
// if (typeof (this.id == 'object') {
// this.id = this.id['ProcessId']
// }
this.testForkJoin()
this.getPublicationDetail();
//this.testForkJoin()
//this.getPublicationDetail();
// this.getPublicationsIds();
}
doRefresh = (event) => {
setTimeout(() => {
this.testForkJoin()
//this.testForkJoin()
this.getPublicationDetail();
// this.getPublicationsIds();
this.getPublicationsIds();
event.target.complete();
}, 3000);
@@ -116,13 +117,14 @@ export class ViewPublicationsPage implements OnInit {
}
getPublicationDetail() {
this.publications.GetPresidentialAction(this.folderId).subscribe(res=>{
this.publications.GetPresidentialAction(this.folderId).subscribe(res => {
console.log(res);
this.item = res;
this.sqliteservice.updatePublicationsDetails(this.folderId, JSON.stringify(res));
});
}
// goes to fork
// goes to fork
// getPublicationsIds() {
// this.showLoader = true;
@@ -138,22 +140,22 @@ export class ViewPublicationsPage implements OnInit {
this.showLoader = true;
const folderId = this.folderId
this.getFromDB()
this.publications.GetPublicationsImages(this.folderId).subscribe(res => {
console.log('publications ids', res)
this.publicationList = new Array();
/* for(let i of res) {
this.publications.GetPublicationById(i).subscribe(ress => {
console.log('publications by ids', ress)
let item: Publication = this.publicationPipe.itemList(ress)
console.log('publications by ids 2', item)
this.publicationList.push(item);
})
} */
for(let i = 0; i < res.length; i++) {
this.publications.GetPublicationById(res[i]).subscribe(ress => {
console.log('publications by ids', ress)
let item: Publication = this.publicationPipe.itemList(ress)
console.log('publications by ids 2', item)
this.publicationList.push(item);
})
}
res.forEach(element => {
/* res.forEach(element => {
console.log('publications elements', element)
this.publications.GetPublicationById(element).subscribe(ress => {
console.log('publications by ids', ress)
@@ -162,13 +164,13 @@ export class ViewPublicationsPage implements OnInit {
this.publicationList.push(ress);
})
});
}); */
console.log('PUBLICATIONS IMAGEs',this.publicationList)
this.sqliteservice.updateactions(this.folderId, JSON.stringify(this.publicationList));
console.log('PUBLICATIONS IMAGEs',this.publicationList)
this.publicationListStorage.add(folderId, this.publicationList)
this.getpublication = this.publicationList;
this.showLoader = false;
/* this.publicationList = new Array();
@@ -189,7 +191,7 @@ export class ViewPublicationsPage implements OnInit {
this.showLoader = true;
const folderId = this.folderId
this.getFromDB();
this.publications.GetPublications(this.folderId).subscribe(res => {
console.log(this.folderId)
@@ -223,13 +225,13 @@ export class ViewPublicationsPage implements OnInit {
});
}
testForkJoin(){
testForkJoin() {
forkJoin([
this.getPublicationsIds(),
this.getPublications(),
]).subscribe(allResults =>{
]).subscribe(allResults => {
this.publicationList = allResults[2]
})
}
@@ -238,7 +240,7 @@ export class ViewPublicationsPage implements OnInit {
this.sqliteservice.getActionById(this.folderId).then((publications) => {
console.log('publications', publications)
let item = {
/* let item = {
ActionType: publications[0].ActionType,
DateBegin: publications[0].DateBegin,
DateEnd: publications[0].DateEnd,
@@ -246,7 +248,8 @@ export class ViewPublicationsPage implements OnInit {
Detail: publications[0].Detail,
ProcessId: publications[0].ProcessId
}
this.publicationDitails = item;
this.publicationDitails = item; */
this.item = JSON.parse(publications[0].publicationsDetails);
let publicationArray = [];
JSON.parse(publications[0].publications).forEach(element => {
@@ -264,7 +267,7 @@ export class ViewPublicationsPage implements OnInit {
publicationArray.push(publicationlis);
});
this.getpublication = publicationArray;
})
}
@@ -68,6 +68,13 @@ export class WsChatMethodsService {
}
getRoomFromDb() {
this.storage.get('Rooms').then((rooms) => {
rooms.result.update.forEach((roomData: room) => {
this.prepareRoom(roomData);
});
})
};
openRoom(roomId) {
if(this.currentRoom) {
@@ -92,9 +99,12 @@ export class WsChatMethodsService {
async getAllRooms () {
this.loadingWholeList = true
this.getRoomFromDb();
const rooms = await this.WsChatService.getRooms();
this.storage.set('Rooms', rooms);
// console.log("ROOMS" + JSON.stringify(rooms))
this.WsChatService.registerCallback({
type:'Onmessage',
funx:(message)=>{
+20 -3
View File
@@ -127,7 +127,8 @@ export class SqliteService {
DateEnd varchar(255),
Detail varchar(255),
Description varchar(255),
publications Text
publications Text,
publicationsDetails Text
)`, [])
.then((res) => {
console.log("Sucess action Table created: ", res)
@@ -195,8 +196,8 @@ export class SqliteService {
public addactions(data) {
console.log('Action insert', data)
this.dbInstance.executeSql(`
INSERT OR IGNORE INTO ${this.actions} (ActionType,DateBegin,DateEnd,Description,Detail,ProcessId,publications)
VALUES ('${data.ActionType}','${data.DateBegin}', '${data.DateEnd}','${data.Description}','${data.Detail}','${data.ProcessId}','${data.publications}')`, [])
INSERT OR IGNORE INTO ${this.actions} (ActionType,DateBegin,DateEnd,Description,Detail,ProcessId,publications,publicationsDetails)
VALUES ('${data.ActionType}','${data.DateBegin}', '${data.DateEnd}','${data.Description}','${data.Detail}','${data.ProcessId}','${data.publications}','${data.publicationsDetails}')`, [])
.then(() => {
console.log("action add with Success");
@@ -319,6 +320,22 @@ export class SqliteService {
}
//updatePublicationsDetails
public updatePublicationsDetails(id, data) {
try {
console.log("update action data", data)
this.dbInstance.executeSql(`
UPDATE ${this.actions} SET publicationsDetails = ? WHERE ProcessId = ${id}`, [data])
.then(() => {
console.log("action update with Success");
}, (e) => {
console.log(JSON.stringify(e.err));
});
} catch(error) {}
}
//updateChatMsg
public updateChatMsg(id, data) {
let jsonId = JSON.stringify(id)
@@ -28,12 +28,12 @@
<div *ngSwitchCase="'MDGPR'" class="height-100">
<div *ngIf="eventaprovacaostore.listmd.length != 0">
<div *ngIf="eventsMDGPRList.length != 0">
<ion-list class="width-100" >
<div
class="expediente item-hover ion-no-padding ion-no-margin cursor-pointer"
*ngFor="let event of eventaprovacaostore.listmd"
*ngFor="let event of eventsMDGPRList"
(click)="goToEventDetail(event)"
>
<!-- (click)="openApproveModal(event)" -->
@@ -52,7 +52,7 @@
</ion-list>
</div>
<div *ngIf="eventaprovacaostore.listmd.length == 0" class="centered-div">
<div *ngIf="eventsMDGPRList.length == 0" class="centered-div">
<div *ngSwitchCase="'MDGPR'" >
<div class="d-flex height-90 align-center justify-content-center"
>
@@ -62,12 +62,12 @@
</div>
</div>
<div *ngSwitchCase="'PR'">
<div *ngIf="eventaprovacaostore.listpr.length != 0">
<div *ngIf="eventsPRList.length != 0">
<ion-list class="width-100" *ngSwitchCase="'PR'">
<div class="width-100" *ngIf="eventaprovacaostore.listpr">
<div class="width-100" *ngIf="eventsPRList">
<div
class="expediente item-hover ion-no-padding ion-no-margin cursor-pointer"
*ngFor="let event of eventaprovacaostore.listpr"
*ngFor="let event of eventsPRList"
(click)="goToEventDetail(event)"
>
<div class="item event-pr-{{event.workflowInstanceDataFields.Agenda}} width-100">
@@ -87,10 +87,10 @@
</div>
<div *ngIf="eventaprovacaostore.listpr.length == 0" class="centered-div d-flex height-90 align-center justify-content-center">
<div *ngIf="eventsPRList.length == 0" class="centered-div d-flex height-90 align-center justify-content-center">
<div *ngSwitchCase="'PR'" >
<div class="d-flex align-center justify-content-center"
*ngIf="eventaprovacaostore.listpr.length < 1">
*ngIf="eventsPRList.length < 1">
Lista vazia
</div>
</div>
@@ -8,6 +8,7 @@ import { LoginUserRespose } from 'src/app/models/user.model';
import { AuthService } from 'src/app/services/auth.service';
import { EventoAprovacaoStore } from 'src/app/store/eventoaprovacao-store.service';
import { SortService } from 'src/app/services/functions/sort.service';
import { Storage } from '@ionic/storage';
@Component({
selector: 'app-events-to-approve',
@@ -33,6 +34,7 @@ export class EventsToApprovePage implements OnInit {
private router: Router,
private userAuth: AuthService,
private sortService: SortService,
private storage: Storage
)
{
this.loggeduser = userAuth.ValidatedUser;
@@ -63,25 +65,46 @@ export class EventsToApprovePage implements OnInit {
async LoadToApproveEvents() {
this.showLoader = true;
console.log(this.segment);
this.getFromDB();
if(this.segment == 'MDGPR'){
let mdEventsOficial = await this.processes.GetTasksList('Agenda Oficial MDGPR', false).toPromise();
let mdEventsPessoal = await this.processes.GetTasksList('Agenda Pessoal MDGPR', false).toPromise();
this.eventsMDGPRList = mdEventsOficial.concat(mdEventsPessoal);
this.eventsMDGPRList = this.sortService.sortArrayByDate(this.eventsMDGPRList)
console.log(this.sortService.sortArrayByDate(this.eventsMDGPRList));
this.eventaprovacaostore.resetmd(this.sortService.sortDate(this.eventsMDGPRList, 'CreateDate'));
this.storage.set('event-to-aproveMD',this.eventsMDGPRList).then(() => {
console.log(' EVENTMD TO APROVE SAVED')
})
//this.eventaprovacaostore.resetmd(this.sortService.sortDate(this.eventsMDGPRList, 'CreateDate'));
}
else if(this.segment == 'PR'){
let prEventsOficial = await this.processes.GetTasksList('Agenda Oficial PR', false).toPromise();
let prEventsPessoal = await this.processes.GetTasksList('Agenda Pessoal PR', false).toPromise();
this.eventsPRList = prEventsOficial.concat(prEventsPessoal);
this.eventsPRList = this.sortService.sortArrayByDate(this.eventsPRList)
this.eventaprovacaostore.resetpr(this.sortService.sortDate(this.eventsPRList, 'CreateDate'));
this.storage.set('event-to-aprovePR',this.eventsPRList).then(() => {
console.log(' EVENTPR TO APROVE SAVED')
})
//this.eventaprovacaostore.resetpr(this.sortService.sortDate(this.eventsPRList, 'CreateDate'));
}
this.showLoader = false;
}
getFromDB() {
this.storage.get('event-to-aproveMD').then((events) => {
this.eventsMDGPRList = events
})
this.storage.get('event-to-aprovePR').then((events) => {
this.eventsPRList = events
})
}
toDateString(e) {
return new Date(e).toDateString()
}
@@ -22,10 +22,10 @@
<div class="content width-100 overflow-y-auto height-100" >
<div >
<ion-list *ngIf="expedientegbstore.list.length >=0">
<ion-list *ngIf="taskslist.length >=0">
<div
class="expediente item-hover ion-no-padding ion-no-margin cursor-pointer"
*ngFor = "let task of expedientegbstore.list"
*ngFor = "let task of taskslist"
(click)="goToExpediente(task.SerialNumber)"
>
<div class="item width-100">
@@ -58,13 +58,13 @@
</div>
<div
*ngIf="!skeletonLoader && expedientegbstore.list.length == 0 && expedientegbstore.list.length == 0"
*ngIf="!skeletonLoader && taskslist.length == 0 && taskslist.length == 0"
class="empty-list d-flex height-100 align-center justify-content-center"
>
<span>Lista vazia</span>
</div>
<div *ngIf="skeletonLoader && expedientegbstore.list.length == 0">
<div *ngIf="skeletonLoader && taskslist.length == 0">
<ion-list>
<ion-item>
@@ -6,6 +6,7 @@ import { ExpedienteGdStore } from 'src/app/store/expedientegd-store.service';
import { ExpedienteTaskPipe } from 'src/app/pipes/expediente-task.pipe';
import { ThemeService } from 'src/app/services/theme.service'
import { SortService } from 'src/app/services/functions/sort.service';
import { Storage } from '@ionic/storage';
@Component({
selector: 'app-expedients',
@@ -13,27 +14,28 @@ import { SortService } from 'src/app/services/functions/sort.service';
styleUrls: ['./expedients.page.scss'],
})
export class ExpedientsPage implements OnInit {
segment:string;
segment: string;
taskslist = [];
serialNumber:string;
serialNumber: string;
@Input() profile:string;
@Input() profile: string;
skeletonLoader = true
expedientegbstore = ExpedienteGdStore
expedienteTaskPipe = new ExpedienteTaskPipe()
constructor(
private processes:ProcessesService,
private processes: ProcessesService,
private alertService: AlertService,
private router: Router,
public ThemeService: ThemeService,
private sortService: SortService,
) {
this.profile = 'mdgpr';
private storage: Storage
) {
this.profile = 'mdgpr';
}
}
ngOnInit() {
//Inicializar segment
@@ -43,11 +45,11 @@ export class ExpedientsPage implements OnInit {
this.router.events.forEach((event) => {
if (event instanceof NavigationStart &&
event.url.startsWith('/home/gabinete-digital?expedientes=true')) {
if(window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) {
this.doRefresh()
} else {
this.LoadList()
}
if (window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) {
this.doRefresh()
} else {
this.LoadList()
}
}
});
@@ -75,21 +77,35 @@ export class ExpedientsPage implements OnInit {
this.taskslist.push(task);
});
this.taskslist = this.sortService.sortDate(this.taskslist, 'CreateDate')
this.addProcessTODb(this.taskslist);
this.expedientegbstore.reset(this.taskslist);
}, (error) => {
this.getEventsFromLocalDb();
});
}
doRefresh() {
setTimeout(()=>{
this.LoadList();
}, 1000)
addProcessTODb(task) {
this.storage.set('gabinete-expediente', task).then(() => {
console.log('GABINETE EXPEDIENTE SAVED')
})
}
goToExpediente(serialNumber:any){
this.router.navigate(['/home/gabinete-digital/expediente',serialNumber,'gabinete-digital']);
getEventsFromLocalDb() {
this.storage.get('gabinete-expediente').then((expediente) => {
this.taskslist = expediente
})
}
}
doRefresh() {
setTimeout(() => {
this.LoadList();
}, 1000)
}
goToExpediente(serialNumber: any) {
this.router.navigate(['/home/gabinete-digital/expediente', serialNumber, 'gabinete-digital']);
}
}
@@ -20,7 +20,7 @@
</ion-refresher>
<app-task-list
[taskList] = pendentesstore.list
[taskList] = listToPresent
[skeletonLoader] = skeletonLoader
(viewTaskDetail)="viewTaskDetails($event)"
> </app-task-list>
@@ -8,6 +8,7 @@ import { PendentesStore } from 'src/app/store/pendestes-store.service';
import { LoginUserRespose } from 'src/app/models/user.model';
import { CustomTaskPipe } from 'src/app/pipes/custom-task.pipe';
import { SortService } from 'src/app/services/functions/sort.service';
import { Storage } from '@ionic/storage';
@Component({
selector: 'app-pendentes',
@@ -20,6 +21,7 @@ export class PendentesPage implements OnInit {
pendentesstore = PendentesStore;
customTaskPipe = new CustomTaskPipe()
loggeduser: LoginUserRespose;
listToPresent = [];
@Input() profile:string;
segment:string;
@@ -30,6 +32,7 @@ export class PendentesPage implements OnInit {
private authService: AuthService,
private router: Router,
private sortService: SortService,
private storage: Storage
) {
this.loggeduser = authService.ValidatedUser;
}
@@ -52,7 +55,7 @@ export class PendentesPage implements OnInit {
async LoadList(){
this.skeletonLoader = true;
this.processes.GetPendingTasks(false).subscribe(async res => {
let pendentes = await this.processes.GetPendingTasks(false).toPromise();
let pendentesList = [];
@@ -64,9 +67,24 @@ export class PendentesPage implements OnInit {
pendentesList = removeDuplicate( pendentesList)
pendentesList = this.sortService.sortDate(pendentesList, 'CreateDate')
this.listToPresent = pendentesList
this.pendentesstore.reset(pendentesList);
this.storage.set('pendente-list',pendentesList).then(() => {
console.log('Pendente list SAVED')
})
this.skeletonLoader = false;
}
}, (error) => {
if(error.status == 0){
this.getFromDb();
}
})
}
getFromDb() {
this.storage.get('pendente-list').then((pendentes) => {
this.listToPresent =pendentes
})
}
doRefresh() {
setTimeout(()=>{
+3 -1
View File
@@ -2,6 +2,7 @@ import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { IonicModule } from '@ionic/angular';
import { IonicImageLoaderModule } from 'ionic-image-loader-v5';
// import { HeaderPage } from './header/header.page';
// import { HeaderPrPage } from './header-pr/header-pr.page';
// import { BtnSeguintePage } from './btn-seguinte/btn-seguinte.page';
@@ -17,7 +18,8 @@ import { IonicModule } from '@ionic/angular';
imports: [
CommonModule,
FormsModule,
IonicModule
IonicModule,
IonicImageLoaderModule
],
exports: [
// HeaderPage,