mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 12:37:53 +00:00
Merge branch 'feature/viewer-attachment' of https://bitbucket.org/equilibriumito/gabinete-digital-fo into feature/viewer-attachment
This commit is contained in:
@@ -14,7 +14,7 @@ import { FormControl, FormGroup, Validators } from '@angular/forms';
|
|||||||
import { ThemePalette } from '@angular/material/core';
|
import { ThemePalette } from '@angular/material/core';
|
||||||
import { formatDate } from 'src/plugin/momentG.js'
|
import { formatDate } from 'src/plugin/momentG.js'
|
||||||
import { ThemeService } from 'src/app/services/theme.service';
|
import { ThemeService } from 'src/app/services/theme.service';
|
||||||
import { Camera, CameraResultType, CameraSource, Photo } from '@capacitor/camera';
|
import { Camera, CameraResultType, CameraSource } from '@capacitor/camera';
|
||||||
|
|
||||||
import { Filesystem, Directory, Encoding, FilesystemDirectory, FilesystemEncoding } from '@capacitor/filesystem';
|
import { Filesystem, Directory, Encoding, FilesystemDirectory, FilesystemEncoding } from '@capacitor/filesystem';
|
||||||
import { NgxImageCompressService } from "ngx-image-compress";
|
import { NgxImageCompressService } from "ngx-image-compress";
|
||||||
|
|||||||
@@ -231,87 +231,12 @@ export class ViewPublicationsPage implements OnInit {
|
|||||||
this.showLoader = true;
|
this.showLoader = true;
|
||||||
const folderId = this.folderId
|
const folderId = this.folderId
|
||||||
|
|
||||||
try {
|
await this.publicationFolderService.getPublicationsIds(folderId)
|
||||||
const publicationIds = await this.publications.GetPublicationsList(folderId).toPromise();
|
|
||||||
|
|
||||||
this.createPublicationList(folderId)
|
this.showLoader = false;
|
||||||
let loadLater = []
|
|
||||||
for (let publicationId of publicationIds) {
|
|
||||||
|
|
||||||
if (!this.publicationIsPresent(publicationId, folderId)) {
|
|
||||||
await this.loadPublication(publicationId, folderId)
|
|
||||||
|
|
||||||
} else {
|
|
||||||
loadLater.push(publicationId)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let publicationId of loadLater) {
|
|
||||||
await this.loadPublication(publicationId, folderId)
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let localPublication of this.publicationFolderService.publicationList[folderId]) {
|
|
||||||
|
|
||||||
const apiPublication = publicationIds.includes(localPublication.DocumentId)
|
|
||||||
if (!apiPublication) {
|
|
||||||
this.publicationFolderService.deletePost(folderId, localPublication.DocumentId)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.showLoader = false;
|
|
||||||
|
|
||||||
this.storage.set(folderId, this.publicationFolderService.publicationList[folderId]);
|
|
||||||
this.getpublication = this.publicationFolderService.publicationList[folderId];
|
|
||||||
} catch (error) {
|
|
||||||
this.showLoader = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
publicationIsPresent(publicationId, folderId) {
|
|
||||||
return this.publicationFolderService.publicationList[folderId].find(e => e.DocumentId == publicationId)
|
|
||||||
}
|
|
||||||
publicationFind(publicationId, folderId) {
|
|
||||||
return this.publicationFolderService.publicationList[folderId].find(e => e.DocumentId == publicationId)
|
|
||||||
}
|
|
||||||
publicationFindIndex(publicationId, folderId) {
|
|
||||||
return this.publicationFolderService.publicationList[folderId].findIndex(e => e.DocumentId == publicationId)
|
|
||||||
}
|
|
||||||
|
|
||||||
async loadPublication(publicationId, folderId) {
|
|
||||||
let Publication = await this.publications.GetPublicationWithArrayOfFilesById(publicationId).toPromise();
|
|
||||||
console.log('Publications with array of file: ', Publication.Files)
|
|
||||||
this.arrayOfFile = Publication.Files
|
|
||||||
let publicationDetails: Publication = this.publicationPipe.itemList(Publication)
|
|
||||||
|
|
||||||
const findIndex = this.publicationFindIndex(publicationId, folderId)
|
|
||||||
const found = this.publicationIsPresent(publicationId, folderId)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (!found) {
|
|
||||||
this.publicationFolderService.publicationList[folderId].push(publicationDetails)
|
|
||||||
this.publicationFolderService.revertPublicationOrder(folderId)
|
|
||||||
} else {
|
|
||||||
|
|
||||||
|
|
||||||
let a: any = Object.assign({}, this.publicationFolderService.publicationList[folderId][findIndex])
|
|
||||||
let b: any = Object.assign({}, publicationDetails)
|
|
||||||
|
|
||||||
a.Files = a.Files.length
|
|
||||||
b.Files = b.Files.length
|
|
||||||
|
|
||||||
if (JSON.stringify(a) != JSON.stringify(b)) {
|
|
||||||
|
|
||||||
// console.log({a, b})
|
|
||||||
this.publicationFolderService.publicationList[folderId][findIndex] = publicationDetails
|
|
||||||
} else {
|
|
||||||
// console.log({publicationDetails})
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
async AddPublication(publicationType: any, folderId: any) {
|
async AddPublication(publicationType: any, folderId: any) {
|
||||||
|
|
||||||
@@ -397,4 +322,3 @@ export class ViewPublicationsPage implements OnInit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -64,7 +64,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<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]="seleted.url" style="height: 69px; width: 69px;"></ion-img>
|
||||||
|
|
||||||
<video class="sdf" *ngIf="checkFileType.checkFileType(seleted.FileExtension) == 'video' " 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">
|
||||||
|
|||||||
@@ -321,7 +321,7 @@ export class NewPublicationPage implements OnInit {
|
|||||||
FileType: this.checkFileType.checkFileType( this.removeTextBeforeSlash(element.mimeType, '/')) as any
|
FileType: this.checkFileType.checkFileType( this.removeTextBeforeSlash(element.mimeType, '/')) as any
|
||||||
})
|
})
|
||||||
|
|
||||||
/* fileObject.needUpload() */
|
fileObject.needUpload()
|
||||||
this.PublicationFromMvService.form.Files.push(fileObject)
|
this.PublicationFromMvService.form.Files.push(fileObject)
|
||||||
})
|
})
|
||||||
.catch((err) => console.error(err));
|
.catch((err) => console.error(err));
|
||||||
@@ -380,6 +380,7 @@ export class NewPublicationPage implements OnInit {
|
|||||||
|
|
||||||
|
|
||||||
close() {
|
close() {
|
||||||
|
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()
|
||||||
@@ -765,38 +766,48 @@ console.log(stringGerada);
|
|||||||
return stringAleatoria;
|
return stringAleatoria;
|
||||||
}
|
}
|
||||||
|
|
||||||
async showCroppModal() {
|
async showCroppModal() {
|
||||||
const modal = await this.modalController.create({
|
|
||||||
component: CropImagePage,
|
|
||||||
componentProps: {
|
|
||||||
base64ToCroppe: this.capturedImage
|
|
||||||
},
|
|
||||||
cssClass: 'modal modal-desktop'
|
|
||||||
});
|
|
||||||
|
|
||||||
modal.onDidDismiss().then((res) => {
|
const modal = await this.modalController.create({
|
||||||
if (res) {
|
component: CropImagePage,
|
||||||
this.capturedImage = res.data
|
componentProps: {
|
||||||
this.filecontent = true;
|
base64ToCroppe: this.capturedImage
|
||||||
this.photoOrVideo = false;
|
},
|
||||||
|
cssClass: 'modal modal-desktop'
|
||||||
|
});
|
||||||
|
|
||||||
const newAttachment = new PublicationAttachmentEntity(
|
modal.onDidDismiss().then((res) => {
|
||||||
{
|
if (res) {
|
||||||
base64: res.data.base64ToCroppe,
|
this.capturedImage = res.data
|
||||||
extension: 'jpeg',
|
this.filecontent = true;
|
||||||
OriginalFileName: "image",
|
this.photoOrVideo = false;
|
||||||
FileType: 'image'
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
this.PublicationFromMvService.form.Files.push(newAttachment)
|
const newAttachment = new PublicationAttachmentEntity(
|
||||||
}
|
{
|
||||||
}, (error) => {
|
base64: res.data.base64ToCroppe,
|
||||||
console.log(error)
|
extension: 'jpeg',
|
||||||
});
|
OriginalFileName: "image",
|
||||||
|
FileType: 'image'
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
await modal.present();
|
this.PublicationFromMvService.form.Files.push(newAttachment)
|
||||||
}
|
}
|
||||||
|
}, (error) => {
|
||||||
|
console.log(error)
|
||||||
|
});
|
||||||
|
|
||||||
|
await modal.present();
|
||||||
|
|
||||||
|
// let fileObject = new PublicationAttachmentEntity({
|
||||||
|
// base64: this.removeTextBeforeSlash(this.capturedImage, ',') ,
|
||||||
|
// extension: 'jpeg',
|
||||||
|
// OriginalFileName: 'video',
|
||||||
|
// FileType: 'image'
|
||||||
|
// })
|
||||||
|
// this.PublicationFromMvService.form.Files.push(fileObject)
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -203,7 +203,7 @@ export class PublicationFromMvService {
|
|||||||
publication.DocumentId = null;
|
publication.DocumentId = null;
|
||||||
publication.ProcessId = this.folderId
|
publication.ProcessId = this.folderId
|
||||||
|
|
||||||
if(this.form.cancel == false) {
|
if(this.form.cancel == true) {
|
||||||
window['upload-header-set-remove'](this.id);
|
window['upload-header-set-remove'](this.id);
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@@ -211,7 +211,6 @@ export class PublicationFromMvService {
|
|||||||
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.httpErroHandle.httpsSucessMessagge('Criar publicação')
|
this.httpErroHandle.httpsSucessMessagge('Criar publicação')
|
||||||
} else if (this.publicationType == '2') {
|
} else if (this.publicationType == '2') {
|
||||||
|
|||||||
@@ -131,6 +131,15 @@ export class PublicationFolderService {
|
|||||||
await this.loadPublication(publicationId, folderId)
|
await this.loadPublication(publicationId, folderId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (let localPublication of this.publicationList[folderId]) {
|
||||||
|
|
||||||
|
const apiPublication = publicationIds.includes(localPublication.DocumentId)
|
||||||
|
if (!apiPublication) {
|
||||||
|
this.deletePost(folderId, localPublication.DocumentId)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
this.showLoader = false;
|
this.showLoader = false;
|
||||||
|
|
||||||
this.storage.set(folderId, this.publicationList[folderId]);
|
this.storage.set(folderId, this.publicationList[folderId]);
|
||||||
@@ -161,7 +170,7 @@ export class PublicationFolderService {
|
|||||||
|
|
||||||
if (JSON.stringify(a) != JSON.stringify(b)) {
|
if (JSON.stringify(a) != JSON.stringify(b)) {
|
||||||
|
|
||||||
// console.log({a, b})
|
console.log({a, b})
|
||||||
this.publicationList[folderId][findIndex] = publicationDetails
|
this.publicationList[folderId][findIndex] = publicationDetails
|
||||||
} else {
|
} else {
|
||||||
// console.log({publicationDetails})
|
// console.log({publicationDetails})
|
||||||
@@ -203,7 +212,7 @@ export class PublicationFolderService {
|
|||||||
if (!found) {
|
if (!found) {
|
||||||
this.publicationList[folderId].push(publicationDetails)
|
this.publicationList[folderId].push(publicationDetails)
|
||||||
this.revertPublicationOrder(folderId);
|
this.revertPublicationOrder(folderId);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return this.publicationList[folderId][findIndex]
|
return this.publicationList[folderId][findIndex]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,4 +4,4 @@ import { environment as oaprProd } from './suport/oapr'
|
|||||||
import { DevDev } from './suport/dev'
|
import { DevDev } from './suport/dev'
|
||||||
|
|
||||||
|
|
||||||
export const environment: Environment = oaprProd;
|
export const environment: Environment = DevDev;
|
||||||
|
|||||||
Reference in New Issue
Block a user