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

@ -193,7 +193,7 @@
<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->filename}}</strong>
<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;

View file

@ -154,27 +154,52 @@
@endforeach
@endif
@if($security_certificate = \App\Models\CMSContent::getModelBySlug('sicherungsschein-nach-sis651r-pdf'))
<tr>
<th scope="row">{{$booking_files_count++}}</th>
<td>
<a target="_blank" href="{{ $security_certificate->getURL() }}" class="badge badge-md badge-next">
<i class="fa fa-file-pdf mr-1"></i> {{$security_certificate->name}}
</a>
</td>
<td>
{{ $security_certificate->formatBytes() }}
</td>
<td>{{\App\Services\Util::_format_date($security_certificate->created_at, 'date')}}</td>
<td>
<button data-target="{{ $security_certificate->getURL() }}" data-name="{{ $security_certificate->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
@foreach(\App\Services\Booking::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
@foreach($booking->travel_country->getContactLandsModels() as $TravelCountry)
@if($TravelCountry->stern_travel_country)
@foreach($TravelCountry->stern_travel_country->general_files as $general_files)
<tr>
<th scope="row">{{$booking_files_count++}}</th>
<td>
<a target="_blank" href="{{ $general_files->getURL() }}" class="badge badge-md badge-info">
<i class="{{$general_files->getIconExt()}} mr-1"></i> {{$general_files->original_name}}
</a>
</td>
<td>
{{ $general_files->mine }} | {{ $general_files->formatBytes() }}
</td>
<td>{{\App\Services\Util::_format_date($general_files->created_at, 'date')}}</td>
<td>
<button data-target="{{ $general_files->getURL() }}" data-name="{{ $general_files->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
@endforeach
@if($booking->booking_files)
@foreach($booking->booking_files as $booking_file)
<tr>

View file

@ -130,8 +130,8 @@
<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-et'))
<div class="float-right small">Vorlage unter: <a href="{{route('admin_settings_email_template')}}">Einstellungen -> E-Mail Vorlagen</a></div>
@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">
@ -175,12 +175,21 @@
</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>{{__('Betreff')}}</th>
<th>{{__('Vorlage Bezeichnung')}}</th>
<th>{{__('Verzeichniss')}}</th>
<th>&nbsp;</th>
</tr>
</thead>
@ -197,23 +206,27 @@
<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($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
@foreach(\App\Services\Booking::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="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>
<label for="subdir" class="form-label">&nbsp;</label>
{{-- TODO load subdirs by pos id --}}
@if(isset($value->booking) && $value->booking->travel_country)
@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
@endif
</select>
</select>
@endif
@endforeach
@endif
</div>
</div>
@endif
@ -244,7 +257,7 @@
<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>
<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;
@ -320,22 +333,25 @@
$('#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);
}
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_dir_country_select();
change_mail_subdir_select();
$('#send_mail_dir').on('change', function () {
change_dir_country_select();
change_mail_subdir_select();
});
if (!window.Quill) {
$('#message-editor,#message-editor-toolbar').remove();
@ -344,6 +360,7 @@
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: {
@ -400,7 +417,6 @@
});
var emailTempplateTable = $('#datatables-email-templates').DataTable({
"processing": true,
"serverSide": true,
@ -408,10 +424,14 @@
"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: 'subject', name: 'subject', width: '', 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,
@ -428,6 +448,10 @@
});
}
});
$('#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());

View file

@ -110,34 +110,40 @@
</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']), 'class' => 'move-mail-form']) !!}
<div class="form-row">
<div class="col-sm-6">
<label for="customer_mail_dir_{{$customer_mail->id}}" class="form-label">Ablegen unter:</label>
<select class="custom-select customer_mail_dir" name="dir" id="customer_mail_dir_{{$customer_mail->id}}">
@foreach($customer_mail->booking::$customer_mail_dirs as $dir_id=>$customer_mail_dirs)
@if($dir_id <= 10)
<option value="{{$dir_id}}" @if($customer_mail->dir == $dir_id) selected @endif>{{$customer_mail_dirs['name']}}</option>
@endif
<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\Booking::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="customer_mail_country_{{$customer_mail->id}}" class="form-label">&nbsp;</label>
<select class="custom-select customer_mail_country" name="travel_country_id" id="customer_mail_country_{{$customer_mail->id}}">
@if($customer_mail->booking->travel_country)
@foreach($customer_mail->booking->travel_country->getCountryLands() as $country_id => $country_name)
<option value="0">Nur bei Agentur -> Land</option>
<option value="{{$country_id}}" @if($customer_mail->travel_country_id == $country_id) selected @endif>{{$country_name}}</option>
@endforeach
@endif
</select>
<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

@ -8,7 +8,7 @@
</div>
<div class="modal-body">
@include('customer.mail.modal-show-mail-inner', ['customer_mail' => $customer_mail])
@include('customer.mail.modal-show-mail-inner', ['customer_mail' => $customer_mail, 'show_move_dirs' => true])
@if($customer_mail->customer_mail)
@include('customer.mail.modal-show-mail-inner', ['customer_mail' => $customer_mail->customer_mail])
@ -21,26 +21,33 @@
</div>
<script type="text/javascript">
function change_dir_country_select(_form){
if(_form.find('.customer_mail_dir').val() == 1){
_form.find('.customer_mail_country').prop('disabled', false);
}else{
_form.find('.customer_mail_country').prop('disabled', true);
_form.find('.customer_mail_country').val(0);
}
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_dir_country_select(_form);
change_mail_subdir_select(_form);
_form.find('.btn-default').removeClass('btn-default').addClass('btn-primary');
});
$(this).find('.customer_mail_country').on('change', function () {
$(this).find('.customer_mail_subdir').on('change', function () {
_form.find('.btn-default').removeClass('btn-default').addClass('btn-primary');
});
change_dir_country_select(_form);
change_mail_subdir_select(_form);
});
});
</script>