mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 21:35:50 +00:00
fix
This commit is contained in:
@@ -13,7 +13,8 @@ import { EditActionPage } from './edit-action/edit-action.page';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
import { ThemeService } from 'src/app/services/theme.service'
|
||||
import { PermissionService } from 'src/app/services/permission.service';
|
||||
import { ActionModel } from 'src/app/models/beast-orm';
|
||||
import { Storage } from '@ionic/storage';
|
||||
// import { ActionModel } from 'src/app/models/beast-orm';
|
||||
|
||||
|
||||
@Component({
|
||||
@@ -64,6 +65,7 @@ export class PublicationsPage implements OnInit {
|
||||
private toastService: ToastService,
|
||||
public ThemeService: ThemeService,
|
||||
public p: PermissionService,
|
||||
private storage: Storage,
|
||||
|
||||
) {
|
||||
this.months = ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"];
|
||||
@@ -141,25 +143,27 @@ export class PublicationsPage implements OnInit {
|
||||
const folders: PublicationFolder[] = this.getPublicationFolderMap(res)
|
||||
|
||||
this.publicationsEventFolderList = folders.filter((e)=>e.ActionType == 'Evento')
|
||||
|
||||
await this.storage.set('actionsEvents', this.publicationsEventFolderList);
|
||||
|
||||
this.showLoader = false;
|
||||
|
||||
(async ()=> {
|
||||
// (async ()=> {
|
||||
|
||||
const created = await ActionModel.create(folders)
|
||||
const stored = await ActionModel.all()
|
||||
// const created = await ActionModel.create(folders)
|
||||
// const stored = await ActionModel.all()
|
||||
|
||||
const notPresentOnTheRequest: ActionModel[] = stored.filter(e => {
|
||||
return !folders.find(b => e.ProcessId == b.ProcessId)
|
||||
})
|
||||
// const notPresentOnTheRequest: ActionModel[] = stored.filter(e => {
|
||||
// return !folders.find(b => e.ProcessId == b.ProcessId)
|
||||
// })
|
||||
|
||||
for (let ActionModelToDelete of notPresentOnTheRequest) {
|
||||
ActionModelToDelete.delete()
|
||||
}
|
||||
// for (let ActionModelToDelete of notPresentOnTheRequest) {
|
||||
// ActionModelToDelete.delete()
|
||||
// }
|
||||
|
||||
// console.log({created, stored, folders, toDeletes})
|
||||
// // console.log({created, stored, folders, toDeletes})
|
||||
|
||||
})()
|
||||
// })()
|
||||
|
||||
|
||||
}, (error) => {
|
||||
@@ -184,9 +188,31 @@ export class PublicationsPage implements OnInit {
|
||||
|
||||
async getFromDB() {
|
||||
|
||||
const folders: PublicationFolder[] = await ActionModel.all()
|
||||
this.showLoader = false;
|
||||
this.publicationsEventFolderList = folders
|
||||
//const folders: PublicationFolder[] = await ActionModel.all()
|
||||
//this.showLoader = false;
|
||||
// this.publicationsEventFolderList = folders
|
||||
|
||||
|
||||
this.storage.get('actionsEvents').then((events = []) => {
|
||||
|
||||
if(Array.isArray(events)) {
|
||||
const folders: PublicationFolder[] = this.getPublicationFolderMap(events)
|
||||
|
||||
this.showLoader = false;
|
||||
this.publicationsEventFolderList = folders
|
||||
}
|
||||
|
||||
});
|
||||
this.storage.get('actionsViagens').then((viagens = []) => {
|
||||
|
||||
if(Array.isArray(viagens)) {
|
||||
const folders: PublicationFolder[] = this.getPublicationFolderMap(viagens)
|
||||
|
||||
this.publicationsTravelFolderList = folders
|
||||
this.showLoader = false;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user