39 lines
1.1 KiB
PHP
39 lines
1.1 KiB
PHP
|
<div class="form-group">
|
||
|
<label for="{{ $id }}">{{ $label }}</label>
|
||
|
<div class="input-group has-validation">
|
||
|
@empty($icon)
|
||
|
@else
|
||
|
<div class="input-group-prepend">
|
||
|
<span class="input-group-text"><i class="fa-fw {{ $icon }}"></i></span>
|
||
|
</div>
|
||
|
@endempty()
|
||
|
<div class="custom-file">
|
||
|
<input type="file" class="custom-file-input @error($id) is-invalid @enderror" id="{{ $id }}" name="{{ $name ?? $id}}">
|
||
|
<label class="custom-file-label input-group-text" for="{{ $id }}">Choose file</label>
|
||
|
</div>
|
||
|
|
||
|
{{--
|
||
|
<div class="input-group-append">
|
||
|
<button type="submit" class="input-group-text btn btn-success" id="">Upload</button>
|
||
|
</div>
|
||
|
--}}
|
||
|
<span class="invalid-feedback @error($id) d-block @enderror" role="alert">
|
||
|
@error($id)
|
||
|
{{ $message }}
|
||
|
@enderror
|
||
|
</span>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
@section('page-scripts')
|
||
|
<script>
|
||
|
$(document).ready(function() {
|
||
|
$('#{{ $id }}').on('change',function(){
|
||
|
//get the file name
|
||
|
var fileName = $(this).val();
|
||
|
//replace the "Choose a file" label
|
||
|
$(this).next('.custom-file-label').html(fileName);
|
||
|
})
|
||
|
});
|
||
|
</script>
|
||
|
@append
|