fix pages

This commit is contained in:
Peter Maquiran
2023-08-22 15:43:20 +01:00
parent f9a4830a30
commit 977aed8862
6 changed files with 42 additions and 32 deletions
+1 -4
View File
@@ -844,10 +844,7 @@ export class AgendaPage implements OnInit {
const selectedCalendarIds = this.getSelectedAgendaCalendars(); const selectedCalendarIds = this.getSelectedAgendaCalendars();
this.listToPresent = this.CalendarStore.getEventsByCalendarIds(selectedCalendarIds) 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(this.listToPresent, 'md', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
this.TimelineMDList = this.listBoxService.list(listToPresent, 'md', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
const selectedDay = momentG(this.eventSelectedDate, 'dd', 'pt'); const selectedDay = momentG(this.eventSelectedDate, 'dd', 'pt');
if(this.TimelineMDList[selectedDay]) { if(this.TimelineMDList[selectedDay]) {
@@ -211,6 +211,7 @@ export class NewPublicationPage implements OnInit {
if (this.publicationType == '3') { if (this.publicationType == '3') {
// has captured image
if (this.capturedImage != '') { if (this.capturedImage != '') {
this.publication = { this.publication = {
DateIndex: this.publication.DateIndex, DateIndex: this.publication.DateIndex,
@@ -232,7 +233,7 @@ export class NewPublicationPage implements OnInit {
this.httpErrorHandle.httpsSucessMessagge('Publicação Editada') this.httpErrorHandle.httpsSucessMessagge('Publicação Editada')
console.log({response}) console.log({response})
this.RouteService.goBack() this.close()
} catch (error) { } catch (error) {
this.httpErrorHandle.httpStatusHandle(error) this.httpErrorHandle.httpStatusHandle(error)
} finally { } 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 = { this.publication = {
DateIndex: this.publication.DateIndex, DateIndex: this.publication.DateIndex,
DocumentId: this.publication.DocumentId, DocumentId: this.publication.DocumentId,
@@ -249,9 +250,9 @@ export class NewPublicationPage implements OnInit {
Title: this.pub.Title, Title: this.pub.Title,
Message: this.pub.Message, Message: this.pub.Message,
DatePublication: this.publication.DatePublication, DatePublication: this.publication.DatePublication,
// OriginalFileName: this.publication.OriginalFileName, OriginalFileName: "",
// FileBase64: this.publication.FileBase64, FileBase64: "",
// FileExtension: 'jpeg', FileExtension: "",
} }
const loader = this.toastService.loading() const loader = this.toastService.loading()
@@ -261,7 +262,7 @@ export class NewPublicationPage implements OnInit {
this.httpErrorHandle.httpsSucessMessagge('Criar publicação') this.httpErrorHandle.httpsSucessMessagge('Criar publicação')
console.log({response}) console.log({response})
this.RouteService.goBack() this.close()
} catch (error) { } catch (error) {
this.httpErrorHandle.httpStatusHandle(error) this.httpErrorHandle.httpStatusHandle(error)
} finally { } finally {
@@ -276,8 +277,8 @@ export class NewPublicationPage implements OnInit {
Title: this.pub.Title, Title: this.pub.Title,
Message: this.pub.Message, Message: this.pub.Message,
DatePublication: this.publication.DatePublication, DatePublication: this.publication.DatePublication,
OriginalFileName: this.capturedImageTitle, OriginalFileName: this.publication.OriginalFileName,
FileBase64: this.capturedImage, FileBase64: this.publication.FileBase64,
FileExtension: 'jpeg', FileExtension: 'jpeg',
} }
@@ -287,7 +288,7 @@ export class NewPublicationPage implements OnInit {
const response = await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise() const response = await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise()
this.httpErrorHandle.httpsSucessMessagge('Publicação Editada') this.httpErrorHandle.httpsSucessMessagge('Publicação Editada')
console.log({response}) console.log({response})
this.RouteService.goBack() this.close()
} catch (error) { } catch (error) {
this.httpErrorHandle.httpStatusHandle(error) this.httpErrorHandle.httpStatusHandle(error)
} finally { } finally {
@@ -345,8 +346,8 @@ export class NewPublicationPage implements OnInit {
} }
clear() { clear() {
this.capturedImageTitle = ''; this.capturedImageTitle = null;
this.capturedImage = ''; this.capturedImage = null;
} }
setTitle() { setTitle() {
+2 -2
View File
@@ -20,8 +20,8 @@ export class PublicationPipe implements PipeTransform {
"DatePublication": element.DatePublication, "DatePublication": element.DatePublication,
/* image:itemImage, */ /* image:itemImage, */
"FileBase64": "data:image/jpg;base64," + element.FileBase64, "FileBase64": "data:image/jpg;base64," + element.FileBase64,
"OriginalFileName": '', "OriginalFileName": element?.OriginalFileName,
"FileExtension": '', "FileExtension": element?.FileExtension,
"OrganicEntityId": element.OrganicEntityId "OrganicEntityId": element.OrganicEntityId
} }
} }
@@ -102,6 +102,9 @@ export class NewPublicationPage implements OnInit {
} }
this.pub = this.publication; this.pub = this.publication;
this.showLoader = false; this.showLoader = false;
}, () => {
this.showLoader = false;
this.goBack()
}); });
} }
@@ -174,7 +177,7 @@ export class NewPublicationPage implements OnInit {
Title: this.pub.Title, Title: this.pub.Title,
Message: this.pub.Message, Message: this.pub.Message,
DatePublication: this.publication.DatePublication, DatePublication: this.publication.DatePublication,
OriginalFileName: this.capturedImageTitle, OriginalFileName: this.publication.OriginalFileName || 'foto',
FileBase64: this.capturedImage, FileBase64: this.capturedImage,
FileExtension: 'jpeg', 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 = { this.publication = {
DateIndex: this.publication.DateIndex, DateIndex: this.publication.DateIndex,
DocumentId:this.publication.DocumentId, DocumentId:this.publication.DocumentId,
@@ -204,10 +208,9 @@ export class NewPublicationPage implements OnInit {
Title: this.pub.Title, Title: this.pub.Title,
Message: this.pub.Message, Message: this.pub.Message,
DatePublication: this.publication.DatePublication, DatePublication: this.publication.DatePublication,
OriginalFileName: this.capturedImageTitle, OriginalFileName: this.publication.OriginalFileName,
// OriginalFileName: this.publication.OriginalFileName, FileBase64: "",
// FileBase64: this.publication.FileBase64, FileExtension: this.publication.FileExtension,
// FileExtension: 'jpeg',
} }
const loader = this.toastService.loading() const loader = this.toastService.loading()
@@ -233,7 +236,7 @@ export class NewPublicationPage implements OnInit {
Title: this.pub.Title, Title: this.pub.Title,
Message: this.pub.Message, Message: this.pub.Message,
DatePublication: this.publication.DatePublication, DatePublication: this.publication.DatePublication,
OriginalFileName: this.capturedImageTitle, OriginalFileName: this.publication.OriginalFileName,
FileBase64: this.capturedImage, FileBase64: this.capturedImage,
FileExtension: 'jpeg', FileExtension: 'jpeg',
} }
@@ -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"
}
} }
+7 -7
View File
@@ -1,12 +1,12 @@
export let versionData = { export let versionData = {
"shortSHA": "51a526644", "shortSHA": "f9a4830a3",
"SHA": "51a526644a23bae4c4a8bfd869df93ea72c7ddd6", "SHA": "f9a4830a30a0bbcb05daad197f636edf6c920569",
"branch": "developer-prod", "branch": "developer-prod",
"lastCommitAuthor": "'Peter Maquiran'", "lastCommitAuthor": "'Peter Maquiran'",
"lastCommitTime": "'Tue Aug 22 13:06:52 2023 +0100'", "lastCommitTime": "'Tue Aug 22 14:39:33 2023 +0100'",
"lastCommitMessage": "merge", "lastCommitMessage": "fix date picker",
"lastCommitNumber": "5201", "lastCommitNumber": "5202",
"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 }", "change": "",
"changeStatus": "On branch developer-prod\nChanges to be committed:\n (use \"git restore --staged <file>...\" 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 <file>...\" to update what will be committed)\n (use \"git restore <file>...\" 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", "changeStatus": "On branch developer-prod\nChanges to be committed:\n (use \"git restore --staged <file>...\" 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" "changeAuthor": "peter.maquiran"
} }