lasthourcloud/resources/views/components/inputs/checkbox.blade.php

41 lines
1.8 KiB
PHP
Raw Normal View History

2023-05-17 13:46:20 +00:00
@props([
'id' => $attributes->has('id') || $attributes->has('label'),
'required' => $attributes->has('required'),
'label' => $attributes->has('label'),
'helper' => $attributes->has('helper'),
'instantSave' => $attributes->has('instantSave'),
'noLabel' => $attributes->has('noLabel'),
'noDirty' => $attributes->has('noDirty'),
'disabled' => null,
])
2023-05-18 11:26:35 +00:00
<label {{ $attributes->merge(['class' => 'flex cursor-pointer w-64 label']) }}>
<div class="label-text">
2023-05-17 13:46:20 +00:00
@if ($label)
{{ $label }}
@else
{{ $id }}
@endif
2023-05-18 11:49:49 +00:00
@if ($helper)
2023-05-22 08:34:00 +00:00
<div class="-mb-1 dropdown dropdown-right dropdown-hover">
2023-05-18 11:49:49 +00:00
<label tabindex="0" class="cursor-pointer text-warning">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
class="w-4 h-4 stroke-current">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path>
</svg>
</label>
<div tabindex="0"
2023-05-22 08:34:00 +00:00
class="border rounded shadow border-warning/30 card compact dropdown-content bg-coolgray-200 w-96">
2023-05-18 11:49:49 +00:00
<div class="card-body">
{!! $helper !!}
</div>
</div>
</div>
@endif
2023-05-18 11:26:35 +00:00
</div>
<div class="flex-1"></div>
<input type="checkbox" @if ($disabled !== null) disabled @endif name={{ $id }}
2023-05-17 13:46:20 +00:00
@if (!$noDirty) wire:dirty.class="input-warning" @endif
@if ($instantSave) wire:click='instantSave' wire:model.defer={{ $id }} @else wire:model.defer={{ $value ?? $id }} @endif />
</label>