Store Customer, Store Booking details
This commit is contained in:
parent
b362b93bca
commit
6706d28f51
33 changed files with 1048 additions and 257 deletions
|
|
@ -69,6 +69,12 @@ class BookingController extends Controller
|
|||
\Session()->flash('alert-save', '1');
|
||||
return redirect(route('booking_detail', [$booking->id])."#collapseBookingNotice");
|
||||
}
|
||||
|
||||
if($data['action'] === 'save_lead_status'){
|
||||
$booking = $this->bookingRepo->updateLeadStatus($id, $data);
|
||||
\Session()->flash('alert-save', '1');
|
||||
return redirect(route('booking_detail', [$booking->id])."#collapseBookingLead");
|
||||
}
|
||||
|
||||
if($data['action'] === 'update_booking'){
|
||||
$booking = $this->bookingRepo->updateBooking($id, $data);
|
||||
|
|
@ -76,15 +82,35 @@ class BookingController extends Controller
|
|||
return redirect(route('booking_detail', [$booking->id])."#collapseBookingBooking");
|
||||
}
|
||||
|
||||
if($data['action'] === 'update_booking_services'){
|
||||
$booking = $this->bookingRepo->updateBookingServices($id, $data);
|
||||
\Session()->flash('alert-save', '1');
|
||||
return redirect(route('booking_detail', [$booking->id])."#collapseBookingServices");
|
||||
}
|
||||
|
||||
if($data['action'] === 'update_booking_number'){
|
||||
$booking = $this->bookingRepo->updateBookingNumber($id, $data);
|
||||
\Session()->flash('alert-save', '1');
|
||||
return redirect(route('booking_detail', [$booking->id])."#collapseBookingMyJack");
|
||||
}
|
||||
|
||||
if($data['action'] === 'update_booking_price'){
|
||||
$booking = $this->bookingRepo->updateBookingPrice($id, $data);
|
||||
\Session()->flash('alert-save', '1');
|
||||
return redirect(route('booking_detail', [$booking->id])."#collapseBookingPrice");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if($id === "new") {
|
||||
$booking = new Booking();
|
||||
}else{
|
||||
$booking = Booking::findOrFail($id);
|
||||
}
|
||||
|
||||
$booking->merlin_order_number = $data['merlin_order_number'];
|
||||
$booking->save();
|
||||
|
||||
// $booking->merlin_order_number = $data['merlin_order_number'];
|
||||
// $booking->save();
|
||||
$i = 1;
|
||||
|
||||
if($data['action'] === 'addItemUp'){
|
||||
|
|
|
|||
|
|
@ -10,12 +10,12 @@ use Request;
|
|||
class CustomerController extends Controller
|
||||
{
|
||||
|
||||
protected $customerRepo;
|
||||
protected $custRepo;
|
||||
|
||||
public function __construct(CustomerRepository $customerRepo)
|
||||
public function __construct(CustomerRepository $custRepo)
|
||||
{
|
||||
$this->middleware('admin');
|
||||
$this->customerRepo = $customerRepo;
|
||||
$this->custRepo = $custRepo;
|
||||
}
|
||||
|
||||
public function index($step = false)
|
||||
|
|
@ -46,12 +46,14 @@ class CustomerController extends Controller
|
|||
|
||||
public function store($id)
|
||||
{
|
||||
$data = Request::all();
|
||||
|
||||
if($data['action'] === 'saveCustomer'){
|
||||
$customer = $this->custRepo->updateCustomer($id, $data);
|
||||
\Session()->flash('alert-save', '1');
|
||||
return redirect(route('customer_detail', [$id]).'#collapseCustomerDetail');
|
||||
}
|
||||
return back();
|
||||
/* $data = Request::all();
|
||||
|
||||
\Session()->flash('alert-save', '1');
|
||||
return redirect(route('lead_detail', [$lead->id]));*/
|
||||
|
||||
}
|
||||
|
||||
public function delete($id){
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ class CustomerFewoMailController extends Controller
|
|||
$this->customerMailRepo = $customerMailRepo;
|
||||
}
|
||||
|
||||
public function index()
|
||||
/* public function index()
|
||||
{
|
||||
$data = [
|
||||
|
||||
|
|
@ -55,7 +55,7 @@ class CustomerFewoMailController extends Controller
|
|||
];
|
||||
return view('customer.mail.detail', $data);
|
||||
|
||||
}
|
||||
}*/
|
||||
|
||||
public function store($id, $action=false)
|
||||
{
|
||||
|
|
@ -137,55 +137,6 @@ class CustomerFewoMailController extends Controller
|
|||
return back();
|
||||
}
|
||||
|
||||
/*public function getCustomerFewoMails()
|
||||
{
|
||||
$query = CustomerFewoMail::with('booking')->with('customer')->select('customer_mails.*');
|
||||
|
||||
return \DataTables::eloquent($query)
|
||||
->addColumn('action_edit', function (CustomerFewoMail $customer_mail) {
|
||||
return '<a href="'.route('customer_mail_detail', [$customer_mail->id]).'" class="btn icon-btn btn-sm btn-primary"><span class="fa fa-edit"></span></a>';
|
||||
})
|
||||
->addColumn('id', function (CustomerFewoMail $customer_mail) {
|
||||
return '<a data-order="'.$customer_mail->id.'" href="'.route('customer_mail_detail', [$customer_mail->id]).'" data-id="'.$customer_mail->id.'">'.$customer_mail->id.'</a>';
|
||||
})
|
||||
->addColumn('booking', function (CustomerFewoMail $customer_mail) {
|
||||
$out = $customer_mail->booking->travel_country_id ? $customer_mail->booking->travel_country->name." | " : "- | ";
|
||||
$out .= $customer_mail->booking->travelagenda_id ? $customer_mail->booking->travel_agenda->name."" : "-";
|
||||
return $out;
|
||||
})
|
||||
->addColumn('travel_user_booking_fewo_id', function (CustomerFewoMail $customer_mail) {
|
||||
return '<a data-order="'.$customer_mail->travel_user_booking_fewo_id.'" href="'.route('booking_detail', [$customer_mail->travel_user_booking_fewo_id]).'">'.$customer_mail->travel_user_booking_fewo_id.'</a>';
|
||||
})
|
||||
->addColumn('customer_id', function (CustomerFewoMail $customer_mail) {
|
||||
return '<a data-order="'.$customer_mail->customer_id.'" href="'.route('customer_detail', [$customer_mail->customer_id]).'">'.$customer_mail->customer_id.'</a>';
|
||||
})
|
||||
->addColumn('send', function (CustomerFewoMail $customer_mail) {
|
||||
return $customer_mail->send ? '<span class="badge badge-pill badge-success"><i class="fa fa-check"></i></span>' : '<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>';
|
||||
})
|
||||
->orderColumn('id', 'id $1')
|
||||
->orderColumn('travel_user_booking_fewo_id', 'travel_user_booking_fewo_id $1')
|
||||
->orderColumn('customer_id', 'customer_id $1')
|
||||
->orderColumn('send', 'send $1')
|
||||
|
||||
->filterColumn('id', function($query, $keyword) {
|
||||
if($keyword != ""){
|
||||
$query->where('id', 'LIKE', '%'.$keyword.'%');
|
||||
}
|
||||
})
|
||||
->filterColumn('customer_id', function($query, $keyword) {
|
||||
if($keyword != ""){
|
||||
$query->where('customer_id', 'LIKE', '%'.$keyword.'%');
|
||||
}
|
||||
})
|
||||
->filterColumn('travel_user_booking_fewo_id', function($query, $keyword) {
|
||||
if($keyword != ""){
|
||||
$query->where('travel_user_booking_fewo_id', 'LIKE', '%'.$keyword.'%');
|
||||
}
|
||||
})
|
||||
->rawColumns(['action_edit', 'send', 'customer_id', 'travel_user_booking_fewo_id', 'id'])
|
||||
->make(true);
|
||||
}*/
|
||||
|
||||
public function getEmailTemplates()
|
||||
{
|
||||
$query = EmailTemplate::with('email_template_dir')->select('email_templates.*')->where('active', '=', true);
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ class CustomerMailController extends Controller
|
|||
$this->customerMailRepo = $customerMailRepo;
|
||||
}
|
||||
|
||||
public function index()
|
||||
/*public function index()
|
||||
{
|
||||
$data = [
|
||||
|
||||
|
|
@ -52,7 +52,7 @@ class CustomerMailController extends Controller
|
|||
];
|
||||
return view('customer.mail.detail', $data);
|
||||
|
||||
}
|
||||
}*/
|
||||
|
||||
public function store($id, $action=false)
|
||||
{
|
||||
|
|
@ -156,62 +156,6 @@ class CustomerMailController extends Controller
|
|||
return back();
|
||||
}
|
||||
|
||||
public function getCustomerMails()
|
||||
{
|
||||
$query = CustomerMail::with('booking')->with('customer')->select('customer_mails.*');
|
||||
|
||||
return \DataTables::eloquent($query)
|
||||
->addColumn('action_edit', function (CustomerMail $customer_mail) {
|
||||
return '<a href="'.route('customer_mail_detail', [$customer_mail->id]).'" class="btn icon-btn btn-sm btn-primary"><span class="fa fa-edit"></span></a>';
|
||||
})
|
||||
->addColumn('id', function (CustomerMail $customer_mail) {
|
||||
return '<a data-order="'.$customer_mail->id.'" href="'.route('customer_mail_detail', [$customer_mail->id]).'" data-id="'.$customer_mail->id.'">'.$customer_mail->id.'</a>';
|
||||
})
|
||||
->addColumn('booking', function (CustomerMail $customer_mail) {
|
||||
$out = $customer_mail->booking->travel_country_id ? $customer_mail->booking->travel_country->name." | " : "- | ";
|
||||
$out .= $customer_mail->booking->travelagenda_id ? $customer_mail->booking->travel_agenda->name."" : "-";
|
||||
return $out;
|
||||
})
|
||||
->addColumn('booking_id', function (CustomerMail $customer_mail) {
|
||||
return '<a data-order="'.$customer_mail->booking_id.'" href="'.route('booking_detail', [$customer_mail->booking_id]).'">'.$customer_mail->booking_id.'</a>';
|
||||
})
|
||||
->addColumn('customer_id', function (CustomerMail $customer_mail) {
|
||||
return '<a data-order="'.$customer_mail->customer_id.'" href="'.route('customer_detail', [$customer_mail->customer_id]).'">'.$customer_mail->customer_id.'</a>';
|
||||
})
|
||||
->addColumn('send', function (CustomerMail $customer_mail) {
|
||||
return $customer_mail->send ? '<span class="badge badge-pill badge-success"><i class="fa fa-check"></i></span>' : '<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>';
|
||||
})
|
||||
->addColumn('date', function (CustomerMail $customer_mail) {
|
||||
if($customer_mail->send){
|
||||
return '<span class="badge badge-success" style="background-color: #94ae59"><i class="fa fa-check-circle"></i> '.$customer_mail->sent_at.'</span>';
|
||||
}
|
||||
return '<span class="badge badge-default"><i class="fa fa-times-circle"></i> '.$customer_mail->sent_at.'</span>';
|
||||
})
|
||||
->orderColumn('id', 'id $1')
|
||||
->orderColumn('booking_id', 'booking_id $1')
|
||||
->orderColumn('customer_id', 'customer_id $1')
|
||||
->orderColumn('send', 'send $1')
|
||||
->orderColumn('date', 'sent_at $1')
|
||||
|
||||
->filterColumn('id', function($query, $keyword) {
|
||||
if($keyword != ""){
|
||||
$query->where('id', 'LIKE', '%'.$keyword.'%');
|
||||
}
|
||||
})
|
||||
->filterColumn('customer_id', function($query, $keyword) {
|
||||
if($keyword != ""){
|
||||
$query->where('customer_id', 'LIKE', '%'.$keyword.'%');
|
||||
}
|
||||
})
|
||||
->filterColumn('booking_id', function($query, $keyword) {
|
||||
if($keyword != ""){
|
||||
$query->where('booking_id', 'LIKE', '%'.$keyword.'%');
|
||||
}
|
||||
})
|
||||
->rawColumns(['action_edit', 'send', 'date', 'customer_id', 'booking_id', 'id'])
|
||||
->make(true);
|
||||
}
|
||||
|
||||
public function getEmailTemplates()
|
||||
{
|
||||
$query = EmailTemplate::with('email_template_dir')->select('email_templates.*')->where('active', '=', true);
|
||||
|
|
|
|||
|
|
@ -31,34 +31,6 @@ class LeadMailController extends Controller
|
|||
$this->leadMailRepo = $leadMailRepo;
|
||||
}
|
||||
|
||||
/*public function index()
|
||||
{
|
||||
$data = [
|
||||
|
||||
];
|
||||
return view('customer.mail.index', $data);
|
||||
}
|
||||
|
||||
public function detail($id)
|
||||
{
|
||||
if($id === "new") {
|
||||
$lead_mail = new LeadMail();
|
||||
$id = 'new';
|
||||
|
||||
}else{
|
||||
$lead_mail = LeadMail::findOrFail($id);
|
||||
$id = $lead_mail->id;
|
||||
}
|
||||
|
||||
|
||||
$data = [
|
||||
'lead_mail' => $lead_mail,
|
||||
'id' => $id,
|
||||
'back' => URL::previous(),
|
||||
];
|
||||
return view('customer.mail.detail', $data);
|
||||
|
||||
}*/
|
||||
|
||||
public function store($id, $action=false)
|
||||
{
|
||||
|
|
|
|||
170
app/Http/Controllers/MailController.php
Normal file
170
app/Http/Controllers/MailController.php
Normal file
|
|
@ -0,0 +1,170 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
|
||||
use Carbon;
|
||||
use Request;
|
||||
use Response;
|
||||
use App\Models\LeadMail;
|
||||
use App\Models\CustomerMail;
|
||||
use App\Models\CustomerFewoMail;
|
||||
|
||||
class MailController extends Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('admin');
|
||||
}
|
||||
|
||||
public function leads()
|
||||
{
|
||||
$data = [
|
||||
];
|
||||
return view('mails.lead', $data);
|
||||
}
|
||||
|
||||
public function bookings()
|
||||
{
|
||||
$data = [
|
||||
];
|
||||
return view('mails.booking', $data);
|
||||
}
|
||||
|
||||
public function bookingFewos()
|
||||
{
|
||||
$data = [
|
||||
];
|
||||
return view('mails.booking_fewo', $data);
|
||||
}
|
||||
|
||||
|
||||
public function leadDatatable()
|
||||
{
|
||||
$query = LeadMail::with('lead')->with('customer')->select('lead_mails.*');
|
||||
|
||||
return \DataTables::eloquent($query)
|
||||
->addColumn('action_edit', function (LeadMail $lead_mail) {
|
||||
return '<a href="'.route('lead_detail', [$lead_mail->lead_id]).'#collapseLeadMails" class="btn icon-btn btn-sm btn-primary"><span class="fa fa-edit"></span></a>';
|
||||
})
|
||||
->addColumn('lead_id', function (LeadMail $lead_mail) {
|
||||
return '<a data-order="'.$lead_mail->lead_id.'" href="'.route('lead_detail', [$lead_mail->lead_id]).'#collapseLeadMails">'.$lead_mail->lead_id.'</a>';
|
||||
})
|
||||
->addColumn('send', function (LeadMail $lead_mail) {
|
||||
return $lead_mail->send ? '<span class="badge badge-pill badge-success"><i class="fa fa-check"></i></span>' : '<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>';
|
||||
})
|
||||
->addColumn('date', function (LeadMail $lead_mail) {
|
||||
if($lead_mail->send){
|
||||
return '<span class="badge badge-success" style="background-color: #94ae59"><i class="fa fa-check-circle"></i> '.$lead_mail->sent_at.'</span>';
|
||||
}
|
||||
return '<span class="badge badge-default"><i class="fa fa-times-circle"></i> '.$lead_mail->sent_at.'</span>';
|
||||
})
|
||||
->orderColumn('lead_id', 'lead_id $1')
|
||||
->orderColumn('send', 'send $1')
|
||||
->orderColumn('date', 'sent_at $1')
|
||||
|
||||
->filterColumn('id', function($query, $keyword) {
|
||||
if($keyword != ""){
|
||||
$query->where('id', 'LIKE', '%'.$keyword.'%');
|
||||
}
|
||||
})
|
||||
->filterColumn('lead_id', function($query, $keyword) {
|
||||
if($keyword != ""){
|
||||
$query->where('lead_id', 'LIKE', '%'.$keyword.'%');
|
||||
}
|
||||
})
|
||||
->rawColumns(['action_edit', 'send', 'date', 'lead_id'])
|
||||
->make(true);
|
||||
}
|
||||
|
||||
public function bookingDatatable()
|
||||
{
|
||||
$query = CustomerMail::with('booking')->with('customer')->select('customer_mails.*');
|
||||
|
||||
return \DataTables::eloquent($query)
|
||||
->addColumn('action_edit', function (CustomerMail $customer_mail) {
|
||||
return '<a href="'.route('booking_detail', [$customer_mail->booking_id]).'#collapseBookingMails" class="btn icon-btn btn-sm btn-primary"><span class="fa fa-edit"></span></a>';
|
||||
})
|
||||
->addColumn('booking', function (CustomerMail $customer_mail) {
|
||||
$out = $customer_mail->booking->travel_country_id ? $customer_mail->booking->travel_country->name." | " : "- | ";
|
||||
$out .= $customer_mail->booking->travelagenda_id ? $customer_mail->booking->travel_agenda->name."" : "-";
|
||||
return $out;
|
||||
})
|
||||
->addColumn('booking_id', function (CustomerMail $customer_mail) {
|
||||
return '<a data-order="'.$customer_mail->booking_id.'" href="'.route('booking_detail', [$customer_mail->booking_id]).'#collapseBookingMails">'.$customer_mail->booking_id.'</a>';
|
||||
})
|
||||
->addColumn('send', function (CustomerMail $customer_mail) {
|
||||
return $customer_mail->send ? '<span class="badge badge-pill badge-success"><i class="fa fa-check"></i></span>' : '<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>';
|
||||
})
|
||||
->addColumn('date', function (CustomerMail $customer_mail) {
|
||||
if($customer_mail->send){
|
||||
return '<span class="badge badge-success" style="background-color: #94ae59"><i class="fa fa-check-circle"></i> '.$customer_mail->sent_at.'</span>';
|
||||
}
|
||||
return '<span class="badge badge-default"><i class="fa fa-times-circle"></i> '.$customer_mail->sent_at.'</span>';
|
||||
})
|
||||
->orderColumn('booking_id', 'booking_id $1')
|
||||
->orderColumn('send', 'send $1')
|
||||
->orderColumn('date', 'sent_at $1')
|
||||
|
||||
->filterColumn('id', function($query, $keyword) {
|
||||
if($keyword != ""){
|
||||
$query->where('id', 'LIKE', '%'.$keyword.'%');
|
||||
}
|
||||
})
|
||||
->filterColumn('booking_id', function($query, $keyword) {
|
||||
if($keyword != ""){
|
||||
$query->where('booking_id', 'LIKE', '%'.$keyword.'%');
|
||||
}
|
||||
})
|
||||
->rawColumns(['action_edit', 'send', 'date', 'booking_id'])
|
||||
->make(true);
|
||||
}
|
||||
|
||||
public function bookingFewoDatatable()
|
||||
{
|
||||
$query = CustomerFewoMail::with('booking')->with('customer')->select('customer_fewo_mails.*');
|
||||
|
||||
return \DataTables::eloquent($query)
|
||||
->addColumn('action_edit', function (CustomerFewoMail $customer_fewo_mail) {
|
||||
return '<a href="'.route('travel_user_booking_fewo_detail', [$customer_fewo_mail->travel_user_booking_fewo_id]).'#collapseBookingMails" class="btn icon-btn btn-sm btn-primary"><span class="fa fa-edit"></span></a>';
|
||||
})
|
||||
->addColumn('booking', function (CustomerFewoMail $customer_fewo_mail) {
|
||||
$out = ($customer_fewo_mail->booking && $customer_fewo_mail->booking->fewo_lodging) ? $customer_fewo_mail->booking->fewo_lodging->name : "-";
|
||||
return $out;
|
||||
})
|
||||
->addColumn('booking_id', function (CustomerFewoMail $customer_fewo_mail) {
|
||||
return '<a data-order="'.$customer_fewo_mail->travel_user_booking_fewo_id.'" href="'.route('travel_user_booking_fewo_detail', [$customer_fewo_mail->travel_user_booking_fewo_id]).'#collapseBookingMails">'.$customer_fewo_mail->travel_user_booking_fewo_id.'</a>';
|
||||
})
|
||||
->addColumn('send', function (CustomerFewoMail $customer_fewo_mail) {
|
||||
return $customer_fewo_mail->send ? '<span class="badge badge-pill badge-success"><i class="fa fa-check"></i></span>' : '<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>';
|
||||
})
|
||||
->addColumn('date', function (CustomerFewoMail $customer_fewo_mail) {
|
||||
if($customer_fewo_mail->send){
|
||||
return '<span class="badge badge-success" style="background-color: #94ae59"><i class="fa fa-check-circle"></i> '.$customer_fewo_mail->sent_at.'</span>';
|
||||
}
|
||||
return '<span class="badge badge-default"><i class="fa fa-times-circle"></i> '.$customer_fewo_mail->sent_at.'</span>';
|
||||
})
|
||||
->orderColumn('booking_id', 'booking_id $1')
|
||||
->orderColumn('send', 'send $1')
|
||||
->orderColumn('date', 'sent_at $1')
|
||||
|
||||
->filterColumn('id', function($query, $keyword) {
|
||||
if($keyword != ""){
|
||||
$query->where('id', 'LIKE', '%'.$keyword.'%');
|
||||
}
|
||||
})
|
||||
->filterColumn('booking_id', function($query, $keyword) {
|
||||
if($keyword != ""){
|
||||
$query->where('booking_id', 'LIKE', '%'.$keyword.'%');
|
||||
}
|
||||
})
|
||||
->rawColumns(['action_edit', 'send', 'date', 'booking_id'])
|
||||
->make(true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -331,7 +331,15 @@ class TravelUserBookingFewoController extends Controller
|
|||
});
|
||||
}
|
||||
})
|
||||
->rawColumns(['action_edit', 'travel_user', 'is_calendar', 'is_mail', 'booking_fewo_notice', 'action_delete'])
|
||||
->addColumn('last_fewo_email', function (TravelUserBookingFewo $travel_user_booking_fewo) {
|
||||
//umbuchen
|
||||
if($travel_user_booking_fewo->customer_fewo_mails->count()){
|
||||
$fewo_mail = $travel_user_booking_fewo->customer_fewo_mail_last;
|
||||
return '<a data-order="'.$fewo_mail->getSentAtRaw().'" href="'.route('travel_user_booking_fewo_detail', [$travel_user_booking_fewo->id]).'#collapseLeadMails" data-order="'.$fewo_mail->sent_at.'"><span class="badge '.($fewo_mail->is_answer ? 'badge-default' : 'badge-secondary').'">'.$fewo_mail->sent_at.'</span></a>';
|
||||
}
|
||||
return '<span data-order="">-</span>';
|
||||
})
|
||||
->rawColumns(['action_edit', 'travel_user', 'is_calendar', 'is_mail', 'booking_fewo_notice', 'last_fewo_email', 'action_delete'])
|
||||
->make(true);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue