Lead create Booking
This commit is contained in:
parent
3df0e93c2c
commit
34a3d2196b
18 changed files with 462 additions and 160 deletions
|
|
@ -125,8 +125,24 @@ class Customer extends Model
|
|||
];
|
||||
|
||||
public static $salutationType = [
|
||||
1 => 'Mann',
|
||||
2 => 'Frau'
|
||||
1 => 'Herr',
|
||||
2 => 'Frau',
|
||||
3 => 'Divers/keine Anrede',
|
||||
4 => 'Firma'
|
||||
];
|
||||
|
||||
public static $salutationNameType = [
|
||||
1 => 'Herr',
|
||||
2 => 'Frau',
|
||||
3 => '',
|
||||
4 => 'Firma'
|
||||
];
|
||||
|
||||
public static $salutationDearType = [
|
||||
1 => 'geehrter',
|
||||
2 => 'geehrte',
|
||||
3 => 'geehrte:r',
|
||||
4 => ''
|
||||
];
|
||||
|
||||
public function travel_country()
|
||||
|
|
@ -155,7 +171,15 @@ class Customer extends Model
|
|||
}
|
||||
|
||||
public function getSalutation(){
|
||||
return $this->salutation_id == 1 ? 'Herr' : 'Frau';
|
||||
return isset(self::$salutationType[$this->salutation_id]) ? self::$salutationType[$this->salutation_id] : '';
|
||||
}
|
||||
|
||||
public function getSalutationName(){
|
||||
return isset(self::$salutationNameType[$this->salutation_id]) ? self::$salutationNameType[$this->salutation_id] : '';
|
||||
}
|
||||
|
||||
public function getSalutationDear(){
|
||||
return isset(self::$salutationDearType[$this->salutation_id]) ? self::$salutationDearType[$this->salutation_id] : '';
|
||||
}
|
||||
|
||||
public function fullName()
|
||||
|
|
|
|||
|
|
@ -1,26 +1,29 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
|
||||
/**
|
||||
* App\Models\TravelProgram
|
||||
*
|
||||
* Class TravelProgram
|
||||
*
|
||||
* @property int $id
|
||||
* @property float|null $profit_margin
|
||||
* @property int|null $category_id
|
||||
* @property string|null $program_code
|
||||
* @property int|null $program_duration
|
||||
* @property int|null $is_seasonal
|
||||
* @property int|null $youth
|
||||
* @property bool|null $is_seasonal
|
||||
* @property bool|null $youth
|
||||
* @property string|null $title
|
||||
* @property string|null $subtitle
|
||||
* @property string|null $slider_info
|
||||
* @property int|null $program_type
|
||||
* @property int|null $crm_draft_id_standard
|
||||
* @property int|null $crm_draft_id_comfort
|
||||
* @property int|null $organizer
|
||||
* @property int|null $generalnote
|
||||
* @property int|null $status
|
||||
|
|
@ -35,8 +38,9 @@ use Illuminate\Database\Eloquent\Model;
|
|||
* @property int|null $insurance_1
|
||||
* @property int|null $insurance_2
|
||||
* @property int|null $insurance_3
|
||||
* @property int $in_slider
|
||||
* @property int $show_map
|
||||
* @property int|null $insurance_4
|
||||
* @property bool $in_slider
|
||||
* @property bool $show_map
|
||||
* @property string|null $map_html
|
||||
* @property string $map_image
|
||||
* @property string $map_image_ext
|
||||
|
|
@ -44,7 +48,7 @@ use Illuminate\Database\Eloquent\Model;
|
|||
* @property int|null $travel_category
|
||||
* @property int|null $travel_agenda
|
||||
* @property int|null $deposit_percent
|
||||
* @property int|null $netto_prices_in_euro
|
||||
* @property bool|null $netto_prices_in_euro
|
||||
* @property string|null $text_right
|
||||
* @property float|null $default_flight_price
|
||||
* @property int|null $travel_arrival_point_id
|
||||
|
|
@ -52,100 +56,202 @@ use Illuminate\Database\Eloquent\Model;
|
|||
* @property int|null $position
|
||||
* @property float|null $discount
|
||||
* @property int|null $discount_is_percent_value
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereAdvices($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereCategoryId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereClassDescription($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereCrmDraftIdComfort($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereCrmDraftIdStandard($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereDefaultFlightPrice($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereDepositPercent($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereDiscount($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereDiscountIsPercentValue($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereExcluded($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereGeneralnote($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereHtmlDescription($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereInSlider($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereIncluded($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereInsurance1($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereInsurance2($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereInsurance3($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereIsSeasonal($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereMapHtml($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereMapImage($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereMapImageExt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereMaxAgeForChildren($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereNettoPricesInEuro($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereNotes($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereOrganizer($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram wherePosition($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereProfitMargin($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereProgramCode($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereProgramDuration($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereProgramType($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereShowMap($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereSliderInfo($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereStatus($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereSubtitle($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereTextRight($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereTitle($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereTravelAgenda($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereTravelArrivalPointId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereTravelCategory($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereTravelCountry($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereUrl($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereWeekdays($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereYouth($value)
|
||||
* @mixin \Eloquent
|
||||
* @property \Illuminate\Support\Carbon|null $created_at
|
||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\TravelClass[] $classes
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereUpdatedAt($value)
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\TravelProgramDraft[] $travel_program_drafts
|
||||
* @property int|null $insurance_4
|
||||
* @property-read \App\Models\TravelProgramCountry $travel_program_country
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereInsurance4($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram query()
|
||||
* @property-read int|null $classes_count
|
||||
* @property-read int|null $travel_program_drafts_count
|
||||
* @property string|null $keywords
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereKeywords($value)
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
*
|
||||
* @property TravelArrivalPoint|null $travel_arrival_point
|
||||
* @property TravelOrganizer|null $travel_organizer
|
||||
* @property TravelInsurance|null $travel_insurance
|
||||
* @property TravelGeneralNote|null $travel_general_note
|
||||
* @property Option $option
|
||||
* @property Collection|TravelClass[] $travel_classes
|
||||
* @property Collection|TravelDeparturePoint[] $travel_departure_points
|
||||
* @property Collection|TravelPeriod[] $travel_periods
|
||||
* @property TravelProgramCountry $travel_program_country
|
||||
* @property TravelProgramDestination $travel_program_destination
|
||||
* @property Collection|TravelProgramDraft[] $travel_program_drafts
|
||||
* @property Collection|TravelProgramImage[] $travel_program_images
|
||||
* @property TravelProgramOption $travel_program_option
|
||||
* @property TravelProgramRelated $travel_program_related
|
||||
*
|
||||
* @package App\Models
|
||||
*/
|
||||
class TravelProgram extends Model
|
||||
{
|
||||
//use the connection to sec. Datebase sterntours
|
||||
protected $connection = 'mysql_stern';
|
||||
protected $connection = 'mysql_stern';
|
||||
|
||||
protected $table = 'travel_program';
|
||||
protected $table = 'travel_program';
|
||||
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'subtitle',
|
||||
'program_code',
|
||||
'weekdays',
|
||||
'keywords',
|
||||
'status',
|
||||
];
|
||||
protected $casts = [
|
||||
'profit_margin' => 'float',
|
||||
'category_id' => 'int',
|
||||
'program_duration' => 'int',
|
||||
'is_seasonal' => 'bool',
|
||||
'youth' => 'bool',
|
||||
'program_type' => 'int',
|
||||
'organizer' => 'int',
|
||||
'generalnote' => 'int',
|
||||
'status' => 'int',
|
||||
'max_age_for_children' => 'int',
|
||||
'insurance_1' => 'int',
|
||||
'insurance_2' => 'int',
|
||||
'insurance_3' => 'int',
|
||||
'insurance_4' => 'int',
|
||||
'in_slider' => 'bool',
|
||||
'show_map' => 'bool',
|
||||
'travel_country' => 'int',
|
||||
'travel_category' => 'int',
|
||||
'travel_agenda' => 'int',
|
||||
'travel_company' => 'int',
|
||||
'deposit_percent' => 'int',
|
||||
'netto_prices_in_euro' => 'bool',
|
||||
'default_flight_price' => 'float',
|
||||
'travel_arrival_point_id' => 'int',
|
||||
'position' => 'int',
|
||||
'discount' => 'float',
|
||||
'discount_is_percent_value' => 'int'
|
||||
];
|
||||
|
||||
public function classes()
|
||||
protected $fillable = [
|
||||
'profit_margin',
|
||||
'category_id',
|
||||
'program_code',
|
||||
'program_duration',
|
||||
'is_seasonal',
|
||||
'youth',
|
||||
'title',
|
||||
'subtitle',
|
||||
'slider_info',
|
||||
'program_type',
|
||||
'organizer',
|
||||
'generalnote',
|
||||
'status',
|
||||
'included',
|
||||
'class_description',
|
||||
'excluded',
|
||||
'advices',
|
||||
'notes',
|
||||
'url',
|
||||
'max_age_for_children',
|
||||
'html_description',
|
||||
'insurance_1',
|
||||
'insurance_2',
|
||||
'insurance_3',
|
||||
'insurance_4',
|
||||
'in_slider',
|
||||
'show_map',
|
||||
'map_html',
|
||||
'map_image',
|
||||
'map_image_ext',
|
||||
'travel_country',
|
||||
'travel_category',
|
||||
'travel_agenda',
|
||||
'travel_company',
|
||||
'deposit_percent',
|
||||
'netto_prices_in_euro',
|
||||
'text_right',
|
||||
'default_flight_price',
|
||||
'travel_arrival_point_id',
|
||||
'weekdays',
|
||||
'position',
|
||||
'discount',
|
||||
'discount_is_percent_value'
|
||||
];
|
||||
|
||||
public static $programTypeTypes = [
|
||||
0 => 'Eigenveranstaltung',
|
||||
1 => 'Vermittlung'
|
||||
];
|
||||
|
||||
public static $travelCategoryTypes = [
|
||||
1 => 'Ägypten-Reise',
|
||||
2 => 'Israel-Reise',
|
||||
3 => 'Jordanien-Reise',
|
||||
4 => 'Reise ohne Conversion-Code'
|
||||
];
|
||||
|
||||
public function travel_arrival_point()
|
||||
{
|
||||
return $this->belongsTo(TravelArrivalPoint::class);
|
||||
}
|
||||
|
||||
public function travel_organizer()
|
||||
{
|
||||
return $this->belongsTo(TravelOrganizer::class, 'organizer');
|
||||
}
|
||||
|
||||
public function travel_insurance()
|
||||
{
|
||||
return $this->belongsTo(TravelInsurance::class, 'insurance_3');
|
||||
}
|
||||
|
||||
public function travel_category()
|
||||
{
|
||||
return $this->belongsTo(TravelCategory::class, 'category_id');
|
||||
}
|
||||
|
||||
public function travel_general_note()
|
||||
{
|
||||
return $this->belongsTo(TravelGeneralNote::class, 'generalnote');
|
||||
}
|
||||
|
||||
public function option()
|
||||
{
|
||||
return $this->hasOne(Option::class, 'program_id');
|
||||
}
|
||||
|
||||
public function classes()
|
||||
{
|
||||
return $this->hasMany('App\Models\TravelClass', 'program_id', 'id');
|
||||
return $this->hasMany(TravelClass::class, 'program_id');
|
||||
}
|
||||
|
||||
public function travel_program_drafts()
|
||||
{
|
||||
return $this->hasMany('App\Models\TravelProgramDraft', 'travel_program_id', 'id');
|
||||
}
|
||||
|
||||
public function travel_program_country()
|
||||
{
|
||||
return $this->hasOne('App\Models\TravelProgramCountry', 'program_id', 'id');
|
||||
}
|
||||
public function travel_classes()
|
||||
{
|
||||
return $this->hasMany(TravelClass::class, 'program_id');
|
||||
}
|
||||
|
||||
public function hasTravelProgramDrafts (){
|
||||
public function travel_departure_points()
|
||||
{
|
||||
return $this->hasMany(TravelDeparturePoint::class, 'program_id');
|
||||
}
|
||||
|
||||
public function travel_periods()
|
||||
{
|
||||
return $this->hasMany(TravelPeriod::class, 'program_id');
|
||||
}
|
||||
|
||||
public function travel_program_country()
|
||||
{
|
||||
return $this->hasOne(TravelProgramCountry::class, 'program_id');
|
||||
}
|
||||
|
||||
public function travel_program_destination()
|
||||
{
|
||||
return $this->hasOne(TravelProgramDestination::class, 'program_id');
|
||||
}
|
||||
|
||||
public function travel_program_drafts()
|
||||
{
|
||||
return $this->hasMany(TravelProgramDraft::class);
|
||||
}
|
||||
|
||||
public function travel_program_images()
|
||||
{
|
||||
return $this->hasMany(TravelProgramImage::class, 'program_id');
|
||||
}
|
||||
|
||||
public function travel_program_option()
|
||||
{
|
||||
return $this->hasOne(TravelProgramOption::class, 'program_id');
|
||||
}
|
||||
|
||||
public function travel_program_related()
|
||||
{
|
||||
return $this->hasOne(TravelProgramRelated::class, 'program_2');
|
||||
}
|
||||
|
||||
public function hasTravelProgramDrafts (){
|
||||
if($this->travel_program_drafts->count()){
|
||||
return true;
|
||||
}
|
||||
|
|
@ -161,7 +267,7 @@ class TravelProgram extends Model
|
|||
return [];
|
||||
}
|
||||
|
||||
public function setWeekdaysFromArray($value){
|
||||
public function setWeekdaysFromArray($value){
|
||||
if($value){
|
||||
if(is_array($value)){
|
||||
if($value[0] === NULL){
|
||||
|
|
|
|||
|
|
@ -109,6 +109,27 @@ class TravelUser extends Model
|
|||
'last_user_data'
|
||||
];
|
||||
|
||||
public static $salutationType = [
|
||||
1 => 'Herr',
|
||||
2 => 'Frau',
|
||||
3 => 'Divers/keine Anrede',
|
||||
4 => 'Firma'
|
||||
];
|
||||
|
||||
public static $salutationNameType = [
|
||||
1 => 'Herr',
|
||||
2 => 'Frau',
|
||||
3 => '',
|
||||
4 => 'Firma'
|
||||
];
|
||||
|
||||
public static $salutationDearType = [
|
||||
1 => 'geehrter',
|
||||
2 => 'geehrte',
|
||||
3 => 'geehrte:r',
|
||||
4 => ''
|
||||
];
|
||||
|
||||
public function travel_nationality()
|
||||
{
|
||||
return $this->belongsTo(\App\Models\TravelNationality::class);
|
||||
|
|
@ -132,7 +153,15 @@ class TravelUser extends Model
|
|||
$this->attributes['birthday'] = isset($value) ? (new Carbon($value))->format('Y-m-d') : NULL;
|
||||
}
|
||||
|
||||
public function getSalutation(){
|
||||
return $this->salutation_id == 1 ? 'Herr' : 'Frau';
|
||||
public function getSalutation(){
|
||||
return isset(self::$salutationType[$this->salutation_id]) ? self::$salutationType[$this->salutation_id] : '';
|
||||
}
|
||||
|
||||
public function getSalutationName(){
|
||||
return isset(self::$salutationNameType[$this->salutation_id]) ? self::$salutationNameType[$this->salutation_id] : '';
|
||||
}
|
||||
|
||||
public function getSalutationDear(){
|
||||
return isset(self::$salutationDearType[$this->salutation_id]) ? self::$salutationDearType[$this->salutation_id] : '';
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -274,13 +274,13 @@ class TravelUserBookingFewo extends Model
|
|||
}
|
||||
|
||||
|
||||
public function getPersonsAttribute($value)
|
||||
public function getPersonsAttribute()
|
||||
{
|
||||
$this->attributes['persons'] = $this->adults + $this->children;
|
||||
return $this->attributes['persons'];
|
||||
}
|
||||
|
||||
public function setPersonsAttribute( $value ) {
|
||||
public function setPersonsAttribute($value) {
|
||||
|
||||
$this->attributes['persons'] = $this->adults + $this->children;
|
||||
|
||||
|
|
@ -321,10 +321,9 @@ class TravelUserBookingFewo extends Model
|
|||
return $ret;
|
||||
}
|
||||
|
||||
public function getBookingDateAttribute($value)
|
||||
public function getBookingDateAttribute()
|
||||
{
|
||||
if(!$value){ return ""; }
|
||||
return Carbon::parse($value)->format(Util::formatDateDB());
|
||||
return isset($this->attributes['booking_date']) ? Carbon::parse($this->attributes['booking_date'])->format(Util::formatDateDB()) : NULL;
|
||||
}
|
||||
|
||||
public function setBookingDateAttribute( $value ) {
|
||||
|
|
@ -332,10 +331,9 @@ class TravelUserBookingFewo extends Model
|
|||
}
|
||||
|
||||
//from_date
|
||||
public function getFromDateAttribute($value)
|
||||
public function getFromDateAttribute()
|
||||
{
|
||||
if(!$value){ return ""; }
|
||||
return Carbon::parse($value)->format(Util::formatDateDB());
|
||||
return isset($this->attributes['from_date']) ? Carbon::parse($this->attributes['from_date'])->format(Util::formatDateDB()) : NULL;
|
||||
}
|
||||
public function setFromDateAttribute( $value ) {
|
||||
$this->attributes['from_date'] = isset($value) ? (new Carbon($value))->format('Y-m-d') : NULL;
|
||||
|
|
@ -346,10 +344,9 @@ class TravelUserBookingFewo extends Model
|
|||
}
|
||||
|
||||
//to_date
|
||||
public function getToDateAttribute($value)
|
||||
public function getToDateAttribute()
|
||||
{
|
||||
if(!$value){ return ""; }
|
||||
return Carbon::parse($value)->format(Util::formatDateDB());
|
||||
return isset($this->attributes['to_date']) ? Carbon::parse($this->attributes['to_date'])->format(Util::formatDateDB()) : NULL;
|
||||
}
|
||||
public function setToDateAttribute( $value ) {
|
||||
$this->attributes['to_date'] = isset($value) ? (new Carbon($value))->format('Y-m-d') : NULL;
|
||||
|
|
@ -367,8 +364,7 @@ class TravelUserBookingFewo extends Model
|
|||
|
||||
public function getPriceTravelAttribute($value)
|
||||
{
|
||||
if(!$value){ return 0; }
|
||||
return number_format(($this->attributes['price_travel']), 2, ',', '.');
|
||||
return isset($this->attributes['price_travel']) ? number_format(($this->attributes['price_travel']), 2, ',', '.') : 0;
|
||||
}
|
||||
|
||||
public function getPriceTravelRaw()
|
||||
|
|
@ -399,8 +395,7 @@ class TravelUserBookingFewo extends Model
|
|||
}
|
||||
public function getPriceBalanceAttribute($value)
|
||||
{
|
||||
if(!$value){ return 0; }
|
||||
return number_format(($this->attributes['price_balance']), 2, ',', '.');
|
||||
return isset($this->attributes['price_balance']) ? number_format(($this->attributes['price_balance']), 2, ',', '.') : 0;
|
||||
}
|
||||
public function getPriceBalanceRaw()
|
||||
{
|
||||
|
|
@ -415,10 +410,10 @@ class TravelUserBookingFewo extends Model
|
|||
}
|
||||
public function getPriceTravelTotalAttribute($value)
|
||||
{
|
||||
if(!$value){
|
||||
if(!isset($this->attributes['price_travel_total']) || $this->attributes['price_travel_total'] == 0){
|
||||
$this->attributes['price_travel_total'] = $this->getPriceTravelRaw() + $this->getPriceBalanceRaw() + $this->getPriceExtraRaw();
|
||||
}
|
||||
return number_format(($this->attributes['price_travel_total']), 2, ',', '.');
|
||||
}
|
||||
return isset($this->attributes['price_travel_total']) ? number_format(($this->attributes['price_travel_total']), 2, ',', '.') : 0;
|
||||
}
|
||||
public function getPriceTravelTotalRaw()
|
||||
{
|
||||
|
|
@ -436,8 +431,7 @@ class TravelUserBookingFewo extends Model
|
|||
|
||||
public function getPriceDepositAttribute($value)
|
||||
{
|
||||
if(!$value){ return 0; }
|
||||
return number_format(($this->attributes['price_deposit']), 2, ',', '.');
|
||||
return isset($this->attributes['price_deposit']) ? number_format(($this->attributes['price_deposit']), 2, ',', '.') : 0;
|
||||
}
|
||||
|
||||
public function getPriceDepositRaw()
|
||||
|
|
@ -453,8 +447,7 @@ class TravelUserBookingFewo extends Model
|
|||
|
||||
public function getPriceServiceAttribute($value)
|
||||
{
|
||||
if(!$value){ return 0; }
|
||||
return number_format(($this->attributes['price_service']), 2, ',', '.');
|
||||
return isset($this->attributes['price_service']) ? number_format(($this->attributes['price_service']), 2, ',', '.') : 0;
|
||||
}
|
||||
|
||||
public function getPriceServiceRaw()
|
||||
|
|
@ -471,8 +464,7 @@ class TravelUserBookingFewo extends Model
|
|||
|
||||
public function getPriceTotalAttribute($value)
|
||||
{
|
||||
if(!$value){ return 0; }
|
||||
return number_format(($this->attributes['price_total']), 2, ',', '.');
|
||||
return isset($this->attributes['price_total']) ? number_format(($this->attributes['price_total']), 2, ',', '.') : 0;
|
||||
}
|
||||
|
||||
public function getPriceTotalRaw()
|
||||
|
|
@ -696,8 +688,12 @@ class TravelUserBookingFewo extends Model
|
|||
if($this->travel_user){
|
||||
if($this->travel_user->salutation_id == 1){
|
||||
$salutation = __('Dear Sir')." ".$this->travel_user->last_name;
|
||||
}else{
|
||||
$salutation = __('Dear Mrs')." ".$this->travel_user->last_name;
|
||||
}
|
||||
if($this->travel_user->salutation_id == 2){
|
||||
$salutation = __('Dear Sir')." ".$this->travel_user->last_name;
|
||||
}
|
||||
if($this->travel_user->salutation_id == 4){
|
||||
$salutation = __('Dear customer')." ".$this->travel_user->last_name;
|
||||
}
|
||||
}
|
||||
return $salutation;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue