Temporal products route added.
This commit is contained in:
@@ -2,8 +2,8 @@
|
||||
<form [formGroup]="form" class="flex-col wrapped">
|
||||
<div class="row-container">
|
||||
<mat-form-field class="flex-auto">
|
||||
<mat-label>Code</mat-label>
|
||||
<input matInput formControlName="code" />
|
||||
<mat-label>Handle</mat-label>
|
||||
<input matInput formControlName="handle" />
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="row-container">
|
||||
|
||||
@@ -47,7 +47,7 @@ export class ProductDetailComponent implements OnInit, AfterViewInit {
|
||||
|
||||
@ViewChild('nameElement', { static: true }) nameElement!: ElementRef<HTMLInputElement>;
|
||||
form: FormGroup<{
|
||||
code: FormControl<string | number>;
|
||||
handle: FormControl<string>;
|
||||
name: FormControl<string | null>;
|
||||
description: FormControl<string | null>;
|
||||
fractionUnits: FormControl<string | null>;
|
||||
@@ -89,7 +89,7 @@ export class ProductDetailComponent implements OnInit, AfterViewInit {
|
||||
|
||||
constructor() {
|
||||
this.form = new FormGroup({
|
||||
code: new FormControl<string | number>({ value: 0, disabled: true }, { nonNullable: true }),
|
||||
handle: new FormControl<string>({ value: '', disabled: true }, { nonNullable: true }),
|
||||
name: new FormControl<string | null>(null),
|
||||
description: new FormControl<string | null>(null),
|
||||
fractionUnits: new FormControl<string | null>(null),
|
||||
@@ -138,7 +138,7 @@ export class ProductDetailComponent implements OnInit, AfterViewInit {
|
||||
item.productGroup = this.productGroups.find((x) => x.id === item.productGroup?.id);
|
||||
this.item = item;
|
||||
this.form.setValue({
|
||||
code: this.item.code || '(Auto)',
|
||||
handle: this.item.handle || '',
|
||||
name: this.item.name,
|
||||
description: this.item.description || '',
|
||||
fractionUnits: this.item.fractionUnits ?? '',
|
||||
|
||||
@@ -51,9 +51,10 @@ export class ProductListDataSource extends DataSource<Product> {
|
||||
return this.filterValue.split(' ').reduce(
|
||||
(p: Product[], c: string) =>
|
||||
p.filter((x) => {
|
||||
const productString = `${x.code} ${x.name} ${x.productGroup?.name}${x.isPurchased ? ' purchased' : ' made'}${
|
||||
x.isSold ? 'sold' : 'used'
|
||||
}${x.isActive ? 'active' : 'deactive'}`.toLowerCase();
|
||||
const productString =
|
||||
`${x.handle} ${x.name} ${x.productGroup?.name}${x.isPurchased ? ' purchased' : ' made'}${
|
||||
x.isSold ? 'sold' : 'used'
|
||||
}${x.isActive ? 'active' : 'deactive'}`.toLowerCase();
|
||||
return productString.indexOf(c) !== -1;
|
||||
}),
|
||||
Object.assign([], data),
|
||||
|
||||
@@ -92,7 +92,7 @@ export class ProductListComponent implements OnInit, AfterViewInit {
|
||||
|
||||
exportCsv() {
|
||||
const headers = {
|
||||
Code: 'code',
|
||||
Handle: 'handle',
|
||||
Name: 'name',
|
||||
Units: 'units',
|
||||
Fraction: 'fraction',
|
||||
|
||||
Reference in New Issue
Block a user