diff --git a/packages/admin/resources/views/livewire/components/discounts/show.blade.php b/packages/admin/resources/views/livewire/components/discounts/show.blade.php index a8e9368d83..094db14ca4 100644 --- a/packages/admin/resources/views/livewire/components/discounts/show.blade.php +++ b/packages/admin/resources/views/livewire/components/discounts/show.blade.php @@ -12,6 +12,7 @@ class="w-8 h-8" /> {{ $discount->name }} +
diff --git a/packages/admin/src/Http/Livewire/Components/Discounts/AbstractDiscount.php b/packages/admin/src/Http/Livewire/Components/Discounts/AbstractDiscount.php index 45696053d0..a97abaf425 100644 --- a/packages/admin/src/Http/Livewire/Components/Discounts/AbstractDiscount.php +++ b/packages/admin/src/Http/Livewire/Components/Discounts/AbstractDiscount.php @@ -215,17 +215,15 @@ public function syncAvailability() ]; }), 'customerGroups' => $this->customerGroups->mapWithKeys(function ($group) { - // $productGroup = $this->product->customerGroups->where('id', $group->id)->first(); + $discountGroup = $this->discount->customerGroups->where('id', $group->id)->first(); - // $pivot = $productGroup->pivot ?? null; - - $pivot = null; + $pivot = $discountGroup->pivot ?? null; return [ $group->id => [ 'customer_group_id' => $group->id, 'scheduling' => false, - 'enabled' => false, + 'enabled' => $pivot?->enabled ?? false, 'status' => 'hidden', 'starts_at' => $pivot?->starts_at ?? null, 'ends_at' => $pivot?->ends_at ?? null, diff --git a/packages/admin/src/Http/Livewire/Components/Discounts/Types/Discount.php b/packages/admin/src/Http/Livewire/Components/Discounts/Types/Discount.php index 3ee0a8b669..1cbdb230e7 100644 --- a/packages/admin/src/Http/Livewire/Components/Discounts/Types/Discount.php +++ b/packages/admin/src/Http/Livewire/Components/Discounts/Types/Discount.php @@ -17,7 +17,7 @@ public function rules() 'discount.data' => 'array', 'discount.data.percentage' => 'required_if:discount.data.fixed_value,false|nullable|numeric|min:1', 'discount.data.fixed_values' => 'array|min:0', - 'discount.data.fixed_value' => 'boolean', + 'discount.data.fixed_value' => 'nullable|boolean', ]; foreach ($this->currencies as $currency) {