mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
add seach button
This commit is contained in:
@@ -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) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user