ldc-crm/resources/views/bo/partials/inputs/bigint-foreign-id.blade.php
2023-10-06 16:37:30 +02:00

43 lines
1.7 KiB
PHP

{{--
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
$value || The default value of the input. || string || OPTIONNAL || ''
$placeholder || The placeholder of the input. || string || OPTIONNAL || __('A beautiful title')
$hasWordCounter || Is the WordCounter needed ? || boolean || OPTIONNAL || false
$model || The model we're creating/editing || Model class || OPTIONNAL || null
--}}
@if(!empty($label))
<label for="{{ $name }}" class="col-form-label"><b>{{ $label }} *</b></label>
@endif
<select
id="{{ $name }}"
class="form-select @if($errors->has($name)) is-invalid @endif"
name="{{ $name }}"
@if(!empty($size))
size="{{ $size }}"
@endif
aria-describedby="{{ $id }}Help"
@if(!empty($label))
required
@endif>
@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
])