2024-09-02 19:54:21 +00:00
|
|
|
@props([
|
|
|
|
|
'id',
|
|
|
|
|
'label' => null,
|
|
|
|
|
'helper' => null,
|
|
|
|
|
'disabled' => false,
|
|
|
|
|
'instantSave' => false,
|
|
|
|
|
'value' => null,
|
2024-12-09 09:28:34 +00:00
|
|
|
'domValue' => null,
|
2024-11-15 20:44:02 +00:00
|
|
|
'checked' => false,
|
2024-09-25 07:16:28 +00:00
|
|
|
'fullWidth' => false,
|
2024-09-02 19:54:21 +00:00
|
|
|
])
|
|
|
|
|
|
2024-09-25 07:16:28 +00:00
|
|
|
<div @class([
|
2025-01-12 17:45:15 +00:00
|
|
|
'flex flex-row items-center gap-4 pr-2 py-1 form-control min-w-fit',
|
2024-09-25 07:16:28 +00:00
|
|
|
'w-full' => $fullWidth,
|
2025-01-12 17:45:15 +00:00
|
|
|
'dark:hover:bg-coolgray-100 cursor-pointer' => !$disabled,
|
2024-09-25 07:16:28 +00:00
|
|
|
])>
|
2025-01-12 17:45:15 +00:00
|
|
|
<label @class(['flex gap-4 items-center px-0 min-w-fit label w-full'])>
|
2025-05-14 10:43:23 +00:00
|
|
|
<span class="flex grow gap-2">
|
2024-12-09 09:28:34 +00:00
|
|
|
@if ($label)
|
2025-01-12 17:45:15 +00:00
|
|
|
@if ($disabled)
|
|
|
|
|
<span class="opacity-60">{!! $label !!}</span>
|
|
|
|
|
@else
|
|
|
|
|
{!! $label !!}
|
|
|
|
|
@endif
|
|
|
|
|
@if ($helper)
|
|
|
|
|
<x-helper :helper="$helper" />
|
|
|
|
|
@endif
|
2024-12-09 09:28:34 +00:00
|
|
|
@endif
|
|
|
|
|
</span>
|
|
|
|
|
@if ($instantSave)
|
|
|
|
|
<input type="checkbox" @disabled($disabled) {{ $attributes->merge(['class' => $defaultClass]) }}
|
|
|
|
|
wire:loading.attr="disabled"
|
|
|
|
|
wire:click='{{ $instantSave === 'instantSave' || $instantSave == '1' ? 'instantSave' : $instantSave }}'
|
|
|
|
|
wire:model={{ $id }} @if ($checked) checked @endif />
|
|
|
|
|
@else
|
|
|
|
|
@if ($domValue)
|
|
|
|
|
<input type="checkbox" @disabled($disabled) {{ $attributes->merge(['class' => $defaultClass]) }}
|
|
|
|
|
value={{ $domValue }} @if ($checked) checked @endif />
|
|
|
|
|
@else
|
|
|
|
|
<input type="checkbox" @disabled($disabled) {{ $attributes->merge(['class' => $defaultClass]) }}
|
|
|
|
|
wire:model={{ $value ?? $id }} @if ($checked) checked @endif />
|
|
|
|
|
@endif
|
|
|
|
|
@endif
|
|
|
|
|
</label>
|
2023-06-14 11:07:58 +00:00
|
|
|
</div>
|