From 977aed8862882fbc93ba9376e49974fdcca9be55 Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Tue, 22 Aug 2023 15:43:20 +0100 Subject: [PATCH] fix pages --- src/app/pages/agenda/agenda.page.ts | 5 +--- .../new-publication/new-publication.page.ts | 25 ++++++++++--------- src/app/pipes/publication.pipe.ts | 4 +-- .../new-publication/new-publication.page.ts | 17 +++++++------ src/app/store/publication-folder.service.ts | 9 +++++++ version/git-version.ts | 14 +++++------ 6 files changed, 42 insertions(+), 32 deletions(-) diff --git a/src/app/pages/agenda/agenda.page.ts b/src/app/pages/agenda/agenda.page.ts index 0d13afc8c..9903032c1 100644 --- a/src/app/pages/agenda/agenda.page.ts +++ b/src/app/pages/agenda/agenda.page.ts @@ -844,10 +844,7 @@ export class AgendaPage implements OnInit { const selectedCalendarIds = this.getSelectedAgendaCalendars(); this.listToPresent = this.CalendarStore.getEventsByCalendarIds(selectedCalendarIds) - const listToPresent = this.listToPresent.filter( e => momentG(new Date(this.eventSelectedDate), 'dd MMMM yyyy', 'pt') == momentG(e.startTime, 'dd MMMM yyyy', 'pt')) - - - this.TimelineMDList = this.listBoxService.list(listToPresent, 'md', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate }) + this.TimelineMDList = this.listBoxService.list(this.listToPresent, 'md', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate }) const selectedDay = momentG(this.eventSelectedDate, 'dd', 'pt'); if(this.TimelineMDList[selectedDay]) { diff --git a/src/app/pages/publications/new-publication/new-publication.page.ts b/src/app/pages/publications/new-publication/new-publication.page.ts index edbbc4a99..e0ffe37a5 100644 --- a/src/app/pages/publications/new-publication/new-publication.page.ts +++ b/src/app/pages/publications/new-publication/new-publication.page.ts @@ -211,6 +211,7 @@ export class NewPublicationPage implements OnInit { if (this.publicationType == '3') { + // has captured image if (this.capturedImage != '') { this.publication = { DateIndex: this.publication.DateIndex, @@ -232,7 +233,7 @@ export class NewPublicationPage implements OnInit { this.httpErrorHandle.httpsSucessMessagge('Publicação Editada') console.log({response}) - this.RouteService.goBack() + this.close() } catch (error) { this.httpErrorHandle.httpStatusHandle(error) } finally { @@ -240,8 +241,8 @@ export class NewPublicationPage implements OnInit { } } - else if (!this.publication.OriginalFileName) { - + // no file names + else if (!this.PublicationFolderService.PublicationHasImage(this.publication)) { this.publication = { DateIndex: this.publication.DateIndex, DocumentId: this.publication.DocumentId, @@ -249,9 +250,9 @@ export class NewPublicationPage implements OnInit { Title: this.pub.Title, Message: this.pub.Message, DatePublication: this.publication.DatePublication, - // OriginalFileName: this.publication.OriginalFileName, - // FileBase64: this.publication.FileBase64, - // FileExtension: 'jpeg', + OriginalFileName: "", + FileBase64: "", + FileExtension: "", } const loader = this.toastService.loading() @@ -261,7 +262,7 @@ export class NewPublicationPage implements OnInit { this.httpErrorHandle.httpsSucessMessagge('Criar publicação') console.log({response}) - this.RouteService.goBack() + this.close() } catch (error) { this.httpErrorHandle.httpStatusHandle(error) } finally { @@ -276,8 +277,8 @@ export class NewPublicationPage implements OnInit { Title: this.pub.Title, Message: this.pub.Message, DatePublication: this.publication.DatePublication, - OriginalFileName: this.capturedImageTitle, - FileBase64: this.capturedImage, + OriginalFileName: this.publication.OriginalFileName, + FileBase64: this.publication.FileBase64, FileExtension: 'jpeg', } @@ -287,7 +288,7 @@ export class NewPublicationPage implements OnInit { const response = await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise() this.httpErrorHandle.httpsSucessMessagge('Publicação Editada') console.log({response}) - this.RouteService.goBack() + this.close() } catch (error) { this.httpErrorHandle.httpStatusHandle(error) } finally { @@ -345,8 +346,8 @@ export class NewPublicationPage implements OnInit { } clear() { - this.capturedImageTitle = ''; - this.capturedImage = ''; + this.capturedImageTitle = null; + this.capturedImage = null; } setTitle() { diff --git a/src/app/pipes/publication.pipe.ts b/src/app/pipes/publication.pipe.ts index 6a52ba4cb..e74636fc3 100644 --- a/src/app/pipes/publication.pipe.ts +++ b/src/app/pipes/publication.pipe.ts @@ -20,8 +20,8 @@ export class PublicationPipe implements PipeTransform { "DatePublication": element.DatePublication, /* image:itemImage, */ "FileBase64": "data:image/jpg;base64," + element.FileBase64, - "OriginalFileName": '', - "FileExtension": '', + "OriginalFileName": element?.OriginalFileName, + "FileExtension": element?.FileExtension, "OrganicEntityId": element.OrganicEntityId } } diff --git a/src/app/shared/publication/new-publication/new-publication.page.ts b/src/app/shared/publication/new-publication/new-publication.page.ts index 4e1a59bee..16ace1644 100644 --- a/src/app/shared/publication/new-publication/new-publication.page.ts +++ b/src/app/shared/publication/new-publication/new-publication.page.ts @@ -102,6 +102,9 @@ export class NewPublicationPage implements OnInit { } this.pub = this.publication; this.showLoader = false; + }, () => { + this.showLoader = false; + this.goBack() }); } @@ -174,7 +177,7 @@ export class NewPublicationPage implements OnInit { Title: this.pub.Title, Message: this.pub.Message, DatePublication: this.publication.DatePublication, - OriginalFileName: this.capturedImageTitle, + OriginalFileName: this.publication.OriginalFileName || 'foto', FileBase64: this.capturedImage, FileExtension: 'jpeg', } @@ -196,7 +199,8 @@ export class NewPublicationPage implements OnInit { } } - else if (!this.publication.OriginalFileName) { // + else if (!this.PublicationFolderService.PublicationHasImage(this.publication)) { // + this.publication = { DateIndex: this.publication.DateIndex, DocumentId:this.publication.DocumentId, @@ -204,10 +208,9 @@ export class NewPublicationPage implements OnInit { Title: this.pub.Title, Message: this.pub.Message, DatePublication: this.publication.DatePublication, - OriginalFileName: this.capturedImageTitle, - // OriginalFileName: this.publication.OriginalFileName, - // FileBase64: this.publication.FileBase64, - // FileExtension: 'jpeg', + OriginalFileName: this.publication.OriginalFileName, + FileBase64: "", + FileExtension: this.publication.FileExtension, } const loader = this.toastService.loading() @@ -233,7 +236,7 @@ export class NewPublicationPage implements OnInit { Title: this.pub.Title, Message: this.pub.Message, DatePublication: this.publication.DatePublication, - OriginalFileName: this.capturedImageTitle, + OriginalFileName: this.publication.OriginalFileName, FileBase64: this.capturedImage, FileExtension: 'jpeg', } diff --git a/src/app/store/publication-folder.service.ts b/src/app/store/publication-folder.service.ts index a54700c33..9cbdac7f3 100644 --- a/src/app/store/publication-folder.service.ts +++ b/src/app/store/publication-folder.service.ts @@ -196,6 +196,15 @@ export class PublicationFolderService { } + + PublicationHasImage(Publication: Publication) { + return Publication.FileBase64 != '' && Publication.FileBase64 != "data:image/jpg;base64,null" + } + + hasCapturedImage(Publication: Publication) { + return Publication.FileBase64 != '' && Publication.FileBase64 != "data:image/jpg;base64,null" + } + } diff --git a/version/git-version.ts b/version/git-version.ts index c2c149a49..163ff7c7d 100644 --- a/version/git-version.ts +++ b/version/git-version.ts @@ -1,12 +1,12 @@ export let versionData = { - "shortSHA": "51a526644", - "SHA": "51a526644a23bae4c4a8bfd869df93ea72c7ddd6", + "shortSHA": "f9a4830a3", + "SHA": "f9a4830a30a0bbcb05daad197f636edf6c920569", "branch": "developer-prod", "lastCommitAuthor": "'Peter Maquiran'", - "lastCommitTime": "'Tue Aug 22 13:06:52 2023 +0100'", - "lastCommitMessage": "merge", - "lastCommitNumber": "5201", - "change": "diff --git a/src/app/pages/publications/new-publication/new-publication.page.ts b/src/app/pages/publications/new-publication/new-publication.page.ts\nindex edbbc4a99..4b1165668 100644\n--- a/src/app/pages/publications/new-publication/new-publication.page.ts\n+++ b/src/app/pages/publications/new-publication/new-publication.page.ts\n@@ -211,6 +211,7 @@ export class NewPublicationPage implements OnInit {\n \n if (this.publicationType == '3') {\n \n+ // has captured image\n if (this.capturedImage != '') {\n this.publication = {\n DateIndex: this.publication.DateIndex,\n@@ -240,8 +241,8 @@ export class NewPublicationPage implements OnInit {\n }\n \n }\n- else if (!this.publication.OriginalFileName) {\n-\n+ // no file names\n+ else if (!this.PublicationFolderService.PublicationHasImage(this.publication)) {\n this.publication = {\n DateIndex: this.publication.DateIndex,\n DocumentId: this.publication.DocumentId,\n@@ -249,9 +250,9 @@ export class NewPublicationPage implements OnInit {\n Title: this.pub.Title,\n Message: this.pub.Message,\n DatePublication: this.publication.DatePublication,\n- // OriginalFileName: this.publication.OriginalFileName,\n- // FileBase64: this.publication.FileBase64,\n- // FileExtension: 'jpeg',\n+ OriginalFileName: \"\",\n+ FileBase64: \"\",\n+ FileExtension: \"\",\n }\n \n const loader = this.toastService.loading()\n@@ -276,8 +277,8 @@ export class NewPublicationPage implements OnInit {\n Title: this.pub.Title,\n Message: this.pub.Message,\n DatePublication: this.publication.DatePublication,\n- OriginalFileName: this.capturedImageTitle,\n- FileBase64: this.capturedImage,\n+ OriginalFileName: this.publication.OriginalFileName,\n+ FileBase64: this.publication.FileBase64,\n FileExtension: 'jpeg',\n }\n \n@@ -345,8 +346,8 @@ export class NewPublicationPage implements OnInit {\n }\n \n clear() {\n- this.capturedImageTitle = '';\n- this.capturedImage = '';\n+ this.capturedImageTitle = null;\n+ this.capturedImage = null;\n }\n \n setTitle() {\ndiff --git a/src/app/shared/publication/new-publication/new-publication.page.ts b/src/app/shared/publication/new-publication/new-publication.page.ts\nindex 4e1a59bee..fe2c6bea1 100644\n--- a/src/app/shared/publication/new-publication/new-publication.page.ts\n+++ b/src/app/shared/publication/new-publication/new-publication.page.ts\n@@ -196,7 +196,8 @@ export class NewPublicationPage implements OnInit {\n }\n \n }\n- else if (!this.publication.OriginalFileName) { //\n+ else if (!this.PublicationFolderService.PublicationHasImage(this.publication)) { //\n+ \n this.publication = {\n DateIndex: this.publication.DateIndex,\n DocumentId:this.publication.DocumentId,\n@@ -204,10 +205,9 @@ export class NewPublicationPage implements OnInit {\n Title: this.pub.Title,\n Message: this.pub.Message,\n DatePublication: this.publication.DatePublication,\n- OriginalFileName: this.capturedImageTitle,\n- // OriginalFileName: this.publication.OriginalFileName,\n- // FileBase64: this.publication.FileBase64,\n- // FileExtension: 'jpeg',\n+ OriginalFileName: this.publication.OriginalFileName,\n+ FileBase64: \"\",\n+ FileExtension: this.publication.FileExtension,\n }\n const loader = this.toastService.loading()\n \ndiff --git a/src/app/store/publication-folder.service.ts b/src/app/store/publication-folder.service.ts\nindex a54700c33..9cbdac7f3 100644\n--- a/src/app/store/publication-folder.service.ts\n+++ b/src/app/store/publication-folder.service.ts\n@@ -196,6 +196,15 @@ export class PublicationFolderService {\n \n }\n \n+\n+ PublicationHasImage(Publication: Publication) {\n+ return Publication.FileBase64 != '' && Publication.FileBase64 != \"data:image/jpg;base64,null\"\n+ }\n+\n+ hasCapturedImage(Publication: Publication) {\n+ return Publication.FileBase64 != '' && Publication.FileBase64 != \"data:image/jpg;base64,null\"\n+ }\n+\n }", - "changeStatus": "On branch developer-prod\nChanges to be committed:\n (use \"git restore --staged ...\" to unstage)\n\tmodified: src/app/home/home.page.ts\n\tmodified: src/app/pages/events/events.page.ts\n\nChanges not staged for commit:\n (use \"git add ...\" to update what will be committed)\n (use \"git restore ...\" to discard changes in working directory)\n\tmodified: src/app/pages/publications/new-publication/new-publication.page.ts\n\tmodified: src/app/shared/publication/new-publication/new-publication.page.ts\n\tmodified: src/app/store/publication-folder.service.ts", + "lastCommitTime": "'Tue Aug 22 14:39:33 2023 +0100'", + "lastCommitMessage": "fix date picker", + "lastCommitNumber": "5202", + "change": "", + "changeStatus": "On branch developer-prod\nChanges to be committed:\n (use \"git restore --staged ...\" to unstage)\n\tmodified: src/app/pages/agenda/agenda.page.ts\n\tmodified: src/app/pages/publications/new-publication/new-publication.page.ts\n\tmodified: src/app/pipes/publication.pipe.ts\n\tmodified: src/app/shared/publication/new-publication/new-publication.page.ts\n\tmodified: src/app/store/publication-folder.service.ts", "changeAuthor": "peter.maquiran" } \ No newline at end of file