diff --git a/app/Livewire/Card.php b/app/Livewire/Card.php index 4700f0a..602e3ab 100644 --- a/app/Livewire/Card.php +++ b/app/Livewire/Card.php @@ -10,11 +10,13 @@ class Card extends Component { public Group $group; public $checkCount; + public $checkboxes = []; public function mount(Group $group) { $this->group = $group; $this->checkCount = auth()->user()->getCheckCountForGroupAndDate($this->group, Carbon::today()); + $this->checkboxes = [...array_fill(0, $this->checkCount, true), ...array_fill(0, $group->per_day-$this->checkCount, false)]; } public function render() { @@ -25,5 +27,6 @@ public function check($count) { $update = auth()->user()->setCheckCountForGroupAndDate($this->group, Carbon::today(), $count); $this->checkCount = $update; + $this->checkboxes = [...array_fill(0, $this->checkCount, true), ...array_fill(0, $this->group->per_day-$this->checkCount, false)]; } } diff --git a/resources/views/livewire/card.blade.php b/resources/views/livewire/card.blade.php index 3e163d0..f16b2b5 100644 --- a/resources/views/livewire/card.blade.php +++ b/resources/views/livewire/card.blade.php @@ -31,14 +31,10 @@ class="{{ $checkCount === $group->per_day ? 'border-pine-400' : 'border-cool-gr style="font-size: 15px;font-weight: 500;color: #4e4e4e87;">{{ $checkCount ?? 0 }} / {{ $group->per_day}}