Fix: Add Tax was not working as TaxIn required a name with length more than 1.
This commit is contained in:
@ -2,6 +2,7 @@ import { AfterViewInit, Component, ElementRef, OnInit, ViewChild } from '@angula
|
||||
import { FormBuilder, FormGroup } from '@angular/forms';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { round } from 'mathjs';
|
||||
|
||||
import { Tax } from '../../core/tax';
|
||||
import { ToasterService } from '../../core/toaster.service';
|
||||
@ -44,7 +45,7 @@ export class TaxDetailComponent implements OnInit, AfterViewInit {
|
||||
this.item = item;
|
||||
this.form.setValue({
|
||||
name: this.item.name || '',
|
||||
rate: this.item.rate || '',
|
||||
rate: this.item.rate * 100,
|
||||
});
|
||||
}
|
||||
|
||||
@ -96,7 +97,7 @@ export class TaxDetailComponent implements OnInit, AfterViewInit {
|
||||
getItem(): Tax {
|
||||
const formModel = this.form.value;
|
||||
this.item.name = formModel.name;
|
||||
this.item.rate = +formModel.rate;
|
||||
this.item.rate = round(+formModel.rate / 100, 5);
|
||||
return this.item;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user