April 2026 waren Wirtschaft Feedback
This commit is contained in:
parent
02f2a4c23e
commit
9ce711d6b2
167 changed files with 25278 additions and 8518 deletions
|
|
@ -1,76 +1,77 @@
|
|||
<?php
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use App\User;
|
||||
use App\Models\Country;
|
||||
use App\Models\Product;
|
||||
use App\Models\Category;
|
||||
use App\Models\LeadType;
|
||||
use App\Models\Attribute;
|
||||
use App\Models\UserLevel;
|
||||
use App\Models\Ingredient;
|
||||
use App\Models\ShoppingUser;
|
||||
use App\Models\AttributeType;
|
||||
use App\Models\Category;
|
||||
use App\Models\Country;
|
||||
use App\Models\Ingredient;
|
||||
use App\Models\LeadType;
|
||||
use App\Models\Product;
|
||||
use App\Models\ShippingCountry;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use App\Models\ShoppingUser;
|
||||
use App\Models\UserLevel;
|
||||
use App\User;
|
||||
|
||||
class HTMLHelper
|
||||
{
|
||||
|
||||
|
||||
public static $months = [
|
||||
1 => 'January',
|
||||
2 => 'February',
|
||||
3 => 'March',
|
||||
4 => 'April',
|
||||
5 => 'May',
|
||||
6 => 'June',
|
||||
7 => 'July',
|
||||
8 => 'August',
|
||||
9 => 'September',
|
||||
10 => 'October',
|
||||
11 => 'November',
|
||||
12 => 'December'
|
||||
2 => 'February',
|
||||
3 => 'March',
|
||||
4 => 'April',
|
||||
5 => 'May',
|
||||
6 => 'June',
|
||||
7 => 'July',
|
||||
8 => 'August',
|
||||
9 => 'September',
|
||||
10 => 'October',
|
||||
11 => 'November',
|
||||
12 => 'December',
|
||||
];
|
||||
|
||||
|
||||
|
||||
private static $roles = [
|
||||
0 => 'Kunde',
|
||||
1 => 'Redakteur',
|
||||
7 => 'Admin',
|
||||
8 => 'SuperAdmin',
|
||||
9 => 'SySAdmin',
|
||||
//10 => "API",
|
||||
// 10 => "API",
|
||||
];
|
||||
|
||||
|
||||
public static function getMonth($i){
|
||||
public static function getMonth($i)
|
||||
{
|
||||
return self::$months[intval($i)];
|
||||
}
|
||||
|
||||
public static function getTransMonths($full = false){
|
||||
public static function getTransMonths($full = false)
|
||||
{
|
||||
$ret = [];
|
||||
foreach(self::$months as $key=>$val){
|
||||
$ret[$key] = trans('cal.months.'.$val);
|
||||
}
|
||||
if($full){ //ganzes Jahr
|
||||
foreach (self::$months as $key => $val) {
|
||||
$ret[$key] = trans('cal.months.'.$val);
|
||||
}
|
||||
if ($full) { // ganzes Jahr
|
||||
$ret[13] = trans('cal.months.full_year');
|
||||
}
|
||||
return $ret;
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public static function getYearRange($start = 2021)
|
||||
{
|
||||
$end = date("Y");
|
||||
$end = date('Y');
|
||||
|
||||
return array_reverse(range($start, $end));
|
||||
}
|
||||
|
||||
public static function getRoleLabel($role_id = 0){
|
||||
public static function getRoleLabel($role_id = 0)
|
||||
{
|
||||
return '<span class="badge badge-pill '.self::getLabel($role_id).'">'.self::$roles[$role_id].'</span>';
|
||||
}
|
||||
|
||||
public static function getLabel($id){
|
||||
public static function getLabel($id)
|
||||
{
|
||||
switch ($id) {
|
||||
case 0:
|
||||
return 'badge-default';
|
||||
|
|
@ -94,31 +95,32 @@ class HTMLHelper
|
|||
|
||||
}
|
||||
|
||||
public static function getCustomListOf($name, $select){
|
||||
$ret = "";
|
||||
if($name === 'day'){
|
||||
public static function getCustomListOf($name, $select)
|
||||
{
|
||||
$ret = '';
|
||||
if ($name === 'day') {
|
||||
$start = 1;
|
||||
$end = 31;
|
||||
$values = range($start, $end);
|
||||
$ret = '<option value="">'.__('Tag').'</option>\n';
|
||||
foreach ($values as $value){
|
||||
foreach ($values as $value) {
|
||||
$attr = ($value == $select) ? 'selected="selected"' : '';
|
||||
$ret .= '<option value="'.$value.'" '.$attr.'>'.$value.'</option>\n';
|
||||
}
|
||||
}
|
||||
if($name === 'month'){
|
||||
if ($name === 'month') {
|
||||
$ret = '<option value="">'.__('Monat').'</option>\n';
|
||||
foreach (self::$months as $key=>$value){
|
||||
foreach (self::$months as $key => $value) {
|
||||
$attr = ($key == $select) ? 'selected="selected"' : '';
|
||||
$ret .= '<option value="'.$key.'" '.$attr.'>'.$value.'</option>\n';
|
||||
}
|
||||
}
|
||||
if($name === 'year'){
|
||||
$start = date("Y", strtotime("-5 years", time()));
|
||||
$end = date("Y", strtotime("-90 years", time()));
|
||||
if ($name === 'year') {
|
||||
$start = date('Y', strtotime('-5 years', time()));
|
||||
$end = date('Y', strtotime('-90 years', time()));
|
||||
$values = range($start, $end);
|
||||
$ret = '<option value="">'.__('Jahr').'</option>\n';
|
||||
foreach ($values as $value){
|
||||
foreach ($values as $value) {
|
||||
$attr = ($value == $select) ? 'selected="selected"' : '';
|
||||
$ret .= '<option value="'.$value.'" '.$attr.'>'.$value.'</option>\n';
|
||||
}
|
||||
|
|
@ -127,14 +129,16 @@ class HTMLHelper
|
|||
return $ret;
|
||||
|
||||
}
|
||||
public static function setContentReadMore($content){
|
||||
|
||||
public static function setContentReadMore($content)
|
||||
{
|
||||
|
||||
$sep = '##mehr lesen##';
|
||||
if(strpos($content, $sep) !== false){
|
||||
if (strpos($content, $sep) !== false) {
|
||||
$name = 'collapse_'.random_int(1000, 10000);
|
||||
$split = explode($sep, $content);
|
||||
$first = isset($split[0]) ? $split[0] : "";
|
||||
$text = isset($split[1]) ? $split[1] : "";
|
||||
$first = isset($split[0]) ? $split[0] : '';
|
||||
$text = isset($split[1]) ? $split[1] : '';
|
||||
|
||||
$content = $first;
|
||||
$content .= '<br><a class="btn btn-primary btn-sm mt-2 collapsed" data-toggle="collapse" href="#'.$name.'" role="button" aria-expanded="false" aria-controls="'.$name.'">
|
||||
|
|
@ -147,382 +151,436 @@ class HTMLHelper
|
|||
</div>
|
||||
</div>';
|
||||
}
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
public static function getRolesOptions(){
|
||||
$ret = "";
|
||||
foreach (self::$roles as $role_id => $value){
|
||||
public static function getRolesOptions()
|
||||
{
|
||||
$ret = '';
|
||||
foreach (self::$roles as $role_id => $value) {
|
||||
$ret .= '<option value="'.$role_id.'">'.$value.'</option>\n';
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public static function getYearSelectOptions(){
|
||||
$start = date("Y", strtotime("-5 years", time()));
|
||||
$end = date("Y", strtotime("+1 years", time()));
|
||||
public static function getYearSelectOptions()
|
||||
{
|
||||
$start = date('Y', strtotime('-5 years', time()));
|
||||
$end = date('Y', strtotime('+1 years', time()));
|
||||
$values = range($start, $end);
|
||||
$now = date("Y", time());
|
||||
$ret = "";
|
||||
foreach ($values as $value){
|
||||
$now = date('Y', time());
|
||||
$ret = '';
|
||||
foreach ($values as $value) {
|
||||
$attr = ($value == $now) ? 'selected="selected"' : '';
|
||||
$ret .= '<option value="'.$value.'" '.$attr.'>'.$value.'</option>\n';
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
public static function getAttributeTypes($id = false){
|
||||
public static function getAttributeTypes($id = false)
|
||||
{
|
||||
$values = AttributeType::where('parent_id', null)->where('active', 1)->orderBy('pos', 'asc')->get();
|
||||
$ret = "";
|
||||
if($id === false){
|
||||
$ret = '';
|
||||
if ($id === false) {
|
||||
$val = $values->first();
|
||||
$id = $val->id;
|
||||
}
|
||||
foreach ($values as $value){
|
||||
foreach ($values as $value) {
|
||||
|
||||
$attr = ($value->id == $id) ? 'selected="selected"' : '';
|
||||
$ret .= '<option value="'.$value->id.'" '.$attr.'>'.$value->name.'</option>\n';
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
public static function getProductsWhiteLabelOptions($ids = [], $unsets = [], $type_id = false){
|
||||
public static function getProductsWhiteLabelOptions($ids = [], $unsets = [], $type_id = false)
|
||||
{
|
||||
$values = Product::where('whitelabel', 1)->where('active', 1)->get();
|
||||
$ret = "";
|
||||
foreach ($values as $value){
|
||||
if(is_array($unsets) && in_array($value->id, $unsets)){
|
||||
$ret = '';
|
||||
foreach ($values as $value) {
|
||||
if (is_array($unsets) && in_array($value->id, $unsets)) {
|
||||
continue;
|
||||
}
|
||||
$attr = (is_array($ids) && in_array($value->id, $ids)) ? 'selected="selected"' : '';
|
||||
$attr = (is_array($ids) && in_array($value->id, $ids)) ? 'selected="selected"' : '';
|
||||
$ret .= '<option value="'.$value->id.'" '.$attr.'>'.$value->name.'</option>\n';
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
public static function getAttributesOptions($ids = array(), $all = true, $type_id = false){
|
||||
if($type_id){
|
||||
public static function getAttributesOptions($ids = [], $all = true, $type_id = false)
|
||||
{
|
||||
if ($type_id) {
|
||||
$values = Attribute::where('active', 1)->where('attribute_type_id', $type_id)->get();
|
||||
}else{
|
||||
} else {
|
||||
$values = Attribute::where('active', 1)->get();
|
||||
}
|
||||
$ret = "";
|
||||
if($all){
|
||||
$ret = '';
|
||||
if ($all) {
|
||||
$ret .= '<option value="">'.__('no').'</option>\n';
|
||||
}
|
||||
foreach ($values as $value){
|
||||
$attr = in_array($value->id, $ids) ? 'selected="selected"' : '';
|
||||
foreach ($values as $value) {
|
||||
$attr = in_array($value->id, $ids) ? 'selected="selected"' : '';
|
||||
$ret .= '<option value="'.$value->id.'" '.$attr.'>'.$value->name.'</option>\n';
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public static function getProductAttributesOptions($product_attributes, $ids = [], $all = true, $type_id = false){
|
||||
$ret = "";
|
||||
if($all){
|
||||
public static function getProductAttributesOptions($product_attributes, $ids = [], $all = true, $type_id = false)
|
||||
{
|
||||
$ret = '';
|
||||
if ($all) {
|
||||
$ret .= '<option value="">'.__('no').'</option>\n';
|
||||
}
|
||||
foreach ($product_attributes as $product_attribute){
|
||||
if($product_attribute->attribute){
|
||||
$attr = (is_array($ids) && in_array($product_attribute->attribute_id, $ids)) ? 'selected="selected"' : '';
|
||||
foreach ($product_attributes as $product_attribute) {
|
||||
if ($product_attribute->attribute) {
|
||||
$attr = (is_array($ids) && in_array($product_attribute->attribute_id, $ids)) ? 'selected="selected"' : '';
|
||||
$ret .= '<option value="'.$product_attribute->attribute_id.'" '.$attr.'>'.$product_attribute->attribute->name.'</option>\n';
|
||||
}
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public static function getCategoriesWithoutParents($id = false, $sameId = false, $all = true){
|
||||
public static function getCategoriesWithoutParents($id = false, $sameId = false, $all = true)
|
||||
{
|
||||
$values = Category::where('parent_id', null)->get();
|
||||
$ret = "";
|
||||
if($all){
|
||||
$ret = '';
|
||||
if ($all) {
|
||||
$ret .= '<option value="">'.__('no').'</option>\n';
|
||||
}
|
||||
foreach ($values as $value){
|
||||
if($sameId == $value->id){
|
||||
foreach ($values as $value) {
|
||||
if ($sameId == $value->id) {
|
||||
continue;
|
||||
}
|
||||
$attr = ($value->id == $id) ? 'selected="selected"' : '';
|
||||
$ret .= '<option value="'.$value->id.'" '.$attr.'>'.$value->name.'</option>\n';
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public static function getProductsOptions($ids = array(), $all = true){
|
||||
if($ids == null){
|
||||
$ids = array();
|
||||
public static function getProductsOptions($ids = [], $all = true)
|
||||
{
|
||||
if ($ids == null) {
|
||||
$ids = [];
|
||||
}
|
||||
$values = Product::where('active', 1)->get();
|
||||
$ret = "";
|
||||
if($all){
|
||||
$ret = '';
|
||||
if ($all) {
|
||||
$ret .= '<option value="">'.__('no').'</option>\n';
|
||||
}
|
||||
foreach ($values as $value){
|
||||
$attr = in_array($value->id, $ids) ? 'selected="selected"' : '';
|
||||
$ret .= '<option value="'.$value->id.'" '.$attr.'>'.$value->name.'</option>\n';
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public static function getCategoriesOptions($ids = array(), $all = true){
|
||||
$values = Category::where('active', 1)->get();
|
||||
$ret = "";
|
||||
if($all){
|
||||
$ret .= '<option value="">'.__('no').'</option>\n';
|
||||
}
|
||||
foreach ($values as $value){
|
||||
foreach ($values as $value) {
|
||||
$attr = in_array($value->id, $ids) ? 'selected="selected"' : '';
|
||||
$ret .= '<option value="'.$value->id.'" '.$attr.'>'.$value->name.'</option>\n';
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public static function getCategoriesByShowOn($show_on = []){
|
||||
$values = Category::where('active', true)->whereJsonContains('show_on', $show_on)->orderBy('pos', 'ASC')->get();
|
||||
public static function getCategoriesOptions($ids = [], $all = true)
|
||||
{
|
||||
$values = Category::where('active', 1)->get();
|
||||
$ret = '';
|
||||
if ($all) {
|
||||
$ret .= '<option value="">'.__('no').'</option>\n';
|
||||
}
|
||||
foreach ($values as $value) {
|
||||
$attr = in_array($value->id, $ids) ? 'selected="selected"' : '';
|
||||
$ret .= '<option value="'.$value->id.'" '.$attr.'>'.$value->name.'</option>\n';
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public static function getCategoriesByShowOn($show_on = [])
|
||||
{
|
||||
$values = Category::where('active', true)->whereJsonContains('show_on', $show_on)->orderBy('pos', 'ASC')->get();
|
||||
$ret = [];
|
||||
foreach ($values as $value){
|
||||
foreach ($values as $value) {
|
||||
$ret[$value->id] = ['name' => $value->name, 'count' => $value->getProductsCountOn($show_on)];
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
public static function getCategoriesOptionsByShowOn($ids = array(), $all = false, $show_on = []){
|
||||
$values = Category::where('active', true)->whereJsonContains('show_on', $show_on)->orderBy('pos', 'ASC')->get();
|
||||
$ret = "";
|
||||
if($all){
|
||||
$ret .= '<option value="">'.$all.'</option>\n';
|
||||
}
|
||||
foreach ($values as $value){
|
||||
$attr = in_array($value->id, $ids) ? 'selected="selected"' : '';
|
||||
$count = $value->getProductsCountOn($show_on);
|
||||
$ret .= '<option value="'.$value->id.'" '.$attr.'>'.$value->name.' ('.$count.')</option>\n';
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public static function getProductIngredientsOptions($has_ids = array(), $all = true){
|
||||
$values = Ingredient::where('active', 1)->get();
|
||||
$ret = "";
|
||||
$attr = "";
|
||||
foreach ($values as $value){
|
||||
if(!in_array($value->id, $has_ids)){
|
||||
public static function getCategoriesOptionsByShowOn($ids = [], $all = false, $show_on = [])
|
||||
{
|
||||
$values = Category::where('active', true)->whereJsonContains('show_on', $show_on)->orderBy('pos', 'ASC')->get();
|
||||
$ret = '';
|
||||
if ($all) {
|
||||
$ret .= '<option value="">'.$all.'</option>\n';
|
||||
}
|
||||
foreach ($values as $value) {
|
||||
$attr = in_array($value->id, $ids) ? 'selected="selected"' : '';
|
||||
$count = $value->getProductsCountOn($show_on);
|
||||
$ret .= '<option value="'.$value->id.'" '.$attr.'>'.$value->name.' ('.$count.')</option>\n';
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public static function getProductIngredientsOptions($has_ids = [], $all = true)
|
||||
{
|
||||
$values = Ingredient::where('active', 1)->orderBy('name')->get();
|
||||
$ret = '';
|
||||
$attr = '';
|
||||
foreach ($values as $value) {
|
||||
if (! in_array($value->id, $has_ids)) {
|
||||
$ret .= '<option value="'.$value->id.'" '.$attr.'>'.$value->name.'</option>\n';
|
||||
}
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public static function getLeadTypeOptions($id = false, $all = true){
|
||||
public static function getLeadTypeOptions($id = false, $all = true)
|
||||
{
|
||||
$values = LeadType::where('active', 1)->get();
|
||||
$ret = "";
|
||||
if($all){
|
||||
$ret = '';
|
||||
if ($all) {
|
||||
$ret .= '<option value="">'.__('no').'</option>\n';
|
||||
}
|
||||
foreach ($values as $value){
|
||||
foreach ($values as $value) {
|
||||
$attr = ($value->id == $id) ? 'selected="selected"' : '';
|
||||
$ret .= '<option value="'.$value->id.'" '.$attr.'>'.$value->name.'</option>\n';
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public static function getUserLevelOptions($id = false, $all = true){
|
||||
public static function getUserLevelOptions($id = false, $all = true)
|
||||
{
|
||||
$values = UserLevel::where('active', 1)->get();
|
||||
$ret = "";
|
||||
if($all){
|
||||
$ret = '';
|
||||
if ($all) {
|
||||
$ret .= '<option value="">'.__('no').'</option>\n';
|
||||
}
|
||||
foreach ($values as $value){
|
||||
foreach ($values as $value) {
|
||||
$attr = ($value->id == $id) ? 'selected="selected"' : '';
|
||||
$ret .= '<option value="'.$value->id.'" '.$attr.'>'.$value->name.'</option>\n';
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
public static function getCompanyOptions($company){
|
||||
$options = array(1 => __('business'), 0 => __('private'), );
|
||||
$ret = "";
|
||||
foreach ($options as $id => $value){
|
||||
public static function getCompanyOptions($company)
|
||||
{
|
||||
$options = [1 => __('business'), 0 => __('private')];
|
||||
$ret = '';
|
||||
foreach ($options as $id => $value) {
|
||||
$attr = ($id == $company) ? 'selected="selected"' : '';
|
||||
$ret .= '<option value="'.$id.'" '.$attr.'>'.$value.'</option>\n';
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public static function getContriesWithMore($id, $all=true){#
|
||||
public static function getContriesWithMore($id, $all = true) //
|
||||
{
|
||||
$values = Country::all();
|
||||
$counter = 1;
|
||||
$ret = "";
|
||||
if($all){
|
||||
$ret = '';
|
||||
if ($all) {
|
||||
$ret .= '<option value="">'.__('please select').'</option>\n';
|
||||
|
||||
}
|
||||
foreach ($values as $value){
|
||||
if( $counter == 7){
|
||||
foreach ($values as $value) {
|
||||
if ($counter == 7) {
|
||||
$ret .= '<optgroup label="'.__('further countrie').'">';
|
||||
}
|
||||
$attr = ($value->id == $id) ? 'selected="selected"' : '';
|
||||
$ret .= '<option value="'.$value->id.'" '.$attr.'>'.$value->getLocated().'</option>\n';
|
||||
|
||||
$counter ++;
|
||||
$counter++;
|
||||
}
|
||||
$ret .= '</optgroup>';
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public static function getContriesCodes($id, $all=true){#
|
||||
public static function getContriesCodes($id, $all = true) //
|
||||
{
|
||||
$values = Country::all();
|
||||
$counter = 1;
|
||||
$ret = "";
|
||||
if($all){
|
||||
$ret = '';
|
||||
if ($all) {
|
||||
$ret .= '<option value="">'.__('please select').'</option>\n';
|
||||
|
||||
}
|
||||
foreach ($values as $value){
|
||||
foreach ($values as $value) {
|
||||
|
||||
if(!$value->phone) continue;
|
||||
if( $counter == 7){
|
||||
if (! $value->phone) {
|
||||
continue;
|
||||
}
|
||||
if ($counter == 7) {
|
||||
$ret .= '<optgroup label="'.__('further countrie').'">';
|
||||
}
|
||||
$attr = ($value->id == $id) ? 'selected="selected"' : '';
|
||||
$ret .= '<option value="'.$value->id.'" '.$attr.'>'.$value->phone.'('.$value->getLocated().')</option>\n';
|
||||
|
||||
$counter ++;
|
||||
$counter++;
|
||||
}
|
||||
$ret .= '</optgroup>';
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public static function getCountriesWithoutUsedShippings($all=true){#
|
||||
public static function getCountriesWithoutUsedShippings($all = true) //
|
||||
{
|
||||
$values = Country::all();
|
||||
$country_ids = ShippingCountry::all()->pluck('country_id')->toArray();
|
||||
$ret = "";
|
||||
if($all){
|
||||
$ret = '';
|
||||
if ($all) {
|
||||
$ret .= '<option value="">'.__('please select').'</option>\n';
|
||||
}
|
||||
foreach ($values as $value){
|
||||
if(!in_array($value->id, $country_ids)){
|
||||
foreach ($values as $value) {
|
||||
if (! in_array($value->id, $country_ids)) {
|
||||
$ret .= '<option value="'.$value->id.'">'.$value->getLocated().'</option>\n';
|
||||
}
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public static function getCountryNameFormShipping($id){
|
||||
public static function getCountryNameFormShipping($id)
|
||||
{
|
||||
$value = ShippingCountry::find($id);
|
||||
if($value){
|
||||
if ($value) {
|
||||
return $value->country->getLocated();
|
||||
}
|
||||
return "not defined";
|
||||
|
||||
return 'not defined';
|
||||
}
|
||||
|
||||
public static function getCountriesForShipping($id, $all=false, $shipping_for = false){#
|
||||
public static function getCountriesForShipping($id, $all = false, $shipping_for = false) //
|
||||
{
|
||||
$values = ShippingCountry::all();
|
||||
|
||||
if($shipping_for){
|
||||
if ($shipping_for) {
|
||||
$temp = [];
|
||||
foreach($values as $value){
|
||||
if($shipping = $value->shipping){
|
||||
if($shipping->getShippingPricesFirstBy($shipping_for)){
|
||||
foreach ($values as $value) {
|
||||
if ($shipping = $value->shipping) {
|
||||
if ($shipping->getShippingPricesFirstBy($shipping_for)) {
|
||||
$temp[] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
$values = $temp;
|
||||
}
|
||||
$ret = "";
|
||||
if($all){
|
||||
$ret = '';
|
||||
if ($all) {
|
||||
$ret .= '<option value="">'.__('please select').'</option>\n';
|
||||
}
|
||||
foreach ($values as $value){
|
||||
foreach ($values as $value) {
|
||||
$attr = ($value->id == $id) ? 'selected="selected"' : '';
|
||||
$ret .= '<option value="'.$value->id.'" '.$attr.'>'.$value->country->getLocated().'</option>\n';
|
||||
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public static function getSalutation($id){
|
||||
$values = array('mr' => __('MR'), 'ms' => __('MS'));
|
||||
$ret = "";
|
||||
public static function getSalutation($id)
|
||||
{
|
||||
$values = ['mr' => __('MR'), 'ms' => __('MS')];
|
||||
$ret = '';
|
||||
$ret .= '<option value="">'.__('please select').'</option>\n';
|
||||
foreach ($values as $key => $value){
|
||||
foreach ($values as $key => $value) {
|
||||
$attr = ($key == $id) ? 'selected="selected"' : '';
|
||||
$ret .= '<option value="'.$key.'" '.$attr.'>'.$value.'</option>\n';
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public static function getSalutationLang($id){
|
||||
$values = array('mr' => __('MR'), 'ms' => __('MS'));
|
||||
return (!empty($values[$id]) ? $values[$id] : '');
|
||||
public static function getSalutationLang($id)
|
||||
{
|
||||
$values = ['mr' => __('MR'), 'ms' => __('MS')];
|
||||
|
||||
return ! empty($values[$id]) ? $values[$id] : '';
|
||||
}
|
||||
|
||||
public static function getTaxSaleOptions($id){
|
||||
$values = array('1' => __('taxable_sales_1'), '2' => __('taxable_sales_2'));
|
||||
$ret = "";
|
||||
public static function getTaxSaleOptions($id)
|
||||
{
|
||||
$values = ['1' => __('taxable_sales_1'), '2' => __('taxable_sales_2')];
|
||||
$ret = '';
|
||||
$ret .= '<option value="">'.__('please select').'</option>\n';
|
||||
foreach ($values as $key => $value){
|
||||
foreach ($values as $key => $value) {
|
||||
$attr = ($key == $id) ? 'selected="selected"' : '';
|
||||
$ret .= '<option value="'.$key.'" '.$attr.'>'.$value.'</option>\n';
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public static function getMembersOptions($id, $all=false){
|
||||
public static function getMembersOptions($id, $all = false)
|
||||
{
|
||||
$values = User::where('active', '=', true)->where('blocked', '=', false)->where('payment_account', '>=', now())->get();
|
||||
$ret = "";
|
||||
if($all){
|
||||
$ret = '';
|
||||
if ($all) {
|
||||
$ret .= '<option value="">'.__('please select').'</option>\n';
|
||||
}
|
||||
foreach ($values as $value){
|
||||
foreach ($values as $value) {
|
||||
$attr = ($value->id == $id) ? 'selected="selected"' : '';
|
||||
$to="";
|
||||
if($value->account){
|
||||
$to = $value->account->first_name." ".$value->account->last_name." | ";
|
||||
$to = '';
|
||||
if ($value->account) {
|
||||
$to = $value->account->first_name.' '.$value->account->last_name.' | ';
|
||||
}
|
||||
$ret .= '<option value="'.$value->id.'" '.$attr.'>'.$to.$value->email.' #'.$value->account->m_account.'</option>\n';
|
||||
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public static function getUserCustomerOptions($id, $all=false){
|
||||
public static function getUserCustomerOptions($id, $all = false)
|
||||
{
|
||||
$values = ShoppingUser::select(['id', 'billing_firstname', 'billing_lastname', 'billing_email', 'number'])
|
||||
->where('shopping_users.member_id', '=', \Auth::user()->id)->get();
|
||||
$ret = "";
|
||||
if($all){
|
||||
$ret = '';
|
||||
if ($all) {
|
||||
$ret .= '<option value="">'.__('please select').'</option>\n';
|
||||
}
|
||||
foreach ($values as $value){
|
||||
foreach ($values as $value) {
|
||||
$attr = ($value->id == $id) ? 'selected="selected"' : '';
|
||||
$to = $value->billing_firstname." ".$value->billing_lastname." | ".$value->billing_email;
|
||||
$to = $value->billing_firstname.' '.$value->billing_lastname.' | '.$value->billing_email;
|
||||
$ret .= '<option value="'.$value->id.'" '.$attr.'>'.$to.' #'.$value->account->m_account.'</option>\n';
|
||||
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public static function getAnyOptions($id, $options = [], $all=true){#
|
||||
$ret = "";
|
||||
if($all){
|
||||
public static function getAnyOptions($id, $options = [], $all = true) //
|
||||
{
|
||||
$ret = '';
|
||||
if ($all) {
|
||||
$ret .= '<option value="">'.__('please select').'</option>\n';
|
||||
}
|
||||
foreach ($options as $key=>$value){
|
||||
foreach ($options as $key => $value) {
|
||||
$attr = ($key == $id) ? 'selected="selected"' : '';
|
||||
$ret .= '<option value="'.$key.'" '.$attr.'>'.$value.'</option>\n';
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public static function getOptionRange($select, $from=1, $to=50){
|
||||
public static function getOptionRange($select, $from = 1, $to = 50)
|
||||
{
|
||||
$values = range($from, $to);
|
||||
$ret = "";
|
||||
foreach ($values as $value){
|
||||
$ret = '';
|
||||
foreach ($values as $value) {
|
||||
$attr = ($value == $select) ? 'selected="selected"' : '';
|
||||
$ret .= '<option value="'.$value.'" '.$attr.'>'.$value.'</option>\n';
|
||||
}
|
||||
|
||||
return $ret;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue