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

52 lines
2.1 KiB
PHP
Raw Normal View History

2023-05-03 12:09:10 +00:00
@props([
2023-05-05 08:13:43 +00:00
'id' => $attributes->has('id') || $attributes->has('label'),
2023-05-05 07:28:00 +00:00
'required' => $attributes->has('required'),
2023-05-05 08:13:43 +00:00
'label' => $attributes->has('label'),
2023-05-17 13:46:20 +00:00
'helper' => $attributes->has('helper'),
2023-05-05 08:13:43 +00:00
'instantSave' => $attributes->has('instantSave'),
'noLabel' => $attributes->has('noLabel'),
'noDirty' => $attributes->has('noDirty'),
2023-05-03 12:09:10 +00:00
])
2023-05-17 13:46:20 +00:00
<div class="w-full max-w-xs form-control">
2023-05-05 07:28:00 +00:00
@if (!$noLabel)
2023-05-17 13:46:20 +00:00
<label class="label">
<span class="label-text">
@if ($label)
{{ $label }}
@else
{{ $id }}
@endif
@if ($required)
<span class="text-warning">*</span>
@endif
@if ($helper)
<div class="dropdown dropdown-right">
<label tabindex="0" class="btn btn-circle btn-ghost btn-xs text-warning">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
class="z-0 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"
class="w-64 border-2 shadow border-coolgray-500 card compact dropdown-content bg-coolgray-200">
<div class="card-body">
{{ $helper }}
</div>
</div>
</div>
@endif
</span>
2023-05-05 07:28:00 +00:00
</label>
@endif
2023-05-17 13:46:20 +00:00
<input {{ $attributes }} name={{ $id }}
@if ($instantSave) wire:click='instantSave' wire:model.defer={{ $id }} @else wire:model.defer={{ $value ?? $id }} @endif
@if (!$noDirty) wire:dirty.class="input-warning" @endif />
2023-04-25 12:43:35 +00:00
@error($id)
2023-05-17 13:46:20 +00:00
<label class="label">
<span class="text-red-500 label-text-alt">{{ $message }}</span>
</label>
2023-04-25 12:43:35 +00:00
@enderror
2023-05-17 13:46:20 +00:00
</div>