ldc-gen-game-web/resources/views/partials/inputs/varchar-file.blade.php
2023-11-27 12:04:19 +01:00

34 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 || ''
$file || The accepted files extensions. || string || OPTIONNAL || '.pdf'
$model || The model we're creating/editing || Model class || OPTIONNAL || null
--}}
@if (!empty($label))
<label class="col-form-label" for="{{ $id }}">
<b>{{ $label }} {{ $required ?? false ? '*' : '' }}</b>
</label>
@endif
<div class="input-group">
<input class="form-control @if ($errors->has($name)) is-invalid @endif" id="{{ $id }}" name="{{ $name }}"
type="file" value="{{ old($name, $model->{$name} ?? ($value ?? '')) }}" aria-describedby="{{ $id }}Help"
accept="{{ $file ?? '.pdf' }}" @if (!empty($required)) required @endif>
@if (!empty($model->{$name}))
<a class="btn btn-warning" data-bs-toggle="tooltip" href="/{{ $model->{$name} }}"
title="{{ __('Visualiser votre fichier :name', ['name' => basename($model->{$name})]) }}" target="_blank">
{{ basename($model->{$name}) }}
</a>
@endif
</div>
@include('modules.input-error', [
'inputName' => $name,
'helperId' => "{$id}Help",
'helper' => $helper,
])