diff --git a/app/Http/Controllers/CategoryController.php b/app/Http/Controllers/CategoryController.php index 63f459b..c2ed9fc 100755 --- a/app/Http/Controllers/CategoryController.php +++ b/app/Http/Controllers/CategoryController.php @@ -21,7 +21,7 @@ class CategoryController extends Controller { $data = [ - 'values' => Category::all(), + 'values' => Category::orderBy('pos', 'ASC')->get(), ]; return view('admin.category.index', $data); } @@ -46,42 +46,66 @@ class CategoryController extends Controller { $data = Request::all(); - $data['active'] = isset($data['active']) ? true : false; - $data['parent_id'] = isset($data['parent_id']) ? $data['parent_id'] : null; - if($data['id'] == "new"){ - $model = Category::create($data); - }else{ - $model = Category::find($data['id']); - $model->fill($data)->save(); + if($data['action'] === 'save-product_category'){ + + if($data['id'] === 'new'){ + $ProductCategory = ProductCategory::create([ + 'pos' => $data['pos'], + 'product_id' => $data['product_id'], + 'category_id' => $data['category_id'], + ]); + \Session()->flash('alert-save', '1'); + return redirect(route('admin_product_category_edit', [$ProductCategory->category_id])); + }else{ + $ProductCategory = ProductCategory::findOrFail($data['id']); + if($ProductCategory->category_id != $data['category_id']){ + abort(404); + } + $ProductCategory->pos = $data['pos']; + $ProductCategory->product_id = $data['product_id']; + $ProductCategory->save(); + \Session()->flash('alert-save', '1'); + return redirect(route('admin_product_category_edit', [$ProductCategory->category_id])); + } + } - $trans = []; - if(!empty($data['trans_name'])){ - - foreach ($data['trans_name'] as $lang => $value){ - if($value && $value != null){ - $trans[$lang] = $value; + if($data['action'] === 'save-form'){ + $data['active'] = isset($data['active']) ? true : false; + $data['parent_id'] = isset($data['parent_id']) ? $data['parent_id'] : null; + if($data['id'] == "new"){ + $model = Category::create($data); + }else{ + $model = Category::find($data['id']); + $model->fill($data)->save(); + } + + $trans = []; + if(!empty($data['trans_name'])){ + + foreach ($data['trans_name'] as $lang => $value){ + if($value && $value != null){ + $trans[$lang] = $value; + } } } - } - $model->trans_name = $trans; - $model->save(); - - $trans = []; - if(!empty($data['trans_headline'])){ - foreach ($data['trans_headline'] as $lang => $value){ - if($value && $value != null){ - $trans[$lang] = $value; + $model->trans_name = $trans; + $model->save(); + + $trans = []; + if(!empty($data['trans_headline'])){ + foreach ($data['trans_headline'] as $lang => $value){ + if($value && $value != null){ + $trans[$lang] = $value; + } } } + $model->trans_headline = $trans; + $model->save(); + + \Session()->flash('alert-save', '1'); + return redirect(route('admin_product_categories')); } - $model->trans_headline = $trans; - $model->save(); - - \Session()->flash('alert-save', '1'); - return redirect(route('admin_product_categories')); - - } @@ -157,7 +181,7 @@ class CategoryController extends Controller return redirect(route('admin_product_category_edit', [$category->id])); } - catch (Exception $e) { + catch (\Exception $e) { \Session()->flash('alert-danger', "Fehler".$e); return redirect(route('admin_product_category_edit', [$category->id])); } diff --git a/app/Http/Controllers/Web/PromotionController.php b/app/Http/Controllers/Web/PromotionController.php index a7d36cf..887e5ef 100644 --- a/app/Http/Controllers/Web/PromotionController.php +++ b/app/Http/Controllers/Web/PromotionController.php @@ -8,6 +8,8 @@ use Response; use Validator; use App\Services\Util; use App\Models\Product; +use App\Models\Category; +use App\Services\Payment; use App\Models\UserHistory; use App\Models\PaymentMethod; use App\Models\PromotionUser; @@ -17,7 +19,6 @@ use App\Services\PromotionCart; use App\Models\PaymentTransaction; use App\Http\Controllers\Controller; use App\Repositories\CheckoutRepository; -use App\Services\Payment; class PromotionController extends Controller { @@ -45,10 +46,16 @@ class PromotionController extends Controller return view('web.promotion.outofstock', $data); } PromotionCart::initYard(); + + $first_category = Category::where('active', true)->whereJsonContains('show_on', ['3'])->orderBy('pos', 'DESC')->first(); + $first_category_id = isset($first_category->id) ? $first_category->id : false; + $shop_products = $this->getShowProducts(); + $data = [ 'promotion_user' => $PromotionUser, - 'shop_products' => Product::where('active', true)->whereJsonContains('show_on', ['3'])->orderBy('pos', 'ASC')->get(), + 'shop_products' => $shop_products, 'user_payment_methods' => PaymentMethod::getDefaultAsArray()->toArray(), + 'first_category_id' => $first_category_id, ]; return view('web.promotion.index', $data); } @@ -95,7 +102,6 @@ class PromotionController extends Controller } if($data['action'] === 'submit-reminder-service'){ return redirect(route('web_promotion_goto', ['thanksreminder', $PromotionUser->id])); - } if($data['action'] === 'submit-promotion-order'){ $rules = array( @@ -142,8 +148,6 @@ class PromotionController extends Controller } } - - private function directPaymentStatus(PaymentTransaction $payt, $identifier){ if(isset($payt->transmitted_data['param'])){ @@ -201,12 +205,19 @@ class PromotionController extends Controller $data = Request::all(); $ret = ""; $status = false; + if(Request::ajax()){ if($data['action'] === 'web-show-product'){ $product = Product::find($data['id']); //current user form order $ret = view("web.promotion.show_product", compact('product', 'data'))->render(); } - if($data['perform']){ + if(isset($data['perform'])){ + if($data['action'] === 'switch-show_products'){ + $category_id = isset($data['show_products_option']) ? $data['show_products_option'] : false; + $shop_products = $this->getShowProducts($category_id); + $shop_products_view = view("web.promotion._shop_products_inner", compact('shop_products'))->render(); + return response()->json(['response' => $data, 'shop_products_view'=>$shop_products_view, 'status'=>$status]); + } if($data['action'] === 'switch-free-product'){ \App\Services\PromotionCart::updateFeeProduct($data); } @@ -226,6 +237,10 @@ class PromotionController extends Controller if($data['action'] === 'switch-shipping'){ \App\Services\PromotionCart::switchShipping($data); } + if($data['action'] === 'change-state-shipping'){ + \App\Services\PromotionCart::changeStateShipping($data); + } + $cart = view("web.promotion._promotion_cart", compact('data'))->render(); if(Yard::instance('shopping')->isQuickShipping()){ $invoice = view("web.promotion._invoice_details_quick")->render(); @@ -233,10 +248,25 @@ class PromotionController extends Controller $invoice = view("web.promotion._invoice_details")->render(); } $checkout = view("web.promotion._checkout")->render(); + $data['shipping_price_formated'] = Yard::instance('shopping')->shipping(); return response()->json(['response' => $data, 'cart'=>$cart, 'invoice'=>$invoice, 'checkout'=>$checkout, 'status'=>$status]); } return response()->json(['response' => $data, 'html'=>$ret, 'status'=>$status]); } } + + private function getShowProducts($category_id = false){ + $shop_products = []; + if($category_id){ + $shop_products = Product::where('active', true)->whereJsonContains('show_on', ['3']) + ->whereHas('categories', function ($query) use ($category_id) { + $query->where('category_id', $category_id); //->whereJsonContains('show_on', ['3']); + })->orderBy('pos', 'ASC')->get(); + }else{ + $shop_products = Product::where('active', true)->whereJsonContains('show_on', ['3']) + ->orderBy('pos', 'ASC')->get(); + } + return $shop_products; + } } \ No newline at end of file diff --git a/app/Models/Category.php b/app/Models/Category.php index ab3c7a2..35e9a88 100644 --- a/app/Models/Category.php +++ b/app/Models/Category.php @@ -2,6 +2,7 @@ namespace App\Models; +use App\Services\Type; use Illuminate\Database\Eloquent\Model; use Cviebrock\EloquentSluggable\Sluggable; @@ -53,10 +54,10 @@ class Category extends Model protected $table = 'categories'; - protected $casts = ['trans_name' => 'array', 'trans_headline' => 'array']; + protected $casts = ['trans_name' => 'array', 'trans_headline' => 'array', 'show_on' => 'array']; protected $fillable = [ - 'parent_id', 'name', 'headline', 'pos', 'active', + 'parent_id', 'name', 'headline', 'pos', 'active', 'show_on' ]; public function sluggable() @@ -133,4 +134,15 @@ class Category extends Model return rtrim($ret, ', '); } + public function getShowOnTypes(){ + $ret = []; + if(is_array($this->show_on)){ + foreach($this->show_on as $show){ + $ret[] = isset(Type::$showONs[$show]) ? Type::$showONs[$show] : '-'; + } + } + return $ret; + } + + } diff --git a/app/Models/PaymentMethod.php b/app/Models/PaymentMethod.php index d2ce62c..ce85ec7 100644 --- a/app/Models/PaymentMethod.php +++ b/app/Models/PaymentMethod.php @@ -6,6 +6,7 @@ namespace App\Models; +use App\Services\Type; use App\Services\Util; use Carbon\Carbon; use Illuminate\Database\Eloquent\Model; @@ -65,35 +66,16 @@ class PaymentMethod extends Model 'active' ]; - public static $showATs = [ - 0 => 'Nur Kunden Shop', - 1 => 'Nur Vertriebspartner Shop', - 2 => 'Kunden + Vertriebspartner Shop', - 3 => 'Nur Reg/Mitgliedschaft Vertriebspartner', - 4 => 'Kunden + Vertriebspartner Shop + Reg/Mitgliedschaft', - 5 => 'Vertriebspartner Shop + Reg/Mitgliedschaft', - 9 => 'überall', - ]; - - public static $showONs = [ - 1 => 'Kunden Bestellungen', - 2 => 'Vertriebspartner Bestellungen', - 3 => 'Microsite', - 4 => 'Registrierung Vertriebspartner', - 5 => 'Mitgliedschaft Vertriebspartner', - //6 => 'Onboarding Berater', - 10 => 'überall', - ]; - + public function getShowAtType(){ - return isset(self::$showATs[$this->show_at]) ? self::$showATs[$this->show_at] : '-'; + return isset(Type::$payShowATs[$this->show_at]) ? Type::$payShowATs[$this->show_at] : '-'; } public function getShowOnTypes(){ $ret = []; if($this->show_on){ foreach($this->show_on as $show){ - $ret[] = isset(self::$showONs[$show]) ? self::$showONs[$show] : '-'; + $ret[] = isset(Type::$payShowONs[$show]) ? Type::$payShowONs[$show] : '-'; } } return $ret; diff --git a/app/Models/Product.php b/app/Models/Product.php index 1d3145e..f8e5148 100644 --- a/app/Models/Product.php +++ b/app/Models/Product.php @@ -2,6 +2,7 @@ namespace App\Models; +use App\Services\Type; use App\Services\Util; use Cviebrock\EloquentSluggable\Sluggable; use Illuminate\Database\Eloquent\Model; @@ -218,27 +219,7 @@ class Product extends Model 4 => 'KG', ]; - public $showATs = [ - 0 => 'Nur Kunden Bestellungen', - 1 => 'Kunden + Vertriebspartner Bestellungen', - 2 => 'Nur Vertriebspartner Bestellungen', - 3 => 'Registrierung / Mitgliedschaft Vertriebspartner', - 4 => 'Nur Mitgliedschaft Vertriebspartner', - //5 => 'Onboarding Vertriebspartner', - //6 => 'Onboarding Vertriebspartner + Vertriebspartner Shop', - 7 => 'zur internen Berechnung', - ]; - - public $showONs = [ - 1 => 'Kunden Bestellungen', - 2 => 'Vertriebspartner Bestellungen', - 3 => 'Microsite', - 4 => 'Registrierung Vertriebspartner', - 5 => 'Mitgliedschaft Vertriebspartner', - //6 => 'Onboarding Berater', - 10 => 'zur internen Berechnung', - ]; public $actions = [ @@ -439,13 +420,13 @@ class Product extends Model return isset($this->unitTypes[$this->unit]) ? $this->unitTypes[$this->unit] : '-'; } public function getShowAtType(){ - return isset($this->showATs[$this->show_at]) ? $this->showATs[$this->show_at] : '-'; + return isset(Type::$showATs[$this->show_at]) ? Type::$showATs[$this->show_at] : '-'; } public function getShowOnTypes(){ $ret = []; foreach($this->show_on as $show){ - $ret[] = isset($this->showONs[$show]) ? $this->showONs[$show] : '-'; + $ret[] = isset(Type::$showONs[$show]) ? Type::$showONs[$show] : '-'; } return $ret; } diff --git a/app/Models/ProductCategory.php b/app/Models/ProductCategory.php index edeebeb..e86571b 100644 --- a/app/Models/ProductCategory.php +++ b/app/Models/ProductCategory.php @@ -2,6 +2,7 @@ namespace App\Models; +use App\Services\Type; use Illuminate\Database\Eloquent\Model; /** @@ -28,8 +29,12 @@ class ProductCategory extends Model { protected $table = 'product_categories'; + protected $casts = [ + 'show_on' => 'array', + ]; + protected $fillable = [ - 'product_id', 'category_id', + 'pos', 'product_id', 'category_id', 'show_on' ]; public function product() @@ -42,4 +47,12 @@ class ProductCategory extends Model return $this->belongsTo('App\Models\Category', 'category_id'); } + public function getShowOnTypes(){ + $ret = []; + foreach($this->show_on as $show){ + $ret[] = isset(Type::$showONs[$show]) ? Type::$showONs[$show] : '-'; + } + return $ret; + } + } diff --git a/app/Models/Shipping.php b/app/Models/Shipping.php index 61f711e..d8c4454 100644 --- a/app/Models/Shipping.php +++ b/app/Models/Shipping.php @@ -80,6 +80,13 @@ class Shipping extends Model } public function getShippingPricesBy($shipping_for){ - return $this->hasMany('App\Models\ShippingPrice', 'shipping_id', 'id')->where('shipping_for', $shipping_for); + return ShippingPrice::where('shipping_id', $this->id)->where('shipping_for', $shipping_for)->get(); } + + public function getShippingPricesFirstBy($shipping_for){ + return ShippingPrice::where('shipping_id', $this->id)->where('shipping_for', $shipping_for) ->orderBy('price', 'ASC')->first(); + } + + + } diff --git a/app/Repositories/ProductRepository.php b/app/Repositories/ProductRepository.php index c0a1b91..bf6724d 100644 --- a/app/Repositories/ProductRepository.php +++ b/app/Repositories/ProductRepository.php @@ -159,7 +159,18 @@ class ProductRepository extends BaseRepository { 'attribute_id' => $attribute->attribute_id, ]); } + //INCS + $ingredients = $model->p_ingredients()->pluck('ingredient_id')->toArray(); + if(is_array($ingredients)){ + foreach ($ingredients as $incs_id){ + ProductIngredient::create([ + 'product_id' => $this->model->id, + 'ingredient_id' => $incs_id, + ]); + } + } + //images foreach ($model->images as $image){ $name = \App\Services\Slim::sanitizeFileName($image->original_name); diff --git a/app/Services/HTMLHelper.php b/app/Services/HTMLHelper.php index f49a90a..ceb7be6 100644 --- a/app/Services/HTMLHelper.php +++ b/app/Services/HTMLHelper.php @@ -211,6 +211,19 @@ class HTMLHelper 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 .= '\n'; + } + foreach ($values as $value){ + $attr = in_array($value->id, $ids) ? 'selected="selected"' : ''; + $ret .= '\n'; + } + return $ret; + } + public static function getProductIngredientsOptions($has_ids = array(), $all = true){ $values = Ingredient::where('active', 1)->get(); $ret = ""; @@ -327,8 +340,20 @@ class HTMLHelper return "not defined"; } - public static function getCountriesForShipping($id, $all=false){# + public static function getCountriesForShipping($id, $all=false, $shipping_for = false){# $values = ShippingCountry::all(); + + if($shipping_for){ + $temp = []; + foreach($values as $value){ + if($shipping = $value->shipping){ + if($shipping->getShippingPricesFirstBy($shipping_for)){ + $temp[] = $value; + } + } + } + $values = $temp; + } $ret = ""; if($all){ $ret .= '\n'; diff --git a/app/Services/PromotionCart.php b/app/Services/PromotionCart.php index 394b819..429b5f8 100644 --- a/app/Services/PromotionCart.php +++ b/app/Services/PromotionCart.php @@ -28,7 +28,7 @@ class PromotionCart { if($ShippingCountry = ShippingCountry::all()->first()){ if($ShippingCountry->shipping){ - if($ShippingPrices = $ShippingCountry->shipping->getShippingPricesBy($shipping_for)->orderBy('price', 'ASC')->first()){ + if($ShippingPrices = $ShippingCountry->shipping->getShippingPricesFirstBy($shipping_for)){ return formatNumber($ShippingPrices->price); } } @@ -48,6 +48,18 @@ class PromotionCart } + public static function changeStateShipping($data) + { + $id = 1; + if($ShippingCountry = ShippingCountry::find($data['shipping_country_id'])){ + $id = $ShippingCountry->id; + } + Yard::instance('shopping')->setShippingCountryWithPrice($id, 'shop'); + } + + + + public static function updateProduct($data, $add=false) { if($product = Product::find($data['product_id'])){ @@ -100,7 +112,8 @@ class PromotionCart [ 'image' => $image, 'slug' => $product->slug, - 'weight' => $product->weight, + //'weight' => $product->weight, + 'weight' => 1, 'free_product_id' => intval($data['free_product_id']), 'product_id' => $product->id ]); diff --git a/app/Services/Type.php b/app/Services/Type.php new file mode 100644 index 0000000..c41f37d --- /dev/null +++ b/app/Services/Type.php @@ -0,0 +1,53 @@ + 'Nur Kunden Bestellungen', + 1 => 'Kunden + Vertriebspartner Bestellungen', + 2 => 'Nur Vertriebspartner Bestellungen', + 3 => 'Registrierung / Mitgliedschaft Vertriebspartner', + 4 => 'Nur Mitgliedschaft Vertriebspartner', + //5 => 'Onboarding Vertriebspartner', + //6 => 'Onboarding Vertriebspartner + Vertriebspartner Shop', + 7 => 'zur internen Berechnung', + + ]; + + public static $showONs = [ + 1 => 'Kunden Bestellungen', + 2 => 'Vertriebspartner Bestellungen', + 3 => 'Microsite', + 4 => 'Registrierung Vertriebspartner', + 5 => 'Mitgliedschaft Vertriebspartner', + //6 => 'Onboarding Berater', + 10 => 'zur internen Berechnung', + ]; + + + public static $payShowATs = [ + 0 => 'Nur Kunden Shop', + 1 => 'Nur Vertriebspartner Shop', + 2 => 'Kunden + Vertriebspartner Shop', + 3 => 'Nur Reg/Mitgliedschaft Vertriebspartner', + 4 => 'Kunden + Vertriebspartner Shop + Reg/Mitgliedschaft', + 5 => 'Vertriebspartner Shop + Reg/Mitgliedschaft', + 9 => 'überall', + ]; + + public static $payShowONs = [ + 1 => 'Kunden Bestellungen', + 2 => 'Vertriebspartner Bestellungen', + 3 => 'Microsite', + 4 => 'Registrierung Vertriebspartner', + 5 => 'Mitgliedschaft Vertriebspartner', + //6 => 'Onboarding Berater', + 10 => 'überall', + ]; + + +} \ No newline at end of file diff --git a/app/Services/Yard.php b/app/Services/Yard.php index feeddab..abb234f 100644 --- a/app/Services/Yard.php +++ b/app/Services/Yard.php @@ -181,7 +181,6 @@ class Yard extends Cart return $this->shipping_country_id; } - public function getYContent() { if (is_null($this->ysession->get($this->yinstance))) { @@ -366,11 +365,14 @@ class Yard extends Cart //sec by weight if(!$shipping_price){ $shipping_price = $this->shippingPriceByWeight($shipping->getShippingPricesBy($shipping_price_for), $this->weight()); + + } //default if(!$shipping_price){ $shipping_price = $shipping->getShippingPricesBy($shipping_price_for)->first(); } + } if($shipping_price){ $price = $shipping_price->price; @@ -443,7 +445,6 @@ class Yard extends Cart private function shippingTax($decimals = null, $decimalPoint = null, $thousandSeperator = null) { return $this->numberFormat($this->shipping_tax, $decimals, $decimalPoint, $thousandSeperator); - } /* private function subShipping($decimals = null, $decimalPoint = null, $thousandSeperator = null){ diff --git a/database/migrations/2018_10_21_163959_create_categories_table.php b/database/migrations/2018_10_21_163959_create_categories_table.php index c2dc19f..6042ad0 100644 --- a/database/migrations/2018_10_21_163959_create_categories_table.php +++ b/database/migrations/2018_10_21_163959_create_categories_table.php @@ -25,6 +25,8 @@ class CreateCategoriesTable extends Migration $table->text('trans_headline')->nullable(); $table->text('trans_name')->nullable(); $table->unsignedTinyInteger('pos')->nullable()->default(0); + $table->string('show_on')->nullable(); + $table->boolean('active')->default(false); $table->string('slug')->unique()->index(); diff --git a/database/migrations/2018_10_21_164005_create_product_categories_table.php b/database/migrations/2018_10_21_164005_create_product_categories_table.php index 439cc6a..909ed01 100644 --- a/database/migrations/2018_10_21_164005_create_product_categories_table.php +++ b/database/migrations/2018_10_21_164005_create_product_categories_table.php @@ -16,8 +16,10 @@ class CreateProductCategoriesTable extends Migration Schema::create('product_categories', function (Blueprint $table) { $table->increments('id'); + $table->tinyInteger('pos')->unsigned()->nullable(); $table->unsignedInteger('product_id')->index(); $table->unsignedInteger('category_id')->index(); + $table->string('show_on')->nullable(); $table->timestamps(); diff --git a/public/css/shop.css b/public/css/shop.css index 19383ee..5e68b51 100644 --- a/public/css/shop.css +++ b/public/css/shop.css @@ -11,6 +11,7 @@ html { body.custom-background { background-color: #f4f1ef; color: rgb(119, 119, 119); + font-size: 17px; } .text-body { @@ -100,7 +101,7 @@ h1, h2, h3, h4, .typo-heading { color: rgb(64, 65, 66); } p { - font-size: 16px; + font-size: 17px; } h4.product-title { @@ -110,7 +111,8 @@ h4.product-title { } .product-description { - height: 4rem; + font-size: 16px; + height: 4.3rem; overflow: hidden; margin-bottom: .5rem; } @@ -229,12 +231,14 @@ h4.product-title { .dropdown-item:hover, .dropdown-item:focus { + background-color: #d6d6d6; color: #46564d; } .dropdown-item.active, .dropdown-item:active { background-color: #46564d; + color:#fff !important; } label { @@ -269,6 +273,11 @@ label .required { } .switcher-label { cursor: pointer; + font-size: 16px; + +} +.switcher .switcher-indicator { + top: 0.1rem; } table.table-payment td { @@ -277,8 +286,6 @@ table.table-payment td { border-bottom: 1px solid #c6c2bf; } - - .yard-items-head { border-bottom: 1px solid #c6c2bf; padding-bottom: 8px; @@ -390,4 +397,64 @@ table.table-payment td { .spinner { display: none; +} + +.tab-content p { + font-size: 1em; +} + +.btn-add-product-shop { + font-size: 16px; +} + +@media (max-width: 991px) { + + .intro-media .media { + display: block; + text-align: center; + } + + .intro-media .media img.d-block { + display: inline-block !important; + margin-bottom: 1em; + } +} +.media-body ul { + padding-left: 1.8rem; +} + +.media-body .table { + font-size:16px; + color: rgb(119, 119, 119); +} +.modal-body .table { + font-size:16px; + color: rgb(119, 119, 119); +} +.media-body table th, .media-body .table td { + padding: 0.4rem; +} +.no-border { + border: none; +} + +.card-header a .fa-caret-collapse { + width: 0.8em; +} +.card-header a.collapsed .fa-caret-collapse:before { + content: "\f0da"; + } + +.card-header a .fa-caret-collapse:before{ + content: "\f0d7"; + } + +.not-show { + display: none; +} + + +.ui-w-150 { + width: 150px !important; + height: auto; } \ No newline at end of file diff --git a/public/js/iq-promotion-shop-cart.js b/public/js/iq-promotion-shop-cart.js index 963e570..4dca58d 100644 --- a/public/js/iq-promotion-shop-cart.js +++ b/public/js/iq-promotion-shop-cart.js @@ -19,11 +19,13 @@ var IqPromotionShopCart = { cart_holder: '#promotion_cart_holder', invoice_holder: '#invoice_details_holder', checkout_holder: '#promotion_checkout_holder', + show_products_holder: '#show_products_holder', + free_product_id: null, shipping_option: null, + show_products_option: null, - init: function () { var _self = this; _self.url = $('input[name=load_url]').val(); @@ -47,8 +49,12 @@ var IqPromotionShopCart = { event.preventDefault(); _self.switchShipping($(this)); }); - _self.showInit(); + $('select[name=show_products_filter]').on('change', function(event){ + event.preventDefault(); + _self.switchShowProducts($(this)); + }); + _self.showInit(); /*$_self.update_poduct_price();*/ @@ -69,12 +75,22 @@ var IqPromotionShopCart = { _self.performRequest({product_id: $(this).data('product-id'), qty: 0, action: 'remove-shop-product'}) .done(_self.refreshItemsAndView); }); + $('#shipping_state').on('change', function(){ + if ($('#shipping_address_switch').is(':checked')) { + _self.changeStateShipping($(this).val()); + } + }); + $('#billing_state').on('change', function(){ + if (!$('#shipping_address_switch').is(':checked')) { + _self.changeStateShipping($(this).val()); + } + }); + }, - switchShipping: function(_ele){ + changeStateShipping: function(_state_id){ var _self = this; - _self.shipping_option = _ele.val(); - _self.performRequest({shipping_option: _self.shipping_option, action: 'switch-shipping'}) - .done(_self.refreshItemsAndView); + _self.performRequest({shipping_country_id: _state_id, action: 'change-state-shipping'}) + .done(_self.refreshItemsAndView); }, switchFreeProduct: function(_ele){ var _self = this; @@ -93,7 +109,28 @@ var IqPromotionShopCart = { .done(_self.refreshItemsAndView); } }, - + switchShipping: function(_ele){ + var _self = this; + _self.shipping_option = _ele.val(); + _self.performRequest({shipping_option: _self.shipping_option, action: 'switch-shipping'}) + .done(_self.refreshItemsAndView); + }, + switchShowProducts: function(_ele){ + var _self = this; + _self.show_products_option = _ele.val(); + _self.performRequest({show_products_option: _self.show_products_option, action: 'switch-show_products'}) + .done(_self.refreshShowProducts); + }, + refreshShowProducts: function (data){ + var _self = IqPromotionShopCart; + if(data.shop_products_view){ + $(_self.show_products_holder).html(data.shop_products_view); + } + $(_self.btn_shop_add).on('click', function(event){ + event.preventDefault(); + _self.addShopProduct($(this)); + }); + }, updateInputCart: function (_ele){ var _self = this; var qty = parseInt(_ele.val()); @@ -130,6 +167,11 @@ var IqPromotionShopCart = { if(data.checkout){ $(_self.checkout_holder).html(data.checkout); } + if(data.response.shipping_price_formated){ + $('#shipping_price_holder').html(data.response.shipping_price_formated); + } + + _self.showInit(); }, performRequest : function(data) { diff --git a/resources/lang/de/email.php b/resources/lang/de/email.php index 15dbe5c..553accc 100644 --- a/resources/lang/de/email.php +++ b/resources/lang/de/email.php @@ -50,9 +50,9 @@ 'credit_title' => 'Gutschrift aus Vertriebspartnerbestellungen auf Grüne Seele', 'invoice_copy1line' => 'vielen Dank für Deine Bestellung bei Grüne Seele. Nachfolgend senden wir Dir die Rechnung zu deiner Bestellung: ', 'credit_copy1line' => 'vielen Dank für Deine Vertriebspartnerschaft bei Grüne Seele. Nachfolgend senden wir Dir Deine Gutschrift zu. Der Betrag wird zeitnah angewiesen, bitte prüfen deine Zahlungsdaten in deinem Konto: Mein Konto -> Meine Daten.', - 'footer_copy1' => 'GRÜNE SEELE GbR | Hauptstrasse 174 | 51143 Köln | Telefon: (+49) 2203 183 86 14 | E-Mail: service@gruene-seele.bio', + 'footer_copy1' => 'GRÜNE SEELE GmbH | Hauptstrasse 174 | 51143 Köln | Telefon: (+49) 2203 183 86 14 | E-Mail: service@gruene-seele.bio', 'footer_copy2' => '', - 'footer_copy3' => '© 2021 All Rights Reserved', + 'footer_copy3' => '© 2022 All Rights Reserved', 'checkout_mail_hl1' => 'Du hast folgende Artikel bestellt:', 'checkout_mail_shipping' => 'Verpackungs- u. Versandkosten', 'checkout_mail_status_info' => 'Statusinfo:', diff --git a/resources/views/admin/category/edit.blade.php b/resources/views/admin/category/edit.blade.php index 7288499..3ddbe3d 100755 --- a/resources/views/admin/category/edit.blade.php +++ b/resources/views/admin/category/edit.blade.php @@ -23,6 +23,7 @@ {!! Form::open(['url' => route('admin_product_category_store'), 'class' => 'form-horizontal', 'id'=>'']) !!} +
  @@ -38,6 +39,7 @@ {!! Form::close() !!} + @include('admin.category.products') @include('admin.category.images') diff --git a/resources/views/admin/category/form.blade.php b/resources/views/admin/category/form.blade.php index c80cb62..9b670ae 100755 --- a/resources/views/admin/category/form.blade.php +++ b/resources/views/admin/category/form.blade.php @@ -27,12 +27,20 @@
-
+
+ + {{ Form::select('show_on[]', \App\Services\Type::$showONs, $category->show_on, array('data-live-search'=>'false', 'class'=>'selectpicker', 'id'=>'show_on', 'multiple') ) }} +
+
+ +
+ {{--
+ --}}
{{ Form::text('pos', $category->pos, array('placeholder'=>__('pos'), 'class'=>'form-control', 'id'=>'pos')) }} diff --git a/resources/views/admin/category/index.blade.php b/resources/views/admin/category/index.blade.php index c0580a6..cf72082 100755 --- a/resources/views/admin/category/index.blade.php +++ b/resources/views/admin/category/index.blade.php @@ -11,32 +11,39 @@   {{__('Pos')}} - {{__('Hauptkategorie')}} + {{__('Kategorie')}} + {{--{{__('Kategorie')}}--}} {{__('Headline')}} - {{__('Translate') }} + {{__('Headline')}} + {{__('Produkte')}} + {{__('sichbar')}} + {{-- __('Translate') --}} {{__('Status')}} - @foreach($values as $value) - - - - - - - {{ $value->pos }} - @if($value->parent) {{ $value->parent->name }} @else {{ $value->name }} @endif - @if($value->parent) {{ $value->name }} @else - @endif - {{ $value->headline }} - - @if($value->active) @else@endif - + @foreach($values as $value) + + + + + + + {{ $value->pos }} + @if($value->parent) {{ $value->parent->name }} @else {{ $value->name }} @endif + {{-- @if($value->parent) {{ $value->name }} @else - @endif--}} + {{ $value->headline }} + {{ $value->product_categories->count() }} + {!! implode($value->getShowOnTypes(), '
') !!} - - @endforeach - + {{-- {{ $value->getTranNames() }} --}} + @if($value->active) @else@endif + + + + @endforeach +
@@ -49,21 +56,11 @@ \ No newline at end of file diff --git a/resources/views/admin/modal/show_product.blade.php b/resources/views/admin/modal/show_product.blade.php index 9d945d7..2a14ffd 100644 --- a/resources/views/admin/modal/show_product.blade.php +++ b/resources/views/admin/modal/show_product.blade.php @@ -102,7 +102,8 @@
-
+
+
@@ -121,6 +122,7 @@ @endforeach
+
diff --git a/resources/views/admin/payment_method/index.blade.php b/resources/views/admin/payment_method/index.blade.php index f5ec9b1..bb7782e 100755 --- a/resources/views/admin/payment_method/index.blade.php +++ b/resources/views/admin/payment_method/index.blade.php @@ -26,7 +26,7 @@ data-pos="{{ $value->pos }}" data-name="{{ $value->name }}" data-short="{{ $value->short }}" - data-show_at="{{ $value->show_at }}" + data-show_on="{{ json_encode($value->show_on) }}" data-max_price="{{ $value->getFormattedMaxPrice() }}" data-default="{{ $value->default }}" data-active="{{ $value->active }}"> @@ -35,7 +35,7 @@ {{ $value->pos }} {{ $value->name }} ({{ $value->short }}) - {{ $value->getShowAtType() }} + {!! implode($value->getShowOnTypes(), '
') !!} {!! get_active_badge($value->default) !!} {!! get_active_badge($value->active) !!} @@ -49,7 +49,7 @@ data-name="" data-short="" data-max_price="" - data-show_at="9" + data-show_on="[]" data-default="1" data-active="1" >{{__('Neue Zahlungsart hinzufügen')}} @@ -85,17 +85,25 @@
-
- -
- - {{ Form::select('show_at', \App\Models\PaymentMethod::$showATs, 9, array('data-live-search'=>'false', 'class'=>'selectpicker', 'id'=>'show_at') ) }} +
+ + {{ Form::select('show_on[]', \App\Services\Type::$payShowONs, 10, array('data-live-search'=>'false', 'class'=>'selectpicker', 'id'=>'show_on', 'multiple') ) }}
+
+
+ +
+
+ + + +
+
@@ -105,9 +113,7 @@ {{__('active')}}
-
- -
+
@@ -137,7 +143,7 @@ $(this).find(".modal-body input[name='short']").val(button.data('short')); $(this).find(".modal-body input[name='max_price']").val(button.data('max_price')); $(this).find(".modal-body input[name='pos']").val(button.data('pos')); - $(this).find(".modal-body select[name='show_at']").val(button.data('show_at')); + $(this).find(".modal-body select[name='show_on[]']").val(button.data('show_on')); $(this).find(".modal-body input[name='active']").prop( "checked", button.data('active')); $(this).find(".modal-body input[name='default']").prop( "checked", button.data('default')); diff --git a/resources/views/admin/product/form.blade.php b/resources/views/admin/product/form.blade.php index c457019..2feb38f 100755 --- a/resources/views/admin/product/form.blade.php +++ b/resources/views/admin/product/form.blade.php @@ -16,12 +16,13 @@ {{ Form::text('name', $product->name, array('placeholder'=>__('Name'), 'class'=>'form-control', 'id'=>'name', 'required')) }}
-
+ {{--
- {{ Form::select('show_at', $product->showATs, $product->show_at, array('data-live-search'=>'false', 'class'=>'selectpicker', 'id'=>'show_at') ) }} + {{ Form::select('show_at', \App\Services\Type::$showATs, $product->show_at, array('data-live-search'=>'false', 'class'=>'selectpicker', 'id'=>'show_at') ) }}
+ --}}
@@ -38,7 +39,7 @@
- {{ Form::select('show_on[]', $product->showONs, $product->show_on, array('data-live-search'=>'false', 'class'=>'selectpicker', 'id'=>'show_on', 'multiple') ) }} + {{ Form::select('show_on[]', \App\Services\Type::$showONs, $product->show_on, array('data-live-search'=>'false', 'class'=>'selectpicker', 'id'=>'show_on', 'multiple') ) }}
diff --git a/resources/views/layouts/includes/layout-sidenav.blade.php b/resources/views/layouts/includes/layout-sidenav.blade.php index dd22a73..4eb682a 100644 --- a/resources/views/layouts/includes/layout-sidenav.blade.php +++ b/resources/views/layouts/includes/layout-sidenav.blade.php @@ -91,14 +91,11 @@ @endif {{-- TODO Remove isAdmin --}} - @if(Auth::user()->isActiveAccount() && Auth::user()->isAdmin()) + @if(Auth::user()->isActiveAccount())
  • {{ __('navigation.my_promotions') }}
    -
    -
    Admin
    -
    • diff --git a/resources/views/pdf/credit.blade.php b/resources/views/pdf/credit.blade.php index 1714f8e..156cb34 100644 --- a/resources/views/pdf/credit.blade.php +++ b/resources/views/pdf/credit.blade.php @@ -264,7 +264,7 @@
      -
      GRÜNE SEELE GbR • Hauptstr. 174 • 51143 Köln
      +
      GRÜNE SEELE GmbH • Hauptstr. 174 • 51143 Köln
      @if($user->account) @if($user->account->company) {{ $user->account->company }}
      diff --git a/resources/views/pdf/invoice.blade.php b/resources/views/pdf/invoice.blade.php index 3f575f9..4c211d7 100644 --- a/resources/views/pdf/invoice.blade.php +++ b/resources/views/pdf/invoice.blade.php @@ -264,7 +264,7 @@
      -
      GRÜNE SEELE GbR • Hauptstr. 174 • 51143 Köln
      +
      GRÜNE SEELE GmbH • Hauptstr. 174 • 51143 Köln
      @if($shopping_order->shopping_user->billing_company) {{ $shopping_order->shopping_user->billing_company }}
      diff --git a/resources/views/user/profile.blade.php b/resources/views/user/profile.blade.php index 4c77391..6bb9bb0 100644 --- a/resources/views/user/profile.blade.php +++ b/resources/views/user/profile.blade.php @@ -30,7 +30,7 @@
      @if ($user->hasProfileImage())
      - +

      -
      Copyright since 2019 • GRÜNE SEELE GbR
      +
      Copyright since 2019 • GRÜNE SEELE GmbH
      diff --git a/resources/views/web/promotion/_free_product.blade.php b/resources/views/web/promotion/_free_product.blade.php index 955fa4e..bf40745 100644 --- a/resources/views/web/promotion/_free_product.blade.php +++ b/resources/views/web/promotion/_free_product.blade.php @@ -7,7 +7,7 @@ @foreach ($promotion_user->promotion_user_products_active as $promotion_user_product) @if ($promotion_user_product->isShow()) -
      +
      @if ($promotion_user_product->product->images) @if ($image = $promotion_user_product->product->images->first()) @@ -51,7 +51,7 @@ @endforeach
      -
      +
      \ No newline at end of file diff --git a/resources/views/web/promotion/_intro.blade.php b/resources/views/web/promotion/_intro.blade.php index 5bf37c7..ade80aa 100644 --- a/resources/views/web/promotion/_intro.blade.php +++ b/resources/views/web/promotion/_intro.blade.php @@ -1,18 +1,21 @@ -
      + +
      @if($promotion_user->user->hasProfileImage()) - + @endif diff --git a/resources/views/web/promotion/_invoice_details.blade.php b/resources/views/web/promotion/_invoice_details.blade.php index 09705f2..a9e51e8 100644 --- a/resources/views/web/promotion/_invoice_details.blade.php +++ b/resources/views/web/promotion/_invoice_details.blade.php @@ -1,5 +1,35 @@

      Rechnungsdetails

      +
      +
      + +
      +
      +
      +
      + +
      +
      @@ -34,18 +64,18 @@ @endif
      -
      +
      {!! Form::text('billing_company', '', ['class' => 'form-control', 'id' => 'billing_company']) !!}
      -
      +
      @@ -62,7 +92,7 @@
      - {!! Form::text('billing_address_2', '', ['placeholder' => 'Wohnung, Suite, Zimmer usw. (optional)', 'class' => 'form-control ' . ($errors->has('billing_address_2') ? 'error' : ''), 'id' => 'billing_address_2']) !!} + {!! Form::text('billing_address_2', '', ['placeholder' => 'Zusätzliche Angaben / Hinweise (optional)', 'class' => 'form-control ' . ($errors->has('billing_address_2') ? 'error' : ''), 'id' => 'billing_address_2']) !!} @if ($errors->has('billing_address_2')) @@ -89,16 +119,6 @@ @endif
      -
      -
      - - {!! Form::text('billing_phone', '', ['class' => 'form-control ' . ($errors->has('billing_phone') ? 'error' : ''), 'id' => 'billing_phone']) !!} - @if ($errors->has('billing_phone')) - - @endif -
      -
      @@ -167,18 +187,18 @@ @endif
      -
      +
      {!! Form::text('shipping_company', '', ['class' => 'form-control', 'id' => 'shipping_company']) !!}
      -
      +
      @@ -195,7 +215,7 @@
      - {!! Form::text('shipping_address_2', '', ['placeholder' => 'Wohnung, Suite, Zimmer usw. (optional)', 'class' => 'form-control ' . ($errors->has('shipping_address_2') ? 'error' : ''), 'id' => 'shipping_address_2']) !!} + {!! Form::text('shipping_address_2', '', ['placeholder' => 'Zusätzliche Angaben / Hinweise (optional)', 'class' => 'form-control ' . ($errors->has('shipping_address_2') ? 'error' : ''), 'id' => 'shipping_address_2']) !!} @if ($errors->has('shipping_address_2')) @@ -222,16 +242,6 @@ @endif
      -
      -
      - - {!! Form::text('shipping_phone', '', ['class' => 'form-control ' . ($errors->has('shipping_phone') ? 'error' : ''), 'id' => 'shipping_phone']) !!} - @if ($errors->has('shipping_phone')) - - @endif -
      -
      \ No newline at end of file + \ No newline at end of file diff --git a/resources/views/web/promotion/_shop_products_inner.blade.php b/resources/views/web/promotion/_shop_products_inner.blade.php new file mode 100644 index 0000000..cab1874 --- /dev/null +++ b/resources/views/web/promotion/_shop_products_inner.blade.php @@ -0,0 +1,82 @@ + +
      +
      + @foreach ($shop_products as $product) + @php($cartItem = Yard::instance('shopping')->getCartItemByProduct($product->id, false, false)) + @php($qty = isset($cartItem->qty) ? "x".$cartItem->qty : 0) + @php($rowId = isset($cartItem->rowId) ? $cartItem->rowId : '') + +
      +
      + @if ($product->images) + @if ($image = $product->images->first()) + + @endif + @endif +

      + {{ $product->name }} +

      +
      + {{ $product->getShortCopy(true, 110) }} +
      + +
      + {{ $product->getFormattedPrice() }} €* +
      {{ $product->getBasePriceFormattedFull() }} € + +
      +
      + +
      +
      +
      +
      + @endforeach +
      +
      +
      +
      +
      + \ No newline at end of file diff --git a/resources/views/web/promotion/show_product.blade.php b/resources/views/web/promotion/show_product.blade.php index ae3e465..269d472 100644 --- a/resources/views/web/promotion/show_product.blade.php +++ b/resources/views/web/promotion/show_product.blade.php @@ -1,14 +1,11 @@