diff --git a/src/app/modals/document-detail/document-detail.page.html b/src/app/modals/document-detail/document-detail.page.html index 533cd81da..4e0a48e46 100644 --- a/src/app/modals/document-detail/document-detail.page.html +++ b/src/app/modals/document-detail/document-detail.page.html @@ -51,7 +51,7 @@ >
- {{LoadedDocument.Assunto}} + {{LoadedDocument.Assunto || 'Sem título'}}
{{ LoadedDocument.Sender }} diff --git a/src/app/modals/forward/forward.page.html b/src/app/modals/forward/forward.page.html index a9add5085..e29b40dee 100644 --- a/src/app/modals/forward/forward.page.html +++ b/src/app/modals/forward/forward.page.html @@ -52,7 +52,7 @@ -

{{attachment.Description}}

+

{{attachment.Description || 'Sem título'}}

{{attachment.Stakeholders}} {{ attachment.CreateDate | date: 'dd-MM-yyyy' }}

diff --git a/src/app/modals/view-event/view-event.page.html b/src/app/modals/view-event/view-event.page.html index 5c570a082..17b346bd7 100644 --- a/src/app/modals/view-event/view-event.page.html +++ b/src/app/modals/view-event/view-event.page.html @@ -98,7 +98,7 @@

- {{attach.SourceName}} + {{attach.SourceName || 'Sem título'}} {{attach.Stakeholders}}

diff --git a/src/app/pages/agenda/view-event/view-event.page.html b/src/app/pages/agenda/view-event/view-event.page.html index 37c45cba9..6f3fc63e3 100644 --- a/src/app/pages/agenda/view-event/view-event.page.html +++ b/src/app/pages/agenda/view-event/view-event.page.html @@ -95,7 +95,8 @@

- {{attach.SourceName}} + {{attach.SourceName || 'Sem título'}} + {{attach.Stakeholders}}

diff --git a/src/app/pages/agenda/view-event/view-event.page.ts b/src/app/pages/agenda/view-event/view-event.page.ts index 2daf1ba65..d598893ec 100644 --- a/src/app/pages/agenda/view-event/view-event.page.ts +++ b/src/app/pages/agenda/view-event/view-event.page.ts @@ -193,6 +193,7 @@ export class ViewEventPage implements OnInit { if(this.sesseionStora.user.Profile == 'MDGPR' || this.sesseionStora.user.Profile == 'PR') { this.eventsService.getEvent(this.eventId).subscribe(res => { + console.log('Loaded Event', res) res = this.dateService.fixDate(res as any) this.loadedEvent = res; this.setTimeZone() @@ -217,7 +218,7 @@ export class ViewEventPage implements OnInit { if(this.CalendarId) { this.eventsService.genericGetEvent(this.eventId, this.CalendarId).subscribe(res => { - + console.log('Loaded Event', res) /* const div = document.createElement("div") div.innerHTML = res.Body.Text res.Body.Text = div.innerText */ diff --git a/src/app/pages/gabinete-digital/event-list/approve-event-modal/approve-event-modal.page.html b/src/app/pages/gabinete-digital/event-list/approve-event-modal/approve-event-modal.page.html index 5f02fa00a..a5565b59a 100644 --- a/src/app/pages/gabinete-digital/event-list/approve-event-modal/approve-event-modal.page.html +++ b/src/app/pages/gabinete-digital/event-list/approve-event-modal/approve-event-modal.page.html @@ -96,7 +96,7 @@ (click)="viewDocument(document.SourceId, document.ApplicationId)" class="width-100 d-block list">

- {{document.SourceName}} + {{document.SourceName || 'Sem título'}} Correspondencia AccoesPresidenciais ArquivoDespachoElect diff --git a/src/app/pages/gabinete-digital/event-list/approve-event/approve-event.page.html b/src/app/pages/gabinete-digital/event-list/approve-event/approve-event.page.html index 0d2d354a3..a94cdaab3 100644 --- a/src/app/pages/gabinete-digital/event-list/approve-event/approve-event.page.html +++ b/src/app/pages/gabinete-digital/event-list/approve-event/approve-event.page.html @@ -95,7 +95,7 @@ *ngFor="let attachment of loadedAttachments" (click)="viewDocument(attachment.DocId, attachment)"> -

{{attachment.Description}}

+

{{attachment.Description || 'Sem título'}}

{{attachment.Stakeholders}}{{ attachment.CreateDate | date: 'dd-MM-yyyy HH:mm' }}

diff --git a/src/app/pages/publications/new-publication/new-publication.page.ts b/src/app/pages/publications/new-publication/new-publication.page.ts index 230b452ac..b05f25db5 100644 --- a/src/app/pages/publications/new-publication/new-publication.page.ts +++ b/src/app/pages/publications/new-publication/new-publication.page.ts @@ -194,7 +194,7 @@ export class NewPublicationPage implements OnInit { this.capturedImage = 'data:image/jpeg;base64,' + capturedImage.base64String; this.capturedImageTitle = 'foto'; - if (this.fileSizeToMB(capturedImage.base64String.length) <= 20) { + if (this.canAddFile(this.fileSizeToMB(capturedImage.base64String.length))) { const compressedImage = await this.compressImageBase64( this.capturedImage, 800, // maxWidth @@ -207,7 +207,8 @@ export class NewPublicationPage implements OnInit { let fileObject = { FileBase64: this.removeTextBeforeSlash(picture, ','), FileExtension: capturedImage.format, - OriginalFileName: 'image' + OriginalFileName: 'image', + FileSize: this.fileSizeToMB(capturedImage.base64String.length) } this.seletedContent.push(fileObject) @@ -251,13 +252,13 @@ export class NewPublicationPage implements OnInit { console.log('video record', data) data.forEach(async element => { this.filesSizeSum = this.filesSizeSum + element.size - if (this.fileSizeToMB(this.filesSizeSum) <= 20) { + if (this.canAddFile(this.fileSizeToMB(element.size))) { try { if (this.platform.is('ios')) { - this.recordevideoIos(element.fullPath) + this.recordevideoIos(element.fullPath,element.size) } else { - this.recordVideoAndroid(element.fullPath) + this.recordVideoAndroid(element.fullPath,element.size) } } catch (e) { @@ -277,37 +278,37 @@ export class NewPublicationPage implements OnInit { } } - async loadVideo() { - const result = await FilePicker.pickMedia ({ multiple: true, }); - console.log(result.files) - result.files.forEach(async element => { - this.filesSizeSum = this.filesSizeSum + element.size - if (this.fileSizeToMB(this.filesSizeSum) <= 20) { - console.log('pass size verificartion') + async loadVideo() { + const result = await FilePicker.pickMedia({ multiple: true, }); + console.log(result.files) + result.files.forEach(async element => { + this.filesSizeSum = this.filesSizeSum + element.size + if (this.canAddFile( this.fileSizeToMB(element.size))) { + console.log('pass size verificartion') if (this.checkFileType.checkFileType(element.mimeType) == 'video' && this.platform.is('ios')) { - let resultUrl = decodeURIComponent(element.path); console.log('pass type verification ', resultUrl) - try { - this.recordevideoIos(resultUrl) - } catch (error) { - console.log('upload video error: ', error) - } - } else if (this.checkFileType.checkFileType(element.mimeType) == 'image' || this.checkFileType.checkFileType(element.mimeType) == 'video') { + let resultUrl = decodeURIComponent(element.path); console.log('pass type verification ', resultUrl) + try { + this.recordevideoIos(resultUrl,element.size) + } catch (error) { + console.log('upload video error: ', error) + } + } else if (this.checkFileType.checkFileType(element.mimeType) == 'image' || this.checkFileType.checkFileType(element.mimeType) == 'video') { let resultUrl = decodeURIComponent(element.path); - console.log('pass type verification ', resultUrl) - try { - this.loadVideoAndroid(resultUrl,element) - } catch (error) { - console.log('upload video error: ', error) - } - } - } else { - if (this.seletedContent.length === 0) - this.filesSizeSum = 0 + console.log('pass type verification ', resultUrl) + try { + this.loadVideoAndroid(resultUrl, element) + } catch (error) { + console.log('upload video error: ', error) + } + } + } else { + if (this.seletedContent.length === 0) + this.filesSizeSum = 0 - this.httpErrorHandle.validationMessagge('filessize') - } - }); - }; + this.httpErrorHandle.validationMessagge('filessize') + } + }); + }; chossePhotoOrVideo() { @@ -527,9 +528,9 @@ export class NewPublicationPage implements OnInit { window["sharedContent"] = null window["openFolder"] = true - if(window.innerWidth <= 700) { + if (window.innerWidth <= 700) { this.router.navigate(['/home/publications', this.folderId]); - } else if(window.innerWidth >= 701){ + } else if (window.innerWidth >= 701) { let navigationExtras: NavigationExtras = { queryParams: { "folderId": this.folderId, } }; this.router.navigate(['/home/publications']); } @@ -744,41 +745,41 @@ export class NewPublicationPage implements OnInit { if (this.checkFileType.checkFileType(FileExtension) == 'image' || this.checkFileType.checkFileType(FileExtension) == 'video') { let resultUrl = decodeURIComponent(element.url); - if(this.platform.is('ios')) { + if (this.platform.is('ios')) { const stringGerada = this.gerarStringAleatoria(); -console.log(stringGerada); - this.shareContentIso(resultUrl,FileExtension,stringGerada) + console.log(stringGerada); + this.shareContentIso(resultUrl, FileExtension, stringGerada) } else { - this.shareContentAndroid(resultUrl,FileExtension) + this.shareContentAndroid(resultUrl, FileExtension) } -/* - Filesystem.readFile({ path: resultUrl }).then(async (content) => { - let fileObject; - try { - if (this.checkFileType.checkFileType(FileExtension) == 'image') { - fileObject = { - FileBase64: this.removeTextBeforeSlash(content.data, ','), - FileExtension: FileExtension, - OriginalFileName: 'shared', - } - - } else if (this.checkFileType.checkFileType(FileExtension) == 'video') { - fileObject = { - FileBase64: 'data:video/mp4;base64,' + this.removeTextBeforeSlash(content.data, ','), - FileExtension: FileExtension, - OriginalFileName: 'shared', - } - - } - console.log('shared base', content.data) - - this.seletedContent.push(fileObject) - } catch (error) { - console.log('error shared filesystem', error) - } - - }) */ + /* + Filesystem.readFile({ path: resultUrl }).then(async (content) => { + let fileObject; + try { + if (this.checkFileType.checkFileType(FileExtension) == 'image') { + fileObject = { + FileBase64: this.removeTextBeforeSlash(content.data, ','), + FileExtension: FileExtension, + OriginalFileName: 'shared', + } + + } else if (this.checkFileType.checkFileType(FileExtension) == 'video') { + fileObject = { + FileBase64: 'data:video/mp4;base64,' + this.removeTextBeforeSlash(content.data, ','), + FileExtension: FileExtension, + OriginalFileName: 'shared', + } + + } + console.log('shared base', content.data) + + this.seletedContent.push(fileObject) + } catch (error) { + console.log('error shared filesystem', error) + } + + }) */ } else { this.httpErrorHandle.validationMessagge('filetype'); } @@ -806,75 +807,77 @@ console.log(stringGerada); } - async recordevideoIos(fullPath) { + async recordevideoIos(fullPath,size) { console.log('fullpath', fullPath) try { - const directory = await Filesystem.getUri({ - directory: Directory.Cache, - path: '', - }); + const directory = await Filesystem.getUri({ + directory: Directory.Cache, + path: '', + }); - const stringGerada = this.gerarStringAleatoria(); -console.log(stringGerada); - let fileObject ={}; - this.videoconvertService.convertVideo(fullPath,directory.uri,stringGerada,'mp4').then(async () => { - await Filesystem.readFile({ path: `${directory.uri}${stringGerada}.mp4`}) + const stringGerada = this.gerarStringAleatoria(); + console.log(stringGerada); + let fileObject = {}; + this.videoconvertService.convertVideo(fullPath, directory.uri, stringGerada, 'mp4').then(async () => { + await Filesystem.readFile({ path: `${directory.uri}${stringGerada}.mp4` }) - .then(async (content) => { - this.filecontent = true; - fileObject = {} - console.log('First clean',fileObject) - fileObject = { - FileBase64: 'data:video/mp4;base64,' + content.data, - FileExtension: 'mp4', - OriginalFileName: stringGerada - } - console.log('what do we have',fileObject) - this.seletedContent.push(fileObject) - console.log('file object 1',fileObject) - fileObject ={}; - const deleteSecretFile = async () => { - await Filesystem.deleteFile({ - path: `${stringGerada}.mp4`, - directory: Directory.Cache, - }); - }; - await deleteSecretFile().then((value) => { - console.log('delete file',value) - fileObject ={}; - console.log('file object 2',fileObject) - }) - }) - .catch((erro) => console.error('read converted video erro ', erro)); - }); + .then(async (content) => { + this.filecontent = true; + fileObject = {} + console.log('First clean', fileObject) + fileObject = { + FileBase64: 'data:video/mp4;base64,' + content.data, + FileExtension: 'mp4', + OriginalFileName: stringGerada, + FileSize: this.fileSizeToMB(size) + } + console.log('what do we have', fileObject) + this.seletedContent.push(fileObject) + console.log('file object 1', fileObject) + fileObject = {}; + const deleteSecretFile = async () => { + await Filesystem.deleteFile({ + path: `${stringGerada}.mp4`, + directory: Directory.Cache, + }); + }; + await deleteSecretFile().then((value) => { + console.log('delete file', value) + fileObject = {}; + console.log('file object 2', fileObject) + }) + }) + .catch((erro) => console.error('read converted video erro ', erro)); + }); - } catch (error) { + } catch (error) { console.log('record video ios erro, ', error) - } + } } - async recordVideoAndroid(fullPath) { + async recordVideoAndroid(fullPath,size) { try { - const savedFile = await Filesystem.copy({ - from: fullPath, - to: "video.mp4", - toDirectory: FilesystemDirectory.Data - }); - console.log(savedFile.uri) - Filesystem.readFile({ path: savedFile.uri }) + const savedFile = await Filesystem.copy({ + from: fullPath, + to: "video.mp4", + toDirectory: FilesystemDirectory.Data + }); + console.log(savedFile.uri) + Filesystem.readFile({ path: savedFile.uri }) - .then(async (content) => { - this.filecontent = true; - let fileObject = { - FileBase64: 'data:video/mp4;base64,' + content.data, - FileExtension: 'mp4', - OriginalFileName: 'video' - } - this.seletedContent.push(fileObject) - }) - .catch((error) => console.error('reade converted video erro ',error)); + .then(async (content) => { + this.filecontent = true; + let fileObject = { + FileBase64: 'data:video/mp4;base64,' + content.data, + FileExtension: 'mp4', + OriginalFileName: 'video', + FileSize: this.fileSizeToMB(size) + } + this.seletedContent.push(fileObject) + }) + .catch((error) => console.error('reade converted video erro ', error)); } catch (error) { console.log('record video android erro ', error) @@ -885,34 +888,36 @@ console.log(stringGerada); } - loadVideoAndroid(resultUrl,element) { + loadVideoAndroid(resultUrl, element) { Filesystem.readFile({ path: resultUrl }) - .then(async (content) => { - console.log(content) - this.filecontent = true; - let fileObject; - if (this.removeTextBeforeSlash(element.mimeType, '/') == "mp4") { - fileObject = { - FileBase64: 'data:video/mp4;base64,' + content.data, - FileExtension: this.removeTextBeforeSlash(element.mimeType, '/'), - OriginalFileName: 'video' + .then(async (content) => { + console.log(content) + this.filecontent = true; + let fileObject; + if (this.removeTextBeforeSlash(element.mimeType, '/') == "mp4") { + fileObject = { + FileBase64: 'data:video/mp4;base64,' + content.data, + FileExtension: this.removeTextBeforeSlash(element.mimeType, '/'), + OriginalFileName: 'video', + FileSize:element.size + } + } else { + fileObject = { + FileBase64: 'data:image/jpeg;base64,' + content.data, + FileExtension: this.removeTextBeforeSlash(element.mimeType, '/'), + OriginalFileName: 'image', + FileSize: this.fileSizeToMB(element.size) + } } - } else { - fileObject = { - FileBase64: 'data:image/jpeg;base64,' + content.data, - FileExtension: this.removeTextBeforeSlash(element.mimeType, '/'), - OriginalFileName: 'image' - } - } - this.seletedContent.push(fileObject) - }) - .catch((err) => console.error(err)); + this.seletedContent.push(fileObject) + }) + .catch((err) => console.error(err)); } - gerarStringAleatoria() { + gerarStringAleatoria() { const caracteres = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; let stringAleatoria = ''; @@ -924,7 +929,7 @@ console.log(stringGerada); return stringAleatoria; } - async shareContentIso(fullPath,FileExtension,filename) { + async shareContentIso(fullPath, FileExtension, filename) { try { if (this.checkFileType.checkFileType(FileExtension) == 'image') { @@ -932,11 +937,11 @@ console.log(stringGerada); Filesystem.readFile({ path: fullPath }).then(async (content) => { let fileObject; try { - fileObject = { - FileBase64: this.removeTextBeforeSlash(content.data, ','), - FileExtension: FileExtension, - OriginalFileName: 'shared', - } + fileObject = { + FileBase64: this.removeTextBeforeSlash(content.data, ','), + FileExtension: FileExtension, + OriginalFileName: 'shared', + } console.log('shared base', content.data) this.seletedContent.push(fileObject) @@ -951,13 +956,13 @@ console.log(stringGerada); path: '', }); - let fileObject ={}; - this.videoconvertService.convertVideo(fullPath,directory.uri,filename,'mp4').then(async () => { - await Filesystem.readFile({ path: `${directory.uri}${filename}.mp4`}) + let fileObject = {}; + this.videoconvertService.convertVideo(fullPath, directory.uri, filename, 'mp4').then(async () => { + await Filesystem.readFile({ path: `${directory.uri}${filename}.mp4` }) - .then(async (content) => { - console.log(content.data) - this.filecontent = true; + .then(async (content) => { + console.log(content.data) + this.filecontent = true; /* fileObject = { FileBase64: this.removeTextBeforeSlash(content.data, ','), FileExtension: 'mp4', @@ -968,38 +973,38 @@ console.log(stringGerada); FileExtension: 'mp4', OriginalFileName: 'shared', } - this.seletedContent.push(fileObject) - fileObject ={}; - const deleteSecretFile = async () => { - await Filesystem.deleteFile({ - path: `${filename}.mp4`, - directory: Directory.Cache, - }); - }; - deleteSecretFile().then((value) => { - console.log('delete file',value) - fileObject ={}; + this.seletedContent.push(fileObject) + fileObject = {}; + const deleteSecretFile = async () => { + await Filesystem.deleteFile({ + path: `${filename}.mp4`, + directory: Directory.Cache, + }); + }; + deleteSecretFile().then((value) => { + console.log('delete file', value) + fileObject = {}; + }) }) - }) - .catch((erro) => console.error('read converted video erro ', erro)); + .catch((erro) => console.error('read converted video erro ', erro)); }); } } catch (error) { - console.log('record video ios erro, ', error) + console.log('record video ios erro, ', error) } } - shareContentAndroid(resultUrl,FileExtension) { + shareContentAndroid(resultUrl, FileExtension) { Filesystem.readFile({ path: resultUrl }).then(async (content) => { let fileObject; try { if (this.checkFileType.checkFileType(FileExtension) == 'image') { fileObject = { - FileBase64: 'data:image/jpeg;base64,' +this.removeTextBeforeSlash(content.data, ','), + FileBase64: 'data:image/jpeg;base64,' + this.removeTextBeforeSlash(content.data, ','), FileExtension: FileExtension, OriginalFileName: 'shared', } @@ -1023,5 +1028,28 @@ console.log(stringGerada); } + canAddFile(fileToAddsize) { + console.log('File size to add', fileToAddsize) + console.log(this.seletedContent) + // Calculate the total size of files in the list + var totalSize = this.seletedContent.reduce((total, {FileSize}) => total + FileSize, 0); + console.log('Totoal size',totalSize) + console.log('fileAddsize',fileToAddsize) + // Check if adding the file would exceed the individual file size limit (20 MB) + if (fileToAddsize >= 20) { + console.log("File size exceeds individual file size limit (20 MB)"); + return false; + } + + // Check if adding the file would exceed the total size limit (20 MB) + + if (totalSize + fileToAddsize >= 20) { + console.log("Total file size exceeds total size limit (20 MB)"); + return false; + } + // If neither condition is met, it's safe to add the file + return true; +} + } diff --git a/src/app/shared/agenda/approve-event/approve-event.page.html b/src/app/shared/agenda/approve-event/approve-event.page.html index f235afeb1..f9f560d32 100644 --- a/src/app/shared/agenda/approve-event/approve-event.page.html +++ b/src/app/shared/agenda/approve-event/approve-event.page.html @@ -106,7 +106,7 @@ *ngFor="let attachment of loadedAttachments" (click)="viewDocument(attachment.DocId, attachment)"> -

{{attachment.Description}}

+

{{attachment.Description || 'Sem título'}}

{{attachment.Stakeholders}}{{ attachment.CreateDate | date: 'dd-MM-yyyy HH:mm' }}

diff --git a/src/app/shared/agenda/view-event/view-event.page.html b/src/app/shared/agenda/view-event/view-event.page.html index 3cd10fa57..32b7bff21 100644 --- a/src/app/shared/agenda/view-event/view-event.page.html +++ b/src/app/shared/agenda/view-event/view-event.page.html @@ -121,7 +121,7 @@ class="ion-no-margin ion-no-padding pa-0">

- {{attach.SourceName}} + {{attach.SourceName || 'Sem título'}} {{attach.Stakeholders}}