[SG 435 & SG-436] Reusable org Component bug fixes (#3098)
* Disable submit button of formGroup is invalid * Fix F4E bug * Remove duplicate validation
This commit is contained in:
parent
0465168919
commit
f233b0cab7
|
@ -131,8 +131,6 @@
|
||||||
type="number"
|
type="number"
|
||||||
name="additionalSeats"
|
name="additionalSeats"
|
||||||
formControlName="additionalSeats"
|
formControlName="additionalSeats"
|
||||||
min="1"
|
|
||||||
max="100000"
|
|
||||||
placeholder="{{ 'userSeatsDesc' | i18n }}"
|
placeholder="{{ 'userSeatsDesc' | i18n }}"
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
|
@ -150,8 +148,6 @@
|
||||||
type="number"
|
type="number"
|
||||||
name="additionalSeats"
|
name="additionalSeats"
|
||||||
formControlName="additionalSeats"
|
formControlName="additionalSeats"
|
||||||
min="0"
|
|
||||||
max="100000"
|
|
||||||
placeholder="{{ 'userSeatsDesc' | i18n }}"
|
placeholder="{{ 'userSeatsDesc' | i18n }}"
|
||||||
/>
|
/>
|
||||||
<small class="text-muted form-text">{{
|
<small class="text-muted form-text">{{
|
||||||
|
@ -169,8 +165,6 @@
|
||||||
type="number"
|
type="number"
|
||||||
name="additionalStorageGb"
|
name="additionalStorageGb"
|
||||||
formControlName="additionalStorage"
|
formControlName="additionalStorage"
|
||||||
min="0"
|
|
||||||
max="99"
|
|
||||||
step="1"
|
step="1"
|
||||||
placeholder="{{ 'additionalStorageGbDesc' | i18n }}"
|
placeholder="{{ 'additionalStorageGbDesc' | i18n }}"
|
||||||
/>
|
/>
|
||||||
|
@ -323,10 +317,9 @@
|
||||||
<app-callout [type]="'error'">{{ "singleOrgBlockCreateMessage" | i18n }}</app-callout>
|
<app-callout [type]="'error'">{{ "singleOrgBlockCreateMessage" | i18n }}</app-callout>
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-4">
|
<div class="mt-4">
|
||||||
<button type="submit" class="btn btn-primary btn-submit" [disabled]="form.loading">
|
<bit-submit-button [loading]="form.loading" [disabled]="!formGroup.valid">{{
|
||||||
<i class="bwi bwi-spinner bwi-spin" title="{{ 'loading' | i18n }}" aria-hidden="true"></i>
|
"submit" | i18n
|
||||||
<span>{{ "submit" | i18n }}</span>
|
}}</bit-submit-button>
|
||||||
</button>
|
|
||||||
<button type="button" class="btn btn-outline-secondary" (click)="cancel()" *ngIf="showCancel">
|
<button type="button" class="btn btn-outline-secondary" (click)="cancel()" *ngIf="showCancel">
|
||||||
{{ "cancel" | i18n }}
|
{{ "cancel" | i18n }}
|
||||||
</button>
|
</button>
|
||||||
|
|
|
@ -52,8 +52,8 @@ export class OrganizationPlansComponent implements OnInit {
|
||||||
discount = 0;
|
discount = 0;
|
||||||
|
|
||||||
formGroup = this.formBuilder.group({
|
formGroup = this.formBuilder.group({
|
||||||
name: ["", [Validators.required]],
|
name: [""],
|
||||||
billingEmail: ["", [Validators.required, Validators.email]],
|
billingEmail: ["", [Validators.email]],
|
||||||
businessOwned: [false],
|
businessOwned: [false],
|
||||||
premiumAccessAddon: [false],
|
premiumAccessAddon: [false],
|
||||||
additionalStorage: [0, [Validators.min(0), Validators.max(99)]],
|
additionalStorage: [0, [Validators.min(0), Validators.max(99)]],
|
||||||
|
@ -96,11 +96,16 @@ export class OrganizationPlansComponent implements OnInit {
|
||||||
this.changedOwnedBusiness();
|
this.changedOwnedBusiness();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.createOrganization) {
|
if (!this.createOrganization || this.acceptingSponsorship) {
|
||||||
this.formGroup.controls.product.setValue(ProductType.Families);
|
this.formGroup.controls.product.setValue(ProductType.Families);
|
||||||
this.changedProduct();
|
this.changedProduct();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.createOrganization) {
|
||||||
|
this.formGroup.controls.name.addValidators(Validators.required);
|
||||||
|
this.formGroup.controls.billingEmail.addValidators(Validators.required);
|
||||||
|
}
|
||||||
|
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -255,6 +260,7 @@ export class OrganizationPlansComponent implements OnInit {
|
||||||
}
|
}
|
||||||
this.formGroup.controls.product.setValue(ProductType.Teams);
|
this.formGroup.controls.product.setValue(ProductType.Teams);
|
||||||
this.formGroup.controls.plan.setValue(PlanType.TeamsAnnually);
|
this.formGroup.controls.plan.setValue(PlanType.TeamsAnnually);
|
||||||
|
this.changedProduct();
|
||||||
}
|
}
|
||||||
|
|
||||||
changedCountry() {
|
changedCountry() {
|
||||||
|
|
Loading…
Reference in New Issue