feat: enhance POS module with dynamic routing, improved state management, and new search functionality

This commit is contained in:
2025-12-26 16:47:47 +03:30
parent abfb2f3479
commit c6efda319c
20 changed files with 264 additions and 109 deletions
@@ -0,0 +1 @@
<input pInputText type="text" placeholder="جستجو..." (input)="onSearchInput($event.target.value)" />
@@ -0,0 +1,36 @@
import { Component, EventEmitter, OnDestroy, OnInit, Output } from '@angular/core';
import { InputText } from 'primeng/inputtext';
import { Subject } from 'rxjs';
import { debounceTime, takeUntil } from 'rxjs/operators';
@Component({
selector: 'app-search-input',
templateUrl: 'search-input.component.html',
imports: [InputText],
})
export class SearchInputComponent implements OnInit, OnDestroy {
private searchSubject = new Subject<string>();
private destroy$ = new Subject<void>();
@Output() search = new EventEmitter<string>();
ngOnInit() {
this.searchSubject.pipe(debounceTime(300), takeUntil(this.destroy$)).subscribe((searchTerm) => {
this.onSearch(searchTerm);
});
}
onSearchInput(value: string) {
this.searchSubject.next(value);
}
onSearch(searchTerm: string) {
console.log('Search:', searchTerm);
this.search.emit(searchTerm);
}
ngOnDestroy() {
this.destroy$.next();
this.destroy$.complete();
}
}