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

40 lines
1.7 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-06-22 08:04:39 +00:00
<div {{ $attributes->merge(['class' => 'flex cursor-pointer label']) }}>
2023-06-07 19:44:16 +00:00
<div class="flex gap-1 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-06-14 11:07:58 +00:00
<div class="group w-fit">
2023-06-07 19:44:16 +00:00
<div class="cursor-pointer text-warning">
2023-05-18 11:49:49 +00:00
<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>
2023-06-07 19:44:16 +00:00
</div>
<div class="absolute hidden text-xs group-hover:block border-coolgray-400 bg-coolgray-500">
<div class="p-4 card-body">
2023-05-18 11:49:49 +00:00
{!! $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
2023-06-19 12:31:42 +00:00
@if ($instantSave) wire:click='{{ $instantSave === 'instantSave' || $instantSave == '1' ? 'instantSave' : $instantSave }}' wire:model.defer={{ $id }} @else wire:model.defer={{ $value ?? $id }} @endif />
2023-06-14 11:07:58 +00:00
</div>