diff --git a/src/app/app.module.ts b/src/app/app.module.ts index afc753a0cb..30e405e727 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -115,6 +115,7 @@ import { PremiumComponent } from './settings/premium.component'; import { ProfileComponent } from './settings/profile.component'; import { PurgeVaultComponent } from './settings/purge-vault.component'; import { SettingsComponent } from './settings/settings.component'; +import { TaxInfoComponent } from './settings/tax-info.component'; import { TwoFactorAuthenticatorComponent } from './settings/two-factor-authenticator.component'; import { TwoFactorDuoComponent } from './settings/two-factor-duo.component'; import { TwoFactorEmailComponent } from './settings/two-factor-email.component'; @@ -350,6 +351,7 @@ registerLocaleData(localeZhTw, 'zh-TW'); ShareComponent, StopClickDirective, StopPropDirective, + TaxInfoComponent, ToolsComponent, TrueFalseValueDirective, TwoFactorAuthenticatorComponent, diff --git a/src/app/organizations/settings/account.component.html b/src/app/organizations/settings/account.component.html index b5adb00f6c..b749de3b1b 100644 --- a/src/app/organizations/settings/account.component.html +++ b/src/app/organizations/settings/account.component.html @@ -49,321 +49,9 @@

{{'taxInformation' | i18n}}

{{'taxInformationDesc' | i18n}}

-
-
-
-
- - -
-
-
-
- - -
-
-
-
- - -
-
-
-
-
-
- - -
-
-
-
-
-
- - -
-
-
-
- - -
-
-
-
- - -
-
-
-
- - -
-
-
- diff --git a/src/app/organizations/settings/account.component.ts b/src/app/organizations/settings/account.component.ts index 65a252810b..80430ac14c 100644 --- a/src/app/organizations/settings/account.component.ts +++ b/src/app/organizations/settings/account.component.ts @@ -18,10 +18,10 @@ import { OrganizationResponse } from 'jslib/models/response/organizationResponse import { ModalComponent } from '../../modal.component'; import { PurgeVaultComponent } from '../../settings/purge-vault.component'; +import { TaxInfoComponent } from '../../settings/tax-info.component'; import { ApiKeyComponent } from './api-key.component'; import { DeleteOrganizationComponent } from './delete-organization.component'; import { RotateApiKeyComponent } from './rotate-api-key.component'; -import { OrganizationTaxInfoUpdateRequest } from 'jslib/models/request/organizationTaxInfoUpdateRequest'; @Component({ selector: 'app-org-account', @@ -32,21 +32,12 @@ export class AccountComponent { @ViewChild('purgeOrganizationTemplate', { read: ViewContainerRef }) purgeModalRef: ViewContainerRef; @ViewChild('apiKeyTemplate', { read: ViewContainerRef }) apiKeyModalRef: ViewContainerRef; @ViewChild('rotateApiKeyTemplate', { read: ViewContainerRef }) rotateApiKeyModalRef: ViewContainerRef; + @ViewChild(TaxInfoComponent) taxInfo: TaxInfoComponent; loading = true; canUseApi = false; org: OrganizationResponse; formPromise: Promise; - taxInfo: any = { - taxId: null, - line1: null, - line2: null, - city: null, - state: null, - postalCode: null, - country: 'US', - includeTaxId: false, - }; private organizationId: string; private modal: ModalComponent = null; @@ -62,23 +53,6 @@ export class AccountComponent { try { this.org = await this.apiService.getOrganization(this.organizationId); this.canUseApi = this.org.useApi; - const taxInfo = await this.apiService.getOrganizationTaxInfo(this.organizationId); - if (taxInfo) { - this.taxInfo.taxId = taxInfo.taxId; - this.taxInfo.state = taxInfo.state; - this.taxInfo.line1 = taxInfo.line1; - this.taxInfo.line2 = taxInfo.line2; - this.taxInfo.city = taxInfo.city; - this.taxInfo.state = taxInfo.state; - this.taxInfo.postalCode = taxInfo.postalCode; - this.taxInfo.country = taxInfo.country; - this.taxInfo.includeTaxId = taxInfo.country !== 'US' && ( - !!taxInfo.taxId - || !!taxInfo.line1 - || !!taxInfo.line2 - || !!taxInfo.city - || !!taxInfo.state); - } } catch { } }); this.loading = false; @@ -100,16 +74,7 @@ export class AccountComponent { } async submitTaxInfo() { - const request = new OrganizationTaxInfoUpdateRequest(); - request.taxId = this.taxInfo.taxId; - request.state = this.taxInfo.state; - request.line1 = this.taxInfo.line1; - request.line2 = this.taxInfo.line2; - request.city = this.taxInfo.city; - request.state = this.taxInfo.state; - request.postalCode = this.taxInfo.postalCode; - request.country = this.taxInfo.country; - this.formPromise = this.apiService.putOrganizationTaxInfo(this.organizationId, request); + this.formPromise = this.taxInfo.submitTaxInfo(); await this.formPromise; this.analytics.eventTrack.next({ action: 'Updated Organization Tax Info' }); this.toasterService.popAsync('success', null, this.i18nService.t('taxInfoUpdated')); @@ -175,15 +140,4 @@ export class AccountComponent { this.modal = null; }); } - - changeCountry() { - if (this.taxInfo.country === 'US') { - this.taxInfo.includeTaxId = false; - this.taxInfo.taxId = null; - this.taxInfo.line1 = null; - this.taxInfo.line2 = null; - this.taxInfo.city = null; - this.taxInfo.state = null; - } - } } diff --git a/src/app/services/services.module.ts b/src/app/services/services.module.ts index 6937e91cd6..2c5fa4481b 100644 --- a/src/app/services/services.module.ts +++ b/src/app/services/services.module.ts @@ -145,9 +145,9 @@ export function initFactory(): Function { } apiService.setUrls({ base: isDev ? null : window.location.origin, - api: isDev ? 'http://localhost:7064' : null, - identity: isDev ? 'http://localhost:5000' : null, - events: isDev ? 'http://localhost:46273' : null, + api: isDev ? 'http://localhost:5000' : null, + identity: isDev ? 'http://localhost:33657' : null, + events: isDev ? 'http://localhost:46274' : null, // Uncomment these (and comment out the above) if you want to target production // servers for local development. diff --git a/src/app/settings/add-credit.component.html b/src/app/settings/add-credit.component.html index 7ec14b9944..2e3a0e67d6 100644 --- a/src/app/settings/add-credit.component.html +++ b/src/app/settings/add-credit.component.html @@ -30,6 +30,7 @@ {{'creditDelayed' | i18n}} +

{{(currentType != null ? 'changePaymentMethod' : 'addPaymentMethod') | i18n}}

-
-
- - - {{'countryPostalCodeRequiredDesc' | i18n}} -
-
- - -
-
+