Upload Files Booking, Mails, Attachments,
This commit is contained in:
parent
5daea268f7
commit
68b9d1ff88
92 changed files with 2837 additions and 1778 deletions
|
|
@ -21,11 +21,13 @@
|
|||
@endif
|
||||
|
||||
<div class="card">
|
||||
<div class="card-datatable table-responsive py-2" data-route-modal="{{ route('cms_content_all_load_modal') }}" data-target-modal="#modals-load-content">
|
||||
<div class="card-datatable table-responsive py-2" >
|
||||
<div class="mr-4 mb-2 text-right">
|
||||
<button type="button" class="btn btn-sm btn-primary" data-toggle="modal" data-target="#modals-load-content"
|
||||
<button type="button" class="btn btn-sm btn-primary" data-toggle="modal"
|
||||
data-target="#modals-load-content"
|
||||
data-id="new"
|
||||
data-model="content"
|
||||
data-route="{{ route('cms_content_all_load_modal') }}"
|
||||
>Neuen Content anlegen</button>
|
||||
</div>
|
||||
|
||||
|
|
@ -34,8 +36,10 @@
|
|||
<tr>
|
||||
<th style="max-width: 60px;"> </th>
|
||||
<th>{{__('Name')}}</th>
|
||||
<th>{{__('Type')}}</th>
|
||||
<th>{{__('Slug')}}</th>
|
||||
<th>{{__('Inhalt')}}</th>
|
||||
<th>{{__('Type')}}</th>
|
||||
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
|
@ -45,13 +49,16 @@
|
|||
<td class="not">
|
||||
<button type="button" class="btn icon-btn btn-sm btn-primary" data-toggle="modal" data-target="#modals-load-content"
|
||||
data-id="{{ $value->id }}"
|
||||
data-model="content">
|
||||
data-model="content"
|
||||
data-route="{{ route('cms_content_all_load_modal') }}">
|
||||
<span class="fa fa-edit"></span>
|
||||
</button>
|
||||
</td>
|
||||
<td>{{ $value->name }}</td>
|
||||
<td>{{ $value->slug }}</td>
|
||||
<td>@if($value->isFile()) {!! $value->getPreviewContent() !!} @else {{ $value->getPreviewContent() }} @endif</td>
|
||||
<td>{{ $value->getFieldName() }}</td>
|
||||
<td>{{ $value->getPreviewContent() }}</td>
|
||||
|
||||
<td><a class="text-danger" href="{{ route('cms_content_all_delete', [$value->id]) }}" onclick="return confirm('{{__('Wirklich löschen?')}}');"><i class="fa fa-trash-alt"></i></a></td>
|
||||
|
||||
</tr>
|
||||
|
|
@ -62,6 +69,7 @@
|
|||
<button type="button" class="btn btn-sm btn-primary" data-toggle="modal" data-target="#modals-load-content"
|
||||
data-id="new"
|
||||
data-model="content"
|
||||
data-route="{{ route('cms_content_all_load_modal') }}"
|
||||
>Neuen Content anlegen</button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -70,52 +78,6 @@
|
|||
<script>
|
||||
$( document ).ready(function() {
|
||||
|
||||
|
||||
function loadModalInner(self, data){
|
||||
|
||||
var url = data.route,
|
||||
contentType = 'application/x-www-form-urlencoded; charset=UTF-8';
|
||||
$.ajax({
|
||||
url: url,
|
||||
data: data,
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
cache: false,
|
||||
contentType: contentType,
|
||||
encode: true,
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
||||
},
|
||||
success: function(data) {
|
||||
$(data.response.target).find('.modal-dialog').html(data.html);
|
||||
$('.selectpicker').selectpicker('refresh');
|
||||
//datepicker_birthday_init();
|
||||
},
|
||||
error: function(xhr, status, errorThrown) {
|
||||
console.log(xhr);
|
||||
console.log(xhr.responseText);
|
||||
console.log(errorThrown);
|
||||
console.log("Sorry, there was a problem!");
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
$('#modals-load-content').on('show.bs.modal', function (event) {
|
||||
var button = $(event.relatedTarget);
|
||||
if (!button.data('id')) {
|
||||
return;
|
||||
}
|
||||
var data = {};
|
||||
data.route = button.parents('.card').find('.card-datatable').data('route-modal');
|
||||
data.target = button.parents('.card').find('.card-datatable').data('target-modal');
|
||||
data.id = button.data('id');
|
||||
data.model = button.data('model');
|
||||
console.log(data);
|
||||
loadModalInner(this, data);
|
||||
|
||||
});
|
||||
|
||||
$('.datatables-default').dataTable({
|
||||
"bLengthChange": false,
|
||||
"iDisplayLength": 50,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
{!! Form::open(['url' => route('cms_content_all_store'), 'class' => 'modal-content']) !!}
|
||||
{!! Form::open(['url' => route('cms_content_all_store'), 'class' => 'modal-content', 'enctype' => 'multipart/form-data']) !!}
|
||||
|
||||
<input type="hidden" name="id" id="id" value="@if($value->id>0){{$value->id}}@else new @endif">
|
||||
<input type="hidden" name="id" id="id" value="{{ $value->id > 0 ? $value->id : 'new' }}">
|
||||
|
||||
|
||||
<div class="modal-header">
|
||||
|
|
@ -12,51 +12,81 @@
|
|||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-row">
|
||||
<div class="form-group col">
|
||||
<label for="name" class="form-label">{{ __('Name') }}</label>
|
||||
{{ Form::text('name', $value->name, array('placeholder'=>__('Name'), 'class'=>'form-control', 'required')) }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col">
|
||||
<label for="field" class="form-label">{{ __('Country') }}*</label>
|
||||
<label for="field" class="form-label">{{ __('Type') }}*</label>
|
||||
<select class="selectpicker" name="field" data-style="btn-light" data-live-search="true" required>
|
||||
{!! \App\Models\CMSContent::getFieldsOptions($value->field) !!}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row show-content-text" style="display: ;">
|
||||
<div class="form-row show-field-name">
|
||||
<div class="form-group col">
|
||||
<label for="name" class="form-label">{{ __('Name') }}</label>
|
||||
{{ Form::text('name', $value->name, array('placeholder'=>__('Name'), 'class'=>'form-control', 'required')) }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-row show-content-text" style="display:none ;">
|
||||
<div class="form-group col">
|
||||
<label for="text" class="form-label">{{ __('Text') }}</label>
|
||||
{{ Form::text('text', $value->text, array('placeholder'=>__('Text'), 'class'=>'form-control')) }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row show-content-full_text" style="display: ;">
|
||||
<div class="form-row show-content-full_text" style="display:none ;">
|
||||
<div class="form-group col">
|
||||
<label for="text" class="form-label">{{ __('Full Text') }}</label>
|
||||
{{ Form::textarea('full_text', $value->full_text, array('placeholder'=>__('Full Text'), 'class'=>'form-control', 'rows'=>20)) }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row show-content-integer" style="display: ;">
|
||||
<div class="form-row show-content-integer" style="display:none ;">
|
||||
<div class="form-group col">
|
||||
<label for="integer" class="form-label">{{ __('Zahl') }}</label>
|
||||
{{ Form::text('integer', $value->integer, array('placeholder'=>__('Zahl'), 'class'=>'form-control')) }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row show-content-decimal" style="display: ;">
|
||||
<div class="form-row show-content-decimal" style="display:none ;">
|
||||
<div class="form-group col">
|
||||
<label for="decimal" class="form-label">{{ __('Kommazahl') }}</label>
|
||||
{{ Form::text('decimal', $value->decimal, array('placeholder'=>__('Kommazahl'), 'class'=>'form-control')) }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-row show-content-file" style="display:none ;">
|
||||
|
||||
@if($value->isFile())
|
||||
<div class="col-12 " id="preview-mail-attachment">
|
||||
<div class="message-attachment ui-bordered p-2 mr-3 mb-3">
|
||||
<div class="message-attachment-file display-4"><i class="mail-att-icon {{$value->getIconExt()}}"></i></div>
|
||||
<div class="media-body ml-3">
|
||||
<strong class="message-attachment-filename">{{$value->filename}}</strong>
|
||||
<div class="text-muted small mail-att-size">{{$value->formatBytes()}}</div>
|
||||
<div>
|
||||
<a href="{{$value->getURL()}}" target="_blank" class="mail-att-show">Vorschau</a>
|
||||
{{-- <a href="javascript:void(0)" class="mail-att-delete">entfernen</a> --}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@else
|
||||
|
||||
<div class="col-12">
|
||||
<div class="alert alert-danger alert-dismissable" style="display:none;"></div>
|
||||
</div>
|
||||
<div class="col-12 mt-2 mb-4">
|
||||
<!-- You can add extra form fields here -->
|
||||
<div class="dropzone" id="fileUpload"></div>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="form-row show-field-slug">
|
||||
<div class="form-group col">
|
||||
<label for="name" class="form-label">{{ __('Slug') }}</label>
|
||||
{{ Form::text('slug', $value->slug, array('class'=>'form-control')) }}
|
||||
|
|
@ -71,7 +101,10 @@
|
|||
{!! Form::close() !!}
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
$( document ).ready(function() {
|
||||
|
||||
$('div[class*="show-content"]').hide();
|
||||
|
|
@ -80,6 +113,67 @@
|
|||
$('select[name="field"]').on('change', function () {
|
||||
$('div[class*="show-content"]').hide();
|
||||
$('.show-content-'+$(this).val()).show();
|
||||
if($(this).val() == 'file' && $('input[name="id"]').val() == 'new'){
|
||||
$('.show-field-slug').hide();
|
||||
$('.show-field-name').hide();
|
||||
}else{
|
||||
$('.show-field-slug').show();
|
||||
$('.show-field-name').show();
|
||||
}
|
||||
});
|
||||
|
||||
Dropzone.autoDiscover = false;
|
||||
$("#fileUpload").dropzone({
|
||||
url: "{{route('cms_content_all_store')}}",
|
||||
uploadMultiple: false,
|
||||
parallelUploads: 1,
|
||||
maxFilesize: 32,
|
||||
addRemoveLinks: true,
|
||||
dictDefaultMessage: '<i class="ion ion-ios-cloud-upload "></i>Hier klicken, oder Datei hier reinziehen (Drag&Drop)',
|
||||
dictFallbackMessage: 'Ihr Browser unterstützt Drag&Drop Dateiuploads nicht',
|
||||
dictFallbackText: 'Benutzen Sie das Formular um Ihre Dateien hochzuladen',
|
||||
dictFileTooBig: "Die Datei ist zu groß. Die maximale Dateigröße beträgt 32 MB",
|
||||
dictInvalidFileType: 'Eine Datei dieses Typs kann nicht hochgeladen werden',
|
||||
dictResponseError: "Der Server hat ihre Anfrage mit Status error abgelehnt",
|
||||
dictCancelUpload: 'Hochladen abbrechen',
|
||||
dictCancelUploadConfirmation: null,
|
||||
dictRemoveFile: 'Datei entfernen',
|
||||
dictMaxFilesExceeded: 'Sie können keine weiteren Dateien mehr hochladen',
|
||||
acceptedFiles: "image/jpeg,image/pjpeg,image/png,image/gif,application/pdf,text/plain",
|
||||
// The setting up of the dropzone
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
||||
},
|
||||
init:function() {
|
||||
this.on("removedfile", function(file) {
|
||||
var _ele = $('.alert-danger');
|
||||
_ele.fadeOut();
|
||||
|
||||
});
|
||||
this.on("addedfile", function (file) {
|
||||
var _ele = $('.alert-danger');
|
||||
_ele.fadeOut();
|
||||
});
|
||||
},
|
||||
error: function(file, response) {
|
||||
var message
|
||||
if($.type(response) === "string")
|
||||
message = response; //dropzone sends it's own error messages in string
|
||||
else
|
||||
message = response.message;
|
||||
var _ele = $('.alert-danger');
|
||||
_ele.fadeIn();
|
||||
console.log(message);
|
||||
_ele.text(message);
|
||||
},
|
||||
success: function(file, response) {
|
||||
console.log(file);
|
||||
console.log(response);
|
||||
if(response.error === false){
|
||||
//window.location.href = window.location.href; //This is a possibility
|
||||
window.location.reload(); //Another possiblity
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue