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

@ -16,31 +16,40 @@ class HTMLHelper
public static $months = [
1 => 'Januar',
2 => 'Februar',
3 => 'März',
1 => 'January',
2 => 'February',
3 => 'March',
4 => 'April',
5 => 'Mai',
6 => 'Juni',
7 => 'Juli',
5 => 'May',
6 => 'June',
7 => 'July',
8 => 'August',
9 => 'September',
10 => 'Oktober',
10 => 'October',
11 => 'November',
12 => 'Dezember'
12 => 'December'
];
private static $roles = [
0 => 'Kunde',
1 => 'Admin',
2 => 'SuperAdmin',
3 => 'SySAdmin',
1 => 'VIP',
2 => 'Admin',
3 => 'SuperAdmin',
4 => 'SySAdmin',
];
public static function getMonth($i){
return self::$months[intval($i)];
return trans('cal.months.'.self::$months[intval($i)]);
}
public static function getTransMonths(){
$ret = [];
foreach(self::$months as $key=>$val){
$ret[$key] = trans('cal.months.'.$val);
}
return $ret;
}
public static function getYearRange($start = 2021)
@ -49,7 +58,6 @@ class HTMLHelper
return array_reverse(range($start, $end));
}
public static function getRoleLabel($role_id = 0){
return '<span class="badge badge-pill '.self::getLabel($role_id).'">'.self::$roles[$role_id].'</span>';
}
@ -60,14 +68,17 @@ class HTMLHelper
return 'badge-default';
break;
case 1:
return 'badge-warning';
return 'badge-secondary';
break;
case 2:
return 'badge-primary';
return 'badge-warning';
break;
case 3:
return 'badge-primary';
break;
case 4:
return 'badge-primary';
break;
}
}
@ -93,11 +104,28 @@ class HTMLHelper
return $ret;
}
public static function getAboIntervallWeeks($default = 1){
$values = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
$ret = "";
foreach ($values as $value){
$attr = ($value == $default) ? 'selected="selected"' : '';
$str = self::getAboWeeksLang($value);
$ret .= '<option value="'.$value.'" '.$attr.'>'.$str.'</option>\n';
}
return $ret;
}
public static function getAboWeeksLang($num){
if($num == 1){
return __('order.every_week');
}
return __('order.every_weeks', ['num' => $num]);
}
public static function getAttributesWithoutParents($id = false, $sameId = false, $all = true){
$values = Attribute::where('parent_id', null)->get();
$ret = "";
if($all){
$ret .= '<option value="">'.__('no').'</option>\n';
$ret .= '<option value="">'.__('none').'</option>\n';
}
foreach ($values as $value){
if($sameId == $value->id){
@ -113,7 +141,7 @@ class HTMLHelper
$values = Category::where('parent_id', null)->get();
$ret = "";
if($all){
$ret .= '<option value="">'.__('no').'</option>\n';
$ret .= '<option value="">'.__('none').'</option>\n';
}
foreach ($values as $value){
if($sameId == $value->id){
@ -132,7 +160,7 @@ class HTMLHelper
$values = Product::where('active', 1)->get();
$ret = "";
if($all){
$ret .= '<option value="">'.__('no').'</option>\n';
$ret .= '<option value="">'.__('none').'</option>\n';
}
foreach ($values as $value){
$attr = in_array($value->id, $ids) ? 'selected="selected"' : '';
@ -145,7 +173,7 @@ class HTMLHelper
$values = Category::where('active', 1)->orderBy('pos', 'DESC')->get();
$ret = "";
if($all){
$ret .= '<option value="">'.__('no').'</option>\n';
$ret .= '<option value="">'.__('none').'</option>\n';
}
foreach ($values as $value){
$attr = in_array($value->id, $ids) ? 'selected="selected"' : '';
@ -170,7 +198,7 @@ class HTMLHelper
$values = Attribute::where('active', 1)->get();
$ret = "";
if($all){
$ret .= '<option value="">'.__('no').'</option>\n';
$ret .= '<option value="">'.__('none').'</option>\n';
}
foreach ($values as $value){
$attr = in_array($value->id, $ids) ? 'selected="selected"' : '';
@ -183,7 +211,7 @@ class HTMLHelper
$values = UserLevel::where('active', 1)->get();
$ret = "";
if($all){
$ret .= '<option value="">'.__('no').'</option>\n';
$ret .= '<option value="">'.__('none').'</option>\n';
}
foreach ($values as $value){
$attr = ($value->id == $id) ? 'selected="selected"' : '';
@ -303,7 +331,7 @@ class HTMLHelper
}
public static function getTaxSaleOptions($id){
$values = array('1' => __('taxable_sales_1'), '2' => __('taxable_sales_2'));
$values = array('1' => __('account.taxable_sales_1'), '2' => __('account.taxable_sales_2'));
$ret = "";
$ret .= '<option value="">'.__('please select').'</option>\n';
foreach ($values as $key => $value){
@ -339,7 +367,6 @@ class HTMLHelper
$ret .= '<option value="">'.__('please select').'</option>\n';
}
foreach ($values as $value){
dump($value);
$attr = ($value->id == $id) ? 'selected="selected"' : '';
$to = $value->billing_firstname." ".$value->billing_lastname." | ".$value->billing_email;
$ret .= '<option value="'.$value->id.'" '.$attr.'>'.$to.' #'.$value->number.'</option>\n';