01 2020
This commit is contained in:
parent
bed91c4f4a
commit
c8948338bb
122 changed files with 7911 additions and 1639 deletions
33
app/Exports/ReportCollectionExport.php
Normal file
33
app/Exports/ReportCollectionExport.php
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
namespace App\Exports;
|
||||
|
||||
use Maatwebsite\Excel\Excel;
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\Exportable;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
|
||||
class ReportCollectionExport implements FromCollection, WithHeadings
|
||||
{
|
||||
protected $collection;
|
||||
protected $headings;
|
||||
|
||||
use Exportable;
|
||||
|
||||
|
||||
public function __construct($data,$header)
|
||||
{
|
||||
$this->collection = $data;
|
||||
$this->headings = $header;
|
||||
}
|
||||
|
||||
public function collection()
|
||||
{
|
||||
return collect($this->collection);
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [$this->headings];
|
||||
}
|
||||
|
||||
}
|
||||
191
app/Http/Controllers/API/BookingController.php
Executable file
191
app/Http/Controllers/API/BookingController.php
Executable file
|
|
@ -0,0 +1,191 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\API;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Arrangement;
|
||||
use App\Models\Booking;
|
||||
use App\Models\BookingServiceItem;
|
||||
use App\Models\Customer;
|
||||
use App\Models\Lead;
|
||||
use App\Models\Participant;
|
||||
use App\Models\TravelBooking;
|
||||
use App\Repositories\DraftRepository;
|
||||
|
||||
|
||||
class BookingController extends Controller
|
||||
{
|
||||
private $successStatus = 200;
|
||||
private $successKey = 'f6077389c9ce710e554763a5de02c8ec';
|
||||
|
||||
protected $draftRepo;
|
||||
|
||||
public function __construct(DraftRepository $draftRepo)
|
||||
{
|
||||
$this->draftRepo = $draftRepo;
|
||||
}
|
||||
|
||||
public function import()
|
||||
{
|
||||
|
||||
$request = \Request::all();
|
||||
if($request['key'] !== $this->successKey){
|
||||
return response()->json(['error' => "key"], 401);
|
||||
}
|
||||
$travel_booking = TravelBooking::find($request['travel_booking_id']);
|
||||
|
||||
// $travel_booking = TravelBooking::find(2458);
|
||||
if(!$travel_booking){
|
||||
return response()->json(['error' => 'no-booking-found'], $this->successStatus);
|
||||
}
|
||||
|
||||
// ---- createCustomer
|
||||
$data = [
|
||||
'salutation_id' => $travel_booking->salutation_id,
|
||||
'name' => $travel_booking->last_name,
|
||||
'firstname' => $travel_booking->first_name,
|
||||
'street' => $travel_booking->street,
|
||||
'zip' => $travel_booking->zipcode,
|
||||
'city' => $travel_booking->city,
|
||||
'country_id' => $travel_booking->country_id,
|
||||
'phone' => $travel_booking->phone,
|
||||
'phonemobile' => $travel_booking->mobile,
|
||||
'email' => $travel_booking->email
|
||||
];
|
||||
$customer = Customer::create($data);
|
||||
|
||||
// ---- createLead
|
||||
$data = [
|
||||
'customer_id' => $customer->id,
|
||||
'request_date' => $travel_booking->created,
|
||||
'travelperiod_start' => $travel_booking->selected_start_date,
|
||||
'travelperiod_end' => $travel_booking->selected_end_date,
|
||||
'remarks' => $travel_booking->comments,
|
||||
'sf_guard_user_id' => 15,
|
||||
'is_closed' => true,
|
||||
'initialcontacttype_id' => 14,
|
||||
'status_id' => 7,
|
||||
'website_id' => 1,
|
||||
];
|
||||
$lead = Lead::create($data);
|
||||
$lead->updateNextDueDate();
|
||||
|
||||
|
||||
$data = [
|
||||
'booking_date' => $travel_booking->created->format('Y-m-d'),
|
||||
'customer_id' => $customer->id,
|
||||
'lead_id' => $lead->id,
|
||||
'new_drafts' => $travel_booking->drafts === null ? 0 : 1,
|
||||
'sf_guard_user_id' => 15,
|
||||
'branch_id' => 4,
|
||||
'travel_country_id' => isset($travel_booking->selected_travel['travel_country_id'][0]) ? $travel_booking->selected_travel['travel_country_id'][0] : null,
|
||||
'travel_category_id' => isset($travel_booking->selected_travel['travel_category_id']) ? $travel_booking->selected_travel['travel_category_id'] : null,
|
||||
'pax' => $travel_booking->selected_adults,
|
||||
'title' => isset($travel_booking->selected_travel['travel_title']) ? $travel_booking->selected_travel['travel_title'] : "",
|
||||
'start_date' => $travel_booking->selected_start_date->format('Y-m-d'),
|
||||
'end_date' => $travel_booking->selected_end_date->format('Y-m-d'),
|
||||
'website_id' => 1,
|
||||
'travel_number' => isset($travel_booking->selected_travel['travel_number']) ? $travel_booking->selected_travel['travel_number'] : null,
|
||||
'participant_name' => isset($travel_booking->participants[0]['last_name']) ? $travel_booking->participants[0]['last_name'] : null,
|
||||
'participant_firstname' => isset($travel_booking->participants[0]['first_name']) ? $travel_booking->participants[0]['first_name'] : null,
|
||||
'participant_birthdate' => isset($travel_booking->participants[0]['birthday']) ? date( "Y-m-d", strtotime($travel_booking->participants[0]['birthday'])) : null,
|
||||
'participant_salutation_id' => isset($travel_booking->participants[0]['gender']) ? $travel_booking->participants[0]['gender'] : null,
|
||||
'travel_company_id' => isset($travel_booking->service_items[0]['travel_company_id']) ? $travel_booking->service_items[0]['travel_company_id'] : null,
|
||||
'price' => $travel_booking->price,
|
||||
'price_total' => $travel_booking->price_total,
|
||||
'deposit_total' => $travel_booking->deposit_total,
|
||||
'final_payment' => $travel_booking->final_payment,
|
||||
'final_payment_date' => $travel_booking->final_payment_date->format('Y-m-d'),
|
||||
'travelagenda_id' => isset($travel_booking->selected_travel['travelagenda_id']) ? $travel_booking->selected_travel['travelagenda_id'] : null,
|
||||
];
|
||||
|
||||
//createBooking
|
||||
$booking = Booking::create($data);
|
||||
|
||||
//createTraveler
|
||||
if($travel_booking->participants){
|
||||
foreach ($travel_booking->participants as $key => $participant){
|
||||
if($key > 0){
|
||||
Participant::create([
|
||||
'booking_id' => $booking->id,
|
||||
'participant_name' => $participant['last_name'],
|
||||
'participant_firstname' => $participant['first_name'],
|
||||
'participant_birthdate' => date( "Y-m-d", strtotime($participant['birthday'])),
|
||||
'participant_salutation_id' => $participant['gender'],
|
||||
'participant_child' => $participant['child'],
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//createServiceItem //service_items
|
||||
if($travel_booking->service_items){
|
||||
foreach ($travel_booking->service_items as $key => $service_item){
|
||||
BookingServiceItem::create([
|
||||
'booking_id' => $booking->id,
|
||||
'travel_company_id' => $service_item['travel_company_id'],
|
||||
'service_price' => $service_item['service_price'],
|
||||
'service_price_refund' => 0,
|
||||
'commission' => $service_item['commission'],
|
||||
'travel_date' => $service_item['travel_date'],
|
||||
'name' => $service_item['name'],
|
||||
'is_commission_locked' => 0,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
//createServiceItem //insurances
|
||||
if($travel_booking->insurances){
|
||||
foreach ($travel_booking->insurances as $key => $service_item){
|
||||
BookingServiceItem::create([
|
||||
'booking_id' => $booking->id,
|
||||
'travel_company_id' => $service_item['travel_company_id'],
|
||||
'service_price' => $service_item['price'],
|
||||
'service_price_refund' => 0,
|
||||
'commission' => $service_item['commission'],
|
||||
'travel_date' => $service_item['travel_date'],
|
||||
'name' => $service_item['name'],
|
||||
'is_commission_locked' => 0,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//createArrangement
|
||||
if($travel_booking->arrangements) {
|
||||
foreach ($travel_booking->arrangements as $key => $arrangement){
|
||||
Arrangement::create([
|
||||
'state' => isset($arrangement['state']) ? $arrangement['state'] : null,
|
||||
'begin' => isset($arrangement['end']) ? $arrangement['end'] : null,
|
||||
'end' => isset($arrangement['end']) ? $arrangement['end'] : null,
|
||||
'type_s' => isset($arrangement['type_s']) ? $arrangement['type_s'] : null,
|
||||
'data_s' => isset($arrangement['data_s']) ? $arrangement['data_s'] : null,
|
||||
'view_position' => isset($arrangement['view_position']) ? $arrangement['view_position'] : null,
|
||||
'booking_id' => $booking->id,
|
||||
'type_id' => $arrangement['type_id'],
|
||||
'in_pdf' => isset($arrangement['in_pdf']) ? $arrangement['in_pdf'] : null,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
//createDrafts
|
||||
|
||||
if($travel_booking->drafts) {
|
||||
$this->draftRepo->create_drafts_from_booking($booking->id, $travel_booking->drafts);
|
||||
}
|
||||
|
||||
$travel_booking->crm_booking_id = $booking->id;
|
||||
$travel_booking->save();
|
||||
$ret= [
|
||||
'url_v1' => make_old_url('/index.php/booking/'.$booking->id.'/edit'),
|
||||
'url_v3' => route('booking_detail', $booking->id),
|
||||
'lead_id' => $lead->id
|
||||
];
|
||||
return response()->json(['success' => "import", "ret" => $ret], $this->successStatus);
|
||||
//return response()->json(['error' => 'no-node'], $this->successStatus);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -10,7 +10,8 @@ use App\Models\TravelGuide;
|
|||
|
||||
class CMSContentController extends Controller
|
||||
{
|
||||
public $successStatus = 200;
|
||||
private $successStatus = 200;
|
||||
private $successKey = 'f6077389c9ce710e554763a5de02c8ec';
|
||||
|
||||
|
||||
public function search()
|
||||
|
|
@ -22,7 +23,7 @@ class CMSContentController extends Controller
|
|||
return response()->json(['error' => "request no found"], $this->successStatus);
|
||||
}
|
||||
|
||||
if($request['key'] !== 'f6077389c9ce710e554763a5de02c8ec'){
|
||||
if($request['key'] !== $this->successKey){
|
||||
return response()->json(['error' => "key"], 401);
|
||||
}
|
||||
|
||||
|
|
@ -35,11 +36,13 @@ class CMSContentController extends Controller
|
|||
$tree = IQContentTree::whereIdentifier($tree_identifier)->first();
|
||||
$travel_guide = null;
|
||||
$url = "";
|
||||
$ret['title'] = "";
|
||||
$ret['description'] = "";
|
||||
if($tree){
|
||||
$lvl = 0;
|
||||
|
||||
$ret['tree'] = $tree->toArray();
|
||||
$ret['navi'] = $this->makeNaviTree($tree, $urlArray, "", 0, false);
|
||||
|
||||
$url = "/".$tree->identifier;
|
||||
$ret['bread_crumb'][$lvl] = [
|
||||
'title' => $tree->name,
|
||||
|
|
@ -51,14 +54,15 @@ class CMSContentController extends Controller
|
|||
$tree_node = IQContentTreeNode::whereTreeId($tree->id)->whereIdentifier($tree_node_identifier)->whereLvl($lvl)->whereActive(true)->first();
|
||||
|
||||
if($tree_node){
|
||||
$lvl ++;
|
||||
$ret['title'] = $tree_node->title;
|
||||
$ret['description'] = $tree_node->description;;
|
||||
$url = $url."/".$tree_node->identifier;
|
||||
$ret['bread_crumb'][$lvl] = [
|
||||
'title' => $tree_node->name,
|
||||
'url' => $url,
|
||||
];
|
||||
|
||||
$ret['nodes'][$lvl] = $tree_node->toArray();
|
||||
$lvl ++;
|
||||
}else{
|
||||
return response()->json(['error' => 'no-node'], $this->successStatus);
|
||||
}
|
||||
|
|
@ -69,12 +73,18 @@ class CMSContentController extends Controller
|
|||
if($tree_node->iq_content_sites->count()){
|
||||
foreach ($tree_node->iq_content_sites as $iq_content_site){
|
||||
if(isset($iq_content_site->travel_guide) && $iq_content_site->travel_guide && $iq_content_site->travel_guide->active){
|
||||
$ret['sites'][] = $iq_content_site->travel_guide->toArray();
|
||||
$key = ($iq_content_site->travel_guide->scope -1) *-1;
|
||||
$ret['sites'][$key] = $iq_content_site->travel_guide->toArray();
|
||||
/*if(!$travel_guide){
|
||||
//$travel_guide = $iq_content_site->travel_guide;
|
||||
}*/
|
||||
}
|
||||
}
|
||||
if(isset($ret['sites'])){
|
||||
ksort($ret['sites']);
|
||||
$ret['sites'] = array_values($ret['sites']);
|
||||
}
|
||||
|
||||
}
|
||||
//children
|
||||
if($tree_node->iq_content_tree_node_childs->count()){
|
||||
|
|
|
|||
|
|
@ -33,35 +33,42 @@ class CMSContentInfoController extends Controller
|
|||
$locals = CMSInfoAvailable::whereType('local')->whereSpecial(false)->get();
|
||||
foreach ($locals as $value){
|
||||
$date = CMSInfoAvailable::getWeekWithDate($value->wday);
|
||||
$ret['local'][$date['date']] = [
|
||||
$ret['local'][strtotime($date['date'])] = [
|
||||
'day'=>$days[$value->wday],
|
||||
'active' => $value->active,
|
||||
'from' => $value->from,
|
||||
'to' => $value->to,
|
||||
'date' => $date['date'],
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
$phones = CMSInfoAvailable::whereType('phone')->whereSpecial(false)->get();
|
||||
foreach ($phones as $value){
|
||||
$date = CMSInfoAvailable::getWeekWithDate($value->wday);
|
||||
$ret['phone'][$date['date']] = [
|
||||
$ret['phone'][strtotime($date['date'])] = [
|
||||
'day'=>$days[$value->wday],
|
||||
'active' => $value->active,
|
||||
'from' => $value->from,
|
||||
'to' => $value->to,
|
||||
'date' => $date['date'],
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
$specials = CMSInfoAvailable::whereSpecial(true)->get();
|
||||
foreach ($specials as $special){
|
||||
$ret[$special->type][$special->date] = [
|
||||
$ret[$special->type][strtotime($special->date)] = [
|
||||
'day'=>$days[$special->wday],
|
||||
'active' => $special->active,
|
||||
'from' => $special->from,
|
||||
'to' => $special->to,
|
||||
'date' => $special->date,
|
||||
|
||||
];
|
||||
}
|
||||
// ksort($ret);
|
||||
ksort($ret['local']);
|
||||
ksort($ret['phone']);
|
||||
|
||||
$ret['info']['office_important_note_active'] = CMSInfo::getContentBySlug('office-important-note-active');
|
||||
$ret['info']['office_important_note'] = CMSInfo::getContentBySlug('office-important-note');
|
||||
|
|
|
|||
|
|
@ -14,8 +14,6 @@ class DraftController extends Controller
|
|||
{
|
||||
public $successStatus = 200;
|
||||
public $data = "";
|
||||
public $room_str = "";
|
||||
public $room_name = "";
|
||||
public $className = "";
|
||||
public $option = "";
|
||||
|
||||
|
|
@ -23,12 +21,12 @@ class DraftController extends Controller
|
|||
{
|
||||
|
||||
|
||||
if ($action == "get_draft_list") {
|
||||
if ($action === "get_draft_list") {
|
||||
$drafts = Draft::where('active', true)->get()->sortByDesc("id");
|
||||
return response()->json(['success' => $drafts], $this->successStatus);
|
||||
}
|
||||
|
||||
if ($action == "get_draft_list_for_table") {
|
||||
if ($action === "get_draft_list_for_table") {
|
||||
$ret = [];
|
||||
if (request('program_id') && request('program_id') > 0) {
|
||||
$travel_program = TravelProgram::find(request('program_id'));
|
||||
|
|
@ -50,20 +48,19 @@ class DraftController extends Controller
|
|||
|
||||
}
|
||||
|
||||
if ($action == "create_drafts_from_fewo") {
|
||||
if ($action === "create_drafts_from_fewo") {
|
||||
$data = \Input::all();
|
||||
$start_date = Carbon::parse($data['startDateStr']);
|
||||
$end_date = Carbon::parse($data['endDateStr']);
|
||||
$pos = 0;
|
||||
if(isset($data['priceResult']) && is_array($data['priceResult'])){
|
||||
if (isset($data['priceResult']) && is_array($data['priceResult'])) {
|
||||
|
||||
if(isset($data['priceResult']['season']) && is_array($data['priceResult']['season'])){
|
||||
foreach ($data['priceResult']['season'] as $season => $values){
|
||||
|
||||
$service = '* Saison: '.$season."\n".
|
||||
'* Mindestbelegung: '.$values['minimumStay'].' '.($values['minimumStay'] < 2 ? 'Nacht' : 'Nächte')."\n".
|
||||
'* Preis: '.number_format($values['price'], 2, ',', '.').' € / '. $values['numberDays'].' '.($values['numberDays'] < 2 ? 'Nacht' : 'Nächte').' x '.number_format($values['perNight'], 2, ',', '.')." € \n";
|
||||
if (isset($data['priceResult']['season']) && is_array($data['priceResult']['season'])) {
|
||||
foreach ($data['priceResult']['season'] as $season => $values) {
|
||||
|
||||
$service = '* Saison: ' . $season . "\n" .
|
||||
'* Mindestbelegung: ' . $values['minimumStay'] . ' ' . ($values['minimumStay'] < 2 ? 'Nacht' : 'Nächte') . "\n" .
|
||||
'* Preis: ' . number_format($values['price'], 2, ',', '.') . ' € / ' . $values['numberDays'] . ' ' . ($values['numberDays'] < 2 ? 'Nacht' : 'Nächte') . ' x ' . number_format($values['perNight'], 2, ',', '.') . " € \n";
|
||||
|
||||
|
||||
$from_date = Carbon::parse($values['fromDay']);
|
||||
|
|
@ -75,7 +72,7 @@ class DraftController extends Controller
|
|||
'fewo_lodging_id' => $data['fewo_lodging_id'],
|
||||
'draft_type_id' => 38,
|
||||
'request_date' => $data['request_date'],
|
||||
'days_duration' => $values['numberDays'],
|
||||
'days_duration' => $values['numberDays'],
|
||||
'start_date' => $from_date->format("Y-m-d"),
|
||||
'end_date' => $to_date->format("Y-m-d"),
|
||||
'service' => $service,
|
||||
|
|
@ -87,14 +84,14 @@ class DraftController extends Controller
|
|||
|
||||
}
|
||||
}
|
||||
if(isset($data['priceResult']['flatPrice'])){
|
||||
$service = '* Service-Gebühr: '.number_format($data['priceResult']['deposit'], 2, ',', '.');
|
||||
if (isset($data['priceResult']['flatPrice'])) {
|
||||
$service = '* Service-Gebühr: ' . number_format($data['priceResult']['deposit'], 2, ',', '.');
|
||||
BookingDraftItem::create([
|
||||
'booking_id' => $data['booking_id'],
|
||||
'fewo_lodging_id' => $data['fewo_lodging_id'],
|
||||
'draft_type_id' => 39,
|
||||
'request_date' => $data['request_date'],
|
||||
'days_duration' => $data['priceResult']['days'],
|
||||
'days_duration' => $data['priceResult']['days'],
|
||||
'start_date' => $start_date->format("Y-m-d"),
|
||||
'end_date' => $end_date->format("Y-m-d"),
|
||||
'service' => $service,
|
||||
|
|
@ -106,14 +103,14 @@ class DraftController extends Controller
|
|||
|
||||
|
||||
}
|
||||
if(isset($data['priceResult']['deposit'])){
|
||||
$service = '* Kaution: '.number_format($data['priceResult']['deposit'], 2, ',', '.');
|
||||
if (isset($data['priceResult']['deposit'])) {
|
||||
$service = '* Kaution: ' . number_format($data['priceResult']['deposit'], 2, ',', '.');
|
||||
BookingDraftItem::create([
|
||||
'booking_id' => $data['booking_id'],
|
||||
'fewo_lodging_id' => $data['fewo_lodging_id'],
|
||||
'draft_type_id' => 40,
|
||||
'request_date' => $data['request_date'],
|
||||
'days_duration' => $data['priceResult']['days'],
|
||||
'days_duration' => $data['priceResult']['days'],
|
||||
'start_date' => $start_date->format("Y-m-d"),
|
||||
'end_date' => $end_date->format("Y-m-d"),
|
||||
'service' => $service,
|
||||
|
|
@ -124,532 +121,12 @@ class DraftController extends Controller
|
|||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
return response()->json(['success' => $data['booking_id']], $this->successStatus);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($action == "create_drafts_from_booking") {
|
||||
$data = \Input::all();
|
||||
$this->data = $data;
|
||||
|
||||
$weekday = date('w', strtotime($data['startDateStr']));
|
||||
$travel_program = TravelProgram::find($data['travel_program_id']);
|
||||
$draft = $this->getDraftByTravelProgramData($travel_program, $data, $weekday);
|
||||
|
||||
$start_date = Carbon::parse($data['startDateStr']);
|
||||
$end_date = Carbon::parse($data['endDateStr']);
|
||||
|
||||
|
||||
if($draft){
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//prepare rooms
|
||||
//request('rooms'); // //["rooms"]=> array(1) { [0]=> object(stdClass)#7284 (5) { ["name"]=> string(12) "Einzelzimmer" ["price_adult"]=> float(1682.16) ["adult"]=> int(1) ["children"]=> int(0) ["price_children"]=> int(0) }
|
||||
$price_info_rooms = [];
|
||||
$room_names = [];
|
||||
$room_adult = 0;
|
||||
$room_children = 0;
|
||||
$room_price_adult = 0;
|
||||
$room_price_children = 0;
|
||||
|
||||
$data['rooms'] = array_reverse($data['rooms']);
|
||||
|
||||
foreach ($data['rooms'] as $room){
|
||||
|
||||
$room_adult += $room['adult'];
|
||||
$room_children += $room['children'];
|
||||
$room_price_adult += ($room['price_adult_full'] * $room['adult']);
|
||||
$room_price_children += ($room['price_children_full'] * $room['children']);
|
||||
|
||||
if(isset($room_names[$room['name']])){
|
||||
$room_names[$room['name']] = $room_names[$room['name']]+1;
|
||||
}else{
|
||||
$room_names[$room['name']] = 1;
|
||||
}
|
||||
|
||||
$service = trans('_vorlagen.grundpreis_reise');
|
||||
$this->room_name = $room['name'];
|
||||
$service = $this->replaceService($service);
|
||||
|
||||
$price_info_rooms[] = [
|
||||
'booking_id' => $data['booking_id'],
|
||||
'travel_program_id' => $data['travel_program_id'],
|
||||
'fewo_lodging_id' => null,
|
||||
'travel_class_id' => null,
|
||||
'draft_item_id' => null,
|
||||
'draft_type_id' => 30,
|
||||
'request_date' => $data['request_date'],
|
||||
'days_start' => null,
|
||||
'days_duration' => null,
|
||||
'start_date' => $data['startDateStr'],
|
||||
'end_date' => $data['endDateStr'],
|
||||
'service' => $service,
|
||||
'price_adult' => $room['price_adult_full'],
|
||||
'adult' => $room['adult'],
|
||||
'price_children' => $room['price_children_full'],
|
||||
'children' => $room['children'],
|
||||
'pos' => 0,
|
||||
'in_pdf' => true,
|
||||
'comfort' => $data['comfort']
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$this->room_str = "";
|
||||
foreach ($room_names as $name=>$count){
|
||||
$this->room_str .= $count.' x '.$name.', ';
|
||||
}
|
||||
$this->room_str = rtrim($this->room_str, ', ');
|
||||
|
||||
|
||||
//before & after days
|
||||
|
||||
$price_info_rooms_before = [];
|
||||
$price_info_rooms_after = [];
|
||||
|
||||
if(isset($data['booking_before']) && is_array($data['booking_before'])){
|
||||
foreach ($data['booking_before'] as $booking_before){
|
||||
$start_date_before = clone $start_date;
|
||||
if(isset($booking_before['days']) && $booking_before['days'] > 0){
|
||||
$start_date_before->modify('-'.$booking_before['days'].' day');
|
||||
}
|
||||
|
||||
$price_info_rooms_before[] = [
|
||||
'booking_id' => $data['booking_id'],
|
||||
'travel_program_id' => $data['travel_program_id'],
|
||||
'fewo_lodging_id' => null,
|
||||
'travel_class_id' => null,
|
||||
'draft_item_id' => null,
|
||||
'draft_type_id' => 36,
|
||||
'request_date' => $data['request_date'],
|
||||
'days_start' => null,
|
||||
'days_duration' => $booking_before['days'],
|
||||
'start_date' => $start_date_before->format("Y-m-d"),
|
||||
'end_date' => $data['startDateStr'],
|
||||
'service' => $booking_before['name'],
|
||||
'price_adult' => $booking_before['price'],
|
||||
'adult' => $booking_before['adults'],
|
||||
'price_children' => $booking_before['price_children'],
|
||||
'children' => $booking_before['children'],
|
||||
'pos' => 0,
|
||||
'in_pdf' => true,
|
||||
'comfort' => $data['comfort']
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($data['booking_after']) && is_array($data['booking_after'])){
|
||||
foreach ($data['booking_after'] as $booking_after){
|
||||
$end_date_after = clone $end_date;
|
||||
if(isset($booking_after['days']) && $booking_after['days'] > 0){
|
||||
$end_date_after->modify('+'.$booking_after['days'].' day');
|
||||
}
|
||||
|
||||
$price_info_rooms_after[] = [
|
||||
'booking_id' => $data['booking_id'],
|
||||
'travel_program_id' => $data['travel_program_id'],
|
||||
'fewo_lodging_id' => null,
|
||||
'travel_class_id' => null,
|
||||
'draft_item_id' => null,
|
||||
'draft_type_id' => 37,
|
||||
'request_date' => $data['request_date'],
|
||||
'days_start' => null,
|
||||
'days_duration' => $booking_after['days'],
|
||||
'start_date' => $data['endDateStr'],
|
||||
'end_date' => $end_date_after->format("Y-m-d"),
|
||||
'service' => $booking_after['name'],
|
||||
'price_adult' => $booking_after['price'],
|
||||
'adult' => $booking_after['adults'],
|
||||
'price_children' => $booking_after['price_children'],
|
||||
'children' => $booking_after['children'],
|
||||
'pos' => 0,
|
||||
'in_pdf' => true,
|
||||
'comfort' => $data['comfort']
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//prepare extra_charge
|
||||
$price_info_extra_charge = [];
|
||||
if($data['departure_extra_charge'] > 0){
|
||||
|
||||
$service = trans('_vorlagen.aufpreis_flug');
|
||||
$service = $this->replaceService($service);
|
||||
|
||||
$price_info_extra_charge[] = [
|
||||
'booking_id' => $data['booking_id'],
|
||||
'travel_program_id' => $data['travel_program_id'],
|
||||
'fewo_lodging_id' => null,
|
||||
'travel_class_id' => null,
|
||||
'draft_item_id' => null,
|
||||
'draft_type_id' => 33,
|
||||
'request_date' => $data['request_date'],
|
||||
'days_start' => null,
|
||||
'days_duration' => null,
|
||||
'start_date' => null,
|
||||
'end_date' => null,
|
||||
'service' => $service,
|
||||
'price_adult' => $data['departure_extra_charge'] ,
|
||||
'adult' => $data['traveler'] ,
|
||||
'price_children' => 0,
|
||||
'children' => 0,
|
||||
'pos' => 0,
|
||||
'in_pdf' => true,
|
||||
'comfort' => $data['comfort']
|
||||
];
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//prepare $class_options
|
||||
$price_info_class_options = [];
|
||||
foreach ($data['class_options'] as $class_option){
|
||||
|
||||
$service = trans('_vorlagen.aufpreis_kategorie');
|
||||
$this->className = $class_option['name'];
|
||||
$service = $this->replaceService($service);
|
||||
|
||||
$price_info_class_options[] = [
|
||||
'booking_id' => $data['booking_id'],
|
||||
'travel_program_id' => $data['travel_program_id'],
|
||||
'fewo_lodging_id' => null,
|
||||
'travel_class_id' => null,
|
||||
'draft_item_id' => null,
|
||||
'draft_type_id' => 32,
|
||||
'request_date' => $data['request_date'],
|
||||
'days_start' => null,
|
||||
'days_duration' => null,
|
||||
'start_date' => null,
|
||||
'end_date' => null,
|
||||
'service' => $service,
|
||||
'price_adult' => $class_option['price'],
|
||||
'adult' => $class_option['count'],
|
||||
'price_children' => 0,
|
||||
'children' => 0,
|
||||
'pos' => 0,
|
||||
'in_pdf' => true,
|
||||
'comfort' => $data['comfort']
|
||||
];
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//prepare $travel_options
|
||||
$price_info_travel_options = [];
|
||||
foreach ($data['travel_options'] as $travel_option){
|
||||
|
||||
$service = trans('_vorlagen.aufpreis_option');
|
||||
$this->option = $travel_option['name'];
|
||||
$service = $this->replaceService($service);
|
||||
|
||||
/*
|
||||
* if($travel_option['children'] < 1){
|
||||
$travel_option['price_children'] = 0;
|
||||
}
|
||||
*/
|
||||
$price_info_travel_options[] = [
|
||||
'booking_id' => $data['booking_id'],
|
||||
'travel_program_id' => $data['travel_program_id'],
|
||||
'fewo_lodging_id' => null,
|
||||
'travel_class_id' => null,
|
||||
'draft_item_id' => null,
|
||||
'draft_type_id' => 41,
|
||||
'request_date' => $data['request_date'],
|
||||
'days_start' => null,
|
||||
'days_duration' => null,
|
||||
'start_date' => null,
|
||||
'end_date' => null,
|
||||
'service' => $service,
|
||||
'price_adult' => $travel_option['price_adult'],
|
||||
'adult' => $travel_option['adult'],
|
||||
'price_children' => $travel_option['price_children'],
|
||||
'children' => $travel_option['children'],
|
||||
'pos' => 0,
|
||||
'in_pdf' => true,
|
||||
'comfort' => $data['comfort']
|
||||
];
|
||||
}
|
||||
|
||||
$price_info_travel_discounts = [];
|
||||
|
||||
foreach ($data['discount'] as $travel_discount){
|
||||
|
||||
$service = trans('_vorlagen.aufpreis_option');
|
||||
$this->option = "";
|
||||
$service = $this->replaceService($service);
|
||||
|
||||
if($travel_discount['price'] > 0){
|
||||
$travel_discount['price'] = $travel_discount['price']*-1;
|
||||
}
|
||||
$price_info_travel_options[] = [
|
||||
'booking_id' => $data['booking_id'],
|
||||
'travel_program_id' => $data['travel_program_id'],
|
||||
'fewo_lodging_id' => null,
|
||||
'travel_class_id' => null,
|
||||
'draft_item_id' => null,
|
||||
'draft_type_id' => 42,
|
||||
'request_date' => $data['request_date'],
|
||||
'days_start' => null,
|
||||
'days_duration' => null,
|
||||
'start_date' => null,
|
||||
'end_date' => null,
|
||||
'service' => $service,
|
||||
'price_adult' => $travel_discount['price'],
|
||||
'adult' => $travel_discount['count'],
|
||||
'price_children' => 0,
|
||||
'children' => 0,
|
||||
'pos' => 0,
|
||||
'in_pdf' => true,
|
||||
'comfort' => $data['comfort']
|
||||
];
|
||||
}
|
||||
|
||||
$info_texts = [];
|
||||
$last_post = 0;
|
||||
foreach ($draft->draft_items as $draft_item){
|
||||
|
||||
$service = $draft_item->service;
|
||||
$price_adult = 0;
|
||||
$adult = 0;
|
||||
$price_children = 0;
|
||||
$children = 0;
|
||||
|
||||
switch ($draft_item->draft_type->id){
|
||||
case 24: //rundreise
|
||||
$price_adult = $room_price_adult;
|
||||
$adult = $room_adult;
|
||||
$price_children = $room_price_children;
|
||||
$children = $room_children;
|
||||
break;
|
||||
case 4: //flug
|
||||
// "Hinflug: Rückflug: Flugzeiten ?"
|
||||
break;
|
||||
}
|
||||
|
||||
$start_date_temp = null;
|
||||
if($draft_item->days_start > 0){
|
||||
$start_date_temp = clone $start_date;
|
||||
$start_date_temp->addDay($draft_item->days_start-1);
|
||||
}
|
||||
|
||||
$end_date_temp = null;
|
||||
if($draft_item->days_duration > 0){
|
||||
$end_date_temp = clone $start_date;
|
||||
$end_date_temp->addDay($draft_item->days_duration-1);
|
||||
}
|
||||
|
||||
$service = $this->replaceService($service);
|
||||
|
||||
if($draft_item->draft_type->id == 27){
|
||||
//text -at last
|
||||
$info_texts[] = [
|
||||
'booking_id' => $data['booking_id'],
|
||||
'travel_program_id' => $data['travel_program_id'],
|
||||
'fewo_lodging_id' => null,
|
||||
'travel_class_id' => null,
|
||||
'draft_item_id' => $draft_item->id,
|
||||
'draft_type_id' => $draft_item->draft_type->id,
|
||||
'request_date' => $data['request_date'],
|
||||
'days_start' => $draft_item->days_start,
|
||||
'days_duration' => $draft_item->days_duration,
|
||||
'start_date' => $start_date_temp ? $start_date_temp->format("Y-m-d") : null,
|
||||
'end_date' => $end_date_temp ? $end_date_temp->format("Y-m-d") : null,
|
||||
'service' => $service,
|
||||
'price_adult' => $price_adult,
|
||||
'adult' => $adult,
|
||||
'price_children' => $price_children,
|
||||
'children' => $children,
|
||||
'pos' => $draft_item->pos,
|
||||
'in_pdf' => $draft_item->in_pdf,
|
||||
'comfort' => $data['comfort']
|
||||
];
|
||||
|
||||
|
||||
}else{
|
||||
//create new from draft items
|
||||
BookingDraftItem::create([
|
||||
'booking_id' => $data['booking_id'],
|
||||
'travel_program_id' => $data['travel_program_id'],
|
||||
'fewo_lodging_id' => null,
|
||||
'travel_class_id' => null,
|
||||
'draft_item_id' => $draft_item->id,
|
||||
'draft_type_id' => $draft_item->draft_type->id,
|
||||
'request_date' => $data['request_date'],
|
||||
'days_start' => $draft_item->days_start,
|
||||
'days_duration' => $draft_item->days_duration,
|
||||
'start_date' => $start_date_temp ? $start_date_temp->format("Y-m-d") : null,
|
||||
'end_date' => $end_date_temp ? $end_date_temp->format("Y-m-d") : null,
|
||||
'service' => $service,
|
||||
'price_adult' => $price_adult,
|
||||
'adult' => $adult,
|
||||
'price_children' => $price_children,
|
||||
'children' => $children,
|
||||
'pos' => $draft_item->pos,
|
||||
'in_pdf' => $draft_item->in_pdf,
|
||||
'comfort' => $data['comfort']
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
$last_post = $draft_item->pos;
|
||||
|
||||
}
|
||||
|
||||
//set room prices
|
||||
if(count($price_info_rooms)){
|
||||
foreach ($price_info_rooms as $price_info_room){
|
||||
$last_post ++;
|
||||
$price_info_room['pos'] = $last_post;
|
||||
BookingDraftItem::create($price_info_room);
|
||||
}
|
||||
}
|
||||
|
||||
//set room prices before
|
||||
if(count($price_info_rooms_before)){
|
||||
foreach ($price_info_rooms_before as $price_info_room){
|
||||
$last_post ++;
|
||||
$price_info_room['pos'] = $last_post;
|
||||
BookingDraftItem::create($price_info_room);
|
||||
}
|
||||
}
|
||||
|
||||
//set room prices after
|
||||
if(count($price_info_rooms_after)){
|
||||
foreach ($price_info_rooms_after as $price_info_room){
|
||||
$last_post ++;
|
||||
$price_info_room['pos'] = $last_post;
|
||||
BookingDraftItem::create($price_info_room);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//set extra charge price
|
||||
if(count($price_info_extra_charge)){
|
||||
foreach ($price_info_extra_charge as $price_info_extra){
|
||||
$last_post ++;
|
||||
$price_info_extra['pos'] = $last_post;
|
||||
BookingDraftItem::create($price_info_extra);
|
||||
}
|
||||
}
|
||||
//set class options prices
|
||||
if(count($price_info_class_options)){
|
||||
foreach ($price_info_class_options as $price_info_class_option){
|
||||
$last_post ++;
|
||||
$price_info_class_option['pos'] = $last_post;
|
||||
BookingDraftItem::create($price_info_class_option);
|
||||
}
|
||||
}
|
||||
|
||||
//set travel options prices
|
||||
if(count($price_info_travel_options)){
|
||||
foreach ($price_info_travel_options as $price_info_travel_option){
|
||||
$last_post ++;
|
||||
$price_info_travel_option['pos'] = $last_post;
|
||||
BookingDraftItem::create($price_info_travel_option);
|
||||
}
|
||||
}
|
||||
|
||||
//set travel discount prices
|
||||
if(count($price_info_travel_discounts)){
|
||||
foreach ($price_info_travel_discounts as $price_info_travel_discount){
|
||||
$last_post ++;
|
||||
$price_info_travel_option['pos'] = $last_post;
|
||||
BookingDraftItem::create($price_info_travel_option);
|
||||
}
|
||||
}
|
||||
|
||||
//set travel options prices
|
||||
if(count($info_texts)){
|
||||
foreach ($info_texts as $info_text){
|
||||
$last_post ++;
|
||||
$info_text['pos'] = $last_post;
|
||||
BookingDraftItem::create($info_text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$ret = [];
|
||||
/*
|
||||
$travel_program_id = request('travel_program_id');
|
||||
$comfort = request('comfort');
|
||||
$booking_id = request('booking_id');
|
||||
$startDateStr = request('startDateStr');
|
||||
$endDateStr = request('endDateStr');
|
||||
$departure = request('departure');
|
||||
$departure_extra_charge = request('departure_extra_charge');
|
||||
$traveler = request('traveler');
|
||||
$title = request('title');
|
||||
$number = request('number');
|
||||
$rooms = request('rooms'); // //["rooms"]=> array(1) { [0]=> object(stdClass)#7284 (5) { ["name"]=> string(12) "Einzelzimmer" ["price_adult"]=> float(1682.16) ["adults"]=> int(1) ["children"]=> int(0) ["price_children"]=> int(0) }
|
||||
$class_options = request('class_options'); //["travel_options"]=> array(2) { [0]=> array(5) { ["name"]=> string(20) "Aufpreis Halbpension" ["price_adult"]=> float(75) ["adult"]=> int(5) ["children"]=> int(0) ["price_children"]=> int(0) }
|
||||
$travel_options = request('travel_options'); //["class_options"]=> array(1) { [0]=> array(3) { ["name"]=> string(39) "zugebuchte Leistung: Komfort (4 Sterne)" ["price"]=> float(152) ["count"]=> int(1)
|
||||
*/
|
||||
|
||||
return response()->json(['success' => $draft->id], $this->successStatus);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
protected function replaceService($service){
|
||||
|
||||
$service = str_replace('#Name#', $this->data['title'], $service);
|
||||
$service = str_replace('#Nummer#', $this->data['number'], $service);
|
||||
$service = str_replace('#Zimmer#', $this->room_str, $service);
|
||||
$service = str_replace('#Raumname#', $this->room_name, $service);
|
||||
$service = str_replace('#Kategorie#', $this->className, $service);
|
||||
$service = str_replace('#Option#', $this->option, $service);
|
||||
$service = str_replace('#Flughafen#', $this->data['departure'], $service);
|
||||
|
||||
return $service;
|
||||
|
||||
}
|
||||
|
||||
protected function getDraftByTravelProgramData($travel_program, $data, $weekday){
|
||||
if ($travel_program && count($travel_program->travel_program_drafts)) {
|
||||
|
||||
foreach ($travel_program->travel_program_drafts as $travel_program_draft) {
|
||||
//this need an realation to travel class by booking and price
|
||||
if(in_array($weekday, $travel_program_draft->weekdays)){
|
||||
if($data['comfort'] == false && strpos(strtolower($travel_program_draft->travel_class->name), 'standard') !== false){
|
||||
return $travel_program_draft->draft;
|
||||
}
|
||||
if($data['comfort'] == true && strpos(strtolower($travel_program_draft->travel_class->name), 'komfort') !== false){
|
||||
return $travel_program_draft->draft;
|
||||
}
|
||||
}
|
||||
}
|
||||
//found non get first
|
||||
foreach ($travel_program->travel_program_drafts as $travel_program_draft) {
|
||||
return $travel_program_draft->draft;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
/*
|
||||
array(14) {
|
||||
["travel_program_id"]=> int(197) ["comfort"]=> bool(true) ["booking_id"]=> string(4) "8435" ["request_date"]=> string(10) "2018-10-29" ["startDateStr"]=> string(10) "2018-11-03" ["endDateStr"]=> string(10) "2018-11-10" ["departure"]=> string(7) "Hamburg" ["departure_extra_charge"]=> float(55) ["traveler"]=> int(3) ["title"]=> string(35) "Höhepunkte Jordaniens ab Nov. 2018" ["number"]=> string(16) "JOR-HOE1920018B1" ["rooms"]=> array(2) {
|
||||
[0]=> array(5) {
|
||||
["name"]=> string(12) "Doppelzimmer" ["price_adult"]=> float(1473.85) ["adults"]=> int(2) ["children"]=> int(0) ["price_children"]=> int(0) } [1]=> array(5) {
|
||||
["name"]=> string(12) "Einzelzimmer" ["price_adult"]=> float(1682.16) ["adults"]=> int(1) ["children"]=> int(0) ["price_children"]=> int(0) } } ["class_options"]=> array(2) {
|
||||
[0]=> array(3) {
|
||||
["name"]=> string(39) "zugebuchte Leistung: Komfort (4 Sterne)" ["price"]=> float(122) ["count"]=> int(2) } [1]=> array(3) {
|
||||
["name"]=> string(39) "zugebuchte Leistung: Komfort (4 Sterne)" ["price"]=> float(171) ["count"]=> int(1) } } ["travel_options"]=> array(1) {
|
||||
[0]=> array(5) {
|
||||
["name"]=> string(20) "Aufpreis Halbpension" ["price_adult"]=> float(75) ["adults"]=> int(3) ["children"]=> int(0) ["price_children"]=> int(0) } } }
|
||||
*/
|
||||
}
|
||||
216
app/Http/Controllers/Admin/ReportController.php
Executable file
216
app/Http/Controllers/Admin/ReportController.php
Executable file
|
|
@ -0,0 +1,216 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Exports\ReportCollectionExport;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
use App\Models\Booking;
|
||||
use App\Models\ServiceProvider;
|
||||
use App\Models\ServiceProviderEntry;
|
||||
use App\Models\TravelAgenda;
|
||||
use App\Services\Util;
|
||||
use Carbon\Carbon;
|
||||
use HTMLHelper;
|
||||
use Illuminate\Validation\Rules\In;
|
||||
use Input;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use Request;
|
||||
use Response;
|
||||
|
||||
class ReportController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('superadmin');
|
||||
}
|
||||
|
||||
|
||||
public function bookings()
|
||||
{
|
||||
$data = [
|
||||
'text' => "Umsetzung folgt",
|
||||
];
|
||||
return view('_empty', $data);
|
||||
}
|
||||
|
||||
public function providers()
|
||||
{
|
||||
$data = [
|
||||
'serviceProviders' => ServiceProvider::all(),
|
||||
];
|
||||
return view('admin.report.index', $data);
|
||||
}
|
||||
|
||||
public function providersExport(){
|
||||
|
||||
$query = ServiceProviderEntry::with('booking', 'service_provider', 'booking.customer');
|
||||
if(Input::get('filter_is_cleared') != ""){
|
||||
$query->where('is_cleared', '=', Input::get('filter_is_cleared'));
|
||||
}
|
||||
if(Input::get('filter_service_provider_id') != ""){
|
||||
$query->where('service_provider_id', '=', Input::get('filter_service_provider_id'));
|
||||
}
|
||||
if(Input::get('filter_travel_date_from') != ""){
|
||||
$query->whereHas('booking', function ($q) {
|
||||
$travel_date_from = Carbon::parse(Input::get('filter_travel_date_from'))->format("Y-m-d");
|
||||
$q->where("start_date", '>=', $travel_date_from);
|
||||
});
|
||||
}
|
||||
if(Input::get('filter_travel_date_to') != ""){
|
||||
$query->whereHas('booking', function ($q) {
|
||||
$travel_date_to = Carbon::parse(Input::get('filter_travel_date_to'))->format("Y-m-d");
|
||||
$q->where("start_date", '<=', $travel_date_to);
|
||||
});
|
||||
}
|
||||
|
||||
$query->whereHas('booking', function ($q) {
|
||||
$q->orderBy("lead_id", 'ASC');
|
||||
});
|
||||
|
||||
$filename = "file-".date('Y-m-d-H-i-s');
|
||||
$exports = $query->get();
|
||||
$columns = [];
|
||||
if(Input::get('export') === "export"){
|
||||
$filename = "Export_".date('Y-m-d-H-i-s');
|
||||
|
||||
$headers = array(
|
||||
'Zähler',
|
||||
'MyJack Nr.',
|
||||
'CRM Nr',
|
||||
'Kunde',
|
||||
'Reisedatum',
|
||||
'Gesamtreisepreis',
|
||||
'Reiseland',
|
||||
'Reiseprogramm',
|
||||
'Reiseteilnehmer',
|
||||
'Leistungsträger',
|
||||
'Rechnungsnummer',
|
||||
'Zahlung',
|
||||
'Zahlungsdatum',
|
||||
'Erlös',
|
||||
'Konto',
|
||||
);
|
||||
$isset = [];
|
||||
foreach($exports as $export) {
|
||||
$new = in_array($export->booking->lead_id, $isset) ? false : true;
|
||||
$columns[] = array(
|
||||
'Zähler' => $new ? $export->getCounter() : "",
|
||||
'MyJack Nr.' => $new ? $export->booking->merlin_order_number : "",
|
||||
'CRM Nr' => $new ? $export->booking->lead_id : "",
|
||||
'Kunde' => $new ? $export->booking->customer->name : "",
|
||||
'Reisedatum' => $new ? $export->booking->getStartDateFormat() : "",
|
||||
'Gesamtreisepreis' => $new ? $export->booking->price : "",
|
||||
'Reiseland' => $new ? $export->booking->travel_country->name : "",
|
||||
'Reiseprogramm' => $new ? $export->booking->travel_agenda->name : "",
|
||||
'Reiseteilnehmer' => $new ? $export->booking->pax : "",
|
||||
'Leistungsträger' => $export->service_provider->name,
|
||||
'Rechnungsnummer' => $export->invoice_number,
|
||||
'Zahlung' => $export->getAmountFinalEur(),
|
||||
'Zahlungsdatum' => $export->getPaymentDateFormat(),
|
||||
'Erlös' => $new ? $export->booking->proceeds() : "",
|
||||
'Konto' => $export->booking->getKontoNumber()
|
||||
);
|
||||
$isset[] = $export->booking->lead_id;
|
||||
}
|
||||
}
|
||||
if(Input::get('export') === "export_lt"){
|
||||
$filename = "Export_LT_".date('Y-m-d-H-i-s');
|
||||
|
||||
$headers = array(
|
||||
'Zähler',
|
||||
'MyJack Nr.',
|
||||
'CRM Nr',
|
||||
'Kunde',
|
||||
'Reisedatum',
|
||||
'Reiseland',
|
||||
'Reiseprogramm',
|
||||
'Reiseteilnehmer',
|
||||
'Leistungsträger',
|
||||
'Rechnungsnummer',
|
||||
'Zahlung',
|
||||
'ZahlungVorgang',
|
||||
);
|
||||
$isset = [];
|
||||
foreach($exports as $export) {
|
||||
$new = in_array($export->booking->lead_id, $isset) ? false : true;
|
||||
$columns[] = array(
|
||||
'Zähler' => $new ? $export->getCounter() : "",
|
||||
'MyJack Nr.' => $new ? $export->booking->merlin_order_number : "",
|
||||
'CRM Nr' => $new ? $export->booking->lead_id : "",
|
||||
'Kunde' => $new ? $export->booking->customer->name : "",
|
||||
'Reisedatum' => $new ? $export->booking->getStartDateFormat() : "",
|
||||
'Reiseland' => $new ? $export->booking->travel_country->name : "",
|
||||
'Reiseprogramm' => $new ? $export->booking->travel_agenda->name : "",
|
||||
'Reiseteilnehmer' => $new ? $export->booking->pax : "",
|
||||
'Leistungsträger' => $export->service_provider->name,
|
||||
'Rechnungsnummer' => $export->invoice_number,
|
||||
'Zahlung' => $export->getAmountFinalEur(),
|
||||
'ZahlungVorgang' => $export->booking->getServiceProviderPaymentsTotal(),
|
||||
);
|
||||
$isset[] = $export->booking->lead_id;
|
||||
}
|
||||
}
|
||||
return Excel::download(new ReportCollectionExport($columns, $headers), $filename.'.xls');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function providersDatatable()
|
||||
{
|
||||
|
||||
$query = ServiceProviderEntry::with('booking', 'service_provider', 'booking.customer');
|
||||
|
||||
if(Input::get('filter_is_cleared') != ""){
|
||||
$query->where('is_cleared', '=', Input::get('filter_is_cleared'));
|
||||
}
|
||||
if(Input::get('filter_service_provider_id') != ""){
|
||||
$query->where('service_provider_id', '=', Input::get('filter_service_provider_id'));
|
||||
}
|
||||
if(Input::get('filter_travel_date_from') != ""){
|
||||
$query->whereHas('booking', function ($q) {
|
||||
$travel_date_from = Carbon::parse(Input::get('filter_travel_date_from'))->format("Y-m-d");
|
||||
$q->where("start_date", '>=', $travel_date_from);
|
||||
});
|
||||
}
|
||||
if(Input::get('filter_travel_date_to') != ""){
|
||||
$query->whereHas('booking', function ($q) {
|
||||
$travel_date_to = Carbon::parse(Input::get('filter_travel_date_to'))->format("Y-m-d");
|
||||
$q->where("start_date", '<=', $travel_date_to);
|
||||
});
|
||||
}
|
||||
|
||||
return \DataTables::eloquent($query)
|
||||
->addColumn('booking.customer.fullName', function (ServiceProviderEntry $serviceProviderEntry) {
|
||||
return $serviceProviderEntry->booking->customer->fullName();
|
||||
})
|
||||
->addColumn('booking.proceeds', function (ServiceProviderEntry $serviceProviderEntry) {
|
||||
return $serviceProviderEntry->booking->proceeds();
|
||||
})
|
||||
->addColumn('booking.start_date', function (ServiceProviderEntry $serviceProviderEntry) {
|
||||
return $serviceProviderEntry->booking->getStartDateFormat();
|
||||
})
|
||||
->addColumn('is_cleared', function (ServiceProviderEntry $serviceProviderEntry) {
|
||||
return $serviceProviderEntry->is_cleared ? ' <span data-order="1" class="badge badge-pill badge-success"><i class="fa fa-check"></i></span>' : '<span data-order="0" class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>';
|
||||
})
|
||||
->filterColumn('booking.customer.fullName', function ($query, $keyword) {
|
||||
if ($keyword != "") {
|
||||
$query->whereHas('booking', function ($q) use ($keyword) {
|
||||
$q->whereHas('customer', function ($q) use ($keyword) {
|
||||
$q->where("name", 'LIKE', '%' . $keyword . '%')
|
||||
->orWhere('firstname', 'LIKE', '%' . $keyword . '%');
|
||||
});
|
||||
});
|
||||
}
|
||||
})
|
||||
->orderColumn('booking.start_date', 'booking.start_date $1')
|
||||
->orderColumn('is_cleared', 'is_cleared $1')
|
||||
->rawColumns(['is_cleared'])
|
||||
->make(true);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -65,7 +65,7 @@ class AdminUserController extends Controller
|
|||
{
|
||||
$data = Input::all();
|
||||
|
||||
if($data['user_id'] == "new"){
|
||||
if($data['user_id'] === "new"){
|
||||
$rules = array(
|
||||
'name' => 'required',
|
||||
'email' => 'required|string|email|max:255|unique:users',
|
||||
|
|
@ -81,7 +81,7 @@ class AdminUserController extends Controller
|
|||
return back()->withInput(Input::all())->withErrors($validator);
|
||||
}
|
||||
|
||||
if($data['user_id'] == "new"){
|
||||
if($data['user_id'] === "new"){
|
||||
$user = User::create([
|
||||
'name' => $data['name'],
|
||||
'email' => $data['email'],
|
||||
|
|
@ -165,19 +165,19 @@ class AdminUserController extends Controller
|
|||
|
||||
return \DataTables::eloquent($query)
|
||||
->addColumn('action_edit', function (User $user) {
|
||||
return '<a href="' . route('admin_user_edit', [$user->id]) . '" class="btn icon-btn btn-sm btn-primary"><span class="far fa-edit"></span></a>';
|
||||
return '<a href="' . route('admin_user_edit', [$user->id]) . '" class="btn icon-btn btn-sm btn-primary"><span class="fa fa-edit"></span></a>';
|
||||
})
|
||||
->addColumn('admin', function (User $user) {
|
||||
return '<a href="#" data-url="'.route('admin_user_load_modal', $user->id).'" data-data="'.$user->id.'" class="update_modal_data_show">'.HTMLHelper::getRoleLabel($user->admin, '<i class="fa fa-edit"></i> Rechte + ','').'</a>';
|
||||
})
|
||||
->addColumn('confirmed', function (User $user) {
|
||||
return $user->confirmed ? '<span class="badge badge-pill badge-success"><i class="far fa-check"></i></span>' : '<span class="badge badge-pill badge-danger"><i class="far fa-times"></i></span>';
|
||||
return $user->confirmed ? '<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('active', function (User $user) {
|
||||
return $user->active ? ' <span class="badge badge-pill badge-success"><i class="far fa-check"></i></span>' : '<span class="badge badge-pill badge-danger"><i class="far fa-times"></i></span>';
|
||||
return $user->active ? ' <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('action_delete', function (User $user) {
|
||||
return '<a href="' . route('admin_user_delete', [$user->id]) . '" class="btn icon-btn btn-sm btn-danger" onclick="return confirm(\''.__('Really delete entry?').'\');"><span class="far fa-trash"></span></a>';
|
||||
return '<a href="' . route('admin_user_delete', [$user->id]) . '" class="btn icon-btn btn-sm btn-danger" onclick="return confirm(\''.__('Really delete entry?').'\');"><span class="fa fa-trash"></span></a>';
|
||||
})
|
||||
->orderColumn('confirmed', 'confirmed $1')
|
||||
->orderColumn('active', 'active $1')
|
||||
|
|
|
|||
|
|
@ -30,13 +30,13 @@ class DataTableController extends Controller
|
|||
return $user->account ? $user->account->last_name : '';
|
||||
})
|
||||
->addColumn('action', function (User $user) {
|
||||
return '<a href="' . route('admin_lead_edit', [$user->id]) . '" class="btn icon-btn btn-sm btn-primary"><span class="far fa-edit"></span></a>';
|
||||
return '<a href="' . route('admin_lead_edit', [$user->id]) . '" class="btn icon-btn btn-sm btn-primary"><span class="fa fa-edit"></span></a>';
|
||||
})
|
||||
->addColumn('confirmed', function (User $user) {
|
||||
return $user->confirmed ? '<span class="badge badge-pill badge-success"><i class="far fa-check"></i></span>' : '<span class="badge badge-pill badge-danger"><i class="far fa-times"></i></span>';
|
||||
return $user->confirmed ? '<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('active', function (User $user) {
|
||||
return $user->active ? ' <span class="badge badge-pill badge-success"><i class="far fa-check"></i></span>' : '<span class="badge badge-pill badge-danger"><i class="far fa-times"></i></span>';
|
||||
return $user->active ? ' <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('confirmed', 'confirmed $1')
|
||||
->orderColumn('active', 'active $1')
|
||||
|
|
@ -52,205 +52,31 @@ class DataTableController extends Controller
|
|||
|
||||
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="far fa-edit"></span></a>';
|
||||
return '<a href="' . route('booking_detail', [$booking->id]) . '" class="btn icon-btn btn-sm btn-primary"><span class="fa fa-edit"></span></a>';
|
||||
})
|
||||
->addColumn('id', function (Booking $booking) {
|
||||
return '<a data-order="'.$booking->id.'" href="' . route('booking_detail', [$booking->id]) . '" data-id="'.$booking->id.'">'.$booking->id.'</a>';
|
||||
})
|
||||
->addColumn('booking_date', function (Booking $booking) {
|
||||
return Carbon::parse($booking->booking_date)->format(\Util::formatDateDB());
|
||||
})
|
||||
->addColumn('start_date', function (Booking $booking) {
|
||||
return Carbon::parse($booking->start_date)->format(\Util::formatDateDB());
|
||||
})
|
||||
->addColumn('end_date', function (Booking $booking) {
|
||||
return Carbon::parse($booking->end_date)->format(\Util::formatDateDB());
|
||||
})
|
||||
->orderColumn('id', 'id $1')
|
||||
->filterColumn('id', function($query, $keyword) {
|
||||
if($keyword != ""){
|
||||
$query->where('id', 'LIKE', '%'.$keyword.'%');
|
||||
}
|
||||
})
|
||||
->rawColumns(['action_edit', 'id'])
|
||||
|
||||
->make(true);
|
||||
}
|
||||
|
||||
public function getRequests()
|
||||
{
|
||||
|
||||
$query = Booking::where('lead_id', '!=', NULL);
|
||||
|
||||
if(Input::get('full_firstname_search') != ""){
|
||||
$query->where('participant_firstname', 'LIKE', '%'.Input::get('full_firstname_search').'%');
|
||||
}
|
||||
|
||||
if(Input::get('full_lastname_search') != ""){
|
||||
$query->where('participant_name', 'LIKE', '%'.Input::get('full_lastname_search').'%');
|
||||
}
|
||||
|
||||
// $query->where('end_date', '<=', $now);
|
||||
|
||||
if(Input::get('travel_option_search')){
|
||||
$now = Carbon::now();
|
||||
|
||||
|
||||
switch (Input::get('travel_option_search')){
|
||||
case 'before_2':
|
||||
$query->whereBetween('start_date', [Carbon::now()->modify('-2 month'), $now]);
|
||||
|
||||
break;
|
||||
case 'brefore_1':
|
||||
$query->whereBetween('start_date', [Carbon::now()->modify('-1 month'), $now]);
|
||||
|
||||
break;
|
||||
case 'on_site':
|
||||
$query->where('start_date', '<=', $now);
|
||||
$query->where('end_date', '>=', $now);
|
||||
break;
|
||||
case 'after_1':
|
||||
$query->whereBetween('start_date', [$now, Carbon::now()->modify('+1 month')]);
|
||||
|
||||
break;
|
||||
case 'after_2':
|
||||
$query->whereBetween('start_date', [$now, Carbon::now()->modify('+2 month')]);
|
||||
|
||||
break;
|
||||
}
|
||||
}else{
|
||||
$start = null;
|
||||
$end = null;
|
||||
if(Input::get('arrival_start_date') != ""){
|
||||
$arrStart = explode(".", Input::get('arrival_start_date'));
|
||||
if(count($arrStart) == 3){
|
||||
$start = Carbon::create($arrStart[2], $arrStart[1], $arrStart[0], 0, 0, 0);
|
||||
}
|
||||
}
|
||||
if(Input::get('arrival_end_date') != ""){
|
||||
$arrEnd = explode(".", Input::get('arrival_end_date'));
|
||||
if(count($arrEnd) == 3){
|
||||
$end = Carbon::create($arrEnd[2], $arrEnd[1], $arrEnd[0], 23, 59, 59);
|
||||
}
|
||||
}
|
||||
if($start && $end){
|
||||
$query->whereBetween('start_date', [$start, $end]);
|
||||
}
|
||||
if($start && !$end){
|
||||
$query->where('start_date', '>=', $start);
|
||||
}
|
||||
if(!$start && $end){
|
||||
$query->where('start_date', '<=', $end);
|
||||
}
|
||||
|
||||
$start = null;
|
||||
$end = null;
|
||||
if(Input::get('departure_start_date') != ""){
|
||||
$arrStart = explode(".", Input::get('departure_start_date'));
|
||||
if(count($arrStart) == 3){
|
||||
$start = Carbon::create($arrStart[2], $arrStart[1], $arrStart[0], 0, 0, 0);
|
||||
}
|
||||
}
|
||||
if(Input::get('departure_end_date') != ""){
|
||||
$arrEnd = explode(".", Input::get('departure_end_date'));
|
||||
if(count($arrEnd) == 3){
|
||||
$end = Carbon::create($arrEnd[2], $arrEnd[1], $arrEnd[0], 23, 59, 59);
|
||||
}
|
||||
}
|
||||
if($start && $end){
|
||||
$query->whereBetween('end_date', [$start, $end]);
|
||||
}
|
||||
if($start && !$end){
|
||||
$query->where('end_date', '>=', $start);
|
||||
}
|
||||
if(!$start && $end){
|
||||
$query->where('end_date', '<=', $end);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(Input::get('sort_travel_country_id') != ""){
|
||||
$query->where('travel_country_id', '=', Input::get('sort_travel_country_id'));
|
||||
}
|
||||
if(Input::get('sort_travelagenda_id') != ""){
|
||||
$query->where('travelagenda_id', '=', Input::get('sort_travelagenda_id'));
|
||||
}
|
||||
|
||||
if(Input::get('sort_sf_guard_user_id') != ""){
|
||||
$query->where('sf_guard_user_id', '=', Input::get('sort_sf_guard_user_id'));
|
||||
}
|
||||
|
||||
if(Input::get('sort_travel_documents') != ""){
|
||||
$query->where('travel_documents', '=', Input::get('sort_travel_documents'));
|
||||
}
|
||||
|
||||
|
||||
if(Input::get('full_lead_id_search') != ""){
|
||||
$query->where('lead_id', 'LIKE', '%'.Input::get('full_lead_id_search'). '%');
|
||||
}
|
||||
if(Input::get('full_booking_id_search') != ""){
|
||||
$query->where('id', 'LIKE', '%'.Input::get('full_booking_id_search').'%');
|
||||
}
|
||||
|
||||
//confirmation_code_remider is delete 2
|
||||
//
|
||||
|
||||
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="far 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>';
|
||||
})
|
||||
->addColumn('participant_firstname', function (Booking $booking) {
|
||||
return '<a data-order="'.$booking->participant_firstname.'" href="'.make_old_url('customer/'.$booking->customer_id.'/edit').'" data-id="'.$booking->customer_id.'">'.$booking->participant_firstname.'</a>';
|
||||
})
|
||||
->addColumn('participant_name', function (Booking $booking) {
|
||||
return '<a data-order="'.$booking->participant_name.'" href="'.make_old_url('customer/'.$booking->customer_id.'/edit').'" data-id="'.$booking->customer_id.'">'.$booking->participant_name.'</a>';
|
||||
})
|
||||
->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('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>';
|
||||
})
|
||||
->addColumn('travelagenda_id', function (Booking $booking) {
|
||||
return '<span data-order="'.($booking->travelagenda_id ? $booking->travelagenda_id : 0).'">'.($booking->travelagenda_id ? $booking->travel_agenda->name : "-").'</span>';
|
||||
})
|
||||
->addColumn('start_date', function (Booking $booking) {
|
||||
return $booking->getStartDateFormat();
|
||||
})
|
||||
->addColumn('end_date', function (Booking $booking) {
|
||||
return $booking->getEndDateFormat();
|
||||
})
|
||||
->addColumn('travel_documents', function (Booking $booking) {
|
||||
return $booking->travel_documents ? ' <span data-order="1" class="badge badge-pill badge-success"><i class="far fa-check"></i></span>' : '<span data-order="0" class="badge badge-pill badge-danger"><i class="far fa-times"></i></span>';
|
||||
})
|
||||
->addColumn('sf_guard_user_id', function (Booking $booking) {
|
||||
return '<span data-order="'.($booking->sf_guard_user_id ? $booking->sf_guard_user_id : 0).'">'.($booking->sf_guard_user_id? $booking->sf_guard_user->first_name." ".$booking->sf_guard_user->last_name : "-").'</span>';
|
||||
})
|
||||
->addColumn('lead.status_id', function (Booking $booking) {
|
||||
return '<span data-order="'.($booking->lead->status_id ? $booking->lead->status_id : 0).'">'.($booking->lead->status_id ? $booking->lead->status->name : "-").'</span>';
|
||||
})
|
||||
/* ->filterColumn('travel_country_id', function($query, $keyword) {
|
||||
|
||||
if($keyword != "") {
|
||||
$query->whereRaw("travel_country_id = ?", $keyword);
|
||||
}
|
||||
|
||||
})
|
||||
->filterColumn('travelagenda_id', function($query, $keyword) {
|
||||
if($keyword != ""){
|
||||
$query->whereRaw("travelagenda_id = ?", $keyword);
|
||||
|
||||
}
|
||||
})
|
||||
*/
|
||||
->orderColumn('lead_id', 'lead_id $1')
|
||||
->orderColumn('participant_firstname', 'participant_firstname $1')
|
||||
->orderColumn('participant_name', 'participant_name $1')
|
||||
->orderColumn('id', 'id $1')
|
||||
->orderColumn('travel_country_id', 'travel_country_id $1')
|
||||
->orderColumn('travelagenda_id', 'travelagenda_id $1')
|
||||
->orderColumn('sf_guard_user_id', 'sf_guard_user_id $1')
|
||||
->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'])
|
||||
->make(true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,11 @@
|
|||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Booking;
|
||||
use App\Models\Sym\TravelCountry;
|
||||
use App\Models\TravelAgenda;
|
||||
use Carbon\Carbon;
|
||||
use Input;
|
||||
use DataTables;
|
||||
|
||||
class RequestController extends Controller
|
||||
{
|
||||
|
|
@ -16,8 +20,13 @@ 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 = [
|
||||
'step' => $step
|
||||
'step' => $step,
|
||||
'travel_countries' => $d,
|
||||
];
|
||||
return view('request.index', $data);
|
||||
}
|
||||
|
|
@ -36,6 +45,209 @@ class RequestController extends Controller
|
|||
}
|
||||
die();
|
||||
*/
|
||||
private function getSearchRequests(){
|
||||
|
||||
$query = Booking::where('lead_id', '!=', NULL);
|
||||
|
||||
if(Input::get('full_firstname_search') != ""){
|
||||
$query->where('participant_firstname', 'LIKE', '%'.Input::get('full_firstname_search').'%');
|
||||
}
|
||||
|
||||
if(Input::get('full_lastname_search') != ""){
|
||||
$query->where('participant_name', 'LIKE', '%'.Input::get('full_lastname_search').'%');
|
||||
}
|
||||
|
||||
|
||||
if(Input::get('travel_option_country_id') != ""){
|
||||
$country_ids = TravelCountry::where('contact_lands', 'LIKE', '%"'.Input::get('travel_option_country_id').'"%')->get()->pluck('id');
|
||||
$country_ids[] = Input::get('travel_option_country_id');
|
||||
$query->whereIn('travel_country_id', $country_ids);
|
||||
|
||||
}
|
||||
if(Input::get('travel_option_agenda_id') != ""){
|
||||
$query->where('travelagenda_id', '=', Input::get('travel_option_agenda_id'));
|
||||
|
||||
}
|
||||
|
||||
// $query->where('end_date', '<=', $now);
|
||||
|
||||
if(Input::get('travel_option_search')){
|
||||
$now = Carbon::now();
|
||||
|
||||
switch (Input::get('travel_option_search')){
|
||||
case 'before_2':
|
||||
$query->whereBetween('start_date', [Carbon::now()->modify('-2 month'), $now]);
|
||||
|
||||
break;
|
||||
case 'brefore_1':
|
||||
$query->whereBetween('start_date', [Carbon::now()->modify('-1 month'), $now]);
|
||||
|
||||
break;
|
||||
case 'on_site':
|
||||
$query->where('start_date', '<=', $now);
|
||||
$query->where('end_date', '>=', $now);
|
||||
break;
|
||||
case 'after_1':
|
||||
$query->whereBetween('start_date', [$now, Carbon::now()->modify('+1 month')]);
|
||||
|
||||
break;
|
||||
case 'after_2':
|
||||
$query->whereBetween('start_date', [$now, Carbon::now()->modify('+2 month')]);
|
||||
|
||||
break;
|
||||
}
|
||||
}else{
|
||||
$start = null;
|
||||
$end = null;
|
||||
if(Input::get('arrival_start_date') != ""){
|
||||
$arrStart = explode(".", Input::get('arrival_start_date'));
|
||||
if(count($arrStart) == 3){
|
||||
$start = Carbon::create($arrStart[2], $arrStart[1], $arrStart[0], 0, 0, 0);
|
||||
}
|
||||
}
|
||||
if(Input::get('arrival_end_date') != ""){
|
||||
$arrEnd = explode(".", Input::get('arrival_end_date'));
|
||||
if(count($arrEnd) == 3){
|
||||
$end = Carbon::create($arrEnd[2], $arrEnd[1], $arrEnd[0], 23, 59, 59);
|
||||
}
|
||||
}
|
||||
if($start && $end){
|
||||
$query->whereBetween('start_date', [$start, $end]);
|
||||
}
|
||||
if($start && !$end){
|
||||
$query->where('start_date', '>=', $start);
|
||||
}
|
||||
if(!$start && $end){
|
||||
$query->where('start_date', '<=', $end);
|
||||
}
|
||||
|
||||
$start = null;
|
||||
$end = null;
|
||||
if(Input::get('departure_start_date') != ""){
|
||||
$arrStart = explode(".", Input::get('departure_start_date'));
|
||||
if(count($arrStart) == 3){
|
||||
$start = Carbon::create($arrStart[2], $arrStart[1], $arrStart[0], 0, 0, 0);
|
||||
}
|
||||
}
|
||||
if(Input::get('departure_end_date') != ""){
|
||||
$arrEnd = explode(".", Input::get('departure_end_date'));
|
||||
if(count($arrEnd) == 3){
|
||||
$end = Carbon::create($arrEnd[2], $arrEnd[1], $arrEnd[0], 23, 59, 59);
|
||||
}
|
||||
}
|
||||
if($start && $end){
|
||||
$query->whereBetween('end_date', [$start, $end]);
|
||||
}
|
||||
if($start && !$end){
|
||||
$query->where('end_date', '>=', $start);
|
||||
}
|
||||
if(!$start && $end){
|
||||
$query->where('end_date', '<=', $end);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(Input::get('sort_travel_country_id') != ""){
|
||||
$query->where('travel_country_id', '=', Input::get('sort_travel_country_id'));
|
||||
}
|
||||
if(Input::get('sort_travelagenda_id') != ""){
|
||||
$query->where('travelagenda_id', '=', Input::get('sort_travelagenda_id'));
|
||||
}
|
||||
|
||||
if(Input::get('sort_sf_guard_user_id') != ""){
|
||||
$query->where('sf_guard_user_id', '=', Input::get('sort_sf_guard_user_id'));
|
||||
}
|
||||
|
||||
if(Input::get('sort_travel_documents') != ""){
|
||||
$query->where('travel_documents', '=', Input::get('sort_travel_documents'));
|
||||
}
|
||||
|
||||
|
||||
if(Input::get('full_lead_id_search') != ""){
|
||||
$query->where('lead_id', 'LIKE', '%'.Input::get('full_lead_id_search'). '%');
|
||||
}
|
||||
if(Input::get('full_booking_id_search') != ""){
|
||||
$query->where('id', 'LIKE', '%'.Input::get('full_booking_id_search').'%');
|
||||
}
|
||||
return $query;
|
||||
}
|
||||
public function getAjaxRequests(){
|
||||
|
||||
$query = $this->getSearchRequests();
|
||||
$ret = $query->get()->pluck('travelagenda_id', 'id')->unique()->toArray();
|
||||
return TravelAgenda::whereIn('id', $ret)->get()->pluck('name', 'id');
|
||||
}
|
||||
|
||||
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('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>';
|
||||
})
|
||||
->addColumn('participant_firstname', function (Booking $booking) {
|
||||
return '<a data-order="'.$booking->participant_firstname.'" href="'.make_old_url('customer/'.$booking->customer_id.'/edit').'" data-id="'.$booking->customer_id.'">'.$booking->participant_firstname.'</a>';
|
||||
})
|
||||
->addColumn('participant_name', function (Booking $booking) {
|
||||
return '<a data-order="'.$booking->participant_name.'" href="'.make_old_url('customer/'.$booking->customer_id.'/edit').'" data-id="'.$booking->customer_id.'">'.$booking->participant_name.'</a>';
|
||||
})
|
||||
->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('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>';
|
||||
})
|
||||
->addColumn('travelagenda_id', function (Booking $booking) {
|
||||
return '<span data-order="'.($booking->travelagenda_id ? $booking->travelagenda_id : 0).'">'.($booking->travelagenda_id ? $booking->travel_agenda->name : "-").'</span>';
|
||||
})
|
||||
->addColumn('start_date', function (Booking $booking) {
|
||||
return $booking->getStartDateFormat();
|
||||
})
|
||||
->addColumn('end_date', function (Booking $booking) {
|
||||
return $booking->getEndDateFormat();
|
||||
})
|
||||
->addColumn('travel_documents', function (Booking $booking) {
|
||||
return $booking->travel_documents ? ' <span data-order="1" class="badge badge-pill badge-success"><i class="fa fa-check"></i></span>' : '<span data-order="0" class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>';
|
||||
})
|
||||
->addColumn('sf_guard_user_id', function (Booking $booking) {
|
||||
return '<span data-order="'.($booking->sf_guard_user_id ? $booking->sf_guard_user_id : 0).'">'.($booking->sf_guard_user_id? $booking->sf_guard_user->first_name." ".$booking->sf_guard_user->last_name : "-").'</span>';
|
||||
})
|
||||
->addColumn('lead.status_id', function (Booking $booking) {
|
||||
return '<span data-order="'.($booking->lead->status_id ? $booking->lead->status_id : 0).'">'.($booking->lead->status_id ? $booking->lead->status->name : "-").'</span>';
|
||||
})
|
||||
/* ->filterColumn('travel_country_id', function($query, $keyword) {
|
||||
|
||||
if($keyword != "") {
|
||||
$query->whereRaw("travel_country_id = ?", $keyword);
|
||||
}
|
||||
|
||||
})
|
||||
->filterColumn('travelagenda_id', function($query, $keyword) {
|
||||
if($keyword != ""){
|
||||
$query->whereRaw("travelagenda_id = ?", $keyword);
|
||||
|
||||
}
|
||||
})
|
||||
*/
|
||||
->orderColumn('lead_id', 'lead_id $1')
|
||||
->orderColumn('participant_firstname', 'participant_firstname $1')
|
||||
->orderColumn('participant_name', 'participant_name $1')
|
||||
->orderColumn('id', 'id $1')
|
||||
->orderColumn('travel_country_id', 'travel_country_id $1')
|
||||
->orderColumn('travelagenda_id', 'travelagenda_id $1')
|
||||
->orderColumn('sf_guard_user_id', 'sf_guard_user_id $1')
|
||||
->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'])
|
||||
->make(true);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
418
app/Http/Controllers/SyS/Tools/ContentLinkController.php
Executable file
418
app/Http/Controllers/SyS/Tools/ContentLinkController.php
Executable file
|
|
@ -0,0 +1,418 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\SyS\Tools;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\IQContentSite;
|
||||
use App\Models\IQContentSiteField;
|
||||
use App\Models\IQContentTree;
|
||||
use App\Models\IQContentTreeNode;
|
||||
use App\Models\TravelGuide;
|
||||
use Input;
|
||||
use Validator;
|
||||
|
||||
class ContentLinkController extends Controller
|
||||
{
|
||||
|
||||
private $tree = [];
|
||||
/**
|
||||
* ContentSiteController constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
// $this->middleware('auth');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$val = [];
|
||||
$text = "";
|
||||
$travelGuides = TravelGuide::all();
|
||||
foreach ($travelGuides as $travelGuide){
|
||||
if(strpos($travelGuide->full_text, "<h1><br></h1>") !== false){
|
||||
$val[$travelGuide->id] = "<h1><br></h1>";
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($travelGuides as $travelGuide){
|
||||
if(strpos($travelGuide->full_text, "<h1") !== false){
|
||||
$val[$travelGuide->id] = "<h1";
|
||||
}
|
||||
}
|
||||
|
||||
$travelGuide = TravelGuide::find(203);
|
||||
$text = $travelGuide->full_text;
|
||||
|
||||
// $new_text = preg_replace('/<h1[^>]*>([\s\S]*?)<\/h1[^>]*>/', '', $TravelGuide->full_text);
|
||||
|
||||
|
||||
$data = [
|
||||
'text' => $text,
|
||||
'values' => $val,
|
||||
];
|
||||
return view('sys.tools.links', $data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function store()
|
||||
{
|
||||
$travelGuides = TravelGuide::all();
|
||||
foreach ($travelGuides as $travelGuide){
|
||||
if(strpos($travelGuide->full_text, "<h1><br></h1>") !== false) {
|
||||
$travelGuide->full_text = str_replace("<h1><br></h1>", "", $travelGuide->full_text);
|
||||
$travelGuide->save();
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($travelGuides as $travelGuide){
|
||||
if(strpos($travelGuide->full_text, "<h1") !== false){
|
||||
$travelGuide->full_text = str_replace("<h1", "<h2", $travelGuide->full_text);
|
||||
$travelGuide->full_text = str_replace("h1>", "h2>", $travelGuide->full_text);
|
||||
$travelGuide->save();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return redirect()->back();
|
||||
|
||||
//$this->readNodeAndSaveToTree();
|
||||
//$this->cleanTextTravelGuide();
|
||||
//$this->h1ToTitleTravelGuide();
|
||||
}
|
||||
|
||||
|
||||
public function treeTitle()
|
||||
{
|
||||
$text = "";
|
||||
$val = [];
|
||||
$trees = IQContentTree::all();
|
||||
foreach ($trees as $tree){
|
||||
foreach ($tree->iq_content_tree_nodes as $tree_node){
|
||||
|
||||
$text .= $tree_node->id." -- ".$tree_node->title."\n";
|
||||
foreach ($tree_node->iq_content_sites as $site){
|
||||
if(isset($site->travel_guide->meta_title)){
|
||||
if(isset($val[$tree_node->id])){
|
||||
if(strlen($site->travel_guide->meta_title) > strlen($val[$tree_node->id])){
|
||||
$val[$tree_node->id] = $site->travel_guide->meta_title;
|
||||
}
|
||||
}else{
|
||||
$val[$tree_node->id] = $site->travel_guide->meta_title;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$data = [
|
||||
'text' => $text,
|
||||
'values' => $val,
|
||||
];
|
||||
return view('sys.tools.trees', $data);
|
||||
}
|
||||
|
||||
public function treeTitleStore()
|
||||
{
|
||||
|
||||
$trees = IQContentTree::all();
|
||||
$val = [];
|
||||
foreach ($trees as $tree){
|
||||
foreach ($tree->iq_content_tree_nodes as $tree_node){
|
||||
foreach ($tree_node->iq_content_sites as $site){
|
||||
if(isset($site->travel_guide->meta_title)){
|
||||
if(isset($val[$tree_node->id])){
|
||||
if(strlen($site->travel_guide->meta_title) > strlen($val[$tree_node->id])){
|
||||
$val[$tree_node->id] = $site->travel_guide->meta_title;
|
||||
}
|
||||
}else{
|
||||
$val[$tree_node->id] = $site->travel_guide->meta_title;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(isset($val[$tree_node->id])){
|
||||
$tree_node->title = $val[$tree_node->id];
|
||||
$tree_node->save();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function h1ToTitleTravelGuide()
|
||||
{
|
||||
$TravelGuides = TravelGuide::all();
|
||||
foreach ($TravelGuides as $travelGuide){
|
||||
if(strpos($travelGuide->full_text,'<html><body><h1>' )){
|
||||
$dom = new \DOMDocument('1.0', 'utf-8');
|
||||
@$dom->loadHTML(mb_convert_encoding($travelGuide->full_text, 'HTML-ENTITIES', 'UTF-8'));
|
||||
$elements = $dom->getElementsByTagName('h1');
|
||||
|
||||
foreach ($elements as $element) {
|
||||
if($element->nodeValue != ""){
|
||||
var_dump($travelGuide->id);
|
||||
var_dump($element->nodeValue);
|
||||
echo "<br>";
|
||||
var_dump($travelGuide->name);
|
||||
echo "<br>";
|
||||
echo "--";
|
||||
echo "<br>";
|
||||
|
||||
$new_text = preg_replace('/<h1[^>]*>([\s\S]*?)<\/h1[^>]*>/', '', $travelGuide->full_text);
|
||||
|
||||
$travelGuide->name = $element->nodeValue;
|
||||
$travelGuide->full_text = $new_text;
|
||||
$travelGuide->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
die("done");
|
||||
}
|
||||
|
||||
|
||||
public function cleanTextTravelGuide()
|
||||
{
|
||||
$TravelGuides = TravelGuide::all();
|
||||
foreach ($TravelGuides as $travelGuide){
|
||||
$new_text = \App\Services\Util::cleanHTML($travelGuide->full_text);
|
||||
if(strcmp($travelGuide->full_text, $new_text) != 0){
|
||||
$travelGuide->full_text = $new_text;
|
||||
$travelGuide->save();
|
||||
var_dump($travelGuide->id);
|
||||
echo "<br>";
|
||||
}
|
||||
}
|
||||
die("done");
|
||||
}
|
||||
|
||||
|
||||
public function readNodeAndSaveToTree(){
|
||||
$input = Input::all();
|
||||
$ret = [];
|
||||
if(isset($input['text'])){
|
||||
$out = $this->ul_to_array($input['text']);
|
||||
$this->array_to_nodes($out);
|
||||
}
|
||||
die("done");
|
||||
$data = [
|
||||
'text' => $input['text'],
|
||||
'values' => $ret,
|
||||
];
|
||||
return view('iq.tools.links', $data);
|
||||
}
|
||||
|
||||
public function array_to_nodes($array, $lvl = 1, $parent_id = 1, $pos=100){
|
||||
|
||||
|
||||
if(is_array($array)){
|
||||
foreach ($array as $node){
|
||||
if(isset($node['slug'])){
|
||||
|
||||
$slug = substr($node['slug'], 0, 80);
|
||||
// $slug = substr($node['slug'], 0, strrpos($slug, " "));
|
||||
|
||||
$name = substr($node['name'], 0, 255);
|
||||
// $name = substr($node['name'], 0, strrpos($name, " "));
|
||||
|
||||
|
||||
$data = [
|
||||
'tree_id' => 1,
|
||||
'parent_id' => $parent_id,
|
||||
'lvl' => $lvl,
|
||||
'name' => $name,
|
||||
'identifier' => $slug,
|
||||
'active' => false,
|
||||
'pos' => $pos++,
|
||||
];
|
||||
$tree_node = IQContentTreeNode::create($data);
|
||||
|
||||
|
||||
$travel_guides = TravelGuide::whereSlug($node['slug'])->get();
|
||||
foreach ($travel_guides as $travel_guide){
|
||||
if(IQContentSite::whereTreeNodeId($tree_node->id)->whereTravelGuideId($travel_guide->id)->count() == 0) {
|
||||
IQContentSite::create(['tree_node_id' => $tree_node->id, 'travel_guide_id' => $travel_guide->id]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
if(isset($node['children']) && is_array($node['children'])){
|
||||
$this->array_to_nodes($node['children'], $lvl + 1, $tree_node->id, $pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function ul_to_array($ol){
|
||||
if(is_string($ol)){
|
||||
if(!$ol = simplexml_load_string($ol)) {
|
||||
trigger_error("Syntax error in UL/LI structure");
|
||||
return FALSE;
|
||||
}
|
||||
return $this->ul_to_array($ol);
|
||||
} else if(is_object($ol)){
|
||||
$output = array();
|
||||
foreach($ol->li as $li){
|
||||
|
||||
$tmp = false;
|
||||
if(isset($li->ol)){
|
||||
$tmp = $this->ul_to_array($li->ol);
|
||||
}
|
||||
|
||||
if($li->count()){
|
||||
|
||||
$str = (string) $li;
|
||||
|
||||
$a = new \SimpleXMLElement($li->children()->asXML());
|
||||
$str = (string) $a[0]." ".$str;
|
||||
$str = str_replace("\n", "", $str);
|
||||
$str = str_replace("\r", "", $str);
|
||||
$str = str_replace("\t", "", $str);
|
||||
$str = preg_replace(array('/\s{2,}/', '/[\t\n]/'), ' ', $str);
|
||||
|
||||
if(trim($str) !== "" && $str !== null){
|
||||
$slug = (string) $a['href'];
|
||||
$link = explode("/", $slug);
|
||||
|
||||
$link1 = array_pop($link);
|
||||
$link1 = str_replace('.htm', '',$link1);
|
||||
$output[] = ['slug'=> $link1, 'name'=>$str, 'children'=>$tmp];
|
||||
}
|
||||
}else{
|
||||
$str = (string) $li;
|
||||
$str = str_replace("\n", "", $str);
|
||||
$str = str_replace("\r", "", $str);
|
||||
$str = str_replace("\t", "", $str);
|
||||
if(trim($str) !== "" && $str !== null){
|
||||
|
||||
$output[] = ['slug'=>'', 'name'=>$str, 'children'=>$tmp];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return $output;
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function rindex()
|
||||
{
|
||||
$data = [
|
||||
'text' => "",
|
||||
'values' => [],
|
||||
];
|
||||
return view('iq.content.tools.redirects', $data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function rstore()
|
||||
{
|
||||
|
||||
$iqContentTree = IQContentTree::find(2);
|
||||
$this->makeTree($iqContentTree);
|
||||
$input = Input::all();
|
||||
$ret = [];
|
||||
|
||||
if(isset($input['text'])){
|
||||
|
||||
|
||||
$dom = new \DOMDocument('1.0', 'utf-8');
|
||||
@$dom->loadHTML(mb_convert_encoding($input['text'], 'HTML-ENTITIES', 'UTF-8'));
|
||||
|
||||
|
||||
|
||||
|
||||
$tags = ['ol'];
|
||||
foreach ($tags as $tag){
|
||||
$domElements = [];
|
||||
$elements = $dom->getElementsByTagName($tag)->item(0);
|
||||
|
||||
foreach($elements as $node){
|
||||
foreach($node->childNodes as $child) {
|
||||
$ret[] = array($child->nodeName => $child->nodeValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* $tags = ['a']; foreach ($tags as $tag){
|
||||
$domElements = [];
|
||||
$elements = $dom->getElementsByTagName($tag);
|
||||
foreach ($elements as $element) {
|
||||
$domElements[] = $element;
|
||||
|
||||
}
|
||||
foreach ($domElements as $domElement) {
|
||||
$r = "-----";
|
||||
$href = $domElement->getAttribute('href');
|
||||
$link = explode("/", $href);
|
||||
|
||||
$link1 = array_pop($link);
|
||||
$link1 = str_replace('.html', '',$link1);
|
||||
$link1 = str_replace('-', '',$link1);
|
||||
if(isset($this->tree[$link1])){
|
||||
$r = $this->tree[$link1];
|
||||
}else{
|
||||
$link1 = array_pop($link);
|
||||
$link1 = str_replace('.html', '',$link1);
|
||||
$link1 = str_replace('-', '',$link1);
|
||||
if(isset($this->tree[$link1])){
|
||||
$r = $this->tree[$link1];
|
||||
}
|
||||
}
|
||||
|
||||
$ret[] = "Redirect 301 /".$href." ".$r;
|
||||
|
||||
}
|
||||
}*/
|
||||
|
||||
}
|
||||
$data = [
|
||||
'text' => $input['text'],
|
||||
'values' => $ret,
|
||||
];
|
||||
|
||||
return view('iq.content.tools.redirects', $data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function makeTree(IQContentTree $iq_content_tree, $lvl = 0, $parent_id = false, $url = "")
|
||||
{
|
||||
|
||||
if ($parent_id) {
|
||||
//where('active', true)
|
||||
$tree_nodes = IQContentTreeNode::where('tree_id', $iq_content_tree->id)->where('lvl', $lvl)->where('active', true)->where('parent_id', $parent_id)->orderBy('pos', 'ASC')->get();
|
||||
} else {
|
||||
|
||||
$url = "/" . $iq_content_tree->identifier . "/";
|
||||
$tree_nodes = IQContentTreeNode::where('tree_id', $iq_content_tree->id)->where('lvl', $lvl)->where('active', true)->orderBy('pos', 'ASC')->get();
|
||||
}
|
||||
|
||||
foreach ($tree_nodes as $node) {
|
||||
$children = IQContentTreeNode::where('tree_id', $iq_content_tree->id)->where('lvl', $lvl + 1)->where('active', true)->where('parent_id', $node->id)->count();
|
||||
$this->tree[str_replace('-', '', $node->identifier)] = url($url . $node->identifier);
|
||||
|
||||
if ($children) {
|
||||
$this->makeTree($iq_content_tree, $lvl + 1, $node->id, $url . $node->identifier . "/");
|
||||
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -190,7 +190,7 @@ class TravelUserBookingFewoController extends Controller
|
|||
|
||||
return \DataTables::eloquent($query)
|
||||
->addColumn('action_edit', function (TravelUserBookingFewo $travel_user_booking_fewo) {
|
||||
return '<a data-order="'.$travel_user_booking_fewo->id.'" href="' . route('travel_user_booking_fewo_detail', [$travel_user_booking_fewo->id]) . '" class="btn icon-btn btn-sm btn-primary"><span class="far fa-edit"></span></a>';
|
||||
return '<a data-order="'.$travel_user_booking_fewo->id.'" href="' . route('travel_user_booking_fewo_detail', [$travel_user_booking_fewo->id]) . '" class="btn icon-btn btn-sm btn-primary"><span class="fa fa-edit"></span></a>';
|
||||
})
|
||||
->addColumn('fewo_lodging', function (TravelUserBookingFewo $travel_user_booking_fewo) {
|
||||
//return '<a href="' . route('travel_user_booking_fewo_detail', [$travel_user_booking_fewo->fewo_lodging_id]) . '">'.$travel_user_booking_fewo->fewo_lodging->name.'</a>';
|
||||
|
|
@ -217,7 +217,7 @@ class TravelUserBookingFewoController extends Controller
|
|||
return $travel_user_booking_fewo->getStatuesName();
|
||||
})
|
||||
->addColumn('action_delete', function (TravelUserBookingFewo $travel_user_booking_fewo) {
|
||||
return '<a href="' . route('travel_user_booking_fewo_delete', [$travel_user_booking_fewo->id]) . '" class="btn icon-btn btn-sm btn-danger" onclick="return confirm(\''.__('Really delete entry?').'\');"><span class="far fa-trash"></span></a>';
|
||||
return '<a href="' . route('travel_user_booking_fewo_delete', [$travel_user_booking_fewo->id]) . '" class="btn icon-btn btn-sm btn-danger" onclick="return confirm(\''.__('Really delete entry?').'\');"><span class="fa fa-trash"></span></a>';
|
||||
})
|
||||
->rawColumns(['action_edit', 'fewo_lodging', 'travel_user', 'is_calendar', 'is_mail', 'action_delete'])
|
||||
->make(true);
|
||||
|
|
|
|||
|
|
@ -96,11 +96,11 @@ class TravelUserController extends Controller
|
|||
|
||||
return \DataTables::eloquent($query)
|
||||
->addColumn('action_edit', function (TravelUser $user) {
|
||||
return '<a data-order="'.$user->id.'" href="' . route('travel_user_detail', [$user->id]) . '" class="btn icon-btn btn-sm btn-primary"><span class="far fa-edit"></span></a>';
|
||||
return '<a data-order="'.$user->id.'" href="' . route('travel_user_detail', [$user->id]) . '" class="btn icon-btn btn-sm btn-primary"><span class="fa fa-edit"></span></a>';
|
||||
})
|
||||
|
||||
->addColumn('action_delete', function (TravelUser $user) {
|
||||
return '<a href="' . route('travel_user_delete', [$user->id]) . '" class="btn icon-btn btn-sm btn-danger" onclick="return confirm(\''.__('Really delete entry?').'\');"><span class="far fa-trash"></span></a>';
|
||||
return '<a href="' . route('travel_user_delete', [$user->id]) . '" class="btn icon-btn btn-sm btn-danger" onclick="return confirm(\''.__('Really delete entry?').'\');"><span class="fa fa-trash"></span></a>';
|
||||
})
|
||||
->rawColumns(['action_edit', 'action_delete'])
|
||||
->make(true);
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ use Carbon\Carbon;
|
|||
use Illuminate\Database\Connection;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Mail\MailActivateUser;
|
||||
use App\Mail\ReportExport;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
|
||||
class UserUpdateEmailController extends Controller
|
||||
|
|
@ -146,7 +146,7 @@ class UserUpdateEmailController extends Controller
|
|||
public function sendActivationMail($user, array $data)
|
||||
{
|
||||
$token = $this->createActivation($user, $data);
|
||||
Mail::to($data['email'])->send(new MailActivateUser($token, $user));
|
||||
Mail::to($data['email'])->send(new ReportExport($token, $user));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ class Kernel extends HttpKernel
|
|||
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
|
||||
'admin' => \App\Http\Middleware\Admin::class,
|
||||
'superadmin' => \App\Http\Middleware\SuperAdmin::class,
|
||||
'sysadmin' => \App\Http\Middleware\SysAdmin::class,
|
||||
'auth.permission' => \App\Http\Middleware\AuthPermission::class,
|
||||
'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
|
||||
|
|
|
|||
26
app/Http/Middleware/SysAdmin.php
Executable file
26
app/Http/Middleware/SysAdmin.php
Executable file
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Auth;
|
||||
|
||||
class SysAdmin
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
if ( Auth::check() && Auth::user()->isSySAdmin() )
|
||||
{
|
||||
return $next($request);
|
||||
}
|
||||
return redirect('/home');
|
||||
|
||||
}
|
||||
}
|
||||
88
app/Models/Arrangement.php
Normal file
88
app/Models/Arrangement.php
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Reliese\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class Arrangement
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $template_id
|
||||
* @property Carbon $state
|
||||
* @property Carbon $begin
|
||||
* @property Carbon $end
|
||||
* @property string $type_s
|
||||
* @property string $data_s
|
||||
* @property int $view_position
|
||||
* @property int $booking_id
|
||||
* @property int $type_id
|
||||
* @property bool $in_pdf
|
||||
* @property Booking $booking
|
||||
* @property ArrangementTemplate $arrangement_template
|
||||
* @package App\Models
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Arrangement newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Arrangement newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Arrangement query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Arrangement whereBegin($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Arrangement whereBookingId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Arrangement whereDataS($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Arrangement whereEnd($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Arrangement whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Arrangement whereInPdf($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Arrangement whereState($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Arrangement whereTemplateId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Arrangement whereTypeId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Arrangement whereTypeS($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Arrangement whereViewPosition($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class Arrangement extends Model
|
||||
{
|
||||
protected $connection = 'mysql';
|
||||
|
||||
protected $table = 'arrangement';
|
||||
public $timestamps = false;
|
||||
|
||||
protected $casts = [
|
||||
'template_id' => 'int',
|
||||
'view_position' => 'int',
|
||||
'booking_id' => 'int',
|
||||
'type_id' => 'int',
|
||||
'in_pdf' => 'bool'
|
||||
];
|
||||
|
||||
protected $dates = [
|
||||
'state',
|
||||
'begin',
|
||||
'end'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'template_id',
|
||||
'state',
|
||||
'begin',
|
||||
'end',
|
||||
'type_s',
|
||||
'data_s',
|
||||
'view_position',
|
||||
'booking_id',
|
||||
'type_id',
|
||||
'in_pdf'
|
||||
];
|
||||
|
||||
public function booking()
|
||||
{
|
||||
return $this->belongsTo(Booking::class);
|
||||
}
|
||||
|
||||
public function arrangement_template()
|
||||
{
|
||||
return $this->belongsTo(ArrangementTemplate::class, 'template_id');
|
||||
}
|
||||
}
|
||||
42
app/Models/ArrangementTemplate.php
Normal file
42
app/Models/ArrangementTemplate.php
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Reliese\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class ArrangementTemplate
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $title
|
||||
* @property Collection|Arrangement[] $arrangements
|
||||
* @package App\Models
|
||||
* @property-read int|null $arrangements_count
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ArrangementTemplate newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ArrangementTemplate newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ArrangementTemplate query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ArrangementTemplate whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ArrangementTemplate whereTitle($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class ArrangementTemplate extends Model
|
||||
{
|
||||
protected $connection = 'mysql';
|
||||
|
||||
protected $table = 'arrangement_template';
|
||||
public $timestamps = false;
|
||||
|
||||
protected $fillable = [
|
||||
'title'
|
||||
];
|
||||
|
||||
public function arrangements()
|
||||
{
|
||||
return $this->hasMany(Arrangement::class, 'template_id');
|
||||
}
|
||||
}
|
||||
92
app/Models/ArrangementType.php
Normal file
92
app/Models/ArrangementType.php
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Reliese\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class ArrangementType
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $name
|
||||
* @property int $notify_rel_days
|
||||
* @property int $arrangement_type_id
|
||||
* @property bool $is_unique
|
||||
* @property int $notify_rel_field_key
|
||||
* @property ArrangementType $arrangement_type
|
||||
* @property Booking $booking
|
||||
* @property DraftItem $draft_item
|
||||
* @property DraftType $draft_type
|
||||
* @property Collection|ArrangementType[] $arrangement_types
|
||||
* @property Collection|InquiryType[] $inquiry_types
|
||||
* @package App\Models
|
||||
* @property-read int|null $arrangement_types_count
|
||||
* @property-read int|null $inquiry_types_count
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ArrangementType newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ArrangementType newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ArrangementType query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ArrangementType whereArrangementTypeId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ArrangementType whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ArrangementType whereIsUnique($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ArrangementType whereName($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ArrangementType whereNotifyRelDays($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ArrangementType whereNotifyRelFieldKey($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class ArrangementType extends Model
|
||||
{
|
||||
protected $connection = 'mysql';
|
||||
|
||||
protected $table = 'arrangement_type';
|
||||
public $timestamps = false;
|
||||
|
||||
protected $casts = [
|
||||
'notify_rel_days' => 'int',
|
||||
'arrangement_type_id' => 'int',
|
||||
'is_unique' => 'bool',
|
||||
'notify_rel_field_key' => 'int'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'notify_rel_days',
|
||||
'arrangement_type_id',
|
||||
'is_unique',
|
||||
'notify_rel_field_key'
|
||||
];
|
||||
|
||||
public function arrangement_type()
|
||||
{
|
||||
return $this->belongsTo(ArrangementType::class);
|
||||
}
|
||||
|
||||
public function booking()
|
||||
{
|
||||
return $this->belongsTo(Booking::class);
|
||||
}
|
||||
|
||||
public function draft_item()
|
||||
{
|
||||
return $this->belongsTo(DraftItem::class);
|
||||
}
|
||||
|
||||
public function draft_type()
|
||||
{
|
||||
return $this->belongsTo(DraftType::class);
|
||||
}
|
||||
|
||||
public function arrangement_types()
|
||||
{
|
||||
return $this->hasMany(ArrangementType::class);
|
||||
}
|
||||
|
||||
public function inquiry_types()
|
||||
{
|
||||
return $this->hasMany(InquiryType::class);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,53 +1,85 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Reliese\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* App\Models\Booking
|
||||
* Class Booking
|
||||
*
|
||||
* @property int $id
|
||||
* @property string|null $booking_date
|
||||
* @property Carbon $booking_date
|
||||
* @property int $customer_id
|
||||
* @property int|null $lead_id
|
||||
* @property int|null $new_drafts
|
||||
* @property int $lead_id
|
||||
* @property bool $new_drafts
|
||||
* @property int $sf_guard_user_id
|
||||
* @property int $branch_id
|
||||
* @property float|null $service_fee
|
||||
* @property int|null $travel_country_id
|
||||
* @property int|null $travel_category_id
|
||||
* @property int|null $pax
|
||||
* @property int|null $coupon_id
|
||||
* @property \Illuminate\Support\Carbon $created_at
|
||||
* @property \Illuminate\Support\Carbon $updated_at
|
||||
* @property string|null $title
|
||||
* @property string|null $start_date
|
||||
* @property string|null $end_date
|
||||
* @property int|null $website_id
|
||||
* @property string|null $travel_number
|
||||
* @property string|null $participant_name
|
||||
* @property string|null $participant_firstname
|
||||
* @property string|null $participant_birthdate
|
||||
* @property int|null $participant_salutation_id
|
||||
* @property string|null $ev_number
|
||||
* @property string|null $merlin_knr
|
||||
* @property string|null $merlin_order_number
|
||||
* @property int|null $travel_company_id
|
||||
* @property int|null $travel_documents
|
||||
* @property float|null $price
|
||||
* @property float|null $price_total
|
||||
* @property float|null $deposit_total
|
||||
* @property float|null $final_payment
|
||||
* @property string|null $final_payment_date
|
||||
* @property int|null $travelagenda_id
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\Sym\Arrangement[] $arrangements
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\BookingDraftItem[] $booking_draft_items
|
||||
* @property-read \App\Models\TravelCountry|null $lead
|
||||
* @property-read \App\Models\SfGuardUser $sf_guard_user
|
||||
* @property-read \App\Models\TravelAgenda|null $travel_agenda
|
||||
* @property-read \App\Models\TravelCountry|null $travel_country
|
||||
* @property float $service_fee
|
||||
* @property int $travel_country_id
|
||||
* @property int $travel_category_id
|
||||
* @property int $pax
|
||||
* @property int $coupon_id
|
||||
* @property Carbon $created_at
|
||||
* @property Carbon $updated_at
|
||||
* @property string $title
|
||||
* @property Carbon $start_date
|
||||
* @property Carbon $end_date
|
||||
* @property int $website_id
|
||||
* @property string $travel_number
|
||||
* @property string $participant_name
|
||||
* @property string $participant_firstname
|
||||
* @property Carbon $participant_birthdate
|
||||
* @property int $participant_salutation_id
|
||||
* @property string $ev_number
|
||||
* @property string $merlin_knr
|
||||
* @property string $merlin_order_number
|
||||
* @property int $travel_company_id
|
||||
* @property bool $travel_documents
|
||||
* @property float $price
|
||||
* @property float $price_total
|
||||
* @property float $deposit_total
|
||||
* @property float $final_payment
|
||||
* @property Carbon $final_payment_date
|
||||
* @property int $travelagenda_id
|
||||
* @property Branch $branch
|
||||
* @property Coupon $coupon
|
||||
* @property Customer $customer
|
||||
* @property Lead $lead
|
||||
* @property SfGuardUser $sf_guard_user
|
||||
* @property TravelCategory $travel_category
|
||||
* @property TravelCompany $travel_company
|
||||
* @property TravelCountry $travel_country
|
||||
* @property TravelAgenda $travel_agenda
|
||||
* @property Collection|Arrangement[] $arrangements
|
||||
* @property Collection|ArrangementType[] $arrangement_types
|
||||
* @property Collection|BookingApplication[] $booking_applications
|
||||
* @property Collection|BookingConfirmation[] $booking_confirmations
|
||||
* @property Collection|BookingDraftItem[] $booking_draft_items
|
||||
* @property Collection|BookingInvoice[] $booking_invoices
|
||||
* @property Collection|BookingServiceItem[] $booking_service_items
|
||||
* @property Collection|BookingVoucher[] $booking_vouchers
|
||||
* @property Collection|Coupon[] $coupons
|
||||
* @property Collection|InsuranceCertificate[] $insurance_certificates
|
||||
* @property Collection|Participant[] $participants
|
||||
* @property Collection|ServiceProviderEntry[] $service_provider_entries
|
||||
* @property Collection|TravelInsurance[] $travel_insurances
|
||||
* @package App\Models
|
||||
* @property-read int|null $arrangement_types_count
|
||||
* @property-read int|null $arrangements_count
|
||||
* @property-read int|null $booking_draft_items_count
|
||||
* @property-read int|null $booking_service_items_count
|
||||
* @property-read int|null $coupons_count
|
||||
* @property-read int|null $insurance_certificates_count
|
||||
* @property-read int|null $participants_count
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereBookingDate($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereBranchId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereCouponId($value)
|
||||
|
|
@ -83,11 +115,7 @@ use Illuminate\Database\Eloquent\Model;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereWebsiteId($value)
|
||||
* @mixin \Eloquent
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking query()
|
||||
* @property-read int|null $arrangements_count
|
||||
* @property-read int|null $booking_draft_items_count
|
||||
* @property-read int|null $service_provider_entries_count
|
||||
*/
|
||||
class Booking extends Model
|
||||
{
|
||||
|
|
@ -95,40 +123,185 @@ class Booking extends Model
|
|||
|
||||
protected $table = 'booking';
|
||||
|
||||
/*protected $fillable = [
|
||||
'pos',
|
||||
];*/
|
||||
protected $casts = [
|
||||
'customer_id' => 'int',
|
||||
'lead_id' => 'int',
|
||||
'new_drafts' => 'bool',
|
||||
'sf_guard_user_id' => 'int',
|
||||
'branch_id' => 'int',
|
||||
'service_fee' => 'float',
|
||||
'travel_country_id' => 'int',
|
||||
'travel_category_id' => 'int',
|
||||
'pax' => 'int',
|
||||
'coupon_id' => 'int',
|
||||
'website_id' => 'int',
|
||||
'participant_salutation_id' => 'int',
|
||||
'travel_company_id' => 'int',
|
||||
'travel_documents' => 'bool',
|
||||
'price' => 'float',
|
||||
'price_total' => 'float',
|
||||
'deposit_total' => 'float',
|
||||
'final_payment' => 'float',
|
||||
'travelagenda_id' => 'int'
|
||||
];
|
||||
|
||||
public function booking_draft_items()
|
||||
{
|
||||
return $this->hasMany('App\Models\BookingDraftItem', 'booking_id', 'id')->orderBy('pos', 'ASC');
|
||||
}
|
||||
protected $dates = [
|
||||
'booking_date',
|
||||
'start_date',
|
||||
'end_date',
|
||||
'participant_birthdate',
|
||||
'final_payment_date'
|
||||
];
|
||||
|
||||
//on crm
|
||||
public function travel_agenda()
|
||||
protected $fillable = [
|
||||
'booking_date',
|
||||
'customer_id',
|
||||
'lead_id',
|
||||
'new_drafts',
|
||||
'sf_guard_user_id',
|
||||
'branch_id',
|
||||
'service_fee',
|
||||
'travel_country_id',
|
||||
'travel_category_id',
|
||||
'pax',
|
||||
'coupon_id',
|
||||
'title',
|
||||
'start_date',
|
||||
'end_date',
|
||||
'website_id',
|
||||
'travel_number',
|
||||
'participant_name',
|
||||
'participant_firstname',
|
||||
'participant_birthdate',
|
||||
'participant_salutation_id',
|
||||
'ev_number',
|
||||
'merlin_knr',
|
||||
'merlin_order_number',
|
||||
'travel_company_id',
|
||||
'travel_documents',
|
||||
'price',
|
||||
'price_total',
|
||||
'deposit_total',
|
||||
'final_payment',
|
||||
'final_payment_date',
|
||||
'travelagenda_id'
|
||||
];
|
||||
|
||||
/*public function branch()
|
||||
{
|
||||
return $this->belongsTo(Branch::class);
|
||||
}*/
|
||||
|
||||
public function coupon()
|
||||
{
|
||||
return $this->belongsTo(Coupon::class);
|
||||
}
|
||||
|
||||
public function customer()
|
||||
{
|
||||
return $this->belongsTo(Customer::class);
|
||||
}
|
||||
|
||||
public function lead()
|
||||
{
|
||||
return $this->belongsTo(Lead::class);
|
||||
}
|
||||
|
||||
public function sf_guard_user()
|
||||
{
|
||||
return $this->belongsTo(SfGuardUser::class);
|
||||
}
|
||||
|
||||
public function travel_category()
|
||||
{
|
||||
return $this->belongsTo(TravelCategory::class);
|
||||
}
|
||||
|
||||
public function travel_company()
|
||||
{
|
||||
return $this->belongsTo(TravelCompany::class);
|
||||
}
|
||||
|
||||
/* public function travel_country()
|
||||
{
|
||||
return $this->belongsTo('App\Models\TravelAgenda', 'travelagenda_id', 'id');
|
||||
}
|
||||
return $this->belongsTo(TravelCountry::class, 'travel_country_id', 'crm_id');
|
||||
}*/
|
||||
|
||||
|
||||
public function travel_country()
|
||||
{
|
||||
return $this->belongsTo('App\Models\TravelCountry', 'travel_country_id', 'crm_id');
|
||||
return $this->belongsTo(\App\Models\Sym\TravelCountry::class, 'travel_country_id', 'id');
|
||||
}
|
||||
|
||||
public function lead()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Lead', 'lead_id', 'id');
|
||||
}
|
||||
public function travel_agenda()
|
||||
{
|
||||
return $this->belongsTo(TravelAgenda::class, 'travelagenda_id');
|
||||
}
|
||||
|
||||
public function sf_guard_user()
|
||||
{
|
||||
return $this->belongsTo('App\Models\SfGuardUser', 'sf_guard_user_id', 'id');
|
||||
}
|
||||
public function arrangements()
|
||||
{
|
||||
return $this->hasMany(Arrangement::class);
|
||||
}
|
||||
|
||||
public function arrangements()
|
||||
{
|
||||
return $this->hasMany('App\Models\Sym\Arrangement', 'booking_id', 'id')->orderBy('view_position', 'DESC');
|
||||
}
|
||||
public function arrangement_types()
|
||||
{
|
||||
return $this->hasMany(ArrangementType::class);
|
||||
}
|
||||
|
||||
/*public function booking_applications()
|
||||
{
|
||||
return $this->hasMany(BookingApplication::class);
|
||||
}
|
||||
|
||||
public function booking_confirmations()
|
||||
{
|
||||
return $this->hasMany(BookingConfirmation::class);
|
||||
}*/
|
||||
|
||||
public function booking_draft_items()
|
||||
{
|
||||
return $this->hasMany(BookingDraftItem::class)->orderBy('pos', 'ASC');
|
||||
}
|
||||
|
||||
/*public function booking_invoices()
|
||||
{
|
||||
return $this->hasMany(BookingInvoice::class);
|
||||
}*/
|
||||
|
||||
public function booking_service_items()
|
||||
{
|
||||
return $this->hasMany(BookingServiceItem::class);
|
||||
}
|
||||
|
||||
/*public function booking_vouchers()
|
||||
{
|
||||
return $this->hasMany(BookingVoucher::class);
|
||||
}*/
|
||||
|
||||
public function coupons()
|
||||
{
|
||||
return $this->hasMany(Coupon::class);
|
||||
}
|
||||
|
||||
public function insurance_certificates()
|
||||
{
|
||||
return $this->hasMany(InsuranceCertificate::class);
|
||||
}
|
||||
|
||||
public function participants()
|
||||
{
|
||||
return $this->hasMany(Participant::class);
|
||||
}
|
||||
|
||||
public function service_provider_entries()
|
||||
{
|
||||
return $this->hasMany(ServiceProviderEntry::class);
|
||||
}
|
||||
/*
|
||||
public function travel_insurances()
|
||||
{
|
||||
return $this->hasMany(TravelInsurance::class);
|
||||
}*/
|
||||
|
||||
|
||||
public function calculate_price_total()
|
||||
|
|
@ -152,7 +325,7 @@ class Booking extends Model
|
|||
}
|
||||
$total_adult += $prices['adult'];
|
||||
$total_children += $prices['children'];
|
||||
}
|
||||
}
|
||||
|
||||
if($travel_draft_item){
|
||||
$travel_draft_item->setPriceAdultRaw($travel_price_adult);
|
||||
|
|
@ -171,6 +344,11 @@ class Booking extends Model
|
|||
return number_format(($this->attributes['price']), 2, ',', '.');
|
||||
}
|
||||
|
||||
public function getPriceRaw()
|
||||
{
|
||||
return $this->attributes['price'];
|
||||
}
|
||||
|
||||
public function findBeforeDraftItemRelation($reid)
|
||||
{
|
||||
$before = false;
|
||||
|
|
@ -207,4 +385,56 @@ class Booking extends Model
|
|||
return Carbon::parse($this->attributes['end_date'])->format(\Util::formatDateDB());
|
||||
}
|
||||
|
||||
|
||||
//erlös #getRevenueFactor
|
||||
public function proceeds(){
|
||||
$proceeds = $this->attributes['price']
|
||||
// - $this->getServiceTotal()
|
||||
// - $this->getServiceFee()
|
||||
- $this->getServiceProviderEntriesAmountFactorTotal();
|
||||
|
||||
return number_format(($proceeds), 2, ',', '.');
|
||||
|
||||
}
|
||||
|
||||
public function getServiceProviderEntriesAmountFactorTotal()
|
||||
{
|
||||
$total = 0;
|
||||
foreach ($this->service_provider_entries as $entry)
|
||||
{
|
||||
$total += $entry->amount / $entry->factor;
|
||||
}
|
||||
return $total;
|
||||
}
|
||||
|
||||
public function getServiceProviderPaymentsTotal()
|
||||
{
|
||||
$total = 0;
|
||||
foreach ($this->service_provider_entries as $entry)
|
||||
{
|
||||
$total += $entry->amount;
|
||||
}
|
||||
return number_format(($total), 2, ',', '.');
|
||||
}
|
||||
|
||||
public function getKontoNumber(){
|
||||
|
||||
switch ($this->ev_number){
|
||||
case 'E01':
|
||||
return '4011';
|
||||
break;
|
||||
case 'E02':
|
||||
return '4012';
|
||||
break;
|
||||
case 'E03':
|
||||
return '4013';
|
||||
break;
|
||||
case 'E04':
|
||||
return '4014';
|
||||
break;
|
||||
|
||||
}
|
||||
return $this->ev_number;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
84
app/Models/BookingServiceItem.php
Normal file
84
app/Models/BookingServiceItem.php
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Reliese\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class BookingServiceItem
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $booking_id
|
||||
* @property int $travel_company_id
|
||||
* @property float $service_price
|
||||
* @property float $service_price_refund
|
||||
* @property float $commission
|
||||
* @property Carbon $travel_date
|
||||
* @property Carbon $created_at
|
||||
* @property Carbon $updated_at
|
||||
* @property string $name
|
||||
* @property bool $is_commission_locked
|
||||
* @property Booking $booking
|
||||
* @property TravelCompany $travel_company
|
||||
* @package App\Models
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingServiceItem newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingServiceItem newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingServiceItem query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingServiceItem whereBookingId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingServiceItem whereCommission($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingServiceItem whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingServiceItem whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingServiceItem whereIsCommissionLocked($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingServiceItem whereName($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingServiceItem whereServicePrice($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingServiceItem whereServicePriceRefund($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingServiceItem whereTravelCompanyId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingServiceItem whereTravelDate($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingServiceItem whereUpdatedAt($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class BookingServiceItem extends Model
|
||||
{
|
||||
protected $connection = 'mysql';
|
||||
|
||||
protected $table = 'booking_service_item';
|
||||
|
||||
protected $casts = [
|
||||
'booking_id' => 'int',
|
||||
'travel_company_id' => 'int',
|
||||
'service_price' => 'float',
|
||||
'service_price_refund' => 'float',
|
||||
'commission' => 'float',
|
||||
'is_commission_locked' => 'bool'
|
||||
];
|
||||
|
||||
protected $dates = [
|
||||
'travel_date'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'booking_id',
|
||||
'travel_company_id',
|
||||
'service_price',
|
||||
'service_price_refund',
|
||||
'commission',
|
||||
'travel_date',
|
||||
'name',
|
||||
'is_commission_locked'
|
||||
];
|
||||
|
||||
public function booking()
|
||||
{
|
||||
return $this->belongsTo(Booking::class);
|
||||
}
|
||||
|
||||
public function travel_company()
|
||||
{
|
||||
return $this->belongsTo(TravelCompany::class);
|
||||
}
|
||||
}
|
||||
92
app/Models/Coupon.php
Normal file
92
app/Models/Coupon.php
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Reliese\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class Coupon
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $number
|
||||
* @property int $customer_id
|
||||
* @property int $booking_id
|
||||
* @property float $value
|
||||
* @property Carbon $issue_date
|
||||
* @property Carbon $valid_date
|
||||
* @property bool $is_redeemed
|
||||
* @property Carbon $redeem_date
|
||||
* @property Carbon $created_at
|
||||
* @property Carbon $updated_at
|
||||
* @property Booking $booking
|
||||
* @property Customer $customer
|
||||
* @property Collection|Booking[] $bookings
|
||||
* @package App\Models
|
||||
* @property-read int|null $bookings_count
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Coupon newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Coupon newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Coupon query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Coupon whereBookingId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Coupon whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Coupon whereCustomerId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Coupon whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Coupon whereIsRedeemed($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Coupon whereIssueDate($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Coupon whereNumber($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Coupon whereRedeemDate($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Coupon whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Coupon whereValidDate($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Coupon whereValue($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class Coupon extends Model
|
||||
{
|
||||
protected $connection = 'mysql';
|
||||
|
||||
protected $table = 'coupon';
|
||||
|
||||
protected $casts = [
|
||||
'customer_id' => 'int',
|
||||
'booking_id' => 'int',
|
||||
'value' => 'float',
|
||||
'is_redeemed' => 'bool'
|
||||
];
|
||||
|
||||
protected $dates = [
|
||||
'issue_date',
|
||||
'valid_date',
|
||||
'redeem_date'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'number',
|
||||
'customer_id',
|
||||
'booking_id',
|
||||
'value',
|
||||
'issue_date',
|
||||
'valid_date',
|
||||
'is_redeemed',
|
||||
'redeem_date'
|
||||
];
|
||||
|
||||
public function booking()
|
||||
{
|
||||
return $this->belongsTo(Booking::class);
|
||||
}
|
||||
|
||||
public function customer()
|
||||
{
|
||||
return $this->belongsTo(Customer::class);
|
||||
}
|
||||
|
||||
public function bookings()
|
||||
{
|
||||
return $this->hasMany(Booking::class);
|
||||
}
|
||||
}
|
||||
42
app/Models/CreditCardType.php
Normal file
42
app/Models/CreditCardType.php
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Reliese\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class CreditCardType
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $name
|
||||
* @property Collection|Customer[] $customers
|
||||
* @package App\Models
|
||||
* @property-read int|null $customers_count
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CreditCardType newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CreditCardType newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CreditCardType query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CreditCardType whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CreditCardType whereName($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class CreditCardType extends Model
|
||||
{
|
||||
protected $connection = 'mysql';
|
||||
|
||||
protected $table = 'credit_card_type';
|
||||
public $timestamps = false;
|
||||
|
||||
protected $fillable = [
|
||||
'name'
|
||||
];
|
||||
|
||||
public function customers()
|
||||
{
|
||||
return $this->hasMany(Customer::class);
|
||||
}
|
||||
}
|
||||
168
app/Models/Customer.php
Normal file
168
app/Models/Customer.php
Normal file
|
|
@ -0,0 +1,168 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Reliese\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class Customer
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $salutation_id
|
||||
* @property string $title
|
||||
* @property string $name
|
||||
* @property string $firstname
|
||||
* @property Carbon $birthdate
|
||||
* @property string $company
|
||||
* @property string $street
|
||||
* @property string $zip
|
||||
* @property string $city
|
||||
* @property string $email
|
||||
* @property string $phone
|
||||
* @property string $phonebusiness
|
||||
* @property string $phonemobile
|
||||
* @property string $fax
|
||||
* @property string $bank
|
||||
* @property string $bank_code
|
||||
* @property string $bank_account_number
|
||||
* @property int $credit_card_type_id
|
||||
* @property string $credit_card_number
|
||||
* @property Carbon $credit_card_expiration_date
|
||||
* @property string $participants_remarks
|
||||
* @property string $miscellaneous_remarks
|
||||
* @property Carbon $created_at
|
||||
* @property Carbon $updated_at
|
||||
* @property int $country_id
|
||||
* @property TravelCountry $travel_country
|
||||
* @property CreditCardType $credit_card_type
|
||||
* @property Salutation $salutation
|
||||
* @property Collection|Booking[] $bookings
|
||||
* @property Collection|Coupon[] $coupons
|
||||
* @property Collection|Lead[] $leads
|
||||
* @package App\Models
|
||||
* @property-read int|null $bookings_count
|
||||
* @property-read int|null $coupons_count
|
||||
* @property-read int|null $leads_count
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Customer newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Customer newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Customer query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Customer whereBank($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Customer whereBankAccountNumber($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Customer whereBankCode($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Customer whereBirthdate($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Customer whereCity($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Customer whereCompany($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Customer whereCountryId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Customer whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Customer whereCreditCardExpirationDate($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Customer whereCreditCardNumber($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Customer whereCreditCardTypeId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Customer whereEmail($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Customer whereFax($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Customer whereFirstname($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Customer whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Customer whereMiscellaneousRemarks($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Customer whereName($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Customer whereParticipantsRemarks($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Customer wherePhone($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Customer wherePhonebusiness($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Customer wherePhonemobile($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Customer whereSalutationId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Customer whereStreet($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Customer whereTitle($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Customer whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Customer whereZip($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class Customer extends Model
|
||||
{
|
||||
protected $connection = 'mysql';
|
||||
|
||||
protected $table = 'customer';
|
||||
|
||||
protected $casts = [
|
||||
'salutation_id' => 'int',
|
||||
'credit_card_type_id' => 'int',
|
||||
'country_id' => 'int'
|
||||
];
|
||||
|
||||
protected $dates = [
|
||||
'birthdate',
|
||||
'credit_card_expiration_date'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'salutation_id',
|
||||
'title',
|
||||
'name',
|
||||
'firstname',
|
||||
'birthdate',
|
||||
'company',
|
||||
'street',
|
||||
'zip',
|
||||
'city',
|
||||
'email',
|
||||
'phone',
|
||||
'phonebusiness',
|
||||
'phonemobile',
|
||||
'fax',
|
||||
'bank',
|
||||
'bank_code',
|
||||
'bank_account_number',
|
||||
'credit_card_type_id',
|
||||
'credit_card_number',
|
||||
'credit_card_expiration_date',
|
||||
'participants_remarks',
|
||||
'miscellaneous_remarks',
|
||||
'country_id',
|
||||
|
||||
];
|
||||
|
||||
public function travel_country()
|
||||
{
|
||||
return $this->belongsTo(TravelCountry::class, 'country_id');
|
||||
}
|
||||
|
||||
public function credit_card_type()
|
||||
{
|
||||
return $this->belongsTo(CreditCardType::class);
|
||||
}
|
||||
|
||||
public function salutation()
|
||||
{
|
||||
return $this->belongsTo(Salutation::class);
|
||||
}
|
||||
|
||||
public function bookings()
|
||||
{
|
||||
return $this->hasMany(Booking::class);
|
||||
}
|
||||
|
||||
public function coupons()
|
||||
{
|
||||
return $this->hasMany(Coupon::class);
|
||||
}
|
||||
|
||||
public function leads()
|
||||
{
|
||||
return $this->hasMany(Lead::class);
|
||||
}
|
||||
|
||||
public function fullName()
|
||||
{
|
||||
if ($this->firstname) {
|
||||
return $this->firstname . ' ' . $this->name;
|
||||
}
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -55,6 +55,8 @@ use Illuminate\Support\Str;
|
|||
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\IQContentSite[] $iq_content_sites
|
||||
* @property-read int|null $iq_content_sites_count
|
||||
* @property-read int|null $iq_content_tree_node_childs_count
|
||||
* @property string|null $title
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\IQContentTreeNode whereTitle($value)
|
||||
*/
|
||||
class IQContentTreeNode extends Model
|
||||
{
|
||||
|
|
@ -68,7 +70,7 @@ class IQContentTreeNode extends Model
|
|||
protected $table = 'i_q_content_tree_nodes';
|
||||
|
||||
protected $fillable = [
|
||||
'tree_id', 'parent_id', 'lvl', 'name', 'identifier', 'description', 'settings', 'pos', 'active',
|
||||
'tree_id', 'parent_id', 'lvl', 'name', 'identifier', 'title', 'description', 'settings', 'pos', 'active',
|
||||
];
|
||||
|
||||
protected $casts = ['settings' => 'array'];
|
||||
|
|
|
|||
42
app/Models/InitialContactType.php
Normal file
42
app/Models/InitialContactType.php
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Reliese\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class InitialContactType
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $name
|
||||
* @property Collection|Lead[] $leads
|
||||
* @package App\Models
|
||||
* @property-read int|null $leads_count
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\InitialContactType newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\InitialContactType newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\InitialContactType query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\InitialContactType whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\InitialContactType whereName($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class InitialContactType extends Model
|
||||
{
|
||||
protected $connection = 'mysql';
|
||||
|
||||
protected $table = 'initial_contact_type';
|
||||
public $timestamps = false;
|
||||
|
||||
protected $fillable = [
|
||||
'name'
|
||||
];
|
||||
|
||||
public function leads()
|
||||
{
|
||||
return $this->hasMany(Lead::class, 'initialcontacttype_id');
|
||||
}
|
||||
}
|
||||
90
app/Models/Inquiry.php
Normal file
90
app/Models/Inquiry.php
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Reliese\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class Inquiry
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $lead_id
|
||||
* @property int $template_id
|
||||
* @property bool $in_pdf
|
||||
* @property Carbon $begin
|
||||
* @property Carbon $end
|
||||
* @property int $type_id
|
||||
* @property string $type_s
|
||||
* @property string $data_s
|
||||
* @property int $view_position
|
||||
* @property Lead $lead
|
||||
* @property InquiryTemplate $inquiry_template
|
||||
* @property InquiryType $inquiry_type
|
||||
* @package App\Models
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Inquiry newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Inquiry newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Inquiry query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Inquiry whereBegin($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Inquiry whereDataS($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Inquiry whereEnd($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Inquiry whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Inquiry whereInPdf($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Inquiry whereLeadId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Inquiry whereTemplateId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Inquiry whereTypeId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Inquiry whereTypeS($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Inquiry whereViewPosition($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class Inquiry extends Model
|
||||
{
|
||||
protected $connection = 'mysql';
|
||||
|
||||
protected $table = 'inquiry';
|
||||
public $timestamps = false;
|
||||
|
||||
protected $casts = [
|
||||
'lead_id' => 'int',
|
||||
'template_id' => 'int',
|
||||
'in_pdf' => 'bool',
|
||||
'type_id' => 'int',
|
||||
'view_position' => 'int'
|
||||
];
|
||||
|
||||
protected $dates = [
|
||||
'begin',
|
||||
'end'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'lead_id',
|
||||
'template_id',
|
||||
'in_pdf',
|
||||
'begin',
|
||||
'end',
|
||||
'type_id',
|
||||
'type_s',
|
||||
'data_s',
|
||||
'view_position'
|
||||
];
|
||||
|
||||
public function lead()
|
||||
{
|
||||
return $this->belongsTo(Lead::class);
|
||||
}
|
||||
|
||||
public function inquiry_template()
|
||||
{
|
||||
return $this->belongsTo(InquiryTemplate::class, 'template_id');
|
||||
}
|
||||
|
||||
public function inquiry_type()
|
||||
{
|
||||
return $this->belongsTo(InquiryType::class, 'type_id');
|
||||
}
|
||||
}
|
||||
42
app/Models/InquiryTemplate.php
Normal file
42
app/Models/InquiryTemplate.php
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Reliese\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class InquiryTemplate
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $title
|
||||
* @property Collection|Inquiry[] $inquiries
|
||||
* @package App\Models
|
||||
* @property-read int|null $inquiries_count
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\InquiryTemplate newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\InquiryTemplate newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\InquiryTemplate query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\InquiryTemplate whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\InquiryTemplate whereTitle($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class InquiryTemplate extends Model
|
||||
{
|
||||
protected $connection = 'mysql';
|
||||
|
||||
protected $table = 'inquiry_template';
|
||||
public $timestamps = false;
|
||||
|
||||
protected $fillable = [
|
||||
'title'
|
||||
];
|
||||
|
||||
public function inquiries()
|
||||
{
|
||||
return $this->hasMany(Inquiry::class, 'template_id');
|
||||
}
|
||||
}
|
||||
55
app/Models/InquiryType.php
Normal file
55
app/Models/InquiryType.php
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Reliese\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class InquiryType
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $name
|
||||
* @property int $arrangement_type_id
|
||||
* @property ArrangementType $arrangement_type
|
||||
* @property Collection|Inquiry[] $inquiries
|
||||
* @package App\Models
|
||||
* @property-read int|null $inquiries_count
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\InquiryType newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\InquiryType newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\InquiryType query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\InquiryType whereArrangementTypeId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\InquiryType whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\InquiryType whereName($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class InquiryType extends Model
|
||||
{
|
||||
protected $connection = 'mysql';
|
||||
|
||||
protected $table = 'inquiry_type';
|
||||
public $timestamps = false;
|
||||
|
||||
protected $casts = [
|
||||
'arrangement_type_id' => 'int'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'arrangement_type_id'
|
||||
];
|
||||
|
||||
public function arrangement_type()
|
||||
{
|
||||
return $this->belongsTo(ArrangementType::class);
|
||||
}
|
||||
|
||||
public function inquiries()
|
||||
{
|
||||
return $this->hasMany(Inquiry::class, 'type_id');
|
||||
}
|
||||
}
|
||||
62
app/Models/InsuranceCertificate.php
Normal file
62
app/Models/InsuranceCertificate.php
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Reliese\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class InsuranceCertificate
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $booking_id
|
||||
* @property int $internal_id
|
||||
* @property string $filename
|
||||
* @property boolean $binary_data
|
||||
* @property Carbon $created_at
|
||||
* @property Carbon $updated_at
|
||||
* @property string $request_data
|
||||
* @property Booking $booking
|
||||
* @package App\Models
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\InsuranceCertificate newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\InsuranceCertificate newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\InsuranceCertificate query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\InsuranceCertificate whereBinaryData($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\InsuranceCertificate whereBookingId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\InsuranceCertificate whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\InsuranceCertificate whereFilename($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\InsuranceCertificate whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\InsuranceCertificate whereInternalId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\InsuranceCertificate whereRequestData($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\InsuranceCertificate whereUpdatedAt($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class InsuranceCertificate extends Model
|
||||
{
|
||||
protected $connection = 'mysql';
|
||||
|
||||
protected $table = 'insurance_certificate';
|
||||
|
||||
protected $casts = [
|
||||
'booking_id' => 'int',
|
||||
'internal_id' => 'int',
|
||||
'binary_data' => 'boolean'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'booking_id',
|
||||
'internal_id',
|
||||
'filename',
|
||||
'binary_data',
|
||||
'request_data'
|
||||
];
|
||||
|
||||
public function booking()
|
||||
{
|
||||
return $this->belongsTo(Booking::class);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,40 +1,68 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Reliese\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* App\Models\Lead
|
||||
* Class Lead
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $customer_id
|
||||
* @property string $request_date
|
||||
* @property string|null $travelperiod_start
|
||||
* @property string|null $travelperiod_end
|
||||
* @property int|null $travelperiod_length
|
||||
* @property int|null $travelcountry_id
|
||||
* @property int|null $travelagenda_id
|
||||
* @property string|null $remarks
|
||||
* @property Carbon $request_date
|
||||
* @property Carbon $travelperiod_start
|
||||
* @property Carbon $travelperiod_end
|
||||
* @property int $travelperiod_length
|
||||
* @property int $travelcountry_id
|
||||
* @property int $travelagenda_id
|
||||
* @property string $remarks
|
||||
* @property int $sf_guard_user_id
|
||||
* @property int|null $is_closed
|
||||
* @property int|null $initialcontacttype_id
|
||||
* @property int|null $searchengine_id
|
||||
* @property string|null $searchengine_keywords
|
||||
* @property bool $is_closed
|
||||
* @property int $initialcontacttype_id
|
||||
* @property int $searchengine_id
|
||||
* @property string $searchengine_keywords
|
||||
* @property int $status_id
|
||||
* @property string|null $next_due_date
|
||||
* @property int|null $website_id
|
||||
* @property int|null $travelcategory_id
|
||||
* @property \Illuminate\Support\Carbon $created_at
|
||||
* @property \Illuminate\Support\Carbon $updated_at
|
||||
* @property float|null $price
|
||||
* @property int|null $pax
|
||||
* @property string|null $participant_name
|
||||
* @property string|null $participant_firstname
|
||||
* @property string|null $participant_birthdate
|
||||
* @property int|null $participant_salutation_id
|
||||
* @property-read \App\Models\SfGuardUser $sf_guard_user
|
||||
* @property-read \App\Models\Status $status
|
||||
* @property Carbon $next_due_date
|
||||
* @property int $website_id
|
||||
* @property int $travelcategory_id
|
||||
* @property Carbon $created_at
|
||||
* @property Carbon $updated_at
|
||||
* @property float $price
|
||||
* @property int $pax
|
||||
* @property string $participant_name
|
||||
* @property string $participant_firstname
|
||||
* @property Carbon $participant_birthdate
|
||||
* @property int $participant_salutation_id
|
||||
* @property Customer $customer
|
||||
* @property InitialContactType $initial_contact_type
|
||||
* @property Salutation $salutation
|
||||
* @property Searchengine $searchengine
|
||||
* @property SfGuardUser $sf_guard_user
|
||||
* @property Status $status
|
||||
* @property TravelAgenda $travel_agenda
|
||||
* @property TravelCategory $travel_category
|
||||
* @property TravelCountry $travel_country
|
||||
* @property Website $website
|
||||
* @property Collection|Booking[] $bookings
|
||||
* @property Collection|Inquiry[] $inquiries
|
||||
* @property Collection|LeadParticipant[] $lead_participants
|
||||
* @property Collection|Offer[] $offers
|
||||
* @property Collection|StatusHistory[] $status_histories
|
||||
* @package App\Models
|
||||
* @property-read int|null $bookings_count
|
||||
* @property-read int|null $inquiries_count
|
||||
* @property-read int|null $lead_participants_count
|
||||
* @property-read int|null $offers_count
|
||||
* @property-read int|null $status_histories_count
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Lead newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Lead newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Lead query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Lead whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Lead whereCustomerId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Lead whereId($value)
|
||||
|
|
@ -62,9 +90,6 @@ use Illuminate\Database\Eloquent\Model;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Lead whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Lead whereWebsiteId($value)
|
||||
* @mixin \Eloquent
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Lead newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Lead newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Lead query()
|
||||
*/
|
||||
class Lead extends Model
|
||||
{
|
||||
|
|
@ -72,13 +97,146 @@ class Lead extends Model
|
|||
|
||||
protected $table = 'lead';
|
||||
|
||||
public function status()
|
||||
protected $casts = [
|
||||
'customer_id' => 'int',
|
||||
'travelperiod_length' => 'int',
|
||||
'travelcountry_id' => 'int',
|
||||
'travelagenda_id' => 'int',
|
||||
'sf_guard_user_id' => 'int',
|
||||
'is_closed' => 'bool',
|
||||
'initialcontacttype_id' => 'int',
|
||||
'searchengine_id' => 'int',
|
||||
'status_id' => 'int',
|
||||
'website_id' => 'int',
|
||||
'travelcategory_id' => 'int',
|
||||
'price' => 'float',
|
||||
'pax' => 'int',
|
||||
'participant_salutation_id' => 'int'
|
||||
];
|
||||
|
||||
protected $dates = [
|
||||
'request_date',
|
||||
'travelperiod_start',
|
||||
'travelperiod_end',
|
||||
'next_due_date',
|
||||
'participant_birthdate'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'customer_id',
|
||||
'request_date',
|
||||
'travelperiod_start',
|
||||
'travelperiod_end',
|
||||
'travelperiod_length',
|
||||
'travelcountry_id',
|
||||
'travelagenda_id',
|
||||
'remarks',
|
||||
'sf_guard_user_id',
|
||||
'is_closed',
|
||||
'initialcontacttype_id',
|
||||
'searchengine_id',
|
||||
'searchengine_keywords',
|
||||
'status_id',
|
||||
'next_due_date',
|
||||
'website_id',
|
||||
'travelcategory_id',
|
||||
'price',
|
||||
'pax',
|
||||
'participant_name',
|
||||
'participant_firstname',
|
||||
'participant_birthdate',
|
||||
'participant_salutation_id'
|
||||
];
|
||||
|
||||
public function updateNextDueDate($date = false){
|
||||
|
||||
if(!$date){
|
||||
$carbon = Carbon::now();
|
||||
$this->next_due_date = $carbon->modify('+ '.$this->status->handling_days.' days')->format("Y-m-d");
|
||||
$this->save();
|
||||
}
|
||||
}
|
||||
public function customer()
|
||||
{
|
||||
return $this->belongsTo(Customer::class);
|
||||
}
|
||||
|
||||
public function initial_contact_type()
|
||||
{
|
||||
return $this->belongsTo(InitialContactType::class, 'initialcontacttype_id');
|
||||
}
|
||||
|
||||
public function salutation()
|
||||
{
|
||||
return $this->belongsTo(Salutation::class, 'participant_salutation_id');
|
||||
}
|
||||
|
||||
public function searchengine()
|
||||
{
|
||||
return $this->belongsTo(Searchengine::class);
|
||||
}
|
||||
|
||||
public function sf_guard_user()
|
||||
{
|
||||
return $this->belongsTo(SfGuardUser::class);
|
||||
}
|
||||
|
||||
public function status()
|
||||
{
|
||||
return $this->belongsTo(Status::class);
|
||||
}
|
||||
|
||||
public function travel_agenda()
|
||||
{
|
||||
return $this->belongsTo(TravelAgenda::class, 'travelagenda_id');
|
||||
}
|
||||
|
||||
public function travel_category()
|
||||
{
|
||||
return $this->belongsTo(TravelCategory::class, 'travelcategory_id');
|
||||
}
|
||||
|
||||
//on crm
|
||||
public function travel_country_crm()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Status', 'status_id', 'id');
|
||||
return $this->belongsTo('App\Models\Sym\TravelCountry', 'travelcountry_id', 'id');
|
||||
}
|
||||
|
||||
public function sf_guard_user()
|
||||
|
||||
//on stern other DB
|
||||
public function travel_country()
|
||||
{
|
||||
return $this->belongsTo('App\Models\SfGuardUser', 'sf_guard_user_id', 'id');
|
||||
return $this->belongsTo('App\Models\TravelCountry', 'travelcountry_id', 'crm_id');
|
||||
}
|
||||
|
||||
|
||||
public function website()
|
||||
{
|
||||
return $this->belongsTo(Website::class);
|
||||
}
|
||||
|
||||
public function bookings()
|
||||
{
|
||||
return $this->hasMany(Booking::class);
|
||||
}
|
||||
|
||||
public function inquiries()
|
||||
{
|
||||
return $this->hasMany(Inquiry::class);
|
||||
}
|
||||
|
||||
public function lead_participants()
|
||||
{
|
||||
return $this->hasMany(LeadParticipant::class);
|
||||
}
|
||||
|
||||
public function offers()
|
||||
{
|
||||
return $this->hasMany(Offer::class);
|
||||
}
|
||||
|
||||
public function status_histories()
|
||||
{
|
||||
return $this->hasMany(StatusHistory::class);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
68
app/Models/LeadParticipant.php
Normal file
68
app/Models/LeadParticipant.php
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Reliese\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class LeadParticipant
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $lead_id
|
||||
* @property string $participant_name
|
||||
* @property string $participant_firstname
|
||||
* @property Carbon $participant_birthdate
|
||||
* @property int $participant_salutation_id
|
||||
* @property Lead $lead
|
||||
* @property Salutation $salutation
|
||||
* @package App\Models
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\LeadParticipant newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\LeadParticipant newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\LeadParticipant query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\LeadParticipant whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\LeadParticipant whereLeadId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\LeadParticipant whereParticipantBirthdate($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\LeadParticipant whereParticipantFirstname($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\LeadParticipant whereParticipantName($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\LeadParticipant whereParticipantSalutationId($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class LeadParticipant extends Model
|
||||
{
|
||||
protected $connection = 'mysql';
|
||||
|
||||
protected $table = 'lead_participant';
|
||||
public $timestamps = false;
|
||||
|
||||
protected $casts = [
|
||||
'lead_id' => 'int',
|
||||
'participant_salutation_id' => 'int'
|
||||
];
|
||||
|
||||
protected $dates = [
|
||||
'participant_birthdate'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'lead_id',
|
||||
'participant_name',
|
||||
'participant_firstname',
|
||||
'participant_birthdate',
|
||||
'participant_salutation_id'
|
||||
];
|
||||
|
||||
public function lead()
|
||||
{
|
||||
return $this->belongsTo(Lead::class);
|
||||
}
|
||||
|
||||
public function salutation()
|
||||
{
|
||||
return $this->belongsTo(Salutation::class, 'participant_salutation_id');
|
||||
}
|
||||
}
|
||||
56
app/Models/Offer.php
Normal file
56
app/Models/Offer.php
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Reliese\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class Offer
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $lead_id
|
||||
* @property float $total
|
||||
* @property boolean $binary_data
|
||||
* @property Carbon $created_at
|
||||
* @property Carbon $updated_at
|
||||
* @property Lead $lead
|
||||
* @package App\Models
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Offer newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Offer newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Offer query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Offer whereBinaryData($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Offer whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Offer whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Offer whereLeadId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Offer whereTotal($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Offer whereUpdatedAt($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class Offer extends Model
|
||||
{
|
||||
protected $connection = 'mysql';
|
||||
|
||||
protected $table = 'offer';
|
||||
|
||||
protected $casts = [
|
||||
'lead_id' => 'int',
|
||||
'total' => 'float',
|
||||
'binary_data' => 'boolean'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'lead_id',
|
||||
'total',
|
||||
'binary_data'
|
||||
];
|
||||
|
||||
public function lead()
|
||||
{
|
||||
return $this->belongsTo(Lead::class);
|
||||
}
|
||||
}
|
||||
72
app/Models/Participant.php
Normal file
72
app/Models/Participant.php
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Reliese\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class Participant
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $booking_id
|
||||
* @property string $participant_name
|
||||
* @property string $participant_firstname
|
||||
* @property Carbon $participant_birthdate
|
||||
* @property int $participant_salutation_id
|
||||
* @property bool $participant_child
|
||||
* @property Booking $booking
|
||||
* @property Salutation $salutation
|
||||
* @package App\Models
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Participant newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Participant newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Participant query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Participant whereBookingId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Participant whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Participant whereParticipantBirthdate($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Participant whereParticipantChild($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Participant whereParticipantFirstname($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Participant whereParticipantName($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Participant whereParticipantSalutationId($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class Participant extends Model
|
||||
{
|
||||
protected $connection = 'mysql';
|
||||
|
||||
protected $table = 'participant';
|
||||
public $timestamps = false;
|
||||
|
||||
protected $casts = [
|
||||
'booking_id' => 'int',
|
||||
'participant_salutation_id' => 'int',
|
||||
'participant_child' => 'bool'
|
||||
];
|
||||
|
||||
protected $dates = [
|
||||
'participant_birthdate'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'booking_id',
|
||||
'participant_name',
|
||||
'participant_firstname',
|
||||
'participant_birthdate',
|
||||
'participant_salutation_id',
|
||||
'participant_child'
|
||||
];
|
||||
|
||||
public function booking()
|
||||
{
|
||||
return $this->belongsTo(Booking::class);
|
||||
}
|
||||
|
||||
public function salutation()
|
||||
{
|
||||
return $this->belongsTo(Salutation::class, 'participant_salutation_id');
|
||||
}
|
||||
}
|
||||
63
app/Models/Salutation.php
Normal file
63
app/Models/Salutation.php
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Reliese\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class Salutation
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $name
|
||||
* @property Collection|Customer[] $customers
|
||||
* @property Collection|Lead[] $leads
|
||||
* @property Collection|LeadParticipant[] $lead_participants
|
||||
* @property Collection|Participant[] $participants
|
||||
* @package App\Models
|
||||
* @property-read int|null $customers_count
|
||||
* @property-read int|null $lead_participants_count
|
||||
* @property-read int|null $leads_count
|
||||
* @property-read int|null $participants_count
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Salutation newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Salutation newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Salutation query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Salutation whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Salutation whereName($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class Salutation extends Model
|
||||
{
|
||||
protected $connection = 'mysql';
|
||||
|
||||
protected $table = 'salutation';
|
||||
public $timestamps = false;
|
||||
|
||||
protected $fillable = [
|
||||
'name'
|
||||
];
|
||||
|
||||
public function customers()
|
||||
{
|
||||
return $this->hasMany(Customer::class);
|
||||
}
|
||||
|
||||
public function leads()
|
||||
{
|
||||
return $this->hasMany(Lead::class, 'participant_salutation_id');
|
||||
}
|
||||
|
||||
public function lead_participants()
|
||||
{
|
||||
return $this->hasMany(LeadParticipant::class, 'participant_salutation_id');
|
||||
}
|
||||
|
||||
public function participants()
|
||||
{
|
||||
return $this->hasMany(Participant::class, 'participant_salutation_id');
|
||||
}
|
||||
}
|
||||
42
app/Models/Searchengine.php
Normal file
42
app/Models/Searchengine.php
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Reliese\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class Searchengine
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $name
|
||||
* @property Collection|Lead[] $leads
|
||||
* @package App\Models
|
||||
* @property-read int|null $leads_count
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Searchengine newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Searchengine newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Searchengine query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Searchengine whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Searchengine whereName($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class Searchengine extends Model
|
||||
{
|
||||
protected $connection = 'mysql';
|
||||
|
||||
protected $table = 'searchengine';
|
||||
public $timestamps = false;
|
||||
|
||||
protected $fillable = [
|
||||
'name'
|
||||
];
|
||||
|
||||
public function leads()
|
||||
{
|
||||
return $this->hasMany(Lead::class);
|
||||
}
|
||||
}
|
||||
50
app/Models/ServiceProvider.php
Normal file
50
app/Models/ServiceProvider.php
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Reliese\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class ServiceProvider
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $name
|
||||
* @property bool $dollar
|
||||
* @property string $type
|
||||
* @property Collection|ServiceProviderEntry[] $service_provider_entries
|
||||
* @package App\Models
|
||||
* @property-read int|null $service_provider_entries_count
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ServiceProvider newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ServiceProvider newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ServiceProvider query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ServiceProvider whereDollar($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ServiceProvider whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ServiceProvider whereName($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ServiceProvider whereType($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class ServiceProvider extends Model
|
||||
{
|
||||
protected $table = 'service_provider';
|
||||
public $timestamps = false;
|
||||
|
||||
protected $casts = [
|
||||
'dollar' => 'bool'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'dollar',
|
||||
'type'
|
||||
];
|
||||
|
||||
public function service_provider_entries()
|
||||
{
|
||||
return $this->hasMany(ServiceProviderEntry::class);
|
||||
}
|
||||
}
|
||||
112
app/Models/ServiceProviderEntry.php
Normal file
112
app/Models/ServiceProviderEntry.php
Normal file
|
|
@ -0,0 +1,112 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Reliese\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class ServiceProviderEntry
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $booking_id
|
||||
* @property int $service_provider_id
|
||||
* @property float $amount
|
||||
* @property float $amount_eur
|
||||
* @property float $factor
|
||||
* @property Carbon $payment_date
|
||||
* @property string $invoice_number
|
||||
* @property bool $is_cleared
|
||||
* @property Carbon $created_at
|
||||
* @property Carbon $updated_at
|
||||
* @property string $type
|
||||
* @property Booking $booking
|
||||
* @property ServiceProvider $service_provider
|
||||
* @package App\Models
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ServiceProviderEntry newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ServiceProviderEntry newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ServiceProviderEntry query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ServiceProviderEntry whereAmount($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ServiceProviderEntry whereAmountEur($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ServiceProviderEntry whereBookingId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ServiceProviderEntry whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ServiceProviderEntry whereFactor($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ServiceProviderEntry whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ServiceProviderEntry whereInvoiceNumber($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ServiceProviderEntry whereIsCleared($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ServiceProviderEntry wherePaymentDate($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ServiceProviderEntry whereServiceProviderId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ServiceProviderEntry whereType($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ServiceProviderEntry whereUpdatedAt($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class ServiceProviderEntry extends Model
|
||||
{
|
||||
protected $table = 'service_provider_entry';
|
||||
|
||||
protected $casts = [
|
||||
'booking_id' => 'int',
|
||||
'service_provider_id' => 'int',
|
||||
'amount' => 'float',
|
||||
'amount_eur' => 'float',
|
||||
'factor' => 'float',
|
||||
'is_cleared' => 'bool'
|
||||
];
|
||||
|
||||
protected $dates = [
|
||||
'payment_date'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'booking_id',
|
||||
'service_provider_id',
|
||||
'amount',
|
||||
'amount_eur',
|
||||
'factor',
|
||||
'payment_date',
|
||||
'invoice_number',
|
||||
'is_cleared',
|
||||
'type'
|
||||
];
|
||||
|
||||
private static $counter = 0;
|
||||
private static $bookingIds = array();
|
||||
|
||||
public function booking()
|
||||
{
|
||||
return $this->belongsTo(Booking::class);
|
||||
}
|
||||
|
||||
public function service_provider()
|
||||
{
|
||||
return $this->belongsTo(ServiceProvider::class);
|
||||
}
|
||||
|
||||
public function getCounter(){
|
||||
if ($this->booking_id) {
|
||||
if (!in_array($this->booking_id, self::$bookingIds)) {
|
||||
self::$bookingIds[] = $this->booking_id;
|
||||
self::$counter++;
|
||||
}
|
||||
return self::$counter;
|
||||
}
|
||||
}
|
||||
|
||||
public function getAmountFinalEur(){
|
||||
$ret = $this->amount;
|
||||
if($this->amount_eur && $this->amount_eur > 0){
|
||||
$ret = $this->amount_eur;
|
||||
}
|
||||
return number_format($ret, 2, ',', '.');
|
||||
;
|
||||
}
|
||||
|
||||
public function getPaymentDateFormat(){
|
||||
if(!$this->attributes['payment_date']){ return ""; }
|
||||
return Carbon::parse($this->attributes['payment_date'])->format(\Util::formatDateDB());
|
||||
}
|
||||
}
|
||||
81
app/Models/StatusHistory.php
Normal file
81
app/Models/StatusHistory.php
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Reliese\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class StatusHistory
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $status_id
|
||||
* @property int $lead_id
|
||||
* @property int $sf_guard_user_id
|
||||
* @property Carbon $date
|
||||
* @property string $remarks
|
||||
* @property Carbon $target_date
|
||||
* @property Carbon $created_at
|
||||
* @property Lead $lead
|
||||
* @property SfGuardUser $sf_guard_user
|
||||
* @property Status $status
|
||||
* @package App\Models
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\StatusHistory newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\StatusHistory newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\StatusHistory query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\StatusHistory whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\StatusHistory whereDate($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\StatusHistory whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\StatusHistory whereLeadId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\StatusHistory whereRemarks($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\StatusHistory whereSfGuardUserId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\StatusHistory whereStatusId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\StatusHistory whereTargetDate($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class StatusHistory extends Model
|
||||
{
|
||||
protected $connection = 'mysql';
|
||||
|
||||
protected $table = 'status_history';
|
||||
public $timestamps = false;
|
||||
|
||||
protected $casts = [
|
||||
'status_id' => 'int',
|
||||
'lead_id' => 'int',
|
||||
'sf_guard_user_id' => 'int'
|
||||
];
|
||||
|
||||
protected $dates = [
|
||||
'date',
|
||||
'target_date'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'status_id',
|
||||
'lead_id',
|
||||
'sf_guard_user_id',
|
||||
'date',
|
||||
'remarks',
|
||||
'target_date'
|
||||
];
|
||||
|
||||
public function lead()
|
||||
{
|
||||
return $this->belongsTo(Lead::class);
|
||||
}
|
||||
|
||||
public function sf_guard_user()
|
||||
{
|
||||
return $this->belongsTo(SfGuardUser::class);
|
||||
}
|
||||
|
||||
public function status()
|
||||
{
|
||||
return $this->belongsTo(Status::class);
|
||||
}
|
||||
}
|
||||
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
namespace App\Models\Sym;
|
||||
|
||||
use App\Models\Booking;
|
||||
use App\Models\Lead;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
|
||||
|
|
@ -62,5 +64,18 @@ class TravelCountry extends Model
|
|||
public $timestamps = false;
|
||||
|
||||
|
||||
/*public function leads()
|
||||
{
|
||||
return $this->hasMany(Lead::class, 'travelcountry_id', 'id');
|
||||
}*/
|
||||
|
||||
public function bookings()
|
||||
{
|
||||
return $this->hasMany(Booking::class, 'travel_country_id', 'id');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
210
app/Models/Sym/_Booking.php
Normal file
210
app/Models/Sym/_Booking.php
Normal file
|
|
@ -0,0 +1,210 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* App\Models\Booking
|
||||
*
|
||||
* @property int $id
|
||||
* @property string|null $booking_date
|
||||
* @property int $customer_id
|
||||
* @property int|null $lead_id
|
||||
* @property int|null $new_drafts
|
||||
* @property int $sf_guard_user_id
|
||||
* @property int $branch_id
|
||||
* @property float|null $service_fee
|
||||
* @property int|null $travel_country_id
|
||||
* @property int|null $travel_category_id
|
||||
* @property int|null $pax
|
||||
* @property int|null $coupon_id
|
||||
* @property \Illuminate\Support\Carbon $created_at
|
||||
* @property \Illuminate\Support\Carbon $updated_at
|
||||
* @property string|null $title
|
||||
* @property string|null $start_date
|
||||
* @property string|null $end_date
|
||||
* @property int|null $website_id
|
||||
* @property string|null $travel_number
|
||||
* @property string|null $participant_name
|
||||
* @property string|null $participant_firstname
|
||||
* @property string|null $participant_birthdate
|
||||
* @property int|null $participant_salutation_id
|
||||
* @property string|null $ev_number
|
||||
* @property string|null $merlin_knr
|
||||
* @property string|null $merlin_order_number
|
||||
* @property int|null $travel_company_id
|
||||
* @property int|null $travel_documents
|
||||
* @property float|null $price
|
||||
* @property float|null $price_total
|
||||
* @property float|null $deposit_total
|
||||
* @property float|null $final_payment
|
||||
* @property string|null $final_payment_date
|
||||
* @property int|null $travelagenda_id
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\Sym\Arrangement[] $arrangements
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\BookingDraftItem[] $booking_draft_items
|
||||
* @property-read \App\Models\TravelCountry|null $lead
|
||||
* @property-read \App\Models\SfGuardUser $sf_guard_user
|
||||
* @property-read \App\Models\TravelAgenda|null $travel_agenda
|
||||
* @property-read \App\Models\TravelCountry|null $travel_country
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereBookingDate($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereBranchId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereCouponId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereCustomerId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereDepositTotal($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereEndDate($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereEvNumber($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereFinalPayment($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereFinalPaymentDate($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereLeadId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereMerlinKnr($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereMerlinOrderNumber($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereNewDrafts($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereParticipantBirthdate($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereParticipantFirstname($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereParticipantName($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereParticipantSalutationId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking wherePax($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking wherePrice($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking wherePriceTotal($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereServiceFee($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereSfGuardUserId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereStartDate($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereTitle($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereTravelCategoryId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereTravelCompanyId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereTravelCountryId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereTravelDocuments($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereTravelNumber($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereTravelagendaId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereWebsiteId($value)
|
||||
* @mixin \Eloquent
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking query()
|
||||
* @property-read int|null $arrangements_count
|
||||
* @property-read int|null $booking_draft_items_count
|
||||
*/
|
||||
class _Booking extends Model
|
||||
{
|
||||
protected $connection = 'mysql';
|
||||
|
||||
protected $table = 'booking';
|
||||
|
||||
/*protected $fillable = [
|
||||
'pos',
|
||||
];*/
|
||||
|
||||
public function booking_draft_items()
|
||||
{
|
||||
return $this->hasMany('App\Models\BookingDraftItem', 'booking_id', 'id')->orderBy('pos', 'ASC');
|
||||
}
|
||||
|
||||
//on crm
|
||||
public function travel_agenda()
|
||||
{
|
||||
return $this->belongsTo('App\Models\TravelAgenda', 'travelagenda_id', 'id');
|
||||
}
|
||||
|
||||
public function travel_country()
|
||||
{
|
||||
return $this->belongsTo('App\Models\TravelCountry', 'travel_country_id', 'crm_id');
|
||||
}
|
||||
|
||||
public function lead()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Lead', 'lead_id', 'id');
|
||||
}
|
||||
|
||||
public function sf_guard_user()
|
||||
{
|
||||
return $this->belongsTo('App\Models\SfGuardUser', 'sf_guard_user_id', 'id');
|
||||
}
|
||||
|
||||
public function arrangements()
|
||||
{
|
||||
return $this->hasMany('App\Models\Sym\Arrangement', 'booking_id', 'id')->orderBy('view_position', 'DESC');
|
||||
}
|
||||
|
||||
|
||||
public function calculate_price_total()
|
||||
{
|
||||
$travel_draft_item = false;
|
||||
$travel_price_adult = 0;
|
||||
$travel_price_children = 0;
|
||||
$total_adult = 0;
|
||||
$total_children = 0;
|
||||
foreach ($this->booking_draft_items as $booking_draft_item) {
|
||||
//24 Rundreise
|
||||
if($booking_draft_item->draft_type_id == 24){
|
||||
$travel_draft_item = $booking_draft_item;
|
||||
continue;
|
||||
}
|
||||
$prices = $booking_draft_item->getItemPrice();
|
||||
//Grundpreis Reise
|
||||
if($booking_draft_item->draft_type_id == 30){
|
||||
$travel_price_adult += $prices['adult'];
|
||||
$travel_price_children += $prices['children'];
|
||||
}
|
||||
$total_adult += $prices['adult'];
|
||||
$total_children += $prices['children'];
|
||||
}
|
||||
|
||||
if($travel_draft_item){
|
||||
$travel_draft_item->setPriceAdultRaw($travel_price_adult);
|
||||
$travel_draft_item->setPriceChildrenRaw($travel_price_children);
|
||||
$travel_draft_item->save();
|
||||
}
|
||||
|
||||
$this->price = $total_adult + $total_children;
|
||||
$this->save();
|
||||
|
||||
}
|
||||
|
||||
public function getPriceAttribute()
|
||||
{
|
||||
// 2 = decimal places | '.' = decimal seperator | ',' = thousand seperator
|
||||
return number_format(($this->attributes['price']), 2, ',', '.');
|
||||
}
|
||||
|
||||
public function findBeforeDraftItemRelation($reid)
|
||||
{
|
||||
$before = false;
|
||||
foreach($this->booking_draft_items as $booking_draft_items) {
|
||||
if ($booking_draft_items->id == $reid) {
|
||||
return $before;
|
||||
}
|
||||
$before = $booking_draft_items;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function findAfterDraftItemRelation($reid)
|
||||
{
|
||||
$next = false;
|
||||
foreach($this->booking_draft_items as $booking_draft_items) {
|
||||
if($next){
|
||||
return $booking_draft_items;
|
||||
}
|
||||
if ($booking_draft_items->id == $reid) {
|
||||
$next = true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getStartDateFormat(){
|
||||
if(!$this->attributes['start_date']){ return ""; }
|
||||
return Carbon::parse($this->attributes['start_date'])->format(\Util::formatDateDB());
|
||||
}
|
||||
|
||||
public function getEndDateFormat(){
|
||||
if(!$this->attributes['end_date']){ return ""; }
|
||||
return Carbon::parse($this->attributes['end_date'])->format(\Util::formatDateDB());
|
||||
}
|
||||
|
||||
}
|
||||
194
app/Models/TravelBooking.php
Normal file
194
app/Models/TravelBooking.php
Normal file
|
|
@ -0,0 +1,194 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Reliese\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class TravelBooking
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $salutation_id
|
||||
* @property string $first_name
|
||||
* @property string $last_name
|
||||
* @property string $street
|
||||
* @property string $zipcode
|
||||
* @property string $city
|
||||
* @property int $country_id
|
||||
* @property string $fax
|
||||
* @property string $phone
|
||||
* @property string $mobile
|
||||
* @property string $comments
|
||||
* @property string $email
|
||||
* @property Carbon $created
|
||||
* @property Carbon $selected_start_date
|
||||
* @property Carbon $selected_end_date
|
||||
* @property string $program_name
|
||||
* @property string $selected_travel
|
||||
* @property string $selected_departure
|
||||
* @property int $program_id
|
||||
* @property int $period_id
|
||||
* @property string $class
|
||||
* @property int $selected_adults
|
||||
* @property int $selected_childs
|
||||
* @property int $participants_total
|
||||
* @property string $participants
|
||||
* @property string $drafts
|
||||
* @property string $service_items
|
||||
* @property string $arrangements
|
||||
* @property string $rooms
|
||||
* @property float $price
|
||||
* @property float $price_total
|
||||
* @property float $deposit_total
|
||||
* @property float $final_payment
|
||||
* @property Carbon $final_payment_date
|
||||
* @property string $insurance_name
|
||||
* @property string $insurances
|
||||
* @property int $travel_cancellation
|
||||
* @property string $options
|
||||
* @property string $class_options
|
||||
* @property string $extra_category
|
||||
* @property bool $accept_legal_rights
|
||||
* @property string $ip
|
||||
* @package App\Models
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelBooking newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelBooking newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelBooking query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelBooking whereAcceptLegalRights($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelBooking whereArrangements($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelBooking whereCity($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelBooking whereClass($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelBooking whereClassOptions($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelBooking whereComments($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelBooking whereCountryId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelBooking whereCreated($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelBooking whereDepositTotal($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelBooking whereDrafts($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelBooking whereEmail($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelBooking whereExtraCategory($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelBooking whereFax($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelBooking whereFinalPayment($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelBooking whereFinalPaymentDate($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelBooking whereFirstName($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelBooking whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelBooking whereInsuranceName($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelBooking whereInsurances($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelBooking whereIp($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelBooking whereLastName($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelBooking whereMobile($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelBooking whereOptions($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelBooking whereParticipants($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelBooking whereParticipantsTotal($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelBooking wherePeriodId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelBooking wherePhone($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelBooking wherePrice($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelBooking wherePriceTotal($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelBooking whereProgramId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelBooking whereProgramName($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelBooking whereRooms($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelBooking whereSalutationId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelBooking whereSelectedAdults($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelBooking whereSelectedChilds($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelBooking whereSelectedDeparture($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelBooking whereSelectedEndDate($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelBooking whereSelectedStartDate($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelBooking whereSelectedTravel($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelBooking whereServiceItems($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelBooking whereStreet($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelBooking whereTravelCancellation($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelBooking whereZipcode($value)
|
||||
* @mixin \Eloquent
|
||||
* @property int|null $crm_booking_id
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelBooking whereCrmBookingId($value)
|
||||
*/
|
||||
class TravelBooking extends Model
|
||||
{
|
||||
protected $connection = 'mysql_stern';
|
||||
protected $table = 'travel_booking';
|
||||
public $timestamps = false;
|
||||
|
||||
protected $casts = [
|
||||
'salutation_id' => 'int',
|
||||
'country_id' => 'int',
|
||||
'program_id' => 'int',
|
||||
'period_id' => 'int',
|
||||
'selected_adults' => 'int',
|
||||
'selected_childs' => 'int',
|
||||
'participants_total' => 'int',
|
||||
'price' => 'float',
|
||||
'price_total' => 'float',
|
||||
'deposit_total' => 'float',
|
||||
'final_payment' => 'float',
|
||||
'travel_cancellation' => 'int',
|
||||
'accept_legal_rights' => 'bool',
|
||||
'selected_travel' => 'array',
|
||||
'selected_departure' => 'array',
|
||||
'participants' => 'array',
|
||||
'drafts' => 'array',
|
||||
'service_items' => 'array',
|
||||
'arrangements' => 'array',
|
||||
'rooms' => 'array',
|
||||
'options' => 'array',
|
||||
'class_options' => 'array',
|
||||
'extra_category' => 'array',
|
||||
'insurances' => 'array'
|
||||
];
|
||||
|
||||
protected $dates = [
|
||||
'created',
|
||||
'selected_start_date',
|
||||
'selected_end_date',
|
||||
'final_payment_date'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'crm_booking_id',
|
||||
'salutation_id',
|
||||
'first_name',
|
||||
'last_name',
|
||||
'street',
|
||||
'zipcode',
|
||||
'city',
|
||||
'country_id',
|
||||
'fax',
|
||||
'phone',
|
||||
'mobile',
|
||||
'comments',
|
||||
'email',
|
||||
'created',
|
||||
'selected_start_date',
|
||||
'selected_end_date',
|
||||
'program_name',
|
||||
'selected_travel',
|
||||
'selected_departure',
|
||||
'program_id',
|
||||
'period_id',
|
||||
'class',
|
||||
'selected_adults',
|
||||
'selected_childs',
|
||||
'participants_total',
|
||||
'participants',
|
||||
'drafts',
|
||||
'service_items',
|
||||
'arrangements',
|
||||
'rooms',
|
||||
'price',
|
||||
'price_total',
|
||||
'deposit_total',
|
||||
'final_payment',
|
||||
'final_payment_date',
|
||||
'insurance_name',
|
||||
'insurances',
|
||||
'travel_cancellation',
|
||||
'options',
|
||||
'class_options',
|
||||
'extra_category',
|
||||
'accept_legal_rights',
|
||||
'ip'
|
||||
];
|
||||
}
|
||||
49
app/Models/TravelCategory.php
Normal file
49
app/Models/TravelCategory.php
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Reliese\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class TravelCategory
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $name
|
||||
* @property Collection|Booking[] $bookings
|
||||
* @property Collection|Lead[] $leads
|
||||
* @package App\Models
|
||||
* @property-read int|null $bookings_count
|
||||
* @property-read int|null $leads_count
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelCategory newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelCategory newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelCategory query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelCategory whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelCategory whereName($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class TravelCategory extends Model
|
||||
{
|
||||
protected $connection = 'mysql';
|
||||
|
||||
protected $table = 'travel_category';
|
||||
public $timestamps = false;
|
||||
|
||||
protected $fillable = [
|
||||
'name'
|
||||
];
|
||||
|
||||
public function bookings()
|
||||
{
|
||||
return $this->hasMany(Booking::class);
|
||||
}
|
||||
|
||||
public function leads()
|
||||
{
|
||||
return $this->hasMany(Lead::class, 'travelcategory_id');
|
||||
}
|
||||
}
|
||||
64
app/Models/TravelCompany.php
Normal file
64
app/Models/TravelCompany.php
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Reliese\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class TravelCompany
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $name
|
||||
* @property float $percentage
|
||||
* @property bool $is_allowed_edit_commission
|
||||
* @property bool $is_inhouse
|
||||
* @property Collection|Booking[] $bookings
|
||||
* @property Collection|BookingServiceItem[] $booking_service_items
|
||||
* @package App\Models
|
||||
* @property-read int|null $booking_service_items_count
|
||||
* @property-read int|null $bookings_count
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelCompany newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelCompany newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelCompany query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelCompany whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelCompany whereIsAllowedEditCommission($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelCompany whereIsInhouse($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelCompany whereName($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelCompany wherePercentage($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class TravelCompany extends Model
|
||||
{
|
||||
protected $connection = 'mysql';
|
||||
|
||||
protected $table = 'travel_company';
|
||||
public $timestamps = false;
|
||||
|
||||
protected $casts = [
|
||||
'percentage' => 'float',
|
||||
'is_allowed_edit_commission' => 'bool',
|
||||
'is_inhouse' => 'bool'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'percentage',
|
||||
'is_allowed_edit_commission',
|
||||
'is_inhouse'
|
||||
];
|
||||
|
||||
public function bookings()
|
||||
{
|
||||
return $this->hasMany(Booking::class);
|
||||
}
|
||||
|
||||
public function booking_service_items()
|
||||
{
|
||||
return $this->hasMany(BookingServiceItem::class);
|
||||
}
|
||||
}
|
||||
|
|
@ -211,9 +211,9 @@ class TravelUserBookingFewo extends Model
|
|||
|
||||
public function getCheckedBadgeCalendar(){
|
||||
$back = "";
|
||||
$back .= $this->is_calendar_fewo_direct ? ' <span class="badge badge-pill badge-success"><i class="far fa-check"></i></span>' : ' <span class="badge badge-pill badge-danger"><i class="far fa-times"></i></span>';
|
||||
$back .= $this->is_calendar_hrs ? ' <span class="badge badge-pill badge-success"><i class="far fa-check"></i></span>' : ' <span class="badge badge-pill badge-danger"><i class="far fa-times"></i></span>';
|
||||
$back .= $this->is_calendar_stern_tours ? ' <span class="badge badge-pill badge-success"><i class="far fa-check"></i></span>' : ' <span class="badge badge-pill badge-danger"><i class="far fa-times"></i></span>';
|
||||
$back .= $this->is_calendar_fewo_direct ? ' <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>';
|
||||
$back .= $this->is_calendar_hrs ? ' <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>';
|
||||
$back .= $this->is_calendar_stern_tours ? ' <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>';
|
||||
return $back;
|
||||
}
|
||||
|
||||
|
|
|
|||
42
app/Models/Website.php
Normal file
42
app/Models/Website.php
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Reliese\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class Website
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $name
|
||||
* @property Collection|Lead[] $leads
|
||||
* @package App\Models
|
||||
* @property-read int|null $leads_count
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Website newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Website newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Website query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Website whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Website whereName($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class Website extends Model
|
||||
{
|
||||
protected $connection = 'mysql';
|
||||
|
||||
protected $table = 'website';
|
||||
public $timestamps = false;
|
||||
|
||||
protected $fillable = [
|
||||
'name'
|
||||
];
|
||||
|
||||
public function leads()
|
||||
{
|
||||
return $this->hasMany(Lead::class);
|
||||
}
|
||||
}
|
||||
519
app/Repositories/DraftRepository.php
Normal file
519
app/Repositories/DraftRepository.php
Normal file
|
|
@ -0,0 +1,519 @@
|
|||
<?php
|
||||
|
||||
namespace App\Repositories;
|
||||
|
||||
|
||||
use App\Models\Booking;
|
||||
use App\Models\BookingDraftItem;
|
||||
use App\Models\TravelProgram;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class DraftRepository extends BaseRepository {
|
||||
|
||||
private $data = "";
|
||||
private $room_str = "";
|
||||
private $room_name = "";
|
||||
private $className = "";
|
||||
private $option = "";
|
||||
|
||||
public function __construct(Booking $model)
|
||||
{
|
||||
$this->model = $model;
|
||||
}
|
||||
|
||||
public function update($data)
|
||||
{
|
||||
return $this->model;
|
||||
}
|
||||
|
||||
|
||||
public function create_drafts_from_booking($booking_id, $data) {
|
||||
|
||||
$this->data = $data;
|
||||
|
||||
$weekday = date('w', strtotime($data['startDateStr']));
|
||||
$travel_program = TravelProgram::find($data['travel_program_id']);
|
||||
$draft = $this->getDraftByTravelProgramData($travel_program, $data, $weekday);
|
||||
|
||||
$start_date = Carbon::parse($data['startDateStr']);
|
||||
$end_date = Carbon::parse($data['endDateStr']);
|
||||
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//prepare rooms
|
||||
//request('rooms'); // //["rooms"]=> array(1) { [0]=> object(stdClass)#7284 (5) { ["name"]=> string(12) "Einzelzimmer" ["price_adult"]=> float(1682.16) ["adult"]=> int(1) ["children"]=> int(0) ["price_children"]=> int(0) }
|
||||
$price_info_rooms = [];
|
||||
$room_names = [];
|
||||
$room_adult = 0;
|
||||
$room_children = 0;
|
||||
$room_price_adult = 0;
|
||||
$room_price_children = 0;
|
||||
|
||||
$data['rooms'] = array_reverse($data['rooms']);
|
||||
|
||||
foreach ($data['rooms'] as $room){
|
||||
|
||||
$room_adult += $room['adult'];
|
||||
$room_children += $room['children'];
|
||||
$room_price_adult += ($room['price_adult_full'] * $room['adult']);
|
||||
$room_price_children += ($room['price_children_full'] * $room['children']);
|
||||
|
||||
if(isset($room_names[$room['name']])){
|
||||
$room_names[$room['name']] = $room_names[$room['name']]+1;
|
||||
}else{
|
||||
$room_names[$room['name']] = 1;
|
||||
}
|
||||
|
||||
$service = trans('_vorlagen.grundpreis_reise');
|
||||
$this->room_name = $room['name'];
|
||||
$service = $this->replaceService($service);
|
||||
|
||||
$price_info_rooms[] = [
|
||||
'booking_id' => $booking_id,
|
||||
'travel_program_id' => $data['travel_program_id'],
|
||||
'fewo_lodging_id' => null,
|
||||
'travel_class_id' => null,
|
||||
'draft_item_id' => null,
|
||||
'draft_type_id' => 30,
|
||||
'request_date' => $data['request_date'],
|
||||
'days_start' => null,
|
||||
'days_duration' => null,
|
||||
'start_date' => $data['startDateStr'],
|
||||
'end_date' => $data['endDateStr'],
|
||||
'service' => $service,
|
||||
'price_adult' => $room['price_adult_full'],
|
||||
'adult' => $room['adult'],
|
||||
'price_children' => $room['price_children_full'],
|
||||
'children' => $room['children'],
|
||||
'pos' => 0,
|
||||
'in_pdf' => true,
|
||||
'comfort' => $data['comfort']
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$this->room_str = "";
|
||||
foreach ($room_names as $name=>$count){
|
||||
$this->room_str .= $count.' x '.$name.', ';
|
||||
}
|
||||
$this->room_str = rtrim($this->room_str, ', ');
|
||||
|
||||
|
||||
//before & after days
|
||||
|
||||
$price_info_rooms_before = [];
|
||||
$price_info_rooms_after = [];
|
||||
|
||||
if(isset($data['booking_before']) && is_array($data['booking_before'])){
|
||||
foreach ($data['booking_before'] as $booking_before){
|
||||
$start_date_before = clone $start_date;
|
||||
if(isset($booking_before['days']) && $booking_before['days'] > 0){
|
||||
$start_date_before->modify('-'.$booking_before['days'].' day');
|
||||
}
|
||||
|
||||
$price_info_rooms_before[] = [
|
||||
'booking_id' => $booking_id,
|
||||
'travel_program_id' => $data['travel_program_id'],
|
||||
'fewo_lodging_id' => null,
|
||||
'travel_class_id' => null,
|
||||
'draft_item_id' => null,
|
||||
'draft_type_id' => 36,
|
||||
'request_date' => $data['request_date'],
|
||||
'days_start' => null,
|
||||
'days_duration' => $booking_before['days'],
|
||||
'start_date' => $start_date_before->format("Y-m-d"),
|
||||
'end_date' => $data['startDateStr'],
|
||||
'service' => $booking_before['name'],
|
||||
'price_adult' => $booking_before['price'],
|
||||
'adult' => $booking_before['adults'],
|
||||
'price_children' => $booking_before['price_children'],
|
||||
'children' => $booking_before['children'],
|
||||
'pos' => 0,
|
||||
'in_pdf' => true,
|
||||
'comfort' => $data['comfort']
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($data['booking_after']) && is_array($data['booking_after'])){
|
||||
foreach ($data['booking_after'] as $booking_after){
|
||||
$end_date_after = clone $end_date;
|
||||
if(isset($booking_after['days']) && $booking_after['days'] > 0){
|
||||
$end_date_after->modify('+'.$booking_after['days'].' day');
|
||||
}
|
||||
|
||||
$price_info_rooms_after[] = [
|
||||
'booking_id' => $booking_id,
|
||||
'travel_program_id' => $data['travel_program_id'],
|
||||
'fewo_lodging_id' => null,
|
||||
'travel_class_id' => null,
|
||||
'draft_item_id' => null,
|
||||
'draft_type_id' => 37,
|
||||
'request_date' => $data['request_date'],
|
||||
'days_start' => null,
|
||||
'days_duration' => $booking_after['days'],
|
||||
'start_date' => $data['endDateStr'],
|
||||
'end_date' => $end_date_after->format("Y-m-d"),
|
||||
'service' => $booking_after['name'],
|
||||
'price_adult' => $booking_after['price'],
|
||||
'adult' => $booking_after['adults'],
|
||||
'price_children' => $booking_after['price_children'],
|
||||
'children' => $booking_after['children'],
|
||||
'pos' => 0,
|
||||
'in_pdf' => true,
|
||||
'comfort' => $data['comfort']
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//prepare extra_charge
|
||||
$price_info_extra_charge = [];
|
||||
if($data['departure_extra_charge'] > 0){
|
||||
|
||||
$service = trans('_vorlagen.aufpreis_flug');
|
||||
$service = $this->replaceService($service);
|
||||
|
||||
$price_info_extra_charge[] = [
|
||||
'booking_id' => $booking_id,
|
||||
'travel_program_id' => $data['travel_program_id'],
|
||||
'fewo_lodging_id' => null,
|
||||
'travel_class_id' => null,
|
||||
'draft_item_id' => null,
|
||||
'draft_type_id' => 33,
|
||||
'request_date' => $data['request_date'],
|
||||
'days_start' => null,
|
||||
'days_duration' => null,
|
||||
'start_date' => null,
|
||||
'end_date' => null,
|
||||
'service' => $service,
|
||||
'price_adult' => $data['departure_extra_charge'] ,
|
||||
'adult' => $data['traveler'] ,
|
||||
'price_children' => 0,
|
||||
'children' => 0,
|
||||
'pos' => 0,
|
||||
'in_pdf' => true,
|
||||
'comfort' => $data['comfort']
|
||||
];
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//prepare $class_options
|
||||
$price_info_class_options = [];
|
||||
foreach ($data['class_options'] as $class_option){
|
||||
|
||||
$service = trans('_vorlagen.aufpreis_kategorie');
|
||||
$this->className = $class_option['name'];
|
||||
$service = $this->replaceService($service);
|
||||
|
||||
$price_info_class_options[] = [
|
||||
'booking_id' => $booking_id,
|
||||
'travel_program_id' => $data['travel_program_id'],
|
||||
'fewo_lodging_id' => null,
|
||||
'travel_class_id' => null,
|
||||
'draft_item_id' => null,
|
||||
'draft_type_id' => 32,
|
||||
'request_date' => $data['request_date'],
|
||||
'days_start' => null,
|
||||
'days_duration' => null,
|
||||
'start_date' => null,
|
||||
'end_date' => null,
|
||||
'service' => $service,
|
||||
'price_adult' => $class_option['price'],
|
||||
'adult' => $class_option['count'],
|
||||
'price_children' => 0,
|
||||
'children' => 0,
|
||||
'pos' => 0,
|
||||
'in_pdf' => true,
|
||||
'comfort' => $data['comfort']
|
||||
];
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//prepare $travel_options
|
||||
$price_info_travel_options = [];
|
||||
foreach ($data['travel_options'] as $travel_option){
|
||||
|
||||
$service = trans('_vorlagen.aufpreis_option');
|
||||
$this->option = $travel_option['name'];
|
||||
$service = $this->replaceService($service);
|
||||
|
||||
/*
|
||||
* if($travel_option['children'] < 1){
|
||||
$travel_option['price_children'] = 0;
|
||||
}
|
||||
*/
|
||||
$price_info_travel_options[] = [
|
||||
'booking_id' => $booking_id,
|
||||
'travel_program_id' => $data['travel_program_id'],
|
||||
'fewo_lodging_id' => null,
|
||||
'travel_class_id' => null,
|
||||
'draft_item_id' => null,
|
||||
'draft_type_id' => 41,
|
||||
'request_date' => $data['request_date'],
|
||||
'days_start' => null,
|
||||
'days_duration' => null,
|
||||
'start_date' => null,
|
||||
'end_date' => null,
|
||||
'service' => $service,
|
||||
'price_adult' => $travel_option['price_adult'],
|
||||
'adult' => $travel_option['adult'],
|
||||
'price_children' => $travel_option['price_children'],
|
||||
'children' => $travel_option['children'],
|
||||
'pos' => 0,
|
||||
'in_pdf' => true,
|
||||
'comfort' => $data['comfort']
|
||||
];
|
||||
}
|
||||
|
||||
$price_info_travel_discounts = [];
|
||||
|
||||
foreach ($data['discount'] as $travel_discount){
|
||||
|
||||
$service = trans('_vorlagen.aufpreis_option');
|
||||
$this->option = "";
|
||||
$service = $this->replaceService($service);
|
||||
|
||||
if($travel_discount['price'] > 0){
|
||||
$travel_discount['price'] = $travel_discount['price']*-1;
|
||||
}
|
||||
$price_info_travel_options[] = [
|
||||
'booking_id' => $booking_id,
|
||||
'travel_program_id' => $data['travel_program_id'],
|
||||
'fewo_lodging_id' => null,
|
||||
'travel_class_id' => null,
|
||||
'draft_item_id' => null,
|
||||
'draft_type_id' => 42,
|
||||
'request_date' => $data['request_date'],
|
||||
'days_start' => null,
|
||||
'days_duration' => null,
|
||||
'start_date' => null,
|
||||
'end_date' => null,
|
||||
'service' => $service,
|
||||
'price_adult' => $travel_discount['price'],
|
||||
'adult' => $travel_discount['count'],
|
||||
'price_children' => 0,
|
||||
'children' => 0,
|
||||
'pos' => 0,
|
||||
'in_pdf' => true,
|
||||
'comfort' => $data['comfort']
|
||||
];
|
||||
}
|
||||
|
||||
$info_texts = [];
|
||||
$last_post = 0;
|
||||
foreach ($draft->draft_items as $draft_item){
|
||||
|
||||
$service = $draft_item->service;
|
||||
$price_adult = 0;
|
||||
$adult = 0;
|
||||
$price_children = 0;
|
||||
$children = 0;
|
||||
|
||||
switch ($draft_item->draft_type->id){
|
||||
case 24: //rundreise
|
||||
$price_adult = $room_price_adult;
|
||||
$adult = $room_adult;
|
||||
$price_children = $room_price_children;
|
||||
$children = $room_children;
|
||||
break;
|
||||
case 4: //flug
|
||||
// "Hinflug: Rückflug: Flugzeiten ?"
|
||||
break;
|
||||
}
|
||||
|
||||
$start_date_temp = null;
|
||||
if($draft_item->days_start > 0){
|
||||
$start_date_temp = clone $start_date;
|
||||
$start_date_temp->addDay($draft_item->days_start-1);
|
||||
}
|
||||
|
||||
$end_date_temp = null;
|
||||
if($draft_item->days_duration > 0){
|
||||
$end_date_temp = clone $start_date;
|
||||
$end_date_temp->addDay($draft_item->days_duration-1);
|
||||
}
|
||||
|
||||
$service = $this->replaceService($service);
|
||||
|
||||
if($draft_item->draft_type->id == 27){
|
||||
//text -at last
|
||||
$info_texts[] = [
|
||||
'booking_id' => $booking_id,
|
||||
'travel_program_id' => $data['travel_program_id'],
|
||||
'fewo_lodging_id' => null,
|
||||
'travel_class_id' => null,
|
||||
'draft_item_id' => $draft_item->id,
|
||||
'draft_type_id' => $draft_item->draft_type->id,
|
||||
'request_date' => $data['request_date'],
|
||||
'days_start' => $draft_item->days_start,
|
||||
'days_duration' => $draft_item->days_duration,
|
||||
'start_date' => $start_date_temp ? $start_date_temp->format("Y-m-d") : null,
|
||||
'end_date' => $end_date_temp ? $end_date_temp->format("Y-m-d") : null,
|
||||
'service' => $service,
|
||||
'price_adult' => $price_adult,
|
||||
'adult' => $adult,
|
||||
'price_children' => $price_children,
|
||||
'children' => $children,
|
||||
'pos' => $draft_item->pos,
|
||||
'in_pdf' => $draft_item->in_pdf,
|
||||
'comfort' => $data['comfort']
|
||||
];
|
||||
|
||||
|
||||
}else{
|
||||
//create new from draft items
|
||||
BookingDraftItem::create([
|
||||
'booking_id' => $booking_id,
|
||||
'travel_program_id' => $data['travel_program_id'],
|
||||
'fewo_lodging_id' => null,
|
||||
'travel_class_id' => null,
|
||||
'draft_item_id' => $draft_item->id,
|
||||
'draft_type_id' => $draft_item->draft_type->id,
|
||||
'request_date' => $data['request_date'],
|
||||
'days_start' => $draft_item->days_start,
|
||||
'days_duration' => $draft_item->days_duration,
|
||||
'start_date' => $start_date_temp ? $start_date_temp->format("Y-m-d") : null,
|
||||
'end_date' => $end_date_temp ? $end_date_temp->format("Y-m-d") : null,
|
||||
'service' => $service,
|
||||
'price_adult' => $price_adult,
|
||||
'adult' => $adult,
|
||||
'price_children' => $price_children,
|
||||
'children' => $children,
|
||||
'pos' => $draft_item->pos,
|
||||
'in_pdf' => $draft_item->in_pdf,
|
||||
'comfort' => $data['comfort']
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
$last_post = $draft_item->pos;
|
||||
|
||||
}
|
||||
|
||||
//set room prices
|
||||
if(count($price_info_rooms)){
|
||||
foreach ($price_info_rooms as $price_info_room){
|
||||
$last_post ++;
|
||||
$price_info_room['pos'] = $last_post;
|
||||
BookingDraftItem::create($price_info_room);
|
||||
}
|
||||
}
|
||||
|
||||
//set room prices before
|
||||
if(count($price_info_rooms_before)){
|
||||
foreach ($price_info_rooms_before as $price_info_room){
|
||||
$last_post ++;
|
||||
$price_info_room['pos'] = $last_post;
|
||||
BookingDraftItem::create($price_info_room);
|
||||
}
|
||||
}
|
||||
|
||||
//set room prices after
|
||||
if(count($price_info_rooms_after)){
|
||||
foreach ($price_info_rooms_after as $price_info_room){
|
||||
$last_post ++;
|
||||
$price_info_room['pos'] = $last_post;
|
||||
BookingDraftItem::create($price_info_room);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//set extra charge price
|
||||
if(count($price_info_extra_charge)){
|
||||
foreach ($price_info_extra_charge as $price_info_extra){
|
||||
$last_post ++;
|
||||
$price_info_extra['pos'] = $last_post;
|
||||
BookingDraftItem::create($price_info_extra);
|
||||
}
|
||||
}
|
||||
//set class options prices
|
||||
if(count($price_info_class_options)){
|
||||
foreach ($price_info_class_options as $price_info_class_option){
|
||||
$last_post ++;
|
||||
$price_info_class_option['pos'] = $last_post;
|
||||
BookingDraftItem::create($price_info_class_option);
|
||||
}
|
||||
}
|
||||
|
||||
//set travel options prices
|
||||
if(count($price_info_travel_options)){
|
||||
foreach ($price_info_travel_options as $price_info_travel_option){
|
||||
$last_post ++;
|
||||
$price_info_travel_option['pos'] = $last_post;
|
||||
BookingDraftItem::create($price_info_travel_option);
|
||||
}
|
||||
}
|
||||
|
||||
//set travel discount prices
|
||||
if(count($price_info_travel_discounts)){
|
||||
foreach ($price_info_travel_discounts as $price_info_travel_discount){
|
||||
$last_post ++;
|
||||
$price_info_travel_option['pos'] = $last_post;
|
||||
BookingDraftItem::create($price_info_travel_option);
|
||||
}
|
||||
}
|
||||
|
||||
//set travel options prices
|
||||
if(count($info_texts)){
|
||||
foreach ($info_texts as $info_text){
|
||||
$last_post ++;
|
||||
$info_text['pos'] = $last_post;
|
||||
BookingDraftItem::create($info_text);
|
||||
}
|
||||
}
|
||||
|
||||
return "";
|
||||
|
||||
|
||||
}
|
||||
|
||||
private function replaceService($service){
|
||||
|
||||
$service = str_replace('#Name#', $this->data['title'], $service);
|
||||
$service = str_replace('#Nummer#', $this->data['number'], $service);
|
||||
$service = str_replace('#Zimmer#', $this->room_str, $service);
|
||||
$service = str_replace('#Raumname#', $this->room_name, $service);
|
||||
$service = str_replace('#Kategorie#', $this->className, $service);
|
||||
$service = str_replace('#Option#', $this->option, $service);
|
||||
$service = str_replace('#Flughafen#', $this->data['departure'], $service);
|
||||
|
||||
return $service;
|
||||
|
||||
}
|
||||
|
||||
private function getDraftByTravelProgramData($travel_program, $data, $weekday){
|
||||
if ($travel_program && count($travel_program->travel_program_drafts)) {
|
||||
|
||||
foreach ($travel_program->travel_program_drafts as $travel_program_draft) {
|
||||
//this need an realation to travel class by booking and price
|
||||
if(in_array($weekday, $travel_program_draft->weekdays)){
|
||||
if($data['comfort'] == false && strpos(strtolower($travel_program_draft->travel_class->name), 'standard') !== false){
|
||||
return $travel_program_draft->draft;
|
||||
}
|
||||
if($data['comfort'] == true && strpos(strtolower($travel_program_draft->travel_class->name), 'komfort') !== false){
|
||||
return $travel_program_draft->draft;
|
||||
}
|
||||
}
|
||||
}
|
||||
//found non get first
|
||||
foreach ($travel_program->travel_program_drafts as $travel_program_draft) {
|
||||
if($travel_program_draft->draft){
|
||||
return $travel_program_draft->draft;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -61,6 +61,7 @@ class HTMLHelper
|
|||
0 => 'Kunde',
|
||||
1 => 'Admin',
|
||||
2 => 'SuperAdmin',
|
||||
3 => 'SysAdmin',
|
||||
];
|
||||
|
||||
|
||||
|
|
@ -103,6 +104,9 @@ class HTMLHelper
|
|||
case 2:
|
||||
return 'badge-primary';
|
||||
break;
|
||||
case 3:
|
||||
return 'badge-success';
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -127,4 +127,17 @@ class Util
|
|||
$html = $dom->saveHTML();
|
||||
return $html;
|
||||
}
|
||||
|
||||
public static function convertArrayWindowsCharset($values){
|
||||
foreach ($values as $key=>$string){
|
||||
$values[$key] = self::convertStringWindowsCharset($string);
|
||||
}
|
||||
return $values;
|
||||
}
|
||||
|
||||
public static function convertStringWindowsCharset($value) {
|
||||
|
||||
$charset = mb_detect_encoding($value, "UTF-8, ISO-8859-1, ISO-8859-15", true);
|
||||
return mb_convert_encoding($value, "Windows-1252", $charset);
|
||||
}
|
||||
}
|
||||
11
app/User.php
11
app/User.php
|
|
@ -160,6 +160,17 @@ class User extends Authenticatable
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isSySAdmin()
|
||||
{
|
||||
if($this->admin >= 3){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private function setPermissionsDefault(){
|
||||
$groups = config('permissions.groups');
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ if (! function_exists('get_active_badge')) {
|
|||
if($tooltip){
|
||||
$tooltip = 'data-toggle="tooltip" data-placement="top" data-original-title="'.$tooltip.'"';
|
||||
}
|
||||
return $active ? '<span class="badge badge-pill badge-success" '.$tooltip.'><i class="far fa-check"></i></span>' : '<span class="badge badge-pill badge-danger" '.$tooltip.'><i class="far fa-times"></i></span>';
|
||||
return $active ? '<span class="badge badge-pill badge-success" '.$tooltip.'><i class="fa fa-check"></i></span>' : '<span class="badge badge-pill badge-danger" '.$tooltip.'><i class="fa fa-times"></i></span>';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue