This commit is contained in:
Kevin Adametz 2021-02-10 10:56:40 +01:00
parent 32595ab5a1
commit 13fb2cfe98
70 changed files with 3614 additions and 401 deletions

View file

@ -71,7 +71,7 @@ class ShippingPrice extends Model
$this->attributes['factor'] = $value ? Util::reFormatNumber($value) : null;
}
public function setTaxAttribute($value)
public function setTaxRateAttribute($value)
{
$this->attributes['tax_rate'] = $value ? Util::reFormatNumber($value) : null;
}

View file

@ -107,28 +107,41 @@ class ShoppingOrder extends Model
'paid',
'txaction',
'wp_invoice_path',
'wp_notice',
'mode',
'shipped',
'tracking'
];
protected $casts = [
'wp_notice' => 'array',
];
public static $shippedTypes = [
0 => 'offen',
1 => 'versendet',
2 => 'abgeschlossen',
4 => 'In Bearbeitung',
1 => 'in Bearbeitung',
2 => 'versendet',
3 => 'abgeschlossen',
10 => 'storniert'
];
50 => 'storiniert'
public static $apiShippedTypes = [
0 => 'open', //(Fullfilment durch Händler)',
1 => 'process', //(Fullfilment durch MIVITA: nicht Versand)
2 => 'sent', //(Fullfilment durch MIVITA: Versand erfolgt)'
3 => 'close', //(Fullfilment durch MIVITA: Versand erfolgt)',
10 => 'cancel'
];
public static $shippedColors = [
0 => 'warning',
1 => 'success',
1 => 'info',
2 => 'success',
4 => 'info',
50 => 'danger',
3 => 'secondary',
10 => 'danger',
];
public function shopping_user()
{
return $this->belongsTo('App\Models\ShoppingUser','shopping_user_id');
@ -205,6 +218,10 @@ class ShoppingOrder extends Model
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 getShippedColor(){
return isset(self::$shippedColors[$this->shipped]) ? self::$shippedColors[$this->shipped] : "default";
}

View file

@ -176,6 +176,8 @@ class ShoppingUser extends Model
'wp_order_number' => 'int',
];
//can null
public function member()
{
@ -243,4 +245,11 @@ class ShoppingUser extends Model
}
return $this;
}
public function getAPIShippedType() {
if($this->shopping_order){
return $this->shopping_order->getAPIShippedType();
}
return "free";
}
}