From e9ee11eec0c2139baae5247012b11ad4c792cf64 Mon Sep 17 00:00:00 2001 From: alex-chevski Date: Mon, 18 Dec 2023 16:35:41 +0300 Subject: [PATCH 01/12] fix comment reset --- app/Livewire/Plan/Comment/Create.php | 2 +- resources/views/livewire/plan/comment/create.blade.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/Livewire/Plan/Comment/Create.php b/app/Livewire/Plan/Comment/Create.php index fc505c8..ee77936 100644 --- a/app/Livewire/Plan/Comment/Create.php +++ b/app/Livewire/Plan/Comment/Create.php @@ -38,7 +38,7 @@ class Create extends Component $comment->plan_id = $this->plan->id; $comment->user_id = $this->user->id; $comment->save(); - $this->reset(['body']); + $this->reset(); $this->toggle(); diff --git a/resources/views/livewire/plan/comment/create.blade.php b/resources/views/livewire/plan/comment/create.blade.php index 92a27a0..507b5b0 100644 --- a/resources/views/livewire/plan/comment/create.blade.php +++ b/resources/views/livewire/plan/comment/create.blade.php @@ -18,8 +18,9 @@ $isChecked]) wire:model="isChecked" wire:click="$set('grade',1)" type="radio" name="rate" id="rate-1" value="1" hidden> + - + From 45c5922c547a1a0d020ea20f33aa46f816ef13e0 Mon Sep 17 00:00:00 2001 From: alex-chevski Date: Mon, 18 Dec 2023 22:30:03 +0300 Subject: [PATCH 02/12] added icon type show --- app/Livewire/Plan/Create.php | 14 +++++++----- resources/views/plan/show.blade.php | 35 ++++++++++++++++++++++++++--- 2 files changed, 40 insertions(+), 9 deletions(-) diff --git a/app/Livewire/Plan/Create.php b/app/Livewire/Plan/Create.php index 9d776d1..6203ba7 100644 --- a/app/Livewire/Plan/Create.php +++ b/app/Livewire/Plan/Create.php @@ -11,12 +11,11 @@ use App\Models\Plan; class Create extends Component { use WithFileUploads; - public $name = ""; public $image = null; public $duration = "7"; public $state = "draft"; - public $type = []; + public $type = ['fit' => false, 'slim' => false, 'behavior' => false, 'wellness' => false]; public $details = ""; public $packets_count = 1; public $packet1_options = []; @@ -120,11 +119,14 @@ class Create extends Component $plan->state = $this->state; $plan->details = $this->details; $plan->packets_count = $this->packets_count; - $plan->type = json_encode($this->type); - $plan->packet1_options = json_encode($this->packet1_options); - $plan->packet2_options = json_encode($this->packet2_options); - $plan->packet3_options = json_encode($this->packet3_options); + $plan->type = $this->type; + $plan->packet1_options = $this->packet1_options; + $plan->packet2_options = $this->packet2_options; + $plan->packet3_options = $this->packet3_options; + $plan->saveOrFail(); + + $user = Auth::user(); $user->author_of_plans()->attach($plan->id); diff --git a/resources/views/plan/show.blade.php b/resources/views/plan/show.blade.php index f256633..f5f2538 100644 --- a/resources/views/plan/show.blade.php +++ b/resources/views/plan/show.blade.php @@ -86,6 +86,35 @@ {{ $plan->details }}

+ +
+ + + @if ($plan->type['slim'] === true) + + + + @endif + + @if ($plan->type['fit'] === true) + + + + @endif + + @if ($plan->type['wellness'] === true) + + + + @endif + + @if ($plan->type['behavior'] === true) + + + + @endif +
+