ldc-agis/resources/views/bo/partials/inputs/bigint-foreign-id.blade.php
2023-12-21 13:56:34 +01:00

47 lines
1.8 KiB
PHP

{{-- blade-formatter-disable --}}
{{--
VARIABLE || COMMENT || TYPE || REQUIRED || DEFAULT
$id || The id of the select tag. || string || REQUIRED ||
$name || The name of the input tag. || string || REQUIRED ||
$helper || The helper of the input. || string || REQUIRED ||
$associatedModels || The models of the relation. || Collection || REQUIRED ||
$foreignLabel || The field to display. || string || REQUIRED ||
$label || The text displayed as a label. || string || OPTIONNAL || null
$size || The number of lines to display. || integer || OPTIONNAL || null
$required || Is the field required ? || boolean || OPTIONNAL || false
$model || The model we're creating/editing || Model class || OPTIONNAL || null
--}}
@if(!empty($label))
<label for="{{ $id }}" class="col-form-label"><b>{{ $label }} *</b></label>
@endif
<select
id="{{ $id }}"
@class([
'form-select',
'is-invalid' => $errors->has($name)
])
name="{{ $name }}"
@if(!empty($size))
size="{{ $size }}"
@endif
aria-describedby="{{ $id }}Help"
@disabled(!empty($disabled))
@readonly(!empty($readonly))
@required(!empty($required))>
@foreach ($associatedModels as $associatedModel)
<option
value="{{ $associatedModel->id }}"
@if (old($name, $model->{$name} ?? $associatedModels[0]->id) == $associatedModel->id)
selected
@endif>
{{ $associatedModel->{$foreignLabel} }}
</option>
@endforeach
</select>
@include('modules.input-error', [
'inputName' => $name,
'helperId' => "{$id}Help",
'helper' => $helper
])