Mails, Strono, filter

This commit is contained in:
Kevin Adametz 2020-03-26 09:48:19 +01:00
parent f53f17f9c1
commit 62e84637b6
99 changed files with 2409 additions and 474 deletions

View file

@ -0,0 +1,233 @@
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">
{{ $value->title }}
@if($value->subtitle)
<br><small class="text-muted">{{$value->subtitle}}</small>
@endif
</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">×</button>
</div>
<div class="modal-body">
{!! Form::open(['url' => $value->url, 'class' => '', 'id'=>'customer-mail-form']) !!}
{{ Form::hidden('booking_id', $value->id) }}
@if(isset($value->customers))
<div class="form-row">
<div class="form-group col">
<label for="to" class="form-label">E-Mail senden an:</label>
@foreach($value->customers as $key=>$val)
<label class="custom-control custom-checkbox mt-2" style="margin-right: 20px;">
{!! Form::checkbox('send_mail_to['.$key.']', 1, $key, ['class'=>'custom-control-input']) !!}
<span class="custom-control-label">{{$val}}</span>
</label>
@endforeach
</div>
</div>
@endif
@if(isset($value->booking))
<div class="">
@if(isset($value->customer_mail))
<p><strong>Antwort auf: </strong>
{{ $value->customer_mail->id }} || {{ $value->customer_mail->subject }}
</p>
@endif
<p><strong>Buchung: </strong>
{{ $value->booking->id }}
@if($value->booking->travel_country_id)
{{ " | ".$value->booking->travel_country->name }}
@endif
@if($value->booking->travelagenda_id)
{{ " | ".$value->booking->travel_agenda->name }}
@endif
</p>
@if($value->booking->customer)
<p><strong>Kunde: </strong>
{{ $value->booking->customer->salutation->name }} {{ $value->booking->customer->firstname }} {{ $value->booking->customer->name }}
</p>
@endif
</div>
<div class="form-row">
<div class="form-group col">
<label for="mail_from" class="form-label">E-Mail von:</label>
{{ Form::text('mail_from', $value->booking->customer ? $value->booking->customer->email : '', array('placeholder'=>'E-Mail Adresse von', 'id'=>'mail_from', 'class'=>'form-control', 'required')) }}
</div>
</div>
<div class="form-row">
<div class="form-group col">
<label for="sent_at" class="form-label">Gesendet am:</label>
{{ Form::text('sent_at', \Carbon::now()->format('d.m.Y H:i'), array('placeholder'=>__(\Carbon::now()->format('d.m.Y - H:i')), 'class'=>'form-control b-material-datetime-picker', 'id'=>'sent_at')) }}
</div>
</div>
@endif
<div class="form-row">
<div class="form-group col">
<label for="subject" class="form-label">Betreff</label>
{{ Form::text('subject', $value->subject, array('placeholder'=>$value->s_placeholder, 'id'=>'subject', 'class'=>'form-control', 'required')) }}
</div>
</div>
<div class="form-group mb-1">
<label class="form-label" for="message">Nachricht</label>
{{ Form::textarea('message', $value->message, array('placeholder'=>$value->m_placeholder, 'class'=>'form-control', 'rows'=>15)) }}
</div>
@if(isset($value->customers))
<p>Platzhalter: #geehrte/r# #Anrede# #Vorname# #Nachname# #Reiseland# #Programm# </p>
@endif
@if(isset($value->customer_mail))
{{ Form::hidden('customer_mail_id', $value->customer_mail->id) }}
@endif
<hr>
{!! Form::close() !!}
<div class="row">
<div class="col-12">
<h5>Datei Anhänge</h5>
</div>
<div class="col-12">
<div class="alert alert-danger alert-dismissable" style="display:none;"></div>
</div>
<div class="col-6" id="preview-mail-attachment">
</div>
<div class="col-6">
{!! Form::open([ 'url' => route('customer_mail_upload_attachment', ['tmp']), 'method' => 'post', 'files' => true, 'enctype' => 'multipart/form-data', 'class' => 'dropzone', 'id' => 'uploadAttachmentFile' ]) !!}
<div class="fallback">
<input name="file" type="file" multiple>
</div>
{!! Form::close() !!}
</div>
</div>
@if(isset($value->customer_mail))
<hr>
@include('customer.mail.modal-show-mail-inner', ['customer_mail' => $value->customer_mail])
@endif
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">schließen</button>
@if(isset($value->customers))
<button type="submit" id="submit-button-form" class="btn btn-primary"><i class="ion ion-ios-mail-open"></i> senden</button>
@endif
@if(isset($value->booking))
<button type="submit" id="submit-button-form" class="btn btn-primary"><i class="ion ion-ios-mail-open"></i> speichern</button>
@endif
</div>
<div class="message-attachment ui-bordered p-2 mr-3 mb-3 d-none" id="mail-attachment-template">
<div class="message-attachment-file display-4"><i class="mail-att-icon"></i></div>
<div class="media-body ml-3">
<strong class="message-attachment-filename"> </strong>
<div class="text-muted small mail-att-size"> </div>
<div>
<a href="javascript:void(0)" target="_blank" class="mail-att-show">Vorschau</a> &nbsp;
<a href="javascript:void(0)" class="mail-att-delete">entfernen</a>
</div>
</div>
</div>
</div>
<script type="text/javascript">
function add_mail_attachment_preview(file, response){
var template = $('#mail-attachment-template').clone()
.removeAttr('id').removeClass('d-none')
.attr('data-id', response.file_id);
template.find('.mail-att-icon').addClass(response.file_icon);
template.find('.message-attachment-filename').text(response.filename);
template.find('.mail-att-size').text(response.file_format_bytes);
///'storage/file/{id}/{disk}
template.find('.mail-att-show').attr('href', response.file_url);
template.find('.mail-att-delete').on('click', function () {
$(this).parents('.message-attachment').remove();
});
$('#preview-mail-attachment').append(template);
}
$(document).ready(function() {
$('.b-material-datetime-picker').bootstrapMaterialDatePicker({
weekStart: 1,
format : 'DD.MM.YYYY HH:mm',
shortTime: false,
nowButton : true,
clearButton: true,
lang: 'de',
//currentDate: ''
});
$("#submit-button-form").click(function(event) {
@if(isset($value->customers))
if( !confirm('E-Mail wirklich senden?') ){
event.preventDefault();
return;
}
@endif
var message_attachment = $('#preview-mail-attachment').find('.message-attachment');
$.each( message_attachment, function( index, value ){
$('#customer-mail-form').append('<input type="hidden" name="message_attachment_id[]" value="'+$(value).data('id')+'">');
});
$( "#customer-mail-form" ).submit();
// event.preventDefault();
});
Dropzone.autoDiscover = false;
$("#uploadAttachmentFile").dropzone({
uploadMultiple: false,
parallelUploads: 1,
maxFilesize: 32,
addRemoveLinks: true,
dictDefaultMessage: '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
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){
add_mail_attachment_preview(file, response);
this.removeFile(file);
}
}
});
});
</script>