User Order all Margins / Checkout

This commit is contained in:
Kevin Adametz 2021-01-22 15:54:51 +01:00
parent a96d7d5c77
commit 224bf9e951
92 changed files with 3551 additions and 561 deletions

View file

@ -69,7 +69,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* @method static \Illuminate\Database\Query\Builder|\App\Models\ShoppingOrder withoutTrashed()
* @property-read \App\Models\ShippingCountry $shipping_country
* @property float|null $shipping_net
* @property float|null $subtotal_ws
* @property float|null $subtotal_shipping
* @property int|null $points
* @property int|null $shipped
* @property string|null $tracking
@ -82,6 +82,15 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* @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
* @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)
*/
class ShoppingOrder extends Model
{
@ -97,11 +106,15 @@ class ShoppingOrder extends Model
'country_id',
'user_shop_id',
'total',
'subtotal_full',
'discount',
'subtotal',
'shipping',
'shipping_net',
'subtotal_ws',
'subtotal_shipping',
'tax',
'total_without_credit',
'payment_credit',
'total_shipping',
'points',
'weight',
@ -176,6 +189,10 @@ class ShoppingOrder extends Model
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();
}
public function shopping_order_items(){
return $this->hasMany('App\Models\ShoppingOrderItem', 'shopping_order_id');
@ -228,11 +245,21 @@ class ShoppingOrder extends Model
return formatNumber($this->attributes['total']);
}
public function getFormattedSubtotalFull()
{
return formatNumber($this->attributes['subtotal_full']);
}
public function getFormattedSubtotal()
{
return formatNumber($this->attributes['subtotal']);
}
public function getFormattedDiscount()
{
return formatNumber($this->attributes['discount']);
}
public function getFormattedShipping()
{
return formatNumber($this->attributes['shipping']);
@ -243,15 +270,24 @@ class ShoppingOrder extends Model
return formatNumber($this->attributes['shipping_net']);
}
public function getFormattedSubtotalWs()
public function getFormattedSubtotalShipping()
{
return formatNumber($this->attributes['subtotal_ws']);
return formatNumber($this->attributes['subtotal_shipping']);
}
public function getFormattedTax()
{
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()
{