Store Customer, Store Booking details
This commit is contained in:
parent
b362b93bca
commit
6706d28f51
33 changed files with 1048 additions and 257 deletions
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue