Customer Mail, Mails, Views Lead Customer
This commit is contained in:
parent
f1e0900a7a
commit
f53f17f9c1
46 changed files with 2217 additions and 1489 deletions
86
app/Http/Controllers/CustomerController.php
Executable file
86
app/Http/Controllers/CustomerController.php
Executable file
|
|
@ -0,0 +1,86 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Customer;
|
||||
use App\Repositories\CustomerRepository;
|
||||
use Carbon;
|
||||
use Request;
|
||||
|
||||
class CustomerController extends Controller
|
||||
{
|
||||
|
||||
protected $customerRepo;
|
||||
|
||||
public function __construct(CustomerRepository $customerRepo)
|
||||
{
|
||||
$this->middleware('admin');
|
||||
$this->customerRepo = $customerRepo;
|
||||
}
|
||||
|
||||
public function index($step = false)
|
||||
{
|
||||
$data = [
|
||||
'step' => $step
|
||||
];
|
||||
return view('customer.index', $data);
|
||||
}
|
||||
|
||||
public function detail($id)
|
||||
{
|
||||
if($id === "new") {
|
||||
$customer = new Customer();
|
||||
$id = 'new';
|
||||
|
||||
}else{
|
||||
$customer = Customer::findOrFail($id);
|
||||
$id = $customer->id;
|
||||
}
|
||||
$data = [
|
||||
'customer' => $customer,
|
||||
'id' => $id,
|
||||
];
|
||||
return view('customer.detail', $data);
|
||||
|
||||
}
|
||||
|
||||
public function store($id)
|
||||
{
|
||||
return back();
|
||||
/* $data = Request::all();
|
||||
|
||||
\Session()->flash('alert-save', '1');
|
||||
return redirect(route('lead_detail', [$lead->id]));*/
|
||||
|
||||
}
|
||||
|
||||
public function delete($id){
|
||||
/*
|
||||
\Session()->flash('alert-success', __('Eintrag gelöscht'));
|
||||
return redirect(route('lead_detail', [$lead->id]));*/
|
||||
}
|
||||
|
||||
public function getCustomers()
|
||||
{
|
||||
$query = Customer::with('salutation');
|
||||
|
||||
return \DataTables::eloquent($query)
|
||||
->addColumn('action_edit', function (Customer $customer) {
|
||||
return '<a href="'.route('customer_detail', [$customer->id]).'" class="btn icon-btn btn-sm btn-primary"><span class="fa fa-edit"></span></a>';
|
||||
})
|
||||
->addColumn('id', function (Customer $customer) {
|
||||
return '<a data-order="'.$customer->id.'" href="'.route('customer_detail', [$customer->id]).'" data-id="'.$customer->id.'">'.$customer->id.'</a>';
|
||||
})
|
||||
|
||||
->orderColumn('id', 'id $1')
|
||||
->filterColumn('id', function($query, $keyword) {
|
||||
if($keyword != ""){
|
||||
$query->where('id', 'LIKE', '%'.$keyword.'%');
|
||||
}
|
||||
})
|
||||
->rawColumns(['action_edit', 'id'])
|
||||
->make(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
114
app/Http/Controllers/CustomerMailController.php
Executable file
114
app/Http/Controllers/CustomerMailController.php
Executable file
|
|
@ -0,0 +1,114 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Customer;
|
||||
use App\Models\CustomerMail;
|
||||
use App\Repositories\CustomerMailRepository;
|
||||
use Carbon;
|
||||
use Request;
|
||||
|
||||
class CustomerMailController extends Controller
|
||||
{
|
||||
|
||||
protected $customerMailRepo;
|
||||
|
||||
public function __construct(CustomerMailRepository $customerMailRepo)
|
||||
{
|
||||
$this->middleware('admin');
|
||||
$this->customerMailRepo = $customerMailRepo;
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$data = [
|
||||
|
||||
];
|
||||
return view('customer.mail.index', $data);
|
||||
}
|
||||
|
||||
public function detail($id)
|
||||
{
|
||||
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,
|
||||
];
|
||||
return view('customer.mail.detail', $data);
|
||||
|
||||
}
|
||||
|
||||
public function store($id)
|
||||
{
|
||||
return back();
|
||||
/* $data = Request::all();
|
||||
|
||||
\Session()->flash('alert-save', '1');
|
||||
return redirect(route('lead_detail', [$lead->id]));*/
|
||||
|
||||
}
|
||||
|
||||
public function delete($id){
|
||||
/*
|
||||
\Session()->flash('alert-success', __('Eintrag gelöscht'));
|
||||
return redirect(route('lead_detail', [$lead->id]));*/
|
||||
}
|
||||
|
||||
public function getCustomerMails()
|
||||
{
|
||||
$query = CustomerMail::with('booking')->with('customer');
|
||||
|
||||
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>';
|
||||
})
|
||||
->orderColumn('id', 'id $1')
|
||||
->orderColumn('booking_id', 'booking_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('booking_id', function($query, $keyword) {
|
||||
if($keyword != ""){
|
||||
$query->where('booking_id', 'LIKE', '%'.$keyword.'%');
|
||||
}
|
||||
})
|
||||
->rawColumns(['action_edit', 'send', 'customer_id', 'booking_id', 'id'])
|
||||
->make(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
100
app/Http/Controllers/LeadController.php
Executable file
100
app/Http/Controllers/LeadController.php
Executable file
|
|
@ -0,0 +1,100 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Lead;
|
||||
use App\Repositories\LeadRepository;
|
||||
use Carbon;
|
||||
use Request;
|
||||
|
||||
class LeadController extends Controller
|
||||
{
|
||||
|
||||
protected $leadRepo;
|
||||
|
||||
public function __construct(LeadRepository $leadRepo)
|
||||
{
|
||||
$this->middleware('admin');
|
||||
$this->leadRepo = $leadRepo;
|
||||
}
|
||||
|
||||
public function index($step = false)
|
||||
{
|
||||
$data = [
|
||||
'step' => $step
|
||||
];
|
||||
return view('lead.index', $data);
|
||||
}
|
||||
|
||||
public function detail($id)
|
||||
{
|
||||
if($id === "new") {
|
||||
$lead = new Lead();
|
||||
$id = 'new';
|
||||
|
||||
}else{
|
||||
$lead = Lead::findOrFail($id);
|
||||
$id = $lead->id;
|
||||
}
|
||||
$data = [
|
||||
'lead' => $lead,
|
||||
'id' => $id,
|
||||
];
|
||||
return view('lead.detail', $data);
|
||||
|
||||
}
|
||||
|
||||
public function store($id)
|
||||
{
|
||||
return back();
|
||||
/* $data = Request::all();
|
||||
|
||||
\Session()->flash('alert-save', '1');
|
||||
return redirect(route('lead_detail', [$lead->id]));*/
|
||||
|
||||
}
|
||||
|
||||
public function delete($id){
|
||||
/*
|
||||
\Session()->flash('alert-success', __('Eintrag gelöscht'));
|
||||
return redirect(route('lead_detail', [$lead->id]));*/
|
||||
}
|
||||
|
||||
public function getLeads()
|
||||
{
|
||||
$query = Lead::with('customer')->with('sf_guard_user')->with('status');
|
||||
|
||||
return \DataTables::eloquent($query)
|
||||
->addColumn('action_edit', function (Lead $lead) {
|
||||
return '<a href="'.route('lead_detail', [$lead->id]).'" class="btn icon-btn btn-sm btn-primary"><span class="fa fa-edit"></span></a>';
|
||||
})
|
||||
->addColumn('id', function (Lead $lead) {
|
||||
return '<a data-order="'.$lead->id.'" href="'.route('lead_detail', [$lead->id]).'" data-id="'.$lead->id.'">'.$lead->id.'</a>';
|
||||
})
|
||||
->addColumn('customer_id', function (Lead $lead) {
|
||||
return '<a data-order="'.$lead->customer_id.'" href="'.route('customer_detail', [$lead->customer_id]).'" data-id="'.$lead->customer_id.'">'.$lead->customer_id.'</a>';
|
||||
})
|
||||
->addColumn('request_date', function (Lead $lead) {
|
||||
return Carbon::parse($lead->request_date)->format(\Util::formatDateDB());
|
||||
})
|
||||
->orderColumn('id', 'id $1')
|
||||
->orderColumn('customer_id', 'customer_id $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.'%');
|
||||
}
|
||||
})
|
||||
->rawColumns(['action_edit', 'customer_id', 'sf_guard_user_id', 'id'])
|
||||
->make(true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -5,7 +5,9 @@ namespace App\Http\Controllers;
|
|||
use App\Models\Booking;
|
||||
use App\Models\Sym\TravelCountry;
|
||||
use App\Models\TravelAgenda;
|
||||
use App\Repositories\CustomerMailRepository;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Request;
|
||||
use DataTables;
|
||||
|
||||
|
|
@ -21,7 +23,6 @@ class RequestController extends Controller
|
|||
public function index($step = false)
|
||||
{
|
||||
|
||||
|
||||
$d = Booking::join('travel_country', 'travel_country_id', '=', 'travel_country.id')->get()->pluck('name', 'travel_country_id')->unique()->toArray();
|
||||
|
||||
$data = [
|
||||
|
|
@ -31,6 +32,17 @@ class RequestController extends Controller
|
|||
return view('request.index', $data);
|
||||
}
|
||||
|
||||
public function detail($id)
|
||||
{
|
||||
|
||||
$d = Booking::join('travel_country', 'travel_country_id', '=', 'travel_country.id')->get()->pluck('name', 'travel_country_id')->unique()->toArray();
|
||||
|
||||
$data = [
|
||||
'travel_countries' => $d,
|
||||
];
|
||||
return view('request.index', $data);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
wirte old where has state to new has travel_documents
|
||||
|
|
@ -70,7 +82,6 @@ class RequestController extends Controller
|
|||
}
|
||||
|
||||
// $query->where('end_date', '<=', $now);
|
||||
|
||||
if(Request::get('travel_option_search')){
|
||||
$now = Carbon::now();
|
||||
|
||||
|
|
@ -146,8 +157,6 @@ class RequestController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(Request::get('sort_travel_country_id') != ""){
|
||||
$query->where('travel_country_id', '=', Request::get('sort_travel_country_id'));
|
||||
}
|
||||
|
|
@ -172,6 +181,7 @@ class RequestController extends Controller
|
|||
}
|
||||
return $query;
|
||||
}
|
||||
|
||||
public function getAjaxRequests(){
|
||||
|
||||
$query = $this->getSearchRequests();
|
||||
|
|
@ -179,14 +189,58 @@ class RequestController extends Controller
|
|||
return TravelAgenda::whereIn('id', $ret)->get()->pluck('name', 'id');
|
||||
}
|
||||
|
||||
|
||||
public function loadModal(){
|
||||
$data = Request::all();
|
||||
$ret = "";
|
||||
if(Request::ajax()){
|
||||
|
||||
$customers = [];
|
||||
$query = $this->getSearchRequests();
|
||||
$bookings = $query->orderBy('id', 'DESC')->limit(50)->get();
|
||||
foreach ($bookings as $booking){
|
||||
$tmp = "";
|
||||
$tmp .= $booking->customer ? $booking->customer->email." | " : "- | ";
|
||||
$tmp .= $booking->customer ? $booking->customer->firstname." ".$booking->customer->name." | " : "- | ";
|
||||
$tmp .= $booking->travel_country_id ? $booking->travel_country->name." | " : "- | ";
|
||||
$tmp .= $booking->travelagenda_id ? $booking->travel_agenda->name."" : "-";
|
||||
|
||||
$customers[$booking->id] = $tmp;
|
||||
}
|
||||
|
||||
// return TravelAgenda::whereIn('id', $ret)->get()->pluck('name', 'id');
|
||||
|
||||
if($data['action'] === "send-customer-mail"){
|
||||
$value = new Collection();
|
||||
$value->id = "add";
|
||||
$value->customers = $customers;
|
||||
$value->message = "Sehr #geehrte/r# #Anrede# #Vorname# #Nachname#,\n\nText ....";
|
||||
$data['title'] = "E-Mail-Nachricht an Auswahl";
|
||||
$url = route('requests_send_customer_mail');
|
||||
$ret = view("request.modal-mail", compact('data','value', 'url') )->render();
|
||||
}
|
||||
|
||||
}
|
||||
return response()->json(['response' => $data, 'html'=>$ret]);
|
||||
}
|
||||
|
||||
public function sendCustomerMail(CustomerMailRepository $customerMailRepository){
|
||||
$data = Request::all();
|
||||
|
||||
$customerMailRepository->sendAndStore($data);
|
||||
\Session()->flash('alert-success', "Mails gesendet!");
|
||||
|
||||
return back();
|
||||
}
|
||||
|
||||
public function getRequests()
|
||||
{
|
||||
|
||||
$query = $this->getSearchRequests();
|
||||
|
||||
return \DataTables::eloquent($query)
|
||||
->addColumn('action_edit', function (Booking $booking) {
|
||||
return ''; //'<a href="' . route('booking_detail', [$booking->id]) . '" class="btn icon-btn btn-sm btn-primary"><span class="fa fa-edit"></span></a>';
|
||||
->addColumn('action_lead_edit', function (Booking $booking) {
|
||||
return '<a href="' . route('booking_detail', [$booking->id]) . '" class="btn icon-btn btn-sm btn-primary"><span class="fa fa-edit"></span></a>';
|
||||
})
|
||||
->addColumn('lead_id', function (Booking $booking) {
|
||||
return '<a data-order="'.$booking->lead_id.'" href="'.make_old_url('leads/'.$booking->lead_id.'/edit').'" data-id="'.$booking->lead_id.'">'.$booking->lead_id.'</a>';
|
||||
|
|
@ -200,6 +254,9 @@ class RequestController extends Controller
|
|||
->addColumn('id', function (Booking $booking) {
|
||||
return '<a data-order="'.$booking->id.'" href="'.make_old_url('booking/'.$booking->id.'/edit').'" data-id="'.$booking->id.'">'.$booking->id.'</a>';
|
||||
})
|
||||
->addColumn('action_booking_edit', function (Booking $booking) {
|
||||
return '<a href="' . route('booking_detail', [$booking->id]) . '" class="btn icon-btn btn-sm btn-primary"><span class="fa fa-edit"></span></a>';
|
||||
})
|
||||
->addColumn('travel_country_id', function (Booking $booking) {
|
||||
return '<span data-order="'.($booking->travel_country_id ? $booking->travel_country_id : 0).'">'.($booking->travel_country_id ? $booking->travel_country->name : "-").'</span>';
|
||||
})
|
||||
|
|
@ -245,11 +302,9 @@ class RequestController extends Controller
|
|||
->orderColumn('start_date', 'start_date $1')
|
||||
->orderColumn('end_date', 'end_date $1')
|
||||
->orderColumn('travel_documents', 'travel_documents $1')
|
||||
->rawColumns(['action_edit', 'lead_id', 'participant_firstname', 'participant_name', 'travel_country_id', 'travelagenda_id', 'sf_guard_user_id', 'lead.status_id', 'id', 'travel_documents'])
|
||||
->rawColumns(['action_lead_edit', 'lead_id', 'participant_firstname', 'participant_name', 'action_booking_edit', 'travel_country_id', 'travelagenda_id', 'sf_guard_user_id', 'lead.status_id', 'id', 'travel_documents'])
|
||||
->make(true);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue