Fewos in CRM,
Fewo Clients Bookings create / edit / delelte via API in DB
This commit is contained in:
parent
aebfb0586a
commit
c0c2a1822c
55 changed files with 9787 additions and 1486 deletions
104
app/Http/Controllers/API/FewoController.php
Executable file
104
app/Http/Controllers/API/FewoController.php
Executable file
|
|
@ -0,0 +1,104 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\API;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\BookingDraftItem;
|
||||
use App\Models\TravelUser;
|
||||
use App\Models\TravelUserBookingFewo;
|
||||
use Carbon\Carbon;
|
||||
use Validator;
|
||||
|
||||
class FewoController extends Controller
|
||||
{
|
||||
public $successStatus = 200;
|
||||
public $errorStatus = 500;
|
||||
public $data = "";
|
||||
public $room_str = "";
|
||||
public $room_name = "";
|
||||
public $className = "";
|
||||
public $option = "";
|
||||
|
||||
public function action($action)
|
||||
{
|
||||
|
||||
|
||||
|
||||
if ($action == "create_travel_users") {
|
||||
$data = \Input::all();
|
||||
if(!isset($data['travel_user']) && !is_array($data['travel_user'])) {
|
||||
return response()->json(['error' => 'travel_user not exist, but need'], $this->errorStatus);
|
||||
}
|
||||
if(!isset($data['travel_user']['email'])){
|
||||
return response()->json(['error' => 'travel_user email not exist, but need'], $this->errorStatus);
|
||||
}
|
||||
|
||||
$rules = array(
|
||||
'salutation_id' => 'required',
|
||||
'travel_nationality_id' => 'required',
|
||||
'first_name'=>'required',
|
||||
'last_name'=>'required',
|
||||
'email' => 'required|string|email|max:255|'
|
||||
|
||||
);
|
||||
$validator = Validator::make($data['travel_user'], $rules);
|
||||
if ($validator->fails()) {
|
||||
return response()->json($validator->messages(), $this->errorStatus);
|
||||
|
||||
}
|
||||
|
||||
$travel_user = TravelUser::where('email', trim($data['travel_user']['email']))->first();
|
||||
if(!$travel_user) {
|
||||
$travel_user = TravelUser::create($data['travel_user']);
|
||||
}else{
|
||||
$checked = [
|
||||
'salutation_id',
|
||||
'first_name',
|
||||
'last_name',
|
||||
'street',
|
||||
'zipcode',
|
||||
'city',
|
||||
'phone',
|
||||
'fax',
|
||||
'travel_nationality_id'
|
||||
];
|
||||
|
||||
$last_user_data = [];
|
||||
foreach ($checked as $check){
|
||||
if($travel_user->{$check} != $data['travel_user'][$check]){
|
||||
$last_user_data[$check] = $travel_user->{$check};
|
||||
}
|
||||
}
|
||||
$data['travel_user']['last_user_data'] = $last_user_data;
|
||||
$travel_user->fill($data['travel_user'])->save();
|
||||
}
|
||||
return response()->json(['success' => ['travel_user_id' => $travel_user->id]], $this->successStatus);
|
||||
}
|
||||
|
||||
|
||||
if ($action == "create_fewo_booking") {
|
||||
|
||||
$data = \Input::all();
|
||||
if(!isset($data['travel_user_booking_fewo']) && !is_array($data['travel_user_booking_fewo'])) {
|
||||
return response()->json(['error' => 'travel_user_booking_fewo not exist, but need'], $this->errorStatus);
|
||||
}
|
||||
$rules = array(
|
||||
'travel_user_id' => 'required',
|
||||
'fewo_lodging_id' => 'required',
|
||||
'from_date'=>'required',
|
||||
'to_date'=>'required',
|
||||
|
||||
);
|
||||
$validator = Validator::make($data['travel_user_booking_fewo'], $rules);
|
||||
if ($validator->fails()) {
|
||||
return response()->json($validator->messages(), $this->errorStatus);
|
||||
|
||||
}
|
||||
|
||||
$travel_user_booking_fewo = TravelUserBookingFewo::create($data['travel_user_booking_fewo']);
|
||||
|
||||
return response()->json(['success' => ['travel_user_booking_fewo_id' => $travel_user_booking_fewo->id, 'crm_url' => route('travel_user_booking_fewo_detail', [$travel_user_booking_fewo->id])]], $this->successStatus);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
131
app/Http/Controllers/TravelUserBookingFewoController.php
Executable file
131
app/Http/Controllers/TravelUserBookingFewoController.php
Executable file
|
|
@ -0,0 +1,131 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
|
||||
use App\Models\FewoReservation;
|
||||
use App\Models\TravelUser;
|
||||
use App\Models\TravelUserBookingFewo;
|
||||
use Input;
|
||||
use Validator;
|
||||
|
||||
class TravelUserBookingFewoController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('admin');
|
||||
|
||||
}
|
||||
|
||||
public function index($step = false)
|
||||
{
|
||||
$data = [
|
||||
'step' => $step
|
||||
];
|
||||
return view('travel.user.booking.index', $data);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function detail($id)
|
||||
{
|
||||
if($id == "new") {
|
||||
$travel_user_booking_fewo = new TravelUserBookingFewo();
|
||||
$id = 'new';
|
||||
|
||||
}else{
|
||||
$travel_user_booking_fewo = TravelUserBookingFewo::findOrFail($id);
|
||||
$id = $travel_user_booking_fewo->id;
|
||||
}
|
||||
$data = [
|
||||
'travel_user_booking_fewo' => $travel_user_booking_fewo,
|
||||
'id' => $id,
|
||||
];
|
||||
return view('travel.user.booking.detail', $data);
|
||||
|
||||
}
|
||||
|
||||
public function store($id)
|
||||
{
|
||||
$data = Input::all();
|
||||
|
||||
|
||||
$rules = array(
|
||||
'travel_user_id' => 'required',
|
||||
'fewo_lodging_id' => 'required',
|
||||
'from_date'=>'required',
|
||||
'to_date'=>'required',
|
||||
'travel_booking_fewo_channel_id' => 'required',
|
||||
'status' => 'required'
|
||||
|
||||
);
|
||||
|
||||
$validator = Validator::make(Input::all(), $rules);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return back()->withInput(Input::all())->withErrors($validator);
|
||||
}
|
||||
|
||||
if($id == "new") {
|
||||
$model = TravelUserBookingFewo::create($data);
|
||||
}else{
|
||||
$model = TravelUserBookingFewo::findOrFail($id);
|
||||
$model->fill($data)->save();
|
||||
}
|
||||
|
||||
\Session()->flash('alert-save', '1');
|
||||
return redirect(route('travel_user_booking_fewo_detail', [$model->id]));
|
||||
|
||||
}
|
||||
|
||||
public function delete($id){
|
||||
$model = TravelUserBookingFewo::findOrFail($id);
|
||||
$FewoReservations = FewoReservation::where('lodging_id', $model->fewo_lodging_id)->where('from_date', $model->getFromDateRaw())->where('to_date', $model->getToDateRaw())->get();
|
||||
foreach ($FewoReservations as $FewoReservation){
|
||||
$FewoReservation->delete();
|
||||
}
|
||||
$model->delete();
|
||||
\Session()->flash('alert-success', __('Buchung gelöscht sowie die Reservierung im Sterntrous Kalender'));
|
||||
return redirect(route('travel_user_booking_fewos'));
|
||||
}
|
||||
|
||||
|
||||
public function getTravelUserBookingFewos()
|
||||
{
|
||||
//confirmation_code_remider is delete 2
|
||||
$query = TravelUserBookingFewo::where('deleted_at', '=', null);
|
||||
|
||||
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>';
|
||||
})
|
||||
->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>';
|
||||
return $travel_user_booking_fewo->fewo_lodging->name;
|
||||
})
|
||||
->addColumn('travel_user', function (TravelUserBookingFewo $travel_user_booking_fewo) {
|
||||
return '<a href="' . route('travel_user_detail', [$travel_user_booking_fewo->travel_user_id]) . '">'.$travel_user_booking_fewo->travel_user->first_name.' '.$travel_user_booking_fewo->travel_user->last_name.'</a>';
|
||||
})
|
||||
->addColumn('is_calendar', function (TravelUserBookingFewo $travel_user_booking_fewo) {
|
||||
|
||||
$back = "";
|
||||
$back .= $travel_user_booking_fewo->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 .= $travel_user_booking_fewo->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 .= $travel_user_booking_fewo->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>';
|
||||
return $back;
|
||||
})
|
||||
->addColumn('status_name', function (TravelUserBookingFewo $travel_user_booking_fewo) {
|
||||
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>';
|
||||
})
|
||||
->rawColumns(['action_edit', 'fewo_lodging', 'travel_user', 'is_calendar', 'action_delete'])
|
||||
->make(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
111
app/Http/Controllers/TravelUserController.php
Executable file
111
app/Http/Controllers/TravelUserController.php
Executable file
|
|
@ -0,0 +1,111 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
|
||||
use App\Models\TravelUser;
|
||||
use Input;
|
||||
use Validator;
|
||||
|
||||
class TravelUserController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('admin');
|
||||
|
||||
}
|
||||
|
||||
public function index($step = false)
|
||||
{
|
||||
$data = [
|
||||
'step' => $step
|
||||
];
|
||||
return view('travel.user.index', $data);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function detail($id)
|
||||
{
|
||||
if($id == "new") {
|
||||
$travel_user = new TravelUser();
|
||||
$id = 'new';
|
||||
|
||||
}else{
|
||||
$travel_user = TravelUser::findOrFail($id);
|
||||
$id = $travel_user->id;
|
||||
}
|
||||
$data = [
|
||||
'travel_user' => $travel_user,
|
||||
'id' => $id,
|
||||
];
|
||||
return view('travel.user.detail', $data);
|
||||
|
||||
}
|
||||
|
||||
public function store($id)
|
||||
{
|
||||
$data = Input::all();
|
||||
|
||||
$rules = array(
|
||||
'salutation_id' => 'required',
|
||||
'travel_nationality_id' => 'required',
|
||||
'first_name'=>'required',
|
||||
'last_name'=>'required',
|
||||
);
|
||||
if($id == "new"){
|
||||
$rules['email'] = 'required|string|email|max:255|unique:mysql_stern.travel_users,email';
|
||||
}else{
|
||||
$model = TravelUser::findOrFail($id);
|
||||
$rules['email'] = 'required|string|email|max:255|unique:mysql_stern.travel_users,email,'.$model->id;
|
||||
}
|
||||
|
||||
$validator = Validator::make(Input::all(), $rules);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return back()->withInput(Input::all())->withErrors($validator);
|
||||
}
|
||||
|
||||
if($id == "new") {
|
||||
$model = TravelUser::create($data);
|
||||
}else{
|
||||
$model = TravelUser::findOrFail($id);
|
||||
$model->fill($data)->save();
|
||||
}
|
||||
|
||||
\Session()->flash('alert-save', '1');
|
||||
return redirect(route('travel_user_detail', [$model->id]));
|
||||
|
||||
}
|
||||
|
||||
public function delete($id){
|
||||
$model = TravelUser::findOrFail($id);
|
||||
$model->email = time()."@delete.de";
|
||||
$model->save();
|
||||
$model->delete();
|
||||
\Session()->flash('alert-success', __('Vorlage gelöscht'));
|
||||
return redirect(route('travel_users'));
|
||||
}
|
||||
|
||||
|
||||
public function getTravelUsers()
|
||||
{
|
||||
//confirmation_code_remider is delete 2
|
||||
$query = TravelUser::where('deleted_at', '=', null);
|
||||
|
||||
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>';
|
||||
})
|
||||
|
||||
->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>';
|
||||
})
|
||||
->rawColumns(['action_edit', 'action_delete'])
|
||||
->make(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
103
app/Models/FewoLodging.php
Normal file
103
app/Models/FewoLodging.php
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
* Date: Thu, 21 Mar 2019 13:40:05 +0100.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Reliese\Database\Eloquent\Model as Eloquent;
|
||||
|
||||
/**
|
||||
* Class FewoLodging
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $group_id
|
||||
* @property int $type_id
|
||||
* @property string $name
|
||||
* @property string $description
|
||||
* @property string $equipment
|
||||
* @property string $adress1
|
||||
* @property string $adress2
|
||||
* @property string $zip_code
|
||||
* @property string $city
|
||||
* @property int $maximum_persons
|
||||
* @property float $deposit
|
||||
* @property bool $calendar_visible
|
||||
* @property \App\Models\FewoLodgingType $fewo_lodging_type
|
||||
* @property \App\Models\FewoLodgingGroup $fewo_lodging_group
|
||||
* @property \Illuminate\Database\Eloquent\Collection $fewo_lodging_images
|
||||
* @property \Illuminate\Database\Eloquent\Collection $fewo_prices
|
||||
* @property \Illuminate\Database\Eloquent\Collection $fewo_reservations
|
||||
* @property \Illuminate\Database\Eloquent\Collection $pages
|
||||
* @property \Illuminate\Database\Eloquent\Collection $travel_user_booking_fewos
|
||||
* @package App\Models
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class FewoLodging extends Model
|
||||
{
|
||||
protected $connection = 'mysql_stern';
|
||||
|
||||
protected $table = 'fewo_lodging';
|
||||
public $timestamps = false;
|
||||
|
||||
protected $casts = [
|
||||
'group_id' => 'int',
|
||||
'type_id' => 'int',
|
||||
'maximum_persons' => 'int',
|
||||
'deposit' => 'float',
|
||||
'calendar_visible' => 'bool'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'group_id',
|
||||
'type_id',
|
||||
'name',
|
||||
'description',
|
||||
'equipment',
|
||||
'adress1',
|
||||
'adress2',
|
||||
'zip_code',
|
||||
'city',
|
||||
'maximum_persons',
|
||||
'deposit',
|
||||
'calendar_visible'
|
||||
];
|
||||
|
||||
public function fewo_lodging_type()
|
||||
{
|
||||
return $this->belongsTo(\App\Models\FewoLodgingType::class, 'type_id');
|
||||
}
|
||||
|
||||
public function fewo_lodging_group()
|
||||
{
|
||||
return $this->belongsTo(\App\Models\FewoLodgingGroup::class, 'group_id');
|
||||
}
|
||||
|
||||
public function fewo_lodging_images()
|
||||
{
|
||||
return $this->hasMany(\App\Models\FewoLodgingImage::class, 'lodging_id');
|
||||
}
|
||||
|
||||
public function fewo_prices()
|
||||
{
|
||||
return $this->hasMany(\App\Models\FewoPrice::class, 'lodging_id');
|
||||
}
|
||||
|
||||
public function fewo_reservations()
|
||||
{
|
||||
return $this->hasMany(\App\Models\FewoReservation::class, 'lodging_id');
|
||||
}
|
||||
|
||||
public function pages()
|
||||
{
|
||||
return $this->hasMany(\App\Models\Page::class, 'fewo_lodging');
|
||||
}
|
||||
|
||||
public function travel_user_booking_fewos()
|
||||
{
|
||||
return $this->hasMany(\App\Models\TravelUserBookingFewo::class);
|
||||
}
|
||||
}
|
||||
42
app/Models/FewoLodgingGroup.php
Normal file
42
app/Models/FewoLodgingGroup.php
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
* Date: Thu, 21 Mar 2019 13:40:07 +0100.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class FewoLodgingGroup
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $name
|
||||
* @property \Illuminate\Database\Eloquent\Collection $fewo_lodgings
|
||||
* @property \Illuminate\Database\Eloquent\Collection $fewo_lodging_group_images
|
||||
* @package App\Models
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class FewoLodgingGroup extends Model
|
||||
{
|
||||
protected $connection = 'mysql_stern';
|
||||
|
||||
protected $table = 'fewo_lodging_group';
|
||||
public $timestamps = false;
|
||||
|
||||
protected $fillable = [
|
||||
'name'
|
||||
];
|
||||
|
||||
public function fewo_lodgings()
|
||||
{
|
||||
return $this->hasMany(\App\Models\FewoLodging::class, 'group_id');
|
||||
}
|
||||
|
||||
public function fewo_lodging_group_images()
|
||||
{
|
||||
return $this->hasMany(\App\Models\FewoLodgingGroupImage::class, 'group_id');
|
||||
}
|
||||
}
|
||||
51
app/Models/FewoLodgingGroupImage.php
Normal file
51
app/Models/FewoLodgingGroupImage.php
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
* Date: Thu, 21 Mar 2019 13:40:06 +0100.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class FewoLodgingGroupImage
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $group_id
|
||||
* @property string $comp
|
||||
* @property int $pos
|
||||
* @property string $full_file_name
|
||||
* @property string $file_name
|
||||
* @property string $description
|
||||
* @property \App\Models\FewoLodgingGroup $fewo_lodging_group
|
||||
* @package App\Models
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class FewoLodgingGroupImage extends Model
|
||||
{
|
||||
protected $connection = 'mysql_stern';
|
||||
|
||||
protected $table = 'fewo_lodging_group_image';
|
||||
public $timestamps = false;
|
||||
|
||||
protected $casts = [
|
||||
'group_id' => 'int',
|
||||
'pos' => 'int'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'group_id',
|
||||
'comp',
|
||||
'pos',
|
||||
'full_file_name',
|
||||
'file_name',
|
||||
'description'
|
||||
];
|
||||
|
||||
public function fewo_lodging_group()
|
||||
{
|
||||
return $this->belongsTo(\App\Models\FewoLodgingGroup::class, 'group_id');
|
||||
}
|
||||
}
|
||||
49
app/Models/FewoLodgingImage.php
Normal file
49
app/Models/FewoLodgingImage.php
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
* Date: Thu, 21 Mar 2019 13:40:07 +0100.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class FewoLodgingImage
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $lodging_id
|
||||
* @property int $pos
|
||||
* @property string $full_file_name
|
||||
* @property string $file_name
|
||||
* @property string $description
|
||||
* @property \App\Models\FewoLodging $fewo_lodging
|
||||
* @package App\Models
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class FewoLodgingImage extends Model
|
||||
{
|
||||
protected $connection = 'mysql_stern';
|
||||
|
||||
protected $table = 'fewo_lodging_image';
|
||||
public $timestamps = false;
|
||||
|
||||
protected $casts = [
|
||||
'lodging_id' => 'int',
|
||||
'pos' => 'int'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'lodging_id',
|
||||
'pos',
|
||||
'full_file_name',
|
||||
'file_name',
|
||||
'description'
|
||||
];
|
||||
|
||||
public function fewo_lodging()
|
||||
{
|
||||
return $this->belongsTo(\App\Models\FewoLodging::class, 'lodging_id');
|
||||
}
|
||||
}
|
||||
36
app/Models/FewoLodgingType.php
Normal file
36
app/Models/FewoLodgingType.php
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
* Date: Thu, 21 Mar 2019 13:40:08 +0100.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class FewoLodgingType
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $name
|
||||
* @property \Illuminate\Database\Eloquent\Collection $fewo_lodgings
|
||||
* @package App\Models
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class FewoLodgingType extends Model
|
||||
{
|
||||
protected $connection = 'mysql_stern';
|
||||
|
||||
protected $table = 'fewo_lodging_type';
|
||||
public $timestamps = false;
|
||||
|
||||
protected $fillable = [
|
||||
'name'
|
||||
];
|
||||
|
||||
public function fewo_lodgings()
|
||||
{
|
||||
return $this->hasMany(\App\Models\FewoLodging::class, 'type_id');
|
||||
}
|
||||
}
|
||||
55
app/Models/FewoPrice.php
Normal file
55
app/Models/FewoPrice.php
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
* Date: Thu, 21 Mar 2019 13:40:09 +0100.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class FewoPrice
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $lodging_id
|
||||
* @property int $season_id
|
||||
* @property float $per_night
|
||||
* @property float $flat_price
|
||||
* @property \App\Models\FewoSeason $fewo_season
|
||||
* @property \App\Models\FewoLodging $fewo_lodging
|
||||
* @package App\Models
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class FewoPrice extends Model
|
||||
{
|
||||
protected $connection = 'mysql_stern';
|
||||
|
||||
protected $table = 'fewo_price';
|
||||
public $timestamps = false;
|
||||
|
||||
protected $casts = [
|
||||
'lodging_id' => 'int',
|
||||
'season_id' => 'int',
|
||||
'per_night' => 'float',
|
||||
'flat_price' => 'float'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'lodging_id',
|
||||
'season_id',
|
||||
'per_night',
|
||||
'flat_price'
|
||||
];
|
||||
|
||||
public function fewo_season()
|
||||
{
|
||||
return $this->belongsTo(\App\Models\FewoSeason::class, 'season_id');
|
||||
}
|
||||
|
||||
public function fewo_lodging()
|
||||
{
|
||||
return $this->belongsTo(\App\Models\FewoLodging::class, 'lodging_id');
|
||||
}
|
||||
}
|
||||
55
app/Models/FewoReservation.php
Normal file
55
app/Models/FewoReservation.php
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
* Date: Thu, 21 Mar 2019 13:40:09 +0100.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class FewoReservation
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $lodging_id
|
||||
* @property \Carbon\Carbon $from_date
|
||||
* @property \Carbon\Carbon $to_date
|
||||
* @property int $status
|
||||
* @property int $type
|
||||
* @property \App\Models\FewoLodging $fewo_lodging
|
||||
* @package App\Models
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class FewoReservation extends Model
|
||||
{
|
||||
protected $connection = 'mysql_stern';
|
||||
|
||||
protected $table = 'fewo_reservation';
|
||||
public $timestamps = false;
|
||||
|
||||
protected $casts = [
|
||||
'lodging_id' => 'int',
|
||||
'status' => 'int',
|
||||
'type' => 'int'
|
||||
];
|
||||
|
||||
protected $dates = [
|
||||
'from_date',
|
||||
'to_date'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'lodging_id',
|
||||
'from_date',
|
||||
'to_date',
|
||||
'status',
|
||||
'type'
|
||||
];
|
||||
|
||||
public function fewo_lodging()
|
||||
{
|
||||
return $this->belongsTo(\App\Models\FewoLodging::class, 'lodging_id');
|
||||
}
|
||||
}
|
||||
56
app/Models/FewoSeason.php
Normal file
56
app/Models/FewoSeason.php
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
* Date: Thu, 21 Mar 2019 13:40:10 +0100.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class FewoSeason
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $name
|
||||
* @property \Carbon\Carbon $from_date
|
||||
* @property \Carbon\Carbon $to_date
|
||||
* @property int $minimum_stay
|
||||
* @property string $description
|
||||
* @property int $only_weekday
|
||||
* @property \Illuminate\Database\Eloquent\Collection $fewo_prices
|
||||
* @package App\Models
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class FewoSeason extends Model
|
||||
{
|
||||
protected $connection = 'mysql_stern';
|
||||
|
||||
protected $table = 'fewo_season';
|
||||
public $timestamps = false;
|
||||
|
||||
protected $casts = [
|
||||
'minimum_stay' => 'int',
|
||||
'only_weekday' => 'int'
|
||||
];
|
||||
|
||||
protected $dates = [
|
||||
'from_date',
|
||||
'to_date'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'from_date',
|
||||
'to_date',
|
||||
'minimum_stay',
|
||||
'description',
|
||||
'only_weekday'
|
||||
];
|
||||
|
||||
public function fewo_prices()
|
||||
{
|
||||
return $this->hasMany(\App\Models\FewoPrice::class, 'season_id');
|
||||
}
|
||||
}
|
||||
35
app/Models/TravelBookingFewoChannel.php
Normal file
35
app/Models/TravelBookingFewoChannel.php
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
* Date: Thu, 21 Mar 2019 13:40:11 +0100.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class TravelBookingFewoChannel
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $name
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property \Illuminate\Database\Eloquent\Collection $travel_user_booking_fewos
|
||||
* @package App\Models
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class TravelBookingFewoChannel extends Model
|
||||
{
|
||||
protected $connection = 'mysql_stern';
|
||||
|
||||
protected $fillable = [
|
||||
'name'
|
||||
];
|
||||
|
||||
public function travel_user_booking_fewos()
|
||||
{
|
||||
return $this->hasMany(\App\Models\TravelUserBookingFewo::class);
|
||||
}
|
||||
}
|
||||
|
|
@ -22,7 +22,6 @@ class TravelNationality extends Model
|
|||
|
||||
protected $table = 'travel_nationality';
|
||||
|
||||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'active',
|
||||
|
|
|
|||
110
app/Models/TravelUser.php
Normal file
110
app/Models/TravelUser.php
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
* Date: Thu, 21 Mar 2019 13:39:44 +0100.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Services\Util;
|
||||
use Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class TravelUser
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $salutation_id
|
||||
* @property string $title
|
||||
* @property string $first_name
|
||||
* @property string $last_name
|
||||
* @property string $email
|
||||
* @property string $password
|
||||
* @property string $company
|
||||
* @property string $street
|
||||
* @property string $zipcode
|
||||
* @property string $city
|
||||
* @property string $phone
|
||||
* @property string $mobil
|
||||
* @property string $fax
|
||||
* @property \Carbon\Carbon $birthday
|
||||
* @property int $travel_nationality_id
|
||||
* @property string $last_user_data
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property string $deleted_at
|
||||
* @property \App\Models\TravelNationality $travel_nationality
|
||||
* @property \Illuminate\Database\Eloquent\Collection $travel_user_booking_fewos
|
||||
* @package App\Models
|
||||
* @method static bool|null forceDelete()
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\Models\TravelUser onlyTrashed()
|
||||
* @method static bool|null restore()
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\Models\TravelUser withTrashed()
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\Models\TravelUser withoutTrashed()
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class TravelUser extends Model
|
||||
{
|
||||
use \Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
protected $connection = 'mysql_stern';
|
||||
|
||||
protected $table = 'travel_users';
|
||||
|
||||
protected $casts = [
|
||||
'salutation_id' => 'int',
|
||||
'travel_nationality_id' => 'int',
|
||||
'last_user_data' => 'array'
|
||||
];
|
||||
|
||||
protected $dates = [
|
||||
'birthday'
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'password'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'salutation_id',
|
||||
'title',
|
||||
'first_name',
|
||||
'last_name',
|
||||
'email',
|
||||
'password',
|
||||
'company',
|
||||
'street',
|
||||
'zipcode',
|
||||
'city',
|
||||
'phone',
|
||||
'mobil',
|
||||
'fax',
|
||||
'birthday',
|
||||
'travel_nationality_id',
|
||||
'last_user_data'
|
||||
];
|
||||
|
||||
public function travel_nationality()
|
||||
{
|
||||
return $this->belongsTo(\App\Models\TravelNationality::class);
|
||||
}
|
||||
|
||||
public function travel_user_booking_fewos()
|
||||
{
|
||||
return $this->hasMany(\App\Models\TravelUserBookingFewo::class);
|
||||
}
|
||||
|
||||
|
||||
public function getBirthdayAttribute($value)
|
||||
{
|
||||
if(!$value){
|
||||
return "";
|
||||
}
|
||||
return Carbon::parse($value)->format(Util::formatDateDB());
|
||||
}
|
||||
|
||||
public function setBirthdayAttribute( $value ) {
|
||||
$this->attributes['birthday'] = isset($value) ? (new Carbon($value))->format('Y-m-d') : NULL;
|
||||
}
|
||||
}
|
||||
314
app/Models/TravelUserBookingFewo.php
Normal file
314
app/Models/TravelUserBookingFewo.php
Normal file
|
|
@ -0,0 +1,314 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
* Date: Thu, 21 Mar 2019 13:40:13 +0100.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Util;
|
||||
|
||||
/**
|
||||
* Class TravelUserBookingFewo
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $travel_user_id
|
||||
* @property int $fewo_lodging_id
|
||||
* @property string $invoice_number
|
||||
* @property int $persons
|
||||
* @property int $adults
|
||||
* @property int $children
|
||||
* @property \Carbon\Carbon $booking_date
|
||||
* @property \Carbon\Carbon $from_date
|
||||
* @property \Carbon\Carbon $to_date
|
||||
* @property string $daily_prices
|
||||
* @property float $price_travel
|
||||
* @property float $price_deposit
|
||||
* @property float $price_service
|
||||
* @property float $price_total
|
||||
* @property int $travel_booking_fewo_channel_id
|
||||
* @property string $notice
|
||||
* @property bool $is_calendar_fewo_direct
|
||||
* @property bool $is_calendar_hrs
|
||||
* @property bool $is_calendar_stern_tours
|
||||
* @property int $status
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property string $deleted_at
|
||||
* @property \App\Models\FewoLodging $fewo_lodging
|
||||
* @property \App\Models\TravelBookingFewoChannel $travel_booking_fewo_channel
|
||||
* @property \App\Models\TravelUser $travel_user
|
||||
* @package App\Models
|
||||
* @method static bool|null forceDelete()
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\Models\TravelUserBookingFewo onlyTrashed()
|
||||
* @method static bool|null restore()
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\Models\TravelUserBookingFewo withTrashed()
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\Models\TravelUserBookingFewo withoutTrashed()
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class TravelUserBookingFewo extends Model
|
||||
{
|
||||
use \Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
|
||||
|
||||
|
||||
protected static $statues = [
|
||||
0 => 'Anfrage von STERN TOURS',
|
||||
1 => 'Angebot versandt',
|
||||
2 => 'Rückfrage Agentur',
|
||||
3 => 'Rückfrage Kunden',
|
||||
5 => 'Nachfrage Angebot',
|
||||
7 => 'gebucht',
|
||||
8 => 'Absage',
|
||||
9 => 'Option',
|
||||
10 => 'Angebot erstellen',
|
||||
11 => 'Storno durch VA',
|
||||
12 => 'Storno durch Kunde',
|
||||
13 => 'Reiseanmeldung verschickt',
|
||||
];
|
||||
|
||||
|
||||
protected $connection = 'mysql_stern';
|
||||
|
||||
protected $table = 'travel_user_booking_fewos';
|
||||
|
||||
protected $casts = [
|
||||
'travel_user_id' => 'int',
|
||||
'fewo_lodging_id' => 'int',
|
||||
'persons' => 'int',
|
||||
'adults' => 'int',
|
||||
'children' => 'int',
|
||||
'daily_prices' => 'array', //!
|
||||
'price_travel' => 'float',
|
||||
'price_deposit' => 'float',
|
||||
'price_service' => 'float',
|
||||
'price_total' => 'float',
|
||||
'travel_booking_fewo_channel_id' => 'int',
|
||||
'is_calendar_fewo_direct' => 'bool',
|
||||
'is_calendar_hrs' => 'bool',
|
||||
'is_calendar_stern_tours' => 'bool',
|
||||
'status' => 'int'
|
||||
];
|
||||
|
||||
protected $dates = [
|
||||
'booking_date',
|
||||
'from_date',
|
||||
'to_date'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'travel_user_id',
|
||||
'fewo_lodging_id',
|
||||
'invoice_number',
|
||||
'adults',
|
||||
'children',
|
||||
'persons',
|
||||
'booking_date',
|
||||
'from_date',
|
||||
'to_date',
|
||||
'daily_prices',
|
||||
'price_travel',
|
||||
'price_deposit',
|
||||
'price_service',
|
||||
'price_total',
|
||||
'travel_booking_fewo_channel_id',
|
||||
'notice',
|
||||
'is_calendar_fewo_direct',
|
||||
'is_calendar_hrs',
|
||||
'is_calendar_stern_tours',
|
||||
'status',
|
||||
'status_text'
|
||||
];
|
||||
|
||||
public function fewo_lodging()
|
||||
{
|
||||
return $this->belongsTo(\App\Models\FewoLodging::class);
|
||||
}
|
||||
|
||||
public function travel_booking_fewo_channel()
|
||||
{
|
||||
return $this->belongsTo(\App\Models\TravelBookingFewoChannel::class);
|
||||
}
|
||||
|
||||
public function travel_user()
|
||||
{
|
||||
return $this->belongsTo(\App\Models\TravelUser::class);
|
||||
}
|
||||
|
||||
public function getStatuesName(){
|
||||
if(isset(self::$statues[$this->status])){
|
||||
return self::$statues[$this->status];
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
public function getPersonsAttribute($value)
|
||||
{
|
||||
$this->attributes['persons'] = $this->adults + $this->children;
|
||||
return $this->attributes['persons'];
|
||||
}
|
||||
|
||||
public function setPersonsAttribute( $value ) {
|
||||
|
||||
$this->attributes['persons'] = $this->adults + $this->children;
|
||||
|
||||
}
|
||||
|
||||
public function getAdultsAttribute()
|
||||
{
|
||||
return isset($this->attributes['adults']) ? $this->attributes['adults'] : 0;
|
||||
}
|
||||
|
||||
public function setAdultsAttribute( $value ) {
|
||||
|
||||
$this->attributes['persons'] = $this->adults + $this->children;
|
||||
$this->attributes['adults'] = $value;
|
||||
|
||||
}
|
||||
|
||||
public function getChildrenAttribute()
|
||||
{
|
||||
return isset($this->attributes['children']) ? $this->attributes['children'] : 0;
|
||||
}
|
||||
|
||||
public function setChildrenAttribute( $value ) {
|
||||
|
||||
$this->attributes['persons'] = $this->adults + $this->children;
|
||||
$this->attributes['children'] = $value;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static function getStatuesOptions($setKey = false){
|
||||
$options = self::$statues;
|
||||
$ret = '';
|
||||
foreach ($options as $key => $option){
|
||||
$attr = ($key == $setKey) ? 'selected="selected"' : '';
|
||||
$ret .= '<option value="'.$key.'" '.$attr.'>'.$option.'</option>\n';
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public function getBookingDateAttribute($value)
|
||||
{
|
||||
if(!$value){ return ""; }
|
||||
return Carbon::parse($value)->format(Util::formatDateDB());
|
||||
}
|
||||
|
||||
public function setBookingDateAttribute( $value ) {
|
||||
$this->attributes['booking_date'] = isset($value) ? (new Carbon($value))->format('Y-m-d') : NULL;
|
||||
}
|
||||
|
||||
//from_date
|
||||
public function getFromDateAttribute($value)
|
||||
{
|
||||
if(!$value){ return ""; }
|
||||
return Carbon::parse($value)->format(Util::formatDateDB());
|
||||
}
|
||||
public function setFromDateAttribute( $value ) {
|
||||
$this->attributes['from_date'] = isset($value) ? (new Carbon($value))->format('Y-m-d') : NULL;
|
||||
}
|
||||
public function getFromDateRaw()
|
||||
{
|
||||
return isset($this->attributes['from_date']) ? $this->attributes['from_date'] : "";
|
||||
}
|
||||
|
||||
//to_date
|
||||
public function getToDateAttribute($value)
|
||||
{
|
||||
if(!$value){ return ""; }
|
||||
return Carbon::parse($value)->format(Util::formatDateDB());
|
||||
}
|
||||
public function setToDateAttribute( $value ) {
|
||||
$this->attributes['to_date'] = isset($value) ? (new Carbon($value))->format('Y-m-d') : NULL;
|
||||
}
|
||||
public function getToDateRaw()
|
||||
{
|
||||
return isset($this->attributes['to_date']) ? $this->attributes['to_date'] : "";
|
||||
}
|
||||
|
||||
//price_travel
|
||||
public function setPriceTravelAttribute($value)
|
||||
{
|
||||
$value = Util::_format_number($value);
|
||||
$this->attributes['price_travel'] = floatval(str_replace(',', '.', $value));
|
||||
}
|
||||
|
||||
public function getPriceTravelAttribute($value)
|
||||
{
|
||||
if(!$value){ return ""; }
|
||||
// 2 = decimal places | '.' = decimal seperator | ',' = thousand seperator
|
||||
return number_format(($this->attributes['price_travel']), 2, ',', '.');
|
||||
}
|
||||
|
||||
public function getPriceTravelRaw()
|
||||
{
|
||||
return isset($this->attributes['price_travel']) ? $this->attributes['price_travel'] : 0;
|
||||
}
|
||||
|
||||
//price_deposit
|
||||
public function setPriceDepositAttribute($value)
|
||||
{
|
||||
$value = Util::_format_number($value);
|
||||
$this->attributes['price_deposit'] = floatval(str_replace(',', '.', $value));
|
||||
}
|
||||
|
||||
public function getPriceDepositAttribute($value)
|
||||
{
|
||||
if(!$value){ return ""; }
|
||||
// 2 = decimal places | '.' = decimal seperator | ',' = thousand seperator
|
||||
return number_format(($this->attributes['price_deposit']), 2, ',', '.');
|
||||
}
|
||||
|
||||
public function getPriceDepositRaw()
|
||||
{
|
||||
return isset($this->attributes['price_deposit']) ? $this->attributes['price_deposit'] : 0;
|
||||
}
|
||||
|
||||
//price_service
|
||||
public function setPriceServiceAttribute($value)
|
||||
{
|
||||
$value = Util::_format_number($value);
|
||||
$this->attributes['price_service'] = floatval(str_replace(',', '.', $value));
|
||||
}
|
||||
|
||||
public function getPriceServiceAttribute($value)
|
||||
{
|
||||
if(!$value){ return ""; }
|
||||
|
||||
// 2 = decimal places | '.' = decimal seperator | ',' = thousand seperator
|
||||
return number_format(($this->attributes['price_service']), 2, ',', '.');
|
||||
}
|
||||
|
||||
public function getPriceServiceRaw()
|
||||
{
|
||||
return isset($this->attributes['price_service']) ? $this->attributes['price_service'] : 0;
|
||||
}
|
||||
|
||||
//price_total
|
||||
public function setPriceTotalAttribute($value)
|
||||
{
|
||||
//$value = Util::_format_number($value);
|
||||
$value = $this->getPriceDepositRaw() + $this->getPriceServiceRaw() + $this->getPriceTravelRaw();
|
||||
$this->attributes['price_total'] = floatval($value);
|
||||
}
|
||||
|
||||
public function getPriceTotalAttribute()
|
||||
{
|
||||
// 2 = decimal places | '.' = decimal seperator | ',' = thousand seperator
|
||||
$value = $this->getPriceDepositRaw() + $this->getPriceServiceRaw() + $this->getPriceTravelRaw();
|
||||
$this->attributes['price_total'] = floatval($value);
|
||||
return number_format(($this->attributes['price_total']), 2, ',', '.');
|
||||
}
|
||||
|
||||
public function getPriceTotalRaw()
|
||||
{
|
||||
return isset($this->attributes['price_total']) ? $this->attributes['price_total'] : 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -4,11 +4,15 @@ namespace App\Services;
|
|||
use App\Models\Country;
|
||||
use App\Models\Draft;
|
||||
use App\Models\DraftType;
|
||||
use App\Models\FewoLodging;
|
||||
use App\Models\IndustrySector;
|
||||
use App\Models\Interest;
|
||||
use App\Models\TravelBookingFewoChannel;
|
||||
use App\Models\TravelClass;
|
||||
use App\Models\TravelCountry;
|
||||
use App\Models\TravelNationality;
|
||||
use App\Models\TravelProgram;
|
||||
use App\Models\TravelUser;
|
||||
use Form;
|
||||
|
||||
class HTMLHelper
|
||||
|
|
@ -48,6 +52,13 @@ class HTMLHelper
|
|||
];
|
||||
|
||||
|
||||
private static $salutation = [
|
||||
1 => 'Herr',
|
||||
2 => 'Frau',
|
||||
3 => 'Firma',
|
||||
];
|
||||
|
||||
|
||||
public static function getMonth($i){
|
||||
return self::$months[intval($i)];
|
||||
}
|
||||
|
|
@ -84,6 +95,15 @@ class HTMLHelper
|
|||
}
|
||||
|
||||
|
||||
public static function getSalutationOptions($id){
|
||||
$ret = "";
|
||||
foreach (self::$salutation as $s_id => $value){
|
||||
$attr = ($s_id == $id) ? 'selected="selected"' : '';
|
||||
$ret .= '<option value="'.$s_id.'" '.$attr.'>'.$value.'</option>\n';
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
public static function getYearSelectOptions(){
|
||||
$start = date("Y", strtotime("-5 years", time()));
|
||||
|
|
@ -152,6 +172,45 @@ class HTMLHelper
|
|||
return $ret;
|
||||
}
|
||||
|
||||
public static function getTravelUserOptions($id = false){
|
||||
$options = TravelUser::all();
|
||||
$ret = '';
|
||||
foreach ($options as $option){
|
||||
$attr = ($option->id === $id) ? 'selected="selected"' : '';
|
||||
$ret .= '<option value="'.$option->id.'" '.$attr.'>'.$option->first_name.' '.$option->last_name.' | '.$option->email.' ('.$option->id.')</option>\n';
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public static function getFewoLodgingOptions($id = false){
|
||||
$options = FewoLodging::all();
|
||||
$ret = '';
|
||||
foreach ($options as $option){
|
||||
$attr = ($option->id === $id) ? 'selected="selected"' : '';
|
||||
$ret .= '<option value="'.$option->id.'" '.$attr.'>'.$option->name.'</option>\n';
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
public static function getTravelBookingFewoChannelOptions($id = false){
|
||||
$options = TravelBookingFewoChannel::all();
|
||||
$ret = '';
|
||||
foreach ($options as $option){
|
||||
$attr = ($option->id === $id) ? 'selected="selected"' : '';
|
||||
$ret .= '<option value="'.$option->id.'" '.$attr.'>'.$option->name.'</option>\n';
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public static function getTravelNationalityOptions($id = false){
|
||||
$options = TravelNationality::where('active',1)->get();
|
||||
$ret = '';
|
||||
foreach ($options as $option){
|
||||
$attr = ($option->id === $id) ? 'selected="selected"' : '';
|
||||
$ret .= '<option value="'.$option->id.'" '.$attr.'>'.$option->name.'</option>\n';
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static function getWeekdaysOptions($programId = false, $weekdays = []){
|
||||
|
|
|
|||
|
|
@ -28,4 +28,8 @@ class Util
|
|||
}
|
||||
return 'd.m.Y - H:i';
|
||||
}
|
||||
|
||||
public static function _format_number($value){
|
||||
return preg_replace("/[^0-9,]/", "", $value);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue