2018-04-02 07:02:12 +08:00
|
|
|
{{--
|
|
|
|
|
|
|
|
Pass in:
|
|
|
|
$model - The model instance this belongs to, e.g: ['model' => $airport]
|
|
|
|
$redirect - Where to go to
|
|
|
|
|
|
|
|
--}}
|
2018-04-03 00:04:32 +08:00
|
|
|
<div id="airport-files-wrapper" class="col-12">
|
2018-04-02 07:02:12 +08:00
|
|
|
<div class="header">
|
|
|
|
<h3>files</h3>
|
2019-08-27 02:43:50 +08:00
|
|
|
@component('admin.components.info')
|
|
|
|
Add a download link or upload a file to make available
|
|
|
|
@endcomponent
|
2018-04-02 07:02:12 +08:00
|
|
|
</div>
|
|
|
|
|
2018-04-10 09:04:21 +08:00
|
|
|
@if(count($model->files) === 0)
|
|
|
|
@include('admin.common.none_added', ['type' => 'files'])
|
|
|
|
@endif
|
|
|
|
|
2018-04-02 07:02:12 +08:00
|
|
|
{{-- Show all the files here --}}
|
|
|
|
<table class="table table-hover table-responsive">
|
|
|
|
@if(count($model->files))
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<td>Name</td>
|
2018-04-03 01:55:37 +08:00
|
|
|
<td>Direct Link</td>
|
|
|
|
<td>Downloads</td>
|
2018-04-02 07:02:12 +08:00
|
|
|
<td class="text-right"></td>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
@endif
|
|
|
|
<tbody>
|
|
|
|
@foreach($model->files as $file)
|
|
|
|
<tr>
|
|
|
|
<td>{{ $file->name }}</td>
|
|
|
|
<td><a href="{{ $file->url }}" target="_blank">Link to file</a></td>
|
2018-04-03 01:55:37 +08:00
|
|
|
<td>{{$file->download_count}}</td>
|
2018-04-02 07:02:12 +08:00
|
|
|
<td class="text-right">
|
|
|
|
{{ Form::open(['route' => ['admin.files.delete', $file->id], 'method' => 'delete']) }}
|
|
|
|
{{ Form::hidden('id', $file->id) }}
|
|
|
|
{{ Form::button('<i class="fa fa-times"></i>', [
|
|
|
|
'type' => 'submit',
|
|
|
|
'class' => 'btn btn-sm btn-danger btn-icon',
|
|
|
|
'onclick' => "return confirm('Are you sure?')"])
|
|
|
|
}}
|
|
|
|
{{ Form::close() }}
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
@endforeach
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
<hr>
|
|
|
|
<div class="row">
|
2018-04-03 00:04:32 +08:00
|
|
|
<div class="col-sm-12">
|
2018-04-02 07:02:12 +08:00
|
|
|
<div class="text-right">
|
|
|
|
{{ Form::open([
|
|
|
|
'url' => route('admin.files.store'),
|
|
|
|
'method' => 'POST',
|
|
|
|
'class' => 'form-inline',
|
|
|
|
'files' => true
|
|
|
|
])
|
|
|
|
}}
|
|
|
|
|
2018-04-03 00:46:33 +08:00
|
|
|
<span class="required">*</span>
|
2019-08-27 02:43:50 +08:00
|
|
|
{{ Form::text('file_name', null, ['class' => 'form-control', 'placeholder' => 'Name']) }}
|
2018-04-03 00:46:33 +08:00
|
|
|
{{ Form::text('file_description', null, ['class' => 'form-control', 'placeholder' => 'Description']) }}
|
2019-08-27 02:43:50 +08:00
|
|
|
{{ Form::text('url', null, ['class' => 'form-control', 'placeholder' => 'URL']) }}
|
2018-04-02 07:02:12 +08:00
|
|
|
{{ Form::file('file', ['class' => 'form-control']) }}
|
|
|
|
|
2019-08-27 02:43:50 +08:00
|
|
|
{{-- Fields for the model --}}
|
|
|
|
{{ Form::hidden('ref_model', get_class($model)) }}
|
|
|
|
{{ Form::hidden('ref_model_id', $model->id) }}
|
|
|
|
|
|
|
|
{{ Form::submit('Save', [
|
|
|
|
'id' => 'save_file_upload',
|
|
|
|
'class' => 'btn btn-success'
|
|
|
|
])
|
|
|
|
}}
|
2018-04-03 00:04:32 +08:00
|
|
|
<div class="text-danger" style="padding-top: 10px;">
|
|
|
|
<span>{{ $errors->first('filename') }}</span>
|
2019-08-27 02:43:50 +08:00
|
|
|
<span>{{ $errors->first('url') }}</span>
|
2018-04-03 00:04:32 +08:00
|
|
|
<span>{{ $errors->first('file') }}</span>
|
|
|
|
</div>
|
2018-04-02 07:02:12 +08:00
|
|
|
|
|
|
|
{{ Form::close() }}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|