Big Chunk of updates on way to making the sales portion working

This commit is contained in:
Amritanshu
2019-07-06 13:46:18 +05:30
parent 87076d9c00
commit d69ab0063a
83 changed files with 1621 additions and 415 deletions

View File

@ -23,6 +23,10 @@
<input matInput placeholder="Maximum" type="number" formControlName="maximum">
</mat-form-field>
</div>
<div fxLayout="row" fxLayoutAlign="space-around start" fxLayout.lt-md="column" fxLayoutGap="20px"
fxLayoutGap.lt-md="0px">
<mat-checkbox formControlName="isActive">Is Active?</mat-checkbox>
</div>
<mat-divider></mat-divider>
<mat-tree [dataSource]="dataSource" [treeControl]="treeControl" class="example-tree">
<!-- This is the tree node template for leaf nodes -->

View File

@ -41,7 +41,8 @@ export class ModifierCategoryDetailComponent implements OnInit, AfterViewInit {
this.form = this.fb.group({
name: '',
minimum: '',
maximum: ''
maximum: '',
isActive: ''
});
}
@ -58,7 +59,8 @@ export class ModifierCategoryDetailComponent implements OnInit, AfterViewInit {
this.form.patchValue({
name: this.item.name || '',
minimum: '' + this.item.minimum,
maximum: '' + this.item.maximum
maximum: '' + this.item.maximum,
isActive: this.item.isActive
});
this.products = new Map();
this.productsOfMenuCategory = new Map();
@ -128,6 +130,7 @@ export class ModifierCategoryDetailComponent implements OnInit, AfterViewInit {
this.item.name = formModel.name;
this.item.minimum = +formModel.minimum;
this.item.maximum = +formModel.maximum;
this.item.isActive = formModel.isActive;
return this.item;
}

View File

@ -27,7 +27,18 @@
<mat-cell *matCellDef="let row">{{row.maximum}}</mat-cell>
</ng-container>
<!-- Permissions Column -->
<!-- Is Active Column -->
<ng-container matColumnDef="isActive">
<mat-header-cell *matHeaderCellDef>Is Active</mat-header-cell>
<mat-cell *matCellDef="let row">
<mat-icon>
{{ row.isActive ? "visibility" : "visibility_off" }}
</mat-icon>
<b> {{ row.isActive ? "Active" : "Not Active" }}</b>
</mat-cell>
</ng-container>
<!-- Products Column -->
<ng-container matColumnDef="products">
<mat-header-cell *matHeaderCellDef>Products</mat-header-cell>
<mat-cell *matCellDef="let row">

View File

@ -12,7 +12,7 @@ export class ModifierCategoryListComponent implements OnInit {
dataSource: ModifierCategoryListDatasource;
list: ModifierCategory[];
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
displayedColumns = ['name', 'minimum', 'maximum', 'products'];
displayedColumns = ['name', 'minimum', 'maximum', 'products', 'isActive'];
constructor(private route: ActivatedRoute) {
}

View File

@ -34,11 +34,11 @@ export class ModifierCategoryService {
);
}
listOfNames(): Observable<string[]> {
const options = {params: new HttpParams().set('n', '')};
return <Observable<string[]>>this.http.get<string[]>(url, options)
listIsActiveOfProduct(id: string): Observable<ModifierCategory[]> {
const options = {params: new HttpParams().set('p', id).set('a', '')};
return <Observable<ModifierCategory[]>>this.http.get<ModifierCategory[]>(url, options)
.pipe(
catchError(this.log.handleError(serviceName, 'list'))
catchError(this.log.handleError(serviceName, 'listIsActiveOfProduct'))
);
}