From 86dd5a56674821ab990b3d654ef9643a216327e4 Mon Sep 17 00:00:00 2001 From: "tiago.kayaya" Date: Tue, 24 Aug 2021 16:48:33 +0100 Subject: [PATCH 01/67] save --- .../publication-detail/publication-detail.page.ts | 2 +- .../view-publications/view-publications.page.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) 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..7e768cd1f 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 @@ -104,7 +104,7 @@ export class PublicationDetailPage implements OnInit { try { await this.publications.DeletePublication(this.folderId, this.publicationId).toPromise(); - this.toastService.successMessage('Publicaçao eliminada') + this.toastService.successMessage('Publicação eliminada') } catch (error) { this.toastService.badRequest('Publicaçao não eliminada') 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 1888cb060..2da01cc30 100644 --- a/src/app/pages/publications/view-publications/view-publications.page.ts +++ b/src/app/pages/publications/view-publications/view-publications.page.ts @@ -57,9 +57,9 @@ export class ViewPublicationsPage implements OnInit { } this.getPublicationDetail(); - setTimeout(() => { + setTimeout(() => { this.getPublications(); - }, 3000); + }, 5000); } @@ -107,7 +107,7 @@ export class ViewPublicationsPage implements OnInit { this.publicationList = new Array(); - + res.forEach(element => { let item: Publication = this.publicationPipe.itemList(element) this.publicationList.push(item); From 7944fa26ead4df9d3462f4934885b252cf982f4c Mon Sep 17 00:00:00 2001 From: "tiago.kayaya" Date: Mon, 30 Aug 2021 09:05:57 +0100 Subject: [PATCH 02/67] save --- src/app/shared/header/header.page.html | 2 +- src/app/shared/header/header.page.scss | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/app/shared/header/header.page.html b/src/app/shared/header/header.page.html index 789ba42ad..10894b729 100644 --- a/src/app/shared/header/header.page.html +++ b/src/app/shared/header/header.page.html @@ -1,4 +1,4 @@ -
+
diff --git a/src/app/shared/header/header.page.scss b/src/app/shared/header/header.page.scss index 0d9330924..b28d613a0 100644 --- a/src/app/shared/header/header.page.scss +++ b/src/app/shared/header/header.page.scss @@ -59,10 +59,14 @@ position: absolute; } } +.main-tab{ + border: 1px solid red; +} .desktop{ display: none; + border: 1px solid red; } @media only screen and (min-width: 1366px) { @@ -80,6 +84,7 @@ height: 65px; cursor: pointer; user-select: none; + border: 1px solid red; } .active{ From 4ea6225f834c51a479e49bd11b9dc372346c0930 Mon Sep 17 00:00:00 2001 From: "tiago.kayaya" Date: Mon, 30 Aug 2021 13:40:26 +0100 Subject: [PATCH 03/67] save --- src/app/shared/header/header.page.scss | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/app/shared/header/header.page.scss b/src/app/shared/header/header.page.scss index b28d613a0..764111ce2 100644 --- a/src/app/shared/header/header.page.scss +++ b/src/app/shared/header/header.page.scss @@ -60,13 +60,12 @@ } } .main-tab{ - border: 1px solid red; + //border: 1px solid red; } .desktop{ display: none; - border: 1px solid red; } @media only screen and (min-width: 1366px) { @@ -84,9 +83,11 @@ height: 65px; cursor: pointer; user-select: none; - border: 1px solid red; } +.tab:hover{ + border-top: 7px solid white; +} .active{ border-top: 7px solid white; } From 8de8e232128cb796b866377bac5e1cd869a2a4f6 Mon Sep 17 00:00:00 2001 From: "tiago.kayaya" Date: Mon, 30 Aug 2021 18:56:37 +0100 Subject: [PATCH 04/67] save --- src/app/pages/chat/chat.page.html | 2 ++ src/app/pages/chat/chat.page.ts | 15 ++++++++++----- .../chat/group-messages/group-messages.page.ts | 2 +- .../chat/group-messages/group-messages.page.ts | 4 +++- src/app/shared/chat/messages/messages.page.ts | 2 ++ 5 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/app/pages/chat/chat.page.html b/src/app/pages/chat/chat.page.html index 74f7fa641..01ac162b7 100644 --- a/src/app/pages/chat/chat.page.html +++ b/src/app/pages/chat/chat.page.html @@ -113,6 +113,7 @@ (showEmptyContainer)="showEmptyContainer()" (showEmptyContainer)="showEmptyContainer()" (openNewEventPage)="openNewEventPage($event)" + (getDirectMessages)="getDirectMessages($event)" [style.display]="showMessages ? 'flex' : 'none'" [roomId]="roomId" [showMessages]="showMessages" #messagecontainer> @@ -156,6 +157,7 @@ (openGroupContacts)="openGroupContactsPage($event)" (openEditGroupPage)="openEditGroupPage($event)" (openNewEventPage)="openNewEventPage($event)" + (getGroups)="getGroups($event)" [style.display]="showGroupMessages ? 'flex' : 'none'" class=" height-100 flex-column" [roomId]="roomId" #messagecontainer> diff --git a/src/app/pages/chat/chat.page.ts b/src/app/pages/chat/chat.page.ts index 5b0b9d7fc..a9117c386 100644 --- a/src/app/pages/chat/chat.page.ts +++ b/src/app/pages/chat/chat.page.ts @@ -374,11 +374,11 @@ hideRefreshButton(){ }); } - async getDirectMessages(){ + async getDirectMessages(event?){ this.chatService.getAllDirectMessages().subscribe(async (res:any)=>{ - if(res.ims != 200){ + if(res != 200){ console.log(res.ims); this.userDirectMessages = res.ims.sort((a,b)=>{ var dateA = new Date(a._updatedAt).getTime(); @@ -391,12 +391,17 @@ hideRefreshButton(){ console.log("Timer message stop") } else { + console.log('TIMER'); //Check if modal is opened if(this.segment == "Contactos" && this.showMessages != true){ - await new Promise(resolve => setTimeout(resolve, 5000)); + await new Promise(resolve => setTimeout(resolve, 2000)); await this.getDirectMessages(); console.log('Timer contactos list running') } + else{ + console.log('No timer!'); + + } } } else{ @@ -452,7 +457,7 @@ hideRefreshButton(){ }); } - async getGroups(){ + async getGroups(event?){ this.result = this.chatService.getAllPrivateGroups().subscribe(async (res:any)=>{ if(res.groups != 200){ @@ -474,7 +479,7 @@ hideRefreshButton(){ else { //Check if modal is opened if(this.segment == "Grupos" && this.showGroupMessages != true){ - await new Promise(resolve => setTimeout(resolve, 5000)); + await new Promise(resolve => setTimeout(resolve, 2000)); await this.getGroups(); console.log('Timer groups list running') } diff --git a/src/app/pages/chat/group-messages/group-messages.page.ts b/src/app/pages/chat/group-messages/group-messages.page.ts index 7b388bd9e..c40abb91c 100644 --- a/src/app/pages/chat/group-messages/group-messages.page.ts +++ b/src/app/pages/chat/group-messages/group-messages.page.ts @@ -1,4 +1,4 @@ -import { Component, ElementRef, OnInit, ViewChild, AfterViewChecked, AfterViewInit, OnDestroy } from '@angular/core'; +import { Component, ElementRef, OnInit, ViewChild, AfterViewChecked, AfterViewInit, OnDestroy, } from '@angular/core'; import { ActionSheetController, MenuController, ModalController, NavParams, PopoverController } from '@ionic/angular'; import { AlertService } from 'src/app/services/alert.service'; import { AuthService } from 'src/app/services/auth.service'; diff --git a/src/app/shared/chat/group-messages/group-messages.page.ts b/src/app/shared/chat/group-messages/group-messages.page.ts index 362468177..88f371032 100644 --- a/src/app/shared/chat/group-messages/group-messages.page.ts +++ b/src/app/shared/chat/group-messages/group-messages.page.ts @@ -41,6 +41,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe @Output() openGroupContacts:EventEmitter = new EventEmitter(); @Output() openEditGroupPage:EventEmitter = new EventEmitter(); @Output() openNewEventPage:EventEmitter = new EventEmitter(); + @Output() getGroups:EventEmitter = new EventEmitter(); @ViewChild('scrollMe') private myScrollContainer: ElementRef; @@ -457,8 +458,9 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe console.log("Timer message stop") } else { if(document.querySelector('app-group-messages')){ - await new Promise(resolve => setTimeout(resolve, 5000)); + await new Promise(resolve => setTimeout(resolve,3000)); await this.serverLongPull(); + this.getGroups.emit(); console.log('Timer message running') } else{ diff --git a/src/app/shared/chat/messages/messages.page.ts b/src/app/shared/chat/messages/messages.page.ts index d3d9c75a3..b68c228c6 100644 --- a/src/app/shared/chat/messages/messages.page.ts +++ b/src/app/shared/chat/messages/messages.page.ts @@ -37,6 +37,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy @Input() showMessages:string; @Output() openNewEventPage:EventEmitter = new EventEmitter(); + @Output() getDirectMessages:EventEmitter = new EventEmitter(); synchro = synchro; @@ -371,6 +372,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy if(document.querySelector('app-messages')){ await new Promise(resolve => setTimeout(resolve, 5000)); await this.serverLongPull(); + this.getDirectMessages.emit(); console.log('Timer message running') } } From 6b61630abc529a03db9f280e74dc72c6f977a538 Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Tue, 31 Aug 2021 09:00:33 +0100 Subject: [PATCH 05/67] save --- config.xml | 2 +- src/app/home/home.page.ts | 15 ++++- src/app/modals/profile/profile.page.ts | 32 ++++++----- src/app/models/agenda/AgendaEventList.ts | 37 +++++++++++++ src/app/pages/agenda/eventListBox.ts | 31 ++++++----- src/app/pages/events/events.page.ts | 2 +- src/app/services/events.service.ts | 15 ++--- src/app/services/storage.service.ts | 55 +++++++++++++++---- src/app/shared/header/header.page.ts | 12 +++- src/app/store/calendar.service.ts | 9 +-- src/app/store/to-day-event-storage.service.ts | 5 +- 11 files changed, 157 insertions(+), 58 deletions(-) create mode 100644 src/app/models/agenda/AgendaEventList.ts diff --git a/config.xml b/config.xml index 7b18d7926..97d2fb38d 100644 --- a/config.xml +++ b/config.xml @@ -3,7 +3,7 @@ gabinete digital An awesome Ionic/Cordova app. Ionic Framework Team - + diff --git a/src/app/home/home.page.ts b/src/app/home/home.page.ts index 912061afe..035f1debd 100644 --- a/src/app/home/home.page.ts +++ b/src/app/home/home.page.ts @@ -162,8 +162,19 @@ export class HomePage implements OnInit { } ) - synchro.registerCallback('Notification', (notification)=> { - console.log('notification====== £=======£==========£======', notification) + + synchro.registerCallback('Notification', (DataArray)=> { + + this.storageService.get('Notifications').then((data)=>{ + data.push(DataArray) + this.storageService.store("Notifications", data) + }).catch(()=>{ + + const a = [] + a.push(DataArray) + this.storageService.store("Notifications",a) + }) + }, 'any') } diff --git a/src/app/modals/profile/profile.page.ts b/src/app/modals/profile/profile.page.ts index aaf8562af..6f77c2f10 100644 --- a/src/app/modals/profile/profile.page.ts +++ b/src/app/modals/profile/profile.page.ts @@ -11,6 +11,7 @@ import { JsonStore } from '../../services/jsonStore.service'; import { StorageService } from '../../services/storage.service'; import { NotificationsService } from '../../services/notifications.service'; import { SessionStore } from 'src/app/store/session.service'; +import { synchro } from 'src/app/services/socket/synchro.service'; @Component({ selector: 'app-profile', @@ -42,24 +43,35 @@ export class ProfilePage implements OnInit { private zone: NgZone, private notificationservice: NotificationsService, private platform: Platform, + private notificationsService: NotificationsService, ) { this.loggeduser = authService.ValidatedUser; console.log(this.loggeduser.RoleDescription) - this.checkState() } ngOnInit() { if (this.platform.is('desktop') || this.platform.is('mobileweb')) { console.log('Notifications not supported') + this.getNotificationData(); } else { - this.getNotificationData(); + this.getNotificationData(); } + this.notificationsService.registerCallback( + 'any', + () => { + setTimeout(()=>{ + this.getNotificationData(); + }, 100) + } + ) + } + close() { this.modalController.dismiss(); } @@ -68,7 +80,7 @@ export class ProfilePage implements OnInit { asyncNotification(){} - async getNotificationData(){ + async getNotificationData() { this.storageservice.get("Notifications").then((value) => { console.log("Init get store", value) @@ -78,6 +90,8 @@ export class ProfilePage implements OnInit { value = JSON.parse(value) console.log("CSDfdvdf",value) } + + this.DataArray = [] value.forEach((element,i) => { console.log("ARaaAA", element) let notificationObject; @@ -213,18 +227,6 @@ export class ProfilePage implements OnInit { } - checkState() { - - let userData = this.localstoreService.get('UserData', {}) - - if (userData.hasOwnProperty('loginPreference')) { - this.userLoginPreference = userData.loginPreference - } else { - this.userLoginPreference = '' - } - - } - async editProfile() { const enterAnimation = (baseEl: any) => { diff --git a/src/app/models/agenda/AgendaEventList.ts b/src/app/models/agenda/AgendaEventList.ts new file mode 100644 index 000000000..63a798d4a --- /dev/null +++ b/src/app/models/agenda/AgendaEventList.ts @@ -0,0 +1,37 @@ +export interface EventList { + HasAttachments: boolean; + IsAllDayEvent: boolean; + EventId: string; + Subject: string; + Location: string; + CalendarId: string; + CalendarName: string; + StartDate: string; + EndDate: string; + 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 + end: Date + color: { + primary: string, + secondary: string + }, + id: string + index: number, + CalendarName: string + event: EventListStore +} \ No newline at end of file diff --git a/src/app/pages/agenda/eventListBox.ts b/src/app/pages/agenda/eventListBox.ts index 83a03759e..72f7b295b 100644 --- a/src/app/pages/agenda/eventListBox.ts +++ b/src/app/pages/agenda/eventListBox.ts @@ -1,5 +1,7 @@ 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'; export class eventListBox { @@ -24,11 +26,11 @@ export class eventListBox { } - filterProfile(eventSource: eventSource[], profile: 'md' | 'pr' | 'all') { + filterProfile(eventSource: EventListStore[], profile: 'md' | 'pr' | 'all') { return eventSource.filter((e) => e.profile == profile) } - getEventInsideRange(eventSource: eventSource[], rangeStartDate, randEndDate) { + getEventInsideRange(eventSource: EventListStore[], rangeStartDate, randEndDate) { return eventSource.filter((e)=> { if(new Date(rangeStartDate).getTime() <= new Date(e.startTime).getTime() && new Date(randEndDate).getTime() >= new Date(e.endTime).getTime()) { @@ -40,7 +42,7 @@ export class eventListBox { daysBetween(){ } - list(eventSource: eventSource[], profile: 'md' | 'pr' | 'all', rangeStartDate, randEndDate, calendarDate) { + list(eventSource: EventListStore[], profile: 'md' | 'pr' | 'all', rangeStartDate, randEndDate, calendarDate) { if(profile != 'all') { eventSource = this.filterProfile(eventSource, profile) @@ -48,19 +50,21 @@ export class eventListBox { eventSource = this.getEventInsideRange(eventSource, rangeStartDate, randEndDate) + let newStracture:CustomCalendarEvent[]; if(profile == 'md') { - eventSource = this.encapsulation(eventSource, 'mdgpr'); + newStracture = this.encapsulation(eventSource, 'mdgpr'); } else { - eventSource = this.encapsulation(eventSource, 'pr'); + newStracture = this.encapsulation(eventSource, 'pr'); } - return this.display(eventSource) + return this.display(newStracture) } display(list) { let days = {}; + console.log(list) - list.forEach( (event:any, index)=> { + list.forEach( (event, index)=> { var startDate: any = new Date(event.start); @@ -215,27 +219,28 @@ export class eventListBox { return days } - encapsulation(eventsList, profile) { + encapsulation(eventsList, profile): CustomCalendarEvent[] { // remove all event - let events = []; + let events: CustomCalendarEvent[] = []; eventsList.forEach((element, eventIndex) => { events.push({ - start: new Date(element.StartDate || element.startTime), - end: new Date(element.EndDate || element.endTime), + start: new Date(element.startTime), + end: new Date(element.endTime), color: { primary: '#0000', secondary: '#0000' }, - id: element.EventId || element.id, + id: element.id, index: eventIndex, - profile: profile, CalendarName: element.calendarName, event: element.event, }); + console.log('element.event', element.event) + }); return events; diff --git a/src/app/pages/events/events.page.ts b/src/app/pages/events/events.page.ts index c2643fe1c..a3a986157 100644 --- a/src/app/pages/events/events.page.ts +++ b/src/app/pages/events/events.page.ts @@ -53,7 +53,7 @@ export class EventsPage implements OnInit { customText = false; totalEvent=0; - currentHoursMinutes: Date; + currentHoursMinutes: Date | string; showLoader: boolean; diff --git a/src/app/services/events.service.ts b/src/app/services/events.service.ts index 79769d4c7..a3a0d8983 100644 --- a/src/app/services/events.service.ts +++ b/src/app/services/events.service.ts @@ -5,6 +5,7 @@ import { Observable } from 'rxjs'; import { environment } from 'src/environments/environment'; import { AuthService } from '../services/auth.service'; import { LoginUserRespose } from '../models/user.model'; +import { EventList } from '../models/agenda/AgendaEventList'; @Injectable({ @@ -107,7 +108,7 @@ export class EventsService { } */ - getAllPrOficialEvents(startdate:string, enddate:string): Observable{ + getAllPrOficialEvents(startdate:string, enddate:string): Observable{ let geturl = environment.apiURL + 'calendar/pr'; geturl = geturl.replace('/V4/','/V5/') @@ -120,10 +121,10 @@ export class EventsService { headers: this.headersPrOficial, params: params }; - return this.http.get(`${geturl}`, options); + return this.http.get(`${geturl}`, options); } - getAllPrPessoalEvents(startdate:string, enddate:string): Observable{ + getAllPrPessoalEvents(startdate:string, enddate:string): Observable{ let geturl = environment.apiURL + 'calendar/pr'; geturl = geturl.replace('/V4/','/V5/') @@ -136,10 +137,10 @@ export class EventsService { headers: this.headersPrPessoal, params: params }; - return this.http.get(`${geturl}`, options); + return this.http.get(`${geturl}`, options); } - async getAllPrEvents(startdate:string, enddate:string){ + async getAllPrEvents(startdate:string, enddate:string): Promise{ let prO = await this.getAllPrOficialEvents(startdate, enddate).toPromise(); let prP = await this.getAllPrPessoalEvents(startdate, enddate).toPromise(); const resFinal = prO.concat(prP); @@ -148,7 +149,7 @@ export class EventsService { }) } - getAllMdOficialEvents(startdate:string, enddate:string): any{ + getAllMdOficialEvents(startdate:string, enddate:string): Observable{ let geturl = environment.apiURL + 'calendar/md'; let params = new HttpParams(); @@ -160,7 +161,7 @@ export class EventsService { headers: this.headersMdOficial, params: params }; - return this.http.get(`${geturl}`, options); + return this.http.get(`${geturl}`, options); } getAllMdPessoalEvents(startdate:string, enddate:string): any{ diff --git a/src/app/services/storage.service.ts b/src/app/services/storage.service.ts index 884c6407c..4371edbda 100644 --- a/src/app/services/storage.service.ts +++ b/src/app/services/storage.service.ts @@ -1,30 +1,65 @@ import { Injectable } from '@angular/core'; import { Storage } from '@ionic/storage'; +import { AnimationController, ModalController,Platform } from '@ionic/angular'; +import { SHA1 } from 'crypto-js' +import { localstoreService } from '../store/localstore.service'; /* import { Plugins } from '@capacitor/core'; const { Storage } = Plugins; */ @Injectable({ providedIn: 'root' }) export class StorageService { - constructor(private storage:Storage,) {} + private keyName: string; + + + constructor(private storage:Storage, + private platform: Platform + ) {} + + key(key) { + this.keyName = (SHA1('service'+this.constructor.name+'key')).toString() + } // Store the value - async store(key: string, value: any){ - const encryptedValue = btoa(escape(JSON.stringify(value))); - await this.storage.set(key, encryptedValue); + async store(key: string, value: any) { + if (this.platform.is('desktop') || this.platform.is('mobileweb')) { + await localstoreService.set(this.key(key), value) + } else { + const encryptedValue = btoa(escape(JSON.stringify(value))); + await this.storage.set(key, encryptedValue); + } + } // Get the value async get(key: string) { - const ret = await this.storage.get(key).then((val) => { return val; }); - try { - return JSON.parse(unescape(atob(ret))); - } catch (error) { - return unescape(atob(ret)) + + + if (this.platform.is('desktop') || this.platform.is('mobileweb')) { + return new Promise((resolve, reject)=>{ + const data = localstoreService.get(this.key(key), false) + if(data) resolve(data) + else reject(data) + }) + } else { + const ret = await this.storage.get(key).then((val) => { return val; }); + try { + return JSON.parse(unescape(atob(ret))); + } catch (error) { + return unescape(atob(ret)) + } } + + } async remove(key: string){ - await this.storage.remove(key); + + if (this.platform.is('desktop') || this.platform.is('mobileweb')) { + await localstoreService.delete(this.key(key)) + } else { + await this.storage.remove(key); + } + } diff --git a/src/app/shared/header/header.page.ts b/src/app/shared/header/header.page.ts index c7aad3f17..eb4212478 100644 --- a/src/app/shared/header/header.page.ts +++ b/src/app/shared/header/header.page.ts @@ -46,17 +46,20 @@ export class HeaderPage implements OnInit { this.hideSearch(); if (this.platform.is('desktop') || this.platform.is('mobileweb')) { console.log('Notifications not supported') + this.UpdateNotificationCount(); } else { this.UpdateNotificationCount(); } } - + UpdateNotificationCount() { this.notificationsService.registerCallback( 'any', () => { - this.notificationLengthData(); + setTimeout(()=>{ + this.notificationLengthData(); + }, 100) } ) } @@ -146,7 +149,6 @@ export class HeaderPage implements OnInit { return enterAnimation(baseEl).direction('reverse'); } - const modal = await this.modalController.create({ enterAnimation, leaveAnimation, @@ -156,6 +158,10 @@ export class HeaderPage implements OnInit { } }); await modal.present(); + + modal.onDidDismiss().then(()=>{ + this.notificationLengthData() + }) } diff --git a/src/app/store/calendar.service.ts b/src/app/store/calendar.service.ts index 9028b36bf..0559532e6 100644 --- a/src/app/store/calendar.service.ts +++ b/src/app/store/calendar.service.ts @@ -2,6 +2,7 @@ import { Injectable } from '@angular/core'; import { eventSource } from '../models/agenda/eventSource'; import { SHA1, SHA256, AES, enc } from 'crypto-js' import { LocalstoreService } from './localstore.service' +import { EventList, EventListStore } from '../models/agenda/AgendaEventList'; @Injectable({ providedIn: 'root' @@ -9,7 +10,7 @@ import { LocalstoreService } from './localstore.service' export class CalendarService { - private _eventSource : eventSource[] = [] + private _eventSource : EventListStore[] = [] private keyName: string; constructor(private localstoreService: LocalstoreService) { @@ -19,7 +20,7 @@ export class CalendarService { let restore = localstoreService.get(this.keyName, []) setTimeout(()=>{ - restore.forEach((element, eventIndex) => { + restore.forEach((element:EventListStore, eventIndex) => { this._eventSource.push({ title: element.title, startTime: new Date(element.startTime), @@ -36,7 +37,7 @@ export class CalendarService { } - ResetList(eventSource: eventSource[]) { + ResetList(eventSource: EventListStore[]) { this._eventSource = eventSource setTimeout(() => { @@ -61,7 +62,7 @@ export class CalendarService { }) } - pushEvent(eventsList, profile: 'pr' | 'md') { + pushEvent(eventsList: EventList[], profile: 'pr' | 'md') { let news = [] eventsList.forEach((element, eventIndex) => { diff --git a/src/app/store/to-day-event-storage.service.ts b/src/app/store/to-day-event-storage.service.ts index 70f1fa2ad..0868c059d 100644 --- a/src/app/store/to-day-event-storage.service.ts +++ b/src/app/store/to-day-event-storage.service.ts @@ -2,6 +2,7 @@ import { Injectable } from '@angular/core'; import { Event } from '../models/event.model'; import { localstoreService } from './localstore.service' import { AES, enc, SHA1 } from 'crypto-js' +import { EventList } from '../models/agenda/AgendaEventList'; @Injectable({ providedIn: 'root' @@ -10,7 +11,7 @@ import { AES, enc, SHA1 } from 'crypto-js' export class ToDayEventStorageService { // main data - private _eventsList: Event[] = [] + private _eventsList:EventList[] = [] // local storage keyName private keyName: string; private _count = 0 @@ -39,7 +40,7 @@ export class ToDayEventStorageService { this.save() } - reset(eventsList: Event[]) { + reset(eventsList: EventList[]) { this._eventsList = eventsList this.count = this._eventsList.length From f9e031254f8e835a9ce2ca2ab5027411b0a164ee Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Tue, 31 Aug 2021 09:11:41 +0100 Subject: [PATCH 06/67] add notification --- src/app/shared/header/header.page.html | 2 +- src/app/shared/header/header.page.ts | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/app/shared/header/header.page.html b/src/app/shared/header/header.page.html index 9bf6ef370..2708eed1d 100644 --- a/src/app/shared/header/header.page.html +++ b/src/app/shared/header/header.page.html @@ -82,7 +82,7 @@
{{profileLabel(loggeduser.Profile)}} -
{{this.notificationLength}}
+
{{notificationLength}}
diff --git a/src/app/shared/header/header.page.ts b/src/app/shared/header/header.page.ts index eb4212478..a0e0c561e 100644 --- a/src/app/shared/header/header.page.ts +++ b/src/app/shared/header/header.page.ts @@ -44,6 +44,8 @@ export class HeaderPage implements OnInit { ngOnInit() { this.hideSearch(); + this.notificationLengthData(); + if (this.platform.is('desktop') || this.platform.is('mobileweb')) { console.log('Notifications not supported') this.UpdateNotificationCount(); From ca4f9e47de959c42149ac0fa551a76e9412d7cd0 Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Tue, 31 Aug 2021 09:16:59 +0100 Subject: [PATCH 07/67] add synchro callbacks --- src/app/home/home.page.ts | 11 +++++++++ src/app/services/socket/synchro.service.ts | 28 +++++++++++++--------- 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/src/app/home/home.page.ts b/src/app/home/home.page.ts index 035f1debd..226533a97 100644 --- a/src/app/home/home.page.ts +++ b/src/app/home/home.page.ts @@ -162,6 +162,17 @@ export class HomePage implements OnInit { } ) + synchro.registerCallback('Online',()=>{ + + }) + + + synchro.registerCallback('Offline',()=>{ + + }) + + + synchro.registerCallback('Notification', (DataArray)=> { diff --git a/src/app/services/socket/synchro.service.ts b/src/app/services/socket/synchro.service.ts index 8d9d4fbf6..f514297b0 100644 --- a/src/app/services/socket/synchro.service.ts +++ b/src/app/services/socket/synchro.service.ts @@ -81,11 +81,14 @@ class SynchroService { this.BackgroundService.online() - this.callBacks.forEach((e)=>{ - if(e.type == 'Online') { - e.funx() - } - }) + if(!this.conected) { + this.callBacks.forEach((e)=>{ + if(e.type == 'Online') { + e.funx() + } + }) + + } console.log('open ======================= welcome to socket server') this._connected = true @@ -169,13 +172,16 @@ class SynchroService { console.log('[close] Connection died'); console.log('Reconnect') - this.BackgroundService.offline(); + - this.callBacks.forEach((e)=>{ - if(e.type == 'Offline') { - e.funx() - } - }) + if(this._connected) { + this.BackgroundService.offline(); + this.callBacks.forEach((e)=>{ + if(e.type == 'Offline') { + e.funx() + } + }) + } // status this._connected = false From 81b825b6b894f45e3b123f888528481f527042de Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Tue, 31 Aug 2021 10:17:23 +0100 Subject: [PATCH 08/67] Fix counting --- src/app/services/socket/synchro.service.ts | 4 +++- src/app/shared/header/header.page.ts | 2 ++ src/app/store/despacho-store.service.ts | 14 +++++++------- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/app/services/socket/synchro.service.ts b/src/app/services/socket/synchro.service.ts index f514297b0..84407e941 100644 --- a/src/app/services/socket/synchro.service.ts +++ b/src/app/services/socket/synchro.service.ts @@ -79,9 +79,11 @@ class SynchroService { private onopen = () =>{ - this.BackgroundService.online() + if(!this.conected) { + + this.BackgroundService.online() this.callBacks.forEach((e)=>{ if(e.type == 'Online') { e.funx() diff --git a/src/app/shared/header/header.page.ts b/src/app/shared/header/header.page.ts index a0e0c561e..2c2ac03be 100644 --- a/src/app/shared/header/header.page.ts +++ b/src/app/shared/header/header.page.ts @@ -70,6 +70,8 @@ export class HeaderPage implements OnInit { this.storageservice.get("Notifications").then((value) => { console.log("Init get store", value) + if(value == 'žée') return false + /* var data = JSON.parse(value); */ this.notificationLength = value.length; }) diff --git a/src/app/store/despacho-store.service.ts b/src/app/store/despacho-store.service.ts index 1cd097920..6f19a114d 100644 --- a/src/app/store/despacho-store.service.ts +++ b/src/app/store/despacho-store.service.ts @@ -36,13 +36,13 @@ export class DespachoStoreService { // (update:customTask) => update.Folio = 'Formação 5' // ) - // this.Query().Update( - // (select:customTask): boolean => select.Folio == 'Formação', - // (update:customTask) => { - // update.Folio = 'Formação 7'; - // update.DocumentURL = 'peter'; - // } - // ) + // this.Query().Update( + // (select:customTask): boolean => select.Folio == 'Formação', + // (update:customTask) => { + // update.Folio = 'Formação 7'; + // update.DocumentURL = 'peter'; + // } + // ) // this.Query().Update( // (select:customTask): boolean => select.Folio == 'Formação', From 6ffccfa8b3b7a5fbb9bf8755b227a30e87ea5b23 Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Tue, 31 Aug 2021 10:19:45 +0100 Subject: [PATCH 09/67] add online event callback --- src/app/home/home.page.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/home/home.page.ts b/src/app/home/home.page.ts index 226533a97..edc515e76 100644 --- a/src/app/home/home.page.ts +++ b/src/app/home/home.page.ts @@ -159,21 +159,21 @@ export class HomePage implements OnInit { 'despachos', () => { this.despachoRule.getList({updateStore: true}) + } ) + synchro.registerCallback('Online',()=>{ }) synchro.registerCallback('Offline',()=>{ - + }) - - synchro.registerCallback('Notification', (DataArray)=> { this.storageService.get('Notifications').then((data)=>{ From 09752557446823cece1226f56cfd6a21eb3ae92a Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Tue, 31 Aug 2021 10:27:00 +0100 Subject: [PATCH 10/67] Fix inactivity goBack --- src/app/pages/inactivity/inactivity.page.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/app/pages/inactivity/inactivity.page.ts b/src/app/pages/inactivity/inactivity.page.ts index bcccf0249..0132a6033 100644 --- a/src/app/pages/inactivity/inactivity.page.ts +++ b/src/app/pages/inactivity/inactivity.page.ts @@ -77,8 +77,8 @@ export class InactivityPage implements OnInit { // if current attemp is equal to the current user if (attempt.UserId == SessionStore.user.UserId) { await this.authService.SetSession(attempt, this.userattempt); - await this.authService.loginChat(this.userattempt); - await this.getToken(); + this.authService.loginChat(this.userattempt); + this.getToken(); SessionStore.setInativity(true) this.goback() @@ -143,7 +143,12 @@ export class InactivityPage implements OnInit { goback() { const pathName = this.SessionStore.user.UrlBeforeInactivity - this.router.navigate([pathName]); + if(pathName) { + this.router.navigate([pathName]); + } else { + this.router.navigate(['/home/events']); + } + } storePin() { From d0511fc6f4c872e10f45c8223f7c184fd420b40f Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Tue, 31 Aug 2021 10:43:38 +0100 Subject: [PATCH 11/67] pin login --- src/app/pages/inactivity/inactivity.page.ts | 9 +++++++-- src/app/services/socket/synchro.service.ts | 3 ++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/app/pages/inactivity/inactivity.page.ts b/src/app/pages/inactivity/inactivity.page.ts index 0132a6033..74437d4ea 100644 --- a/src/app/pages/inactivity/inactivity.page.ts +++ b/src/app/pages/inactivity/inactivity.page.ts @@ -131,9 +131,14 @@ export class InactivityPage implements OnInit { const code = this.code.join('') if( SessionStore.validatePin(code)) { - + + SessionStore.setInativity(true) this.goback() - this.clearCode() + + setTimeout(()=>{ + this.clearCode() + }, 1000) + } else { this.toastService.badRequest('Pin incorreto') this.code = [] diff --git a/src/app/services/socket/synchro.service.ts b/src/app/services/socket/synchro.service.ts index 84407e941..8881a2829 100644 --- a/src/app/services/socket/synchro.service.ts +++ b/src/app/services/socket/synchro.service.ts @@ -135,7 +135,8 @@ 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 8056981ca12dca501e51e49273430de9ab5080cf Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Tue, 31 Aug 2021 10:54:00 +0100 Subject: [PATCH 12/67] Improve inactivity page --- src/app/home/home-routing.module.ts | 10 ++++++++++ src/app/modals/profile/profile.page.ts | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/app/home/home-routing.module.ts b/src/app/home/home-routing.module.ts index 014635651..564db5b3e 100644 --- a/src/app/home/home-routing.module.ts +++ b/src/app/home/home-routing.module.ts @@ -382,6 +382,16 @@ const routes: Routes = [ ], canActivate: [InactivityGuard] }, + { + path: 'login', + children: [ + { + path:'', + loadChildren: ()=> import('../pages/inactivity/inactivity.module').then(m => m.InactivityPageModule) + }, + ], + canActivate: [InactivityGuard] + }, { path: 'pin', children: [ diff --git a/src/app/modals/profile/profile.page.ts b/src/app/modals/profile/profile.page.ts index 6f77c2f10..33ec61cff 100644 --- a/src/app/modals/profile/profile.page.ts +++ b/src/app/modals/profile/profile.page.ts @@ -222,7 +222,7 @@ export class ProfilePage implements OnInit { SessionStore.setInativity(false) setTimeout(() => { - this.router.navigate(['/inactivity']); + this.router.navigate(['/login']); }, 100) } From b9b3f5be243fbdfbdba673f55e602d670e88e626 Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Tue, 31 Aug 2021 11:10:40 +0100 Subject: [PATCH 13/67] add web notification popup --- src/app/home/home.page.ts | 8 +++- .../web-notification-popup.service.spec.ts | 16 +++++++ .../web-notification-popup.service.ts | 47 +++++++++++++++++++ 3 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 src/app/services/notification/web-notification-popup.service.spec.ts create mode 100644 src/app/services/notification/web-notification-popup.service.ts diff --git a/src/app/home/home.page.ts b/src/app/home/home.page.ts index edc515e76..99dfec1bc 100644 --- a/src/app/home/home.page.ts +++ b/src/app/home/home.page.ts @@ -18,6 +18,7 @@ import { ExpedienteGdStore } from '../store/expedientegd-store.service'; import { InativityService } from '../services/inativity.service'; import { SessionStore } from '../store/session.service'; import { StorageService } from '../services/storage.service'; +import { WebNotificationPopupService } from '../services/notification/web-notification-popup.service'; @Component({ selector: 'app-home', @@ -72,7 +73,10 @@ export class HomePage implements OnInit { public documentCounterService: DocumentCounterService, private despachoRule: DespachoService, private inativityService: InativityService, - private storageService: StorageService,) { + private storageService: StorageService, + private webNotificationPopupService: WebNotificationPopupService) { + + this.webNotificationPopupService.askNotificationPermission() this.router.events.subscribe((val) => { document.querySelectorAll('ion-modal').forEach((e: any) => e.remove()) @@ -176,6 +180,8 @@ export class HomePage implements OnInit { synchro.registerCallback('Notification', (DataArray)=> { + this.webNotificationPopupService.sendNotification(DataArray.Object) + this.storageService.get('Notifications').then((data)=>{ data.push(DataArray) this.storageService.store("Notifications", data) diff --git a/src/app/services/notification/web-notification-popup.service.spec.ts b/src/app/services/notification/web-notification-popup.service.spec.ts new file mode 100644 index 000000000..e45f02163 --- /dev/null +++ b/src/app/services/notification/web-notification-popup.service.spec.ts @@ -0,0 +1,16 @@ +import { TestBed } from '@angular/core/testing'; + +import { WebNotificationPopupService } from './web-notification-popup.service'; + +describe('WebNotificationPopupService', () => { + let service: WebNotificationPopupService; + + beforeEach(() => { + TestBed.configureTestingModule({}); + service = TestBed.inject(WebNotificationPopupService); + }); + + it('should be created', () => { + expect(service).toBeTruthy(); + }); +}); diff --git a/src/app/services/notification/web-notification-popup.service.ts b/src/app/services/notification/web-notification-popup.service.ts new file mode 100644 index 000000000..9520630a9 --- /dev/null +++ b/src/app/services/notification/web-notification-popup.service.ts @@ -0,0 +1,47 @@ +import { Injectable } from '@angular/core'; + +@Injectable({ + providedIn: 'root' +}) +export class WebNotificationPopupService { + + constructor() { } + + + askNotificationPermission() { + + // function to actually ask the permissions + function handlePermission(permission) {} + + // Let's check if the browser supports notifications + if (!('Notification' in window)) { + console.log("This browser does not support notifications."); + } else { + if(this.checkNotificationPromise()) { + Notification.requestPermission() + .then((permission) => { + handlePermission(permission); + }) + } else { + Notification.requestPermission(function(permission) { + handlePermission(permission); + }); + } + } + } + + + private checkNotificationPromise() { + try { + Notification.requestPermission().then(); + } catch(e) { + return false; + } + + return true; + } + + sendNotification(message) { + var n = new Notification(message); + } +} From 12e8b2fdf06c0398a96e70309a193cbf858b2873 Mon Sep 17 00:00:00 2001 From: "tiago.kayaya" Date: Tue, 31 Aug 2021 11:29:28 +0100 Subject: [PATCH 14/67] save --- config.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.xml b/config.xml index 7b18d7926..97d2fb38d 100644 --- a/config.xml +++ b/config.xml @@ -3,7 +3,7 @@ gabinete digital An awesome Ionic/Cordova app. Ionic Framework Team - + From 60fdcfa42eb550c6acb9929e93309985f47a92c8 Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Tue, 31 Aug 2021 11:44:10 +0100 Subject: [PATCH 15/67] 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 16/67] 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 17/67] 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 22/67] 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 23/67] 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 24/67] 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 25/67] 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) + } + } +} From 40a6a4d37a0fc4692f32ea7b4cf07af73d597191 Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Tue, 31 Aug 2021 16:44:03 +0100 Subject: [PATCH 26/67] reduz repeated code --- src/app/pages/agenda/agenda.page.ts | 32 +++--- src/app/services/ageanda/list-box.service.ts | 106 ++++++------------- 2 files changed, 49 insertions(+), 89 deletions(-) diff --git a/src/app/pages/agenda/agenda.page.ts b/src/app/pages/agenda/agenda.page.ts index 6af359567..eb2b3f70c 100644 --- a/src/app/pages/agenda/agenda.page.ts +++ b/src/app/pages/agenda/agenda.page.ts @@ -464,7 +464,7 @@ export class AgendaPage implements OnInit { // loop this.calendarService.pushEvent(response, 'md'); - this.TimelineMDList = this.listBoxService.list(this.calendarService.eventSource, 'md', this.rangeStartDate, this.rangeEndDate, 'date') + this.TimelineMDList = this.listBoxService.list(this.calendarService.eventSource, 'md', this.rangeStartDate, this.rangeEndDate, {}) this.myCal.update(); this.myCal.loadEvents(); @@ -485,7 +485,7 @@ export class AgendaPage implements OnInit { // calendar this.calendarService.pushEvent(response, 'pr'); - this.TimelineMDList = this.listBoxService.list(this.calendarService.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, 'date') + this.TimelineMDList = this.listBoxService.list(this.calendarService.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, {}) this.myCal.update(); this.myCal.loadEvents(); @@ -511,7 +511,7 @@ export class AgendaPage implements OnInit { this.calendarService.pushEvent(response, 'pr'); - this.TimelineMDList = this.listBoxService.list(this.calendarService.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, 'date') + this.TimelineMDList = this.listBoxService.list(this.calendarService.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, {}) this.myCal.update(); @@ -539,7 +539,7 @@ export class AgendaPage implements OnInit { this.calendarService.pushEvent(eventsList, 'md'); - this.TimelineMDList = this.listBoxService.list(this.calendarService.eventSource, 'md', this.rangeStartDate, this.rangeEndDate, 'date') + this.TimelineMDList = this.listBoxService.list(this.calendarService.eventSource, 'md', this.rangeStartDate, this.rangeEndDate, {}) this.myCal.update(); this.myCal.loadEvents(); @@ -553,17 +553,13 @@ export class AgendaPage implements OnInit { } else{ this.eventService.getAllPrEvents(momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59')).then((response:any) => { - //this.eventSource=[]; - // clear the current month only this.calendarService.removeRange(startTime, endTime, 'pr') const eventsList = response.filter(data => data.CalendarName == "Pessoal"); this.calendarService.pushEvent(eventsList, 'pr'); - - this.TimelineMDList = this.listBoxService.list(this.calendarService.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, 'date') - + this.TimelineMDList = this.listBoxService.list(this.calendarService.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, {}) this.myCal.update(); this.myCal.loadEvents(); @@ -592,7 +588,7 @@ export class AgendaPage implements OnInit { this.calendarService.pushEvent(eventsList, 'md'); - this.TimelineMDList = this.listBoxService.list(this.calendarService.eventSource, 'md', this.rangeStartDate, this.rangeEndDate, 'date') + this.TimelineMDList = this.listBoxService.list(this.calendarService.eventSource, 'md', this.rangeStartDate, this.rangeEndDate, {}) this.myCal.update(); this.myCal.loadEvents(); @@ -614,7 +610,7 @@ export class AgendaPage implements OnInit { this.calendarService.pushEvent(eventsList, 'pr'); - this.TimelineMDList = this.listBoxService.list(this.calendarService.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, 'date') + this.TimelineMDList = this.listBoxService.list(this.calendarService.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, {}) this.myCal.update(); this.myCal.loadEvents(); @@ -645,7 +641,7 @@ export class AgendaPage implements OnInit { // loop this.calendarService.pushEvent(eventsList, 'md'); - this.TimelineMDList = this.listBoxService.list(this.calendarService.eventSource, 'md', this.rangeStartDate, this.rangeEndDate, 'date') + this.TimelineMDList = this.listBoxService.list(this.calendarService.eventSource, 'md', this.rangeStartDate, this.rangeEndDate, {}) this.myCal.update(); this.myCal.loadEvents(); @@ -674,7 +670,7 @@ export class AgendaPage implements OnInit { this.calendarService.pushEvent(eventsList, 'pr'); - this.TimelinePRList = this.listBoxService.list(this.calendarService.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, 'date') + this.TimelinePRList = this.listBoxService.list(this.calendarService.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, {}) this.myCal.update(); this.myCal.loadEvents(); @@ -712,7 +708,7 @@ export class AgendaPage implements OnInit { this.calendarService.pushEvent(eventsList, 'pr'); - this.TimelinePRList = this.listBoxService.list(this.calendarService.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, 'date') + this.TimelinePRList = this.listBoxService.list(this.calendarService.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, {}) this.myCal.update(); @@ -739,8 +735,8 @@ export class AgendaPage implements OnInit { updateEventListBox() { - 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') + this.TimelinePRList = this.listBoxService.list(this.calendarService.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, {}) + this.TimelineMDList = this.listBoxService.list(this.calendarService.eventSource, 'md', this.rangeStartDate, this.rangeEndDate, {}) } @@ -939,13 +935,13 @@ export class AgendaPage implements OnInit { if(this.profile == "mdgpr") { this.profile ="pr"; this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate); - this.TimelineMDList = this.listBoxService.list(this.calendarService.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, 'date') + this.TimelineMDList = this.listBoxService.list(this.calendarService.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, {}) } else { this.profile ="mdgpr"; this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate); - this.TimelineMDList = this.listBoxService.list(this.calendarService.eventSource, 'md', this.rangeStartDate, this.rangeEndDate, 'date') + this.TimelineMDList = this.listBoxService.list(this.calendarService.eventSource, 'md', this.rangeStartDate, this.rangeEndDate, {}) } } diff --git a/src/app/services/ageanda/list-box.service.ts b/src/app/services/ageanda/list-box.service.ts index c514470e8..6e5458ae2 100644 --- a/src/app/services/ageanda/list-box.service.ts +++ b/src/app/services/ageanda/list-box.service.ts @@ -28,7 +28,7 @@ export class ListBoxService { daysBetween(){ } - list(eventSource: EventListStore[], profile: 'md' | 'pr' | 'all', rangeStartDate, randEndDate, calendarDate) { + list(eventSource: EventListStore[], profile: 'md' | 'pr' | 'all', rangeStartDate, randEndDate, {segment = 'todo'}) { console.log('eventSource: EventListStore[]',eventSource) @@ -71,8 +71,7 @@ export class ListBoxService { days[day] = [] } - if (new Date(startDate).toLocaleDateString() != new Date(endDate).toLocaleDateString()) { - + if (this.dateService.notSameDate(startDate, endDate)) { const diffDays = this.dateService.deferenceBetweenDays(endDate, startDate) @@ -80,27 +79,8 @@ export class ListBoxService { if (diffDays >= 1) { - const StartEvent = Object.assign({}, { - title: event.event.Subject, - start: event.start, - end: event.end, - color: event.color, - id: event.id, - index: event.index, - CalendarName: event.CalendarName, - event: { - Subject: event.event.Subject, - StartDate: event.event.StartDate, - EndDate: event.event.EndDate, - Location: event.event.Location, - EventId: event.event.EventId, - CalendarName: event.event.CalendarName - }, - startMany: true, - endMany: false, - middle: false - }) - + const StartEvent = this.transForm(event, {startMany: true,endMany: false, middle: false}) + days[day].push(StartEvent) let i = 1; @@ -126,53 +106,12 @@ export class ListBoxService { startDate.getDate() != endDate.getDate())) { // last push - const EndEvent = Object.assign({}, { - title: event.event.Subject, - start: event.start, - end: event.end, - color: event.color, - id: event.id, - index: event.index, - CalendarName: event.CalendarName, - event: { - Subject: event.event.Subject, - StartDate: event.event.StartDate, - EndDate: event.event.EndDate, - Location: event.event.Location, - EventId: event.event.EventId, - CalendarName: event.event.CalendarName - }, - Subject: event.event.Subject, - startMany: false, - endMany: true, - middle: false - }) - + const EndEvent = this.transForm(event, {startMany: false,endMany: true, middle: false}) days[otherDays].push(EndEvent) } else { - const EndEvent = Object.assign({}, { - title: event.event.Subject, - start: event.start, - end: event.end, - color: event.color, - id: event.id, - index: event.index, - profile: event, - CalendarName: event.CalendarName, - event: { - Subject: event.event.Subject, - StartDate: event.event.StartDate, - EndDate: event.event.EndDate, - Location: event.event.Location, - EventId: event.event.EventId, - CalendarName: event.event.CalendarName - }, - Subject: event.event.Subject, - startMany: false, - endMany: true, - middle: true - }) + + const EndEvent = this.transForm(event, {startMany: false,endMany: true, middle: true}) days[otherDays].push(EndEvent) } @@ -180,13 +119,10 @@ export class ListBoxService { } else { days[day].push(event) - } } else { days[day].push(event) - } - } days[day].push(event) @@ -231,4 +167,32 @@ export class ListBoxService { return events; } + + + transForm(event: CustomCalendarEvent, {startMany, endMany, middle}) { + return Object.assign({}, { + title: event.event.Subject, + start: event.start, + end: event.end, + color: event.color, + id: event.id, + index: event.index, + profile: event, + CalendarName: event.CalendarName, + event: { + Subject: event.event.Subject, + StartDate: event.event.StartDate, + EndDate: event.event.EndDate, + Location: event.event.Location, + EventId: event.event.EventId, + CalendarName: event.event.CalendarName + }, + Subject: event.event.Subject, + startMany: false, + endMany: true, + middle: true + }) + } + + } From 82a601ccecfad2a8b42e562b3f5ad39369b5ca2f Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Tue, 31 Aug 2021 19:30:08 +0100 Subject: [PATCH 27/67] Fix storage service --- src/app/home/home.page.ts | 2 +- src/app/services/ageanda/list-box.service.ts | 2 - .../web-notification-popup.service.ts | 3 ++ src/app/services/notifications.service.ts | 4 +- src/app/services/socket/synchro.service.ts | 4 +- src/app/services/storage.service.ts | 42 ++++--------------- 6 files changed, 16 insertions(+), 41 deletions(-) diff --git a/src/app/home/home.page.ts b/src/app/home/home.page.ts index b759fa172..4a358eb41 100644 --- a/src/app/home/home.page.ts +++ b/src/app/home/home.page.ts @@ -184,7 +184,7 @@ export class HomePage implements OnInit { this.webNotificationPopupService.sendNotification(DataArray.Object) - this.storageService.get('Notifications').then((data)=>{ + this.storageService.get('Notifications').then((data:any)=>{ data.push(DataArray) this.storageService.store("Notifications", data) }).catch(()=>{ diff --git a/src/app/services/ageanda/list-box.service.ts b/src/app/services/ageanda/list-box.service.ts index 6e5458ae2..5dff546f9 100644 --- a/src/app/services/ageanda/list-box.service.ts +++ b/src/app/services/ageanda/list-box.service.ts @@ -30,8 +30,6 @@ export class ListBoxService { list(eventSource: EventListStore[], profile: 'md' | 'pr' | 'all', rangeStartDate, randEndDate, {segment = 'todo'}) { - console.log('eventSource: EventListStore[]',eventSource) - if(profile != 'all') { eventSource = this.filterProfile(eventSource, profile) } diff --git a/src/app/services/notification/web-notification-popup.service.ts b/src/app/services/notification/web-notification-popup.service.ts index e4e89dc64..4dac3fe48 100644 --- a/src/app/services/notification/web-notification-popup.service.ts +++ b/src/app/services/notification/web-notification-popup.service.ts @@ -45,6 +45,9 @@ export class WebNotificationPopupService { } sendNotification(message) { + if (this.platform.is('desktop') || this.platform.is('mobileweb')) {} + else {return false} + var n = new Notification(message); } } diff --git a/src/app/services/notifications.service.ts b/src/app/services/notifications.service.ts index d04433176..cf7d3197c 100644 --- a/src/app/services/notifications.service.ts +++ b/src/app/services/notifications.service.ts @@ -54,9 +54,7 @@ export class NotificationsService { registerCallback(type: string, funx: Function, object: any = {} ) { this.callbacks.push({type, funx}) - if(!object.hasOwnProperty('desktop') && object['desktop'] != false) { - synchro.registerCallback('Notification',funx, type) - } + synchro.registerCallback('Notification',funx, type) } diff --git a/src/app/services/socket/synchro.service.ts b/src/app/services/socket/synchro.service.ts index dd19ac1f2..88eb2d374 100644 --- a/src/app/services/socket/synchro.service.ts +++ b/src/app/services/socket/synchro.service.ts @@ -133,8 +133,8 @@ class SynchroService { if(idConnection != this.id ) { - if(window['platform'].is('desktop') || this.platform.is('mobileweb')) {} - else return false + //if(window['platform'].is('desktop') || this.platform.is('mobileweb')) {} + //else return false if(environment.production) return false diff --git a/src/app/services/storage.service.ts b/src/app/services/storage.service.ts index 37bb2b92b..31efdf205 100644 --- a/src/app/services/storage.service.ts +++ b/src/app/services/storage.service.ts @@ -11,7 +11,6 @@ const { Storage } = Plugins; */ export class StorageService { private keyName: string; - constructor(private storage:Storage, private platform: Platform ) {} @@ -22,50 +21,27 @@ const { Storage } = Plugins; */ // Store the value async store(key: string, value: any) { - if (this.platform.is('desktop') || this.platform.is('mobileweb')) { - await localstoreService.set(this.key(key), value) - } else { - const encryptedValue = btoa(escape(JSON.stringify(value))); - await this.storage.set(key, encryptedValue); - } + + await localstoreService.set(this.key(key), value) } // Get the value - async get(key: string) { - - - if (this.platform.is('desktop') || this.platform.is('mobileweb')) { - return new Promise((resolve, reject)=>{ - const data = localstoreService.get(this.key(key), false) - if(data) resolve(data) - else reject(data) - }) - } else { - const ret = await this.storage.get(key).then((val) => { return val; }); - try { - return JSON.parse(unescape(atob(ret))); - } catch (error) { - if(ret == 'žée') { - throw(key+' not found') - } - return unescape(atob(ret)) - } - } + async get(key: string): Promise { + return new Promise((resolve, reject)=>{ + const data = localstoreService.get(this.key(key), false) + if(data) resolve(data) + else reject(data) + }) } async remove(key: string){ - if (this.platform.is('desktop') || this.platform.is('mobileweb')) { - await localstoreService.delete(this.key(key)) - } else { - await this.storage.remove(key); - } + await localstoreService.delete(this.key(key)) } - /* // Get the value async get(storageKey: string) { From 3437c190274e05cbd343ec10fad7e89963593d94 Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Tue, 31 Aug 2021 19:31:46 +0100 Subject: [PATCH 28/67] remove notification for mobile --- src/app/services/notifications.service.ts | 4 +++- src/app/services/socket/synchro.service.ts | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/app/services/notifications.service.ts b/src/app/services/notifications.service.ts index cf7d3197c..d04433176 100644 --- a/src/app/services/notifications.service.ts +++ b/src/app/services/notifications.service.ts @@ -54,7 +54,9 @@ export class NotificationsService { registerCallback(type: string, funx: Function, object: any = {} ) { this.callbacks.push({type, funx}) - synchro.registerCallback('Notification',funx, type) + if(!object.hasOwnProperty('desktop') && object['desktop'] != false) { + synchro.registerCallback('Notification',funx, type) + } } diff --git a/src/app/services/socket/synchro.service.ts b/src/app/services/socket/synchro.service.ts index 88eb2d374..dd19ac1f2 100644 --- a/src/app/services/socket/synchro.service.ts +++ b/src/app/services/socket/synchro.service.ts @@ -133,8 +133,8 @@ class SynchroService { if(idConnection != this.id ) { - //if(window['platform'].is('desktop') || this.platform.is('mobileweb')) {} - //else return false + if(window['platform'].is('desktop') || this.platform.is('mobileweb')) {} + else return false if(environment.production) return false From fb22023c5d7b9d3e6cfd854f030d30cc35a011d3 Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Tue, 31 Aug 2021 22:49:37 +0100 Subject: [PATCH 29/67] Improve notification --- src/app/home/home.page.ts | 2 +- src/app/services/notification/sw.js | 17 ++++++++ .../web-notification-popup.service.ts | 42 +++++++++++++++++-- 3 files changed, 57 insertions(+), 4 deletions(-) create mode 100644 src/app/services/notification/sw.js diff --git a/src/app/home/home.page.ts b/src/app/home/home.page.ts index 4a358eb41..71a17b5a8 100644 --- a/src/app/home/home.page.ts +++ b/src/app/home/home.page.ts @@ -182,7 +182,7 @@ export class HomePage implements OnInit { synchro.registerCallback('Notification', (DataArray)=> { - this.webNotificationPopupService.sendNotification(DataArray.Object) + this.webNotificationPopupService.sendNotification(DataArray) this.storageService.get('Notifications').then((data:any)=>{ data.push(DataArray) diff --git a/src/app/services/notification/sw.js b/src/app/services/notification/sw.js new file mode 100644 index 000000000..79be69284 --- /dev/null +++ b/src/app/services/notification/sw.js @@ -0,0 +1,17 @@ + +self.addEventListener('install', function() { + self.skipWaiting(); +}); + +self.addEventListener('activate', function(event) { + event.waitUntil(clients.claim()); +}); + +self.addEventListener('notificationclick', function(event) { + // Close the notification when it is clicked + event.notification.close(); + console.log(event) +}); + + + \ No newline at end of file diff --git a/src/app/services/notification/web-notification-popup.service.ts b/src/app/services/notification/web-notification-popup.service.ts index 4dac3fe48..c3f35da11 100644 --- a/src/app/services/notification/web-notification-popup.service.ts +++ b/src/app/services/notification/web-notification-popup.service.ts @@ -1,11 +1,20 @@ import { Injectable } from '@angular/core'; import { AlertController, Platform } from '@ionic/angular'; +import { v4 as uuidv4 } from 'uuid' @Injectable({ providedIn: 'root' }) export class WebNotificationPopupService { - constructor( private platform: Platform) { } + constructor( private platform: Platform) { + + var myWorker = new Worker( new URL('./sw.js', import.meta.url)); + + myWorker.onmessage = function(oEvent) { + console.log('Worker said : ' + oEvent.data); + } + + } askNotificationPermission() { @@ -44,10 +53,37 @@ export class WebNotificationPopupService { return true; } - sendNotification(message) { + cc = 0; + + sendNotification(e) { if (this.platform.is('desktop') || this.platform.is('mobileweb')) {} else {return false} + + Notification.requestPermission((result) => { + if (result === 'granted') { + navigator.serviceWorker.ready.then((registration)=> { + + registration.showNotification(e.Object+ this.cc, { + body: e.Service, + icon: 'assets/icon/favicon.png', + requireInteraction: true, + tag: 'require-interaction'+uuidv4(), + // actions: [ + // {action: 'like', title: 'Like', icon: 'https://example/like.png'}, + // {action: 'reply', title: 'Reply', icon: 'https://example/reply.png'} + // ] + }).then(e =>{ + console.log(e) + }) + + }); + + + + } + }); + + - var n = new Notification(message); } } From 36fa6b1d2ab98885e739396ed32410a38d9f79ef Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Tue, 31 Aug 2021 22:53:07 +0100 Subject: [PATCH 30/67] Improve notification --- .../notification/web-notification-popup.service.ts | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/app/services/notification/web-notification-popup.service.ts b/src/app/services/notification/web-notification-popup.service.ts index c3f35da11..406761332 100644 --- a/src/app/services/notification/web-notification-popup.service.ts +++ b/src/app/services/notification/web-notification-popup.service.ts @@ -8,11 +8,7 @@ export class WebNotificationPopupService { constructor( private platform: Platform) { - var myWorker = new Worker( new URL('./sw.js', import.meta.url)); - - myWorker.onmessage = function(oEvent) { - console.log('Worker said : ' + oEvent.data); - } + navigator.serviceWorker.register(new URL('./sw.js', import.meta.url)); } @@ -53,8 +49,6 @@ export class WebNotificationPopupService { return true; } - cc = 0; - sendNotification(e) { if (this.platform.is('desktop') || this.platform.is('mobileweb')) {} else {return false} @@ -63,7 +57,7 @@ export class WebNotificationPopupService { if (result === 'granted') { navigator.serviceWorker.ready.then((registration)=> { - registration.showNotification(e.Object+ this.cc, { + registration.showNotification(e.Object, { body: e.Service, icon: 'assets/icon/favicon.png', requireInteraction: true, From 99633533729aba580cffad67246f9cd0918113e1 Mon Sep 17 00:00:00 2001 From: "tiago.kayaya" Date: Wed, 1 Sep 2021 09:38:05 +0100 Subject: [PATCH 31/67] save --- src/app/pages/chat/chat.page.html | 4 +-- src/app/pages/chat/chat.page.scss | 1 + .../gabinete-digital.page.html | 26 +++++++++---------- .../gabinete-digital.page.scss | 4 +-- .../all-processes/all-processes.page.html | 2 +- .../all-processes/all-processes.page.scss | 4 +-- .../diplomas-assinar.page.html | 20 +++++++------- .../diplomas-assinar.page.scss | 10 +++---- .../diplomas/diplomas.page.html | 10 +++---- .../diplomas/diplomas.page.scss | 10 +++---- .../events-to-approve.page.html | 4 +-- .../expedientes-pr/expedientes-pr.page.html | 10 +++---- .../expedientes-pr/expedientes-pr.page.scss | 10 +++---- .../expedients/expedients.page.html | 14 +++++----- .../expedients/expedients.page.scss | 13 +++++----- .../generic/task-list/task-list.page.html | 2 +- .../pedidos/pedidos.page.html | 4 +-- .../pedidos/pedidos.page.scss | 4 +-- src/theme/variables.scss | 10 +++++++ 19 files changed, 87 insertions(+), 75 deletions(-) diff --git a/src/app/pages/chat/chat.page.html b/src/app/pages/chat/chat.page.html index 01ac162b7..0eaf46dde 100644 --- a/src/app/pages/chat/chat.page.html +++ b/src/app/pages/chat/chat.page.html @@ -42,7 +42,7 @@
-
@@ -76,7 +76,7 @@
+ class="item item-hover d-flex">
diff --git a/src/app/pages/chat/chat.page.scss b/src/app/pages/chat/chat.page.scss index 9daa904a6..fba37f381 100644 --- a/src/app/pages/chat/chat.page.scss +++ b/src/app/pages/chat/chat.page.scss @@ -122,6 +122,7 @@ ion-content{ color: #fff; } } + .item-active{ color: #fff !important; background-color: #42b9fe !important; diff --git a/src/app/pages/gabinete-digital/gabinete-digital.page.html b/src/app/pages/gabinete-digital/gabinete-digital.page.html index 5dae4bfa1..210a03648 100644 --- a/src/app/pages/gabinete-digital/gabinete-digital.page.html +++ b/src/app/pages/gabinete-digital/gabinete-digital.page.html @@ -39,7 +39,7 @@
@@ -89,7 +89,7 @@
-
+
@@ -98,7 +98,7 @@

{{ totalDocumentStore.count }} Documentos

-
+
@@ -106,7 +106,7 @@

{{eventoaprovacaostore.countMd + eventoaprovacaostore.countPr}} Documentos

-
+
@@ -115,7 +115,7 @@
-
+
@@ -124,7 +124,7 @@

{{pendentesstore.count}} Documentos

-
+
@@ -133,7 +133,7 @@

{{ despachoprstore.count }} Documentos

-
+
@@ -141,7 +141,7 @@

{{despachoStore.count}} Documentos

-
+
@@ -150,7 +150,7 @@

{{pedidosstore.countparecer}} Documentos

-
+
@@ -172,7 +172,7 @@
--> -
+
@@ -184,7 +184,7 @@
-
+
@@ -193,7 +193,7 @@

{{ deplomasStore.deplomasReviewCount }} Documentos

-
+
@@ -202,7 +202,7 @@

{{ deplomasStore.countDiplomasAssinadoListCount }} Documentos

-
+
diff --git a/src/app/pages/gabinete-digital/gabinete-digital.page.scss b/src/app/pages/gabinete-digital/gabinete-digital.page.scss index 85eb31969..d4fba4516 100644 --- a/src/app/pages/gabinete-digital/gabinete-digital.page.scss +++ b/src/app/pages/gabinete-digital/gabinete-digital.page.scss @@ -154,9 +154,9 @@ ion-segment-button{ .exp-card-long{ cursor: pointer; user-select: none; - background: white; + //background: white; box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.07); - background: white; + //Sbackground: white; width: 360px; margin: 7px 20px; border-radius: 15px; diff --git a/src/app/shared/gabinete-digital/all-processes/all-processes.page.html b/src/app/shared/gabinete-digital/all-processes/all-processes.page.html index 45c681abf..c1c5b30a6 100644 --- a/src/app/shared/gabinete-digital/all-processes/all-processes.page.html +++ b/src/app/shared/gabinete-digital/all-processes/all-processes.page.html @@ -28,7 +28,7 @@
diff --git a/src/app/shared/gabinete-digital/all-processes/all-processes.page.scss b/src/app/shared/gabinete-digital/all-processes/all-processes.page.scss index 0cbc30bb6..b33103830 100644 --- a/src/app/shared/gabinete-digital/all-processes/all-processes.page.scss +++ b/src/app/shared/gabinete-digital/all-processes/all-processes.page.scss @@ -36,12 +36,12 @@ ion-list{ border-radius: 15px; box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.07); border:1px solid #e9e9e9 !important; - background-color: #fff !important; + //background-color: #fff !important; margin-bottom: 10px !important; padding: 15px; .item{ - background-color: var(--white); + //background-color: var(--white); margin: 0 auto; overflow: hidden; diff --git a/src/app/shared/gabinete-digital/diplomas-assinar/diplomas-assinar.page.html b/src/app/shared/gabinete-digital/diplomas-assinar/diplomas-assinar.page.html index 5a42d4af1..36f91d6e7 100644 --- a/src/app/shared/gabinete-digital/diplomas-assinar/diplomas-assinar.page.html +++ b/src/app/shared/gabinete-digital/diplomas-assinar/diplomas-assinar.page.html @@ -18,18 +18,18 @@ refreshingText="A actualizar..."> - - + +
- - + + -
@@ -60,19 +60,19 @@
- +
-
Lista vazia
- + diff --git a/src/app/shared/gabinete-digital/diplomas-assinar/diplomas-assinar.page.scss b/src/app/shared/gabinete-digital/diplomas-assinar/diplomas-assinar.page.scss index 69e7608e5..517d76d7c 100644 --- a/src/app/shared/gabinete-digital/diplomas-assinar/diplomas-assinar.page.scss +++ b/src/app/shared/gabinete-digital/diplomas-assinar/diplomas-assinar.page.scss @@ -40,7 +40,7 @@ } .ion-item-class{ padding: 0; - + } .label-text{ width: 100%; @@ -52,7 +52,7 @@ ion-item{ --background: none; } .item { - background-color: var(--white); + //background-color: var(--white); margin: 0 auto; overflow: hidden; } @@ -86,7 +86,7 @@ ion-item{ .div-icon ion-icon{ display: block; margin: 0 auto; - + } .div-content-expediente p, .div-content-pendentes p{ font-size: 14pt; @@ -166,7 +166,7 @@ ion-item{ .exp-workflow{ float: left; margin: 0 !important; - + .label{ border-radius: 15px; background: #ffb703; @@ -229,4 +229,4 @@ ion-item{ font-size: 45px; float: right; margin-right: 10px; -} \ No newline at end of file +} diff --git a/src/app/shared/gabinete-digital/diplomas/diplomas.page.html b/src/app/shared/gabinete-digital/diplomas/diplomas.page.html index 06e93b8cf..056dec629 100644 --- a/src/app/shared/gabinete-digital/diplomas/diplomas.page.html +++ b/src/app/shared/gabinete-digital/diplomas/diplomas.page.html @@ -26,7 +26,7 @@
@@ -63,7 +63,7 @@
@@ -94,15 +94,15 @@
-
Lista vazia
- + diff --git a/src/app/shared/gabinete-digital/diplomas/diplomas.page.scss b/src/app/shared/gabinete-digital/diplomas/diplomas.page.scss index f93c4bd0f..6a305a0f1 100644 --- a/src/app/shared/gabinete-digital/diplomas/diplomas.page.scss +++ b/src/app/shared/gabinete-digital/diplomas/diplomas.page.scss @@ -25,7 +25,7 @@ } .ion-item-class{ padding: 0; - + } .label-text{ width: 100%; @@ -40,7 +40,7 @@ ion-item{ //border-radius: 15px; //box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.07); //Sborder: solid 1px #e9e9e9; - background-color: var(--white); + //background-color: var(--white); margin: 0 auto; //padding: 10px; overflow: hidden; @@ -75,7 +75,7 @@ ion-item{ .div-icon ion-icon{ display: block; margin: 0 auto; - + } .div-content-expediente p, .div-content-pendentes p{ font-size: 14pt; @@ -157,7 +157,7 @@ ion-item{ .exp-workflow{ float: left; margin: 0 !important; - + .label{ border-radius: 15px; background: #ffb703; @@ -220,4 +220,4 @@ ion-item{ font-size: 45px; float: right; margin-right: 10px; -} \ No newline at end of file +} diff --git a/src/app/shared/gabinete-digital/events-to-approve/events-to-approve.page.html b/src/app/shared/gabinete-digital/events-to-approve/events-to-approve.page.html index 8890497cd..c3d4f6f0c 100644 --- a/src/app/shared/gabinete-digital/events-to-approve/events-to-approve.page.html +++ b/src/app/shared/gabinete-digital/events-to-approve/events-to-approve.page.html @@ -32,7 +32,7 @@
@@ -66,7 +66,7 @@
diff --git a/src/app/shared/gabinete-digital/expedientes-pr/expedientes-pr.page.html b/src/app/shared/gabinete-digital/expedientes-pr/expedientes-pr.page.html index b85b72640..8c128bda1 100644 --- a/src/app/shared/gabinete-digital/expedientes-pr/expedientes-pr.page.html +++ b/src/app/shared/gabinete-digital/expedientes-pr/expedientes-pr.page.html @@ -9,13 +9,13 @@
- +
@@ -47,15 +47,15 @@ -
Lista vazia
- + diff --git a/src/app/shared/gabinete-digital/expedientes-pr/expedientes-pr.page.scss b/src/app/shared/gabinete-digital/expedientes-pr/expedientes-pr.page.scss index 706482f8a..cd1087582 100644 --- a/src/app/shared/gabinete-digital/expedientes-pr/expedientes-pr.page.scss +++ b/src/app/shared/gabinete-digital/expedientes-pr/expedientes-pr.page.scss @@ -25,7 +25,7 @@ } .ion-item-class{ padding: 0; - + } .label-text{ width: 100%; @@ -75,7 +75,7 @@ ion-item{ .div-icon ion-icon{ display: block; margin: 0 auto; - + } .div-content-expediente p, .div-content-pendentes p{ font-size: 14pt; @@ -102,7 +102,7 @@ ion-item{ border-radius: 15px; box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.07); border:1px solid #e9e9e9 !important; - background-color: var(--white); + //background-color: var(--white); margin-bottom: 10px !important; padding: 15px; } @@ -156,7 +156,7 @@ ion-item{ .exp-workflow{ float: left; margin: 0 !important; - + .label{ border-radius: 15px; background: #ffb703; @@ -219,4 +219,4 @@ ion-item{ font-size: 45px; float: right; margin-right: 10px; -} \ No newline at end of file +} diff --git a/src/app/shared/gabinete-digital/expedients/expedients.page.html b/src/app/shared/gabinete-digital/expedients/expedients.page.html index 621163895..05473058e 100644 --- a/src/app/shared/gabinete-digital/expedients/expedients.page.html +++ b/src/app/shared/gabinete-digital/expedients/expedients.page.html @@ -17,13 +17,13 @@ refreshingText="A actualizar..."> - +
-
@@ -55,15 +55,15 @@
-
Lista vazia
- +
- + diff --git a/src/app/shared/gabinete-digital/expedients/expedients.page.scss b/src/app/shared/gabinete-digital/expedients/expedients.page.scss index 706482f8a..7eabe2f6c 100644 --- a/src/app/shared/gabinete-digital/expedients/expedients.page.scss +++ b/src/app/shared/gabinete-digital/expedients/expedients.page.scss @@ -25,7 +25,7 @@ } .ion-item-class{ padding: 0; - + } .label-text{ width: 100%; @@ -40,7 +40,7 @@ ion-item{ //border-radius: 15px; //box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.07); //Sborder: solid 1px #e9e9e9; - background-color: var(--white); + //background-color: var(--white); margin: 0 auto; //padding: 10px; overflow: auto; @@ -53,6 +53,7 @@ ion-item{ margin: 10px 0 10px 0; background: #dae3f3; border-radius: 20px; + border: 1px solid red; } .div-content-pendentes{ width: 100%; @@ -75,7 +76,7 @@ ion-item{ .div-icon ion-icon{ display: block; margin: 0 auto; - + } .div-content-expediente p, .div-content-pendentes p{ font-size: 14pt; @@ -102,7 +103,7 @@ ion-item{ border-radius: 15px; box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.07); border:1px solid #e9e9e9 !important; - background-color: var(--white); + //background-color: transparent; margin-bottom: 10px !important; padding: 15px; } @@ -156,7 +157,7 @@ ion-item{ .exp-workflow{ float: left; margin: 0 !important; - + .label{ border-radius: 15px; background: #ffb703; @@ -219,4 +220,4 @@ ion-item{ font-size: 45px; float: right; margin-right: 10px; -} \ No newline at end of file +} diff --git a/src/app/shared/gabinete-digital/generic/task-list/task-list.page.html b/src/app/shared/gabinete-digital/generic/task-list/task-list.page.html index dcda5489b..1358175c1 100644 --- a/src/app/shared/gabinete-digital/generic/task-list/task-list.page.html +++ b/src/app/shared/gabinete-digital/generic/task-list/task-list.page.html @@ -5,7 +5,7 @@
diff --git a/src/app/shared/gabinete-digital/pedidos/pedidos.page.html b/src/app/shared/gabinete-digital/pedidos/pedidos.page.html index 1887bb852..97a5a57bb 100644 --- a/src/app/shared/gabinete-digital/pedidos/pedidos.page.html +++ b/src/app/shared/gabinete-digital/pedidos/pedidos.page.html @@ -35,7 +35,7 @@
@@ -72,7 +72,7 @@
diff --git a/src/app/shared/gabinete-digital/pedidos/pedidos.page.scss b/src/app/shared/gabinete-digital/pedidos/pedidos.page.scss index b8fbc29f0..a8b52045f 100644 --- a/src/app/shared/gabinete-digital/pedidos/pedidos.page.scss +++ b/src/app/shared/gabinete-digital/pedidos/pedidos.page.scss @@ -39,8 +39,8 @@ ion-item{ .item { //border-radius: 15px; //box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.07); - //Sborder: solid 1px #e9e9e9; - background-color: var(--white); + //border: solid 1px #e9e9e9; + //background-color: var(--white); margin: 0 auto; //padding: 10px; overflow: hidden; diff --git a/src/theme/variables.scss b/src/theme/variables.scss index b7b9788f3..9da84140a 100644 --- a/src/theme/variables.scss +++ b/src/theme/variables.scss @@ -367,6 +367,16 @@ $app-theme: mat-light-theme(( /* .event-actions-popover ion-list{ } */ + +.item-hover:hover{ + background-color: #e6f6ff75 !important; +} + +.box-hover:hover{ + background-color: #e6f6ff75 !important; + border: 1px solid #42b9fe !important; +} + .Rectangle { border-radius: 15px; box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.07); From c7f8d5a5838fb08a06915df3bbf8153f1d15f0df Mon Sep 17 00:00:00 2001 From: "tiago.kayaya" Date: Wed, 1 Sep 2021 12:17:40 +0100 Subject: [PATCH 32/67] save --- src/app/guards/login.guard.ts | 5 ++--- src/app/pages/events/events.page.html | 4 ++-- src/app/pages/events/events.page.scss | 26 +++++++++++++++----------- 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/src/app/guards/login.guard.ts b/src/app/guards/login.guard.ts index 848df6137..e723767e6 100644 --- a/src/app/guards/login.guard.ts +++ b/src/app/guards/login.guard.ts @@ -20,9 +20,8 @@ export class LoginGuard implements CanActivate { this.router.navigate(['/home/events']); return false } else { - - return true + return true; } } - + } diff --git a/src/app/pages/events/events.page.html b/src/app/pages/events/events.page.html index 7ce9f393c..469840e51 100644 --- a/src/app/pages/events/events.page.html +++ b/src/app/pages/events/events.page.html @@ -47,7 +47,7 @@ -
@@ -94,7 +94,7 @@
-
diff --git a/src/app/pages/events/events.page.scss b/src/app/pages/events/events.page.scss index 9434c2c5b..a29948aa5 100644 --- a/src/app/pages/events/events.page.scss +++ b/src/app/pages/events/events.page.scss @@ -81,7 +81,7 @@ ion-toolbar{ margin-right: 5px; line-height: 25px; } - + .p-small{ font-size: 13pt; margin-top: 13px; @@ -90,7 +90,7 @@ ion-toolbar{ text-align: right; /* color: #ffffff; */ } - + /* CONTENT */ .item-list-small{ font-size: 14px; @@ -98,14 +98,14 @@ ion-toolbar{ } .ion-item-class{ padding: 0; - + } .label-text{ width: 100%; padding: 0; margin: 0; } - + //DIV .div-item-Oficial{ width: 100%; @@ -146,7 +146,7 @@ ion-toolbar{ .div-icon ion-icon{ display: block; margin: 0 auto; - + } .div-content-Oficial{ width: 85%; @@ -312,7 +312,7 @@ ion-toolbar{ color: var(--white); margin-right: 7px; } - + .meeting-description { margin-top: 2px; font-family: Roboto; @@ -347,12 +347,13 @@ ion-toolbar{ .title { display: flex; align-items: center; + .icon{ color: #e8e8e8; height: 35px; width: 35px; margin-right: 10px; - } + } .text{ font-family: Roboto; font-size: 20px; @@ -372,6 +373,7 @@ ion-toolbar{ overflow: auto; padding-top: 5px; padding-bottom: 5px; + background-color: transparent !important; } ion-list{ padding: 0px; @@ -389,6 +391,8 @@ ion-toolbar{ display: flex; justify-content: space-between; align-items: center; + --background: transparent !important; + .schedule-time{ margin-right: 10px; .time-start{ @@ -418,7 +422,7 @@ ion-toolbar{ font-size: 13px; color: black; width: 100%; - + } .description{ width: 100%; @@ -446,7 +450,7 @@ ion-toolbar{ padding-bottom: unset !important; } } - + } .resume{ @@ -484,7 +488,7 @@ ion-toolbar{ .content, .conteiner-box{ height: unset !important; max-height: unset !important; - } + } } @@ -512,4 +516,4 @@ ion-toolbar{ ion-title{ border: 1px solid red; text-overflow: ellipsis; -} \ No newline at end of file +} From adecc6ebd09e8dc5aab1d37cdb3a0434121e460b Mon Sep 17 00:00:00 2001 From: "tiago.kayaya" Date: Wed, 1 Sep 2021 17:14:57 +0100 Subject: [PATCH 33/67] save --- src/app/pages/agenda/agenda.page.html | 14 +++++++------- src/app/pages/chat/messages/messages.page.ts | 16 +++++++++++++--- src/app/pages/login/login.page.ts | 2 +- src/app/services/chat.service.ts | 2 +- .../agenda/event-list/event-list.page.html | 2 +- 5 files changed, 23 insertions(+), 13 deletions(-) diff --git a/src/app/pages/agenda/agenda.page.html b/src/app/pages/agenda/agenda.page.html index 736ecbf38..8251c8678 100644 --- a/src/app/pages/agenda/agenda.page.html +++ b/src/app/pages/agenda/agenda.page.html @@ -17,7 +17,7 @@
- +
@@ -219,7 +219,7 @@
- +
@@ -229,7 +229,7 @@
-
@@ -271,7 +271,7 @@
-
@@ -327,7 +327,7 @@
- - - \ No newline at end of file + diff --git a/src/app/pages/chat/messages/messages.page.ts b/src/app/pages/chat/messages/messages.page.ts index 2b6880152..678d7e141 100644 --- a/src/app/pages/chat/messages/messages.page.ts +++ b/src/app/pages/chat/messages/messages.page.ts @@ -1,6 +1,7 @@ import { AfterViewChecked, AfterViewInit, Component, ElementRef, OnDestroy, OnInit, ViewChild } from '@angular/core'; import {ActivatedRoute, Router} from '@angular/router' import { ModalController, NavParams, PopoverController } from '@ionic/angular'; +import { map } from 'rxjs/operators'; import { ContactsPage } from 'src/app/pages/chat/messages/contacts/contacts.page'; import { AlertService } from 'src/app/services/alert.service'; import { AuthService } from 'src/app/services/auth.service'; @@ -151,7 +152,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy { loadMessages() { this.showLoader = true; const roomId = this.roomId - + this.chatService.getRoomMessages(this.roomId).subscribe(res => { /* console.log(res); */ this.messages = res['messages'].reverse(); @@ -252,9 +253,18 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy { } async serverLongPull() { + alert('YAS') const roomId = this.roomId - this.chatService.getRoomMessages(roomId).subscribe(async res => { + + this.chatService.getRoomMessages(roomId).subscribe(res=>{ + console.log(res); + + }) + + + /* this.chatService.getRoomMessages(roomId).subscribe(async res => { + if (res == 502) { // Connection timeout @@ -287,7 +297,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy { //this.loadMessages() await this.serverLongPull(); } - }); + }); */ } } diff --git a/src/app/pages/login/login.page.ts b/src/app/pages/login/login.page.ts index ee388ca95..5500b8c4d 100644 --- a/src/app/pages/login/login.page.ts +++ b/src/app/pages/login/login.page.ts @@ -102,7 +102,7 @@ export class LoginPage implements OnInit { if (attempt) { await this.authService.loginChat(this.userattempt); await this.getToken(); - + this.router.navigate(['/pin']); } diff --git a/src/app/services/chat.service.ts b/src/app/services/chat.service.ts index 8d21e8119..440a2e978 100644 --- a/src/app/services/chat.service.ts +++ b/src/app/services/chat.service.ts @@ -99,7 +99,7 @@ export class ChatService { let opts = { headers: this.headers, - params: params + params: params, } return this.http.get(environment.apiChatUrl+'im.history', opts); } diff --git a/src/app/shared/agenda/event-list/event-list.page.html b/src/app/shared/agenda/event-list/event-list.page.html index 348467823..71ac37fc9 100644 --- a/src/app/shared/agenda/event-list/event-list.page.html +++ b/src/app/shared/agenda/event-list/event-list.page.html @@ -33,7 +33,7 @@
From 3937c0c9c83774eb2f37bab8f8a94b63bb540d00 Mon Sep 17 00:00:00 2001 From: "tiago.kayaya" Date: Wed, 1 Sep 2021 17:32:11 +0100 Subject: [PATCH 34/67] save --- src/app/pages/publications/publications.page.html | 8 ++++---- src/app/pages/publications/publications.page.scss | 13 ++++++++++--- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/app/pages/publications/publications.page.html b/src/app/pages/publications/publications.page.html index 25305ce60..081edd3a9 100644 --- a/src/app/pages/publications/publications.page.html +++ b/src/app/pages/publications/publications.page.html @@ -42,8 +42,8 @@ -
+ class="item-hover width-100 d-flex ion-no-border ion-no-margin ion-no-padding"> +
@@ -87,12 +87,12 @@ *ngFor="let evento of publicationEventFolderStorage.list" >
-
+

{{evento.Description}}

diff --git a/src/app/pages/publications/publications.page.scss b/src/app/pages/publications/publications.page.scss index 1a9c5cd92..8fc9f6a7d 100644 --- a/src/app/pages/publications/publications.page.scss +++ b/src/app/pages/publications/publications.page.scss @@ -39,7 +39,7 @@ ion-toolbar{ margin-right: 10px; } } - + ion-content{ // --background:#0782c9; --border: none; @@ -52,7 +52,7 @@ ion-toolbar{ overflow:hidden; color:#000; transform: translate3d(0, 1px, 0); - + .title-content{ margin: 0px auto; padding: 0 !important; @@ -100,6 +100,9 @@ ion-toolbar{ //border: 1px solid red; } } + ion-item{ + --background: transparent; + } .item{ width: 100% !important; padding: 0px !important; @@ -107,6 +110,7 @@ ion-toolbar{ align-items: center; justify-content: space-between; flex-direction: row; + background-color: transparent; .item-icon{ //margin-top: 28px; @@ -162,6 +166,9 @@ ion-toolbar{ font-size: 20px; } } + .item:hover{ + background-color: #e6f6ff75 !important; + } ion-item-options{ border: 1px solid #fff; @@ -207,7 +214,7 @@ ion-toolbar{ margin: 12px; border: 1px solid #d30a0a; } - + From 3614a2eba7e48dbdd0bc98feeb8ddfbcecc09d2a Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Thu, 2 Sep 2021 10:12:18 +0100 Subject: [PATCH 35/67] Fix login layout --- src/app/Rules/despacho.service.ts | 15 + src/app/home/home.page.ts | 4 +- src/app/pages/agenda/agenda.page.ts | 3 - src/app/pages/events/events.page.ts | 2 +- src/app/pages/inactivity/inactivity.page.html | 2 +- src/app/pages/inactivity/inactivity.page.scss | 366 ++++++++++++------ src/app/pages/inactivity/inactivity.page.ts | 42 +- src/app/pages/login/login.page.scss | 6 +- src/app/pages/login/login.page.ts | 4 +- .../web-notification-popup.service.ts | 2 - 10 files changed, 301 insertions(+), 145 deletions(-) diff --git a/src/app/Rules/despacho.service.ts b/src/app/Rules/despacho.service.ts index 1d07c2698..d6356b8a2 100644 --- a/src/app/Rules/despacho.service.ts +++ b/src/app/Rules/despacho.service.ts @@ -6,6 +6,7 @@ import { CustomTaskPipe } from '../pipes/custom-task.pipe'; import { ProcessesService } from '../services/processes.service'; import { DespachoStore } from '../store/despacho-store.service'; import { LoaderService } from 'src/app/store/loader.service' +import { SessionStore } from '../store/session.service'; @Injectable({ providedIn: 'root' }) @@ -225,6 +226,20 @@ export class DespachoService { } + async getListPr() { + let result = await this.processes.GetTasksList("Despacho do Presidente da República", false).toPromise(); + + let despachosPr; + switch (SessionStore.user.Profile) { + case 'MDGPR': + despachosPr = result.reverse().filter(data => data.activityInstanceName == "Tarefa de Despacho"); + break; + case 'PR': + despachosPr = result.reverse().filter(data => data.activityInstanceName == "Concluir Despacho"); + break; + } + } + sortArrayISODate(myArray: any) { return myArray.sort(function(a, b) { return (a.CreateDate < b.CreateDate) ? -1 : ((a.CreateDate > b.CreateDate) ? 1 : 0); diff --git a/src/app/home/home.page.ts b/src/app/home/home.page.ts index 71a17b5a8..681b4155e 100644 --- a/src/app/home/home.page.ts +++ b/src/app/home/home.page.ts @@ -103,7 +103,8 @@ export class HomePage implements OnInit { ngOnInit() { /* this.network.checkNetworkConnection; this.network.checkNetworkDisconnection; */ - console.log('Active route ', this.router.url) + // console.log('Active route ', this.router.url) + if (this.platform.is('desktop') || this.platform.is('mobileweb')) { this.webnotification.webconnection(); this.webnotification.onReceviNotificationWeb(); @@ -165,7 +166,6 @@ export class HomePage implements OnInit { 'despachos', () => { this.despachoRule.getList({updateStore: true}) - } ) diff --git a/src/app/pages/agenda/agenda.page.ts b/src/app/pages/agenda/agenda.page.ts index eb2b3f70c..6cfc2ee4a 100644 --- a/src/app/pages/agenda/agenda.page.ts +++ b/src/app/pages/agenda/agenda.page.ts @@ -358,9 +358,6 @@ export class AgendaPage implements OnInit { get CalendarCurrentDay ():any { - /* console.log(this.viewDate.getDate(), '0_0') */ - // console.log(this.viewDate.getDate(), '0_0') - return this.viewDate.getDate() } diff --git a/src/app/pages/events/events.page.ts b/src/app/pages/events/events.page.ts index a3a986157..021e447cc 100644 --- a/src/app/pages/events/events.page.ts +++ b/src/app/pages/events/events.page.ts @@ -95,7 +95,7 @@ export class EventsPage implements OnInit { this.platform.resize.subscribe(async () => { //console.log('Resize event detected'); - console.log('Resize event detected'); + // console.log('Resize event detected'); }); diff --git a/src/app/pages/inactivity/inactivity.page.html b/src/app/pages/inactivity/inactivity.page.html index 5c971a7cd..b9e70878a 100644 --- a/src/app/pages/inactivity/inactivity.page.html +++ b/src/app/pages/inactivity/inactivity.page.html @@ -33,7 +33,7 @@
-
+
diff --git a/src/app/pages/inactivity/inactivity.page.scss b/src/app/pages/inactivity/inactivity.page.scss index b7c588f44..8756fb1f0 100644 --- a/src/app/pages/inactivity/inactivity.page.scss +++ b/src/app/pages/inactivity/inactivity.page.scss @@ -1,77 +1,79 @@ @import '~src/function.scss'; :host, app-login { - ion-content { - background: linear-gradient(180deg, #42B9FE 0%, #0782C9 100%) !important; - } + ion-content { + background: linear-gradient(180deg, #42B9FE 0%, #0782C9 100%) !important; + } } ion-content{ background-color: white !important; } .main-wrapper{ - background: linear-gradient(180deg, #42B9FE 0%, #0782C9 100%) !important; - display: flex; - width: 100vw; - height: 100vh; - overflow: auto; - background: white !important; - + background: linear-gradient(180deg, #42B9FE 0%, #0782C9 100%) !important; + display: flex; + width: 100vw; + height: 100vh; + overflow: auto; + background: white !important; + display: flex; + align-items: center; + justify-content: center; } .wrapper{ - /* width: 400px; */ - height: auto; - padding: 0 !important; - /* margin: auto !important; */ - overflow: auto; - width: 100%; - background: linear-gradient(180deg, #42B9FE 0%, #0782C9 100%) !important; + /* width: 400px; */ + height: auto; + padding: 0 !important; + /* margin: auto !important; */ + overflow: auto; + width: 100%; + background: linear-gradient(180deg, #42B9FE 0%, #0782C9 100%) !important; } .logo{ - width: 400px; - height: 400px; - background-position: center; - background-repeat: no-repeat; + width: 400px; + height: 400px; + background-position: center; + background-repeat: no-repeat; } .bg-1{ - width: 250px; - height: 250px; - overflow: auto; - border-radius: 50%; - background: #4cb9f825; - margin: auto; - .bg-2{ - width: 225px; - height: 225px; - overflow: auto; - border-radius: 50%; - background: #61bdf2b4; - margin: auto; - .bg-3{ - width: 200px; - height: 200px; - overflow: auto; - border-radius: 50%; - background: #96d3f8be; - margin: auto; - .bg-4{ - width: 175px; - height: 175px; - overflow: auto; - border-radius: 50%; - background: rgba(255, 255, 255, 0.918); - padding: 15px; - margin: auto; + width: 250px; + height: 250px; + overflow: auto; + border-radius: 50%; + background: #4cb9f825; + margin: auto; + .bg-2{ + width: 225px; + height: 225px; + overflow: auto; + border-radius: 50%; + background: #61bdf2b4; + margin: auto; + .bg-3{ + width: 200px; + height: 200px; + overflow: auto; + border-radius: 50%; + background: #96d3f8be; + margin: auto; + .bg-4{ + width: 175px; + height: 175px; + overflow: auto; + border-radius: 50%; + background: rgba(255, 255, 255, 0.918); + padding: 15px; + margin: auto; - .bg-4 img{ - width: 100%; - } - } - } - } + .bg-4 img{ + width: 100%; + } + } + } + } } .div-logo{ width: 200px !important; @@ -133,110 +135,216 @@ ion-item{ .circle{ - color: white; - width: 70px; - height: 70px; - display: flex; - align-items: center; - justify-content: center; - font-size: 19pt; - background: #44b5ea; - border-radius: 56px; - margin-bottom: 15px; - user-select: none; - margin-right: 15px; - margin-left: 15px; + color: white; + width: 70px; + height: 70px; + display: flex; + align-items: center; + justify-content: center; + font-size: 19pt; + background: #44b5ea; + border-radius: 56px; + margin-bottom: 15px; + user-select: none; + margin-right: 15px; + margin-left: 15px; } .title{ - padding-top: 32px; - z-index: 1000; - height: unset !important; - position: relative; - top: -30px; + padding-top: 32px; + z-index: 1000; + height: unset !important; + position: relative; + top: -30px; } .terminal { - padding-top: 49px; - justify-content: center; - display: flex; - flex-direction: column; - align-items: center; - background-image: url(/assets/background/auth.svg); - background-position: center; - background-repeat: no-repeat; - width: 100%; - padding-bottom: 48px; - margin-bottom: -58px; - z-index: 100; - margin-top: -80px; + justify-content: center; + display: flex; + flex-direction: column; + background-image: url(/assets/background/auth.svg); + background-position: center; + background-repeat: no-repeat; + width: 100%; + z-index: 100; + background-size: 610px; } .clear{ - color: #44b5ea; - font-size: 12pt; - z-index: 1000; + color: #44b5ea; + font-size: 12pt; + z-index: 1000; } .dot-active{ - background: #44b5ea; + background: #44b5ea; } .dot{ - width: 25px; - height: 25px; - margin: 0 10px 0 0; - border: 3px solid #44b5ea; - box-sizing: border-box; - border-radius: 50px; - -webkit-border-radius: 50px; - -moz-border-radius: 50px; - -ms-border-radius: 50px; - -o-border-radius: 50px; + width: 25px; + height: 25px; + margin: 0 10px 0 0; + border: 3px solid #44b5ea; + box-sizing: border-box; + border-radius: 50px; + -webkit-border-radius: 50px; + -moz-border-radius: 50px; + -ms-border-radius: 50px; + -o-border-radius: 50px; } .main-content { - width: 100vw; - height: 100vh; - background-color: white; - text-align: center; - align-items: center; - justify-content: center; - background-size: 686px 674px; - background-position: center; - background-position-y: 110px; - background-repeat: no-repeat; - margin: auto; - justify-content: space-around; + width: 100vw; + /* background-color: white; */ + text-align: center; + align-items: center; + /* justify-content: center; */ + background-size: 686px 674px; + background-position: center; + background-position-y: 110px; + background-repeat: no-repeat; + margin: auto; + /* justify-content: space-around; */ } .voltar{ - user-select: none; + user-select: none; } .msg-bottom{ - width: 100%; - color: #fff; - align-items: center; - justify-content: center; + width: 100%; + color: #fff; + align-items: center; + justify-content: center; - .msg-bottom-p{ - width: 220px; - position: absolute; - bottom: 0 !important; - text-align: center; - } + .msg-bottom-p{ + width: 220px; + position: absolute; + bottom: 0 !important; + text-align: center; + } } @media only screen and (max-height: 746px){ - .msg-bottom-p { - padding-top: 20px; - position: unset !important; - } + .msg-bottom-p { + padding-top: 20px; + position: unset !important; + } } .pin-4 { - z-index: 1000; - margin-bottom: 36px; + z-index: 1000; + margin-bottom: 107px; +} + + + +@media only screen and (min-height: 168px) { + .circle{ + width: 60px; + height: 60px; + margin-bottom: 7px; + margin-right: 7px; + margin-left: 7px; + } + .terminal{ + margin-top: -33px !important; + } + + .pin-4 { + position: relative; + top: 49px; + } + + .clear { + padding-top: 10px !important; + } + + .div-top-header { + position: unset ; + top: unset ; + } +} + +@media only screen and (min-height: 640px) { + .circle{ + width: 60px; + height: 60px; + margin-bottom: 9px; + margin-right: 9px; + margin-left: 9px; + } + .terminal{ + margin-top: -33px !important; + } + + .pin-4 { + position: relative; + top: 49px; + } + +} + +@media only screen and (min-height: 667px) { + .circle{ + width: 60px; + height: 60px; + margin-bottom: 7px; + margin-right: 7px; + margin-left: 7px; + } + .terminal{ + margin-top: 0px !important; + } + + .clear { + padding-top: 25px !important; + } +} + +@media only screen and (min-height: 731px) { + .circle{ + width: 63px; + height: 63px; + margin-bottom: 10px; + margin-right: 10px; + margin-left: 10px; + } + .terminal{ + margin-top: -33px !important; + } + + .pin-4 { + position: relative; + top: 35px; + } + + .div-top-header { + position: absolute !important; + top: 0px !important; + } + + +} + +@media only screen and (min-height: 832px) { + .circle{ + width: 65px; + height: 65px; + margin-bottom: 15px; + margin-right: 15px; + margin-left: 15px; + } + .terminal{ + margin-top: -33px !important; + } + + .pin-4 { + position: relative; + top: unset !important; + margin-bottom: 107px; + } + + } diff --git a/src/app/pages/inactivity/inactivity.page.ts b/src/app/pages/inactivity/inactivity.page.ts index 74437d4ea..223409792 100644 --- a/src/app/pages/inactivity/inactivity.page.ts +++ b/src/app/pages/inactivity/inactivity.page.ts @@ -32,7 +32,47 @@ export class InactivityPage implements OnInit { public alertController: AlertController ) {} - ngOnInit() {} + loop = false + + ngOnInit() { + + + // window.addEventListener('resize', (event) => { + // if(this.router.url != '/login') return false + + // if(this.loop == false) { + // this.loop = true + // this.runloop() + // } + + // }, true); + + } + + runloop() { + // const containerHeight = 651 + + // let circleHeight = document.querySelector('.circle')['offsetHeight'] + // let circleWidth = document.querySelector('.circle')['offsetWidth'] + // console.log(window.innerHeight, ' < ', containerHeight) + + // console.log(circleHeight) + + // document.querySelectorAll('.circle').forEach(e=>{ + // e['style']['height'] = (circleHeight -1 )+'px' + // e['style']['width'] = (circleWidth -1 )+'px' + // }) + + + // if( window.innerHeight< containerHeight) { + // setTimeout(()=>{ + // this.runloop() + // }, 100) + // } else { + // this.loop = false + // } + + } async presentAlert(message: string) { const alert = await this.alertController.create({ diff --git a/src/app/pages/login/login.page.scss b/src/app/pages/login/login.page.scss index 88f9eae74..103042085 100644 --- a/src/app/pages/login/login.page.scss +++ b/src/app/pages/login/login.page.scss @@ -144,7 +144,7 @@ ion-item{ user-select: none; } -.title{ +.title { padding-top: 32px; } @@ -203,7 +203,7 @@ ion-item{ align-items: center; justify-content: center; - .msg-bottom-p{ + .msg-bottom-p { width: 220px; position: absolute; bottom: 0 !important; @@ -211,7 +211,7 @@ ion-item{ } } -@media only screen and (max-height: 746px){ +@media only screen and (max-height: 746px) { .msg-bottom-p { padding-top: 20px; position: unset !important; diff --git a/src/app/pages/login/login.page.ts b/src/app/pages/login/login.page.ts index ee388ca95..f1a0441f4 100644 --- a/src/app/pages/login/login.page.ts +++ b/src/app/pages/login/login.page.ts @@ -6,7 +6,6 @@ import { ToastService } from 'src/app/services/toast.service'; import { environment } from 'src/environments/environment'; import { AlertController } from '@ionic/angular'; import { NotificationsService } from 'src/app/services/notifications.service'; -import { LocalstoreService } from 'src/app/store/localstore.service'; import { SessionStore } from 'src/app/store/session.service'; @Component({ @@ -32,8 +31,7 @@ export class LoginPage implements OnInit { private router: Router, private authService: AuthService, private toastService: ToastService, - public alertController: AlertController, - private localstoreService: LocalstoreService + public alertController: AlertController ) { } diff --git a/src/app/services/notification/web-notification-popup.service.ts b/src/app/services/notification/web-notification-popup.service.ts index 406761332..48c8e83da 100644 --- a/src/app/services/notification/web-notification-popup.service.ts +++ b/src/app/services/notification/web-notification-popup.service.ts @@ -71,8 +71,6 @@ export class WebNotificationPopupService { }) }); - - } }); From 1f2631fcdfcf17dd1bab7ca768f13f9bc3c030d3 Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Thu, 2 Sep 2021 12:17:14 +0100 Subject: [PATCH 36/67] Improve login --- src/app/guards/inactivity.guard.ts | 9 +++- src/app/guards/login.guard.ts | 12 +++-- .../edit-profile/edit-profile.page.html | 7 +-- .../profile/edit-profile/edit-profile.page.ts | 4 +- src/app/modals/profile/profile.page.ts | 5 +- src/app/pages/inactivity/inactivity.page.html | 31 ----------- src/app/pages/inactivity/inactivity.page.ts | 2 +- src/app/pages/login/login.page.ts | 52 ++++++++++--------- src/app/services/auth.service.ts | 2 +- src/app/services/inativity.service.ts | 2 +- 10 files changed, 51 insertions(+), 75 deletions(-) diff --git a/src/app/guards/inactivity.guard.ts b/src/app/guards/inactivity.guard.ts index 59e88cb68..d23bfb54e 100644 --- a/src/app/guards/inactivity.guard.ts +++ b/src/app/guards/inactivity.guard.ts @@ -2,6 +2,7 @@ import { Injectable } from '@angular/core'; import { ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot, UrlTree } from '@angular/router'; import { Observable } from 'rxjs'; import { SessionStore } from '../store/session.service'; +import { AlertController, Platform } from '@ionic/angular'; @Injectable({ providedIn: 'root' @@ -9,14 +10,18 @@ import { SessionStore } from '../store/session.service'; export class InactivityGuard implements CanActivate { constructor( - private router:Router + private router:Router, + private platform: Platform, ){} canActivate( route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable | Promise | boolean | UrlTree { - if(SessionStore.exist && SessionStore.user.Inactivity && !SessionStore.hasPin ) { + if (this.platform.is('desktop') || this.platform.is('mobileweb')) { + this.router.navigate(['/home/events']); + return false + } else if(SessionStore.exist && SessionStore.user.Inactivity && !SessionStore.hasPin ) { return true } else if(SessionStore.exist && !SessionStore.user.Inactivity) { return true diff --git a/src/app/guards/login.guard.ts b/src/app/guards/login.guard.ts index 848df6137..ecfdc9df4 100644 --- a/src/app/guards/login.guard.ts +++ b/src/app/guards/login.guard.ts @@ -8,19 +8,23 @@ import { SessionStore } from '../store/session.service'; providedIn: 'root' }) export class LoginGuard implements CanActivate { - constructor( private router:Router, - private localstoreService: LocalstoreService) { + constructor( private router:Router) { } canActivate( route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable | Promise | boolean | UrlTree { - if(window.location.pathname == '/' && SessionStore.exist ) { + if(SessionStore.exist && SessionStore.user.Inactivity && SessionStore.user.LoginPreference != 'Pin' ) { this.router.navigate(['/home/events']); return false + } else if(SessionStore.exist && !SessionStore.hasPin ) { + this.router.navigate(['/pin']); + return false + } else if(SessionStore.exist && !SessionStore.user.Inactivity && SessionStore.user.LoginPreference == 'Pin' ) { + this.router.navigate(['/inactivity']); + return false } else { - return true } } 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 ec1f40183..6d3fc6052 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 @@
-
diff --git a/src/app/modals/profile/edit-profile/edit-profile.page.ts b/src/app/modals/profile/edit-profile/edit-profile.page.ts index 84f1e8308..e535c7127 100644 --- a/src/app/modals/profile/edit-profile/edit-profile.page.ts +++ b/src/app/modals/profile/edit-profile/edit-profile.page.ts @@ -4,6 +4,7 @@ import { FingerprintPage } from 'src/app/shared/fingerprint/fingerprint.page'; import { PinPage } from 'src/app/shared/pin/pin.page'; import { SessionStore } from 'src/app/store/session.service'; import { environment } from 'src/environments/environment'; +import { Platform } from '@ionic/angular'; @Component({ selector: 'app-edit-profile', @@ -16,7 +17,8 @@ export class EditProfilePage implements OnInit { production = environment.production constructor(private modalController:ModalController, - private animationController: AnimationController + private animationController: AnimationController, + public platform: Platform, ) {} ngOnInit() {} diff --git a/src/app/modals/profile/profile.page.ts b/src/app/modals/profile/profile.page.ts index 33ec61cff..634a59c3f 100644 --- a/src/app/modals/profile/profile.page.ts +++ b/src/app/modals/profile/profile.page.ts @@ -11,7 +11,6 @@ import { JsonStore } from '../../services/jsonStore.service'; import { StorageService } from '../../services/storage.service'; import { NotificationsService } from '../../services/notifications.service'; import { SessionStore } from 'src/app/store/session.service'; -import { synchro } from 'src/app/services/socket/synchro.service'; @Component({ selector: 'app-profile', @@ -43,7 +42,7 @@ export class ProfilePage implements OnInit { private zone: NgZone, private notificationservice: NotificationsService, private platform: Platform, - private notificationsService: NotificationsService, + private notificationsService: NotificationsService, ) { this.loggeduser = authService.ValidatedUser; @@ -222,7 +221,7 @@ export class ProfilePage implements OnInit { SessionStore.setInativity(false) setTimeout(() => { - this.router.navigate(['/login']); + this.router.navigateByUrl('/', { replaceUrl: true }); }, 100) } diff --git a/src/app/pages/inactivity/inactivity.page.html b/src/app/pages/inactivity/inactivity.page.html index b9e70878a..ed7075b3e 100644 --- a/src/app/pages/inactivity/inactivity.page.html +++ b/src/app/pages/inactivity/inactivity.page.html @@ -1,37 +1,6 @@
-
- -
-
-
-
- -
-
-
-
-

Inicie a sessão

-
-

Email

- - - -

Palavra-passe

- - - -
- -
-
-
-

Uma iniciativa do Gabinete do Presidente da República

-
-
diff --git a/src/app/pages/inactivity/inactivity.page.ts b/src/app/pages/inactivity/inactivity.page.ts index 223409792..7ae1e66c6 100644 --- a/src/app/pages/inactivity/inactivity.page.ts +++ b/src/app/pages/inactivity/inactivity.page.ts @@ -110,7 +110,7 @@ export class InactivityPage implements OnInit { domainName: environment.domain, BasicAuthKey: "" } - let attempt = await this.authService.login(this.userattempt, false) + let attempt = await this.authService.login(this.userattempt, {saveSession: false}) if (attempt) { diff --git a/src/app/pages/login/login.page.ts b/src/app/pages/login/login.page.ts index f1a0441f4..04e468f91 100644 --- a/src/app/pages/login/login.page.ts +++ b/src/app/pages/login/login.page.ts @@ -16,7 +16,7 @@ import { SessionStore } from 'src/app/store/session.service'; export class LoginPage implements OnInit { logstatus: boolean; - username: string = environment.defaultuser; + username: string = SessionStore.user.Email || environment.defaultuser; password: string = environment.defaultuserpwd; userattempt: UserForm; code = [] @@ -35,26 +35,7 @@ export class LoginPage implements OnInit { ) { } - ngOnInit() { - - let userData = this.sessionStore.user - - const loginPreference = userData?.LoginPreference - const pin = userData?.PIN - - if (pin) { - this.hasPin = true - } else { - this.hasPin = false - } - - if (loginPreference) { - this.loginPreference = loginPreference - } else { - this.loginPreference = '' - } - - } + ngOnInit() {} //Function to validade the login inputs validateUsername() { @@ -95,13 +76,23 @@ export class LoginPage implements OnInit { domainName: environment.domain, BasicAuthKey: "" } - let attempt = await this.authService.login(this.userattempt) + + let attempt = await this.authService.login(this.userattempt, {saveSession: false}) if (attempt) { - await this.authService.loginChat(this.userattempt); - await this.getToken(); - this.router.navigate(['/pin']); + if (attempt.UserId == SessionStore.user.UserId) { + await this.authService.SetSession(attempt, this.userattempt); + this.authService.loginChat(this.userattempt); + this.getToken(); + SessionStore.setInativity(true) + this.goback() + } else { + SessionStore.delete() + window.localStorage.clear(); + await this.authService.SetSession(attempt, this.userattempt); + this.router.navigate(['/pin']); + } } } @@ -114,4 +105,15 @@ export class LoginPage implements OnInit { } } + + goback() { + const pathName = SessionStore.user.UrlBeforeInactivity + if(pathName) { + this.router.navigate([pathName]); + } else { + this.router.navigate(['/home/events']); + } + + } + } diff --git a/src/app/services/auth.service.ts b/src/app/services/auth.service.ts index b5339cc31..8f848e0a8 100644 --- a/src/app/services/auth.service.ts +++ b/src/app/services/auth.service.ts @@ -41,7 +41,7 @@ export class AuthService { } - async login(user: UserForm, saveSession = true): Promise { + async login(user: UserForm, {saveSession = true}): Promise { user.BasicAuthKey = 'Basic ' + btoa(user.username + ':' + this.aesencrypt.encrypt(user.password,user.username )); this.headers = this.headers.set('Authorization',user.BasicAuthKey); diff --git a/src/app/services/inativity.service.ts b/src/app/services/inativity.service.ts index 1ea52ceca..a93c50a3f 100644 --- a/src/app/services/inativity.service.ts +++ b/src/app/services/inativity.service.ts @@ -29,7 +29,7 @@ export class InativityService { function resetTimer() { clearTimeout(t); - t = setTimeout(userIsNotActive, 60000 * 5); // time is in milliseconds + t = setTimeout(userIsNotActive, 60000 * 15); // time is in milliseconds } } } From edc07d0d9ec842804fec7f8299042fdabc0da81b Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Thu, 2 Sep 2021 12:37:21 +0100 Subject: [PATCH 37/67] Fix --- src/app/store/localstore.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/store/localstore.service.ts b/src/app/store/localstore.service.ts index 221c3bf8a..cf5076fb4 100644 --- a/src/app/store/localstore.service.ts +++ b/src/app/store/localstore.service.ts @@ -6,7 +6,7 @@ import { AES, enc, SHA1 } from 'crypto-js' }) export class LocalstoreService { - private prefix = 'v16-' + private prefix = 'v17-' constructor() { From 5c4654e4dae51a64b99ed5b8c4f3998294b4ec6f Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Thu, 2 Sep 2021 12:40:26 +0100 Subject: [PATCH 38/67] Fix loop --- src/app/guards/login.guard.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/app/guards/login.guard.ts b/src/app/guards/login.guard.ts index ecfdc9df4..a14bab109 100644 --- a/src/app/guards/login.guard.ts +++ b/src/app/guards/login.guard.ts @@ -3,12 +3,13 @@ import { CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, UrlTree, Rout import { Observable } from 'rxjs'; import { LocalstoreService } from '../store/localstore.service'; import { SessionStore } from '../store/session.service'; +import { AlertController, Platform } from '@ionic/angular'; @Injectable({ providedIn: 'root' }) export class LoginGuard implements CanActivate { - constructor( private router:Router) { + constructor( private router:Router, private platform: Platform,) { } canActivate( @@ -18,10 +19,10 @@ export class LoginGuard implements CanActivate { if(SessionStore.exist && SessionStore.user.Inactivity && SessionStore.user.LoginPreference != 'Pin' ) { this.router.navigate(['/home/events']); return false - } else if(SessionStore.exist && !SessionStore.hasPin ) { + } else if(SessionStore.exist && !SessionStore.hasPin && !this.platform.is('desktop') && !this.platform.is('mobileweb') ) { this.router.navigate(['/pin']); return false - } else if(SessionStore.exist && !SessionStore.user.Inactivity && SessionStore.user.LoginPreference == 'Pin' ) { + } else if(SessionStore.exist && !SessionStore.user.Inactivity && SessionStore.user.LoginPreference == 'Pin' && !this.platform.is('desktop') && !this.platform.is('mobileweb')) { this.router.navigate(['/inactivity']); return false } else { From 1b49c11bb22e84408e2de2f4d6785e4ecb0f5c08 Mon Sep 17 00:00:00 2001 From: "tiago.kayaya" Date: Thu, 2 Sep 2021 13:19:50 +0100 Subject: [PATCH 39/67] save --- src/app/pages/chat/messages/messages.page.ts | 8 +-- .../pages/publications/publications.module.ts | 3 +- .../pages/publications/publications.page.html | 70 ++++++------------- .../pages/publications/publications.page.scss | 28 +++++--- .../pages/publications/publications.page.ts | 2 + 5 files changed, 49 insertions(+), 62 deletions(-) diff --git a/src/app/pages/chat/messages/messages.page.ts b/src/app/pages/chat/messages/messages.page.ts index 678d7e141..fdf2150ea 100644 --- a/src/app/pages/chat/messages/messages.page.ts +++ b/src/app/pages/chat/messages/messages.page.ts @@ -257,13 +257,13 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy { const roomId = this.roomId - this.chatService.getRoomMessages(roomId).subscribe(res=>{ + /* this.chatService.getRoomMessages(roomId).subscribe(res=>{ console.log(res); - }) + }) */ - /* this.chatService.getRoomMessages(roomId).subscribe(async res => { + this.chatService.getRoomMessages(roomId).subscribe(async res => { if (res == 502) { @@ -297,7 +297,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy { //this.loadMessages() await this.serverLongPull(); } - }); */ + }); } } diff --git a/src/app/pages/publications/publications.module.ts b/src/app/pages/publications/publications.module.ts index 0a65732bf..dbb7e19a7 100644 --- a/src/app/pages/publications/publications.module.ts +++ b/src/app/pages/publications/publications.module.ts @@ -14,13 +14,14 @@ import { NewActionPageModule } from 'src/app/shared/publication/new-action/new-a import { PublicationDetailPageModule } from 'src/app/shared/publication/view-publications/publication-detail/publication-detail.module'; import { HeaderPageModule } from 'src/app/shared/header/header.module'; import { EditActionPageModule } from 'src/app/shared/publication/edit-action/edit-action.module'; +import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; @NgModule({ imports: [ CommonModule, FormsModule, IonicModule, - + FontAwesomeModule, PublicationsPageRoutingModule, HeaderPageModule, ViewPublicationsPageModule, diff --git a/src/app/pages/publications/publications.page.html b/src/app/pages/publications/publications.page.html index 081edd3a9..2d76756ae 100644 --- a/src/app/pages/publications/publications.page.html +++ b/src/app/pages/publications/publications.page.html @@ -39,20 +39,23 @@
- -
+ class="item width-100 d-flex ion-no-border ion-no-margin ion-no-padding" + [class.item-active]="viagem.ProcessId == idSelected" + > +
- -

{{viagem.Description}}

-

{{viagem.Detail}}

+ +

{{viagem.Description}}

+

{{viagem.Detail}}

-
- +
+ +
@@ -68,38 +71,25 @@ - - - + +
-
+
- -

{{evento.Description}}

+ +

{{evento.Description}}

-
- +
+ +
@@ -115,22 +105,6 @@ -
diff --git a/src/app/pages/publications/publications.page.scss b/src/app/pages/publications/publications.page.scss index 8fc9f6a7d..9c7c8c04b 100644 --- a/src/app/pages/publications/publications.page.scss +++ b/src/app/pages/publications/publications.page.scss @@ -93,7 +93,7 @@ ion-toolbar{ } .aside{ - padding: 0px 20px 0 20px !important; + //padding: 0px 20px 0 20px !important; } } .content{ @@ -105,12 +105,13 @@ ion-toolbar{ } .item{ width: 100% !important; - padding: 0px !important; + padding: 0px 20px 0 20px !important; border-bottom: 1px solid #ebebeb; align-items: center; justify-content: space-between; flex-direction: row; background-color: transparent; + overflow: auto; .item-icon{ //margin-top: 28px; @@ -133,6 +134,7 @@ ion-toolbar{ width: 100%; padding: 15px 0 15px 10px; overflow: auto; + margin-right: 5px; p{ white-space: nowrap; @@ -158,16 +160,24 @@ ion-toolbar{ margin: 0 !important; padding: 0 !important; } - } - - .item-options{ - - width: 25px; - font-size: 20px; + .item-options{ + color: #42b9fe; + width: 25px; + font-size: 20px; + } + .item-content-date-active, .item-content-title-active, .item-content-detail-active, .item-options-active{ + color: #fff; + } } } + + .item-active{ + background-color: #42b9fe !important; + color: #fff !important; + } + .item:hover{ - background-color: #e6f6ff75 !important; + background-color: #e6f6ff75; } ion-item-options{ diff --git a/src/app/pages/publications/publications.page.ts b/src/app/pages/publications/publications.page.ts index 0c85a3de9..799c6f822 100644 --- a/src/app/pages/publications/publications.page.ts +++ b/src/app/pages/publications/publications.page.ts @@ -54,6 +54,7 @@ export class PublicationsPage implements OnInit { //publication: object; hideRefreshBtn = true; showSlidingOptions = true; + idSelected: string; constructor( private router: Router, @@ -213,6 +214,7 @@ export class PublicationsPage implements OnInit { goToPublicationsList(folderId: string){ this.folderId = folderId + this.idSelected = folderId; if( window.innerWidth <= 800){ this.router.navigate(['/home/publications',folderId]); From aa48d25810085f875672dd8bfcfb17189e691eb7 Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Thu, 2 Sep 2021 14:23:17 +0100 Subject: [PATCH 40/67] Fix --- src/app/guards/login.guard.ts | 3 +-- .../despachos-pr/despacho-pr/despacho-pr.page.html | 8 ++++---- .../despachos/despacho/despacho.page.html | 4 ++-- .../diploma-assinar/diploma-assinar.page.html | 4 ++-- .../gabinete-digital/diplomas/diploma/diploma.page.html | 4 ++-- .../expediente-detail/expediente-detail.page.html | 2 +- .../expedientes-pr/expediente-pr/expediente-pr.page.html | 4 ++-- .../gabinete-digital/pedidos/pedido/pedido.page.html | 4 ++-- .../publication-detail/publication-detail.page.ts | 7 +++++-- .../popover/despachos-options/despachos-options.page.html | 2 +- .../despachos-pr-options/despachos-pr-options.page.html | 2 +- .../popover/opts-expediente/opts-expediente.page.html | 2 +- 12 files changed, 24 insertions(+), 22 deletions(-) diff --git a/src/app/guards/login.guard.ts b/src/app/guards/login.guard.ts index a14bab109..16aa98223 100644 --- a/src/app/guards/login.guard.ts +++ b/src/app/guards/login.guard.ts @@ -1,9 +1,8 @@ import { Injectable } from '@angular/core'; import { CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, UrlTree, Router } from '@angular/router'; import { Observable } from 'rxjs'; -import { LocalstoreService } from '../store/localstore.service'; import { SessionStore } from '../store/session.service'; -import { AlertController, Platform } from '@ionic/angular'; +import { Platform } from '@ionic/angular'; @Injectable({ providedIn: 'root' diff --git a/src/app/pages/gabinete-digital/despachos-pr/despacho-pr/despacho-pr.page.html b/src/app/pages/gabinete-digital/despachos-pr/despacho-pr/despacho-pr.page.html index 204c046e9..35ea31958 100644 --- a/src/app/pages/gabinete-digital/despachos-pr/despacho-pr/despacho-pr.page.html +++ b/src/app/pages/gabinete-digital/despachos-pr/despacho-pr/despacho-pr.page.html @@ -2,7 +2,7 @@ -
+
@@ -76,8 +76,8 @@
-
-
+
+
Responder ao PR
@@ -92,7 +92,7 @@
-
+
diff --git a/src/app/pages/gabinete-digital/despachos/despacho/despacho.page.html b/src/app/pages/gabinete-digital/despachos/despacho/despacho.page.html index 9e1e95c68..8d26f9959 100644 --- a/src/app/pages/gabinete-digital/despachos/despacho/despacho.page.html +++ b/src/app/pages/gabinete-digital/despachos/despacho/despacho.page.html @@ -3,7 +3,7 @@ -
+
@@ -83,7 +83,7 @@ -
+
Responder ao PR
diff --git a/src/app/pages/gabinete-digital/diplomas-assinar/diploma-assinar/diploma-assinar.page.html b/src/app/pages/gabinete-digital/diplomas-assinar/diploma-assinar/diploma-assinar.page.html index 0b9a620eb..ddf004b10 100644 --- a/src/app/pages/gabinete-digital/diplomas-assinar/diploma-assinar/diploma-assinar.page.html +++ b/src/app/pages/gabinete-digital/diplomas-assinar/diploma-assinar/diploma-assinar.page.html @@ -3,7 +3,7 @@ -
+
@@ -74,7 +74,7 @@
-
+
diff --git a/src/app/pages/gabinete-digital/diplomas/diploma/diploma.page.html b/src/app/pages/gabinete-digital/diplomas/diploma/diploma.page.html index eeaa42369..bb70c7582 100644 --- a/src/app/pages/gabinete-digital/diplomas/diploma/diploma.page.html +++ b/src/app/pages/gabinete-digital/diplomas/diploma/diploma.page.html @@ -3,7 +3,7 @@ -
+
@@ -73,7 +73,7 @@
-
+
diff --git a/src/app/pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page.html b/src/app/pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page.html index 112d7f4de..980592aa6 100644 --- a/src/app/pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page.html +++ b/src/app/pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page.html @@ -95,7 +95,7 @@
Outras opções
- + diff --git a/src/app/pages/gabinete-digital/expedientes-pr/expediente-pr/expediente-pr.page.html b/src/app/pages/gabinete-digital/expedientes-pr/expediente-pr/expediente-pr.page.html index 05f4a3b9f..5399ee8c5 100644 --- a/src/app/pages/gabinete-digital/expedientes-pr/expediente-pr/expediente-pr.page.html +++ b/src/app/pages/gabinete-digital/expedientes-pr/expediente-pr/expediente-pr.page.html @@ -7,7 +7,7 @@
-
+
@@ -104,7 +104,7 @@
-
+
diff --git a/src/app/pages/gabinete-digital/pedidos/pedido/pedido.page.html b/src/app/pages/gabinete-digital/pedidos/pedido/pedido.page.html index f9a7c35d0..8d4abe6d3 100644 --- a/src/app/pages/gabinete-digital/pedidos/pedido/pedido.page.html +++ b/src/app/pages/gabinete-digital/pedidos/pedido/pedido.page.html @@ -3,7 +3,7 @@ -
+
@@ -78,7 +78,7 @@
-
+
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 06fe9717c..5807597a0 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 @@ -6,6 +6,7 @@ import { PublicationsService } from 'src/app/services/publications.service'; import { ToastService } from 'src/app/services/toast.service'; import { ImageModalPage } from '../../gallery/image-modal/image-modal.page'; import { NewPublicationPage } from '../../new-publication/new-publication.page'; +import { Location } from '@angular/common'; @Component({ selector: 'app-publication-detail', @@ -26,6 +27,7 @@ export class PublicationDetailPage implements OnInit { private toastService: ToastService, private activatedRoute: ActivatedRoute, private router: Router, + private location: Location, ) { this.activatedRoute.paramMap.subscribe(params => { @@ -93,7 +95,7 @@ export class PublicationDetailPage implements OnInit { if(this.isModal) { this.close() } else { - this.router.navigate(['/home/publications', this.folderId]); + this.location.back(); } } @@ -110,8 +112,9 @@ export class PublicationDetailPage implements OnInit { this.toastService.badRequest('Publicaçao não eliminada') } finally { loader.remove() + this.goBack(); } - this.goBack(); + } diff --git a/src/app/shared/popover/despachos-options/despachos-options.page.html b/src/app/shared/popover/despachos-options/despachos-options.page.html index 28969ca9c..0bc89a61c 100644 --- a/src/app/shared/popover/despachos-options/despachos-options.page.html +++ b/src/app/shared/popover/despachos-options/despachos-options.page.html @@ -18,7 +18,7 @@
- +
diff --git a/src/app/shared/popover/despachos-pr-options/despachos-pr-options.page.html b/src/app/shared/popover/despachos-pr-options/despachos-pr-options.page.html index 77a0beb7c..b02dd875b 100644 --- a/src/app/shared/popover/despachos-pr-options/despachos-pr-options.page.html +++ b/src/app/shared/popover/despachos-pr-options/despachos-pr-options.page.html @@ -17,7 +17,7 @@
- +
diff --git a/src/app/shared/popover/opts-expediente/opts-expediente.page.html b/src/app/shared/popover/opts-expediente/opts-expediente.page.html index 08f3c65f2..298db9f25 100644 --- a/src/app/shared/popover/opts-expediente/opts-expediente.page.html +++ b/src/app/shared/popover/opts-expediente/opts-expediente.page.html @@ -16,7 +16,7 @@
- + From dbe6a022f20a4a9f6c9e2582c249ab9bcf74063e Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Thu, 2 Sep 2021 14:29:58 +0100 Subject: [PATCH 41/67] Fix scroll --- src/app/modals/profile/profile.page.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/modals/profile/profile.page.html b/src/app/modals/profile/profile.page.html index 326672ecc..0b9b583db 100644 --- a/src/app/modals/profile/profile.page.html +++ b/src/app/modals/profile/profile.page.html @@ -33,9 +33,9 @@ -
+
-
+
Date: Thu, 2 Sep 2021 16:06:53 +0100 Subject: [PATCH 42/67] Fix event all day --- src/app/guards/home.guard.spec.ts | 16 -- src/app/guards/home.guard.ts | 32 --- src/app/guards/index.guard.spec.ts | 16 -- src/app/guards/index.guard.ts | 31 --- src/app/guards/login.guard.ts | 2 + src/app/index/index-routing.module.ts | 1 - src/app/models/agenda/AgendaEventList.ts | 19 +- src/app/pages/agenda/agenda.page.html | 14 +- src/app/pages/agenda/agenda.page.ts | 210 ++----------------- src/app/services/ageanda/list-box.service.ts | 37 ++-- src/app/store/calendar.service.ts | 2 - 11 files changed, 49 insertions(+), 331 deletions(-) delete mode 100644 src/app/guards/home.guard.spec.ts delete mode 100644 src/app/guards/home.guard.ts delete mode 100644 src/app/guards/index.guard.spec.ts delete mode 100644 src/app/guards/index.guard.ts diff --git a/src/app/guards/home.guard.spec.ts b/src/app/guards/home.guard.spec.ts deleted file mode 100644 index b14fb3fe3..000000000 --- a/src/app/guards/home.guard.spec.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { TestBed } from '@angular/core/testing'; - -import { HomeGuard } from './home.guard'; - -describe('HomeGuard', () => { - let guard: HomeGuard; - - beforeEach(() => { - TestBed.configureTestingModule({}); - guard = TestBed.inject(HomeGuard); - }); - - it('should be created', () => { - expect(guard).toBeTruthy(); - }); -}); diff --git a/src/app/guards/home.guard.ts b/src/app/guards/home.guard.ts deleted file mode 100644 index 133cd1b45..000000000 --- a/src/app/guards/home.guard.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { Injectable } from '@angular/core'; -import { CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, UrlTree, Router } from '@angular/router'; -import { Observable } from 'rxjs'; -import { AuthConnstants } from '../config/auth-constants'; -import { StorageService } from '../services/storage.service'; - -@Injectable({ - providedIn: 'root' -}) -export class HomeGuard implements CanActivate { - constructor( - public storageService:StorageService, - private router:Router - ){} - - canActivate(): Promise{ - return new Promise(resolve => { - /* this.storageService.get(AuthConnstants.AUTH).then(res => { - if(res){ - resolve(true); - } - else{ - this.router.navigate(['']); - resolve(false); - } - }).catch(err =>{ - resolve(false); - }) */ - }); - } - -} diff --git a/src/app/guards/index.guard.spec.ts b/src/app/guards/index.guard.spec.ts deleted file mode 100644 index 7c19426b5..000000000 --- a/src/app/guards/index.guard.spec.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { TestBed } from '@angular/core/testing'; - -import { IndexGuard } from './index.guard'; - -describe('IndexGuard', () => { - let guard: IndexGuard; - - beforeEach(() => { - TestBed.configureTestingModule({}); - guard = TestBed.inject(IndexGuard); - }); - - it('should be created', () => { - expect(guard).toBeTruthy(); - }); -}); diff --git a/src/app/guards/index.guard.ts b/src/app/guards/index.guard.ts deleted file mode 100644 index e3ffa3eff..000000000 --- a/src/app/guards/index.guard.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { Injectable } from '@angular/core'; -import { CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, UrlTree, Router } from '@angular/router'; -import { Observable } from 'rxjs'; -import { AuthConnstants } from '../config/auth-constants'; -import { StorageService } from '../services/storage.service'; - -@Injectable({ - providedIn: 'root' -}) -export class IndexGuard implements CanActivate { - constructor( - public storageService:StorageService, - private router:Router - ){} - canActivate(): Promise { - return new Promise(resolve => { - /* this.storageService.get(AuthConnstants.AUTH).then(res => { - if(res){ - this.router.navigate(['home']); - resolve(false); - } - else{ - resolve(true); - } - }).catch(err =>{ - resolve(false); - }) */ - }); - } - -} diff --git a/src/app/guards/login.guard.ts b/src/app/guards/login.guard.ts index 16aa98223..363c6a7d6 100644 --- a/src/app/guards/login.guard.ts +++ b/src/app/guards/login.guard.ts @@ -15,6 +15,8 @@ export class LoginGuard implements CanActivate { route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable | Promise | boolean | UrlTree { + // console.log(SessionStore.exist, SessionStore.user.Inactivity, SessionStore.user.LoginPreference) + if(SessionStore.exist && SessionStore.user.Inactivity && SessionStore.user.LoginPreference != 'Pin' ) { this.router.navigate(['/home/events']); return false diff --git a/src/app/index/index-routing.module.ts b/src/app/index/index-routing.module.ts index 6d90f05c2..5abed4edd 100644 --- a/src/app/index/index-routing.module.ts +++ b/src/app/index/index-routing.module.ts @@ -1,6 +1,5 @@ import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; -import { IndexGuard } from '../guards/index.guard'; import { LoginGuard } from '../guards/login.guard'; import { IndexPage } from './index.page'; diff --git a/src/app/models/agenda/AgendaEventList.ts b/src/app/models/agenda/AgendaEventList.ts index fad1343c4..a40eba19b 100644 --- a/src/app/models/agenda/AgendaEventList.ts +++ b/src/app/models/agenda/AgendaEventList.ts @@ -1,11 +1,10 @@ export interface EventListStore { - title: string startTime: Date endTime: Date allDay: boolean, event: EventList, - calendarName: string + calendarName: "Oficial" |"Pessoal" profile: "md" | "pr", id: string } @@ -27,12 +26,16 @@ export interface EventList { export interface CustomCalendarEvent { start: Date end: Date - color: { - primary: string, - secondary: string - }, id: string - index: number, - CalendarName: string event: EventList +} + + + +export interface days { + [days: string]: { + day: number + activeEvent: number + events: CustomCalendarEvent[] + } } \ No newline at end of file diff --git a/src/app/pages/agenda/agenda.page.html b/src/app/pages/agenda/agenda.page.html index 736ecbf38..818633557 100644 --- a/src/app/pages/agenda/agenda.page.html +++ b/src/app/pages/agenda/agenda.page.html @@ -223,14 +223,13 @@
-
-
+
+
{{ TimelineDayEvent(events.key)}}
-
+
{{event.event.StartDate | date: 'HH:mm'}}
@@ -263,16 +262,15 @@
-
+
-
+
{{ TimelineDayEvent(events.key)}}
-
+
{{event.event.StartDate | date: 'HH:mm'}}
diff --git a/src/app/pages/agenda/agenda.page.ts b/src/app/pages/agenda/agenda.page.ts index 6cfc2ee4a..1f5d75c69 100644 --- a/src/app/pages/agenda/agenda.page.ts +++ b/src/app/pages/agenda/agenda.page.ts @@ -290,6 +290,7 @@ export class AgendaPage implements OnInit { // calendar change date this.eventSelectedDate = new Date(ev); + this.updateEventListBox() }; // changedate @@ -461,7 +462,7 @@ export class AgendaPage implements OnInit { // loop this.calendarService.pushEvent(response, 'md'); - this.TimelineMDList = this.listBoxService.list(this.calendarService.eventSource, 'md', this.rangeStartDate, this.rangeEndDate, {}) + this.TimelineMDList = this.listBoxService.list(this.calendarService.eventSource, 'md', this.rangeStartDate, this.rangeEndDate, {segment:this.segment, selectedDate: this.eventSelectedDate}) this.myCal.update(); this.myCal.loadEvents(); @@ -482,7 +483,7 @@ export class AgendaPage implements OnInit { // calendar this.calendarService.pushEvent(response, 'pr'); - this.TimelineMDList = this.listBoxService.list(this.calendarService.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, {}) + this.TimelineMDList = this.listBoxService.list(this.calendarService.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, {segment:this.segment, selectedDate: this.eventSelectedDate}) this.myCal.update(); this.myCal.loadEvents(); @@ -508,7 +509,7 @@ export class AgendaPage implements OnInit { this.calendarService.pushEvent(response, 'pr'); - this.TimelineMDList = this.listBoxService.list(this.calendarService.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, {}) + this.TimelineMDList = this.listBoxService.list(this.calendarService.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, {segment:this.segment, selectedDate: this.eventSelectedDate}) this.myCal.update(); @@ -536,7 +537,7 @@ export class AgendaPage implements OnInit { this.calendarService.pushEvent(eventsList, 'md'); - this.TimelineMDList = this.listBoxService.list(this.calendarService.eventSource, 'md', this.rangeStartDate, this.rangeEndDate, {}) + this.TimelineMDList = this.listBoxService.list(this.calendarService.eventSource, 'md', this.rangeStartDate, this.rangeEndDate, {segment:this.segment, selectedDate: this.eventSelectedDate}) this.myCal.update(); this.myCal.loadEvents(); @@ -556,7 +557,7 @@ export class AgendaPage implements OnInit { const eventsList = response.filter(data => data.CalendarName == "Pessoal"); this.calendarService.pushEvent(eventsList, 'pr'); - this.TimelineMDList = this.listBoxService.list(this.calendarService.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, {}) + this.TimelineMDList = this.listBoxService.list(this.calendarService.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, {segment:this.segment, selectedDate: this.eventSelectedDate}) this.myCal.update(); this.myCal.loadEvents(); @@ -607,7 +608,7 @@ export class AgendaPage implements OnInit { this.calendarService.pushEvent(eventsList, 'pr'); - this.TimelineMDList = this.listBoxService.list(this.calendarService.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, {}) + this.TimelineMDList = this.listBoxService.list(this.calendarService.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, {segment:this.segment, selectedDate: this.eventSelectedDate}) this.myCal.update(); this.myCal.loadEvents(); @@ -638,7 +639,7 @@ export class AgendaPage implements OnInit { // loop this.calendarService.pushEvent(eventsList, 'md'); - this.TimelineMDList = this.listBoxService.list(this.calendarService.eventSource, 'md', this.rangeStartDate, this.rangeEndDate, {}) + this.TimelineMDList = this.listBoxService.list(this.calendarService.eventSource, 'md', this.rangeStartDate, this.rangeEndDate, {segment:this.segment, selectedDate: this.eventSelectedDate}) this.myCal.update(); this.myCal.loadEvents(); @@ -667,7 +668,7 @@ export class AgendaPage implements OnInit { this.calendarService.pushEvent(eventsList, 'pr'); - this.TimelinePRList = this.listBoxService.list(this.calendarService.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, {}) + this.TimelinePRList = this.listBoxService.list(this.calendarService.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, {segment:this.segment, selectedDate: this.eventSelectedDate}) this.myCal.update(); this.myCal.loadEvents(); @@ -705,7 +706,7 @@ export class AgendaPage implements OnInit { this.calendarService.pushEvent(eventsList, 'pr'); - this.TimelinePRList = this.listBoxService.list(this.calendarService.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, {}) + this.TimelinePRList = this.listBoxService.list(this.calendarService.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, {segment:this.segment, selectedDate: this.eventSelectedDate}) this.myCal.update(); @@ -732,174 +733,11 @@ export class AgendaPage implements OnInit { updateEventListBox() { - this.TimelinePRList = this.listBoxService.list(this.calendarService.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, {}) - this.TimelineMDList = this.listBoxService.list(this.calendarService.eventSource, 'md', this.rangeStartDate, this.rangeEndDate, {}) + this.TimelinePRList = this.listBoxService.list(this.calendarService.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, {segment:this.segment, selectedDate: this.eventSelectedDate}) + this.TimelineMDList = this.listBoxService.list(this.calendarService.eventSource, 'md', this.rangeStartDate, this.rangeEndDate, {segment:this.segment, selectedDate: this.eventSelectedDate}) } - eventListBox(list, nice?) { - let days = {}; - - list.forEach( (event:any)=> { - - var startDate: any = new Date(event.start); - - var endDate: any = this.EventTretment({ - 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() - - - - if(!days.hasOwnProperty(day)) { - days[day] = [] - } - - if (new Date(startDate).toLocaleDateString() != new Date(endDate).toLocaleDateString()) { - - // difference - const diffTime = Math.abs(endDate - startDate); - const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24)); - - if (diffDays <= 150 && !event.event.IsAllDayEvent ) { - - - if (diffDays >= 1) { - - const StartEvent = Object.assign({}, { - title: event.title, - 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, - StartDate: event.event.StartDate, - EndDate: event.event.EndDate, - Location: event.event.Location, - EventId: event.event.EventId, - CalendarName: event.event.CalendarName - }, - startMany: true, - endMany: false, - middle: false - }) - - days[day].push(StartEvent) - - let i = 1; - - while (startDate.getFullYear() != endDate.getFullYear() || - startDate.getMonth() != endDate.getMonth() || - startDate.getDate() != endDate.getDate()) { - - const newDate = startDate.setDate(startDate.getDate()+ i) - - let otherDays = (((new Date (newDate)).getDate())).toString().padStart(2,'0') - - event.other = true - - event.start = newDate - if(!days.hasOwnProperty(otherDays)) { - - days[otherDays] = [] - } - - if (!(startDate.getFullYear() != endDate.getFullYear() || - startDate.getMonth() != endDate.getMonth() || - startDate.getDate() != endDate.getDate())) { - // last push - - const EndEvent = Object.assign({}, { - title: event.title, - 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, - StartDate: event.event.StartDate, - EndDate: event.event.EndDate, - Location: event.event.Location, - EventId: event.event.EventId, - CalendarName: event.event.CalendarName - }, - Subject: event.Subject, - startMany: false, - endMany: true, - middle: false - }) - - days[otherDays].push(EndEvent) - - } else { - const EndEvent = Object.assign({}, { - title: event.title, - 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, - StartDate: event.event.StartDate, - EndDate: event.event.EndDate, - Location: event.event.Location, - EventId: event.event.EventId, - CalendarName: event.event.CalendarName - }, - Subject: event.Subject, - startMany: false, - endMany: true, - middle: true - }) - days[otherDays].push(EndEvent) - } - - } - - } else { - days[day].push(event) - - } - } else { - days[day].push(event) - - } - - } - - days[day].push(event) - - }) - - setTimeout(()=>{ - document.querySelectorAll('.EventListBox-container .EventListBox').forEach((e)=>{ - if(e.childElementCount == 0) { - e.parentElement.style.display = 'none' - } else { - e.parentElement.style.display = 'block' - } - }) - }, 10) - - return days - } get viewEventMonth () { return this.viewDate.getMonth() @@ -932,13 +770,13 @@ export class AgendaPage implements OnInit { if(this.profile == "mdgpr") { this.profile ="pr"; this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate); - this.TimelineMDList = this.listBoxService.list(this.calendarService.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, {}) + this.TimelineMDList = this.listBoxService.list(this.calendarService.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, {segment:this.segment, selectedDate: this.eventSelectedDate}) } else { this.profile ="mdgpr"; this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate); - this.TimelineMDList = this.listBoxService.list(this.calendarService.eventSource, 'md', this.rangeStartDate, this.rangeEndDate, {}) + this.TimelineMDList = this.listBoxService.list(this.calendarService.eventSource, 'md', this.rangeStartDate, this.rangeEndDate, {segment:this.segment, selectedDate: this.eventSelectedDate}) } } @@ -1224,26 +1062,10 @@ export class AgendaPage implements OnInit { } this.showTimelineFilterState = false; - setTimeout(()=>{ - document.querySelectorAll('.EventListBox-container .EventListBox').forEach((e)=>{ - if(e.childElementCount == 0) { - e.parentElement.style.display = 'none' - } else { - e.parentElement.style.display = 'block' - } - }) - }, 10) + // THIS LINE + this.updateEventListBox() - setTimeout(()=>{ - document.querySelectorAll('.EventListBox-container .EventListBox').forEach((e)=>{ - if(e.childElementCount == 0) { - e.parentElement.style.display = 'none' - } else { - e.parentElement.style.display = 'block' - } - }) - }, 100) } diff --git a/src/app/services/ageanda/list-box.service.ts b/src/app/services/ageanda/list-box.service.ts index 5dff546f9..15d9c90cc 100644 --- a/src/app/services/ageanda/list-box.service.ts +++ b/src/app/services/ageanda/list-box.service.ts @@ -26,10 +26,23 @@ export class ListBoxService { }) } + filterSegment(eventSource: EventListStore[], segment): EventListStore[] { + return eventSource.filter( data => data.calendarName == segment) + } + + daysBetween(){ } - list(eventSource: EventListStore[], profile: 'md' | 'pr' | 'all', rangeStartDate, randEndDate, {segment = 'todo'}) { + list(eventSource: EventListStore[], profile: 'md' | 'pr' | 'all', rangeStartDate, randEndDate, {segment = 'Combinado', selectedDate= null}) { + if(selectedDate) { + eventSource = eventSource.filter(data => data.startTime.toLocaleDateString('pt')>= selectedDate.toLocaleDateString('pt')) + } + + if(segment!='Combinado') { + eventSource = this.filterSegment(eventSource, segment) + } + if(profile != 'all') { eventSource = this.filterProfile(eventSource, profile) } @@ -49,7 +62,6 @@ export class ListBoxService { display(list: CustomCalendarEvent[]) { let days = {}; - console.log(list) list.forEach( (event:CustomCalendarEvent, index)=> { @@ -127,15 +139,6 @@ export class ListBoxService { }) - setTimeout(()=>{ - document.querySelectorAll('.EventListBox-container .EventListBox').forEach((e)=>{ - if(e.childElementCount == 0) { - e.parentElement.style.display = 'none' - } else { - e.parentElement.style.display = 'block' - } - }) - }, 10) return days } @@ -149,18 +152,10 @@ export class ListBoxService { events.push({ start: new Date(element.startTime), end: new Date(element.endTime), - color: { - primary: '#0000', - secondary: '#0000' - }, id: element.id, - index: eventIndex, - CalendarName: element.calendarName, event: element.event, }); - console.log('element.event', element.event) - }); return events; @@ -169,14 +164,10 @@ export class ListBoxService { transForm(event: CustomCalendarEvent, {startMany, endMany, middle}) { return Object.assign({}, { - title: event.event.Subject, start: event.start, end: event.end, - color: event.color, id: event.id, - index: event.index, profile: event, - CalendarName: event.CalendarName, event: { Subject: event.event.Subject, StartDate: event.event.StartDate, diff --git a/src/app/store/calendar.service.ts b/src/app/store/calendar.service.ts index 0559532e6..bd9919f8e 100644 --- a/src/app/store/calendar.service.ts +++ b/src/app/store/calendar.service.ts @@ -22,7 +22,6 @@ export class CalendarService { setTimeout(()=>{ restore.forEach((element:EventListStore, eventIndex) => { this._eventSource.push({ - title: element.title, startTime: new Date(element.startTime), endTime: new Date(element.endTime), allDay: element.allDay, @@ -67,7 +66,6 @@ export class CalendarService { let news = [] eventsList.forEach((element, eventIndex) => { news.push({ - title: element.Subject, startTime: new Date(element.StartDate), endTime: new Date(element.EndDate), allDay: false, From 5de16776a2d0d5cddbb186151ec203ae12509873 Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Thu, 2 Sep 2021 16:10:55 +0100 Subject: [PATCH 43/67] Fix event all day --- src/app/services/ageanda/list-box.service.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/app/services/ageanda/list-box.service.ts b/src/app/services/ageanda/list-box.service.ts index 15d9c90cc..98245a350 100644 --- a/src/app/services/ageanda/list-box.service.ts +++ b/src/app/services/ageanda/list-box.service.ts @@ -36,7 +36,10 @@ export class ListBoxService { list(eventSource: EventListStore[], profile: 'md' | 'pr' | 'all', rangeStartDate, randEndDate, {segment = 'Combinado', selectedDate= null}) { if(selectedDate) { - eventSource = eventSource.filter(data => data.startTime.toLocaleDateString('pt')>= selectedDate.toLocaleDateString('pt')) + eventSource = eventSource.filter(data => + data.startTime.toLocaleDateString('pt')>= selectedDate.toLocaleDateString('pt') && + data.startTime.getMonth() == selectedDate.getMonth() + ) } if(segment!='Combinado') { From 09c9ef0578c2aeb23ce7b9fef066438b93334737 Mon Sep 17 00:00:00 2001 From: "tiago.kayaya" Date: Thu, 2 Sep 2021 16:23:12 +0100 Subject: [PATCH 44/67] save --- src/app/pages/chat/messages/messages.page.ts | 1 - src/app/pages/events/events.page.scss | 13 ++++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/app/pages/chat/messages/messages.page.ts b/src/app/pages/chat/messages/messages.page.ts index fdf2150ea..b0810150b 100644 --- a/src/app/pages/chat/messages/messages.page.ts +++ b/src/app/pages/chat/messages/messages.page.ts @@ -253,7 +253,6 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy { } async serverLongPull() { - alert('YAS') const roomId = this.roomId diff --git a/src/app/pages/events/events.page.scss b/src/app/pages/events/events.page.scss index a29948aa5..7e8af5266 100644 --- a/src/app/pages/events/events.page.scss +++ b/src/app/pages/events/events.page.scss @@ -330,7 +330,6 @@ ion-toolbar{ .schedule { max-width: 400px; font-family: Roboto; - padding: 20px; background-color: white; box-shadow: 0 0 10px 0 rgb(0 0 0 / 7%); border: solid 1px #e9e9e9; @@ -339,11 +338,15 @@ ion-toolbar{ display: flex; flex-direction: column; max-height: 100%; + overflow: auto; + padding-bottom: 25px; .schedule-header{ display: flex; margin-bottom: 20px; justify-content: space-between; + padding: 20px 20px 0px 20px; + .title { display: flex; align-items: center; @@ -369,10 +372,14 @@ ion-toolbar{ } } .content{ + //padding: 0px 20px 20px 20px; + overflow: auto; + .item-exp{ overflow: auto; - padding-top: 5px; - padding-bottom: 5px; + //padding-top: 5px; + //padding-bottom: 5px; + padding: 5px 20px 5px 20px; background-color: transparent !important; } ion-list{ From f246db005439e45e55f2b28bfc4ba2f3363a5587 Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Thu, 2 Sep 2021 16:41:43 +0100 Subject: [PATCH 45/67] Fix duplicated inputs --- src/app/modals/profile/profile.page.ts | 2 +- .../agenda/edit-event/edit-event.page.html | 40 ++----------------- .../agenda/edit-event/edit-event.page.ts | 9 ++--- 3 files changed, 7 insertions(+), 44 deletions(-) diff --git a/src/app/modals/profile/profile.page.ts b/src/app/modals/profile/profile.page.ts index 634a59c3f..a5ea4a616 100644 --- a/src/app/modals/profile/profile.page.ts +++ b/src/app/modals/profile/profile.page.ts @@ -219,7 +219,7 @@ export class ProfilePage implements OnInit { logout() { SessionStore.setInativity(false) - + SessionStore.setUrlBeforeInactivity(this.router.url) setTimeout(() => { this.router.navigateByUrl('/', { replaceUrl: true }); }, 100) 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 6056f6b6a..d3539b232 100644 --- a/src/app/shared/agenda/edit-event/edit-event.page.html +++ b/src/app/shared/agenda/edit-event/edit-event.page.html @@ -117,7 +117,7 @@ @@ -145,7 +145,7 @@ @@ -195,7 +195,7 @@ @@ -213,41 +213,7 @@
-
-
-
- -
-
- - {{recurring.Description}} - -
-
-
-
-
-
- -
-
- - - -
-
-
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 f4c28947b..9e8ea4ffc 100644 --- a/src/app/shared/agenda/edit-event/edit-event.page.ts +++ b/src/app/shared/agenda/edit-event/edit-event.page.ts @@ -89,9 +89,6 @@ export class EditEventPage implements OnInit { { value: false, label: 'False' } ]; - get dateOccurrence () { - return this.dateControlOccurrence.value - } public listColors = ['primary', 'accent', 'warn']; public stepHours = [1, 2, 3, 4, 5]; public stepMinutes = [1, 5, 10, 15, 20, 25]; @@ -109,6 +106,7 @@ export class EditEventPage implements OnInit { ngOnInit() { this.dateControlOccurrence = new FormControl(moment(this.postEvent.EventRecurrence.LastOccurrence)); + this.postEvent.EventRecurrence.Type = '-1' if(!this.restoreTemporaryData()) { // clear @@ -208,13 +206,13 @@ export class EditEventPage implements OnInit { dateEnd: new FormControl(this.dateEnd, [ Validators.required ]), - dateOccurrence: new FormControl(this.dateOccurrence, [ + dateOccurrence: new FormControl(this.postEvent.EventRecurrence.Type, [ Validators.required ]), participantes: new FormControl(this.taskParticipants, [ // Validators.required ]), - Date: new FormControl( new Date(this.dateControlStart.value).toLocaleString() < new Date(this.dateControlEnd.value).toLocaleString()? 'ok': null,[ + Date: new FormControl( new Date(this.dateControlStart.value).toLocaleString('pt') < new Date(this.dateControlEnd.value).toLocaleString('pt')? 'ok': null,[ Validators.required ]), @@ -364,7 +362,6 @@ export class EditEventPage implements OnInit { if (this.postEvent) { this.postEvent.StartDate = this.dateStart this.postEvent.EndDate = this.dateEnd - this.postEvent.EventRecurrence.LastOccurrence = this.dateOccurrence } } From 7576552306ea3b0ef91d6f1f699c46d1db1d7c29 Mon Sep 17 00:00:00 2001 From: "tiago.kayaya" Date: Thu, 2 Sep 2021 16:49:58 +0100 Subject: [PATCH 46/67] save --- src/app/pages/agenda/agenda.page.html | 7 +------ src/app/shared/agenda/event-list/event-list.page.scss | 6 ++++-- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/app/pages/agenda/agenda.page.html b/src/app/pages/agenda/agenda.page.html index 6af7f806b..7876e711e 100644 --- a/src/app/pages/agenda/agenda.page.html +++ b/src/app/pages/agenda/agenda.page.html @@ -270,12 +270,7 @@
-<<<<<<< HEAD -
-======= -
->>>>>>> 5de16776a2d0d5cddbb186151ec203ae12509873 +
{{event.event.StartDate | date: 'HH:mm'}}
diff --git a/src/app/shared/agenda/event-list/event-list.page.scss b/src/app/shared/agenda/event-list/event-list.page.scss index 4c04f8508..0d1e3c664 100644 --- a/src/app/shared/agenda/event-list/event-list.page.scss +++ b/src/app/shared/agenda/event-list/event-list.page.scss @@ -1,10 +1,10 @@ :host{ - padding: 30px 20px 0 20px !important; margin: 0; } .header-content{ overflow: auto; margin: 0 auto; + padding: 30px 20px 0 20px !important; } .header-icon-left{ font-size: 33px; @@ -20,6 +20,8 @@ } .main-content{ + padding: 0px 20px 0 20px !important; + margin-top: 20px; .item{ --inner-padding-end: 0 !important; @@ -100,4 +102,4 @@ margin: 0; padding: 0; } -} \ No newline at end of file +} From 39f1669ffedbd2a1c7c0e4d5fb8d1b1fb2fb79fd Mon Sep 17 00:00:00 2001 From: "tiago.kayaya" Date: Thu, 2 Sep 2021 17:04:01 +0100 Subject: [PATCH 47/67] save --- .../events-to-approve/events-to-approve.page.scss | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/app/shared/gabinete-digital/events-to-approve/events-to-approve.page.scss b/src/app/shared/gabinete-digital/events-to-approve/events-to-approve.page.scss index e55a1817c..d0a8dbd65 100644 --- a/src/app/shared/gabinete-digital/events-to-approve/events-to-approve.page.scss +++ b/src/app/shared/gabinete-digital/events-to-approve/events-to-approve.page.scss @@ -1,5 +1,4 @@ :host{ - padding: 30px 20px 0 20px !important; margin: 0; } .title-container{ @@ -12,6 +11,7 @@ } } .title{ + padding: 30px 20px 0 20px !important; font-family: Roboto; font-size: 25px; color:#000; @@ -21,6 +21,7 @@ margin-top: 5px; } .main-content{ + padding: 0px 20px 0 20px !important; margin-top: 20px; .item{ --inner-padding-end: 0 !important; From 31e11bb6d0f6e96fcacd64de517ba7050d1a6185 Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Thu, 2 Sep 2021 17:08:43 +0100 Subject: [PATCH 48/67] Fix --- src/app/pages/agenda/agenda.page.html | 5 --- src/app/services/events.service.ts | 4 +++ .../agenda/edit-event/edit-event.page.html | 6 ++-- .../agenda/edit-event/edit-event.page.ts | 35 +------------------ 4 files changed, 8 insertions(+), 42 deletions(-) diff --git a/src/app/pages/agenda/agenda.page.html b/src/app/pages/agenda/agenda.page.html index 6af7f806b..294e312ee 100644 --- a/src/app/pages/agenda/agenda.page.html +++ b/src/app/pages/agenda/agenda.page.html @@ -270,12 +270,7 @@
-<<<<<<< HEAD -
-=======
->>>>>>> 5de16776a2d0d5cddbb186151ec203ae12509873
{{event.event.StartDate | date: 'HH:mm'}}
diff --git a/src/app/services/events.service.ts b/src/app/services/events.service.ts index a3a0d8983..c23d4678e 100644 --- a/src/app/services/events.service.ts +++ b/src/app/services/events.service.ts @@ -301,6 +301,10 @@ export class EventsService { params = params.set("conflictResolutionMode", conflictResolutionMode.toString()); params = params.set("sendInvitationsOrCancellationsMode", sendInvitationsOrCancellationsMode.toString()); + params.set('CalendarId', event.CalendarId) + params.set('CalendarName', event.CalendarName) + this.headers['CalendarId'] = event.CalendarId + this.headers['CalendarName'] = event.CalendarName let options = { headers: this.headers, 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 d3539b232..ddea0f9c0 100644 --- a/src/app/shared/agenda/edit-event/edit-event.page.html +++ b/src/app/shared/agenda/edit-event/edit-event.page.html @@ -116,7 +116,7 @@ @@ -144,7 +144,7 @@ @@ -283,7 +283,7 @@
-
+
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 9e8ea4ffc..2106c2e83 100644 --- a/src/app/shared/agenda/edit-event/edit-event.page.ts +++ b/src/app/shared/agenda/edit-event/edit-event.page.ts @@ -66,18 +66,10 @@ export class EditEventPage implements OnInit { @Output() setIntervenientCC = new EventEmitter(); @Output() clearPostEvent = new EventEmitter(); - public dateControlStart = new FormControl(moment("DD MM YYYY hh")); - public dateControlEnd = new FormControl(moment("DD MM YYYY hh")); showLoader = false - get dateStart () { - return this.dateControlStart.value - } - get dateEnd () { - return this.dateControlEnd.value - } @ViewChild('picker') picker: any; @ViewChild('fim') fim: any; @@ -146,9 +138,7 @@ export class EditEventPage implements OnInit { } } - this.getAttachments(this.postEvent.EventId); - this.restoreDatepickerData(); this.getRecurrenceTypes(); this.postEvent.EventRecurrence.Type = this.postEvent.EventRecurrence.Type.toString(); @@ -200,19 +190,13 @@ export class EditEventPage implements OnInit { Categories: new FormControl(this.postEvent.Category, [ Validators.required ]), - dateStart: new FormControl(this.dateStart, [ - Validators.required - ]), - dateEnd: new FormControl(this.dateEnd, [ - Validators.required - ]), dateOccurrence: new FormControl(this.postEvent.EventRecurrence.Type, [ Validators.required ]), participantes: new FormControl(this.taskParticipants, [ // Validators.required ]), - Date: new FormControl( new Date(this.dateControlStart.value).toLocaleString('pt') < new Date(this.dateControlEnd.value).toLocaleString('pt')? 'ok': null,[ + Date: new FormControl( new Date(this.postEvent.StartDate).toLocaleString('pt') < new Date(this.postEvent.EndDate).toLocaleString('pt')? 'ok': null,[ Validators.required ]), @@ -262,7 +246,6 @@ export class EditEventPage implements OnInit { return false } - this.getDatepickerData() this.postEvent.Attendees = this.taskParticipants.concat(this.taskParticipantsCc); if(!this.postEvent.EventRecurrence.hasOwnProperty('Type')) { @@ -358,24 +341,10 @@ export class EditEventPage implements OnInit { } - getDatepickerData() { - if (this.postEvent) { - this.postEvent.StartDate = this.dateStart - this.postEvent.EndDate = this.dateEnd - } - } - restoreDatepickerData() { - if (this.postEvent) { - this.dateControlStart = new FormControl(moment(this.postEvent.StartDate)); - this.dateControlEnd = new FormControl(moment(this.postEvent.EndDate)); - } - } saveTemporaryData() { - this.getDatepickerData() - window['temp.path:/home/agenda/edit-event.component.ts'] = { postEvent: this.postEvent, eventBody: this.eventBody, @@ -392,8 +361,6 @@ export class EditEventPage implements OnInit { this.eventBody = restoredData.eventBody this.segment = restoredData.segment - this.restoreDatepickerData() - return true; } else { return false; From f1a9f1796a0b293730e7d12c5f52aa29bd623417 Mon Sep 17 00:00:00 2001 From: "tiago.kayaya" Date: Fri, 3 Sep 2021 12:11:01 +0100 Subject: [PATCH 49/67] save --- .../gabinete-digital.page.scss | 4 +- .../expedientes-pr/expedientes-pr.page.html | 2 +- .../expedientes-pr/expedientes-pr.page.scss | 85 +++---------------- .../expedients/expedients.page.html | 4 +- .../expedients/expedients.page.scss | 82 +++--------------- 5 files changed, 28 insertions(+), 149 deletions(-) diff --git a/src/app/pages/gabinete-digital/gabinete-digital.page.scss b/src/app/pages/gabinete-digital/gabinete-digital.page.scss index d4fba4516..852c5e3e6 100644 --- a/src/app/pages/gabinete-digital/gabinete-digital.page.scss +++ b/src/app/pages/gabinete-digital/gabinete-digital.page.scss @@ -149,6 +149,7 @@ ion-segment-button{ border-radius: 15px; box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.07); background: white; + border: 1px solid white; float: left; } .exp-card-long{ @@ -161,7 +162,7 @@ ion-segment-button{ margin: 7px 20px; border-radius: 15px; padding: 7px; - border: blue !important; + border:1px solid white; .center-div{ width: fit-content; @@ -559,6 +560,7 @@ ion-list{ .active { color: white !important; fill: white !important; + border: 1px solid #42b9fe !important; background: #42b9fe !important; box-sizing: border-box; diff --git a/src/app/shared/gabinete-digital/expedientes-pr/expedientes-pr.page.html b/src/app/shared/gabinete-digital/expedientes-pr/expedientes-pr.page.html index 8c128bda1..4ba4bac60 100644 --- a/src/app/shared/gabinete-digital/expedientes-pr/expedientes-pr.page.html +++ b/src/app/shared/gabinete-digital/expedientes-pr/expedientes-pr.page.html @@ -10,7 +10,7 @@ -
+
diff --git a/src/app/shared/gabinete-digital/expedientes-pr/expedientes-pr.page.scss b/src/app/shared/gabinete-digital/expedientes-pr/expedientes-pr.page.scss index cd1087582..1a0dc6200 100644 --- a/src/app/shared/gabinete-digital/expedientes-pr/expedientes-pr.page.scss +++ b/src/app/shared/gabinete-digital/expedientes-pr/expedientes-pr.page.scss @@ -1,7 +1,6 @@ @import '~src/function.scss'; -/* CONTENT */ +//CONTENT :host{ - padding: 30px 20px 0 20px !important; margin: 0; } .title{ @@ -9,6 +8,7 @@ font-size: 25px; color:#000; overflow: auto; + padding: 30px 20px 0 20px !important; .thetitle{ width: fit-content; @@ -19,19 +19,6 @@ float: right; } } -.item-list-small{ - font-size: 11px; - overflow: auto; - } - .ion-item-class{ - padding: 0; - - } - .label-text{ - width: 100%; - padding: 0; - margin: 0; - } //DIV ion-item{ --background: none; @@ -40,76 +27,28 @@ ion-item{ //border-radius: 15px; //box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.07); //Sborder: solid 1px #e9e9e9; - background-color: var(--white); + //background-color: var(--white); margin: 0 auto; //padding: 10px; overflow: auto; } -.div-content-expediente{ - width: 100%; - float: left; - border-left: 3px solid #dae3f3; - padding:5px 5px 15px 5px; - margin: 10px 0 10px 0; - background: #dae3f3; - border-radius: 20px; -} -.div-content-pendentes{ - width: 100%; - float: left; - border-left: 3px solid #d9d9d9; - padding: 5px; -} - .div-content-expediente h3, .div-content-pendentes h3{ - margin: 0; - padding: 0; - font-size: 14pt; - width: 100%; - } - .div-icon{ - width: 10%; - font-size: 20px; - float: left; - color: #808080; - } - .div-icon ion-icon{ - display: block; - margin: 0 auto; - - } - .div-content-expediente p, .div-content-pendentes p{ - font-size: 14pt; - color: rgb(94, 92, 92); - padding: 0; - margin: 0; - } - .span-left{ - /* border: 1px solid red; */ - float: left; - font-size: 12px; - padding-left: 18px; - } - .span-right{ - /* border: 1px solid blue; */ - text-align: right; - float: right; - font-size: 12px; - padding-right: 18px; -} /* New CSS */ +.content{ + padding: 0px 20px 0 20px !important; +} .expediente{ border-radius: 15px; box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.07); border:1px solid #e9e9e9 !important; - //background-color: var(--white); + //background-color: transparent; margin-bottom: 10px !important; padding: 15px; } .exp-list-item{ //width: 368px; overflow: auto; - /* border-bottom: 1px solid gray; */ + //border-bottom: 1px solid gray; margin: 10px auto; } @@ -130,7 +69,7 @@ ion-item{ .exp-icon{ width: fit-content; float: right; - /* font-size: 13px; */ + //font-size: 13px; margin: 0 !important; padding: 0 !important; @@ -160,7 +99,7 @@ ion-item{ .label{ border-radius: 15px; background: #ffb703; - /* font-size: 12px; */ + //font-size: 12px; float: right; padding: 2.5px 13.5px 2.5px 13.5px; color: #fff; @@ -188,11 +127,11 @@ ion-item{ .exp-remetente{ //width: 200px; font-family: Roboto; - /* font-size: 13px; */ + //font-size: 13px; font-weight: normal; color: #000000; float: left; - /* border: 1px solid red; */ + //border: 1px solid red; } } .div-top-header{ diff --git a/src/app/shared/gabinete-digital/expedients/expedients.page.html b/src/app/shared/gabinete-digital/expedients/expedients.page.html index 05473058e..1c65289ef 100644 --- a/src/app/shared/gabinete-digital/expedients/expedients.page.html +++ b/src/app/shared/gabinete-digital/expedients/expedients.page.html @@ -1,6 +1,6 @@
-
Expediente
+
Expediente11
- -
- -
- -
-
- - - - diff --git a/src/app/shared/headers/header-no-search/profile/profile.page.scss b/src/app/shared/headers/header-no-search/profile/profile.page.scss deleted file mode 100644 index acab1b075..000000000 --- a/src/app/shared/headers/header-no-search/profile/profile.page.scss +++ /dev/null @@ -1,64 +0,0 @@ -.profile-content{ - padding: 20px 20px; -} - -.icon{ - font-size: 35px; -} - -.go-back{ - font-family: Roboto; - font-size: 25px; - .icon{ - margin-right: 7px; - } -} - -.profile-pic{ - width: 200px; - height: 200px; - border-radius: 20px; - margin: 0px auto; -} - -.profile-info{ - .label-text{ - font-size: 15px; - font-weight: bold; - color: white; - margin-bottom: 10px; - } - - .user-role{ - background-color: white; - border-radius: 5px; - padding: 12px; - font-family: Roboto; - font-size: 13px; - color: black; - text-align: center; - } - - .email { - margin-top: 15px; - } - -} - -.login-preference{ - margin-top: 44px; - - .preference{ - font-family: Roboto; - font-size: 15px; - margin-bottom: 20px; - font-weight: bold; - } - .checkBox{ - margin-right: 10px; - } -} - -.buttonSize { - width: 100% !important; -} \ No newline at end of file diff --git a/src/app/shared/headers/header-no-search/profile/profile.page.spec.ts b/src/app/shared/headers/header-no-search/profile/profile.page.spec.ts deleted file mode 100644 index e3f18689f..000000000 --- a/src/app/shared/headers/header-no-search/profile/profile.page.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; -import { IonicModule } from '@ionic/angular'; - -import { ProfileComponent } from './profile.page'; - -describe('ProfilePage', () => { - let component: ProfileComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ ProfileComponent ], - imports: [IonicModule.forRoot()] - }).compileComponents(); - - fixture = TestBed.createComponent(ProfileComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - })); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/shared/headers/header-no-search/profile/profile.page.ts b/src/app/shared/headers/header-no-search/profile/profile.page.ts deleted file mode 100644 index 6a2a5029c..000000000 --- a/src/app/shared/headers/header-no-search/profile/profile.page.ts +++ /dev/null @@ -1,158 +0,0 @@ -import { Component, OnInit } from '@angular/core'; -import { Router } from '@angular/router'; -import { AnimationController, ModalController } from '@ionic/angular'; -import { LoginUserRespose } from 'src/app/models/user.model'; -import { AuthService } from 'src/app/services/auth.service'; -import { FingerprintPage } from 'src/app/shared/fingerprint/fingerprint.page'; -import { PinPage } from 'src/app/shared/pin/pin.page'; -import { LocalstoreService } from 'src/app/store/localstore.service'; - -@Component({ - selector: 'app-profile', - templateUrl: './profile.page.html', - styleUrls: ['./profile.page.scss'], -}) -export class ProfileComponent implements OnInit { - - loggeduser: LoginUserRespose; - userLoginPreference = '' - - constructor(private modalController:ModalController, - private authService: AuthService, - private animationController: AnimationController, - private router: Router, - private localstoreService: LocalstoreService - ) { - - this.loggeduser = authService.ValidatedUser; - - // console.log(this.loggeduser.RoleDescription) - - this.checkState() - } - - ngOnInit() {} - - close() { - this.modalController.dismiss(); - } - - async addPin() { - const enterAnimation = (baseEl: any) => { - const backdropAnimation = this.animationController.create() - .addElement(baseEl.querySelector('ion-backdrop')!) - .fromTo('opacity', '0.01', 'var(--backdrop-opacity)'); - - const wrapperAnimation = this.animationController.create() - .addElement(baseEl.querySelector('.modal-wrapper')!) - .keyframes([ - { offset: 0, opacity: '1', right: '-100%' }, - { offset: 1, opacity: '1', right: '0px' } - ]); - - return this.animationController.create() - .addElement(baseEl) - .easing('ease-out') - .duration(500) - .addAnimation([backdropAnimation, wrapperAnimation]); - } - - const leaveAnimation = (baseEl: any) => { - return enterAnimation(baseEl).direction('reverse'); - } - - - const modal = await this.modalController.create({ - enterAnimation, - leaveAnimation, - component: PinPage, - cssClass: 'model profile-modal', - componentProps: { - } - }); - - modal.present(); - } - - - async addFingerprint() { - const enterAnimation = (baseEl: any) => { - const backdropAnimation = this.animationController.create() - .addElement(baseEl.querySelector('ion-backdrop')!) - .fromTo('opacity', '0.01', 'var(--backdrop-opacity)'); - - const wrapperAnimation = this.animationController.create() - .addElement(baseEl.querySelector('.modal-wrapper')!) - .keyframes([ - { offset: 0, opacity: '1', right: '-100%' }, - { offset: 1, opacity: '1', right: '0px' } - ]); - - return this.animationController.create() - .addElement(baseEl) - .easing('ease-out') - .duration(500) - .addAnimation([backdropAnimation, wrapperAnimation]); - } - - const leaveAnimation = (baseEl: any) => { - return enterAnimation(baseEl).direction('reverse'); - } - - - const modal = await this.modalController.create({ - enterAnimation, - leaveAnimation, - component: FingerprintPage, - cssClass: 'model profile-modal', - componentProps: { - } - }); - - modal.present(); - } - - logout() { - // clear local storage - window.localStorage.clear(); - - setTimeout(()=> { - this.router.navigateByUrl('/', { replaceUrl: true }); - },100) - - } - - LoginPreferenceMethod(type: string) { - - let userData = this.localstoreService.get('UserData', {}) - - if (userData.hasOwnProperty('loginPreference')) { - if (userData.loginPreference != type) { - if (type) { - userData.loginPreference = type - } - } else { - userData.loginPreference = 'none' - } - - } else { - userData.loginPreference = 'none' - } - - - this.localstoreService.set('UserData', userData) - } - - checkState() { - - let userData = this.localstoreService.get('UserData', {}) - - if (userData.hasOwnProperty('loginPreference')) { - this.userLoginPreference = userData.loginPreference - } else { - this.userLoginPreference = '' - } - - } - -} diff --git a/src/app/store/session.service.ts b/src/app/store/session.service.ts index d2e8f225e..3e480e7bc 100644 --- a/src/app/store/session.service.ts +++ b/src/app/store/session.service.ts @@ -58,6 +58,7 @@ class SessionService { setInativity(value: boolean) { this._user.Inactivity = value + this._user.UrlBeforeInactivity = '' this.save() } From 3c7c60cce0b0554884bde501c5aa888af2c0040a Mon Sep 17 00:00:00 2001 From: "tiago.kayaya" Date: Fri, 3 Sep 2021 12:52:49 +0100 Subject: [PATCH 51/67] save --- src/app/services/events.service.ts | 213 ++++++++++++++++------------- 1 file changed, 115 insertions(+), 98 deletions(-) diff --git a/src/app/services/events.service.ts b/src/app/services/events.service.ts index c23d4678e..be0456111 100644 --- a/src/app/services/events.service.ts +++ b/src/app/services/events.service.ts @@ -41,7 +41,7 @@ export class EventsService { if(this.loggeduser){ if(this.loggeduser.Profile == 'MDGPR') { - + this.loggeduser.OwnerCalendars.forEach(calendar => { if(calendar.CalendarName == 'Oficial') { this.headersMdOficial = this.headersMdOficial.set('Authorization', this.loggeduser.BasicAuthKey); @@ -52,10 +52,10 @@ export class EventsService { this.headersMdPessoal = this.headersMdPessoal.set('Authorization', this.loggeduser.BasicAuthKey); this.headersMdPessoal = this.headersMdPessoal.set('CalendarId', calendar.CalendarId); this.headersMdPessoal = this.headersMdPessoal.set('CalendarRoleId', calendar.CalendarRoleId); - + } }); - + this.loggeduser.SharedCalendars.forEach(sharedCalendar => { if(sharedCalendar.CalendarName == 'Oficial') { this.headersSharedOficial = this.headersSharedOficial.set('Authorization', this.loggeduser.BasicAuthKey); @@ -70,7 +70,7 @@ export class EventsService { }); } else if(this.loggeduser.Profile == 'PR') { - + this.loggeduser.OwnerCalendars.forEach(calendar =>{ if(calendar.CalendarName == 'Oficial'){ this.headersPrOficial = this.headersPrOficial.set('Authorization', this.loggeduser.BasicAuthKey); @@ -81,11 +81,11 @@ export class EventsService { this.headersPrPessoal = this.headersPrPessoal.set('Authorization', this.loggeduser.BasicAuthKey); this.headersPrPessoal = this.headersPrPessoal.set('CalendarId', calendar.CalendarId); this.headersPrPessoal = this.headersPrPessoal.set('CalendarRoleId', calendar.CalendarRoleId); - + } }); } - + this.headers = new HttpHeaders(); this.headers = this.headers.set('Authorization', this.loggeduser.BasicAuthKey); } @@ -99,10 +99,10 @@ export class EventsService { params = params.set("StartDate", startdate); params = params.set("EndDate", enddate); - - let options = { - headers: this.headers, - params: params + + let options = { + headers: this.headers, + params: params }; return this.http.get(`${geturl}`, options); } */ @@ -116,10 +116,10 @@ export class EventsService { params = params.set("Start", startdate); params = params.set("End", enddate); - - let options = { - headers: this.headersPrOficial, - params: params + + let options = { + headers: this.headersPrOficial, + params: params }; return this.http.get(`${geturl}`, options); } @@ -132,10 +132,10 @@ export class EventsService { params = params.set("Start", startdate); params = params.set("End", enddate); - - let options = { - headers: this.headersPrPessoal, - params: params + + let options = { + headers: this.headersPrPessoal, + params: params }; return this.http.get(`${geturl}`, options); } @@ -156,25 +156,25 @@ export class EventsService { params = params.set("Start", startdate); params = params.set("End", enddate); - - let options = { - headers: this.headersMdOficial, - params: params + + let options = { + headers: this.headersMdOficial, + params: params }; return this.http.get(`${geturl}`, options); } getAllMdPessoalEvents(startdate:string, enddate:string): any{ let geturl = environment.apiURL + 'calendar/md'; - + let params = new HttpParams(); params = params.set("Start", startdate); params = params.set("End", enddate); - - let options = { - headers: this.headersMdPessoal, - params: params + + let options = { + headers: this.headersMdPessoal, + params: params }; return this.http.get(`${geturl}`, options) } @@ -192,7 +192,7 @@ export class EventsService { let prO = await this.getAllSharedOficialEvents(startdate, enddate).toPromise(); let prP = await this.getAllSharedPessoalEvents(startdate, enddate).toPromise(); const resFinal = prO.concat(prP); - + return new Promise(resolve =>{ return resolve(resFinal) }); @@ -208,13 +208,13 @@ export class EventsService { params = params.set("Start", startdate); params = params.set("End", enddate); - - let options = { - headers: this.headersSharedOficial, - params: params + + let options = { + headers: this.headersSharedOficial, + params: params }; console.log(options); - + return this.http.get(`${geturl}`, options); } @@ -226,10 +226,10 @@ export class EventsService { params = params.set("Start", startdate); params = params.set("End", enddate); - - let options = { - headers: this.headersSharedPessoal, - params: params + + let options = { + headers: this.headersSharedPessoal, + params: params }; return this.http.get(`${geturl}`, options); } @@ -238,8 +238,8 @@ export class EventsService { getRecurrenceTypes(): any{ const geturl = environment.apiURL + 'Calendar/RecurrenceTypes'; - let options = { - headers: this.headers, + let options = { + headers: this.headers, }; return this.http.get(`${geturl}`, options); } @@ -254,10 +254,10 @@ export class EventsService { params = params.set("CalendarName", calendarname); params = params.set("StartDate", startdate); params = params.set("EndDate", enddate); - - let options = { - headers: this.headers, - params: params + + let options = { + headers: this.headers, + params: params }; return this.http.get(`${geturl}`, options); } @@ -265,12 +265,12 @@ export class EventsService { getEvent(eventid: string): Observable{ let geturl = environment.apiURL + 'calendar/GetEvent'; let params = new HttpParams(); - + params = params.set("EventId", eventid); - - let options = { - headers: this.headers, - params: params + + let options = { + headers: this.headers, + params: params }; return this.http.get(`${geturl}`, options); @@ -284,10 +284,10 @@ export class EventsService { params = params.set("conflictResolutionMode", conflictResolutionMode.toString()); params = params.set("sendInvitationsOrCancellationsMode", sendInvitationsOrCancellationsMode.toString()); - - let options = { - headers: this.headers, - params: params + + let options = { + headers: this.headers, + params: params }; return this.http.put(`${puturl}`, event, options) @@ -305,10 +305,27 @@ export class EventsService { params.set('CalendarName', event.CalendarName) this.headers['CalendarId'] = event.CalendarId this.headers['CalendarName'] = event.CalendarName - - let options = { - headers: this.headers, - params: params + + if(event.CalendarName == 'Oficial'){ + if(this.loggeduser.Profile == 'MDGPR'){ + this.headers = this.headersMdOficial; + } + else if(this.loggeduser.Profile == 'PR'){ + this.headers = this.headersPrOficial; + } + } + else{ + if(this.loggeduser.Profile == 'MDGPR'){ + this.headers = this.headersMdPessoal; + } + else if(this.loggeduser.Profile == 'PR'){ + this.headers = this.headersPrPessoal; + } + } + + let options = { + headers: this.headers, + params: params }; return this.http.put(`${puturl}`, event, options) @@ -316,7 +333,7 @@ export class EventsService { changeAgenda(body:any){ const puturl = environment.apiURL + 'Calendar/MoveEvent'; - let options = { + let options = { headers: this.headers, }; return this.http.post(`${puturl}`, body, options); @@ -329,14 +346,14 @@ export class EventsService { params = params.set("CalendarName", calendarName); - let options = { - headers: this.headers, - params: params + let options = { + headers: this.headers, + params: params }; - + return this.http.post(`${puturl}`, event, options) } */ - + postEventMd(event:Event, calendarName:string) { const puturl = environment.apiURL + 'calendar/md'; @@ -348,17 +365,17 @@ export class EventsService { switch (calendarName) { case 'Oficial': console.log(calendarName); - options = { - headers: this.headersMdOficial, - params: params + options = { + headers: this.headersMdOficial, + params: params }; break; - + case 'Pessoal': console.log(calendarName); - options = { - headers: this.headersMdPessoal, - params: params + options = { + headers: this.headersMdPessoal, + params: params }; break; } @@ -377,21 +394,21 @@ export class EventsService { switch (calendarName) { case 'Oficial': console.log(calendarName); - options = { - headers: this.headersPrOficial, - params: params + options = { + headers: this.headersPrOficial, + params: params }; break; - + case 'Pessoal': console.log(calendarName); - options = { - headers: this.headersPrPessoal, - params: params + options = { + headers: this.headersPrPessoal, + params: params }; break; } - + return this.http.post(`${puturl}`, event, options) } @@ -404,11 +421,11 @@ export class EventsService { // 0 for occurence and 1 for serie (delete all events) params = params.set("eventDeleteType", eventDeleteType.toString()); - let options = { - headers: this.headers, - params: params + let options = { + headers: this.headers, + params: params }; - + return this.http.delete(`${puturl}`, options) } postExpedientEvent(docId:any, body:any, sharedagenda:string, serialNumber:any, applicationID:any){ @@ -423,29 +440,29 @@ export class EventsService { switch (this.loggeduser.Profile) { case 'MDGPR': if(body.CalendarName == 'Pessoal'){ - options = { + options = { headers: this.headersMdPessoal, - params: params + params: params }; } else if(body.CalendarName == 'Oficial'){ - options = { + options = { headers: this.headersMdOficial, - params: params + params: params }; } break; case 'PR': if(body.CalendarName == 'Pessoal'){ - options = { + options = { headers: this.headersPrPessoal, - params: params + params: params }; } else if(body.CalendarName == 'Oficial'){ - options = { + options = { headers: this.headersPrOficial, - params: params + params: params }; } break; @@ -464,29 +481,29 @@ export class EventsService { switch (this.loggeduser.Profile) { case 'MDGPR': if(body.CalendarName == 'Pessoal'){ - options = { + options = { headers: this.headersMdPessoal, - params: params + params: params }; } else if(body.CalendarName == 'Oficial'){ - options = { + options = { headers: this.headersMdOficial, - params: params + params: params }; } break; case 'PR': if(body.CalendarName == 'Pessoal'){ - options = { + options = { headers: this.headersPrPessoal, - params: params + params: params }; } else if(body.CalendarName == 'Oficial'){ - options = { + options = { headers: this.headersPrOficial, - params: params + params: params }; } break; @@ -497,7 +514,7 @@ export class EventsService { postEventToApproveEdit(body: EventToApproveEdit) { const geturl = environment.apiURL + 'Tasks/EditEventTask'; - let options = { + let options = { headers: this.headers, }; From 1ab73f0daf83ce48e89ad59e4dfea2a35db0d847 Mon Sep 17 00:00:00 2001 From: "tiago.kayaya" Date: Fri, 3 Sep 2021 13:11:53 +0100 Subject: [PATCH 52/67] save --- .../expediente-detail/expediente-detail.page.ts | 14 ++++++-------- .../opts-expediente/opts-expediente.page.ts | 7 ++----- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/app/pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page.ts b/src/app/pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page.ts index 35dc124fa..7d7fc1a75 100644 --- a/src/app/pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page.ts +++ b/src/app/pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page.ts @@ -382,19 +382,17 @@ export class ExpedienteDetailPage implements OnInit { }); await modal.present(); modal.onDidDismiss().then( async(res)=>{ + alert('AQUI') let body = res['data']; if(res['data']) { - - //await this.distartExpedientModal(body); const loader = this.toastService.loading() try { await this.processes.CompleteTask(body).toPromise(); - //this.toastService.successMessage('Processo descartado'); - this.goBack(); - } catch (error) { - this.toastService.badRequest('Processo não descartado') - } finally { - loader.remove() + this.goBack(); + } catch (error) { + this.toastService.badRequest('Processo não descartado') + } finally { + loader.remove() } } else{ diff --git a/src/app/shared/popover/opts-expediente/opts-expediente.page.ts b/src/app/shared/popover/opts-expediente/opts-expediente.page.ts index aefca0253..8cea8c836 100644 --- a/src/app/shared/popover/opts-expediente/opts-expediente.page.ts +++ b/src/app/shared/popover/opts-expediente/opts-expediente.page.ts @@ -87,7 +87,7 @@ export class OptsExpedientePage implements OnInit { } else { this.location.back() - + /* this.activatedRoute.paramMap.subscribe(params => { console.log('YES'); @@ -166,7 +166,7 @@ export class OptsExpedientePage implements OnInit { }); }); - + this.popoverController.dismiss() } @@ -325,12 +325,9 @@ export class OptsExpedientePage implements OnInit { console.log(res['data']); let body = res['data']; if(res['data']){ - console.log('open discart') - //this.distartExpedientModal(body); const loader = this.toastService.loading() try { await this.processes.CompleteTask(body).toPromise(); - this.toastService.successMessage('Processo descartado'); this.goBack(); } catch (error) { this.toastService.badRequest('Processo não descartado') From 6d33498352ccf1e2c3d9cddb311c3bce835ed00c Mon Sep 17 00:00:00 2001 From: "tiago.kayaya" Date: Fri, 3 Sep 2021 15:20:42 +0100 Subject: [PATCH 53/67] save --- .../deploma-options/deploma-options.page.scss | 12 ++++++------ .../despachos-options.page.scss | 16 ++++++++-------- .../despachos-pr-options.page.html | 6 ++++-- .../despachos-pr-options.page.scss | 2 +- .../messages-options/messages-options.page.scss | 4 ++++ 5 files changed, 23 insertions(+), 17 deletions(-) diff --git a/src/app/shared/popover/deploma-options/deploma-options.page.scss b/src/app/shared/popover/deploma-options/deploma-options.page.scss index 41abf3ba8..3f1718b98 100644 --- a/src/app/shared/popover/deploma-options/deploma-options.page.scss +++ b/src/app/shared/popover/deploma-options/deploma-options.page.scss @@ -25,11 +25,11 @@ border-top: 1px solid #bbb; margin: 0 auto !important; } - .btn-ok, .btn-cancel{ - //width: 50% !important; - margin-bottom: 5px !important; - margin-top: 5px !important; -} + .btn-ok, .btn-cancel, .btn-delete{ + width: calc(50% - 10px) !important; + margin: 5px 5px 5px 5px !important; + } + @media only screen and (max-width: 800px) { .btn-ok, .btn-cancel, .btn-delete{ width: 47% !important; @@ -53,4 +53,4 @@ /* .solid{ display: block; } */ -} \ No newline at end of file +} diff --git a/src/app/shared/popover/despachos-options/despachos-options.page.scss b/src/app/shared/popover/despachos-options/despachos-options.page.scss index 7ad4b7bbf..5ea5fa2c7 100644 --- a/src/app/shared/popover/despachos-options/despachos-options.page.scss +++ b/src/app/shared/popover/despachos-options/despachos-options.page.scss @@ -3,6 +3,7 @@ --padding-bottom:20px !important; --padding-start:20px !important; --padding-end:20px !important; + } .arrow-right { display: none; @@ -25,11 +26,10 @@ border-top: 1px solid #bbb; margin: 0 auto !important; } - .btn-ok, .btn-cancel{ - //width: 50% !important; - margin-bottom: 5px !important; - margin-top: 5px !important; -} + .btn-ok, .btn-cancel, .btn-delete{ + width: calc(50% - 10px) !important; + margin: 5px 5px 5px 5px !important; + } .pr-options { .btn-ok, .btn-cancel{ @@ -45,7 +45,7 @@ width: 30%; } } - + @media only screen and (min-width: 1140px){ .content{ width: 75%; @@ -54,9 +54,9 @@ width: 25%; } } - + .desk{ text-align: left; background-color: white; -} \ No newline at end of file +} diff --git a/src/app/shared/popover/despachos-pr-options/despachos-pr-options.page.html b/src/app/shared/popover/despachos-pr-options/despachos-pr-options.page.html index b02dd875b..fdf88d42e 100644 --- a/src/app/shared/popover/despachos-pr-options/despachos-pr-options.page.html +++ b/src/app/shared/popover/despachos-pr-options/despachos-pr-options.page.html @@ -20,6 +20,7 @@ +
@@ -28,11 +29,12 @@ +
-
- +
diff --git a/src/app/shared/popover/despachos-pr-options/despachos-pr-options.page.scss b/src/app/shared/popover/despachos-pr-options/despachos-pr-options.page.scss index 6108784b8..91b87ddc7 100644 --- a/src/app/shared/popover/despachos-pr-options/despachos-pr-options.page.scss +++ b/src/app/shared/popover/despachos-pr-options/despachos-pr-options.page.scss @@ -58,4 +58,4 @@ .desk{ text-align: left; background-color: white; -} \ No newline at end of file +} diff --git a/src/app/shared/popover/messages-options/messages-options.page.scss b/src/app/shared/popover/messages-options/messages-options.page.scss index dd61665a1..29fe1e464 100644 --- a/src/app/shared/popover/messages-options/messages-options.page.scss +++ b/src/app/shared/popover/messages-options/messages-options.page.scss @@ -25,6 +25,10 @@ border-top: 1px solid #bbb; margin: 0 auto !important; } + /* .btn-ok, .btn-cancel, .btn-delete{ + width: calc(50% - 10px) !important; + margin: 5px 5px 5px 5px !important; + } */ @media only screen and (min-width: 701px) { .arrow-right{ display: flex; From 1257e5f24392677e14c5ebb5eeb7dc9a3971703a Mon Sep 17 00:00:00 2001 From: "tiago.kayaya" Date: Fri, 3 Sep 2021 15:43:22 +0100 Subject: [PATCH 54/67] save --- .../request-options/request-options.page.html | 10 +++++- .../request-options/request-options.page.ts | 33 ++++++++++--------- 2 files changed, 27 insertions(+), 16 deletions(-) diff --git a/src/app/shared/popover/request-options/request-options.page.html b/src/app/shared/popover/request-options/request-options.page.html index a343f7758..e02596261 100644 --- a/src/app/shared/popover/request-options/request-options.page.html +++ b/src/app/shared/popover/request-options/request-options.page.html @@ -15,6 +15,7 @@ +
@@ -25,6 +26,7 @@ +
@@ -36,15 +38,17 @@ +
- +
+
@@ -54,6 +58,10 @@ +
+ diff --git a/src/app/shared/popover/request-options/request-options.page.ts b/src/app/shared/popover/request-options/request-options.page.ts index cf4b91daf..3cd00bfc5 100644 --- a/src/app/shared/popover/request-options/request-options.page.ts +++ b/src/app/shared/popover/request-options/request-options.page.ts @@ -39,7 +39,7 @@ export class RequestOptionsPage implements OnInit { this.task = this.navParams.get('task'); this.fulltask = this.navParams.get('fulltask'); this.serialNumber = this.navParams.get('serialNumber'); - + this.activatedRoute.queryParams.subscribe(params => { if(params["serialNumber"]) { this.serialNumber = params["serialNumber"]; @@ -62,7 +62,7 @@ export class RequestOptionsPage implements OnInit { ngOnInit() { console.log(this.task); this.profile = "mdgpr"; - + window.onresize = (event) => { if( window.innerWidth >= 800){ this.popoverController.dismiss(); @@ -73,6 +73,9 @@ export class RequestOptionsPage implements OnInit { close() { this.popoverController.dismiss('close') } + cancel(){ + this.popoverController.dismiss(); + } sendExpedienteToPending() { this.processes.SetTaskToPending(this.task.SerialNumber).subscribe(res=>{ @@ -83,7 +86,7 @@ export class RequestOptionsPage implements OnInit { this.toastService.badRequest('Processo não encontrado') }); - + } async openBookMeetingModal(task: any) { @@ -130,7 +133,7 @@ export class RequestOptionsPage implements OnInit { console.log(res['data']); if(res['data']=='openDiscart') { console.log('open discart'); - + } else { this.popoverController.dismiss('close') } @@ -139,8 +142,8 @@ export class RequestOptionsPage implements OnInit { } async repreciar(note:string, documents:any) { - let body = { - "serialNumber": this.serialNumber, + let body = { + "serialNumber": this.serialNumber, "action": "Reapreciação", "ActionTypeId": 100000009, "dataFields": { @@ -151,13 +154,13 @@ export class RequestOptionsPage implements OnInit { const loader = this.toastService.loading() - try { + try { await this.processes.CompleteTask(body).toPromise() this.close(); this.toastService.successMessage() } catch (error) { this.toastService.badRequest() - } + } finally { loader.remove() } @@ -180,9 +183,9 @@ export class RequestOptionsPage implements OnInit { cssClass: classs, backdropDismiss: true }); - + await modal.present(); - + modal.onDidDismiss().then(async (res) => { @@ -192,7 +195,7 @@ export class RequestOptionsPage implements OnInit { SourceId: e.Id, } }); - + let docs = { ProcessInstanceID: "", Attachments: DocumentToSave, @@ -217,7 +220,7 @@ export class RequestOptionsPage implements OnInit { const loader = this.toastService.loading() - try { + try { await this.pedidoService.arquivar({serialNumber: this.serialNumber, documents, note @@ -233,7 +236,7 @@ export class RequestOptionsPage implements OnInit { } async openDarParecer(task: any) { - + let classs; if( window.innerWidth <= 800){ classs = 'book-meeting-modal modal modal-desktop' @@ -258,7 +261,7 @@ export class RequestOptionsPage implements OnInit { async openDelegarModal(task: any) { - + let classs; if( window.innerWidth <= 800){ classs = 'book-meeting-modal modal modal-desktop' @@ -275,7 +278,7 @@ export class RequestOptionsPage implements OnInit { }); await modal.present(); modal.onDidDismiss().then( async (res)=> { - + if(res['data']=='close') { this.popoverController.dismiss('close'); } From 4a6225b914c42fb02175bbc006670faef981ebba Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Fri, 3 Sep 2021 15:50:13 +0100 Subject: [PATCH 55/67] Fix event to approve --- src/app/services/processes.service.ts | 1 + src/app/shared/agenda/approve-event/approve-event.page.html | 1 + .../edit-event-to-approve/edit-event-to-approve.page.html | 2 +- .../edit-event-to-approve/edit-event-to-approve.page.ts | 5 +++-- src/app/shared/agenda/edit-event/edit-event.page.ts | 4 ---- src/app/shared/agenda/event-list/event-list.page.ts | 3 +-- .../gabinete-digital/despachos-pr/despachos-pr.page.ts | 2 -- .../edit-event-to-approve/edit-event.page.html | 2 +- .../edit-event-to-approve/edit-event.page.ts | 5 +++-- src/app/store/localstore.service.ts | 4 +--- 10 files changed, 12 insertions(+), 17 deletions(-) diff --git a/src/app/services/processes.service.ts b/src/app/services/processes.service.ts index f84e7e025..7b7edec8e 100644 --- a/src/app/services/processes.service.ts +++ b/src/app/services/processes.service.ts @@ -71,6 +71,7 @@ export class ProcessesService { }; return this.http.get(`${geturl}`, options); } + SetTaskToPending(serialNumber:string): Observable{ const geturl = environment.apiURL + 'Tasks/SetTaskPending'; diff --git a/src/app/shared/agenda/approve-event/approve-event.page.html b/src/app/shared/agenda/approve-event/approve-event.page.html index f8a57ae31..0869990f7 100644 --- a/src/app/shared/agenda/approve-event/approve-event.page.html +++ b/src/app/shared/agenda/approve-event/approve-event.page.html @@ -13,6 +13,7 @@ --> +
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 eeaac17a4..1c484cf20 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 @@ -87,7 +87,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 d96328a0e..ed9222302 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 @@ -73,7 +73,7 @@ export class EditEventToApprovePage implements OnInit { Body: "", OccurrenceType: '', Category: '', - LastOccurrence: '', + LastOccurrence: new Date(), IsRecurring: false, ParticipantsList: [], Agenda: '', @@ -127,7 +127,6 @@ export class EditEventToApprovePage implements OnInit { private toastService: ToastService, ) { this.isEventEdited = false; - } ngOnInit() { @@ -147,6 +146,8 @@ export class EditEventToApprovePage implements OnInit { this.processes.GetTask(this.serialNumber).subscribe( (result) =>{ this.eventProcess = result + this.eventProcess.workflowInstanceDataFields.LastOccurrence = new Date(this.eventProcess.workflowInstanceDataFields.LastOccurrence) + this.restoreDatepickerData() // description 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 4dedc8a17..308b74d4b 100644 --- a/src/app/shared/agenda/edit-event/edit-event.page.ts +++ b/src/app/shared/agenda/edit-event/edit-event.page.ts @@ -11,7 +11,6 @@ import { AttachmentsService } from 'src/app/services/attachments.service'; import { Attachment } from 'src/app/models/attachment.model'; import { ToastService } from 'src/app/services/toast.service'; import { FormControl, FormGroup, Validators } from '@angular/forms'; -import * as moment from 'moment'; import { ParticipantsPipe } from 'src/app/pipes/participants.pipe'; @Component({ @@ -65,11 +64,8 @@ export class EditEventPage implements OnInit { @Output() setIntervenientCC = new EventEmitter(); @Output() clearPostEvent = new EventEmitter(); - showLoader = false - - @ViewChild('picker') picker: any; @ViewChild('fim') fim: any; @ViewChild('inicio') inicio: any; diff --git a/src/app/shared/agenda/event-list/event-list.page.ts b/src/app/shared/agenda/event-list/event-list.page.ts index 73d6f0bb3..bcc74b0c2 100644 --- a/src/app/shared/agenda/event-list/event-list.page.ts +++ b/src/app/shared/agenda/event-list/event-list.page.ts @@ -1,9 +1,8 @@ import { Component, OnInit, Input, EventEmitter, Output } from '@angular/core'; import { EventBody } from 'src/app/models/eventbody.model'; import { EventPerson } from 'src/app/models/eventperson.model'; -import { Event } from 'src/app/models/event.model'; import { ProcessesService } from 'src/app/services/processes.service'; -import { ModalController, NavParams } from '@ionic/angular'; +import { ModalController } from '@ionic/angular'; import { NavigationEnd, Router } from '@angular/router'; import { AuthService } from 'src/app/services/auth.service'; import { LoginUserRespose } from 'src/app/models/user.model'; 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 cbc419510..079995aa6 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 @@ -1,8 +1,6 @@ import { Component, OnInit} from '@angular/core'; - import { customTask} from '../../../models/dailyworktask.model'; import { ProcessesService } from 'src/app/services/processes.service'; - import { AuthService } from 'src/app/services/auth.service'; import { LoginUserRespose } from 'src/app/models/user.model'; import { NavigationStart, Router } from '@angular/router'; 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 663009d0d..22d37ee80 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 gg + Editar evento por aprovar
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 c7bc0343d..169268a04 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 @@ -69,7 +69,7 @@ export class EditEventToApproveComponent implements OnInit { Body: "", OccurrenceType: '', Category: '', - LastOccurrence: '', + LastOccurrence: new Date(), ParticipantsList: [], Agenda: '', EndDate: '', @@ -134,9 +134,10 @@ export class EditEventToApproveComponent implements OnInit { const result = await this.processes.GetTask(this.serialNumber).toPromise(); console.log(result); - + this.eventProcess = result this.eventProcess.workflowInstanceDataFields.Category = result.workflowInstanceDataFields.EventType + this.eventProcess.workflowInstanceDataFields.LastOccurrence = new Date(this.eventProcess.workflowInstanceDataFields.LastOccurrence) this.startDate = new Date(this.eventProcess.workflowInstanceDataFields.StartDate); this.endDate = new Date(this.eventProcess.workflowInstanceDataFields.EndDate); diff --git a/src/app/store/localstore.service.ts b/src/app/store/localstore.service.ts index cf5076fb4..8b0b434f7 100644 --- a/src/app/store/localstore.service.ts +++ b/src/app/store/localstore.service.ts @@ -63,6 +63,4 @@ export class LocalstoreService { } -export const localstoreService = new LocalstoreService() - -console.log( AES.encrypt( 'pode ser qualquer', 'ayrton').toString() ) +export const localstoreService = new LocalstoreService() \ No newline at end of file From d3b6370f6c0cf675e452ea3a6c1e28c6be99a8a1 Mon Sep 17 00:00:00 2001 From: "tiago.kayaya" Date: Fri, 3 Sep 2021 16:20:22 +0100 Subject: [PATCH 56/67] save --- .../event-actions-popover.page.html | 2 +- .../event-actions-popover.page.scss | 4 ++-- .../request-options/request-options.page.html | 13 ++---------- .../request-options/request-options.page.scss | 20 +++++++++++++------ 4 files changed, 19 insertions(+), 20 deletions(-) diff --git a/src/app/pages/agenda/event-actions-popover/event-actions-popover.page.html b/src/app/pages/agenda/event-actions-popover/event-actions-popover.page.html index f8dd72530..ca44e45ca 100644 --- a/src/app/pages/agenda/event-actions-popover/event-actions-popover.page.html +++ b/src/app/pages/agenda/event-actions-popover/event-actions-popover.page.html @@ -1,4 +1,4 @@ - +
-
- +
@@ -61,7 +55,4 @@
- - +
diff --git a/src/app/shared/popover/request-options/request-options.page.scss b/src/app/shared/popover/request-options/request-options.page.scss index 6d4e6714f..1dfc3209f 100644 --- a/src/app/shared/popover/request-options/request-options.page.scss +++ b/src/app/shared/popover/request-options/request-options.page.scss @@ -1,8 +1,7 @@ -.container{ - --padding-top:20px !important; - --padding-bottom:20px !important; - --padding-start:20px !important; - --padding-end:20px !important; +.wrapper{ + width: 100% !important; + padding-top:20px !important; + padding-bottom:20px !important; } .arrow-right{ display: none; @@ -15,9 +14,11 @@ } } .buttons{ + width: 100% !important; display: flex; flex-wrap: wrap; justify-content: space-around; + margin: 0 auto !important; } .solid { display: none; @@ -31,11 +32,18 @@ margin-top: 5px !important; } @media only screen and (max-width: 800px) { + .container{ + width: 100% !important; + } .btn-ok, .btn-cancel, .btn-delete{ width: 47% !important; } } @media only screen and (min-width: 1024px) { + .container{ + width: 100% !important; + + } .arrow-right{ display: flex; justify-content: flex-end; @@ -53,4 +61,4 @@ /* .solid{ display: block; } */ -} \ No newline at end of file +} From 83c6dc4cb227f792c2fc48306ef4dd80586b076b Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Fri, 3 Sep 2021 16:37:00 +0100 Subject: [PATCH 57/67] Agenda add functionality to change year and month --- src/app/pages/agenda/agenda.page.ts | 28 +++++++++++++++++++ .../despacho-pr/despacho-pr.page.html | 1 - src/app/services/ageanda/list-box.service.ts | 3 +- 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/src/app/pages/agenda/agenda.page.ts b/src/app/pages/agenda/agenda.page.ts index 6d3035652..f3a6069eb 100644 --- a/src/app/pages/agenda/agenda.page.ts +++ b/src/app/pages/agenda/agenda.page.ts @@ -191,6 +191,9 @@ export class AgendaPage implements OnInit { }, 1000) + + window['year'] = this.changeYear + } ngOnInit() { @@ -738,6 +741,31 @@ export class AgendaPage implements OnInit { } + changeYear = (year) => { + const a = this.calendar.currentDate + this.calendar.currentDate = new Date(`${year}-${a.getMonth()}-${a.getDay()}`); + + try { + this.myCal.update(); + this.myCal.loadEvents(); + } catch(e) {} + + this.updateEventListBox() + + } + + changeMonth = (month) => { + const a = this.calendar.currentDate + this.calendar.currentDate = new Date(`${a.getFullYear()}-${month}-${a.getDay()}`); + + try { + this.myCal.update(); + this.myCal.loadEvents(); + } catch(e) {} + + this.updateEventListBox() + } + get viewEventMonth () { return this.viewDate.getMonth() diff --git a/src/app/pages/gabinete-digital/despachos-pr/despacho-pr/despacho-pr.page.html b/src/app/pages/gabinete-digital/despachos-pr/despacho-pr/despacho-pr.page.html index 35ea31958..2d91d5205 100644 --- a/src/app/pages/gabinete-digital/despachos-pr/despacho-pr/despacho-pr.page.html +++ b/src/app/pages/gabinete-digital/despachos-pr/despacho-pr/despacho-pr.page.html @@ -40,7 +40,6 @@
- .. {{ cc | json }} ..
Com conhecimento
diff --git a/src/app/services/ageanda/list-box.service.ts b/src/app/services/ageanda/list-box.service.ts index dc8a988b1..04066f1da 100644 --- a/src/app/services/ageanda/list-box.service.ts +++ b/src/app/services/ageanda/list-box.service.ts @@ -156,7 +156,8 @@ export class ListBoxService { push(event: any, selectedDate: Date) { - return new Date(event.start).getMonth() == selectedDate.getMonth() + return new Date(event.start).getMonth() == selectedDate.getMonth() && + new Date(event.start).getFullYear() == selectedDate.getFullYear() } encapsulation(eventsList:EventListStore[], profile): CustomCalendarEvent[] { From 0db26d8cd0eebcc6994cf9b0c2fc42733e84ef64 Mon Sep 17 00:00:00 2001 From: "tiago.kayaya" Date: Fri, 3 Sep 2021 16:38:59 +0100 Subject: [PATCH 58/67] save --- .../gabinete-digital/gabinete-digital.page.ts | 35 +++++++++---------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/src/app/pages/gabinete-digital/gabinete-digital.page.ts b/src/app/pages/gabinete-digital/gabinete-digital.page.ts index dccb3d085..feca818ee 100644 --- a/src/app/pages/gabinete-digital/gabinete-digital.page.ts +++ b/src/app/pages/gabinete-digital/gabinete-digital.page.ts @@ -124,7 +124,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck { this.loggeduser = authService.ValidatedUser; window.onresize = (event) => { // if not mobile remove all component - if( window.innerWidth <= 701){ + if( window.innerWidth < 701){ this.modalController.dismiss(); this.segmentVista = "listview"; } @@ -133,7 +133,6 @@ export class GabineteDigitalPage implements OnInit, DoCheck { } }; this.checkRoutes(); - } ngDoCheck(): void { @@ -191,7 +190,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck { async loadAllProcesses() { let allProcessesList = await this.processesbackend.GetTasksList("", false).toPromise(); - + if(!this.p.userRole(['PR'])) { allProcessesList = allProcessesList.filter( element => element.activityInstanceName != 'Assinar Diplomas') } else if (this.p.userRole(['PR'])) { @@ -464,7 +463,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck { if(despachos) { this.despachoStore.reset(despachos) } - + let pareceres = await this.processesbackend.GetTasksList("Pedido de Parecer", false).toPromise(); let pareceresPr = await this.processesbackend.GetTasksList("Pedido de Parecer do Presidente", false).toPromise(); @@ -503,7 +502,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck { 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(); @@ -521,7 +520,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck { let diplomasAssinar = despachospr.filter(data => data.activityInstanceName == "Assinar Diploma"); this.count_dip_as = Object.keys(diplomasAssinar).length; this.deplomasStore.resetDiplomasList(diplomasAssinar) - + let diplomasAssinados = despachospr.filter(data => data.activityInstanceName == "Diploma Assinado"); this.count_dip_as_pr = Object.keys(diplomasAssinados).length; @@ -569,7 +568,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck { } selectedElementF(element:string) { - if (window.innerWidth >= 801) { + if (window.innerWidth > 701) { return element == this.selectedElement } return false; @@ -578,7 +577,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck { openAllProcessesPage() { this.closeAllDesktopComponents(); let navigationExtras: NavigationExtras = { queryParams: {"processes": true,}}; - if( window.innerWidth <= 801) { + if( window.innerWidth < 701) { this.router.navigate(['/home/gabinete-digital']); } else { @@ -591,7 +590,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck { openEventsToApprovePage() { this.closeAllDesktopComponents(); let navigationExtras: NavigationExtras = { queryParams: {"eventos": true,}}; - if( window.innerWidth <= 801) { + if( window.innerWidth < 701) { //this.openEventsToApproveList(profile); this.router.navigate(['/home/gabinete-digital/event-list']); } @@ -606,7 +605,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck { this.closeAllDesktopComponents(); switch(this.loggeduser.Profile){ case 'MDGPR': - if( window.innerWidth <= 801) { + if( window.innerWidth < 701) { //this.openExpedientList(); this.router.navigate(['/home/gabinete-digital/expediente']); } @@ -618,7 +617,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck { } break; case 'PR': - if( window.innerWidth <= 801) { + if( window.innerWidth < 701) { this.router.navigate(['/home/gabinete-digital/expedientes-pr']); } else { @@ -645,7 +644,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck { this.segment = 'parecer' } - if( window.innerWidth <= 801) { + if( window.innerWidth < 701) { this.router.navigate(['/home/gabinete-digital/pedidos'], navigationExtras); } else { @@ -662,7 +661,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck { openDespachosPage(segment?:string) { this.closeAllDesktopComponents(); - if( window.innerWidth <= 801){ + if( window.innerWidth < 701){ this.router.navigate(['/home/gabinete-digital/despachos']); } else{ @@ -674,7 +673,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck { openDespachosPrPage(segment?:string) { this.closeAllDesktopComponents(); - if( window.innerWidth <= 801){ + if( window.innerWidth < 701){ this.router.navigate(['/home/gabinete-digital/despachos-pr']); } else{ @@ -686,7 +685,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck { openPendentesPage(segment?:string){ this.closeAllDesktopComponents(); - if( window.innerWidth <= 801){ + if( window.innerWidth < 701){ this.router.navigate(['/home/gabinete-digital/pendentes']); } else{ @@ -698,7 +697,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck { openExpedientesPrPage(segment?:string){ this.closeAllDesktopComponents(); - if( window.innerWidth <= 801) { + if( window.innerWidth < 701) { this.router.navigate(['/home/gabinete-digital/expedientes-pr']); } else { @@ -720,7 +719,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck { this.segment = segment; - if( window.innerWidth <= 801){ + if( window.innerWidth < 701){ this.router.navigate(['/home/gabinete-digital/diplomas'], navigationExtras); } else{ @@ -734,7 +733,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck { openDiplomasAssinarPage() { this.closeAllDesktopComponents(); - if( window.innerWidth <= 801){ + if( window.innerWidth < 701){ this.router.navigate(['/home/gabinete-digital/diplomas-assinar']); } else{ From b83a71a396c943066651598de8a20ed9482cc3e9 Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Fri, 3 Sep 2021 17:01:01 +0100 Subject: [PATCH 59/67] Publication fix delete publication when there is only one element --- .../publications/view-publications/view-publications.page.ts | 1 + .../publication/view-publications/view-publications.page.ts | 3 ++- src/app/store/publication-list.service.ts | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) 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 2b88e41e4..776316e26 100644 --- a/src/app/pages/publications/view-publications/view-publications.page.ts +++ b/src/app/pages/publications/view-publications/view-publications.page.ts @@ -122,6 +122,7 @@ export class ViewPublicationsPage implements OnInit { if(error.status == '404'){ this.error = 'Sem publicações disponíveis!'; this.publicationList= []; + this.publicationListStorage.add(folderId, this.publicationList) } this.showLoader = false; diff --git a/src/app/shared/publication/view-publications/view-publications.page.ts b/src/app/shared/publication/view-publications/view-publications.page.ts index 70016f30e..910bed35e 100644 --- a/src/app/shared/publication/view-publications/view-publications.page.ts +++ b/src/app/shared/publication/view-publications/view-publications.page.ts @@ -113,7 +113,8 @@ export class ViewPublicationsPage implements OnInit { (error)=>{ if(error.status == '404') { this.error = 'Sem publicações disponíveis!'; - // this.publicationList = null; + this.publicationList= []; + this.publicationListStorage.add(folderId, this.publicationList) } this.showLoader = false; diff --git a/src/app/store/publication-list.service.ts b/src/app/store/publication-list.service.ts index 48e3e4a26..a84ed779d 100644 --- a/src/app/store/publication-list.service.ts +++ b/src/app/store/publication-list.service.ts @@ -31,7 +31,7 @@ export class PublicationListService { return this._document[folderId] } - add(folderId, document) { + add(folderId, document = []) { this._document[folderId] = document setTimeout(()=> { From ff7bf2d174c815422d9ada3fdcac9145a094f6f3 Mon Sep 17 00:00:00 2001 From: "tiago.kayaya" Date: Fri, 3 Sep 2021 17:02:42 +0100 Subject: [PATCH 60/67] save --- src/app/pages/chat/chat.page.ts | 5 +++++ src/app/pages/chat/group-messages/group-messages.page.ts | 5 +++++ src/app/pages/chat/messages/messages.page.ts | 6 ++++++ 3 files changed, 16 insertions(+) diff --git a/src/app/pages/chat/chat.page.ts b/src/app/pages/chat/chat.page.ts index a9117c386..2ec8c44fb 100644 --- a/src/app/pages/chat/chat.page.ts +++ b/src/app/pages/chat/chat.page.ts @@ -120,6 +120,11 @@ export class ChatPage implements OnInit { ){ this.loggedUserChat = authService.ValidatedUserChat['data']; this.headers = new HttpHeaders(); + window.onresize = (event) => { + if( window.innerWidth > 701){ + this.modalController.dismiss(); + } + }; } diff --git a/src/app/pages/chat/group-messages/group-messages.page.ts b/src/app/pages/chat/group-messages/group-messages.page.ts index c40abb91c..ab82b2491 100644 --- a/src/app/pages/chat/group-messages/group-messages.page.ts +++ b/src/app/pages/chat/group-messages/group-messages.page.ts @@ -54,6 +54,11 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy { this.loggedUserChat = authService.ValidatedUserChat['data']; this.isGroupCreated = true; this.roomId = this.navParams.get('roomId'); + window.onresize = (event) => { + if( window.innerWidth > 701){ + this.modalController.dismiss(); + } + }; } ngOnInit() { diff --git a/src/app/pages/chat/messages/messages.page.ts b/src/app/pages/chat/messages/messages.page.ts index b0810150b..0408cc09e 100644 --- a/src/app/pages/chat/messages/messages.page.ts +++ b/src/app/pages/chat/messages/messages.page.ts @@ -60,6 +60,12 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy { }); */ this.loggedUser = authService.ValidatedUserChat['data']; this.roomId = this.navParams.get('roomId'); + + window.onresize = (event) => { + if( window.innerWidth > 701){ + this.modalController.dismiss(); + } + }; } ngOnInit() { From b43693df2f21a69b7e73535aab93d0aa27552cef Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Fri, 3 Sep 2021 17:11:13 +0100 Subject: [PATCH 61/67] Fix guard loop --- src/app/guards/auth.guard.ts | 4 ++-- src/app/guards/login.guard.ts | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/app/guards/auth.guard.ts b/src/app/guards/auth.guard.ts index 83859aead..b493d2813 100644 --- a/src/app/guards/auth.guard.ts +++ b/src/app/guards/auth.guard.ts @@ -18,9 +18,9 @@ export class AuthGuard implements CanActivate { state: RouterStateSnapshot): Observable | Promise | boolean | UrlTree { if(!SessionStore.user.Inactivity) { - this.router.navigate(['/inactivity']); + this.router.navigate(['/']); } - else if(window.location.pathname != '' && !SessionStore.exist) { + else if(!SessionStore.exist) { this.router.navigate(['/']); return false } else { diff --git a/src/app/guards/login.guard.ts b/src/app/guards/login.guard.ts index 375d80d13..8b7a734d3 100644 --- a/src/app/guards/login.guard.ts +++ b/src/app/guards/login.guard.ts @@ -17,6 +17,7 @@ export class LoginGuard implements CanActivate { // console.log(SessionStore.exist, SessionStore.user.Inactivity, SessionStore.user.LoginPreference) + console.log(SessionStore.exist, SessionStore.user.Inactivity, SessionStore.user.LoginPreference) if(SessionStore.exist && SessionStore.user.Inactivity && SessionStore.user.LoginPreference != 'Pin' ) { this.router.navigate(['/home/events']); return false From ba5e7f192e158148e2d5c317667534d31a5aad62 Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Fri, 3 Sep 2021 17:33:29 +0100 Subject: [PATCH 62/67] fix login to rocket chat --- src/app/pages/gabinete-digital/gabinete-digital.page.ts | 7 ++++++- src/app/pages/login/login.page.ts | 3 ++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/app/pages/gabinete-digital/gabinete-digital.page.ts b/src/app/pages/gabinete-digital/gabinete-digital.page.ts index feca818ee..d3414e37c 100644 --- a/src/app/pages/gabinete-digital/gabinete-digital.page.ts +++ b/src/app/pages/gabinete-digital/gabinete-digital.page.ts @@ -133,6 +133,11 @@ export class GabineteDigitalPage implements OnInit, DoCheck { } }; this.checkRoutes(); + + + // this.eventoaprovacaostore.resetmd([]) + // this.eventoaprovacaostore.resetpr([]) + } ngDoCheck(): void { @@ -158,7 +163,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck { this.segmentVista = "listview"; } else{ - this.segmentVista = "boxview"; + this.segmentVista = "boxview" } const pathname = window.location.pathname diff --git a/src/app/pages/login/login.page.ts b/src/app/pages/login/login.page.ts index b2fd26e37..b453225dc 100644 --- a/src/app/pages/login/login.page.ts +++ b/src/app/pages/login/login.page.ts @@ -83,7 +83,7 @@ export class LoginPage implements OnInit { if (attempt.UserId == SessionStore.user.UserId) { await this.authService.SetSession(attempt, this.userattempt); - this.authService.loginChat(this.userattempt); + await this.authService.loginChat(this.userattempt); this.getToken(); SessionStore.setInativity(true) @@ -92,6 +92,7 @@ export class LoginPage implements OnInit { SessionStore.delete() window.localStorage.clear(); await this.authService.SetSession(attempt, this.userattempt); + await this.authService.loginChat(this.userattempt); this.router.navigate(['/pin']); } From 64fb8f42a11abbb41256efb800ea4d0468d5c4e5 Mon Sep 17 00:00:00 2001 From: "tiago.kayaya" Date: Mon, 6 Sep 2021 12:14:21 +0100 Subject: [PATCH 63/67] save --- src/app/Rules/despacho.service.ts | 89 +++++++++++++------ .../create-process/create-process.page.ts | 27 +++--- 2 files changed, 74 insertions(+), 42 deletions(-) diff --git a/src/app/Rules/despacho.service.ts b/src/app/Rules/despacho.service.ts index d6356b8a2..2ff5130c4 100644 --- a/src/app/Rules/despacho.service.ts +++ b/src/app/Rules/despacho.service.ts @@ -32,7 +32,7 @@ export class DespachoService { public p: PermissionService, public LoaderService: LoaderService ) { } - + arquivar(note:string, documents:AttachmentList, serialnumber) { let body = { @@ -44,10 +44,10 @@ export class DespachoService { }, "AttachmentList" :documents, } - + return this.processes.CompleteTask(body) } - + // reencaminhar(note:string, documents:any, serialnumber) { // let body = { @@ -61,9 +61,9 @@ export class DespachoService { // } // return this.processes.CompleteTask(body) // } - + executado(note:string, documents:any , serialnumber) { - + let body = { "serialNumber": serialnumber, "action": "Conhecimento", @@ -77,30 +77,61 @@ export class DespachoService { return this.processes.CompleteTask(body) } - solicitarParecer({note ='', documents = [], serialnumber}) { - let body = { - "serialNumber": serialnumber, - "action": "Conhecimento", - "ActionTypeId": 92, - "dataFields": { - "ReviewUserComment": note, - }, - "AttachmentList" :documents, + solicitarParecer({note ='', documents = [], serialnumber, activityInstanceName}) { + let body; + if(activityInstanceName == 'Concluir Despacho' || activityInstanceName == 'Concluir Parecer' || activityInstanceName == 'Concluir Deferimento'){ + body = { + "serialNumber": serialnumber, + "action": "Parecer", + "ActionTypeId": 92, + "dataFields": { + "ReviewUserComment": note, + }, + "AttachmentList" :documents, + } + + } + else{ + body = { + "serialNumber": serialnumber, + "action": "Conhecimento", + "ActionTypeId": 92, + "dataFields": { + "ReviewUserComment": note, + }, + "AttachmentList" :documents, + } + } return this.processes.CompleteTask(body) } - EfectuarDespacho({note = '', documents = [], serialnumber}) { - let body = { - "serialNumber": serialnumber, - "action": "Conhecimento", - "ActionTypeId": 94, - "dataFields": { - "ReviewUserComment": note, - }, - "AttachmentList" :documents, + EfectuarDespacho({note = '', documents = [], serialnumber, activityInstanceName}) { + let body; + if(activityInstanceName == 'Concluir Despacho' || activityInstanceName == 'Concluir Parecer' || activityInstanceName == 'Concluir Deferimento'){ + body = { + "serialNumber": serialnumber, + "action": "Despacho", + "ActionTypeId": 94, + "dataFields": { + "ReviewUserComment": note, + }, + "AttachmentList" :documents, + } } + else{ + body = { + "serialNumber": serialnumber, + "action": "Conhecimento", + "ActionTypeId": 94, + "dataFields": { + "ReviewUserComment": note, + }, + "AttachmentList" :documents, + } + } + console.log(body); return this.processes.CompleteTask(body) } @@ -191,13 +222,13 @@ export class DespachoService { async getList({updateStore = false}): Promise | null { - + if (this.LoaderService.loading) { return this.despachoStore.list } this.LoaderService.push({}) - + let result: fullTaskList[] = [] let despachoList: customTask[] = []; @@ -205,18 +236,18 @@ export class DespachoService { result = await this.processes.GetTasksList("Despacho", false).toPromise(); result = result.filter((data:fullTaskList) => data.workflowInstanceDataFields.Status == "Active") result.forEach((element, index) => { - + let task: customTask = this.customTaskPipe.transform(element); despachoList.push(task); - + }); - + despachoList = this.sortArrayISODate(despachoList).reverse(); if(updateStore) { this.despachoStore.reset(despachoList); } - + } catch (error) { } finally { diff --git a/src/app/modals/create-process/create-process.page.ts b/src/app/modals/create-process/create-process.page.ts index 2b27f0440..ddb43255c 100644 --- a/src/app/modals/create-process/create-process.page.ts +++ b/src/app/modals/create-process/create-process.page.ts @@ -120,7 +120,7 @@ export class CreateProcessPage implements OnInit { NumberPDPP = this.fulltask.workflowInstanceDataFields.DispatchNumber } } - + let SourceId; let SourceType; let SourceSecFsId; @@ -230,7 +230,7 @@ export class CreateProcessPage implements OnInit { this.runValidation() if(this.Form.invalid) return false } - + if(this.postData.Priority=='99999861') { this.dispatchFolder.DeadlineType = 'Normal'; @@ -279,15 +279,16 @@ export class CreateProcessPage implements OnInit { DispatchFolder: this.dispatchFolder, } console.log('this.postData', this.postData, this.taskType); + console.log(this.task.activityInstanceName); try { await this.processes.postDespatcho(this.postData).toPromise(); - await this.despachoService.EfectuarDespacho({serialnumber: this.task.serialNumber}).toPromise(); - + await this.despachoService.EfectuarDespacho({serialnumber: this.task.serialNumber, activityInstanceName: this.task.activityInstanceName}).toPromise(); + this.modalController.dismiss(); } catch (error) { this.toastService.badRequest('Processo não efectuado'); - + } finally { loader.remove() } @@ -307,12 +308,12 @@ export class CreateProcessPage implements OnInit { try { if(this.task.activityInstanceName == 'Tarefa de Despacho' || this.task.activityInstanceName == 'Reexecutar Despacho') { await this.despachoService.createParecer(this.postData).toPromise(); - await this.despachoService.solicitarParecer({ serialnumber: this.task.serialNumber}).toPromise(); + await this.despachoService.solicitarParecer({ serialnumber: this.task.serialNumber, activityInstanceName: this.task.activityInstanceName}).toPromise(); } else { await this.pedidoService.createParecer(this.postData).toPromise(); await this.pedidoService.taskCompleteParecer({serialNumber:this.task.serialNumber}).toPromise(); } - + this.modalController.dismiss(); this.toastService.successMessage('Pedido de Parecer enviado'); } @@ -340,7 +341,7 @@ export class CreateProcessPage implements OnInit { this.modalController.dismiss(); this.toastService.successMessage('Pedido de Deferimento criado'); - } + } catch (error) { this.toastService.badRequest('Processo não efectuado'); } @@ -368,7 +369,7 @@ export class CreateProcessPage implements OnInit { try { await this.despachoService.createDespacho(this.postData).toPromise(); await this.despachoService.CompleteTask({serialNumber: this.task.serialNumber}).toPromise(); - + this.modalController.dismiss(); this.toastService.successMessage('Despacho criado'); } catch (error) { @@ -393,7 +394,7 @@ export class CreateProcessPage implements OnInit { if(this.task.activityInstanceName == 'Tarefa de Despacho' || this.task.activityInstanceName == 'Reexecutar Despacho') { await this.despachoService.createParecer(this.postData).toPromise(); - await this.despachoService.solicitarParecer({ serialnumber: this.task.serialNumber}).toPromise(); + await this.despachoService.solicitarParecer({ serialnumber: this.task.serialNumber, activityInstanceName: this.task.activityInstanceName}).toPromise(); } else { await this.pedidoService.createParecer(this.postData).toPromise(); await this.pedidoService.taskCompleteParecer({serialNumber:this.task.serialNumber}).toPromise(); @@ -442,7 +443,7 @@ export class CreateProcessPage implements OnInit { async FinalizarDespacho(loader: HTMLDivElement, message?) { - + let body; if(this.task.activityInstanceName =='Tarefa de Despacho' || @@ -461,7 +462,7 @@ export class CreateProcessPage implements OnInit { else if(this.task.activityInstanceName =='Concluir Despacho' || this.task.activityInstanceName == 'Concluir Parecer' || this.task.activityInstanceName =='Concluir Deferimento' || - this.task.activityInstanceName =='Reapreciar Deferimento' || + this.task.activityInstanceName =='Reapreciar Deferimento' || this.task.activityInstanceName == 'Tarefa de Deferimento' ) { @@ -478,7 +479,7 @@ export class CreateProcessPage implements OnInit { } else { console.log('unexpected activityInstanceName', this.task) } - + console.log(body); try { From 2b2d4ef315a6afc3b8b87cba76605d66e7c900bb Mon Sep 17 00:00:00 2001 From: "tiago.kayaya" Date: Mon, 6 Sep 2021 14:41:32 +0100 Subject: [PATCH 64/67] save --- src/app/Rules/despacho.service.ts | 12 ++++++++++-- .../despachos/despacho/despacho.page.ts | 2 +- .../book-meeting-modal/book-meeting-modal.page.ts | 9 +++++---- .../gabinete-digital/gabinete-digital.page.scss | 4 ++-- 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/app/Rules/despacho.service.ts b/src/app/Rules/despacho.service.ts index 2ff5130c4..89d801ddf 100644 --- a/src/app/Rules/despacho.service.ts +++ b/src/app/Rules/despacho.service.ts @@ -79,7 +79,11 @@ export class DespachoService { solicitarParecer({note ='', documents = [], serialnumber, activityInstanceName}) { let body; - if(activityInstanceName == 'Concluir Despacho' || activityInstanceName == 'Concluir Parecer' || activityInstanceName == 'Concluir Deferimento'){ + if(activityInstanceName == 'Concluir Despacho' + || activityInstanceName == 'Concluir Parecer' + || activityInstanceName == 'Concluir Deferimento' + || activityInstanceName == 'Tarefa de Deferimento' + ){ body = { "serialNumber": serialnumber, "action": "Parecer", @@ -109,7 +113,11 @@ export class DespachoService { EfectuarDespacho({note = '', documents = [], serialnumber, activityInstanceName}) { let body; - if(activityInstanceName == 'Concluir Despacho' || activityInstanceName == 'Concluir Parecer' || activityInstanceName == 'Concluir Deferimento'){ + if(activityInstanceName == 'Concluir Despacho' + || activityInstanceName == 'Concluir Parecer' + || activityInstanceName == 'Concluir Deferimento' + || activityInstanceName == 'Tarefa de Deferimento' + ){ body = { "serialNumber": serialnumber, "action": "Despacho", diff --git a/src/app/pages/gabinete-digital/despachos/despacho/despacho.page.ts b/src/app/pages/gabinete-digital/despachos/despacho/despacho.page.ts index 1c7e55605..262b21dc0 100644 --- a/src/app/pages/gabinete-digital/despachos/despacho/despacho.page.ts +++ b/src/app/pages/gabinete-digital/despachos/despacho/despacho.page.ts @@ -52,7 +52,7 @@ export class DespachoPage implements OnInit { private despachoService: DespachoService, private location: Location, public p: PermissionService, - + ) { this.activatedRoute.paramMap.subscribe(params => { diff --git a/src/app/pages/gabinete-digital/expediente/book-meeting-modal/book-meeting-modal.page.ts b/src/app/pages/gabinete-digital/expediente/book-meeting-modal/book-meeting-modal.page.ts index b525a8cd9..a563b56ee 100644 --- a/src/app/pages/gabinete-digital/expediente/book-meeting-modal/book-meeting-modal.page.ts +++ b/src/app/pages/gabinete-digital/expediente/book-meeting-modal/book-meeting-modal.page.ts @@ -226,7 +226,7 @@ export class BookMeetingModalPage implements OnInit { this.runValidation() if(this.Form.invalid) return false } - + let Attendees = this.taskParticipants.concat(this.taskParticipantsCc); this.eventBody={ @@ -284,15 +284,16 @@ export class BookMeetingModalPage implements OnInit { } else if(this.task.FsId == '361') { + const loader = this.toastService.loading() try { switch (this.loggeduser.Profile) { case 'MDGPR': - await this.calendarService.createTaskEvent(this.task.FolderId, this.postData, "md",this.task.SerialNumber, this.task.FsId).toPromise(); + await this.calendarService.createTaskEvent(this.task.FolderID | this.task.FolderId, this.postData, "md",this.task.SerialNumber, this.task.FsId).toPromise(); break; case 'PR': - await this.calendarService.createTaskEvent(this.task.FolderId, this.postData, "pr",this.task.SerialNumber, this.task.FsId).toPromise(); + await this.calendarService.createTaskEvent(this.task.FolderID | this.task.FolderId, this.postData, "pr",this.task.SerialNumber, this.task.FsId).toPromise(); break; } this.close(); @@ -307,7 +308,7 @@ export class BookMeetingModalPage implements OnInit { } if(true) { - // + // } } diff --git a/src/app/pages/gabinete-digital/gabinete-digital.page.scss b/src/app/pages/gabinete-digital/gabinete-digital.page.scss index 852c5e3e6..20f96d556 100644 --- a/src/app/pages/gabinete-digital/gabinete-digital.page.scss +++ b/src/app/pages/gabinete-digital/gabinete-digital.page.scss @@ -155,9 +155,8 @@ ion-segment-button{ .exp-card-long{ cursor: pointer; user-select: none; - //background: white; + background: white; box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.07); - //Sbackground: white; width: 360px; margin: 7px 20px; border-radius: 15px; @@ -518,6 +517,7 @@ ion-list{ } } } + @media only screen and (min-width: 801px) { .title{ font-size: 25px !important; From d0fee13402852939e4f61097a43da598b735fd9f Mon Sep 17 00:00:00 2001 From: "tiago.kayaya" Date: Mon, 6 Sep 2021 16:19:34 +0100 Subject: [PATCH 65/67] save --- src/app/pages/chat/chat.page.html | 2 +- .../shared/popover/request-options/request-options.page.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/pages/chat/chat.page.html b/src/app/pages/chat/chat.page.html index 0eaf46dde..bdfd6a2d0 100644 --- a/src/app/pages/chat/chat.page.html +++ b/src/app/pages/chat/chat.page.html @@ -86,7 +86,7 @@
{{group.name.split('-').join(' ')}}
-
{{group.lastMessage._updatedAt | date: 'HH:mm'}}
+
{{showDateDuration(group._updatedAt)}}
{{group.lastMessage.u.name}}: {{group.lastMessage.msg}} diff --git a/src/app/shared/popover/request-options/request-options.page.ts b/src/app/shared/popover/request-options/request-options.page.ts index 3cd00bfc5..074609703 100644 --- a/src/app/shared/popover/request-options/request-options.page.ts +++ b/src/app/shared/popover/request-options/request-options.page.ts @@ -22,8 +22,8 @@ export class RequestOptionsPage implements OnInit { task:any; fulltask: any; profile:string; - serialNumber : string - showEnviarPendentes = false + serialNumber : string; + showEnviarPendentes = false; constructor( private popoverController: PopoverController, From 5e4229e21051b2416ddacad345afa5b9f38b4442 Mon Sep 17 00:00:00 2001 From: "tiago.kayaya" Date: Mon, 6 Sep 2021 16:53:58 +0100 Subject: [PATCH 66/67] save --- .../group-messages/group-messages.page.ts | 9 ++-- .../services/functions/time.service.spec.ts | 16 +++++++ src/app/services/functions/time.service.ts | 47 +++++++++++++++++++ .../group-messages/group-messages.page.html | 2 +- .../group-messages/group-messages.page.ts | 7 ++- .../shared/chat/messages/messages.page.html | 2 +- src/app/shared/chat/messages/messages.page.ts | 8 +++- 7 files changed, 84 insertions(+), 7 deletions(-) create mode 100644 src/app/services/functions/time.service.spec.ts create mode 100644 src/app/services/functions/time.service.ts diff --git a/src/app/pages/chat/group-messages/group-messages.page.ts b/src/app/pages/chat/group-messages/group-messages.page.ts index ab82b2491..6ef11c520 100644 --- a/src/app/pages/chat/group-messages/group-messages.page.ts +++ b/src/app/pages/chat/group-messages/group-messages.page.ts @@ -10,6 +10,7 @@ import { NewGroupPage } from '../new-group/new-group.page'; import { GroupContactsPage } from './group-contacts/group-contacts.page'; import {Router} from '@angular/router' import { EditGroupPage } from '../edit-group/edit-group.page'; +import { TimeService } from 'src/app/services/functions/time.service'; @Component({ selector: 'app-group-messages', @@ -49,7 +50,8 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy { private navParams: NavParams, private authService: AuthService, private alertService: AlertService, - private route: Router + private route: Router, + private timeService: TimeService, ) { this.loggedUserChat = authService.ValidatedUserChat['data']; this.isGroupCreated = true; @@ -178,7 +180,8 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy { } showDateDuration(start:any){ - let end; + return this.timeService.showDateDuration(start); + /* let end; end = new Date(); start = new Date(start); let customizedDate; @@ -204,7 +207,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy { else{ let date = start.getDate() + "/" + (start.getMonth()+1) + "/" + start.getFullYear(); return date; - } + } */ } addZero(i) { diff --git a/src/app/services/functions/time.service.spec.ts b/src/app/services/functions/time.service.spec.ts new file mode 100644 index 000000000..c906c0a8f --- /dev/null +++ b/src/app/services/functions/time.service.spec.ts @@ -0,0 +1,16 @@ +import { TestBed } from '@angular/core/testing'; + +import { TimeService } from './time.service'; + +describe('TimeService', () => { + let service: TimeService; + + beforeEach(() => { + TestBed.configureTestingModule({}); + service = TestBed.inject(TimeService); + }); + + it('should be created', () => { + expect(service).toBeTruthy(); + }); +}); diff --git a/src/app/services/functions/time.service.ts b/src/app/services/functions/time.service.ts new file mode 100644 index 000000000..fa0bf2440 --- /dev/null +++ b/src/app/services/functions/time.service.ts @@ -0,0 +1,47 @@ +import { Injectable } from '@angular/core'; + +@Injectable({ + providedIn: 'root' +}) +export class TimeService { + + constructor() { } + + showDateDuration(start:any){ + let end; + end = new Date(); + start = new Date(start); + let customizedDate; + + 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 ); + + if(totalDays == 0){ + if(start.getDate() == new Date().getDate()){ + let time = start.getHours() + ":" + this.addZero(start.getUTCMinutes()); + return time; + } + else{ + return 'Ontem'; + } + } + else{ + let date = start.getDate() + "/" + (start.getMonth()+1) + "/" + start.getFullYear(); + return date; + } + } + + addZero(i) { + if (i < 10) { + i = "0" + i; + } + return i; + } + +} diff --git a/src/app/shared/chat/group-messages/group-messages.page.html b/src/app/shared/chat/group-messages/group-messages.page.html index 3db44986d..db2c8cbe4 100644 --- a/src/app/shared/chat/group-messages/group-messages.page.html +++ b/src/app/shared/chat/group-messages/group-messages.page.html @@ -42,7 +42,7 @@
{{msg.u.name}} - {{msg._updatedAt | date: 'HH:mm' }} + {{showDateDuration(msg._updatedAt)}}
{{msg.msg}} diff --git a/src/app/shared/chat/group-messages/group-messages.page.ts b/src/app/shared/chat/group-messages/group-messages.page.ts index 88f371032..a266277f4 100644 --- a/src/app/shared/chat/group-messages/group-messages.page.ts +++ b/src/app/shared/chat/group-messages/group-messages.page.ts @@ -10,6 +10,7 @@ import { GroupContactsPage } from './group-contacts/group-contacts.page'; import { Router } from '@angular/router' import { ChatOptionsPopoverPage } from '../../popover/chat-options-popover/chat-options-popover.page'; import { ChatOptionsFeaturesPage } from 'src/app/modals/chat-options-features/chat-options-features.page'; +import { TimeService } from 'src/app/services/functions/time.service'; @Component({ selector: 'app-group-messages', @@ -54,7 +55,8 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe private authService: AuthService, private animationController: AnimationController, private alertService: AlertService, - private route: Router + private route: Router, + private timeService: TimeService, ) { this.loggedUserChat = authService.ValidatedUserChat['data']; this.isGroupCreated = true; @@ -140,6 +142,9 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe console.log('here watching'); return this.roomId; } + showDateDuration(start:any){ + return this.timeService.showDateDuration(start); + } getRoomInfo(){ this.showLoader = true; diff --git a/src/app/shared/chat/messages/messages.page.html b/src/app/shared/chat/messages/messages.page.html index 552158990..14bbc4c1a 100644 --- a/src/app/shared/chat/messages/messages.page.html +++ b/src/app/shared/chat/messages/messages.page.html @@ -35,7 +35,7 @@
{{msg.u.name}} - {{msg._updatedAt | date: 'HH:mm' }} + {{showDateDuration(msg._updatedAt)}}
{{msg.msg}} diff --git a/src/app/shared/chat/messages/messages.page.ts b/src/app/shared/chat/messages/messages.page.ts index b68c228c6..3e8bccfc4 100644 --- a/src/app/shared/chat/messages/messages.page.ts +++ b/src/app/shared/chat/messages/messages.page.ts @@ -12,6 +12,7 @@ import { synchro } from 'src/app/services/socket/synchro.service'; import { ChatOptionsFeaturesPage } from 'src/app/modals/chat-options-features/chat-options-features.page'; import { ChatMessageStore } from 'src/app/store/chat/chat-message.service'; import { ChatUserStorage } from 'src/app/store/chat/chat-user.service'; +import { TimeService } from 'src/app/services/functions/time.service'; @Component({ selector: 'app-messages', @@ -58,7 +59,8 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy private animationController: AnimationController, private alertService: AlertService, private toastService: ToastService, - private route: Router + private route: Router, + private timeService: TimeService, ) { this.loggedUser = authService.ValidatedUserChat['data']; @@ -151,6 +153,10 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy this.openNewEventPage.emit(data); } + showDateDuration(start:any){ + return this.timeService.showDateDuration(start); + } + sendMessage() { this.synchro.$send({}) From 7592e7cb0e0a1c3c72ea8a4bb6ad1759c7c2da8b Mon Sep 17 00:00:00 2001 From: "tiago.kayaya" Date: Mon, 6 Sep 2021 16:57:25 +0100 Subject: [PATCH 67/67] save --- src/app/services/functions/time.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/services/functions/time.service.ts b/src/app/services/functions/time.service.ts index fa0bf2440..33e8719cc 100644 --- a/src/app/services/functions/time.service.ts +++ b/src/app/services/functions/time.service.ts @@ -32,7 +32,7 @@ export class TimeService { } } else{ - let date = start.getDate() + "/" + (start.getMonth()+1) + "/" + start.getFullYear(); + let date = this.addZero(start.getDate()) + "/" + this.addZero(start.getMonth()+1) + "/" + start.getFullYear(); return date; } }