Strict done!!
This commit is contained in:
1 parent
af343cb7f9
commit
afe746ecdc
142 files changed
+1258
-907
No files matched your search
@@ -1,5 +1,5 @@
|
||||
import { AfterViewInit, Component, ElementRef, OnInit, ViewChild } from '@angular/core';
|
||||
import { FormBuilder, FormGroup } from '@angular/forms';
|
||||
import { FormBuilder, FormControl, FormGroup } from '@angular/forms';
|
||||
import { MatAutocompleteSelectedEvent } from '@angular/material/autocomplete';
|
||||
import { MatPaginator } from '@angular/material/paginator';
|
||||
import { MatSort } from '@angular/material/sort';
|
||||
@@ -25,13 +25,13 @@ export class LedgerComponent implements OnInit, AfterViewInit {
|
||||
@ViewChild('accountElement', { static: true }) accountElement?: ElementRef;
|
||||
@ViewChild(MatPaginator, { static: true }) paginator?: MatPaginator;
|
||||
@ViewChild(MatSort, { static: true }) sort?: MatSort;
|
||||
dataSource: LedgerDataSource;
|
||||
info: Ledger = new Ledger();
|
||||
dataSource: LedgerDataSource = new LedgerDataSource(this.info.body);
|
||||
form: FormGroup;
|
||||
info: Ledger;
|
||||
selectedRowId: string;
|
||||
debit: number;
|
||||
credit: number;
|
||||
running: number;
|
||||
selectedRowId = '';
|
||||
debit = 0;
|
||||
credit = 0;
|
||||
running = 0;
|
||||
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
|
||||
displayedColumns = ['date', 'particulars', 'type', 'narration', 'debit', 'credit', 'running'];
|
||||
|
||||
@@ -51,7 +51,7 @@ export class LedgerComponent implements OnInit, AfterViewInit {
|
||||
account: '',
|
||||
});
|
||||
|
||||
this.accounts = this.form.get('account').valueChanges.pipe(
|
||||
this.accounts = (this.form.get('account') as FormControl).valueChanges.pipe(
|
||||
startWith(null),
|
||||
map((x) => (x !== null && x.length >= 1 ? x : null)),
|
||||
debounceTime(150),
|
||||
@@ -71,18 +71,18 @@ export class LedgerComponent implements OnInit, AfterViewInit {
|
||||
startDate: moment(this.info.startDate, 'DD-MMM-YYYY').toDate(),
|
||||
finishDate: moment(this.info.finishDate, 'DD-MMM-YYYY').toDate(),
|
||||
});
|
||||
this.dataSource = new LedgerDataSource(this.paginator, this.sort, this.info.body);
|
||||
this.dataSource = new LedgerDataSource(this.info.body, this.paginator, this.sort);
|
||||
});
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
setTimeout(() => {
|
||||
this.accountElement.nativeElement.focus();
|
||||
if (this.accountElement) this.accountElement.nativeElement.focus();
|
||||
}, 0);
|
||||
}
|
||||
|
||||
displayFn(account?: Account): string | undefined {
|
||||
return account ? account.name : undefined;
|
||||
displayFn(account?: Account): string {
|
||||
return account ? account.name : '';
|
||||
}
|
||||
|
||||
calculateTotals() {
|
||||
@@ -124,11 +124,11 @@ export class LedgerComponent implements OnInit, AfterViewInit {
|
||||
getInfo(): Ledger {
|
||||
const formModel = this.form.value;
|
||||
|
||||
return {
|
||||
return new Ledger({
|
||||
account: formModel.account,
|
||||
startDate: moment(formModel.startDate).format('DD-MMM-YYYY'),
|
||||
finishDate: moment(formModel.finishDate).format('DD-MMM-YYYY'),
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
exportCsv() {
|
||||
|
||||
Reference in new issue
Block a user