Fewo Mails / Booking Country Services
This commit is contained in:
parent
b9c26d06d0
commit
48a6eb2282
154 changed files with 7761 additions and 1643 deletions
|
|
@ -287,11 +287,12 @@ class Booking extends Model
|
|||
2 => 'erledigt',
|
||||
];
|
||||
|
||||
public static $hold_types = [
|
||||
0 => '-',
|
||||
1 => 'eingetragen',
|
||||
];
|
||||
|
||||
public static $customer_mail_dirs = [
|
||||
0 => ['name' => 'Reisender', 'icon'=>'ion-ios-filing'],
|
||||
1 => ['name' => 'Agentur', 'icon'=>'ion-ios-folder-open'],
|
||||
2 => ['name' => 'Flug', 'icon'=>'ion-ios-airplane'],
|
||||
3 => ['name' => 'Versicherung', 'icon'=>'ion-ios-help-buoy'],
|
||||
11 => ['name' => 'Entwürfe', 'icon'=>'ion-md-create'],
|
||||
12 => ['name' => 'Papierkorb', 'icon'=>'ion-md-trash'],
|
||||
];
|
||||
|
|
@ -473,6 +474,23 @@ class Booking extends Model
|
|||
return $this->hasMany(BookingFile::class);
|
||||
}
|
||||
|
||||
public function booking_country_services()
|
||||
{
|
||||
return $this->hasMany(BookingCountryService::class, 'booking_id');
|
||||
}
|
||||
|
||||
public function booking_country_services_checked()
|
||||
{
|
||||
return $this->hasMany(BookingCountryService::class, 'booking_id')->where('status', '=', 0);
|
||||
}
|
||||
|
||||
public function hasBookingCountryServicesUnchecked(){
|
||||
if(!$this->booking_country_services->count() || $this->booking_country_services_checked->count() ||
|
||||
($this->booking_country_services->count() !== TravelCountryService::where('crm_travel_country_id', '=', $this->travel_country_id)->count())){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function calculate_price_total()
|
||||
{
|
||||
|
|
@ -740,13 +758,13 @@ class Booking extends Model
|
|||
return isset($this->xx_tkt_colors[$this->xx_tkt]) ? $this->xx_tkt_colors[$this->xx_tkt] : '-';
|
||||
}
|
||||
|
||||
public function countCustomerMailsBy($dir, $country=false){
|
||||
public function countCustomerMailsBy($dir, $subdir=false){
|
||||
|
||||
if($dir === 11){
|
||||
return $this->customer_mails->where('draft', true)->count();
|
||||
return $this->customer_mails->where('draft', true)->where('dir', '!=', 12)->count();
|
||||
}
|
||||
if($country){
|
||||
return $this->customer_mails->where('dir', $dir)->where('travel_country_id', $country)->count();
|
||||
if($subdir){
|
||||
return $this->customer_mails->where('dir', $dir)->where('subdir', $subdir)->count();
|
||||
}
|
||||
return $this->customer_mails->where('dir', $dir)->count();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue