From 60fdcfa42eb550c6acb9929e93309985f47a92c8 Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Tue, 31 Aug 2021 11:44:10 +0100 Subject: [PATCH 01/11] Remove synchro to production --- .../notification/web-notification-popup.service.ts | 7 +++++-- src/app/services/socket/synchro.service.ts | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/app/services/notification/web-notification-popup.service.ts b/src/app/services/notification/web-notification-popup.service.ts index 9520630a9..e4e89dc64 100644 --- a/src/app/services/notification/web-notification-popup.service.ts +++ b/src/app/services/notification/web-notification-popup.service.ts @@ -1,15 +1,18 @@ import { Injectable } from '@angular/core'; - +import { AlertController, Platform } from '@ionic/angular'; @Injectable({ providedIn: 'root' }) export class WebNotificationPopupService { - constructor() { } + constructor( private platform: Platform) { } askNotificationPermission() { + if (this.platform.is('desktop') || this.platform.is('mobileweb')) {} + else {return false} + // function to actually ask the permissions function handlePermission(permission) {} diff --git a/src/app/services/socket/synchro.service.ts b/src/app/services/socket/synchro.service.ts index 8881a2829..dd19ac1f2 100644 --- a/src/app/services/socket/synchro.service.ts +++ b/src/app/services/socket/synchro.service.ts @@ -136,7 +136,7 @@ class SynchroService { if(window['platform'].is('desktop') || this.platform.is('mobileweb')) {} else return false - // if(environment.production) return false + if(environment.production) return false this.callBacks.forEach((e)=> { From 98def4edf3b8980d93a82c9754b7a128dbdc643e Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Tue, 31 Aug 2021 12:02:45 +0100 Subject: [PATCH 02/11] Fix prod version --- src/app/modals/profile/edit-profile/edit-profile.page.html | 2 +- src/app/modals/profile/edit-profile/edit-profile.page.ts | 2 ++ .../edit-event-to-approve/edit-event.page.html | 3 +-- 3 files changed, 4 insertions(+), 3 deletions(-) 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 d1ed6cfd8..ec1f40183 100644 --- a/src/app/modals/profile/edit-profile/edit-profile.page.html +++ b/src/app/modals/profile/edit-profile/edit-profile.page.html @@ -53,7 +53,7 @@ - -
-
+
Date: Tue, 31 Aug 2021 13:11:46 +0100 Subject: [PATCH 03/11] Improve notification counting --- src/app/home/home.page.ts | 18 ++++++++++-------- src/app/pages/events/events.page.html | 1 - 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/app/home/home.page.ts b/src/app/home/home.page.ts index 99dfec1bc..27f033c2a 100644 --- a/src/app/home/home.page.ts +++ b/src/app/home/home.page.ts @@ -82,7 +82,6 @@ export class HomePage implements OnInit { document.querySelectorAll('ion-modal').forEach((e: any) => e.remove()) }); - this.updateList() window['platform'] = platform window['inactivity/function'] = () => { @@ -95,13 +94,6 @@ export class HomePage implements OnInit { } } - var myWorker = new Worker(new URL('./nice.worker.js', import.meta.url) ); - - myWorker.onmessage = function(oEvent) { - console.log('Worker said : ' + oEvent.data); - } - - myWorker.postMessage('ali'); } @@ -121,7 +113,17 @@ export class HomePage implements OnInit { this.notificationsService.onReceviNotification(); } + this.updateList() + + var myWorker = new Worker(new URL('./nice.worker.js', import.meta.url) ); + + myWorker.onmessage = function(oEvent) { + console.log('Worker said : ' + oEvent.data); + } + + myWorker.postMessage('ali'); } + mobilefirstConnect() { if(window['WLAuthorizationManager']) { diff --git a/src/app/pages/events/events.page.html b/src/app/pages/events/events.page.html index 13052ad42..830847aba 100644 --- a/src/app/pages/events/events.page.html +++ b/src/app/pages/events/events.page.html @@ -113,7 +113,6 @@
- @@ -82,7 +82,7 @@
-
+
@@ -92,7 +92,7 @@
-
+
diff --git a/src/app/pages/events/events.page.scss b/src/app/pages/events/events.page.scss index 1343febc9..9434c2c5b 100644 --- a/src/app/pages/events/events.page.scss +++ b/src/app/pages/events/events.page.scss @@ -325,17 +325,21 @@ ion-toolbar{ display: flex; flex-wrap: wrap; justify-content: center; + padding-bottom: 20px; } .schedule { max-width: 400px; font-family: Roboto; - margin: 10px 0px; padding: 20px; background-color: white; - box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.07); + box-shadow: 0 0 10px 0 rgb(0 0 0 / 7%); border: solid 1px #e9e9e9; margin-bottom: 20px; border-radius: 25px; + display: flex; + flex-direction: column; + max-height: 100%; + .schedule-header{ display: flex; margin-bottom: 20px; @@ -473,6 +477,18 @@ ion-toolbar{ } + + +@media only screen and (max-width: 856px) { + + .content, .conteiner-box{ + height: unset !important; + max-height: unset !important; + } + +} + + @media only screen and (min-width: 804px) { .schedule:first-child { diff --git a/src/app/services/notifications.service.ts b/src/app/services/notifications.service.ts index feb297b5b..d04433176 100644 --- a/src/app/services/notifications.service.ts +++ b/src/app/services/notifications.service.ts @@ -44,10 +44,9 @@ export class NotificationsService { this.storageService.get("Notifications").then((value) => { - if(value == 'žée') { - this.storageService.store("Notifications", []) - } - + }).catch(()=>{ + + this.storageService.store("Notifications",[]) }) } diff --git a/src/app/services/storage.service.ts b/src/app/services/storage.service.ts index ba4feb1b0..37bb2b92b 100644 --- a/src/app/services/storage.service.ts +++ b/src/app/services/storage.service.ts @@ -45,6 +45,9 @@ const { Storage } = Plugins; */ try { return JSON.parse(unescape(atob(ret))); } catch (error) { + if(ret == 'žée') { + throw(key+' not found') + } return unescape(atob(ret)) } } From 77d69caca93162d31c4a3d2f51b87550441542bf Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Tue, 31 Aug 2021 14:50:15 +0100 Subject: [PATCH 08/11] enable field --- .../edit-event-to-approve/edit-event-to-approve.page.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/shared/agenda/edit-event-to-approve/edit-event-to-approve.page.html b/src/app/shared/agenda/edit-event-to-approve/edit-event-to-approve.page.html index 22078a985..5d5f12a30 100644 --- a/src/app/shared/agenda/edit-event-to-approve/edit-event-to-approve.page.html +++ b/src/app/shared/agenda/edit-event-to-approve/edit-event-to-approve.page.html @@ -58,7 +58,7 @@
- Date: Tue, 31 Aug 2021 15:05:42 +0100 Subject: [PATCH 09/11] Fix --- src/app/models/event.model.ts | 4 -- .../agenda/edit-event/edit-event.page.html | 39 ++++++++++++++++--- .../agenda/edit-event/edit-event.page.ts | 5 ++- 3 files changed, 37 insertions(+), 11 deletions(-) diff --git a/src/app/models/event.model.ts b/src/app/models/event.model.ts index dfa36d7d0..fb1e5b581 100644 --- a/src/app/models/event.model.ts +++ b/src/app/models/event.model.ts @@ -33,10 +33,6 @@ export class Event{ EventRecurrence: EventRecurrence; Name?: string Attachments?: Attachment[]; - - /* public Event(){ - this.EventRecurrence = new EventRecurrence(); - } */ } diff --git a/src/app/shared/agenda/edit-event/edit-event.page.html b/src/app/shared/agenda/edit-event/edit-event.page.html index 1c7c50fc6..6056f6b6a 100644 --- a/src/app/shared/agenda/edit-event/edit-event.page.html +++ b/src/app/shared/agenda/edit-event/edit-event.page.html @@ -55,7 +55,6 @@
- 123123
@@ -214,13 +213,41 @@
- +
+ +
+
+
+ +
+
+ + + +
+
+
diff --git a/src/app/shared/agenda/edit-event/edit-event.page.ts b/src/app/shared/agenda/edit-event/edit-event.page.ts index fdef4a5bd..f4c28947b 100644 --- a/src/app/shared/agenda/edit-event/edit-event.page.ts +++ b/src/app/shared/agenda/edit-event/edit-event.page.ts @@ -31,7 +31,9 @@ export class EditEventPage implements OnInit { eventAttendees: EventPerson[]; // minDate: string; loadedEventAttachments: Attachment[]=[]; - recurringTypes: any; + recurringTypes = []; + selectedRecurringType: any; + public dateControlOccurrence = new FormControl(moment("DD MM YYYY hh")); public date: any; @@ -107,6 +109,7 @@ export class EditEventPage implements OnInit { ngOnInit() { this.dateControlOccurrence = new FormControl(moment(this.postEvent.EventRecurrence.LastOccurrence)); + if(!this.restoreTemporaryData()) { // clear From 27e09aa4061f2cd66605067aba474e9d41f1a59a Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Tue, 31 Aug 2021 15:32:25 +0100 Subject: [PATCH 10/11] Fix event to approve --- .../edit-event-to-approve.module.ts | 4 +++- .../edit-event-to-approve.page.html | 9 ++++---- .../edit-event-to-approve.page.ts | 23 ------------------- .../edit-event.module.ts | 3 ++- .../edit-event.page.html | 8 +++---- .../edit-event-to-approve/edit-event.page.ts | 2 -- 6 files changed, 14 insertions(+), 35 deletions(-) diff --git a/src/app/shared/agenda/edit-event-to-approve/edit-event-to-approve.module.ts b/src/app/shared/agenda/edit-event-to-approve/edit-event-to-approve.module.ts index db637c541..208cad591 100644 --- a/src/app/shared/agenda/edit-event-to-approve/edit-event-to-approve.module.ts +++ b/src/app/shared/agenda/edit-event-to-approve/edit-event-to-approve.module.ts @@ -18,10 +18,11 @@ import { ReactiveFormsModule } from '@angular/forms'; import { MatButtonModule } from '@angular/material/button'; import { MatSelectModule } from '@angular/material/select'; import { NgxMatMomentModule } from '@angular-material-components/moment-adapter'; -import { MAT_DATE_LOCALE } from '@angular/material/core'; import { MatDatepickerModule } from '@angular/material/datepicker'; import { MatInputModule } from '@angular/material/input'; import { MatDialogModule } from '@angular/material/dialog'; +import { AttendeeModalPageModule } from 'src/app/shared/event/attendee-modal/attendee-modal.module'; + @NgModule({ imports: [ @@ -41,6 +42,7 @@ import { MatDialogModule } from '@angular/material/dialog'; MatButtonModule, ReactiveFormsModule, MatDialogModule, + AttendeeModalPageModule, ], declarations: [EditEventToApprovePage], exports: [EditEventToApprovePage] diff --git a/src/app/shared/agenda/edit-event-to-approve/edit-event-to-approve.page.html b/src/app/shared/agenda/edit-event-to-approve/edit-event-to-approve.page.html index 5d5f12a30..eeaac17a4 100644 --- a/src/app/shared/agenda/edit-event-to-approve/edit-event-to-approve.page.html +++ b/src/app/shared/agenda/edit-event-to-approve/edit-event-to-approve.page.html @@ -280,7 +280,7 @@
-
+
@@ -289,7 +289,7 @@
-
+
@@ -301,7 +301,7 @@
-
+
@@ -310,7 +310,7 @@
-
+
@@ -361,6 +361,7 @@
+
diff --git a/src/app/shared/agenda/edit-event-to-approve/edit-event-to-approve.page.ts b/src/app/shared/agenda/edit-event-to-approve/edit-event-to-approve.page.ts index 0f85c7b4e..d96328a0e 100644 --- a/src/app/shared/agenda/edit-event-to-approve/edit-event-to-approve.page.ts +++ b/src/app/shared/agenda/edit-event-to-approve/edit-event-to-approve.page.ts @@ -132,9 +132,6 @@ export class EditEventToApprovePage implements OnInit { ngOnInit() { - console.log('EDITAR'); - - if(this.restoreTemporaryData()){ this.setOtherData() } else { @@ -338,26 +335,6 @@ export class EditEventToApprovePage implements OnInit { } - // setIntervenient(data){ - // this.taskParticipants = data; - // this.postEvent.Attendees = data; - // } - - // setIntervenientCC(data) { - // this.taskParticipantsCc = data; - // } - - // addParticipants(){ - // this.adding = 'intervenient' - - // this.openAttendees(); - // } - - // addParticipantsCC(){ - - // this.adding = 'CC' - // this.openAttendees(); - // } dynamicSetIntervenient({taskParticipants, taskParticipantsCc}) { this.taskParticipants = removeDuplicate(taskParticipants) ; diff --git a/src/app/shared/gabinete-digital/edit-event-to-approve/edit-event.module.ts b/src/app/shared/gabinete-digital/edit-event-to-approve/edit-event.module.ts index eb34ada4f..dab3db7f9 100644 --- a/src/app/shared/gabinete-digital/edit-event-to-approve/edit-event.module.ts +++ b/src/app/shared/gabinete-digital/edit-event-to-approve/edit-event.module.ts @@ -18,10 +18,10 @@ import { ReactiveFormsModule } from '@angular/forms'; import { MatButtonModule } from '@angular/material/button'; import { MatSelectModule } from '@angular/material/select'; import { NgxMatMomentModule } from '@angular-material-components/moment-adapter'; -import { MAT_DATE_LOCALE } from '@angular/material/core'; import { MatDatepickerModule } from '@angular/material/datepicker'; import { MatInputModule } from '@angular/material/input'; import { MatDialogModule } from '@angular/material/dialog'; +import { AttendeeModalPageModule } from 'src/app/shared/event/attendee-modal/attendee-modal.module'; @NgModule({ imports: [ @@ -41,6 +41,7 @@ import { MatDialogModule } from '@angular/material/dialog'; MatButtonModule, ReactiveFormsModule, MatDialogModule, + AttendeeModalPageModule, ], declarations: [ EditEventToApproveComponent diff --git a/src/app/shared/gabinete-digital/edit-event-to-approve/edit-event.page.html b/src/app/shared/gabinete-digital/edit-event-to-approve/edit-event.page.html index 8352645ff..663009d0d 100644 --- a/src/app/shared/gabinete-digital/edit-event-to-approve/edit-event.page.html +++ b/src/app/shared/gabinete-digital/edit-event-to-approve/edit-event.page.html @@ -8,7 +8,7 @@
- Editar evento por aprovar + Editar evento por aprovar gg
@@ -290,12 +290,12 @@
-
+
-
+
@@ -304,7 +304,7 @@
-
+
diff --git a/src/app/shared/gabinete-digital/edit-event-to-approve/edit-event.page.ts b/src/app/shared/gabinete-digital/edit-event-to-approve/edit-event.page.ts index 49cc677c1..c7bc0343d 100644 --- a/src/app/shared/gabinete-digital/edit-event-to-approve/edit-event.page.ts +++ b/src/app/shared/gabinete-digital/edit-event-to-approve/edit-event.page.ts @@ -259,7 +259,6 @@ export class EditEventToApproveComponent implements OnInit { Category: this.eventProcess.workflowInstanceDataFields.Category } - console.log(event); this.eventsService.postEventToApproveEdit(event).subscribe(()=>{ this.toastService.successMessage('Evento editado'); @@ -342,7 +341,6 @@ export class EditEventToApproveComponent implements OnInit { addParticipants(){ this.adding = 'intervenient' this.openAttendees(); - console.log('LOGS'); } From 0b21f06a43844e8e30c71d31c5cc19e814b7ce23 Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Tue, 31 Aug 2021 16:32:16 +0100 Subject: [PATCH 11/11] Fix aganda all day --- src/app/models/agenda/AgendaEventList.ts | 25 ++++--- src/app/pages/agenda/agenda.page.ts | 36 +++++---- .../diplomas/diploma/diploma.page.ts | 2 +- .../approve-event/approve-event.page.ts | 2 +- .../pedidos/pedido/pedido.page.ts | 2 +- .../publication-detail.page.ts | 2 +- .../view-publications.page.ts | 2 +- .../services/ageanda/list-box.service.spec.ts | 16 ++++ .../ageanda/list-box.service.ts} | 75 ++++++++----------- src/app/services/date.service.spec.ts | 16 ++++ src/app/services/date.service.ts | 40 ++++++++++ 11 files changed, 137 insertions(+), 81 deletions(-) create mode 100644 src/app/services/ageanda/list-box.service.spec.ts rename src/app/{pages/agenda/eventListBox.ts => services/ageanda/list-box.service.ts} (75%) create mode 100644 src/app/services/date.service.spec.ts create mode 100644 src/app/services/date.service.ts diff --git a/src/app/models/agenda/AgendaEventList.ts b/src/app/models/agenda/AgendaEventList.ts index 63a798d4a..fad1343c4 100644 --- a/src/app/models/agenda/AgendaEventList.ts +++ b/src/app/models/agenda/AgendaEventList.ts @@ -1,3 +1,15 @@ + +export interface EventListStore { + title: string + startTime: Date + endTime: Date + allDay: boolean, + event: EventList, + calendarName: string + profile: "md" | "pr", + id: string +} + export interface EventList { HasAttachments: boolean; IsAllDayEvent: boolean; @@ -11,17 +23,6 @@ export interface EventList { HumanDate: string; } -export interface EventListStore { - title: string - startTime: Date - endTime: Date - allDay: boolean, - event: EventList, - calendarName: string - profile: "md" | "pr", - id: string -} - export interface CustomCalendarEvent { start: Date @@ -33,5 +34,5 @@ export interface CustomCalendarEvent { id: string index: number, CalendarName: string - event: EventListStore + event: EventList } \ No newline at end of file diff --git a/src/app/pages/agenda/agenda.page.ts b/src/app/pages/agenda/agenda.page.ts index 931a0390b..6af359567 100644 --- a/src/app/pages/agenda/agenda.page.ts +++ b/src/app/pages/agenda/agenda.page.ts @@ -25,8 +25,8 @@ import { LoginUserRespose } from 'src/app/models/user.model'; import { DateAdapter } from '@angular/material/core'; import { ToastService } from 'src/app/services/toast.service'; import { eventSource } from 'src/app/models/agenda/eventSource'; -import { eventListBox as eventListBoxComponent } from './eventListBox' import { CalendarService } from 'src/app/store/calendar.service'; +import { ListBoxService } from 'src/app/services/ageanda/list-box.service'; @Component({ selector: 'app-agenda', @@ -123,8 +123,6 @@ export class AgendaPage implements OnInit { startTime: Date; endTime: Date; - eventListBoxComponent = new eventListBoxComponent() - mobileComponent = { showAddNewEvent: false, showEditEvent: false, @@ -162,7 +160,8 @@ export class AgendaPage implements OnInit { authService: AuthService, private dateAdapter: DateAdapter, private toastService: ToastService, - public calendarService: CalendarService + public calendarService: CalendarService, + private listBoxService: ListBoxService ) { this.dateAdapter.setLocale('es'); @@ -457,7 +456,6 @@ export class AgendaPage implements OnInit { this.eventService.getAllMdEvents( momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59') ).then( (response:any) => { - console.log(response); // calendar @@ -466,7 +464,7 @@ export class AgendaPage implements OnInit { // loop this.calendarService.pushEvent(response, 'md'); - this.TimelineMDList = this.eventListBoxComponent.list(this.calendarService.eventSource, 'md', this.rangeStartDate, this.rangeEndDate, 'date') + this.TimelineMDList = this.listBoxService.list(this.calendarService.eventSource, 'md', this.rangeStartDate, this.rangeEndDate, 'date') this.myCal.update(); this.myCal.loadEvents(); @@ -487,7 +485,7 @@ export class AgendaPage implements OnInit { // calendar this.calendarService.pushEvent(response, 'pr'); - this.TimelineMDList = this.eventListBoxComponent.list(this.calendarService.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, 'date') + this.TimelineMDList = this.listBoxService.list(this.calendarService.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, 'date') this.myCal.update(); this.myCal.loadEvents(); @@ -513,7 +511,7 @@ export class AgendaPage implements OnInit { this.calendarService.pushEvent(response, 'pr'); - this.TimelineMDList = this.eventListBoxComponent.list(this.calendarService.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, 'date') + this.TimelineMDList = this.listBoxService.list(this.calendarService.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, 'date') this.myCal.update(); @@ -541,7 +539,7 @@ export class AgendaPage implements OnInit { this.calendarService.pushEvent(eventsList, 'md'); - this.TimelineMDList = this.eventListBoxComponent.list(this.calendarService.eventSource, 'md', this.rangeStartDate, this.rangeEndDate, 'date') + this.TimelineMDList = this.listBoxService.list(this.calendarService.eventSource, 'md', this.rangeStartDate, this.rangeEndDate, 'date') this.myCal.update(); this.myCal.loadEvents(); @@ -564,7 +562,7 @@ export class AgendaPage implements OnInit { this.calendarService.pushEvent(eventsList, 'pr'); - this.TimelineMDList = this.eventListBoxComponent.list(this.calendarService.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, 'date') + this.TimelineMDList = this.listBoxService.list(this.calendarService.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, 'date') this.myCal.update(); @@ -594,7 +592,7 @@ export class AgendaPage implements OnInit { this.calendarService.pushEvent(eventsList, 'md'); - this.TimelineMDList = this.eventListBoxComponent.list(this.calendarService.eventSource, 'md', this.rangeStartDate, this.rangeEndDate, 'date') + this.TimelineMDList = this.listBoxService.list(this.calendarService.eventSource, 'md', this.rangeStartDate, this.rangeEndDate, 'date') this.myCal.update(); this.myCal.loadEvents(); @@ -616,7 +614,7 @@ export class AgendaPage implements OnInit { this.calendarService.pushEvent(eventsList, 'pr'); - this.TimelineMDList = this.eventListBoxComponent.list(this.calendarService.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, 'date') + this.TimelineMDList = this.listBoxService.list(this.calendarService.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, 'date') this.myCal.update(); this.myCal.loadEvents(); @@ -647,7 +645,7 @@ export class AgendaPage implements OnInit { // loop this.calendarService.pushEvent(eventsList, 'md'); - this.TimelineMDList = this.eventListBoxComponent.list(this.calendarService.eventSource, 'md', this.rangeStartDate, this.rangeEndDate, 'date') + this.TimelineMDList = this.listBoxService.list(this.calendarService.eventSource, 'md', this.rangeStartDate, this.rangeEndDate, 'date') this.myCal.update(); this.myCal.loadEvents(); @@ -676,7 +674,7 @@ export class AgendaPage implements OnInit { this.calendarService.pushEvent(eventsList, 'pr'); - this.TimelinePRList = this.eventListBoxComponent.list(this.calendarService.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, 'date') + this.TimelinePRList = this.listBoxService.list(this.calendarService.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, 'date') this.myCal.update(); this.myCal.loadEvents(); @@ -714,7 +712,7 @@ export class AgendaPage implements OnInit { this.calendarService.pushEvent(eventsList, 'pr'); - this.TimelinePRList = this.eventListBoxComponent.list(this.calendarService.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, 'date') + this.TimelinePRList = this.listBoxService.list(this.calendarService.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, 'date') this.myCal.update(); @@ -741,8 +739,8 @@ export class AgendaPage implements OnInit { updateEventListBox() { - this.TimelinePRList = this.eventListBoxComponent.list(this.calendarService.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, 'date') - this.TimelineMDList = this.eventListBoxComponent.list(this.calendarService.eventSource, 'md', this.rangeStartDate, this.rangeEndDate, 'date') + this.TimelinePRList = this.listBoxService.list(this.calendarService.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, 'date') + this.TimelineMDList = this.listBoxService.list(this.calendarService.eventSource, 'md', this.rangeStartDate, this.rangeEndDate, 'date') } @@ -941,13 +939,13 @@ export class AgendaPage implements OnInit { if(this.profile == "mdgpr") { this.profile ="pr"; this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate); - this.TimelineMDList = this.eventListBoxComponent.list(this.calendarService.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, 'date') + this.TimelineMDList = this.listBoxService.list(this.calendarService.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, 'date') } else { this.profile ="mdgpr"; this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate); - this.TimelineMDList = this.eventListBoxComponent.list(this.calendarService.eventSource, 'md', this.rangeStartDate, this.rangeEndDate, 'date') + this.TimelineMDList = this.listBoxService.list(this.calendarService.eventSource, 'md', this.rangeStartDate, this.rangeEndDate, 'date') } } diff --git a/src/app/pages/gabinete-digital/diplomas/diploma/diploma.page.ts b/src/app/pages/gabinete-digital/diplomas/diploma/diploma.page.ts index 8c40c45e9..1f8dd62fa 100644 --- a/src/app/pages/gabinete-digital/diplomas/diploma/diploma.page.ts +++ b/src/app/pages/gabinete-digital/diplomas/diploma/diploma.page.ts @@ -44,7 +44,7 @@ export class DiplomaPage implements OnInit { private location: Location, ) { this.activatedRoute.paramMap.subscribe(params => { - console.log(params["params"]); + // console.log(params["params"]); if(params["params"].SerialNumber) { this.serialNumber = params["params"].SerialNumber; diff --git a/src/app/pages/gabinete-digital/event-list/approve-event/approve-event.page.ts b/src/app/pages/gabinete-digital/event-list/approve-event/approve-event.page.ts index bd44c675e..6e05b6c58 100644 --- a/src/app/pages/gabinete-digital/event-list/approve-event/approve-event.page.ts +++ b/src/app/pages/gabinete-digital/event-list/approve-event/approve-event.page.ts @@ -51,7 +51,7 @@ export class ApproveEventPage implements OnInit { private location: Location, ) { this.activatedRoute.paramMap.subscribe(params => { - console.log(params["params"]); + // console.log(params["params"]); if(params["params"].serialNumber) { this.serialNumber = params["params"].serialNumber; diff --git a/src/app/pages/gabinete-digital/pedidos/pedido/pedido.page.ts b/src/app/pages/gabinete-digital/pedidos/pedido/pedido.page.ts index b4efdf65b..53d32bbb2 100644 --- a/src/app/pages/gabinete-digital/pedidos/pedido/pedido.page.ts +++ b/src/app/pages/gabinete-digital/pedidos/pedido/pedido.page.ts @@ -60,7 +60,7 @@ export class PedidoPage implements OnInit { this.loggeduser = authService.ValidatedUser; this.activatedRoute.paramMap.subscribe(params => { - console.log(params["params"]); + // console.log(params["params"]); if(params["params"].SerialNumber) { this.serialnumber = params["params"].SerialNumber; diff --git a/src/app/pages/publications/view-publications/publication-detail/publication-detail.page.ts b/src/app/pages/publications/view-publications/publication-detail/publication-detail.page.ts index d70b37f90..06fe9717c 100644 --- a/src/app/pages/publications/view-publications/publication-detail/publication-detail.page.ts +++ b/src/app/pages/publications/view-publications/publication-detail/publication-detail.page.ts @@ -33,7 +33,7 @@ export class PublicationDetailPage implements OnInit { if(params["params"]) { this.folderId = params["params"].folderId; this.publicationId = params["params"].publicationId; - console.log(params["params"]); + // console.log(params["params"]); } }); 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 c4d58a5a6..9fa4d51f9 100644 --- a/src/app/pages/publications/view-publications/view-publications.page.ts +++ b/src/app/pages/publications/view-publications/view-publications.page.ts @@ -44,7 +44,7 @@ export class ViewPublicationsPage implements OnInit { if(params["params"]) { this.folderId = params["params"].folderId; - console.log(params["params"]); + // console.log(params["params"]); } window['app-view-publications-page-doRefresh'] = this.doRefresh diff --git a/src/app/services/ageanda/list-box.service.spec.ts b/src/app/services/ageanda/list-box.service.spec.ts new file mode 100644 index 000000000..8f319b4ec --- /dev/null +++ b/src/app/services/ageanda/list-box.service.spec.ts @@ -0,0 +1,16 @@ +import { TestBed } from '@angular/core/testing'; + +import { ListBoxService } from './list-box.service'; + +describe('ListBoxService', () => { + let service: ListBoxService; + + beforeEach(() => { + TestBed.configureTestingModule({}); + service = TestBed.inject(ListBoxService); + }); + + it('should be created', () => { + expect(service).toBeTruthy(); + }); +}); diff --git a/src/app/pages/agenda/eventListBox.ts b/src/app/services/ageanda/list-box.service.ts similarity index 75% rename from src/app/pages/agenda/eventListBox.ts rename to src/app/services/ageanda/list-box.service.ts index 0335f7cc9..c514470e8 100644 --- a/src/app/pages/agenda/eventListBox.ts +++ b/src/app/services/ageanda/list-box.service.ts @@ -1,30 +1,16 @@ -import { eventSource } from 'src/app/models/agenda/eventSource'; -import { setHours, setMinutes } from 'date-fns'; -import { CustomCalendarEvent, EventList, EventListStore } from 'src/app/models/agenda/AgendaEventList'; -import { CalendarEvent } from 'angular-calendar'; +import { Injectable } from '@angular/core'; +import { CustomCalendarEvent, EventListStore } from 'src/app/models/agenda/AgendaEventList'; +import { DateService } from '../date.service'; -export class eventListBox { - - constructor(){} +@Injectable({ + providedIn: 'root' +}) +export class ListBoxService { - EventEndDateTreatment ({startTime, endTime}) { + constructor( + private dateService: DateService + ){} - const startTimeSamp = new Date(startTime).toLocaleDateString() - const endTimeSamp = new Date(endTime).toLocaleDateString() - - const endMinutes = new Date(endTime).getMinutes() - const endHours = new Date(endTime).getHours() - - - if (startTimeSamp < endTimeSamp && (endMinutes + endHours) == 0) { - endTime = new Date(endTime); - endTime.setSeconds(endTime.getSeconds() - 1); - return new Date(endTime) - } else { - return new Date(endTime) - } - - } filterProfile(eventSource: EventListStore[], profile: 'md' | 'pr' | 'all') { return eventSource.filter((e) => e.profile == profile) @@ -44,6 +30,8 @@ export class eventListBox { list(eventSource: EventListStore[], profile: 'md' | 'pr' | 'all', rangeStartDate, randEndDate, calendarDate) { + console.log('eventSource: EventListStore[]',eventSource) + if(profile != 'all') { eventSource = this.filterProfile(eventSource, profile) } @@ -51,6 +39,7 @@ export class eventListBox { eventSource = this.getEventInsideRange(eventSource, rangeStartDate, randEndDate) let newStracture:CustomCalendarEvent[]; + if(profile == 'md') { newStracture = this.encapsulation(eventSource, 'mdgpr'); } else { @@ -60,24 +49,23 @@ export class eventListBox { return this.display(newStracture) } - display(list) { + display(list: CustomCalendarEvent[]) { let days = {}; console.log(list) - list.forEach( (event, index)=> { + list.forEach( (event:CustomCalendarEvent, index)=> { var startDate: any = new Date(event.start); - var endDate: any = this.EventEndDateTreatment({ + var endDate: any = this.dateService.EventEndDateTreatment({ startTime: startDate, endTime: event.end }) const day = (((new Date (event.start)).getDate())).toString().padStart(2,'0') - event.manyDays = false - - event.todayOnly = new Date(event.start).toLocaleDateString() == new Date(event.end).toLocaleDateString() + event['manyDays'] = false + event['todayOnly'] = this.dateService.isSameDate(event.start, event.end) if(!days.hasOwnProperty(day)) { days[day] = [] @@ -85,21 +73,20 @@ export class eventListBox { if (new Date(startDate).toLocaleDateString() != new Date(endDate).toLocaleDateString()) { - const diffTime = Math.abs(endDate - startDate); - const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24)); + + const diffDays = this.dateService.deferenceBetweenDays(endDate, startDate) if (diffDays <= 150 && !event.event.IsAllDayEvent ) { if (diffDays >= 1) { const StartEvent = Object.assign({}, { - title: event.title, + title: event.event.Subject, start: event.start, end: event.end, color: event.color, id: event.id, index: event.index, - profile: event.profile, CalendarName: event.CalendarName, event: { Subject: event.event.Subject, @@ -126,7 +113,7 @@ export class eventListBox { let otherDays = (((new Date (newDate)).getDate())).toString().padStart(2,'0') - event.other = true + event['other'] = true event.start = newDate if(!days.hasOwnProperty(otherDays)) { @@ -140,13 +127,12 @@ export class eventListBox { // last push const EndEvent = Object.assign({}, { - title: event.title, + title: event.event.Subject, start: event.start, end: event.end, color: event.color, id: event.id, index: event.index, - profile: event.profile, CalendarName: event.CalendarName, event: { Subject: event.event.Subject, @@ -156,7 +142,7 @@ export class eventListBox { EventId: event.event.EventId, CalendarName: event.event.CalendarName }, - Subject: event.Subject, + Subject: event.event.Subject, startMany: false, endMany: true, middle: false @@ -166,13 +152,13 @@ export class eventListBox { } else { const EndEvent = Object.assign({}, { - title: event.title, + title: event.event.Subject, start: event.start, end: event.end, color: event.color, id: event.id, index: event.index, - profile: event.profile, + profile: event, CalendarName: event.CalendarName, event: { Subject: event.event.Subject, @@ -182,7 +168,7 @@ export class eventListBox { EventId: event.event.EventId, CalendarName: event.event.CalendarName }, - Subject: event.Subject, + Subject: event.event.Subject, startMany: false, endMany: true, middle: true @@ -219,7 +205,7 @@ export class eventListBox { return days } - encapsulation(eventsList, profile): CustomCalendarEvent[] { + encapsulation(eventsList:EventListStore[], profile): CustomCalendarEvent[] { // remove all event let events: CustomCalendarEvent[] = []; @@ -239,11 +225,10 @@ export class eventListBox { event: element.event, }); - // console.log('element.event', element.event) + console.log('element.event', element.event) }); return events; } - -} \ No newline at end of file +} diff --git a/src/app/services/date.service.spec.ts b/src/app/services/date.service.spec.ts new file mode 100644 index 000000000..c90b9f927 --- /dev/null +++ b/src/app/services/date.service.spec.ts @@ -0,0 +1,16 @@ +import { TestBed } from '@angular/core/testing'; + +import { DateService } from './date.service'; + +describe('DateService', () => { + let service: DateService; + + beforeEach(() => { + TestBed.configureTestingModule({}); + service = TestBed.inject(DateService); + }); + + it('should be created', () => { + expect(service).toBeTruthy(); + }); +}); diff --git a/src/app/services/date.service.ts b/src/app/services/date.service.ts new file mode 100644 index 000000000..f64ef6fbd --- /dev/null +++ b/src/app/services/date.service.ts @@ -0,0 +1,40 @@ +import { Injectable } from '@angular/core'; + +@Injectable({ + providedIn: 'root' +}) +export class DateService { + + constructor() { } + + + deferenceBetweenDays(start: any, end: any) { + const diffTime = Math.abs(end - start); + return Math.ceil(diffTime / (1000 * 60 * 60 * 24)); + } + + notSameDate(start: any, end: any): boolean { + return new Date(start).toLocaleDateString() != new Date(end).toLocaleDateString() + } + isSameDate(start: any, end: any): boolean { + return !this.notSameDate(start, end) + } + + EventEndDateTreatment({startTime, endTime}) { + + const startTimeSamp = new Date(startTime).toLocaleDateString() + const endTimeSamp = new Date(endTime).toLocaleDateString() + + const endMinutes = new Date(endTime).getMinutes() + const endHours = new Date(endTime).getHours() + + + if (startTimeSamp < endTimeSamp && (endMinutes + endHours) == 0) { + endTime = new Date(endTime); + endTime.setSeconds(endTime.getSeconds() - 1); + return new Date(endTime) + } else { + return new Date(endTime) + } + } +}