mirror of
https://github.com/bitwarden/browser
synced 2025-12-16 16:23:44 +00:00
[EC-8] Use CL in payment method component
This commit is contained in:
@@ -54,48 +54,25 @@
|
|||||||
#verifyForm
|
#verifyForm
|
||||||
class="form-inline"
|
class="form-inline"
|
||||||
(ngSubmit)="verifyBank()"
|
(ngSubmit)="verifyBank()"
|
||||||
|
[formGroup]="verifyBankForm"
|
||||||
[appApiAction]="verifyBankPromise"
|
[appApiAction]="verifyBankPromise"
|
||||||
ngNativeValidate
|
ngNativeValidate
|
||||||
>
|
>
|
||||||
<label class="sr-only" for="verifyAmount1">{{ "amount" | i18n: "1" }}</label>
|
<bit-form-field class="tw-mr-2 tw-w-40">
|
||||||
<div class="input-group mr-2">
|
<bit-label>{{ "amountX" | i18n: "1" }}</bit-label>
|
||||||
<div class="input-group-prepend">
|
<input bitInput type="number" step="1" placeholder="xx" formControlName="amount1" />
|
||||||
<div class="input-group-text">$0.</div>
|
<span bitPrefix>$0.</span>
|
||||||
</div>
|
</bit-form-field>
|
||||||
<input
|
<bit-form-field class="tw-mr-2 tw-w-40">
|
||||||
type="number"
|
<bit-label>{{ "amountX" | i18n: "2" }}</bit-label>
|
||||||
class="form-control"
|
<input bitInput type="number" step="1" placeholder="xx" formControlName="amount2" />
|
||||||
id="verifyAmount1"
|
<span bitPrefix>$0.</span>
|
||||||
placeholder="xx"
|
</bit-form-field>
|
||||||
name="Amount1"
|
|
||||||
[(ngModel)]="verifyAmount1"
|
|
||||||
min="1"
|
|
||||||
max="99"
|
|
||||||
step="1"
|
|
||||||
required
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<label class="sr-only" for="verifyAmount2">{{ "amount" | i18n: "2" }}</label>
|
|
||||||
<div class="input-group mr-2">
|
|
||||||
<div class="input-group-prepend">
|
|
||||||
<div class="input-group-text">$0.</div>
|
|
||||||
</div>
|
|
||||||
<input
|
|
||||||
type="number"
|
|
||||||
class="form-control"
|
|
||||||
id="verifyAmount2"
|
|
||||||
placeholder="xx"
|
|
||||||
name="Amount2"
|
|
||||||
[(ngModel)]="verifyAmount2"
|
|
||||||
min="1"
|
|
||||||
max="99"
|
|
||||||
step="1"
|
|
||||||
required
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<button
|
<button
|
||||||
|
bitButton
|
||||||
|
buttonType="primary"
|
||||||
type="submit"
|
type="submit"
|
||||||
class="btn btn-outline-primary btn-submit"
|
class="btn-submit"
|
||||||
[disabled]="verifyForm.loading"
|
[disabled]="verifyForm.loading"
|
||||||
>
|
>
|
||||||
<i class="bwi bwi-spinner bwi-spin" title="{{ 'loading' | i18n }}" aria-hidden="true"></i>
|
<i class="bwi bwi-spinner bwi-spin" title="{{ 'loading' | i18n }}" aria-hidden="true"></i>
|
||||||
@@ -138,7 +115,13 @@
|
|||||||
ngNativeValidate
|
ngNativeValidate
|
||||||
>
|
>
|
||||||
<app-tax-info></app-tax-info>
|
<app-tax-info></app-tax-info>
|
||||||
<button type="submit" class="btn btn-primary btn-submit" [disabled]="formTax.loading">
|
<button
|
||||||
|
bitButton
|
||||||
|
buttonType="primary"
|
||||||
|
type="submit"
|
||||||
|
class="btn-submit"
|
||||||
|
[disabled]="formTax.loading"
|
||||||
|
>
|
||||||
<i class="bwi bwi-spinner bwi-spin" title="{{ 'loading' | i18n }}" aria-hidden="true"></i>
|
<i class="bwi bwi-spinner bwi-spin" title="{{ 'loading' | i18n }}" aria-hidden="true"></i>
|
||||||
<span>{{ "save" | i18n }}</span>
|
<span>{{ "save" | i18n }}</span>
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { Component, OnInit, ViewChild } from "@angular/core";
|
import { Component, OnInit, ViewChild } from "@angular/core";
|
||||||
|
import { FormBuilder, FormControl, Validators } from "@angular/forms";
|
||||||
import { ActivatedRoute, Router } from "@angular/router";
|
import { ActivatedRoute, Router } from "@angular/router";
|
||||||
|
|
||||||
import { ApiService } from "@bitwarden/common/abstractions/api.service";
|
import { ApiService } from "@bitwarden/common/abstractions/api.service";
|
||||||
@@ -27,19 +28,31 @@ export class PaymentMethodComponent implements OnInit {
|
|||||||
org: OrganizationResponse;
|
org: OrganizationResponse;
|
||||||
paymentMethodType = PaymentMethodType;
|
paymentMethodType = PaymentMethodType;
|
||||||
organizationId: string;
|
organizationId: string;
|
||||||
verifyAmount1: number;
|
|
||||||
verifyAmount2: number;
|
|
||||||
|
|
||||||
verifyBankPromise: Promise<any>;
|
verifyBankPromise: Promise<any>;
|
||||||
taxFormPromise: Promise<any>;
|
taxFormPromise: Promise<any>;
|
||||||
|
|
||||||
|
verifyBankForm = this.formBuilder.group({
|
||||||
|
amount1: new FormControl<number>(null, [
|
||||||
|
Validators.required,
|
||||||
|
Validators.max(99),
|
||||||
|
Validators.min(0),
|
||||||
|
]),
|
||||||
|
amount2: new FormControl<number>(null, [
|
||||||
|
Validators.required,
|
||||||
|
Validators.max(99),
|
||||||
|
Validators.min(0),
|
||||||
|
]),
|
||||||
|
});
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
protected apiService: ApiService,
|
protected apiService: ApiService,
|
||||||
protected i18nService: I18nService,
|
protected i18nService: I18nService,
|
||||||
protected platformUtilsService: PlatformUtilsService,
|
protected platformUtilsService: PlatformUtilsService,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private logService: LogService,
|
private logService: LogService,
|
||||||
private route: ActivatedRoute
|
private route: ActivatedRoute,
|
||||||
|
private formBuilder: FormBuilder
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
@@ -123,8 +136,8 @@ export class PaymentMethodComponent implements OnInit {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const request = new VerifyBankRequest();
|
const request = new VerifyBankRequest();
|
||||||
request.amount1 = this.verifyAmount1;
|
request.amount1 = this.verifyBankForm.value.amount1;
|
||||||
request.amount2 = this.verifyAmount2;
|
request.amount2 = this.verifyBankForm.value.amount2;
|
||||||
this.verifyBankPromise = this.apiService.postOrganizationVerifyBank(
|
this.verifyBankPromise = this.apiService.postOrganizationVerifyBank(
|
||||||
this.organizationId,
|
this.organizationId,
|
||||||
request
|
request
|
||||||
|
|||||||
Reference in New Issue
Block a user