#51 2 Business Points edit / add, user dashboard

This commit is contained in:
Kevin Adametz 2022-07-22 13:43:24 +02:00
parent 263cf93a1e
commit dfd049aaa9
25 changed files with 1291 additions and 381 deletions

View file

@ -102,12 +102,22 @@ class UserSalesVolume extends Model
public static $statusTypes = [
0 => 'nicht zugewiesen',
1 => 'hinzugefügt aus Beraterbestellung',
2 => 'hinzugefügt aus Shopbestellung',
3 => 'hinzugefügt aus Shopbestellung / pending',
1 => 'Beraterbestellung', //hinzugefügt aus
2 => 'Shopbestellung', //hinzugefügt aus
3 => 'Shopbestellung / pending', //hinzugefügt aus
4 => 'Gutschrift', //hinzugefügt aus
10 => ''
];
public static $statusColors = [
0 => 'warning',
1 => 'success',
2 => 'secondary',
3 => 'warning',
4 => 'info',
10 => 'danger',
];
public function shopping_order()
{
return $this->belongsTo(ShoppingOrder::class);
@ -133,10 +143,21 @@ class UserSalesVolume extends Model
return isset($this->attributes['date']) ? $this->attributes['date'] : NULL;
}
public function getPointsSum(){
return $this->month_points + $this->month_shop_points;
}
public function getTotalNetSum(){
return $this->month_total_net + $this->month_shop_total_net;
}
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";
}
public function getFormatedMonthYear(){
return str_pad($this->month, 2, "0", STR_PAD_LEFT)."/".$this->year;
}