Passolution
This commit is contained in:
parent
f79806ffe8
commit
06fc3ba919
31 changed files with 337 additions and 119 deletions
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Services\Passolution;
|
||||
use App\Services\Util;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
|
|
@ -245,6 +246,7 @@ class Booking extends Model
|
|||
'participant_firstname',
|
||||
'participant_birthdate',
|
||||
'participant_salutation_id',
|
||||
'nationality_id',
|
||||
'ev_number',
|
||||
'merlin_knr',
|
||||
'merlin_order_number',
|
||||
|
|
@ -335,6 +337,7 @@ class Booking extends Model
|
|||
2 => 'success',
|
||||
];
|
||||
|
||||
protected $passolutionPDFs = [];
|
||||
|
||||
/*public function branch()
|
||||
{
|
||||
|
|
@ -514,6 +517,11 @@ class Booking extends Model
|
|||
return $this->hasMany(BookingProviderService::class, 'booking_id')->where('status', '=', 0);
|
||||
}
|
||||
|
||||
public function travel_nationality()
|
||||
{
|
||||
return $this->belongsTo(TravelNationality::class, 'nationality_id');
|
||||
}
|
||||
|
||||
public function hasBookingServicesUnchecked(){
|
||||
$country_services = true;
|
||||
$provider_services = true;
|
||||
|
|
@ -537,6 +545,37 @@ class Booking extends Model
|
|||
return false;
|
||||
}
|
||||
|
||||
public function getPassolutionPDF($create = false){
|
||||
|
||||
$nats = [];
|
||||
|
||||
if(count($this->passolutionPDFs)){
|
||||
return $this->passolutionPDFs;
|
||||
}
|
||||
|
||||
$destco = $this->travel_country->destco;
|
||||
if($this->travel_nationality){
|
||||
$nats[$this->travel_nationality->nat] = $this->travel_nationality->nat;
|
||||
}
|
||||
if($this->participants->count()){
|
||||
foreach ($this->participants as $participant){
|
||||
if($participant->travel_nationality){
|
||||
$nats[$participant->travel_nationality->nat] = $participant->travel_nationality->nat;
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach ($nats as $nat){
|
||||
$data = [
|
||||
'nat' => $nat,
|
||||
'destco' => $destco,
|
||||
];
|
||||
|
||||
$passolution = new Passolution($data);
|
||||
$this->passolutionPDFs[] = $passolution->findOrCreatePDF($create);
|
||||
}
|
||||
return $this->passolutionPDFs;
|
||||
}
|
||||
|
||||
public function calculate_price_total()
|
||||
{
|
||||
$travel_draft_item = false;
|
||||
|
|
|
|||
|
|
@ -57,7 +57,8 @@ class Participant extends Model
|
|||
'participant_firstname',
|
||||
'participant_birthdate',
|
||||
'participant_salutation_id',
|
||||
'participant_child'
|
||||
'participant_child',
|
||||
'nationality_id'
|
||||
];
|
||||
|
||||
public function booking()
|
||||
|
|
@ -69,4 +70,9 @@ class Participant extends Model
|
|||
{
|
||||
return $this->belongsTo(Salutation::class, 'participant_salutation_id');
|
||||
}
|
||||
|
||||
public function travel_nationality()
|
||||
{
|
||||
return $this->belongsTo(TravelNationality::class, 'nationality_id');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue