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

24 lines
917 B
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: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>