This commit is contained in:
Peter Maquiran
2022-01-28 16:30:30 +01:00
7 changed files with 134 additions and 51 deletions
@@ -49,7 +49,7 @@
</ion-refresher-content>
</ion-refresher> -->
<div (click)="handleClick()" class="messages" #scrollMe>
<div class="messages-list-item-wrapper container-width-100" *ngFor="let msg of wsChatMethodsService.getDmRoom(this.roomId).massages; let last = last" [class.messages-list-item-wrapper-active]="msg._id == selectedMsgId" >
<div class="messages-list-item-wrapper container-width-100" *ngFor="let msg of wsChatMethodsService.getDmRoom(this.roomId).messages; let last = last" [class.messages-list-item-wrapper-active]="msg._id == selectedMsgId" >
<div (press)="handlePress(msg._id)" class='message-container incoming-{{msg.u.username!=loggedUser.me.username}}' (click)="downloadFileMsg(msg)" *ngIf="msg.msg !=''">
<div class="title">
<ion-label>{{msg.u.name}}</ion-label>
+70 -12
View File
@@ -16,6 +16,7 @@ import { PublicationTravelFolderStore } from 'src/app/store/publication-travel-f
import { SqliteService } from 'src/app/services/sqlite.service';
import { BackgroundService } from 'src/app/services/background.service';
import { ThemeService } from 'src/app/services/theme.service'
import { Storage } from '@ionic/storage';
@Component({
@@ -59,7 +60,7 @@ export class PublicationsPage implements OnInit {
hideRefreshBtn = true;
showSlidingOptions = true;
idSelected: string;
skeletonLoader:boolean;
skeletonLoader: boolean;
constructor(
private router: Router,
@@ -71,6 +72,7 @@ export class PublicationsPage implements OnInit {
private backgroundservice: BackgroundService,
private platform: Platform,
public ThemeService: ThemeService,
private storage: Storage
) {
this.months = ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"];
@@ -85,13 +87,15 @@ export class PublicationsPage implements OnInit {
this.router.events.forEach((event) => {
if (event instanceof NavigationEnd && event.url == pathname) {
this.getActions();
}
});
this.hideRefreshButton();
this.backgroundservice.registerBackService('Online', () => {
/* this.backgroundservice.registerBackService('Online', () => {
this.getActions();
})
}) */
}
@@ -143,12 +147,13 @@ export class PublicationsPage implements OnInit {
getActions() {
this.showLoader = true;
this.skeletonLoader = true;
this.publications.GetPublicationFolderList().subscribe(res => {
this.getFromDB()
this.publications.GetPublicationFolderList().subscribe(async res => {
console.log('accoes', res)
this.publicationsEventFolderList = new Array();
this.publicationsTravelFolderList = new Array();
let publicationsEventFolderList = new Array();
let publicationsTravelFolderList = new Array();
res.forEach(data => {
let folder: PublicationFolder = {
@@ -164,22 +169,41 @@ export class PublicationsPage implements OnInit {
if (data.ActionType == "Evento") {
console.log('Evento', folder)
this.publicationsEventFolderList.push(folder);
publicationsEventFolderList.push(folder);
}
else {
console.log('Viagem', folder)
this.publicationsTravelFolderList.push(folder);
publicationsTravelFolderList.push(folder);
}
this.showLoader = false;
});
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
await this.storage.set('actionsEvents', publicationsEventFolderList);
await this.storage.set('actionsViagens', publicationsTravelFolderList);
this.getFromDB()
} else {
this.getFromDB()
}
}, (error) => {
this.showLoader = false;
}/* , (error) => {
this.getFromDB();
});
} */);
this.skeletonLoader = false;
}
addActionToStorage(events, viagens) {
console.log('actionsWEBDB', events, viagens)
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
this.storage.set('actionsEvents', events);
this.storage.set('actionsViagens', viagens);
}
}
addActionToDB(folder) {
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
} else {
@@ -190,6 +214,40 @@ export class PublicationsPage implements OnInit {
getFromDB() {
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
this.publicationsEventFolderList = new Array();
this.publicationsTravelFolderList = new Array();
this.storage.get('actionsEvents').then((events) => {
console.log('actionsEvents', events)
events.forEach(data => {
let folder: PublicationFolder = {
ProcessId: data.ProcessId,
Description: data.Description,
Detail: data.Detail,
DateBegin: data.DateBegin,
DateEnd: data.DateEnd,
ActionType: data.ActionType,
}
this.publicationsEventFolderList.push(folder);
this.showLoader = false;
});
});
this.storage.get('actionsViagens').then((viagens) => {
console.log('actionsViagens', viagens)
viagens.forEach(data => {
let folder: PublicationFolder = {
ProcessId: data.ProcessId,
Description: data.Description,
Detail: data.Detail,
DateBegin: data.DateBegin,
DateEnd: data.DateEnd,
ActionType: data.ActionType,
}
this.publicationsTravelFolderList.push(folder);
this.showLoader = false;
});
});
} else {
this.sqliteservice.getAllActions().then((actions: any[]) => {
@@ -379,7 +437,7 @@ export class PublicationsPage implements OnInit {
this.desktopComponent.showAddNewPublication = true;
}
async editPublication(foolderId:string){
async editPublication(foolderId: string) {
this.closeDesktopComponent();
this.desktopComponent.showEditActions = true;
}