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:
2023-03-05 23:50:41 +05:30
parent 802eded568
commit e46fe7f90e
141 changed files with 2197 additions and 892 deletions

View File

@ -1,5 +1,5 @@
import { AfterViewInit, Component, ElementRef, OnInit, ViewChild } from '@angular/core';
import { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
import { FormControl, FormGroup } from '@angular/forms';
import { MatDialog } from '@angular/material/dialog';
import { ActivatedRoute, Router } from '@angular/router';
@ -15,20 +15,22 @@ import { SectionService } from '../section.service';
})
export class SectionDetailComponent implements OnInit, AfterViewInit {
@ViewChild('nameElement', { static: true }) nameElement?: ElementRef;
form: UntypedFormGroup;
form: FormGroup<{
name: FormControl<string>;
}>;
item: Section = new Section();
constructor(
private route: ActivatedRoute,
private router: Router,
private dialog: MatDialog,
private fb: UntypedFormBuilder,
private toaster: ToasterService,
private ser: SectionService,
) {
// Create form
this.form = this.fb.group({
name: '',
this.form = new FormGroup({
name: new FormControl<string>('', { nonNullable: true }),
});
}
@ -42,7 +44,7 @@ export class SectionDetailComponent implements OnInit, AfterViewInit {
showItem(item: Section) {
this.item = item;
this.form.setValue({
name: this.item.name || '',
name: this.item.name ?? '',
});
}
@ -93,7 +95,7 @@ export class SectionDetailComponent implements OnInit, AfterViewInit {
getItem(): Section {
const formModel = this.form.value;
this.item.name = formModel.name;
this.item.name = formModel.name ?? '';
return this.item;
}
}