mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-21 13:55:51 +00:00
fix publication details
This commit is contained in:
@@ -48,22 +48,22 @@
|
||||
*ngFor="let evento of publicationsEventFolderList">
|
||||
<ion-item lines="none"
|
||||
class="item cursor-pointer width-100 d-flex ion-no-border ion-no-margin ion-no-padding"
|
||||
[class.item-active]="evento.ProcessId == idSelected"
|
||||
(click)="goToPublicationsList(evento.ProcessId)">
|
||||
[class.item-active]="evento.processId == idSelected"
|
||||
(click)="goToPublicationsList(evento.processId)">
|
||||
<div class="item-icon2">
|
||||
<ion-icon class="font-40-em" *ngIf="ThemeService.currentTheme == 'default' " slot="end" src='assets/images/icons-nav-actions.svg'></ion-icon>
|
||||
<ion-icon class="font-40-em" *ngIf="ThemeService.currentTheme == 'gov' && evento.ProcessId != idSelected " slot="end" src='assets/images/theme/gov/icons-nav-actions.svg'></ion-icon>
|
||||
<ion-icon class="font-40-em" *ngIf="ThemeService.currentTheme == 'gov' && evento.ProcessId == idSelected " slot="end" src='assets/images/theme/gov/icons-nav-actions-hover.svg'></ion-icon>
|
||||
<ion-icon class="font-40-em" *ngIf="ThemeService.currentTheme == 'doneIt' && evento.ProcessId != idSelected " slot="end" src='assets/images/theme/{{ThemeService.currentTheme}}/icons-nav-actions.svg'></ion-icon>
|
||||
<ion-icon class="font-40-em" *ngIf="ThemeService.currentTheme == 'doneIt' && evento.ProcessId == idSelected " slot="end" src='assets/images/theme/{{ThemeService.currentTheme}}/icons-nav-actions-hover.svg'></ion-icon>
|
||||
<ion-icon class="font-40-em" *ngIf="ThemeService.currentTheme == 'gov' && evento.processId != idSelected " slot="end" src='assets/images/theme/gov/icons-nav-actions.svg'></ion-icon>
|
||||
<ion-icon class="font-40-em" *ngIf="ThemeService.currentTheme == 'gov' && evento.processId == idSelected " slot="end" src='assets/images/theme/gov/icons-nav-actions-hover.svg'></ion-icon>
|
||||
<ion-icon class="font-40-em" *ngIf="ThemeService.currentTheme == 'doneIt' && evento.processId != idSelected " slot="end" src='assets/images/theme/{{ThemeService.currentTheme}}/icons-nav-actions.svg'></ion-icon>
|
||||
<ion-icon class="font-40-em" *ngIf="ThemeService.currentTheme == 'doneIt' && evento.processId == idSelected " slot="end" src='assets/images/theme/{{ThemeService.currentTheme}}/icons-nav-actions-hover.svg'></ion-icon>
|
||||
</div>
|
||||
<div class="item-content flex-grow-1">
|
||||
<p class="item-content-date font-13-em" [class.item-content-date-active]="evento.ProcessId == idSelected">{{getDate(evento.DateBegin)}}</p>
|
||||
<p class="item-content-title font-15-em" [class.item-content-title-active]="evento.ProcessId == idSelected">{{evento.Description}}</p>
|
||||
<p class="item-content-date font-13-em" [class.item-content-date-active]="evento.processId == idSelected">{{getDate(evento.dateBegin)}}</p>
|
||||
<p class="item-content-title font-15-em" [class.item-content-title-active]="evento.processId == idSelected">{{evento.detail}}</p>
|
||||
</div>
|
||||
</ion-item>
|
||||
<ion-item-options class="members-options" side="end">
|
||||
<ion-item-option *ngIf="p.userPermission([p.permissionList.Actions.edit])" class="edit-option" (click)="editAction(evento.ProcessId)">
|
||||
<ion-item-option *ngIf="p.userPermission([p.permissionList.Actions.edit])" class="edit-option" (click)="editAction(evento.processId)">
|
||||
<button class="btn-no-color">
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="edit" slot="end" src="assets/images/icons-edit.svg" ></ion-icon>
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="edit" slot="end" src="assets/images/theme/gov/icons-edit.svg" ></ion-icon>
|
||||
@@ -71,7 +71,7 @@
|
||||
|
||||
</button>
|
||||
</ion-item-option>
|
||||
<ion-item-option *ngIf="p.userPermission([p.permissionList.Actions.delete])" class="delete-option" (click)="deleteAction(evento.ProcessId)">
|
||||
<ion-item-option *ngIf="p.userPermission([p.permissionList.Actions.delete])" class="delete-option" (click)="deleteAction(evento.processId)">
|
||||
<button class="btn-no-color">
|
||||
<ion-icon class="delete" name="trash-sharp"></ion-icon>
|
||||
</button>
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Router, NavigationEnd } from '@angular/router';
|
||||
import { AlertController, ModalController, NavParams } from '@ionic/angular';
|
||||
import { PublicationFolder } from 'src/app/models/publicationfolder';
|
||||
import { ModalController } from '@ionic/angular';
|
||||
import { PublicationsService } from 'src/app/services/publications.service';
|
||||
import { NewActionPage } from './new-action/new-action.page';
|
||||
import { ViewPublicationsPage } from './view-publications/view-publications.page';
|
||||
|
||||
import { AnimationController } from '@ionic/angular';
|
||||
import { Publication } from 'src/app/models/publication';
|
||||
import { ActionsOptionsPage } from 'src/app/shared/popover/actions-options/actions-options.page';
|
||||
@@ -15,15 +13,10 @@ import { ThemeService } from 'src/app/services/theme.service'
|
||||
import { PermissionService } from 'src/app/services/permission.service';
|
||||
import { Storage } from '@ionic/storage';
|
||||
import { NewPublicationPage } from './new-publication/new-publication.page';
|
||||
import { ChunkService } from 'src/app/services/stream/chunk.service'
|
||||
import { StreamService } from 'src/app/services/stream/stream.service'
|
||||
import { HttpClient, HttpHeaders, HttpEventType } from '@angular/common/http';
|
||||
import { PublicationFolderService } from 'src/app/store/publication-folder.service';
|
||||
|
||||
// import { ActionModel } from 'src/app/models/beast-orm';
|
||||
|
||||
|
||||
|
||||
import { ActionsGetAllUseCaseService } from 'src/app/core/actions/use-case/actions-get-all-use-case.service';
|
||||
import { ActionRemoteRepositoryService } from 'src/app/module/actions/data/repository/action-remote-repository.service';
|
||||
import { ActionEntity, IAction } from 'src/app/core/actions/entity/action';
|
||||
@Component({
|
||||
selector: 'app-publications',
|
||||
templateUrl: './publications.page.html',
|
||||
@@ -31,12 +24,12 @@ import { PublicationFolderService } from 'src/app/store/publication-folder.servi
|
||||
})
|
||||
export class PublicationsPage implements OnInit {
|
||||
showLoader: boolean = false
|
||||
publicationFolder: PublicationFolder;
|
||||
publicationFolder: IAction;
|
||||
publication: Publication;
|
||||
|
||||
publicationsEventFolderList: PublicationFolder[] = [];
|
||||
actionsListStorage: PublicationFolder[] = new Array();
|
||||
publicationsTravelFolderList: PublicationFolder[] = [];
|
||||
publicationsEventFolderList: IAction[] = [];
|
||||
actionsListStorage: IAction[] = new Array();
|
||||
publicationsTravelFolderList: IAction[] = [];
|
||||
|
||||
theDate: any;
|
||||
theEndDate: any;
|
||||
@@ -75,12 +68,9 @@ export class PublicationsPage implements OnInit {
|
||||
public ThemeService: ThemeService,
|
||||
public p: PermissionService,
|
||||
private storage: Storage,
|
||||
private ChunkService: ChunkService,
|
||||
private StreamService:StreamService,
|
||||
private http: HttpClient,
|
||||
public publicationFolderService: PublicationFolderService,
|
||||
|
||||
|
||||
private ActionsGetAllUseCaseService: ActionsGetAllUseCaseService,
|
||||
private actionRemoteRepository: ActionRemoteRepositoryService
|
||||
) {
|
||||
this.months = ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"];
|
||||
this.days = ["Domingo", "Segunda-feira", "Terça-feira", "Quarta-feira", "Quinta-feira", "Sexta-feira", "Sábado"];
|
||||
@@ -93,15 +83,11 @@ export class PublicationsPage implements OnInit {
|
||||
window['updateAction'] = () => {
|
||||
this.getActions()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
checkQueryParameter() {
|
||||
// var urlSearchParams = new URLSearchParams(window.location.search);
|
||||
|
||||
// var folderId = urlSearchParams.get('folderId');
|
||||
if (this.publicationFolderService.gotoAction) {
|
||||
const folderId = this.publicationFolderService.gotoAction
|
||||
this.goToPublicationsList(folderId)
|
||||
@@ -118,9 +104,8 @@ export class PublicationsPage implements OnInit {
|
||||
|
||||
this.router.events.forEach((event) => {
|
||||
if (event instanceof NavigationEnd && event.url == pathname) {
|
||||
console.log('=================', this.publicationFolderService.gotoAction)
|
||||
this.getActions();
|
||||
// this.checkQueryParameter()
|
||||
this.ActionsGetAllUseCaseService.execute();
|
||||
}
|
||||
this.intent = window['sharedContent']
|
||||
});
|
||||
@@ -187,16 +172,13 @@ export class PublicationsPage implements OnInit {
|
||||
getActions = () => {
|
||||
this.showLoader = true
|
||||
|
||||
this.publications.GetPublicationFolderList().subscribe(async res => {
|
||||
this.actionRemoteRepository.actionGetAll().then(async res => {
|
||||
this.showLoader = false;
|
||||
const folders: PublicationFolder[] = this.getPublicationFolderMap(res)
|
||||
|
||||
this.publicationsEventFolderList = folders.filter((e)=>e.ActionType == 'Evento')
|
||||
|
||||
await this.storage.set('actionsEvents', this.publicationsEventFolderList);
|
||||
|
||||
this.showLoader = false;
|
||||
|
||||
if(res.isOk()) {
|
||||
const folders: IAction[] = res.value.data.data;
|
||||
await this.storage.set('actionsEvents', this.publicationsEventFolderList);
|
||||
this.publicationsEventFolderList = folders;
|
||||
}
|
||||
}, (error) => {
|
||||
this.showLoader = false;
|
||||
this.getFromDB()
|
||||
@@ -204,89 +186,23 @@ export class PublicationsPage implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
getPublicationFolderMap(events: any):PublicationFolder[] {
|
||||
return events.map((data) : PublicationFolder => {
|
||||
return {
|
||||
ProcessId: data.ProcessId,
|
||||
Description: data.Description,
|
||||
Detail: data.Detail,
|
||||
DateBegin: data.DateBegin,
|
||||
DateEnd: data.DateEnd,
|
||||
ActionType: data.ActionType,
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async getFromDB() {
|
||||
|
||||
//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.publicationsEventFolderList = events
|
||||
}
|
||||
|
||||
});
|
||||
this.storage.get('actionsViagens').then((viagens = []) => {
|
||||
|
||||
if(Array.isArray(viagens)) {
|
||||
const folders: PublicationFolder[] = this.getPublicationFolderMap(viagens)
|
||||
|
||||
this.publicationsTravelFolderList = folders
|
||||
this.publicationsTravelFolderList = viagens
|
||||
this.showLoader = false;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
async onFileSelect(event: any) {
|
||||
|
||||
const file:File = event.target.files[0];
|
||||
|
||||
|
||||
const chunkSize = 1024 * 1024; // Adjust the chunk size as needed
|
||||
const chunks = [];
|
||||
let offset = 0;
|
||||
let i = 0;
|
||||
let j = 0;
|
||||
|
||||
function count () {
|
||||
j++
|
||||
return j
|
||||
}
|
||||
|
||||
while (offset < file.size) {
|
||||
const chunk = file.slice(offset, offset + chunkSize);
|
||||
const reader = new FileReader();
|
||||
|
||||
reader.onload = async () => {
|
||||
|
||||
const headers = new HttpHeaders()
|
||||
.append('X-File-Name', "fileName")
|
||||
.append('X-File-Extension', "mp4")
|
||||
.append('X-File-Content-Length', i.toString())
|
||||
.append('X-File-Index', count().toString());
|
||||
|
||||
const a = new Uint8Array(reader.result as ArrayBuffer)
|
||||
await this.http.post('http://localhost:3001/upload', a.buffer, { headers, responseType: 'blob' }).toPromise();
|
||||
|
||||
|
||||
};
|
||||
reader.readAsArrayBuffer(chunk);
|
||||
offset += chunkSize;
|
||||
i++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -51,43 +51,6 @@
|
||||
></app-swiper>
|
||||
</div>
|
||||
|
||||
<!-- <div *ngIf="platform.is('ios')" style="width: 322px; height: 357px;">
|
||||
<app-swiper
|
||||
[publicationList]=publication
|
||||
></app-swiper>
|
||||
</div> -->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- <swiper-container #swipers [slidechange]="onSlideChange()">
|
||||
<swiper-slide *ngFor="let files of publication.Files let k = index">
|
||||
<div >
|
||||
<img *ngIf="checkFileType.checkFileType(files.FileExtension ) == 'image'" class="post-img"
|
||||
[lazyLoad]="'data:image/jpg;base64,' + files.FileBase64">
|
||||
|
||||
<video #videoElement [appVisibility]="onVisibilityChange" *ngIf="checkFileType.checkFileType(files.FileExtension ) == 'video'" class="post-video" controls="controls" preload="none"
|
||||
playsinline webkit-playsinline="webkit-playsinline" (play)="stopvideoService.registerVideoWithEvent($event)" (click)="preventVideoPlay($event)">
|
||||
<source [src]="files.FileBase64" type="video/mp4" >
|
||||
</video>
|
||||
|
||||
</div>
|
||||
</swiper-slide>
|
||||
|
||||
</swiper-container> -->
|
||||
<!-- <div *ngIf="publication.FileExtension == 'mp4'"
|
||||
(click)="goToPublicationDetail(publication.DocumentId, publication.ProcessId)" class="post-video">
|
||||
|
||||
</div> -->
|
||||
|
||||
<!-- <div *ngIf="publication.Files.length > 2" class="dots-container">
|
||||
<span *ngFor="let files of publication.Files; let k = index"
|
||||
[class.dotsSwiper]="true"
|
||||
[class.active-dot]="swiperIndex === k"
|
||||
(click)="goToSlide(k)">
|
||||
</span>
|
||||
</div> -->
|
||||
|
||||
<div (click)="goToPublicationDetail(publication.DocumentId, publication.ProcessId)" class="post-content" >
|
||||
<div class="post-title-time">
|
||||
|
||||
@@ -11,14 +11,10 @@ import { BackgroundService } from 'src/app/services/background.service';
|
||||
import { ThemeService } from 'src/app/services/theme.service'
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
import { PermissionService } from 'src/app/services/permission.service';
|
||||
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
|
||||
import { Storage } from '@ionic/storage';
|
||||
import { PublicationFolderService } from 'src/app/store/publication-folder.service';
|
||||
// import { CapacitorVideoPlayer } from 'capacitor-video-player';
|
||||
import { checkFileTypeService } from 'src/app/services/checkFileType.service';
|
||||
import { PublicationVideoManagerService } from "src/app/services/publication/publication-video-manager.service"
|
||||
import { StopvideoService } from "src/app/services/stopvideo.service"
|
||||
import { Result } from 'neverthrow';
|
||||
import { App } from '@capacitor/app';
|
||||
import { ActiveTabService } from 'src/app/services/active-tab.service';
|
||||
import { PublicationHolderService } from 'src/app/services/publication/publication-holder.service'
|
||||
@@ -29,7 +25,7 @@ import { PublicationHolderService } from 'src/app/services/publication/publicati
|
||||
styleUrls: ['./view-publications.page.scss'],
|
||||
})
|
||||
export class ViewPublicationsPage implements OnInit {
|
||||
showLoader = true;
|
||||
showLoader = false;
|
||||
loading: any;
|
||||
|
||||
|
||||
@@ -80,26 +76,13 @@ export class ViewPublicationsPage implements OnInit {
|
||||
public activeTabService: ActiveTabService,
|
||||
public PublicationHolderService: PublicationHolderService) {
|
||||
|
||||
|
||||
/* this.publicationVideoManagerService.setContainer(this.VideoManager.nativeElement) */
|
||||
|
||||
|
||||
setTimeout(() => {
|
||||
|
||||
console.log(this.VideoManager.nativeElement)
|
||||
}, 2000)
|
||||
|
||||
this.createPublicationList()
|
||||
|
||||
this.getFromDB();
|
||||
|
||||
this.activatedRoute.paramMap.subscribe(params => {
|
||||
|
||||
if (params["params"]) {
|
||||
this.folderId = params["params"].folderId;
|
||||
//
|
||||
}
|
||||
|
||||
window['app-view-publications-page-doRefresh'] = this.doRefresh
|
||||
});
|
||||
}
|
||||
@@ -111,29 +94,12 @@ export class ViewPublicationsPage implements OnInit {
|
||||
}
|
||||
|
||||
this.createPublicationList()
|
||||
|
||||
this.getFromDB();
|
||||
//this.testForkJoin()
|
||||
this.getPublicationDetail();
|
||||
this.getPublicationsIds();
|
||||
/* setTimeout(() => {
|
||||
this.getPublications();
|
||||
}, 1000); */
|
||||
|
||||
this.backgroundservice.registerBackService('Online', () => {
|
||||
this.getPublicationDetail();
|
||||
//this.testForkJoin()
|
||||
|
||||
})
|
||||
|
||||
// console.log(this.publicationFolderService.publicationList[this.folderId])
|
||||
|
||||
setTimeout(()=> {
|
||||
|
||||
// this.doRefresh({})
|
||||
|
||||
}, 1500)
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -153,7 +119,6 @@ export class ViewPublicationsPage implements OnInit {
|
||||
video.pause();
|
||||
})
|
||||
|
||||
|
||||
this.videoElements.forEach(videoElement => {
|
||||
// You can access the native HTML video element using videoElement.nativeElement
|
||||
const video: HTMLVideoElement = videoElement.nativeElement;
|
||||
@@ -174,12 +139,10 @@ export class ViewPublicationsPage implements OnInit {
|
||||
}
|
||||
|
||||
this.createPublicationList()
|
||||
|
||||
this.getFromDB();
|
||||
}
|
||||
|
||||
createPublicationList(folderId = this.folderId) {
|
||||
console.log('create')
|
||||
if (!this.publicationFolderService.publicationList[folderId]) {
|
||||
this.publicationFolderService.publicationList[folderId] = []
|
||||
}
|
||||
@@ -192,7 +155,6 @@ export class ViewPublicationsPage implements OnInit {
|
||||
//setTimeout(() => {
|
||||
//this.testForkJoin()
|
||||
this.getPublicationDetail();
|
||||
this.getPublicationsIds();
|
||||
try {
|
||||
event?.target?.complete();
|
||||
} catch (error) { }
|
||||
@@ -215,10 +177,12 @@ export class ViewPublicationsPage implements OnInit {
|
||||
}
|
||||
|
||||
getPublicationDetail() {
|
||||
this.showLoader = true;
|
||||
const folderId = this.folderId
|
||||
this.publications.GetPresidentialAction(folderId).subscribe(res => {
|
||||
this.publicationFolderService.FolderDetails[folderId] = res
|
||||
this.storage.set(folderId + "name", res)
|
||||
this.showLoader = false;
|
||||
}, (error) => {
|
||||
this.showLoader = false;
|
||||
// this.httpErroHandle.httpStatusHandle(error)
|
||||
@@ -230,26 +194,6 @@ export class ViewPublicationsPage implements OnInit {
|
||||
this.publicationFolderService.getFromDB(folderId)
|
||||
}
|
||||
|
||||
async getPublicationsIds() {
|
||||
|
||||
this.showLoader = true;
|
||||
const folderId = this.folderId
|
||||
|
||||
await this.publicationFolderService.getPublicationsIds(folderId)
|
||||
|
||||
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 AddPublication(publicationType: any, folderId: any) {
|
||||
|
||||
@@ -307,10 +251,6 @@ export class ViewPublicationsPage implements OnInit {
|
||||
// backdropDismiss: false
|
||||
});
|
||||
|
||||
modal.onDidDismiss().then(() => {
|
||||
this.getPublicationsIds();
|
||||
});
|
||||
|
||||
await modal.present();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user