This commit is contained in:
Peter Maquiran
2024-04-03 15:28:58 +01:00
parent 00a58e12f4
commit 1671ace745
5 changed files with 41 additions and 14 deletions
@@ -409,21 +409,31 @@ export class NewPublicationPage implements OnInit {
close() { close() {
this.modalController.dismiss(this.PublicationFromMvService.form).then(() => { this.modalController.dismiss(this.PublicationFromMvService.form).then(() => {
this.showLoader = true; this.showLoader = true;
}); });
} }
cancel() { cancel() {
this.PublicationFromMvService.form.cancel = true
if(this.PublicationFromMvService.form.send == false) { if(this.PublicationFromMvService.form.send == false) {
this.PublicationFromMvService.cancel() this.PublicationFromMvService.cancel()
this.PublicationFromMvService.ObjectMergeNotification.close() this.PublicationFromMvService.ObjectMergeNotification.close()
} }
this.modalController.dismiss(this.PublicationFromMvService.form).then(() => { if (window["sharedContent"]) {
this.showLoader = true;
}); if (this.platform.is('android')) {
App.exitApp()
} else {
window["sharedContent"] = null;
this.close()
}
} else {
this.close()
}
} }
clear() { clear() {
@@ -66,7 +66,7 @@
<ion-img *ngIf="checkFileType.checkFileType(seleted.FileExtension) == 'image'" <ion-img *ngIf="checkFileType.checkFileType(seleted.FileExtension) == 'image'"
name="image" ngDefaultControl [src]="'data:image/jpg;base64,' + seleted.Base64" style="height: 69px; width: 69px;"></ion-img> name="image" ngDefaultControl [src]="'data:image/jpg;base64,' + seleted.Base64" style="height: 69px; width: 69px;"></ion-img>
<video class="sdf" *ngIf="checkFileType.checkFileType(seleted.FileExtension) == 'video' && checkDesktop() == true" width="70" height="70" <video class="sdf" *ngIf="checkFileType.checkFileType(seleted.FileExtension) == 'video' " width="70" height="70"
preload="metadata" webkit-playsinline="webkit-playsinline"> preload="metadata" webkit-playsinline="webkit-playsinline">
<source type="video/mp4" [src]="seleted.url"> <source type="video/mp4" [src]="seleted.url">
</video> </video>
@@ -315,7 +315,7 @@ export class NewPublicationPage implements OnInit {
console.log('load video tablet base64', content) console.log('load video tablet base64', content)
this.filecontent = true; this.filecontent = true;
let fileObject = new PublicationAttachmentEntity({ let fileObject = new PublicationAttachmentEntity({
base64: 'data:video/mp4;base64,'+content.data, base64: content.data,
extension: this.removeTextBeforeSlash(element.mimeType, '/'), extension: this.removeTextBeforeSlash(element.mimeType, '/'),
OriginalFileName: 'video', OriginalFileName: 'video',
FileType: this.checkFileType.checkFileType( this.removeTextBeforeSlash(element.mimeType, '/')) as any FileType: this.checkFileType.checkFileType( this.removeTextBeforeSlash(element.mimeType, '/')) as any
@@ -113,11 +113,19 @@ export class PublicationFromMvService {
publication.ProcessId = this.folderId publication.ProcessId = this.folderId
if(this.form.cancel) {
window['upload-header-set-remove'](this.id);
return false
}
try { try {
const response = await this.publications.UpdatePublication(publication.ProcessId, publication).toPromise() const response = await this.publications.UpdatePublication(publication.ProcessId, publication).toPromise()
this.httpErroHandle.httpsSucessMessagge('Editar publicação') if (!this.form.cancel) {
this.httpErroHandle.httpsSucessMessagge('Editar publicação')
}
this.publicationFolderService.getPublicationsIds(this.folderId) this.publicationFolderService.getPublicationsIds(this.folderId)
window['upload-header-set-remove'](this.id); window['upload-header-set-remove'](this.id);
@@ -195,21 +203,24 @@ export class PublicationFromMvService {
publication.DocumentId = null; publication.DocumentId = null;
publication.ProcessId = this.folderId publication.ProcessId = this.folderId
if(this.form.cancel) {
window['upload-header-set-remove'](this.id);
return false
}
try { try {
await this.publications.CreatePublication(publication.ProcessId, publication).toPromise() await this.publications.CreatePublication(publication.ProcessId, publication).toPromise()
if (this.publicationType == '1') { if (this.publicationType == '1' && !this.form.cancel) {
this.httpErroHandle.httpsSucessMessagge('Criar publicação') this.httpErroHandle.httpsSucessMessagge('Criar publicação')
} else if (this.publicationType == '2') { } else if (this.publicationType == '2' && !this.form.cancel) {
this.httpErroHandle.httpsSucessMessagge('Criar publicação') this.httpErroHandle.httpsSucessMessagge('Criar publicação')
} else if (this.publicationType == '3') {
this.httpErroHandle.httpsSucessMessagge('Editar publicação')
} }
// this.goBackToViewPublications.emit(); // this.goBackToViewPublications.emit();
window['upload-header-set-remove'](this.id); window['upload-header-set-remove'](this.id);
this.closeApp() this.doneUpload()
this.publicationFolderService.getPublicationsIds(this.folderId) this.publicationFolderService.getPublicationsIds(this.folderId)
} catch (error) { } catch (error) {
window['upload-header-set-retry'](this.id) window['upload-header-set-retry'](this.id)
@@ -232,11 +243,14 @@ export class PublicationFromMvService {
} }
closeApp() { doneUpload() {
if (window["sharedContent"]) { if (window["sharedContent"]) {
if (this.platform.is('android')) { if (this.platform.is('android')) {
App.exitApp() window["sharedContent"] = null
this.modalController.dismiss(this.form).then(() => {
this.router.navigate(['/home/publications', this.folderId])
});
} else { } else {
window["sharedContent"] = null window["sharedContent"] = null
this.modalController.dismiss(this.form).then(() => { this.modalController.dismiss(this.form).then(() => {
@@ -244,6 +258,8 @@ export class PublicationFromMvService {
}); });
} }
} else {
this.modalController.dismiss(this.form).then(() => {});
} }
} }
@@ -215,6 +215,7 @@ export class PublicationFormModel implements IPublicationFormModelEntity {
hasSet = false hasSet = false
send = false send = false
cancel = false
setData(data: IPublicationFormModelEntity) { setData(data: IPublicationFormModelEntity) {
if(data.Files) { if(data.Files) {