Mail and Booking

This commit is contained in:
Kevin Adametz 2020-04-15 12:11:42 +02:00
parent 62e84637b6
commit 5daea268f7
250 changed files with 5377 additions and 1473 deletions

View file

@ -13,30 +13,15 @@
<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>
{{ Form::hidden('action', '') }}
@if(isset($value->save_customer_mail_id))
{{ Form::hidden('save_customer_mail_id', $value->save_customer_mail_id) }}
@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>
@if($value->show === 'single' || $value->show === 'reply')
<div class="row">
<div class="col-sm-4">
<strong>Buchung: </strong><br>
{{ $value->booking->id }}
@if($value->booking->travel_country_id)
{{ " | ".$value->booking->travel_country->name }}
@ -44,13 +29,76 @@
@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="col-sm-4">
@if($value->booking->customer)
<strong>Kunde: </strong><br>{{ $value->booking->customer->salutation->name }} {{ $value->booking->customer->firstname }} {{ $value->booking->customer->name }}
@endif
</div>
<div class="col-sm-4">
@if(isset($value->customer_mail))
<strong>Antwort auf: </strong><br>{{ $value->customer_mail->id }} || {{ $value->customer_mail->subject }}
@endif
</div>
<div class="col-sm-12">
<hr>
</div>
</div>
@endif
@if(isset($value->customers))
@if($value->show === 'single')
<div class="form-row">
<div class="form-group col-sm-12 mb-1">
<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">
<div class="row">
<div class="col-sm-6">
{{ Form::text('send_mail_to_mail['.$key.']', $val['email'], array('placeholder'=>'Erste E-Mail: Pflichtpfeld', 'id'=>'send_mail_to_mail_'.$key, 'class'=>'form-control', 'style'=>'margin-top: -8px;', 'required')) }}
</div>
<div class="col-sm-6">
<button type="button" class="btn btn-sm btn-outline-primary mt-1 mb-2" data-toggle="collapse" data-target="#collapseModalNewMailRe" aria-expanded="false" aria-controls="collapseModalNewMailRe"><i class="fa fa-plus-circle"></i> Weitere Empfänger</button>
</div>
</div>
</span>
</label>
@endforeach
</div>
</div>
<div class="collapse form-row" id="collapseModalNewMailRe">
<div class="form-group col-sm-4">
<label class="form-label" for="recipient">TO: (weitere Empfänger)</label>
{{ Form::textarea('recipient', $value->recipient, ['class' => 'form-control', 'rows'=>4]) }}
</div>
<div class="form-group col-sm-4">
<label class="form-label" for="cc">CC: (Kopie Empfänger)</label>
{{ Form::textarea('cc', $value->cc, ['class' => 'form-control', 'rows'=>4]) }}
</div>
<div class="form-group col-sm-4">
<label class="form-label" for="bcc">BCC: (Blindkopie Empfänger)</label>
{{ Form::textarea('bcc', $value->bcc, ['class' => 'form-control', 'rows'=>4]) }}
</div>
</div>
@endif
@if($value->show === 'multi')
<div class="form-row">
<div class="form-group col-sm-12 mb-1">
<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['email'] }} | {{ $val['name'] }}</span>
</label>
@endforeach
</div>
</div>
@endif
@endif
@if($value->show === 'reply' && isset($value->booking))
<div class="form-row">
<div class="form-group col">
<label for="mail_from" class="form-label">E-Mail von:</label>
@ -75,10 +123,64 @@
<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 id="message-editor-toolbar">
<span class="ql-formats">
<button class="ql-bold"></button>
<button class="ql-italic"></button>
<button class="ql-underline"></button>
<button class="ql-strike"></button>
</span>
<span class="ql-formats">
<button class="ql-header" value="1"></button>
<button class="ql-header" value="2"></button>
<button class="ql-blockquote"></button>
<button class="ql-code-block"></button>
</span>
<span class="ql-formats">
<button class="ql-list" value="ordered"></button>
<button class="ql-list" value="bullet"></button>
<button class="ql-indent" value="-1"></button>
<button class="ql-indent" value="+1"></button>
</span>
<span class="ql-formats">
<select class="ql-align"></select>
</span>
<span class="ql-formats">
<button class="ql-clean"></button>
</span>
</div>
<div id="message-editor" style="height: 400px">{!! $value->message !!}</div>
{{ Form::textarea('message', $value->message, array('placeholder'=>$value->m_placeholder, 'id'=>'message-editor-fallback', 'class'=>'form-control d-none', 'rows'=>15)) }}
</div>
@if(isset($value->customers))
<p>Platzhalter: #geehrte/r# #Anrede# #Vorname# #Nachname# #Reiseland# #Programm# </p>
<p>Platzhalter: #geehrte/r# #Anrede# #Vorname# #Nachname# #Reiseland# #Programm# #Anreisedatum# #Abreisedatum# #Buchungsdatum# #Airline#</p>
@endif
@if($value->show === 'single' || $value->show === 'reply')
<div class="form-row">
<div class="col-sm-6">
<label for="to" class="form-label">Ablegen unter:</label>
<select class="custom-select" name="dir" id="send_mail_dir">
@foreach($value->booking::$customer_mail_dirs as $dir_id=>$customer_mail_dirs)
@if($dir_id <= 10)
<option value="{{$dir_id}}" @if($value->customer_mail_dir == $dir_id) selected @endif>{{$customer_mail_dirs['name']}}</option>
@endif
@endforeach
</select>
</div>
<div class="col-sm-6">
<label for="send_mail_country" class="form-label">&nbsp;</label>
<select class="custom-select" name="travel_country_id" id="send_mail_country">
@if($value->booking->travel_country)
@foreach($value->booking->travel_country->getCountryLands() as $country_id => $country_name)
<option value="0">Nur bei Agentur -> Land</option>
<option value="{{$country_id}}" @if($value->customer_mail_country == $country_id) selected @endif>{{$country_name}}</option>
@endforeach
@endif
</select>
</div>
</div>
@endif
@if(isset($value->customer_mail))
{{ Form::hidden('customer_mail_id', $value->customer_mail->id) }}
@ -92,10 +194,23 @@
</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">
@if(isset($value->customer_files))
@foreach($value->customer_files as $customer_file)
<div class="message-attachment ui-bordered p-2 mr-3 mb-3">
<div class="message-attachment-file display-4"><i class="mail-att-icon {{$customer_file->getIconExt()}}"></i></div>
<div class="media-body ml-3">
<strong class="message-attachment-filename">{{$customer_file->filename}}</strong>
<div class="text-muted small mail-att-size">{{$customer_file->formatBytes()}}</div>
<div>
<a href="{{$customer_file->getURL()}}" target="_blank" class="mail-att-show">Vorschau</a> &nbsp;
{{-- <a href="javascript:void(0)" class="mail-att-delete">entfernen</a> --}}
</div>
</div>
</div>
@endforeach
@endif
</div>
<div class="col-6">
@ -113,12 +228,15 @@
@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>
<button type="button" class="btn btn-default float-left" data-dismiss="modal">schließen</button>
@if($value->show === 'single' || $value->show === 'multi')
@if($value->draft)
<button type="submit" class="btn btn-next submit-button-form" value="draft"><i class="ion ion-ios-save"></i> Entwurf speichern</button>
@endif
<button type="submit" class="btn btn-primary submit-button-form" value="send"><i class="ion ion-ios-mail-open"></i> E-Mail 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>
@if($value->show === 'reply')
<button type="submit" class="btn btn-primary submit-button-form" value="save"><i class="ion ion-ios-mail-open"></i> Antwort speichern</button>
@endif
</div>
<div class="message-attachment ui-bordered p-2 mr-3 mb-3 d-none" id="mail-attachment-template">
@ -134,6 +252,9 @@
</div>
</div>
<script type="text/javascript">
function add_mail_attachment_preview(file, response){
@ -152,8 +273,38 @@
$('#preview-mail-attachment').append(template);
}
function change_dir_country_select(){
//agentur
if($('#send_mail_dir').val() == 1){
$('#send_mail_country').prop('disabled', false);
}else{
$('#send_mail_country').prop('disabled', true);
$('#send_mail_country').val(0);
}
}
$(document).ready(function() {
change_dir_country_select();
$('#send_mail_dir').on('change', function () {
change_dir_country_select();
});
if (!window.Quill) {
$('#message-editor,#message-editor-toolbar').remove();
$('#message-editor-fallback').removeClass('d-none');
} else {
//$('#message-editor-fallback').remove();
var quill = new Quill('#message-editor', {
modules: {
toolbar: '#message-editor-toolbar'
},
placeholder: '{{$value->m_placeholder}}',
theme: 'snow'
});
}
$('.b-material-datetime-picker').bootstrapMaterialDatePicker({
weekStart: 1,
format : 'DD.MM.YYYY HH:mm',
@ -164,19 +315,20 @@
//currentDate: ''
});
$("#submit-button-form").click(function(event) {
$(".submit-button-form").click(function(event) {
@if(isset($value->customers))
if( !confirm('E-Mail wirklich senden?') ){
if($(this).val() === 'send' && !confirm('E-Mail wirklich senden?')){
event.preventDefault();
return;
}
@endif
$('#customer-mail-form input[name=action]').val($(this).val());
$("#message-editor-fallback").val($('#message-editor .ql-editor').html());
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;