Gutschriften Anpassungen

This commit is contained in:
Kevin Adametz 2021-04-29 16:36:11 +02:00
parent 3754f1c571
commit e670b92f5d
28 changed files with 303 additions and 99 deletions

View file

@ -126,6 +126,7 @@ class ShoppingOrder extends Model
'weight',
'paid',
'invoice',
'invoice_number',
'txaction',
'wp_invoice_path',
'wp_notice',

View file

@ -127,12 +127,12 @@ class UserAccount extends Model
'm_account', 'm_salutation', 'm_first_name', 'm_last_name', 'm_notes', 'company', 'salutation', 'first_name', 'last_name', 'address', 'address_2', 'zipcode', 'city', 'country_id', 'pre_phone_id', 'phone', 'pre_mobil_id', 'mobil',
'tax_number', 'tax_identification_number', 'taxable_sales', 'same_as_billing',
'shipping_salutation', 'shipping_company', 'shipping_firstname', 'shipping_lastname', 'shipping_address', 'shipping_address_2', 'shipping_zipcode', 'shipping_city', 'shipping_country_id', 'shipping_pre_phone_id', 'shipping_phone',
'birthday', 'website', 'facebook', 'facebook_fanpage', 'instagram', 'notice'
'birthday', 'website', 'facebook', 'facebook_fanpage', 'instagram', 'notice', 'payment_data'
];
protected $casts = [
'payment_data' => 'array',
'notice' => 'array',
'notice' => 'array'
];
use SoftDeletes;
@ -194,6 +194,10 @@ class UserAccount extends Model
return Carbon::parse($this->attributes['accept_contract'])->format(\Util::formatDateTimeDB());
}
public function getPaymentData($key)
{
return isset($this->payment_data[$key]) ? $this->payment_data[$key] : '';
}
public function getCountryAttrAs($attr, $as = false){
if($this->country){

View file

@ -65,6 +65,7 @@ class UserCredit extends Model
protected $fillable = [
'auth_user_id',
'credit_number',
'net',
'tax_rate',
'tax',
@ -77,6 +78,20 @@ class UserCredit extends Model
'status'
];
public static $statusTypes = [
0 => 'offen',
1 => 'bezahlt',
2 => 'prüfen',
10 => 'storniert'
];
public static $statusColors = [
0 => 'warning',
1 => 'success',
2 => 'secondary',
10 => 'danger',
];
public function user()
{
return $this->belongsTo(\App\User::class, 'auth_user_id');
@ -112,5 +127,14 @@ class UserCredit extends Model
{
return formatNumber($this->attributes['total']);
}
public function getStatusType(){
return isset(self::$statusTypes[$this->status]) ? self::$statusTypes[$this->status] : "";
}
public function getStatusColor(){
return isset(self::$statusColors[$this->status]) ? self::$statusColors[$this->status] : "default";
}
}