08 2024
This commit is contained in:
parent
c1c613a4b9
commit
881fc84207
384 changed files with 50679 additions and 990 deletions
|
|
@ -203,6 +203,7 @@ class Booking extends Model
|
|||
'new_drafts' => 'bool',
|
||||
'sf_guard_user_id' => 'int',
|
||||
'branch_id' => 'int',
|
||||
'airport_id' => 'int',
|
||||
'service_fee' => 'float',
|
||||
'travel_country_id' => 'int',
|
||||
'travel_category_id' => 'int',
|
||||
|
|
@ -282,6 +283,7 @@ class Booking extends Model
|
|||
'paying_out',
|
||||
'paying_out_status',
|
||||
//'airline_id',
|
||||
'airport_id',
|
||||
'airline_ids',
|
||||
'refund',
|
||||
'refund_date',
|
||||
|
|
@ -400,6 +402,11 @@ class Booking extends Model
|
|||
return $this->belongsTo(TravelCompany::class);
|
||||
}
|
||||
|
||||
public function airport()
|
||||
{
|
||||
return $this->belongsTo(Airport::class, 'airport_id');
|
||||
}
|
||||
|
||||
/* public function travel_country()
|
||||
{
|
||||
return $this->belongsTo(TravelCountry::class, 'travel_country_id', 'crm_id');
|
||||
|
|
@ -460,6 +467,11 @@ class Booking extends Model
|
|||
return $this->hasMany(Participant::class);
|
||||
}
|
||||
|
||||
public function participant_salutation()
|
||||
{
|
||||
return $this->belongsTo(Salutation::class, 'participant_salutation_id');
|
||||
}
|
||||
|
||||
public function service_provider_entries()
|
||||
{
|
||||
return $this->hasMany(ServiceProviderEntry::class);
|
||||
|
|
@ -471,6 +483,11 @@ class Booking extends Model
|
|||
return $this->hasMany(CustomerMail::class, 'booking_id', 'id');
|
||||
}
|
||||
|
||||
public function customer_mails_reverse()
|
||||
{
|
||||
return $this->hasMany(CustomerMail::class, 'booking_id', 'id')->orderBy('id', 'DESC');
|
||||
}
|
||||
|
||||
public function customer_mails_sent_at()
|
||||
{
|
||||
return $this->hasMany(CustomerMail::class, 'booking_id')->orderBy('sent_at', 'ASC');
|
||||
|
|
@ -521,6 +538,11 @@ class Booking extends Model
|
|||
return $this->hasMany(BookingFile::class);
|
||||
}
|
||||
|
||||
public function booking_documents()
|
||||
{
|
||||
return $this->hasMany(BookingDocument::class, 'booking_id');
|
||||
}
|
||||
|
||||
public function booking_country_services()
|
||||
{
|
||||
return $this->hasMany(BookingCountryService::class, 'booking_id');
|
||||
|
|
@ -991,4 +1013,31 @@ class Booking extends Model
|
|||
}
|
||||
return $this->customer_mails->where('dir', $dir)->count();
|
||||
}
|
||||
|
||||
/*DOCUMENTS*/
|
||||
|
||||
public function hasDocument($identifier){
|
||||
return $this->booking_documents->where('identifier', $identifier)->count() ? true : false;
|
||||
}
|
||||
|
||||
public function getDocument($identifier){
|
||||
return $this->booking_documents->where('identifier', $identifier)->first();
|
||||
|
||||
}
|
||||
|
||||
public function isDepositPossible($maxIntervalDays = false)
|
||||
{
|
||||
$maxIntervalDays = $maxIntervalDays ? $maxIntervalDays : config('booking.max_interval_days');
|
||||
$diffInDays = $this->booking_date->diffInDays($this->start_date, false);
|
||||
return $diffInDays > $maxIntervalDays;
|
||||
}
|
||||
|
||||
public function getConfirmationDeposit($percentageRate = false){
|
||||
$percentageRate = $percentageRate ? $percentageRate : config('booking.deposit_percentage_rate');
|
||||
return ($this->isDepositPossible() ? round($this->getPriceRaw() * $percentageRate / 100) : 0);
|
||||
}
|
||||
|
||||
public function getConfirmationFinalPayment(){
|
||||
return $this->getPriceRaw() - $this->getConfirmationDeposit();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue