Merged PR 1792: #4610 Disable Option to Unselect Selected Customer Type

#4610 Disable Option to Unselect Selected Customer Type
This commit is contained in:
Nino Righi
2024-09-24 17:51:52 +00:00
committed by Lorenz Hilpert
parent 8723f7aa7e
commit eb6e93149e
2 changed files with 8 additions and 1 deletions

View File

@@ -13,7 +13,7 @@
*ngIf="option?.enabled !== false"
[ngModel]="option.value === customerType"
(ngModelChange)="setValue({ customerType: $event ? option.value : undefined })"
[disabled]="readonly"
[disabled]="isOptionDisabled(option)"
[name]="option.value"
>
{{ option.label }}

View File

@@ -200,6 +200,13 @@ export class CustomerTypeSelectorComponent
this.disabled = isDisabled;
}
// #4610 Checkbox welche bereits ausgewählt ist soll nicht abgewählt werden können (Ausnahme bei Kundenkarte + Onlinekonto)
isOptionDisabled(option: OptionDTO) {
const isValueCurrentlySelected = option.value === this.customerType;
const isCustomerCardActive = this.p4mUser;
return this.readonly || (isValueCurrentlySelected && !isCustomerCardActive);
}
setValue(value: { p4mUser?: boolean; customerType?: string } | string) {
const initial = { p4mUser: this.p4mUser, customerType: this.customerType };