This commit is contained in:
Kevin Adametz 2024-08-05 12:05:24 +02:00
parent 04d677d37a
commit bfa3bb1df4
1191 changed files with 637397 additions and 10619 deletions

View file

@ -95,6 +95,8 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* @property-read \App\Models\ShoppingCollectOrder|null $shopping_collect_order
* @property array|null $net_split
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrder whereNetSplit($value)
* @property string|null $language
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrder whereLanguage($value)
* @mixin \Eloquent
*/
class ShoppingOrder extends Model
@ -111,6 +113,7 @@ class ShoppingOrder extends Model
'homeparty_id',
'payment_for',
'country_id',
'language',
'user_shop_id',
'total',
'subtotal',
@ -124,6 +127,8 @@ class ShoppingOrder extends Model
'points',
'weight',
'paid',
'is_abo',
'abo_interval',
'txaction',
'wp_invoice_path',
'api_notice',
@ -137,15 +142,17 @@ class ShoppingOrder extends Model
'api_notice' => 'array',
'tax_split' => 'array',
'net_split' => 'array',
'abo_interval' => 'int',
'is_abo' => 'bool',
];
public static $shippedTypes = [
0 => 'offen',
1 => 'in Bearbeitung',
2 => 'versendet',
3 => 'abgeschlossen',
10 => 'storniert'
0 => 'open',
1 => 'in_process',
2 => 'shipped',
3 => 'completed',
4 => 'trade_fair',
10 => 'cancelled'
];
public static $apiShippedTypes = [
@ -153,14 +160,15 @@ class ShoppingOrder extends Model
1 => 'process', //(Fullfilment durch MIVITA: nicht Versand)
2 => 'sent', //(Fullfilment durch MIVITA: Versand erfolgt)'
3 => 'close', //(Fullfilment durch MIVITA: Versand erfolgt)',
4 => 'trade', //(Fullfilment durch MIVITA: Versand erfolgt)',
10 => 'cancel'
];
public static $apiStatusTypes = [
0 => 'bestellt',
1 => 'im Prozess',
2 => 'bezahlt',
5 => 'entfernt',
0 => 'ordered',
1 => 'in_process',
2 => 'paid',
5 => 'removed',
];
public static $apiStatusColors = [
0 => 'warning',
@ -173,19 +181,20 @@ class ShoppingOrder extends Model
1 => 'info',
2 => 'success',
3 => 'secondary',
4 => 'secondary',
10 => 'danger',
];
public static $paymentForTypes = [
0 => '',
1 => 'Registrierung',
2 => 'Mitgliedschaft',
3 => 'Bestellung',
4 => 'Kundenbestellung',
5 => 'Homeparty',
6 => 'Shop',
7 => 'extern',
8 => 'Sammelrechnung',
1 => 'registration',
2 => 'membership',
3 => 'order',
4 => 'customer_order',
5 => 'homeparty',
6 => 'shop',
7 => 'external',
8 => 'collective_invoice',
10 => '',
];
@ -273,7 +282,9 @@ class ShoppingOrder extends Model
}
public function getLocale(){
return $this->language ? $this->language : \App::getLocale();
}
public function setUserHistoryValue($values = []){
if($user_history = $this->user_history){
@ -311,7 +322,14 @@ class ShoppingOrder extends Model
}
public function getShippedType(){
return isset(self::$shippedTypes[$this->shipped]) ? self::$shippedTypes[$this->shipped] : "";
return isset(self::$shippedTypes[$this->shipped]) ? __('payment.'.self::$shippedTypes[$this->shipped]) : "";
}
public static function getTransShippedType(){
$ret = [];
foreach(self::$shippedTypes as $key=>$val){
$ret[$key] = trans('payment.'.$val);
}
return $ret;
}
public function getAPIShippedType(){
@ -323,7 +341,7 @@ class ShoppingOrder extends Model
}
public function getAPIStatusType(){
return isset(self::$apiStatusTypes[$this->api_status]) ? self::$apiStatusTypes[$this->api_status] : "bestellt";
return isset(self::$apiStatusTypes[$this->api_status]) ? __('payment.'.self::$apiStatusTypes[$this->api_status]) : "bestellt";
}
public function getAPIStatusColor(){
@ -381,7 +399,7 @@ class ShoppingOrder extends Model
}
public function getPaymentForType(){
return isset(self::$paymentForTypes[$this->payment_for]) ? self::$paymentForTypes[$this->payment_for] : "";
return isset(self::$paymentForTypes[$this->payment_for]) ? __('payment.'.self::$paymentForTypes[$this->payment_for]) : "";
}
public function getPaymentForColor(){
return isset(self::$paymentForColors[$this->payment_for]) ? self::$paymentForColors[$this->payment_for] : "";
@ -579,6 +597,19 @@ class ShoppingOrder extends Model
$this->save();
}
public function getShoppingUserFullName(){
if($this->shopping_user){
$fullname = $this->shopping_user->getFullNameAsArray();
$ret = "";
$ret .= $fullname['company'] ? $fullname['company'].' | ' : '';
$ret .= $fullname['salutation'] ? \App\Services\HTMLHelper::getSalutationLang($fullname['salutation']).' ' : '';
$ret .= $fullname['firstname'] ? $fullname['firstname'].' ' : '';
$ret .= $fullname['lastname'] ? $fullname['lastname'] : '';
$ret .= $fullname['email'] ? ' | '.$fullname['email'].'' : '';
}
return $ret;
}
}