From be40004a3d3ecaa0730e2ce549775e298aec7d35 Mon Sep 17 00:00:00 2001 From: Amritanshu Date: Wed, 26 Aug 2026 13:35:01 +0000 Subject: [PATCH] Ledger now showing running totals. --- .../ee77296e69b7_recipe_template_removed.py | 4 +- .../account-detail.component.ts | 1 - .../account-list/account-list.component.ts | 1 - .../app/attendance/attendance.component.ts | 1 - .../balance-sheet/balance-sheet.component.ts | 1 - .../client-detail/client-detail.component.ts | 6 +-- .../closing-stock/closing-stock.component.ts | 1 - .../cost-centre-detail.component.ts | 6 +-- overlord/src/app/daybook/daybook.component.ts | 1 - .../employee-attendance.component.ts | 1 - .../employee-benefits.component.ts | 6 +-- .../employee-detail.component.ts | 7 +--- .../employee-list/employee-list.component.ts | 1 - .../src/app/incentive/incentive.component.ts | 6 +-- .../src/app/issue/issue-dialog.component.ts | 2 +- overlord/src/app/issue/issue.component.ts | 10 ++--- .../app/journal/journal-dialog.component.ts | 2 +- overlord/src/app/journal/journal.component.ts | 1 - overlord/src/app/ledger/ledger.component.ts | 39 ++++++++++++++++--- .../mozimo-daily-register.component.ts | 1 - .../mozimo-product-register.component.ts | 1 - .../net-transactions.component.ts | 7 +--- .../app/payment/payment-dialog.component.ts | 2 +- overlord/src/app/payment/payment.component.ts | 13 ++----- .../period-detail/period-detail.component.ts | 6 +-- .../product-group-detail.component.ts | 6 +-- .../product-group-list.component.ts | 1 - .../product-detail-dialog.component.ts | 2 +- .../product-detail.component.ts | 6 +-- .../product-list/product-list.component.ts | 1 - .../app/profit-loss/profit-loss.component.ts | 2 - .../purchase-entries.component.ts | 3 -- .../purchase-return-dialog.component.ts | 2 +- .../purchase-return.component.ts | 12 ++---- .../app/purchase/purchase-dialog.component.ts | 2 +- .../src/app/purchase/purchase.component.ts | 12 ++---- .../src/app/purchases/purchases.component.ts | 1 - .../rate-contract-detail.component.ts | 1 - .../rate-contract-list.component.ts | 1 - .../raw-material-cost.component.ts | 1 - .../app/receipt/receipt-dialog.component.ts | 2 +- overlord/src/app/receipt/receipt.component.ts | 12 ++---- .../recipe-list/recipe-list.component.ts | 3 +- .../role/role-detail/role-detail.component.ts | 4 +- .../confirm-dialog.component.ts | 2 +- .../image-dialog/image-dialog.component.ts | 2 +- .../stock-movement.component.ts | 2 +- .../app/tag-dialog/tag-dialog.component.ts | 2 +- .../tag/tag-detail/tag-detail.component.ts | 4 +- .../app/tag/tag-list/tag-list.component.ts | 1 + .../temporal-product-detail.component.ts | 5 +-- .../temporal-product-list.component.ts | 1 - .../trial-balance/trial-balance.component.ts | 1 - .../user/user-detail/user-detail.component.ts | 5 +-- .../app/user/user-list/user-list.component.ts | 2 + 55 files changed, 85 insertions(+), 143 deletions(-) diff --git a/brewman/alembic/versions/ee77296e69b7_recipe_template_removed.py b/brewman/alembic/versions/ee77296e69b7_recipe_template_removed.py index 148d7d88..7fb2bcde 100644 --- a/brewman/alembic/versions/ee77296e69b7_recipe_template_removed.py +++ b/brewman/alembic/versions/ee77296e69b7_recipe_template_removed.py @@ -6,9 +6,11 @@ Create Date: 2026-08-26 05:54:36.396717 """ -from alembic import op import sqlalchemy as sa +from alembic import op + + # revision identifiers, used by Alembic. revision = "ee77296e69b7" down_revision = "09a4f0ca450f" diff --git a/overlord/src/app/account/account-detail/account-detail.component.ts b/overlord/src/app/account/account-detail/account-detail.component.ts index 30ccce35..da43f278 100644 --- a/overlord/src/app/account/account-detail/account-detail.component.ts +++ b/overlord/src/app/account/account-detail/account-detail.component.ts @@ -42,7 +42,6 @@ export interface AccountDetailFormData { MatButtonModule, FormField, FormRoot, - SkeletonLoaderComponent, ErrorStateComponent, ], diff --git a/overlord/src/app/account/account-list/account-list.component.ts b/overlord/src/app/account/account-list/account-list.component.ts index 240f621a..58f8714b 100644 --- a/overlord/src/app/account/account-list/account-list.component.ts +++ b/overlord/src/app/account/account-list/account-list.component.ts @@ -44,7 +44,6 @@ export interface AccountListFormData { MatTableModule, MatSortModule, MatPaginatorModule, - SkeletonLoaderComponent, ErrorStateComponent, ], diff --git a/overlord/src/app/attendance/attendance.component.ts b/overlord/src/app/attendance/attendance.component.ts index 7f779eaa..b8ad97f1 100644 --- a/overlord/src/app/attendance/attendance.component.ts +++ b/overlord/src/app/attendance/attendance.component.ts @@ -45,7 +45,6 @@ export interface AttendanceFormData { MatOptionModule, MatIconModule, MatChipsModule, - SkeletonLoaderComponent, ErrorStateComponent, ], diff --git a/overlord/src/app/balance-sheet/balance-sheet.component.ts b/overlord/src/app/balance-sheet/balance-sheet.component.ts index e4da1fb2..c59648c0 100644 --- a/overlord/src/app/balance-sheet/balance-sheet.component.ts +++ b/overlord/src/app/balance-sheet/balance-sheet.component.ts @@ -39,7 +39,6 @@ import { BalanceSheetService } from './balance-sheet.service'; MatPaginatorModule, CurrencyPipe, ClearPipe, - SkeletonLoaderComponent, ErrorStateComponent, ], diff --git a/overlord/src/app/client/client-detail/client-detail.component.ts b/overlord/src/app/client/client-detail/client-detail.component.ts index 76606572..ffc734e8 100644 --- a/overlord/src/app/client/client-detail/client-detail.component.ts +++ b/overlord/src/app/client/client-detail/client-detail.component.ts @@ -37,17 +37,13 @@ export interface ClientFormData { ], }) export class ClientDetailComponent { - id = input(null, { transform: (v: string | null | undefined) => v ?? null }); - private router = inject(Router); private dialog = inject(MatDialog); private snackBar = inject(MatSnackBar); private ser = inject(ClientService); - + id = input(null, { transform: (v: string | null | undefined) => v ?? null }); itemResource = this.ser.get(this.id); - item = computed(() => this.itemResource.value() ?? new Client()); - model = linkedSignal({ source: this.item, computation: (item): ClientFormData => ({ diff --git a/overlord/src/app/closing-stock/closing-stock.component.ts b/overlord/src/app/closing-stock/closing-stock.component.ts index c0ea39d9..0dcdc177 100644 --- a/overlord/src/app/closing-stock/closing-stock.component.ts +++ b/overlord/src/app/closing-stock/closing-stock.component.ts @@ -56,7 +56,6 @@ export interface ClosingStockFormData { MatPaginatorModule, DecimalPipe, CurrencyPipe, - SkeletonLoaderComponent, ErrorStateComponent, ], diff --git a/overlord/src/app/cost-centre/cost-centre-detail/cost-centre-detail.component.ts b/overlord/src/app/cost-centre/cost-centre-detail/cost-centre-detail.component.ts index b7fde087..f7791414 100644 --- a/overlord/src/app/cost-centre/cost-centre-detail/cost-centre-detail.component.ts +++ b/overlord/src/app/cost-centre/cost-centre-detail/cost-centre-detail.component.ts @@ -30,16 +30,12 @@ export interface CostCentreDetailFormData { ], }) export class CostCentreDetailComponent { - id = input(null, { transform: (v: string | null | undefined) => v ?? null }); - private router = inject(Router); private snackBar = inject(MatSnackBar); private ser = inject(CostCentreService); - + id = input(null, { transform: (v: string | null | undefined) => v ?? null }); itemResource = this.ser.get(this.id); - item = computed(() => this.itemResource.value() ?? new CostCentre()); - model = linkedSignal({ source: this.item, computation: (itemVal): CostCentreDetailFormData => ({ diff --git a/overlord/src/app/daybook/daybook.component.ts b/overlord/src/app/daybook/daybook.component.ts index d9529e97..b44e2da5 100644 --- a/overlord/src/app/daybook/daybook.component.ts +++ b/overlord/src/app/daybook/daybook.component.ts @@ -39,7 +39,6 @@ import { DaybookService } from './daybook.service'; RouterModule, MatPaginatorModule, CurrencyPipe, - SkeletonLoaderComponent, ErrorStateComponent, ], diff --git a/overlord/src/app/employee-attendance/employee-attendance.component.ts b/overlord/src/app/employee-attendance/employee-attendance.component.ts index ea62ec82..f32738ec 100644 --- a/overlord/src/app/employee-attendance/employee-attendance.component.ts +++ b/overlord/src/app/employee-attendance/employee-attendance.component.ts @@ -49,7 +49,6 @@ export interface EmployeeAttendanceFormData { MatSelectModule, MatIconModule, MatChipsModule, - SkeletonLoaderComponent, ErrorStateComponent, ], diff --git a/overlord/src/app/employee-benefits/employee-benefits.component.ts b/overlord/src/app/employee-benefits/employee-benefits.component.ts index 33c5d868..79ac1dcd 100644 --- a/overlord/src/app/employee-benefits/employee-benefits.component.ts +++ b/overlord/src/app/employee-benefits/employee-benefits.component.ts @@ -68,19 +68,15 @@ export interface EmployeeBenefitsFormData { ], }) export class EmployeeBenefitsComponent { - id = input(null, { transform: (v: string | null | undefined) => v ?? null }); - private router = inject(Router); private dialog = inject(MatDialog); private snackBar = inject(MatSnackBar); auth = inject(AuthService); private ser = inject(VoucherService); private employeeSer = inject(EmployeeService); - + id = input(null, { transform: (v: string | null | undefined) => v ?? null }); voucherResource = this.ser.getVoucher(this.id, signal('Employee Benefit'), signal(null), signal(null)); - item = linkedSignal(() => this.voucherResource.value() ?? new Voucher()); - formModel = linkedSignal({ source: this.item, computation: (v): EmployeeBenefitsFormData => ({ diff --git a/overlord/src/app/employee/employee-detail/employee-detail.component.ts b/overlord/src/app/employee/employee-detail/employee-detail.component.ts index 49f1d549..0f871636 100644 --- a/overlord/src/app/employee/employee-detail/employee-detail.component.ts +++ b/overlord/src/app/employee/employee-detail/employee-detail.component.ts @@ -47,24 +47,19 @@ export interface EmployeeDetailFormData { MatOptionModule, MatDatepickerModule, MatButtonModule, - SkeletonLoaderComponent, ErrorStateComponent, ], }) export class EmployeeDetailComponent { - id = input(null, { transform: (v: string | null | undefined) => v ?? null }); - private router = inject(Router); private dialog = inject(MatDialog); private snackBar = inject(MatSnackBar); private ser = inject(EmployeeService); private costCentreService = inject(CostCentreService); - + id = input(null, { transform: (v: string | null | undefined) => v ?? null }); itemResource = this.ser.get(this.id); - item = computed(() => this.itemResource.value() ?? new Employee()); - model = linkedSignal({ source: this.item, computation: (itemVal): EmployeeDetailFormData => ({ diff --git a/overlord/src/app/employee/employee-list/employee-list.component.ts b/overlord/src/app/employee/employee-list/employee-list.component.ts index 075123f6..f4214f14 100644 --- a/overlord/src/app/employee/employee-list/employee-list.component.ts +++ b/overlord/src/app/employee/employee-list/employee-list.component.ts @@ -42,7 +42,6 @@ import { EmployeeService } from '../employee.service'; FormField, FormRoot, RouterModule, - SkeletonLoaderComponent, ErrorStateComponent, ], diff --git a/overlord/src/app/incentive/incentive.component.ts b/overlord/src/app/incentive/incentive.component.ts index 7acdf2f9..ec4a4f33 100644 --- a/overlord/src/app/incentive/incentive.component.ts +++ b/overlord/src/app/incentive/incentive.component.ts @@ -49,18 +49,14 @@ export interface IncentiveFormData { ], }) export class IncentiveComponent { - id = input(null, { transform: (v: string | null | undefined) => v ?? null }); - private router = inject(Router); private dialog = inject(MatDialog); private snackBar = inject(MatSnackBar); auth = inject(AuthService); private ser = inject(VoucherService); - + id = input(null, { transform: (v: string | null | undefined) => v ?? null }); voucherResource = this.ser.getVoucher(this.id, signal('Incentive'), signal(null), signal(null)); - voucher = computed(() => this.voucherResource.value() ?? new Voucher()); - model = linkedSignal({ source: this.voucher, computation: (v): IncentiveFormData => ({ diff --git a/overlord/src/app/issue/issue-dialog.component.ts b/overlord/src/app/issue/issue-dialog.component.ts index 4d4f4899..437490a3 100644 --- a/overlord/src/app/issue/issue-dialog.component.ts +++ b/overlord/src/app/issue/issue-dialog.component.ts @@ -36,7 +36,7 @@ export interface IssueDialogFormData { ], }) export class IssueDialogComponent { - dialogRef = inject>(MatDialogRef); + readonly dialogRef = inject>(MatDialogRef); data = inject<{ inventory: Inventory; date: string; diff --git a/overlord/src/app/issue/issue.component.ts b/overlord/src/app/issue/issue.component.ts index f472eebc..2e3988d5 100644 --- a/overlord/src/app/issue/issue.component.ts +++ b/overlord/src/app/issue/issue.component.ts @@ -88,16 +88,11 @@ export interface IssueFormModel { DecimalPipe, CurrencyPipe, LocalTimePipe, - SkeletonLoaderComponent, ErrorStateComponent, ], }) export class IssueComponent { - id = input(null, { transform: (v: string | null | undefined) => v ?? null }); - d = input(null, { transform: (v: string | null | undefined) => v ?? null }); - type = signal('Issue'); - private router = inject(Router); private dialog = inject(MatDialog); private snackBar = inject(MatSnackBar); @@ -107,10 +102,11 @@ export class IssueComponent { private batchSer = inject(BatchService); private issueGridSer = inject(IssueGridService); private costCentreSer = inject(CostCentreService); - sortActive = signal(''); sortDirection = signal(''); - + id = input(null, { transform: (v: string | null | undefined) => v ?? null }); + d = input(null, { transform: (v: string | null | undefined) => v ?? null }); + type = signal('Issue'); itemResource = this.ser.getVoucher(this.id, this.type, signal(null), this.d); item = linkedSignal(() => this.itemResource.value() ?? new Voucher()); diff --git a/overlord/src/app/journal/journal-dialog.component.ts b/overlord/src/app/journal/journal-dialog.component.ts index 9abefc16..1d61235e 100644 --- a/overlord/src/app/journal/journal-dialog.component.ts +++ b/overlord/src/app/journal/journal-dialog.component.ts @@ -44,7 +44,7 @@ export interface JournalDialogFormData { export class JournalDialogComponent { private math = inject(MathService); private accountSer = inject(AccountService); - dialogRef = inject>(MatDialogRef); + readonly dialogRef = inject>(MatDialogRef); data = inject<{ journal: Journal; date: string; diff --git a/overlord/src/app/journal/journal.component.ts b/overlord/src/app/journal/journal.component.ts index 7ea73286..ed4460b5 100644 --- a/overlord/src/app/journal/journal.component.ts +++ b/overlord/src/app/journal/journal.component.ts @@ -98,7 +98,6 @@ export interface JournalFormModel { LocalTimePipe, FormRoot, FormField, - SkeletonLoaderComponent, ErrorStateComponent, ], diff --git a/overlord/src/app/ledger/ledger.component.ts b/overlord/src/app/ledger/ledger.component.ts index 982f0707..99ff7131 100644 --- a/overlord/src/app/ledger/ledger.component.ts +++ b/overlord/src/app/ledger/ledger.component.ts @@ -65,8 +65,6 @@ import { LedgerService } from './ledger.service'; CurrencyPipe, AccountingPipe, ClearPipe, - ClearPipe, - SkeletonLoaderComponent, ErrorStateComponent, ], @@ -90,7 +88,9 @@ export class LedgerComponent { sortDirection = signal(''); infoResource = this.ser.list(this.id, this.startDate, this.finishDate); info = computed(() => this.infoResource.value() ?? new Ledger()); + allTags = computed(() => this.tagsResource.value() ?? []); + tags = computed(() => { const data = this.info().body; return ['(None)', ...Array.from(new Set(data.map((x) => x.tags).reduce((list, t) => list.concat(t), [])))]; @@ -101,10 +101,11 @@ export class LedgerComponent { filteredList = computed(() => { const data = this.info().body ?? []; const tags = this.tagsSignal(); - return data.filter( + const filtered = data.filter( (x) => (x.tags.length === 0 && tags.indexOf('(None)') !== -1) || x.tags.filter((t) => tags.includes(t)).length > 0, ); + return this.calculateTotals([...filtered]); }); length = computed(() => this.filteredList().length); @@ -187,11 +188,37 @@ export class LedgerComponent { this.selectedRowId = id; } - debit = computed(() => this.filteredList().reduce((acc, row) => acc + row.debit, 0)); + debit = computed(() => + this.filteredList() + .filter((item) => item.type !== 'Opening Balance') + .reduce((acc, row) => acc + row.debit, 0), + ); - credit = computed(() => this.filteredList().reduce((acc, row) => acc + row.credit, 0)); + credit = computed(() => + this.filteredList() + .filter((item) => item.type !== 'Opening Balance') + .reduce((acc, row) => acc + row.credit, 0), + ); - running = computed(() => this.filteredList().reduce((acc, row) => acc + row.debit - row.credit, 0)); + running = computed(() => { + const list = this.filteredList(); + return list.length ? (list[list.length - 1]?.running ?? 0) : 0; + }); + + calculateTotals(data: LedgerItem[]) { + let running = 0; + data.forEach((item) => { + if (item.type !== 'Opening Balance') { + if (item.posted) { + running += item.debit - item.credit; + } + } else { + running += item.debit - item.credit; + } + item.running = running; + }); + return data; + } isAllSelected() { const numSelected = this.selection.selected.length; diff --git a/overlord/src/app/mozimo-daily-register/mozimo-daily-register.component.ts b/overlord/src/app/mozimo-daily-register/mozimo-daily-register.component.ts index 04cba1e7..d1316d1d 100644 --- a/overlord/src/app/mozimo-daily-register/mozimo-daily-register.component.ts +++ b/overlord/src/app/mozimo-daily-register/mozimo-daily-register.component.ts @@ -54,7 +54,6 @@ export interface MozimoDailyRegisterFormData { MatTooltipModule, FormField, FormRoot, - SkeletonLoaderComponent, ErrorStateComponent, ], diff --git a/overlord/src/app/mozimo-product-register/mozimo-product-register.component.ts b/overlord/src/app/mozimo-product-register/mozimo-product-register.component.ts index 307ef341..3780b63c 100644 --- a/overlord/src/app/mozimo-product-register/mozimo-product-register.component.ts +++ b/overlord/src/app/mozimo-product-register/mozimo-product-register.component.ts @@ -59,7 +59,6 @@ export interface MozimoProductRegisterFormData { MatTooltipModule, FormField, FormRoot, - SkeletonLoaderComponent, ErrorStateComponent, ], diff --git a/overlord/src/app/net-transactions/net-transactions.component.ts b/overlord/src/app/net-transactions/net-transactions.component.ts index b2430777..226c43c8 100644 --- a/overlord/src/app/net-transactions/net-transactions.component.ts +++ b/overlord/src/app/net-transactions/net-transactions.component.ts @@ -40,22 +40,19 @@ import { NetTransactionsService } from './net-transactions.service'; MatPaginatorModule, CurrencyPipe, AccountingPipe, - SkeletonLoaderComponent, ErrorStateComponent, ], }) export class NetTransactionsComponent { - startDate = input(null, { transform: (v: string | null | undefined) => v ?? null }); - finishDate = input(null, { transform: (v: string | null | undefined) => v ?? null }); - private router = inject(Router); private ser = inject(NetTransactionsService); - pageSize = signal(50); pageIndex = signal(0); sortActive = signal(''); sortDirection = signal(''); + startDate = input(null, { transform: (v: string | null | undefined) => v ?? null }); + finishDate = input(null, { transform: (v: string | null | undefined) => v ?? null }); infoResource = this.ser.list(this.startDate, this.finishDate); info = computed(() => this.infoResource.value() ?? new NetTransactions()); diff --git a/overlord/src/app/payment/payment-dialog.component.ts b/overlord/src/app/payment/payment-dialog.component.ts index 5dac219f..d5a3834f 100644 --- a/overlord/src/app/payment/payment-dialog.component.ts +++ b/overlord/src/app/payment/payment-dialog.component.ts @@ -37,7 +37,7 @@ export interface PaymentDialogFormData { ], }) export class PaymentDialogComponent { - dialogRef = inject>(MatDialogRef); + readonly dialogRef = inject>(MatDialogRef); data = inject<{ journal: Journal; date: string; diff --git a/overlord/src/app/payment/payment.component.ts b/overlord/src/app/payment/payment.component.ts index bdb53a6e..d073e20a 100644 --- a/overlord/src/app/payment/payment.component.ts +++ b/overlord/src/app/payment/payment.component.ts @@ -98,17 +98,11 @@ export interface PaymentFormModel { CurrencyPipe, AccountingPipe, LocalTimePipe, - SkeletonLoaderComponent, ErrorStateComponent, ], }) export class PaymentComponent { - id = input(null, { transform: (v: string | null | undefined) => v ?? null }); - d = input(null, { transform: (v: string | null | undefined) => v ?? null }); - a = input(null, { transform: (v: string | null | undefined) => v ?? null }); - type = signal('Payment'); - private router = inject(Router); private dialog = inject(MatDialog); private snackBar = inject(MatSnackBar); @@ -118,13 +112,14 @@ export class PaymentComponent { private ser = inject(VoucherService); private accountSer = inject(AccountService); private tagSer = inject(TagService); - sortActive = signal(''); sortDirection = signal(''); - + id = input(null, { transform: (v: string | null | undefined) => v ?? null }); + d = input(null, { transform: (v: string | null | undefined) => v ?? null }); + a = input(null, { transform: (v: string | null | undefined) => v ?? null }); + type = signal('Payment'); itemResource = this.ser.getVoucher(this.id, this.type, this.a, this.d); item = linkedSignal(() => this.itemResource.value() ?? new Voucher()); - formModel = linkedSignal({ source: this.item, computation: (voucher): PaymentFormModel => { diff --git a/overlord/src/app/period/period-detail/period-detail.component.ts b/overlord/src/app/period/period-detail/period-detail.component.ts index 8c62eebd..d1f8a20b 100644 --- a/overlord/src/app/period/period-detail/period-detail.component.ts +++ b/overlord/src/app/period/period-detail/period-detail.component.ts @@ -38,17 +38,13 @@ import { PeriodService } from '../period.service'; ], }) export class PeriodDetailComponent { - id = input(null, { transform: (v: string | null | undefined) => v ?? null }); - private router = inject(Router); private dialog = inject(MatDialog); private snackBar = inject(MatSnackBar); private ser = inject(PeriodService); - + id = input(null, { transform: (v: string | null | undefined) => v ?? null }); itemResource = this.ser.get(this.id); - item = computed(() => this.itemResource.value() ?? new Period()); - model = linkedSignal({ source: this.item, computation: (item): PeriodFormData => ({ diff --git a/overlord/src/app/product-group/product-group-detail/product-group-detail.component.ts b/overlord/src/app/product-group/product-group-detail/product-group-detail.component.ts index 68594f34..bb10e233 100644 --- a/overlord/src/app/product-group/product-group-detail/product-group-detail.component.ts +++ b/overlord/src/app/product-group/product-group-detail/product-group-detail.component.ts @@ -34,16 +34,12 @@ export interface ProductGroupDetailFormData { ], }) export class ProductGroupDetailComponent { - id = input(null, { transform: (v: string | null | undefined) => v ?? null }); - private router = inject(Router); private snackBar = inject(MatSnackBar); private ser = inject(ProductGroupService); - + id = input(null, { transform: (v: string | null | undefined) => v ?? null }); itemResource = this.ser.get(this.id); - item = computed(() => this.itemResource.value() ?? new ProductGroup()); - model = linkedSignal({ source: this.item, computation: (itemVal): ProductGroupDetailFormData => ({ diff --git a/overlord/src/app/product-group/product-group-list/product-group-list.component.ts b/overlord/src/app/product-group/product-group-list/product-group-list.component.ts index 271c3ba3..899357b3 100644 --- a/overlord/src/app/product-group/product-group-list/product-group-list.component.ts +++ b/overlord/src/app/product-group/product-group-list/product-group-list.component.ts @@ -27,7 +27,6 @@ import { ProductGroupService } from '../product-group.service'; }) export class ProductGroupListComponent { private ser = inject(ProductGroupService); - pageSize = signal(50); pageIndex = signal(0); sortActive = signal(''); diff --git a/overlord/src/app/product/product-detail/product-detail-dialog.component.ts b/overlord/src/app/product/product-detail/product-detail-dialog.component.ts index eb3859fe..35bf3abb 100644 --- a/overlord/src/app/product/product-detail/product-detail-dialog.component.ts +++ b/overlord/src/app/product/product-detail/product-detail-dialog.component.ts @@ -32,7 +32,7 @@ export interface ProductDetailDialogFormData { ], }) export class ProductDetailDialogComponent { - dialogRef = inject>(MatDialogRef); + readonly dialogRef = inject>(MatDialogRef); data = inject<{ item: StockKeepingUnit; isSold: boolean; diff --git a/overlord/src/app/product/product-detail/product-detail.component.ts b/overlord/src/app/product/product-detail/product-detail.component.ts index 2ac3820b..47860949 100644 --- a/overlord/src/app/product/product-detail/product-detail.component.ts +++ b/overlord/src/app/product/product-detail/product-detail.component.ts @@ -79,23 +79,19 @@ export interface ProductDetailFormModel { MatTableModule, MatIconModule, CurrencyPipe, - SkeletonLoaderComponent, ErrorStateComponent, ], }) export class ProductDetailComponent { - id = input(null, { transform: (v: string | null | undefined) => v ?? null }); - private router = inject(Router); private dialog = inject(MatDialog); private snackBar = inject(MatSnackBar); private ser = inject(ProductService); private pgSer = inject(ProductGroupService); - + id = input(null, { transform: (v: string | null | undefined) => v ?? null }); itemResource = this.ser.get(this.id); item = linkedSignal(() => this.itemResource.value() ?? new Product()); - formModel = linkedSignal({ source: this.item, computation: (itemVal): ProductDetailFormModel => ({ diff --git a/overlord/src/app/product/product-list/product-list.component.ts b/overlord/src/app/product/product-list/product-list.component.ts index 86c23eca..ec08bf8f 100644 --- a/overlord/src/app/product/product-list/product-list.component.ts +++ b/overlord/src/app/product/product-list/product-list.component.ts @@ -49,7 +49,6 @@ export interface ProductListFormData { MatPaginatorModule, PercentPipe, CurrencyPipe, - SkeletonLoaderComponent, ErrorStateComponent, ], diff --git a/overlord/src/app/profit-loss/profit-loss.component.ts b/overlord/src/app/profit-loss/profit-loss.component.ts index bffac886..23460408 100644 --- a/overlord/src/app/profit-loss/profit-loss.component.ts +++ b/overlord/src/app/profit-loss/profit-loss.component.ts @@ -40,7 +40,6 @@ export interface ProfitLossFormData { MatSortModule, MatPaginatorModule, CurrencyPipe, - SkeletonLoaderComponent, ErrorStateComponent, ], @@ -51,7 +50,6 @@ export class ProfitLossComponent { private ser = inject(ProfitLossService); pageSize = signal(50); pageIndex = signal(0); - startDate = input(null, { transform: (v: string | null | undefined) => v ?? null }); finishDate = input(null, { transform: (v: string | null | undefined) => v ?? null }); infoResource = this.ser.list(this.startDate, this.finishDate); diff --git a/overlord/src/app/purchase-entries/purchase-entries.component.ts b/overlord/src/app/purchase-entries/purchase-entries.component.ts index cb3f2de2..9211be77 100644 --- a/overlord/src/app/purchase-entries/purchase-entries.component.ts +++ b/overlord/src/app/purchase-entries/purchase-entries.component.ts @@ -43,7 +43,6 @@ export interface PurchaseEntriesFormData { DecimalPipe, PercentPipe, CurrencyPipe, - SkeletonLoaderComponent, ErrorStateComponent, ], @@ -52,12 +51,10 @@ export class PurchaseEntriesComponent { private route = inject(ActivatedRoute); private router = inject(Router); private ser = inject(PurchaseEntriesService); - pageSize = signal(50); pageIndex = signal(0); sortActive = signal(''); sortDirection = signal(''); - startDate = input(null, { transform: (v: string | null | undefined) => v ?? null }); finishDate = input(null, { transform: (v: string | null | undefined) => v ?? null }); resource = this.ser.list(this.startDate, this.finishDate); diff --git a/overlord/src/app/purchase-return/purchase-return-dialog.component.ts b/overlord/src/app/purchase-return/purchase-return-dialog.component.ts index 60c1b638..f1a15cae 100644 --- a/overlord/src/app/purchase-return/purchase-return-dialog.component.ts +++ b/overlord/src/app/purchase-return/purchase-return-dialog.component.ts @@ -36,7 +36,7 @@ export interface PurchaseReturnDialogFormData { ], }) export class PurchaseReturnDialogComponent { - dialogRef = inject>(MatDialogRef); + readonly dialogRef = inject>(MatDialogRef); data = inject<{ inventory: Inventory; date: string; diff --git a/overlord/src/app/purchase-return/purchase-return.component.ts b/overlord/src/app/purchase-return/purchase-return.component.ts index eecbe7dd..45d521e1 100644 --- a/overlord/src/app/purchase-return/purchase-return.component.ts +++ b/overlord/src/app/purchase-return/purchase-return.component.ts @@ -101,17 +101,11 @@ export interface PurchaseReturnFormModel { CurrencyPipe, AccountingPipe, LocalTimePipe, - SkeletonLoaderComponent, ErrorStateComponent, ], }) export class PurchaseReturnComponent { - id = input(null, { transform: (v: string | null | undefined) => v ?? null }); - d = input(null, { transform: (v: string | null | undefined) => v ?? null }); - a = input(null, { transform: (v: string | null | undefined) => v ?? null }); - type = signal('Purchase Return'); - private router = inject(Router); private dialog = inject(MatDialog); private snackBar = inject(MatSnackBar); @@ -122,10 +116,12 @@ export class PurchaseReturnComponent { private batchSer = inject(BatchService); private accountSer = inject(AccountService); private tagSer = inject(TagService); - sortActive = signal(''); sortDirection = signal(''); - + id = input(null, { transform: (v: string | null | undefined) => v ?? null }); + d = input(null, { transform: (v: string | null | undefined) => v ?? null }); + a = input(null, { transform: (v: string | null | undefined) => v ?? null }); + type = signal('Purchase Return'); itemResource = this.ser.getVoucher(this.id, this.type, this.a, this.d); item = linkedSignal(() => this.itemResource.value() ?? new Voucher()); diff --git a/overlord/src/app/purchase/purchase-dialog.component.ts b/overlord/src/app/purchase/purchase-dialog.component.ts index 2e59d44c..3f96c4ee 100644 --- a/overlord/src/app/purchase/purchase-dialog.component.ts +++ b/overlord/src/app/purchase/purchase-dialog.component.ts @@ -41,7 +41,7 @@ export interface PurchaseDialogFormData { ], }) export class PurchaseDialogComponent { - dialogRef = inject>(MatDialogRef); + readonly dialogRef = inject>(MatDialogRef); data = inject<{ inventory: Inventory; }>(MAT_DIALOG_DATA); diff --git a/overlord/src/app/purchase/purchase.component.ts b/overlord/src/app/purchase/purchase.component.ts index a9f1173e..1ba6dea1 100644 --- a/overlord/src/app/purchase/purchase.component.ts +++ b/overlord/src/app/purchase/purchase.component.ts @@ -106,17 +106,11 @@ export interface PurchaseFormModel { CurrencyPipe, AccountingPipe, LocalTimePipe, - SkeletonLoaderComponent, ErrorStateComponent, ], }) export class PurchaseComponent { - id = input(null, { transform: (v: string | null | undefined) => v ?? null }); - d = input(null, { transform: (v: string | null | undefined) => v ?? null }); - a = input(null, { transform: (v: string | null | undefined) => v ?? null }); - type = signal('Purchase'); - private router = inject(Router); private dialog = inject(MatDialog); private snackBar = inject(MatSnackBar); @@ -127,10 +121,12 @@ export class PurchaseComponent { private productSer = inject(ProductService); private accountSer = inject(AccountService); private tagSer = inject(TagService); - sortActive = signal(''); sortDirection = signal(''); - + id = input(null, { transform: (v: string | null | undefined) => v ?? null }); + d = input(null, { transform: (v: string | null | undefined) => v ?? null }); + a = input(null, { transform: (v: string | null | undefined) => v ?? null }); + type = signal('Purchase'); itemResource = this.ser.getVoucher(this.id, this.type, this.a, this.d); item = linkedSignal(() => this.itemResource.value() ?? new Voucher()); diff --git a/overlord/src/app/purchases/purchases.component.ts b/overlord/src/app/purchases/purchases.component.ts index a4a4f6aa..ce43c313 100644 --- a/overlord/src/app/purchases/purchases.component.ts +++ b/overlord/src/app/purchases/purchases.component.ts @@ -43,7 +43,6 @@ export interface PurchasesFormData { MatPaginatorModule, DecimalPipe, CurrencyPipe, - SkeletonLoaderComponent, ErrorStateComponent, ], diff --git a/overlord/src/app/rate-contract/rate-contract-detail/rate-contract-detail.component.ts b/overlord/src/app/rate-contract/rate-contract-detail/rate-contract-detail.component.ts index 8832b89e..b20df634 100644 --- a/overlord/src/app/rate-contract/rate-contract-detail/rate-contract-detail.component.ts +++ b/overlord/src/app/rate-contract/rate-contract-detail/rate-contract-detail.component.ts @@ -67,7 +67,6 @@ export interface RateContractDetailFormData { MatSortModule, MatIconModule, CurrencyPipe, - SkeletonLoaderComponent, ErrorStateComponent, ], diff --git a/overlord/src/app/rate-contract/rate-contract-list/rate-contract-list.component.ts b/overlord/src/app/rate-contract/rate-contract-list/rate-contract-list.component.ts index 8c30d3d3..50898283 100644 --- a/overlord/src/app/rate-contract/rate-contract-list/rate-contract-list.component.ts +++ b/overlord/src/app/rate-contract/rate-contract-list/rate-contract-list.component.ts @@ -24,7 +24,6 @@ import { RateContractService } from '../rate-contract.service'; MatPaginatorModule, CurrencyPipe, MatButtonModule, - SkeletonLoaderComponent, ErrorStateComponent, ], diff --git a/overlord/src/app/raw-material-cost/raw-material-cost.component.ts b/overlord/src/app/raw-material-cost/raw-material-cost.component.ts index 84abac0a..8ec21a6a 100644 --- a/overlord/src/app/raw-material-cost/raw-material-cost.component.ts +++ b/overlord/src/app/raw-material-cost/raw-material-cost.component.ts @@ -46,7 +46,6 @@ export interface RawMaterialCostFormData { DecimalPipe, PercentPipe, CurrencyPipe, - SkeletonLoaderComponent, ErrorStateComponent, ], diff --git a/overlord/src/app/receipt/receipt-dialog.component.ts b/overlord/src/app/receipt/receipt-dialog.component.ts index 04c3d005..805e0322 100644 --- a/overlord/src/app/receipt/receipt-dialog.component.ts +++ b/overlord/src/app/receipt/receipt-dialog.component.ts @@ -37,7 +37,7 @@ export interface ReceiptDialogFormData { ], }) export class ReceiptDialogComponent { - dialogRef = inject>(MatDialogRef); + readonly dialogRef = inject>(MatDialogRef); data = inject<{ journal: Journal; date: string; diff --git a/overlord/src/app/receipt/receipt.component.ts b/overlord/src/app/receipt/receipt.component.ts index 3848e072..c27daa2e 100644 --- a/overlord/src/app/receipt/receipt.component.ts +++ b/overlord/src/app/receipt/receipt.component.ts @@ -99,17 +99,11 @@ export interface ReceiptFormModel { CurrencyPipe, AccountingPipe, LocalTimePipe, - SkeletonLoaderComponent, ErrorStateComponent, ], }) export class ReceiptComponent { - id = input(null, { transform: (v: string | null | undefined) => v ?? null }); - d = input(null, { transform: (v: string | null | undefined) => v ?? null }); - a = input(null, { transform: (v: string | null | undefined) => v ?? null }); - type = signal('Receipt'); - private router = inject(Router); private dialog = inject(MatDialog); private snackBar = inject(MatSnackBar); @@ -119,10 +113,12 @@ export class ReceiptComponent { private ser = inject(VoucherService); private accountSer = inject(AccountService); private tagSer = inject(TagService); - sortActive = signal(''); sortDirection = signal(''); - + id = input(null, { transform: (v: string | null | undefined) => v ?? null }); + d = input(null, { transform: (v: string | null | undefined) => v ?? null }); + a = input(null, { transform: (v: string | null | undefined) => v ?? null }); + type = signal('Receipt'); itemResource = this.ser.getVoucher(this.id, this.type, this.a, this.d); item = linkedSignal(() => this.itemResource.value() ?? new Voucher()); diff --git a/overlord/src/app/recipe/recipe-list/recipe-list.component.ts b/overlord/src/app/recipe/recipe-list/recipe-list.component.ts index 6dbc4b97..27844e71 100644 --- a/overlord/src/app/recipe/recipe-list/recipe-list.component.ts +++ b/overlord/src/app/recipe/recipe-list/recipe-list.component.ts @@ -37,13 +37,11 @@ import { RecipeService } from '../recipe.service'; MatSortModule, MatPaginatorModule, MatButtonModule, - SkeletonLoaderComponent, ErrorStateComponent, ], }) export class RecipeListComponent { - p = input(); private ser = inject(RecipeService); private router = inject(Router); private periodSer = inject(PeriodService); @@ -54,6 +52,7 @@ export class RecipeListComponent { sortActive = signal(''); sortDirection = signal(''); + p = input(); model = signal({ period: null as Period | null, productGroup: null as ProductGroup | string | null, diff --git a/overlord/src/app/role/role-detail/role-detail.component.ts b/overlord/src/app/role/role-detail/role-detail.component.ts index 37350d6f..87bc52b3 100644 --- a/overlord/src/app/role/role-detail/role-detail.component.ts +++ b/overlord/src/app/role/role-detail/role-detail.component.ts @@ -28,19 +28,17 @@ import { RoleService } from '../role.service'; MatDividerModule, MatCheckboxModule, MatButtonModule, - SkeletonLoaderComponent, ErrorStateComponent, ], }) export class RoleDetailComponent { - id = input(null, { transform: (v: string | null | undefined) => v ?? null }); - private router = inject(Router); private snackBar = inject(MatSnackBar); private dialog = inject(MatDialog); private ser = inject(RoleService); + id = input(null, { transform: (v: string | null | undefined) => v ?? null }); itemResource = this.ser.get(this.id); item = computed(() => this.itemResource.value() ?? new Role()); diff --git a/overlord/src/app/shared/confirm-dialog/confirm-dialog.component.ts b/overlord/src/app/shared/confirm-dialog/confirm-dialog.component.ts index 89c5f865..992e475f 100644 --- a/overlord/src/app/shared/confirm-dialog/confirm-dialog.component.ts +++ b/overlord/src/app/shared/confirm-dialog/confirm-dialog.component.ts @@ -10,7 +10,7 @@ import { MAT_DIALOG_DATA, MatDialogModule, MatDialogRef } from '@angular/materia imports: [MatDialogModule, CdkScrollableModule, MatButtonModule], }) export class ConfirmDialogComponent { - dialogRef = inject>(MatDialogRef); + readonly dialogRef = inject>(MatDialogRef); data = inject<{ title: string; content: string; diff --git a/overlord/src/app/shared/image-dialog/image-dialog.component.ts b/overlord/src/app/shared/image-dialog/image-dialog.component.ts index 2c18c297..40506de8 100644 --- a/overlord/src/app/shared/image-dialog/image-dialog.component.ts +++ b/overlord/src/app/shared/image-dialog/image-dialog.component.ts @@ -8,7 +8,7 @@ import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; standalone: true, }) export class ImageDialogComponent { - dialogRef = inject>(MatDialogRef); + readonly dialogRef = inject>(MatDialogRef); data = inject(MAT_DIALOG_DATA); close(): void { diff --git a/overlord/src/app/stock-movement/stock-movement.component.ts b/overlord/src/app/stock-movement/stock-movement.component.ts index d8cc3570..80fe6157 100644 --- a/overlord/src/app/stock-movement/stock-movement.component.ts +++ b/overlord/src/app/stock-movement/stock-movement.component.ts @@ -41,7 +41,6 @@ export interface StockMovementFormData { RouterModule, MatPaginatorModule, DecimalPipe, - SkeletonLoaderComponent, ErrorStateComponent, ], @@ -55,6 +54,7 @@ export class StockMovementComponent { pageIndex = signal(0); sortActive = signal(''); sortDirection = signal(''); + startDate = input(null, { transform: (v: string | null | undefined) => v ?? null }); finishDate = input(null, { transform: (v: string | null | undefined) => v ?? null }); diff --git a/overlord/src/app/tag-dialog/tag-dialog.component.ts b/overlord/src/app/tag-dialog/tag-dialog.component.ts index a03bc86e..d277ee28 100644 --- a/overlord/src/app/tag-dialog/tag-dialog.component.ts +++ b/overlord/src/app/tag-dialog/tag-dialog.component.ts @@ -33,7 +33,7 @@ export interface TagDialogFormData { ], }) export class TagDialogComponent implements OnInit { - dialogRef = inject>(MatDialogRef); + readonly dialogRef = inject>(MatDialogRef); data = inject<{ tags: Tag[]; vouchers: LedgerItem[]; diff --git a/overlord/src/app/tag/tag-detail/tag-detail.component.ts b/overlord/src/app/tag/tag-detail/tag-detail.component.ts index d83bdfca..a785e325 100644 --- a/overlord/src/app/tag/tag-detail/tag-detail.component.ts +++ b/overlord/src/app/tag/tag-detail/tag-detail.component.ts @@ -32,15 +32,13 @@ export interface TagDetailFormData { ], }) export class TagDetailComponent { - id = input(null, { transform: (v: string | null | undefined) => v ?? null }); - private router = inject(Router); private snackBar = inject(MatSnackBar); private dialog = inject(MatDialog); private ser = inject(TagService); + id = input(null, { transform: (v: string | null | undefined) => v ?? null }); itemResource = this.ser.get(this.id); - item = computed(() => this.itemResource.value() ?? new Tag()); formModel = linkedSignal({ diff --git a/overlord/src/app/tag/tag-list/tag-list.component.ts b/overlord/src/app/tag/tag-list/tag-list.component.ts index b9458844..ec66ae59 100644 --- a/overlord/src/app/tag/tag-list/tag-list.component.ts +++ b/overlord/src/app/tag/tag-list/tag-list.component.ts @@ -32,6 +32,7 @@ export class TagListComponent { pageIndex = signal(0); sortActive = signal(''); sortDirection = signal(''); + listResource = this.ser.list(); list = computed(() => this.listResource.value() ?? []); sortedList = computed(() => { diff --git a/overlord/src/app/temporal-product/temporal-product-detail/temporal-product-detail.component.ts b/overlord/src/app/temporal-product/temporal-product-detail/temporal-product-detail.component.ts index 5a4c41dd..c11eab60 100644 --- a/overlord/src/app/temporal-product/temporal-product-detail/temporal-product-detail.component.ts +++ b/overlord/src/app/temporal-product/temporal-product-detail/temporal-product-detail.component.ts @@ -127,20 +127,19 @@ function createEmptySkuForm(): TemporalProductSkuFormData { FormField, FormRoot, CurrencyPipe, - SkeletonLoaderComponent, ErrorStateComponent, ], }) export class TemporalProductDetailComponent { - id = input(null, { transform: (v: string | null | undefined) => v ?? null }); - private router = inject(Router); private dialog = inject(MatDialog); private snackBar = inject(MatSnackBar); private ser = inject(TemporalProductService); private pgSer = inject(ProductGroupService); + id = input(null, { transform: (v: string | null | undefined) => v ?? null }); + productDisplayedColumns = ['name', 'fractionUnits', 'productGroup', 'validFrom', 'validTill', 'actions']; skuDisplayedColumns = [ 'units', diff --git a/overlord/src/app/temporal-product/temporal-product-list/temporal-product-list.component.ts b/overlord/src/app/temporal-product/temporal-product-list/temporal-product-list.component.ts index 870959f3..f5db529b 100644 --- a/overlord/src/app/temporal-product/temporal-product-list/temporal-product-list.component.ts +++ b/overlord/src/app/temporal-product/temporal-product-list/temporal-product-list.component.ts @@ -37,7 +37,6 @@ export interface TemporalProductListFormData { FormField, FormRoot, RouterLink, - SkeletonLoaderComponent, ErrorStateComponent, ], diff --git a/overlord/src/app/trial-balance/trial-balance.component.ts b/overlord/src/app/trial-balance/trial-balance.component.ts index 4c87a1f7..ca277621 100644 --- a/overlord/src/app/trial-balance/trial-balance.component.ts +++ b/overlord/src/app/trial-balance/trial-balance.component.ts @@ -41,7 +41,6 @@ export interface TrialBalanceFormData { MatPaginatorModule, CurrencyPipe, AccountingPipe, - SkeletonLoaderComponent, ErrorStateComponent, ], diff --git a/overlord/src/app/user/user-detail/user-detail.component.ts b/overlord/src/app/user/user-detail/user-detail.component.ts index 0eb2697a..3a6511cb 100644 --- a/overlord/src/app/user/user-detail/user-detail.component.ts +++ b/overlord/src/app/user/user-detail/user-detail.component.ts @@ -35,21 +35,18 @@ export interface UserDetailFormData { MatCheckboxModule, MatDividerModule, MatButtonModule, - SkeletonLoaderComponent, ErrorStateComponent, ], }) export class UserDetailComponent { - id = input(null, { transform: (v: string | null | undefined) => v ?? null }); - private router = inject(Router); private snackBar = inject(MatSnackBar); private dialog = inject(MatDialog); private ser = inject(UserService); + id = input(null, { transform: (v: string | null | undefined) => v ?? null }); itemResource = this.ser.get(this.id); - item = computed(() => this.itemResource.value() ?? new User()); formModel = linkedSignal({ diff --git a/overlord/src/app/user/user-list/user-list.component.ts b/overlord/src/app/user/user-list/user-list.component.ts index 30dbc61c..7f845dee 100644 --- a/overlord/src/app/user/user-list/user-list.component.ts +++ b/overlord/src/app/user/user-list/user-list.component.ts @@ -29,10 +29,12 @@ import { UserService } from '../user.service'; }) export class UserListComponent { private ser = inject(UserService); + pageSize = signal(50); pageIndex = signal(0); sortActive = signal(''); sortDirection = signal(''); + listResource = this.ser.list(); list = computed(() => this.listResource.value() ?? []); sortedList = computed(() => {