diff --git a/app/Http/Controllers/BookingController.php b/app/Http/Controllers/BookingController.php
index 8c0800b..7a03a21 100755
--- a/app/Http/Controllers/BookingController.php
+++ b/app/Http/Controllers/BookingController.php
@@ -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'){
diff --git a/app/Http/Controllers/CustomerController.php b/app/Http/Controllers/CustomerController.php
index 0d06912..f3d0151 100755
--- a/app/Http/Controllers/CustomerController.php
+++ b/app/Http/Controllers/CustomerController.php
@@ -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){
diff --git a/app/Http/Controllers/CustomerFewoMailController.php b/app/Http/Controllers/CustomerFewoMailController.php
index a42dd6b..a81d3ca 100755
--- a/app/Http/Controllers/CustomerFewoMailController.php
+++ b/app/Http/Controllers/CustomerFewoMailController.php
@@ -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 ' ';
- })
- ->addColumn('id', function (CustomerFewoMail $customer_mail) {
- return ''.$customer_mail->id.' ';
- })
- ->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 ''.$customer_mail->travel_user_booking_fewo_id.' ';
- })
- ->addColumn('customer_id', function (CustomerFewoMail $customer_mail) {
- return ''.$customer_mail->customer_id.' ';
- })
- ->addColumn('send', function (CustomerFewoMail $customer_mail) {
- return $customer_mail->send ? ' ' : ' ';
- })
- ->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);
diff --git a/app/Http/Controllers/CustomerMailController.php b/app/Http/Controllers/CustomerMailController.php
index c7838e4..ba205f4 100755
--- a/app/Http/Controllers/CustomerMailController.php
+++ b/app/Http/Controllers/CustomerMailController.php
@@ -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 ' ';
- })
- ->addColumn('id', function (CustomerMail $customer_mail) {
- return ''.$customer_mail->id.' ';
- })
- ->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 ''.$customer_mail->booking_id.' ';
- })
- ->addColumn('customer_id', function (CustomerMail $customer_mail) {
- return ''.$customer_mail->customer_id.' ';
- })
- ->addColumn('send', function (CustomerMail $customer_mail) {
- return $customer_mail->send ? ' ' : ' ';
- })
- ->addColumn('date', function (CustomerMail $customer_mail) {
- if($customer_mail->send){
- return ' '.$customer_mail->sent_at.' ';
- }
- return ' '.$customer_mail->sent_at.' ';
- })
- ->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);
diff --git a/app/Http/Controllers/LeadMailController.php b/app/Http/Controllers/LeadMailController.php
index 8eece0c..800e5b4 100644
--- a/app/Http/Controllers/LeadMailController.php
+++ b/app/Http/Controllers/LeadMailController.php
@@ -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)
{
diff --git a/app/Http/Controllers/MailController.php b/app/Http/Controllers/MailController.php
new file mode 100644
index 0000000..d42c3e2
--- /dev/null
+++ b/app/Http/Controllers/MailController.php
@@ -0,0 +1,170 @@
+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 ' ';
+ })
+ ->addColumn('lead_id', function (LeadMail $lead_mail) {
+ return ''.$lead_mail->lead_id.' ';
+ })
+ ->addColumn('send', function (LeadMail $lead_mail) {
+ return $lead_mail->send ? ' ' : ' ';
+ })
+ ->addColumn('date', function (LeadMail $lead_mail) {
+ if($lead_mail->send){
+ return ' '.$lead_mail->sent_at.' ';
+ }
+ return ' '.$lead_mail->sent_at.' ';
+ })
+ ->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 ' ';
+ })
+ ->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 ''.$customer_mail->booking_id.' ';
+ })
+ ->addColumn('send', function (CustomerMail $customer_mail) {
+ return $customer_mail->send ? ' ' : ' ';
+ })
+ ->addColumn('date', function (CustomerMail $customer_mail) {
+ if($customer_mail->send){
+ return ' '.$customer_mail->sent_at.' ';
+ }
+ return ' '.$customer_mail->sent_at.' ';
+ })
+ ->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 ' ';
+ })
+ ->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 ''.$customer_fewo_mail->travel_user_booking_fewo_id.' ';
+ })
+ ->addColumn('send', function (CustomerFewoMail $customer_fewo_mail) {
+ return $customer_fewo_mail->send ? ' ' : ' ';
+ })
+ ->addColumn('date', function (CustomerFewoMail $customer_fewo_mail) {
+ if($customer_fewo_mail->send){
+ return ' '.$customer_fewo_mail->sent_at.' ';
+ }
+ return ' '.$customer_fewo_mail->sent_at.' ';
+ })
+ ->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);
+ }
+
+
+
+}
+
+
diff --git a/app/Http/Controllers/TravelUserBookingFewoController.php b/app/Http/Controllers/TravelUserBookingFewoController.php
index 471b1d9..c277be2 100755
--- a/app/Http/Controllers/TravelUserBookingFewoController.php
+++ b/app/Http/Controllers/TravelUserBookingFewoController.php
@@ -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 ''.$fewo_mail->sent_at.' ';
+ }
+ return '- ';
+ })
+ ->rawColumns(['action_edit', 'travel_user', 'is_calendar', 'is_mail', 'booking_fewo_notice', 'last_fewo_email', 'action_delete'])
->make(true);
}
}
diff --git a/app/Models/Customer.php b/app/Models/Customer.php
index c2e5e77..c408d5b 100644
--- a/app/Models/Customer.php
+++ b/app/Models/Customer.php
@@ -143,15 +143,15 @@ class Customer extends Model
}
public function bookings()
{
- return $this->hasMany(Booking::class);
+ return $this->hasMany(Booking::class, 'customer_id');
}
public function coupons()
{
- return $this->hasMany(Coupon::class);
+ return $this->hasMany(Coupon::class, 'customer_id');
}
public function leads()
{
- return $this->hasMany(Lead::class);
+ return $this->hasMany(Lead::class, 'customer_id');
}
public function getSalutation(){
diff --git a/app/Models/CustomerFewoMail.php b/app/Models/CustomerFewoMail.php
index 74d574f..0b696e2 100644
--- a/app/Models/CustomerFewoMail.php
+++ b/app/Models/CustomerFewoMail.php
@@ -167,7 +167,7 @@ class CustomerFewoMail extends Model
public function booking()
{
- return $this->belongsTo(TravelUserBookingFewo::class);
+ return $this->belongsTo(TravelUserBookingFewo::class, 'travel_user_booking_fewo_id');
}
public function travel_user()
diff --git a/app/Repositories/BookingRepository.php b/app/Repositories/BookingRepository.php
index 0b54139..4b33f3b 100644
--- a/app/Repositories/BookingRepository.php
+++ b/app/Repositories/BookingRepository.php
@@ -3,9 +3,11 @@
namespace App\Repositories;
+use Auth;
+use App\Models\Lead;
+use App\Services\Util;
use App\Models\Booking;
use App\Models\BookingNotice;
-use Auth;
use App\Models\BookingCompanyService;
use App\Models\BookingCountryService;
use App\Models\BookingProviderService;
@@ -46,11 +48,37 @@ class BookingRepository extends BaseRepository {
return $this->model;
}
+ public function updateLeadStatus($id, $data){
+
+ $this->model = Booking::findOrFail($id);
+
+ if(isset($data['lead'])){
+ $lead = $this->model->lead;
+ if($lead->id != $data['lead']['id']){
+ abort(500);
+ }
+ $lead->status_id = $data['lead']['status_id'];
+ $lead->is_rebook = isset($data['lead']['is_rebook']) ? true : false;
+ $lead->is_closed = isset($data['lead']['is_closed']) ? true : false;
+ $lead->save();
+ }
+ return $this->model;
+ }
+
public function updateBooking($id, $data){
$this->model = Booking::findOrFail($id);
$fill = [
+ 'sf_guard_user_id' => $data['sf_guard_user_id'],
+ 'booking_date' => $data['booking_date'] ? _reformat_date($data['booking_date']) : null,
+ 'travel_number' => $data['travel_number'],
+ 'travel_country_id' => $data['travel_country_id'] ? $data['travel_country_id'] : null,
+ 'travelagenda_id' => $data['travelagenda_id'] ? $data['travelagenda_id'] : null,
+ 'travel_category_id' => $data['travel_category_id'] ? $data['travel_category_id'] : null,
+ 'start_date' => $data['start_date'] ? _reformat_date($data['start_date']) : null,
+ 'end_date' => $data['end_date'] ? _reformat_date($data['end_date']) : null,
+ 'title' => $data['title'],
'paying_out' => $data['paying_out'],
'paying_out_status' => $data['paying_out_status'],
'airline_id' => $data['airline_id'],
@@ -63,11 +91,17 @@ class BookingRepository extends BaseRepository {
'filekey' => $data['filekey'],
'is_rail_fly' => isset($data['is_rail_fly']) ? true : false,
'notice' => $data['notice'],
+ 'ev_number' => $data['ev_number'],
+ 'merlin_order_number' => $data['merlin_order_number'],
];
-
$this->model->fill($fill);
$this->model->save();
+ return $this->model;
+ }
+ public function updateBookingServices($id, $data){
+
+ $this->model = Booking::findOrFail($id);
if(isset($data['country_service'])){
$this->updateCountryService($data['country_service']);
}
@@ -79,11 +113,38 @@ class BookingRepository extends BaseRepository {
if(isset($data['company_service'])){
$this->updateCompanyService($data['company_service']);
}
-
return $this->model;
}
- public function updateCountryService($country_services){
+ public function updateBookingNumber($id, $data){
+
+ $this->model = Booking::findOrFail($id);
+ $fill = [
+ 'ev_number' => $data['ev_number'],
+ 'merlin_order_number' => $data['merlin_order_number'],
+ ];
+ $this->model->fill($fill);
+ $this->model->save();
+ return $this->model;
+ }
+
+ public function updateBookingPrice($id, $data){
+
+ $this->model = Booking::findOrFail($id);
+ $fill = [
+ 'deposit_total' => $data['deposit_total'] ? Util::_clean_float($data['deposit_total']) : 0,
+ 'final_payment' => $data['final_payment'] ? Util::_clean_float($data['final_payment']) : 0,
+ 'final_payment_date' => $data['final_payment_date'] ? _reformat_date($data['final_payment_date']) : null,
+ ];
+ $this->model->fill($fill);
+ $this->model->save();
+ return $this->model;
+ }
+
+
+
+
+ private function updateCountryService($country_services){
foreach ($country_services as $country_service_id=>$val){
$booking_country_service = BookingCountryService::where('travel_country_service_id', '=', $country_service_id)
->where('booking_id', '=', $this->model->id)->first();
@@ -103,7 +164,7 @@ class BookingRepository extends BaseRepository {
}
}
- public function updateProviderService($provider_service){
+ private function updateProviderService($provider_service){
foreach ($provider_service as $provider_service_id=>$val){
$booking_provider_service = BookingProviderService::where('service_provider_service_id', '=', $provider_service_id)
->where('booking_id', '=', $this->model->id)->first();
@@ -123,7 +184,7 @@ class BookingRepository extends BaseRepository {
}
}
- public function updateCompanyService($company_service){
+ private function updateCompanyService($company_service){
foreach ($company_service as $company_service_id=>$val){
$booking_company_service = BookingCompanyService::where('travel_company_service_id', '=', $company_service_id)
->where('booking_id', '=', $this->model->id)->first();
diff --git a/app/Repositories/CustomerRepository.php b/app/Repositories/CustomerRepository.php
index 2bfcc9e..ddfe472 100644
--- a/app/Repositories/CustomerRepository.php
+++ b/app/Repositories/CustomerRepository.php
@@ -16,27 +16,13 @@ class CustomerRepository extends BaseRepository {
public function updateCustomer($id, $data)
{
-
$this->model = Customer::findOrFail($id);
- $fill = [
- 'salutation_id' => $data['salutation_id'],
- 'name' => $data['name'],
- 'firstname' => $data['firstname'],
- 'street' => $data['street'],
- 'zip' => $data['zip'],
- 'city' => $data['city'],
- 'email' => $data['email'],
- 'phone' => $data['phone'],
- 'phonemobile' => $data['phonemobile'],
- 'country_id' => $data['country_id'],
- ];
- $this->model->fill($fill);
+ $this->model->fill($data);
$this->model->save();
return $this->model;
}
-
public function updateCustomerFromLead($id, $data){
$lead = Lead::findOrFail($id);
diff --git a/app/Services/Model.php b/app/Services/Model.php
new file mode 100644
index 0000000..78a7efe
--- /dev/null
+++ b/app/Services/Model.php
@@ -0,0 +1,46 @@
+get()->pluck('fullname', 'id');
+ }
+
+ public static function getTravelCountryArray($emtpy = false){
+ $TravelCountry = TravelCountry::where('active_backend', 1)->orderBy('name')->get()->pluck('name', 'id');
+ return $emtpy ? $TravelCountry->prepend('-', 0) : $TravelCountry;
+
+ }
+
+ public static function getTravelCategoryArray($emtpy = false){
+ $TravelCategory = TravelCategory::orderBy('name')->get()->pluck('name', 'id');
+ return $emtpy ? $TravelCategory->prepend('-', 0) : $TravelCategory;
+
+ }
+
+ public static function getTravelAgendaArray($emtpy = false){
+ $TravelAgenda = TravelAgenda::orderBy('name')->get()->pluck('name', 'id');
+ return $emtpy ? $TravelAgenda->prepend('-', 0) : $TravelAgenda;
+ }
+
+ public static function getSymTravelCountryArray($emtpy = false){
+ $TravelAgenda = SymTravelCountry::orderBy('name')->get()->pluck('name', 'id');
+ return $emtpy ? $TravelAgenda->prepend('-', 0) : $TravelAgenda;
+ }
+
+ public static function getStatusArray($emtpy = false){
+ $Status = Status::orderBy('name')->get()->pluck('name', 'id');
+ return $emtpy ? $Status->prepend('-', 0) : $Status;
+ }
+
+
+}
\ No newline at end of file
diff --git a/config/permissions.php b/config/permissions.php
index d1fc639..ef63242 100755
--- a/config/permissions.php
+++ b/config/permissions.php
@@ -15,10 +15,13 @@ return [
'crm-bo-bo' => ['name' => 'ADMIN CRM > Buchungen > Buchungen' , 'color' => 'admin'],
'crm-bo-le' => ['name' => 'ADMIN CRM > Buchungen > Anfragen' , 'color' => 'admin'],
'crm-bo-cu' => ['name' => 'ADMIN CRM > Buchungen > Kunden' , 'color' => 'admin'],
- 'crm-bo-ma' => ['name' => 'ADMIN CRM > Buchungen > Kunden Mails' , 'color' => 'admin'],
'crm-cm' => ['name' => 'ADMIN CRM > Kundenverwaltung' , 'color' => 'admin'],
'crm-cm-cf' => ['name' => 'ADMIN CRM > Kundenverwaltung > Kunden (FeWo)' , 'color' => 'admin'],
'crm-cm-bf' => ['name' => 'ADMIN CRM > Kundenverwaltung > Buchungen (FeWo)' , 'color' => 'admin'],
+ 'crm-mail' => ['name' => 'ADMIN CRM > E-Mails' , 'color' => 'admin'],
+ 'crm-mail-le' => ['name' => 'ADMIN CRM > E-Mails > Anfragen' , 'color' => 'admin'],
+ 'crm-mail-bo' => ['name' => 'ADMIN CRM > E-Mails > Buchungen' , 'color' => 'admin'],
+ 'crm-mail-bf' => ['name' => 'ADMIN CRM > E-Mails > Buchungen (Fewo)' , 'color' => 'admin'],
'crm-old-cm' => ['name' => 'ADMIN CRM altes System > Kundenverwaltung' , 'color' => 'info'],
'cms' => ['name' => 'ADMIN CMS' , 'color' => 'secondary'],
'cms-iq-assets' => ['name' => 'ADMIN CMS > Medien' , 'color' => 'secondary'],
diff --git a/resources/views/booking/_detail_booking.blade.php b/resources/views/booking/_detail_booking.blade.php
index 0a55ed0..4b17a48 100755
--- a/resources/views/booking/_detail_booking.blade.php
+++ b/resources/views/booking/_detail_booking.blade.php
@@ -5,41 +5,59 @@
+
- {{ __('Sachbearbeiter') }}
- {{ Form::text('sf_guard_user_id', $booking->sf_guard_user->first_name." ".$booking->sf_guard_user->last_name, array('placeholder'=>__('Sachbearbeiter'), 'class'=>'form-control', 'id'=>'sf_guard_user_id', 'readonly')) }}
+ {{ __('Sachbearbeiter') }}*
+ {{ Form::select('sf_guard_user_id', \App\Services\Model::getSfGuardUserArray() , $booking->sf_guard_user_id, array('class'=>'custom-select', 'id'=>'sf_guard_user_id', 'required'=>true)) }}
{{ __('Buchungsdatum') }}
- {{ Form::text('booking_date', _format_date($booking->booking_date), array('placeholder'=>__('Buchungsdatum'), 'class'=>'form-control', 'id'=>'booking_date', 'readonly')) }}
-
-
{{ __('Reisenummer') }}
- {{ Form::text('travel_number', $booking->travel_number, array('placeholder'=>__('Reisenummer'), 'class'=>'form-control', 'id'=>'travel_number', 'readonly')) }}
+ {{ Form::text('travel_number', $booking->travel_number, array('placeholder'=>__('Reisenummer'), 'class'=>'form-control', 'id'=>'travel_number')) }}
+
+
+
+ {{ __('Reiseland') }}
+ {{ Form::select('travel_country_id', \App\Services\Model::getSymTravelCountryArray(true) , $booking->travel_country_id, array('class'=>'custom-select', 'id'=>'travel_country_id')) }}
{{ __('Reiseprogramm') }}
- {{ Form::text('travelagenda_id', $booking->travel_agenda ? $booking->travel_agenda->name : '', array('placeholder'=>__('Reiseprogramm'), 'class'=>'form-control', 'id'=>'travelagenda_id', 'readonly')) }}
+ {{ Form::select('travelagenda_id', \App\Services\Model::getTravelAgendaArray(true) , $booking->travelagenda_id, array('class'=>'custom-select', 'id'=>'travelagenda_id')) }}
{{ __('Reiseart') }}
- {{ Form::text('travel_category_id', $booking->travel_category ? $booking->travel_category->name : '', array('placeholder'=>__('Reiseart'), 'class'=>'form-control', 'id'=>'travel_category_id', 'readonly')) }}
+ {{ Form::select('travel_category_id', \App\Services\Model::getTravelCategoryArray(true) , $booking->travel_category_id, array('class'=>'custom-select', 'id'=>'travel_category_id')) }}
+
{{ __('Reisetitel') }}
- {{ Form::text('title', $booking->title, array('placeholder'=>__('Reisetitel'), 'class'=>'form-control', 'id'=>'title', 'readonly')) }}
+ {{ Form::text('title', $booking->title, array('placeholder'=>__('Reisetitel'), 'class'=>'form-control', 'id'=>'title')) }}
@@ -60,7 +78,12 @@
{{ __('XX TKT') }}
@@ -68,7 +91,12 @@
{{ __('Hold') }}
@@ -91,7 +119,12 @@
diff --git a/resources/views/booking/_detail_lead.blade.php b/resources/views/booking/_detail_lead.blade.php
index 411b7bf..5876032 100755
--- a/resources/views/booking/_detail_lead.blade.php
+++ b/resources/views/booking/_detail_lead.blade.php
@@ -15,11 +15,14 @@
{{ Form::text('lead[id]', $booking->lead->id, array('placeholder'=>__('Anfrage ID'), 'class'=>'form-control', 'id'=>'lead_id', 'readonly')) }}
-
diff --git a/resources/views/booking/_detail_myjack.blade.php b/resources/views/booking/_detail_myjack.blade.php
index a9e7dbd..9b9c420 100755
--- a/resources/views/booking/_detail_myjack.blade.php
+++ b/resources/views/booking/_detail_myjack.blade.php
@@ -3,20 +3,28 @@
MyJack
-
+
+ {{ __('MyJack Nr.') }}
+ {{ Form::text('merlin_order_number', $booking->merlin_order_number, array('placeholder'=>__('MyJack Nr.'), 'class'=>'form-control', 'id'=>'merlin_order_number')) }}
+
{{ __('EV Nummer') }}
- {{ Form::text('ev_number', $booking->ev_number, array('placeholder'=>__('EV Nummer'), 'class'=>'form-control', 'id'=>'ev_number', 'readonly')) }}
+ {{ Form::select('ev_number', ['E01'=>'E01', 'E02'=>'E02', 'E03'=>'E03', 'E04'=>'E04'] , $booking->ev_number, array('class'=>'custom-select', 'id'=>'ev_number' )) }}
{{ __('Konto') }}
- {{ Form::text('booking_konto', 4011, array('placeholder'=>__('Konto'), 'class'=>'form-control', 'id'=>'booking_konto', 'readonly')) }}
-
-
- {{ __('MyJack Nr.') }}
- {{ Form::text('merlin_order_number', $booking->merlin_order_number, array('placeholder'=>__('MyJack Nr.'), 'class'=>'form-control', 'id'=>'merlin_order_number', 'readonly')) }}
+ {{ Form::text('booking_konto', $booking->getKontoNumber(), array('placeholder'=>__('Konto'), 'class'=>'form-control', 'id'=>'booking_konto')) }}
+
+
+
\ No newline at end of file
diff --git a/resources/views/booking/_detail_price.blade.php b/resources/views/booking/_detail_price.blade.php
index 8d8d0e3..f7825a0 100755
--- a/resources/views/booking/_detail_price.blade.php
+++ b/resources/views/booking/_detail_price.blade.php
@@ -98,7 +98,7 @@
€
- {{ Form::text('deposit_total', $booking->deposit_total, array('placeholder'=>__('Anzahlung'), 'class'=>'form-control', 'id'=>'deposit_total', 'readonly')) }}
+ {{ Form::text('deposit_total', $booking->deposit_total, array('placeholder'=>__('Anzahlung'), 'class'=>'form-control', 'id'=>'deposit_total')) }}
+
+
\ No newline at end of file
diff --git a/resources/views/booking/_detail_services.blade.php b/resources/views/booking/_detail_services.blade.php
index b958c9f..b79d7d4 100755
--- a/resources/views/booking/_detail_services.blade.php
+++ b/resources/views/booking/_detail_services.blade.php
@@ -82,7 +82,7 @@
diff --git a/resources/views/booking/detail.blade.php b/resources/views/booking/detail.blade.php
index 9af8e27..383f7bb 100755
--- a/resources/views/booking/detail.blade.php
+++ b/resources/views/booking/detail.blade.php
@@ -102,7 +102,7 @@
- {!! Form::open(['url' => route('booking_detail', [$id]), 'class' => 'form-horizontal', 'id'=>'lead-form-validation']) !!}
+ {!! Form::open(['url' => route('booking_detail', [$id]), 'class' => 'form-horizontal', 'id'=>'booking-form-validation']) !!}
diff --git a/resources/views/customer/_detail_booking.blade.php b/resources/views/customer/_detail_booking.blade.php
new file mode 100644
index 0000000..a936771
--- /dev/null
+++ b/resources/views/customer/_detail_booking.blade.php
@@ -0,0 +1,171 @@
+
+
+
+
+
+
+
+
+
+
+ AnfrageID
+ {{__('Sachbearbeiter')}}
+ {{__('Status')}}
+ {{__('Anfrage-Datum')}}
+
+
+
+ @if($customer->leads)
+ @foreach ($customer->leads as $lead)
+
+
+
+
+
+ {{ $lead->id }}
+
+
+ @if($lead->sf_guard_user_id && $lead->sf_guard_user)
+ {{ $lead->sf_guard_user->first_name }} {{ $lead->sf_guard_user->last_name }}
+ @endif
+
+
+ {!! $lead->getStatusBadge() !!}
+
+
+ {{ _format_date($lead->request_date) }}
+
+
+ @endforeach
+ @endif
+
+
+
+
+
+
+
+
+
+ BuchnungsID
+ {{__('Reiseland')}}
+ {{__('Programm')}}
+ {{__('Anreise')}}
+ {{__('Abreise')}}
+ {{__('Sachbearbeiter')}}
+ {{__('Status')}}
+ {{__('Datum')}}
+
+
+
+ @if($customer->bookings)
+ @foreach ($customer->bookings as $booking)
+
+
+
+
+
+ {{ $booking->id }}
+
+
+ @if($booking->travel_country_id && $booking->travel_country)
+ {{ $booking->travel_country->name }}
+ @endif
+
+
+ @if($booking->travelagenda_id && $booking->travel_agenda)
+ {{ $booking->travel_agenda->name }}
+ @endif
+
+ {{ _format_date($booking->start_date) }}
+ {{ _format_date($booking->end_date) }}
+
+ @if($booking->sf_guard_user_id && $booking->sf_guard_user)
+ {{ $booking->sf_guard_user->first_name }} {{ $booking->sf_guard_user->last_name }}
+ @endif
+
+
+ @if($booking->lead)
+ {!! $booking->lead->getStatusBadge($booking) !!}
+ @endif
+
+
+ {{ _format_date($booking->booking_date) }}
+
+
+ @endforeach
+ @endif
+
+
+
+
+
+
+
+
+
+ {{__('Gutschein')}}
+ {{__('Wert')}}
+ {{__('Ausstellungsdatum')}}
+ {{__('Gültig bis')}}
+ {{__('Eingelöst')}}
+ {{__('#')}}
+
+
+
+ @if($customer->coupons)
+ @foreach ($customer->coupons as $coupon)
+
+
+
+ Gutschein {{$coupon->number}}
+
+
+
+ {{ \App\Services\Util::_number_format($coupon->value)}} €
+
+
+ {{\App\Services\Util::_format_date($coupon->issue_date, 'date')}}
+
+
+ {{\App\Services\Util::_format_date($coupon->valid_date, 'date')}}
+
+
+ @if($coupon->is_redeemed)
+ {{\App\Services\Util::_format_date($coupon->redeem_date, 'date')}}
+ @else
+
+ @endif
+
+
+
+
+
+
+
+
+ @endforeach
+ @endif
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/resources/views/customer/_detail_customer.blade.php b/resources/views/customer/_detail_customer.blade.php
new file mode 100644
index 0000000..f10fd2d
--- /dev/null
+++ b/resources/views/customer/_detail_customer.blade.php
@@ -0,0 +1,77 @@
+
+
+
+
+ @if($customer->count())
+
+
+
+
+ {{ __('Anrede') }}*
+ {{ Form::select('salutation_id', \App\Models\Customer::$salutationType , $customer->salutation_id, array('class'=>'custom-select', 'required'=>true)) }}
+
+
+
+ {{ __('Vorname') }}*
+ {{ Form::text('firstname', $customer->firstname, array('placeholder'=>__('Vorname'), 'class'=>'form-control', 'id'=>'firstname', 'required'=>true)) }}
+
+
+
+ {{ __('Nachname') }}*
+ {{ Form::text('name', $customer->name, array('placeholder'=>__('Nachname'), 'class'=>'form-control', 'id'=>'name', 'required'=>true)) }}
+
+
+
+ {{ __('Straße') }}
+ {{ Form::text('street', $customer->street, array('placeholder'=>__('Straße'), 'class'=>'form-control', 'id'=>'street')) }}
+
+
+
+ {{ __('PLZ') }}
+ {{ Form::text('zip', $customer->zip, array('placeholder'=>__('PLZ'), 'class'=>'form-control', 'id'=>'zip')) }}
+
+
+
+ {{ __('Stadt') }}
+ {{ Form::text('city', $customer->city, array('placeholder'=>__('Stadt'), 'class'=>'form-control', 'id'=>'city')) }}
+
+
+
+ {{ __('Land') }}*
+ {{ Form::select('country_id', \App\Models\Customer::getCustomerCountriesArray() , $customer->country_id, array('class'=>'custom-select', 'required'=>true)) }}
+
+
+
+ {{ __('Telefon') }}
+ {{ Form::text('phone', $customer->phone, array('placeholder'=>__('Telefon'), 'class'=>'form-control', 'id'=>'phone')) }}
+
+
+
+ {{ __('Telefon Mobil') }}
+ {{ Form::text('phonemobile', $customer->phonemobile, array('placeholder'=>__('Telefon Mobil'), 'class'=>'form-control', 'id'=>'phonemobile')) }}
+
+
+
+ {{ __('E-Mail') }}*
+ {{ Form::text('email', $customer->email, array('placeholder'=>__('E-Mail'), 'class'=>'form-control', 'id'=>'email', 'required'=>true)) }}
+
+
+
+
+
+ @endif
+
+
+
\ No newline at end of file
diff --git a/resources/views/customer/detail.blade.php b/resources/views/customer/detail.blade.php
index 5de4888..f6faace 100755
--- a/resources/views/customer/detail.blade.php
+++ b/resources/views/customer/detail.blade.php
@@ -4,12 +4,6 @@
+
+
+
Kunden verwalten
- {!! Form::open(['url' => route('customer_detail', [$id]), 'class' => 'form-horizontal', 'id'=>'lead-form-validation']) !!}
+
+
+ {!! Form::open(['url' => route('customer_detail', [$id]), 'class' => 'form-horizontal', 'id'=>'customer-form-validation']) !!}
+
+
+ @include('customer._detail_customer')
-
-
-
-
- {{ __('Nr.') }}*
- {{ Form::text('id', $customer->id, array('placeholder'=>__('Nr.'), 'class'=>'form-control', 'id'=>'customer_id', 'readonly')) }}
-
-
-
-
-
-
-
{{ __('save changes') }}
-
{{ __('zur Übersicht') }}
-
{{ __('zurück ins CRM v2') }}
+ @if($id !== "new" && $customer)
+ @include('customer._detail_booking')
+ @endif
+
{!! Form::close() !!}
-
diff --git a/resources/views/layouts/includes/layout-sidenav.blade.php b/resources/views/layouts/includes/layout-sidenav.blade.php
index e0fa537..a782ca4 100755
--- a/resources/views/layouts/includes/layout-sidenav.blade.php
+++ b/resources/views/layouts/includes/layout-sidenav.blade.php
@@ -51,14 +51,16 @@
@endif
@@ -97,6 +94,32 @@
@endif
+
+ @if(Auth::user()->isPermission('crm-mail'))
+
+
+
+ E-Mails
+
+
+
+ @endif
@endif
@if(Auth::user()->isPermission('crm-old-cm'))
diff --git a/resources/views/lead/_detail_booking.blade.php b/resources/views/lead/_detail_booking.blade.php
new file mode 100644
index 0000000..57605ec
--- /dev/null
+++ b/resources/views/lead/_detail_booking.blade.php
@@ -0,0 +1,71 @@
+
+
+
+
+
+
+
+
+
+
+ BuchnungsID
+ {{__('Reiseland')}}
+ {{__('Programm')}}
+ {{__('Anreise')}}
+ {{__('Abreise')}}
+ {{__('Sachbearbeiter')}}
+ {{__('Status')}}
+ {{__('Datum')}}
+
+
+
+
+ @if($lead->bookings)
+ @foreach ($lead->bookings as $booking)
+
+
+
+
+
+ {{ $booking->id }}
+
+
+ @if($booking->travel_country_id && $booking->travel_country)
+ {{ $booking->travel_country->name }}
+ @endif
+
+
+ @if($booking->travelagenda_id && $booking->travel_agenda)
+ {{ $booking->travel_agenda->name }}
+ @endif
+
+ {{ _format_date($booking->start_date) }}
+ {{ _format_date($booking->end_date) }}
+
+ @if($booking->sf_guard_user_id && $booking->sf_guard_user)
+ {{ $booking->sf_guard_user->first_name }} {{ $booking->sf_guard_user->last_name }}
+ @endif
+
+
+ @if($booking->lead)
+ {!! $booking->lead->getStatusBadge($booking) !!}
+ @endif
+
+
+ {{ _format_date($booking->booking_date) }}
+
+
+ @endforeach
+ @endif
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/resources/views/lead/_detail_lead.blade.php b/resources/views/lead/_detail_lead.blade.php
index 2bbd987..8c1a0e2 100644
--- a/resources/views/lead/_detail_lead.blade.php
+++ b/resources/views/lead/_detail_lead.blade.php
@@ -18,7 +18,7 @@
{{ __('Sachbearbeiter') }}*
- {{ Form::select('sf_guard_user_id', \App\Models\Lead::getSfGuardUserArray() , $lead->sf_guard_user_id, array('class'=>'custom-select', 'required'=>true)) }}
+ {{ Form::select('sf_guard_user_id', \App\Services\Model::getSfGuardUserArray() , $lead->sf_guard_user_id, array('class'=>'custom-select', 'required'=>true)) }}