Skip to content

Commit 4d7d3a7

Browse files
feat: #447 enabling search project by customer name
1 parent 95f4b37 commit 4d7d3a7

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/app/modules/shared/models/project.model.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ export interface Project {
55
name: string;
66
description?: string;
77
project_type_id?: string;
8+
search_field?: string;
89
}

src/app/modules/time-clock/components/project-list-hover/project-list-hover.component.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { getActiveTimeEntry } from './../../store/entry.selectors';
1818
})
1919
export class ProjectListHoverComponent implements OnInit, OnDestroy {
2020

21-
keyword = 'name';
21+
keyword = 'search_field';
2222
listProjects: Project[] = [];
2323
activeEntry;
2424
projectsForm: FormGroup;
@@ -36,7 +36,13 @@ export class ProjectListHoverComponent implements OnInit, OnDestroy {
3636
this.store.dispatch(new actions.LoadProjects());
3737
const projects$ = this.store.pipe(select(getProjects));
3838
projects$.subscribe((projects) => {
39-
this.listProjects = projects;
39+
this.listProjects = [];
40+
projects.forEach((project) => {
41+
const projectWithSearchField = {...project};
42+
projectWithSearchField.search_field = `${project.customer_name} - ${project.name}`;
43+
this.listProjects.push(projectWithSearchField);
44+
}
45+
);
4046
this.loadActiveTimeEntry();
4147
});
4248

0 commit comments

Comments
 (0)