diff --git a/package-lock.json b/package-lock.json index ca1c032a7..5f3686bc9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2180,6 +2180,11 @@ "tslib": "^2.1.0" } }, + "@capacitor/device": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@capacitor/device/-/device-1.1.0.tgz", + "integrity": "sha512-HCFwOxmK7igEgNm20y+zYi+XQ0OlZYnE4oCaI82TGmA7sehlDpBBKbjmI2Bd8aM09+BXFbAAtq7JCxkEfY8nIg==" + }, "@capacitor/filesystem": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/@capacitor/filesystem/-/filesystem-1.0.6.tgz", @@ -16288,6 +16293,14 @@ "tslib": "^2.0.0" } }, + "ngx-image-compress": { + "version": "11.0.3", + "resolved": "https://registry.npmjs.org/ngx-image-compress/-/ngx-image-compress-11.0.3.tgz", + "integrity": "sha512-F1+93cBosm9bNEUmuQM3LvfBg9lzhEITfh8tEhqYb5+OH1HYsjW/nZLQGu5rDS4YCDEA8TQKwmYrrsYjR1t/WA==", + "requires": { + "tslib": "^2.0.0" + } + }, "ngx-image-cropper": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/ngx-image-cropper/-/ngx-image-cropper-5.0.1.tgz", diff --git a/package.json b/package.json index 3947f6c01..c62f12b60 100644 --- a/package.json +++ b/package.json @@ -37,6 +37,7 @@ "@capacitor/browser": "1.0.6", "@capacitor/camera": "^1.2.0", "@capacitor/core": "^3.3.0", + "@capacitor/device": "^1.1.0", "@capacitor/filesystem": "^1.0.6", "@capacitor/haptics": "^1.1.2", "@capacitor/ios": "3.3.0", @@ -125,6 +126,7 @@ "ng-lazyload-image": "^9.1.0", "ng2-pdf-viewer": "^7.0.1", "ngx-cookie-service": "^12.0.3", + "ngx-image-compress": "^11.0.3", "ngx-image-cropper": "^5.0.1", "ngx-socket-io": "^3.2.0", "pdfjs": "^2.4.6", diff --git a/src/app/Rules/despacho.service.ts b/src/app/Rules/despacho.service.ts index e39f5e5cf..ae89903af 100644 --- a/src/app/Rules/despacho.service.ts +++ b/src/app/Rules/despacho.service.ts @@ -253,11 +253,8 @@ export class DespachoService { }); - console.log(despachoList); - - - despachoList = this.sortService.sortArrayISODate(despachoList).reverse(); - + despachoList = this.sortService.sortDate(despachoList, 'CreateDate') + if(updateStore) { this.despachoStore.reset(despachoList); } diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 94dcce95c..6f0284e42 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -11,8 +11,12 @@ import { NGX_MAT_DATE_FORMATS } from '@angular-material-components/datetime-pick import { SqliteService } from 'src/app/services/sqlite.service'; import { BackgroundService } from 'src/app/services/background.service'; import { ScreenOrientation } from '@ionic-native/screen-orientation/ngx'; +<<<<<<< HEAD import { Directory, Filesystem } from '@capacitor/filesystem'; +======= +import { StorageService } from 'src/app/services/storage.service'; +>>>>>>> 6a912b740d97159664c5fe5dff07ac378b028771 const CUSTOM_DATE_FORMATS: NgxMatDateFormats = { @@ -44,7 +48,11 @@ export class AppComponent { private screenOrientation: ScreenOrientation, private sqliteservice: SqliteService, private backgroundservice: BackgroundService, +<<<<<<< HEAD +======= + private storageservice: StorageService +>>>>>>> 6a912b740d97159664c5fe5dff07ac378b028771 ) { this.createCacheFolder() this.initializeApp(); @@ -79,17 +87,15 @@ export class AppComponent { } } - window.addEventListener('online', () => { - console.log('Became online') - this.backgroundservice.online() - if (this.platform.is('desktop') || this.platform.is('mobileweb')) { + this.storageservice.get('networkCheckStore').then((network) => { + if(network === 'online') { + console.log('Network app componente check', network) + this.backgroundservice.online() } else { + console.log('Network app componente check', network) + this.backgroundservice.offline(); } - }); - window.addEventListener('offline', () => { - console.log('Became offline') - this.backgroundservice.offline() - }); + }) }); } diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 40f8a91d6..cb5711f8f 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -65,10 +65,14 @@ import { MediaCapture } from '@ionic-native/media-capture/ngx'; import { Media } from '@ionic-native/media/ngx'; import { StreamingMedia } from '@ionic-native/streaming-media/ngx'; import { PhotoViewer } from '@ionic-native/photo-viewer/ngx'; +<<<<<<< HEAD import { CustomImageCachePageRoutingModule } from './services/file/custom-image-cache/custom-image-cache-routing.module'; +======= +import {NgxImageCompressService} from 'ngx-image-compress'; +>>>>>>> 6a912b740d97159664c5fe5dff07ac378b028771 /* import { FCM } from '@ionic-native/fcm/ngx'; import { FirebaseX } from '@ionic-native/firebase-x/ngx'; */ @@ -140,7 +144,8 @@ import { FirebaseX } from '@ionic-native/firebase-x/ngx'; */ MediaCapture, Media, StreamingMedia, - PhotoViewer + PhotoViewer, + NgxImageCompressService ], bootstrap: [AppComponent], schemas: [CUSTOM_ELEMENTS_SCHEMA] diff --git a/src/app/home/home.page.html b/src/app/home/home.page.html index bfcabdb5c..96fb9d42e 100644 --- a/src/app/home/home.page.html +++ b/src/app/home/home.page.html @@ -3,7 +3,7 @@ - {{toDayEventStorage.eventsList.length + expedienteGdStore.count}} + Início @@ -15,8 +15,8 @@ - {{ documentCounterService.mdTotalDocument }} - {{ documentCounterService.prTotalDocument }} + Gabinete diff --git a/src/app/home/home.page.ts b/src/app/home/home.page.ts index 1d0aaa047..36ac32e4e 100644 --- a/src/app/home/home.page.ts +++ b/src/app/home/home.page.ts @@ -1,6 +1,6 @@ /* eslint-disable */ /* tslint:disable */ -import { Component, OnInit, NgZone } from '@angular/core'; +import { Component, OnInit } from '@angular/core'; import { Event } from '../models/event.model'; import { NotificationsService } from '../services/notifications.service'; /*import { WebNotificationsService } from '../services/webnotifications.service'; */ @@ -25,6 +25,7 @@ import { EventsService } from 'src/app/services/events.service'; import { ProcessesService } from 'src/app/services/processes.service'; import { ScreenOrientation } from '@ionic-native/screen-orientation/ngx'; import { SqliteService } from 'src/app/services/sqlite.service'; +import { Device } from '@capacitor/device'; @Component({ selector: 'app-home', @@ -68,7 +69,6 @@ export class HomePage implements OnInit { status: string = ""; audioName: string = ""; constructor( - private zone: NgZone, private router: Router, public modalCtrl: AlertController, private notificationsService: NotificationsService, @@ -93,13 +93,18 @@ export class HomePage implements OnInit { this.router.events.subscribe((val) => { document.querySelectorAll('ion-modal').forEach((e: any) => e.remove()) + document.querySelectorAll('popover-viewport').forEach((e: any) => e.remove()) }); window['platform'] = platform + window['inactivity/function'] = () => { if (window.location.pathname != '/inactivity') { + document.querySelectorAll('ion-modal').forEach((e: any) => e.remove()) + document.querySelectorAll('.popover-viewport').forEach((e: any) => e.remove()) + const pathname = window.location.pathname SessionStore.setUrlBeforeInactivity(pathname) this.router.navigate(['/inactivity']); @@ -107,6 +112,7 @@ export class HomePage implements OnInit { } + } goto(url) { @@ -117,6 +123,8 @@ export class HomePage implements OnInit { ngOnInit() { + this.logDeviceInfo(); + this.notificationsService.onReciveForeground(); this.notificationsService.onReciveBackground(); @@ -144,6 +152,12 @@ export class HomePage implements OnInit { myWorker.postMessage('ali'); */ } + logDeviceInfo = async () => { + const info = await Device.getInfo(); + + console.log('Device info',info); + }; + updateList() { /* this.notificationsService.registerCallback( diff --git a/src/app/modals/profile/edit-profile/edit-profile.page.html b/src/app/modals/profile/edit-profile/edit-profile.page.html index 93d007657..dd5a6e265 100644 --- a/src/app/modals/profile/edit-profile/edit-profile.page.html +++ b/src/app/modals/profile/edit-profile/edit-profile.page.html @@ -72,9 +72,9 @@ - diff --git a/src/app/modals/profile/profile.page.ts b/src/app/modals/profile/profile.page.ts index d585e8d37..926fe61f9 100644 --- a/src/app/modals/profile/profile.page.ts +++ b/src/app/modals/profile/profile.page.ts @@ -10,6 +10,7 @@ import { NotificationsService } from '../../services/notifications.service'; import { SessionStore } from 'src/app/store/session.service'; import { EventTrigger } from '../../services/eventTrigger.service'; import { ThemeService } from 'src/app/services/theme.service' +import { SortService } from 'src/app/services/functions/sort.service'; @Component({ selector: 'app-profile', @@ -41,7 +42,8 @@ export class ProfilePage implements OnInit { private notificationservice: NotificationsService, private platform: Platform, private eventtrigger: EventTrigger, - public ThemeService: ThemeService + public ThemeService: ThemeService, + private sortService: SortService, ) { this.loggeduser = authService.ValidatedUser; diff --git a/src/app/pages/agenda/agenda.page.ts b/src/app/pages/agenda/agenda.page.ts index 07ae8a76f..136a6a819 100644 --- a/src/app/pages/agenda/agenda.page.ts +++ b/src/app/pages/agenda/agenda.page.ts @@ -161,6 +161,7 @@ export class AgendaPage implements OnInit { dropdownScrollWeal = false CalendarStore = CalendarStore listToPresent + array = [] constructor( private alertCtrl: AlertController, @@ -232,6 +233,8 @@ export class AgendaPage implements OnInit { ngOnInit() { + this.getFromDB(); + const pathname = window.location.pathname let realoadCounter = 0 this.router.events.forEach((event) => { @@ -240,14 +243,14 @@ export class AgendaPage implements OnInit { this.segment = "Combinado"; } if (realoadCounter != 0) { - this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate); + //this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate); } realoadCounter++; } }); this.backgroundservice.registerBackService('Online', () => { - this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate); + //this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate); }); window.onresize = (event) => { @@ -487,6 +490,7 @@ export class AgendaPage implements OnInit { } loadRangeEvents(startTime: Date, endTime: Date) { + this.array = []; this.rangeStartDate = startTime this.rangeEndDate = endTime @@ -514,6 +518,7 @@ export class AgendaPage implements OnInit { this.TimelineMDList = this.listBoxService.list(this.listToPresent, 'md', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate }) + console.log('check list to present data', this.listToPresent); this.myCal.update(); this.myCal.loadEvents(); @@ -540,13 +545,17 @@ export class AgendaPage implements OnInit { this.TimelineMDList = this.listBoxService.list(this.listToPresent, 'pr', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate }) + console.log('check list to present data', this.listToPresent); this.myCal.update(); this.myCal.loadEvents(); this.showLoader = false; this.showTimeline = true; - }).finally(() => { + }).catch((error) => { + this.getFromDB() + }) + .finally(() => { this.showLoader = false; }) @@ -567,6 +576,7 @@ export class AgendaPage implements OnInit { this.TimelineMDList = this.listBoxService.list(this.listToPresent, 'pr', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate }) + console.log('check list to present data', this.listToPresent); this.myCal.update(); this.myCal.loadEvents(); @@ -603,6 +613,7 @@ export class AgendaPage implements OnInit { this.TimelineMDList = this.listBoxService.list(this.listToPresent, 'md', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate }) + console.log('check list to present data', this.listToPresent); this.myCal.update(); this.myCal.loadEvents(); @@ -614,7 +625,10 @@ export class AgendaPage implements OnInit { } - }).finally(() => { + }).catch((error) => { + this.getFromDB() + }) + .finally(() => { counter++; if (counter == 2) { this.showLoader = false; @@ -633,6 +647,8 @@ export class AgendaPage implements OnInit { this.TimelinePRList = this.listBoxService.list(this.listToPresent, 'pr', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate }) + console.log('check list to present data', this.listToPresent); + this.myCal.update(); this.myCal.loadEvents(); @@ -644,7 +660,10 @@ export class AgendaPage implements OnInit { this.showLoader = false; } - }).finally(() => { + }).catch((error) => { + this.getFromDB() + }) + .finally(() => { counter++; if (counter == 2) { this.showLoader = false; @@ -674,6 +693,7 @@ export class AgendaPage implements OnInit { this.TimelinePRList = this.listBoxService.list(this.listToPresent, 'pr', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate }) + console.log('check list to present data', this.listToPresent); this.myCal.update(); this.myCal.loadEvents(); @@ -685,7 +705,10 @@ export class AgendaPage implements OnInit { this.showLoader = false; } - }).finally(() => { + }).catch((error) => { + this.getFromDB() + }) + .finally(() => { if (counter == 1 || this.loggeduser.Profile == 'PR') { this.showLoader = false; } @@ -697,7 +720,6 @@ export class AgendaPage implements OnInit { } trasnformData(response,profile) { - let array = [] response.forEach(element => { let event = { startTime: new Date(element.StartDate), @@ -708,10 +730,9 @@ export class AgendaPage implements OnInit { profile: profile, id: element.EventId, } - array.push(event) + this.array.push(event) }); - - this.listToPresent = array; + this.listToPresent = this.array; console.log('LIST TO PRESET', this.listToPresent) } @@ -992,7 +1013,6 @@ export class AgendaPage implements OnInit { this.postEvent = data.event; this.mobileComponent.showEditEvent = true; - } this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate); @@ -1147,7 +1167,7 @@ export class AgendaPage implements OnInit { async closeComponentEditEventOrAdd() { if (this.IsEvent = 'edit') { - // this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate); + this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate); this.eventClicked(this.viewingEventObject); } else if (this.IsEvent = 'add') { this.cloneAllmobileComponent(); diff --git a/src/app/pages/events/events.page.html b/src/app/pages/events/events.page.html index 7ad906034..9792c8a6c 100644 --- a/src/app/pages/events/events.page.html +++ b/src/app/pages/events/events.page.html @@ -1,8 +1,8 @@ - + - +

{{customDate}}

diff --git a/src/app/pages/events/events.page.scss b/src/app/pages/events/events.page.scss index 3080ac852..0a534d223 100644 --- a/src/app/pages/events/events.page.scss +++ b/src/app/pages/events/events.page.scss @@ -275,6 +275,7 @@ ion-toolbar{ // new .main{ padding: 0px em(20px); + background: linear-gradient(270deg, var(--color2) 100%, var(--color3) 100%, var(--color4) 100%, var(--color5) 100%) !important; } .event-number{ @@ -402,8 +403,8 @@ ion-toolbar{ display: flex; justify-content: space-between; align-items: center; - background-color: transparent !important; - --background: transparent !important; + background-color: transparent; + --background: transparent; .schedule-time{ margin-right: 10px; .time-start{ diff --git a/src/app/pages/gabinete-digital/despachos-pr/despacho-pr/despacho-pr.page.ts b/src/app/pages/gabinete-digital/despachos-pr/despacho-pr/despacho-pr.page.ts index 8cd38b474..d295e2e60 100644 --- a/src/app/pages/gabinete-digital/despachos-pr/despacho-pr/despacho-pr.page.ts +++ b/src/app/pages/gabinete-digital/despachos-pr/despacho-pr/despacho-pr.page.ts @@ -448,6 +448,7 @@ export class DespachoPrPage implements OnInit { else if (actionName == 'Reexecução') { await this.reexecutar(res.data.note, docs); } + this.goBack(); } }); diff --git a/src/app/pages/gabinete-digital/despachos-pr/despachos-pr.page.ts b/src/app/pages/gabinete-digital/despachos-pr/despachos-pr.page.ts index 80fa3d4be..a237e0c7e 100644 --- a/src/app/pages/gabinete-digital/despachos-pr/despachos-pr.page.ts +++ b/src/app/pages/gabinete-digital/despachos-pr/despachos-pr.page.ts @@ -157,8 +157,9 @@ export class DespachosPrPage implements OnInit { } this.despachoList.push(task); - console.log(this.despachoList); }); + + this.despachoList = this.sortService.sortDate(this.despachoList, 'CreateDate') this.listToPresent = this.despachoList }, (error) => { diff --git a/src/app/pages/gabinete-digital/diplomas-assinar/diplomas-assinar.page.ts b/src/app/pages/gabinete-digital/diplomas-assinar/diplomas-assinar.page.ts index e9cfdf5ca..564ea7b51 100644 --- a/src/app/pages/gabinete-digital/diplomas-assinar/diplomas-assinar.page.ts +++ b/src/app/pages/gabinete-digital/diplomas-assinar/diplomas-assinar.page.ts @@ -80,13 +80,14 @@ export class DiplomasAssinarPage implements OnInit { let diplomas = await this.processes.GetTasksList("Despacho do Presidente da República", false).toPromise(); this.diplomasList = []; - let diplomasAssinar = diplomas.reverse().filter(data => data.activityInstanceName == "Assinar Diploma"); - diplomasAssinar = this.sortService.sortArrayISODate(diplomasAssinar); + let diplomasAssinar = diplomas.filter(data => data.activityInstanceName == "Assinar Diploma"); diplomasAssinar.forEach(element => { let task: customTask = this.customTaskPipe.transform(element) this.diplomasList.push(task); }); + this.diplomasList = this.sortService.sortDate(this.diplomasList, 'CreateDate') + this.skeletonLoader = false this.showLoader = false; diff --git a/src/app/pages/gabinete-digital/diplomas/diplomas.page.html b/src/app/pages/gabinete-digital/diplomas/diplomas.page.html index b5b84d976..2fb25a676 100644 --- a/src/app/pages/gabinete-digital/diplomas/diplomas.page.html +++ b/src/app/pages/gabinete-digital/diplomas/diplomas.page.html @@ -16,10 +16,10 @@ - Por validar + Por validar ... - Assinados PR + Assinados PR ... diff --git a/src/app/pages/gabinete-digital/diplomas/diplomas.page.ts b/src/app/pages/gabinete-digital/diplomas/diplomas.page.ts index 49a5df6e8..5f49173e7 100644 --- a/src/app/pages/gabinete-digital/diplomas/diplomas.page.ts +++ b/src/app/pages/gabinete-digital/diplomas/diplomas.page.ts @@ -182,7 +182,6 @@ export class DiplomasPage implements OnInit, OnDestroy { this.skeletonLoader = false this.showLoader = false; - let diplomasValidar = diplomas.filter(data => data.activityInstanceName == "Revisar Diploma"); let diplomasList = []; diplomasValidar.forEach(async element => { @@ -191,18 +190,19 @@ export class DiplomasPage implements OnInit, OnDestroy { diplomasList.push(task); }); - this.diplomasList = this.sortService.sortArrayISODate(diplomasList.reverse()); + + this.diplomasList = this.sortService.sortDate(diplomasList, 'CreateDate'); + let diplomasAssinados = diplomas.filter(data => data.activityInstanceName == "Diploma Assinado"); + let diplomasAssinadoList = []; - 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.sortService.sortArrayISODate(diplomasAssinadoList).reverse(); + + this.diplomasAssinadoList = this.sortService.sortDate(diplomasAssinadoList, 'CreateDate') }, (error) => { this.getFromDb() @@ -220,21 +220,21 @@ export class DiplomasPage implements OnInit, OnDestroy { let task = this.pipeTaskOffline(element) diplomasList.push(task); + }); - }); - console.log(diplomasList); + console.log(diplomasList); + this.diplomasList = this.sortService.sortDate(diplomasList, 'taskStartDate'); - this.diplomasList = this.sortService.sortArrayISODate(diplomasList).reverse(); - - let diplomasAssinados = process.reverse().filter(data => data.activityInstanceName == "Diploma Assinado"); + let diplomasAssinados = process.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.sortService.sortArrayISODate(diplomasAssinadoList).reverse(); + let task = this.pipeTaskOffline(element) + diplomasAssinadoList.push(task); + }); + + console.log('diplomasAssinados', diplomasAssinados) + this.diplomasAssinadoList = this.sortService.sortDate(diplomasAssinadoList, 'taskStartDate') }) } diff --git a/src/app/pages/gabinete-digital/event-list/event-list.page.ts b/src/app/pages/gabinete-digital/event-list/event-list.page.ts index 444e0e291..aa7a02372 100644 --- a/src/app/pages/gabinete-digital/event-list/event-list.page.ts +++ b/src/app/pages/gabinete-digital/event-list/event-list.page.ts @@ -84,14 +84,13 @@ export class EventListPage implements OnInit { this.platform.ready().then(() => { this.sqliteservice.getListOfEventAprove('Agenda Oficial MDGPR', 'Agenda Pessoal MDGPR').then((event: any[]) => { - this.eventsMDGPRList = this.sortService.sortArrayByDate(event).reverse() + this.eventsMDGPRList = this.sortService.sortDate(event, 'taskStartDate') - console.log("All evento to aprove from db ", event) }) this.sqliteservice.getListOfEventAprove('Agenda Oficial PR', 'Agenda Pessoal PR').then((event: any[]) => { - this.eventsPRList = this.sortService.sortArrayByDate(event).reverse() - console.log("All evento to aprove from db ", event) + this.eventsPRList = this.sortService.sortDate(event, 'taskStartDate') + }) }) console.log('Offlineee') @@ -111,14 +110,14 @@ export class EventListPage implements OnInit { let mdEventsOficial = await this.processes.GetTasksList('Agenda Oficial MDGPR', false).toPromise(); let mdEventsPessoal = await this.processes.GetTasksList('Agenda Pessoal MDGPR', false).toPromise(); this.eventsMDGPRList = mdEventsOficial.concat(mdEventsPessoal); - this.eventsMDGPRList = this.sortService.sortArrayByDate(this.eventsMDGPRList).reverse() + this.eventsMDGPRList = this.sortService.sortDate(this.eventsMDGPRList, 'taskStartDate') 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.sortArrayByDate(this.eventsPRList).reverse(); + this.eventsPRList = this.sortService.sortDate(this.eventsPRList, 'taskStartDate') this.eventaprovacaostore.resetpr(this.sortService.sortArrayByDate(this.eventsPRList).reverse()); } this.showLoader = false; diff --git a/src/app/pages/gabinete-digital/expediente/expediente.page.ts b/src/app/pages/gabinete-digital/expediente/expediente.page.ts index 3f165a4a1..fbb867aa7 100644 --- a/src/app/pages/gabinete-digital/expediente/expediente.page.ts +++ b/src/app/pages/gabinete-digital/expediente/expediente.page.ts @@ -8,7 +8,7 @@ import { SqliteService } from 'src/app/services/sqlite.service'; 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'; @Component({ selector: 'app-expediente', @@ -38,7 +38,8 @@ export class ExpedientePage implements OnInit { public platform: Platform, private sqliteservice: SqliteService, private backgroundservice: BackgroundService, - public ThemeService: ThemeService + public ThemeService: ThemeService, + private sortService: SortService, ) { } ngOnInit() { @@ -70,7 +71,7 @@ export class ExpedientePage implements OnInit { const result = res this.taskslist = new Array(); - let ress = result.reverse().filter((data: any) => data.workflowInstanceDataFields.Status == "Active"); + let ress = result.filter((data: any) => data.workflowInstanceDataFields.Status == "Active"); ress.forEach((element: any) => { @@ -78,7 +79,7 @@ export class ExpedientePage implements OnInit { this.taskslist.push(task); this.addProcessTODb(task); }); - this.listToPresent = this.taskslist + this.listToPresent = this.sortService.sortDate(this.taskslist, 'taskStartDate') console.log('expediente list', this.listToPresent) this.skeletonLoader = false; diff --git a/src/app/pages/gabinete-digital/expedientes-pr/expedientes-pr.page.ts b/src/app/pages/gabinete-digital/expedientes-pr/expedientes-pr.page.ts index 590200750..9ce1fd431 100644 --- a/src/app/pages/gabinete-digital/expedientes-pr/expedientes-pr.page.ts +++ b/src/app/pages/gabinete-digital/expedientes-pr/expedientes-pr.page.ts @@ -12,7 +12,7 @@ import { Location } from '@angular/common' 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'; @Component({ selector: 'app-expedientes-pr', @@ -41,7 +41,8 @@ export class ExpedientesPrPage implements OnInit { private authService: AuthService, private router: Router, private location: Location, - public ThemeService: ThemeService + public ThemeService: ThemeService, + private sortService: SortService, ) { this.loggeduser = authService.ValidatedUser; } @@ -80,6 +81,8 @@ export class ExpedientesPrPage implements OnInit { this.taskslist.push(task); }); console.log(this.taskslist); + + this.taskslist = this.sortService.sortDate(this.taskslist, 'CreateDate') this.expedienteGdStore.reset(this.taskslist); this.skeletonLoader = false }) diff --git a/src/app/pages/gabinete-digital/gabinete-digital.page.ts b/src/app/pages/gabinete-digital/gabinete-digital.page.ts index 96aa9f284..2d701a46d 100644 --- a/src/app/pages/gabinete-digital/gabinete-digital.page.ts +++ b/src/app/pages/gabinete-digital/gabinete-digital.page.ts @@ -29,6 +29,7 @@ import { ThemeService } from 'src/app/services/theme.service' import { SqliteService } from '../../services/sqlite.service'; import { Platform } from '@ionic/angular'; import { BackgroundService } from 'src/app/services/background.service'; +import { SortService } from 'src/app/services/functions/sort.service'; @Component({ selector: 'app-gabinete-digital', @@ -130,7 +131,8 @@ export class GabineteDigitalPage implements OnInit, DoCheck { private platform: Platform, private changeProfileService: ChangeProfileService, private backgroundservice: BackgroundService, - public ThemeService: ThemeService + public ThemeService: ThemeService, + private sortService: SortService, ) { this.loggeduser = authService.ValidatedUser; @@ -146,10 +148,6 @@ export class GabineteDigitalPage implements OnInit, DoCheck { }; this.checkRoutes(); - - // this.eventoaprovacaostore.resetmd([]) - // this.eventoaprovacaostore.resetpr([]) - } ngDoCheck(): void { @@ -209,64 +207,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck { } async loadAllProcesses() { - - this.processesbackend.GetTasksList("", false).subscribe(async res => { - - let allProcessesList = await this.processesbackend.GetTasksList("", false).toPromise(); - - allProcessesList = allProcessesList.filter(element => element.activityInstanceName != 'Conhecimento') - - 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') - } - - 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; - + this.LoadCounts(); } addProcessToDB(data) { @@ -330,7 +271,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck { this.allProcessesList.push(task); this.allProcessesList = removeDuplicate(this.allProcessesList) - this.allProcessesList = this.sortArrayISODate(this.allProcessesList).reverse(); + this.allProcessesList = this.sortService.sortDate(this.allProcessesList, 'CreateDate') }); console.log("All process from db ", allprocess) @@ -345,21 +286,18 @@ export class GabineteDigitalPage implements OnInit, DoCheck { setFormatDate(start: any, end: any, allday: boolean) { let customDate; - /* start = new Date(); - end= new Date("2021-08-04T18:01:04.753Z"); */ - //end = new Date("2021-09-04T18:01:04.753Z"); const totalSeconds = Math.floor((end - (start)) / 1000);; const totalMinutes = Math.floor(totalSeconds / 60); const totalHours = Math.floor(totalMinutes / 60); const totalDays = Math.floor(totalHours / 24); - const hours = totalHours - (totalDays * 24); - const minutes = totalMinutes - (totalDays * 24 * 60) - (hours * 60); - const seconds = totalSeconds - (totalDays * 24 * 60 * 60) - (hours * 60 * 60) - (minutes * 60); + //const hours = totalHours - (totalDays * 24); + //const minutes = totalMinutes - (totalDays * 24 * 60) - (hours * 60); + // const seconds = totalSeconds - (totalDays * 24 * 60 * 60) - (hours * 60 * 60) - (minutes * 60); - let diffDays = totalDays; - let diffMinutes = minutes; + // let diffDays = totalDays; + // let diffMinutes = minutes; if (totalDays == 0) { if (allday) { @@ -385,6 +323,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck { (thedate.getMonth() + 1) + "/" + thedate.getFullYear(); } + getCustomHours(thedate: Date) { return thedate.getHours() + ":" + thedate.getMinutes(); @@ -551,8 +490,49 @@ export class GabineteDigitalPage implements OnInit, DoCheck { this.showLoader = true; let allPreocesses_ = await this.processesbackend.GetTasksList("", false).toPromise(); - let count_all_processes = Object.keys(allPreocesses_).length; + let allProcessesList = allPreocesses_; + allProcessesList = allProcessesList.filter(element => element.activityInstanceName != 'Conhecimento') + + 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.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.sortService.sortDate(this.allProcessesList, 'CreateDate') + + }); let expedientes = await this.processesbackend.GetTaskListExpediente(false).toPromise(); expedientes = expedientes.filter(data => data.workflowInstanceDataFields.Status == "Active") @@ -582,6 +562,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck { let despachospr = await this.processesbackend.GetTasksList("Despacho do Presidente da República", false).toPromise(); let despachosPr; + switch (this.loggeduser.Profile) { case 'MDGPR': despachosPr = despachospr.filter(data => data.activityInstanceName == "Tarefa de Despacho").filter(data => data.workflowInstanceDataFields.Status == "Active"); @@ -595,23 +576,18 @@ export class GabineteDigitalPage implements OnInit, DoCheck { break; } - let mdEventsOficial = await this.processesbackend.GetTasksList('Agenda Oficial MDGPR', false).toPromise(); let mdEventsPessoal = await this.processesbackend.GetTasksList('Agenda Pessoal MDGPR', false).toPromise(); const eventsMDGPRList = mdEventsOficial.concat(mdEventsPessoal); this.eventoaprovacaostore.countMd = eventsMDGPRList.length this.eventoaprovacaostore.resetmd(eventsMDGPRList); - - let prEventsOficial = await this.processesbackend.GetTasksList('Agenda Oficial PR', false).toPromise(); let prEventsPessoal = await this.processesbackend.GetTasksList('Agenda Pessoal PR', false).toPromise(); const eventsPRList = prEventsOficial.concat(prEventsPessoal); this.eventoaprovacaostore.countPr = eventsPRList.length this.eventoaprovacaostore.resetpr(eventsPRList); - - let diplomasValidar = despachospr.filter(data => data.activityInstanceName == "Revisar Diploma"); this.count_dip_pv = Object.keys(diplomasValidar).length; this.deplomasStore.resetDiplomasReview(diplomasValidar) @@ -622,7 +598,6 @@ export class GabineteDigitalPage implements OnInit, DoCheck { this.deplomasStore.resetDiplomasList(diplomasAssinar) - let diplomasAssinados = despachospr.filter(data => data.activityInstanceName == "Diploma Assinado"); this.count_dip_as_pr = Object.keys(diplomasAssinados).length; this.deplomasStore.resetDiplomasAssinadoList(diplomasAssinados) @@ -641,22 +616,8 @@ export class GabineteDigitalPage implements OnInit, DoCheck { doRefresh(event) { console.log(event); - - // this.closeAllDesktopComponents(); - /* switch(this.loggeduser.Profile){ - case 'MDGPR': - this.selectedElement='Correspondence'; - this.showExpedients = true; - this.expedientesPage.doRefresh(); - break; - case 'PR': - this.selectedElement='ExpedientesPr'; - this.showExpedientesPr = true; - break; - } */ - this.LoadCounts(); - this.loadAllProcesses(); - //this.refreshExpedientes(); + + this.LoadCounts(); if (event) { setTimeout(() => { diff --git a/src/app/pages/gabinete-digital/pedidos/pedidos.page.ts b/src/app/pages/gabinete-digital/pedidos/pedidos.page.ts index 81e1b863b..0f115b020 100644 --- a/src/app/pages/gabinete-digital/pedidos/pedidos.page.ts +++ b/src/app/pages/gabinete-digital/pedidos/pedidos.page.ts @@ -164,7 +164,7 @@ export class PedidosPage implements OnInit { }); this.addPedidoToDb(this.parecerList); - this.listToPresentparecerList = this.sortService.sortArrayISODate(this.parecerList); + this.listToPresentparecerList = this.sortService.sortDate(this.parecerList, 'CreateDate') this.pedidosstorage.resetparecer(this.listToPresentparecerList); } @@ -205,7 +205,7 @@ export class PedidosPage implements OnInit { }); }); this.addPedidoToDb(this.deferimentoList); - this.listToPresentdeferimentoList = this.sortService.sortArrayISODate(this.deferimentoList); + this.listToPresentdeferimentoList = this.sortService.sortDate(this.deferimentoList, 'CreateDate') this.pedidosstorage.resetdeferimento(this.listToPresentdeferimentoList); } diff --git a/src/app/pages/gabinete-digital/pendentes/pendentes.page.ts b/src/app/pages/gabinete-digital/pendentes/pendentes.page.ts index a9ecba812..c06053412 100644 --- a/src/app/pages/gabinete-digital/pendentes/pendentes.page.ts +++ b/src/app/pages/gabinete-digital/pendentes/pendentes.page.ts @@ -102,7 +102,7 @@ export class PendentesPage implements OnInit { }); pendentesList = removeDuplicate(pendentesList) - pendentesList = this.sortService.sortArrayISODate(pendentesList); + pendentesList = this.sortService.sortDate(pendentesList, 'CreateDate'); this.listToPresent = pendentesList; this.skeletonLoader = false; @@ -138,7 +138,7 @@ export class PendentesPage implements OnInit { } }); - pendingList = pendingList; + pendingList = this.sortService.sortDate(pendingList, 'CreateDate'); this.listToPresent = pendingList; console.log('pendentes', pendingList) diff --git a/src/app/pages/inactivity/inactivity.page.ts b/src/app/pages/inactivity/inactivity.page.ts index 324212a46..7b52d83da 100644 --- a/src/app/pages/inactivity/inactivity.page.ts +++ b/src/app/pages/inactivity/inactivity.page.ts @@ -192,9 +192,9 @@ export class InactivityPage implements OnInit { goback() { const pathName = this.SessionStore.user.UrlBeforeInactivity if(pathName) { - this.router.navigate([pathName]); + this.router.navigate([pathName],{replaceUrl: true}); } else { - this.router.navigate(['/home/events']); + this.router.navigate(['/home/events'], {replaceUrl: true}); } } diff --git a/src/app/pages/publications/new-publication/new-publication.page.ts b/src/app/pages/publications/new-publication/new-publication.page.ts index 86cbc5186..682cc6a9e 100644 --- a/src/app/pages/publications/new-publication/new-publication.page.ts +++ b/src/app/pages/publications/new-publication/new-publication.page.ts @@ -19,6 +19,7 @@ import { ThemeService } from 'src/app/services/theme.service'; import { Camera, CameraResultType, CameraSource, Photo } from '@capacitor/camera'; import { Filesystem, Directory } from '@capacitor/filesystem'; +import { NgxImageCompressService } from "ngx-image-compress"; const IMAGE_DIR = 'stored-images'; @@ -72,6 +73,9 @@ export class NewPublicationPage implements OnInit { capturedImageTitle: any; public photos: any[] = []; + imgResultBeforeCompress: string; + imgResultAfterCompress: string; + constructor( private modalController: ModalController, public photoService: PhotoService, @@ -83,6 +87,7 @@ export class NewPublicationPage implements OnInit { public ThemeService: ThemeService, private platform: Platform, private loadingCtrl: LoadingController, + public imageCompress: NgxImageCompressService ) { this.publicationType = this.navParams.get('publicationType'); @@ -104,13 +109,13 @@ export class NewPublicationPage implements OnInit { async takePicture() { const image = await Camera.getPhoto({ - quality: 50, + quality: 20, allowEditing: false, width:50, height: 50, resultType: CameraResultType.Uri, source: CameraSource.Camera // Camera, Photos or Prompt! - + }); if (image) { @@ -120,13 +125,13 @@ export class NewPublicationPage implements OnInit { } - imageSize(image){ - var canvas = document.createElement('canvas'); - var ctx = canvas.getContext('2d'); - canvas.width=100 - canvas.height=34 - ctx.drawImage(image, 0, 0, 100, 34); - document.body.appendChild(canvas); + imageSize(image) { + var canvas = document.createElement('canvas'); + var ctx = canvas.getContext('2d'); + canvas.width = 100 + canvas.height = 34 + ctx.drawImage(image, 0, 0, 100, 34); + document.body.appendChild(canvas); } convertBlobToBase64 = (blob: Blob) => new Promise((resolve, reject) => { @@ -394,9 +399,13 @@ export class NewPublicationPage implements OnInit { async selectImage() { const image = await Camera.getPhoto({ +<<<<<<< HEAD quality: 50, width:50, height:50, +======= + quality: 20, +>>>>>>> 6a912b740d97159664c5fe5dff07ac378b028771 allowEditing: false, resultType: CameraResultType.Uri, source: CameraSource.Camera // Camera, Photos or Prompt! @@ -407,7 +416,7 @@ export class NewPublicationPage implements OnInit { } } - + // Create a new file from a capture image async saveImage(photo: Photo) { @@ -496,12 +505,43 @@ export class NewPublicationPage implements OnInit { this.capturedImage = this.images[0].data + this.compressFile(); + loading.dismiss(); } + /* compressImage() { + let image = this.capturedImage; + this.imageCompress.compressFile(image, orientation, 50, 50,).then(() => { + this.imgResultBeforeCompress = image; + console.log('Size in bytes was:', this.imageCompress.byteCount(image)); + + this.imageCompress.compressFile(image, orientation, 50, 50).then( + result => { + this.imgResultAfterCompress = result; + console.log('Size in bytes is now:', this.imageCompress.byteCount(result)); + } + ); + }) + } */ + + compressFile() { + + //this.imgResultBeforeCompress = image; + this.imageCompress.getOrientation(this.capturedImage).then((orientation) => { + console.log('Size in bytes was:', this.imageCompress.byteCount(this.capturedImage)); + this.imageCompress.compressFile(this.capturedImage, orientation, 20, 20).then( + result => { + this.capturedImage = result; + console.log('Size in bytes is now:', this.imageCompress.byteCount(result)); + } + ); + + }); + } + - } diff --git a/src/app/pages/publications/publications.page.html b/src/app/pages/publications/publications.page.html index 6d802fcb7..9951a3376 100644 --- a/src/app/pages/publications/publications.page.html +++ b/src/app/pages/publications/publications.page.html @@ -66,7 +66,7 @@ diff --git a/src/app/pages/publications/view-publications/view-publications.page.html b/src/app/pages/publications/view-publications/view-publications.page.html index dfc615f99..797982d9b 100644 --- a/src/app/pages/publications/view-publications/view-publications.page.html +++ b/src/app/pages/publications/view-publications/view-publications.page.html @@ -39,7 +39,11 @@ (click)="goToPublicationDetail(publication.DocumentId)" >
+<<<<<<< HEAD image +======= + +>>>>>>> 6a912b740d97159664c5fe5dff07ac378b028771
image diff --git a/src/app/pages/publications/view-publications/view-publications.page.ts b/src/app/pages/publications/view-publications/view-publications.page.ts index d075c390e..01681f05f 100644 --- a/src/app/pages/publications/view-publications/view-publications.page.ts +++ b/src/app/pages/publications/view-publications/view-publications.page.ts @@ -69,6 +69,7 @@ export class ViewPublicationsPage implements OnInit { this.folderId = this.folderId['ProcessId'] } +<<<<<<< HEAD if (typeof (this.id) == 'object') { this.id = this.id['ProcessId'] @@ -78,11 +79,17 @@ export class ViewPublicationsPage implements OnInit { setTimeout(() => { this.testForkJoin() // this.getPublications(); +======= + this.getPublicationsIds() + this.getPublicationDetail(); + setTimeout(() => { + this.getPublicationsIds(); +>>>>>>> 6a912b740d97159664c5fe5dff07ac378b028771 }, 1000); - this.backgroundservice.registerBackService('Online',() => { + this.backgroundservice.registerBackService('Online', () => { this.getPublicationDetail(); - this.getPublications(); + this.getPublicationsIds(); }) @@ -99,15 +106,23 @@ export class ViewPublicationsPage implements OnInit { // } this.testForkJoin() this.getPublicationDetail(); +<<<<<<< HEAD // this.getPublications(); +======= + this.getPublicationsIds(); +>>>>>>> 6a912b740d97159664c5fe5dff07ac378b028771 } doRefresh = (event) => { setTimeout(() => { this.testForkJoin() this.getPublicationDetail(); +<<<<<<< HEAD // this.getPublications(); +======= + this.getPublicationsIds(); +>>>>>>> 6a912b740d97159664c5fe5dff07ac378b028771 event.target.complete(); }, 3000); @@ -146,6 +161,7 @@ export class ViewPublicationsPage implements OnInit { this.publicationList = new Array(); +<<<<<<< HEAD res.forEach(element => { console.log('getPublications', element) let item: Publication = this.publicationPipe.itemList(element) @@ -171,6 +187,59 @@ export class ViewPublicationsPage implements OnInit { }); } // goes to fork +======= + getPublicationsIds() { + + this.showLoader = true; + const folderId = this.folderId + + this.publications.GetPublicationsID(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); + }) + } + + /* res.forEach(element => { + console.log('publications elements', element) + this.publications.GetPublicationById(element).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(ress); + }) + + }); */ + + this.sqliteservice.updateactions(this.folderId, JSON.stringify(this.publicationList)); + + this.publicationListStorage.add(folderId, this.publicationList) + this.getpublication = this.publicationList; + + this.showLoader = false; + + /* this.publicationList = new Array(); + + res.forEach(element => { + console.log('getPublications', element) + let item: Publication = this.publicationPipe.itemList(element) + this.publicationList.push(item); + }); + this.sqliteservice.updateactions(this.folderId, JSON.stringify(this.publicationList)); + + this.publicationListStorage.add(folderId, this.publicationList) + this.getpublication = this.publicationList; */ + }); + } + +>>>>>>> 6a912b740d97159664c5fe5dff07ac378b028771 getPublications() { this.showLoader = true; @@ -186,6 +255,8 @@ export class ViewPublicationsPage implements OnInit { console.log('getPublications', element) let item: Publication = this.publicationPipe.itemList(element) this.publicationList.push(item); + console.log('getPublications 222', item) + }); this.sqliteservice.updateactions(this.folderId, JSON.stringify(this.publicationList)); @@ -195,7 +266,7 @@ export class ViewPublicationsPage implements OnInit { this.showLoader = false; }, (error) => { - if(error.status == '0') { + if (error.status == '0') { this.getFromDB(); } if (error.status == '404') { @@ -285,7 +356,7 @@ export class ViewPublicationsPage implements OnInit { }); await modal.present(); modal.onDidDismiss().then(() => { - this.getPublications(); + this.getPublicationsIds(); }); } diff --git a/src/app/services/agenda/list-box.service.ts b/src/app/services/agenda/list-box.service.ts index c1e6c663c..8070c3a21 100644 --- a/src/app/services/agenda/list-box.service.ts +++ b/src/app/services/agenda/list-box.service.ts @@ -12,7 +12,7 @@ export class ListBoxService { ){} - filterProfile(eventSource: EventListStore[], profile: 'md' | 'pr' | 'all') { + filterProfile(eventSource: EventListStore[] = [], profile: 'md' | 'pr' | 'all') { return eventSource.filter((e) => e.profile == profile) } @@ -160,14 +160,12 @@ export class ListBoxService { } - push(event: any, selectedDate: Date) { - - console.log(new Date(event.start).getDate(), selectedDate.getDate(), new Date(event.start).getDate() >= selectedDate.getDate()) + push(event: any, selectedDate: Date) { - return new Date(event.start).getMonth() == selectedDate.getMonth() && - new Date(event.start).getFullYear() == selectedDate.getFullYear() && - new Date(event.start).getDate() >= selectedDate.getDate() - } + return new Date(event.start).getMonth() == selectedDate.getMonth() && + new Date(event.start).getFullYear() == selectedDate.getFullYear() && + new Date(event.start).getDate() >= selectedDate.getDate() + } encapsulation(eventsList:EventListStore[], profile): CustomCalendarEvent[] { diff --git a/src/app/services/background.service.ts b/src/app/services/background.service.ts index e1670c200..acd6153ec 100644 --- a/src/app/services/background.service.ts +++ b/src/app/services/background.service.ts @@ -1,5 +1,6 @@ import { Injectable } from '@angular/core'; import { ThemeService } from 'src/app/services/theme.service'; +import { StorageService} from 'src/app/services/storage.service'; @Injectable({ providedIn: 'root' @@ -13,7 +14,8 @@ export class BackgroundService { }[] = [] constructor( - private themeservice: ThemeService + private themeservice: ThemeService, + private storageservice: StorageService ) { } online() { @@ -24,6 +26,7 @@ export class BackgroundService { document.body.style.setProperty(`--color3`, "#d9d9d9"); document.body.style.setProperty(`--color4`, "#d9d9d9ee"); document.body.style.setProperty(`--color5`, "#ececec"); + this.storageservice.store('networkCheckStore','online'); } else { document.body.style.setProperty(`--color`, "#0782C9"); @@ -31,6 +34,7 @@ export class BackgroundService { document.body.style.setProperty(`--color3`, "#0782C9"); document.body.style.setProperty(`--color4`, "#0782c9f0"); document.body.style.setProperty(`--color5`, "#45BAFF"); + this.storageservice.store('networkCheckStore','online'); } this.callBacks.forEach((e) => { @@ -46,6 +50,7 @@ export class BackgroundService { document.body.style.setProperty(`--color3`, "#ffb703"); document.body.style.setProperty(`--color4`, "#ffb703"); document.body.style.setProperty(`--color5`, "#ffb703"); + this.storageservice.store('networkCheckStore','offline'); this.callBacks.forEach((e) => { if (e.type == 'Offline') { e.funx() diff --git a/src/app/services/date.service.ts b/src/app/services/date.service.ts index 2895fea2d..c1c98e440 100644 --- a/src/app/services/date.service.ts +++ b/src/app/services/date.service.ts @@ -7,7 +7,6 @@ export class DateService { constructor() { } - deferenceBetweenDays(start: any, end: any) { const diffTime = Math.abs(end - start); return Math.ceil(diffTime / (1000 * 60 * 60 * 24)); diff --git a/src/app/services/functions/object.service.spec.ts b/src/app/services/functions/object.service.spec.ts new file mode 100644 index 000000000..ed7a3d76a --- /dev/null +++ b/src/app/services/functions/object.service.spec.ts @@ -0,0 +1,16 @@ +import { TestBed } from '@angular/core/testing'; + +import { ObjectService } from './object.service'; + +describe('ObjectService', () => { + let service: ObjectService; + + beforeEach(() => { + TestBed.configureTestingModule({}); + service = TestBed.inject(ObjectService); + }); + + it('should be created', () => { + expect(service).toBeTruthy(); + }); +}); diff --git a/src/app/services/functions/object.service.ts b/src/app/services/functions/object.service.ts new file mode 100644 index 000000000..9b52713c8 --- /dev/null +++ b/src/app/services/functions/object.service.ts @@ -0,0 +1,25 @@ +import { Injectable } from '@angular/core'; + +@Injectable({ + providedIn: 'root' +}) +export class ObjectService { + + constructor() { } + + + deepFind(obj, path) { + var paths = path.split('.') + , current = obj + , i; + + for (i = 0; i < paths.length; ++i) { + if (current[paths[i]] == undefined) { + return undefined; + } else { + current = current[paths[i]]; + } + } + return current; + } +} diff --git a/src/app/services/functions/sort.service.ts b/src/app/services/functions/sort.service.ts index 9d580897b..c248ff958 100644 --- a/src/app/services/functions/sort.service.ts +++ b/src/app/services/functions/sort.service.ts @@ -1,11 +1,12 @@ import { Injectable } from '@angular/core'; +import { ObjectService } from './object.service'; @Injectable({ providedIn: 'root' }) export class SortService { - constructor() { } + constructor(private ObjectService: ObjectService) { } sortArrayISODate(myArray: any) { if(myArray.length > 0){ @@ -14,6 +15,7 @@ export class SortService { }); } } + sortArrayByDate(myArray: any) { console.log(myArray[0].taskStartDate); if(myArray.length > 0){ @@ -22,4 +24,15 @@ export class SortService { }); } } + + sortDate(array = [], path: string) { + + return array.sort( (a,b)=> { + + return new Date(this.ObjectService.deepFind(b, path)).getTime() - + new Date(this.ObjectService.deepFind(a, path)).getTime() + + }) + + } } diff --git a/src/app/services/publications.service.ts b/src/app/services/publications.service.ts index aa1f17808..2bbea80b7 100644 --- a/src/app/services/publications.service.ts +++ b/src/app/services/publications.service.ts @@ -84,7 +84,24 @@ export class PublicationsService { return this.http.delete(`${geturl}`, options); } +<<<<<<< HEAD //this worker obervable goes to ForkJoin as a second api call +======= + GetPublicationsID(folder:any) { + const geturl = environment.apiURL + 'presidentialActions/'+ folder +'/posts/ids'; + let params = new HttpParams(); + + params = params.set("folderId", folder); + + let options = { + headers: this.headers, + params: params + }; + return this.http.get(`${geturl}`, options) + + } + +>>>>>>> 6a912b740d97159664c5fe5dff07ac378b028771 GetPublications(id:any){ const geturl = environment.apiURL + 'presidentialActions/'+ id +'/posts'; let params = new HttpParams(); @@ -117,11 +134,11 @@ export class PublicationsService { const geturl = environment.apiURL + 'presidentialActions/posts/'+ publicationId; let params = new HttpParams(); - /* params = params.set("id", publicationId); */ + params = params.set("id", publicationId); let options = { headers: this.headers, - /* params: params */ + params: params }; return this.http.get(`${geturl}`, options); } diff --git a/src/app/services/webnotifications.service.ts b/src/app/services/webnotifications.service.ts index db0818093..f67bdcd3e 100644 --- a/src/app/services/webnotifications.service.ts +++ b/src/app/services/webnotifications.service.ts @@ -24,8 +24,7 @@ export class WebNotificationsService { private animationController: AnimationController, private platform: Platform, private router: Router, - private toastService: ToastService, - private zone: NgZone) { } + private toastService: ToastService) { } webconnection() { diff --git a/src/app/shared/gabinete-digital/all-processes/all-processes.page.ts b/src/app/shared/gabinete-digital/all-processes/all-processes.page.ts index 612988024..e41d4bd93 100644 --- a/src/app/shared/gabinete-digital/all-processes/all-processes.page.ts +++ b/src/app/shared/gabinete-digital/all-processes/all-processes.page.ts @@ -75,14 +75,11 @@ export class AllProcessesPage implements OnInit { allProcessesList.forEach(element => { let date = new Date(element.taskStartDate); date.setMonth(date.getMonth() + 1); - let taskDate = date.getFullYear() + "-" + date.getMonth() + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds(); - let 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, @@ -95,10 +92,11 @@ export class AllProcessesPage implements OnInit { "Agenda": element.workflowInstanceDataFields.Agenda, "customDate": this.setFormatDate(new Date(element.workflowInstanceDataFields.StartDate), new Date(element.workflowInstanceDataFields.EndDate), element.workflowInstanceDataFields.IsAllDayEvent), } + this.allProcessesList.push(task); this.allProcessesList = removeDuplicate(this.allProcessesList) - //this.allProcessesList = this.sortArrayISODate(this.allProcessesList).reverse(); - this.allProcessesList = this.sortService.sortArrayISODate(this.allProcessesList).reverse(); + + this.allProcessesList = this.sortService.sortDate(this.allProcessesList, 'CreateDate'); }); diff --git a/src/app/shared/gabinete-digital/despachos-pr/despachos-pr.page.ts b/src/app/shared/gabinete-digital/despachos-pr/despachos-pr.page.ts index 1da06551a..c5a97201e 100644 --- a/src/app/shared/gabinete-digital/despachos-pr/despachos-pr.page.ts +++ b/src/app/shared/gabinete-digital/despachos-pr/despachos-pr.page.ts @@ -74,7 +74,7 @@ constructor ( despachoList.push(task); }); - despachoList = this.sortService.sortArrayISODate(despachoList).reverse() + despachoList = this.sortService.sortDate(despachoList, 'CreateDate') this.despachosprstore.reset(despachoList); this.skeletonLoader = false; diff --git a/src/app/shared/gabinete-digital/diplomas-assinar/diplomas-assinar.page.ts b/src/app/shared/gabinete-digital/diplomas-assinar/diplomas-assinar.page.ts index 247e6e8f2..047ba3e66 100644 --- a/src/app/shared/gabinete-digital/diplomas-assinar/diplomas-assinar.page.ts +++ b/src/app/shared/gabinete-digital/diplomas-assinar/diplomas-assinar.page.ts @@ -76,6 +76,9 @@ export class DiplomasAssinarPage implements OnInit { this.diplomasList.push(task); }); + this.diplomasList = this.sortService.sortDate(this.diplomasList, 'CreateDate') + + this.deplomasStore.resetDiplomasList(this.diplomasList); } diff --git a/src/app/shared/gabinete-digital/diplomas/diplomas.page.ts b/src/app/shared/gabinete-digital/diplomas/diplomas.page.ts index 53a5fdeb1..452d7a033 100644 --- a/src/app/shared/gabinete-digital/diplomas/diplomas.page.ts +++ b/src/app/shared/gabinete-digital/diplomas/diplomas.page.ts @@ -8,6 +8,7 @@ import { removeDuplicate } from 'src/plugin/removeDuplicate.js' import { CustomTaskPipe } from 'src/app/pipes/custom-task.pipe'; import { DeplomasStore } from 'src/app/store/deplomas.service'; import { ThemeService } from 'src/app/services/theme.service' +import { SortService } from 'src/app/services/functions/sort.service'; @Component({ selector: 'app-diplomas', @@ -34,10 +35,9 @@ constructor( private alertService: AlertService, private router: Router, private activatedRoute: ActivatedRoute, - public ThemeService: ThemeService - ) { - - } + public ThemeService: ThemeService, + private sortService: SortService, + ) {} ngOnInit() { // update list @@ -82,7 +82,7 @@ constructor( diplomasList.push(task); }); - this.diplomasList = this.sortArrayISODate(diplomasList).reverse(); + this.diplomasList = this.sortService.sortDate(diplomasList, 'CreateDate') this.deplomasStore.resetDiplomasList(this.diplomasList) let diplomasAssinadoList = [] @@ -93,7 +93,7 @@ constructor( diplomasAssinadoList.push(task); }); - this.diplomasAssinadoList = this.sortArrayISODate(diplomasAssinadoList).reverse(); + this.diplomasAssinadoList = this.sortService.sortDate(diplomasAssinadoList, 'CreateDate') this.deplomasStore.resetDiplomasAssinadoList(this.diplomasAssinadoList) this.showLoader = false; @@ -120,12 +120,6 @@ constructor( } } - sortArrayISODate(myArray: any) { - return myArray.sort(function(a, b) { - return (a.CreateDate < b.CreateDate) ? -1 : ((a.CreateDate > b.CreateDate) ? 1 : 0); - }); - } - async refreshing() { setTimeout(() => { this.LoadList(); diff --git a/src/app/shared/gabinete-digital/events-to-approve/events-to-approve.page.ts b/src/app/shared/gabinete-digital/events-to-approve/events-to-approve.page.ts index e04bf0a86..93a20876d 100644 --- a/src/app/shared/gabinete-digital/events-to-approve/events-to-approve.page.ts +++ b/src/app/shared/gabinete-digital/events-to-approve/events-to-approve.page.ts @@ -69,13 +69,14 @@ export class EventsToApprovePage implements OnInit { this.eventsMDGPRList = mdEventsOficial.concat(mdEventsPessoal); console.log(this.sortService.sortArrayByDate(this.eventsMDGPRList)); - this.eventaprovacaostore.resetmd(this.sortService.sortArrayByDate(this.eventsMDGPRList).reverse()); + 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.eventaprovacaostore.resetpr(this.sortService.sortArrayByDate(this.eventsPRList).reverse()); + + this.eventaprovacaostore.resetpr(this.sortService.sortDate(this.eventsPRList, 'CreateDate')); } this.showLoader = false; } diff --git a/src/app/shared/gabinete-digital/expedientes-pr/expedientes-pr.page.ts b/src/app/shared/gabinete-digital/expedientes-pr/expedientes-pr.page.ts index d89169481..fc6b10e54 100644 --- a/src/app/shared/gabinete-digital/expedientes-pr/expedientes-pr.page.ts +++ b/src/app/shared/gabinete-digital/expedientes-pr/expedientes-pr.page.ts @@ -10,6 +10,7 @@ import { CustomTaskPipe } from 'src/app/pipes/custom-task.pipe'; 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'; @Component({ @@ -35,7 +36,8 @@ export class ExpedientesPrPage implements OnInit { private alertService: AlertService, private authService: AuthService, private router: Router, - public ThemeService: ThemeService + public ThemeService: ThemeService, + private sortService: SortService, ) { this.loggeduser = authService.ValidatedUser; } @@ -75,7 +77,8 @@ export class ExpedientesPrPage implements OnInit { let task = this.expedienteTaskPipe.transform(element); this.taskslist.push(task); }); - console.log(this.taskslist); + + this.taskslist = this.sortService.sortDate(this.taskslist, 'CreateDate') this.expedienteGdStore.reset(this.taskslist); this.skeletonLoader = false; diff --git a/src/app/shared/gabinete-digital/expedients/expedients.page.ts b/src/app/shared/gabinete-digital/expedients/expedients.page.ts index 2f0237c92..84d2baad5 100644 --- a/src/app/shared/gabinete-digital/expedients/expedients.page.ts +++ b/src/app/shared/gabinete-digital/expedients/expedients.page.ts @@ -5,6 +5,7 @@ import { AlertService } from 'src/app/services/alert.service'; 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'; @Component({ selector: 'app-expedients', @@ -27,7 +28,8 @@ export class ExpedientsPage implements OnInit { private processes:ProcessesService, private alertService: AlertService, private router: Router, - public ThemeService: ThemeService + public ThemeService: ThemeService, + private sortService: SortService, ) { this.profile = 'mdgpr'; @@ -67,13 +69,14 @@ export class ExpedientsPage implements OnInit { this.taskslist = []; this.skeletonLoader = false - let res = result.reverse().filter(data => data.workflowInstanceDataFields.Status == "Active"); + let res = result.filter(data => data.workflowInstanceDataFields.Status == "Active"); res.forEach(element => { let task = this.expedienteTaskPipe.transform(element) this.taskslist.push(task); }); + this.taskslist = this.sortService.sortDate(this.taskslist, 'CreateDate') this.expedientegbstore.reset(this.taskslist); }); } diff --git a/src/app/shared/gabinete-digital/pedidos/pedidos.page.ts b/src/app/shared/gabinete-digital/pedidos/pedidos.page.ts index 785392167..409e85bf9 100644 --- a/src/app/shared/gabinete-digital/pedidos/pedidos.page.ts +++ b/src/app/shared/gabinete-digital/pedidos/pedidos.page.ts @@ -50,7 +50,7 @@ export class PedidosPage implements OnInit { public ThemeService: ThemeService ) { this.profile = 'mdgpr'; - } + } ngOnInit() { @@ -96,7 +96,8 @@ export class PedidosPage implements OnInit { let task: customTask = this.customTaskPipe.transform(element); this.parecerList.push(task); }); - this.pedidosstore.resetparecer(this.sortService.sortArrayISODate(this.parecerList)); + + this.pedidosstore.resetparecer(this.sortService.sortDate(this.parecerList, 'CreateDate')); } else if(this.segment == 'deferimento') { @@ -112,7 +113,9 @@ export class PedidosPage implements OnInit { let task: customTask = this.customTaskPipe.transform(element); this.deferimentoList.push(task); }); - this.pedidosstore.resetdeferimento(this.sortService.sortArrayISODate(this.deferimentoList)); + + + this.pedidosstore.resetdeferimento(this.sortService.sortDate(this.deferimentoList, 'CreateDate')); }); } diff --git a/src/app/shared/gabinete-digital/pendentes/pendentes.page.ts b/src/app/shared/gabinete-digital/pendentes/pendentes.page.ts index cc20a4a26..c74f98171 100644 --- a/src/app/shared/gabinete-digital/pendentes/pendentes.page.ts +++ b/src/app/shared/gabinete-digital/pendentes/pendentes.page.ts @@ -62,7 +62,7 @@ export class PendentesPage implements OnInit { }); pendentesList = removeDuplicate( pendentesList) - pendentesList = this.sortService.sortArrayISODate(pendentesList); + pendentesList = this.sortService.sortDate(pendentesList, 'CreateDate') this.pendentesstore.reset(pendentesList); this.skeletonLoader = false; diff --git a/src/app/shared/header/header.page.html b/src/app/shared/header/header.page.html index abe6a5226..27acb350c 100644 --- a/src/app/shared/header/header.page.html +++ b/src/app/shared/header/header.page.html @@ -1,6 +1,6 @@
-
+