ldc-agis/resources/views/bo/partials/inputs/timestamp-datetime.blade.php

32 lines
1.4 KiB
PHP
Raw Permalink Normal View History

2023-12-21 13:56:34 +01:00
{{-- blade-formatter-disable --}}
2023-12-19 15:09:12 +00:00
{{--
VARIABLE || COMMENT || TYPE || REQUIRED || DEFAULT
$id || The id of the input tag. || string || REQUIRED ||
$name || The name of the input tag. || string || REQUIRED ||
$helper || The helper of the input. || string || REQUIRED ||
$label || The text displayed as a label. || string || OPTIONNAL || null
$required || Is the field required ? || boolean || OPTIONNAL || false
$model || The model we're creating/editing || Model class || OPTIONNAL || null
2023-12-21 13:56:34 +01:00
$type || The input data type || string || OPTIONNAL || datetime-local
$format || The inpute date format || string || OPTIONNAL || Y-m-d\TH:i
2023-12-19 15:09:12 +00:00
--}}
2023-12-21 13:56:34 +01:00
@if (!empty($label))
<label class="col-form-label" for="{{ $id }}">
<b>{{ $label }} {{ $required ?? false ? '*' : '' }}</b>
</label>
2023-12-19 15:09:12 +00:00
@endif
<input id="{{ $id }}"
name="{{ $name }}"
2023-12-21 13:56:34 +01:00
class="form-control @if ($errors->has($name)) is-invalid @endif"
type="{{ $type ?? 'datetime-local' }}"
2023-12-19 15:09:12 +00:00
data-form-type="date"
2023-12-21 13:56:34 +01:00
value="{{ old($name, (isset($model) and $model->{$name}) ? $model->{$name}->format($format ?? 'Y-m-d\TH:i') ?? '' : '') }}"
aria-describedby="{{ "{$id}Help" }}">
2023-12-19 15:09:12 +00:00
@include('modules.input-error', [
'inputName' => $name,
'helperId' => "{$id}Help",
2023-12-21 13:56:34 +01:00
'helper' => $helper,
2023-12-19 15:09:12 +00:00
])