Files
ladill-care/resources/views/components/field.blade.php
T
isaaccladandCursor 6c9c742ed8
Deploy Ladill Care / deploy (push) Failing after 13s
Initial Ladill Care release.
Healthcare management app: patients, appointments, consultations, lab,
pharmacy inventory, billing, and reports at care.ladill.com.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-29 11:36:22 +00:00

38 lines
1.5 KiB
PHP

@props([
'name',
'label' => null,
'type' => 'text',
'value' => null,
'options' => [],
'placeholder' => '',
'required' => false,
'rows' => 4,
])
@php
$label = $label ?? \Illuminate\Support\Str::headline($name);
$current = old($name, $value);
$base = 'mt-1 block w-full rounded-xl border-slate-300 text-sm shadow-sm focus:border-indigo-500 focus:ring-indigo-500';
@endphp
<div {{ $attributes->only('class') }}>
<label for="{{ $name }}" class="block text-sm font-medium text-slate-700">
{{ $label }} @if($required)<span class="text-red-500">*</span>@endif
</label>
@if ($type === 'textarea')
<textarea id="{{ $name }}" name="{{ $name }}" rows="{{ $rows }}" placeholder="{{ $placeholder }}"
class="{{ $base }}">{{ $current }}</textarea>
@elseif ($type === 'select')
<select id="{{ $name }}" name="{{ $name }}" class="{{ $base }}">
@foreach ($options as $optValue => $optLabel)
<option value="{{ $optValue }}" @selected((string) $current === (string) $optValue)>{{ $optLabel }}</option>
@endforeach
</select>
@else
<input type="{{ $type }}" id="{{ $name }}" name="{{ $name }}" value="{{ $current }}"
placeholder="{{ $placeholder }}" @if($type==='number') step="0.01" min="0" @endif
class="{{ $base }}">
@endif
@error($name)<p class="mt-1 text-xs text-red-600">{{ $message }}</p>@enderror
</div>