Converted Date to Moment. Since Datepicker is already using Moment adapter

This commit is contained in:
2025-07-15 19:04:35 +00:00
parent d3588977a5
commit c542114e42
25 changed files with 126 additions and 126 deletions
@@ -53,7 +53,7 @@ export class AttendanceComponent implements OnInit {
public attendanceObservable = new BehaviorSubject<AttendanceItem[]>([]); public attendanceObservable = new BehaviorSubject<AttendanceItem[]>([]);
dataSource: AttendanceDataSource = new AttendanceDataSource(this.attendanceObservable); dataSource: AttendanceDataSource = new AttendanceDataSource(this.attendanceObservable);
form: FormGroup<{ form: FormGroup<{
date: FormControl<Date>; date: FormControl<moment.Moment>;
attendances: FormArray< attendances: FormArray<
FormGroup<{ FormGroup<{
attendanceType: FormControl<number>; attendanceType: FormControl<number>;
@@ -75,7 +75,7 @@ export class AttendanceComponent implements OnInit {
constructor() { constructor() {
this.form = new FormGroup({ this.form = new FormGroup({
date: new FormControl(new Date(), { nonNullable: true }), date: new FormControl(moment(new Date()), { nonNullable: true }),
attendances: new FormArray<FormGroup<{ attendanceType: FormControl<number> }>>([]), attendances: new FormArray<FormGroup<{ attendanceType: FormControl<number> }>>([]),
}); });
} }
@@ -86,7 +86,7 @@ export class AttendanceComponent implements OnInit {
this.info = data.info; this.info = data.info;
this.attendanceTypes = data.attendanceTypes; this.attendanceTypes = data.attendanceTypes;
this.form.controls.date.setValue(moment(this.info.date, 'DD-MMM-YYYY').toDate()); this.form.controls.date.setValue(moment(this.info.date, 'DD-MMM-YYYY'));
this.form.controls.attendances.clear(); this.form.controls.attendances.clear();
this.info.body.forEach((x) => this.info.body.forEach((x) =>
this.form.controls.attendances.push( this.form.controls.attendances.push(
@@ -44,7 +44,7 @@ export class BalanceSheetComponent implements OnInit {
info: BalanceSheet = new BalanceSheet(); info: BalanceSheet = new BalanceSheet();
dataSource: BalanceSheetDataSource = new BalanceSheetDataSource(this.info.body, this.paginator, this.sort); dataSource: BalanceSheetDataSource = new BalanceSheetDataSource(this.info.body, this.paginator, this.sort);
form: FormGroup<{ form: FormGroup<{
date: FormControl<Date>; date: FormControl<moment.Moment>;
}>; }>;
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */ /** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
@@ -59,7 +59,7 @@ export class BalanceSheetComponent implements OnInit {
constructor() { constructor() {
this.form = new FormGroup({ this.form = new FormGroup({
date: new FormControl(new Date(), { nonNullable: true }), date: new FormControl(moment(new Date()), { nonNullable: true }),
}); });
} }
@@ -69,7 +69,7 @@ export class BalanceSheetComponent implements OnInit {
this.info = data.info; this.info = data.info;
this.form.setValue({ this.form.setValue({
date: moment(this.info.date, 'DD-MMM-YYYY').toDate(), date: moment(this.info.date, 'DD-MMM-YYYY'),
}); });
this.dataSource = new BalanceSheetDataSource(this.info.body, this.paginator, this.sort); this.dataSource = new BalanceSheetDataSource(this.info.body, this.paginator, this.sort);
}); });
@@ -41,8 +41,8 @@ export class CashFlowComponent implements OnInit {
info: CashFlow = new CashFlow(); info: CashFlow = new CashFlow();
dataSource: CashFlowDataSource = new CashFlowDataSource(CashFlow.Data(this.info)); dataSource: CashFlowDataSource = new CashFlowDataSource(CashFlow.Data(this.info));
form: FormGroup<{ form: FormGroup<{
startDate: FormControl<Date>; startDate: FormControl<moment.Moment>;
finishDate: FormControl<Date>; finishDate: FormControl<moment.Moment>;
}>; }>;
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */ /** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
@@ -57,8 +57,8 @@ export class CashFlowComponent implements OnInit {
constructor() { constructor() {
this.form = new FormGroup({ this.form = new FormGroup({
startDate: new FormControl(new Date(), { nonNullable: true }), startDate: new FormControl(moment(new Date()), { nonNullable: true }),
finishDate: new FormControl(new Date(), { nonNullable: true }), finishDate: new FormControl(moment(new Date()), { nonNullable: true }),
}); });
} }
@@ -68,8 +68,8 @@ export class CashFlowComponent implements OnInit {
this.info = data.info; this.info = data.info;
this.form.setValue({ this.form.setValue({
startDate: moment(this.info.startDate, 'DD-MMM-YYYY').toDate(), startDate: moment(this.info.startDate, 'DD-MMM-YYYY'),
finishDate: moment(this.info.finishDate, 'DD-MMM-YYYY').toDate(), finishDate: moment(this.info.finishDate, 'DD-MMM-YYYY'),
}); });
this.dataSource = new CashFlowDataSource(CashFlow.Data(this.info)); this.dataSource = new CashFlowDataSource(CashFlow.Data(this.info));
}); });
@@ -63,7 +63,7 @@ export class ClosingStockComponent implements OnInit {
info: ClosingStock = new ClosingStock(); info: ClosingStock = new ClosingStock();
dataSource: ClosingStockDataSource = new ClosingStockDataSource(this.info.items, this.paginator, this.sort); dataSource: ClosingStockDataSource = new ClosingStockDataSource(this.info.items, this.paginator, this.sort);
form: FormGroup<{ form: FormGroup<{
date: FormControl<Date>; date: FormControl<moment.Moment>;
costCentre: FormControl<string | null>; costCentre: FormControl<string | null>;
stocks: FormArray< stocks: FormArray<
FormGroup<{ FormGroup<{
@@ -88,7 +88,7 @@ export class ClosingStockComponent implements OnInit {
constructor() { constructor() {
this.costCentres = []; this.costCentres = [];
this.form = new FormGroup({ this.form = new FormGroup({
date: new FormControl(new Date(), { nonNullable: true }), date: new FormControl(moment(new Date()), { nonNullable: true }),
costCentre: new FormControl<string | null>(null), costCentre: new FormControl<string | null>(null),
stocks: new FormArray<FormGroup<{ physical: FormControl<number>; costCentre: FormControl<string | undefined> }>>( stocks: new FormArray<FormGroup<{ physical: FormControl<number>; costCentre: FormControl<string | undefined> }>>(
[], [],
@@ -102,7 +102,7 @@ export class ClosingStockComponent implements OnInit {
this.info = data.info; this.info = data.info;
this.costCentres = data.costCentres; this.costCentres = data.costCentres;
this.form.patchValue({ this.form.patchValue({
date: moment(this.info.date, 'DD-MMM-YYYY').toDate(), date: moment(this.info.date, 'DD-MMM-YYYY'),
costCentre: this.info.costCentre.id, costCentre: this.info.costCentre.id,
}); });
this.form.controls.stocks.clear(); this.form.controls.stocks.clear();
@@ -43,8 +43,8 @@ export class DaybookComponent implements OnInit {
info: Daybook = new Daybook(); info: Daybook = new Daybook();
dataSource: DaybookDataSource = new DaybookDataSource(this.info.body, this.paginator, this.sort); dataSource: DaybookDataSource = new DaybookDataSource(this.info.body, this.paginator, this.sort);
form: FormGroup<{ form: FormGroup<{
startDate: FormControl<Date>; startDate: FormControl<moment.Moment>;
finishDate: FormControl<Date>; finishDate: FormControl<moment.Moment>;
}>; }>;
selectedRowId = ''; selectedRowId = '';
@@ -60,8 +60,8 @@ export class DaybookComponent implements OnInit {
constructor() { constructor() {
this.form = new FormGroup({ this.form = new FormGroup({
startDate: new FormControl(new Date(), { nonNullable: true }), startDate: new FormControl(moment(new Date()), { nonNullable: true }),
finishDate: new FormControl(new Date(), { nonNullable: true }), finishDate: new FormControl(moment(new Date()), { nonNullable: true }),
}); });
} }
@@ -71,8 +71,8 @@ export class DaybookComponent implements OnInit {
this.info = data.info; this.info = data.info;
this.form.setValue({ this.form.setValue({
startDate: moment(this.info.startDate, 'DD-MMM-YYYY').toDate(), startDate: moment(this.info.startDate, 'DD-MMM-YYYY'),
finishDate: moment(this.info.finishDate, 'DD-MMM-YYYY').toDate(), finishDate: moment(this.info.finishDate, 'DD-MMM-YYYY'),
}); });
this.dataSource = new DaybookDataSource(this.info.body, this.paginator, this.sort); this.dataSource = new DaybookDataSource(this.info.body, this.paginator, this.sort);
}); });
@@ -63,8 +63,8 @@ export class EmployeeAttendanceComponent implements OnInit, AfterViewInit {
dataSource: EmployeeAttendanceDataSource = new EmployeeAttendanceDataSource(this.employeeAttendanceObservable); dataSource: EmployeeAttendanceDataSource = new EmployeeAttendanceDataSource(this.employeeAttendanceObservable);
form: FormGroup<{ form: FormGroup<{
startDate: FormControl<Date>; startDate: FormControl<moment.Moment>;
finishDate: FormControl<Date>; finishDate: FormControl<moment.Moment>;
employee: FormControl<string | null>; employee: FormControl<string | null>;
attendances: FormArray< attendances: FormArray<
FormGroup<{ FormGroup<{
@@ -89,8 +89,8 @@ export class EmployeeAttendanceComponent implements OnInit, AfterViewInit {
constructor() { constructor() {
this.form = new FormGroup({ this.form = new FormGroup({
startDate: new FormControl(new Date(), { nonNullable: true }), startDate: new FormControl(moment(new Date()), { nonNullable: true }),
finishDate: new FormControl(new Date(), { nonNullable: true }), finishDate: new FormControl(moment(new Date()), { nonNullable: true }),
employee: new FormControl<string | null>(null), employee: new FormControl<string | null>(null),
attendances: new FormArray<FormGroup<{ attendanceType: FormControl<number> }>>([]), attendances: new FormArray<FormGroup<{ attendanceType: FormControl<number> }>>([]),
}); });
@@ -108,8 +108,8 @@ export class EmployeeAttendanceComponent implements OnInit, AfterViewInit {
this.info = data.info; this.info = data.info;
this.attendanceTypes = data.attendanceTypes; this.attendanceTypes = data.attendanceTypes;
this.form.controls.startDate.setValue(moment(this.info.startDate, 'DD-MMM-YYYY').toDate()); this.form.controls.startDate.setValue(moment(this.info.startDate, 'DD-MMM-YYYY'));
this.form.controls.finishDate.setValue(moment(this.info.finishDate, 'DD-MMM-YYYY').toDate()); this.form.controls.finishDate.setValue(moment(this.info.finishDate, 'DD-MMM-YYYY'));
this.form.controls.employee.setValue(this.info.employee?.name ?? ''); this.form.controls.employee.setValue(this.info.employee?.name ?? '');
this.form.controls.attendances.clear(); this.form.controls.attendances.clear();
this.info.body.forEach((x) => this.info.body.forEach((x) =>
@@ -64,7 +64,7 @@ export class EmployeeBenefitsComponent implements OnInit, AfterViewInit {
public benefitsObservable = new BehaviorSubject<EmployeeBenefit[]>([]); public benefitsObservable = new BehaviorSubject<EmployeeBenefit[]>([]);
dataSource: EmployeeBenefitsDataSource = new EmployeeBenefitsDataSource(this.benefitsObservable); dataSource: EmployeeBenefitsDataSource = new EmployeeBenefitsDataSource(this.benefitsObservable);
form: FormGroup<{ form: FormGroup<{
date: FormControl<Date>; date: FormControl<moment.Moment>;
addRow: FormGroup<{ addRow: FormGroup<{
employee: FormControl<string | null>; employee: FormControl<string | null>;
grossSalary: FormControl<string | null>; grossSalary: FormControl<string | null>;
@@ -99,7 +99,7 @@ export class EmployeeBenefitsComponent implements OnInit, AfterViewInit {
constructor() { constructor() {
this.form = new FormGroup({ this.form = new FormGroup({
date: new FormControl(new Date(), { nonNullable: true }), date: new FormControl(moment(new Date()), { nonNullable: true }),
addRow: new FormGroup({ addRow: new FormGroup({
employee: new FormControl(''), employee: new FormControl(''),
grossSalary: new FormControl(''), grossSalary: new FormControl(''),
@@ -149,7 +149,7 @@ export class EmployeeBenefitsComponent implements OnInit, AfterViewInit {
loadVoucher(voucher: Voucher) { loadVoucher(voucher: Voucher) {
this.voucher = voucher; this.voucher = voucher;
this.form.setValue({ this.form.setValue({
date: moment(this.voucher.date, 'DD-MMM-YYYY').toDate(), date: moment(this.voucher.date, 'DD-MMM-YYYY'),
addRow: { addRow: {
employee: '1', employee: '1',
grossSalary: '', grossSalary: '',
@@ -52,8 +52,8 @@ export class EmployeeDetailComponent implements OnInit, AfterViewInit {
points: FormControl<number | string | null>; points: FormControl<number | string | null>;
isActive: FormControl<boolean>; isActive: FormControl<boolean>;
costCentre: FormControl<string | null>; costCentre: FormControl<string | null>;
joiningDate: FormControl<Date>; joiningDate: FormControl<moment.Moment>;
leavingDate: FormControl<Date | null>; leavingDate: FormControl<moment.Moment | null>;
}>; }>;
costCentres: CostCentre[] = []; costCentres: CostCentre[] = [];
@@ -68,8 +68,8 @@ export class EmployeeDetailComponent implements OnInit, AfterViewInit {
points: new FormControl<number | string | null>(null), points: new FormControl<number | string | null>(null),
isActive: new FormControl<boolean>(true, { nonNullable: true }), isActive: new FormControl<boolean>(true, { nonNullable: true }),
costCentre: new FormControl<string | null>(null), costCentre: new FormControl<string | null>(null),
joiningDate: new FormControl(new Date(), { nonNullable: true }), joiningDate: new FormControl(moment(new Date()), { nonNullable: true }),
leavingDate: new FormControl<Date | null>(null), leavingDate: new FormControl<moment.Moment | null>(null),
}); });
// Listen to IsActive Changes // Listen to IsActive Changes
this.form.controls.isActive.valueChanges.subscribe((x) => { this.form.controls.isActive.valueChanges.subscribe((x) => {
@@ -96,8 +96,8 @@ export class EmployeeDetailComponent implements OnInit, AfterViewInit {
points: this.item.points || '', points: this.item.points || '',
isActive: this.item.isActive, isActive: this.item.isActive,
costCentre: this.item.costCentre.id ?? '', costCentre: this.item.costCentre.id ?? '',
joiningDate: this.item.joiningDate ? moment(this.item.joiningDate, 'DD-MMM-YYYY').toDate() : new Date(), joiningDate: this.item.joiningDate ? moment(this.item.joiningDate, 'DD-MMM-YYYY') : moment(new Date()),
leavingDate: this.item.isActive ? null : moment(this.item.leavingDate, 'DD-MMM-YYYY').toDate(), leavingDate: this.item.isActive ? null : moment(this.item.leavingDate, 'DD-MMM-YYYY'),
}); });
} }
@@ -51,8 +51,8 @@ export class EntriesComponent implements OnInit {
info: Report = new Report(); info: Report = new Report();
dataSource: EntriesDatasource; dataSource: EntriesDatasource;
form: FormGroup<{ form: FormGroup<{
startDate: FormControl<Date>; startDate: FormControl<moment.Moment>;
finishDate: FormControl<Date>; finishDate: FormControl<moment.Moment>;
posted: FormControl<boolean | null>; posted: FormControl<boolean | null>;
issue: FormControl<boolean>; issue: FormControl<boolean>;
}>; }>;
@@ -71,8 +71,8 @@ export class EntriesComponent implements OnInit {
constructor() { constructor() {
this.form = new FormGroup({ this.form = new FormGroup({
startDate: new FormControl(new Date(), { nonNullable: true }), startDate: new FormControl(moment(new Date()), { nonNullable: true }),
finishDate: new FormControl(new Date(), { nonNullable: true }), finishDate: new FormControl(moment(new Date()), { nonNullable: true }),
posted: new FormControl<boolean | null>(null), posted: new FormControl<boolean | null>(null),
issue: new FormControl<boolean>(false, { nonNullable: true }), issue: new FormControl<boolean>(false, { nonNullable: true }),
}); });
@@ -84,8 +84,8 @@ export class EntriesComponent implements OnInit {
const data = value as { info: Report }; const data = value as { info: Report };
this.info = data.info; this.info = data.info;
const queryMap = this.route.snapshot.queryParamMap; const queryMap = this.route.snapshot.queryParamMap;
const startDate = moment(queryMap.get('s') || undefined, 'DD-MMM-YYYY').toDate(); const startDate = moment(queryMap.get('s') || undefined, 'DD-MMM-YYYY');
const finishDate = moment(queryMap.get('f') || undefined, 'DD-MMM-YYYY').toDate(); const finishDate = moment(queryMap.get('f') || undefined, 'DD-MMM-YYYY');
const postedO = queryMap.get('p'); const postedO = queryMap.get('p');
this.posted = postedO !== null ? postedO === 'true' : null; this.posted = postedO !== null ? postedO === 'true' : null;
const pageSizeO = queryMap.get('ps'); const pageSizeO = queryMap.get('ps');
@@ -56,7 +56,7 @@ export class IncentiveComponent implements OnInit {
public incentiveObservable = new BehaviorSubject<Incentive[]>([]); public incentiveObservable = new BehaviorSubject<Incentive[]>([]);
dataSource: IncentiveDataSource = new IncentiveDataSource(this.incentiveObservable); dataSource: IncentiveDataSource = new IncentiveDataSource(this.incentiveObservable);
form: FormGroup<{ form: FormGroup<{
date: FormControl<Date>; date: FormControl<moment.Moment>;
incentives: FormArray< incentives: FormArray<
FormGroup<{ FormGroup<{
points: FormControl<number>; points: FormControl<number>;
@@ -79,7 +79,7 @@ export class IncentiveComponent implements OnInit {
constructor() { constructor() {
this.form = new FormGroup({ this.form = new FormGroup({
date: new FormControl(new Date(), { nonNullable: true }), date: new FormControl(moment(new Date()), { nonNullable: true }),
incentives: new FormArray<FormGroup<{ points: FormControl<number> }>>([]), incentives: new FormArray<FormGroup<{ points: FormControl<number> }>>([]),
}); });
// Listen to Date Change // Listen to Date Change
@@ -103,7 +103,7 @@ export class IncentiveComponent implements OnInit {
loadVoucher(voucher: Voucher) { loadVoucher(voucher: Voucher) {
this.voucher = voucher; this.voucher = voucher;
this.form.controls.date.setValue(moment(this.voucher.date, 'DD-MMM-YYYY').toDate()); this.form.controls.date.setValue(moment(this.voucher.date, 'DD-MMM-YYYY'));
this.form.controls.incentives.clear(); this.form.controls.incentives.clear();
this.voucher.incentives.forEach((x) => this.voucher.incentives.forEach((x) =>
this.form.controls.incentives.push( this.form.controls.incentives.push(
+6 -6
View File
@@ -82,8 +82,8 @@ export class LedgerComponent implements OnInit, AfterViewInit {
allTags: Tag[] = []; allTags: Tag[] = [];
tags: string[] = []; tags: string[] = [];
form: FormGroup<{ form: FormGroup<{
startDate: FormControl<Date>; startDate: FormControl<moment.Moment>;
finishDate: FormControl<Date>; finishDate: FormControl<moment.Moment>;
account: FormControl<string | null>; account: FormControl<string | null>;
tags: FormControl<string[]>; tags: FormControl<string[]>;
}>; }>;
@@ -103,8 +103,8 @@ export class LedgerComponent implements OnInit, AfterViewInit {
constructor() { constructor() {
this.form = new FormGroup({ this.form = new FormGroup({
startDate: new FormControl(new Date(), { nonNullable: true }), startDate: new FormControl(moment(new Date()), { nonNullable: true }),
finishDate: new FormControl(new Date(), { nonNullable: true }), finishDate: new FormControl(moment(new Date()), { nonNullable: true }),
account: new FormControl<string | null>(null), account: new FormControl<string | null>(null),
tags: new FormControl<string[]>([], { nonNullable: true }), tags: new FormControl<string[]>([], { nonNullable: true }),
}); });
@@ -128,8 +128,8 @@ export class LedgerComponent implements OnInit, AfterViewInit {
]; ];
this.form.setValue({ this.form.setValue({
account: this.info.account?.name ?? '', account: this.info.account?.name ?? '',
startDate: moment(this.info.startDate, 'DD-MMM-YYYY').toDate(), startDate: moment(this.info.startDate, 'DD-MMM-YYYY'),
finishDate: moment(this.info.finishDate, 'DD-MMM-YYYY').toDate(), finishDate: moment(this.info.finishDate, 'DD-MMM-YYYY'),
tags: this.tags, tags: this.tags,
}); });
this.body.next(this.info.body); this.body.next(this.info.body);
@@ -63,7 +63,7 @@ export class MozimoDailyRegisterComponent implements OnInit {
dataSource: MozimoDailyRegisterDataSource = new MozimoDailyRegisterDataSource(this.body); dataSource: MozimoDailyRegisterDataSource = new MozimoDailyRegisterDataSource(this.body);
form: FormGroup<{ form: FormGroup<{
date: FormControl<Date>; date: FormControl<moment.Moment>;
items: FormArray< items: FormArray<
FormGroup<{ FormGroup<{
received: FormControl<number>; received: FormControl<number>;
@@ -80,7 +80,7 @@ export class MozimoDailyRegisterComponent implements OnInit {
constructor() { constructor() {
this.form = new FormGroup({ this.form = new FormGroup({
date: new FormControl(new Date(), { nonNullable: true }), date: new FormControl(moment(new Date()), { nonNullable: true }),
items: new FormArray< items: new FormArray<
FormGroup<{ FormGroup<{
received: FormControl<number>; received: FormControl<number>;
@@ -98,7 +98,7 @@ export class MozimoDailyRegisterComponent implements OnInit {
const data = value as { info: MozimoDailyRegister }; const data = value as { info: MozimoDailyRegister };
this.info = data.info; this.info = data.info;
this.form.patchValue({ this.form.patchValue({
date: moment(this.info.date, 'DD-MMM-YYYY').toDate(), date: moment(this.info.date, 'DD-MMM-YYYY'),
}); });
this.form.controls.items.clear(); this.form.controls.items.clear();
this.info.body.forEach((x) => this.info.body.forEach((x) =>
@@ -67,8 +67,8 @@ export class MozimoProductRegisterComponent implements OnInit {
dataSource: MozimoProductRegisterDataSource = new MozimoProductRegisterDataSource(this.body); dataSource: MozimoProductRegisterDataSource = new MozimoProductRegisterDataSource(this.body);
form: FormGroup<{ form: FormGroup<{
startDate: FormControl<Date>; startDate: FormControl<moment.Moment>;
finishDate: FormControl<Date>; finishDate: FormControl<moment.Moment>;
product: FormControl<string | null>; product: FormControl<string | null>;
items: FormArray< items: FormArray<
FormGroup<{ FormGroup<{
@@ -88,8 +88,8 @@ export class MozimoProductRegisterComponent implements OnInit {
constructor() { constructor() {
this.form = new FormGroup({ this.form = new FormGroup({
startDate: new FormControl(new Date(), { nonNullable: true }), startDate: new FormControl(moment(new Date()), { nonNullable: true }),
finishDate: new FormControl(new Date(), { nonNullable: true }), finishDate: new FormControl(moment(new Date()), { nonNullable: true }),
product: new FormControl<string | null>(null), product: new FormControl<string | null>(null),
items: new FormArray< items: new FormArray<
FormGroup<{ FormGroup<{
@@ -115,8 +115,8 @@ export class MozimoProductRegisterComponent implements OnInit {
this.info = data.info; this.info = data.info;
this.form.patchValue({ this.form.patchValue({
product: this.info.product?.name ?? '', product: this.info.product?.name ?? '',
startDate: moment(this.info.startDate, 'DD-MMM-YYYY').toDate(), startDate: moment(this.info.startDate, 'DD-MMM-YYYY'),
finishDate: moment(this.info.finishDate, 'DD-MMM-YYYY').toDate(), finishDate: moment(this.info.finishDate, 'DD-MMM-YYYY'),
}); });
this.form.controls.items.clear(); this.form.controls.items.clear();
this.info.body.forEach((x) => this.info.body.forEach((x) =>
@@ -44,8 +44,8 @@ export class NetTransactionsComponent implements OnInit {
info: NetTransactions = new NetTransactions(); info: NetTransactions = new NetTransactions();
dataSource: NetTransactionsDataSource = new NetTransactionsDataSource(this.info.body, this.paginator, this.sort); dataSource: NetTransactionsDataSource = new NetTransactionsDataSource(this.info.body, this.paginator, this.sort);
form: FormGroup<{ form: FormGroup<{
startDate: FormControl<Date>; startDate: FormControl<moment.Moment>;
finishDate: FormControl<Date>; finishDate: FormControl<moment.Moment>;
}>; }>;
selectedRowId = ''; selectedRowId = '';
@@ -61,8 +61,8 @@ export class NetTransactionsComponent implements OnInit {
constructor() { constructor() {
this.form = new FormGroup({ this.form = new FormGroup({
startDate: new FormControl(new Date(), { nonNullable: true }), startDate: new FormControl(moment(new Date()), { nonNullable: true }),
finishDate: new FormControl(new Date(), { nonNullable: true }), finishDate: new FormControl(moment(new Date()), { nonNullable: true }),
}); });
} }
@@ -72,8 +72,8 @@ export class NetTransactionsComponent implements OnInit {
this.info = data.info; this.info = data.info;
this.form.setValue({ this.form.setValue({
startDate: moment(this.info.startDate, 'DD-MMM-YYYY').toDate(), startDate: moment(this.info.startDate, 'DD-MMM-YYYY'),
finishDate: moment(this.info.finishDate, 'DD-MMM-YYYY').toDate(), finishDate: moment(this.info.finishDate, 'DD-MMM-YYYY'),
}); });
this.dataSource = new NetTransactionsDataSource(this.info.body, this.paginator, this.sort); this.dataSource = new NetTransactionsDataSource(this.info.body, this.paginator, this.sort);
}); });
@@ -36,8 +36,8 @@ export class PeriodDetailComponent implements OnInit {
@ViewChild('startDateElement', { static: true }) startDate!: ElementRef<HTMLInputElement>; @ViewChild('startDateElement', { static: true }) startDate!: ElementRef<HTMLInputElement>;
form: FormGroup<{ form: FormGroup<{
validFrom: FormControl<Date>; validFrom: FormControl<moment.Moment>;
validTill: FormControl<Date>; validTill: FormControl<moment.Moment>;
}>; }>;
item: Period = new Period(); item: Period = new Period();
@@ -51,8 +51,8 @@ export class PeriodDetailComponent implements OnInit {
constructor() { constructor() {
this.form = new FormGroup({ this.form = new FormGroup({
validFrom: new FormControl(new Date(), { nonNullable: true }), validFrom: new FormControl(moment(new Date()), { nonNullable: true }),
validTill: new FormControl(new Date(), { nonNullable: true }), validTill: new FormControl(moment(new Date()), { nonNullable: true }),
}); });
} }
@@ -67,8 +67,8 @@ export class PeriodDetailComponent implements OnInit {
showItem(item: Period) { showItem(item: Period) {
this.item = item; this.item = item;
this.form.setValue({ this.form.setValue({
validFrom: moment(this.item.validFrom, 'DD-MMM-YYYY').toDate(), validFrom: moment(this.item.validFrom, 'DD-MMM-YYYY'),
validTill: moment(this.item.validTill, 'DD-MMM-YYYY').toDate(), validTill: moment(this.item.validTill, 'DD-MMM-YYYY'),
}); });
} }
@@ -62,8 +62,8 @@ export class ProductLedgerComponent implements OnInit, AfterViewInit {
info: ProductLedger = new ProductLedger(); info: ProductLedger = new ProductLedger();
dataSource: ProductLedgerDataSource = new ProductLedgerDataSource(this.info.body, this.paginator, this.sort); dataSource: ProductLedgerDataSource = new ProductLedgerDataSource(this.info.body, this.paginator, this.sort);
form: FormGroup<{ form: FormGroup<{
startDate: FormControl<Date>; startDate: FormControl<moment.Moment>;
finishDate: FormControl<Date>; finishDate: FormControl<moment.Moment>;
product: FormControl<string | null>; product: FormControl<string | null>;
}>; }>;
@@ -99,8 +99,8 @@ export class ProductLedgerComponent implements OnInit, AfterViewInit {
constructor() { constructor() {
this.form = new FormGroup({ this.form = new FormGroup({
startDate: new FormControl(new Date(), { nonNullable: true }), startDate: new FormControl(moment(new Date()), { nonNullable: true }),
finishDate: new FormControl(new Date(), { nonNullable: true }), finishDate: new FormControl(moment(new Date()), { nonNullable: true }),
product: new FormControl<string | null>(null), product: new FormControl<string | null>(null),
}); });
@@ -119,8 +119,8 @@ export class ProductLedgerComponent implements OnInit, AfterViewInit {
this.calculateTotals(); this.calculateTotals();
this.form.setValue({ this.form.setValue({
product: this.info.product?.name ?? '', product: this.info.product?.name ?? '',
startDate: moment(this.info.startDate, 'DD-MMM-YYYY').toDate(), startDate: moment(this.info.startDate, 'DD-MMM-YYYY'),
finishDate: moment(this.info.finishDate, 'DD-MMM-YYYY').toDate(), finishDate: moment(this.info.finishDate, 'DD-MMM-YYYY'),
}); });
this.dataSource = new ProductLedgerDataSource(this.info.body, this.paginator, this.sort); this.dataSource = new ProductLedgerDataSource(this.info.body, this.paginator, this.sort);
}); });
@@ -42,8 +42,8 @@ export class ProfitLossComponent implements OnInit {
info: ProfitLoss = new ProfitLoss(); info: ProfitLoss = new ProfitLoss();
dataSource: ProfitLossDataSource = new ProfitLossDataSource(this.info.body, this.paginator, this.sort); dataSource: ProfitLossDataSource = new ProfitLossDataSource(this.info.body, this.paginator, this.sort);
form: FormGroup<{ form: FormGroup<{
startDate: FormControl<Date>; startDate: FormControl<moment.Moment>;
finishDate: FormControl<Date>; finishDate: FormControl<moment.Moment>;
}>; }>;
selectedRowId = ''; selectedRowId = '';
@@ -59,8 +59,8 @@ export class ProfitLossComponent implements OnInit {
constructor() { constructor() {
this.form = new FormGroup({ this.form = new FormGroup({
startDate: new FormControl(new Date(), { nonNullable: true }), startDate: new FormControl(moment(new Date()), { nonNullable: true }),
finishDate: new FormControl(new Date(), { nonNullable: true }), finishDate: new FormControl(moment(new Date()), { nonNullable: true }),
}); });
} }
@@ -70,8 +70,8 @@ export class ProfitLossComponent implements OnInit {
this.info = data.info; this.info = data.info;
this.form.setValue({ this.form.setValue({
startDate: moment(this.info.startDate, 'DD-MMM-YYYY').toDate(), startDate: moment(this.info.startDate, 'DD-MMM-YYYY'),
finishDate: moment(this.info.finishDate, 'DD-MMM-YYYY').toDate(), finishDate: moment(this.info.finishDate, 'DD-MMM-YYYY'),
}); });
this.dataSource = new ProfitLossDataSource(this.info.body, this.paginator, this.sort); this.dataSource = new ProfitLossDataSource(this.info.body, this.paginator, this.sort);
}); });
@@ -45,8 +45,8 @@ export class PurchaseEntriesComponent implements OnInit {
info: PurchaseEntries = new PurchaseEntries(); info: PurchaseEntries = new PurchaseEntries();
dataSource: PurchaseEntriesDataSource = new PurchaseEntriesDataSource(this.info.body, this.paginator, this.sort); dataSource: PurchaseEntriesDataSource = new PurchaseEntriesDataSource(this.info.body, this.paginator, this.sort);
form: FormGroup<{ form: FormGroup<{
startDate: FormControl<Date>; startDate: FormControl<moment.Moment>;
finishDate: FormControl<Date>; finishDate: FormControl<moment.Moment>;
}>; }>;
selectedRowId = ''; selectedRowId = '';
@@ -62,8 +62,8 @@ export class PurchaseEntriesComponent implements OnInit {
constructor() { constructor() {
this.form = new FormGroup({ this.form = new FormGroup({
startDate: new FormControl(new Date(), { nonNullable: true }), startDate: new FormControl(moment(new Date()), { nonNullable: true }),
finishDate: new FormControl(new Date(), { nonNullable: true }), finishDate: new FormControl(moment(new Date()), { nonNullable: true }),
}); });
} }
@@ -73,8 +73,8 @@ export class PurchaseEntriesComponent implements OnInit {
this.info = data.info; this.info = data.info;
this.form.setValue({ this.form.setValue({
startDate: moment(this.info.startDate, 'DD-MMM-YYYY').toDate(), startDate: moment(this.info.startDate, 'DD-MMM-YYYY'),
finishDate: moment(this.info.finishDate, 'DD-MMM-YYYY').toDate(), finishDate: moment(this.info.finishDate, 'DD-MMM-YYYY'),
}); });
this.dataSource = new PurchaseEntriesDataSource(this.info.body, this.paginator, this.sort); this.dataSource = new PurchaseEntriesDataSource(this.info.body, this.paginator, this.sort);
}); });
@@ -45,8 +45,8 @@ export class PurchasesComponent implements OnInit {
info: Purchases = new Purchases(); info: Purchases = new Purchases();
dataSource: PurchasesDataSource = new PurchasesDataSource(this.info.body, this.paginator, this.sort); dataSource: PurchasesDataSource = new PurchasesDataSource(this.info.body, this.paginator, this.sort);
form: FormGroup<{ form: FormGroup<{
startDate: FormControl<Date>; startDate: FormControl<moment.Moment>;
finishDate: FormControl<Date>; finishDate: FormControl<moment.Moment>;
}>; }>;
selectedRowId = ''; selectedRowId = '';
@@ -62,8 +62,8 @@ export class PurchasesComponent implements OnInit {
constructor() { constructor() {
this.form = new FormGroup({ this.form = new FormGroup({
startDate: new FormControl(new Date(), { nonNullable: true }), startDate: new FormControl(moment(new Date()), { nonNullable: true }),
finishDate: new FormControl(new Date(), { nonNullable: true }), finishDate: new FormControl(moment(new Date()), { nonNullable: true }),
}); });
} }
@@ -73,8 +73,8 @@ export class PurchasesComponent implements OnInit {
this.info = data.info; this.info = data.info;
this.form.setValue({ this.form.setValue({
startDate: moment(this.info.startDate, 'DD-MMM-YYYY').toDate(), startDate: moment(this.info.startDate, 'DD-MMM-YYYY'),
finishDate: moment(this.info.finishDate, 'DD-MMM-YYYY').toDate(), finishDate: moment(this.info.finishDate, 'DD-MMM-YYYY'),
}); });
this.dataSource = new PurchasesDataSource(this.info.body, this.paginator, this.sort); this.dataSource = new PurchasesDataSource(this.info.body, this.paginator, this.sort);
}); });
@@ -66,10 +66,10 @@ export class RateContractDetailComponent implements OnInit, AfterViewInit {
public itemsObservable = new BehaviorSubject<RateContractItem[]>([]); public itemsObservable = new BehaviorSubject<RateContractItem[]>([]);
dataSource: RateContractDetailDatasource = new RateContractDetailDatasource(this.itemsObservable); dataSource: RateContractDetailDatasource = new RateContractDetailDatasource(this.itemsObservable);
form: FormGroup<{ form: FormGroup<{
date: FormControl<Date>; date: FormControl<moment.Moment>;
account: FormControl<string | null>; account: FormControl<string | null>;
validFrom: FormControl<Date>; validFrom: FormControl<moment.Moment>;
validTill: FormControl<Date>; validTill: FormControl<moment.Moment>;
addRow: FormGroup<{ addRow: FormGroup<{
product: FormControl<string | null>; product: FormControl<string | null>;
price: FormControl<string>; price: FormControl<string>;
@@ -96,10 +96,10 @@ export class RateContractDetailComponent implements OnInit, AfterViewInit {
constructor() { constructor() {
this.form = new FormGroup({ this.form = new FormGroup({
date: new FormControl(new Date(), { nonNullable: true }), date: new FormControl(moment(new Date()), { nonNullable: true }),
account: new FormControl<string | null>(null), account: new FormControl<string | null>(null),
validFrom: new FormControl(new Date(), { nonNullable: true }), validFrom: new FormControl(moment(new Date()), { nonNullable: true }),
validTill: new FormControl(new Date(), { nonNullable: true }), validTill: new FormControl(moment(new Date()), { nonNullable: true }),
addRow: new FormGroup({ addRow: new FormGroup({
product: new FormControl(''), product: new FormControl(''),
price: new FormControl('', { nonNullable: true }), price: new FormControl('', { nonNullable: true }),
@@ -129,9 +129,9 @@ export class RateContractDetailComponent implements OnInit, AfterViewInit {
loadItem(item: RateContract) { loadItem(item: RateContract) {
this.item = item; this.item = item;
this.form.setValue({ this.form.setValue({
date: moment(this.item.date, 'DD-MMM-YYYY').toDate(), date: moment(this.item.date, 'DD-MMM-YYYY'),
validFrom: moment(this.item.validFrom, 'DD-MMM-YYYY').toDate(), validFrom: moment(this.item.validFrom, 'DD-MMM-YYYY'),
validTill: moment(this.item.validTill, 'DD-MMM-YYYY').toDate(), validTill: moment(this.item.validTill, 'DD-MMM-YYYY'),
account: this.item.vendor?.name ?? '', account: this.item.vendor?.name ?? '',
addRow: { addRow: {
product: '', product: '',
@@ -49,8 +49,8 @@ export class RawMaterialCostComponent implements OnInit {
info: RawMaterialCost = new RawMaterialCost(); info: RawMaterialCost = new RawMaterialCost();
dataSource: RawMaterialCostDataSource = new RawMaterialCostDataSource(this.info.body, this.paginator, this.sort); dataSource: RawMaterialCostDataSource = new RawMaterialCostDataSource(this.info.body, this.paginator, this.sort);
form: FormGroup<{ form: FormGroup<{
startDate: FormControl<Date>; startDate: FormControl<moment.Moment>;
finishDate: FormControl<Date>; finishDate: FormControl<moment.Moment>;
}>; }>;
debitQuantity = 0; debitQuantity = 0;
@@ -73,8 +73,8 @@ export class RawMaterialCostComponent implements OnInit {
constructor() { constructor() {
this.form = new FormGroup({ this.form = new FormGroup({
startDate: new FormControl(new Date(), { nonNullable: true }), startDate: new FormControl(moment(new Date()), { nonNullable: true }),
finishDate: new FormControl(new Date(), { nonNullable: true }), finishDate: new FormControl(moment(new Date()), { nonNullable: true }),
}); });
} }
@@ -85,8 +85,8 @@ export class RawMaterialCostComponent implements OnInit {
this.info = data.info; this.info = data.info;
this.displayedColumns = this.info.id ? this.columnsId : this.columnsNoId; this.displayedColumns = this.info.id ? this.columnsId : this.columnsNoId;
this.form.setValue({ this.form.setValue({
startDate: moment(this.info.startDate, 'DD-MMM-YYYY').toDate(), startDate: moment(this.info.startDate, 'DD-MMM-YYYY'),
finishDate: moment(this.info.finishDate, 'DD-MMM-YYYY').toDate(), finishDate: moment(this.info.finishDate, 'DD-MMM-YYYY'),
}); });
this.dataSource = new RawMaterialCostDataSource(this.info.body, this.paginator, this.sort); this.dataSource = new RawMaterialCostDataSource(this.info.body, this.paginator, this.sort);
}); });
@@ -39,7 +39,7 @@ export class RecipeTemplateDetailComponent implements OnInit, AfterViewInit {
@ViewChild('nameElement', { static: true }) nameElement!: ElementRef<HTMLInputElement>; @ViewChild('nameElement', { static: true }) nameElement!: ElementRef<HTMLInputElement>;
form: FormGroup<{ form: FormGroup<{
name: FormControl<string>; name: FormControl<string>;
date: FormControl<Date>; date: FormControl<moment.Moment>;
text: FormControl<string>; text: FormControl<string>;
selected: FormControl<boolean>; selected: FormControl<boolean>;
}>; }>;
@@ -49,7 +49,7 @@ export class RecipeTemplateDetailComponent implements OnInit, AfterViewInit {
constructor() { constructor() {
this.form = new FormGroup({ this.form = new FormGroup({
name: new FormControl<string>('', { nonNullable: true }), name: new FormControl<string>('', { nonNullable: true }),
date: new FormControl(new Date(), { nonNullable: true }), date: new FormControl(moment(new Date()), { nonNullable: true }),
text: new FormControl<string>('', { nonNullable: true }), text: new FormControl<string>('', { nonNullable: true }),
selected: new FormControl<boolean>(false, { nonNullable: true }), selected: new FormControl<boolean>(false, { nonNullable: true }),
}); });
@@ -67,7 +67,7 @@ export class RecipeTemplateDetailComponent implements OnInit, AfterViewInit {
this.item = item; this.item = item;
this.form.setValue({ this.form.setValue({
name: this.item.name, name: this.item.name,
date: moment(this.item.date, 'DD-MMM-YYYY').toDate(), date: moment(this.item.date, 'DD-MMM-YYYY'),
text: this.item.text, text: this.item.text,
selected: this.item.selected, selected: this.item.selected,
}); });
@@ -63,7 +63,7 @@ export class RecipeDetailComponent implements OnInit, AfterViewInit {
public itemsObservable = new BehaviorSubject<RecipeItem[]>([]); public itemsObservable = new BehaviorSubject<RecipeItem[]>([]);
dataSource: RecipeDetailDatasource = new RecipeDetailDatasource(this.itemsObservable); dataSource: RecipeDetailDatasource = new RecipeDetailDatasource(this.itemsObservable);
form: FormGroup<{ form: FormGroup<{
date: FormControl<Date>; date: FormControl<moment.Moment>;
source: FormControl<string>; source: FormControl<string>;
recipeYield: FormControl<string | null>; recipeYield: FormControl<string | null>;
product: FormControl<ProductSku | string | null>; product: FormControl<ProductSku | string | null>;
@@ -90,7 +90,7 @@ export class RecipeDetailComponent implements OnInit, AfterViewInit {
this.product = null; this.product = null;
this.ingredient = null; this.ingredient = null;
this.form = new FormGroup({ this.form = new FormGroup({
date: new FormControl(new Date(), { nonNullable: true }), date: new FormControl(moment(new Date()), { nonNullable: true }),
source: new FormControl('', { nonNullable: true }), source: new FormControl('', { nonNullable: true }),
recipeYield: new FormControl<string | null>(null), recipeYield: new FormControl<string | null>(null),
product: new FormControl<ProductSku | string | null>(new ProductSku()), product: new FormControl<ProductSku | string | null>(new ProductSku()),
@@ -132,7 +132,7 @@ export class RecipeDetailComponent implements OnInit, AfterViewInit {
showItem(item: Recipe) { showItem(item: Recipe) {
this.item = item; this.item = item;
this.form.setValue({ this.form.setValue({
date: moment(item.date, 'DD-MMM-YYYY').toDate(), date: moment(item.date, 'DD-MMM-YYYY'),
source: item.source, source: item.source,
recipeYield: `${item.recipeYield}`, recipeYield: `${item.recipeYield}`,
product: item.sku, product: item.sku,
@@ -43,8 +43,8 @@ export class StockMovementComponent implements OnInit {
info: StockMovement = new StockMovement(); info: StockMovement = new StockMovement();
dataSource: StockMovementDataSource = new StockMovementDataSource(this.info.body, this.paginator, this.sort); dataSource: StockMovementDataSource = new StockMovementDataSource(this.info.body, this.paginator, this.sort);
form: FormGroup<{ form: FormGroup<{
startDate: FormControl<Date>; startDate: FormControl<moment.Moment>;
finishDate: FormControl<Date>; finishDate: FormControl<moment.Moment>;
}>; }>;
selectedRowId = ''; selectedRowId = '';
@@ -60,8 +60,8 @@ export class StockMovementComponent implements OnInit {
constructor() { constructor() {
this.form = new FormGroup({ this.form = new FormGroup({
startDate: new FormControl(new Date(), { nonNullable: true }), startDate: new FormControl(moment(new Date()), { nonNullable: true }),
finishDate: new FormControl(new Date(), { nonNullable: true }), finishDate: new FormControl(moment(new Date()), { nonNullable: true }),
}); });
} }
@@ -71,8 +71,8 @@ export class StockMovementComponent implements OnInit {
this.info = data.info; this.info = data.info;
this.form.setValue({ this.form.setValue({
startDate: moment(this.info.startDate, 'DD-MMM-YYYY').toDate(), startDate: moment(this.info.startDate, 'DD-MMM-YYYY'),
finishDate: moment(this.info.finishDate, 'DD-MMM-YYYY').toDate(), finishDate: moment(this.info.finishDate, 'DD-MMM-YYYY'),
}); });
this.dataSource = new StockMovementDataSource(this.info.body, this.paginator, this.sort); this.dataSource = new StockMovementDataSource(this.info.body, this.paginator, this.sort);
}); });
@@ -44,7 +44,7 @@ export class TrialBalanceComponent implements OnInit {
info: TrialBalance = new TrialBalance(); info: TrialBalance = new TrialBalance();
dataSource: TrialBalanceDataSource = new TrialBalanceDataSource(this.info.body, this.paginator, this.sort); dataSource: TrialBalanceDataSource = new TrialBalanceDataSource(this.info.body, this.paginator, this.sort);
form: FormGroup<{ form: FormGroup<{
date: FormControl<Date>; date: FormControl<moment.Moment>;
}>; }>;
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */ /** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
@@ -59,7 +59,7 @@ export class TrialBalanceComponent implements OnInit {
constructor() { constructor() {
this.form = new FormGroup({ this.form = new FormGroup({
date: new FormControl(new Date(), { nonNullable: true }), date: new FormControl(moment(new Date()), { nonNullable: true }),
}); });
} }
@@ -69,7 +69,7 @@ export class TrialBalanceComponent implements OnInit {
this.info = data.info; this.info = data.info;
this.form.setValue({ this.form.setValue({
date: moment(this.info.date, 'DD-MMM-YYYY').toDate(), date: moment(this.info.date, 'DD-MMM-YYYY'),
}); });
this.dataSource = new TrialBalanceDataSource(this.info.body, this.paginator, this.sort); this.dataSource = new TrialBalanceDataSource(this.info.body, this.paginator, this.sort);
}); });