mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
Improve
This commit is contained in:
@@ -69,7 +69,7 @@ export class ViewPublicationsPage implements OnInit {
|
||||
this.getPublicationDetail();
|
||||
setTimeout(() => {
|
||||
this.getPublications();
|
||||
}, 5000);
|
||||
}, 1000);
|
||||
|
||||
this.backgroundservice.registerBackService('Online',() => {
|
||||
this.getPublicationDetail();
|
||||
@@ -110,23 +110,28 @@ export class ViewPublicationsPage implements OnInit {
|
||||
getPublicationDetail() {
|
||||
|
||||
setTimeout(() => {
|
||||
|
||||
let allActions = this.publicationEventFolderStorage.list.concat(this.publicationTravelFolderService.list)
|
||||
this.item = allActions.find((e) => e.ProcessId == this.folderId);
|
||||
this.publicationDitails = this.item
|
||||
console.log('item', this.item)
|
||||
|
||||
}, 100);
|
||||
|
||||
}
|
||||
|
||||
getPublications() {
|
||||
|
||||
this.showLoader = true;
|
||||
const folderId = this.folderId
|
||||
|
||||
alert('get 2')
|
||||
this.publications.GetPublications(this.folderId).subscribe(res => {
|
||||
alert('get 2 resppose')
|
||||
console.log(this.folderId)
|
||||
|
||||
this.publicationList = new Array();
|
||||
|
||||
|
||||
res.forEach(element => {
|
||||
console.log('getPublications', element)
|
||||
let item: Publication = this.publicationPipe.itemList(element)
|
||||
@@ -134,26 +139,23 @@ export class ViewPublicationsPage implements OnInit {
|
||||
});
|
||||
this.sqliteservice.updateactions(this.folderId, JSON.stringify(this.publicationList));
|
||||
|
||||
|
||||
this.publicationListStorage.add(folderId, this.publicationList)
|
||||
this.getpublication = this.publicationList;
|
||||
|
||||
this.showLoader = false;
|
||||
},
|
||||
(error) => {
|
||||
if(error.status == '0') {
|
||||
this.getFromDB();
|
||||
}
|
||||
if (error.status == '404') {
|
||||
this.error = 'Sem publicações disponíveis!';
|
||||
this.publicationList = [];
|
||||
this.publicationListStorage.add(folderId, this.publicationList)
|
||||
}
|
||||
|
||||
this.showLoader = false;
|
||||
|
||||
});
|
||||
}, (error) => {
|
||||
|
||||
alert('error')
|
||||
if(error.status == '0') {
|
||||
this.getFromDB();
|
||||
}
|
||||
if (error.status == '404') {
|
||||
this.error = 'Sem publicações disponíveis!';
|
||||
this.publicationList = [];
|
||||
this.publicationListStorage.add(folderId, this.publicationList)
|
||||
}
|
||||
this.showLoader = false;
|
||||
});
|
||||
}
|
||||
|
||||
getFromDB() {
|
||||
|
||||
@@ -207,15 +207,18 @@ export class SqliteService {
|
||||
|
||||
//updateActions
|
||||
public updateactions(id, data) {
|
||||
console.log("update action data", data)
|
||||
this.dbInstance.executeSql(`
|
||||
UPDATE ${this.actions} SET publications = ? WHERE ProcessId = ${id}`, [data])
|
||||
.then(() => {
|
||||
console.log("action update with Success");
|
||||
try {
|
||||
console.log("update action data", data)
|
||||
this.dbInstance.executeSql(`
|
||||
UPDATE ${this.actions} SET publications = ? WHERE ProcessId = ${id}`, [data])
|
||||
.then(() => {
|
||||
console.log("action update with Success");
|
||||
|
||||
}, (e) => {
|
||||
console.log(JSON.stringify(e.err));
|
||||
});
|
||||
} catch(error) {}
|
||||
|
||||
}, (e) => {
|
||||
console.log(JSON.stringify(e.err));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
|
||||
|
||||
<ion-header class="ion-no-border">
|
||||
<div class="main-header">
|
||||
<div class="title-content d-flex flex-end">
|
||||
<!-- <div class="back-icon" (click)="goBack()">
|
||||
<ion-icon slot="end" src='assets/images/icons-arrow-arrow-left.svg'></ion-icon>
|
||||
</div> -->
|
||||
<div class="div-title flex-grow-1">
|
||||
<div *ngIf="item" class="div-title flex-grow-1">
|
||||
<ion-label class="title">{{item.Description}}</ion-label>
|
||||
<p class="item-content-detail">{{item.Detail}}</p>
|
||||
<p class="item-content-date">{{ item.DateBegin | date: 'dd-MM-yy | HH:mm'}}</p>
|
||||
|
||||
@@ -4,7 +4,7 @@ import { Publication } from 'src/app/models/publication';
|
||||
import { PublicationFolder } from 'src/app/models/publicationfolder';
|
||||
import { LoadingService } from 'src/app/services/loading.service';
|
||||
import { PublicationsService } from 'src/app/services/publications.service';
|
||||
import { PublicationDetailPage } from 'src/app/pages/publications/publication-detail/publication-detail.page';
|
||||
|
||||
import { NewPublicationPage } from 'src/app/pages/publications/new-publication/new-publication.page';
|
||||
import { PublicationListStorage } from 'src/app/store/publication-list.service'
|
||||
import { PublicationEventFolderStorage } from 'src/app/store/publication-event-folder.service';
|
||||
|
||||
@@ -24,11 +24,11 @@ export class PublicationEventFolderService {
|
||||
}
|
||||
|
||||
get list() {
|
||||
return this._list
|
||||
return this._list || []
|
||||
}
|
||||
|
||||
reset(list: PublicationFolder[]) {
|
||||
this._list = list
|
||||
this._list = list || []
|
||||
|
||||
this.save()
|
||||
}
|
||||
@@ -36,7 +36,7 @@ export class PublicationEventFolderService {
|
||||
private save() {
|
||||
setTimeout(()=> {
|
||||
localstoreService.set(this.keyName, {
|
||||
list: this._list
|
||||
list: this._list || []
|
||||
})
|
||||
}, 10)
|
||||
}
|
||||
|
||||
@@ -796,6 +796,7 @@ body {
|
||||
}
|
||||
}
|
||||
|
||||
// blue
|
||||
.default {
|
||||
--login-label-text: #fff;
|
||||
--chat-alert-msg-color: #fef4c5;
|
||||
|
||||
Reference in New Issue
Block a user