Mails, Strono, filter

This commit is contained in:
Kevin Adametz 2020-03-26 09:48:19 +01:00
parent f53f17f9c1
commit 62e84637b6
99 changed files with 2409 additions and 474 deletions

View file

@ -142,15 +142,20 @@ class Booking extends Model
'price_total' => 'float',
'deposit_total' => 'float',
'final_payment' => 'float',
'travelagenda_id' => 'int'
];
'travelagenda_id' => 'int',
'paying_out' => 'int',
'refund' => 'int',
'xx_tkt' => 'int',
];
protected $dates = [
'booking_date',
'start_date',
'end_date',
'participant_birthdate',
'final_payment_date'
'final_payment_date',
'refund_date'
];
protected $fillable = [
@ -184,9 +189,69 @@ class Booking extends Model
'deposit_total',
'final_payment',
'final_payment_date',
'travelagenda_id'
'travelagenda_id',
'paying_out',
'paying_out_status',
'refund',
'refund_date',
'xx_tkt',
'xx_tkt_date',
];
public static $paying_out_types = [
0 => '-',
1 => 'Gutschein',
2 => 'Auszahlung',
3 => 'Umbuchung',
4 => 'AZ + GS',
5 => 'AZ o. FP',
];
public static $refund_types = [
0 => '-',
1 => 'eingereicht',
2 => 'erledigt',
];
public static $xx_tkt_types = [
0 => '-',
1 => 'offen',
2 => 'erledigt',
];
public static $paying_out_status_types = [
0 => '-',
1 => 'offen',
2 => 'erledigt',
];
protected $paying_out_colors = [
0 => '',
1 => 'info',
2 => 'dark',
3 => 'warning',
4 => 'warning',
5 => 'warning',
];
protected $refund_colors = [
0 => '',
1 => 'warning',
2 => 'success',
];
protected $xx_tkt_colors = [
0 => '',
1 => 'danger',
2 => 'success',
];
protected $paying_out_status_colors = [
0 => '',
1 => 'danger',
2 => 'success',
];
/*public function branch()
{
return $this->belongsTo(Branch::class);
@ -297,6 +362,17 @@ class Booking extends Model
{
return $this->hasMany(ServiceProviderEntry::class);
}
public function customer_mails()
{
return $this->hasMany(CustomerMail::class, 'booking_id', 'id');
}
public function customer_mails_sent_at()
{
return $this->hasMany(CustomerMail::class, 'booking_id')->orderBy('sent_at', 'ASC');
}
/*
public function travel_insurances()
{
@ -437,4 +513,57 @@ class Booking extends Model
return $this->ev_number;
}
public function getPayingOutType(){
return isset(self::$paying_out_types[$this->paying_out]) ? self::$paying_out_types[$this->paying_out] : '-';
}
public function getPayingOutStatusType(){
return isset(self::$paying_out_status_types[$this->paying_out_status]) ? self::$paying_out_status_types[$this->paying_out_status] : '-';
}
public function getRefundType(){
return isset(self::$refund_types[$this->refund]) ? self::$refund_types[$this->refund] : '-';
}
public function getXxTktType(){
return isset(self::$xx_tkt_types[$this->xx_tkt]) ? self::$xx_tkt_types[$this->xx_tkt] : '-';
}
public function getXxTktTypeList(){
if(isset(self::$xx_tkt_types[$this->xx_tkt])){
if($this->xx_tkt == 1 && $this->xx_tkt_date){
return Carbon::parse($this->xx_tkt_date)->format('d.m.Y');
}
return self::$xx_tkt_types[$this->xx_tkt];
}
return "-";
}
public function getRefundTypeList(){
if(isset(self::$refund_types[$this->refund])){
if($this->refund == 1 && $this->refund_date){
return Carbon::parse($this->refund_date)->format('d.m.Y');
}
return self::$refund_types[$this->refund];
}
return "-";
}
public function getPayingOutColor(){
return isset($this->paying_out_colors[$this->paying_out]) ? $this->paying_out_colors[$this->paying_out] : '';
}
public function getPayingOutStatusColor(){
return isset($this->paying_out_status_colors[$this->paying_out_status]) ? $this->paying_out_status_colors[$this->paying_out_status] : '';
}
public function getRefundColor(){
return isset($this->refund_colors[$this->refund]) ? $this->refund_colors[$this->refund] : '-';
}
public function getXxTktColor(){
return isset($this->xx_tkt_colors[$this->xx_tkt]) ? $this->xx_tkt_colors[$this->xx_tkt] : '-';
}
}