From 7e5388e4e1d6c316733b2ab4e8cd69a629c57660 Mon Sep 17 00:00:00 2001 From: "tiago.kayaya" Date: Tue, 14 Dec 2021 14:58:34 +0100 Subject: [PATCH 1/8] add message errors in new action. --- .../new-action/new-action.page.ts | 20 ++++++++----- src/app/services/functions/file.service.ts | 7 ++++- .../shared/agenda/new-event/new-event.page.ts | 5 ---- .../group-messages/group-messages.page.html | 4 +-- .../shared/chat/messages/messages.page.html | 4 +-- src/app/shared/chat/messages/messages.page.ts | 1 + .../publication/new-action/new-action.page.ts | 28 +++++++++++-------- 7 files changed, 41 insertions(+), 28 deletions(-) diff --git a/src/app/pages/publications/new-action/new-action.page.ts b/src/app/pages/publications/new-action/new-action.page.ts index 196a9ada0..b81efd8d9 100644 --- a/src/app/pages/publications/new-action/new-action.page.ts +++ b/src/app/pages/publications/new-action/new-action.page.ts @@ -66,7 +66,7 @@ export class NewActionPage implements OnInit { private publication: PublicationsService, private toastService: ToastService - ) { + ) { this.folder = new PublicationFolder(); @@ -76,7 +76,7 @@ export class NewActionPage implements OnInit { this.folder.DateBegin = new Date().toISOString() this.folder.DateEnd = (new Date(new Date().getTime() + 15 * 60000)).toISOString() - + } ngOnInit() { @@ -102,7 +102,13 @@ export class NewActionPage implements OnInit { } runValidation() { - this.validateFrom = true + this.validateFrom = true; + if(new Date(this.folder.DateBegin).toISOString() > new Date(this.folder.DateEnd).toISOString()){ + this.toastService.badRequest("A data de início não pode ser superior a data de fim"); + } + else if(this.folder.DateBegin > new Date().toISOString()){ + this.toastService.badRequest("A data de início não pode ser superior a data actual"); + } } injectValidation() { @@ -134,8 +140,8 @@ export class NewActionPage implements OnInit { DateEnd: this.folder.DateEnd, ActionType: this.segment, } - - + + const loader = this.toastService.loading() try { @@ -144,7 +150,7 @@ export class NewActionPage implements OnInit { this.toastService.successMessage("Ação presidencial criado"); this.close(); } catch (error) { - + this.toastService.badRequest("Ação presidencial não criado"); } finally { loader.remove() @@ -156,5 +162,5 @@ export class NewActionPage implements OnInit { close(){ this.modalController.dismiss(); } - + } diff --git a/src/app/services/functions/file.service.ts b/src/app/services/functions/file.service.ts index 087e77394..ee3d2d9de 100644 --- a/src/app/services/functions/file.service.ts +++ b/src/app/services/functions/file.service.ts @@ -51,7 +51,9 @@ export class FileService { private platform: Platform, private loadingCtrl: LoadingController, private http: HttpClient, - ) { } + ) { + this.headers = new HttpHeaders(); + } uploadFile(formData:any){ @@ -71,6 +73,9 @@ export class FileService { params = params.set("path", guid); + this.headers = this.headers.set('responseType', 'blob'); + this.headers = this.headers.set('Content-Type', 'application/octet-stream'); + let options = { headers: this.headers, params: params diff --git a/src/app/shared/agenda/new-event/new-event.page.ts b/src/app/shared/agenda/new-event/new-event.page.ts index e615df6a8..dd837f708 100644 --- a/src/app/shared/agenda/new-event/new-event.page.ts +++ b/src/app/shared/agenda/new-event/new-event.page.ts @@ -201,13 +201,11 @@ export class NewEventPage implements OnInit { } }) } - this.taskParticipants = removeDuplicate(this.taskParticipants); this.taskParticipantsCc = removeDuplicate(this.taskParticipantsCc); this.setIntervenient.emit(this.taskParticipants); this.setIntervenientCC.emit(this.taskParticipantsCc); - } @@ -307,7 +305,6 @@ export class NewEventPage implements OnInit { close(){ this.deleteTemporaryData(); - this.cloneAllmobileComponent.emit(); this.clearContact.emit(); this.setIntervenient.emit([]); @@ -425,10 +422,8 @@ export class NewEventPage implements OnInit { (id) => { console.log(id); - const eventId: any = id; - const DocumentToSave: EventAttachment[] = this.documents.map((e) => { return { SourceTitle: e.Assunto, 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 086fa5332..6947bcfa7 100644 --- a/src/app/shared/chat/group-messages/group-messages.page.html +++ b/src/app/shared/chat/group-messages/group-messages.page.html @@ -149,9 +149,9 @@ - + diff --git a/src/app/shared/chat/messages/messages.page.html b/src/app/shared/chat/messages/messages.page.html index d1afd2f27..4fcb6d4e2 100644 --- a/src/app/shared/chat/messages/messages.page.html +++ b/src/app/shared/chat/messages/messages.page.html @@ -123,9 +123,9 @@ - + diff --git a/src/app/shared/chat/messages/messages.page.ts b/src/app/shared/chat/messages/messages.page.ts index 67fb6bc09..6d8d05816 100644 --- a/src/app/shared/chat/messages/messages.page.ts +++ b/src/app/shared/chat/messages/messages.page.ts @@ -250,6 +250,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy if(msg.file.type == "application/img"){ let response:any = await this.fileService.getFile(msg.file.guid).toPromise(); console.log(response); + alert(response); //this.openPreview(msg); diff --git a/src/app/shared/publication/new-action/new-action.page.ts b/src/app/shared/publication/new-action/new-action.page.ts index 733434a1b..9fee8eedf 100644 --- a/src/app/shared/publication/new-action/new-action.page.ts +++ b/src/app/shared/publication/new-action/new-action.page.ts @@ -28,27 +28,27 @@ export class NewActionPage implements OnInit { public stepMinute = 5; public stepSecond = 5; public endMinDate = new Date(new Date().getTime() + 15 * 60000); - + Form: FormGroup; validateFrom = false public dateControlStart = new FormControl(moment("DD MM YYYY hh")); public dateControlEnd = new FormControl(moment("DD MM YYYY hh")); - + @Output() closeDesktopComponent= new EventEmitter(); @Output() getActions= new EventEmitter(); constructor( private publication: PublicationsService, private toastService: ToastService - ) { + ) { this.folder = new PublicationFolder(); this.folder = Object.assign(this.folder, { - DateBegin: moment(new Date()), - DateEnd: moment(new Date(new Date().getTime() + 15 * 60000)), + DateBegin: new Date().toISOString(), + DateEnd: (new Date(new Date().getTime() + 15 * 60000)).toISOString(), }) } @@ -76,9 +76,15 @@ export class NewActionPage implements OnInit { return ['ok'] } } - + runValidation() { - this.validateFrom = true + this.validateFrom = true; + if((new Date(this.folder.DateBegin).getTime()) > (new Date(this.folder.DateEnd).getTime())){ + this.toastService._badRequest("A data de início não pode ser superior a data de fim"); + } + else if(new Date(this.folder.DateBegin).getTime() > new Date().getTime()){ + this.toastService._badRequest("A data de início não pode ser superior a data actual"); + } } injectValidation() { @@ -119,21 +125,21 @@ export class NewActionPage implements OnInit { ActionType: this.segment, } console.log(this.folder); - + const loader = this.toastService.loading() try { await this.publication.CreatePublicationFolder(this.folder).toPromise() this.close(); - this.toastService.successMessage('Acção presidencial criada') + this.toastService._successMessage('Acção presidencial criada') this.getActions.emit() } catch (error) { - this.toastService.badRequest('Não foi possivel criar a acção presidencial') + this.toastService._badRequest('Não foi possivel criar a acção presidencial') } finally { loader.remove() } - + } close(){ From 2428fe5ceeda9228d13571f99037e52fbf15c28e Mon Sep 17 00:00:00 2001 From: "tiago.kayaya" Date: Tue, 14 Dec 2021 16:02:28 +0100 Subject: [PATCH 2/8] hide options when presidential action is selected --- src/app/pages/publications/publications.page.html | 3 +-- src/app/pages/publications/publications.page.scss | 7 ++++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/app/pages/publications/publications.page.html b/src/app/pages/publications/publications.page.html index 151742973..3ebb7d4de 100644 --- a/src/app/pages/publications/publications.page.html +++ b/src/app/pages/publications/publications.page.html @@ -40,7 +40,7 @@
- {{viagem.Detail}}

-
diff --git a/src/app/pages/publications/publications.page.scss b/src/app/pages/publications/publications.page.scss index c98ad9b40..84cd1fecb 100644 --- a/src/app/pages/publications/publications.page.scss +++ b/src/app/pages/publications/publications.page.scss @@ -165,10 +165,13 @@ ion-toolbar{ width: 25px; font-size: 20px; } - .item-content-date-active, .item-content-title-active, .item-content-detail-active, .item-options-active{ + .item-content-date-active, .item-content-title-active, .item-content-detail-active{ color: #fff; } } + .item-options-active{ + display: none !important; + } } .item-active{ @@ -240,5 +243,7 @@ ion-toolbar{ } .item-options{ display: block !important; + padding: 10px; + } } From d644b5dc0fbefac92b0b7b5639552b5a85ed888e Mon Sep 17 00:00:00 2001 From: "tiago.kayaya" Date: Tue, 14 Dec 2021 16:22:53 +0100 Subject: [PATCH 3/8] remove duplicated button in expediente --- src/app/pages/publications/publications.page.ts | 11 +++++------ .../shared/chat/messages/contacts/contacts.page.ts | 2 +- .../popover/opts-expediente/opts-expediente.page.html | 3 +-- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/app/pages/publications/publications.page.ts b/src/app/pages/publications/publications.page.ts index 3ceb83fc3..671e6a488 100644 --- a/src/app/pages/publications/publications.page.ts +++ b/src/app/pages/publications/publications.page.ts @@ -70,7 +70,7 @@ export class PublicationsPage implements OnInit { private backgroundservice: BackgroundService, private platform: Platform, public ThemeService: ThemeService, - + ) { this.months = ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"]; this.days = ["Domingo", "Segunda-feira", "Terça-feira", "Quarta-feira", "Quinta-feira", "Sexta-feira", "Sábado"]; @@ -187,7 +187,7 @@ export class PublicationsPage implements OnInit { } getFromDB() { - + if (this.platform.is('desktop') || this.platform.is('mobileweb')) { } else { this.sqliteservice.getAllActions().then((actions: any[]) => { @@ -277,13 +277,12 @@ export class PublicationsPage implements OnInit { } goToPublicationsList(folderId: string) { - this.folderId = folderId - this.idSelected = folderId; - if (window.innerWidth <= 800) { this.router.navigate(['/home/publications', folderId]); + this.idSelected = ""; } else { this.closeDesktopComponent(); + this.idSelected = folderId; this.folderId = folderId this.desktopComponent.showViewPublication = true; } @@ -461,5 +460,5 @@ export class PublicationsPage implements OnInit { // newImage => console.log('new image path is: ' + newImage), // error => console.error('Error cropping image', error) // ); - + } diff --git a/src/app/shared/chat/messages/contacts/contacts.page.ts b/src/app/shared/chat/messages/contacts/contacts.page.ts index 308e81dc6..f277dc474 100644 --- a/src/app/shared/chat/messages/contacts/contacts.page.ts +++ b/src/app/shared/chat/messages/contacts/contacts.page.ts @@ -49,7 +49,7 @@ export class ContactsPage implements OnInit { } openMessagesPage(username:string){ - if( window.innerWidth <= 1024){ + if( window.innerWidth < 701){ this.createRoom(username); } else{ 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 57bd27f4e..c8a439597 100644 --- a/src/app/shared/popover/opts-expediente/opts-expediente.page.html +++ b/src/app/shared/popover/opts-expediente/opts-expediente.page.html @@ -28,13 +28,12 @@
-
- + From 4b5d3c87aa4c118d7c98dd8843311d743378dad6 Mon Sep 17 00:00:00 2001 From: "tiago.kayaya" Date: Tue, 14 Dec 2021 16:42:09 +0100 Subject: [PATCH 4/8] save --- .../chat/messages/contacts/contacts.page.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/app/shared/chat/messages/contacts/contacts.page.ts b/src/app/shared/chat/messages/contacts/contacts.page.ts index f277dc474..e3b72fc64 100644 --- a/src/app/shared/chat/messages/contacts/contacts.page.ts +++ b/src/app/shared/chat/messages/contacts/contacts.page.ts @@ -117,10 +117,10 @@ export class ContactsPage implements OnInit { this.chatService.createRoom(body).subscribe(res => { console.log(res); this.room = res['room']; - this.getDirectMessage(this.room._id); + this.openMessagesModal(this.room._id); }); } - getDirectMessage(roomId:any){ + /* getDirectMessage(roomId:any){ console.log(roomId); this.chatService.getAllDirectMessages().subscribe(res=>{ @@ -129,17 +129,17 @@ export class ContactsPage implements OnInit { console.log(this.dm); this.openModal(this.dm); }); - } - async openModal(dm:any){ - this.close(); - console.log(dm); + } */ + + async openMessagesModal(roomId: any) { + + console.log(roomId); const modal = await this.modalController.create({ component: MessagesPage, - cssClass: 'group-messages', - backdropDismiss: false, + cssClass: 'modal modal-desktop isMessagesChatOpened', componentProps: { - dm: dm, + roomId: roomId, }, }); await modal.present(); From 243cbe5cf9adad2065c6016357000310e276e1e3 Mon Sep 17 00:00:00 2001 From: "tiago.kayaya" Date: Tue, 14 Dec 2021 17:09:53 +0100 Subject: [PATCH 5/8] fixed bug in mobile view --- src/app/pages/chat/messages/messages.page.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/app/pages/chat/messages/messages.page.ts b/src/app/pages/chat/messages/messages.page.ts index b5295fc19..ed27104e0 100644 --- a/src/app/pages/chat/messages/messages.page.ts +++ b/src/app/pages/chat/messages/messages.page.ts @@ -110,7 +110,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy { this.load(); this.setStatus('online'); - this.loadFiles(); + //this.loadFiles(); VoiceRecorder.requestAudioRecordingPermission(); Filesystem.mkdir({ path: IMAGE_DIR, @@ -562,7 +562,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy { let msgChat = { _id: element.Id, - attachments: this.isJson(element.Attachments), + attachments: this.isJson(element.Attachments), channels: this.isJson(element.Channels), file: this.isJson(element.File), mentions: this.isJson(element.Mentions), @@ -613,7 +613,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy { this.sqlservice.addChatMSG(chatmsg) }); } - + } async serverLongPull() { @@ -643,8 +643,11 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy { // Show Error //showMessage(response.statusText); //this.loadMessages() - //this.messages = res['messages'].reverse(); - //this.chatMessageStore.add(roomId, this.messages) + + if (this.platform.is('desktop') || this.platform.is('mobileweb')) { + this.messages = res['messages'].reverse(); + this.chatMessageStore.add(roomId, this.messages) + } //console.log(this.messages); // Reconnect in one second From 710098146765913698f25b42fa169cfde9437c96 Mon Sep 17 00:00:00 2001 From: "tiago.kayaya" Date: Tue, 14 Dec 2021 17:12:32 +0100 Subject: [PATCH 6/8] save --- src/app/shared/chat/messages/contacts/contacts.page.ts | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/app/shared/chat/messages/contacts/contacts.page.ts b/src/app/shared/chat/messages/contacts/contacts.page.ts index e3b72fc64..fdfbefb5a 100644 --- a/src/app/shared/chat/messages/contacts/contacts.page.ts +++ b/src/app/shared/chat/messages/contacts/contacts.page.ts @@ -120,16 +120,6 @@ export class ContactsPage implements OnInit { this.openMessagesModal(this.room._id); }); } - /* getDirectMessage(roomId:any){ - console.log(roomId); - - this.chatService.getAllDirectMessages().subscribe(res=>{ - let result = res['ims'].filter(data => data._id == roomId); - this.dm = result[0]; - console.log(this.dm); - this.openModal(this.dm); - }); - } */ async openMessagesModal(roomId: any) { From 9d2fcc9fc9c11a874ea3c54ae65c36602b59601c Mon Sep 17 00:00:00 2001 From: "tiago.kayaya" Date: Tue, 14 Dec 2021 23:04:03 +0100 Subject: [PATCH 7/8] fix footer of individual chat and group chat --- .../group-messages/group-messages.page.html | 5 +- .../group-messages/group-messages.page.scss | 76 ++++++++++--------- .../shared/chat/messages/messages.page.html | 4 +- .../shared/chat/messages/messages.page.scss | 12 +-- 4 files changed, 51 insertions(+), 46 deletions(-) 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 6947bcfa7..a9c145708 100644 --- a/src/app/shared/chat/group-messages/group-messages.page.html +++ b/src/app/shared/chat/group-messages/group-messages.page.html @@ -161,7 +161,8 @@
-
+ +
-
+
-
+ +