Mostly working with Product + Version and Sku + Version.

There will still be many errors. But this is working somewhat
This commit is contained in:
tanshu committed 2026-01-23 02:30:57 +00:00
1 parent aaf64ab75a
commit 1b8ab2857f
95 files changed
+4506 -2624

No files matched your search

@@ -6,25 +6,52 @@
<input matInput #name formControlName="name" />
</mat-form-field>
<mat-form-field class="basis-1-4">
<mat-label>Fraction Units</mat-label>
<input matInput formControlName="fractionUnits" />
</mat-form-field>
</div>
<div class="row-container">
<mat-form-field class="basis-3-4">
<mat-label>Sale Category</mat-label>
<mat-select formControlName="saleCategory">
@for (sc of saleCategories; track sc) {
<mat-option [value]="sc.id">
{{ sc.name }}
</mat-option>
}
</mat-select>
</mat-form-field>
<mat-checkbox formControlName="enabled" class="basis-1-4">Enabled?</mat-checkbox>
</div>
<!-- SKU section -->
<h2>Stock Keeping Units</h2>
<div formGroupName="addRow" class="nutrition-grid">
<mat-form-field class="flex-auto">
<mat-label>Units</mat-label>
<input matInput formControlName="units" />
</mat-form-field>
</div>
<div class="row-container">
<mat-form-field class="flex-auto">
<mat-label>Price</mat-label>
<input matInput type="number" formControlName="price" />
<mat-label>Fraction</mat-label>
<input matInput type="number" formControlName="fraction" />
</mat-form-field>
<mat-form-field class="flex-auto">
<mat-label>Quantity</mat-label>
<input matInput type="number" formControlName="quantity" />
<mat-label>Yield</mat-label>
<input matInput type="number" formControlName="productYield" />
</mat-form-field>
</div>
<div class="row-container">
<mat-checkbox formControlName="hasHappyHour">Has Happy Hour?</mat-checkbox>
<mat-checkbox formControlName="isNotAvailable">Is Not Available?</mat-checkbox>
</div>
<div class="row-container">
<mat-form-field class="flex-auto">
<mat-label>Cost Price</mat-label>
<input matInput type="number" formControlName="costPrice" />
</mat-form-field>
<mat-form-field class="flex-auto">
<mat-label>Sale Price</mat-label>
<input matInput type="number" formControlName="salePrice" />
</mat-form-field>
<mat-form-field class="flex-auto">
<mat-label>Menu Category</mat-label>
<mat-select formControlName="menuCategory">
@@ -35,18 +62,87 @@
}
</mat-select>
</mat-form-field>
<mat-form-field class="flex-auto">
<mat-label>Sale Category</mat-label>
<mat-select formControlName="saleCategory">
@for (sc of saleCategories; track sc) {
<mat-option [value]="sc.id">
{{ sc.name }}
</mat-option>
}
</mat-select>
</mat-form-field>
</div>
</form>
<mat-checkbox formControlName="hasHappyHour" class="flex-auto">Has Happy Hour?</mat-checkbox>
<mat-checkbox formControlName="isNotAvailable" class="flex-auto">Not Available?</mat-checkbox>
<button mat-raised-button color="primary" (click)="addRow()" class="flex-auto">Add</button>
</div></form>
<!-- SKU table -->
<div class="row-container wrapped">
<mat-table [dataSource]="dataSource" aria-label="Stock Keeping Units" class="flex-auto">
<!-- Units Column -->
<ng-container matColumnDef="units">
<mat-header-cell *matHeaderCellDef>Units</mat-header-cell>
<mat-cell *matCellDef="let row">{{ row.units }}</mat-cell>
</ng-container>
<!-- Fraction Column -->
<ng-container matColumnDef="fraction">
<mat-header-cell *matHeaderCellDef>Fraction</mat-header-cell>
<mat-cell *matCellDef="let row">{{ row.fraction }}</mat-cell>
</ng-container>
<!-- Yield Column -->
<ng-container matColumnDef="productYield">
<mat-header-cell *matHeaderCellDef class="right">Yield</mat-header-cell>
<mat-cell *matCellDef="let row" class="right">{{ row.productYield }}</mat-cell>
</ng-container>
<!-- Cost Price Column -->
<ng-container matColumnDef="costPrice">
<mat-header-cell *matHeaderCellDef class="right">Cost Price</mat-header-cell>
<mat-cell *matCellDef="let row" class="right">{{ row.costPrice | currency: 'INR' }}</mat-cell>
</ng-container>
<!-- Sale Price Column -->
<ng-container matColumnDef="salePrice">
<mat-header-cell *matHeaderCellDef class="right">Sale Price</mat-header-cell>
<mat-cell *matCellDef="let row" class="right">{{ row.salePrice | currency: 'INR' }}</mat-cell>
</ng-container>
<!-- Menu Category Column -->
<ng-container matColumnDef="menuCategory">
<mat-header-cell *matHeaderCellDef>Menu Category</mat-header-cell>
<mat-cell *matCellDef="let row">
{{ row.menuCategory?.name ?? row.menuCategory?.id ?? '' }}
</mat-cell>
</ng-container>
<!-- Happy Hour Column -->
<ng-container matColumnDef="hasHappyHour">
<mat-header-cell *matHeaderCellDef class="center">Happy Hour</mat-header-cell>
<mat-cell *matCellDef="let row" class="center">
<mat-checkbox [checked]="row.hasHappyHour" disabled></mat-checkbox>
</mat-cell>
</ng-container>
<!-- Not Available Column -->
<ng-container matColumnDef="isNotAvailable">
<mat-header-cell *matHeaderCellDef class="center">Not Available</mat-header-cell>
<mat-cell *matCellDef="let row" class="center">
<mat-checkbox [checked]="row.isNotAvailable" disabled></mat-checkbox>
</mat-cell>
</ng-container>
<!-- Action Column -->
<ng-container matColumnDef="action">
<mat-header-cell *matHeaderCellDef class="center">Action</mat-header-cell>
<mat-cell *matCellDef="let row" class="center">
<!-- <button mat-icon-button tabindex="-1" (click)="editRow(row)">
<mat-icon>edit</mat-icon>
</button> -->
<button mat-icon-button tabindex="-1" color="warn" (click)="deleteRow(row)">
<mat-icon>delete</mat-icon>
</button>
</mat-cell>
</ng-container>
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
<mat-row *matRowDef="let row; columns: displayedColumns"></mat-row>
</mat-table>
</div>
<div class="row-container">
<button mat-raised-button color="primary" class="" (click)="save()">Save</button>
@if (!!item.id) {