Fewo Mails / Booking Country Services
This commit is contained in:
parent
b9c26d06d0
commit
48a6eb2282
154 changed files with 7761 additions and 1643 deletions
|
|
@ -3,6 +3,7 @@
|
|||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Customer;
|
||||
use App\Models\CustomerFewoMail;
|
||||
use App\Models\CustomerFile;
|
||||
use App\Models\CustomerMail;
|
||||
use App\Models\EmailTemplate;
|
||||
|
|
@ -39,13 +40,10 @@ class CustomerMailController extends Controller
|
|||
if($id === "new") {
|
||||
$customer_mail = new CustomerMail();
|
||||
$id = 'new';
|
||||
|
||||
}else{
|
||||
$customer_mail = CustomerMail::findOrFail($id);
|
||||
$id = $customer_mail->id;
|
||||
}
|
||||
|
||||
|
||||
$data = [
|
||||
'customer_mail' => $customer_mail,
|
||||
'id' => $id,
|
||||
|
|
@ -58,23 +56,29 @@ class CustomerMailController extends Controller
|
|||
public function store($id, $action=false)
|
||||
{
|
||||
$data = Request::all();
|
||||
$customer_mail = CustomerMail::findOrFail($id);
|
||||
|
||||
if($action === 'move-mail'){
|
||||
$data['travel_country_id'] = isset($data['travel_country_id']) && $data['travel_country_id'] ? $data['travel_country_id'] : null;
|
||||
$customer_mail = CustomerMail::findOrFail($id);
|
||||
$data['subdir'] = isset($data['subdir']) && $data['subdir'] ? $data['subdir'] : null;
|
||||
$customer_mail->dir = $data['dir'];
|
||||
$customer_mail->travel_country_id = $data['travel_country_id'];
|
||||
$customer_mail->subdir = $data['subdir'];
|
||||
$customer_mail->save();
|
||||
|
||||
}
|
||||
if($action === 'move-mail-fewo'){
|
||||
$customer_mail = CustomerFewoMail::findOrFail($id);
|
||||
$data['subdir'] = isset($data['subdir']) && $data['subdir'] ? $data['subdir'] : null;
|
||||
$customer_mail->dir = $data['dir'];
|
||||
$customer_mail->subdir = $data['subdir'];
|
||||
$customer_mail->save();
|
||||
}
|
||||
return back();
|
||||
}
|
||||
|
||||
public function delete($id){
|
||||
$customer_mail = CustomerMail::find($id);
|
||||
$customer_mail->dir = 12;
|
||||
$customer_mail->travel_country_id = null;
|
||||
$customer_mail->draft = false;
|
||||
$customer_mail->subdir = 0;
|
||||
$customer_mail->save();
|
||||
|
||||
\Session()->flash('alert-success', __('Mail gelöscht'));
|
||||
|
|
@ -186,7 +190,11 @@ class CustomerMailController extends Controller
|
|||
|
||||
public function getEmailTemplates()
|
||||
{
|
||||
$query = EmailTemplate::where('active', '=', true);
|
||||
$query = EmailTemplate::with('email_template_dir')->select('email_templates.*')->where('active', '=', true);
|
||||
|
||||
if(Request::get('filter_email_templates_directory') != ""){
|
||||
$query->where('email_template_dir_id', '=', Request::get('filter_email_templates_directory'));
|
||||
}
|
||||
|
||||
return \DataTables::eloquent($query)
|
||||
->addColumn('action', function (EmailTemplate $emailTemplate) {
|
||||
|
|
@ -194,8 +202,12 @@ class CustomerMailController extends Controller
|
|||
data-url="'.route('customer_mail_ajax').'" data-id="'.$emailTemplate->id.'" data-action="load_email_template"
|
||||
title="Vorlage laden" data-placement="left" rel="tooltip"><span class="ion ion-ios-arrow-dropup"></span></a>';
|
||||
})
|
||||
->addColumn('email_template_dir.name', function (EmailTemplate $emailTemplate) {
|
||||
return $emailTemplate->email_template_dir ? '<span class="badge badge-default" style="background-color: '.$emailTemplate->email_template_dir->color.'">'.$emailTemplate->email_template_dir->name.'</span>' : ' ';
|
||||
})
|
||||
->orderColumn('id', 'id $1')
|
||||
->orderColumn('subject', 'subject $1')
|
||||
->orderColumn('email_template_dir.name', 'email_template_dir.name $1')
|
||||
->orderColumn('message', 'message $1')
|
||||
->filterColumn('id', function($query, $keyword) {
|
||||
if($keyword != ""){
|
||||
|
|
@ -204,17 +216,16 @@ class CustomerMailController extends Controller
|
|||
})
|
||||
->filterColumn('subject', function($query, $keyword) {
|
||||
if($keyword != ""){
|
||||
$query->where('subject', 'LIKE', '%'.$keyword.'%');
|
||||
$query->where('name', 'LIKE', '%'.$keyword.'%');
|
||||
$query->OrWhere('subject', 'LIKE', '%'.$keyword.'%');
|
||||
$query->OrWhere('message', 'LIKE', '%'.$keyword.'%');
|
||||
|
||||
}
|
||||
})
|
||||
->rawColumns(['action'])
|
||||
->rawColumns(['action', 'email_template_dir.name'])
|
||||
->make(true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function uploadAttachment($id){
|
||||
|
||||
$fileRepo = new CustomerFileRepository(new CustomerFile());
|
||||
|
|
@ -290,13 +301,13 @@ class CustomerMailController extends Controller
|
|||
}
|
||||
$query = CustomerMail::where('booking_id', '=', Request::get('booking_id'));
|
||||
if (Request::get('customer_mail_dir') == 11) { //draft
|
||||
$query->where('draft', '=', true);
|
||||
$query->where('draft', '=', true)->where('dir', '!=', 12);
|
||||
}else{
|
||||
$query->where('dir', '=', Request::get('customer_mail_dir')); //with('lead'
|
||||
|
||||
}
|
||||
if (Request::get('customer_mail_country')) {
|
||||
$query->where('travel_country_id', '=', Request::get('customer_mail_country'));
|
||||
if (Request::get('customer_mail_subdir')) {
|
||||
$query->where('subdir', '=', Request::get('customer_mail_subdir'));
|
||||
}
|
||||
return $query;
|
||||
}
|
||||
|
|
@ -348,14 +359,14 @@ class CustomerMailController extends Controller
|
|||
$ret = '<a href="javascript:void(0)" class="btn btn-xs btn-secondary" data-toggle="modal"
|
||||
data-target="#modals-load-content" data-id="reply-send" data-model="customerMail" data-action="new-customer-mail"
|
||||
data-url="'.route('customer_mail_send_mail').'" data-redirect="back" data-customer_mail_id="'.$customer_mail->id.'"
|
||||
data-booking_id="'.$customer_mail->booking_id.'" data-route="'.route('booking_modal_load').'" data-customer_mail_dir="'.$customer_mail->dir.'" data-customer_mail_country="'.$customer_mail->travel_country_id.'">
|
||||
data-booking_id="'.$customer_mail->booking_id.'" data-route="'.route('booking_modal_load').'" data-customer_mail_dir="'.$customer_mail->dir.'" data-customer_mail_subdir="'.$customer_mail->subdir.'">
|
||||
<span title="Antwort auf E-Mail senden" data-placement="left" rel="tooltip"><i class="ion ion-ios-redo"></i> <i class="ion ion-md-mail-open"></i></span>
|
||||
</a>
|
||||
|
||||
<a href="javascript:void(0)" class="btn btn-xs btn-default" data-toggle="modal"
|
||||
data-target="#modals-load-content" data-id="reply-save" data-model="customerMail" data-action="reply-customer-mail"
|
||||
data-url="'.route('customer_mail_reply_mail').'" data-redirect="back" data-customer_mail_id="'.$customer_mail->id.'"
|
||||
data-booking_id="'.$customer_mail->booking_id.'" data-route="'.route('booking_modal_load').'" data-customer_mail_dir="'.$customer_mail->dir.'" data-customer_mail_country="'.$customer_mail->travel_country_id.'">
|
||||
data-booking_id="'.$customer_mail->booking_id.'" data-route="'.route('booking_modal_load').'" data-customer_mail_dir="'.$customer_mail->dir.'" data-customer_mail_subdir="'.$customer_mail->subdir.'">
|
||||
<span title="Antwort auf E-Mail speichern" data-placement="left" rel="tooltip"><i class="ion ion-ios-redo"></i> <i class="ion ion-md-mail-unread"></i></span>
|
||||
</a>
|
||||
';
|
||||
|
|
@ -375,7 +386,7 @@ class CustomerMailController extends Controller
|
|||
/*->filterColumn('subject', function($query, $keyword) {
|
||||
if($keyword != ""){
|
||||
$query->whereRaw("subject LIKE ?", '%'.$keyword.'%');
|
||||
|
||||
|
||||
}
|
||||
})*/
|
||||
->orderColumn('date', 'sent_at $1')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue