|
|
|
|
@ -7,6 +7,7 @@ import { ActivatedRoute } from '@angular/router';
@@ -7,6 +7,7 @@ import { ActivatedRoute } from '@angular/router';
|
|
|
|
|
import { ApiService } from 'jslib/abstractions/api.service'; |
|
|
|
|
import { OrganizationTaxInfoUpdateRequest } from 'jslib/models/request/organizationTaxInfoUpdateRequest'; |
|
|
|
|
import { TaxInfoUpdateRequest } from 'jslib/models/request/taxInfoUpdateRequest'; |
|
|
|
|
import { TaxRateResponse } from 'jslib/models/response/taxRateResponse'; |
|
|
|
|
|
|
|
|
|
@Component({ |
|
|
|
|
selector: 'app-tax-info', |
|
|
|
|
@ -28,6 +29,8 @@ export class TaxInfoComponent {
@@ -28,6 +29,8 @@ export class TaxInfoComponent {
|
|
|
|
|
includeTaxId: false, |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
taxRates: TaxRateResponse[]; |
|
|
|
|
|
|
|
|
|
private pristine: any = { |
|
|
|
|
taxId: null, |
|
|
|
|
line1: null, |
|
|
|
|
@ -77,9 +80,22 @@ export class TaxInfoComponent {
@@ -77,9 +80,22 @@ export class TaxInfoComponent {
|
|
|
|
|
this.onCountryChanged.emit(); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
const taxRates = await this.apiService.getTaxRates(); |
|
|
|
|
this.taxRates = taxRates.data; |
|
|
|
|
this.loading = false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
get taxRate() { |
|
|
|
|
if (this.taxRates != null) { |
|
|
|
|
const localTaxRate = this.taxRates.find(x => |
|
|
|
|
x.country === this.taxInfo.country && |
|
|
|
|
x.postalCode === this.taxInfo.postalCode |
|
|
|
|
); |
|
|
|
|
return localTaxRate?.rate ?? null; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
getTaxInfoRequest(): TaxInfoUpdateRequest { |
|
|
|
|
if (this.organizationId) { |
|
|
|
|
const request = new OrganizationTaxInfoUpdateRequest(); |
|
|
|
|
|