mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
fix bug
This commit is contained in:
@@ -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 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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,18 @@ 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) => {
|
|
||||||
if (res) {
|
|
||||||
this.capturedImage = res.data
|
|
||||||
this.filecontent = true;
|
|
||||||
this.photoOrVideo = false;
|
|
||||||
|
|
||||||
const newAttachment = new PublicationAttachmentEntity(
|
let fileObject = new PublicationAttachmentEntity({
|
||||||
{
|
base64: this.removeTextBeforeSlash(this.capturedImage, ',') ,
|
||||||
base64: res.data.base64ToCroppe,
|
extension: 'jpeg',
|
||||||
extension: 'jpeg',
|
OriginalFileName: 'video',
|
||||||
OriginalFileName: "image",
|
FileType: 'image'
|
||||||
FileType: 'image'
|
})
|
||||||
}
|
this.PublicationFromMvService.form.Files.push(fileObject)
|
||||||
)
|
|
||||||
|
|
||||||
this.PublicationFromMvService.form.Files.push(newAttachment)
|
}
|
||||||
}
|
|
||||||
}, (error) => {
|
|
||||||
console.log(error)
|
|
||||||
});
|
|
||||||
|
|
||||||
await modal.present();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -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})
|
||||||
|
|||||||
@@ -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