mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 21:35:50 +00:00
fix publication OrifinalFilename
This commit is contained in:
@@ -51,12 +51,12 @@
|
||||
<ion-img *ngIf="checkFileType.checkFileType(seleted.FileExtension) == 'image'"
|
||||
name="image" ngDefaultControl [src]="seleted.FileBase64"></ion-img>
|
||||
|
||||
|
||||
<video *ngIf="checkFileType.checkFileType(seleted.FileExtension) == 'video'" width="70" height="70"
|
||||
preload="metadata" webkit-playsinline="webkit-playsinline">
|
||||
<source type="video/mp4" [src]="seleted.FileBase64">
|
||||
</video>
|
||||
|
||||
|
||||
</ion-thumbnail>
|
||||
<!-- Display the blurred image and count if there are more images -->
|
||||
<ion-thumbnail *ngIf="seletedContent.length > displayLimit" lot="start">
|
||||
@@ -102,8 +102,6 @@
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
|
||||
|
||||
<div class="ion-item-container-no-border hide-desktop">
|
||||
<ion-label (click)="loadVideo()">
|
||||
<div class="attach-icon">
|
||||
|
||||
@@ -130,7 +130,16 @@ export class NewPublicationPage implements OnInit {
|
||||
}
|
||||
console.log('edit',this.publication)
|
||||
this.pub = this.publication;
|
||||
this.seletedContent = this.publication.Files;
|
||||
this.seletedContent = this.publication.Files.map( e => {
|
||||
return new PublicationAttachmentEntity(
|
||||
{
|
||||
base64: e.FileBase64,
|
||||
extension: e.FileExtension,
|
||||
OriginalFileName: e.OriginalFileName,
|
||||
FileType: this.checkFileType.checkFileType(e.FileExtension)
|
||||
}
|
||||
)
|
||||
})
|
||||
this.showLoader = false;
|
||||
}, (error) => {
|
||||
console.log(error)
|
||||
@@ -322,52 +331,47 @@ export class NewPublicationPage implements OnInit {
|
||||
|
||||
if (this.publicationType == ActionType.edit) {
|
||||
|
||||
if (!this.publication?.OriginalFileName || !this.pub.OriginalFileName) {
|
||||
|
||||
if (this.pub?.OriginalFileName) {
|
||||
console.log('this.pub', this.pub)
|
||||
}
|
||||
throw ('no this.publication.OriginalFileName')
|
||||
|
||||
}
|
||||
|
||||
const loader = this.toastService.loading()
|
||||
|
||||
if (this.seletedContent.length > 0) {
|
||||
|
||||
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 || 'foto',
|
||||
Files: this.seletedContent,
|
||||
}
|
||||
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,
|
||||
Files: this.seletedContent,
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
const response = await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise()
|
||||
this.publication.Files = this.publication.Files.map( e => ({
|
||||
FileBase64: e.FileBase64,
|
||||
FileExtension: e.FileExtension,
|
||||
OriginalFileName: 'foto'
|
||||
}))
|
||||
|
||||
this.httpErroHandle.httpsSucessMessagge('Editar publicação')
|
||||
console.log({ response })
|
||||
try {
|
||||
|
||||
const response = await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise()
|
||||
|
||||
this.httpErroHandle.httpsSucessMessagge('Editar publicação')
|
||||
console.log({ response })
|
||||
|
||||
this.goBack();
|
||||
|
||||
} catch (error) {
|
||||
this.httpErroHandle.httpStatusHandle(error)
|
||||
if (error.status == 404) {
|
||||
this.PublicationFolderService.deletePost(this.publication.ProcessId, this.publication.DocumentId)
|
||||
this.goBack();
|
||||
|
||||
} catch (error) {
|
||||
this.httpErroHandle.httpStatusHandle(error)
|
||||
if (error.status == 404) {
|
||||
this.PublicationFolderService.deletePost(this.publication.ProcessId, this.publication.DocumentId)
|
||||
this.goBack();
|
||||
}
|
||||
} finally {
|
||||
loader.remove()
|
||||
}
|
||||
|
||||
} else {
|
||||
}/*
|
||||
else if (!this.PublicationFolderService.PublicationHasImage(this.publication)) { //
|
||||
} finally {
|
||||
loader.remove()
|
||||
}
|
||||
/*
|
||||
else if (!this.PublicationFolderService.PublicationHasImage(this.publication)) { //
|
||||
|
||||
this.publication = {
|
||||
DateIndex: this.publication.DateIndex,
|
||||
@@ -412,6 +416,16 @@ export class NewPublicationPage implements OnInit {
|
||||
}
|
||||
|
||||
|
||||
// this.publicationFormMV.setDataToFrom(this.publication)
|
||||
|
||||
// this.publicationFormMV.uploadVideosFiles()
|
||||
|
||||
this.publication.Files = this.publication.Files.map( e => ({
|
||||
FileBase64: e.FileBase64,
|
||||
FileExtension: e.FileExtension,
|
||||
OriginalFileName: 'foto'
|
||||
}))
|
||||
|
||||
const loader = this.toastService.loading()
|
||||
|
||||
try {
|
||||
@@ -1043,7 +1057,7 @@ class PublicationAttachmentEntity {
|
||||
this.FileBase64 = 'data:image/jpg;base64,' + this.FileBase64
|
||||
}
|
||||
} else if (this.FileType == 'video' ) {
|
||||
if(!this.FileBase64.startsWith('data:')) {
|
||||
if(!this.FileBase64.startsWith('data:') && !this.FileBase64.startsWith('http')) {
|
||||
this.FileBase64 = 'data:video/mp4;base64,' + this.FileBase64
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user