From 8fe761c931a68cb441b3e347fedc715a87d3add3 Mon Sep 17 00:00:00 2001 From: "tiago.kayaya" Date: Fri, 20 Aug 2021 16:38:58 +0100 Subject: [PATCH 1/5] save --- src/app/pages/chat/chat.page.html | 2 +- src/app/pages/chat/chat.page.ts | 41 +++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/src/app/pages/chat/chat.page.html b/src/app/pages/chat/chat.page.html index 9d8259898..74f7fa641 100644 --- a/src/app/pages/chat/chat.page.html +++ b/src/app/pages/chat/chat.page.html @@ -63,7 +63,7 @@ -
{{dm._updatedAt | date: 'HH:mm'}}
+
{{showDateDuration(dm._updatedAt)}}
{{dm.lastMessage.msg}} diff --git a/src/app/pages/chat/chat.page.ts b/src/app/pages/chat/chat.page.ts index ab87827d8..3385911d9 100644 --- a/src/app/pages/chat/chat.page.ts +++ b/src/app/pages/chat/chat.page.ts @@ -138,6 +138,10 @@ export class ChatPage implements OnInit { /* Fim websocket functions */ this.hideRefreshButton(); this.getChatMembers(); + + //Teste + let t = this.showDateDuration(new Date()); + console.log(t); } hideRefreshButton(){ @@ -368,6 +372,43 @@ hideRefreshButton(){ }); } + 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.getDay()+1) + "/" + (start.getMonth()+1) + "/" + start.getFullYear(); + return date; + } + } + + addZero(i) { + if (i < 10) { + i = "0" + i; + } + return i; + } + async getChatMembers(){ //return await this.chatService.getMembers(roomId).toPromise(); this.chatService.getAllUsers().subscribe(res=> { From 84d24dbbaf479280f82e07bdf24391f79783dd07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eudes=20In=C3=A1cio?= Date: Fri, 20 Aug 2021 16:43:17 +0100 Subject: [PATCH 2/5] Profile notification layout add desc fild --- src/app/modals/profile/profile.page.html | 17 ++++--- src/app/modals/profile/profile.page.scss | 27 ++++++++++- src/app/modals/profile/profile.page.ts | 30 ++++++++---- src/app/services/notifications.service.ts | 4 +- src/app/services/storage.service.ts | 6 ++- src/assets/images/icons-nav-accoes-active.svg | 36 +++++++++++++++ src/assets/images/icons-nav-agenda-active.svg | 46 +++++++++++++++++++ 7 files changed, 146 insertions(+), 20 deletions(-) create mode 100644 src/assets/images/icons-nav-accoes-active.svg create mode 100644 src/assets/images/icons-nav-agenda-active.svg diff --git a/src/app/modals/profile/profile.page.html b/src/app/modals/profile/profile.page.html index bebdb558f..37dd1e50f 100644 --- a/src/app/modals/profile/profile.page.html +++ b/src/app/modals/profile/profile.page.html @@ -40,17 +40,22 @@
- + +
-

{{item.dateInit}}

-

{{item.dateEnd}}

+

{{item.dateInit}}

+

{{item.dateEnd}}

-

{{item.Location}}

-

{{item.alert}}

+

{{item.Location}}

+

{{item.alert}}

+

{{item.desc}}

-
+
+
+
+
diff --git a/src/app/modals/profile/profile.page.scss b/src/app/modals/profile/profile.page.scss index c64fbe321..00bbc3115 100644 --- a/src/app/modals/profile/profile.page.scss +++ b/src/app/modals/profile/profile.page.scss @@ -96,14 +96,39 @@ ion-list{ .approve-event-detail{ width: calc(100% - 115px) !important; float: left; + #profile-title{ + width: 250px; + } } - .notification-label{ + .notification-label-MD-official{ float: right; width: 5px; height: 100%; border-radius: 0% 100% 100% 0%; background-color: #ffb703; } + .notification-label-MD-pessoal{ + float: right; + width: 5px; + height: 100%; + border-radius: 0% 100% 100% 0%; + background-color: #ff0303; + } + + .notification-label-PR-official{ + float: right; + width: 5px; + height: 100%; + border-radius: 0% 100% 100% 0%; + background-color: #03d838; + } + .notification-label-PR-pessoal{ + float: right; + width: 5px; + height: 100%; + border-radius: 0% 100% 100% 0%; + background-color: #8b0ae0; + } } } diff --git a/src/app/modals/profile/profile.page.ts b/src/app/modals/profile/profile.page.ts index 192dccbc4..285353b74 100644 --- a/src/app/modals/profile/profile.page.ts +++ b/src/app/modals/profile/profile.page.ts @@ -72,10 +72,11 @@ export class ProfilePage implements OnInit { IdObject: payload.IdObject, FolderId: payload.FolderId, desc: payload.desc, - dateInit: payload.dateInit, - dateEnd: payload.dateEnd, + dateInit: this.getFormatedTime(payload.dateInit), + dateEnd: this.getFormatedTime(payload.dateEnd), Location: payload.Location, TypeAgenda: payload.TypeAgenda, + Role: payload.Role, Status: payload.Status } } else { @@ -87,10 +88,11 @@ export class ProfilePage implements OnInit { IdObject: element.IdObject, FolderId: element.FolderId, desc: element.desc, - dateInit: element.dateInit, - dateEnd: element.dateEnd, + dateInit: this.getFormatedTime(element.dateInit), + dateEnd: this.getFormatedTime(element.dateEnd), Location: element.Location, TypeAgenda: element.TypeAgenda, + Role: element.Role, Status: element.Status } } @@ -107,7 +109,18 @@ export class ProfilePage implements OnInit { console.log('Timer badge count') } + getFormatedTime(dateString){ + var date = new Date(dateString); + var hours = date.getHours() > 12 ? date.getHours() - 12 : date.getHours(); + var am_pm = date.getHours() >= 12 ? "pm" : "am"; + var minutes = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes(); + let time = hours + ":" + minutes /* + " " + am_pm */; + console.log('Formate',time) + return time; + } + notificatinsRoutes = (index, Service, Object, IdObject, FolderId) => { + this.deleteNotification(index); if (Service === "agenda") { this.zone.run(() => this.router.navigate(['/home/agenda', IdObject, 'agenda'])); } @@ -115,7 +128,8 @@ export class ProfilePage implements OnInit { this.zone.run(() => this.router.navigate(['/home/gabinete-digital/expediente', IdObject, 'gabinete-digital'])); } else if (Service === "gabinete-digital" && Object === "event-list") { - this.zone.run(() => this.router.navigate(['/home/gabinete-digital/event-list/approve-event', IdObject, 'gabinete-digital'])); + this.zone.run(() => this.router.navigate(['/home/gabinete-digital/event-list/approve-event',IdObject, 'gabinete-digital'])); + } else if (Service === "gabinete-digital" && Object === "despachos") { this.zone.run(() => this.router.navigate(['/home/gabinete-digital/despachos', IdObject, 'gabinete-digital'], { replaceUrl: true })); @@ -153,7 +167,7 @@ export class ProfilePage implements OnInit { this.zone.run(() => this.router.navigate(['/home/gabinete-digital/expedientes-pr', IdObject, 'gabinete-digital'])); } - this.deleteNotification(index); + } @@ -162,10 +176,6 @@ export class ProfilePage implements OnInit { console.log("Delete notification first stata", this.notificationdata) this.notificationdata = this.notificationdata.filter(item=>item.index !=index ); - if(typeof(this.notificationdata) != 'object' ) { - console.log('=_+_+_+_+_+_+_+_+_+_++_+_+_+_+_+_+_+_+_+_+_+_ not an object') - } - this.storageservice.store("Notifications",JSON.stringify(this.notificationdata)).then(() =>{ this.storageservice.get("Notifications").then((value) =>{ console.log("notfication state", value, ) diff --git a/src/app/services/notifications.service.ts b/src/app/services/notifications.service.ts index 906b4cc32..6ae9b2db6 100644 --- a/src/app/services/notifications.service.ts +++ b/src/app/services/notifications.service.ts @@ -231,8 +231,8 @@ export class NotificationsService { else if (data.Service === "gabinete-digital" && data.Object === "expediente") { this.zone.run(() => this.router.navigate(['/home/gabinete-digital/expediente',data.IdObject,'gabinete-digital'])); } - else if (data.Service === "gabinete-digital" && data.Object === "event-list") { - this.zone.run(() => this.router.navigate(['/home/gabinete-digital/event-list/approve-event',data.IdObject, 'gabinete-digital'])); + else if (data.Service === "agenda" && data.Object === "event-list") { + this.zone.run(() => this.router.navigate(['/home/agenda/event-list/approve-event',data.IdObject, 'agenda'])); }else if (data.Service === "gabinete-digital" && data.Object === "despachos") { this.zone.run(() => this.router.navigate(['/home/gabinete-digital/despachos',data.IdObject,'gabinete-digital'],{replaceUrl: true})); diff --git a/src/app/services/storage.service.ts b/src/app/services/storage.service.ts index 95ba38c25..7bfd08526 100644 --- a/src/app/services/storage.service.ts +++ b/src/app/services/storage.service.ts @@ -16,7 +16,11 @@ const { Storage } = Plugins; */ // Get the value async get(key: string) { const ret = await this.storage.get(key).then((val) => { return val; }); - return JSON.parse(unescape(atob(ret))); + try { + return JSON.parse(unescape(atob(ret))); + } catch (error) { + return unescape(atob(ret)) + } } async remove(key: string){ diff --git a/src/assets/images/icons-nav-accoes-active.svg b/src/assets/images/icons-nav-accoes-active.svg new file mode 100644 index 000000000..2d12457f3 --- /dev/null +++ b/src/assets/images/icons-nav-accoes-active.svg @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/assets/images/icons-nav-agenda-active.svg b/src/assets/images/icons-nav-agenda-active.svg new file mode 100644 index 000000000..c1a5e00b6 --- /dev/null +++ b/src/assets/images/icons-nav-agenda-active.svg @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 2b21af3511a583372e7e4a468fae66a64424dfed Mon Sep 17 00:00:00 2001 From: "tiago.kayaya" Date: Fri, 20 Aug 2021 16:44:48 +0100 Subject: [PATCH 3/5] set duration --- src/app/pages/chat/chat.page.ts | 2 +- src/app/pages/gabinete-digital/gabinete-digital.page.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/pages/chat/chat.page.ts b/src/app/pages/chat/chat.page.ts index 3385911d9..16c295461 100644 --- a/src/app/pages/chat/chat.page.ts +++ b/src/app/pages/chat/chat.page.ts @@ -397,7 +397,7 @@ hideRefreshButton(){ } } else{ - let date = (start.getDay()+1) + "/" + (start.getMonth()+1) + "/" + start.getFullYear(); + let date = start.getDate() + "/" + (start.getMonth()+1) + "/" + start.getFullYear(); return date; } } diff --git a/src/app/pages/gabinete-digital/gabinete-digital.page.ts b/src/app/pages/gabinete-digital/gabinete-digital.page.ts index 3fb1fae68..9bf903b4f 100644 --- a/src/app/pages/gabinete-digital/gabinete-digital.page.ts +++ b/src/app/pages/gabinete-digital/gabinete-digital.page.ts @@ -154,7 +154,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck { } const pathname = window.location.pathname - + this.router.events.forEach((event) => { if(event instanceof NavigationEnd && event.url == pathname) { @@ -266,7 +266,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck { } getCustomDate(thedate: Date){ - return (thedate.getDay()+1) + "/" + + return thedate.getDate() + "/" + (thedate.getMonth()+1) + "/" + thedate.getFullYear(); } From 629a02a13ecbe75ac2bae3c66d98c36d9a41d117 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eudes=20In=C3=A1cio?= Date: Fri, 20 Aug 2021 16:59:44 +0100 Subject: [PATCH 4/5] Profile get old notification bug resolved --- src/app/modals/profile/profile.page.ts | 6 +++--- src/app/services/notifications.service.ts | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/app/modals/profile/profile.page.ts b/src/app/modals/profile/profile.page.ts index 285353b74..51a96b6c2 100644 --- a/src/app/modals/profile/profile.page.ts +++ b/src/app/modals/profile/profile.page.ts @@ -53,7 +53,7 @@ export class ProfilePage implements OnInit { notImplemented() { } async getNotificationData(){ - + this.notificationservice.tempClearArray(); this.storageservice.get("Notifications").then((value) => { console.log("Init get store", value) @@ -120,7 +120,7 @@ export class ProfilePage implements OnInit { } notificatinsRoutes = (index, Service, Object, IdObject, FolderId) => { - this.deleteNotification(index); + if (Service === "agenda") { this.zone.run(() => this.router.navigate(['/home/agenda', IdObject, 'agenda'])); } @@ -167,7 +167,7 @@ export class ProfilePage implements OnInit { this.zone.run(() => this.router.navigate(['/home/gabinete-digital/expedientes-pr', IdObject, 'gabinete-digital'])); } - + this.deleteNotification(index); } diff --git a/src/app/services/notifications.service.ts b/src/app/services/notifications.service.ts index 6ae9b2db6..1a3a32dda 100644 --- a/src/app/services/notifications.service.ts +++ b/src/app/services/notifications.service.ts @@ -175,6 +175,10 @@ export class NotificationsService { } } + tempClearArray(){ + this.DataArray = []; + } + async onReceviNotification() { if(window['WLAuthorizationManager']) { From f1aa56bf4a8ff1999e5b238e4f374ce355b2bd2a Mon Sep 17 00:00:00 2001 From: "tiago.kayaya" Date: Fri, 20 Aug 2021 17:00:48 +0100 Subject: [PATCH 5/5] save --- .../group-messages/group-messages.page.html | 2 +- .../group-messages/group-messages.page.ts | 41 +++++++++++++++++++ .../pages/chat/messages/messages.page.html | 2 +- src/app/pages/chat/messages/messages.page.ts | 37 +++++++++++++++++ 4 files changed, 80 insertions(+), 2 deletions(-) diff --git a/src/app/pages/chat/group-messages/group-messages.page.html b/src/app/pages/chat/group-messages/group-messages.page.html index 173101d6b..d102fd9b4 100644 --- a/src/app/pages/chat/group-messages/group-messages.page.html +++ b/src/app/pages/chat/group-messages/group-messages.page.html @@ -43,7 +43,7 @@
{{msg.u.name}} - {{msg._updatedAt | date: 'HH:mm' }} + {{showDateDuration(msg._updatedAt)}}
{{msg.msg}} 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 9c8803255..512c3397f 100644 --- a/src/app/pages/chat/group-messages/group-messages.page.ts +++ b/src/app/pages/chat/group-messages/group-messages.page.ts @@ -133,6 +133,47 @@ export class GroupMessagesPage implements OnInit, AfterViewChecked { }); } */ } + + 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; + } + + + + sendMessage(){ let body = { "message": { "rid": this.roomId, "msg": this.message } diff --git a/src/app/pages/chat/messages/messages.page.html b/src/app/pages/chat/messages/messages.page.html index dfbf5e17a..c458eae00 100644 --- a/src/app/pages/chat/messages/messages.page.html +++ b/src/app/pages/chat/messages/messages.page.html @@ -39,7 +39,7 @@
{{msg.u.name}} - {{msg._updatedAt | date: 'HH:mm' }} + {{showDateDuration(msg._updatedAt)}}
{{msg.msg}} diff --git a/src/app/pages/chat/messages/messages.page.ts b/src/app/pages/chat/messages/messages.page.ts index 0e045125e..0820cbb7b 100644 --- a/src/app/pages/chat/messages/messages.page.ts +++ b/src/app/pages/chat/messages/messages.page.ts @@ -126,6 +126,43 @@ export class MessagesPage implements OnInit, AfterViewChecked { }); } + 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; + } + async openMessagesOptions(ev?: any) { const popover = await this.popoverController.create({ component: MessagesOptionsPage,