Fewo Mails / Booking Country Services

This commit is contained in:
Kevin Adametz 2020-05-28 19:03:42 +02:00
parent b9c26d06d0
commit 48a6eb2282
154 changed files with 7761 additions and 1643 deletions

View file

@ -0,0 +1,78 @@
<div class="table-responsive border-bottom mb-2">
<table class="table table-striped table-sm" id="table-modal-booking-files">
<thead>
<tr>
<th>#</th>
<th>Datei</th>
<th>Inhalt</th>
<th>Datum</th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody>
@php($booking_files_count = 1)
@foreach(\App\Services\BookingFewo::contentFiles() as $content_file)
@if($file = \App\Models\CMSContent::getModelBySlug($content_file))
<tr>
<th scope="row">{{$booking_files_count++}}</th>
<td>
<a target="_blank" href="{{ $file->getURL() }}" class="badge badge-md badge-next">
<i class="fa fa-file-pdf mr-1"></i> {{$file->name}}
</a>
</td>
<td>
{{ $file->formatBytes() }}
</td>
<td>{{\App\Services\Util::_format_date($file->created_at, 'date')}}</td>
<td>
<button data-target="{{ $file->getURL() }}" data-name="{{ $file->name }}" class="btn btn-xs btn-primary add-file-to-attachment"
title="als Anhang hinzufügen" data-placement="left" rel="tooltip">
<i class="fa fa-cloud-download-alt"></i>
</button>
</td>
</tr>
@endif
@endforeach
@if($booking->booking_files)
@foreach($booking->booking_files as $booking_file)
<tr>
<th scope="row">{{$booking_files_count++}}</th>
<td>
<a target="_blank" href="{{ $booking_file->getURL() }}" class="badge badge-md badge-secondary">
<i class="{{$booking_file->getIconExt()}} mr-1"></i> {{ $booking_file->original_name }}
</a>
</td>
<td>
{{ $booking_file->mine }} | {{ $booking_file->formatBytes() }}
</td>
<td>{{\App\Services\Util::_format_date($booking_file->created_at, 'date')}}</td>
<td>
<button data-target="{{ $booking_file->getURL() }}" data-name="{{ $booking_file->original_name }}" class="btn btn-xs btn-primary add-file-to-attachment"
title="als Anhang hinzufügen" data-placement="left" rel="tooltip">
<i class="fa fa-cloud-download-alt"></i>
</button>
</td>
</tr>
@endforeach
@endif
</tbody>
</table>
</div>
<script type="text/javascript">
$(document).ready(function() {
$('#table-modal-booking-files [rel="tooltip"]').tooltip({trigger: "hover"});
$('#table-modal-booking-files .add-file-to-attachment').on('click', function (event) {
var $elem = $('<div/>');
$elem.data('action', 'add_attachment');
$elem.data('id', 'new');
$elem.data('url', '{{route('customer_fewo_mail_ajax')}}');
$elem.data('target', $(this).data('target'));
$elem.data('name', $(this).data('name'));
ajax_object_action(event, $elem, callback_ajax_add_attachment);
});
});
</script>

View file

@ -0,0 +1,512 @@
<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('travel_user_booking_fewo_id', $value->id) }}
{{ Form::hidden('action', '') }}
@if(isset($value->save_customer_mail_id))
{{ Form::hidden('save_customer_mail_id', $value->save_customer_mail_id) }}
@endif
@if($value->show === 'single' || $value->show === 'reply')
<div class="row">
@if(isset($value->booking))
<div class="col-sm-4">
<strong>Buchung: </strong><br>
@if($value->booking->fewo_lodging_id)
{{ $value->booking->fewo_lodging->name." | " }}
@endif
({{ $value->booking->id }})
</div>
<div class="col-sm-4">
@if($value->booking->customer)
<strong>Kunde: </strong><br>{{ $value->booking->customer->getSalutation() }} {{ $value->booking->customer->title }} {{ $value->booking->customer->first_name }} {{ $value->booking->customer->last_name }}
({{$value->booking->id}})
@endif
@if($value->booking)
@endif
</div>
@endif
<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>
{{ Form::text('mail_from', $value->booking->travel_user ? $value->booking->travel_user->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">
{{ Form::hidden('lead_title_id', $value->lead_title_id, array('id'=>'lead_title_id')) }}
<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>
@if($value->show === 'single' || $value->show === 'multi')
@if(Auth::user()->isPermission('sua-st-em'))
<div class="float-right small">Vorlage unter: <a href="{{route('admin_settings_emails')}}">Einstellungen -> E-Mails / Vorlagen</a></div>
@endif
@endif
<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>
<span class="ql-formats">
<select class="ql-placeholder">
{!! \App\Services\Placeholder::getBookingOptions() !!}
</select>
</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($value->show === 'single' || $value->show === 'multi')
<div class="row">
<div class="col-12">
<button type="button" class="btn btn-sm btn-outline-next mt-1 mb-3 float-left" data-toggle="collapse" data-target="#collapseModalEmailTemplate" aria-expanded="false" aria-controls="collapseModalEmailTemplate"><i class="ion ion-ios-mail"></i> E-Mail Vorlage laden</button>
</div>
<div class="collapse col-12" id="collapseModalEmailTemplate">
<hr class="mt-0">
<select class="custom-select" name="filter_email_templates_directory" id="filter_email_templates_directory" style="">
<option value="">Alle Verzeichniss</option>
@foreach($value->filter_email_templates_directories as $id=>$name)
<option value="{{$id}}" >{{$name}}</option>
@endforeach
</select>
<div class="table-responsive" id="email_templates_table">
<table id="datatables-email-templates" class="table table-striped">
<thead>
<tr>
<th>#</th>
<th>{{__('Vorlage Bezeichnung')}}</th>
<th>{{__('Verzeichniss')}}</th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody class="">
</tbody>
</table>
</div>
<hr class="mt-1">
</div>
</div>
@endif
@if($value->show === 'single' || $value->show === 'reply')
<div class="form-row">
<div class="col-sm-6">
<label for="send_mail_dir" class="form-label">Ablegen unter:</label>
<select class="custom-select" name="dir" id="send_mail_dir">
@foreach(\App\Services\BookingFewo::getCustomerMailDirs() as $customer_mail_dir)
<option value="{{$customer_mail_dir->pos}}" @if($value->customer_mail_dir == $customer_mail_dir->pos) selected @endif>{{$customer_mail_dir->name}}</option>
@endforeach
</select>
</div>
<div class="col-sm-6">
<label for="subdir" class="form-label">&nbsp;</label>
{{-- TODO load subdirs by pos id --}}
{{-- @if(isset($value->booking))
@foreach(\App\Services\Booking::getCustomerMailDirs() as $customer_mail_dir)
@if($customer_mail_dir->pos > 0)
<select class="custom-select send_mail_subdir" name="subdir" id="send_mail_subdir_{{$customer_mail_dir->pos}}">
<option value="0">keinen Unterordner</option>
@foreach($value->booking->travel_country->getMailDirs($customer_mail_dir->pos) as $mail_dir_id)
@php ($mail_dir_name = \App\Services\Booking::getCustomerMailName($customer_mail_dir, $mail_dir_id))
<option value="{{$mail_dir_id}}" @if($value->customer_mail_subdir == $mail_dir_id) selected @endif>{{$mail_dir_name}}</option>
@endforeach
</select>
@endif
@endforeach
@endif
--}}
</div>
</div>
@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">
@if($value->show === 'single' && isset($value->booking))
<button type="button" class="btn btn-sm btn-outline-primary mt-1 mb-2 float-right" data-toggle="collapse" data-target="#collapseModalBookingFiles" aria-expanded="false" aria-controls="collapseModalBookingFiles"><i class="fa fa-plus-circle"></i> Dateien aus Buchung</button>
@endif
<h5>Datei Anhänge</h5>
</div>
@if($value->show === 'single' && isset($value->booking))
<div class="collapse col-12" id="collapseModalBookingFiles">
@include('travel.user.booking.mail.modal-new-booking-files', ['booking'=>$value->booking])
</div>
@endif
<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->original_name}}</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)" data-url="{{route('customer_fewo_mail_ajax')}}" data-id="{{$customer_file->id}}" data-action="delete_mail_attachment" class="mail-att-delete">löschen</a>
</div>
</div>
</div>
@endforeach
@endif
</div>
<div class="col-6">
{!! Form::open([ 'url' => route('customer_fewo_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('travel.user.booking.mail.modal-show-mail-inner', ['customer_mail' => $value->customer_mail])
@endif
</div>
<div class="modal-footer">
<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($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">
<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-remove">entfernen</a>
</div>
</div>
</div>
</div>
<script type="text/javascript">
function callback_ajax_add_attachment(response) {
if(response.error === false){
add_mail_attachment_preview(response);
}
}
function add_mail_attachment_preview(response){
console.log(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.original_name);
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-remove').on('click', function () {
$(this).parents('.message-attachment').remove();
});
$('#preview-mail-attachment').append(template);
}
function change_mail_subdir_select(){
var $dir_id = $('#send_mail_dir').val();
$('.send_mail_subdir').each(function () {
var send_mail_subdir = 'send_mail_subdir_' + $dir_id;
if($(this).attr('id') === send_mail_subdir){
$(this).prop('disabled', false);
$(this).show();
}else{
$(this).prop('disabled', true);
$(this).val(0);
$(this).hide();
}
})
}
$(document).ready(function() {
change_mail_subdir_select();
$('#send_mail_dir').on('change', function () {
change_mail_subdir_select();
});
if (!window.Quill) {
$('#message-editor,#message-editor-toolbar').remove();
$('#message-editor-fallback').removeClass('d-none');
} else {
Quill.register('modules/placeholder', PlaceholderModule.default(Quill))
//$('#message-editor-fallback').remove();
var quill = new Quill('#message-editor', {
debug: 'error',
modules: {
toolbar: '#message-editor-toolbar',
placeholder: {
placeholders: [
{!! \App\Services\Placeholder::getBookingQuill() !!}
]
}
},
placeholder: '{{$value->m_placeholder}}',
theme: 'snow'
});
}
$('.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($(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();
});
$("#preview-mail-attachment .mail-att-delete").click(function(event) {
_self = $(this);
if(!confirm('Angang wirklick löschen?')){
event.preventDefault();
return;
}
ajax_object_action(event, $(this), function (data) {
console.log(data);
if(data.status === 'success'){
_self.parents('.message-attachment').remove();
}
});
});
var emailTempplateTable = $('#datatables-email-templates').DataTable({
"processing": true,
"serverSide": true,
"searching": true,
"autoWidth": false,
ajax: {
url: '{!! route( 'email_template_data_table' ) !!}',
data: function(d) {
d.filter_email_templates_directory = $('select[name=filter_email_templates_directory]').val();
}
},
"columns": [
{ data: 'id', width: '8%', searchable: true },
{ data: 'name', name: 'name', width: '', searchable: true },
{ data: 'email_template_dir.name', name: 'email_template_dir.name', width: '25%', orderable: false, searchable: false },
{ data: 'action', width: '8%', orderable: false, searchable: false},
],
"bLengthChange": false,
"iDisplayLength": 10,
"orderSequence": ["desc", "asc"],
"order": [[ 0, "desc" ]],
"language": {
"url": "/js/German.json"
},
"drawCallback": function( settings ) {
$('#datatables-email-templates [rel="tooltip"]').tooltip({trigger: "hover"});
$('#datatables-email-templates .email-template-action').on('click', function (event) {
ajax_object_action(event, $(this), callback_email_template_data_table);
});
}
});
$('#filter_email_templates_directory').on('change', function(){
emailTempplateTable.draw();
});
function callback_email_template_data_table(data) {
if(data.status === 'success'){
$('input#subject').val(data.response.subject + $('input#lead_title_id').val());
$("input#message-editor-fallback").val(data.html);
$('#message-editor .ql-editor').html(data.html)
$('#collapseModalEmailTemplate').collapse('hide');
}
}
Dropzone.autoDiscover = false;
$("#uploadAttachmentFile").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
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(response);
this.removeFile(file);
}
}
});
});
</script>

View file

@ -0,0 +1,145 @@
<div class="card mb-2">
<!-- Header -->
<div class="media px-4 pt-4 pb-2">
<a href="javascript:void(0)" class="messages-sidebox-toggler d-lg-none d-block align-self-center text-muted text-large pr-3 mr-3"><i class="ion ion-md-more"></i></a>
<!-- Sender photo -->
<div class="media-body">
<!-- Sender & date -->
<div class="mb-1">
@if($customer_mail->is_answer)
Antwort von:<br>
@else
Gesendet an:<br>
@endif
&lt;<a href="mailto:{{$customer_mail->email}}">{{$customer_mail->email}}</a>&gt; {{$customer_mail->sent_at }}
@if($customer_mail->recipient)
<div>TO: {{\App\Services\Util::_implodeLines($customer_mail->recipient, ', ')}}</div>
@endif
@if($customer_mail->cc)
<div>CC: {{\App\Services\Util::_implodeLines($customer_mail->cc, ', ')}}</div>
@endif
@if($customer_mail->bcc)
<div>BCC: {{\App\Services\Util::_implodeLines($customer_mail->bcc, ', ')}}</div>
@endif
</div>
<!-- Subject -->
<h5 class="line-height-inherit m-0">{{$customer_mail->subject}}</h5>
</div>
</div>
<hr class="border-light m-0">
<!-- / Header -->
{{-- <!-- Controls -->
<div class="media flex-wrap align-items-center p-2">
<div class="media-body d-flex flex-wrap flex-basis-100 flex-basis-sm-auto">
<button type="button" class="btn btn-default borderless md-btn-flat icon-btn messages-tooltip text-muted mr-3" title="Back"><i class="ion ion-md-arrow-back"></i></button>
<button type="button" class="btn btn-default borderless md-btn-flat icon-btn messages-tooltip text-muted" title="Mark as unread"><i class="ion ion-md-mail-unread"></i></button>
<button type="button" class="btn btn-default borderless md-btn-flat icon-btn messages-tooltip text-muted" title="Mark as important"><i class="ion ion-md-alert"></i></button>
<button type="button" class="btn btn-default borderless md-btn-flat icon-btn messages-tooltip text-muted" title="Move to spam"><i class="ion ion-md-folder-open"></i></button>
<button type="button" class="btn btn-default borderless md-btn-flat icon-btn messages-tooltip text-muted" title="Move to trash"><i class="ion ion-md-trash"></i></button>
</div>
<div class="d-flex flex-wrap align-items-center ml-auto">
<button type="button" class="btn btn-default borderless md-btn-flat text-muted px-3"><i class="ion ion-ios-undo"></i>&nbsp; Reply</button>
<div class="text-lighter">|</div>
<button type="button" class="btn btn-default borderless md-btn-flat text-muted px-3">Forward &nbsp;<i class="ion ion-ios-redo"></i></button>
</div>
</div>
<hr class="border-light m-0">
<!-- / Controls -->
--}}
<div class="p-4">
{!! nl2br($customer_mail->message) !!}
</div>
<hr class="border-light m-0">
<!-- Message infos -->
<div class="px-4 pt-4 pb-2">
@if($customer_mail->customer)
<p><strong>Kunde: </strong>
{{ $customer_mail->customer->getSalutation() }} {{ $customer_mail->customer->title }} {{ $customer_mail->customer->firstname }} {{ $customer_mail->customer->name }}
@if($customer_mail->booking)
({{$customer_mail->booking->id}})1
@endif
</p>
@endif
@if($customer_mail->booking)
<p><strong>Buchung: </strong>
@if($value->booking->fewo_lodging_id) {{ $value->booking->fewo_lodging->name." | " }} @endif
({{ $value->booking->id }})
</p>
@endif
@if($customer_mail->send)
<span class="badge badge-success">Mail gesendet</span>
<p>Datum: {{$customer_mail->sent_at}}</p>
@endif
@if($customer_mail->fail)
<span class="badge badge-danger">Mail Fehler</span>
<p>{{$customer_mail->error }}</p>
@endif
</div>
<!-- Message attachments -->
@if($customer_mail->customer_files)
<hr class="border-light m-0">
<div class="px-4 pt-4 pb-2">
<h6 class="small font-weight-semibold mb-4">Datei-Anhänge</h6>
<div class="row">
@foreach($customer_mail->customer_files as $file)
<div class="col-sm-12 col-md-6 col-xl-4">
<div class="message-attachment ui-bordered p-2 mr-3 mb-3">
<div class="message-attachment-file display-4"><i class="{{$file->getIconExt()}}"></i></div>
<div class="media-body ml-3">
<strong class="message-attachment-filename">{{$file->original_name}}</strong>
<div class="text-muted small">{{$file->formatBytes()}}</div>
<div>
<a href="{{$file->getURL()}}" target="_blank" class="mail-att-show">Vorschau</a> &nbsp;
</div>
</div>
</div>
</div>
@endforeach
</div>
</div>
@endif
@if(isset($show_move_dirs))
<hr class="border-light m-0">
<div class="px-4 pt-4 pb-2">
{!! Form::open(['url' => route('customer_mail_detail', [$customer_mail->id, 'move-mail-fewo']), 'class' => 'move-mail-form']) !!}
<div class="form-row">
<div class="col-sm-6">
<label for="customer_mail_dir" class="form-label">Ablegen unter:</label>
<select class="custom-select customer_mail_dir" name="dir" id="customer_mail_dir">
@foreach(\App\Services\BookingFewo::getCustomerMailDirs() as $customer_mail_dir)
<option value="{{$customer_mail_dir->pos}}" @if($customer_mail->dir == $customer_mail_dir->pos) selected @endif>{{$customer_mail_dir->name}}</option>
@endforeach
</select>
</div>
<div class="col-sm-6">
<button type="submit" class="btn btn-xs btn-default float-right mt-1"><i class="ion ion-ios-redo"></i>&nbsp; verschieben</button>
<label for="subdir" class="form-label">&nbsp;</label>
{{-- TODO load subdirs by pos id
@if($customer_mail->booking->travel_country)
@foreach(\App\Services\Booking::getCustomerMailDirs() as $customer_mail_dir)
@if($customer_mail_dir->pos > 0)
<select class="custom-select customer_mail_subdir" name="subdir" id="customer_mail_subdir_{{$customer_mail_dir->pos}}">
<option value="0">keinen Unterordner</option>
@foreach($customer_mail->booking->travel_country->getMailDirs($customer_mail_dir->pos) as $mail_dir_id)
@php ($mail_dir_name = \App\Services\Booking::getCustomerMailName($customer_mail_dir, $mail_dir_id))
<option value="{{$mail_dir_id}}" @if($customer_mail->subdir == $mail_dir_id) selected @endif>{{$mail_dir_name}}</option>
@endforeach
</select>
@endif
@endforeach
@endif
--}}
</div>
</div>
{!! Form::close() !!}
</div>
@endif
</div>

View file

@ -0,0 +1,53 @@
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">
{{ $value->title }}
</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">×</button>
</div>
<div class="modal-body">
@include('travel.user.booking.mail.modal-show-mail-inner', ['customer_mail' => $customer_mail, 'show_move_dirs' => true])
@if($customer_mail->customer_fewo_mail)
@include('travel.user.booking.mail.modal-show-mail-inner', ['customer_fewo_mail' => $customer_mail->customer_mail])
@endif
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">schließen</button>
</div>
</div>
<script type="text/javascript">
function change_mail_subdir_select(_form){
var $dir_id = _form.find('#customer_mail_dir').val();
$('.customer_mail_subdir').each(function () {
var customer_mail_subdir = 'customer_mail_subdir_' + $dir_id;
if($(this).attr('id') === customer_mail_subdir){
$(this).prop('disabled', false);
$(this).show();
}else{
$(this).prop('disabled', true);
$(this).val(0);
$(this).hide();
}
})
}
$(document).ready(function() {
$('form.move-mail-form').each(function () {
var _form = $(this);
$(this).find('.customer_mail_dir').on('change', function () {
change_mail_subdir_select(_form);
_form.find('.btn-default').removeClass('btn-default').addClass('btn-primary');
});
$(this).find('.customer_mail_subdir').on('change', function () {
_form.find('.btn-default').removeClass('btn-default').addClass('btn-primary');
});
change_mail_subdir_select(_form);
});
});
</script>