feat(cart): implement cart editing policy with granular permissions
This commit is contained in:
@@ -26,7 +26,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if (hasVariantSelectors() && !quantityDisabled()) {
|
||||
@if (hasVariantSelectors() && !variantDisabled()) {
|
||||
<app-variant-selector
|
||||
class="cart-item-variant-selector"
|
||||
[variants]="variants()"
|
||||
@@ -55,7 +55,7 @@
|
||||
(increase)="onIncrease()"
|
||||
(decrease)="onDecrease()"
|
||||
/>
|
||||
@if (!quantityDisabled() && showRemove()) {
|
||||
@if (!removeDisabled() && allowDelete()) {
|
||||
<app-icon-button variant="trash" class="cart-item-remove-btn" (click)="onRemove()" />
|
||||
}
|
||||
</div>
|
||||
|
||||
@@ -31,7 +31,9 @@ export class CartItemComponent {
|
||||
readonly quantity = input<number>(1);
|
||||
readonly readonly = input<boolean>(false);
|
||||
readonly quantityDisabled = input<boolean>(false);
|
||||
readonly showRemove = input<boolean>(true);
|
||||
readonly variantDisabled = input<boolean>(false);
|
||||
readonly removeDisabled = input<boolean>(false);
|
||||
readonly allowDelete = input<boolean>(true);
|
||||
|
||||
readonly quantityChange = output<number>();
|
||||
readonly remove = output<void>();
|
||||
@@ -61,7 +63,7 @@ export class CartItemComponent {
|
||||
}
|
||||
|
||||
protected onVariantChange(variant: unknown): void {
|
||||
if (!this.quantityDisabled() && typeof variant === 'number') {
|
||||
if (!this.variantDisabled() && typeof variant === 'number') {
|
||||
this.variantChange.emit(variant);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user