pull made

This commit is contained in:
Eudes Inácio
2023-07-16 22:17:23 +01:00
25 changed files with 135 additions and 236 deletions
@@ -18,7 +18,7 @@
</ion-toolbar>
<ion-toolbar class="toolbar-search">
<div class="search">
<ion-searchbar debounce="500" (ionChange)="onChange($event)" placeholder="Pesquisar por contacto" ></ion-searchbar>
<ion-searchbar search-icon="undefined" debounce="500" (ionChange)="onChange($event)" placeholder="Pesquisar por contacto" ></ion-searchbar>
</div>
</ion-toolbar>
</ion-header>
@@ -18,7 +18,7 @@
</ion-toolbar>
<ion-toolbar class="toolbar-search">
<div class="search">
<ion-searchbar debounce="500" (ionChange)="onChange($event)" placeholder="Pesquisar por contacto" ></ion-searchbar>
<ion-searchbar search-icon="undefined" debounce="500" (ionChange)="onChange($event)" placeholder="Pesquisar por contacto" ></ion-searchbar>
</div>
</ion-toolbar>
</ion-header>
@@ -18,7 +18,7 @@
</ion-toolbar>
<ion-toolbar class="toolbar-search">
<div class="search">
<ion-searchbar (ionChange)="onChange($event)" placeholder="Pesquisar por contacto" ></ion-searchbar>
<ion-searchbar search-icon="undefined" (ionChange)="onChange($event)" placeholder="Pesquisar por contacto" ></ion-searchbar>
</div>
</ion-toolbar>
</ion-header>
@@ -2,7 +2,7 @@
<ion-toolbar class="px-10">
<ion-title class="pa-0">Adicionar intervenientes</ion-title>
</ion-toolbar>
<ion-searchbar class="attendee-search-bar" (ionChange)="onChange($event)" placeholder="Insira email para adicionar destinatário"></ion-searchbar><!-- [(ngModel)]="searchCountryString" -->
<ion-searchbar search-icon="undefined" class="attendee-search-bar" (ionChange)="onChange($event)" placeholder="Insira email para adicionar destinatário"></ion-searchbar><!-- [(ngModel)]="searchCountryString" -->
<ion-progress-bar type="indeterminate" *ngIf="showLoader"></ion-progress-bar>
</ion-header>
@@ -93,20 +93,21 @@
<ion-list class="width-100 height-100" >
<div class="overflow-y-auto height-100">
<ion-item-sliding>
<ion-item class="Rectangle cursor-pointer " lines="none"
*ngFor="let event of eventoaprovacaostore.get(segment)" (click)="goToEventToApproveDetail(event.serialNumber)">
<div class="content-{{color}}-{{event.workflowInstanceDataFields.Agenda}} width-100 d-flex overflow-hidden">
<div class="approve-event-time">
<p>{{event.workflowInstanceDataFields.StartDate | date: 'HH:mm'}}</p>
<p>{{event.workflowInstanceDataFields.EndDate | date: 'HH:mm'}}</p>
</div>
<div class="approve-event-detail">
<p *ngIf="event.workflowInstanceDataFields.StartDate != event.workflowInstanceDataFields.EndDate">{{event.workflowInstanceDataFields.StartDate | date: 'd/M/yy' }} - {{ event.workflowInstanceDataFields.EndDate | date: 'dd/M/yy'}} | {{event.workflowInstanceDataFields.Location}}</p>
<p *ngIf="event.workflowInstanceDataFields.StartDate == event.workflowInstanceDataFields.EndDate">{{event.workflowInstanceDataFields.StartDate | date: 'd/M/yy' }} | {{event.workflowInstanceDataFields.Location}}</p>
<h3>{{event.workflowInstanceDataFields.Subject}}</h3>
<div *ngIf="event.activityInstanceName">
<div class="label-event-type font-13-rem"> {{ event.activityInstanceName }} </div>
<ion-item class="cursor-pointer " lines="none"
*ngFor="let event of list" (click)="goToEventToApproveDetail(event.serialNumber)">
<div *ngIf="TaskService.filter(event, filterName)" class="Rectangle ">
<div class="fix-temp content-{{color}}-{{event.workflowInstanceDataFields.Agenda}} width-100 d-flex overflow-hidden">
<div class="approve-event-time">
<p>{{event.workflowInstanceDataFields.StartDate | date: 'HH:mm'}}</p>
<p>{{event.workflowInstanceDataFields.EndDate | date: 'HH:mm'}}</p>
</div>
<div class="approve-event-detail">
<p *ngIf="event.workflowInstanceDataFields.StartDate != event.workflowInstanceDataFields.EndDate">{{event.workflowInstanceDataFields.StartDate | date: 'd/M/yy' }} - {{ event.workflowInstanceDataFields.EndDate | date: 'dd/M/yy'}} | {{event.workflowInstanceDataFields.Location}}</p>
<p *ngIf="event.workflowInstanceDataFields.StartDate == event.workflowInstanceDataFields.EndDate">{{event.workflowInstanceDataFields.StartDate | date: 'd/M/yy' }} | {{event.workflowInstanceDataFields.Location}}</p>
<h3>{{event.workflowInstanceDataFields.Subject}}</h3>
<div *ngIf="event.activityInstanceName">
<div class="label-event-type font-13-rem"> {{ event.activityInstanceName }} </div>
</div>
</div>
</div>
</div>
@@ -120,7 +121,7 @@
<div class="height-100" >
<div class="d-flex height-100 align-center justify-content-center" >
<div
*ngIf="!skeletonLoader && (eventoaprovacaostore.get(segment).length == 0)"
*ngIf="!skeletonLoader && (list.length == 0)"
class="empty-list d-flex height-100 align-center justify-content-center"
>
<span>Lista vazia</span>
@@ -49,7 +49,9 @@ ion-item-sliding{
padding: 10px;
margin-bottom: 10px;
overflow: auto;
width: 100%;
}
.content-pr-Oficial{
background-color: var(--white);
border-radius: 5px;
@@ -6,7 +6,7 @@ import { ModalController } from '@ionic/angular';
import { ApproveEventModalPage } from './approve-event-modal/approve-event-modal.page';
import { NavigationStart, Router } from '@angular/router';
import { EventoAprovacaoStore } from 'src/app/store/eventoaprovacao-store.service';
import { TaskService } from 'src/app/services/task.service'
import { BackgroundService } from '../../../services/background.service';
import { SortService } from 'src/app/services/functions/sort.service';
import { ThemeService } from 'src/app/services/theme.service'
@@ -26,8 +26,6 @@ export class EventListPage implements OnInit {
profile: string;
segment: any;
showLoader: boolean;
eventsPRList: any = [];
eventsMDGPRList: any = [];
eventPerson: EventPerson;
eventBody: EventBody;
categories: string[];
@@ -35,7 +33,6 @@ export class EventListPage implements OnInit {
skeletonLoader = true
eventoaprovacaostore = EventoAprovacaoStore;
eventsList: any = []
color: 'pr' | 'mdgpr'
environment = environment
filterName: 'Para hoje' | 'Novos'| 'Lidos'| 'Não lidos'| 'OverdueTasks' | 'Todos' = 'Todos'
@@ -46,6 +43,10 @@ export class EventListPage implements OnInit {
list = []
ordinance: string = 'old'
listSubscription : {
delete(): void;
}
constructor(
private processes: ProcessesService,
private modalController: ModalController,
@@ -55,6 +56,7 @@ export class EventListPage implements OnInit {
public ThemeService: ThemeService,
private RouteService: RouteService,
public eventService: EventsService,
public TaskService: TaskService,
) { }
ngOnInit() {
@@ -80,6 +82,15 @@ export class EventListPage implements OnInit {
}
})
this.listSubscription = this.eventoaprovacaostore.registerCallback({
id: import.meta.url,
funx:() => {
this.dynamicSearch()
}
})
const location = window.location
@@ -110,6 +121,12 @@ export class EventListPage implements OnInit {
}
ngOnDestroy() {
this.listSubscription.delete()
}
ngAfterViewInit(): void {
@@ -119,7 +136,27 @@ export class EventListPage implements OnInit {
this.ordinance = orderBy;
// this.dynamicSearch();
this.dynamicSearch();
}
async dynamicSearch() {
if(this.showSearch && this.searchSubject) {
const list = this.eventoaprovacaostore.get(this.segment).filter((task) => {
let subject = task.Folio || task.Subject || task.workflowInstanceDataFields.Subject
subject = subject.toLowerCase();
return subject.includes(this.searchSubject.toLowerCase())
})
this.list = this.TaskService.reorderList(this.ordinance, list)
} else {
const list = this.eventoaprovacaostore.get(this.segment)
this.list = this.TaskService.reorderList(this.ordinance, list)
}
}
@@ -141,30 +178,33 @@ export class EventListPage implements OnInit {
this.color = 'mdgpr'
}
let eventsList
let genericEvents = await this.processes.eventsToApprove(SessionStore.user.UserId,'mobile agenda').toPromise()
try {
this.eventsList = this.sortService.sortArrayByDate(genericEvents).reverse();
eventsList = this.sortService.sortArrayByDate(genericEvents).reverse();
} catch (error) {
this.skeletonLoader = false
this.eventsList = [];
eventsList = [];
}
this.eventoaprovacaostore.save(segment, this.eventsList)
this.eventoaprovacaostore.save(segment, eventsList as any)
this.dynamicSearch()
} else if(segment) {
this.color = 'pr'
let eventsList = []
let allEvents = await this.processes.eventsToApprove(segment,'mobile agenda').toPromise()
try {
this.eventsList = this.sortService.sortArrayByDate(allEvents).reverse();
eventsList = this.sortService.sortArrayByDate(allEvents).reverse();
} catch(error) {
this.skeletonLoader = false
this.eventsList = []
eventsList = []
}
this.eventsList = this.eventsList
this.showLoader = false;
this.eventoaprovacaostore.save(segment, this.eventsList)
this.eventoaprovacaostore.save(segment, eventsList)
this.dynamicSearch()
}
this.showLoader = false;
@@ -161,6 +161,7 @@ export class BookMeetingModalPage implements OnInit {
}]
}
this.changeAgenda();
}
ngOnInit() {
@@ -319,11 +320,12 @@ export class BookMeetingModalPage implements OnInit {
}
else if(this.task.FsId == '361') {
console.log('361')
const loader = this.toastService.loading()
try {
const CalendarId = this.selectedCalendarId()
console.log({CalendarId})
await this.calendarService.genericCreateTaskEvent(this.task.FolderID | this.task.FolderId, this.postData, "",this.task.SerialNumber, this.task.FsId, CalendarId).toPromise();
this.close();
@@ -112,6 +112,7 @@ export class GabineteDigitalPage implements OnInit {
window.onresize = (event) => {
if (window.innerWidth < 701) {
this.modalController.dismiss();
this.hideRefreshBtn = false;
this.hideInMobile = false;
this.segmentVista = "listview";
@@ -197,6 +198,14 @@ export class GabineteDigitalPage implements OnInit {
this.hideRefreshButton();
}
ngAfterViewInit(): void {
// We can access the TestComponent now that this portion of the view tree has been initiated.
const element = this.scroll.nativeElement
this.scroll.nativeElement.addEventListener("scroll", (e)=> {
this.changeTab()
});
(async () => {
@@ -236,15 +245,6 @@ export class GabineteDigitalPage implements OnInit {
}
});
}
ngAfterViewInit(): void {
// We can access the TestComponent now that this portion of the view tree has been initiated.
this.scroll.nativeElement.addEventListener("scroll", (e)=> {
this.changeTab()
});
}
@@ -1,148 +0,0 @@
import { Component, OnInit } from '@angular/core';
import { AnimationController, ModalController, NavParams } from '@ionic/angular';
import { Publication } from 'src/app/models/publication';
import { PublicationsService } from 'src/app/services/publications.service';
import { ToastService } from 'src/app/services/toast.service';
import { ImageModalPage } from '../gallery/image-modal/image-modal.page';
import { NewPublicationPage } from '../new-publication/new-publication.page';
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 { RouteService } from 'src/app/services/route.service';
import { PermissionService } from 'src/app/services/permission.service';
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
@Component({
selector: 'app-publication-detail',
templateUrl: './publication-detail.page.html',
styleUrls: ['./publication-detail.page.scss'],
})
export class PublicationDetailPage implements OnInit {
showLoader: boolean;
publicationId: string;
folderId: string;
publication: Publication;
constructor(
private modalController: ModalController,
private navParams:NavParams,
private publications:PublicationsService,
private toastService: ToastService,
private RouteService: RouteService,
public ThemeService: ThemeService,
public p:PermissionService,
private httpErrorHandle: HttpErrorHandle ) {
this.publicationId = this.navParams.get('publicationId');
/* this.folderId = this.navParams.get('folderIdId'); */
this.publication = {
DateIndex: null,
DocumentId: null,
ProcessId:'',
Title:'',
Message: '',
/* image: null, */
DatePublication: null,
FileBase64: '',
OriginalFileName: '',
FileExtension: '',
};
}
ngOnInit() {
this.getPublicationDetail();
}
doRefresh(event) {
this.getPublicationDetail();
setTimeout(() => {
try {
event?.target?.complete();
} catch(error) {}
}, 2000);
}
getPublicationDetail() {
this.showLoader = true;
this.publications.GetPublicationById(this.publicationId).subscribe(res=>{
/* this.publication = res; */
this.publication = {
DateIndex: res.DateIndex,
DocumentId: res.DocumentId,
ProcessId:res.ProcessId,
Title:res.Title,
Message: res.Message,
DatePublication: res.DatePublication,
FileBase64: "data:image/jpg;base64," + res.FileBase64,
OriginalFileName: res.OriginalFileName,
FileExtension: 'jpeg',
}
this.showLoader = false;
});
}
getFromDB() {
}
close() {
this.RouteService.goBack()
}
async deletePost() {
const loader = this.toastService.loading()
try {
await this.publications.DeletePublication(this.folderId, this.publicationId).toPromise();
this.httpErrorHandle.httpsSucessMessagge('Eliminar publicação')
if(window['app-view-publications-page-doRefresh']) {
window['app-view-publications-page-doRefresh']()
}
this.close();
} catch (error) {
this.httpErrorHandle.httpStatusHandle(error)
} finally {
loader.remove()
}
}
async editPost(publicationType:any) {
const modal = await this.modalController.create({
component: NewPublicationPage,
componentProps:{
publicationType: publicationType,
publication: this.publication,
},
cssClass: 'new-publication modal modal-desktop',
backdropDismiss: false
});
modal.onDidDismiss().then(()=>{
setTimeout(() => {
this.getPublicationDetail();
}, 5000);
});
await modal.present();
}
openPreview(imageUrl:string){
this.modalController.create({
component: ImageModalPage,
componentProps: {
imageUrl:imageUrl,
}
}).then(modal => modal.present());
}
}