diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..7c3ddad --- /dev/null +++ b/.dockerignore @@ -0,0 +1,61 @@ +# Version control & IDEs +.git +.gitignore +.vscode +.idea +.agents +.gemini + +# Build artifacts & compiled outputs +frontend +dist +**/dist +out-tsc +**/out-tsc +bazel-out + +# Dependencies & framework caches +node_modules +**/node_modules +.angular +**/.angular +.nx +**/.nx +.sass-cache +**/.sass-cache + +# Python virtual environments & caches +.venv +**/__pycache__ +**/.mypy_cache +**/.ruff_cache +**/.pytest_cache +*.py[cod] +*$py.class +*.egg-info + +# Testing & coverage +coverage +**/coverage +.coverage +htmlcov + +# Logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# Environment & local deployment/dev files +.env* +!.env.example +ansible +deploy.sh +lint.sh +version_bump.sh +Makefile +README.md +CHANGES.md +typings +.DS_Store +Thumbs.db diff --git a/.gitignore b/.gitignore index 61d4861..d83e5a6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,12 +1,52 @@ -*.pyc -venv -.project -.pydevproject -*/__pycache__/ +# IDEs & System Files .idea/ -*.egg-info/ -DB/Data/*.sql -barker/static/ -build/ -dist/ +.DS_Store +Thumbs.db + +# Build outputs frontend/ +dist/ +**/dist/ +out-tsc/ +**/out-tsc/ +bazel-out/ + +# Angular & Nx caches +.angular/ +**/.angular/ +.nx/ +**/.nx/ +.sass-cache/ + +# Dependencies +node_modules/ +**/node_modules/ + +# Python & Virtual Environments +.venv/ +**/__pycache__/ +*.py[cod] +*$py.class +*.egg-info/ +.mypy_cache/ +**/.mypy_cache/ +.ruff_cache/ +**/.ruff_cache/ +.pytest_cache/ +**/.pytest_cache/ + +# Testing & Coverage +coverage/ +**/coverage/ +.coverage +htmlcov/ + +# Logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# Ignore Pyright-generated stubs +*.pyi +typings/ diff --git a/.vscode/settings.json b/.vscode/settings.json index 13c0da0..a05700b 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -26,6 +26,7 @@ "[python]": { "editor.defaultFormatter": "charliermarsh.ruff" }, + "ruff.enable": true, "files.eol": "\n", "eslint.workingDirectories": [ { @@ -37,24 +38,42 @@ "files.exclude": { "**/__pycache__": true, "**/.mypy_cache": true, + "**/.ruff_cache": true, + "**/.pytest_cache": true, ".idea": true, "**/node_modules": true, - "**/.venv": true, - "typings": true + "typings": true, + "frontend": true, + "**/.angular": true, + "**/.nx": true, + "**/out-tsc": true, + "**/dist": true, + "**/.sass-cache": true, + "**/coverage": true }, "search.exclude": { "**/__pycache__": true, "**/.mypy_cache": true, + "**/.ruff_cache": true, + "**/.pytest_cache": true, ".idea": true, "**/node_modules": true, - "**/uv.lock": true, + "**/poetry.lock": true, "**/package-lock.json": true, - "/bookie/.angular/**": true, - "**/.venv": true, - "typings": true + "typings": true, + "frontend/**": true, + "**/.angular/**": true, + "**/.nx/**": true, + "**/out-tsc/**": true, + "**/dist/**": true, + "**/.sass-cache/**": true, + "**/coverage/**": true }, "editor.codeActionsOnSave": { "source.fixAll.ruff": "always", "source.fixAll.eslint": "always" - } + }, + "python-envs.defaultEnvManager": "ms-python.python:venv", + "python-envs.defaultPackageManager": "ms-python.python:pip", + "python-envs.pythonProjects": [] } diff --git a/bookie/src/app/app.config.ts b/bookie/src/app/app.config.ts index 7f83b19..8d30224 100644 --- a/bookie/src/app/app.config.ts +++ b/bookie/src/app/app.config.ts @@ -1,6 +1,12 @@ import { LayoutModule } from '@angular/cdk/layout'; import { provideHttpClient, withInterceptors } from '@angular/common/http'; -import { ApplicationConfig, LOCALE_ID, importProvidersFrom, provideZonelessChangeDetection } from '@angular/core'; +import { + ApplicationConfig, + LOCALE_ID, + importProvidersFrom, + isDevMode, + provideZonelessChangeDetection, +} from '@angular/core'; import { ReactiveFormsModule } from '@angular/forms'; import { MomentDateAdapter } from '@angular/material-moment-adapter'; import { MatButtonModule } from '@angular/material/button'; @@ -24,6 +30,7 @@ import { dateFormat } from './app.environment'; import { routes } from './app.routes'; import { AuthService } from './auth/auth.service'; import { authInterceptor } from './core/auth.interceptor'; +import { delayInterceptor } from './core/delay-interceptor'; import { jwtInterceptor } from './core/jwt.interceptor'; import { refreshInterceptor } from './core/refresh.interceptor'; @@ -49,7 +56,14 @@ export const appConfig: ApplicationConfig = { ), { provide: LOCALE_ID, useValue: 'en-IN' }, AuthService, - provideHttpClient(withInterceptors([refreshInterceptor, jwtInterceptor, authInterceptor])), + provideHttpClient( + withInterceptors([ + authInterceptor, + jwtInterceptor, + refreshInterceptor, + ...(isDevMode() ? [delayInterceptor] : []), + ]), + ), provideRouter( routes, withRouterConfig({ diff --git a/bookie/src/app/beer-sale-report/beer-sale-report.component.html b/bookie/src/app/beer-sale-report/beer-sale-report.component.html index fcd097f..7909281 100644 --- a/bookie/src/app/beer-sale-report/beer-sale-report.component.html +++ b/bookie/src/app/beer-sale-report/beer-sale-report.component.html @@ -1,86 +1,92 @@ -

- Beer Sale Report - -

- -@if (!infoResource.value() || !saleCategoriesResource.value()) { -

Loading...

+@if (infoResource.isLoading()) { + +} @else if (infoResource.error()) { + } @else { -
-
- - Start Date - - - - - - Finish Date - - - - - - Sale Category - - @for (sc of saleCategories(); track sc) { - - {{ sc.name }} - +

+ Beer Sale Report + +

+ + @if (!infoResource.value() || !saleCategoriesResource.value()) { +

Loading...

+ } @else { + +
+ + Start Date + + + + + + Finish Date + + + + + + Sale Category + + @for (sc of saleCategories(); track sc) { + + {{ sc.name }} + + } + + @for (error of form.saleCategory().errors(); track error) { + {{ error.message }} } - - @for (error of form.saleCategory().errors(); track error) { - {{ error.message }} - } - - -
-
- Regular - Happy Hour - Staff Consumption - No Charge -
- - - - - Time - {{ row.date }} - - - - @for (col of info()?.headers ?? []; track col) { - - {{ col }} - {{ row[col] | number: '1.2-2' }} +
+ +
+
+ Regular + Happy Hour + Staff Consumption + No Charge +
+ + + + + Time + {{ row.date }} - } - - - + + @for (col of info()?.headers ?? []; track col) { + + {{ col }} + {{ row[col] | number: '1.2-2' }} + + } + + + + + } } diff --git a/bookie/src/app/beer-sale-report/beer-sale-report.component.ts b/bookie/src/app/beer-sale-report/beer-sale-report.component.ts index 33f26ef..4605c5a 100644 --- a/bookie/src/app/beer-sale-report/beer-sale-report.component.ts +++ b/bookie/src/app/beer-sale-report/beer-sale-report.component.ts @@ -13,6 +13,8 @@ import { Router } from '@angular/router'; import moment from 'moment'; import { SaleCategoryService } from '../sale-category/sale-category.service'; +import { ErrorStateComponent } from '../shared/error-state/error-state.component'; +import { SkeletonLoaderComponent } from '../shared/skeleton-loader/skeleton-loader.component'; import { ToCsvService } from '../shared/to-csv.service'; import { BeerSaleExportHeaderInterface } from './beer-sale-export-header-interface'; import { BeerSaleReport } from './beer-sale-report'; @@ -43,6 +45,8 @@ export interface BeerSaleReportFormData { MatSelectModule, MatTableModule, FormField, + ErrorStateComponent, + SkeletonLoaderComponent, ], }) export class BeerSaleReportComponent { diff --git a/bookie/src/app/bill-settlement-report/bill-settlement-report.component.html b/bookie/src/app/bill-settlement-report/bill-settlement-report.component.html index 4fff145..36a38fd 100644 --- a/bookie/src/app/bill-settlement-report/bill-settlement-report.component.html +++ b/bookie/src/app/bill-settlement-report/bill-settlement-report.component.html @@ -1,64 +1,70 @@ -

- Bill Settlement Report - -

+@if (infoResource.isLoading()) { + +} @else if (infoResource.error()) { + +} @else { +

+ Bill Settlement Report + +

-
-
- - Start Date - - - - - - Finish Date - - - - - -
-
- - - - Time - {{ row.date | localTime }} - +
+
+ + Start Date + + + + + + Finish Date + + + + + +
+
+ + + + Time + {{ row.date | localTime }} + - - - Bill ID - {{ row.billId }} - + + + Bill ID + {{ row.billId }} + - - - Amount - {{ row.amount | number: '1.2-2' }} - + + + Amount + {{ row.amount | number: '1.2-2' }} + - - - Settlement - {{ row.settlement }} - + + + Settlement + {{ row.settlement }} + - - - + + +
+} diff --git a/bookie/src/app/bill-settlement-report/bill-settlement-report.component.ts b/bookie/src/app/bill-settlement-report/bill-settlement-report.component.ts index 4dd20d1..dbdea69 100644 --- a/bookie/src/app/bill-settlement-report/bill-settlement-report.component.ts +++ b/bookie/src/app/bill-settlement-report/bill-settlement-report.component.ts @@ -10,7 +10,9 @@ import { MatTableModule } from '@angular/material/table'; import { Router } from '@angular/router'; import moment from 'moment'; +import { ErrorStateComponent } from '../shared/error-state/error-state.component'; import { LocalTimePipe } from '../shared/local-time.pipe'; +import { SkeletonLoaderComponent } from '../shared/skeleton-loader/skeleton-loader.component'; import { ToCsvService } from '../shared/to-csv.service'; import { BillSettlementReport } from './bill-settlement-report'; import { BillSettlementReportService } from './bill-settlement-report.service'; @@ -34,6 +36,8 @@ export interface BillSettlementReportFormData { MatInputModule, MatTableModule, FormField, + ErrorStateComponent, + SkeletonLoaderComponent, ], }) export class BillSettlementReportComponent { diff --git a/bookie/src/app/bundles/bundle-detail/bundle-detail-dialog.component.html b/bookie/src/app/bundles/bundle-detail/bundle-detail-dialog.component.html index 8ee1cdc..4fb8d60 100644 --- a/bookie/src/app/bundles/bundle-detail/bundle-detail-dialog.component.html +++ b/bookie/src/app/bundles/bundle-detail/bundle-detail-dialog.component.html @@ -1,33 +1,39 @@ -

Edit Bundle Item

+@if (productsResource.isLoading()) { + +} @else if (productsResource.error()) { + +} @else { +

Edit Bundle Item

-
-
- - Item - - - @for (p of products(); track p) { - {{ p.name }} - } - - - -
- - Quantity - +
+ + + Item + + + @for (p of products(); track p) { + {{ p.name }} + } + - - Sale Price - - - Print in Bill? -
- -
+
+ + Quantity + + -
- - -
+ + Sale Price + + + Print in Bill? +
+ +
+ +
+ + +
+} diff --git a/bookie/src/app/bundles/bundle-detail/bundle-detail-dialog.component.ts b/bookie/src/app/bundles/bundle-detail/bundle-detail-dialog.component.ts index 07bb18a..a554f1d 100644 --- a/bookie/src/app/bundles/bundle-detail/bundle-detail-dialog.component.ts +++ b/bookie/src/app/bundles/bundle-detail/bundle-detail-dialog.component.ts @@ -10,6 +10,8 @@ import { MatInputModule } from '@angular/material/input'; import { ProductQuery } from '../../core/product-query'; import { ProductService } from '../../product/product.service'; +import { ErrorStateComponent } from '../../shared/error-state/error-state.component'; +import { SkeletonLoaderComponent } from '../../shared/skeleton-loader/skeleton-loader.component'; import { BundleItem } from '../bundle'; export interface BundleDetailDialogFormData { @@ -33,6 +35,8 @@ export interface BundleDetailDialogFormData { MatFormFieldModule, MatInputModule, FormField, + ErrorStateComponent, + SkeletonLoaderComponent, ], }) export class BundleDetailDialogComponent { diff --git a/bookie/src/app/bundles/bundle-detail/bundle-detail.component.html b/bookie/src/app/bundles/bundle-detail/bundle-detail.component.html index f1ccd59..fc6af9a 100644 --- a/bookie/src/app/bundles/bundle-detail/bundle-detail.component.html +++ b/bookie/src/app/bundles/bundle-detail/bundle-detail.component.html @@ -1,149 +1,155 @@ -

Bundle

+@if (itemResource.isLoading()) { + +} @else if (itemResource.error()) { + +} @else { +

Bundle

-
-
- - Name - - + +
+ + Name + + - - Units - - + + Units + + +
+ +
+ + Sale Price + + Computed from bundle items + + + + Menu Category + + @for (mc of menuCategories(); track mc) { + + {{ mc.name }} + + } + + + + + Sale Category + + @for (sc of saleCategories(); track sc) { + + {{ sc.name }} + + } + + +
+
+ Sale Category is used for Tax Report and displaying in the right bill regimes. For the Sale Report, Discount + Report and Beer Sale Report, the Sale Category from the Bundle Items is used. +
+
+ Has Happy Hour? + Not Available? +
+ +

Items

+ +
+ + Product + + + @for (p of itemProducts(); track p) { + {{ p.name }} + } + + + + + Quantity + + + + + Sale Price + + + Print in Bill? + + +
+ + +
+ + + + Item + + {{ row.sku?.name }} + + + + + + Qty + + {{ row.quantity }} + + + + + + Sale Price + + {{ row.salePrice | currency: 'INR' }} + + + + + + Print in Bill + + + {{ row.printInBill ? 'visibility' : 'visibility_off' }} + + + + + + + Action + + + + + + + + +
- - Sale Price - - Computed from bundle items - - - - Menu Category - - @for (mc of menuCategories(); track mc) { - - {{ mc.name }} - - } - - - - - Sale Category - - @for (sc of saleCategories(); track sc) { - - {{ sc.name }} - - } - - + + @if (!!item().id) { + + }
-
- Sale Category is used for Tax Report and displaying in the right bill regimes. For the Sale Report, Discount - Report and Beer Sale Report, the Sale Category from the Bundle Items is used. -
-
- Has Happy Hour? - Not Available? -
- -

Items

- -
- - Product - - - @for (p of itemProducts(); track p) { - {{ p.name }} - } - - - - - Quantity - - - - - Sale Price - - - Print in Bill? - - -
- - -
- - - - Item - - {{ row.sku?.name }} - - - - - - Qty - - {{ row.quantity }} - - - - - - Sale Price - - {{ row.salePrice | currency: 'INR' }} - - - - - - Print in Bill - - - {{ row.printInBill ? 'visibility' : 'visibility_off' }} - - - - - - - Action - - - - - - - - - -
- -
- - @if (!!item().id) { - - } -
+} diff --git a/bookie/src/app/bundles/bundle-detail/bundle-detail.component.ts b/bookie/src/app/bundles/bundle-detail/bundle-detail.component.ts index 272fefd..d09b66f 100644 --- a/bookie/src/app/bundles/bundle-detail/bundle-detail.component.ts +++ b/bookie/src/app/bundles/bundle-detail/bundle-detail.component.ts @@ -21,6 +21,8 @@ import { MenuCategoryService } from '../../menu-category/menu-category.service'; import { ProductService } from '../../product/product.service'; import { SaleCategoryService } from '../../sale-category/sale-category.service'; import { ConfirmDialogComponent } from '../../shared/confirm-dialog/confirm-dialog.component'; +import { ErrorStateComponent } from '../../shared/error-state/error-state.component'; +import { SkeletonLoaderComponent } from '../../shared/skeleton-loader/skeleton-loader.component'; import { Bundle, BundleItem } from '../bundle'; import { BundleService } from '../bundle.service'; import { BundleDetailDialogComponent } from './bundle-detail-dialog.component'; @@ -58,6 +60,8 @@ export interface BundleDetailFormData { MatSelectModule, MatTableModule, FormField, + ErrorStateComponent, + SkeletonLoaderComponent, ], }) export class BundleDetailComponent { diff --git a/bookie/src/app/bundles/bundle-list/bundle-list.component.html b/bookie/src/app/bundles/bundle-list/bundle-list.component.html index 53e5752..aa82bbc 100644 --- a/bookie/src/app/bundles/bundle-list/bundle-list.component.html +++ b/bookie/src/app/bundles/bundle-list/bundle-list.component.html @@ -1,107 +1,113 @@ -

- Bundles - - - add_box - Add - -

+@if (listResource.isLoading()) { + +} @else if (listResource.error()) { + +} @else { +

+ Bundles + + + add_box + Add + +

-
-
- - Filter - - + +
+ + Filter + + - - Menu Category - - -- All Bundles -- - @for (mc of menuCategoriesResource.value(); track mc) { - - {{ mc.name }} - - } - - -
- + + Menu Category + + -- All Bundles -- + @for (mc of menuCategoriesResource.value(); track mc) { + + {{ mc.name }} + + } + + +
+ - - - - Name - - {{ row.name }} ({{ row.units }}) - - + + + + Name + + {{ row.name }} ({{ row.units }}) + + - - - Price - - {{ row.salePrice | currency: 'INR' }} - - + + + Price + + {{ row.salePrice | currency: 'INR' }} + + - - - Menu Category - - {{ row.menuCategory?.name }} - - + + + Menu Category + + {{ row.menuCategory?.name }} + + - - - Sale Category - - {{ row.saleCategory?.name }} - - + + + Sale Category + + {{ row.saleCategory?.name }} + + - - - Items - -
- @for (item of row.items; track item) { - - {{ item.printInBill ? 'visibility' : 'visibility_off' }} - -
- {{ item.sku?.name }} x {{ item.quantity }} @ {{ item.salePrice | currency: 'INR' }} + + + Items + +
+ @for (item of row.items; track item) { + + {{ item.printInBill ? 'visibility' : 'visibility_off' }} + +
+ {{ item.sku?.name }} x {{ item.quantity }} @ {{ item.salePrice | currency: 'INR' }} +
+ } +
+
+
+ + + + Details + +
+
+ + {{ row.hasHappyHour ? 'sentiment_satisfied_alt' : 'sentiment_dissatisfied' }} + + {{ row.hasHappyHour ? 'Happy Hour' : 'Regular' }}
- } -
-
-
- - - Details - -
-
- - {{ row.hasHappyHour ? 'sentiment_satisfied_alt' : 'sentiment_dissatisfied' }} - - {{ row.hasHappyHour ? 'Happy Hour' : 'Regular' }} +
+ + {{ row.isNotAvailable ? 'pause' : 'play_arrow' }} + + {{ row.isNotAvailable ? 'Not Available' : 'Available' }} +
+ + -
- - {{ row.isNotAvailable ? 'pause' : 'play_arrow' }} - - {{ row.isNotAvailable ? 'Not Available' : 'Available' }} -
-
-
-
- - - - + + + +} diff --git a/bookie/src/app/bundles/bundle-list/bundle-list.component.ts b/bookie/src/app/bundles/bundle-list/bundle-list.component.ts index 6ddcb8d..0bd1460 100644 --- a/bookie/src/app/bundles/bundle-list/bundle-list.component.ts +++ b/bookie/src/app/bundles/bundle-list/bundle-list.component.ts @@ -11,6 +11,8 @@ import { MatTableModule } from '@angular/material/table'; import { RouterModule } from '@angular/router'; import { MenuCategoryService } from '../../menu-category/menu-category.service'; +import { ErrorStateComponent } from '../../shared/error-state/error-state.component'; +import { SkeletonLoaderComponent } from '../../shared/skeleton-loader/skeleton-loader.component'; import { ToCsvService } from '../../shared/to-csv.service'; import { Bundle } from '../bundle'; import { BundleService } from '../bundle.service'; @@ -35,6 +37,8 @@ export interface BundleListFormData { MatTableModule, FormField, RouterModule, + ErrorStateComponent, + SkeletonLoaderComponent, ], }) export class BundleListComponent { @@ -48,7 +52,7 @@ export class BundleListComponent { menuCategoryFilter = computed(() => this.formModel().menuCategory); formModel = signal({ - menuCategory: '', + menuCategory: null, filter: '', }); diff --git a/bookie/src/app/cashier-report/cashier-report.component.html b/bookie/src/app/cashier-report/cashier-report.component.html index 0f335d3..4ea8ec4 100644 --- a/bookie/src/app/cashier-report/cashier-report.component.html +++ b/bookie/src/app/cashier-report/cashier-report.component.html @@ -1,68 +1,74 @@ -

- Cashier Report - - - -

+@if (infoResource.isLoading()) { + +} @else if (infoResource.error()) { + +} @else { +

+ Cashier Report + + + +

-
-
- - Start Date - - - - - - Finish Date - - - - -
-
- - Cashier - - -- Cashier -- - @for (ac of cashiers(); track ac) { - - {{ ac.name }} - - } - - - -
-
- - - - Name - {{ row.name }} - +
+
+ + Start Date + + + + + + Finish Date + + + + +
+
+ + Cashier + + -- Cashier -- + @for (ac of cashiers(); track ac) { + + {{ ac.name }} + + } + + + +
+
+ + + + Name + {{ row.name }} + - - - Amount - {{ row.amount | currency: 'INR' }} - - - - + + + Amount + {{ row.amount | currency: 'INR' }} + + + +
+} diff --git a/bookie/src/app/cashier-report/cashier-report.component.ts b/bookie/src/app/cashier-report/cashier-report.component.ts index 791ee09..bc76a8c 100644 --- a/bookie/src/app/cashier-report/cashier-report.component.ts +++ b/bookie/src/app/cashier-report/cashier-report.component.ts @@ -14,6 +14,8 @@ import { Router } from '@angular/router'; import moment from 'moment'; import { User } from '../core/user'; +import { ErrorStateComponent } from '../shared/error-state/error-state.component'; +import { SkeletonLoaderComponent } from '../shared/skeleton-loader/skeleton-loader.component'; import { ToCsvService } from '../shared/to-csv.service'; import { CashierReport } from './cashier-report'; import { CashierReportService } from './cashier-report.service'; @@ -39,6 +41,8 @@ export interface CashierReportFormData { MatSelectModule, MatTableModule, FormField, + ErrorStateComponent, + SkeletonLoaderComponent, ], }) export class CashierReportComponent { diff --git a/bookie/src/app/core/delay-interceptor.ts b/bookie/src/app/core/delay-interceptor.ts new file mode 100644 index 0000000..c321a49 --- /dev/null +++ b/bookie/src/app/core/delay-interceptor.ts @@ -0,0 +1,7 @@ +import { HttpInterceptorFn } from '@angular/common/http'; +import { timer, switchMap } from 'rxjs'; + +export const delayInterceptor: HttpInterceptorFn = (req, next) => { + // Delay all requests by 1500ms to test loading states + return timer(1500).pipe(switchMap(() => next(req))); +}; diff --git a/bookie/src/app/customers/customer-detail/customer-detail.component.html b/bookie/src/app/customers/customer-detail/customer-detail.component.html index 6c48a03..121e94a 100644 --- a/bookie/src/app/customers/customer-detail/customer-detail.component.html +++ b/bookie/src/app/customers/customer-detail/customer-detail.component.html @@ -1,41 +1,47 @@ -

Customer

-
+@if (itemResource.isLoading()) { + +} @else if (itemResource.error()) { + +} @else { +

Customer

+ +
+ + Name + + +
+
+ + Phone + + +
+
+ + Address + + +
+
+ Print in Bill? +
+ +
+ @for (r of item().discounts; track r; let i = $index) { +
+ + Discount on {{ r.name }} + + % + Max {{ r.limit | percent: '1.2-2' }} + +
+ } +
+
- - Name - - + +
-
- - Phone - - -
-
- - Address - - -
-
- Print in Bill? -
- -
- @for (r of item().discounts; track r; let i = $index) { -
- - Discount on {{ r.name }} - - % - Max {{ r.limit | percent: '1.2-2' }} - -
- } -
- -
- - -
+} diff --git a/bookie/src/app/customers/customer-detail/customer-detail.component.ts b/bookie/src/app/customers/customer-detail/customer-detail.component.ts index a055b30..701500d 100644 --- a/bookie/src/app/customers/customer-detail/customer-detail.component.ts +++ b/bookie/src/app/customers/customer-detail/customer-detail.component.ts @@ -13,6 +13,8 @@ import { round } from 'mathjs'; import { Customer } from '../../core/customer'; import { ConfirmDialogComponent } from '../../shared/confirm-dialog/confirm-dialog.component'; +import { ErrorStateComponent } from '../../shared/error-state/error-state.component'; +import { SkeletonLoaderComponent } from '../../shared/skeleton-loader/skeleton-loader.component'; import { CustomerService } from '../customer.service'; export interface CustomerDetailFormData { @@ -37,6 +39,8 @@ export interface CustomerDetailFormData { MatInputModule, PercentPipe, FormField, + ErrorStateComponent, + SkeletonLoaderComponent, ], }) export class CustomerDetailComponent { diff --git a/bookie/src/app/customers/customer-list/customer-list.component.html b/bookie/src/app/customers/customer-list/customer-list.component.html index 051fff4..3e4239b 100644 --- a/bookie/src/app/customers/customer-list/customer-list.component.html +++ b/bookie/src/app/customers/customer-list/customer-list.component.html @@ -1,65 +1,71 @@ -

- Customers - - add_box - Add - -

-
-
- - Filter - - -
-
- - - - Name - {{ row.name }} - +@if (listResource.isLoading()) { + +} @else if (listResource.error()) { + +} @else { +

+ Customers + + add_box + Add + +

+
+
+ + Filter + + +
+
+ + + + Name + {{ row.name }} + - - - Phone - {{ row.phone }} - + + + Phone + {{ row.phone }} + - - - Address - {{ row.address }} - + + + Address + {{ row.address }} + - - - Print in Bill - {{ row.printInBill }} - + + + Print in Bill + {{ row.printInBill }} + - - - Discounts - -
    - @for (discount of row.discounts; track discount) { -
  • {{ discount.name }} - {{ discount.discount | percent: '1.2-2' }}
  • - } -
-
-
+ + + Discounts + +
    + @for (discount of row.discounts; track discount) { +
  • {{ discount.name }} - {{ discount.discount | percent: '1.2-2' }}
  • + } +
+
+
- - -
- - + + +
+ + +} diff --git a/bookie/src/app/customers/customer-list/customer-list.component.ts b/bookie/src/app/customers/customer-list/customer-list.component.ts index 3ac0c26..6b73029 100644 --- a/bookie/src/app/customers/customer-list/customer-list.component.ts +++ b/bookie/src/app/customers/customer-list/customer-list.component.ts @@ -11,6 +11,8 @@ import { MatTableModule } from '@angular/material/table'; import { ActivatedRoute, Router, RouterLink } from '@angular/router'; import { Customer } from '../../core/customer'; +import { ErrorStateComponent } from '../../shared/error-state/error-state.component'; +import { SkeletonLoaderComponent } from '../../shared/skeleton-loader/skeleton-loader.component'; import { CustomerService } from '../customer.service'; export interface CustomerListFormData { @@ -31,6 +33,8 @@ export interface CustomerListFormData { MatPaginatorModule, MatSortModule, FormField, + ErrorStateComponent, + SkeletonLoaderComponent, ], }) export class CustomerListComponent { diff --git a/bookie/src/app/devices/device-detail/device-detail.component.html b/bookie/src/app/devices/device-detail/device-detail.component.html index a1de46d..7fe5021 100644 --- a/bookie/src/app/devices/device-detail/device-detail.component.html +++ b/bookie/src/app/devices/device-detail/device-detail.component.html @@ -1,34 +1,40 @@ -

Device

-
-
- - Name - - +@if (itemResource.isLoading()) { + +} @else if (itemResource.error()) { + +} @else { +

Device

+ +
+ + Name + + +
+
+ + Section + + @for (s of sections(); track s) { + + {{ s.name }} + + } + + +
+
+ Enabled? +
+ +
+ + @if (!!item().id) { + + } +
+ Created on {{ item().creationDate | localTime }}
-
- - Section - - @for (s of sections(); track s) { - - {{ s.name }} - - } - - -
-
- Enabled? -
- -
- - @if (!!item().id) { - - } -
- Created on {{ item().creationDate | localTime }} -
+} diff --git a/bookie/src/app/devices/device-detail/device-detail.component.ts b/bookie/src/app/devices/device-detail/device-detail.component.ts index d952877..a2f0314 100644 --- a/bookie/src/app/devices/device-detail/device-detail.component.ts +++ b/bookie/src/app/devices/device-detail/device-detail.component.ts @@ -14,7 +14,9 @@ import { Device } from '../../core/device'; import { Section } from '../../core/section'; import { SectionService } from '../../sections/section.service'; import { ConfirmDialogComponent } from '../../shared/confirm-dialog/confirm-dialog.component'; +import { ErrorStateComponent } from '../../shared/error-state/error-state.component'; import { LocalTimePipe } from '../../shared/local-time.pipe'; +import { SkeletonLoaderComponent } from '../../shared/skeleton-loader/skeleton-loader.component'; import { DeviceService } from '../device.service'; export interface DeviceDetailFormData { @@ -36,6 +38,8 @@ export interface DeviceDetailFormData { MatOptionModule, MatSelectModule, FormField, + ErrorStateComponent, + SkeletonLoaderComponent, ], }) export class DeviceDetailComponent { diff --git a/bookie/src/app/devices/device-list/device-list.component.html b/bookie/src/app/devices/device-list/device-list.component.html index 82ccd6a..7c4df70 100644 --- a/bookie/src/app/devices/device-list/device-list.component.html +++ b/bookie/src/app/devices/device-list/device-list.component.html @@ -1,45 +1,51 @@ -

- Devices - - add_box - Add - -

- - - - Name - {{ row.name }} - +@if (listResource.isLoading()) { + +} @else if (listResource.error()) { + +} @else { +

+ Devices + + add_box + Add + +

+ + + + Name + {{ row.name }} + - - - Section - {{ row.section.name }} - + + + Section + {{ row.section.name }} + - - - Enabled - {{ row.enabled }} - + + + Enabled + {{ row.enabled }} + - - - Created - {{ row.creationDate | localTime }} - + + + Created + {{ row.creationDate | localTime }} + - - - Last Login - {{ row.lastUser }} @ {{ row.lastDate ? (row.lastDate | localTime) : 'Never' }} - + + + Last Login + {{ row.lastUser }} @ {{ row.lastDate ? (row.lastDate | localTime) : 'Never' }} + - - - + + +
+} diff --git a/bookie/src/app/devices/device-list/device-list.component.ts b/bookie/src/app/devices/device-list/device-list.component.ts index 01294fa..7fd7c1b 100644 --- a/bookie/src/app/devices/device-list/device-list.component.ts +++ b/bookie/src/app/devices/device-list/device-list.component.ts @@ -4,13 +4,23 @@ import { MatIconModule } from '@angular/material/icon'; import { MatTableModule } from '@angular/material/table'; import { RouterLink } from '@angular/router'; +import { ErrorStateComponent } from '../../shared/error-state/error-state.component'; import { LocalTimePipe } from '../../shared/local-time.pipe'; +import { SkeletonLoaderComponent } from '../../shared/skeleton-loader/skeleton-loader.component'; import { DeviceService } from '../device.service'; @Component({ selector: 'app-device-list', templateUrl: './device-list.component.html', styleUrls: ['./device-list.component.css'], - imports: [LocalTimePipe, MatButtonModule, MatIconModule, MatTableModule, RouterLink], + imports: [ + LocalTimePipe, + MatButtonModule, + MatIconModule, + MatTableModule, + RouterLink, + ErrorStateComponent, + SkeletonLoaderComponent, + ], }) export class DeviceListComponent { private deviceService = inject(DeviceService); diff --git a/bookie/src/app/discount-report/discount-report.component.html b/bookie/src/app/discount-report/discount-report.component.html index 30b91db..651a98d 100644 --- a/bookie/src/app/discount-report/discount-report.component.html +++ b/bookie/src/app/discount-report/discount-report.component.html @@ -1,54 +1,60 @@ -

- Discount Report - - - -

-
-
- - Start Date - - - - - - Finish Date - - - - - -
-
- - - - Name - {{ row.name }} - +@if (infoResource.isLoading()) { + +} @else if (infoResource.error()) { + +} @else { +

+ Discount Report + + + +

+
+
+ + Start Date + + + + + + Finish Date + + + + + +
+
+ + + + Name + {{ row.name }} + - - - Amount - {{ row.amount | currency: 'INR' }} - - - - + + + Amount + {{ row.amount | currency: 'INR' }} + + + +
+} diff --git a/bookie/src/app/discount-report/discount-report.component.ts b/bookie/src/app/discount-report/discount-report.component.ts index 3c30bee..45e493c 100644 --- a/bookie/src/app/discount-report/discount-report.component.ts +++ b/bookie/src/app/discount-report/discount-report.component.ts @@ -11,6 +11,8 @@ import { MatTableModule } from '@angular/material/table'; import { Router } from '@angular/router'; import moment from 'moment'; +import { ErrorStateComponent } from '../shared/error-state/error-state.component'; +import { SkeletonLoaderComponent } from '../shared/skeleton-loader/skeleton-loader.component'; import { ToCsvService } from '../shared/to-csv.service'; import { DiscountReport } from './discount-report'; import { DiscountReportService } from './discount-report.service'; @@ -33,6 +35,8 @@ export interface DiscountReportFormData { MatInputModule, MatTableModule, FormField, + ErrorStateComponent, + SkeletonLoaderComponent, ], }) export class DiscountReportComponent { diff --git a/bookie/src/app/guest-book/guest-book-detail/guest-book-detail.component.html b/bookie/src/app/guest-book/guest-book-detail/guest-book-detail.component.html index b9ea107..44f26c8 100644 --- a/bookie/src/app/guest-book/guest-book-detail/guest-book-detail.component.html +++ b/bookie/src/app/guest-book/guest-book-detail/guest-book-detail.component.html @@ -1,70 +1,76 @@ -

Guest Details

-
-
- - Name - - -
-
- - Phone - - - - @for (customer of customers(); track customer) { - {{ customer.name }} - {{ customer.phone }} - } - -
-
- - Pax - - -
-
- - Address - - -
-
- - Notes - - -
-
- - Date - - - - - - Time - - - - -
-
+@if (itemResource.isLoading()) { + +} @else if (itemResource.error()) { + +} @else { +

Guest Details

+
+
+ + Name + + +
+
+ + Phone + + + + @for (customer of customers(); track customer) { + {{ customer.name }} - {{ customer.phone }} + } + +
+
+ + Pax + + +
+
+ + Address + + +
+
+ + Notes + + +
+
+ + Date + + + + + + Time + + + + +
+
-
- - @if (!!item().id) { - - } -
+
+ + @if (!!item().id) { + + } +
+} diff --git a/bookie/src/app/guest-book/guest-book-detail/guest-book-detail.component.ts b/bookie/src/app/guest-book/guest-book-detail/guest-book-detail.component.ts index 00d2af6..012b237 100644 --- a/bookie/src/app/guest-book/guest-book-detail/guest-book-detail.component.ts +++ b/bookie/src/app/guest-book/guest-book-detail/guest-book-detail.component.ts @@ -15,6 +15,8 @@ import moment from 'moment'; import { Customer } from '../../core/customer'; import { CustomerService } from '../../customers/customer.service'; import { ConfirmDialogComponent } from '../../shared/confirm-dialog/confirm-dialog.component'; +import { ErrorStateComponent } from '../../shared/error-state/error-state.component'; +import { SkeletonLoaderComponent } from '../../shared/skeleton-loader/skeleton-loader.component'; import { GuestBook, GuestBookType } from '../guest-book'; import { GuestBookService } from '../guest-book.service'; @@ -41,6 +43,8 @@ export interface GuestBookDetailFormData { MatOptionModule, MatTimepickerModule, FormField, + ErrorStateComponent, + SkeletonLoaderComponent, ], }) export class GuestBookDetailComponent { diff --git a/bookie/src/app/guest-book/guest-book-list/guest-book-list.component.html b/bookie/src/app/guest-book/guest-book-list/guest-book-list.component.html index c2b2a86..5cb0461 100644 --- a/bookie/src/app/guest-book/guest-book-list/guest-book-list.component.html +++ b/bookie/src/app/guest-book/guest-book-list/guest-book-list.component.html @@ -1,78 +1,83 @@ -

- Guest List - - add_box - Table Booking - - - add_box - Walk-in - -

+@if (listResource.isLoading()) { + +} @else if (listResource.error()) { + +} @else { +

+ Guest List + + add_box + Table Booking + + + add_box + Walk-in + +

-
-
- - Date - - - - -
-
- - - - S. No / Total - {{ row.serial }} / {{ row.count }} - +
+
+ + Date + + + + +
+
+ + + + S. No / Total + {{ row.serial }} / {{ row.count }} + - - - Name - {{ row.name }} - + + + Name + {{ row.name }} + - - - Phone - {{ row.phone }} - + + + Phone + {{ row.phone }} + - - - Pax - {{ row.pax }} - + + + Pax + {{ row.pax }} + - - - Time - {{ row.bookingDate | localTime }} // {{ row.arrivalDate | localTime }} - + + + Time + {{ row.bookingDate | localTime }} // {{ row.arrivalDate | localTime }} + - - - Action - - @if (row.status === 'old' || (!row.tableId && !row.voucherId)) { - - } - @if (row.tableId) { - - } - + + Action + + @if (row.status === 'old' || (!row.tableId && !row.voucherId)) { + + } + @if (row.tableId) { + + } + - - + + - - - + + +
+} diff --git a/bookie/src/app/guest-book/guest-book-list/guest-book-list.component.ts b/bookie/src/app/guest-book/guest-book-list/guest-book-list.component.ts index 7773d95..f11ceed 100644 --- a/bookie/src/app/guest-book/guest-book-list/guest-book-list.component.ts +++ b/bookie/src/app/guest-book/guest-book-list/guest-book-list.component.ts @@ -9,7 +9,9 @@ import { MatTableModule } from '@angular/material/table'; import { ActivatedRoute, Router, RouterLink } from '@angular/router'; import moment from 'moment'; +import { ErrorStateComponent } from '../../shared/error-state/error-state.component'; import { LocalTimePipe } from '../../shared/local-time.pipe'; +import { SkeletonLoaderComponent } from '../../shared/skeleton-loader/skeleton-loader.component'; import { GuestBookService } from '../guest-book.service'; export interface GuestBookListFormData { @@ -31,6 +33,8 @@ export interface GuestBookListFormData { MatTableModule, FormField, RouterLink, + ErrorStateComponent, + SkeletonLoaderComponent, ], }) export class GuestBookListComponent { diff --git a/bookie/src/app/header-footer/header-footer.component.html b/bookie/src/app/header-footer/header-footer.component.html index d0f8138..5220ccd 100644 --- a/bookie/src/app/header-footer/header-footer.component.html +++ b/bookie/src/app/header-footer/header-footer.component.html @@ -1,23 +1,29 @@ -
+@if (listResource.isLoading()) { + +} @else if (listResource.error()) { + +} @else { + +
+ + Header / Footer + + @for (s of list(); track s) { + + {{ s.name }} + + } + + +
+
+ + Text + + +
+
- - Header / Footer - - @for (s of list(); track s) { - - {{ s.name }} - - } - - +
-
- - Text - - -
- -
- -
+} diff --git a/bookie/src/app/header-footer/header-footer.component.ts b/bookie/src/app/header-footer/header-footer.component.ts index 1e3ba66..16d760b 100644 --- a/bookie/src/app/header-footer/header-footer.component.ts +++ b/bookie/src/app/header-footer/header-footer.component.ts @@ -9,6 +9,8 @@ import { MatSelectChange, MatSelectModule } from '@angular/material/select'; import { MatSnackBar } from '@angular/material/snack-bar'; import { Router } from '@angular/router'; +import { ErrorStateComponent } from '../shared/error-state/error-state.component'; +import { SkeletonLoaderComponent } from '../shared/skeleton-loader/skeleton-loader.component'; import { HeaderFooter } from './header-footer'; import { HeaderFooterService } from './header-footer.service'; @@ -29,6 +31,8 @@ export interface HeaderFooterFormData { MatOptionModule, MatSelectModule, FormField, + ErrorStateComponent, + SkeletonLoaderComponent, ], }) export class HeaderFooterComponent { diff --git a/bookie/src/app/menu-category/menu-category-detail/menu-category-detail.component.html b/bookie/src/app/menu-category/menu-category-detail/menu-category-detail.component.html index bb73daf..e45be34 100644 --- a/bookie/src/app/menu-category/menu-category-detail/menu-category-detail.component.html +++ b/bookie/src/app/menu-category/menu-category-detail/menu-category-detail.component.html @@ -1,23 +1,29 @@ -

Menu Category

-
-
- - Name - - -
-
- Is Active? -
-
+@if (itemResource.isLoading()) { + +} @else if (itemResource.error()) { + +} @else { +

Menu Category

+
+
+ + Name + + +
+
+ Is Active? +
+
-
- - @if (!!item().id) { - - } -
+ @if (!!item().id) { + + } +
+} diff --git a/bookie/src/app/menu-category/menu-category-detail/menu-category-detail.component.ts b/bookie/src/app/menu-category/menu-category-detail/menu-category-detail.component.ts index 4e1ce86..b088944 100644 --- a/bookie/src/app/menu-category/menu-category-detail/menu-category-detail.component.ts +++ b/bookie/src/app/menu-category/menu-category-detail/menu-category-detail.component.ts @@ -10,6 +10,8 @@ import { Router } from '@angular/router'; import { MenuCategory } from '../../core/menu-category'; import { ConfirmDialogComponent } from '../../shared/confirm-dialog/confirm-dialog.component'; +import { ErrorStateComponent } from '../../shared/error-state/error-state.component'; +import { SkeletonLoaderComponent } from '../../shared/skeleton-loader/skeleton-loader.component'; import { MenuCategoryService } from '../menu-category.service'; export interface MenuCategoryDetailFormData { @@ -21,7 +23,15 @@ export interface MenuCategoryDetailFormData { selector: 'app-menu-category-detail', templateUrl: './menu-category-detail.component.html', styleUrls: ['./menu-category-detail.component.css'], - imports: [MatButtonModule, MatCheckboxModule, MatFormFieldModule, MatInputModule, FormField], + imports: [ + MatButtonModule, + MatCheckboxModule, + MatFormFieldModule, + MatInputModule, + FormField, + ErrorStateComponent, + SkeletonLoaderComponent, + ], }) export class MenuCategoryDetailComponent { private router = inject(Router); diff --git a/bookie/src/app/menu-category/menu-category-list/menu-category-list.component.html b/bookie/src/app/menu-category/menu-category-list/menu-category-list.component.html index 7461994..3be9e83 100644 --- a/bookie/src/app/menu-category/menu-category-list/menu-category-list.component.html +++ b/bookie/src/app/menu-category/menu-category-list/menu-category-list.component.html @@ -1,39 +1,45 @@ -

- Menu Categories - - - add_box - Add - -

- - - - Name - {{ row.name }} - +@if (listResource.isLoading()) { + +} @else if (listResource.error()) { + +} @else { +

+ Menu Categories + + + add_box + Add + +

+ + + + Name + {{ row.name }} + - - - Active? - {{ row.isActive }} - + + + Active? + {{ row.isActive }} + - - - Fixture? - {{ row.isFixture }} - + + + Fixture? + {{ row.isFixture }} + - - - + + +
+} diff --git a/bookie/src/app/menu-category/menu-category-list/menu-category-list.component.ts b/bookie/src/app/menu-category/menu-category-list/menu-category-list.component.ts index d53f2e2..8610d24 100644 --- a/bookie/src/app/menu-category/menu-category-list/menu-category-list.component.ts +++ b/bookie/src/app/menu-category/menu-category-list/menu-category-list.component.ts @@ -8,12 +8,22 @@ import { RouterLink } from '@angular/router'; import { firstValueFrom } from 'rxjs'; import { MenuCategory } from '../../core/menu-category'; +import { ErrorStateComponent } from '../../shared/error-state/error-state.component'; +import { SkeletonLoaderComponent } from '../../shared/skeleton-loader/skeleton-loader.component'; import { MenuCategoryService } from '../menu-category.service'; @Component({ selector: 'app-menu-category-list', templateUrl: './menu-category-list.component.html', styleUrls: ['./menu-category-list.component.css'], - imports: [DragDropModule, MatButtonModule, MatIconModule, MatTableModule, RouterLink], + imports: [ + DragDropModule, + MatButtonModule, + MatIconModule, + MatTableModule, + RouterLink, + ErrorStateComponent, + SkeletonLoaderComponent, + ], }) export class MenuCategoryListComponent { private snackBar = inject(MatSnackBar); diff --git a/bookie/src/app/menu-engineering-report/menu-engineering-report.component.html b/bookie/src/app/menu-engineering-report/menu-engineering-report.component.html index 28e5931..7f502b6 100644 --- a/bookie/src/app/menu-engineering-report/menu-engineering-report.component.html +++ b/bookie/src/app/menu-engineering-report/menu-engineering-report.component.html @@ -1,103 +1,109 @@ -

- Menu Engineering Report - - - -

+@if (infoResource.isLoading()) { + +} @else if (infoResource.error()) { + +} @else { +

+ Menu Engineering Report + + + +

-
-
- - Start Date - - - - - - Finish Date - - - - - -
-
- - Filter - - n: Name, sc: Sale Category, mc: Menu Category, q:(=/<=/>=/</>)Quantity, - s:(=/<=/>=/</>)Sales +
+ + Start Date + + + + + + Finish Date + + + + + +
+
+ + Filter + + n: Name, sc: Sale Category, mc: Menu Category, q:(=/<=/>=/</>)Quantity, + s:(=/<=/>=/</>)Sales + +
+ + + + + Name + {{ row.name }} + + + + + Price + {{ row.average | number: '1.2-2' }} / {{ row.price | number: '1.2-2' }} -
-
- - - - - Name - {{ row.name }} - + - - - Price - {{ row.average | number: '1.2-2' }} / {{ row.price | number: '1.2-2' }} - + + + Sale Category + {{ row.saleCategory }} + - - - Sale Category - {{ row.saleCategory }} - + + + Menu Category + {{ row.menuCategory }} + - - - Menu Category - {{ row.menuCategory }} - + + + Quantity + {{ row.quantity | number: '1.2-2' }} ({{ row.quantityPercent | percent: '1.2-2' }}) + - - - Quantity - {{ row.quantity | number: '1.2-2' }} ({{ row.quantityPercent | percent: '1.2-2' }}) - - - - - Sales - {{ row.sales | number: '1.2-2' }} ({{ row.salesPercent | percent: '1.2-2' }}) - - - - - - + + + Sales + {{ row.sales | number: '1.2-2' }} ({{ row.salesPercent | percent: '1.2-2' }}) + + + + + + +} diff --git a/bookie/src/app/menu-engineering-report/menu-engineering-report.component.ts b/bookie/src/app/menu-engineering-report/menu-engineering-report.component.ts index b10a089..aee252c 100644 --- a/bookie/src/app/menu-engineering-report/menu-engineering-report.component.ts +++ b/bookie/src/app/menu-engineering-report/menu-engineering-report.component.ts @@ -14,6 +14,8 @@ import { Router } from '@angular/router'; import { equal, larger, largerEq, smaller, smallerEq } from 'mathjs'; import moment from 'moment'; +import { ErrorStateComponent } from '../shared/error-state/error-state.component'; +import { SkeletonLoaderComponent } from '../shared/skeleton-loader/skeleton-loader.component'; import { ToCsvService } from '../shared/to-csv.service'; import { MenuEngineeringReport } from './menu-engineering-report'; import { MenuEngineeringReportItem } from './menu-engineering-report-item'; @@ -41,6 +43,8 @@ export interface MenuEngineeringReportFormData { MatTableModule, PercentPipe, FormField, + ErrorStateComponent, + SkeletonLoaderComponent, ], }) export class MenuEngineeringReportComponent { diff --git a/bookie/src/app/modifier-categories/modifier-category-detail/modifier-category-detail.component.html b/bookie/src/app/modifier-categories/modifier-category-detail/modifier-category-detail.component.html index 5922f28..f6e8dd7 100644 --- a/bookie/src/app/modifier-categories/modifier-category-detail/modifier-category-detail.component.html +++ b/bookie/src/app/modifier-categories/modifier-category-detail/modifier-category-detail.component.html @@ -1,65 +1,71 @@ -

Modifier Category

-
-
- - Name - - -
-
- - Minimum - - - - Maximum - - -
-
- Is Active? -
- - - - -
  • - - - - {{ node.name }} -
  • -
    - - -
  • -
    - +@if (itemResource.isLoading()) { + +} @else if (itemResource.error()) { + +} @else { +

    Modifier Category

    + +
    + + Name + + +
    +
    + + Minimum + + + + Maximum + + +
    +
    + Is Active? +
    + + + + +
  • + + + {{ node.name }} -
  • -
      - -
    - - - - + + + + +
  • +
    + + {{ node.name }} +
    +
      + +
    +
  • +
    + + -
    - - -
    +
    + + +
    +} diff --git a/bookie/src/app/modifier-categories/modifier-category-detail/modifier-category-detail.component.ts b/bookie/src/app/modifier-categories/modifier-category-detail/modifier-category-detail.component.ts index 4abf3ea..9249313 100644 --- a/bookie/src/app/modifier-categories/modifier-category-detail/modifier-category-detail.component.ts +++ b/bookie/src/app/modifier-categories/modifier-category-detail/modifier-category-detail.component.ts @@ -13,6 +13,8 @@ import { Router } from '@angular/router'; import { ModifierCategory, MenuCategory, StockKeepingUnitLink } from '../../core/modifier-category'; import { ConfirmDialogComponent } from '../../shared/confirm-dialog/confirm-dialog.component'; +import { ErrorStateComponent } from '../../shared/error-state/error-state.component'; +import { SkeletonLoaderComponent } from '../../shared/skeleton-loader/skeleton-loader.component'; import { ModifierCategoryService } from '../modifier-category.service'; import { NodeItem } from '../node-item'; @@ -46,6 +48,8 @@ export interface ModifierCategoryDetailFormData { MatInputModule, MatTreeModule, FormField, + ErrorStateComponent, + SkeletonLoaderComponent, ], }) export class ModifierCategoryDetailComponent { diff --git a/bookie/src/app/modifier-categories/modifier-category-list/modifier-category-list.component.html b/bookie/src/app/modifier-categories/modifier-category-list/modifier-category-list.component.html index d43dade..caad6d2 100644 --- a/bookie/src/app/modifier-categories/modifier-category-list/modifier-category-list.component.html +++ b/bookie/src/app/modifier-categories/modifier-category-list/modifier-category-list.component.html @@ -1,63 +1,69 @@ -

    - Modifier Categories - - add_box - Add - -

    - - - - Name - {{ row.name }} - +@if (listResource.isLoading()) { + +} @else if (listResource.error()) { + +} @else { +

    + Modifier Categories + + add_box + Add + +

    + + + + Name + {{ row.name }} + - - - Minimum - {{ row.minimum }} - + + + Minimum + {{ row.minimum }} + - - - Maximum - {{ row.maximum }} - + + + Maximum + {{ row.maximum }} + - - - Is Active - - - {{ row.isActive ? 'visibility' : 'visibility_off' }} - - {{ row.isActive ? 'Active' : 'Not Active' }} - - + + + Is Active + + + {{ row.isActive ? 'visibility' : 'visibility_off' }} + + {{ row.isActive ? 'Active' : 'Not Active' }} + + - - - Products - -
      - @for (mc of row.menuCategories; track mc) { -
    • - {{ mc.name }} - @if (!mc.enabled) { -
        - @for (p of mc.skus; track p) { -
      • {{ p.name }}
      • - } -
      - } -
    • - } -
    -
    -
    + + + Products + +
      + @for (mc of row.menuCategories; track mc) { +
    • + {{ mc.name }} + @if (!mc.enabled) { +
        + @for (p of mc.skus; track p) { +
      • {{ p.name }}
      • + } +
      + } +
    • + } +
    +
    +
    - - -
    + + +
    +} diff --git a/bookie/src/app/modifier-categories/modifier-category-list/modifier-category-list.component.ts b/bookie/src/app/modifier-categories/modifier-category-list/modifier-category-list.component.ts index 62bed24..917d139 100644 --- a/bookie/src/app/modifier-categories/modifier-category-list/modifier-category-list.component.ts +++ b/bookie/src/app/modifier-categories/modifier-category-list/modifier-category-list.component.ts @@ -4,12 +4,14 @@ import { MatIconModule } from '@angular/material/icon'; import { MatTableModule } from '@angular/material/table'; import { RouterLink } from '@angular/router'; +import { ErrorStateComponent } from '../../shared/error-state/error-state.component'; +import { SkeletonLoaderComponent } from '../../shared/skeleton-loader/skeleton-loader.component'; import { ModifierCategoryService } from '../modifier-category.service'; @Component({ selector: 'app-modifier-category-list', templateUrl: './modifier-category-list.component.html', styleUrls: ['./modifier-category-list.component.css'], - imports: [MatButtonModule, MatIconModule, MatTableModule, RouterLink], + imports: [MatButtonModule, MatIconModule, MatTableModule, RouterLink, ErrorStateComponent, SkeletonLoaderComponent], }) export class ModifierCategoryListComponent { private modifierCategoryService = inject(ModifierCategoryService); diff --git a/bookie/src/app/modifiers/modifier-detail/modifier-detail.component.html b/bookie/src/app/modifiers/modifier-detail/modifier-detail.component.html index 0f837ad..e0e95b8 100644 --- a/bookie/src/app/modifiers/modifier-detail/modifier-detail.component.html +++ b/bookie/src/app/modifiers/modifier-detail/modifier-detail.component.html @@ -1,43 +1,49 @@ -

    Modifier

    -
    -
    - - Name - - -
    -
    - Show In Bill? -
    -
    - - Price - - -
    -
    - - Category - - @for (mc of modifierCategories(); track mc) { - - {{ mc.name }} - +@if (itemResource.isLoading()) { + +} @else if (itemResource.error()) { + +} @else { +

    Modifier

    + +
    + + Name + + +
    +
    + Show In Bill? +
    +
    + + Price + + +
    +
    + + Category + + @for (mc of modifierCategories(); track mc) { + + {{ mc.name }} + + } + + @for (error of form.modifierCategory().errors(); track error) { + {{ error.message }} } - - @for (error of form.modifierCategory().errors(); track error) { - {{ error.message }} - } - -
    -
    - Is Active? -
    - +
    +
    +
    + Is Active? +
    + -
    - - @if (!!item().id) { - - } -
    +
    + + @if (!!item().id) { + + } +
    +} diff --git a/bookie/src/app/modifiers/modifier-detail/modifier-detail.component.ts b/bookie/src/app/modifiers/modifier-detail/modifier-detail.component.ts index 4afacc0..4cd6174 100644 --- a/bookie/src/app/modifiers/modifier-detail/modifier-detail.component.ts +++ b/bookie/src/app/modifiers/modifier-detail/modifier-detail.component.ts @@ -14,6 +14,8 @@ import { Modifier } from '../../core/modifier'; import { ModifierCategory } from '../../core/modifier-category'; import { ModifierCategoryService } from '../../modifier-categories/modifier-category.service'; import { ConfirmDialogComponent } from '../../shared/confirm-dialog/confirm-dialog.component'; +import { ErrorStateComponent } from '../../shared/error-state/error-state.component'; +import { SkeletonLoaderComponent } from '../../shared/skeleton-loader/skeleton-loader.component'; import { ModifierService } from '../modifier.service'; export interface ModifierDetailFormData { @@ -36,6 +38,8 @@ export interface ModifierDetailFormData { MatOptionModule, MatSelectModule, FormField, + ErrorStateComponent, + SkeletonLoaderComponent, ], }) export class ModifierDetailComponent { diff --git a/bookie/src/app/modifiers/modifier-list/modifier-list.component.html b/bookie/src/app/modifiers/modifier-list/modifier-list.component.html index 9a0897d..d536dde 100644 --- a/bookie/src/app/modifiers/modifier-list/modifier-list.component.html +++ b/bookie/src/app/modifiers/modifier-list/modifier-list.component.html @@ -1,72 +1,78 @@ -

    - Modifiers - - add_box - Add - -

    -
    -
    - - Modifier Category - - -- All Categories -- - @for (mc of modifierCategories(); track mc.id) { - - {{ mc.name }} - - } - - -
    -
    - - - - Name - {{ row.name }} - +@if (listResource.isLoading()) { + +} @else if (listResource.error()) { + +} @else { +

    + Modifiers + + add_box + Add + +

    +
    +
    + + Modifier Category + + -- All Categories -- + @for (mc of modifierCategories(); track mc.id) { + + {{ mc.name }} + + } + + +
    +
    + + + + Name + {{ row.name }} + - - - Show In Bill - -
    -
    - - {{ row.showInBill ? 'visibility' : 'visibility_off' }} - - {{ row.showInBill ? 'Show' : 'Hide' }} + + + Show In Bill + +
    +
    + + {{ row.showInBill ? 'visibility' : 'visibility_off' }} + + {{ row.showInBill ? 'Show' : 'Hide' }} +
    -
    - - + + - - - Price - {{ row.price | currency: 'INR' }} - + + + Price + {{ row.price | currency: 'INR' }} + - - - Category - {{ row.modifierCategory.name }} - + + + Category + {{ row.modifierCategory.name }} + - - - Is Active - - - {{ row.isActive ? 'visibility' : 'visibility_off' }} - - {{ row.isActive ? 'Active' : 'Not Active' }} - - + + + Is Active + + + {{ row.isActive ? 'visibility' : 'visibility_off' }} + + {{ row.isActive ? 'Active' : 'Not Active' }} + + - - - + + + +} diff --git a/bookie/src/app/modifiers/modifier-list/modifier-list.component.ts b/bookie/src/app/modifiers/modifier-list/modifier-list.component.ts index 96ee2f3..913f6f2 100644 --- a/bookie/src/app/modifiers/modifier-list/modifier-list.component.ts +++ b/bookie/src/app/modifiers/modifier-list/modifier-list.component.ts @@ -10,6 +10,8 @@ import { MatTableModule } from '@angular/material/table'; import { RouterLink } from '@angular/router'; import { ModifierCategoryService } from '../../modifier-categories/modifier-category.service'; +import { ErrorStateComponent } from '../../shared/error-state/error-state.component'; +import { SkeletonLoaderComponent } from '../../shared/skeleton-loader/skeleton-loader.component'; import { ModifierService } from '../modifier.service'; export interface ModifierListFormData { @@ -30,6 +32,8 @@ export interface ModifierListFormData { MatTableModule, FormField, RouterLink, + ErrorStateComponent, + SkeletonLoaderComponent, ], }) export class ModifierListComponent { diff --git a/bookie/src/app/printers/printer-detail/printer-detail.component.html b/bookie/src/app/printers/printer-detail/printer-detail.component.html index dcee6c1..b47bad2 100644 --- a/bookie/src/app/printers/printer-detail/printer-detail.component.html +++ b/bookie/src/app/printers/printer-detail/printer-detail.component.html @@ -1,26 +1,32 @@ -

    Printer

    -
    -
    - - Name - - -
    -
    - - Address - - - - Cut Code - - -
    -
    +@if (itemResource.isLoading()) { + +} @else if (itemResource.error()) { + +} @else { +

    Printer

    +
    +
    + + Name + + +
    +
    + + Address + + + + Cut Code + + +
    +
    -
    - - @if (!!item().id) { - - } -
    +
    + + @if (!!item().id) { + + } +
    +} diff --git a/bookie/src/app/printers/printer-detail/printer-detail.component.ts b/bookie/src/app/printers/printer-detail/printer-detail.component.ts index c2c3fd5..9e00767 100644 --- a/bookie/src/app/printers/printer-detail/printer-detail.component.ts +++ b/bookie/src/app/printers/printer-detail/printer-detail.component.ts @@ -9,6 +9,8 @@ import { Router } from '@angular/router'; import { Printer } from '../../core/printer'; import { ConfirmDialogComponent } from '../../shared/confirm-dialog/confirm-dialog.component'; +import { ErrorStateComponent } from '../../shared/error-state/error-state.component'; +import { SkeletonLoaderComponent } from '../../shared/skeleton-loader/skeleton-loader.component'; import { PrinterService } from '../printer.service'; export interface PrinterDetailFormData { @@ -21,7 +23,14 @@ export interface PrinterDetailFormData { selector: 'app-printer-detail', templateUrl: './printer-detail.component.html', styleUrls: ['./printer-detail.component.css'], - imports: [MatButtonModule, MatFormFieldModule, MatInputModule, FormField], + imports: [ + MatButtonModule, + MatFormFieldModule, + MatInputModule, + FormField, + ErrorStateComponent, + SkeletonLoaderComponent, + ], }) export class PrinterDetailComponent { private router = inject(Router); diff --git a/bookie/src/app/printers/printer-list/printer-list.component.html b/bookie/src/app/printers/printer-list/printer-list.component.html index b2fc556..a71197a 100644 --- a/bookie/src/app/printers/printer-list/printer-list.component.html +++ b/bookie/src/app/printers/printer-list/printer-list.component.html @@ -1,31 +1,37 @@ -

    - Printers - - add_box - Add - -

    - - - - Name - {{ row.name }} - +@if (listResource.isLoading()) { + +} @else if (listResource.error()) { + +} @else { +

    + Printers + + add_box + Add + +

    + + + + Name + {{ row.name }} + - - - Address - {{ row.address }} - + + + Address + {{ row.address }} + - - - Cut Code - {{ row.cutCode }} - + + + Cut Code + {{ row.cutCode }} + - - - + + +
    +} diff --git a/bookie/src/app/printers/printer-list/printer-list.component.ts b/bookie/src/app/printers/printer-list/printer-list.component.ts index 34e80e2..b2f2b20 100644 --- a/bookie/src/app/printers/printer-list/printer-list.component.ts +++ b/bookie/src/app/printers/printer-list/printer-list.component.ts @@ -4,12 +4,14 @@ import { MatIconModule } from '@angular/material/icon'; import { MatTableModule } from '@angular/material/table'; import { RouterLink } from '@angular/router'; +import { ErrorStateComponent } from '../../shared/error-state/error-state.component'; +import { SkeletonLoaderComponent } from '../../shared/skeleton-loader/skeleton-loader.component'; import { PrinterService } from '../printer.service'; @Component({ selector: 'app-printer-list', templateUrl: './printer-list.component.html', styleUrls: ['./printer-list.component.css'], - imports: [MatButtonModule, MatIconModule, MatTableModule, RouterLink], + imports: [MatButtonModule, MatIconModule, MatTableModule, RouterLink, ErrorStateComponent, SkeletonLoaderComponent], }) export class PrinterListComponent { private printerService = inject(PrinterService); diff --git a/bookie/src/app/product-sale-report/product-sale-report.component.html b/bookie/src/app/product-sale-report/product-sale-report.component.html index de47a00..d474745 100644 --- a/bookie/src/app/product-sale-report/product-sale-report.component.html +++ b/bookie/src/app/product-sale-report/product-sale-report.component.html @@ -1,91 +1,97 @@ -

    - Product Sale Report - - - -

    +@if (infoResource.isLoading()) { + +} @else if (infoResource.error()) { + +} @else { +

    + Product Sale Report + + + +

    -
    -
    - - Start Date - - - - - - Finish Date - - - - - - Section - - -- All -- - @for (p of sections(); track p.id) { - - {{ p.name }} - - } - - - -
    -
    - - - - Name - {{ row.name }} - +
    +
    + + Start Date + + + + + + Finish Date + + + + + + Section + + -- All -- + @for (p of sections(); track p.id) { + + {{ p.name }} + + } + + + +
    +
    + + + + Name + {{ row.name }} + - - - Unbilled - {{ row.kot | number: '1.2-2' }} - + + + Unbilled + {{ row.kot | number: '1.2-2' }} + - - - Sale - {{ row.regularBill | number: '1.2-2' }} - + + + Sale + {{ row.regularBill | number: '1.2-2' }} + - - - No Charge - {{ row.noCharge | number: '1.2-2' }} - + + + No Charge + {{ row.noCharge | number: '1.2-2' }} + - - - Staff - {{ row.staff | number: '1.2-2' }} - + + + Staff + {{ row.staff | number: '1.2-2' }} + - - - Cancelled - {{ row.cancel | number: '1.2-2' }} - + + + Cancelled + {{ row.cancel | number: '1.2-2' }} + - - - + + +
    +} diff --git a/bookie/src/app/product-sale-report/product-sale-report.component.ts b/bookie/src/app/product-sale-report/product-sale-report.component.ts index e9a0f53..18f4904 100644 --- a/bookie/src/app/product-sale-report/product-sale-report.component.ts +++ b/bookie/src/app/product-sale-report/product-sale-report.component.ts @@ -13,6 +13,8 @@ import { Router } from '@angular/router'; import moment from 'moment'; import { SectionService } from '../sections/section.service'; +import { ErrorStateComponent } from '../shared/error-state/error-state.component'; +import { SkeletonLoaderComponent } from '../shared/skeleton-loader/skeleton-loader.component'; import { ToCsvService } from '../shared/to-csv.service'; import { ProductSaleReport } from './product-sale-report'; import { ProductSaleReportService } from './product-sale-report.service'; @@ -38,6 +40,8 @@ export interface ProductSaleReportFormData { MatTableModule, FormField, FormRoot, + ErrorStateComponent, + SkeletonLoaderComponent, ], }) export class ProductSaleReportComponent { diff --git a/bookie/src/app/product-updates-report/product-updates-report.component.html b/bookie/src/app/product-updates-report/product-updates-report.component.html index e5e416a..1117826 100644 --- a/bookie/src/app/product-updates-report/product-updates-report.component.html +++ b/bookie/src/app/product-updates-report/product-updates-report.component.html @@ -1,46 +1,52 @@ -

    - Product Update Report - -

    +@if (infoResource.isLoading()) { + +} @else if (infoResource.error()) { + +} @else { +

    + Product Update Report + +

    -
    -
    - - Start Date - - - - - - Finish Date - - - - - -
    -
    - - - - Details - {{ row }} - +
    +
    + + Start Date + + + + + + Finish Date + + + + + +
    +
    + + + + Details + {{ row }} + - - - + + +
    +} diff --git a/bookie/src/app/product-updates-report/product-updates-report.component.ts b/bookie/src/app/product-updates-report/product-updates-report.component.ts index 386fdac..a5eb7e0 100644 --- a/bookie/src/app/product-updates-report/product-updates-report.component.ts +++ b/bookie/src/app/product-updates-report/product-updates-report.component.ts @@ -9,6 +9,8 @@ import { MatTableModule } from '@angular/material/table'; import { Router } from '@angular/router'; import moment from 'moment'; +import { ErrorStateComponent } from '../shared/error-state/error-state.component'; +import { SkeletonLoaderComponent } from '../shared/skeleton-loader/skeleton-loader.component'; import { ToCsvService } from '../shared/to-csv.service'; import { ProductUpdatesReport } from './product-updates-report'; import { ProductUpdatesReportService } from './product-updates-report.service'; @@ -30,6 +32,8 @@ export interface ProductUpdatesReportFormData { MatInputModule, MatTableModule, FormField, + ErrorStateComponent, + SkeletonLoaderComponent, ], }) export class ProductUpdatesReportComponent { diff --git a/bookie/src/app/product/product-detail/product-detail.component.html b/bookie/src/app/product/product-detail/product-detail.component.html index 7341577..945f6aa 100644 --- a/bookie/src/app/product/product-detail/product-detail.component.html +++ b/bookie/src/app/product/product-detail/product-detail.component.html @@ -1,178 +1,184 @@ -

    Product

    -
    -
    - - Name - - - - Fraction Units - - +@if (itemResource.isLoading()) { + +} @else if (itemResource.error()) { + +} @else { +

    Product

    + +
    + + Name + + + + Fraction Units + + +
    +
    + + Sale Category + + @for (sc of saleCategories(); track sc) { + + {{ sc.name }} + + } + + + Enabled? +
    + +

    Stock Keeping Units

    + +
    + + Units + + @for (error of form.addRow.units().errors(); track error) { + {{ error.message }} + } + + + + Fraction + + @for (error of form.addRow.fraction().errors(); track error) { + {{ error.message }} + } + + + + Yield + + @for (error of form.addRow.productYield().errors(); track error) { + {{ error.message }} + } + + + + Cost Price + + @for (error of form.addRow.costPrice().errors(); track error) { + {{ error.message }} + } + + + + Sale Price + + @for (error of form.addRow.salePrice().errors(); track error) { + {{ error.message }} + } + + + + Menu Category + + @for (mc of menuCategories(); track mc) { + + {{ mc.name }} + + } + + @for (error of form.addRow.menuCategory().errors(); track error) { + {{ error.message }} + } + + + Has Happy Hour? + Not Available? + + +
    + + +
    + + + + Units + {{ row.units }} + + + + + Fraction + {{ row.fraction }} + + + + + Yield + {{ row.productYield }} + + + + + Cost Price + {{ row.costPrice | currency: 'INR' }} + + + + + Sale Price + {{ row.salePrice | currency: 'INR' }} + + + + + Menu Category + + {{ row.menuCategory?.name ?? row.menuCategory?.id ?? '' }} + + + + + + Happy Hour + + + + + + + + Not Available + + + + + + + + Action + + + + + + + + +
    - - Sale Category - - @for (sc of saleCategories(); track sc) { - - {{ sc.name }} - - } - - - Enabled? + + @if (!!item().id) { + + }
    - -

    Stock Keeping Units

    - -
    - - Units - - @for (error of form.addRow.units().errors(); track error) { - {{ error.message }} - } - - - - Fraction - - @for (error of form.addRow.fraction().errors(); track error) { - {{ error.message }} - } - - - - Yield - - @for (error of form.addRow.productYield().errors(); track error) { - {{ error.message }} - } - - - - Cost Price - - @for (error of form.addRow.costPrice().errors(); track error) { - {{ error.message }} - } - - - - Sale Price - - @for (error of form.addRow.salePrice().errors(); track error) { - {{ error.message }} - } - - - - Menu Category - - @for (mc of menuCategories(); track mc) { - - {{ mc.name }} - - } - - @for (error of form.addRow.menuCategory().errors(); track error) { - {{ error.message }} - } - - - Has Happy Hour? - Not Available? - - -
    - - -
    - - - - Units - {{ row.units }} - - - - - Fraction - {{ row.fraction }} - - - - - Yield - {{ row.productYield }} - - - - - Cost Price - {{ row.costPrice | currency: 'INR' }} - - - - - Sale Price - {{ row.salePrice | currency: 'INR' }} - - - - - Menu Category - - {{ row.menuCategory?.name ?? row.menuCategory?.id ?? '' }} - - - - - - Happy Hour - - - - - - - - Not Available - - - - - - - - Action - - - - - - - - - -
    -
    - - @if (!!item().id) { - - } -
    +} diff --git a/bookie/src/app/product/product-detail/product-detail.component.ts b/bookie/src/app/product/product-detail/product-detail.component.ts index 9462787..122186d 100644 --- a/bookie/src/app/product/product-detail/product-detail.component.ts +++ b/bookie/src/app/product/product-detail/product-detail.component.ts @@ -19,6 +19,8 @@ import { SaleCategory } from '../../core/sale-category'; import { MenuCategoryService } from '../../menu-category/menu-category.service'; import { SaleCategoryService } from '../../sale-category/sale-category.service'; import { ConfirmDialogComponent } from '../../shared/confirm-dialog/confirm-dialog.component'; +import { ErrorStateComponent } from '../../shared/error-state/error-state.component'; +import { SkeletonLoaderComponent } from '../../shared/skeleton-loader/skeleton-loader.component'; import { ProductService } from '../product.service'; import { ProductDetailDialogComponent } from './product-detail-dialog.component'; @@ -55,6 +57,8 @@ export interface ProductDetailFormData { MatSelectModule, MatTableModule, FormField, + ErrorStateComponent, + SkeletonLoaderComponent, ], }) export class ProductDetailComponent { diff --git a/bookie/src/app/product/product-list/product-list.component.html b/bookie/src/app/product/product-list/product-list.component.html index 8e9bfda..af0cbce 100644 --- a/bookie/src/app/product/product-list/product-list.component.html +++ b/bookie/src/app/product/product-list/product-list.component.html @@ -1,134 +1,140 @@ -

    - Products - + + + + add_box + Add + +

    +
    +
    + + Filter + + + + Menu Category + + -- All Products -- + @for (mc of menuCategoriesResource.value(); track mc) { + + {{ mc.name }} + + } + + +
    +
    + - Update Order - - - - - add_box - Add - - -
    -
    - - Filter - - - - Menu Category - - -- All Products -- - @for (mc of menuCategoriesResource.value(); track mc) { - - {{ mc.name }} - - } - - -
    -
    - - - - Name - - - - + + + Name + + + + - - - Price - -
      - @for (sku of row.skus; track sku) { -
    • - {{ sku.salePrice | currency: 'INR' }} -
    • - } -
    -
    -
    + + + Price + +
      + @for (sku of row.skus; track sku) { +
    • + {{ sku.salePrice | currency: 'INR' }} +
    • + } +
    +
    +
    - - - Menu Category - -
      - @for (sku of row.skus; track sku) { -
    • - {{ sku.menuCategory.name }} -
    • - } -
    -
    -
    + + + Menu Category + +
      + @for (sku of row.skus; track sku) { +
    • + {{ sku.menuCategory.name }} +
    • + } +
    +
    +
    - - - Sale Category - {{ row.saleCategory.name }} - + + + Sale Category + {{ row.saleCategory.name }} + - - - Details - -
      - @for (sku of row.skus; track sku) { -
    • -
      - - {{ sku.hasHappyHour ? 'sentiment_satisfied_alt' : 'sentiment_dissatisfied' }} - - {{ sku.hasHappyHour ? 'Happy Hour' : 'Regular' }} -
      -
      - - {{ row.isNotAvailable ? 'pause' : 'play_arrow' }} - - {{ row.isNotAvailable ? 'Not Available' : 'Available' }} -
      -
    • - } -
    -
    -
    + + + Details + +
      + @for (sku of row.skus; track sku) { +
    • +
      + + {{ sku.hasHappyHour ? 'sentiment_satisfied_alt' : 'sentiment_dissatisfied' }} + + {{ sku.hasHappyHour ? 'Happy Hour' : 'Regular' }} +
      +
      + + {{ row.isNotAvailable ? 'pause' : 'play_arrow' }} + + {{ row.isNotAvailable ? 'Not Available' : 'Available' }} +
      +
    • + } +
    +
    +
    - - - Quantity - -
      - @for (sku of row.skus; track sku) { -
    • {{ sku.fraction | number: '1.2-2' }}{{ row.fractionUnits }}
    • - } -
    -
    -
    + + + Quantity + +
      + @for (sku of row.skus; track sku) { +
    • {{ sku.fraction | number: '1.2-2' }}{{ row.fractionUnits }}
    • + } +
    +
    +
    - - -
    + + +
    +} diff --git a/bookie/src/app/product/product-list/product-list.component.ts b/bookie/src/app/product/product-list/product-list.component.ts index 9184c7d..8bf49d4 100644 --- a/bookie/src/app/product/product-list/product-list.component.ts +++ b/bookie/src/app/product/product-list/product-list.component.ts @@ -15,6 +15,8 @@ import { firstValueFrom } from 'rxjs'; import { Product } from '../../core/product'; import { MenuCategoryService } from '../../menu-category/menu-category.service'; +import { ErrorStateComponent } from '../../shared/error-state/error-state.component'; +import { SkeletonLoaderComponent } from '../../shared/skeleton-loader/skeleton-loader.component'; import { ToCsvService } from '../../shared/to-csv.service'; import { ProductService } from '../product.service'; @@ -40,6 +42,8 @@ export interface ProductListFormData { MatTableModule, FormField, RouterModule, + ErrorStateComponent, + SkeletonLoaderComponent, ], }) export class ProductListComponent { @@ -59,7 +63,7 @@ export class ProductListComponent { form = form(this.formModel); - menuCategoryFilter = computed(() => this.formModel().menuCategory ?? ''); + menuCategoryFilter = computed(() => this.formModel().menuCategory ?? null); filterSignal = computed(() => this.formModel().filter); debouncedFilter = debounced(this.filterSignal, 150); diff --git a/bookie/src/app/product/product.service.ts b/bookie/src/app/product/product.service.ts index 86084f8..6b3519a 100644 --- a/bookie/src/app/product/product.service.ts +++ b/bookie/src/app/product/product.service.ts @@ -63,7 +63,7 @@ export class ProductService { .pipe(catchError(this.log.handleError(serviceName, 'update'))) as Observable; } - updateSortOrder(menuCategoryId: string, list: Product[]): Observable { + updateSortOrder(menuCategoryId: string | null, list: Product[]): Observable { return this.http .post(`${url}/list/${menuCategoryId}`, list, httpOptions) .pipe(catchError(this.log.handleError(serviceName, 'updateSortOrder'))) as Observable; diff --git a/bookie/src/app/regimes/regime-detail/regime-detail.component.html b/bookie/src/app/regimes/regime-detail/regime-detail.component.html index 1bfa513..59d29e9 100644 --- a/bookie/src/app/regimes/regime-detail/regime-detail.component.html +++ b/bookie/src/app/regimes/regime-detail/regime-detail.component.html @@ -1,32 +1,38 @@ -

    Regime

    -
    -
    - - Name - - -
    -
    - - Header - - -
    -
    - - Prefix - - -
    -
    +@if (itemResource.isLoading()) { + +} @else if (itemResource.error()) { + +} @else { +

    Regime

    +
    +
    + + Name + + +
    +
    + + Header + + +
    +
    + + Prefix + + +
    +
    -
    - - @if (!!item().id) { - - } -
    + @if (!!item().id) { + + } +
    +} diff --git a/bookie/src/app/regimes/regime-detail/regime-detail.component.ts b/bookie/src/app/regimes/regime-detail/regime-detail.component.ts index 8aa768c..357b5da 100644 --- a/bookie/src/app/regimes/regime-detail/regime-detail.component.ts +++ b/bookie/src/app/regimes/regime-detail/regime-detail.component.ts @@ -9,6 +9,8 @@ import { Router } from '@angular/router'; import { Regime } from '../../core/regime'; import { ConfirmDialogComponent } from '../../shared/confirm-dialog/confirm-dialog.component'; +import { ErrorStateComponent } from '../../shared/error-state/error-state.component'; +import { SkeletonLoaderComponent } from '../../shared/skeleton-loader/skeleton-loader.component'; import { RegimeService } from '../regime.service'; export interface RegimeDetailFormData { @@ -21,7 +23,14 @@ export interface RegimeDetailFormData { selector: 'app-regime-detail', templateUrl: './regime-detail.component.html', styleUrls: ['./regime-detail.component.css'], - imports: [MatButtonModule, MatFormFieldModule, MatInputModule, FormField], + imports: [ + MatButtonModule, + MatFormFieldModule, + MatInputModule, + FormField, + ErrorStateComponent, + SkeletonLoaderComponent, + ], }) export class RegimeDetailComponent { private router = inject(Router); diff --git a/bookie/src/app/regimes/regime-list/regime-list.component.html b/bookie/src/app/regimes/regime-list/regime-list.component.html index 09ed2b7..72b5b5b 100644 --- a/bookie/src/app/regimes/regime-list/regime-list.component.html +++ b/bookie/src/app/regimes/regime-list/regime-list.component.html @@ -1,37 +1,43 @@ -

    - Regimes - - add_box - Add - -

    - - - - Name - {{ row.name }} - +@if (listResource.isLoading()) { + +} @else if (listResource.error()) { + +} @else { +

    + Regimes + + add_box + Add + +

    + + + + Name + {{ row.name }} + - - - Header - {{ row.header }} - + + + Header + {{ row.header }} + - - - Prefix - {{ row.prefix }} - + + + Prefix + {{ row.prefix }} + - - - Is Fixture? - {{ row.isFixture }} - + + + Is Fixture? + {{ row.isFixture }} + - - - + + +
    +} diff --git a/bookie/src/app/regimes/regime-list/regime-list.component.ts b/bookie/src/app/regimes/regime-list/regime-list.component.ts index 41c711a..28061f8 100644 --- a/bookie/src/app/regimes/regime-list/regime-list.component.ts +++ b/bookie/src/app/regimes/regime-list/regime-list.component.ts @@ -4,12 +4,14 @@ import { MatIconModule } from '@angular/material/icon'; import { MatTableModule } from '@angular/material/table'; import { RouterLink } from '@angular/router'; +import { ErrorStateComponent } from '../../shared/error-state/error-state.component'; +import { SkeletonLoaderComponent } from '../../shared/skeleton-loader/skeleton-loader.component'; import { RegimeService } from '../regime.service'; @Component({ selector: 'app-regime-list', templateUrl: './regime-list.component.html', styleUrls: ['./regime-list.component.css'], - imports: [MatButtonModule, MatIconModule, MatTableModule, RouterLink], + imports: [MatButtonModule, MatIconModule, MatTableModule, RouterLink, ErrorStateComponent, SkeletonLoaderComponent], }) export class RegimeListComponent { private regimeService = inject(RegimeService); diff --git a/bookie/src/app/roles/role-detail/role-detail.component.html b/bookie/src/app/roles/role-detail/role-detail.component.html index c365902..57a0f9e 100644 --- a/bookie/src/app/roles/role-detail/role-detail.component.html +++ b/bookie/src/app/roles/role-detail/role-detail.component.html @@ -1,39 +1,45 @@ -

    Role

    -
    +@if (itemResource.isLoading()) { + +} @else if (itemResource.error()) { + +} @else { +

    Role

    + +
    + + Name + + +
    + +
    +
    +

    Permissions

    + @for (p of form.permissions; track p; let i = $index) { +
    + {{ p.name().value() }} +
    + } +
    + +
    +

    Includes Roles

    + @for (r of form.includedRoles; track r; let i = $index) { +
    + {{ r.name().value() }} +
    + } +
    +
    + +
    - - Name - - + +
    - -
    -
    -

    Permissions

    - @for (p of form.permissions; track p; let i = $index) { -
    - {{ p.name().value() }} -
    - } -
    - -
    -

    Includes Roles

    - @for (r of form.includedRoles; track r; let i = $index) { -
    - {{ r.name().value() }} -
    - } -
    -
    - - -
    - - -
    +} diff --git a/bookie/src/app/roles/role-detail/role-detail.component.ts b/bookie/src/app/roles/role-detail/role-detail.component.ts index 789890d..38d7ac2 100644 --- a/bookie/src/app/roles/role-detail/role-detail.component.ts +++ b/bookie/src/app/roles/role-detail/role-detail.component.ts @@ -9,6 +9,8 @@ import { MatSnackBar } from '@angular/material/snack-bar'; import { Router } from '@angular/router'; import { ConfirmDialogComponent } from '../../shared/confirm-dialog/confirm-dialog.component'; +import { ErrorStateComponent } from '../../shared/error-state/error-state.component'; +import { SkeletonLoaderComponent } from '../../shared/skeleton-loader/skeleton-loader.component'; import { Role } from '../role'; import { RoleService } from '../role.service'; @@ -22,7 +24,15 @@ export interface RoleDetailFormData { selector: 'app-role-detail', templateUrl: './role-detail.component.html', styleUrls: ['./role-detail.component.css'], - imports: [MatButtonModule, MatCheckboxModule, MatFormFieldModule, MatInputModule, FormField], + imports: [ + MatButtonModule, + MatCheckboxModule, + MatFormFieldModule, + MatInputModule, + FormField, + ErrorStateComponent, + SkeletonLoaderComponent, + ], }) export class RoleDetailComponent { private router = inject(Router); diff --git a/bookie/src/app/roles/role-list/role-list.component.html b/bookie/src/app/roles/role-list/role-list.component.html index e68a46e..92c18ff 100644 --- a/bookie/src/app/roles/role-list/role-list.component.html +++ b/bookie/src/app/roles/role-list/role-list.component.html @@ -1,47 +1,53 @@ -

    - Roles - - add_box - Add - -

    - - - - Name - {{ row.name }} - +@if (listResource.isLoading()) { + +} @else if (listResource.error()) { + +} @else { +

    + Roles + + add_box + Add + +

    + + + + Name + {{ row.name }} + - - - Includes - - @if (row.includedRoles?.length) { + + + Includes + + @if (row.includedRoles?.length) { +
      + @for (r of row.includedRoles; track r) { +
    • {{ r }}
    • + } +
    + } @else { + - + } +
    +
    + + + + Permissions +
      - @for (r of row.includedRoles; track r) { -
    • {{ r }}
    • + @for (permission of row.permissions; track permission) { +
    • {{ permission }}
    • }
    - } @else { - - - } -
    -
    +
    +
    - - - Permissions - -
      - @for (permission of row.permissions; track permission) { -
    • {{ permission }}
    • - } -
    -
    -
    - - - -
    + + +
    +} diff --git a/bookie/src/app/roles/role-list/role-list.component.ts b/bookie/src/app/roles/role-list/role-list.component.ts index 9df37a1..4f4df0e 100644 --- a/bookie/src/app/roles/role-list/role-list.component.ts +++ b/bookie/src/app/roles/role-list/role-list.component.ts @@ -4,12 +4,14 @@ import { MatIconModule } from '@angular/material/icon'; import { MatTableModule } from '@angular/material/table'; import { RouterLink } from '@angular/router'; +import { ErrorStateComponent } from '../../shared/error-state/error-state.component'; +import { SkeletonLoaderComponent } from '../../shared/skeleton-loader/skeleton-loader.component'; import { RoleService } from '../role.service'; @Component({ selector: 'app-role-list', templateUrl: './role-list.component.html', styleUrls: ['./role-list.component.css'], - imports: [MatButtonModule, MatIconModule, MatTableModule, RouterLink], + imports: [MatButtonModule, MatIconModule, MatTableModule, RouterLink, ErrorStateComponent, SkeletonLoaderComponent], }) export class RoleListComponent { private roleService = inject(RoleService); diff --git a/bookie/src/app/sale-category/sale-category-detail/sale-category-detail.component.html b/bookie/src/app/sale-category/sale-category-detail/sale-category-detail.component.html index 7b093b3..6b0c351 100644 --- a/bookie/src/app/sale-category/sale-category-detail/sale-category-detail.component.html +++ b/bookie/src/app/sale-category/sale-category-detail/sale-category-detail.component.html @@ -1,61 +1,67 @@ -

    Sale Category

    -
    +@if (itemResource.isLoading()) { + +} @else if (itemResource.error()) { + +} @else { +

    Sale Category

    + +
    + + Name + + +
    +
    + + Discount Limit + + % + +
    +
    + + Tax + + @for (t of taxes(); track t) { + + {{ t.name }} + + } + + +
    + +
    - - Name - - + + @if (!!item().id) { + + }
    -
    - - Discount Limit - - % - -
    -
    - - Tax - - @for (t of taxes(); track t) { - - {{ t.name }} - - } - - -
    - - -
    - - @if (!!item().id) { - - } -
    -

    Products

    - - - - Name - {{ row.name }} - +

    Products

    + + + + Name + {{ row.name }} + - - - Price - {{ row.price | currency: 'INR' }} - + + + Price + {{ row.price | currency: 'INR' }} + - - - Menu Category - {{ row.menuCategory.name }} - + + + Menu Category + {{ row.menuCategory.name }} + - - - + + +
    +} diff --git a/bookie/src/app/sale-category/sale-category-detail/sale-category-detail.component.ts b/bookie/src/app/sale-category/sale-category-detail/sale-category-detail.component.ts index 50c8ad1..1acaafa 100644 --- a/bookie/src/app/sale-category/sale-category-detail/sale-category-detail.component.ts +++ b/bookie/src/app/sale-category/sale-category-detail/sale-category-detail.component.ts @@ -17,6 +17,8 @@ import { SaleCategory } from '../../core/sale-category'; import { Tax } from '../../core/tax'; import { ProductService } from '../../product/product.service'; import { ConfirmDialogComponent } from '../../shared/confirm-dialog/confirm-dialog.component'; +import { ErrorStateComponent } from '../../shared/error-state/error-state.component'; +import { SkeletonLoaderComponent } from '../../shared/skeleton-loader/skeleton-loader.component'; import { TaxService } from '../../taxes/tax.service'; import { SaleCategoryService } from '../sale-category.service'; @@ -41,6 +43,8 @@ export interface SaleCategoryDetailFormData { MatTableModule, FormField, RouterLink, + ErrorStateComponent, + SkeletonLoaderComponent, ], }) export class SaleCategoryDetailComponent { diff --git a/bookie/src/app/sale-category/sale-category-list/sale-category-list.component.html b/bookie/src/app/sale-category/sale-category-list/sale-category-list.component.html index 5b06da4..3b31fc9 100644 --- a/bookie/src/app/sale-category/sale-category-list/sale-category-list.component.html +++ b/bookie/src/app/sale-category/sale-category-list/sale-category-list.component.html @@ -1,31 +1,37 @@ -

    - Sale Categories - - add_box - Add - -

    - - - - Name - {{ row.name }} - +@if (listResource.isLoading()) { + +} @else if (listResource.error()) { + +} @else { +

    + Sale Categories + + add_box + Add + +

    + + + + Name + {{ row.name }} + - - - Discount Limit - {{ row.discountLimit | percent: '1.2-2' }} - + + + Discount Limit + {{ row.discountLimit | percent: '1.2-2' }} + - - - Tax - {{ row.tax.rate | percent: '1.2-2' }} {{ row.tax.name }} - + + + Tax + {{ row.tax.rate | percent: '1.2-2' }} {{ row.tax.name }} + - - - + + +
    +} diff --git a/bookie/src/app/sale-category/sale-category-list/sale-category-list.component.ts b/bookie/src/app/sale-category/sale-category-list/sale-category-list.component.ts index 5785b61..751289f 100644 --- a/bookie/src/app/sale-category/sale-category-list/sale-category-list.component.ts +++ b/bookie/src/app/sale-category/sale-category-list/sale-category-list.component.ts @@ -5,12 +5,22 @@ import { MatIconModule } from '@angular/material/icon'; import { MatTableModule } from '@angular/material/table'; import { RouterLink } from '@angular/router'; +import { ErrorStateComponent } from '../../shared/error-state/error-state.component'; +import { SkeletonLoaderComponent } from '../../shared/skeleton-loader/skeleton-loader.component'; import { SaleCategoryService } from '../sale-category.service'; @Component({ selector: 'app-sale-category-list', templateUrl: './sale-category-list.component.html', styleUrls: ['./sale-category-list.component.css'], - imports: [MatButtonModule, MatIconModule, MatTableModule, PercentPipe, RouterLink], + imports: [ + MatButtonModule, + MatIconModule, + MatTableModule, + PercentPipe, + RouterLink, + ErrorStateComponent, + SkeletonLoaderComponent, + ], }) export class SaleCategoryListComponent { private ser = inject(SaleCategoryService); diff --git a/bookie/src/app/sale-report/sale-report.component.html b/bookie/src/app/sale-report/sale-report.component.html index 353434f..4d6f29f 100644 --- a/bookie/src/app/sale-report/sale-report.component.html +++ b/bookie/src/app/sale-report/sale-report.component.html @@ -1,66 +1,72 @@ -

    - Sale Report - - - -

    +@if (infoResource.isLoading()) { + +} @else if (infoResource.error()) { + +} @else { +

    + Sale Report + + + +

    -
    -
    - - Start Date - - - - - - Finish Date - - - - - - Section - - -- All -- - @for (p of sections(); track p.id) { - - {{ p.name }} - - } - - - -
    -
    - - - - Name - {{ row.name }} - +
    +
    + + Start Date + + + + + + Finish Date + + + + + + Section + + -- All -- + @for (p of sections(); track p.id) { + + {{ p.name }} + + } + + + +
    +
    + + + + Name + {{ row.name }} + - - - Amount - {{ row.amount | currency: 'INR' }} - - - - + + + Amount + {{ row.amount | currency: 'INR' }} + + + +
    +} diff --git a/bookie/src/app/sale-report/sale-report.component.ts b/bookie/src/app/sale-report/sale-report.component.ts index 9ffb920..aa95d46 100644 --- a/bookie/src/app/sale-report/sale-report.component.ts +++ b/bookie/src/app/sale-report/sale-report.component.ts @@ -14,6 +14,8 @@ import { Router } from '@angular/router'; import moment from 'moment'; import { SectionService } from '../sections/section.service'; +import { ErrorStateComponent } from '../shared/error-state/error-state.component'; +import { SkeletonLoaderComponent } from '../shared/skeleton-loader/skeleton-loader.component'; import { ToCsvService } from '../shared/to-csv.service'; import { SaleReport } from './sale-report'; import { SaleReportService } from './sale-report.service'; @@ -39,6 +41,8 @@ export interface SaleReportFormData { MatSelectModule, MatTableModule, FormField, + ErrorStateComponent, + SkeletonLoaderComponent, ], }) export class SaleReportComponent { diff --git a/bookie/src/app/sales/bills/bills.component.html b/bookie/src/app/sales/bills/bills.component.html index 2c71e19..6b464c4 100644 --- a/bookie/src/app/sales/bills/bills.component.html +++ b/bookie/src/app/sales/bills/bills.component.html @@ -1,207 +1,231 @@ -

    Bill

    - - - Bill / KOT number - - - {{ bs.bill().billId }} / K-{{ bs.bill().kotId }} - - - Time / Start Time / Last Edit Time - - - - {{ bs.bill().date }} / {{ bs.bill().creationDate }} / {{ bs.bill().lastEditDate }} - - - Table / Pax / Customer - - - / - / - - +@if (billResource.isLoading()) { + +} @else if (billResource.error()) { + +} @else { +

    Bill

    +
    + + Bill / KOT number + + + {{ bs.bill().billId }} / K-{{ bs.bill().kotId }} + + + Time / Start Time / Last Edit Time + + + + {{ bs.bill().date }} / {{ bs.bill().creationDate }} / {{ + bs.bill().lastEditDate + }} + + + Table / Pax / Customer + + + / + / + + - - - - @if (row.id) { + + + + @if (row.id) { + + + } + + + + - } - - - - - - - - - - - - - - - {{ row.id ? `Kot: ${row.kot.code} / ${row.kot.date} (${row.kot.user.name})` : '== New Kot ==' }} - - - - - {{ `${row.inv.sku.name} @ ${row.inv.price} - ${discountPct(row.inv)}%` }} -
      - @for (m of row.inv.modifiers; track m.id) { -
    • {{ m.name }}
    • - } -
    -
    -
    - - - {{ `${row.inv.sku.name} @ ${row.inv.price} - ${discountPct(row.inv)}%` }} -
      - @for (m of row.inv.modifiers; track m.id) { -
    • {{ m.name }}
    • - } -
    -
    -
    - - - Quantity - - - - - - Quantity - - - - - - - - - Quantity - - - - - - - +
    +
    + + + + + + + {{ row.id ? `Kot: ${row.kot.code} / ${row.kot.date} (${row.kot.user.name})` : '== New Kot ==' }} + + + + + {{ `${row.inv.sku.name} @ ${row.inv.price} - ${discountPct(row.inv)}%` }} +
      + @for (m of row.inv.modifiers; track m.id) { +
    • {{ m.name }}
    • + } +
    +
    +
    + + + {{ `${row.inv.sku.name} @ ${row.inv.price} - ${discountPct(row.inv)}%` }} +
      + @for (m of row.inv.modifiers; track m.id) { +
    • {{ m.name }}
    • + } +
    +
    +
    + + + Quantity + + + + + + Quantity + + + + + + + + + Quantity + + + + + + + - - - - - - - - - Gross - - - {{ - bs.grossAmount() | currency: 'INR' - }} - + + + + + + + + + Gross + + + {{ + bs.grossAmount() | currency: 'INR' + }} + - - - Happy Hour Discount - - - {{ bs.hhAmount() | currency: 'INR' }} - + + + Happy Hour Discount + + + {{ + bs.hhAmount() | currency: 'INR' + }} + - - - Discount - - - {{ - bs.discountAmount() | currency: 'INR' - }} - + + + Discount + + + {{ + bs.discountAmount() | currency: 'INR' + }} + - - - Tax - - - {{ bs.taxAmount() | currency: 'INR' }} - + + + Tax + + + {{ + bs.taxAmount() | currency: 'INR' + }} + - - - Amount - - - {{ bs.amount() | currency: 'INR' }} - -
    + + + Amount + + + {{ bs.amount() | currency: 'INR' }} + + - + +} diff --git a/bookie/src/app/sales/bills/bills.component.ts b/bookie/src/app/sales/bills/bills.component.ts index 1cc7567..93178f9 100644 --- a/bookie/src/app/sales/bills/bills.component.ts +++ b/bookie/src/app/sales/bills/bills.component.ts @@ -1,5 +1,5 @@ import { CommonModule, CurrencyPipe } from '@angular/common'; -import { Component, OnDestroy, OnInit, Signal, computed, effect, inject, input } from '@angular/core'; +import { Component, OnDestroy, Signal, computed, effect, inject, input, untracked } from '@angular/core'; import { MatButtonModule } from '@angular/material/button'; import { MatCheckboxModule } from '@angular/material/checkbox'; import { MatDialog } from '@angular/material/dialog'; @@ -15,7 +15,9 @@ import { AuthService } from '../../auth/auth.service'; import { Customer } from '../../core/customer'; import { Table } from '../../core/table'; import { ConfirmDialogComponent } from '../../shared/confirm-dialog/confirm-dialog.component'; +import { ErrorStateComponent } from '../../shared/error-state/error-state.component'; import { MathService } from '../../shared/math.service'; +import { SkeletonLoaderComponent } from '../../shared/skeleton-loader/skeleton-loader.component'; import { TableService } from '../../tables/table.service'; import { BillService } from '../bill.service'; import { ChooseCustomerComponent } from '../choose-customer/choose-customer.component'; @@ -42,9 +44,11 @@ import { VoucherService } from './voucher.service'; MatTableModule, MatTooltipModule, RouterOutlet, + ErrorStateComponent, + SkeletonLoaderComponent, ], }) -export class BillsComponent implements OnInit, OnDestroy { +export class BillsComponent implements OnDestroy { private router = inject(Router); private dialog = inject(MatDialog); private snackBar = inject(MatSnackBar); @@ -107,10 +111,6 @@ export class BillsComponent implements OnInit, OnDestroy { displayedColumns: string[] = ['selectInv', 'infoInv', 'quantity']; childColumns: string[] = ['selectChild', 'infoChild', 'childQuantity']; - ngOnInit() { - this.getPax(); - } - ngOnDestroy() { this.bs.reset(); } @@ -122,6 +122,8 @@ export class BillsComponent implements OnInit, OnDestroy { this.choosePax(); } + private paxChecked = false; + choosePax(): void { const dialogRef = this.dialog.open(PaxComponent, { // width: '750px', @@ -320,6 +322,12 @@ export class BillsComponent implements OnInit, OnDestroy { if (bill) { this.bs.loadData(bill, this.updateTable()); } + + const loading = this.billResource.isLoading() || this.tableResource.isLoading() || this.idResource.isLoading(); + if (!loading && bill && !this.paxChecked) { + this.paxChecked = true; + untracked(() => this.getPax()); + } }); } } diff --git a/bookie/src/app/sales/choose-customer/choose-customer.component.html b/bookie/src/app/sales/choose-customer/choose-customer.component.html index 4598dee..0e359cb 100644 --- a/bookie/src/app/sales/choose-customer/choose-customer.component.html +++ b/bookie/src/app/sales/choose-customer/choose-customer.component.html @@ -1,57 +1,63 @@ -

    Customer

    - -
    -
    - - Phone - - - - @for (customer of customers(); track customer) { - {{ customer.name }} - {{ customer.phone }} - } - -
    -
    - - Name - - -
    -
    - - Address - - -
    -
    - Print in Bill? -
    -

    -
    -
      - @for (r of formModel().discounts; track r.id) { - @if (r.discount > 0) { -
    • {{ r.name }} - {{ r.discount | percent: '1.2-2' }}
    • +@if (customersResource.isLoading()) { + +} @else if (customersResource.error()) { + +} @else { +

      Customer

      + + +
      + + Phone + + + + @for (customer of customers(); track customer) { + {{ customer.name }} - {{ customer.phone }} } - } -
    -
    -
    -
    - - - - + +
    +
    + + Name + + +
    +
    + + Address + + +
    +
    + Print in Bill? +
    +

    +
    +
      + @for (r of formModel().discounts; track r.id) { + @if (r.discount > 0) { +
    • {{ r.name }} - {{ r.discount | percent: '1.2-2' }}
    • + } + } +
    +
    + + + + + + +} diff --git a/bookie/src/app/sales/choose-customer/choose-customer.component.ts b/bookie/src/app/sales/choose-customer/choose-customer.component.ts index 58b71a8..b81ae50 100644 --- a/bookie/src/app/sales/choose-customer/choose-customer.component.ts +++ b/bookie/src/app/sales/choose-customer/choose-customer.component.ts @@ -13,6 +13,8 @@ import { MatInputModule } from '@angular/material/input'; import { Customer } from '../../core/customer'; import { CustomerDiscount } from '../../core/customer-discount'; import { CustomerService } from '../../customers/customer.service'; +import { ErrorStateComponent } from '../../shared/error-state/error-state.component'; +import { SkeletonLoaderComponent } from '../../shared/skeleton-loader/skeleton-loader.component'; export interface ChooseCustomerFormData { id: string; @@ -38,6 +40,8 @@ export interface ChooseCustomerFormData { MatOptionModule, PercentPipe, FormField, + ErrorStateComponent, + SkeletonLoaderComponent, ], }) export class ChooseCustomerComponent { diff --git a/bookie/src/app/sales/home/sales-home.component.html b/bookie/src/app/sales/home/sales-home.component.html index 953daaf..a6ad705 100644 --- a/bookie/src/app/sales/home/sales-home.component.html +++ b/bookie/src/app/sales/home/sales-home.component.html @@ -1,76 +1,82 @@ -
    - -

    Add Product

    -
    - -

    Discount

    -
    - -

    Print KOT

    -
    - -

    Print Bill

    -
    - -

    Back to Tables

    -
    - -

    Receive Payment

    -
    - -

    Move Table

    -
    - -

    Cancel Bill

    -
    - -

    Split Bill

    -
    -
    +@if (saleCategoriesResource.isLoading()) { + +} @else if (saleCategoriesResource.error()) { + +} @else { +
    + +

    Add Product

    +
    + +

    Discount

    +
    + +

    Print KOT

    +
    + +

    Print Bill

    +
    + +

    Back to Tables

    +
    + +

    Receive Payment

    +
    + +

    Move Table

    +
    + +

    Cancel Bill

    +
    + +

    Split Bill

    +
    +
    +} diff --git a/bookie/src/app/sales/home/sales-home.component.ts b/bookie/src/app/sales/home/sales-home.component.ts index 5b5c4b8..f40e0fe 100644 --- a/bookie/src/app/sales/home/sales-home.component.ts +++ b/bookie/src/app/sales/home/sales-home.component.ts @@ -13,6 +13,8 @@ import { SaleCategory } from '../../core/sale-category'; import { Table } from '../../core/table'; import { SaleCategoryService } from '../../sale-category/sale-category.service'; import { ConfirmDialogComponent } from '../../shared/confirm-dialog/confirm-dialog.component'; +import { ErrorStateComponent } from '../../shared/error-state/error-state.component'; +import { SkeletonLoaderComponent } from '../../shared/skeleton-loader/skeleton-loader.component'; import { TableService } from '../../tables/table.service'; import { BillTypeComponent } from '../bill-type/bill-type.component'; import { BillService } from '../bill.service'; @@ -28,7 +30,7 @@ import { TablesDialogComponent } from '../tables-dialog/tables-dialog.component' selector: 'app-sales-home', templateUrl: './sales-home.component.html', styleUrls: ['./sales-home.component.sass'], - imports: [MatRippleModule, RouterLink, MatCardModule], + imports: [MatRippleModule, RouterLink, MatCardModule, ErrorStateComponent, SkeletonLoaderComponent], }) export class SalesHomeComponent { private router = inject(Router); diff --git a/bookie/src/app/sales/menu-categories/menu-categories.component.html b/bookie/src/app/sales/menu-categories/menu-categories.component.html index df76f80..7d1fb89 100644 --- a/bookie/src/app/sales/menu-categories/menu-categories.component.html +++ b/bookie/src/app/sales/menu-categories/menu-categories.component.html @@ -1,15 +1,21 @@ -
    - -

    Back

    -
    - @for (item of list(); track item) { - -

    {{ item.name }}

    +@if (listResource.isLoading()) { + +} @else if (listResource.error()) { + +} @else { +
    + +

    Back

    - } -
    + @for (item of list(); track item) { + +

    {{ item.name }}

    +
    + } +
    +} diff --git a/bookie/src/app/sales/menu-categories/menu-categories.component.ts b/bookie/src/app/sales/menu-categories/menu-categories.component.ts index d86eb2b..f28c369 100644 --- a/bookie/src/app/sales/menu-categories/menu-categories.component.ts +++ b/bookie/src/app/sales/menu-categories/menu-categories.component.ts @@ -4,12 +4,14 @@ import { MatRippleModule } from '@angular/material/core'; import { RouterLink } from '@angular/router'; import { MenuCategoryService } from '../../menu-category/menu-category.service'; +import { ErrorStateComponent } from '../../shared/error-state/error-state.component'; +import { SkeletonLoaderComponent } from '../../shared/skeleton-loader/skeleton-loader.component'; @Component({ selector: 'app-menu-category', templateUrl: './menu-categories.component.html', styleUrls: ['./menu-categories.component.sass'], - imports: [MatRippleModule, RouterLink, MatCardModule], + imports: [MatRippleModule, RouterLink, MatCardModule, ErrorStateComponent, SkeletonLoaderComponent], }) export class MenuCategoriesComponent { private menuCategoryService = inject(MenuCategoryService); diff --git a/bookie/src/app/sales/products/products.component.html b/bookie/src/app/sales/products/products.component.html index 2957a8b..7d11005 100644 --- a/bookie/src/app/sales/products/products.component.html +++ b/bookie/src/app/sales/products/products.component.html @@ -1,23 +1,29 @@ -
    - -

    Back

    -
    - @for (item of list(); track item) { +@if (listResource.isLoading()) { + +} @else if (listResource.error()) { + +} @else { +
    -

    {{ item.name }}

    - {{ item.price | currency: 'INR' }} +

    Back

    - } -
    + @for (item of list(); track item) { + +

    {{ item.name }}

    + {{ item.price | currency: 'INR' }} +
    + } +
    +} diff --git a/bookie/src/app/sales/products/products.component.ts b/bookie/src/app/sales/products/products.component.ts index 334288a..dddd9a6 100644 --- a/bookie/src/app/sales/products/products.component.ts +++ b/bookie/src/app/sales/products/products.component.ts @@ -6,13 +6,15 @@ import { RouterLink } from '@angular/router'; import { ProductQuery } from '../../core/product-query'; import { ProductService } from '../../product/product.service'; +import { ErrorStateComponent } from '../../shared/error-state/error-state.component'; +import { SkeletonLoaderComponent } from '../../shared/skeleton-loader/skeleton-loader.component'; import { BillService } from '../bill.service'; @Component({ selector: 'app-products', templateUrl: './products.component.html', styleUrls: ['./products.component.sass'], - imports: [CurrencyPipe, MatRippleModule, RouterLink, MatCardModule], + imports: [CurrencyPipe, MatRippleModule, RouterLink, MatCardModule, ErrorStateComponent, SkeletonLoaderComponent], }) export class ProductsComponent { private productService = inject(ProductService); diff --git a/bookie/src/app/sales/receive-payment/receive-payment.component.html b/bookie/src/app/sales/receive-payment/receive-payment.component.html index a86fdca..6496272 100644 --- a/bookie/src/app/sales/receive-payment/receive-payment.component.html +++ b/bookie/src/app/sales/receive-payment/receive-payment.component.html @@ -1,44 +1,50 @@ -

    Receive Payment

    - -
    - - - - Amount - {{ row.name }} - Balance - - - - {{ - amount | currency: 'INR' - }} - - - - - - {{ balance() | currency: 'INR' }} - - - - - - - Reason - - -
    -
    - - - - +@if (settleOptionsResource.isLoading()) { + +} @else if (settleOptionsResource.error()) { + +} @else { +

    Receive Payment

    + +
    + + + + Amount + {{ row.name }} + Balance + + + + {{ + amount | currency: 'INR' + }} + + + + + + {{ balance() | currency: 'INR' }} + + + + + + + Reason + + +
    +
    + + + + +} diff --git a/bookie/src/app/sales/receive-payment/receive-payment.component.ts b/bookie/src/app/sales/receive-payment/receive-payment.component.ts index ecd6c36..6a310dc 100644 --- a/bookie/src/app/sales/receive-payment/receive-payment.component.ts +++ b/bookie/src/app/sales/receive-payment/receive-payment.component.ts @@ -10,6 +10,8 @@ import { MatTableModule } from '@angular/material/table'; import { ReceivePaymentItem } from '../../core/receive-payment-item'; import { SettleOptionService } from '../../settle-option/settle-option.service'; +import { ErrorStateComponent } from '../../shared/error-state/error-state.component'; +import { SkeletonLoaderComponent } from '../../shared/skeleton-loader/skeleton-loader.component'; import { VoucherType } from '../bills/voucher-type'; export interface ReceivePaymentFormData { @@ -33,6 +35,8 @@ export interface ReceivePaymentFormData { MatInputModule, MatTableModule, FormField, + ErrorStateComponent, + SkeletonLoaderComponent, ], }) export class ReceivePaymentComponent { diff --git a/bookie/src/app/sales/running-tables/running-tables.component.html b/bookie/src/app/sales/running-tables/running-tables.component.html index 3b5fd73..2f3fa62 100644 --- a/bookie/src/app/sales/running-tables/running-tables.component.html +++ b/bookie/src/app/sales/running-tables/running-tables.component.html @@ -1,27 +1,33 @@ -

    Running Tables

    +@if (listResource.isLoading()) { + +} @else if (listResource.error()) { + +} @else { +

    Running Tables

    -
    - @for (table of list(); track table) { - -

    {{ table.name }}

    - {{ table.guest }} - {{ table.pax ?? '-' }} / {{ table.seats }} / {{ table.section?.name }} - @if (table.date) { - {{ table.date }} - } - @if (table.amount) { - {{ table.amount | currency: 'INR' }} - } +
    + @for (table of list(); track table) { + +

    {{ table.name }}

    + {{ table.guest }} + {{ table.pax ?? '-' }} / {{ table.seats }} / {{ table.section?.name }} + @if (table.date) { + {{ table.date }} + } + @if (table.amount) { + {{ table.amount | currency: 'INR' }} + } +
    + } + +

    Open Bill

    - } - -

    Open Bill

    -
    -
    +
    +} diff --git a/bookie/src/app/sales/running-tables/running-tables.component.ts b/bookie/src/app/sales/running-tables/running-tables.component.ts index 9c01c59..4fb5063 100644 --- a/bookie/src/app/sales/running-tables/running-tables.component.ts +++ b/bookie/src/app/sales/running-tables/running-tables.component.ts @@ -9,6 +9,8 @@ import { map } from 'rxjs/operators'; import { Table } from '../../core/table'; import { RegimeService } from '../../regimes/regime.service'; +import { ErrorStateComponent } from '../../shared/error-state/error-state.component'; +import { SkeletonLoaderComponent } from '../../shared/skeleton-loader/skeleton-loader.component'; import { TableService } from '../../tables/table.service'; import { BillNumberComponent } from '../bill-number/bill-number.component'; @@ -16,7 +18,7 @@ import { BillNumberComponent } from '../bill-number/bill-number.component'; selector: 'app-running-tables', templateUrl: './running-tables.component.html', styleUrls: ['./running-tables.component.sass'], - imports: [CurrencyPipe, MatRippleModule, MatCardModule], + imports: [CurrencyPipe, MatRippleModule, MatCardModule, ErrorStateComponent, SkeletonLoaderComponent], }) export class RunningTablesComponent { private tableService = inject(TableService); diff --git a/bookie/src/app/section-printers/section-printer.component.html b/bookie/src/app/section-printers/section-printer.component.html index 0dfbc65..83809de 100644 --- a/bookie/src/app/section-printers/section-printer.component.html +++ b/bookie/src/app/section-printers/section-printer.component.html @@ -1,63 +1,69 @@ -

    Section Printer

    -
    -
    - - Section - - @for (s of sections(); track s) { - - {{ s.name }} - - } - - -
    - - - - - Sale Category - {{ row.saleCategory?.name ?? 'Default' }} - +@if (listResource.isLoading()) { + +} @else if (listResource.error()) { + +} @else { +

    Section Printer

    + +
    + + Section + + @for (s of sections(); track s) { + + {{ s.name }} + + } + + +
    + + + + + Sale Category + {{ row.saleCategory?.name ?? 'Default' }} + - - - Printer - - - Printer - - -- Default -- - @for (p of printers(); track p) { - - {{ p.name }} - - } - - - - - - - - Copies - - @if (form.saleCategories[i].printer().controlValue()) { + + + Printer + - Copies - + Printer + + -- Default -- + @for (p of printers(); track p) { + + {{ p.name }} + + } + - } - - + + - - - - -
    - - @if (id()) { - - } -
    + + + Copies + + @if (form.saleCategories[i].printer().controlValue()) { + + Copies + + + } + + + + + +
    + +
    + + @if (id()) { + + } +
    +} diff --git a/bookie/src/app/section-printers/section-printer.component.ts b/bookie/src/app/section-printers/section-printer.component.ts index fc03c4d..fedcffc 100644 --- a/bookie/src/app/section-printers/section-printer.component.ts +++ b/bookie/src/app/section-printers/section-printer.component.ts @@ -16,6 +16,8 @@ import { SectionPrinter } from '../core/section-printer'; import { PrinterService } from '../printers/printer.service'; import { SectionService } from '../sections/section.service'; import { ConfirmDialogComponent } from '../shared/confirm-dialog/confirm-dialog.component'; +import { ErrorStateComponent } from '../shared/error-state/error-state.component'; +import { SkeletonLoaderComponent } from '../shared/skeleton-loader/skeleton-loader.component'; import { SectionPrinterService } from './section-printer.service'; export interface SectionPrinterFormData { @@ -40,6 +42,8 @@ export interface SectionPrinterFormData { MatSelectModule, MatTableModule, FormField, + ErrorStateComponent, + SkeletonLoaderComponent, ], }) export class SectionPrinterComponent { diff --git a/bookie/src/app/sections/section-detail/section-detail.component.html b/bookie/src/app/sections/section-detail/section-detail.component.html index 4ba3097..eb920c1 100644 --- a/bookie/src/app/sections/section-detail/section-detail.component.html +++ b/bookie/src/app/sections/section-detail/section-detail.component.html @@ -1,16 +1,22 @@ -

    Section

    -
    -
    - - Name - - -
    -
    +@if (itemResource.isLoading()) { + +} @else if (itemResource.error()) { + +} @else { +

    Section

    +
    +
    + + Name + + +
    +
    -
    - - @if (!!item().id) { - - } -
    +
    + + @if (!!item().id) { + + } +
    +} diff --git a/bookie/src/app/sections/section-detail/section-detail.component.ts b/bookie/src/app/sections/section-detail/section-detail.component.ts index 87c38ef..883455f 100644 --- a/bookie/src/app/sections/section-detail/section-detail.component.ts +++ b/bookie/src/app/sections/section-detail/section-detail.component.ts @@ -9,6 +9,8 @@ import { Router } from '@angular/router'; import { Section } from '../../core/section'; import { ConfirmDialogComponent } from '../../shared/confirm-dialog/confirm-dialog.component'; +import { ErrorStateComponent } from '../../shared/error-state/error-state.component'; +import { SkeletonLoaderComponent } from '../../shared/skeleton-loader/skeleton-loader.component'; import { SectionService } from '../section.service'; export interface SectionDetailFormData { @@ -19,7 +21,14 @@ export interface SectionDetailFormData { selector: 'app-section-detail', templateUrl: './section-detail.component.html', styleUrls: ['./section-detail.component.css'], - imports: [MatButtonModule, MatFormFieldModule, MatInputModule, FormField], + imports: [ + MatButtonModule, + MatFormFieldModule, + MatInputModule, + FormField, + ErrorStateComponent, + SkeletonLoaderComponent, + ], }) export class SectionDetailComponent { private router = inject(Router); diff --git a/bookie/src/app/sections/section-list/section-list.component.html b/bookie/src/app/sections/section-list/section-list.component.html index 00b62ec..09fa748 100644 --- a/bookie/src/app/sections/section-list/section-list.component.html +++ b/bookie/src/app/sections/section-list/section-list.component.html @@ -1,19 +1,25 @@ -

    - Sections - - add_box - Add - -

    - - - - Name - {{ row.name }} - +@if (listResource.isLoading()) { + +} @else if (listResource.error()) { + +} @else { +

    + Sections + + add_box + Add + +

    + + + + Name + {{ row.name }} + - - - + + +
    +} diff --git a/bookie/src/app/sections/section-list/section-list.component.ts b/bookie/src/app/sections/section-list/section-list.component.ts index 68099e6..4dd3545 100644 --- a/bookie/src/app/sections/section-list/section-list.component.ts +++ b/bookie/src/app/sections/section-list/section-list.component.ts @@ -4,12 +4,14 @@ import { MatIconModule } from '@angular/material/icon'; import { MatTableModule } from '@angular/material/table'; import { RouterLink } from '@angular/router'; +import { ErrorStateComponent } from '../../shared/error-state/error-state.component'; +import { SkeletonLoaderComponent } from '../../shared/skeleton-loader/skeleton-loader.component'; import { SectionService } from '../section.service'; @Component({ selector: 'app-section-list', templateUrl: './section-list.component.html', styleUrls: ['./section-list.component.css'], - imports: [MatButtonModule, MatIconModule, MatTableModule, RouterLink], + imports: [MatButtonModule, MatIconModule, MatTableModule, RouterLink, ErrorStateComponent, SkeletonLoaderComponent], }) export class SectionListComponent { private sectionService = inject(SectionService); diff --git a/bookie/src/app/settings/settings.component.html b/bookie/src/app/settings/settings.component.html index 203a353..d9e1022 100644 --- a/bookie/src/app/settings/settings.component.html +++ b/bookie/src/app/settings/settings.component.html @@ -1,53 +1,59 @@ - - - - - - Prefill the customer discount - - - - - - - -
    -
    - - Start Date - - - - - - Finish Date - - - - -
    -

    Beer

    - -

    Sale

    - - -
    -
    -
    -
    -
    -
    -

    Backend: v{{ auth.user()?.ver }} / Frontend: v{{ version }}

    -
    +@if (prefillCustomerDiscountResource.isLoading()) { + +} @else if (prefillCustomerDiscountResource.error()) { + +} @else { + + + + + + Prefill the customer discount + + + + + + + +
    +
    + + Start Date + + + + + + Finish Date + + + + +
    +

    Beer

    + +

    Sale

    + + +
    +
    +
    +
    +
    +
    +

    Backend: v{{ auth.user()?.ver }} / Frontend: v{{ version }}

    +
    +} diff --git a/bookie/src/app/settings/settings.component.ts b/bookie/src/app/settings/settings.component.ts index 59e0b91..5b016f1 100644 --- a/bookie/src/app/settings/settings.component.ts +++ b/bookie/src/app/settings/settings.component.ts @@ -12,6 +12,8 @@ import moment from 'moment'; import { environment } from '../app.environment'; import { AuthService } from '../auth/auth.service'; +import { ErrorStateComponent } from '../shared/error-state/error-state.component'; +import { SkeletonLoaderComponent } from '../shared/skeleton-loader/skeleton-loader.component'; import { SettingsService } from './settings.service'; @Component({ @@ -28,6 +30,8 @@ import { SettingsService } from './settings.service'; MatTabsModule, MatCardModule, FormField, + ErrorStateComponent, + SkeletonLoaderComponent, ], }) export class SettingsComponent { diff --git a/bookie/src/app/settle-option/settle-option-detail/settle-option-detail.component.html b/bookie/src/app/settle-option/settle-option-detail/settle-option-detail.component.html index d40ad10..ab20404 100644 --- a/bookie/src/app/settle-option/settle-option-detail/settle-option-detail.component.html +++ b/bookie/src/app/settle-option/settle-option-detail/settle-option-detail.component.html @@ -1,39 +1,45 @@ -

    Settle Option

    -
    -
    - - Name - - -
    -
    - - Voucher Type - - @for (vt of voucherTypes; track vt) { - - {{ vt.name }} - - } - - - - Reporting Level - - @for (rl of reportingLevel; track rl) { - - {{ rl.name }} - - } - - - Has Reason? -
    -
    +@if (itemResource.isLoading()) { + +} @else if (itemResource.error()) { + +} @else { +

    Settle Option

    +
    +
    + + Name + + +
    +
    + + Voucher Type + + @for (vt of voucherTypes; track vt) { + + {{ vt.name }} + + } + + + + Reporting Level + + @for (rl of reportingLevel; track rl) { + + {{ rl.name }} + + } + + + Has Reason? +
    +
    -
    - - @if (!!item().id) { - - } -
    +
    + + @if (!!item().id) { + + } +
    +} diff --git a/bookie/src/app/settle-option/settle-option-detail/settle-option-detail.component.ts b/bookie/src/app/settle-option/settle-option-detail/settle-option-detail.component.ts index 78dee37..1394a23 100644 --- a/bookie/src/app/settle-option/settle-option-detail/settle-option-detail.component.ts +++ b/bookie/src/app/settle-option/settle-option-detail/settle-option-detail.component.ts @@ -14,6 +14,8 @@ import { ReportingLevel } from '../../core/reporting-level'; import { SettleOption } from '../../core/settle-option'; import { VoucherType } from '../../sales/bills/voucher-type'; import { ConfirmDialogComponent } from '../../shared/confirm-dialog/confirm-dialog.component'; +import { ErrorStateComponent } from '../../shared/error-state/error-state.component'; +import { SkeletonLoaderComponent } from '../../shared/skeleton-loader/skeleton-loader.component'; import { SettleOptionService } from '../settle-option.service'; export interface SettleOptionDetailFormData { @@ -35,6 +37,8 @@ export interface SettleOptionDetailFormData { MatOptionModule, MatSelectModule, FormField, + ErrorStateComponent, + SkeletonLoaderComponent, ], }) export class SettleOptionDetailComponent { diff --git a/bookie/src/app/settle-option/settle-option-list/settle-option-list.component.html b/bookie/src/app/settle-option/settle-option-list/settle-option-list.component.html index 1528db6..a6c537d 100644 --- a/bookie/src/app/settle-option/settle-option-list/settle-option-list.component.html +++ b/bookie/src/app/settle-option/settle-option-list/settle-option-list.component.html @@ -1,43 +1,49 @@ -

    - Settle Options - - add_box - Add - -

    - - - - Name - {{ row.name }} - +@if (listResource.isLoading()) { + +} @else if (listResource.error()) { + +} @else { +

    + Settle Options + + add_box + Add + +

    + + + + Name + {{ row.name }} + - - - Voucher Type - {{ voucherType(row.voucherType) }} - + + + Voucher Type + {{ voucherType(row.voucherType) }} + - - - Reporting Level - {{ reportingLevel(row.reportingLevel) }} - + + + Reporting Level + {{ reportingLevel(row.reportingLevel) }} + - - - Has Reason? - {{ row.hasReason }} - + + + Has Reason? + {{ row.hasReason }} + - - - Fixture? - {{ row.isFixture }} - + + + Fixture? + {{ row.isFixture }} + - - - + + +
    +} diff --git a/bookie/src/app/settle-option/settle-option-list/settle-option-list.component.ts b/bookie/src/app/settle-option/settle-option-list/settle-option-list.component.ts index 6d8ff52..e9a866e 100644 --- a/bookie/src/app/settle-option/settle-option-list/settle-option-list.component.ts +++ b/bookie/src/app/settle-option/settle-option-list/settle-option-list.component.ts @@ -6,12 +6,14 @@ import { RouterLink } from '@angular/router'; import { ReportingLevel } from '../../core/reporting-level'; import { VoucherType } from '../../sales/bills/voucher-type'; +import { ErrorStateComponent } from '../../shared/error-state/error-state.component'; +import { SkeletonLoaderComponent } from '../../shared/skeleton-loader/skeleton-loader.component'; import { SettleOptionService } from '../settle-option.service'; @Component({ selector: 'app-settle-option-list', templateUrl: './settle-option-list.component.html', styleUrls: ['./settle-option-list.component.css'], - imports: [MatButtonModule, MatIconModule, MatTableModule, RouterLink], + imports: [MatButtonModule, MatIconModule, MatTableModule, RouterLink, ErrorStateComponent, SkeletonLoaderComponent], }) export class SettleOptionListComponent { private ser = inject(SettleOptionService); diff --git a/bookie/src/app/shared/error-state/error-state.component.html b/bookie/src/app/shared/error-state/error-state.component.html new file mode 100644 index 0000000..1d909e4 --- /dev/null +++ b/bookie/src/app/shared/error-state/error-state.component.html @@ -0,0 +1,10 @@ +
    +
    + error_outline +
    +

    {{ title() }}

    +

    {{ message() }}

    +
    + +
    +
    diff --git a/bookie/src/app/shared/error-state/error-state.component.sass b/bookie/src/app/shared/error-state/error-state.component.sass new file mode 100644 index 0000000..83a3873 --- /dev/null +++ b/bookie/src/app/shared/error-state/error-state.component.sass @@ -0,0 +1,33 @@ +.error-state-container + display: flex + flex-direction: column + align-items: center + justify-content: center + padding: 48px 24px + text-align: center + background-color: #fef2f2 + border-radius: 8px + border: 1px solid #f87171 + +.error-state-icon + font-size: 48px + color: #ef4444 + margin-bottom: 16px + i + font-size: 48px + +.error-state-title + font-size: 1.25rem + font-weight: 600 + color: #991b1b + margin: 0 0 8px 0 + +.error-state-message + font-size: 0.875rem + color: #b91c1c + margin: 0 0 24px 0 + max-width: 400px + +.error-state-actions + display: flex + gap: 12px diff --git a/bookie/src/app/shared/error-state/error-state.component.spec.ts b/bookie/src/app/shared/error-state/error-state.component.spec.ts new file mode 100644 index 0000000..515a776 --- /dev/null +++ b/bookie/src/app/shared/error-state/error-state.component.spec.ts @@ -0,0 +1,22 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ErrorStateComponent } from './error-state.component'; + +describe('ErrorStateComponent', () => { + let component: ErrorStateComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [ErrorStateComponent], + }).compileComponents(); + + fixture = TestBed.createComponent(ErrorStateComponent); + component = fixture.componentInstance; + await fixture.whenStable(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/bookie/src/app/shared/error-state/error-state.component.ts b/bookie/src/app/shared/error-state/error-state.component.ts new file mode 100644 index 0000000..2752276 --- /dev/null +++ b/bookie/src/app/shared/error-state/error-state.component.ts @@ -0,0 +1,20 @@ +import { CommonModule } from '@angular/common'; +import { Component, input, output } from '@angular/core'; +import { MatButtonModule } from '@angular/material/button'; + +@Component({ + selector: 'app-error-state', + standalone: true, + imports: [CommonModule, MatButtonModule], + templateUrl: './error-state.component.html', + styleUrl: './error-state.component.sass', +}) +export class ErrorStateComponent { + title = input('Something went wrong'); + message = input('An error occurred while loading the data.'); + retryAction = output(); + + onRetry(): void { + this.retryAction.emit(); + } +} diff --git a/bookie/src/app/shared/skeleton-loader/skeleton-loader.component.html b/bookie/src/app/shared/skeleton-loader/skeleton-loader.component.html new file mode 100644 index 0000000..d31f742 --- /dev/null +++ b/bookie/src/app/shared/skeleton-loader/skeleton-loader.component.html @@ -0,0 +1,16 @@ +@for (item of iterableCount; track $index) { +
    + @if (type() === 'table') { +
    +
    +
    +
    + } @else if (type() === 'card') { +
    +
    +
    + } @else { +
    + } +
    +} diff --git a/bookie/src/app/shared/skeleton-loader/skeleton-loader.component.sass b/bookie/src/app/shared/skeleton-loader/skeleton-loader.component.sass new file mode 100644 index 0000000..671aa58 --- /dev/null +++ b/bookie/src/app/shared/skeleton-loader/skeleton-loader.component.sass @@ -0,0 +1,52 @@ +.skeleton-wrapper + margin-bottom: 16px + +.skeleton-pulse + background: #e0e0e0 + background: linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%) + background-size: 200% 100% + animation: pulse 1.5s infinite linear + +@keyframes pulse + 0% + background-position: 200% 0 + 100% + background-position: -200% 0 + +.skeleton-line + height: 20px + width: 100% + border-radius: 4px + +.skeleton-table + border: 1px solid #e0e0e0 + border-radius: 8px + padding: 16px + .skeleton-header + height: 40px + width: 100% + border-radius: 4px + margin-bottom: 16px + .skeleton-row + height: 30px + width: 100% + border-radius: 4px + margin-bottom: 8px + +.skeleton-card + border: 1px solid #e0e0e0 + border-radius: 8px + padding: 16px + display: flex + flex-direction: column + gap: 12px + .skeleton-image + height: 150px + width: 100% + border-radius: 4px + .skeleton-text + height: 20px + width: 100% + border-radius: 4px + .skeleton-text.short + width: 60% diff --git a/bookie/src/app/shared/skeleton-loader/skeleton-loader.component.spec.ts b/bookie/src/app/shared/skeleton-loader/skeleton-loader.component.spec.ts new file mode 100644 index 0000000..bf2dbc5 --- /dev/null +++ b/bookie/src/app/shared/skeleton-loader/skeleton-loader.component.spec.ts @@ -0,0 +1,22 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { SkeletonLoaderComponent } from './skeleton-loader.component'; + +describe('SkeletonLoaderComponent', () => { + let component: SkeletonLoaderComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [SkeletonLoaderComponent], + }).compileComponents(); + + fixture = TestBed.createComponent(SkeletonLoaderComponent); + component = fixture.componentInstance; + await fixture.whenStable(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/bookie/src/app/shared/skeleton-loader/skeleton-loader.component.ts b/bookie/src/app/shared/skeleton-loader/skeleton-loader.component.ts new file mode 100644 index 0000000..2a6140f --- /dev/null +++ b/bookie/src/app/shared/skeleton-loader/skeleton-loader.component.ts @@ -0,0 +1,16 @@ +import { Component, input } from '@angular/core'; + +@Component({ + selector: 'app-skeleton-loader', + standalone: true, + templateUrl: './skeleton-loader.component.html', + styleUrl: './skeleton-loader.component.sass', +}) +export class SkeletonLoaderComponent { + type = input<'table' | 'card' | 'line'>('line'); + count = input(1); + + get iterableCount(): number[] { + return Array(this.count()).fill(0); + } +} diff --git a/bookie/src/app/shared/spinner/spinner.component.html b/bookie/src/app/shared/spinner/spinner.component.html new file mode 100644 index 0000000..2ce6bc8 --- /dev/null +++ b/bookie/src/app/shared/spinner/spinner.component.html @@ -0,0 +1,3 @@ +
    +
    +
    diff --git a/bookie/src/app/shared/spinner/spinner.component.sass b/bookie/src/app/shared/spinner/spinner.component.sass new file mode 100644 index 0000000..7806279 --- /dev/null +++ b/bookie/src/app/shared/spinner/spinner.component.sass @@ -0,0 +1,18 @@ +.spinner-container + display: flex + justify-content: center + align-items: center + +.spinner + width: 100% + height: 100% + border: 4px solid rgba(0, 0, 0, 0.1) + border-left-color: #3f51b5 + border-radius: 50% + animation: spin 1s linear infinite + +@keyframes spin + 0% + transform: rotate(0deg) + 100% + transform: rotate(360deg) diff --git a/bookie/src/app/shared/spinner/spinner.component.spec.ts b/bookie/src/app/shared/spinner/spinner.component.spec.ts new file mode 100644 index 0000000..bf3ef91 --- /dev/null +++ b/bookie/src/app/shared/spinner/spinner.component.spec.ts @@ -0,0 +1,22 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { SpinnerComponent } from './spinner.component'; + +describe('SpinnerComponent', () => { + let component: SpinnerComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [SpinnerComponent], + }).compileComponents(); + + fixture = TestBed.createComponent(SpinnerComponent); + component = fixture.componentInstance; + await fixture.whenStable(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/bookie/src/app/shared/spinner/spinner.component.ts b/bookie/src/app/shared/spinner/spinner.component.ts new file mode 100644 index 0000000..3a8b848 --- /dev/null +++ b/bookie/src/app/shared/spinner/spinner.component.ts @@ -0,0 +1,11 @@ +import { Component, input } from '@angular/core'; + +@Component({ + selector: 'app-spinner', + standalone: true, + templateUrl: './spinner.component.html', + styleUrl: './spinner.component.sass', +}) +export class SpinnerComponent { + diameter = input(40); +} diff --git a/bookie/src/app/tables/table-detail/table-detail.component.html b/bookie/src/app/tables/table-detail/table-detail.component.html index be7795b..30606c8 100644 --- a/bookie/src/app/tables/table-detail/table-detail.component.html +++ b/bookie/src/app/tables/table-detail/table-detail.component.html @@ -1,37 +1,43 @@ -

    Table

    -
    -
    - - Name - - -
    -
    - - Seats - - -
    -
    - - Section - - @for (s of sections(); track s) { - - {{ s.name }} - - } - - -
    -
    - Is Active? -
    -
    +@if (itemResource.isLoading()) { + +} @else if (itemResource.error()) { + +} @else { +

    Table

    +
    +
    + + Name + + +
    +
    + + Seats + + +
    +
    + + Section + + @for (s of sections(); track s) { + + {{ s.name }} + + } + + +
    +
    + Is Active? +
    +
    -
    - - @if (!!item().id) { - - } -
    +
    + + @if (!!item().id) { + + } +
    +} diff --git a/bookie/src/app/tables/table-detail/table-detail.component.ts b/bookie/src/app/tables/table-detail/table-detail.component.ts index de17713..48b34a0 100644 --- a/bookie/src/app/tables/table-detail/table-detail.component.ts +++ b/bookie/src/app/tables/table-detail/table-detail.component.ts @@ -14,6 +14,8 @@ import { Section } from '../../core/section'; import { Table } from '../../core/table'; import { SectionService } from '../../sections/section.service'; import { ConfirmDialogComponent } from '../../shared/confirm-dialog/confirm-dialog.component'; +import { ErrorStateComponent } from '../../shared/error-state/error-state.component'; +import { SkeletonLoaderComponent } from '../../shared/skeleton-loader/skeleton-loader.component'; import { TableService } from '../table.service'; export interface TableDetailFormData { @@ -35,6 +37,8 @@ export interface TableDetailFormData { MatOptionModule, MatSelectModule, FormField, + ErrorStateComponent, + SkeletonLoaderComponent, ], }) export class TableDetailComponent { diff --git a/bookie/src/app/tables/table-list/table-list.component.html b/bookie/src/app/tables/table-list/table-list.component.html index 75ecdcf..ef1ee22 100644 --- a/bookie/src/app/tables/table-list/table-list.component.html +++ b/bookie/src/app/tables/table-list/table-list.component.html @@ -1,46 +1,52 @@ -

    - Tables - - - add_box - Add - -

    +@if (listResource.isLoading()) { + +} @else if (listResource.error()) { + +} @else { +

    + Tables + + + add_box + Add + +

    - - - - Name - {{ row.name }} - + + + + Name + {{ row.name }} + - - - Seats - {{ row.seats }} - + + + Seats + {{ row.seats }} + - - - Section - {{ row.section.name }} - + + + Section + {{ row.section.name }} + - - - Is Active? - {{ row.isActive }} - + + + Is Active? + {{ row.isActive }} + - - - + + + +} diff --git a/bookie/src/app/tables/table-list/table-list.component.ts b/bookie/src/app/tables/table-list/table-list.component.ts index a0a8483..690104e 100644 --- a/bookie/src/app/tables/table-list/table-list.component.ts +++ b/bookie/src/app/tables/table-list/table-list.component.ts @@ -9,12 +9,23 @@ import { RouterLink } from '@angular/router'; import { firstValueFrom } from 'rxjs'; import { Table } from '../../core/table'; +import { ErrorStateComponent } from '../../shared/error-state/error-state.component'; +import { SkeletonLoaderComponent } from '../../shared/skeleton-loader/skeleton-loader.component'; import { TableService } from '../table.service'; @Component({ selector: 'app-table-list', templateUrl: './table-list.component.html', styleUrls: ['./table-list.component.sass'], - imports: [DragDropModule, MatButtonModule, MatIconModule, MatTableModule, RouterLink, MatToolbarModule], + imports: [ + DragDropModule, + MatButtonModule, + MatIconModule, + MatTableModule, + RouterLink, + MatToolbarModule, + ErrorStateComponent, + SkeletonLoaderComponent, + ], }) export class TableListComponent { private snackBar = inject(MatSnackBar); diff --git a/bookie/src/app/tax-report/tax-report.component.html b/bookie/src/app/tax-report/tax-report.component.html index 62b374a..7616caa 100644 --- a/bookie/src/app/tax-report/tax-report.component.html +++ b/bookie/src/app/tax-report/tax-report.component.html @@ -1,64 +1,70 @@ -

    - Tax Report - -

    +@if (infoResource.isLoading()) { + +} @else if (infoResource.error()) { + +} @else { +

    + Tax Report + +

    -
    -
    - - Start Date - - - - - - Finish Date - - - - - -
    -
    - - - - Name - {{ row.name }} - +
    +
    + + Start Date + + + + + + Finish Date + + + + + +
    +
    + + + + Name + {{ row.name }} + - - - Rate - {{ row.taxRate | percent: '1.2-2' }} - + + + Rate + {{ row.taxRate | percent: '1.2-2' }} + - - - Sale - {{ row.saleAmount | currency: 'INR' }} - + + + Sale + {{ row.saleAmount | currency: 'INR' }} + - - - Tax - {{ row.amount | currency: 'INR' }} - + + + Tax + {{ row.amount | currency: 'INR' }} + - - - + + +
    +} diff --git a/bookie/src/app/tax-report/tax-report.component.ts b/bookie/src/app/tax-report/tax-report.component.ts index 8906e35..0417ce9 100644 --- a/bookie/src/app/tax-report/tax-report.component.ts +++ b/bookie/src/app/tax-report/tax-report.component.ts @@ -10,6 +10,8 @@ import { MatTableModule } from '@angular/material/table'; import { Router } from '@angular/router'; import moment from 'moment'; +import { ErrorStateComponent } from '../shared/error-state/error-state.component'; +import { SkeletonLoaderComponent } from '../shared/skeleton-loader/skeleton-loader.component'; import { ToCsvService } from '../shared/to-csv.service'; import { TaxReport } from './tax-report'; import { TaxReportService } from './tax-report.service'; @@ -33,6 +35,8 @@ export interface TaxReportFormData { MatTableModule, PercentPipe, FormField, + ErrorStateComponent, + SkeletonLoaderComponent, ], }) export class TaxReportComponent { diff --git a/bookie/src/app/taxes/tax-detail/tax-detail.component.html b/bookie/src/app/taxes/tax-detail/tax-detail.component.html index 644738f..17705f8 100644 --- a/bookie/src/app/taxes/tax-detail/tax-detail.component.html +++ b/bookie/src/app/taxes/tax-detail/tax-detail.component.html @@ -1,40 +1,46 @@ -

    Tax

    -
    -
    - - Name - - Format for GST: ST GST @ x% (1/2) ; CGST @ x% (1/2) - -
    -
    - - Rate - - % - -
    -
    - - Regime - - @for (reg of regimes(); track reg) { - - {{ reg.name }} - - } - - -
    -
    +@if (itemResource.isLoading()) { + +} @else if (itemResource.error()) { + +} @else { +

    Tax

    +
    +
    + + Name + + Format for GST: ST GST @ x% (1/2) ; CGST @ x% (1/2) + +
    +
    + + Rate + + % + +
    +
    + + Regime + + @for (reg of regimes(); track reg) { + + {{ reg.name }} + + } + + +
    +
    -
    - - @if (!!item().id) { - - } -
    + @if (!!item().id) { + + } +
    +} diff --git a/bookie/src/app/taxes/tax-detail/tax-detail.component.ts b/bookie/src/app/taxes/tax-detail/tax-detail.component.ts index 8b4d78c..ac962b8 100644 --- a/bookie/src/app/taxes/tax-detail/tax-detail.component.ts +++ b/bookie/src/app/taxes/tax-detail/tax-detail.component.ts @@ -14,6 +14,8 @@ import { Regime } from '../../core/regime'; import { Tax } from '../../core/tax'; import { RegimeService } from '../../regimes/regime.service'; import { ConfirmDialogComponent } from '../../shared/confirm-dialog/confirm-dialog.component'; +import { ErrorStateComponent } from '../../shared/error-state/error-state.component'; +import { SkeletonLoaderComponent } from '../../shared/skeleton-loader/skeleton-loader.component'; import { TaxService } from '../tax.service'; export interface TaxDetailFormData { @@ -26,7 +28,16 @@ export interface TaxDetailFormData { selector: 'app-tax-detail', templateUrl: './tax-detail.component.html', styleUrls: ['./tax-detail.component.css'], - imports: [MatButtonModule, MatFormFieldModule, MatInputModule, MatOptionModule, MatSelectModule, FormField], + imports: [ + MatButtonModule, + MatFormFieldModule, + MatInputModule, + MatOptionModule, + MatSelectModule, + FormField, + ErrorStateComponent, + SkeletonLoaderComponent, + ], }) export class TaxDetailComponent { private regimeService = inject(RegimeService); diff --git a/bookie/src/app/taxes/tax-list/tax-list.component.html b/bookie/src/app/taxes/tax-list/tax-list.component.html index 7a9a14d..60c8f66 100644 --- a/bookie/src/app/taxes/tax-list/tax-list.component.html +++ b/bookie/src/app/taxes/tax-list/tax-list.component.html @@ -1,37 +1,43 @@ -

    - Taxes - - add_box - Add - -

    - - - - Name - {{ row.name }} - +@if (listResource.isLoading()) { + +} @else if (listResource.error()) { + +} @else { +

    + Taxes + + add_box + Add + +

    + + + + Name + {{ row.name }} + - - - Rate - {{ row.rate | percent: '1.2-2' }} - + + + Rate + {{ row.rate | percent: '1.2-2' }} + - - - Regime - {{ row.regime.name }} - + + + Regime + {{ row.regime.name }} + - - - Is Fixture? - {{ row.isFixture }} - + + + Is Fixture? + {{ row.isFixture }} + - - - + + +
    +} diff --git a/bookie/src/app/taxes/tax-list/tax-list.component.ts b/bookie/src/app/taxes/tax-list/tax-list.component.ts index 323d8ce..9134d6b 100644 --- a/bookie/src/app/taxes/tax-list/tax-list.component.ts +++ b/bookie/src/app/taxes/tax-list/tax-list.component.ts @@ -5,12 +5,22 @@ import { MatIconModule } from '@angular/material/icon'; import { MatTableModule } from '@angular/material/table'; import { RouterLink } from '@angular/router'; +import { ErrorStateComponent } from '../../shared/error-state/error-state.component'; +import { SkeletonLoaderComponent } from '../../shared/skeleton-loader/skeleton-loader.component'; import { TaxService } from '../tax.service'; @Component({ selector: 'app-tax-list', templateUrl: './tax-list.component.html', styleUrls: ['./tax-list.component.css'], - imports: [MatButtonModule, MatIconModule, MatTableModule, PercentPipe, RouterLink], + imports: [ + MatButtonModule, + MatIconModule, + MatTableModule, + PercentPipe, + RouterLink, + ErrorStateComponent, + SkeletonLoaderComponent, + ], }) export class TaxListComponent { private taxService = inject(TaxService); diff --git a/bookie/src/app/temporal-product/temporal-product-detail/temporal-product-detail.component.html b/bookie/src/app/temporal-product/temporal-product-detail/temporal-product-detail.component.html index db5a769..bbec533 100644 --- a/bookie/src/app/temporal-product/temporal-product-detail/temporal-product-detail.component.html +++ b/bookie/src/app/temporal-product/temporal-product-detail/temporal-product-detail.component.html @@ -1,201 +1,207 @@ -

    Product

    -
    -
    -

    Product Versions

    -
    -
    - - Name - - - - Fraction Units - - -
    -
    - - Sale Category - - @for (sc of saleCategories(); track sc) { - - {{ sc.name }} - - } - - -
    -
    - - Valid From - - - - - - Valid Till - - - - -
    -
    - - -
    -
    - - - - - +@if (itemResource.isLoading()) { + +} @else if (itemResource.error()) { + +} @else { +

    Product

    +
    +
    +

    Product Versions

    +
    +
    + + Name + + + + Fraction Units + + +
    +
    + + Sale Category + + @for (sc of saleCategories(); track sc) { + + {{ sc.name }} + + } + + +
    +
    + + Valid From + + + + + + Valid Till + + + + +
    +
    + + +
    + +
    Name{{ p.name }}
    + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - -
    Name{{ p.name }}Fraction Units{{ p.fraction_units }}Fraction Units{{ p.fraction_units }}Sale Category{{ p.saleCategory?.name }}Sale Category{{ p.saleCategory?.name }}Valid From{{ p.validFrom }}Valid From{{ p.validFrom }}Valid Till{{ p.validTill }}Valid Till{{ p.validTill }}Actions - - Actions + +
    + + + +
    +
    +

    SKU Versions

    +
    +
    + + Units + + + + + Fraction + + +
    + +
    + + Yield + + + + + Cost Price + + + + + Sale Price + + +
    +
    + + Menu Category + + @for (mc of menuCategories(); track mc) { + + {{ mc.name }} + + } + + +
    +
    + Has Happy Hour? + Is Not Available? +
    +
    + + Valid From + + + + + + Valid Till + + + + +
    +
    + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Units{{ s.units }}Sale Price{{ s.salePrice }}Menu Category{{ s.menuCategory?.name }}Valid From{{ s.validFrom }}Valid Till{{ s.validTill }}Actions + +
    +
    -
    -

    SKU Versions

    -
    -
    - - Units - - - - - Fraction - - -
    - -
    - - Yield - - - - - Cost Price - - - - - Sale Price - - -
    -
    - - Menu Category - - @for (mc of menuCategories(); track mc) { - - {{ mc.name }} - - } - - -
    -
    - Has Happy Hour? - Is Not Available? -
    -
    - - Valid From - - - - - - Valid Till - - - - -
    -
    - - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Units{{ s.units }}Sale Price{{ s.salePrice }}Menu Category{{ s.menuCategory?.name }}Valid From{{ s.validFrom }}Valid Till{{ s.validTill }}Actions - -
    +
    + +
    -
    -
    - - -
    +} diff --git a/bookie/src/app/temporal-product/temporal-product-detail/temporal-product-detail.component.ts b/bookie/src/app/temporal-product/temporal-product-detail/temporal-product-detail.component.ts index 7f321f4..394f18c 100644 --- a/bookie/src/app/temporal-product/temporal-product-detail/temporal-product-detail.component.ts +++ b/bookie/src/app/temporal-product/temporal-product-detail/temporal-product-detail.component.ts @@ -21,6 +21,8 @@ import { SaleCategory } from '../../core/sale-category'; import { MenuCategoryService } from '../../menu-category/menu-category.service'; import { SaleCategoryService } from '../../sale-category/sale-category.service'; import { ConfirmDialogComponent } from '../../shared/confirm-dialog/confirm-dialog.component'; +import { ErrorStateComponent } from '../../shared/error-state/error-state.component'; +import { SkeletonLoaderComponent } from '../../shared/skeleton-loader/skeleton-loader.component'; import { Product, StockKeepingUnit, TemporalProduct } from '../temporal-product'; import { TemporalProductService } from '../temporal-product.service'; @@ -62,6 +64,8 @@ export interface TemporalSkuFormData { MatSelectModule, MatTableModule, FormField, + ErrorStateComponent, + SkeletonLoaderComponent, ], }) export class TemporalProductDetailComponent { diff --git a/bookie/src/app/temporal-product/temporal-product-list/temporal-product-list.component.html b/bookie/src/app/temporal-product/temporal-product-list/temporal-product-list.component.html index 38fa789..a4377bc 100644 --- a/bookie/src/app/temporal-product/temporal-product-list/temporal-product-list.component.html +++ b/bookie/src/app/temporal-product/temporal-product-list/temporal-product-list.component.html @@ -1,93 +1,98 @@ -

    Temporal Products

    -
    -
    - - Filter - - - - Menu Category - - -- All Products -- - @for (mc of menuCategoriesResource.value(); track mc) { - - {{ mc.name }} - - } - - - - Sale Category - - -- All Products -- - @for (mc of saleCategoriesResource.value(); track mc) { - - {{ mc.name }} - - } - - -
    -
    - - - - Products - -
      - @for (p of row.products; track p) { -
    • - - {{ p.name }} - -
      - Valid: - {{ p.validFrom ?? '∞' }} - linear_scale - {{ p.validTill ?? '∞' }} -
      -
    • - } -
    -
    -
    +@if (listResource.isLoading()) { + +} @else if (listResource.error()) { + +} @else { +

    Temporal Products

    +
    +
    + + Filter + + + + Menu Category + + -- All Products -- + @for (mc of menuCategoriesResource.value(); track mc) { + + {{ mc.name }} + + } + + + + Sale Category + + -- All Products -- + @for (mc of saleCategoriesResource.value(); track mc) { + + {{ mc.name }} + + } + + +
    +
    + + + + Products + +
      + @for (p of row.products; track p) { +
    • + + {{ p.name }} + +
      + Valid: + {{ p.validFrom ?? '∞' }} + linear_scale + {{ p.validTill ?? '∞' }} +
      +
    • + } +
    +
    +
    - - Skus - -
      - @for (s of row.skus; track s) { -
    • - {{ s.units }} -
    • - } -
    -
    -
    + + Skus + +
      + @for (s of row.skus; track s) { +
    • + {{ s.units }} +
    • + } +
    +
    +
    - - - Price - {{ row.skus.at(-1).price | currency: 'INR' }} - + + + Price + {{ row.skus.at(-1).price | currency: 'INR' }} + - - - Menu Category - {{ row.skus.at(-1).menuCategory.name }} - + + + Menu Category + {{ row.skus.at(-1).menuCategory.name }} + - - - Sale Category - {{ row.products.at(-1).saleCategory.name }} - + + + Sale Category + {{ row.products.at(-1).saleCategory.name }} + - - - Details - - + + Details + + - - + + - - + - - -
    + + +
    +} diff --git a/bookie/src/app/temporal-product/temporal-product-list/temporal-product-list.component.ts b/bookie/src/app/temporal-product/temporal-product-list/temporal-product-list.component.ts index 7386d76..67acda9 100644 --- a/bookie/src/app/temporal-product/temporal-product-list/temporal-product-list.component.ts +++ b/bookie/src/app/temporal-product/temporal-product-list/temporal-product-list.component.ts @@ -11,6 +11,8 @@ import { RouterLink } from '@angular/router'; import { MenuCategoryService } from '../../menu-category/menu-category.service'; import { SaleCategoryService } from '../../sale-category/sale-category.service'; +import { ErrorStateComponent } from '../../shared/error-state/error-state.component'; +import { SkeletonLoaderComponent } from '../../shared/skeleton-loader/skeleton-loader.component'; import { TemporalProductService } from '../temporal-product.service'; export interface TemporalProductListFormData { @@ -33,6 +35,8 @@ export interface TemporalProductListFormData { MatTableModule, FormField, RouterLink, + ErrorStateComponent, + SkeletonLoaderComponent, ], }) export class TemporalProductListComponent { @@ -46,14 +50,14 @@ export class TemporalProductListComponent { formModel = signal({ filter: '', - menuCategory: '', - saleCategory: '', + menuCategory: null, + saleCategory: null, }); form = form(this.formModel); - menuCategoryFilter = computed(() => this.formModel().menuCategory ?? ''); - saleCategoryFilter = computed(() => this.formModel().saleCategory ?? ''); + menuCategoryFilter = computed(() => this.formModel().menuCategory); + saleCategoryFilter = computed(() => this.formModel().saleCategory); filterSignal = computed(() => this.formModel().filter); debouncedFilter = debounced(this.filterSignal, 150); diff --git a/bookie/src/app/update-product-prices/update-product-prices.component.html b/bookie/src/app/update-product-prices/update-product-prices.component.html index de33a86..c61e65a 100644 --- a/bookie/src/app/update-product-prices/update-product-prices.component.html +++ b/bookie/src/app/update-product-prices/update-product-prices.component.html @@ -1,60 +1,66 @@ -

    - Product Update Report - -

    +@if (infoResource.isLoading()) { + +} @else if (infoResource.error()) { + +} @else { +

    + Product Update Report + +

    -
    -
    - - Date - - - - - - Menu Category - - @for (s of menuCategories(); track s) { - - {{ s.name }} - - } - - - + +
    + + Date + + + + + + Menu Category + + @for (s of menuCategories(); track s) { + + {{ s.name }} + + } + + + +
    + + + + Name + {{ row.name }} + + + + + Old Price + {{ row.oldPrice | currency: 'INR' }} + + + + + New Price + + + New Price + + ₹  + + + + + + + + + +
    +
    - - - - Name - {{ row.name }} - - - - - Old Price - {{ row.oldPrice | currency: 'INR' }} - - - - - New Price - - - New Price - - ₹  - - - - - - - - - -
    - -
    +} diff --git a/bookie/src/app/update-product-prices/update-product-prices.component.ts b/bookie/src/app/update-product-prices/update-product-prices.component.ts index cab2611..9086a9a 100644 --- a/bookie/src/app/update-product-prices/update-product-prices.component.ts +++ b/bookie/src/app/update-product-prices/update-product-prices.component.ts @@ -14,6 +14,8 @@ import { Router } from '@angular/router'; import moment from 'moment'; import { MenuCategoryService } from '../menu-category/menu-category.service'; +import { ErrorStateComponent } from '../shared/error-state/error-state.component'; +import { SkeletonLoaderComponent } from '../shared/skeleton-loader/skeleton-loader.component'; import { ToCsvService } from '../shared/to-csv.service'; import { UpdateProductPrices } from './update-product-prices'; import { UpdateProductPricesService } from './update-product-prices.service'; @@ -39,6 +41,8 @@ export interface UpdateProductPricesFormData { MatSelectModule, MatTableModule, FormField, + ErrorStateComponent, + SkeletonLoaderComponent, ], }) export class UpdateProductPricesComponent { diff --git a/bookie/src/app/users/user-detail/user-detail.component.html b/bookie/src/app/users/user-detail/user-detail.component.html index b764eb7..ea556a0 100644 --- a/bookie/src/app/users/user-detail/user-detail.component.html +++ b/bookie/src/app/users/user-detail/user-detail.component.html @@ -1,32 +1,38 @@ -

    User

    -
    -
    - - Name - - -
    -
    - - Password - - {{ hide ? 'visibility' : 'visibility_off' }} - -
    -
    - Is Locked Out? -
    - -
    - @for (r of form.roles; track r; let i = $index) { -
    - {{ r.name().value() }} -
    - } -
    -
    +@if (itemResource.isLoading()) { + +} @else if (itemResource.error()) { + +} @else { +

    User

    +
    +
    + + Name + + +
    +
    + + Password + + {{ hide ? 'visibility' : 'visibility_off' }} + +
    +
    + Is Locked Out? +
    + +
    + @for (r of form.roles; track r; let i = $index) { +
    + {{ r.name().value() }} +
    + } +
    +
    -
    - - -
    +
    + + +
    +} diff --git a/bookie/src/app/users/user-detail/user-detail.component.ts b/bookie/src/app/users/user-detail/user-detail.component.ts index fced545..5c571a9 100644 --- a/bookie/src/app/users/user-detail/user-detail.component.ts +++ b/bookie/src/app/users/user-detail/user-detail.component.ts @@ -12,6 +12,8 @@ import { Router } from '@angular/router'; import { User } from '../../core/user'; import { ConfirmDialogComponent } from '../../shared/confirm-dialog/confirm-dialog.component'; +import { ErrorStateComponent } from '../../shared/error-state/error-state.component'; +import { SkeletonLoaderComponent } from '../../shared/skeleton-loader/skeleton-loader.component'; import { UserService } from '../user.service'; export interface UserDetailFormData { @@ -33,6 +35,8 @@ export interface UserDetailFormData { MatIconModule, MatInputModule, FormField, + ErrorStateComponent, + SkeletonLoaderComponent, ], }) export class UserDetailComponent { diff --git a/bookie/src/app/users/user-list/user-list.component.html b/bookie/src/app/users/user-list/user-list.component.html index 0a5ddf5..3d16493 100644 --- a/bookie/src/app/users/user-list/user-list.component.html +++ b/bookie/src/app/users/user-list/user-list.component.html @@ -1,45 +1,51 @@ -

    - Users - - add_box - Add - -

    - - - - Name - {{ row.name }} - +@if (listResource.isLoading()) { + +} @else if (listResource.error()) { + +} @else { +

    + Users + + add_box + Add + +

    + + + + Name + {{ row.name }} + - - - Is Locked Out? - {{ row.lockedOut }} - + + + Is Locked Out? + {{ row.lockedOut }} + - - - Roles - -
      - @for (role of row.roles; track role) { -
    • {{ role }}
    • - } -
    -
    -
    + + + Roles + +
      + @for (role of row.roles; track role) { +
    • {{ role }}
    • + } +
    +
    +
    - - - Last Login - {{ row.lastDevice }} @ {{ row.lastDate ? (row.lastDate | localTime) : 'Never' }} - + + + Last Login + {{ row.lastDevice }} @ {{ row.lastDate ? (row.lastDate | localTime) : 'Never' }} + - - -
    + + +
    +} diff --git a/bookie/src/app/users/user-list/user-list.component.ts b/bookie/src/app/users/user-list/user-list.component.ts index 224b48b..b85d391 100644 --- a/bookie/src/app/users/user-list/user-list.component.ts +++ b/bookie/src/app/users/user-list/user-list.component.ts @@ -4,13 +4,23 @@ import { MatIconModule } from '@angular/material/icon'; import { MatTableModule } from '@angular/material/table'; import { RouterLink } from '@angular/router'; +import { ErrorStateComponent } from '../../shared/error-state/error-state.component'; import { LocalTimePipe } from '../../shared/local-time.pipe'; +import { SkeletonLoaderComponent } from '../../shared/skeleton-loader/skeleton-loader.component'; import { UserService } from '../user.service'; @Component({ selector: 'app-user-list', templateUrl: './user-list.component.html', styleUrls: ['./user-list.component.css'], - imports: [LocalTimePipe, MatButtonModule, MatIconModule, MatTableModule, RouterLink], + imports: [ + LocalTimePipe, + MatButtonModule, + MatIconModule, + MatTableModule, + RouterLink, + ErrorStateComponent, + SkeletonLoaderComponent, + ], }) export class UserListComponent { private userService = inject(UserService);