Chore: Upgrade to Angular v14
This commit is contained in:
1 parent
a4c3ae1035
commit
b1c003a935
54 files changed
+355
-325
No files matched your search
@@ -0,0 +1,29 @@
|
||||
# See https://pre-commit.com for more information
|
||||
# See https://pre-commit.com/hooks.html for more hooks
|
||||
repos:
|
||||
- repo: https://github.com/psf/black
|
||||
rev: 22.6.0
|
||||
hooks:
|
||||
- id: black
|
||||
|
||||
- repo: https://gitlab.com/pycqa/flake8
|
||||
rev: 4.0.1
|
||||
hooks:
|
||||
- id: flake8
|
||||
args: ['--config=brewman/.flake8']
|
||||
|
||||
- repo: https://github.com/timothycrosley/isort
|
||||
rev: 5.10.1
|
||||
hooks:
|
||||
- id: isort
|
||||
additional_dependencies: [toml]
|
||||
exclude: ^.*/?setup\.py$
|
||||
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v4.3.0
|
||||
hooks:
|
||||
- id: trailing-whitespace
|
||||
- id: end-of-file-fixer
|
||||
- id: check-yaml
|
||||
- id: check-added-large-files
|
||||
- id: debug-statements
|
||||
@@ -6,15 +6,15 @@ authors = ["tanshu <git@tanshu.com>"]
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
python = "^3.10"
|
||||
uvicorn = {extras = ["standard"], version = "^0.17.6"}
|
||||
uvicorn = {extras = ["standard"], version = "^0.18.2"}
|
||||
fastapi = "^0.78.0"
|
||||
python-jose = {extras = ["cryptography"], version = "^3.3.0"}
|
||||
passlib = {extras = ["bcrypt"], version = "^1.7.4"}
|
||||
psycopg2-binary = "^2.9.3"
|
||||
SQLAlchemy = {extras = ["mypy"], version = "^1.4.36"}
|
||||
SQLAlchemy = {extras = ["mypy"], version = "^1.4.39"}
|
||||
python-multipart = "^0.0.5"
|
||||
PyJWT = "^2.4.0"
|
||||
alembic = "^1.7.7"
|
||||
alembic = "^1.8.0"
|
||||
itsdangerous = "^2.1.2"
|
||||
python-dotenv = "^0.20.0"
|
||||
pydantic = {extras = ["dotenv"], version = "^1.9.1"}
|
||||
@@ -22,9 +22,10 @@ starlette = "^0.19.1"
|
||||
|
||||
[tool.poetry.dev-dependencies]
|
||||
flake8 = "^4.0.1"
|
||||
black = "^22.3.0"
|
||||
black = "^22.6.0"
|
||||
isort = {extras = ["toml"], version = "^5.10.1"}
|
||||
mypy = "^0.950"
|
||||
pre-commit = "^2.19.0"
|
||||
mypy = "^0.961"
|
||||
|
||||
[build-system]
|
||||
requires = ["poetry-core>=1.0.0"]
|
||||
|
||||
@@ -116,8 +116,10 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"defaultProject": "overlord",
|
||||
"cli": {
|
||||
"defaultCollection": "@angular-eslint/schematics"
|
||||
"schematicCollections": [
|
||||
"@angular-eslint/schematics"
|
||||
],
|
||||
"analytics": "0309c8d2-99a2-4dd3-b63e-9a0a43611460"
|
||||
}
|
||||
}
|
||||
+29
-29
@@ -14,44 +14,44 @@
|
||||
},
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@angular/animations": "^13.3.6",
|
||||
"@angular/cdk": "^13.3.6",
|
||||
"@angular/common": "^13.3.6",
|
||||
"@angular/compiler": "^13.3.6",
|
||||
"@angular/core": "^13.3.6",
|
||||
"@angular/flex-layout": "^13.0.0-beta.38",
|
||||
"@angular/forms": "^13.3.6",
|
||||
"@angular/material": "^13.3.6",
|
||||
"@angular/material-moment-adapter": "^13.3.6",
|
||||
"@angular/platform-browser": "^13.3.6",
|
||||
"@angular/platform-browser-dynamic": "^13.3.6",
|
||||
"@angular/router": "^13.3.6",
|
||||
"@angular/animations": "^14.0.4",
|
||||
"@angular/cdk": "^14.0.4",
|
||||
"@angular/common": "^14.0.4",
|
||||
"@angular/compiler": "^14.0.4",
|
||||
"@angular/core": "^14.0.4",
|
||||
"@angular/flex-layout": "^14.0.0-beta.40",
|
||||
"@angular/forms": "^14.0.4",
|
||||
"@angular/material": "^14.0.4",
|
||||
"@angular/material-moment-adapter": "^14.0.4",
|
||||
"@angular/platform-browser": "^14.0.4",
|
||||
"@angular/platform-browser-dynamic": "^14.0.4",
|
||||
"@angular/router": "^14.0.4",
|
||||
"@ngx-loading-bar/core": "^6.0.2",
|
||||
"@ngx-loading-bar/http-client": "^6.0.2",
|
||||
"@ngx-loading-bar/router": "^6.0.2",
|
||||
"@types/mousetrap": "1.6.9",
|
||||
"angular2-hotkeys": "^13.1.0",
|
||||
"mathjs": "^10.5.2",
|
||||
"mathjs": "^10.6.4",
|
||||
"moment": "^2.29.3",
|
||||
"rxjs": "^6.6.7",
|
||||
"tslib": "^2.1.0",
|
||||
"zone.js": "~0.11.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@angular-devkit/build-angular": "^13.3.5",
|
||||
"@angular-eslint/builder": "^13.2.1",
|
||||
"@angular-eslint/eslint-plugin": "^13.2.1",
|
||||
"@angular-eslint/eslint-plugin-template": "^13.2.1",
|
||||
"@angular-eslint/schematics": "^13.2.1",
|
||||
"@angular-eslint/template-parser": "^13.2.1",
|
||||
"@angular/cli": "^13.3.5",
|
||||
"@angular/compiler-cli": "^13.3.6",
|
||||
"@angular/language-service": "^13.3.6",
|
||||
"@angular-devkit/build-angular": "^14.0.4",
|
||||
"@angular-eslint/builder": "^14.0.0",
|
||||
"@angular-eslint/eslint-plugin": "^14.0.0",
|
||||
"@angular-eslint/eslint-plugin-template": "^14.0.0",
|
||||
"@angular-eslint/schematics": "^14.0.0",
|
||||
"@angular-eslint/template-parser": "^14.0.0",
|
||||
"@angular/cli": "^14.0.4",
|
||||
"@angular/compiler-cli": "^14.0.4",
|
||||
"@angular/language-service": "^14.0.4",
|
||||
"@types/jasmine": "~3.7.4",
|
||||
"@types/node": "^17.0.31",
|
||||
"@typescript-eslint/eslint-plugin": "5.23.0",
|
||||
"@typescript-eslint/parser": "5.23.0",
|
||||
"eslint": "^8.2.0",
|
||||
"@types/node": "^18.0.1",
|
||||
"@typescript-eslint/eslint-plugin": "^5.29.0",
|
||||
"@typescript-eslint/parser": "^5.29.0",
|
||||
"eslint": "^8.18.0",
|
||||
"eslint-plugin-import": "2.26.0",
|
||||
"husky": "^8.0.1",
|
||||
"jasmine-core": "~3.8.0",
|
||||
@@ -61,9 +61,9 @@
|
||||
"karma-coverage": "~2.0.3",
|
||||
"karma-jasmine": "~4.0.1",
|
||||
"karma-jasmine-html-reporter": "^1.6.0",
|
||||
"lint-staged": "^12.4.1",
|
||||
"prettier": "^2.6.2",
|
||||
"standard-version": "^9.3.2",
|
||||
"lint-staged": "^13.0.3",
|
||||
"prettier": "^2.7.1",
|
||||
"standard-version": "^9.5.0",
|
||||
"ts-node": "^9.1.1",
|
||||
"typescript": "~4.6.4"
|
||||
},
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { AfterViewInit, Component, ElementRef, OnInit, ViewChild } from '@angular/core';
|
||||
import { FormBuilder, FormGroup } from '@angular/forms';
|
||||
import { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
|
||||
@@ -17,7 +17,7 @@ import { ConfirmDialogComponent } from '../../shared/confirm-dialog/confirm-dial
|
||||
})
|
||||
export class AccountDetailComponent implements OnInit, AfterViewInit {
|
||||
@ViewChild('nameElement', { static: true }) nameElement?: ElementRef;
|
||||
form: FormGroup;
|
||||
form: UntypedFormGroup;
|
||||
accountTypes: AccountType[] = [];
|
||||
costCentres: CostCentre[] = [];
|
||||
item: Account = new Account();
|
||||
@@ -26,7 +26,7 @@ export class AccountDetailComponent implements OnInit, AfterViewInit {
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private dialog: MatDialog,
|
||||
private fb: FormBuilder,
|
||||
private fb: UntypedFormBuilder,
|
||||
private toaster: ToasterService,
|
||||
private ser: AccountService,
|
||||
) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { AfterViewInit, Component, ElementRef, OnInit, ViewChild } from '@angular/core';
|
||||
import { FormBuilder, FormControl, FormGroup } from '@angular/forms';
|
||||
import { UntypedFormBuilder, UntypedFormControl, UntypedFormGroup } from '@angular/forms';
|
||||
import { MatPaginator } from '@angular/material/paginator';
|
||||
import { MatSort } from '@angular/material/sort';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
@@ -21,18 +21,18 @@ export class AccountListComponent implements OnInit, AfterViewInit {
|
||||
@ViewChild(MatSort, { static: true }) sort?: MatSort;
|
||||
dataSource: AccountListDataSource;
|
||||
filter: Observable<string>;
|
||||
form: FormGroup;
|
||||
form: UntypedFormGroup;
|
||||
list: Account[] = [];
|
||||
|
||||
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
|
||||
displayedColumns = ['name', 'type', 'isActive', 'isReconcilable', 'costCentre'];
|
||||
|
||||
constructor(private route: ActivatedRoute, private fb: FormBuilder) {
|
||||
constructor(private route: ActivatedRoute, private fb: UntypedFormBuilder) {
|
||||
this.form = this.fb.group({
|
||||
filter: '',
|
||||
});
|
||||
// Listen to Filter Change
|
||||
this.filter = (this.form.get('filter') as FormControl).valueChanges.pipe(
|
||||
this.filter = (this.form.get('filter') as UntypedFormControl).valueChanges.pipe(
|
||||
startWith(''),
|
||||
debounceTime(150),
|
||||
distinctUntilChanged(),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { FormArray, FormBuilder, FormControl, FormGroup } from '@angular/forms';
|
||||
import { UntypedFormArray, UntypedFormBuilder, UntypedFormControl, UntypedFormGroup } from '@angular/forms';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import * as moment from 'moment';
|
||||
@@ -22,7 +22,7 @@ import { AttendanceService } from './attendance.service';
|
||||
export class AttendanceComponent implements OnInit {
|
||||
public attendanceObservable = new BehaviorSubject<AttendanceItem[]>([]);
|
||||
dataSource: AttendanceDataSource = new AttendanceDataSource(this.attendanceObservable);
|
||||
form: FormGroup;
|
||||
form: UntypedFormGroup;
|
||||
|
||||
info: Attendance = new Attendance();
|
||||
attendanceTypes: AttendanceType[] = [];
|
||||
@@ -32,7 +32,7 @@ export class AttendanceComponent implements OnInit {
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private fb: FormBuilder,
|
||||
private fb: UntypedFormBuilder,
|
||||
private dialog: MatDialog,
|
||||
private toaster: ToasterService,
|
||||
private auth: AuthService,
|
||||
@@ -50,7 +50,7 @@ export class AttendanceComponent implements OnInit {
|
||||
|
||||
this.info = data.info;
|
||||
this.attendanceTypes = data.attendanceTypes;
|
||||
(this.form.get('date') as FormControl).setValue(
|
||||
(this.form.get('date') as UntypedFormControl).setValue(
|
||||
moment(this.info.date, 'DD-MMM-YYYY').toDate(),
|
||||
);
|
||||
this.form.setControl(
|
||||
@@ -69,7 +69,7 @@ export class AttendanceComponent implements OnInit {
|
||||
}
|
||||
|
||||
getClass(index: number) {
|
||||
const array = this.form.get('attendances') as FormArray;
|
||||
const array = this.form.get('attendances') as UntypedFormArray;
|
||||
const id = array.controls[index].value.attendanceType;
|
||||
const { name } = this.attendanceTypes.filter((x) => x.id === id)[0];
|
||||
return name.toLowerCase().replace(/(\s+\+\s+)|(\s+)/g, '-');
|
||||
@@ -94,14 +94,14 @@ export class AttendanceComponent implements OnInit {
|
||||
getAttendance(): Attendance {
|
||||
const formModel = this.form.value;
|
||||
this.info.date = moment(formModel.date).format('DD-MMM-YYYY');
|
||||
const array = this.form.get('attendances') as FormArray;
|
||||
const array = this.form.get('attendances') as UntypedFormArray;
|
||||
this.info.body.forEach((item, index) => {
|
||||
item.attendanceType.id = array.controls[index].value.attendanceType;
|
||||
});
|
||||
return this.info;
|
||||
}
|
||||
|
||||
get attendancesArray(): FormArray {
|
||||
return this.form.get('attendances') as FormArray;
|
||||
get attendancesArray(): UntypedFormArray {
|
||||
return this.form.get('attendances') as UntypedFormArray;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import { AfterViewInit, Component, ElementRef, OnInit, ViewChild } from '@angular/core';
|
||||
import { FormBuilder, FormGroup } from '@angular/forms';
|
||||
import { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
|
||||
import { ToasterService } from '../../core/toaster.service';
|
||||
@@ -13,7 +13,7 @@ import { AuthService } from '../auth.service';
|
||||
})
|
||||
export class LoginComponent implements OnInit, AfterViewInit {
|
||||
@ViewChild('nameElement', { static: true }) nameElement?: ElementRef;
|
||||
form: FormGroup;
|
||||
form: UntypedFormGroup;
|
||||
hide: boolean;
|
||||
showOtp: boolean;
|
||||
clientId = '';
|
||||
@@ -25,7 +25,7 @@ export class LoginComponent implements OnInit, AfterViewInit {
|
||||
private router: Router,
|
||||
private toaster: ToasterService,
|
||||
private cs: CookieService,
|
||||
private fb: FormBuilder,
|
||||
private fb: UntypedFormBuilder,
|
||||
) {
|
||||
this.hide = true;
|
||||
this.showOtp = false;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { FormBuilder, FormGroup } from '@angular/forms';
|
||||
import { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
|
||||
import { MatPaginator } from '@angular/material/paginator';
|
||||
import { MatSort } from '@angular/material/sort';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
@@ -18,11 +18,11 @@ export class BalanceSheetComponent implements OnInit {
|
||||
@ViewChild(MatSort, { static: true }) sort?: MatSort;
|
||||
info: BalanceSheet = new BalanceSheet();
|
||||
dataSource: BalanceSheetDataSource = new BalanceSheetDataSource(this.info.body);
|
||||
form: FormGroup;
|
||||
form: UntypedFormGroup;
|
||||
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
|
||||
displayedColumns = ['group', 'name', 'subAmount', 'total'];
|
||||
|
||||
constructor(private route: ActivatedRoute, private router: Router, private fb: FormBuilder) {
|
||||
constructor(private route: ActivatedRoute, private router: Router, private fb: UntypedFormBuilder) {
|
||||
this.form = this.fb.group({
|
||||
date: '',
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { FormBuilder, FormGroup } from '@angular/forms';
|
||||
import { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import * as moment from 'moment';
|
||||
|
||||
@@ -14,11 +14,11 @@ import { CashFlowDataSource } from './cash-flow-datasource';
|
||||
export class CashFlowComponent implements OnInit {
|
||||
info: CashFlow = new CashFlow();
|
||||
dataSource: CashFlowDataSource = new CashFlowDataSource(CashFlow.Data(this.info));
|
||||
form: FormGroup;
|
||||
form: UntypedFormGroup;
|
||||
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
|
||||
displayedColumns = ['name', 'amount'];
|
||||
|
||||
constructor(private route: ActivatedRoute, private router: Router, private fb: FormBuilder) {
|
||||
constructor(private route: ActivatedRoute, private router: Router, private fb: UntypedFormBuilder) {
|
||||
this.form = this.fb.group({
|
||||
startDate: '',
|
||||
finishDate: '',
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { AfterViewInit, Component, ElementRef, OnInit, ViewChild } from '@angular/core';
|
||||
import { FormBuilder, FormGroup } from '@angular/forms';
|
||||
import { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
|
||||
@@ -15,14 +15,14 @@ import { ClientService } from '../client.service';
|
||||
})
|
||||
export class ClientDetailComponent implements OnInit, AfterViewInit {
|
||||
@ViewChild('nameElement', { static: true }) nameElement?: ElementRef;
|
||||
form: FormGroup;
|
||||
form: UntypedFormGroup;
|
||||
item: Client = new Client();
|
||||
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private dialog: MatDialog,
|
||||
private fb: FormBuilder,
|
||||
private fb: UntypedFormBuilder,
|
||||
private toaster: ToasterService,
|
||||
private ser: ClientService,
|
||||
) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { FormArray, FormBuilder, FormControl, FormGroup } from '@angular/forms';
|
||||
import { UntypedFormArray, UntypedFormBuilder, FormControl, UntypedFormGroup } from '@angular/forms';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { MatPaginator } from '@angular/material/paginator';
|
||||
import { MatSelectChange } from '@angular/material/select';
|
||||
@@ -29,7 +29,7 @@ export class ClosingStockComponent implements OnInit {
|
||||
@ViewChild(MatSort, { static: true }) sort?: MatSort;
|
||||
info: ClosingStock = new ClosingStock();
|
||||
dataSource: ClosingStockDataSource = new ClosingStockDataSource(this.info.items);
|
||||
form: FormGroup;
|
||||
form: UntypedFormGroup;
|
||||
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
|
||||
displayedColumns = [
|
||||
'product',
|
||||
@@ -46,7 +46,7 @@ export class ClosingStockComponent implements OnInit {
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private fb: FormBuilder,
|
||||
private fb: UntypedFormBuilder,
|
||||
private toCsv: ToCsvService,
|
||||
private dialog: MatDialog,
|
||||
private toaster: ToasterService,
|
||||
@@ -108,7 +108,7 @@ export class ClosingStockComponent implements OnInit {
|
||||
getClosingStock(): ClosingStock {
|
||||
const formModel = this.form.value;
|
||||
this.info.date = moment(formModel.date).format('DD-MMM-YYYY');
|
||||
const array = this.form.get('stocks') as FormArray;
|
||||
const array = this.form.get('stocks') as UntypedFormArray;
|
||||
this.info.items.forEach((item, index) => {
|
||||
item.physical = +array.controls[index].value.physical;
|
||||
item.costCentre =
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { AfterViewInit, Component, ElementRef, OnInit, ViewChild } from '@angular/core';
|
||||
import { FormBuilder, FormGroup } from '@angular/forms';
|
||||
import { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
|
||||
import { CostCentre } from '../../core/cost-centre';
|
||||
@@ -13,13 +13,13 @@ import { CostCentreService } from '../cost-centre.service';
|
||||
})
|
||||
export class CostCentreDetailComponent implements OnInit, AfterViewInit {
|
||||
@ViewChild('nameElement', { static: true }) nameElement?: ElementRef;
|
||||
form: FormGroup;
|
||||
form: UntypedFormGroup;
|
||||
item: CostCentre = new CostCentre();
|
||||
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private fb: FormBuilder,
|
||||
private fb: UntypedFormBuilder,
|
||||
private toaster: ToasterService,
|
||||
private ser: CostCentreService,
|
||||
) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { FormBuilder, FormGroup } from '@angular/forms';
|
||||
import { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
|
||||
import { MatPaginator } from '@angular/material/paginator';
|
||||
import { MatSort } from '@angular/material/sort';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
@@ -19,7 +19,7 @@ export class DaybookComponent implements OnInit {
|
||||
@ViewChild(MatSort, { static: true }) sort?: MatSort;
|
||||
info: Daybook = new Daybook();
|
||||
dataSource: DaybookDataSource = new DaybookDataSource(this.info.body);
|
||||
form: FormGroup;
|
||||
form: UntypedFormGroup;
|
||||
selectedRowId = '';
|
||||
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
|
||||
displayedColumns = [
|
||||
@@ -35,7 +35,7 @@ export class DaybookComponent implements OnInit {
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private fb: FormBuilder,
|
||||
private fb: UntypedFormBuilder,
|
||||
private ser: DaybookService,
|
||||
) {
|
||||
this.form = this.fb.group({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { AfterViewInit, Component, ElementRef, OnInit, ViewChild } from '@angular/core';
|
||||
import { FormArray, FormBuilder, FormControl, FormGroup } from '@angular/forms';
|
||||
import { UntypedFormArray, UntypedFormBuilder, UntypedFormControl, UntypedFormGroup } from '@angular/forms';
|
||||
import { MatAutocompleteSelectedEvent } from '@angular/material/autocomplete';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
@@ -30,7 +30,7 @@ export class EmployeeAttendanceComponent implements OnInit, AfterViewInit {
|
||||
this.employeeAttendanceObservable,
|
||||
);
|
||||
|
||||
form: FormGroup;
|
||||
form: UntypedFormGroup;
|
||||
|
||||
info: EmployeeAttendance = new EmployeeAttendance();
|
||||
attendanceTypes: AttendanceType[] = [];
|
||||
@@ -42,7 +42,7 @@ export class EmployeeAttendanceComponent implements OnInit, AfterViewInit {
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private fb: FormBuilder,
|
||||
private fb: UntypedFormBuilder,
|
||||
private dialog: MatDialog,
|
||||
private toaster: ToasterService,
|
||||
private auth: AuthService,
|
||||
@@ -56,7 +56,7 @@ export class EmployeeAttendanceComponent implements OnInit, AfterViewInit {
|
||||
attendances: this.fb.array([]),
|
||||
});
|
||||
// Listen to Employee Value Changes
|
||||
this.employees = (this.form.get('employee') as FormControl).valueChanges.pipe(
|
||||
this.employees = (this.form.get('employee') as UntypedFormControl).valueChanges.pipe(
|
||||
startWith(null),
|
||||
map((x) => (x !== null && x.length >= 1 ? x : null)),
|
||||
debounceTime(150),
|
||||
@@ -71,13 +71,13 @@ export class EmployeeAttendanceComponent implements OnInit, AfterViewInit {
|
||||
|
||||
this.info = data.info;
|
||||
this.attendanceTypes = data.attendanceTypes;
|
||||
(this.form.get('startDate') as FormControl).setValue(
|
||||
(this.form.get('startDate') as UntypedFormControl).setValue(
|
||||
moment(this.info.startDate, 'DD-MMM-YYYY').toDate(),
|
||||
);
|
||||
(this.form.get('finishDate') as FormControl).setValue(
|
||||
(this.form.get('finishDate') as UntypedFormControl).setValue(
|
||||
moment(this.info.finishDate, 'DD-MMM-YYYY').toDate(),
|
||||
);
|
||||
(this.form.get('employee') as FormControl).setValue(this.info.employee);
|
||||
(this.form.get('employee') as UntypedFormControl).setValue(this.info.employee);
|
||||
this.form.setControl(
|
||||
'attendances',
|
||||
this.fb.array(
|
||||
@@ -110,7 +110,7 @@ export class EmployeeAttendanceComponent implements OnInit, AfterViewInit {
|
||||
}
|
||||
|
||||
getClass(index: number) {
|
||||
const array = this.form.get('attendances') as FormArray;
|
||||
const array = this.form.get('attendances') as UntypedFormArray;
|
||||
const id = array.controls[index].value.attendanceType;
|
||||
const { name } = this.attendanceTypes.filter((x) => x.id === id)[0];
|
||||
return name.toLowerCase().replace(/(\s+\+\s+)|(\s+)/g, '-');
|
||||
@@ -143,14 +143,14 @@ export class EmployeeAttendanceComponent implements OnInit, AfterViewInit {
|
||||
const formValue = this.form.value;
|
||||
this.info.startDate = moment(formValue.startDate).format('DD-MMM-YYYY');
|
||||
this.info.finishDate = moment(formValue.finishDate).format('DD-MMM-YYYY');
|
||||
const array = this.form.get('attendances') as FormArray;
|
||||
const array = this.form.get('attendances') as UntypedFormArray;
|
||||
this.info.body.forEach((item, index) => {
|
||||
item.attendanceType.id = array.controls[index].value.attendanceType;
|
||||
});
|
||||
return this.info;
|
||||
}
|
||||
|
||||
get attendancesArray(): FormArray {
|
||||
return this.form.get('attendances') as FormArray;
|
||||
get attendancesArray(): UntypedFormArray {
|
||||
return this.form.get('attendances') as UntypedFormArray;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import { AfterViewInit, Component, ElementRef, OnInit, ViewChild } from '@angular/core';
|
||||
import { FormBuilder, FormControl, FormGroup } from '@angular/forms';
|
||||
import { UntypedFormBuilder, UntypedFormControl, UntypedFormGroup } from '@angular/forms';
|
||||
import { MatAutocompleteSelectedEvent } from '@angular/material/autocomplete';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
@@ -29,7 +29,7 @@ export class EmployeeBenefitsComponent implements OnInit, AfterViewInit {
|
||||
@ViewChild('employeeElement', { static: true }) employeeElement?: ElementRef;
|
||||
public benefitsObservable = new BehaviorSubject<EmployeeBenefit[]>([]);
|
||||
dataSource: EmployeeBenefitsDataSource = new EmployeeBenefitsDataSource(this.benefitsObservable);
|
||||
form: FormGroup;
|
||||
form: UntypedFormGroup;
|
||||
voucher: Voucher = new Voucher();
|
||||
employee: Employee | null = null;
|
||||
accBal: AccountBalance | null = null;
|
||||
@@ -51,7 +51,7 @@ export class EmployeeBenefitsComponent implements OnInit, AfterViewInit {
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private fb: FormBuilder,
|
||||
private fb: UntypedFormBuilder,
|
||||
private dialog: MatDialog,
|
||||
private toaster: ToasterService,
|
||||
public auth: AuthService,
|
||||
@@ -68,7 +68,7 @@ export class EmployeeBenefitsComponent implements OnInit, AfterViewInit {
|
||||
});
|
||||
// Setup Employee Autocomplete
|
||||
this.employees = (
|
||||
(this.form.get('addRow') as FormControl).get('employee') as FormControl
|
||||
(this.form.get('addRow') as UntypedFormControl).get('employee') as UntypedFormControl
|
||||
).valueChanges.pipe(
|
||||
startWith(null),
|
||||
map((x) => (x !== null && x.length >= 1 ? x : null)),
|
||||
@@ -147,10 +147,10 @@ export class EmployeeBenefitsComponent implements OnInit, AfterViewInit {
|
||||
return;
|
||||
}
|
||||
|
||||
const formValue = (this.form.get('addRow') as FormControl).value;
|
||||
const formValue = (this.form.get('addRow') as UntypedFormControl).value;
|
||||
const grossSalary = +formValue.grossSalary;
|
||||
const daysWorked = +formValue.daysWorked;
|
||||
const date = (this.form.get('date') as FormControl).value;
|
||||
const date = (this.form.get('date') as UntypedFormControl).value;
|
||||
const daysInMonth = moment(date).daysInMonth();
|
||||
const esi = EmployeeBenefitsComponent.getEsi(grossSalary, daysWorked, daysInMonth);
|
||||
const pf = EmployeeBenefitsComponent.getPf(grossSalary, daysWorked, daysInMonth);
|
||||
@@ -171,7 +171,7 @@ export class EmployeeBenefitsComponent implements OnInit, AfterViewInit {
|
||||
}
|
||||
|
||||
resetAddRow() {
|
||||
(this.form.get('addRow') as FormControl).reset({
|
||||
(this.form.get('addRow') as UntypedFormControl).reset({
|
||||
employee: '',
|
||||
grossSalary: null,
|
||||
daysWorked: null,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { FormBuilder, FormControl, FormGroup } from '@angular/forms';
|
||||
import { UntypedFormBuilder, UntypedFormControl, UntypedFormGroup } from '@angular/forms';
|
||||
import { MatDatepicker } from '@angular/material/datepicker';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
@@ -17,15 +17,15 @@ import { EmployeeFunctionsService } from './employee-functions.service';
|
||||
styleUrls: ['./employee-functions.component.css'],
|
||||
})
|
||||
export class EmployeeFunctionsComponent {
|
||||
creditSalaryForm: FormGroup;
|
||||
attendanceRecordForm: FormGroup;
|
||||
fingerprintForm: FormGroup;
|
||||
creditSalaryForm: UntypedFormGroup;
|
||||
attendanceRecordForm: UntypedFormGroup;
|
||||
fingerprintForm: UntypedFormGroup;
|
||||
fingerprintFile: File | null = null;
|
||||
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private fb: FormBuilder,
|
||||
private fb: UntypedFormBuilder,
|
||||
private dialog: MatDialog,
|
||||
private toaster: ToasterService,
|
||||
private auth: AuthService,
|
||||
@@ -44,7 +44,7 @@ export class EmployeeFunctionsComponent {
|
||||
}
|
||||
|
||||
chosenYearHandler(normalizedYear: Moment) {
|
||||
const dateControl = this.creditSalaryForm.get('date') as FormControl;
|
||||
const dateControl = this.creditSalaryForm.get('date') as UntypedFormControl;
|
||||
const ctrlValue = dateControl.value;
|
||||
ctrlValue.year(normalizedYear.year());
|
||||
ctrlValue.date(ctrlValue.daysInMonth());
|
||||
@@ -52,7 +52,7 @@ export class EmployeeFunctionsComponent {
|
||||
}
|
||||
|
||||
chosenMonthHandler(normlizedMonth: Moment, datepicker: MatDatepicker<Moment>) {
|
||||
const dateControl = this.creditSalaryForm.get('date') as FormControl;
|
||||
const dateControl = this.creditSalaryForm.get('date') as UntypedFormControl;
|
||||
const ctrlValue = dateControl.value;
|
||||
ctrlValue.month(normlizedMonth.month());
|
||||
ctrlValue.date(ctrlValue.daysInMonth());
|
||||
@@ -61,7 +61,7 @@ export class EmployeeFunctionsComponent {
|
||||
}
|
||||
|
||||
creditSalary() {
|
||||
const date = moment((this.creditSalaryForm.get('date') as FormControl).value).format(
|
||||
const date = moment((this.creditSalaryForm.get('date') as UntypedFormControl).value).format(
|
||||
'DD-MMM-YYYY',
|
||||
);
|
||||
if (!date) {
|
||||
@@ -80,10 +80,10 @@ export class EmployeeFunctionsComponent {
|
||||
|
||||
attendanceRecordUrl() {
|
||||
const startDate = moment(
|
||||
(this.attendanceRecordForm.get('startDate') as FormControl).value,
|
||||
(this.attendanceRecordForm.get('startDate') as UntypedFormControl).value,
|
||||
).format('DD-MMM-YYYY');
|
||||
const finishDate = moment(
|
||||
(this.attendanceRecordForm.get('finishDate') as FormControl).value,
|
||||
(this.attendanceRecordForm.get('finishDate') as UntypedFormControl).value,
|
||||
).format('DD-MMM-YYYY');
|
||||
if (!startDate || !finishDate) {
|
||||
// this.toaster.show('Danger', 'Please choose a start and finish date.');
|
||||
@@ -94,10 +94,10 @@ export class EmployeeFunctionsComponent {
|
||||
|
||||
fingerPrintUrl() {
|
||||
const startDate = moment(
|
||||
(this.attendanceRecordForm.get('startDate') as FormControl).value,
|
||||
(this.attendanceRecordForm.get('startDate') as UntypedFormControl).value,
|
||||
).format('DD-MMM-YYYY');
|
||||
const finishDate = moment(
|
||||
(this.attendanceRecordForm.get('finishDate') as FormControl).value,
|
||||
(this.attendanceRecordForm.get('finishDate') as UntypedFormControl).value,
|
||||
).format('DD-MMM-YYYY');
|
||||
if (!startDate || !finishDate) {
|
||||
// this.toaster.show('Danger', 'Please choose a start and finish date.');
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { AfterViewInit, Component, ElementRef, OnInit, ViewChild } from '@angular/core';
|
||||
import { FormBuilder, FormControl, FormGroup } from '@angular/forms';
|
||||
import { UntypedFormBuilder, UntypedFormControl, UntypedFormGroup } from '@angular/forms';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import * as moment from 'moment';
|
||||
@@ -17,7 +17,7 @@ import { EmployeeService } from '../employee.service';
|
||||
})
|
||||
export class EmployeeDetailComponent implements OnInit, AfterViewInit {
|
||||
@ViewChild('nameElement', { static: true }) nameElement?: ElementRef;
|
||||
form: FormGroup;
|
||||
form: UntypedFormGroup;
|
||||
costCentres: CostCentre[] = [];
|
||||
item: Employee = new Employee();
|
||||
|
||||
@@ -25,7 +25,7 @@ export class EmployeeDetailComponent implements OnInit, AfterViewInit {
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private dialog: MatDialog,
|
||||
private fb: FormBuilder,
|
||||
private fb: UntypedFormBuilder,
|
||||
private toaster: ToasterService,
|
||||
private ser: EmployeeService,
|
||||
) {
|
||||
@@ -41,7 +41,7 @@ export class EmployeeDetailComponent implements OnInit, AfterViewInit {
|
||||
leavingDate: '',
|
||||
});
|
||||
// Listen to IsActive Changes
|
||||
(this.form.get('isActive') as FormControl).valueChanges.subscribe((x) => {
|
||||
(this.form.get('isActive') as UntypedFormControl).valueChanges.subscribe((x) => {
|
||||
this.item.isActive = x;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { AfterViewInit, Component, ElementRef, OnInit, ViewChild } from '@angular/core';
|
||||
import { FormBuilder, FormControl, FormGroup } from '@angular/forms';
|
||||
import { UntypedFormBuilder, UntypedFormControl, UntypedFormGroup } from '@angular/forms';
|
||||
import { MatPaginator } from '@angular/material/paginator';
|
||||
import { MatSort } from '@angular/material/sort';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
@@ -22,7 +22,7 @@ export class EmployeeListComponent implements OnInit, AfterViewInit {
|
||||
@ViewChild(MatSort, { static: true }) sort?: MatSort;
|
||||
dataSource: EmployeeListDataSource;
|
||||
filter: Observable<string>;
|
||||
form: FormGroup;
|
||||
form: UntypedFormGroup;
|
||||
list: Employee[] = [];
|
||||
|
||||
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
|
||||
@@ -37,11 +37,11 @@ export class EmployeeListComponent implements OnInit, AfterViewInit {
|
||||
'leavingDate',
|
||||
];
|
||||
|
||||
constructor(private route: ActivatedRoute, private fb: FormBuilder, private toCsv: ToCsvService) {
|
||||
constructor(private route: ActivatedRoute, private fb: UntypedFormBuilder, private toCsv: ToCsvService) {
|
||||
this.form = this.fb.group({
|
||||
filter: '',
|
||||
});
|
||||
this.filter = (this.form.get('filter') as FormControl).valueChanges.pipe(
|
||||
this.filter = (this.form.get('filter') as UntypedFormControl).valueChanges.pipe(
|
||||
startWith(''),
|
||||
debounceTime(150),
|
||||
distinctUntilChanged(),
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { DataSource } from '@angular/cdk/collections';
|
||||
import { MatPaginator } from '@angular/material/paginator';
|
||||
import { MatSort } from '@angular/material/sort';
|
||||
import { SortDirection } from '@angular/material/sort/sort-direction';
|
||||
import { MatSort, SortDirection } from '@angular/material/sort';
|
||||
import { Observable, of as observableOf } from 'rxjs';
|
||||
|
||||
import { Entries } from './entries';
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { FormBuilder, FormControl, FormGroup } from '@angular/forms';
|
||||
import { UntypedFormBuilder, UntypedFormControl, UntypedFormGroup } from '@angular/forms';
|
||||
import { MatPaginator } from '@angular/material/paginator';
|
||||
import { MatRadioChange } from '@angular/material/radio';
|
||||
import { MatSort } from '@angular/material/sort';
|
||||
import { SortDirection } from '@angular/material/sort/sort-direction';
|
||||
import { MatSort, SortDirection } from '@angular/material/sort';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import * as moment from 'moment';
|
||||
|
||||
@@ -20,7 +19,7 @@ export class EntriesComponent implements OnInit {
|
||||
@ViewChild(MatSort, { static: true }) sort?: MatSort;
|
||||
info: Report = new Report();
|
||||
dataSource: EntriesDatasource = new EntriesDatasource(this.info.report, 0);
|
||||
form: FormGroup;
|
||||
form: UntypedFormGroup;
|
||||
displayedColumns = [
|
||||
'date',
|
||||
'voucherType',
|
||||
@@ -33,7 +32,7 @@ export class EntriesComponent implements OnInit {
|
||||
|
||||
posted: boolean | null = null;
|
||||
issue: boolean = false;
|
||||
constructor(private route: ActivatedRoute, private router: Router, private fb: FormBuilder) {
|
||||
constructor(private route: ActivatedRoute, private router: Router, private fb: UntypedFormBuilder) {
|
||||
this.form = this.fb.group({
|
||||
startDate: '',
|
||||
finishDate: '',
|
||||
@@ -70,9 +69,9 @@ export class EntriesComponent implements OnInit {
|
||||
issue: this.issue,
|
||||
});
|
||||
if (this.posted === null || this.posted) {
|
||||
(this.form.get('issue') as FormControl).enable();
|
||||
(this.form.get('issue') as UntypedFormControl).enable();
|
||||
} else {
|
||||
(this.form.get('issue') as FormControl).disable();
|
||||
(this.form.get('issue') as UntypedFormControl).disable();
|
||||
}
|
||||
this.dataSource = new EntriesDatasource(
|
||||
this.info.report,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { FormArray, FormBuilder, FormControl, FormGroup } from '@angular/forms';
|
||||
import { UntypedFormArray, UntypedFormBuilder, UntypedFormControl, UntypedFormGroup } from '@angular/forms';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import * as moment from 'moment';
|
||||
@@ -26,7 +26,7 @@ import { IncentiveDataSource } from './incentive-datasource';
|
||||
export class IncentiveComponent implements OnInit {
|
||||
public incentiveObservable = new BehaviorSubject<Incentive[]>([]);
|
||||
dataSource: IncentiveDataSource = new IncentiveDataSource(this.incentiveObservable);
|
||||
form: FormGroup;
|
||||
form: UntypedFormGroup;
|
||||
voucher: Voucher = new Voucher();
|
||||
account: Account = new Account();
|
||||
accBal: AccountBalance | null = null;
|
||||
@@ -36,7 +36,7 @@ export class IncentiveComponent implements OnInit {
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private fb: FormBuilder,
|
||||
private fb: UntypedFormBuilder,
|
||||
private dialog: MatDialog,
|
||||
private toaster: ToasterService,
|
||||
public auth: AuthService,
|
||||
@@ -47,7 +47,7 @@ export class IncentiveComponent implements OnInit {
|
||||
incentives: this.fb.array([]),
|
||||
});
|
||||
// Listen to Date Change
|
||||
(this.form.get('date') as FormControl).valueChanges
|
||||
(this.form.get('date') as UntypedFormControl).valueChanges
|
||||
.pipe(map((x) => moment(x).format('DD-MMM-YYYY')))
|
||||
.subscribe((x) => {
|
||||
if (x !== this.voucher.date && !this.voucher.id) {
|
||||
@@ -69,7 +69,7 @@ export class IncentiveComponent implements OnInit {
|
||||
|
||||
loadVoucher(voucher: Voucher) {
|
||||
this.voucher = voucher;
|
||||
(this.form.get('date') as FormControl).setValue(
|
||||
(this.form.get('date') as UntypedFormControl).setValue(
|
||||
moment(this.voucher.date, 'DD-MMM-YYYY').toDate(),
|
||||
);
|
||||
this.form.setControl(
|
||||
@@ -99,7 +99,7 @@ export class IncentiveComponent implements OnInit {
|
||||
less(row: Incentive, i: number) {
|
||||
if (row.points >= 1) {
|
||||
row.points -= 1;
|
||||
((this.form.get('incentives') as FormArray).get(`${i}`) as FormGroup).setValue({
|
||||
((this.form.get('incentives') as UntypedFormArray).get(`${i}`) as UntypedFormGroup).setValue({
|
||||
points: `${row.points}`,
|
||||
});
|
||||
}
|
||||
@@ -107,18 +107,18 @@ export class IncentiveComponent implements OnInit {
|
||||
|
||||
change(row: Incentive, i: number) {
|
||||
row.points = +(
|
||||
((this.form.get('incentives') as FormArray).get(`${i}`) as FormGroup).get(
|
||||
((this.form.get('incentives') as UntypedFormArray).get(`${i}`) as UntypedFormGroup).get(
|
||||
'points',
|
||||
) as FormControl
|
||||
) as UntypedFormControl
|
||||
).value;
|
||||
((this.form.get('incentives') as FormArray).get(`${i}`) as FormGroup).setValue({
|
||||
((this.form.get('incentives') as UntypedFormArray).get(`${i}`) as UntypedFormGroup).setValue({
|
||||
points: `${row.points}`,
|
||||
});
|
||||
}
|
||||
|
||||
more(row: Incentive, i: number) {
|
||||
row.points += 1;
|
||||
((this.form.get('incentives') as FormArray).get(`${i}`) as FormGroup).setValue({
|
||||
((this.form.get('incentives') as UntypedFormArray).get(`${i}`) as UntypedFormGroup).setValue({
|
||||
points: `${row.points}`,
|
||||
});
|
||||
}
|
||||
@@ -171,7 +171,7 @@ export class IncentiveComponent implements OnInit {
|
||||
getVoucher(): Voucher {
|
||||
const formModel = this.form.value;
|
||||
this.voucher.date = moment(formModel.date).format('DD-MMM-YYYY');
|
||||
const array = this.form.get('incentives') as FormArray;
|
||||
const array = this.form.get('incentives') as UntypedFormArray;
|
||||
this.voucher.incentives.forEach((item, index) => {
|
||||
item.points = array.controls[index].value.points;
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Component, Inject, OnInit } from '@angular/core';
|
||||
import { FormBuilder, FormControl, FormGroup } from '@angular/forms';
|
||||
import { UntypedFormBuilder, UntypedFormControl, UntypedFormGroup } from '@angular/forms';
|
||||
import { MatAutocompleteSelectedEvent } from '@angular/material/autocomplete';
|
||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||
import { Observable } from 'rxjs';
|
||||
@@ -17,13 +17,13 @@ import { MathService } from '../shared/math.service';
|
||||
})
|
||||
export class IssueDialogComponent implements OnInit {
|
||||
batches: Observable<Batch[]>;
|
||||
form: FormGroup;
|
||||
form: UntypedFormGroup;
|
||||
batch: Batch = new Batch();
|
||||
|
||||
constructor(
|
||||
public dialogRef: MatDialogRef<IssueDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: { inventory: Inventory; date: string },
|
||||
private fb: FormBuilder,
|
||||
private fb: UntypedFormBuilder,
|
||||
private math: MathService,
|
||||
private batchSer: BatchService,
|
||||
) {
|
||||
@@ -32,7 +32,7 @@ export class IssueDialogComponent implements OnInit {
|
||||
quantity: '',
|
||||
});
|
||||
// Listen to Batch Autocomplete Change
|
||||
this.batches = (this.form.get('batch') as FormControl).valueChanges.pipe(
|
||||
this.batches = (this.form.get('batch') as UntypedFormControl).valueChanges.pipe(
|
||||
startWith(''),
|
||||
debounceTime(150),
|
||||
distinctUntilChanged(),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { AfterViewInit, Component, ElementRef, OnInit, OnDestroy, ViewChild } from '@angular/core';
|
||||
import { FormBuilder, FormControl, FormGroup } from '@angular/forms';
|
||||
import { UntypedFormBuilder, UntypedFormControl, UntypedFormGroup } from '@angular/forms';
|
||||
import { MatAutocompleteSelectedEvent } from '@angular/material/autocomplete';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
@@ -39,7 +39,7 @@ export class IssueComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
public gridObservable = new BehaviorSubject<IssueGridItem[]>([]);
|
||||
dataSource: IssueDataSource = new IssueDataSource(this.inventoryObservable);
|
||||
gridDataSource: IssueGridDataSource = new IssueGridDataSource(this.gridObservable);
|
||||
form: FormGroup;
|
||||
form: UntypedFormGroup;
|
||||
voucher: Voucher = new Voucher();
|
||||
costCentres: CostCentre[] = [];
|
||||
batch: Batch | null = null;
|
||||
@@ -52,7 +52,7 @@ export class IssueComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private fb: FormBuilder,
|
||||
private fb: UntypedFormBuilder,
|
||||
private dialog: MatDialog,
|
||||
private hotkeys: HotkeysService,
|
||||
private toaster: ToasterService,
|
||||
@@ -75,7 +75,7 @@ export class IssueComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
});
|
||||
// Listen to Batch Autocomplete Change
|
||||
this.batches = (
|
||||
(this.form.get('addRow') as FormControl).get('batch') as FormControl
|
||||
(this.form.get('addRow') as UntypedFormControl).get('batch') as UntypedFormControl
|
||||
).valueChanges.pipe(
|
||||
startWith('null'),
|
||||
debounceTime(150),
|
||||
@@ -85,7 +85,7 @@ export class IssueComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
),
|
||||
);
|
||||
// Listen to Date Change
|
||||
(this.form.get('date') as FormControl).valueChanges
|
||||
(this.form.get('date') as UntypedFormControl).valueChanges
|
||||
.pipe(map((x) => moment(x).format('DD-MMM-YYYY')))
|
||||
.subscribe((x) => this.showGrid(x));
|
||||
}
|
||||
@@ -160,7 +160,7 @@ export class IssueComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
}
|
||||
|
||||
addRow() {
|
||||
const formValue = (this.form.get('addRow') as FormControl).value;
|
||||
const formValue = (this.form.get('addRow') as UntypedFormControl).value;
|
||||
const quantity = this.math.parseAmount(formValue.quantity, 2);
|
||||
const isConsumption = this.form.value.source === '7b845f95-dfef-fa4a-897c-f0baf15284a3';
|
||||
if (this.batch === null || quantity <= 0) {
|
||||
@@ -194,7 +194,7 @@ export class IssueComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
}
|
||||
|
||||
resetAddRow() {
|
||||
(this.form.get('addRow') as FormControl).reset({
|
||||
(this.form.get('addRow') as UntypedFormControl).reset({
|
||||
batch: null,
|
||||
quantity: '',
|
||||
});
|
||||
@@ -212,7 +212,7 @@ export class IssueComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
Math.abs(this.voucher.inventories.map((x) => x.amount).reduce((p, c) => p + c, 0)),
|
||||
2,
|
||||
);
|
||||
(this.form.get('amount') as FormControl).setValue(amount);
|
||||
(this.form.get('amount') as UntypedFormControl).setValue(amount);
|
||||
}
|
||||
|
||||
editRow(row: Inventory) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Component, Inject, OnInit } from '@angular/core';
|
||||
import { FormBuilder, FormControl, FormGroup } from '@angular/forms';
|
||||
import { UntypedFormBuilder, UntypedFormControl, UntypedFormGroup } from '@angular/forms';
|
||||
import { MatAutocompleteSelectedEvent } from '@angular/material/autocomplete';
|
||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||
import { Observable, of as observableOf } from 'rxjs';
|
||||
@@ -18,14 +18,14 @@ import { MathService } from '../shared/math.service';
|
||||
})
|
||||
export class JournalDialogComponent implements OnInit {
|
||||
accounts: Observable<Account[]>;
|
||||
form: FormGroup;
|
||||
form: UntypedFormGroup;
|
||||
account: Account = new Account();
|
||||
accBal: AccountBalance | null = null;
|
||||
|
||||
constructor(
|
||||
public dialogRef: MatDialogRef<JournalDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: { journal: Journal; date: string },
|
||||
private fb: FormBuilder,
|
||||
private fb: UntypedFormBuilder,
|
||||
private math: MathService,
|
||||
private accountSer: AccountService,
|
||||
) {
|
||||
@@ -36,7 +36,7 @@ export class JournalDialogComponent implements OnInit {
|
||||
});
|
||||
this.accBal = null;
|
||||
// Setup Account Autocomplete
|
||||
this.accounts = (this.form.get('account') as FormControl).valueChanges.pipe(
|
||||
this.accounts = (this.form.get('account') as UntypedFormControl).valueChanges.pipe(
|
||||
startWith(null),
|
||||
map((x) => (x !== null && x.length >= 1 ? x : null)),
|
||||
debounceTime(150),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { AfterViewInit, Component, ElementRef, OnInit, OnDestroy, ViewChild } from '@angular/core';
|
||||
import { FormBuilder, FormControl, FormGroup } from '@angular/forms';
|
||||
import { UntypedFormBuilder, UntypedFormControl, UntypedFormGroup } from '@angular/forms';
|
||||
import { MatAutocompleteSelectedEvent } from '@angular/material/autocomplete';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
@@ -37,7 +37,7 @@ export class JournalComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
@ViewChild('dateElement', { static: true }) dateElement?: ElementRef;
|
||||
public journalObservable = new BehaviorSubject<Journal[]>([]);
|
||||
dataSource: JournalDataSource = new JournalDataSource(this.journalObservable);
|
||||
form: FormGroup;
|
||||
form: UntypedFormGroup;
|
||||
voucher: Voucher = new Voucher();
|
||||
account: Account | null;
|
||||
accBal: AccountBalance | null = null;
|
||||
@@ -49,7 +49,7 @@ export class JournalComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private fb: FormBuilder,
|
||||
private fb: UntypedFormBuilder,
|
||||
private dialog: MatDialog,
|
||||
private hotkeys: HotkeysService,
|
||||
private toaster: ToasterService,
|
||||
@@ -72,7 +72,7 @@ export class JournalComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
this.accBal = null;
|
||||
// Setup Account Autocomplete
|
||||
this.accounts = (
|
||||
(this.form.get('addRow') as FormControl).get('account') as FormControl
|
||||
(this.form.get('addRow') as UntypedFormControl).get('account') as UntypedFormControl
|
||||
).valueChanges.pipe(
|
||||
startWith(null),
|
||||
map((x) => (x !== null && x.length >= 1 ? x : null)),
|
||||
@@ -160,7 +160,7 @@ export class JournalComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
}
|
||||
|
||||
addRow() {
|
||||
const formValue = (this.form.get('addRow') as FormControl).value;
|
||||
const formValue = (this.form.get('addRow') as UntypedFormControl).value;
|
||||
const amount = this.math.journalAmount(formValue.amount, +formValue.debit);
|
||||
if (this.account === null || amount.amount === 0) {
|
||||
return;
|
||||
@@ -192,8 +192,8 @@ export class JournalComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
Math.abs(this.voucher.journals.map((x) => x.debit * x.amount).reduce((p, c) => p + c)),
|
||||
2,
|
||||
);
|
||||
const { debit } = (this.form.get('addRow') as FormControl).value;
|
||||
(this.form.get('addRow') as FormControl).reset({
|
||||
const { debit } = (this.form.get('addRow') as UntypedFormControl).value;
|
||||
(this.form.get('addRow') as UntypedFormControl).reset({
|
||||
debit,
|
||||
account: null,
|
||||
amount: `${amount}`,
|
||||
@@ -212,7 +212,7 @@ export class JournalComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
width: '750px',
|
||||
data: {
|
||||
journal: { ...row },
|
||||
date: moment((this.form.get('date') as FormControl).value).format('DD-MMM-YYYY'),
|
||||
date: moment((this.form.get('date') as UntypedFormControl).value).format('DD-MMM-YYYY'),
|
||||
},
|
||||
});
|
||||
|
||||
@@ -239,7 +239,7 @@ export class JournalComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
const amount = Math.abs(
|
||||
this.voucher.journals.map((x) => x.debit * x.amount).reduce((p, c) => p + c, 0),
|
||||
);
|
||||
(this.form.get('addRow') as FormControl).patchValue({
|
||||
(this.form.get('addRow') as UntypedFormControl).patchValue({
|
||||
amount,
|
||||
});
|
||||
}
|
||||
@@ -325,7 +325,7 @@ export class JournalComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
accountSelected(event: MatAutocompleteSelectedEvent): void {
|
||||
const account = event.option.value;
|
||||
this.account = account;
|
||||
const date = moment((this.form.get('date') as FormControl).value).format('DD-MMM-YYYY');
|
||||
const date = moment((this.form.get('date') as UntypedFormControl).value).format('DD-MMM-YYYY');
|
||||
this.accountSer.balance(account.id as string, date).subscribe((v) => {
|
||||
this.accBal = v;
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { AfterViewInit, Component, ElementRef, OnInit, ViewChild } from '@angular/core';
|
||||
import { FormBuilder, FormControl, FormGroup } from '@angular/forms';
|
||||
import { UntypedFormBuilder, UntypedFormControl, UntypedFormGroup } from '@angular/forms';
|
||||
import { MatAutocompleteSelectedEvent } from '@angular/material/autocomplete';
|
||||
import { MatPaginator } from '@angular/material/paginator';
|
||||
import { MatSort } from '@angular/material/sort';
|
||||
@@ -27,7 +27,7 @@ export class LedgerComponent implements OnInit, AfterViewInit {
|
||||
@ViewChild(MatSort, { static: true }) sort?: MatSort;
|
||||
info: Ledger = new Ledger();
|
||||
dataSource: LedgerDataSource = new LedgerDataSource(this.info.body);
|
||||
form: FormGroup;
|
||||
form: UntypedFormGroup;
|
||||
selectedRowId = '';
|
||||
debit = 0;
|
||||
credit = 0;
|
||||
@@ -40,7 +40,7 @@ export class LedgerComponent implements OnInit, AfterViewInit {
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private fb: FormBuilder,
|
||||
private fb: UntypedFormBuilder,
|
||||
private toCsv: ToCsvService,
|
||||
private ser: LedgerService,
|
||||
private accountSer: AccountService,
|
||||
@@ -51,7 +51,7 @@ export class LedgerComponent implements OnInit, AfterViewInit {
|
||||
account: '',
|
||||
});
|
||||
|
||||
this.accounts = (this.form.get('account') as FormControl).valueChanges.pipe(
|
||||
this.accounts = (this.form.get('account') as UntypedFormControl).valueChanges.pipe(
|
||||
startWith(null),
|
||||
map((x) => (x !== null && x.length >= 1 ? x : null)),
|
||||
debounceTime(150),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { FormBuilder, FormGroup } from '@angular/forms';
|
||||
import { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
|
||||
import { MatPaginator } from '@angular/material/paginator';
|
||||
import { MatSort } from '@angular/material/sort';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
@@ -18,12 +18,12 @@ export class NetTransactionsComponent implements OnInit {
|
||||
@ViewChild(MatSort, { static: true }) sort?: MatSort;
|
||||
info: NetTransactions = new NetTransactions();
|
||||
dataSource: NetTransactionsDataSource = new NetTransactionsDataSource(this.info.body);
|
||||
form: FormGroup;
|
||||
form: UntypedFormGroup;
|
||||
selectedRowId = '';
|
||||
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
|
||||
displayedColumns = ['type', 'name', 'debit', 'credit'];
|
||||
|
||||
constructor(private route: ActivatedRoute, private router: Router, private fb: FormBuilder) {
|
||||
constructor(private route: ActivatedRoute, private router: Router, private fb: UntypedFormBuilder) {
|
||||
this.form = this.fb.group({
|
||||
startDate: '',
|
||||
finishDate: '',
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Component, Inject, OnInit } from '@angular/core';
|
||||
import { FormBuilder, FormControl, FormGroup } from '@angular/forms';
|
||||
import { UntypedFormBuilder, UntypedFormControl, UntypedFormGroup } from '@angular/forms';
|
||||
import { MatAutocompleteSelectedEvent } from '@angular/material/autocomplete';
|
||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||
import { Observable, of as observableOf } from 'rxjs';
|
||||
@@ -18,14 +18,14 @@ import { MathService } from '../shared/math.service';
|
||||
})
|
||||
export class PaymentDialogComponent implements OnInit {
|
||||
accounts: Observable<Account[]>;
|
||||
form: FormGroup;
|
||||
form: UntypedFormGroup;
|
||||
account: Account = new Account();
|
||||
accBal: AccountBalance | null = null;
|
||||
|
||||
constructor(
|
||||
public dialogRef: MatDialogRef<PaymentDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: { journal: Journal; date: string },
|
||||
private fb: FormBuilder,
|
||||
private fb: UntypedFormBuilder,
|
||||
private math: MathService,
|
||||
private accountSer: AccountService,
|
||||
) {
|
||||
@@ -35,7 +35,7 @@ export class PaymentDialogComponent implements OnInit {
|
||||
});
|
||||
this.accBal = null;
|
||||
// Setup Account Autocomplete
|
||||
this.accounts = (this.form.get('account') as FormControl).valueChanges.pipe(
|
||||
this.accounts = (this.form.get('account') as UntypedFormControl).valueChanges.pipe(
|
||||
startWith(null),
|
||||
map((x) => (x !== null && x.length >= 1 ? x : null)),
|
||||
debounceTime(150),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { AfterViewInit, Component, ElementRef, OnInit, OnDestroy, ViewChild } from '@angular/core';
|
||||
import { FormBuilder, FormControl, FormGroup } from '@angular/forms';
|
||||
import { UntypedFormBuilder, UntypedFormControl, UntypedFormGroup } from '@angular/forms';
|
||||
import { MatAutocompleteSelectedEvent } from '@angular/material/autocomplete';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
@@ -37,7 +37,7 @@ export class PaymentComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
@ViewChild('dateElement', { static: true }) dateElement?: ElementRef;
|
||||
public journalObservable = new BehaviorSubject<Journal[]>([]);
|
||||
dataSource: PaymentDataSource = new PaymentDataSource(this.journalObservable);
|
||||
form: FormGroup;
|
||||
form: UntypedFormGroup;
|
||||
paymentAccounts: Account[] = [];
|
||||
paymentJournal: Journal = new Journal();
|
||||
voucher: Voucher = new Voucher();
|
||||
@@ -51,7 +51,7 @@ export class PaymentComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private fb: FormBuilder,
|
||||
private fb: UntypedFormBuilder,
|
||||
private dialog: MatDialog,
|
||||
private hotkeys: HotkeysService,
|
||||
private toaster: ToasterService,
|
||||
@@ -75,7 +75,7 @@ export class PaymentComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
this.accBal = null;
|
||||
// Listen to Account Autocomplete Change
|
||||
this.accounts = (
|
||||
(this.form.get('addRow') as FormControl).get('account') as FormControl
|
||||
(this.form.get('addRow') as UntypedFormControl).get('account') as UntypedFormControl
|
||||
).valueChanges.pipe(
|
||||
startWith(null),
|
||||
map((x) => (x !== null && x.length >= 1 ? x : null)),
|
||||
@@ -84,7 +84,7 @@ export class PaymentComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
switchMap((x) => (x === null ? observableOf([]) : this.accountSer.autocomplete(x))),
|
||||
);
|
||||
// Listen to Payment Account Change
|
||||
(this.form.get('paymentAccount') as FormControl).valueChanges.subscribe((x) =>
|
||||
(this.form.get('paymentAccount') as UntypedFormControl).valueChanges.subscribe((x) =>
|
||||
this.router.navigate([], {
|
||||
relativeTo: this.route,
|
||||
queryParams: { a: x },
|
||||
@@ -174,7 +174,7 @@ export class PaymentComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
}
|
||||
|
||||
addRow() {
|
||||
const amount = this.math.parseAmount((this.form.get('addRow') as FormControl).value.amount, 2);
|
||||
const amount = this.math.parseAmount((this.form.get('addRow') as UntypedFormControl).value.amount, 2);
|
||||
const debit = 1;
|
||||
if (this.account === null || amount <= 0) {
|
||||
return;
|
||||
@@ -203,7 +203,7 @@ export class PaymentComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
}
|
||||
|
||||
resetAddRow() {
|
||||
(this.form.get('addRow') as FormControl).reset({
|
||||
(this.form.get('addRow') as UntypedFormControl).reset({
|
||||
account: null,
|
||||
amount: null,
|
||||
});
|
||||
@@ -223,7 +223,7 @@ export class PaymentComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
Math.abs(journals.map((x) => x.amount).reduce((p, c) => p + c, 0)),
|
||||
2,
|
||||
);
|
||||
(this.form.get('paymentAmount') as FormControl).setValue(this.paymentJournal.amount);
|
||||
(this.form.get('paymentAmount') as UntypedFormControl).setValue(this.paymentJournal.amount);
|
||||
}
|
||||
|
||||
editRow(row: Journal) {
|
||||
@@ -231,7 +231,7 @@ export class PaymentComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
width: '750px',
|
||||
data: {
|
||||
journal: { ...row },
|
||||
date: moment((this.form.get('date') as FormControl).value).format('DD-MMM-YYYY'),
|
||||
date: moment((this.form.get('date') as UntypedFormControl).value).format('DD-MMM-YYYY'),
|
||||
},
|
||||
});
|
||||
|
||||
@@ -338,7 +338,7 @@ export class PaymentComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
accountSelected(event: MatAutocompleteSelectedEvent): void {
|
||||
const account = event.option.value;
|
||||
this.account = account;
|
||||
const date = moment((this.form.get('date') as FormControl).value).format('DD-MMM-YYYY');
|
||||
const date = moment((this.form.get('date') as UntypedFormControl).value).format('DD-MMM-YYYY');
|
||||
this.accountSer.balance(account.id as string, date).subscribe((v) => {
|
||||
this.accBal = v;
|
||||
});
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
import { AfterViewInit, Component, ElementRef, OnInit, ViewChild } from '@angular/core';
|
||||
import { FormBuilder, FormGroup } from '@angular/forms';
|
||||
import { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
|
||||
import { ProductGroup } from '../../core/product-group';
|
||||
@@ -13,13 +13,13 @@ import { ProductGroupService } from '../product-group.service';
|
||||
})
|
||||
export class ProductGroupDetailComponent implements OnInit, AfterViewInit {
|
||||
@ViewChild('nameElement', { static: true }) nameElement?: ElementRef;
|
||||
form: FormGroup;
|
||||
form: UntypedFormGroup;
|
||||
item: ProductGroup = new ProductGroup();
|
||||
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private fb: FormBuilder,
|
||||
private fb: UntypedFormBuilder,
|
||||
private toaster: ToasterService,
|
||||
private ser: ProductGroupService,
|
||||
) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { AfterViewInit, Component, ElementRef, OnInit, ViewChild } from '@angular/core';
|
||||
import { FormBuilder, FormControl, FormGroup } from '@angular/forms';
|
||||
import { UntypedFormBuilder, UntypedFormControl, UntypedFormGroup } from '@angular/forms';
|
||||
import { MatAutocompleteSelectedEvent } from '@angular/material/autocomplete';
|
||||
import { MatPaginator } from '@angular/material/paginator';
|
||||
import { MatSort } from '@angular/material/sort';
|
||||
@@ -28,7 +28,7 @@ export class ProductLedgerComponent implements OnInit, AfterViewInit {
|
||||
@ViewChild(MatSort, { static: true }) sort?: MatSort;
|
||||
info: ProductLedger = new ProductLedger();
|
||||
dataSource: ProductLedgerDataSource = new ProductLedgerDataSource(this.info.body);
|
||||
form: FormGroup;
|
||||
form: UntypedFormGroup;
|
||||
selectedRowId = '';
|
||||
debitQuantity = 0;
|
||||
debitAmount = 0;
|
||||
@@ -55,7 +55,7 @@ export class ProductLedgerComponent implements OnInit, AfterViewInit {
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private fb: FormBuilder,
|
||||
private fb: UntypedFormBuilder,
|
||||
private toCsv: ToCsvService,
|
||||
private ser: ProductLedgerService,
|
||||
private productSer: ProductService,
|
||||
@@ -66,7 +66,7 @@ export class ProductLedgerComponent implements OnInit, AfterViewInit {
|
||||
product: '',
|
||||
});
|
||||
|
||||
this.products = (this.form.get('product') as FormControl).valueChanges.pipe(
|
||||
this.products = (this.form.get('product') as UntypedFormControl).valueChanges.pipe(
|
||||
startWith(null),
|
||||
map((x) => (x !== null && x.length >= 1 ? x : null)),
|
||||
debounceTime(150),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Component, Inject, OnInit } from '@angular/core';
|
||||
import { FormBuilder, FormGroup } from '@angular/forms';
|
||||
import { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
|
||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||
|
||||
import { StockKeepingUnit } from '../../core/product';
|
||||
@@ -10,13 +10,13 @@ import { StockKeepingUnit } from '../../core/product';
|
||||
styleUrls: ['./product-detail-dialog.component.css'],
|
||||
})
|
||||
export class ProductDetailDialogComponent implements OnInit {
|
||||
form: FormGroup;
|
||||
form: UntypedFormGroup;
|
||||
|
||||
constructor(
|
||||
public dialogRef: MatDialogRef<ProductDetailDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA)
|
||||
public data: { item: StockKeepingUnit; isSold: boolean; isPurchased: boolean },
|
||||
private fb: FormBuilder,
|
||||
private fb: UntypedFormBuilder,
|
||||
) {
|
||||
this.form = this.fb.group({
|
||||
units: '',
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { AfterViewInit, Component, ElementRef, OnInit, ViewChild } from '@angular/core';
|
||||
import { FormBuilder, FormControl, FormGroup } from '@angular/forms';
|
||||
import { UntypedFormBuilder, UntypedFormControl, UntypedFormGroup } from '@angular/forms';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { BehaviorSubject } from 'rxjs';
|
||||
@@ -20,7 +20,7 @@ import { ProductDetailDialogComponent } from './product-detail-dialog.component'
|
||||
})
|
||||
export class ProductDetailComponent implements OnInit, AfterViewInit {
|
||||
@ViewChild('nameElement', { static: true }) nameElement?: ElementRef;
|
||||
form: FormGroup;
|
||||
form: UntypedFormGroup;
|
||||
productGroups: ProductGroup[] = [];
|
||||
public skus = new BehaviorSubject<StockKeepingUnit[]>([]);
|
||||
dataSource: ProductDetailDatasource = new ProductDetailDatasource(this.skus);
|
||||
@@ -32,7 +32,7 @@ export class ProductDetailComponent implements OnInit, AfterViewInit {
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private dialog: MatDialog,
|
||||
private fb: FormBuilder,
|
||||
private fb: UntypedFormBuilder,
|
||||
private toaster: ToasterService,
|
||||
private ser: ProductService,
|
||||
) {
|
||||
@@ -94,7 +94,7 @@ export class ProductDetailComponent implements OnInit, AfterViewInit {
|
||||
}
|
||||
|
||||
addRow() {
|
||||
const formValue = (this.form.get('addRow') as FormControl).value;
|
||||
const formValue = (this.form.get('addRow') as UntypedFormControl).value;
|
||||
const fraction = +formValue.fraction;
|
||||
if (fraction < 1) {
|
||||
this.toaster.show('Danger', 'Fraction has to be >= 1');
|
||||
@@ -129,7 +129,7 @@ export class ProductDetailComponent implements OnInit, AfterViewInit {
|
||||
}
|
||||
|
||||
resetAddRow() {
|
||||
(this.form.get('addRow') as FormControl).reset({
|
||||
(this.form.get('addRow') as UntypedFormControl).reset({
|
||||
units: '',
|
||||
fraction: '',
|
||||
productYield: '',
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { AfterViewInit, Component, ElementRef, OnInit, ViewChild } from '@angular/core';
|
||||
import { FormBuilder, FormControl, FormGroup } from '@angular/forms';
|
||||
import { UntypedFormBuilder, UntypedFormControl, UntypedFormGroup } from '@angular/forms';
|
||||
import { MatPaginator } from '@angular/material/paginator';
|
||||
import { MatSort } from '@angular/material/sort';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
@@ -23,18 +23,18 @@ export class ProductListComponent implements OnInit, AfterViewInit {
|
||||
list: Product[] = [];
|
||||
filter: Observable<string>;
|
||||
dataSource: ProductListDataSource;
|
||||
form: FormGroup;
|
||||
form: UntypedFormGroup;
|
||||
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
|
||||
displayedColumns: string[] = [];
|
||||
|
||||
private _showExtended = true;
|
||||
|
||||
constructor(private route: ActivatedRoute, private fb: FormBuilder, private toCsv: ToCsvService) {
|
||||
constructor(private route: ActivatedRoute, private fb: UntypedFormBuilder, private toCsv: ToCsvService) {
|
||||
this.showExtended = true;
|
||||
this.form = this.fb.group({
|
||||
filter: '',
|
||||
});
|
||||
this.filter = (this.form.get('filter') as FormControl).valueChanges.pipe(
|
||||
this.filter = (this.form.get('filter') as UntypedFormControl).valueChanges.pipe(
|
||||
startWith(''),
|
||||
debounceTime(150),
|
||||
distinctUntilChanged(),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { FormBuilder, FormGroup } from '@angular/forms';
|
||||
import { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
|
||||
import { MatPaginator } from '@angular/material/paginator';
|
||||
import { MatSort } from '@angular/material/sort';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
@@ -18,12 +18,12 @@ export class ProfitLossComponent implements OnInit {
|
||||
@ViewChild(MatSort, { static: true }) sort?: MatSort;
|
||||
info: ProfitLoss = new ProfitLoss();
|
||||
dataSource: ProfitLossDataSource = new ProfitLossDataSource(this.info.body);
|
||||
form: FormGroup;
|
||||
form: UntypedFormGroup;
|
||||
selectedRowId = '';
|
||||
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
|
||||
displayedColumns = ['group', 'name', 'amount', 'total'];
|
||||
|
||||
constructor(private route: ActivatedRoute, private router: Router, private fb: FormBuilder) {
|
||||
constructor(private route: ActivatedRoute, private router: Router, private fb: UntypedFormBuilder) {
|
||||
this.form = this.fb.group({
|
||||
startDate: '',
|
||||
finishDate: '',
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { FormBuilder, FormGroup } from '@angular/forms';
|
||||
import { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
|
||||
import { MatPaginator } from '@angular/material/paginator';
|
||||
import { MatSort } from '@angular/material/sort';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
@@ -18,7 +18,7 @@ export class PurchaseEntriesComponent implements OnInit {
|
||||
@ViewChild(MatSort, { static: true }) sort?: MatSort;
|
||||
info: PurchaseEntries = new PurchaseEntries();
|
||||
dataSource: PurchaseEntriesDataSource = new PurchaseEntriesDataSource(this.info.body);
|
||||
form: FormGroup;
|
||||
form: UntypedFormGroup;
|
||||
selectedRowId = '';
|
||||
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
|
||||
displayedColumns = [
|
||||
@@ -32,7 +32,7 @@ export class PurchaseEntriesComponent implements OnInit {
|
||||
'amount',
|
||||
];
|
||||
|
||||
constructor(private route: ActivatedRoute, private router: Router, private fb: FormBuilder) {
|
||||
constructor(private route: ActivatedRoute, private router: Router, private fb: UntypedFormBuilder) {
|
||||
this.form = this.fb.group({
|
||||
startDate: '',
|
||||
finishDate: '',
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Component, Inject, OnInit } from '@angular/core';
|
||||
import { FormBuilder, FormControl, FormGroup } from '@angular/forms';
|
||||
import { UntypedFormBuilder, UntypedFormControl, UntypedFormGroup } from '@angular/forms';
|
||||
import { MatAutocompleteSelectedEvent } from '@angular/material/autocomplete';
|
||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||
import { Observable } from 'rxjs';
|
||||
@@ -17,13 +17,13 @@ import { MathService } from '../shared/math.service';
|
||||
})
|
||||
export class PurchaseReturnDialogComponent implements OnInit {
|
||||
batches: Observable<Batch[]>;
|
||||
form: FormGroup;
|
||||
form: UntypedFormGroup;
|
||||
batch: Batch = new Batch();
|
||||
|
||||
constructor(
|
||||
public dialogRef: MatDialogRef<PurchaseReturnDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: { inventory: Inventory; date: string },
|
||||
private fb: FormBuilder,
|
||||
private fb: UntypedFormBuilder,
|
||||
private math: MathService,
|
||||
private batchSer: BatchService,
|
||||
) {
|
||||
@@ -32,7 +32,7 @@ export class PurchaseReturnDialogComponent implements OnInit {
|
||||
quantity: '',
|
||||
});
|
||||
// Listen to Batch Autocomplete Change
|
||||
this.batches = (this.form.get('batch') as FormControl).valueChanges.pipe(
|
||||
this.batches = (this.form.get('batch') as UntypedFormControl).valueChanges.pipe(
|
||||
startWith('null'),
|
||||
debounceTime(150),
|
||||
distinctUntilChanged(),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { AfterViewInit, Component, ElementRef, OnInit, OnDestroy, ViewChild } from '@angular/core';
|
||||
import { FormBuilder, FormControl, FormGroup } from '@angular/forms';
|
||||
import { UntypedFormBuilder, UntypedFormControl, UntypedFormGroup } from '@angular/forms';
|
||||
import { MatAutocompleteSelectedEvent } from '@angular/material/autocomplete';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
@@ -40,7 +40,7 @@ export class PurchaseReturnComponent implements OnInit, AfterViewInit, OnDestroy
|
||||
@ViewChild('dateElement', { static: true }) dateElement?: ElementRef;
|
||||
public inventoryObservable = new BehaviorSubject<Inventory[]>([]);
|
||||
dataSource: PurchaseReturnDataSource = new PurchaseReturnDataSource(this.inventoryObservable);
|
||||
form: FormGroup;
|
||||
form: UntypedFormGroup;
|
||||
voucher: Voucher = new Voucher();
|
||||
batch: Batch | null = null;
|
||||
accBal: AccountBalance | null = null;
|
||||
@@ -53,7 +53,7 @@ export class PurchaseReturnComponent implements OnInit, AfterViewInit, OnDestroy
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private fb: FormBuilder,
|
||||
private fb: UntypedFormBuilder,
|
||||
private dialog: MatDialog,
|
||||
private hotkeys: HotkeysService,
|
||||
private toaster: ToasterService,
|
||||
@@ -75,7 +75,7 @@ export class PurchaseReturnComponent implements OnInit, AfterViewInit, OnDestroy
|
||||
narration: '',
|
||||
});
|
||||
// Listen to Account Autocomplete Change
|
||||
this.accounts = (this.form.get('account') as FormControl).valueChanges.pipe(
|
||||
this.accounts = (this.form.get('account') as UntypedFormControl).valueChanges.pipe(
|
||||
startWith(null),
|
||||
map((x) => (x !== null && x.length >= 1 ? x : null)),
|
||||
debounceTime(150),
|
||||
@@ -84,7 +84,7 @@ export class PurchaseReturnComponent implements OnInit, AfterViewInit, OnDestroy
|
||||
);
|
||||
// Listen to Batch Autocomplete Change
|
||||
this.batches = (
|
||||
(this.form.get('addRow') as FormControl).get('batch') as FormControl
|
||||
(this.form.get('addRow') as UntypedFormControl).get('batch') as UntypedFormControl
|
||||
).valueChanges.pipe(
|
||||
startWith(''),
|
||||
debounceTime(150),
|
||||
@@ -174,7 +174,7 @@ export class PurchaseReturnComponent implements OnInit, AfterViewInit, OnDestroy
|
||||
}
|
||||
|
||||
addRow() {
|
||||
const formValue = (this.form.get('addRow') as FormControl).value;
|
||||
const formValue = (this.form.get('addRow') as UntypedFormControl).value;
|
||||
const quantity = this.math.parseAmount(formValue.quantity, 2);
|
||||
if (this.batch === null || quantity <= 0 || this.batch.quantityRemaining < quantity) {
|
||||
return;
|
||||
@@ -199,7 +199,7 @@ export class PurchaseReturnComponent implements OnInit, AfterViewInit, OnDestroy
|
||||
}
|
||||
|
||||
resetAddRow() {
|
||||
(this.form.get('addRow') as FormControl).reset({
|
||||
(this.form.get('addRow') as UntypedFormControl).reset({
|
||||
batch: null,
|
||||
quantity: '',
|
||||
});
|
||||
@@ -213,7 +213,7 @@ export class PurchaseReturnComponent implements OnInit, AfterViewInit, OnDestroy
|
||||
|
||||
updateView() {
|
||||
this.inventoryObservable.next(this.voucher.inventories);
|
||||
(this.form.get('amount') as FormControl).setValue(
|
||||
(this.form.get('amount') as UntypedFormControl).setValue(
|
||||
round(Math.abs(this.voucher.inventories.map((x) => x.amount).reduce((p, c) => p + c, 0)), 2),
|
||||
);
|
||||
}
|
||||
@@ -328,7 +328,7 @@ export class PurchaseReturnComponent implements OnInit, AfterViewInit, OnDestroy
|
||||
}
|
||||
|
||||
accountSelected(event: MatAutocompleteSelectedEvent): void {
|
||||
(this.form.get('account') as FormControl).setValue(event.option.value);
|
||||
(this.form.get('account') as UntypedFormControl).setValue(event.option.value);
|
||||
}
|
||||
|
||||
batchSelected(event: MatAutocompleteSelectedEvent): void {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Component, Inject, OnInit } from '@angular/core';
|
||||
import { FormBuilder, FormControl, FormGroup } from '@angular/forms';
|
||||
import { UntypedFormBuilder, UntypedFormControl, UntypedFormGroup } from '@angular/forms';
|
||||
import { MatAutocompleteSelectedEvent } from '@angular/material/autocomplete';
|
||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||
import { round } from 'mathjs';
|
||||
@@ -20,13 +20,13 @@ import { MathService } from '../shared/math.service';
|
||||
})
|
||||
export class PurchaseDialogComponent implements OnInit {
|
||||
products: Observable<ProductSku[]>;
|
||||
form: FormGroup;
|
||||
form: UntypedFormGroup;
|
||||
product: ProductSku = new ProductSku();
|
||||
|
||||
constructor(
|
||||
public dialogRef: MatDialogRef<PurchaseDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: { inventory: Inventory },
|
||||
private fb: FormBuilder,
|
||||
private fb: UntypedFormBuilder,
|
||||
private math: MathService,
|
||||
private productSer: ProductService,
|
||||
) {
|
||||
@@ -38,7 +38,7 @@ export class PurchaseDialogComponent implements OnInit {
|
||||
discount: '',
|
||||
});
|
||||
// Listen to Product Autocomplete Change
|
||||
this.products = (this.form.get('product') as FormControl).valueChanges.pipe(
|
||||
this.products = (this.form.get('product') as UntypedFormControl).valueChanges.pipe(
|
||||
startWith(null),
|
||||
map((x) => (x !== null && x.length >= 1 ? x : null)),
|
||||
debounceTime(150),
|
||||
@@ -64,7 +64,7 @@ export class PurchaseDialogComponent implements OnInit {
|
||||
|
||||
productSelected(event: MatAutocompleteSelectedEvent): void {
|
||||
this.product = event.option.value;
|
||||
(this.form.get('price') as FormControl).setValue(this.product.costPrice);
|
||||
(this.form.get('price') as UntypedFormControl).setValue(this.product.costPrice);
|
||||
}
|
||||
|
||||
accept(): void {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { AfterViewInit, Component, ElementRef, OnInit, OnDestroy, ViewChild } from '@angular/core';
|
||||
import { FormBuilder, FormControl, FormGroup } from '@angular/forms';
|
||||
import { UntypedFormBuilder, UntypedFormControl, UntypedFormGroup } from '@angular/forms';
|
||||
import { MatAutocompleteSelectedEvent } from '@angular/material/autocomplete';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
@@ -42,7 +42,7 @@ export class PurchaseComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
@ViewChild('dateElement', { static: true }) dateElement?: ElementRef;
|
||||
public inventoryObservable = new BehaviorSubject<Inventory[]>([]);
|
||||
dataSource: PurchaseDataSource = new PurchaseDataSource(this.inventoryObservable);
|
||||
form: FormGroup;
|
||||
form: UntypedFormGroup;
|
||||
voucher: Voucher = new Voucher();
|
||||
product: ProductSku | null = null;
|
||||
accBal: AccountBalance | null = null;
|
||||
@@ -55,7 +55,7 @@ export class PurchaseComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private fb: FormBuilder,
|
||||
private fb: UntypedFormBuilder,
|
||||
private dialog: MatDialog,
|
||||
private hotkeys: HotkeysService,
|
||||
private toaster: ToasterService,
|
||||
@@ -81,7 +81,7 @@ export class PurchaseComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
});
|
||||
this.accBal = null;
|
||||
// Listen to Account Autocomplete Change
|
||||
this.accounts = (this.form.get('account') as FormControl).valueChanges.pipe(
|
||||
this.accounts = (this.form.get('account') as UntypedFormControl).valueChanges.pipe(
|
||||
startWith(null),
|
||||
map((x) => (x !== null && x.length >= 1 ? x : null)),
|
||||
debounceTime(150),
|
||||
@@ -90,7 +90,7 @@ export class PurchaseComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
);
|
||||
// Listen to Product Autocomplete Change
|
||||
this.products = (
|
||||
(this.form.get('addRow') as FormControl).get('product') as FormControl
|
||||
(this.form.get('addRow') as UntypedFormControl).get('product') as UntypedFormControl
|
||||
).valueChanges.pipe(
|
||||
startWith(null),
|
||||
map((x) => (x !== null && x.length >= 1 ? x : null)),
|
||||
@@ -191,7 +191,7 @@ export class PurchaseComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
}
|
||||
|
||||
addRow() {
|
||||
const formValue = (this.form.get('addRow') as FormControl).value;
|
||||
const formValue = (this.form.get('addRow') as UntypedFormControl).value;
|
||||
const quantity = this.math.parseAmount(formValue.quantity, 2);
|
||||
if (this.product === null || quantity <= 0) {
|
||||
return;
|
||||
@@ -228,7 +228,7 @@ export class PurchaseComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
}
|
||||
|
||||
resetAddRow() {
|
||||
(this.form.get('addRow') as FormControl).reset({
|
||||
(this.form.get('addRow') as UntypedFormControl).reset({
|
||||
product: null,
|
||||
quantity: '',
|
||||
price: '',
|
||||
@@ -236,9 +236,9 @@ export class PurchaseComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
discount: '',
|
||||
});
|
||||
this.product = null;
|
||||
((this.form.get('addRow') as FormControl).get('price') as FormControl).enable();
|
||||
((this.form.get('addRow') as FormControl).get('tax') as FormControl).enable();
|
||||
((this.form.get('addRow') as FormControl).get('discount') as FormControl).enable();
|
||||
((this.form.get('addRow') as UntypedFormControl).get('price') as UntypedFormControl).enable();
|
||||
((this.form.get('addRow') as UntypedFormControl).get('tax') as UntypedFormControl).enable();
|
||||
((this.form.get('addRow') as UntypedFormControl).get('discount') as UntypedFormControl).enable();
|
||||
setTimeout(() => {
|
||||
if (this.productElement) {
|
||||
this.productElement.nativeElement.focus();
|
||||
@@ -248,7 +248,7 @@ export class PurchaseComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
|
||||
updateView() {
|
||||
this.inventoryObservable.next(this.voucher.inventories);
|
||||
(this.form.get('amount') as FormControl).setValue(
|
||||
(this.form.get('amount') as UntypedFormControl).setValue(
|
||||
round(Math.abs(this.voucher.inventories.map((x) => x.amount).reduce((p, c) => p + c, 0)), 2),
|
||||
);
|
||||
}
|
||||
@@ -360,26 +360,26 @@ export class PurchaseComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
}
|
||||
|
||||
accountSelected(event: MatAutocompleteSelectedEvent): void {
|
||||
(this.form.get('account') as FormControl).setValue(event.option.value);
|
||||
(this.form.get('account') as UntypedFormControl).setValue(event.option.value);
|
||||
}
|
||||
|
||||
productSelected(event: MatAutocompleteSelectedEvent): void {
|
||||
const product: ProductSku = event.option.value;
|
||||
const addRowForm: FormControl = this.form.get('addRow') as FormControl;
|
||||
const addRowForm: UntypedFormControl = this.form.get('addRow') as UntypedFormControl;
|
||||
this.product = product;
|
||||
(addRowForm.get('price') as FormControl).setValue(product.costPrice);
|
||||
(addRowForm.get('price') as UntypedFormControl).setValue(product.costPrice);
|
||||
if (product.isRateContracted) {
|
||||
(addRowForm.get('price') as FormControl).disable();
|
||||
(addRowForm.get('tax') as FormControl).disable();
|
||||
(addRowForm.get('discount') as FormControl).disable();
|
||||
(addRowForm.get('tax') as FormControl).setValue('RC');
|
||||
(addRowForm.get('discount') as FormControl).setValue('RC');
|
||||
(addRowForm.get('price') as UntypedFormControl).disable();
|
||||
(addRowForm.get('tax') as UntypedFormControl).disable();
|
||||
(addRowForm.get('discount') as UntypedFormControl).disable();
|
||||
(addRowForm.get('tax') as UntypedFormControl).setValue('RC');
|
||||
(addRowForm.get('discount') as UntypedFormControl).setValue('RC');
|
||||
} else {
|
||||
(addRowForm.get('price') as FormControl).enable();
|
||||
(addRowForm.get('tax') as FormControl).enable();
|
||||
(addRowForm.get('discount') as FormControl).enable();
|
||||
(addRowForm.get('tax') as FormControl).setValue('');
|
||||
(addRowForm.get('discount') as FormControl).setValue('');
|
||||
(addRowForm.get('price') as UntypedFormControl).enable();
|
||||
(addRowForm.get('tax') as UntypedFormControl).enable();
|
||||
(addRowForm.get('discount') as UntypedFormControl).enable();
|
||||
(addRowForm.get('tax') as UntypedFormControl).setValue('');
|
||||
(addRowForm.get('discount') as UntypedFormControl).setValue('');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { FormBuilder, FormGroup } from '@angular/forms';
|
||||
import { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
|
||||
import { MatPaginator } from '@angular/material/paginator';
|
||||
import { MatSort } from '@angular/material/sort';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
@@ -19,12 +19,12 @@ export class PurchasesComponent implements OnInit {
|
||||
@ViewChild(MatSort, { static: true }) sort?: MatSort;
|
||||
info: Purchases = new Purchases();
|
||||
dataSource: PurchasesDataSource = new PurchasesDataSource(this.info.body);
|
||||
form: FormGroup;
|
||||
form: UntypedFormGroup;
|
||||
selectedRowId = '';
|
||||
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
|
||||
displayedColumns = ['product', 'quantity', 'rate', 'amount'];
|
||||
|
||||
constructor(private route: ActivatedRoute, private router: Router, private fb: FormBuilder) {
|
||||
constructor(private route: ActivatedRoute, private router: Router, private fb: UntypedFormBuilder) {
|
||||
this.form = this.fb.group({
|
||||
startDate: '',
|
||||
finishDate: '',
|
||||
|
||||
+8
-8
@@ -1,5 +1,5 @@
|
||||
import { AfterViewInit, Component, ElementRef, OnInit, ViewChild } from '@angular/core';
|
||||
import { FormBuilder, FormControl, FormGroup } from '@angular/forms';
|
||||
import { UntypedFormBuilder, UntypedFormControl, UntypedFormGroup } from '@angular/forms';
|
||||
import { MatAutocompleteSelectedEvent } from '@angular/material/autocomplete';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
@@ -31,7 +31,7 @@ export class RateContractDetailComponent implements OnInit, AfterViewInit {
|
||||
@ViewChild('productElement', { static: true }) productElement?: ElementRef;
|
||||
public itemsObservable = new BehaviorSubject<RateContractItem[]>([]);
|
||||
dataSource: RateContractDetailDatasource = new RateContractDetailDatasource(this.itemsObservable);
|
||||
form: FormGroup;
|
||||
form: UntypedFormGroup;
|
||||
item: RateContract = new RateContract();
|
||||
|
||||
product: Product | null = null;
|
||||
@@ -44,7 +44,7 @@ export class RateContractDetailComponent implements OnInit, AfterViewInit {
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private fb: FormBuilder,
|
||||
private fb: UntypedFormBuilder,
|
||||
private toaster: ToasterService,
|
||||
private dialog: MatDialog,
|
||||
private math: MathService,
|
||||
@@ -63,7 +63,7 @@ export class RateContractDetailComponent implements OnInit, AfterViewInit {
|
||||
}),
|
||||
narration: '',
|
||||
});
|
||||
this.accounts = (this.form.get('account') as FormControl).valueChanges.pipe(
|
||||
this.accounts = (this.form.get('account') as UntypedFormControl).valueChanges.pipe(
|
||||
startWith(null),
|
||||
map((x) => (x !== null && x.length >= 1 ? x : null)),
|
||||
debounceTime(150),
|
||||
@@ -72,7 +72,7 @@ export class RateContractDetailComponent implements OnInit, AfterViewInit {
|
||||
);
|
||||
// Listen to Product Autocomplete Change
|
||||
this.products = (
|
||||
(this.form.get('addRow') as FormControl).get('product') as FormControl
|
||||
(this.form.get('addRow') as UntypedFormControl).get('product') as UntypedFormControl
|
||||
).valueChanges.pipe(
|
||||
startWith(null),
|
||||
map((x) => (x !== null && x.length >= 1 ? x : null)),
|
||||
@@ -115,7 +115,7 @@ export class RateContractDetailComponent implements OnInit, AfterViewInit {
|
||||
}
|
||||
|
||||
addRow() {
|
||||
const formValue = (this.form.get('addRow') as FormControl).value;
|
||||
const formValue = (this.form.get('addRow') as UntypedFormControl).value;
|
||||
const price = this.math.parseAmount(formValue.price, 2);
|
||||
if (this.product === null || price <= 0) {
|
||||
return;
|
||||
@@ -136,7 +136,7 @@ export class RateContractDetailComponent implements OnInit, AfterViewInit {
|
||||
}
|
||||
|
||||
resetAddRow() {
|
||||
(this.form.get('addRow') as FormControl).reset({
|
||||
(this.form.get('addRow') as UntypedFormControl).reset({
|
||||
product: null,
|
||||
price: '',
|
||||
});
|
||||
@@ -157,7 +157,7 @@ export class RateContractDetailComponent implements OnInit, AfterViewInit {
|
||||
}
|
||||
|
||||
accountSelected(event: MatAutocompleteSelectedEvent): void {
|
||||
(this.form.get('account') as FormControl).setValue(event.option.value);
|
||||
(this.form.get('account') as UntypedFormControl).setValue(event.option.value);
|
||||
}
|
||||
|
||||
productSelected(event: MatAutocompleteSelectedEvent): void {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { FormBuilder, FormGroup } from '@angular/forms';
|
||||
import { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
|
||||
import { MatPaginator } from '@angular/material/paginator';
|
||||
import { MatSort } from '@angular/material/sort';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
@@ -20,7 +20,7 @@ export class RawMaterialCostComponent implements OnInit {
|
||||
@ViewChild(MatSort, { static: true }) sort?: MatSort;
|
||||
info: RawMaterialCost = new RawMaterialCost();
|
||||
dataSource: RawMaterialCostDataSource = new RawMaterialCostDataSource(this.info.body);
|
||||
form: FormGroup;
|
||||
form: UntypedFormGroup;
|
||||
debitQuantity = 0;
|
||||
debitAmount = 0;
|
||||
creditQuantity = 0;
|
||||
@@ -35,7 +35,7 @@ export class RawMaterialCostComponent implements OnInit {
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private fb: FormBuilder,
|
||||
private fb: UntypedFormBuilder,
|
||||
private toCsv: ToCsvService,
|
||||
) {
|
||||
this.form = this.fb.group({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Component, Inject, OnInit } from '@angular/core';
|
||||
import { FormBuilder, FormControl, FormGroup } from '@angular/forms';
|
||||
import { UntypedFormBuilder, UntypedFormControl, UntypedFormGroup } from '@angular/forms';
|
||||
import { MatAutocompleteSelectedEvent } from '@angular/material/autocomplete';
|
||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||
import { Observable, of as observableOf } from 'rxjs';
|
||||
@@ -18,14 +18,14 @@ import { MathService } from '../shared/math.service';
|
||||
})
|
||||
export class ReceiptDialogComponent implements OnInit {
|
||||
accounts: Observable<Account[]>;
|
||||
form: FormGroup;
|
||||
form: UntypedFormGroup;
|
||||
account: Account = new Account();
|
||||
accBal: AccountBalance | null = null;
|
||||
|
||||
constructor(
|
||||
public dialogRef: MatDialogRef<ReceiptDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: { journal: Journal; date: string },
|
||||
private fb: FormBuilder,
|
||||
private fb: UntypedFormBuilder,
|
||||
private math: MathService,
|
||||
private accountSer: AccountService,
|
||||
) {
|
||||
@@ -35,7 +35,7 @@ export class ReceiptDialogComponent implements OnInit {
|
||||
});
|
||||
this.accBal = null;
|
||||
// Setup Account Autocomplete
|
||||
this.accounts = (this.form.get('account') as FormControl).valueChanges.pipe(
|
||||
this.accounts = (this.form.get('account') as UntypedFormControl).valueChanges.pipe(
|
||||
startWith(null),
|
||||
map((x) => (x !== null && x.length >= 1 ? x : null)),
|
||||
debounceTime(150),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { AfterViewInit, Component, ElementRef, OnInit, OnDestroy, ViewChild } from '@angular/core';
|
||||
import { FormBuilder, FormControl, FormGroup } from '@angular/forms';
|
||||
import { UntypedFormBuilder, UntypedFormControl, UntypedFormGroup } from '@angular/forms';
|
||||
import { MatAutocompleteSelectedEvent } from '@angular/material/autocomplete';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
@@ -37,7 +37,7 @@ export class ReceiptComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
@ViewChild('dateElement', { static: true }) dateElement?: ElementRef;
|
||||
public journalObservable = new BehaviorSubject<Journal[]>([]);
|
||||
dataSource: ReceiptDataSource = new ReceiptDataSource(this.journalObservable);
|
||||
form: FormGroup;
|
||||
form: UntypedFormGroup;
|
||||
receiptAccounts: Account[] = [];
|
||||
receiptJournal: Journal = new Journal();
|
||||
voucher: Voucher = new Voucher();
|
||||
@@ -51,7 +51,7 @@ export class ReceiptComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private fb: FormBuilder,
|
||||
private fb: UntypedFormBuilder,
|
||||
private dialog: MatDialog,
|
||||
private hotkeys: HotkeysService,
|
||||
private toaster: ToasterService,
|
||||
@@ -74,7 +74,7 @@ export class ReceiptComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
this.accBal = null;
|
||||
// Listen to Account Autocomplete Change
|
||||
this.accounts = (
|
||||
(this.form.get('addRow') as FormControl).get('account') as FormControl
|
||||
(this.form.get('addRow') as UntypedFormControl).get('account') as UntypedFormControl
|
||||
).valueChanges.pipe(
|
||||
startWith(null),
|
||||
map((x) => (x !== null && x.length >= 1 ? x : null)),
|
||||
@@ -83,7 +83,7 @@ export class ReceiptComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
switchMap((x) => (x === null ? observableOf([]) : this.accountSer.autocomplete(x))),
|
||||
);
|
||||
// Listen to Receipt Account Change
|
||||
(this.form.get('receiptAccount') as FormControl).valueChanges.subscribe((x) =>
|
||||
(this.form.get('receiptAccount') as UntypedFormControl).valueChanges.subscribe((x) =>
|
||||
this.router.navigate([], {
|
||||
relativeTo: this.route,
|
||||
queryParams: { a: x },
|
||||
@@ -173,7 +173,7 @@ export class ReceiptComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
}
|
||||
|
||||
addRow() {
|
||||
const amount = this.math.parseAmount((this.form.get('addRow') as FormControl).value.amount, 2);
|
||||
const amount = this.math.parseAmount((this.form.get('addRow') as UntypedFormControl).value.amount, 2);
|
||||
const debit = -1;
|
||||
if (this.account === null || amount <= 0) {
|
||||
return;
|
||||
@@ -202,7 +202,7 @@ export class ReceiptComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
}
|
||||
|
||||
resetAddRow() {
|
||||
(this.form.get('addRow') as FormControl).reset({
|
||||
(this.form.get('addRow') as UntypedFormControl).reset({
|
||||
account: null,
|
||||
amount: null,
|
||||
});
|
||||
@@ -222,7 +222,7 @@ export class ReceiptComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
Math.abs(journals.map((x) => x.amount).reduce((p, c) => p + c, 0)),
|
||||
2,
|
||||
);
|
||||
(this.form.get('receiptAmount') as FormControl).setValue(this.receiptJournal.amount);
|
||||
(this.form.get('receiptAmount') as UntypedFormControl).setValue(this.receiptJournal.amount);
|
||||
}
|
||||
|
||||
editRow(row: Journal) {
|
||||
@@ -230,7 +230,7 @@ export class ReceiptComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
width: '750px',
|
||||
data: {
|
||||
journal: { ...row },
|
||||
date: moment((this.form.get('date') as FormControl).value).format('DD-MMM-YYYY'),
|
||||
date: moment((this.form.get('date') as UntypedFormControl).value).format('DD-MMM-YYYY'),
|
||||
},
|
||||
});
|
||||
|
||||
@@ -337,7 +337,7 @@ export class ReceiptComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
accountSelected(event: MatAutocompleteSelectedEvent): void {
|
||||
const account = event.option.value;
|
||||
this.account = account;
|
||||
const date = moment((this.form.get('date') as FormControl).value).format('DD-MMM-YYYY');
|
||||
const date = moment((this.form.get('date') as UntypedFormControl).value).format('DD-MMM-YYYY');
|
||||
this.accountSer.balance(account.id as string, date).subscribe((v) => {
|
||||
this.accBal = v;
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { AfterViewInit, Component, ElementRef, OnInit, ViewChild } from '@angular/core';
|
||||
import { FormBuilder, FormControl, FormGroup } from '@angular/forms';
|
||||
import { UntypedFormBuilder, UntypedFormControl, UntypedFormGroup } from '@angular/forms';
|
||||
import { MatAutocompleteSelectedEvent } from '@angular/material/autocomplete';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
@@ -30,7 +30,7 @@ export class RecipeDetailComponent implements OnInit, AfterViewInit {
|
||||
@ViewChild('ingredientElement', { static: true }) ingredientElement?: ElementRef;
|
||||
public itemsObservable = new BehaviorSubject<RecipeItem[]>([]);
|
||||
dataSource: RecipeDetailDatasource = new RecipeDetailDatasource(this.itemsObservable);
|
||||
form: FormGroup;
|
||||
form: UntypedFormGroup;
|
||||
product: ProductSku | null;
|
||||
products: Observable<ProductSku[]>;
|
||||
ingredient: ProductSku | null;
|
||||
@@ -42,7 +42,7 @@ export class RecipeDetailComponent implements OnInit, AfterViewInit {
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private fb: FormBuilder,
|
||||
private fb: UntypedFormBuilder,
|
||||
private dialog: MatDialog,
|
||||
private toaster: ToasterService,
|
||||
private math: MathService,
|
||||
@@ -66,7 +66,7 @@ export class RecipeDetailComponent implements OnInit, AfterViewInit {
|
||||
}),
|
||||
});
|
||||
// Setup Product Autocomplete
|
||||
this.products = (this.form.get('product') as FormControl).valueChanges.pipe(
|
||||
this.products = (this.form.get('product') as UntypedFormControl).valueChanges.pipe(
|
||||
startWith(null),
|
||||
map((x) => (x !== null && x.length >= 1 ? x : null)),
|
||||
debounceTime(150),
|
||||
@@ -75,7 +75,7 @@ export class RecipeDetailComponent implements OnInit, AfterViewInit {
|
||||
);
|
||||
// Setup Product Autocomplete
|
||||
this.ingredients = (
|
||||
(this.form.get('addRow') as FormControl).get('ingredient') as FormControl
|
||||
(this.form.get('addRow') as UntypedFormControl).get('ingredient') as UntypedFormControl
|
||||
).valueChanges.pipe(
|
||||
startWith(null),
|
||||
map((x) => (x !== null && x.length >= 1 ? x : null)),
|
||||
@@ -133,8 +133,8 @@ export class RecipeDetailComponent implements OnInit, AfterViewInit {
|
||||
productSelected(event: MatAutocompleteSelectedEvent): void {
|
||||
const product: ProductSku = event.option.value;
|
||||
this.item.sku = product;
|
||||
(this.form.get('product') as FormControl).setValue(product);
|
||||
(this.form.get('salePrice') as FormControl).setValue('' + (product.salePrice ?? 0));
|
||||
(this.form.get('product') as UntypedFormControl).setValue(product);
|
||||
(this.form.get('salePrice') as UntypedFormControl).setValue('' + (product.salePrice ?? 0));
|
||||
}
|
||||
|
||||
ingredientSelected(event: MatAutocompleteSelectedEvent): void {
|
||||
@@ -144,14 +144,14 @@ export class RecipeDetailComponent implements OnInit, AfterViewInit {
|
||||
this.ser
|
||||
.getIngredientDetails(ingredient.id, item.validFrom, item.validTill)
|
||||
.subscribe((x) =>
|
||||
((this.form.get('addRow') as FormControl).get('rate') as FormControl).setValue(
|
||||
((this.form.get('addRow') as UntypedFormControl).get('rate') as UntypedFormControl).setValue(
|
||||
'' + x.costPrice,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
addRow() {
|
||||
const formValue = (this.form.get('addRow') as FormControl).value;
|
||||
const formValue = (this.form.get('addRow') as UntypedFormControl).value;
|
||||
const quantity = this.math.parseAmount(formValue.quantity, 2);
|
||||
const rate = this.math.parseAmount(formValue.rate, 2);
|
||||
if (this.ingredient === null || quantity <= 0 || rate <= 0) {
|
||||
@@ -176,7 +176,7 @@ export class RecipeDetailComponent implements OnInit, AfterViewInit {
|
||||
}
|
||||
|
||||
resetAddRow() {
|
||||
(this.form.get('addRow') as FormControl).reset({
|
||||
(this.form.get('addRow') as UntypedFormControl).reset({
|
||||
ingredient: null,
|
||||
quantity: '',
|
||||
rate: '',
|
||||
@@ -195,13 +195,13 @@ export class RecipeDetailComponent implements OnInit, AfterViewInit {
|
||||
this.item.items.map((x) => x.quantity * x.price).reduce((p, c) => p + c, 0),
|
||||
2,
|
||||
);
|
||||
(this.form.get('costPrice') as FormControl).setValue(costPrice);
|
||||
(this.form.get('costPrice') as UntypedFormControl).setValue(costPrice);
|
||||
const salePrice = this.math.parseAmount(this.form.value.salePrice, 2);
|
||||
if (salePrice < 0) {
|
||||
return;
|
||||
}
|
||||
const costPercentage = round((100 * costPrice) / salePrice, 2);
|
||||
(this.form.get('costPercentage') as FormControl).setValue(costPercentage);
|
||||
(this.form.get('costPercentage') as UntypedFormControl).setValue(costPercentage);
|
||||
}
|
||||
|
||||
deleteRow(row: RecipeItem) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { FormBuilder, FormGroup } from '@angular/forms';
|
||||
import { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
|
||||
import { MatPaginator } from '@angular/material/paginator';
|
||||
import { MatSort } from '@angular/material/sort';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
@@ -19,7 +19,7 @@ import { RecipeListDatasource } from './recipe-list-datasource';
|
||||
export class RecipeListComponent implements OnInit {
|
||||
@ViewChild(MatPaginator, { static: true }) paginator?: MatPaginator;
|
||||
@ViewChild(MatSort, { static: true }) sort?: MatSort;
|
||||
form: FormGroup;
|
||||
form: UntypedFormGroup;
|
||||
productGroups: ProductGroup[] = [];
|
||||
validFromFilter: BehaviorSubject<Date | null> = new BehaviorSubject<Date | null>(null);
|
||||
validTillFilter: BehaviorSubject<Date | null> = new BehaviorSubject<Date | null>(null);
|
||||
@@ -36,7 +36,7 @@ export class RecipeListComponent implements OnInit {
|
||||
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
|
||||
displayedColumns = ['name', 'validity', 'salePrice', 'costPrice', 'costPercentage'];
|
||||
|
||||
constructor(private route: ActivatedRoute, private fb: FormBuilder) {
|
||||
constructor(private route: ActivatedRoute, private fb: UntypedFormBuilder) {
|
||||
this.form = this.fb.group({
|
||||
validFrom: '',
|
||||
validTill: '',
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { AfterViewInit, Component, ElementRef, OnInit, ViewChild } from '@angular/core';
|
||||
import { FormArray, FormBuilder, FormControl, FormGroup } from '@angular/forms';
|
||||
import { UntypedFormArray, UntypedFormBuilder, UntypedFormControl, UntypedFormGroup } from '@angular/forms';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
|
||||
@@ -15,13 +15,13 @@ import { RoleService } from '../role.service';
|
||||
})
|
||||
export class RoleDetailComponent implements OnInit, AfterViewInit {
|
||||
@ViewChild('nameElement', { static: true }) nameElement?: ElementRef;
|
||||
form: FormGroup;
|
||||
form: UntypedFormGroup;
|
||||
item: Role = new Role();
|
||||
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private fb: FormBuilder,
|
||||
private fb: UntypedFormBuilder,
|
||||
private toaster: ToasterService,
|
||||
private dialog: MatDialog,
|
||||
private ser: RoleService,
|
||||
@@ -37,7 +37,7 @@ export class RoleDetailComponent implements OnInit, AfterViewInit {
|
||||
const data = value as { item: Role };
|
||||
|
||||
this.item = data.item;
|
||||
(this.form.get('name') as FormControl).setValue(this.item.name);
|
||||
(this.form.get('name') as UntypedFormControl).setValue(this.item.name);
|
||||
this.form.setControl(
|
||||
'permissions',
|
||||
this.fb.array(
|
||||
@@ -99,7 +99,7 @@ export class RoleDetailComponent implements OnInit, AfterViewInit {
|
||||
getItem(): Role {
|
||||
const formModel = this.form.value;
|
||||
this.item.name = formModel.name;
|
||||
const array = this.form.get('permissions') as FormArray;
|
||||
const array = this.form.get('permissions') as UntypedFormArray;
|
||||
this.item.permissions.forEach((item, index) => {
|
||||
item.enabled = array.controls[index].value.permission;
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { FormArray, FormBuilder, FormControl, FormGroup } from '@angular/forms';
|
||||
import { UntypedFormArray, UntypedFormBuilder, UntypedFormControl, UntypedFormGroup } from '@angular/forms';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import * as moment from 'moment';
|
||||
@@ -27,14 +27,14 @@ export class SettingsComponent implements OnInit {
|
||||
accountTypes: AccountType[] = [];
|
||||
voucherTypes: AccountType[] = [];
|
||||
|
||||
lockInfoForm: FormGroup;
|
||||
lockInfoForm: UntypedFormGroup;
|
||||
lockInformation: LockInfo[];
|
||||
lockOlder: boolean = false;
|
||||
olderRolling: boolean = false;
|
||||
lockNewer: boolean = false;
|
||||
newerRolling: boolean = false;
|
||||
|
||||
rebaseDataForm: FormGroup;
|
||||
rebaseDataForm: UntypedFormGroup;
|
||||
|
||||
maintenance: { enabled: boolean; user: string };
|
||||
|
||||
@@ -45,7 +45,7 @@ export class SettingsComponent implements OnInit {
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private fb: FormBuilder,
|
||||
private fb: UntypedFormBuilder,
|
||||
private dialog: MatDialog,
|
||||
private toaster: ToasterService,
|
||||
public auth: AuthService,
|
||||
@@ -120,16 +120,16 @@ export class SettingsComponent implements OnInit {
|
||||
}
|
||||
|
||||
listenToLockForm() {
|
||||
(this.lockInfoForm.get('lockOlder') as FormControl).valueChanges.subscribe((x) => {
|
||||
(this.lockInfoForm.get('lockOlder') as UntypedFormControl).valueChanges.subscribe((x) => {
|
||||
this.lockOlder = x;
|
||||
});
|
||||
(this.lockInfoForm.get('lockNewer') as FormControl).valueChanges.subscribe((x) => {
|
||||
(this.lockInfoForm.get('lockNewer') as UntypedFormControl).valueChanges.subscribe((x) => {
|
||||
this.lockNewer = x;
|
||||
});
|
||||
(this.lockInfoForm.get('olderRolling') as FormControl).valueChanges.subscribe((x) => {
|
||||
(this.lockInfoForm.get('olderRolling') as UntypedFormControl).valueChanges.subscribe((x) => {
|
||||
this.olderRolling = x;
|
||||
});
|
||||
(this.lockInfoForm.get('newerRolling') as FormControl).valueChanges.subscribe((x) => {
|
||||
(this.lockInfoForm.get('newerRolling') as UntypedFormControl).valueChanges.subscribe((x) => {
|
||||
this.newerRolling = x;
|
||||
});
|
||||
}
|
||||
@@ -137,44 +137,44 @@ export class SettingsComponent implements OnInit {
|
||||
saveLock() {
|
||||
const item = new LockInfo();
|
||||
if (this.lockOlder && this.olderRolling) {
|
||||
item.start.days = +(this.lockInfoForm.get('olderDays') as FormControl).value;
|
||||
item.start.days = +(this.lockInfoForm.get('olderDays') as UntypedFormControl).value;
|
||||
} else if (this.lockOlder && !this.olderRolling) {
|
||||
item.start.date = moment((this.lockInfoForm.get('olderDate') as FormControl).value).format(
|
||||
item.start.date = moment((this.lockInfoForm.get('olderDate') as UntypedFormControl).value).format(
|
||||
'DD-MMM-YYYY',
|
||||
);
|
||||
}
|
||||
if (this.lockNewer && this.newerRolling) {
|
||||
item.finish.days = +(this.lockInfoForm.get('newerDays') as FormControl).value;
|
||||
item.finish.days = +(this.lockInfoForm.get('newerDays') as UntypedFormControl).value;
|
||||
}
|
||||
if (this.lockNewer && !this.newerRolling) {
|
||||
item.finish.date = moment((this.lockInfoForm.get('newerDate') as FormControl).value).format(
|
||||
item.finish.date = moment((this.lockInfoForm.get('newerDate') as UntypedFormControl).value).format(
|
||||
'DD-MMM-YYYY',
|
||||
);
|
||||
}
|
||||
const atArray = this.lockInfoForm.get('accountTypes') as FormArray;
|
||||
const atArray = this.lockInfoForm.get('accountTypes') as UntypedFormArray;
|
||||
this.accountTypes.forEach((at, index) => {
|
||||
if (atArray.controls[index].value.accountType) {
|
||||
item.accountTypes.push({ id: at.id, name: at.name });
|
||||
}
|
||||
});
|
||||
|
||||
const vtArray = this.lockInfoForm.get('voucherTypes') as FormArray;
|
||||
const vtArray = this.lockInfoForm.get('voucherTypes') as UntypedFormArray;
|
||||
this.voucherTypes.forEach((vt, index) => {
|
||||
if (vtArray.controls[index].value.voucherType) {
|
||||
item.voucherTypes.push({ id: vt.id, name: vt.name });
|
||||
}
|
||||
});
|
||||
|
||||
const validFrom = (this.lockInfoForm.get('validFrom') as FormControl).value;
|
||||
const validFrom = (this.lockInfoForm.get('validFrom') as UntypedFormControl).value;
|
||||
if (validFrom) {
|
||||
item.validFrom = moment(validFrom).format('DD-MMM-YYYY');
|
||||
}
|
||||
|
||||
const validTill = (this.lockInfoForm.get('validTill') as FormControl).value;
|
||||
const validTill = (this.lockInfoForm.get('validTill') as UntypedFormControl).value;
|
||||
if (validTill) {
|
||||
item.validTill = moment(validTill).format('DD-MMM-YYYY');
|
||||
}
|
||||
item.index = +(this.lockInfoForm.get('index') as FormControl).value;
|
||||
item.index = +(this.lockInfoForm.get('index') as UntypedFormControl).value;
|
||||
|
||||
this.ser.setLockInformation(item).subscribe(
|
||||
(result) => {
|
||||
@@ -194,7 +194,7 @@ export class SettingsComponent implements OnInit {
|
||||
}
|
||||
|
||||
confirmRebase(): void {
|
||||
const rebaseDate = moment((this.rebaseDataForm.get('date') as FormControl).value).format(
|
||||
const rebaseDate = moment((this.rebaseDataForm.get('date') as UntypedFormControl).value).format(
|
||||
'DD-MMM-YYYY',
|
||||
);
|
||||
const dialogRef = this.dialog.open(ConfirmDialogComponent, {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { FormBuilder, FormGroup } from '@angular/forms';
|
||||
import { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
|
||||
import { MatPaginator } from '@angular/material/paginator';
|
||||
import { MatSort } from '@angular/material/sort';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
@@ -18,12 +18,12 @@ export class StockMovementComponent implements OnInit {
|
||||
@ViewChild(MatSort, { static: true }) sort?: MatSort;
|
||||
info: StockMovement = new StockMovement();
|
||||
dataSource: StockMovementDataSource = new StockMovementDataSource(this.info.body);
|
||||
form: FormGroup;
|
||||
form: UntypedFormGroup;
|
||||
selectedRowId = '';
|
||||
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
|
||||
displayedColumns = ['group', 'name', 'opening', 'purchase', 'issue', 'closing'];
|
||||
|
||||
constructor(private route: ActivatedRoute, private router: Router, private fb: FormBuilder) {
|
||||
constructor(private route: ActivatedRoute, private router: Router, private fb: UntypedFormBuilder) {
|
||||
this.form = this.fb.group({
|
||||
startDate: '',
|
||||
finishDate: '',
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { FormBuilder, FormGroup } from '@angular/forms';
|
||||
import { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
|
||||
import { MatPaginator } from '@angular/material/paginator';
|
||||
import { MatSort } from '@angular/material/sort';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
@@ -18,11 +18,11 @@ export class TrialBalanceComponent implements OnInit {
|
||||
@ViewChild(MatSort, { static: true }) sort?: MatSort;
|
||||
info: TrialBalance = new TrialBalance();
|
||||
dataSource: TrialBalanceDataSource = new TrialBalanceDataSource(this.info.body);
|
||||
form: FormGroup;
|
||||
form: UntypedFormGroup;
|
||||
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
|
||||
displayedColumns = ['type', 'name', 'debit', 'credit'];
|
||||
|
||||
constructor(private route: ActivatedRoute, private router: Router, private fb: FormBuilder) {
|
||||
constructor(private route: ActivatedRoute, private router: Router, private fb: UntypedFormBuilder) {
|
||||
this.form = this.fb.group({
|
||||
date: '',
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { AfterViewInit, Component, ElementRef, OnInit, ViewChild } from '@angular/core';
|
||||
import { FormArray, FormBuilder, FormControl, FormGroup } from '@angular/forms';
|
||||
import { UntypedFormArray, UntypedFormBuilder, UntypedFormControl, UntypedFormGroup } from '@angular/forms';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
|
||||
@@ -15,14 +15,14 @@ import { UserService } from '../user.service';
|
||||
})
|
||||
export class UserDetailComponent implements OnInit, AfterViewInit {
|
||||
@ViewChild('nameElement', { static: true }) nameElement?: ElementRef;
|
||||
form: FormGroup;
|
||||
form: UntypedFormGroup;
|
||||
item: User = new User();
|
||||
hide: boolean;
|
||||
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private fb: FormBuilder,
|
||||
private fb: UntypedFormBuilder,
|
||||
private toaster: ToasterService,
|
||||
private dialog: MatDialog,
|
||||
private ser: UserService,
|
||||
@@ -46,9 +46,9 @@ export class UserDetailComponent implements OnInit, AfterViewInit {
|
||||
|
||||
showItem(item: User) {
|
||||
this.item = item;
|
||||
(this.form.get('name') as FormControl).setValue(item.name);
|
||||
(this.form.get('password') as FormControl).setValue('');
|
||||
(this.form.get('lockedOut') as FormControl).setValue(item.lockedOut);
|
||||
(this.form.get('name') as UntypedFormControl).setValue(item.name);
|
||||
(this.form.get('password') as UntypedFormControl).setValue('');
|
||||
(this.form.get('lockedOut') as UntypedFormControl).setValue(item.lockedOut);
|
||||
this.form.setControl(
|
||||
'roles',
|
||||
this.fb.array(
|
||||
@@ -123,7 +123,7 @@ export class UserDetailComponent implements OnInit, AfterViewInit {
|
||||
this.item.name = formModel.name;
|
||||
this.item.password = formModel.password;
|
||||
this.item.lockedOut = formModel.lockedOut;
|
||||
const array = this.form.get('roles') as FormArray;
|
||||
const array = this.form.get('roles') as UntypedFormArray;
|
||||
this.item.roles.forEach((item, index) => {
|
||||
item.enabled = array.controls[index].value.role;
|
||||
});
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
"experimentalDecorators": true,
|
||||
"moduleResolution": "node",
|
||||
"importHelpers": true,
|
||||
"target": "es2017",
|
||||
"target": "es2020",
|
||||
"module": "es2020",
|
||||
"lib": [
|
||||
"es2018",
|
||||
|
||||
Reference in new issue
Block a user