Merged PR 1908: feat(remission-shared-dialog): add dynamic dropdown label for return reason s...

feat(remission-shared-dialog): add dynamic dropdown label for return reason selection

Implement computed property to show selected reason value or default placeholder
text in the dropdown label. This provides better UX by displaying the current
selection instead of a static label.

- Add dropdownLabel computed property that returns selected reason or fallback
- Update template to use dynamic label binding instead of hardcoded text
- Enhances user feedback when reason is selected vs. when no selection is made

Ref: #5253
This commit is contained in:
Nino Righi
2025-08-06 15:58:44 +00:00
committed by Andreas Schickinger
parent 0dcb31973f
commit 7ae484fc83
2 changed files with 7 additions and 1 deletions

View File

@@ -24,7 +24,7 @@
class="border-none max-w-56 truncate"
data-what="dropdown"
data-which="reason"
label="Rückgabegrund"
[label]="dropdownLabel()"
>
@if (reasonResource.value(); as reasons) {
@for (reson of reasons; track reson.key) {

View File

@@ -1,6 +1,7 @@
import {
ChangeDetectionStrategy,
Component,
computed,
inject,
input,
model,
@@ -41,6 +42,11 @@ export class QuantityAndReasonItemComponent {
quantityAndReason = model.required<QuantityAndReason>();
dropdownLabel = computed(() => {
const reason = this.quantityAndReason().reason;
return reason !== '' ? reason : 'Rückgabegrund';
});
reasonResource = resource({
loader: async ({ abortSignal }) => {
return this.#reasonService.fetchReturnReasons(abortSignal);