Feature: Tax Regimes are added so that different bills with different series can be printed for Different regimes such as VAT and GST
Chore: Model relationships updated to make them simpler Chore: Bill printing majorly refactored for it Due to the sheer depth of the changes. There can be showstoppers. Please test it carefully
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
import { AfterViewInit, Component, ElementRef, OnInit, ViewChild } from '@angular/core';
|
||||
import { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
|
||||
import { FormControl, FormGroup, Validators } from '@angular/forms';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
|
||||
import { ToasterService } from '../../core/toaster.service';
|
||||
@ -13,7 +13,11 @@ import { AuthService } from '../auth.service';
|
||||
})
|
||||
export class LoginComponent implements OnInit, AfterViewInit {
|
||||
@ViewChild('nameElement', { static: true }) nameElement?: ElementRef;
|
||||
form: UntypedFormGroup;
|
||||
form: FormGroup<{
|
||||
username: FormControl<string>;
|
||||
password: FormControl<string>;
|
||||
}>;
|
||||
|
||||
hide: boolean;
|
||||
unregisteredDevice: boolean;
|
||||
deviceName: string;
|
||||
@ -25,7 +29,6 @@ export class LoginComponent implements OnInit, AfterViewInit {
|
||||
private router: Router,
|
||||
private toaster: ToasterService,
|
||||
private cs: CookieService,
|
||||
private fb: UntypedFormBuilder,
|
||||
) {
|
||||
this.hide = true;
|
||||
this.unregisteredDevice = false;
|
||||
@ -33,15 +36,14 @@ export class LoginComponent implements OnInit, AfterViewInit {
|
||||
this.returnUrl = '';
|
||||
|
||||
// Create form
|
||||
this.form = this.fb.group({
|
||||
username: '',
|
||||
password: '',
|
||||
otp: '',
|
||||
this.form = new FormGroup({
|
||||
username: new FormControl('', { validators: Validators.required, nonNullable: true }),
|
||||
password: new FormControl('', { validators: Validators.required, nonNullable: true }),
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.returnUrl = this.route.snapshot.queryParams['returnUrl'] || '/';
|
||||
this.returnUrl = this.route.snapshot.queryParams['returnUrl'] ?? '/';
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
@ -54,8 +56,8 @@ export class LoginComponent implements OnInit, AfterViewInit {
|
||||
|
||||
login(): void {
|
||||
const formModel = this.form.value;
|
||||
const { username } = formModel;
|
||||
const { password } = formModel;
|
||||
const username = formModel.username ?? '';
|
||||
const password = formModel.password ?? '';
|
||||
this.auth
|
||||
.login(username.trim(), password.trim())
|
||||
// .pipe(first())
|
||||
|
||||
Reference in New Issue
Block a user