2023-05-03 12:09:10 +00:00
|
|
|
@props([
|
|
|
|
'id' => null,
|
|
|
|
'required' => false,
|
|
|
|
'readonly' => false,
|
|
|
|
'label' => null,
|
|
|
|
'type' => 'text',
|
|
|
|
'class' => '',
|
|
|
|
'instantSave' => false,
|
|
|
|
'disabled' => false,
|
|
|
|
'hidden' => false,
|
|
|
|
])
|
|
|
|
|
2023-04-25 12:43:35 +00:00
|
|
|
@if ($type === 'checkbox')
|
|
|
|
<label for={{ $id }}>
|
|
|
|
@if ($label)
|
|
|
|
{{ $label }}
|
|
|
|
@else
|
|
|
|
{{ $id }}
|
|
|
|
@endif
|
|
|
|
@if ($required)
|
|
|
|
*
|
|
|
|
@endif
|
|
|
|
<input type="checkbox" id={{ $id }}
|
|
|
|
@if ($instantSave) wire:click='instantSave' wire:model.defer={{ $id }} @else wire:model.defer={{ $id }} @endif>
|
|
|
|
</label>
|
|
|
|
@error($id)
|
|
|
|
<span class="text-red-500">{{ $message }}</span>
|
|
|
|
@enderror
|
|
|
|
@else
|
|
|
|
<label for={{ $id }}>
|
|
|
|
@if ($label)
|
|
|
|
{{ $label }}
|
|
|
|
@else
|
|
|
|
{{ $id }}
|
|
|
|
@endif
|
|
|
|
@if ($required)
|
|
|
|
*
|
|
|
|
@endif
|
|
|
|
</label>
|
2023-04-26 13:38:50 +00:00
|
|
|
@if ($type === 'textarea')
|
2023-05-03 08:41:25 +00:00
|
|
|
<textarea class={{ $class }} type={{ $type }} id={{ $id }}
|
|
|
|
wire:model.defer={{ $id }} @if ($required) required @endif
|
|
|
|
@if ($disabled) disabled @endif @if ($readonly) readOnly disabled @endif></textarea>
|
2023-04-26 13:38:50 +00:00
|
|
|
@else
|
2023-05-03 08:41:25 +00:00
|
|
|
<input class={{ $class }} type={{ $type }} id={{ $id }}
|
|
|
|
wire:model.defer={{ $id }} @if ($required) required @endif
|
|
|
|
@if ($disabled) disabled @endif
|
2023-04-26 13:38:50 +00:00
|
|
|
@if ($readonly) readOnly disabled @endif />
|
|
|
|
@endif
|
|
|
|
|
2023-04-25 12:43:35 +00:00
|
|
|
@error($id)
|
|
|
|
<div class="text-red-500">{{ $message }}</div>
|
|
|
|
@enderror
|
|
|
|
@endif
|