April 2026 waren Wirtschaft Feedback
This commit is contained in:
parent
02f2a4c23e
commit
9ce711d6b2
167 changed files with 25278 additions and 8518 deletions
|
|
@ -2,8 +2,11 @@
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use App\User;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
/**
|
||||
* App\Models\ShoppingOrder
|
||||
|
|
@ -22,16 +25,17 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
|||
* @property int|null $weight
|
||||
* @property int|null $paid
|
||||
* @property string|null $txaction
|
||||
* @property \Illuminate\Support\Carbon|null $created_at
|
||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||
* @property-read \App\User|null $auth_user
|
||||
* @property-read \App\Models\Country $country
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\ShoppingOrderItem[] $shopping_order_items
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
* @property-read User|null $auth_user
|
||||
* @property-read Country $country
|
||||
* @property-read Collection|ShoppingOrderItem[] $shopping_order_items
|
||||
* @property-read int|null $shopping_order_items_count
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\ShoppingPayment[] $shopping_payments
|
||||
* @property-read Collection|ShoppingPayment[] $shopping_payments
|
||||
* @property-read int|null $shopping_payments_count
|
||||
* @property-read \App\Models\ShoppingUser $shopping_user
|
||||
* @property-read \App\Models\UserShop $user_shop
|
||||
* @property-read ShoppingUser $shopping_user
|
||||
* @property-read UserShop $user_shop
|
||||
*
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrder newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrder newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrder query()
|
||||
|
|
@ -51,62 +55,93 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrder whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrder whereUserShopId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrder whereWeight($value)
|
||||
*
|
||||
* @property int|null $payment_for
|
||||
*
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrder wherePaymentFor($value)
|
||||
*
|
||||
* @property int|null $member_id
|
||||
* @property string|null $mode
|
||||
* @property-read \App\User|null $member
|
||||
* @property-read \App\Models\UserHistory|null $user_history
|
||||
* @property-read User|null $member
|
||||
* @property-read UserHistory|null $user_history
|
||||
*
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrder whereMemberId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrder whereMode($value)
|
||||
* @property \Illuminate\Support\Carbon|null $deleted_at
|
||||
*
|
||||
* @property Carbon|null $deleted_at
|
||||
* @property string|null $user_deleted_at
|
||||
*
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\Models\ShoppingOrder onlyTrashed()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrder whereDeletedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrder whereUserDeletedAt($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\Models\ShoppingOrder withTrashed()
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\Models\ShoppingOrder withoutTrashed()
|
||||
* @property-read \App\Models\ShippingCountry $shipping_country
|
||||
*
|
||||
* @property-read ShippingCountry $shipping_country
|
||||
* @property float|null $shipping_net
|
||||
* @property float|null $subtotal_shipping
|
||||
* @property int|null $points
|
||||
* @property int|null $shipped
|
||||
* @property string|null $tracking
|
||||
* @property string|null $wp_invoice_path
|
||||
*
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrder wherePoints($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrder whereShipped($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrder whereShippingNet($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrder whereSubtotalWs($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrder whereTracking($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrder whereWpInvoicePath($value)
|
||||
*
|
||||
* @property array|null $wp_notice
|
||||
*
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrder whereWpNotice($value)
|
||||
*
|
||||
* @property string|null $subtotal_full
|
||||
* @property-read \App\Models\ShoppingOrderMargin|null $shopping_order_margin
|
||||
* @property-read \App\Models\ShoppingPayment|null $shopping_payment_last
|
||||
* @property-read ShoppingOrderMargin|null $shopping_order_margin
|
||||
* @property-read ShoppingPayment|null $shopping_payment_last
|
||||
*
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrder whereSubtotalFull($value)
|
||||
*
|
||||
* @property string|null $discount
|
||||
* @property string|null $payment_credit
|
||||
*
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrder whereDiscount($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrder wherePaymentCredit($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrder whereSubtotalShipping($value)
|
||||
*
|
||||
* @property string|null $total_without_credit
|
||||
*
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrder whereTotalWithoutCredit($value)
|
||||
*
|
||||
* @property array|null $invoice
|
||||
* @property \Illuminate\Support\Carbon|null $shipped_at
|
||||
* @property Carbon|null $shipped_at
|
||||
*
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrder whereInvoice($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrder whereShippedAt($value)
|
||||
*
|
||||
* @property string|null $invoice_number
|
||||
*
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrder whereInvoiceNumber($value)
|
||||
*
|
||||
* @property int|null $promotion_user_id
|
||||
* @property string|null $shipping_option
|
||||
* @property-read \App\Models\PromotionUser|null $promotion_user
|
||||
* @property-read PromotionUser|null $promotion_user
|
||||
*
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrder wherePromotionUserId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrder whereShippingOption($value)
|
||||
*
|
||||
* @property array|null $delivery
|
||||
*
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrder whereDelivery($value)
|
||||
*
|
||||
* @property bool $user_white_label
|
||||
*
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|ShoppingOrder whereUserWhiteLabel($value)
|
||||
*
|
||||
* @property array<array-key, mixed>|null $cancellation_invoice
|
||||
*
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|ShoppingOrder whereCancellationInvoice($value)
|
||||
*
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class ShoppingOrder extends Model
|
||||
|
|
@ -114,6 +149,7 @@ class ShoppingOrder extends Model
|
|||
protected $table = 'shopping_orders';
|
||||
|
||||
use SoftDeletes;
|
||||
|
||||
protected $dates = ['deleted_at'];
|
||||
|
||||
protected $fillable = [
|
||||
|
|
@ -139,6 +175,7 @@ class ShoppingOrder extends Model
|
|||
'weight',
|
||||
'paid',
|
||||
'invoice',
|
||||
'cancellation_invoice',
|
||||
'delivery',
|
||||
'user_white_label',
|
||||
'invoice_number',
|
||||
|
|
@ -155,6 +192,7 @@ class ShoppingOrder extends Model
|
|||
protected $casts = [
|
||||
'wp_notice' => 'array',
|
||||
'invoice' => 'array',
|
||||
'cancellation_invoice' => 'array',
|
||||
'delivery' => 'array',
|
||||
'shipped_at' => 'datetime',
|
||||
'user_white_label' => 'boolean',
|
||||
|
|
@ -167,14 +205,14 @@ class ShoppingOrder extends Model
|
|||
3 => 'abgeschlossen',
|
||||
5 => 'Wartestellung',
|
||||
4 => 'Abholung',
|
||||
10 => 'storniert'
|
||||
10 => 'storniert',
|
||||
];
|
||||
|
||||
public static $paymentForTypes = [
|
||||
0 => '',
|
||||
1 => 'Registrierung',
|
||||
2 => 'Mitgliedschaft',
|
||||
3 => 'Guthabenaufladung', //guthaben
|
||||
3 => 'Guthabenaufladung', // guthaben
|
||||
4 => 'VP.Bestellung Abholung',
|
||||
5 => 'VP.Bestellung Lieferung',
|
||||
6 => 'VP.Kundenbestellung',
|
||||
|
|
@ -182,7 +220,7 @@ class ShoppingOrder extends Model
|
|||
8 => 'Shop',
|
||||
9 => '-',
|
||||
10 => 'extern',
|
||||
11 => ''
|
||||
11 => '',
|
||||
];
|
||||
|
||||
public static $paymentForColors = [
|
||||
|
|
@ -198,18 +236,17 @@ class ShoppingOrder extends Model
|
|||
8 => 'info',
|
||||
9 => 'default',
|
||||
10 => 'info',
|
||||
11 => 'default'
|
||||
11 => 'default',
|
||||
|
||||
];
|
||||
|
||||
|
||||
public static $apiShippedTypes = [
|
||||
0 => 'open', //(Fullfilment durch Händler)',
|
||||
1 => 'process', //(Fullfilment: nicht Versand)
|
||||
2 => 'sent', //(Fullfilment: Versand erfolgt)'
|
||||
3 => 'close', //(Fullfilment: Versand erfolgt)',
|
||||
4 => 'pick_up', //(Fullfilment: Versand erfolgt)',
|
||||
10 => 'cancel'
|
||||
0 => 'open', // (Fullfilment durch Händler)',
|
||||
1 => 'process', // (Fullfilment: nicht Versand)
|
||||
2 => 'sent', // (Fullfilment: Versand erfolgt)'
|
||||
3 => 'close', // (Fullfilment: Versand erfolgt)',
|
||||
4 => 'pick_up', // (Fullfilment: Versand erfolgt)',
|
||||
10 => 'cancel',
|
||||
];
|
||||
|
||||
public static $shippedColors = [
|
||||
|
|
@ -224,101 +261,126 @@ class ShoppingOrder 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 country()
|
||||
{
|
||||
return $this->belongsTo('App\Models\ShippingCountry','country_id');
|
||||
return $this->belongsTo('App\Models\ShippingCountry', 'country_id');
|
||||
}
|
||||
|
||||
public function shipping_country()
|
||||
{
|
||||
return $this->belongsTo('App\Models\ShippingCountry','country_id');
|
||||
return $this->belongsTo('App\Models\ShippingCountry', 'country_id');
|
||||
}
|
||||
|
||||
public function promotion_user()
|
||||
{
|
||||
return $this->belongsTo('App\Models\PromotionUser','promotion_user_id');
|
||||
return $this->belongsTo('App\Models\PromotionUser', 'promotion_user_id');
|
||||
}
|
||||
|
||||
public function user_shop()
|
||||
{
|
||||
return $this->belongsTo('App\Models\UserShop','user_shop_id');
|
||||
return $this->belongsTo('App\Models\UserShop', 'user_shop_id');
|
||||
}
|
||||
|
||||
//can null
|
||||
// can null
|
||||
public function member()
|
||||
{
|
||||
return $this->belongsTo('App\User','member_id');
|
||||
return $this->belongsTo('App\User', 'member_id');
|
||||
}
|
||||
//can null
|
||||
|
||||
// can null
|
||||
public function auth_user()
|
||||
{
|
||||
return $this->belongsTo('App\User','auth_user_id');
|
||||
return $this->belongsTo('App\User', 'auth_user_id');
|
||||
}
|
||||
|
||||
public function user_history()
|
||||
{
|
||||
return $this->hasOne('App\Models\UserHistory','shopping_order_id')->latest();
|
||||
return $this->hasOne('App\Models\UserHistory', 'shopping_order_id')->latest();
|
||||
}
|
||||
|
||||
public function shopping_order_margin()
|
||||
{
|
||||
return $this->hasOne('App\Models\ShoppingOrderMargin','shopping_order_id')->latest();
|
||||
return $this->hasOne('App\Models\ShoppingOrderMargin', 'shopping_order_id')->latest();
|
||||
}
|
||||
|
||||
public function shopping_order_items(){
|
||||
public function shopping_order_items()
|
||||
{
|
||||
return $this->hasMany('App\Models\ShoppingOrderItem', 'shopping_order_id');
|
||||
}
|
||||
|
||||
public function shopping_payments(){
|
||||
/**
|
||||
* Mindestens eine Bestellzeile mit White-Label-Produkt (Lieferschein mit Etikett-Infos).
|
||||
*/
|
||||
public function hasWhitelabelProducts(): bool
|
||||
{
|
||||
return $this->shopping_order_items()
|
||||
->whereHas('product', function ($query): void {
|
||||
$query->where('whitelabel', true);
|
||||
})
|
||||
->exists();
|
||||
}
|
||||
|
||||
public function shopping_payments()
|
||||
{
|
||||
return $this->hasMany('App\Models\ShoppingPayment', 'shopping_order_id');
|
||||
}
|
||||
|
||||
public function shopping_payment_last(){
|
||||
public function shopping_payment_last()
|
||||
{
|
||||
return $this->hasOne('App\Models\ShoppingPayment', 'shopping_order_id')->latest();
|
||||
}
|
||||
|
||||
public function setUserHistoryValue($values = []){
|
||||
if($user_history = $this->user_history){
|
||||
foreach ($values as $key=>$val){
|
||||
public function setUserHistoryValue($values = [])
|
||||
{
|
||||
if ($user_history = $this->user_history) {
|
||||
foreach ($values as $key => $val) {
|
||||
$user_history->{$key} = $val;
|
||||
}
|
||||
$user_history->save();
|
||||
}
|
||||
}
|
||||
|
||||
public function getLastShoppingPayment($key=false){
|
||||
public function getLastShoppingPayment($key = false)
|
||||
{
|
||||
$shopping_payment = $this->shopping_payments->last();
|
||||
if($shopping_payment){
|
||||
if($key === 'getPaymentType'){
|
||||
if ($shopping_payment) {
|
||||
if ($key === 'getPaymentType') {
|
||||
return $shopping_payment->getPaymentType();
|
||||
}
|
||||
if($key === 'reference'){
|
||||
if ($key === 'reference') {
|
||||
return $shopping_payment->reference;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
public function getShippedType(){
|
||||
return isset(self::$shippedTypes[$this->shipped]) ? self::$shippedTypes[$this->shipped] : "";
|
||||
public function getShippedType()
|
||||
{
|
||||
return isset(self::$shippedTypes[$this->shipped]) ? self::$shippedTypes[$this->shipped] : '';
|
||||
}
|
||||
|
||||
public function getAPIShippedType(){
|
||||
return isset(self::$apiShippedTypes[$this->shipped]) ? self::$apiShippedTypes[$this->shipped] : "free";
|
||||
public function getAPIShippedType()
|
||||
{
|
||||
return isset(self::$apiShippedTypes[$this->shipped]) ? self::$apiShippedTypes[$this->shipped] : 'free';
|
||||
}
|
||||
|
||||
public function getShippedColor(){
|
||||
return isset(self::$shippedColors[$this->shipped]) ? self::$shippedColors[$this->shipped] : "default";
|
||||
public function getShippedColor()
|
||||
{
|
||||
return isset(self::$shippedColors[$this->shipped]) ? self::$shippedColors[$this->shipped] : 'default';
|
||||
}
|
||||
|
||||
public function getPaymentForType(){
|
||||
return isset(self::$paymentForTypes[$this->payment_for]) ? self::$paymentForTypes[$this->payment_for] : "";
|
||||
public function getPaymentForType()
|
||||
{
|
||||
return isset(self::$paymentForTypes[$this->payment_for]) ? self::$paymentForTypes[$this->payment_for] : '';
|
||||
}
|
||||
public function getPaymentForColor(){
|
||||
return isset(self::$paymentForColors[$this->payment_for]) ? self::$paymentForColors[$this->payment_for] : "";
|
||||
|
||||
public function getPaymentForColor()
|
||||
{
|
||||
return isset(self::$paymentForColors[$this->payment_for]) ? self::$paymentForColors[$this->payment_for] : '';
|
||||
}
|
||||
|
||||
public function getFormattedTotal()
|
||||
|
|
@ -360,39 +422,46 @@ class ShoppingOrder extends Model
|
|||
{
|
||||
return formatNumber($this->attributes['tax']);
|
||||
}
|
||||
|
||||
public function getFormattedTotalWithoutCredit()
|
||||
{
|
||||
return formatNumber($this->attributes['total_without_credit']);
|
||||
}
|
||||
|
||||
public function getFormattedPaymentCredit()
|
||||
{
|
||||
return formatNumber($this->attributes['payment_credit']);
|
||||
}
|
||||
|
||||
public function getFormattedTotalShipping()
|
||||
{
|
||||
return formatNumber($this->attributes['total_shipping']);
|
||||
}
|
||||
|
||||
public function getItemsCount(){
|
||||
public function getItemsCount()
|
||||
{
|
||||
$count = 0;
|
||||
if($this->shopping_order_items){
|
||||
foreach ($this->shopping_order_items as $shopping_order_item){
|
||||
if ($this->shopping_order_items) {
|
||||
foreach ($this->shopping_order_items as $shopping_order_item) {
|
||||
$count += $shopping_order_item->qty;
|
||||
}
|
||||
}
|
||||
|
||||
return $count;
|
||||
}
|
||||
|
||||
public function isInvoice(){
|
||||
public function isInvoice()
|
||||
{
|
||||
return $this->user_invoice ? true : false;
|
||||
}
|
||||
|
||||
public function isPickUp(){
|
||||
public function isPickUp()
|
||||
{
|
||||
return $this->shipping_option === 'pick_up' ? true : false;
|
||||
}
|
||||
|
||||
public function isTax(){
|
||||
public function isTax()
|
||||
{
|
||||
return $this->tax > 0 ? true : false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue