Skip to content

Commit

Permalink
for round trip disabling
Browse files Browse the repository at this point in the history
  • Loading branch information
suyashpatil78 committed Mar 11, 2024
1 parent 3aa7f12 commit 26d9faf
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,12 @@
>
</app-fy-alert-info>

<div class="route-selector-modal--internal-block" *ngIf="mileageLocations.controls.length < 3">
<mat-checkbox [disabled]="isAmountDisabled" formControlName="roundTrip">
<div
class="route-selector-modal--internal-block"
*ngIf="mileageLocations.controls.length < 3"
[ngClass]="{ 'route-selector-modal--input-disabled': !distance }"
>
<mat-checkbox [disabled]="!distance" formControlName="roundTrip">
<span class="route-selector-modal--checkbox"> Round Trip </span>
</mat-checkbox>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,12 @@
</ng-template>
</div>

<div class="route-selector--internal-block" *ngIf="mileageLocations.controls.length < 3">
<mat-checkbox [disabled]="isAmountDisabled || !form.controls.distance" formControlName="roundTrip">
<div
class="route-selector--internal-block"
*ngIf="mileageLocations.controls.length < 3"
[ngClass]="{ 'route-selector--input-disabled': isRoundTripEnabled }"
>
<mat-checkbox [disabled]="isRoundTripEnabled" formControlName="roundTrip">
<span class="route-selector--checkbox"> Round Trip </span>
</mat-checkbox>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ export class RouteSelectorComponent implements OnInit, ControlValueAccessor, OnD
return this.form.controls.mileageLocations as FormArray;
}

get isRoundTripEnabled(): boolean {
return this.isAmountDisabled || !this.form.controls.distance?.value;
}

onTouched = () => {};

ngDoCheck() {
Expand Down

0 comments on commit 26d9faf

Please sign in to comment.