fix actions and draft data object

This commit is contained in:
Peter Maquiran
2024-01-17 10:25:16 +01:00
parent 69ee75b039
commit 4314ae1bff
35 changed files with 556 additions and 305 deletions
@@ -32,7 +32,7 @@
<div class="d-flex justify-content-between">
<div class="d-flex">
<ion-thumbnail *ngFor="let seleted of seletedContent.slice(0, displayLimit), let i = index" (click)="deleteFromSeletedContent(i)" lot="start">
<div *ngFor="let seleted of seletedContent.slice(0, displayLimit), let i = index" lot="start">
<ion-img *ngIf="checkFileType.checkFileType(seleted.FileExtension) == 'image'" [(ngModel)]="capturedImage"
name="image" ngDefaultControl [src]="'data:image/jpg;base64,' + seleted.FileBase64"
@@ -43,7 +43,11 @@
<source type="video/mp4" [src]="'data:video/mp4;base64,' + seleted.FileBase64">
</video>
</ion-thumbnail>
<div class="text-center cursor-pointer" (click)="deleteFromSeletedContent(i)">
<ion-icon src="assets/images/theme/gov/icons-delete.svg" class="delete md hydrated"></ion-icon>
</div>
</div>
<!-- Display the blurred image and count if there are more images -->
<ion-thumbnail *ngIf="seletedContent.length > displayLimit" lot="start">
<ion-img [src]="'data:image/jpg;base64,' + seletedContent[displayLimit - 1].base64"
@@ -57,9 +61,6 @@
</ion-label>
</div>
<div class="font-25" (click)="clear()">
<ion-icon name="close"></ion-icon>
</div>
</div>
</div>
@@ -400,21 +400,14 @@ export class NewPublicationPage implements OnInit {
if (this.publicationType == '3') {
const loader = this.toastService.loading()
this.publication = {
DateIndex: this.publication.DateIndex,
DocumentId: this.publication.DocumentId,
ProcessId: this.publication.ProcessId,
Title: this.pub.Title,
Message: this.pub.Message,
DatePublication: this.publication.DatePublication,
OriginalFileName: this.publication.OriginalFileName,
Files: this.seletedContent,
}
/* else {
if (this.seletedContent.length >= 1) {
const loader = this.toastService.loading()
this.publication = {
DateIndex: this.publication.DateIndex,
DocumentId: this.publication.DocumentId,
@@ -423,79 +416,77 @@ export class NewPublicationPage implements OnInit {
Message: this.pub.Message,
DatePublication: this.publication.DatePublication,
OriginalFileName: this.publication.OriginalFileName,
FileBase64: this.publication.FileBase64,
FileExtension: this.publication.FileExtension || 'jpeg',
Files: this.seletedContent,
}
} */
try {
const response = await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise()
this.httpErrorHandle.httpsSucessMessagge('Editar publicação')
console.log({ response })
this.close();
} catch (error) {
if (error.status == 404) {
this.PublicationFolderService.deletePost(this.publication.ProcessId, this.publication.DocumentId)
try {
const response = await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise()
this.httpErrorHandle.httpsSucessMessagge('Editar publicação')
console.log({ response })
this.close();
} catch (error) {
if (error.status == 404) {
this.PublicationFolderService.deletePost(this.publication.ProcessId, this.publication.DocumentId)
this.close();
}
this.httpErrorHandle.httpStatusHandle(error)
} finally {
loader.remove()
}
this.httpErrorHandle.httpStatusHandle(error)
} finally {
loader.remove()
} else {
this.toastService._badRequest("É necessário adicionar anexo")
}
}
else {
const date = formatDate(new Date(), 'yyyy-MM-dd HH:mm:ss')
/* if (this.capturedImage != '') { */
this.publication = {
DateIndex: date,
DocumentId: null,
ProcessId: this.folderId,
Title: this.pub.Title,
Message: this.pub.Message,
DatePublication: date,
OriginalFileName: this.capturedImageTitle,
Files: this.seletedContent,
/* FileExtension: 'jpeg', */
}
if (this.seletedContent.length >= 1) {
/* } else if (this.capturedVideo != '') {
this.publication = {
DateIndex: date,
DocumentId: null,
ProcessId: this.folderId,
Title: this.pub.Title,
Message: this.pub.Message,
DatePublication: date,
OriginalFileName: this.capturedImageTitle || 'video',
Files: this.seletedContent,
FileExtension: 'mp4',
}
} */
const date = formatDate(new Date(), 'yyyy-MM-dd HH:mm:ss')
/* if (this.capturedImage != '') { */
this.publication = {
DateIndex: date,
DocumentId: null,
ProcessId: this.folderId,
Title: this.pub.Title,
Message: this.pub.Message,
DatePublication: date,
OriginalFileName: this.capturedImageTitle,
Files: this.seletedContent,
/* FileExtension: 'jpeg', */
}
const loader = this.toastService.loading()
try {
await this.publications.CreatePublication(this.folderId, this.publication).toPromise();
this.close();
this.httpErrorHandle.httpsSucessMessagge('Criar publicação')
window["sharedContent"] = null;
this.close();
} catch (error) {
this.httpErrorHandle.httpStatusHandle(error)
} finally {
loader.remove()
}
const loader = this.toastService.loading()
try {
await this.publications.CreatePublication(this.folderId, this.publication).toPromise();
this.close();
this.httpErrorHandle.httpsSucessMessagge('Criar publicação')
window["sharedContent"] = null;
this.close();
} catch (error) {
this.httpErrorHandle.httpStatusHandle(error)
} finally {
loader.remove()
} else {
this.toastService._badRequest("É necessário adicionar anexo")
}
}
@@ -716,4 +707,3 @@ export class NewPublicationPage implements OnInit {
}
}
@@ -122,13 +122,10 @@ ion-toolbar {
.post-img {
width: 100%;
height: 100%;
max-height: 400px;
min-height: 350px;
min-width: 350px;
margin: 5px auto;
border-radius: 0px !important;
overflow: hidden;
background-color: white;
@@ -136,6 +133,10 @@ ion-toolbar {
justify-content: center;
align-items: center;
background: black;
-webkit-border-radius: 0px !important;
-moz-border-radius: 0px !important;
-ms-border-radius: 0px !important;
-o-border-radius: 0px !important;
}
.post-video {
width: 100%;