incentive and closing stock fixed
This commit is contained in:
@@ -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(),
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user