incentive and closing stock fixed

This commit is contained in:
2026-08-27 08:42:05 +00:00
parent e918644a5b
commit 0d5012c961
5 changed files with 35 additions and 27 deletions
@@ -1,6 +1,6 @@
import { CurrencyPipe, DecimalPipe } from '@angular/common';
import { Component, inject, computed, input, linkedSignal, signal, afterNextRender } from '@angular/core';
import { form as createForm, FormField, FormRoot } from '@angular/forms/signals';
import { form as createForm, FormField, FormRoot, required } from '@angular/forms/signals';
import { MatButtonModule } from '@angular/material/button';
import { MatOptionModule } from '@angular/material/core';
import { MatDatepickerModule } from '@angular/material/datepicker';
@@ -94,7 +94,10 @@ export class ClosingStockComponent {
}),
});
form = createForm(this.model);
form = createForm(this.model, (f) => {
required(f.costCentre);
required(f.date);
});
sortedList = computed(() => {
const data = this.info().items ?? [];
@@ -144,6 +147,9 @@ export class ClosingStockComponent {
}
show() {
if (this.form().invalid()) {
return;
}
const info = this.getInfo();
this.router.navigate(['closing-stock', info.date], {
queryParams: {
@@ -180,7 +186,7 @@ export class ClosingStockComponent {
return new ClosingStock({
date: moment(formModel.date).format('DD-MMM-YYYY'),
costCentre: new CostCentre({ id: formModel.costCentre?.id ?? '' }),
costCentre: formModel.costCentre ?? new CostCentre(),
});
}