Moving to strict.
Create form has now moved to constructor and route data subscribe is type safe.
This commit is contained in:
1 parent
30b1a3ef7d
commit
39e3cc51bb
52 files changed
+348
-448
No files matched your search
@@ -30,10 +30,6 @@ export class AccountDetailComponent implements OnInit, AfterViewInit {
|
||||
private toaster: ToasterService,
|
||||
private ser: AccountService,
|
||||
) {
|
||||
this.createForm();
|
||||
}
|
||||
|
||||
createForm() {
|
||||
this.form = this.fb.group({
|
||||
code: { value: '', disabled: true },
|
||||
name: '',
|
||||
@@ -45,13 +41,17 @@ export class AccountDetailComponent implements OnInit, AfterViewInit {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data.subscribe(
|
||||
(data: { item: Account; accountTypes: AccountType[]; costCentres: CostCentre[] }) => {
|
||||
this.accountTypes = data.accountTypes;
|
||||
this.costCentres = data.costCentres;
|
||||
this.showItem(data.item);
|
||||
},
|
||||
);
|
||||
this.route.data.subscribe((value) => {
|
||||
const data = value as {
|
||||
item: Account;
|
||||
accountTypes: AccountType[];
|
||||
costCentres: CostCentre[];
|
||||
};
|
||||
|
||||
this.accountTypes = data.accountTypes;
|
||||
this.costCentres = data.costCentres;
|
||||
this.showItem(data.item);
|
||||
});
|
||||
}
|
||||
|
||||
showItem(item: Account) {
|
||||
|
||||
@@ -28,14 +28,10 @@ export class AccountListComponent implements OnInit, AfterViewInit {
|
||||
displayedColumns = ['name', 'type', 'isActive', 'isReconcilable', 'costCentre'];
|
||||
|
||||
constructor(private route: ActivatedRoute, private fb: FormBuilder) {
|
||||
this.createForm();
|
||||
this.filter = this.listenToFilterChange();
|
||||
}
|
||||
|
||||
createForm() {
|
||||
this.form = this.fb.group({
|
||||
filter: '',
|
||||
});
|
||||
this.filter = this.listenToFilterChange();
|
||||
}
|
||||
|
||||
listenToFilterChange() {
|
||||
@@ -45,7 +41,9 @@ export class AccountListComponent implements OnInit, AfterViewInit {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data.subscribe((data: { list: Account[] }) => {
|
||||
this.route.data.subscribe((value) => {
|
||||
const data = value as { list: Account[] };
|
||||
|
||||
this.list = data.list;
|
||||
});
|
||||
this.dataSource = new AccountListDataSource(this.paginator, this.sort, this.filter, this.list);
|
||||
|
||||
@@ -38,10 +38,6 @@ export class AttendanceComponent implements OnInit {
|
||||
private auth: AuthService,
|
||||
private ser: AttendanceService,
|
||||
) {
|
||||
this.createForm();
|
||||
}
|
||||
|
||||
createForm() {
|
||||
this.form = this.fb.group({
|
||||
date: '',
|
||||
attendances: this.fb.array([]),
|
||||
@@ -49,7 +45,9 @@ export class AttendanceComponent implements OnInit {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data.subscribe((data: { info: Attendance; attendanceTypes: AttendanceType[] }) => {
|
||||
this.route.data.subscribe((value) => {
|
||||
const data = value as { info: Attendance; attendanceTypes: AttendanceType[] };
|
||||
|
||||
this.info = data.info;
|
||||
this.attendanceTypes = data.attendanceTypes;
|
||||
this.form.get('date').setValue(moment(this.info.date, 'DD-MMM-YYYY').toDate());
|
||||
|
||||
@@ -29,10 +29,6 @@ export class LoginComponent implements OnInit, AfterViewInit {
|
||||
) {
|
||||
this.hide = true;
|
||||
this.showOtp = false;
|
||||
this.createForm();
|
||||
}
|
||||
|
||||
createForm() {
|
||||
this.form = this.fb.group({
|
||||
username: '',
|
||||
password: '',
|
||||
|
||||
@@ -23,17 +23,15 @@ export class BalanceSheetComponent implements OnInit {
|
||||
displayedColumns = ['group', 'name', 'subAmount', 'total'];
|
||||
|
||||
constructor(private route: ActivatedRoute, private router: Router, private fb: FormBuilder) {
|
||||
this.createForm();
|
||||
}
|
||||
|
||||
createForm() {
|
||||
this.form = this.fb.group({
|
||||
date: '',
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data.subscribe((data: { info: BalanceSheet }) => {
|
||||
this.route.data.subscribe((value) => {
|
||||
const data = value as { info: BalanceSheet };
|
||||
|
||||
this.info = data.info;
|
||||
this.form.setValue({
|
||||
date: moment(this.info.date, 'DD-MMM-YYYY').toDate(),
|
||||
|
||||
@@ -19,10 +19,6 @@ export class CashFlowComponent implements OnInit {
|
||||
displayedColumns = ['name', 'amount'];
|
||||
|
||||
constructor(private route: ActivatedRoute, private router: Router, private fb: FormBuilder) {
|
||||
this.createForm();
|
||||
}
|
||||
|
||||
createForm() {
|
||||
this.form = this.fb.group({
|
||||
startDate: '',
|
||||
finishDate: '',
|
||||
@@ -30,7 +26,9 @@ export class CashFlowComponent implements OnInit {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data.subscribe((data: { info: CashFlow }) => {
|
||||
this.route.data.subscribe((value) => {
|
||||
const data = value as { info: CashFlow };
|
||||
|
||||
this.info = data.info;
|
||||
this.form.setValue({
|
||||
startDate: moment(this.info.startDate, 'DD-MMM-YYYY').toDate(),
|
||||
|
||||
@@ -26,10 +26,6 @@ export class ClientDetailComponent implements OnInit, AfterViewInit {
|
||||
private toaster: ToasterService,
|
||||
private ser: ClientService,
|
||||
) {
|
||||
this.createForm();
|
||||
}
|
||||
|
||||
createForm() {
|
||||
this.form = this.fb.group({
|
||||
code: { value: '', disabled: true },
|
||||
name: '',
|
||||
@@ -39,7 +35,9 @@ export class ClientDetailComponent implements OnInit, AfterViewInit {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data.subscribe((data: { item: Client }) => {
|
||||
this.route.data.subscribe((value) => {
|
||||
const data = value as { item: Client };
|
||||
|
||||
this.showItem(data.item);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -23,7 +23,9 @@ export class ClientListComponent implements OnInit {
|
||||
constructor(private route: ActivatedRoute) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data.subscribe((data: { list: Client[] }) => {
|
||||
this.route.data.subscribe((value) => {
|
||||
const data = value as { list: Client[] };
|
||||
|
||||
this.list = data.list;
|
||||
});
|
||||
this.dataSource = new ClientListDataSource(this.paginator, this.sort, this.list);
|
||||
|
||||
@@ -30,17 +30,15 @@ export class ClosingStockComponent implements OnInit {
|
||||
private fb: FormBuilder,
|
||||
private toCsv: ToCsvService,
|
||||
) {
|
||||
this.createForm();
|
||||
}
|
||||
|
||||
createForm() {
|
||||
this.form = this.fb.group({
|
||||
date: '',
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data.subscribe((data: { info: ClosingStock }) => {
|
||||
this.route.data.subscribe((value) => {
|
||||
const data = value as { info: ClosingStock };
|
||||
|
||||
this.info = data.info;
|
||||
this.form.setValue({
|
||||
date: moment(this.info.date, 'DD-MMM-YYYY').toDate(),
|
||||
|
||||
@@ -23,17 +23,15 @@ export class CostCentreDetailComponent implements OnInit, AfterViewInit {
|
||||
private toaster: ToasterService,
|
||||
private ser: CostCentreService,
|
||||
) {
|
||||
this.createForm();
|
||||
}
|
||||
|
||||
createForm() {
|
||||
this.form = this.fb.group({
|
||||
name: '',
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data.subscribe((data: { item: CostCentre }) => {
|
||||
this.route.data.subscribe((value) => {
|
||||
const data = value as { item: CostCentre };
|
||||
|
||||
this.showItem(data.item);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -23,7 +23,9 @@ export class CostCentreListComponent implements OnInit {
|
||||
constructor(private route: ActivatedRoute) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data.subscribe((data: { list: CostCentre[] }) => {
|
||||
this.route.data.subscribe((value) => {
|
||||
const data = value as { list: CostCentre[] };
|
||||
|
||||
this.list = data.list;
|
||||
});
|
||||
this.dataSource = new CostCentreListDataSource(this.paginator, this.sort, this.list);
|
||||
|
||||
@@ -38,11 +38,16 @@ export class DaybookComponent implements OnInit {
|
||||
private fb: FormBuilder,
|
||||
private ser: DaybookService,
|
||||
) {
|
||||
this.createForm();
|
||||
this.form = this.fb.group({
|
||||
startDate: '',
|
||||
finishDate: '',
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data.subscribe((data: { info: Daybook }) => {
|
||||
this.route.data.subscribe((value) => {
|
||||
const data = value as { info: Daybook };
|
||||
|
||||
this.info = data.info;
|
||||
this.form.setValue({
|
||||
startDate: moment(this.info.startDate, 'DD-MMM-YYYY').toDate(),
|
||||
@@ -66,13 +71,6 @@ export class DaybookComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
createForm() {
|
||||
this.form = this.fb.group({
|
||||
startDate: '',
|
||||
finishDate: '',
|
||||
});
|
||||
}
|
||||
|
||||
prepareSubmit(): Daybook {
|
||||
const formModel = this.form.value;
|
||||
|
||||
|
||||
@@ -46,47 +46,43 @@ export class EmployeeAttendanceComponent implements OnInit, AfterViewInit {
|
||||
private ser: EmployeeAttendanceService,
|
||||
private employeeSer: EmployeeService,
|
||||
) {
|
||||
this.createForm();
|
||||
this.listenToEmployeeValueChanges();
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data.subscribe(
|
||||
(data: { info: EmployeeAttendance; attendanceTypes: AttendanceType[] }) => {
|
||||
this.info = data.info;
|
||||
this.attendanceTypes = data.attendanceTypes;
|
||||
this.form.get('startDate').setValue(moment(this.info.startDate, 'DD-MMM-YYYY').toDate());
|
||||
this.form.get('finishDate').setValue(moment(this.info.finishDate, 'DD-MMM-YYYY').toDate());
|
||||
this.form.get('employee').setValue(this.info.employee);
|
||||
this.form.setControl(
|
||||
'attendances',
|
||||
this.fb.array(
|
||||
this.info.body.map((x) =>
|
||||
this.fb.group({
|
||||
attendanceType: x.attendanceType.id,
|
||||
}),
|
||||
),
|
||||
),
|
||||
);
|
||||
this.dataSource = new EmployeeAttendanceDataSource(this.employeeAttendanceObservable);
|
||||
this.employeeAttendanceObservable.next(this.info.body);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
setTimeout(() => {
|
||||
this.employeeElement.nativeElement.focus();
|
||||
}, 0);
|
||||
}
|
||||
|
||||
createForm() {
|
||||
this.form = this.fb.group({
|
||||
startDate: '',
|
||||
finishDate: '',
|
||||
employee: '',
|
||||
attendances: this.fb.array([]),
|
||||
});
|
||||
this.listenToEmployeeValueChanges();
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data.subscribe((value) => {
|
||||
const data = value as { info: EmployeeAttendance; attendanceTypes: AttendanceType[] };
|
||||
|
||||
this.info = data.info;
|
||||
this.attendanceTypes = data.attendanceTypes;
|
||||
this.form.get('startDate').setValue(moment(this.info.startDate, 'DD-MMM-YYYY').toDate());
|
||||
this.form.get('finishDate').setValue(moment(this.info.finishDate, 'DD-MMM-YYYY').toDate());
|
||||
this.form.get('employee').setValue(this.info.employee);
|
||||
this.form.setControl(
|
||||
'attendances',
|
||||
this.fb.array(
|
||||
this.info.body.map((x) =>
|
||||
this.fb.group({
|
||||
attendanceType: x.attendanceType.id,
|
||||
}),
|
||||
),
|
||||
),
|
||||
);
|
||||
this.dataSource = new EmployeeAttendanceDataSource(this.employeeAttendanceObservable);
|
||||
this.employeeAttendanceObservable.next(this.info.body);
|
||||
});
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
setTimeout(() => {
|
||||
this.employeeElement.nativeElement.focus();
|
||||
}, 0);
|
||||
}
|
||||
|
||||
listenToEmployeeValueChanges() {
|
||||
|
||||
@@ -56,7 +56,14 @@ export class EmployeeBenefitsComponent implements OnInit, AfterViewInit {
|
||||
private ser: VoucherService,
|
||||
private employeeSer: EmployeeService,
|
||||
) {
|
||||
this.createForm();
|
||||
this.form = this.fb.group({
|
||||
date: '',
|
||||
addRow: this.fb.group({
|
||||
employee: '',
|
||||
grossSalary: '',
|
||||
daysWorked: '',
|
||||
}),
|
||||
});
|
||||
this.setupEmployeeAutocomplete();
|
||||
}
|
||||
|
||||
@@ -83,7 +90,9 @@ export class EmployeeBenefitsComponent implements OnInit, AfterViewInit {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data.subscribe((data: { voucher: Voucher }) => {
|
||||
this.route.data.subscribe((value) => {
|
||||
const data = value as { voucher: Voucher };
|
||||
|
||||
this.loadVoucher(data.voucher);
|
||||
});
|
||||
}
|
||||
@@ -108,17 +117,6 @@ export class EmployeeBenefitsComponent implements OnInit, AfterViewInit {
|
||||
this.benefitsObservable.next(this.voucher.employeeBenefits);
|
||||
}
|
||||
|
||||
createForm() {
|
||||
this.form = this.fb.group({
|
||||
date: '',
|
||||
addRow: this.fb.group({
|
||||
employee: '',
|
||||
grossSalary: '',
|
||||
daysWorked: '',
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
setupEmployeeAutocomplete(): void {
|
||||
const control = this.form.get('addRow').get('employee');
|
||||
this.employees = control.valueChanges.pipe(
|
||||
|
||||
@@ -31,10 +31,6 @@ export class EmployeeFunctionsComponent {
|
||||
private auth: AuthService,
|
||||
private ser: EmployeeFunctionsService,
|
||||
) {
|
||||
this.createForm();
|
||||
}
|
||||
|
||||
createForm() {
|
||||
const startDate = moment().date(1);
|
||||
const finishDate = moment().date(startDate.daysInMonth());
|
||||
this.creditSalaryForm = this.fb.group({
|
||||
|
||||
@@ -29,11 +29,6 @@ export class EmployeeDetailComponent implements OnInit, AfterViewInit {
|
||||
private toaster: ToasterService,
|
||||
private ser: EmployeeService,
|
||||
) {
|
||||
this.createForm();
|
||||
this.listenToIsActiveChanges();
|
||||
}
|
||||
|
||||
createForm() {
|
||||
this.form = this.fb.group({
|
||||
code: { value: '', disabled: true },
|
||||
name: '',
|
||||
@@ -45,10 +40,13 @@ export class EmployeeDetailComponent implements OnInit, AfterViewInit {
|
||||
joiningDate: '',
|
||||
leavingDate: '',
|
||||
});
|
||||
this.listenToIsActiveChanges();
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data.subscribe((data: { item: Employee; costCentres: CostCentre[] }) => {
|
||||
this.route.data.subscribe((value) => {
|
||||
const data = value as { item: Employee; costCentres: CostCentre[] };
|
||||
|
||||
this.costCentres = data.costCentres;
|
||||
this.showItem(data.item);
|
||||
});
|
||||
|
||||
@@ -38,14 +38,10 @@ export class EmployeeListComponent implements OnInit, AfterViewInit {
|
||||
];
|
||||
|
||||
constructor(private route: ActivatedRoute, private fb: FormBuilder, private toCsv: ToCsvService) {
|
||||
this.createForm();
|
||||
this.filter = this.listenToFilterChange();
|
||||
}
|
||||
|
||||
createForm() {
|
||||
this.form = this.fb.group({
|
||||
filter: '',
|
||||
});
|
||||
this.filter = this.listenToFilterChange();
|
||||
}
|
||||
|
||||
listenToFilterChange() {
|
||||
@@ -55,7 +51,9 @@ export class EmployeeListComponent implements OnInit, AfterViewInit {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data.subscribe((data: { list: Employee[] }) => {
|
||||
this.route.data.subscribe((value) => {
|
||||
const data = value as { list: Employee[] };
|
||||
|
||||
this.list = data.list;
|
||||
});
|
||||
this.dataSource = new EmployeeListDataSource(this.paginator, this.sort, this.filter, this.list);
|
||||
|
||||
@@ -42,12 +42,17 @@ export class IncentiveComponent implements OnInit {
|
||||
public auth: AuthService,
|
||||
private ser: VoucherService,
|
||||
) {
|
||||
this.createForm();
|
||||
this.form = this.fb.group({
|
||||
date: '',
|
||||
incentives: this.fb.array([]),
|
||||
});
|
||||
this.listenToDateChange();
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data.subscribe((data: { voucher: Voucher }) => {
|
||||
this.route.data.subscribe((value) => {
|
||||
const data = value as { voucher: Voucher };
|
||||
|
||||
this.loadVoucher(data.voucher);
|
||||
});
|
||||
}
|
||||
@@ -69,13 +74,6 @@ export class IncentiveComponent implements OnInit {
|
||||
this.incentiveObservable.next(this.voucher.incentives);
|
||||
}
|
||||
|
||||
createForm() {
|
||||
this.form = this.fb.group({
|
||||
date: '',
|
||||
incentives: this.fb.array([]),
|
||||
});
|
||||
}
|
||||
|
||||
listenToDateChange(): void {
|
||||
this.form
|
||||
.get('date')
|
||||
|
||||
@@ -26,7 +26,10 @@ export class IssueDialogComponent implements OnInit {
|
||||
private math: MathService,
|
||||
private batchSer: BatchService,
|
||||
) {
|
||||
this.createForm();
|
||||
this.form = this.fb.group({
|
||||
batch: '',
|
||||
quantity: '',
|
||||
});
|
||||
this.listenToBatchAutocompleteChange();
|
||||
}
|
||||
|
||||
@@ -38,13 +41,6 @@ export class IssueDialogComponent implements OnInit {
|
||||
this.batch = this.data.inventory.batch;
|
||||
}
|
||||
|
||||
createForm() {
|
||||
this.form = this.fb.group({
|
||||
batch: '',
|
||||
quantity: '',
|
||||
});
|
||||
}
|
||||
|
||||
listenToBatchAutocompleteChange(): void {
|
||||
const control = this.form.get('batch');
|
||||
this.batches = control.valueChanges.pipe(
|
||||
|
||||
@@ -60,14 +60,26 @@ export class IssueComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
private batchSer: BatchService,
|
||||
private issueGridSer: IssueGridService,
|
||||
) {
|
||||
this.createForm();
|
||||
this.form = this.fb.group({
|
||||
date: '',
|
||||
source: '',
|
||||
destination: '',
|
||||
amount: { value: '', disabled: true },
|
||||
addRow: this.fb.group({
|
||||
batch: '',
|
||||
quantity: '',
|
||||
}),
|
||||
narration: '',
|
||||
});
|
||||
this.listenToBatchAutocompleteChange();
|
||||
this.listenToDateChange();
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.gridDataSource = new IssueGridDataSource(this.gridObservable);
|
||||
this.route.data.subscribe((data: { voucher: Voucher; costCentres: CostCentre[] }) => {
|
||||
this.route.data.subscribe((value) => {
|
||||
const data = value as { voucher: Voucher; costCentres: CostCentre[] };
|
||||
|
||||
this.costCentres = data.costCentres;
|
||||
this.loadVoucher(data.voucher);
|
||||
});
|
||||
@@ -219,20 +231,6 @@ export class IssueComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
this.updateView();
|
||||
}
|
||||
|
||||
createForm() {
|
||||
this.form = this.fb.group({
|
||||
date: '',
|
||||
source: '',
|
||||
destination: '',
|
||||
amount: { value: '', disabled: true },
|
||||
addRow: this.fb.group({
|
||||
batch: '',
|
||||
quantity: '',
|
||||
}),
|
||||
narration: '',
|
||||
});
|
||||
}
|
||||
|
||||
canSave() {
|
||||
if (!this.voucher.id) {
|
||||
return true;
|
||||
|
||||
@@ -27,7 +27,12 @@ export class JournalDialogComponent implements OnInit {
|
||||
private math: MathService,
|
||||
private accountSer: AccountService,
|
||||
) {
|
||||
this.createForm();
|
||||
this.form = this.fb.group({
|
||||
debit: '1',
|
||||
account: '',
|
||||
amount: '',
|
||||
});
|
||||
this.accBal = null;
|
||||
this.setupAccountAutocomplete();
|
||||
}
|
||||
|
||||
@@ -40,15 +45,6 @@ export class JournalDialogComponent implements OnInit {
|
||||
this.account = this.data.journal.account;
|
||||
}
|
||||
|
||||
createForm() {
|
||||
this.form = this.fb.group({
|
||||
debit: '1',
|
||||
account: '',
|
||||
amount: '',
|
||||
});
|
||||
this.accBal = null;
|
||||
}
|
||||
|
||||
setupAccountAutocomplete(): void {
|
||||
const control = this.form.get('account');
|
||||
this.accounts = control.valueChanges.pipe(
|
||||
|
||||
@@ -58,12 +58,23 @@ export class JournalComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
private accountSer: AccountService,
|
||||
) {
|
||||
this.account = null;
|
||||
this.createForm();
|
||||
this.form = this.fb.group({
|
||||
date: '',
|
||||
addRow: this.fb.group({
|
||||
debit: '1',
|
||||
account: '',
|
||||
amount: '',
|
||||
}),
|
||||
narration: '',
|
||||
});
|
||||
this.accBal = null;
|
||||
this.setupAccountAutocomplete();
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data.subscribe((data: { voucher: Voucher }) => {
|
||||
this.route.data.subscribe((value) => {
|
||||
const data = value as { voucher: Voucher };
|
||||
|
||||
this.loadVoucher(data.voucher);
|
||||
});
|
||||
this.hotkeys.add(
|
||||
@@ -217,19 +228,6 @@ export class JournalComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
});
|
||||
}
|
||||
|
||||
createForm() {
|
||||
this.form = this.fb.group({
|
||||
date: '',
|
||||
addRow: this.fb.group({
|
||||
debit: '1',
|
||||
account: '',
|
||||
amount: '',
|
||||
}),
|
||||
narration: '',
|
||||
});
|
||||
this.accBal = null;
|
||||
}
|
||||
|
||||
canSave() {
|
||||
if (!this.voucher.id) {
|
||||
return true;
|
||||
|
||||
@@ -45,7 +45,11 @@ export class LedgerComponent implements OnInit, AfterViewInit {
|
||||
private ser: LedgerService,
|
||||
private accountSer: AccountService,
|
||||
) {
|
||||
this.createForm();
|
||||
this.form = this.fb.group({
|
||||
startDate: '',
|
||||
finishDate: '',
|
||||
account: '',
|
||||
});
|
||||
|
||||
this.accounts = this.form.get('account').valueChanges.pipe(
|
||||
startWith(null),
|
||||
@@ -57,7 +61,9 @@ export class LedgerComponent implements OnInit, AfterViewInit {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data.subscribe((data: { info: Ledger }) => {
|
||||
this.route.data.subscribe((value) => {
|
||||
const data = value as { info: Ledger };
|
||||
|
||||
this.info = data.info;
|
||||
this.calculateTotals();
|
||||
this.form.setValue({
|
||||
@@ -115,14 +121,6 @@ export class LedgerComponent implements OnInit, AfterViewInit {
|
||||
});
|
||||
}
|
||||
|
||||
createForm() {
|
||||
this.form = this.fb.group({
|
||||
startDate: '',
|
||||
finishDate: '',
|
||||
account: '',
|
||||
});
|
||||
}
|
||||
|
||||
getInfo(): Ledger {
|
||||
const formModel = this.form.value;
|
||||
|
||||
|
||||
@@ -24,11 +24,16 @@ export class NetTransactionsComponent implements OnInit {
|
||||
displayedColumns = ['type', 'name', 'debit', 'credit'];
|
||||
|
||||
constructor(private route: ActivatedRoute, private router: Router, private fb: FormBuilder) {
|
||||
this.createForm();
|
||||
this.form = this.fb.group({
|
||||
startDate: '',
|
||||
finishDate: '',
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data.subscribe((data: { info: NetTransactions }) => {
|
||||
this.route.data.subscribe((value) => {
|
||||
const data = value as { info: NetTransactions };
|
||||
|
||||
this.info = data.info;
|
||||
this.form.setValue({
|
||||
startDate: moment(this.info.startDate, 'DD-MMM-YYYY').toDate(),
|
||||
@@ -48,13 +53,6 @@ export class NetTransactionsComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
createForm() {
|
||||
this.form = this.fb.group({
|
||||
startDate: '',
|
||||
finishDate: '',
|
||||
});
|
||||
}
|
||||
|
||||
prepareSubmit(): NetTransactions {
|
||||
const formModel = this.form.value;
|
||||
|
||||
|
||||
@@ -27,7 +27,11 @@ export class PaymentDialogComponent implements OnInit {
|
||||
private math: MathService,
|
||||
private accountSer: AccountService,
|
||||
) {
|
||||
this.createForm();
|
||||
this.form = this.fb.group({
|
||||
account: '',
|
||||
amount: '',
|
||||
});
|
||||
this.accBal = null;
|
||||
this.setupAccountAutocomplete();
|
||||
}
|
||||
|
||||
@@ -39,14 +43,6 @@ export class PaymentDialogComponent implements OnInit {
|
||||
this.account = this.data.journal.account;
|
||||
}
|
||||
|
||||
createForm() {
|
||||
this.form = this.fb.group({
|
||||
account: '',
|
||||
amount: '',
|
||||
});
|
||||
this.accBal = null;
|
||||
}
|
||||
|
||||
setupAccountAutocomplete(): void {
|
||||
const control = this.form.get('account');
|
||||
this.accounts = control.valueChanges.pipe(
|
||||
|
||||
@@ -60,13 +60,25 @@ export class PaymentComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
private accountSer: AccountService,
|
||||
) {
|
||||
this.account = null;
|
||||
this.createForm();
|
||||
this.form = this.fb.group({
|
||||
date: '',
|
||||
paymentAccount: '',
|
||||
paymentAmount: { value: '', disabled: true },
|
||||
addRow: this.fb.group({
|
||||
account: '',
|
||||
amount: '',
|
||||
}),
|
||||
narration: '',
|
||||
});
|
||||
this.accBal = null;
|
||||
this.listenToAccountAutocompleteChange();
|
||||
this.listenToPaymentAccountChange();
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data.subscribe((data: { voucher: Voucher; paymentAccounts: Account[] }) => {
|
||||
this.route.data.subscribe((value) => {
|
||||
const data = value as { voucher: Voucher; paymentAccounts: Account[] };
|
||||
|
||||
this.paymentAccounts = data.paymentAccounts;
|
||||
this.loadVoucher(data.voucher);
|
||||
});
|
||||
@@ -218,20 +230,6 @@ export class PaymentComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
this.updateView();
|
||||
}
|
||||
|
||||
createForm() {
|
||||
this.form = this.fb.group({
|
||||
date: '',
|
||||
paymentAccount: '',
|
||||
paymentAmount: { value: '', disabled: true },
|
||||
addRow: this.fb.group({
|
||||
account: '',
|
||||
amount: '',
|
||||
}),
|
||||
narration: '',
|
||||
});
|
||||
this.accBal = null;
|
||||
}
|
||||
|
||||
canSave() {
|
||||
if (!this.voucher.id) {
|
||||
return true;
|
||||
|
||||
+3
-5
@@ -23,17 +23,15 @@ export class ProductGroupDetailComponent implements OnInit, AfterViewInit {
|
||||
private toaster: ToasterService,
|
||||
private ser: ProductGroupService,
|
||||
) {
|
||||
this.createForm();
|
||||
}
|
||||
|
||||
createForm() {
|
||||
this.form = this.fb.group({
|
||||
name: '',
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data.subscribe((data: { item: ProductGroup }) => {
|
||||
this.route.data.subscribe((value) => {
|
||||
const data = value as { item: ProductGroup };
|
||||
|
||||
this.showItem(data.item);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -23,7 +23,9 @@ export class ProductGroupListComponent implements OnInit {
|
||||
constructor(private route: ActivatedRoute) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data.subscribe((data: { list: ProductGroup[] }) => {
|
||||
this.route.data.subscribe((value) => {
|
||||
const data = value as { list: ProductGroup[] };
|
||||
|
||||
this.list = data.list;
|
||||
});
|
||||
this.dataSource = new ProductGroupListDataSource(this.paginator, this.sort, this.list);
|
||||
|
||||
@@ -59,7 +59,11 @@ export class ProductLedgerComponent implements OnInit, AfterViewInit {
|
||||
private ser: ProductLedgerService,
|
||||
private productSer: ProductService,
|
||||
) {
|
||||
this.createForm();
|
||||
this.form = this.fb.group({
|
||||
startDate: '',
|
||||
finishDate: '',
|
||||
product: '',
|
||||
});
|
||||
|
||||
this.products = this.form.get('product').valueChanges.pipe(
|
||||
startWith(null),
|
||||
@@ -71,7 +75,9 @@ export class ProductLedgerComponent implements OnInit, AfterViewInit {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data.subscribe((data: { info: ProductLedger }) => {
|
||||
this.route.data.subscribe((value) => {
|
||||
const data = value as { info: ProductLedger };
|
||||
|
||||
this.info = data.info;
|
||||
this.calculateTotals();
|
||||
this.form.setValue({
|
||||
@@ -131,14 +137,6 @@ export class ProductLedgerComponent implements OnInit, AfterViewInit {
|
||||
});
|
||||
}
|
||||
|
||||
createForm() {
|
||||
this.form = this.fb.group({
|
||||
startDate: '',
|
||||
finishDate: '',
|
||||
product: '',
|
||||
});
|
||||
}
|
||||
|
||||
getInfo(): ProductLedger {
|
||||
const formModel = this.form.value;
|
||||
|
||||
|
||||
@@ -28,10 +28,6 @@ export class ProductDetailComponent implements OnInit, AfterViewInit {
|
||||
private toaster: ToasterService,
|
||||
private ser: ProductService,
|
||||
) {
|
||||
this.createForm();
|
||||
}
|
||||
|
||||
createForm() {
|
||||
this.form = this.fb.group({
|
||||
code: { value: '', disabled: true },
|
||||
name: '',
|
||||
@@ -49,7 +45,9 @@ export class ProductDetailComponent implements OnInit, AfterViewInit {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data.subscribe((data: { item: Product; productGroups: ProductGroup[] }) => {
|
||||
this.route.data.subscribe((value) => {
|
||||
const data = value as { item: Product; productGroups: ProductGroup[] };
|
||||
|
||||
this.productGroups = data.productGroups;
|
||||
this.showItem(data.item);
|
||||
});
|
||||
|
||||
@@ -32,7 +32,9 @@ export class ProductListComponent implements OnInit, AfterViewInit {
|
||||
|
||||
constructor(private route: ActivatedRoute, private fb: FormBuilder, private toCsv: ToCsvService) {
|
||||
this.showExtended = false;
|
||||
this.createForm();
|
||||
this.form = this.fb.group({
|
||||
filter: '',
|
||||
});
|
||||
this.filter = this.listenToFilterChange();
|
||||
}
|
||||
|
||||
@@ -51,12 +53,6 @@ export class ProductListComponent implements OnInit, AfterViewInit {
|
||||
}
|
||||
}
|
||||
|
||||
createForm() {
|
||||
this.form = this.fb.group({
|
||||
filter: '',
|
||||
});
|
||||
}
|
||||
|
||||
listenToFilterChange() {
|
||||
return this.form
|
||||
.get('filter')
|
||||
@@ -64,7 +60,9 @@ export class ProductListComponent implements OnInit, AfterViewInit {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data.subscribe((data: { list: Product[] }) => {
|
||||
this.route.data.subscribe((value) => {
|
||||
const data = value as { list: Product[] };
|
||||
|
||||
this.list = data.list;
|
||||
});
|
||||
this.dataSource = new ProductListDataSource(this.paginator, this.sort, this.filter, this.list);
|
||||
|
||||
@@ -24,11 +24,16 @@ export class ProfitLossComponent implements OnInit {
|
||||
displayedColumns = ['group', 'name', 'amount', 'total'];
|
||||
|
||||
constructor(private route: ActivatedRoute, private router: Router, private fb: FormBuilder) {
|
||||
this.createForm();
|
||||
this.form = this.fb.group({
|
||||
startDate: '',
|
||||
finishDate: '',
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data.subscribe((data: { info: ProfitLoss }) => {
|
||||
this.route.data.subscribe((value) => {
|
||||
const data = value as { info: ProfitLoss };
|
||||
|
||||
this.info = data.info;
|
||||
this.form.setValue({
|
||||
startDate: moment(this.info.startDate, 'DD-MMM-YYYY').toDate(),
|
||||
@@ -48,13 +53,6 @@ export class ProfitLossComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
createForm() {
|
||||
this.form = this.fb.group({
|
||||
startDate: '',
|
||||
finishDate: '',
|
||||
});
|
||||
}
|
||||
|
||||
prepareSubmit(): ProfitLoss {
|
||||
const formModel = this.form.value;
|
||||
|
||||
|
||||
@@ -33,11 +33,16 @@ export class PurchaseEntriesComponent implements OnInit {
|
||||
];
|
||||
|
||||
constructor(private route: ActivatedRoute, private router: Router, private fb: FormBuilder) {
|
||||
this.createForm();
|
||||
this.form = this.fb.group({
|
||||
startDate: '',
|
||||
finishDate: '',
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data.subscribe((data: { info: PurchaseEntries }) => {
|
||||
this.route.data.subscribe((value) => {
|
||||
const data = value as { info: PurchaseEntries };
|
||||
|
||||
this.info = data.info;
|
||||
this.form.setValue({
|
||||
startDate: moment(this.info.startDate, 'DD-MMM-YYYY').toDate(),
|
||||
@@ -57,13 +62,6 @@ export class PurchaseEntriesComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
createForm() {
|
||||
this.form = this.fb.group({
|
||||
startDate: '',
|
||||
finishDate: '',
|
||||
});
|
||||
}
|
||||
|
||||
prepareSubmit(): PurchaseEntries {
|
||||
const formModel = this.form.value;
|
||||
|
||||
|
||||
@@ -26,7 +26,10 @@ export class PurchaseReturnDialogComponent implements OnInit {
|
||||
private math: MathService,
|
||||
private batchSer: BatchService,
|
||||
) {
|
||||
this.createForm();
|
||||
this.form = this.fb.group({
|
||||
batch: '',
|
||||
quantity: '',
|
||||
});
|
||||
this.listenToBatchAutocompleteChange();
|
||||
}
|
||||
|
||||
@@ -38,13 +41,6 @@ export class PurchaseReturnDialogComponent implements OnInit {
|
||||
this.batch = this.data.inventory.batch;
|
||||
}
|
||||
|
||||
createForm() {
|
||||
this.form = this.fb.group({
|
||||
batch: '',
|
||||
quantity: '',
|
||||
});
|
||||
}
|
||||
|
||||
listenToBatchAutocompleteChange(): void {
|
||||
const control = this.form.get('batch');
|
||||
this.batches = control.valueChanges.pipe(
|
||||
|
||||
@@ -62,13 +62,24 @@ export class PurchaseReturnComponent implements OnInit, AfterViewInit, OnDestroy
|
||||
private batchSer: BatchService,
|
||||
private accountSer: AccountService,
|
||||
) {
|
||||
this.createForm();
|
||||
this.form = this.fb.group({
|
||||
date: '',
|
||||
account: '',
|
||||
amount: { value: '', disabled: true },
|
||||
addRow: this.fb.group({
|
||||
batch: '',
|
||||
quantity: '',
|
||||
}),
|
||||
narration: '',
|
||||
});
|
||||
this.listenToAccountAutocompleteChange();
|
||||
this.listenToBatchAutocompleteChange();
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data.subscribe((data: { voucher: Voucher }) => {
|
||||
this.route.data.subscribe((value) => {
|
||||
const data = value as { voucher: Voucher };
|
||||
|
||||
this.loadVoucher(data.voucher);
|
||||
});
|
||||
this.hotkeys.add(
|
||||
@@ -221,19 +232,6 @@ export class PurchaseReturnComponent implements OnInit, AfterViewInit, OnDestroy
|
||||
this.updateView();
|
||||
}
|
||||
|
||||
createForm() {
|
||||
this.form = this.fb.group({
|
||||
date: '',
|
||||
account: '',
|
||||
amount: { value: '', disabled: true },
|
||||
addRow: this.fb.group({
|
||||
batch: '',
|
||||
quantity: '',
|
||||
}),
|
||||
narration: '',
|
||||
});
|
||||
}
|
||||
|
||||
canSave() {
|
||||
if (!this.voucher.id) {
|
||||
return true;
|
||||
|
||||
@@ -27,7 +27,13 @@ export class PurchaseDialogComponent implements OnInit {
|
||||
private math: MathService,
|
||||
private productSer: ProductService,
|
||||
) {
|
||||
this.createForm();
|
||||
this.form = this.fb.group({
|
||||
product: '',
|
||||
quantity: '',
|
||||
price: '',
|
||||
tax: '',
|
||||
discount: '',
|
||||
});
|
||||
this.listenToProductAutocompleteChange();
|
||||
}
|
||||
|
||||
@@ -42,16 +48,6 @@ export class PurchaseDialogComponent implements OnInit {
|
||||
this.product = this.data.inventory.product;
|
||||
}
|
||||
|
||||
createForm() {
|
||||
this.form = this.fb.group({
|
||||
product: '',
|
||||
quantity: '',
|
||||
price: '',
|
||||
tax: '',
|
||||
discount: '',
|
||||
});
|
||||
}
|
||||
|
||||
listenToProductAutocompleteChange(): void {
|
||||
const control = this.form.get('product');
|
||||
this.products = control.valueChanges.pipe(
|
||||
|
||||
@@ -62,13 +62,28 @@ export class PurchaseComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
private productSer: ProductService,
|
||||
private accountSer: AccountService,
|
||||
) {
|
||||
this.createForm();
|
||||
this.form = this.fb.group({
|
||||
date: '',
|
||||
account: '',
|
||||
amount: { value: '', disabled: true },
|
||||
addRow: this.fb.group({
|
||||
product: '',
|
||||
quantity: '',
|
||||
price: '',
|
||||
tax: '',
|
||||
discount: '',
|
||||
}),
|
||||
narration: '',
|
||||
});
|
||||
this.accBal = null;
|
||||
this.listenToAccountAutocompleteChange();
|
||||
this.listenToProductAutocompleteChange();
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data.subscribe((data: { voucher: Voucher }) => {
|
||||
this.route.data.subscribe((value) => {
|
||||
const data = value as { voucher: Voucher };
|
||||
|
||||
this.loadVoucher(data.voucher);
|
||||
});
|
||||
this.hotkeys.add(
|
||||
@@ -225,23 +240,6 @@ export class PurchaseComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
this.updateView();
|
||||
}
|
||||
|
||||
createForm() {
|
||||
this.form = this.fb.group({
|
||||
date: '',
|
||||
account: '',
|
||||
amount: { value: '', disabled: true },
|
||||
addRow: this.fb.group({
|
||||
product: '',
|
||||
quantity: '',
|
||||
price: '',
|
||||
tax: '',
|
||||
discount: '',
|
||||
}),
|
||||
narration: '',
|
||||
});
|
||||
this.accBal = null;
|
||||
}
|
||||
|
||||
canSave() {
|
||||
if (!this.voucher.id) {
|
||||
return true;
|
||||
|
||||
@@ -25,11 +25,16 @@ export class PurchasesComponent implements OnInit {
|
||||
displayedColumns = ['product', 'quantity', 'rate', 'amount'];
|
||||
|
||||
constructor(private route: ActivatedRoute, private router: Router, private fb: FormBuilder) {
|
||||
this.createForm();
|
||||
this.form = this.fb.group({
|
||||
startDate: '',
|
||||
finishDate: '',
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data.subscribe((data: { info: Purchases }) => {
|
||||
this.route.data.subscribe((value) => {
|
||||
const data = value as { info: Purchases };
|
||||
|
||||
this.info = data.info;
|
||||
this.form.setValue({
|
||||
startDate: moment(this.info.startDate, 'DD-MMM-YYYY').toDate(),
|
||||
@@ -49,13 +54,6 @@ export class PurchasesComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
createForm() {
|
||||
this.form = this.fb.group({
|
||||
startDate: '',
|
||||
finishDate: '',
|
||||
});
|
||||
}
|
||||
|
||||
prepareSubmit(): Purchases {
|
||||
const formModel = this.form.value;
|
||||
|
||||
|
||||
@@ -42,11 +42,16 @@ export class RawMaterialCostComponent implements OnInit {
|
||||
private fb: FormBuilder,
|
||||
private toCsv: ToCsvService,
|
||||
) {
|
||||
this.createForm();
|
||||
this.form = this.fb.group({
|
||||
startDate: '',
|
||||
finishDate: '',
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data.subscribe((data: { info: RawMaterialCost }) => {
|
||||
this.route.data.subscribe((value) => {
|
||||
const data = value as { info: RawMaterialCost };
|
||||
|
||||
this.info = data.info;
|
||||
this.displayedColumns = this.info.id ? this.columnsId : this.columnsNoId;
|
||||
this.form.setValue({
|
||||
@@ -67,13 +72,6 @@ export class RawMaterialCostComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
createForm() {
|
||||
this.form = this.fb.group({
|
||||
startDate: '',
|
||||
finishDate: '',
|
||||
});
|
||||
}
|
||||
|
||||
prepareSubmit(): RawMaterialCost {
|
||||
const formModel = this.form.value;
|
||||
|
||||
|
||||
@@ -27,7 +27,11 @@ export class ReceiptDialogComponent implements OnInit {
|
||||
private math: MathService,
|
||||
private accountSer: AccountService,
|
||||
) {
|
||||
this.createForm();
|
||||
this.form = this.fb.group({
|
||||
account: '',
|
||||
amount: '',
|
||||
});
|
||||
this.accBal = null;
|
||||
this.setupAccountAutocomplete();
|
||||
}
|
||||
|
||||
@@ -39,14 +43,6 @@ export class ReceiptDialogComponent implements OnInit {
|
||||
this.account = this.data.journal.account;
|
||||
}
|
||||
|
||||
createForm() {
|
||||
this.form = this.fb.group({
|
||||
account: '',
|
||||
amount: '',
|
||||
});
|
||||
this.accBal = null;
|
||||
}
|
||||
|
||||
setupAccountAutocomplete(): void {
|
||||
const control = this.form.get('account');
|
||||
this.accounts = control.valueChanges.pipe(
|
||||
|
||||
@@ -60,13 +60,25 @@ export class ReceiptComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
private accountSer: AccountService,
|
||||
) {
|
||||
this.account = null;
|
||||
this.createForm();
|
||||
this.form = this.fb.group({
|
||||
date: '',
|
||||
receiptAccount: '',
|
||||
receiptAmount: { value: '', disabled: true },
|
||||
addRow: this.fb.group({
|
||||
account: '',
|
||||
amount: '',
|
||||
}),
|
||||
narration: '',
|
||||
});
|
||||
this.accBal = null;
|
||||
this.listenToAccountAutocompleteChange();
|
||||
this.listenToReceiptAccountChange();
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data.subscribe((data: { voucher: Voucher; receiptAccounts: Account[] }) => {
|
||||
this.route.data.subscribe((value) => {
|
||||
const data = value as { voucher: Voucher; receiptAccounts: Account[] };
|
||||
|
||||
this.receiptAccounts = data.receiptAccounts;
|
||||
this.loadVoucher(data.voucher);
|
||||
});
|
||||
@@ -221,20 +233,6 @@ export class ReceiptComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
this.updateView();
|
||||
}
|
||||
|
||||
createForm() {
|
||||
this.form = this.fb.group({
|
||||
date: '',
|
||||
receiptAccount: '',
|
||||
receiptAmount: { value: '', disabled: true },
|
||||
addRow: this.fb.group({
|
||||
account: '',
|
||||
amount: '',
|
||||
}),
|
||||
narration: '',
|
||||
});
|
||||
this.accBal = null;
|
||||
}
|
||||
|
||||
canSave() {
|
||||
if (!this.voucher.id) {
|
||||
return true;
|
||||
|
||||
@@ -26,10 +26,6 @@ export class RoleDetailComponent implements OnInit, AfterViewInit {
|
||||
private dialog: MatDialog,
|
||||
private ser: RoleService,
|
||||
) {
|
||||
this.createForm();
|
||||
}
|
||||
|
||||
createForm() {
|
||||
this.form = this.fb.group({
|
||||
name: '',
|
||||
permissions: this.fb.array([]),
|
||||
@@ -37,7 +33,9 @@ export class RoleDetailComponent implements OnInit, AfterViewInit {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data.subscribe((data: { item: Role }) => {
|
||||
this.route.data.subscribe((value) => {
|
||||
const data = value as { item: Role };
|
||||
|
||||
this.item = data.item;
|
||||
this.form.get('name').setValue(this.item.name);
|
||||
this.form.setControl(
|
||||
|
||||
@@ -23,7 +23,9 @@ export class RoleListComponent implements OnInit {
|
||||
constructor(private route: ActivatedRoute) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data.subscribe((data: { list: Role[] }) => {
|
||||
this.route.data.subscribe((value) => {
|
||||
const data = value as { list: Role[] };
|
||||
|
||||
this.list = data.list;
|
||||
});
|
||||
this.dataSource = new RoleListDatasource(this.paginator, this.sort, this.list);
|
||||
|
||||
@@ -45,38 +45,6 @@ export class SettingsComponent implements OnInit {
|
||||
private ser: SettingsService,
|
||||
private productSer: ProductService,
|
||||
) {
|
||||
this.createForm();
|
||||
this.listenToLockForm();
|
||||
this.lockInformation = {
|
||||
lockOlder: false,
|
||||
olderRolling: false,
|
||||
lockNewer: false,
|
||||
newerRolling: false,
|
||||
};
|
||||
this.listenToProductChanges();
|
||||
|
||||
this.maintenance = { enabled: false, user: '' };
|
||||
this.version = environment.version;
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data.subscribe((data: { maintenance: any; lockInformation: any }) => {
|
||||
this.maintenance = data.maintenance;
|
||||
this.lockInformation = data.lockInformation;
|
||||
this.lockDatesForm.patchValue({
|
||||
lockOlder: this.lockInformation.lockOlder,
|
||||
olderRolling: this.lockInformation.olderRolling,
|
||||
olderDate: this.lockInformation.olderDate,
|
||||
olderDays: this.lockInformation.olderDays,
|
||||
lockNewer: this.lockInformation.lockNewer,
|
||||
newerRolling: this.lockInformation.newerRolling,
|
||||
newerDate: this.lockInformation.newerDate,
|
||||
newerDays: this.lockInformation.newerDays,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
createForm() {
|
||||
const startDate = moment().date(1);
|
||||
const finishDate = moment().date(startDate.daysInMonth());
|
||||
this.lockDatesForm = this.fb.group({
|
||||
@@ -100,6 +68,36 @@ export class SettingsComponent implements OnInit {
|
||||
product: null,
|
||||
quantity: 0,
|
||||
});
|
||||
this.listenToLockForm();
|
||||
this.lockInformation = {
|
||||
lockOlder: false,
|
||||
olderRolling: false,
|
||||
lockNewer: false,
|
||||
newerRolling: false,
|
||||
};
|
||||
this.listenToProductChanges();
|
||||
|
||||
this.maintenance = { enabled: false, user: '' };
|
||||
this.version = environment.version;
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data.subscribe((value) => {
|
||||
const data = value as { maintenance: any; lockInformation: any };
|
||||
|
||||
this.maintenance = data.maintenance;
|
||||
this.lockInformation = data.lockInformation;
|
||||
this.lockDatesForm.patchValue({
|
||||
lockOlder: this.lockInformation.lockOlder,
|
||||
olderRolling: this.lockInformation.olderRolling,
|
||||
olderDate: this.lockInformation.olderDate,
|
||||
olderDays: this.lockInformation.olderDays,
|
||||
lockNewer: this.lockInformation.lockNewer,
|
||||
newerRolling: this.lockInformation.newerRolling,
|
||||
newerDate: this.lockInformation.newerDate,
|
||||
newerDays: this.lockInformation.newerDays,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
listenToLockForm() {
|
||||
|
||||
@@ -24,11 +24,16 @@ export class StockMovementComponent implements OnInit {
|
||||
displayedColumns = ['group', 'name', 'opening', 'purchase', 'issue', 'closing'];
|
||||
|
||||
constructor(private route: ActivatedRoute, private router: Router, private fb: FormBuilder) {
|
||||
this.createForm();
|
||||
this.form = this.fb.group({
|
||||
startDate: '',
|
||||
finishDate: '',
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data.subscribe((data: { info: StockMovement }) => {
|
||||
this.route.data.subscribe((value) => {
|
||||
const data = value as { info: StockMovement };
|
||||
|
||||
this.info = data.info;
|
||||
this.form.setValue({
|
||||
startDate: moment(this.info.startDate, 'DD-MMM-YYYY').toDate(),
|
||||
@@ -48,13 +53,6 @@ export class StockMovementComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
createForm() {
|
||||
this.form = this.fb.group({
|
||||
startDate: '',
|
||||
finishDate: '',
|
||||
});
|
||||
}
|
||||
|
||||
prepareSubmit(): StockMovement {
|
||||
const formModel = this.form.value;
|
||||
|
||||
|
||||
@@ -23,17 +23,15 @@ export class TrialBalanceComponent implements OnInit {
|
||||
displayedColumns = ['type', 'name', 'debit', 'credit'];
|
||||
|
||||
constructor(private route: ActivatedRoute, private router: Router, private fb: FormBuilder) {
|
||||
this.createForm();
|
||||
}
|
||||
|
||||
createForm() {
|
||||
this.form = this.fb.group({
|
||||
date: '',
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data.subscribe((data: { info: TrialBalance }) => {
|
||||
this.route.data.subscribe((value) => {
|
||||
const data = value as { info: TrialBalance };
|
||||
|
||||
this.info = data.info;
|
||||
this.form.setValue({
|
||||
date: moment(this.info.date, 'DD-MMM-YYYY').toDate(),
|
||||
|
||||
@@ -28,10 +28,6 @@ export class UserDetailComponent implements OnInit, AfterViewInit {
|
||||
private ser: UserService,
|
||||
) {
|
||||
this.hide = true;
|
||||
this.createForm();
|
||||
}
|
||||
|
||||
createForm() {
|
||||
this.form = this.fb.group({
|
||||
name: '',
|
||||
password: '',
|
||||
@@ -41,7 +37,9 @@ export class UserDetailComponent implements OnInit, AfterViewInit {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data.subscribe((data: { item: User }) => {
|
||||
this.route.data.subscribe((value) => {
|
||||
const data = value as { item: User };
|
||||
|
||||
this.showItem(data.item);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -40,12 +40,9 @@
|
||||
/** IE10 and IE11 requires the following for the Reflect API. */
|
||||
// import 'core-js/es6/reflect';
|
||||
|
||||
|
||||
/** Evergreen browsers require these. **/
|
||||
// Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove.
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Web Animations `@angular/platform-browser/animations`
|
||||
* Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
|
||||
@@ -58,11 +55,11 @@
|
||||
* user can disable parts of macroTask/DomEvents patch by setting following flags
|
||||
*/
|
||||
|
||||
// (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
|
||||
// (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
|
||||
// (window as any).__zone_symbol__BLACK_LISTED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
|
||||
// (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
|
||||
// (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
|
||||
// (window as any).__zone_symbol__BLACK_LISTED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
|
||||
|
||||
/*
|
||||
/*
|
||||
* in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
|
||||
* with the following flag, it will bypass `zone.js` patch for IE/Edge
|
||||
*/
|
||||
@@ -71,9 +68,7 @@
|
||||
/***************************************************************************************************
|
||||
* Zone JS is required by default for Angular itself.
|
||||
*/
|
||||
import 'zone.js/dist/zone'; // Included with Angular CLI.
|
||||
|
||||
|
||||
import 'zone.js/dist/zone'; // Included with Angular CLI.
|
||||
|
||||
/***************************************************************************************************
|
||||
* APPLICATION IMPORTS
|
||||
|
||||
@@ -4,16 +4,13 @@ import 'zone.js/dist/zone-testing';
|
||||
import { getTestBed } from '@angular/core/testing';
|
||||
import {
|
||||
BrowserDynamicTestingModule,
|
||||
platformBrowserDynamicTesting
|
||||
platformBrowserDynamicTesting,
|
||||
} from '@angular/platform-browser-dynamic/testing';
|
||||
|
||||
declare const require: any;
|
||||
|
||||
// First, initialize the Angular testing environment.
|
||||
getTestBed().initTestEnvironment(
|
||||
BrowserDynamicTestingModule,
|
||||
platformBrowserDynamicTesting()
|
||||
);
|
||||
getTestBed().initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting());
|
||||
// Then we find all the tests.
|
||||
const context = require.context('./', true, /\.spec\.ts$/);
|
||||
// And load the modules.
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
||||
{
|
||||
"compileOnSave": false,
|
||||
"compilerOptions": {
|
||||
"baseUrl": "./",
|
||||
"outDir": "../frontend",
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
// "strict": true,
|
||||
"strict": true,
|
||||
"noImplicitReturns": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"sourceMap": true,
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../out-tsc/spec",
|
||||
"types": [
|
||||
"jasmine",
|
||||
"node"
|
||||
"jasmine"
|
||||
]
|
||||
},
|
||||
"files": [
|
||||
@@ -12,7 +12,7 @@
|
||||
"src/polyfills.ts"
|
||||
],
|
||||
"include": [
|
||||
"**/*.spec.ts",
|
||||
"**/*.d.ts"
|
||||
"src/**/*.spec.ts",
|
||||
"src/**/*.d.ts"
|
||||
]
|
||||
}
|
||||
Reference in new issue
Block a user