add seach button

This commit is contained in:
Peter Maquiran
2023-04-20 11:45:46 +01:00
parent 15276dfc1a
commit 47dd1b2bc8
12 changed files with 274 additions and 165 deletions
@@ -3,7 +3,43 @@
<div class="title">
<div class="thetitle"><ion-label >Todas as tarefas</ion-label></div>
<div class="theicon">
<div class="theicon d-flex">
<div>
<div title="Pesquisa" *ngIf="!hideSearchBtn" class="mr-20 d-flex align-center cursor-pointer">
<div style="padding-top: 5px;" (click)="openSearch();showSearch=true" *ngIf="!showSearch">
<ion-icon title="Perfil" *ngIf="ThemeService.currentTheme == 'doneIt' " class="font-35" src="assets/images/theme/doneIt/icons-search.svg"></ion-icon>
<ion-icon title="Perfil" *ngIf="ThemeService.currentTheme == 'default' " class="font-35" src='assets/images/icons-search.svg'></ion-icon>
<ion-icon title="Perfil" *ngIf="ThemeService.currentTheme == 'gov' " class="font-35" src='assets/images/theme/gov/icons-search.svg'></ion-icon>
</div>
<button title="Fechar" class="btn-no-color d-flex" (click)="closeSearch();showSearch=false;searchSubject=''" *ngIf="showSearch">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' || ThemeService.currentTheme == 'doneIt' " class="font-35" name="restaurant-outline" src="assets/images/icons-search-close.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="font-35" name="restaurant-outline" src="assets/images/theme/gov/icons-search-close.svg"></ion-icon>
</button>
<div *ngIf="showSearch">
<div class="d-flex search-input-container ml-10 justify-between" *ngIf="showSearch">
<!-- <div class="icon" (click)="basicSearch()">
<ion-icon class="icon-z" slot="end" name="search"></ion-icon>
</div> -->
<div class="input-text d-flex ion-align-items-center">
<ion-input (keyup.enter)="basicSearch()" [(ngModel)]='searchSubject' (ngModelChange)="dynamicSearch()"
class="search-input text-black" type="search" placeholder="Pesquisar"></ion-input>
</div>
<!-- <div class="icon" (click)="clearSearchInput()">
<ion-icon title="Limpar" *ngIf="ThemeService.currentTheme == 'default' "name="restaurant-outline" src="assets/images/icons-search-close.svg"></ion-icon>
<ion-icon title="Limpar" *ngIf="ThemeService.currentTheme == 'doneIt' "name="restaurant-outline" src="assets/images/theme/doneIt/icons-search.svg"></ion-icon>
<ion-icon title="Limpar" *ngIf="ThemeService.currentTheme == 'gov' " name="restaurant-outline" src="assets/images/theme/gov/icons-search-close.svg"></ion-icon>
</div> -->
<div (click)="basicSearch()" class="d-flex align-center icon">
<ion-icon class="icon-z" slot="end" src="assets/images/theme/gov/search.svg"></ion-icon>
</div>
</div>
</div>
</div>
</div>
<div>
<mat-form-field class="task-filter-input" appearance="none" color="ion-color-secondary" placeholder="Selecione agenda">
<mat-select [(value)]="filterName">
@@ -42,7 +78,7 @@
</div>
</ion-header>
<ion-content>
<!--
<ion-refresher name="refresher" slot="fixed" >
<ion-refresher-content
pullingIcon="chevron-down-circle-outline"
@@ -51,7 +87,7 @@
refreshingText="A actualizar...">
</ion-refresher-content>
</ion-refresher>
</ion-refresher> -->
<div class="overflow-y-auto height-100 width-100">
@@ -167,4 +167,29 @@ ion-list{
.new-task {
height: 23px;
}
}
.search-input-container{
background-color: white;
border-radius: 27.5px;
border: solid 1px #ebebeb;
font-size: 14px;
.icon{
color: #797979;
width: 41px;
height: 41px;
display: flex;
justify-content: center;
font-size: 25px;
align-items: center;
}
.input-text{
width: 100%;
}
.icon-z{
width: 20px;
}
}
@@ -1,17 +1,10 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, NavigationEnd, NavigationStart, Router } from '@angular/router';
import { ActivatedRoute, NavigationEnd, Router } from '@angular/router';
import { LoginUserRespose } from 'src/app/models/user.model';
import { ThemeService } from 'src/app/services/theme.service'
import { ExpedienteGdStore } from 'src/app/store/expedientegd-store.service';
import { DeplomasStore } from 'src/app/store/deplomas.service';
import { PendentesStore } from 'src/app/store/pendestes-store.service';
import { DespachoStore } from 'src/app/store/despacho-store.service';
import { TotalDocumentStore } from 'src/app/store/total-document.service';
import { DespachosprStore } from 'src/app/store/despachospr-store.service';
import { EventoAprovacaoStore } from 'src/app/store/eventoaprovacao-store.service';
import { PedidosStore } from 'src/app/store/pedidos-store.service';
import { SessionStore } from 'src/app/store/session.service';
import { TaskService } from 'src/app/services/task.service'
import MiniSearch from 'minisearch'
@Component({
selector: 'app-all-processes',
@@ -21,29 +14,24 @@ import { TaskService } from 'src/app/services/task.service'
export class AllProcessesPage implements OnInit {
skeletonLoader = false;
allProcessesList: any[] = [];
loggeduser: LoginUserRespose;
expedientegbstore = ExpedienteGdStore;
pendentesstore = PendentesStore;
despachoStore = DespachoStore;
eventoaprovacaostore = EventoAprovacaoStore;
pedidosstore = PedidosStore;
despachoprstore = DespachosprStore;
totalDocumentStore = TotalDocumentStore
deplomasStore = DeplomasStore
hideSearchBtn: boolean = false;
showSearch = false;
searchSubject: string = '';
filterName: 'Para hoje' | 'Novos'| 'Lidos'| 'Não lidos'| 'OverdueTasks' | 'Todos' = 'Todos'
miniSearch = new MiniSearch({
fields: ['Folio', 'Senders'], // fields to index for full-text search
idField: 'DocId'
})
constructor(
private router: Router,
public ThemeService: ThemeService,
public TaskService: TaskService,
private route: ActivatedRoute
) {
this.loggeduser = SessionStore.user;
}
) {}
ngOnInit() {
// this.updateAllProcess()
@@ -51,14 +39,32 @@ export class AllProcessesPage implements OnInit {
this.router.events.forEach((event) => {
if (event instanceof NavigationEnd && event.url.includes('/home/gabinete-digital')) {
this.refreshing();
// this.refreshing();
this.checkFilter();
}
});
setTimeout(() => {
console.log('this.TaskService.AllProcess', this.TaskService.AllProcess)
this.miniSearch.addAll(this.TaskService.AllProcess)
window['miniSearch'] = this.miniSearch
}, 5000)
this.TaskService.registerCallback({
id: import.meta.url,
funx:() => {
}
})
}
openSearch() {}
async closeSearch() {}
async basicSearch() {}
async dynamicSearch() {}
checkFilter() {
if(this.router.url.includes('ForToDay')) {
@@ -72,69 +78,6 @@ export class AllProcessesPage implements OnInit {
}
}
doRefresh(event) {
if (event) {
setTimeout(() => {
try {
event?.target?.complete();
} catch(error) {}
}, 2000);
}
setTimeout(() => {
// this.updateAllProcess();
}, 1000);
}
refreshing() {
setTimeout(() => {
// this.updateAllProcess();
}, 1000);
}
setFormatDate(start: any, end: any, allday: boolean) {
let customDate;
const totalSeconds = Math.floor((end - (start)) / 1000);;
const totalMinutes = Math.floor(totalSeconds / 60);
const totalHours = Math.floor(totalMinutes / 60);
const totalDays = Math.floor(totalHours / 24);
const hours = totalHours - (totalDays * 24);
const minutes = totalMinutes - (totalDays * 24 * 60) - (hours * 60);
const seconds = totalSeconds - (totalDays * 24 * 60 * 60) - (hours * 60 * 60) - (minutes * 60);
if (totalDays == 0) {
if (allday) {
customDate = this.getCustomDate(start) + ", " + this.getCustomHours(start) + " (todo dia)";
return customDate;
}
else {
//customDate = this.getCustomDate(start)+","+this.getCustomHours(start)+" ("+minutes+" mins)";
customDate = this.getCustomDate(start) + ", " + this.getCustomHours(start) + " | " + this.getCustomHours(end);
return customDate;
}
}
else {
customDate = this.getCustomDate(start) + "," + this.getCustomHours(start) +
" (termina:" + this.getCustomDate(end) + "," + this.getCustomHours(end) + ")";
return customDate;
}
}
getCustomDate(thedate: Date) {
return (thedate.getDay() + 1) + "/" +
(thedate.getMonth() + 1) + "/" +
thedate.getFullYear();
}
getCustomHours(thedate: Date) {
return thedate.getHours() + ":" +
thedate.getMinutes();
}
goToProcess(serialNumber: string, workflowName: string, activityName: string) {