mein-sterntours/resources/views/lead/upload_modal.blade.php
2021-05-07 17:44:02 +02:00

105 lines
4.1 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">
{{ __('Datei') }}
<span class="font-weight-light">hinzufügen</span>
</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">×</button>
</div>
<div class="modal-body">
<div class="form-row show-content-file">
<div class="col-12">
<div class="alert alert-danger alert-dismissable" style="display:none;"></div>
</div>
<div class="col-12 mt-2 mb-4">
{!! Form::open([ 'url' => route('lead_mail_modal_load'), 'method' => 'post', 'files' => true, 'enctype' => 'multipart/form-data', 'class' => 'dropzone', 'id' => 'uploadLeadFile' ]) !!}
<input type="hidden" name="lead_id" value="{{ $data['lead_id'] }}">
<input type="hidden" name="action" value="upload-lead-file">
<div class="fallback">
<input name="file" type="file" multiple>
</div>
{!! Form::close() !!}
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">schließen</button>
</div>
</div>
<script type="text/javascript">
var responseReaload = false;
$('#modals-load-content').on('hide.bs.modal', function (event) {
$(this).off('hide.bs.modal');
if(responseReaload){
responseReaload = false;
window.location.reload();
}
});
$( document ).ready(function() {
Dropzone.autoDiscover = false;
$("#uploadLeadFile").dropzone({
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();
$(file.previewElement).find('.dz-error-message').text(message);
$(file.previewElement).addClass('dz-error');
_ele.text(message);
},
success: function(file, response) {
// console.log(file);
// console.log(response);
$(file.previewElement).addClass('dz-success');
if(response.error === false){
responseReaload = true;
//window.location.href = window.location.href; //This is a possibility
// window.location.reload(); //Another possiblity
}
}
});
});
</script>