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

@ -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());