Mail Weiterleitung / verlauf / Notizen Buchnungen
This commit is contained in:
parent
f1a1baa913
commit
644ec93c53
47 changed files with 663 additions and 59 deletions
|
|
@ -524,6 +524,11 @@ class Booking extends Model
|
|||
return $this->belongsTo(TravelNationality::class, 'nationality_id');
|
||||
}
|
||||
|
||||
public function booking_notices()
|
||||
{
|
||||
return $this->hasMany(BookingNotice::class, 'booking_id')->orderBy('created_at', 'DESC');
|
||||
}
|
||||
|
||||
public function hasBookingServicesUnchecked(){
|
||||
$country_services = true;
|
||||
$provider_services = true;
|
||||
|
|
@ -547,14 +552,18 @@ class Booking extends Model
|
|||
return false;
|
||||
}
|
||||
|
||||
public function getPassolutionPDF($create = false){
|
||||
public function getPassolutionPDF($create = false, $resync = false){
|
||||
|
||||
$nats = [];
|
||||
|
||||
if(count($this->passolutionPDFs)){
|
||||
return $this->passolutionPDFs;
|
||||
return $this->passolutionPDFs;
|
||||
}
|
||||
|
||||
if(!$this->travel_country){
|
||||
return $this->passolutionPDFs;
|
||||
}
|
||||
|
||||
$destco = $this->travel_country->destco;
|
||||
if($this->travel_nationality){
|
||||
$nats[$this->travel_nationality->nat] = $this->travel_nationality->nat;
|
||||
|
|
@ -566,6 +575,11 @@ class Booking extends Model
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(empty($nats)){
|
||||
$nats['de'] = 'de';
|
||||
}
|
||||
|
||||
foreach ($nats as $nat){
|
||||
$data = [
|
||||
'nat' => $nat,
|
||||
|
|
@ -573,11 +587,15 @@ class Booking extends Model
|
|||
];
|
||||
|
||||
$passolution = new Passolution($data);
|
||||
$this->passolutionPDFs[] = $passolution->findOrCreatePDF($create);
|
||||
$this->passolutionPDFs[] = $passolution->findOrCreatePDF($create, $resync);
|
||||
}
|
||||
return $this->passolutionPDFs;
|
||||
}
|
||||
|
||||
public function resyncPassolutionPDF(){
|
||||
return $this->getPassolutionPDF(true, true);
|
||||
}
|
||||
|
||||
public function calculate_price_total()
|
||||
{
|
||||
$travel_draft_item = false;
|
||||
|
|
|
|||
85
app/Models/BookingNotice.php
Normal file
85
app/Models/BookingNotice.php
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\User;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class BookingNotice
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $booking_id
|
||||
* @property int $from_user_id
|
||||
* @property int $to_user_id
|
||||
* @property string $message
|
||||
* @property bool $show
|
||||
* @property bool $important
|
||||
* @property Carbon $created_at
|
||||
* @property Carbon $updated_at
|
||||
*
|
||||
* @property Booking $booking
|
||||
* @property User $user
|
||||
*
|
||||
* @package App\Models
|
||||
*/
|
||||
class BookingNotice extends Model
|
||||
{
|
||||
protected $table = 'booking_notices';
|
||||
|
||||
protected $casts = [
|
||||
'booking_id' => 'int',
|
||||
'from_user_id' => 'int',
|
||||
'to_user_id' => 'int',
|
||||
'show' => 'bool',
|
||||
'important' => 'bool'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'booking_id',
|
||||
'from_user_id',
|
||||
'to_user_id',
|
||||
'message',
|
||||
'show',
|
||||
'important'
|
||||
];
|
||||
|
||||
public function booking()
|
||||
{
|
||||
return $this->belongsTo(Booking::class);
|
||||
}
|
||||
|
||||
public function to_user()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'to_user_id');
|
||||
}
|
||||
|
||||
public function from_user()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'from_user_id');
|
||||
}
|
||||
|
||||
public function getName(){
|
||||
if($this->from_user){
|
||||
if($this->from_user->sf_guard_user){
|
||||
return $this->from_user->sf_guard_user->first_name." ".$this->from_user->sf_guard_user->last_name;
|
||||
}else{
|
||||
$this->from_user->name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function getSmallerMessage($max = 500){
|
||||
|
||||
$ret = substr($this->message, 0, $max);
|
||||
if(strlen($this->message) > 500){
|
||||
$ret .= " ...";
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
|
|
@ -102,6 +102,7 @@ class CustomerFewoMail extends Model
|
|||
'send' => 'bool',
|
||||
'fail' => 'bool',
|
||||
'recipient' => 'array',
|
||||
'forward' => 'array',
|
||||
'cc' => 'array',
|
||||
'bcc' => 'array'
|
||||
];
|
||||
|
|
@ -131,6 +132,7 @@ class CustomerFewoMail extends Model
|
|||
'send',
|
||||
'fail',
|
||||
'error',
|
||||
'forward',
|
||||
'sent_at',
|
||||
'scheduled_at',
|
||||
'delivered_at'
|
||||
|
|
@ -204,4 +206,15 @@ class CustomerFewoMail extends Model
|
|||
if(!$this->attributes['created_at']){ return ""; }
|
||||
return Carbon::parse($this->attributes['created_at'])->format(\Util::formatDateTimeDB());
|
||||
}
|
||||
public function setForwardMessage($forward = [])
|
||||
{
|
||||
if($forward && is_array($forward)){
|
||||
if(isset($this->forward) && $this->forward){
|
||||
$this->forward = array_merge($this->forward , $forward);
|
||||
}else{
|
||||
$this->forward = $forward;
|
||||
}
|
||||
$this->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -105,6 +105,7 @@ class CustomerMail extends Model
|
|||
'send' => 'bool',
|
||||
'fail' => 'bool',
|
||||
'recipient' => 'array',
|
||||
'forward' => 'array',
|
||||
'cc' => 'array',
|
||||
'bcc' => 'array'
|
||||
];
|
||||
|
|
@ -135,6 +136,7 @@ class CustomerMail extends Model
|
|||
'send',
|
||||
'fail',
|
||||
'error',
|
||||
'forward',
|
||||
'sent_at',
|
||||
'scheduled_at',
|
||||
'delivered_at'
|
||||
|
|
@ -188,4 +190,23 @@ class CustomerMail extends Model
|
|||
if(!$this->attributes['created_at']){ return ""; }
|
||||
return Carbon::parse($this->attributes['created_at'])->format(\Util::formatDateTimeDB());
|
||||
}
|
||||
|
||||
public function customer_mail_deep($deep = 0){
|
||||
|
||||
if($this->customer_mail){
|
||||
$deep = $this->customer_mail->customer_mail_deep(++$deep);
|
||||
}
|
||||
return $deep;
|
||||
}
|
||||
public function setForwardMessage($forward = [])
|
||||
{
|
||||
if($forward && is_array($forward)){
|
||||
if(isset($this->forward) && $this->forward){
|
||||
$this->forward = array_merge($this->forward , $forward);
|
||||
}else{
|
||||
$this->forward = $forward;
|
||||
}
|
||||
$this->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use App\User;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
|
||||
|
|
@ -59,4 +60,9 @@ class SfGuardUser extends Model
|
|||
|
||||
protected $table = 'sf_guard_user';
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'user_id');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue