Fewo Mails / Booking Country Services
This commit is contained in:
parent
b9c26d06d0
commit
48a6eb2282
154 changed files with 7761 additions and 1643 deletions
|
|
@ -98,6 +98,14 @@ use App\Services\Util;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelUserBookingFewo whereUpdatedAt($value)
|
||||
* @property string|null $last_change_at
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelUserBookingFewo whereLastChangeAt($value)
|
||||
* @property-read \App\Models\CustomerFewoMail|null $customer_fewo_mail_last
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\CustomerFewoMail[] $customer_fewo_mails
|
||||
* @property-read int|null $customer_fewo_mails_count
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\CustomerFewoMail[] $customer_fewo_mails_sent_at
|
||||
* @property-read int|null $customer_fewo_mails_sent_at_count
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\TravelUserBookingFile[] $booking_files
|
||||
* @property-read int|null $booking_files_count
|
||||
* @property-read \App\Models\TravelUser $customer
|
||||
*/
|
||||
class TravelUserBookingFewo extends Model
|
||||
{
|
||||
|
|
@ -182,6 +190,11 @@ class TravelUserBookingFewo extends Model
|
|||
'status_text'
|
||||
];
|
||||
|
||||
public static $customer_mail_dirs = [
|
||||
11 => ['name' => 'Entwürfe', 'icon'=>'ion-md-create'],
|
||||
12 => ['name' => 'Papierkorb', 'icon'=>'ion-md-trash'],
|
||||
];
|
||||
|
||||
public function fewo_lodging()
|
||||
{
|
||||
return $this->belongsTo(\App\Models\FewoLodging::class);
|
||||
|
|
@ -202,6 +215,31 @@ class TravelUserBookingFewo extends Model
|
|||
return $this->belongsTo(\App\Models\TravelUser::class);
|
||||
}
|
||||
|
||||
public function customer()
|
||||
{
|
||||
return $this->belongsTo(\App\Models\TravelUser::class, 'travel_user_id');
|
||||
}
|
||||
|
||||
public function booking_files()
|
||||
{
|
||||
return $this->hasMany(TravelUserBookingFile::class, 'travel_user_booking_fewo_id');
|
||||
}
|
||||
|
||||
public function customer_fewo_mails()
|
||||
{
|
||||
return $this->hasMany(CustomerFewoMail::class, 'travel_user_booking_fewo_id', 'id');
|
||||
}
|
||||
|
||||
public function customer_fewo_mails_sent_at()
|
||||
{
|
||||
return $this->hasMany(CustomerFewoMail::class, 'travel_user_booking_fewo_id')->orderBy('sent_at', 'ASC');
|
||||
}
|
||||
|
||||
public function customer_fewo_mail_last()
|
||||
{
|
||||
return $this->hasOne(CustomerFewoMail::class, 'travel_user_booking_fewo_id')->latest();
|
||||
}
|
||||
|
||||
public function getStatuesName(){
|
||||
if(isset(self::$statues[$this->status])){
|
||||
return self::$statues[$this->status];
|
||||
|
|
@ -693,6 +731,16 @@ class TravelUserBookingFewo extends Model
|
|||
return false;
|
||||
}
|
||||
|
||||
public function countCustomerMailsBy($dir, $subdir=false){
|
||||
if($dir === 11){
|
||||
return $this->customer_fewo_mails->where('draft', true)->where('dir', '!=', 12)->count();
|
||||
}
|
||||
if($subdir){
|
||||
return $this->customer_fewo_mails->where('dir', $dir)->where('subdir', $subdir)->count();
|
||||
}
|
||||
return $this->customer_fewo_mails->where('dir', $dir)->count();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue