23-01-2026
This commit is contained in:
parent
a939cd51ef
commit
a8b395e20d
248 changed files with 29342 additions and 4805 deletions
|
|
@ -123,17 +123,17 @@ class UserAbo extends Model
|
|||
];
|
||||
|
||||
public static $aboDeliveryDays = [5, 10, 20, 25];
|
||||
|
||||
|
||||
public static $statusTypes = [
|
||||
0 => 'abo_new',
|
||||
1 => 'abo_new',
|
||||
1 => 'abo_new',
|
||||
2 => 'abo_okay',
|
||||
3 => 'abo_hold',
|
||||
4 => 'abo_cancel',
|
||||
5 => 'abo_finish',
|
||||
6 => 'abo_inactive',
|
||||
7 => 'abo_grace'
|
||||
];
|
||||
];
|
||||
|
||||
public static $statusColors = [
|
||||
0 => 'success',
|
||||
|
|
@ -144,9 +144,9 @@ class UserAbo extends Model
|
|||
5 => 'info',
|
||||
6 => 'warning',
|
||||
7 => 'danger'
|
||||
];
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
public function user()
|
||||
{
|
||||
|
|
@ -159,9 +159,9 @@ class UserAbo extends Model
|
|||
}
|
||||
|
||||
public function shopping_user()
|
||||
{
|
||||
return $this->belongsTo('App\Models\ShoppingUser','shopping_user_id');
|
||||
}
|
||||
{
|
||||
return $this->belongsTo('App\Models\ShoppingUser', 'shopping_user_id');
|
||||
}
|
||||
|
||||
public function user_abo_orders()
|
||||
{
|
||||
|
|
@ -173,66 +173,80 @@ class UserAbo extends Model
|
|||
return $this->hasMany(UserAboItem::class);
|
||||
}
|
||||
|
||||
public function getCountOrders(){
|
||||
public function getCountOrders()
|
||||
{
|
||||
//sind bezahlte Bestellungen
|
||||
return $this->user_abo_orders->where('status', '>=', 2)->count();
|
||||
}
|
||||
|
||||
public function setStartDateAttribute( $value ) {
|
||||
$this->attributes['start_date'] = isset($value) ? (new Carbon($value))->format('Y-m-d') : NULL;
|
||||
}
|
||||
public function getCountPaidOrders()
|
||||
{
|
||||
//sind bezahlte Bestellungen
|
||||
return $this->user_abo_orders->where('status', '>=', 2)->where('paid', true)->count();
|
||||
}
|
||||
|
||||
public function setStartDateAttribute($value)
|
||||
{
|
||||
$this->attributes['start_date'] = isset($value) ? (new Carbon($value))->format('Y-m-d') : NULL;
|
||||
}
|
||||
public function getStartDateAttribute()
|
||||
{
|
||||
{
|
||||
return $this->attributes['start_date'] ? Carbon::parse($this->attributes['start_date'])->format(\Util::formatDateDB()) : '';
|
||||
}
|
||||
}
|
||||
|
||||
public function setLastDateAttribute( $value ) {
|
||||
$this->attributes['last_date'] = isset($value) ? (new Carbon($value))->format('Y-m-d') : NULL;
|
||||
}
|
||||
public function setLastDateAttribute($value)
|
||||
{
|
||||
$this->attributes['last_date'] = isset($value) ? (new Carbon($value))->format('Y-m-d') : NULL;
|
||||
}
|
||||
public function getLastDateAttribute()
|
||||
{
|
||||
{
|
||||
return $this->attributes['last_date'] ? Carbon::parse($this->attributes['last_date'])->format(\Util::formatDateDB()) : '';
|
||||
}
|
||||
}
|
||||
|
||||
public function setNextDateAttribute( $value ) {
|
||||
$this->attributes['next_date'] = isset($value) ? (new Carbon($value))->format('Y-m-d') : NULL;
|
||||
}
|
||||
public function setNextDateAttribute($value)
|
||||
{
|
||||
$this->attributes['next_date'] = isset($value) ? (new Carbon($value))->format('Y-m-d') : NULL;
|
||||
}
|
||||
public function getNextDateAttribute()
|
||||
{
|
||||
{
|
||||
return $this->attributes['next_date'] ? Carbon::parse($this->attributes['next_date'])->format(\Util::formatDateDB()) : '';
|
||||
}
|
||||
}
|
||||
|
||||
public function setCancelDateAttribute( $value ) {
|
||||
$this->attributes['cancel_date'] = isset($value) ? (new Carbon($value))->format('Y-m-d') : NULL;
|
||||
}
|
||||
public function setCancelDateAttribute($value)
|
||||
{
|
||||
$this->attributes['cancel_date'] = isset($value) ? (new Carbon($value))->format('Y-m-d') : NULL;
|
||||
}
|
||||
public function getCancelDateAttribute()
|
||||
{
|
||||
{
|
||||
return $this->attributes['cancel_date'] ? Carbon::parse($this->attributes['cancel_date'])->format(\Util::formatDateDB()) : '';
|
||||
}
|
||||
}
|
||||
|
||||
public function getFormattedAmount()
|
||||
{
|
||||
return isset($this->attributes['amount']) ? Util::formatNumber($this->attributes['amount']/100) : "";
|
||||
}
|
||||
{
|
||||
return isset($this->attributes['amount']) ? Util::formatNumber($this->attributes['amount'] / 100) : "";
|
||||
}
|
||||
public function getIsForFormated()
|
||||
{
|
||||
return $this->attributes['is_for'] === 'me' ? '<span class="badge badge-outline-warning-dark">'.__('tables.adviser').'</span>' : '<span class="badge badge-outline-info">'.__('tables.customer').'</span>';
|
||||
return $this->attributes['is_for'] === 'me' ? '<span class="badge badge-outline-warning-dark">' . __('tables.adviser') . '</span>' : '<span class="badge badge-outline-info">' . __('tables.customer') . '</span>';
|
||||
}
|
||||
|
||||
public function getStatusFormated(){
|
||||
return '<span class="badge badge-pill badge-'.$this->getStatusColor().'">'.$this->getStatusType().'</span>';
|
||||
public function getStatusFormated()
|
||||
{
|
||||
return '<span class="badge badge-pill badge-' . $this->getStatusColor() . '">' . $this->getStatusType() . '</span>';
|
||||
}
|
||||
|
||||
public function getStatusType(){
|
||||
return isset(self::$statusTypes[$this->status]) ? __('abo.'.self::$statusTypes[$this->status]) : "";
|
||||
}
|
||||
public function getStatusType()
|
||||
{
|
||||
return isset(self::$statusTypes[$this->status]) ? __('abo.' . self::$statusTypes[$this->status]) : "";
|
||||
}
|
||||
|
||||
public function getStatusColor(){
|
||||
return isset(self::$statusColors[$this->status]) ? self::$statusColors[$this->status] : "default";
|
||||
}
|
||||
public function getStatusColor()
|
||||
{
|
||||
return isset(self::$statusColors[$this->status]) ? self::$statusColors[$this->status] : "default";
|
||||
}
|
||||
|
||||
public function getPaymentType(){
|
||||
public function getPaymentType()
|
||||
{
|
||||
return $this->clearingtype === 'wlt' ? __('payment.paypal') : __('payment.credit_card');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue