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