Report Strono-Date, Booking+Fewo Notice, Custom Mail opti

This commit is contained in:
Kevin Adametz 2021-04-23 14:55:48 +02:00
parent 644ec93c53
commit 5d55e5be3f
35 changed files with 581 additions and 41 deletions

View file

View file

@ -176,6 +176,13 @@ use Illuminate\Database\Eloquent\Model;
* @property-read int|null $booking_provider_services_count
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\BookingProviderService[] $booking_provider_services_checked
* @property-read int|null $booking_provider_services_checked_count
* @property bool|null $comfort
* @property int|null $nationality_id
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\BookingNotice[] $booking_notices
* @property-read int|null $booking_notices_count
* @property-read \App\Models\TravelNationality|null $travel_nationality
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereComfort($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereNationalityId($value)
*/
class Booking extends Model
{
@ -529,6 +536,11 @@ class Booking extends Model
return $this->hasMany(BookingNotice::class, 'booking_id')->orderBy('created_at', 'DESC');
}
public function booking_strono()
{
return $this->hasOne(BookingStorno::class);
}
public function hasBookingServicesUnchecked(){
$country_services = true;
$provider_services = true;

View file

@ -12,7 +12,7 @@ use Illuminate\Database\Eloquent\Model;
/**
* Class BookingNotice
*
*
* @property int $id
* @property int $booking_id
* @property int $from_user_id
@ -20,13 +20,28 @@ use Illuminate\Database\Eloquent\Model;
* @property string $message
* @property bool $show
* @property bool $important
* @property Carbon $edit_at
* @property Carbon $created_at
* @property Carbon $updated_at
*
* @property Booking $booking
* @property User $user
*
* @package App\Models
* @property-read \App\User $from_user
* @property-read \App\User|null $to_user
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingNotice newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingNotice newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingNotice query()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingNotice whereBookingId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingNotice whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingNotice whereEditAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingNotice whereFromUserId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingNotice whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingNotice whereImportant($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingNotice whereMessage($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingNotice whereShow($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingNotice whereToUserId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingNotice whereUpdatedAt($value)
* @mixin \Eloquent
*/
class BookingNotice extends Model
{
@ -40,13 +55,18 @@ class BookingNotice extends Model
'important' => 'bool'
];
protected $dates = [
'edit_at',
];
protected $fillable = [
'booking_id',
'from_user_id',
'to_user_id',
'message',
'show',
'important'
'important',
'edit_at'
];
public function booking()

View file

@ -36,6 +36,8 @@ use Illuminate\Database\Eloquent\Model;
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingStorno whereTotal($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingStorno whereUpdatedAt($value)
* @mixin \Eloquent
* @property \Illuminate\Support\Carbon|null $storno_print
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingStorno whereStornoPrint($value)
*/
class BookingStorno extends Model
{
@ -49,7 +51,8 @@ class BookingStorno extends Model
];
protected $dates = [
'storno_date'
'storno_date',
'storno_print'
];
protected $fillable = [
@ -57,6 +60,7 @@ class BookingStorno extends Model
'total',
'storno',
'storno_date',
'storno_print',
'binary_data',
'done'
];

View file

@ -81,6 +81,8 @@ use Illuminate\Database\Eloquent\Model;
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerFewoMail whereDeletedAt($value)
* @method static \Illuminate\Database\Query\Builder|\App\Models\CustomerFewoMail withTrashed()
* @method static \Illuminate\Database\Query\Builder|\App\Models\CustomerFewoMail withoutTrashed()
* @property array|null $forward
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerFewoMail whereForward($value)
*/
class CustomerFewoMail extends Model
{

View file

@ -77,6 +77,8 @@ use Illuminate\Database\Eloquent\Model;
* @mixin \Eloquent
* @property int|null $subdir
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail whereSubdir($value)
* @property array|null $forward
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail whereForward($value)
*/
class CustomerMail extends Model
{

View file

@ -33,6 +33,9 @@ use Illuminate\Database\Eloquent\Model;
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Participant whereParticipantName($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Participant whereParticipantSalutationId($value)
* @mixin \Eloquent
* @property int|null $nationality_id
* @property-read \App\Models\TravelNationality|null $travel_nationality
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Participant whereNationalityId($value)
*/
class Participant extends Model
{

View file

@ -53,6 +53,7 @@ use Illuminate\Database\Eloquent\Model;
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SfGuardUser newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SfGuardUser newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SfGuardUser query()
* @property-read \App\User|null $user
*/
class SfGuardUser extends Model
{

View file

@ -49,6 +49,8 @@ use Illuminate\Database\Eloquent\Model;
* @property-read \App\Models\TravelCountry|null $stern_travel_country
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\TravelCountryService[] $travel_country_services
* @property-read int|null $travel_country_services_count
* @property string|null $destco
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Sym\TravelCountry whereDestco($value)
*/
class TravelCountry extends Model
{

View file

@ -69,6 +69,8 @@ use Illuminate\Support\Str;
* @property-read \App\Models\Sym\TravelCountry|null $crm_travel_country
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\TravelCountryService[] $travel_country_services
* @property-read int|null $travel_country_services_count
* @property string|null $destco
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelCountry whereDestco($value)
*/
class TravelCountry extends Model
{

View file

@ -17,6 +17,8 @@ use Illuminate\Database\Eloquent\Model;
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelNationality newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelNationality newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelNationality query()
* @property string|null $nat
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelNationality whereNat($value)
*/
class TravelNationality extends Model
{

View file

@ -251,6 +251,11 @@ class TravelUserBookingFewo extends Model
return $this->hasOne(CustomerFewoMail::class, 'travel_user_booking_fewo_id')->latest();
}
public function booking_fewo_notices()
{
return $this->hasMany(TravelUserBookingFewoNotice::class, 'travel_user_booking_fewo_id')->orderBy('created_at', 'DESC');
}
public function getStatuesName(){
if(isset(self::$statues[$this->status])){
return self::$statues[$this->status];

View file

@ -0,0 +1,92 @@
<?php
/**
* Created by Reliese Model.
*/
namespace App\Models;
use App\User;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
/**
* Class TravelUserBookingFewoNotice
*
* @property int $id
* @property int $travel_user_booking_fewo_id
* @property int $from_user_id
* @property int $to_user_id
* @property string $message
* @property bool $show
* @property bool $important
* @property Carbon $edit_at
* @property Carbon $created_at
* @property Carbon $updated_at
*
* @property TravelUserBookingFewo $travel_user_booking_fewo
*
* @package App\Models
*/
class TravelUserBookingFewoNotice extends Model
{
protected $connection = 'mysql_stern';
protected $table = 'travel_user_booking_fewo_notices';
protected $casts = [
'travel_user_booking_fewo_id' => 'int',
'from_user_id' => 'int',
'to_user_id' => 'int',
'show' => 'bool',
'important' => 'bool'
];
protected $dates = [
'edit_at'
];
protected $fillable = [
'travel_user_booking_fewo_id',
'from_user_id',
'to_user_id',
'message',
'show',
'important',
'edit_at'
];
public function travel_user_booking_fewo()
{
return $this->belongsTo(TravelUserBookingFewo::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;
}
}