API Shopping Order backend
This commit is contained in:
parent
7a040c3e19
commit
d01b4bd560
24 changed files with 1584 additions and 34 deletions
|
|
@ -81,7 +81,8 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrder whereTracking($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrder whereWpInvoicePath($value)
|
||||
* @property int|null $homeparty_id
|
||||
* @property array|null $wp_notice
|
||||
* @property array|null $api_notice
|
||||
* @property int|null $api_status
|
||||
* @property-read \App\Models\Homeparty|null $homeparty
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrder whereHomepartyId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrder whereWpNotice($value)
|
||||
|
|
@ -119,14 +120,15 @@ class ShoppingOrder extends Model
|
|||
'paid',
|
||||
'txaction',
|
||||
'wp_invoice_path',
|
||||
'wp_notice',
|
||||
'api_notice',
|
||||
'api_status',
|
||||
'mode',
|
||||
'shipped',
|
||||
'tracking'
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'wp_notice' => 'array',
|
||||
'api_notice' => 'array',
|
||||
'tax_split' => 'array',
|
||||
];
|
||||
|
||||
|
|
@ -146,6 +148,19 @@ class ShoppingOrder extends Model
|
|||
10 => 'cancel'
|
||||
];
|
||||
|
||||
|
||||
public static $apiStatusTypes = [
|
||||
0 => 'offen',
|
||||
1 => 'offen / pre',
|
||||
2 => 'bestellt',
|
||||
5 => 'entfernt',
|
||||
];
|
||||
public static $apiStatusColors = [
|
||||
0 => 'warning',
|
||||
1 => 'warning',
|
||||
2 => 'success',
|
||||
5 => 'danger',
|
||||
];
|
||||
public static $shippedColors = [
|
||||
0 => 'warning',
|
||||
1 => 'info',
|
||||
|
|
@ -295,6 +310,15 @@ class ShoppingOrder extends Model
|
|||
return isset(self::$shippedColors[$this->shipped]) ? self::$shippedColors[$this->shipped] : "default";
|
||||
}
|
||||
|
||||
public function getAPIStatusType(){
|
||||
return isset(self::$apiStatusTypes[$this->api_status]) ? self::$apiStatusTypes[$this->api_status] : "offen";
|
||||
}
|
||||
|
||||
public function getAPIStatusColor(){
|
||||
return isset(self::$apiStatusColors[$this->api_status]) ? self::$apiStatusColors[$this->api_status] : "warning";
|
||||
}
|
||||
|
||||
|
||||
public function getFormattedTotal()
|
||||
{
|
||||
return formatNumber($this->attributes['total']);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue