add search

This commit is contained in:
Peter Maquiran
2023-05-04 09:48:04 +01:00
parent bd8b3c3501
commit 9208b055f2
41 changed files with 957 additions and 98 deletions
@@ -59,7 +59,10 @@ export class DespachosPrPage implements OnInit {
SessionStore = SessionStore
environment = environment
filterName: 'Para hoje' | 'Novos'| 'Lidos'| 'Não lidos'| 'OverdueTasks' | 'Todos' = 'Todos'
showSearch = false
searchSubject = ''
list = []
constructor(
private processes: ProcessesService,
private modalController: ModalController,
@@ -99,8 +102,25 @@ export class DespachosPrPage implements OnInit {
this.backgroundservice.registerBackService('Online', () => {
this.LoadList()
});
this.dynamicSearch()
}
async dynamicSearch() {
if(this.showSearch && this.searchSubject) {
this.list = this.TaskService.despachoStore.list.filter((task) => {
let subject = task.Folio || task.Subject || task.workflowInstanceDataFields.Subject
subject = subject.toLowerCase();
return subject.includes(this.searchSubject.toLowerCase())
})
} else {
this.list = this.TaskService.AllProcess
}
}
segmentChanged(ev: any) {
this.LoadList();
@@ -10,6 +10,43 @@
<div class="title flex-1"><ion-label >Despachos</ion-label></div>
<div class="theicon btn-refresh">
<div>
<div title="Pesquisa" *ngIf="!hideSearchBtn" class="mr-20 d-flex align-center cursor-pointer">
<div (click)="openSearch();showSearch=true" *ngIf="!showSearch" class="d-flex">
<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>
<mat-form-field class="task-filter-input" appearance="none" color="ion-color-secondary" placeholder="Selecione agenda">
<mat-select [(value)]="filterName">
@@ -238,4 +238,26 @@ ion-item{
.label-deadline {
}
}
.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;
}
}
@@ -19,6 +19,10 @@ export class DespachosPage implements OnInit {
despachoStore = DespachoStore;
filterName: 'Para hoje' | 'Novos'| 'Lidos'| 'Não lidos'| 'OverdueTasks' | 'Todos' = 'Todos'
showSearch = false
searchSubject = ''
list = []
hideSearchBtn: boolean = false;
constructor(
private router: Router,
@@ -51,8 +55,40 @@ export class DespachosPage implements OnInit {
this.LoadList();
});
this.dynamicSearch()
}
async dynamicSearch() {
if(this.showSearch && this.searchSubject) {
this.list = this.TaskService.despachoStore.list.filter((task) => {
let subject = task.Folio || task.Subject || task.workflowInstanceDataFields.Subject
subject = subject.toLowerCase();
return subject.includes(this.searchSubject.toLowerCase())
})
} else {
this.list = this.TaskService.AllProcess
}
}
openSearch() {
this.dynamicSearch()
}
async closeSearch() {
this.searchSubject = ''
this.dynamicSearch()
}
async basicSearch() {
this.dynamicSearch()
}
async refreshing() {
setTimeout(() => {
this.LoadList();
@@ -29,7 +29,9 @@ export class DiplomasAssinarPage implements OnInit {
skeletonLoader = true
deplomasStore = DeplomasStore
filterName: 'Para hoje' | 'Novos'| 'Lidos'| 'Não lidos'| 'OverdueTasks' | 'Todos' = 'Todos'
showSearch = false
searchSubject = ''
list = []
constructor(
private processes:ProcessesService,
@@ -56,6 +58,23 @@ export class DiplomasAssinarPage implements OnInit {
}
}
});
this.dynamicSearch()
}
async dynamicSearch() {
if(this.showSearch && this.searchSubject) {
this.list = this.TaskService.despachoStore.list.filter((task) => {
let subject = task.Folio || task.Subject || task.workflowInstanceDataFields.Subject
subject = subject.toLowerCase();
return subject.includes(this.searchSubject.toLowerCase())
})
} else {
this.list = this.TaskService.AllProcess
}
}
@@ -30,7 +30,10 @@ export class DiplomasGerarPage implements OnInit {
deplomasStore = DeplomasStore
filterName: 'Para hoje' | 'Novos'| 'Lidos'| 'Não lidos'| 'OverdueTasks' | 'Todos' = 'Todos'
showSearch = false
searchSubject = ''
list = []
constructor(
private processes:ProcessesService,
private modalController: ModalController,
@@ -56,7 +59,24 @@ export class DiplomasGerarPage implements OnInit {
}
}
});
}
this.dynamicSearch()
}
async dynamicSearch() {
if(this.showSearch && this.searchSubject) {
this.list = this.TaskService.despachoStore.list.filter((task) => {
let subject = task.Folio || task.Subject || task.workflowInstanceDataFields.Subject
subject = subject.toLowerCase();
return subject.includes(this.searchSubject.toLowerCase())
})
} else {
this.list = this.TaskService.AllProcess
}
}
@@ -32,6 +32,9 @@ export class DiplomasPage implements OnInit, OnDestroy {
customTaskPipe = new CustomTaskPipe()
filterName: 'Para hoje' | 'Novos'| 'Lidos'| 'Não lidos'| 'OverdueTasks' | 'Todos' = 'Todos'
showSearch = false
searchSubject = ''
constructor(
private processes: ProcessesService,
private router: Router,
@@ -85,6 +88,23 @@ export class DiplomasPage implements OnInit, OnDestroy {
this.LoadList();
});
this.dynamicSearch()
}
async dynamicSearch() {
if(this.showSearch && this.searchSubject) {
this.list = this.TaskService.despachoStore.list.filter((task) => {
let subject = task.Folio || task.Subject || task.workflowInstanceDataFields.Subject
subject = subject.toLowerCase();
return subject.includes(this.searchSubject.toLowerCase())
})
} else {
this.list = this.TaskService.AllProcess
}
}
async getTotalDocs(DocId: any) {
@@ -45,6 +45,9 @@ export class EventListPage implements OnInit {
filterName: 'Para hoje' | 'Novos'| 'Lidos'| 'Não lidos'| 'OverdueTasks' | 'Todos' = 'Todos'
showFilter = false
showSearch = false
searchSubject = ''
list = []
constructor(
private processes: ProcessesService,
private modalController: ModalController,
@@ -36,6 +36,10 @@ export class ExpedientePage implements OnInit {
listToPresent= []
showSearch = false
searchSubject = ''
list = []
filterName: 'Para hoje' | 'Novos'| 'Lidos'| 'Não lidos'| 'OverdueTasks' | 'Todos' = 'Todos'
constructor(
private processes: ProcessesService,
@@ -80,6 +84,23 @@ export class ExpedientePage implements OnInit {
this.backgroundservice.registerBackService('Online', () => {
this.LoadList();
});
this.dynamicSearch()
}
async dynamicSearch() {
if(this.showSearch && this.searchSubject) {
this.list = this.TaskService.despachoStore.list.filter((task) => {
let subject = task.Folio || task.Subject || task.workflowInstanceDataFields.Subject
subject = subject.toLowerCase();
return subject.includes(this.searchSubject.toLowerCase())
})
} else {
this.list = this.TaskService.AllProcess
}
}
LoadList() {
@@ -36,6 +36,11 @@ export class ExpedientesPrPage implements OnInit {
expedienteTaskPipe = new ExpedienteTaskPipe()
filterName: 'Para hoje' | 'Novos'| 'Lidos'| 'Não lidos'| 'OverdueTasks' | 'Todos' = 'Todos'
showSearch = false
searchSubject = ''
list = []
constructor(
private processes:ProcessesService,
private modalController: ModalController,
@@ -68,6 +73,23 @@ export class ExpedientesPrPage implements OnInit {
}
});
this.dynamicSearch()
}
async dynamicSearch() {
if(this.showSearch && this.searchSubject) {
this.list = this.TaskService.despachoStore.list.filter((task) => {
let subject = task.Folio || task.Subject || task.workflowInstanceDataFields.Subject
subject = subject.toLowerCase();
return subject.includes(this.searchSubject.toLowerCase())
})
} else {
this.list = this.TaskService.AllProcess
}
}
LoadList() {
@@ -43,6 +43,10 @@ export class PedidosPage implements OnInit {
@Output() openExpedientDetail: EventEmitter<any> = new EventEmitter<any>();
filterName: 'Para hoje' | 'Novos'| 'Lidos'| 'Não lidos'| 'OverdueTasks' | 'Todos' = 'Todos'
showSearch = false
searchSubject = ''
list = []
constructor(
private router: Router,
private processes: ProcessesService,
@@ -90,6 +94,23 @@ export class PedidosPage implements OnInit {
this.backgroundservice.registerBackService('Online', () => {
this.getFromDb();
});
this.dynamicSearch()
}
async dynamicSearch() {
if(this.showSearch && this.searchSubject) {
this.list = this.TaskService.despachoStore.list.filter((task) => {
let subject = task.Folio || task.Subject || task.workflowInstanceDataFields.Subject
subject = subject.toLowerCase();
return subject.includes(this.searchSubject.toLowerCase())
})
} else {
this.list = this.TaskService.AllProcess
}
}
goBack() {
@@ -41,6 +41,10 @@ export class PendentesPage implements OnInit {
listToPresent = [];
filterName: 'Para hoje' | 'Novos'| 'Lidos'| 'Não lidos'| 'OverdueTasks' | 'Todos' = 'Todos'
showSearch = false
searchSubject = ''
list = []
constructor(
private processes: ProcessesService,
private alertService: AlertService,
@@ -81,6 +85,23 @@ export class PendentesPage implements OnInit {
this.LoadList();
});
this.dynamicSearch()
}
async dynamicSearch() {
if(this.showSearch && this.searchSubject) {
this.list = this.TaskService.despachoStore.list.filter((task) => {
let subject = task.Folio || task.Subject || task.workflowInstanceDataFields.Subject
subject = subject.toLowerCase();
return subject.includes(this.searchSubject.toLowerCase())
})
} else {
this.list = this.TaskService.AllProcess
}
}
segmentChanged(ev: any) {