Merged PR 1502: #3358 Disable Pick Up Option in purchasing Modal if no valid targetBranch is...

#3358 Disable Pick Up Option in purchasing Modal if no valid targetBranch is selected
This commit is contained in:
Nino Righi
2023-03-06 14:36:31 +00:00
committed by Lorenz Hilpert
parent 7508144e27
commit 24f6ba117d
4 changed files with 20 additions and 3 deletions

View File

@@ -35,3 +35,7 @@ p {
.select-option {
@apply mt-4 mb-4 border-2 border-solid border-brand text-brand text-cta-l font-bold bg-white rounded-full py-3 px-6;
}
.select-option:disabled {
@apply bg-disabled-branch border-disabled-branch text-white;
}

View File

@@ -9,6 +9,7 @@
</p>
<span class="price" *ngIf="price$ | async; let price">{{ price?.value?.value | currency: price?.value?.currency:'code' }}</span>
<ui-branch-dropdown
class="min-h-[38px]"
[branches]="branches$ | async"
[selected]="selected$ | async"
(selectBranch)="selectBranch($event)"
@@ -18,7 +19,12 @@
>
<div class="grow"></div>
<div>
<button [disabled]="availability.price?.value?.value < 0" type="button" class="select-option" (click)="select()">
<button
[disabled]="availability.price?.value?.value < 0 || !(selected$ | async)"
type="button"
class="select-option"
(click)="select()"
>
Auswählen
</button>
</div>

View File

@@ -13,7 +13,14 @@ import { PurchasingOptionsModalStore } from '../purchasing-options-modal.store';
})
export class PickUpOptionComponent {
branches$: Observable<BranchDTO[]> = this._purchasingOptionsModalStore.selectAvailableBranches;
selected$: Observable<string> = this._purchasingOptionsModalStore.selectBranch.pipe(map((branch) => branch.name));
selected$: Observable<string> = this._purchasingOptionsModalStore.selectBranch.pipe(
map((branch) => {
// Determins if branch is targetBranch
if (branch.branchType === 1) {
return branch.name;
}
})
);
readonly item$ = this._purchasingOptionsModalStore.selectItem;

View File

@@ -9,7 +9,7 @@
cdkOverlayOrigin
#trigger="cdkOverlayOrigin"
>
<span>{{ selected }}</span>
<span>{{ selected ?? 'Filiale auswählen' }}</span>
<div class="arrow-icon">
<ui-icon size="15px" icon="arrow_head"></ui-icon>
</div>