Publication

This commit is contained in:
Peter Maquiran
2023-08-23 09:55:14 +01:00
parent a06bc4a409
commit b81e876dde
6 changed files with 71 additions and 101 deletions
+2 -1
View File
@@ -453,13 +453,14 @@ ion-toolbar{
color: black; color: black;
min-height: 19px; min-height: 19px;
width: 100%; width: 100%;
font-weight: bold;
} }
.description{ .description{
width: 100%; width: 100%;
font-family: Roboto; font-family: Roboto;
font-size: rem(13); font-size: rem(13);
font-weight: bold;
//color: #0d89d1; //color: #0d89d1;
color: var(--title-text-color) color: var(--title-text-color)
} }
@@ -210,6 +210,7 @@ export class NewPublicationPage implements OnInit {
if (this.publicationType == '3') { if (this.publicationType == '3') {
const loader = this.toastService.loading()
// has captured image // has captured image
if (this.capturedImage != '') { if (this.capturedImage != '') {
@@ -225,20 +226,7 @@ export class NewPublicationPage implements OnInit {
FileExtension: 'jpeg', FileExtension: 'jpeg',
} }
const loader = this.toastService.loading()
try {
const response = await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise()
this.httpErrorHandle.httpsSucessMessagge('Publicação Editada')
console.log({response})
this.close()
} catch (error) {
this.httpErrorHandle.httpStatusHandle(error)
} finally {
loader.remove()
}
} }
// no file names // no file names
@@ -255,19 +243,6 @@ export class NewPublicationPage implements OnInit {
FileExtension: "", FileExtension: "",
} }
const loader = this.toastService.loading()
try {
const response = await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise()
this.httpErrorHandle.httpsSucessMessagge('Criar publicação')
console.log({response})
this.close()
} catch (error) {
this.httpErrorHandle.httpStatusHandle(error)
} finally {
loader.remove()
}
} else { } else {
this.publication = { this.publication = {
@@ -282,22 +257,29 @@ export class NewPublicationPage implements OnInit {
FileExtension: 'jpeg', FileExtension: 'jpeg',
} }
const loader = this.toastService.loading() }
try {
const response = await this.publications.CreatePublication(this.publication.ProcessId, this.publication).toPromise()
try { try {
const response = await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise() await this.publications.DeletePublication(this.folderId, this.publication.DocumentId).toPromise();
this.httpErrorHandle.httpsSucessMessagge('Publicação Editada') } catch(error) {}
console.log({response})
this.close()
} catch (error) {
this.httpErrorHandle.httpStatusHandle(error)
} finally {
loader.remove()
}
this.httpErrorHandle.httpsSucessMessagge('Editar publicação')
console.log({response})
this.close();
} catch (error) {
this.httpErrorHandle.httpStatusHandle(error)
} finally {
loader.remove()
} }
this.PublicationFolderService.deletePost(this.publication.DocumentId, this.publication.ProcessId) this.PublicationFolderService.deletePost(this.publication.DocumentId, this.publication.ProcessId)
this.PublicationFolderService.deletePost(this.folderId, this.publication.ProcessId)
this.PublicationFolderService.deletePost(this.publication.ProcessId, this.publication.DocumentId)
} }
else { else {
@@ -336,11 +318,13 @@ export class NewPublicationPage implements OnInit {
} }
} }
this.PublicationFolderService.getPublicationsIds(this.folderId)
} }
close() { close() {
this.modalController.dismiss().then(() => { this.modalController.dismiss(this.publication).then(() => {
this.showLoader = true; this.showLoader = true;
}); });
} }
@@ -134,6 +134,9 @@ export class PublicationDetailPage implements OnInit {
if(this.isModal) { if(this.isModal) {
this.close() this.close()
} else { } else {
if(window['app-view-publications-page-doRefresh']) {
window['app-view-publications-page-doRefresh']()
}
this.RouteService.goBack(); this.RouteService.goBack();
} }
@@ -156,6 +159,7 @@ export class PublicationDetailPage implements OnInit {
} catch (error) { } catch (error) {
if(error.status == 404) { if(error.status == 404) {
this.publicationFolderService.deletePost(this.folderId, this.publicationId) this.publicationFolderService.deletePost(this.folderId, this.publicationId)
this.goBack();
} }
this.httpErrorHandle.httpStatusHandle(error) this.httpErrorHandle.httpStatusHandle(error)
} finally { } finally {
@@ -178,10 +182,13 @@ export class PublicationDetailPage implements OnInit {
backdropDismiss: false backdropDismiss: false
}); });
modal.onDidDismiss().then(()=>{ modal.onDidDismiss().then((data) => {
setTimeout(() => { if(data.data) {
this.getPublicationDetail(); this.publication = data.data
}, 5000); if(window['app-view-publications-page-doRefresh']) {
window['app-view-publications-page-doRefresh']()
}
}
}); });
await modal.present(); await modal.present();
@@ -167,6 +167,7 @@ export class NewPublicationPage implements OnInit {
} }
if(this.publicationType == '3') { if(this.publicationType == '3') {
const loader = this.toastService.loading()
if(this.capturedImage != '') { if(this.capturedImage != '') {
@@ -181,23 +182,6 @@ export class NewPublicationPage implements OnInit {
FileBase64: this.capturedImage, FileBase64: this.capturedImage,
FileExtension: 'jpeg', FileExtension: 'jpeg',
} }
const loader = this.toastService.loading()
try {
const response = await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise()
this.httpErroHandle.httpsSucessMessagge('Criar publicação')
console.log({response})
this.goBack();
} catch (error) {
this.httpErroHandle.httpStatusHandle(error)
} finally {
loader.remove()
}
} }
else if (!this.PublicationFolderService.PublicationHasImage(this.publication)) { // else if (!this.PublicationFolderService.PublicationHasImage(this.publication)) { //
@@ -212,21 +196,6 @@ export class NewPublicationPage implements OnInit {
FileBase64: "", FileBase64: "",
FileExtension: this.publication.FileExtension, FileExtension: this.publication.FileExtension,
} }
const loader = this.toastService.loading()
try {
const response = await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise()
this.httpErroHandle.httpsSucessMessagge('Criar publicação')
console.log({response})
this.goBack();
} catch (error) {
this.httpErroHandle.httpStatusHandle(error)
} finally {
loader.remove()
}
} else { } else {
this.publication = { this.publication = {
@@ -241,28 +210,29 @@ export class NewPublicationPage implements OnInit {
FileExtension: 'jpeg', FileExtension: 'jpeg',
} }
const loader = this.toastService.loading()
try {
const response =await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise()
this.httpErroHandle.httpsSucessMessagge('Criar publicação')
console.log({response})
this.goBack();
} catch (error) {
this.httpErroHandle.httpStatusHandle(error)
} finally {
loader.remove()
}
} }
try {
const response = await this.publications.CreatePublication(this.publication.ProcessId, this.publication).toPromise()
try {
await this.publications.DeletePublication(this.folderId, this.publication.DocumentId).toPromise();
} catch(error) {}
this.httpErroHandle.httpsSucessMessagge('Editar publicação')
console.log({response})
this.goBack();
} catch (error) {
this.httpErroHandle.httpStatusHandle(error)
} finally {
loader.remove()
}
this.PublicationFolderService.deletePost(this.publication.ProcessId, this.publication.DocumentId)
this.PublicationFolderService.deletePost(this.publication.DocumentId, this.publication.ProcessId) this.PublicationFolderService.deletePost(this.publication.DocumentId, this.publication.ProcessId)
} }
else { else {
@@ -155,6 +155,14 @@ export class PublicationFolderService {
} }
async CreatePublication(folderId, publication: Publication) {
const response = await this.publications.CreatePublication(folderId, publication).toPromise()
let publicationDetails: Publication = this.publicationPipe.itemList(response)
this.publicationList[folderId].push(publicationDetails)
return publicationDetails
}
async setPublication(publicationId, folderId, publicationDetails: Publication) { async setPublication(publicationId, folderId, publicationDetails: Publication) {
+6 -6
View File
@@ -1,12 +1,12 @@
export let versionData = { export let versionData = {
"shortSHA": "977aed886", "shortSHA": "a06bc4a40",
"SHA": "977aed8862882fbc93ba9376e49974fdcca9be55", "SHA": "a06bc4a409dab223870433cd26d557b78ea5a8d3",
"branch": "developer-prod", "branch": "developer-prod",
"lastCommitAuthor": "'Peter Maquiran'", "lastCommitAuthor": "'Peter Maquiran'",
"lastCommitTime": "'Tue Aug 22 15:43:20 2023 +0100'", "lastCommitTime": "'Tue Aug 22 17:50:18 2023 +0100'",
"lastCommitMessage": "fix pages", "lastCommitMessage": "s",
"lastCommitNumber": "5203", "lastCommitNumber": "5204",
"change": "", "change": "",
"changeStatus": "On branch developer-prod\nChanges to be committed:\n (use \"git restore --staged <file>...\" to unstage)\n\tmodified: src/app/modals/document-set-up-meeting/document-set-up-meeting.page.ts\n\tmodified: src/app/pages/gabinete-digital/expediente/book-meeting-modal/book-meeting-modal.page.ts", "changeStatus": "On branch developer-prod\nChanges to be committed:\n (use \"git restore --staged <file>...\" to unstage)\n\tmodified: src/app/pages/events/events.page.scss\n\tmodified: src/app/pages/publications/new-publication/new-publication.page.ts\n\tmodified: src/app/pages/publications/view-publications/publication-detail/publication-detail.page.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"
} }