diff --git a/.idea/workspace.xml b/.idea/workspace.xml index c3b2448..5005720 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -1,88 +1,35 @@ + + - - - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - + + + - - - - - - - + - - - - - - - - - - + + + + + + + + + + + - - @@ -582,6 +529,9 @@ + + + @@ -618,10 +568,10 @@ - + - + @@ -670,21 +620,21 @@ - + - + - + - + diff --git a/app/Http/Controllers/User/CustomerController.php b/app/Http/Controllers/User/CustomerController.php index e391a92..f1affca 100755 --- a/app/Http/Controllers/User/CustomerController.php +++ b/app/Http/Controllers/User/CustomerController.php @@ -79,39 +79,66 @@ class CustomerController extends Controller abort(404); } } - if(old('email') || old('billing_email')){ - $step = 1; - $shopping_user->same_as_billing = true; + + $billing_email = null; + if(!session('errors')){ + if(old('email') || old('billing_email')){ + $step = 1; + $shopping_user->same_as_billing = true; + $billing_email = old('email'); + } + if(old('switcher-without-email') === 'true'){ + $step = 1; + $shopping_user->same_as_billing = true; + $billing_email = time()."@faker-mivita.care"; + } } $data = [ 'shopping_user' => $shopping_user, 'isAdmin' => false, 'isView' => $step === 0 ? 'customer' : 'customer-add', 'step' => $step, - 'billing_email' => old('email'), + 'billing_email' => $billing_email, ]; return view('user.customer.add', $data); } + private function checkShoppingUsersEmail($data){ + $rules = array( + 'email' => 'required|string|email|max:255|unique:shopping_users,billing_email', + ); + $messages = [ + 'unique' => __('validation.custom.unique_email_client'), + ]; + $validator = Validator::make(Request::all(), $rules, $messages); + if ($validator->fails()) { + return back()->withErrors($validator)->withInput(Request::all()); + } + + $rules = array( + 'email' => 'required|string|email|max:255|unique:users,email', + ); + $messages = [ + 'unique' => __('validation.custom.unique_email_member'), + ]; + $validator = Validator::make(Request::all(), $rules, $messages); + if ($validator->fails()) { + return back()->withErrors($validator)->withInput(Request::all()); + } + + return back()->withInput(Request::all()); + } + public function store($id) { $data = Request::all(); - if($id === 'new' && $data['action'] === 'add_customer_step_email'){ - $rules = array( - 'email' => 'required|string|email|max:255|unique:shopping_users,billing_email', - ); - $messages = [ - 'unique' => __('validation.custom.unique_email_client'), - ]; - $validator = Validator::make(Request::all(), $rules, $messages); - if ($validator->fails()) { - return back()->withErrors($validator)->withInput(Request::all()); - } - //okay, go to step 1 + if($id === 'new' && $data['action'] === 'add_customer_with_email'){ + return $this->checkShoppingUsersEmail($data); + } + if($id === 'new' && $data['action'] === 'add_customer_without_email'){ return back()->withInput(Request::all()); - } if($data['action'] === 'shopping-user-store-new' || $data['action']==='shopping-user-store'){ @@ -159,6 +186,7 @@ class CustomerController extends Controller CustomerPriority::checkChangeOne($shopping_user, $data, true); $shopping_user->fill($data); $shopping_user->save(); + } if($id === 'new' && $data['action'] === 'shopping-user-store-new') { @@ -169,6 +197,10 @@ class CustomerController extends Controller } \App\Services\Shop::newUserOrder($shopping_user->number); + if($shopping_user->is_like){ + \Session()->flash('custom-error', __('validation.custom.match_found')); + } + \Session()->flash('alert-save', true); return redirect(route('user_customer_detail', [$shopping_user->id])); } @@ -209,7 +241,7 @@ class CustomerController extends Controller return get_active_badge($ShoppingUser->subscribed); }) ->addColumn('status', function (ShoppingUser $ShoppingUser) { - return $ShoppingUser->is_like ? ' in Prüfung ' : ' aktiv'; + return $ShoppingUser->is_like ? ' in Prüfung ' : ' zugewiesen'; }) ->addColumn('extras', function (ShoppingUser $ShoppingUser) { return $ShoppingUser->wp_order_number.($ShoppingUser->mode==='dev' ? ' dev' : ''); diff --git a/app/Http/Controllers/User/OrderController.php b/app/Http/Controllers/User/OrderController.php index a35b927..946d8e7 100755 --- a/app/Http/Controllers/User/OrderController.php +++ b/app/Http/Controllers/User/OrderController.php @@ -4,12 +4,14 @@ namespace App\Http\Controllers\User; use App\Http\Controllers\Controller; use App\Models\Product; +use App\Models\ShippingCountry; use App\Models\ShoppingOrder; use App\Models\ShoppingUser; -use App\Services\HTMLHelper; -use App\Services\Payment; use App\User; +use Auth; use Request; +use Validator; +use Yard; class OrderController extends Controller @@ -17,10 +19,9 @@ class OrderController extends Controller public function __construct() { - $this->middleware('active.shop'); + $this->middleware('active.account'); } - public function index() { $data = [ @@ -47,22 +48,23 @@ class OrderController extends Controller { $user = User::find(\Auth::user()->id); - /*if (Request::isMethod('post')) { - $data = Request::all(); - if($data['switchers-radio-is-for'] === 'is-for-member'){ - return redirect(route('user_order_my_list', ['me'])); - } - if($data['switchers-radio-is-for'] === 'is-for-customer'){ - //check ist customer - return redirect(route('user_order_my_list', ['ot', $id])); - } - }*/ $shopping_user = null; $delivery_id = null; if($for === 'ot'){ $shopping_user = $this->checkShoppingUser($id, $user); $delivery_id = $shopping_user->id; + if(!$this->checkShoppingCountry($for, $delivery_id) && !\Session()->has('custom-error')){ + \Session()->flash('custom-error', __('validation.custom.shipping_not_found')); + return redirect(route('user_order_my_delivery', [$for, $delivery_id])); + } + } + if(Request::get('action') === 'next'){ + Yard::instance('shopping')->destroy(); + if(Request::get('switchers-radio-is-for') === 'ot'){ + $delivery_id = $id; + } + return redirect(route('user_order_my_list', [Request::get('switchers-radio-is-for'), $delivery_id])); } $data = [ @@ -78,19 +80,26 @@ class OrderController extends Controller public function list($for, $id=null) { $user = User::find(\Auth::user()->id); - $shopping_user = null; $delivery_id = null; + if($for === 'ot'){ $shopping_user = $this->checkShoppingUser($id, $user); $delivery_id = $shopping_user->id; } - //$data = Request::all(); - //dd(session('switchers-radio-is-for')); - //$shopping_user = new ShoppingUser(); - //$shopping_user->id = "new"; - //$shopping_user->same_as_billing = true; + $shipping_country_id = $this->checkShoppingCountry($for, $id); + if(!$shipping_country_id){ + \Session()->flash('custom-error', __('validation.custom.shipping_not_found')); + return redirect(route('user_order_my_delivery', [$for, $delivery_id])); + } + Yard::instance('shopping')->setShippingCountryWithPrice($shipping_country_id, $for); + + $comp_products = null; + if($for === 'me'){ + $comp_products = Product::whereActive(true)->where('show_at', '=', 1)->where('shipping_addon', true)->orderBy('pos', 'DESC')->get(); + + } $data = [ 'shopping_user' => $shopping_user, 'user' => $user, @@ -98,11 +107,129 @@ class OrderController extends Controller 'isView' => 'customer', 'for' => $for, 'delivery_id' => $delivery_id, - + 'comp_products' => $comp_products, ]; return view('user.order.list', $data); } + public function payment($for, $id=null){ + + $data = Request::all(); + + $user = User::find(Auth::user()->id); + $rules = array( + 'shipping_salutation' => 'required', + 'shipping_firstname'=>'required', + 'shipping_lastname'=>'required', + 'shipping_address'=>'required', + 'shipping_zipcode'=>'required', + 'shipping_city' => 'required', + 'shipping_state' => 'required', + ); + $validator = Validator::make(Request::all(), $rules); + if ($validator->fails()) { + return back()->withErrors($validator)->withInput(Request::all()); + } + + if($for === 'me'){ + if(Request::get('switchers-comp-product')) { + $product = Product::find(Request::get('switchers-comp-product')); + Yard::instance('shopping')->add($product->id, $product->getLang('name'), 1, 0, ['image' => '', 'slug' => $product->slug, 'weight' => 0]); + } + + } + // Yard::instance('shopping')->destroy(); + + return back()->withInput(Request::all()); + + if($for === 'ot' && $id){ + dd($data); + + } + + + Yard::instance('shopping')->destroy(); + $product = Product::find(Request::get('switchers-package-wizard')); + $showAboOptions = false; + if(Request::get('abo_options')){ + $showAboOptions = true; + $user->abo_options = true; + $user->save(); + } + + if($product && $product->active && $product->show_at == 3){ + //set membership product + $image = ""; + if($product->images->count()){ + $image = $product->images->first()->slug; + } + + + //set onboarding products + if(Request::get('products_on_board')){ + foreach (Request::get('products_on_board') as $product_on_board_id){ + $product_on_board = Product::find($product_on_board_id); + $image = ""; + if($product_on_board->images->count()){ + $image = $product_on_board->images->first()->slug; + } + Yard::instance('shopping')->add($product_on_board->id, $product_on_board->getLang('name'), 1, $product_on_board->price, ['image' => $image, 'slug' => $product_on_board->slug, 'weight' => $product_on_board->weight]); + } + } + + do { + $identifier = Util::getToken(); + } while( ShoppingInstance::where('identifier', $identifier)->count() ); + + ShoppingInstance::create([ + 'identifier' => $identifier, + 'user_shop_id' => 1, //is first faker shop for buy intern + 'auth_user_id' => Auth::user()->id, + 'payment' => 4, //Berater Wizard + 'subdomain' => url('/'), + 'country_id' => Yard::instance('shopping')->getShippingCountryId(), + + ]); + Yard::instance('shopping')->store($identifier); + //add to DB + $path = route('checkout.checkout_card', ['identifier'=>$identifier]); + UserHistory::create(['user_id' => $user->id, 'action'=>'wizard_payment', 'status'=>1, 'product_id'=>$product->id, 'identifier'=>$identifier, 'abo_options'=>$showAboOptions]); + //$path = str_replace('http', 'https', $path); + return redirect()->secure($path); + + } + + \Session()->flash('alert-error', "Fehler beim Produkt"); + return back(); + } + + private function checkShoppingCountry($for, $id=null){ + $country_id = null; + if($for === 'me'){ + $user = User::find(\Auth::user()->id); + if($user->same_as_billing){ + $country_id = $user->account->country_id; + }else{ + $country_id = $user->account->shipping_country_id; + } + } + if($for === 'ot' && $id){ + $shopping_user = ShoppingUser::findOrFail($id); + if($shopping_user->same_as_billing){ + $country_id = $shopping_user->billing_country_id; + }else{ + $country_id = $shopping_user->shipping_country_id; + } + } + + if($country_id){ + if($shipping_country = ShippingCountry::whereCountryId($country_id)->first()){ + return $shipping_country->id; + } + } + return false; + } + private function checkShoppingUser($id, $user){ if($id === null){ abort(403, 'Error: Keine User ID'); @@ -129,27 +256,22 @@ class OrderController extends Controller return \DataTables::eloquent($query) ->addColumn('add_card', function (Product $product) { - return ' + return ''; }) ->addColumn('quantity', function (Product $product) { - //return ''; + $cartItem = Yard::instance('shopping')->getCartItemByProduct($product->id); + $qty = isset($cartItem->qty) ? $cartItem->qty : 0; + $rowId = isset($cartItem->rowId) ? $cartItem->rowId : ''; return '
- + - + - +
'; @@ -161,22 +283,27 @@ class OrderController extends Controller } return ""; }) - ->addColumn('price', function (Product $product) { - return $product->getFormattedPriceWith(); + ->addColumn('price_net', function (Product $product) { + return $product->getFormattedPriceWith(true, true). " €"; + }) + ->addColumn('price_gross', function (Product $product) { + return $product->getFormattedPriceWith(false, true). " €"; + }) + ->addColumn('price_vk_gross', function (Product $product) { + return $product->getFormattedPriceWith(false, false). " €"; }) ->addColumn('action', function (Product $product) { return ''; - - }) - ->orderColumn('name', 'name $1') ->orderColumn('number', 'number $1') ->orderColumn('points', 'points $1') - ->orderColumn('price', 'price $1') + ->orderColumn('price_net', 'price_net $1') + ->orderColumn('price_gross', 'price_gross $1') + ->orderColumn('price_vk_gross', 'price_vk_gross $1') ->orderColumn('contents_total', 'contents_total $1') ->orderColumn('weight', 'weight $1') ->rawColumns(['add_card', 'quantity', 'picture', 'action']) @@ -184,4 +311,82 @@ class OrderController extends Controller } + public function performRequest(){ + + if(Request::ajax()) { + $data = Request::all(); + if($data['action'] === 'updateCart' && isset($data['product_id'])){ + if($product = Product::find($data['product_id'])){ + $image = ""; + if($product->images->count()){ + $image = $product->images->first()->slug; + } + + //get the card item + $cartItem = Yard::instance('shopping')->add($product->id, $product->getLang('name'), 1, $product->getPriceWith(false, true), ['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight, 'points' => $product->points]); + Yard::setTax($cartItem->rowId, $product->tax); + + if(isset($data['qty']) && $data['qty'] > 0){ + Yard::instance('shopping')->update($cartItem->rowId, $data['qty']); + }else{ + //if 0 get the item by qty:1 and remove it + Yard::instance('shopping')->remove($cartItem->rowId); + } + $this->updateCompProduct($data); + + Yard::instance('shopping')->reCalculateShippingPrice(); + $html = view("user.order.yard_view_form", $data)->render(); + return response()->json(['response' => true, 'data'=>$data, 'html'=>$html]); + } + } + if($data['action'] === 'clearCart') { + Yard::instance('shopping')->destroy(); + return response()->json(['response' => true, 'data'=>Yard::instance('shopping')->count(), 'html'=>'']); + + } + + if($data['action'] === 'updateShippingCountry') { + if(isset($data['shipping_country_id'])){ + $is_for = isset($data['shipping_is_for']) ? $data['shipping_is_for'] : 'ot'; + if($shipping_country = ShippingCountry::find($data['shipping_country_id'])){ + Yard::instance('shopping')->setShippingCountryWithPrice($shipping_country->id, $is_for); + $this->updateCompProduct($data); + } + } + $html = view("user.order.yard_view_form", $data)->render(); + return response()->json(['response' => true, 'data'=>$data, 'html'=>$html]); + + } + if($data['action'] === 'updateCompProduct'){ + $this->updateCompProduct($data); + Yard::instance('shopping')->reCalculateShippingPrice(); + $html = view("user.order.yard_view_form", $data)->render(); + return response()->json(['response' => true, 'data'=>$data, 'html'=>$html]); + + } + return response()->json(['response' => false, 'data'=>$data]); + } + } + + private function updateCompProduct($data){ + //clear old + foreach (Yard::instance('shopping')->content() as $row) { + if($row->options->comp) { + Yard::instance('shopping')->remove($row->rowId); + } + } + if(isset($data['comp_product_id'])) { + if ($product = Product::find($data['comp_product_id'])) { + + $image = ""; + if ($product->images->count()) { + $image = $product->images->first()->slug; + } + + $cartItem = Yard::instance('shopping')->add($product->id, $product->getLang('name'), 1, 0, ['image' => $image, 'slug' => $product->slug, 'weight' => 0, 'points' => 0, 'comp' => $product->id]); + Yard::setTax($cartItem->rowId, 0); + } + } + + } } \ No newline at end of file diff --git a/app/Models/Product.php b/app/Models/Product.php index 3d0bd81..5b9fc63 100644 --- a/app/Models/Product.php +++ b/app/Models/Product.php @@ -295,7 +295,7 @@ class Product extends Model $price = $this->attributes['price']; $price = $net ? $this->calcPriceNet($price) : $price; $price = $ufactor ? $this->calcPriceUserFactor($price) : $price; - return $price; + return round($price, 2); } /*out*/ public function getFormattedPriceWith(Bool $net = true, Bool $ufactor = true) diff --git a/app/Services/Shop.php b/app/Services/Shop.php index 7dac7d3..f9b7fee 100644 --- a/app/Services/Shop.php +++ b/app/Services/Shop.php @@ -3,6 +3,7 @@ namespace App\Services; use App\Models\ShoppingUser; +use Gloudemans\Shoppingcart\CartItem; class Shop { diff --git a/app/Services/Yard.php b/app/Services/Yard.php index 1b3dcc2..b9c1f90 100644 --- a/app/Services/Yard.php +++ b/app/Services/Yard.php @@ -1,9 +1,11 @@ shipping_country_id = $this->getShippingExtra('shipping_country_id'); } + if($this->getShippingExtra('shipping_is_for')){ + $this->shipping_is_for = $this->getShippingExtra('shipping_is_for'); + } + + parent::__construct($session, $events); - if($this->shipping_country_id == 0){ + if(gettype($this->shipping_country_id) !== 'object' && $this->shipping_country_id == 0){ $shippingCountry = ShippingCountry::first(); if($shippingCountry){ $this->shipping_country_id = $shippingCountry->id; } } + if($this->shipping_price == 0){ - self::instance('shopping')->setShippingCountryWithPrice($this->shipping_country_id); + self::instance('shopping')->setShippingCountryWithPrice($this->shipping_country_id, $this->shipping_is_for); } } @@ -102,10 +113,14 @@ class Yard extends Cart $this->calculateShippingPrice(); } - public function setShippingCountryWithPrice($shipping_country_id) + public function setShippingCountryWithPrice($shipping_country_id, $shipping_is_for = 'ot') { $this->shipping_country_id = $shipping_country_id; $this->putShippingExtra('shipping_country_id', $shipping_country_id); + + $this->shipping_is_for = $shipping_is_for; + $this->putShippingExtra('shipping_is_for', $shipping_is_for); + $this->calculateShippingPrice(); } @@ -113,11 +128,15 @@ class Yard extends Cart private function calculateShippingPrice(){ $shippingCountry = ShippingCountry::find($this->shipping_country_id); + if(!$shippingCountry){ + return; + } $shipping = $shippingCountry->shipping; if($this->weight() == 0){ $shipping_price = $shipping->shipping_prices->first(); $shipping_price->price = 0; + $shipping_price->price_comp = 0; }else{ //first by price $shipping_price = $this->shippingPriceByTotal($shipping->shipping_prices, $this->total(2, '.', '')); @@ -131,10 +150,20 @@ class Yard extends Cart } } if($shipping_price){ - $this->shipping_price = $shipping_price->price; - $this->shipping_tax = $shipping_price->tax_rate; + $price = $shipping_price->price; + if($this->shipping_is_for === 'me'){ + $price = $shipping_price->price_comp; + + } + $this->shipping_price = $price; + $this->shipping_tax_rate = $shipping_price->tax_rate; + $this->shipping_price_net = round($price / ((100+$shipping_price->tax_rate) / 100), 2); + $this->shipping_tax = round($price / (100+$shipping_price->tax_rate) * 100, 2); + $this->putShippingExtra('shipping_price', $this->shipping_price); + $this->putShippingExtra('shipping_tax_rate', $this->shipping_tax_rate); $this->putShippingExtra('shipping_tax', $this->shipping_tax); + $this->putShippingExtra('shipping_price_net', $this->shipping_price_net); } } @@ -169,31 +198,36 @@ class Yard extends Cart { return $this->numberFormat($this->shipping_price, $decimals, $decimalPoint, $thousandSeperator); } + + public function shippingNet($decimals = null, $decimalPoint = null, $thousandSeperator = null) + { + return $this->numberFormat($this->shipping_price_net, $decimals, $decimalPoint, $thousandSeperator); + } // - private function shippingTax($decimals = null, $decimalPoint = null, $thousandSeperator = null){ - $shippingTax = $this->shipping_price / (100 + $this->shipping_tax) * $this->shipping_tax; - return $this->numberFormat($shippingTax, $decimals, $decimalPoint, $thousandSeperator); + 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){ - $subShipping = $this->shipping_price - $this->shippingTax($decimals, $decimalPoint, $thousandSeperator); + /* private function subShipping($decimals = null, $decimalPoint = null, $thousandSeperator = null){ + $subShipping = $this->shipping_price_net return $this->numberFormat($subShipping, $decimals, $decimalPoint, $thousandSeperator); - } - - + }*/ + //netto public function subtotalWithShipping($decimals = null, $decimalPoint = null, $thousandSeperator = null) { - $subtotal = $this->subtotal(2, '.', '') + $this->subShipping(2, '.', ''); + $subtotal = (float) $this->shipping_price_net + $this->subtotal(2, '.', ''); return $this->numberFormat($subtotal, $decimals, $decimalPoint, $thousandSeperator); } public function taxWithShipping($decimals = null, $decimalPoint = null, $thousandSeperator = null) { - $totalTax = $this->tax(2, '.', ''); - $shippingTax = $this->shippingTax(2, '.', ''); - return $this->numberFormat(($totalTax+$shippingTax), $decimals, $decimalPoint, $thousandSeperator); + $total = $this->totalWithShipping(2, '.', ''); + // $totalTax = (float) $this->tax(2, '.', '') + $this->shipping_tax; + $totalTax = $this->subtotalWithShipping(2, '.', ''); + return $this->numberFormat(($total - $totalTax), $decimals, $decimalPoint, $thousandSeperator); } @@ -220,6 +254,27 @@ class Yard extends Cart return $total; } + + public function points() + { + $content = $this->getContent(); + $total = $content->reduce(function ($total, CartItem $cartItem) { + return $total + ($cartItem->options->points ? ($cartItem->options->points * $cartItem->qty) : 0); + }, 0); + + return $total; + } + + public function compCount() + { + $content = $this->getContent(); + + $count = parent::count(); + $comp_count = $content->reduce(function ($comp_count, CartItem $cartItem) { + return $cartItem->options->comp ? $comp_count + 1 : $comp_count; + }, 0); + return $count-$comp_count; + } /** * Get the total price of the items in the cart. * @@ -271,13 +326,48 @@ class Yard extends Cart $content = $this->getContent(); $subTotal = $content->reduce(function ($subTotal, CartItem $cartItem) { - $priceTax = $cartItem->price / (100 + $cartItem->taxRate) * $cartItem->taxRate; - return $subTotal + ($cartItem->qty * ($cartItem->price - $priceTax)); + $price_net = $cartItem->price / ((100 + $cartItem->taxRate) / 100); + return $subTotal + ($cartItem->qty * $price_net); }, 0); return $this->numberFormat($subTotal, $decimals, $decimalPoint, $thousandSeperator); } + + public function getCartItemByProduct($product_id, $set_price='with'){ + if($product = Product::find($product_id)) { + $image = ""; + if ($product->images->count()) { + $image = $product->images->first()->slug; + } + $price = $product->price; + if($set_price === 'with'){ + $price = $product->getPriceWith(false, true); + } + $cartItem = $this->getCartItem($product->id, $product->getLang('name'), 1, $price, ['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight, 'points' => $product->points]); + $content = $this->getContent(); + + if ($content->has($cartItem->rowId)){ + return $content->get($cartItem->rowId); + } + return $cartItem; + } + return null; + + } + + + public function getCartItem($id, $name = null, $qty = null, $price = null, array $options = []){ + if ($id instanceof Buyable) { + $cartItem = CartItem::fromBuyable($id, $qty ?: []); + } elseif (is_array($id)) { + $cartItem = CartItem::fromArray($id); + } else { + $cartItem = CartItem::fromAttributes($id, $name, $price, $options); + } + return $cartItem; + } + public function destroy() { $this->ysession->remove($this->yinstance); @@ -285,6 +375,17 @@ class Yard extends Cart } + public function rowPriceNet(CartItem $row, $decimals = null, $decimalPoint = null, $thousandSeperator = null){ + $price = round($row->price / ((100 + $row->taxRate) /100), 4); + return $this->numberFormat($price, $decimals, $decimalPoint, $thousandSeperator); + } + + public function rowSubtotalNet(CartItem $row, $decimals = null, $decimalPoint = null, $thousandSeperator = null){ + $price = round($row->price / ((100 + $row->taxRate) /100), 4); + return $this->numberFormat(($price * $row->qty), $decimals, $decimalPoint, $thousandSeperator); + } + + /** * Get the Formated number diff --git a/app/helpers.php b/app/helpers.php index 1dfeead..c92c36e 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -21,7 +21,7 @@ if (! function_exists('get_file_last_time')) { if (file_exists($value)) { return filemtime($value); } - return date("Ymd-i", time()); + return date("Ymd-is", time()); } } diff --git a/public/js/custom.js b/public/js/custom.js index 2d89808..8645e92 100644 --- a/public/js/custom.js +++ b/public/js/custom.js @@ -45,43 +45,46 @@ jQuery(document).ready(function() { e.preventDefault(); update_modal_data_load(e, $(this)); }); + if($('.datepicker-base').length > 0) { + $('.datepicker-base').datepicker({ + orientation: 'auto right', + calendarWeeks: true, + todayBtn: 'linked', + //daysOfWeekDisabled: '1', + todayHighlight: true, + multidate: false, + daysOfWeekHighlighted: '0,6', + autoclose: true, + format: 'dd.mm.yyyy', + language: 'de', + clearBtn: true, + }); + } + if($('.datepicker-birthday').length > 0) { + $('.datepicker-birthday').datepicker({ + todayBtn: 'linked', + // daysOfWeekDisabled: '1', + multidate: false, + daysOfWeekHighlighted: '0,6', + autoclose: true, + format: 'dd.mm.yyyy', + language: 'de', + clearBtn: true, + startView: 2, - $('.datepicker-base').datepicker({ - orientation: 'auto right', - calendarWeeks: true, - todayBtn: 'linked', - //daysOfWeekDisabled: '1', - todayHighlight: true, - multidate: false, - daysOfWeekHighlighted: '0,6', - autoclose: true, - format: 'dd.mm.yyyy', - language: 'de', - clearBtn: true, - }); - - $('.datepicker-birthday').datepicker({ - todayBtn: 'linked', - // daysOfWeekDisabled: '1', - multidate: false, - daysOfWeekHighlighted: '0,6', - autoclose: true, - format: 'dd.mm.yyyy', - language: 'de', - clearBtn: true, - startView: 2, - - }); - - $('.b-material-datetime-picker').bootstrapMaterialDatePicker({ - weekStart: 1, - format : 'DD.MM.YYYY HH:mm', - shortTime: false, - nowButton : true, - clearButton: true, - lang: 'de', - //currentDate: '' - }); + }); + } + if($('.b-material-datetime-picker').length > 0) { + $('.b-material-datetime-picker').bootstrapMaterialDatePicker({ + weekStart: 1, + format: 'DD.MM.YYYY HH:mm', + shortTime: false, + nowButton: true, + clearButton: true, + lang: 'de', + //currentDate: '' + }); + } }); diff --git a/public/js/iq-shopping-cart.js b/public/js/iq-shopping-cart.js new file mode 100755 index 0000000..9a7c93a --- /dev/null +++ b/public/js/iq-shopping-cart.js @@ -0,0 +1,188 @@ + +var IqShoppingCart = { + table: "#datatables-order-list", + btn_add: '.add-product-basket', + btn_remove: '.remove-product-basket', + card_holder: '#holder_html_view_card', + is_for: null, + url: null, + btn_clear: '#clear-products-basket', + modal: null, + oTable: null, + cProductId: null, + table_input: '.table-input-event-onchange', + cart_input: '.cart-input-event-onchange', + remove_item: '.remove_item_form_cart', + shipping_state: '#change_shipping_state', + comp_product: 'switchers-comp-product', + shipping_is_for: 'shipping_is_for', + + init: function () { + var _self = this; + _self.url = $(_self.table).data('url'); + _self.is_for = $('input[name="'+_self.shipping_is_for+'"]').val(); + _self.cProductId = $('input[name="'+_self.comp_product+'"]:checked').val(); + _self.showInit(); + $(_self.shipping_state).on('change', function(){ + _self.update_shipping_state($(this)); + }); + $('input[name="'+_self.comp_product+'"]').on('change', function(){ + _self.update_comp_product(); + }); + // _self.update_comp_product(); + return _self; + }, + setDatabase: function (oTable){ + var _self = this; + _self.oTable = oTable; + }, + reInit: function (){ + var _self = this; + $(_self.table).find(_self.btn_add).on('click', function(){ + _self.add_product($(this)) + }); + + $(_self.table).find(_self.btn_remove).on('click', function(){ + _self.remove_product($(this)) + }); + $(_self.table).find(_self.table_input).off('change').on('change', function(){ + _self.update_input_table($(this)); + }); + }, + showInit: function (){ + var _self = this; + $(_self.btn_clear).on('click', function (){ + _self.performRequest({action: 'clearCart'}) + .done(_self.refreshDatabaseRefreshAndView) + }); + $(_self.cart_input).on('change', function(){ + _self.update_input_cart($(this)); + }); + $(_self.remove_item).on('click', function(){ + _self.update_cart_database($(this).data('product-id'), 0); + }); + + }, + update_shipping_state : function (_obj){ + var _self = this; + var id = parseInt(_obj.val()); + var is_for = _obj.data('is-for'); + _self.performRequest({shipping_country_id: id, shipping_is_for: is_for, action: 'updateShippingCountry'}) + .done(_self.refreshItemsAndView); + }, + update_input_table: function (_obj){ + var _self = this; + var qty = parseInt(_obj.val()); + qty = _self.checkNumber(qty); + _obj.val(qty); + _self.update_cart(_obj.data('product-id'), qty); + }, + update_input_cart: function (_obj){ + var _self = this; + var qty = parseInt(_obj.val()); + qty = _self.checkNumber(qty); + _obj.val(qty); + _self.update_cart_database(_obj.data('product-id'), qty); + }, + update_comp_product: function (){ + var _self = this; + _self.cProductId = $('input[name="'+_self.comp_product+'"]:checked').val(); + _self.performRequest({action: 'updateCompProduct'}) + .done(_self.refreshItemsAndView); + }, + add_product: function (_obj){ + var _self = this; + var input = $(_self.table).find('input[name="product_qty_'+_obj.data('product-id')+'"]'); + var qty = parseInt(input.val()) + 1; + qty = _self.checkNumber(qty); + input.val(qty); + _self.update_cart(_obj.data('product-id'), qty); + }, + remove_product: function (_obj){ + var _self = this; + var input = $(_self.table).find('input[name="product_qty_'+_obj.data('product-id')+'"]'); + var qty = parseInt(input.val()) - 1; + if(qty < 0){ + qty = 0; + } + input.val(qty); + _self.update_cart(_obj.data('product-id'), qty); + }, + update_cart_database: function (product_id, qty){ + var _self = this; + _self.performRequest({product_id: product_id, qty: qty, action: 'updateCart'}) + .done(_self.refreshDatabaseAndView); + }, + update_cart: function (product_id, qty){ + var _self = this; + _self.performRequest({product_id: product_id, qty: qty, action: 'updateCart'}) + .done(_self.refreshItemsAndView); + }, + refreshItemsAndView: function (data){ + var _self = IqShoppingCart; + $(_self.card_holder).html(data.html); + _self.showInit(); + + }, + refreshDatabaseAndView: function (data) { + var _self = IqShoppingCart; + $(_self.card_holder).html(data.html); + var input = $(_self.table).find('input[name="product_qty_'+data.data.product_id+'"]'); + input.val(data.data.qty); + _self.showInit(); + }, + refreshDatabaseRefreshAndView : function (data){ + var _self = IqShoppingCart; + $(_self.card_holder).html(data.html); + _self.showInit(); + _self.oTable.draw(); + _self.update_comp_product(); + + }, + checkNumber : function(number){ + if(number < 0 || isNaN(number)){ + return 0; + } + if(number >= 100){ + return 100; + } + return number; + }, + performRequest : function(data) { + var _self = this; + var url = _self.url, + contentType = 'application/x-www-form-urlencoded; charset=UTF-8'; + + data.shipping_is_for = _self.is_for; + data.comp_product_id = _self.cProductId; + console.log(data); + console.log(url); + + return $.ajax({ + url: url, + data: data, + type: "POST", + dataType: "json", + cache: false, + contentType: contentType, + encode: true, + headers: { + 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') + } + }) + .done(function (data) { + + console.log('performRequest'); + console.log(data); + + + + }).fail(function (jqXHR, textStatus, errorThrown) { + console.log(jqXHR); + console.log(jqXHR.responseText); + console.log(textStatus); + console.log(errorThrown); + console.log("Sorry, there was a problem!"); + }); + } +}; \ No newline at end of file diff --git a/resources/lang/de/validation.php b/resources/lang/de/validation.php index 4dc2911..fc3eb65 100755 --- a/resources/lang/de/validation.php +++ b/resources/lang/de/validation.php @@ -130,7 +130,11 @@ return [ */ 'custom' => [ + 'no_email' => 'Das Feld E-Mail muss angegeben werden', 'unique_email_client' => 'Ein Kunde mit der E-Mail-Adresse ist schon im mivita-Salescenter vorhanden', + 'unique_email_member' => 'Ein Berater mit der E-Mail-Adresse ist schon im mivita-Salescenter vorhanden', + 'match_found' => 'Kundenhoheit: Es wurde eine Übereinstimmung zu einem bestehenden Kunden gefunden, dieser Konflikt wird erst überprüft. Bis dahin hat der Kunden den Status "in Prüfung". Möchtest du eine Bestellung für den Kunden ausführen, so kannst Du die Produkte auch zu Deiner Adresse bestellen.', + 'shipping_not_found' => 'Das Lieferland ist noch nicht im System hinterlegt, bitte wende Dich an info@mivita.care um das Lieferland hinterlegen zu lassen.', 'attribute-name' => [ 'rule-name' => 'custom-message', ], diff --git a/resources/views/admin/customer/_detail.blade.php b/resources/views/admin/customer/_detail.blade.php index c1895c6..0970ffa 100644 --- a/resources/views/admin/customer/_detail.blade.php +++ b/resources/views/admin/customer/_detail.blade.php @@ -36,75 +36,94 @@ {{$shopping_user->firstEntryByNumber()->created_at->format("d.m.Y H:i")}}
+ + @if(!$shopping_user->is_like) Kundendaten bearbeiten + @endif
@endif
- - @if($isAdmin) -
-
-
- @if(isset($change_member_error) && $change_member_error) -
-
-
-
    -
  • {{ $change_member_error }}
  • -
+
+
+ @if($isAdmin) +
+ @if(isset($change_member_error) && $change_member_error) +
+
+
+
    +
  • {{ $change_member_error }}
  • +
+
-
- @endif -
Zugewiesener Berater
- @if($shopping_user->is_like) - - @else - @if($shopping_user->member) - - {{$shopping_user->member->getFullName()}} #{{$shopping_user->member->number}} @endif - - @endif -
-
-
Über Shop
- @if($shopping_user->shopping_order) - @if($shopping_user->shopping_order->user_shop->user->isActive() && $shopping_user->shopping_order->user_shop->user->isActiveShop()) - {{$shopping_user->shopping_order->user_shop->getSubdomain(false)}} +
Zugewiesener Berater
+ @if($shopping_user->is_like) + @else - {{$shopping_user->shopping_order->user_shop->getSubdomain(false)}} + @if($shopping_user->member) + + {{$shopping_user->member->getFullName()}} #{{$shopping_user->member->number}} + @endif + @endif - @endif -
-
-
ist Berater
- @if($shopping_user->auth_user) - - - {{$shopping_user->auth_user->getFullName()}} #{{$shopping_user->auth_user->number}} - @else - - @endif +
+
+
Über Shop
+ @if($shopping_user->shopping_order) + @if($shopping_user->shopping_order->user_shop->user->isActive() && $shopping_user->shopping_order->user_shop->user->isActiveShop()) + {{$shopping_user->shopping_order->user_shop->getSubdomain(false)}} + @else + {{$shopping_user->shopping_order->user_shop->getSubdomain(false)}} + @endif + @endif +
+
+
ist Berater
+ @if($shopping_user->auth_user) + + + {{$shopping_user->auth_user->getFullName()}} #{{$shopping_user->auth_user->number}} + @else + + @endif +
+ @else +
+ @if(!$shopping_user->is_like) + + Bestellung für diesen Kunden aufgeben + + @endif +
+
+
Kundenhoheit
+ @if($shopping_user->is_like) + in Prüfung + @else + zugewiesen + @endif + +
+ @endif
-

- @endif @include('admin.customer._customer_detail') diff --git a/resources/views/admin/modal/show_product.blade.php b/resources/views/admin/modal/show_product.blade.php index 90e9da1..479abb8 100644 --- a/resources/views/admin/modal/show_product.blade.php +++ b/resources/views/admin/modal/show_product.blade.php @@ -17,7 +17,7 @@ @endif
-
+

{{ $product->name }}

@@ -49,7 +49,8 @@ -
+ {{-- +
@@ -64,6 +65,7 @@ + --}}
diff --git a/resources/views/admin/shipping/edit.blade.php b/resources/views/admin/shipping/edit.blade.php index cf0362f..ed99acc 100755 --- a/resources/views/admin/shipping/edit.blade.php +++ b/resources/views/admin/shipping/edit.blade.php @@ -142,18 +142,17 @@
-
- -
+
+ +
-
diff --git a/resources/views/layouts/application.blade.php b/resources/views/layouts/application.blade.php index cca2c95..997ca3a 100755 --- a/resources/views/layouts/application.blade.php +++ b/resources/views/layouts/application.blade.php @@ -142,6 +142,8 @@ + + @yield('scripts') diff --git a/resources/views/user/customer/detail.blade.php b/resources/views/user/customer/detail.blade.php index bd026a9..714b0ab 100644 --- a/resources/views/user/customer/detail.blade.php +++ b/resources/views/user/customer/detail.blade.php @@ -6,6 +6,16 @@ zurück {{ __('Kunden Details') }} + + + + @if(Session::has('custom-error')) +
+ + {{ Session::get('custom-error') }} +
+ @endif + @include('admin.customer._detail') zurück diff --git a/resources/views/user/membership/index.blade.php b/resources/views/user/membership/index.blade.php index 3da83f4..56f33bf 100644 --- a/resources/views/user/membership/index.blade.php +++ b/resources/views/user/membership/index.blade.php @@ -100,8 +100,8 @@
{{__('Mitgliedschaft')}} {{__('anpassen')}}
-
Du kannst Deine Mitglidschaft bis zur nächsten Vertragsverlängerung, am {{ $user->nextRenewalAccount() }}, ändern
-

Die restlichen Läufzeiten bleiben erhalten, erst mit der Verlängerung wird das geänderte Paket aktiv.

+
Du kannst Deine Mitglidschaft bis zur nächsten Vertragsverlängerung, am {{ $user->nextRenewalAccount() }}, ändern.
+

Die restlichen Laufzeiten bleiben erhalten, erst mit der Verlängerung wird das geänderte Paket aktiv.

@include('user.membership._change')
diff --git a/resources/views/user/order/comp_product.blade.php b/resources/views/user/order/comp_product.blade.php new file mode 100644 index 0000000..f53cce3 --- /dev/null +++ b/resources/views/user/order/comp_product.blade.php @@ -0,0 +1,35 @@ +
+
+

Versand Kompensationsprodukt

+ + @if($comp_products) +
+ @php($counter = 1) + + @foreach($comp_products as $comp_product) +
+
+ @if(count($comp_product->images)) + + @endif +
+
+ +
{{ $comp_product->name }}
+
Art-Nr.: {{ $comp_product->number }}
+ +
+
+ @php($counter++) + @endforeach +
+ @endif +
+
\ No newline at end of file diff --git a/resources/views/user/order/delivery.blade.php b/resources/views/user/order/delivery.blade.php index 21ad344..07b17d2 100644 --- a/resources/views/user/order/delivery.blade.php +++ b/resources/views/user/order/delivery.blade.php @@ -10,12 +10,12 @@
- {!! Form::open(['url' => route('user_order_my_list', [$for, $delivery_id]), 'class' => 'form-horizontal']) !!} + {!! Form::open(['url' => route('user_order_my_delivery', [$for, $delivery_id]), 'class' => 'form-horizontal']) !!}

Lieferdaten

- + An neuen Kunden versenden | Kunden hinzufügen

@if($shopping_user) + @if(Session::has('custom-error')) +
+ + {{ Session::get('custom-error') }} +
+ @endif

An diesen Kunde versenden

@include('admin.customer._customer_detail') @@ -62,11 +63,15 @@ @endif
- - -
- -
+ @if($shopping_user) +
+ +
+ @else +
+ +
+ @endif
{!! Form::close() !!} @@ -76,18 +81,14 @@ $( document ).ready(function() { $('input[name="switchers-radio-is-for"]').on('change', function (){ - if($(this).val() === 'is-for-customer'){ + if($(this).val() === 'ot'){ $('#show-is-for-customer').show('slow'); + $('#hide_for_ot').hide('slow'); }else{ $('#show-is-for-customer').hide('slow'); + $('#hide_for_ot').show('slow'); } }); - - /* - * showCreditCardPayment(jQuery('input[name="payment_method"]:checked').val()); - jQuery('input[name="payment_method"]').on('change', function () { - showCreditCardPayment($(this).val()); - });*/ }); @endsection diff --git a/resources/views/user/order/list.blade.php b/resources/views/user/order/list.blade.php index df5f6e9..9c9ff6b 100644 --- a/resources/views/user/order/list.blade.php +++ b/resources/views/user/order/list.blade.php @@ -3,8 +3,8 @@ @section('content')

{{ __('navigation.my_orders') }} / {{ __('navigation.do_order') }} + zurück

-
- +
@@ -45,6 +44,8 @@ + + @@ -55,33 +56,48 @@
{{__('Bild')}}{{__('Produkt')}} {{__('Artikelnummer')}} {{__('Netto-Preis')}}{{__('Brutto-Preis')}}{{__('VK-Brutto-Preis')}} {{__('Points')}} {{__('Inhalt (ml)')}} {{__('Gewicht (g)')}}
+
-
- - {!! Form::open(['url' => route('wizard_store_payment', [20]), 'class' => 'form-horizontal']) !!} - + {!! Form::open(['url' => route('user_order_my_payment', [$for, $delivery_id]), 'class' => 'form-horizontal']) !!} + +
- @if($for === 'ot') -

Lieferadresse (Kunde)

+

Lieferadresse des Kunden

@include('user.order.shipping_ot') @endif @if($for === 'me') -

Lieferadresse (meine)

+

Meine Lieferadresse

@include('user.order.shipping_me') @endif
- - - @include('user.order.list_form') - - {!! Form::close() !!}
+ @if($for === 'me') + @include('user.order.comp_product') + @endif + +
+
+

Warenkorb

+
+ @include('user.order.yard_view_form') +
+
+
+
+ zurück +
+ + {!! Form::close() !!} + + @endsection - diff --git a/resources/views/user/order/list_form.blade.php b/resources/views/user/order/list_form.blade.php index 04bbc6a..9206917 100644 --- a/resources/views/user/order/list_form.blade.php +++ b/resources/views/user/order/list_form.blade.php @@ -1,104 +1,103 @@ -
-

Warenkorb

- - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ProduktPreisAnzahlSumme
-
- -
- Nike Men Black Liteforce III Sneakers - - Color: -   - Size: EU 37   - Ships from: China - -
-
-
- $57.55 - - - - 115.1 € - - × -
-
- -
- WALKING 400 BLUE CAT3 - - Ships from: Germany - -
-
-
- $20.55 - - - - $20.55 - - × -
-
- + +
+ + + + + + + + + + + + -
-
- {{-- - - --}} -
-
-
- -
$20
-
-
- -
$1164.65
+
+ + + + + + + + + + + + + + + + + + +
ProduktPreisAnzahlSumme
+
+ +
+ Nike Men Black Liteforce III Sneakers + + Color: +   + Size: EU 37   + Ships from: China +
- -
-
- -
+
+ $57.55 + + + + 115.1 € + + × +
+
+ +
+ WALKING 400 BLUE CAT3 + + Ships from: Germany + +
+
+
+ $20.55 + + + + $20.55 + + × +
+
+ + +
+
+ {{-- + + --}}
+
+
+ +
$20
+
+
+ +
$1164.65
+
+
+
+
+
+ +
+ diff --git a/resources/views/user/order/shipping_me.blade.php b/resources/views/user/order/shipping_me.blade.php index a829745..4999c35 100644 --- a/resources/views/user/order/shipping_me.blade.php +++ b/resources/views/user/order/shipping_me.blade.php @@ -2,100 +2,213 @@ @if($user->account) @if($user->account->same_as_billing) -
- @if($user->account->company) -
-
Firma
- {{ $user->account->company }} -
- @endif -
-
Anrede
- {{ \App\Services\HTMLHelper::getSalutationLang($user->account->salutation) }} -
-
-
Vorname
- {{ $user->account->first_name }} -
-
-
Nachname
- {{ $user->account->last_name }} + +
+
+
+ + {{ Form::text('shipping_company', $user->account->company, array('placeholder'=>__('Company name'), 'class'=>'form-control')) }}
-
-
-
Straße
- {{ $user->account->address }} -
-
-
Zusatz
- {{ $user->account->address_2 }} -
-
-
PLZ
- {{ $user->account->zipcode }} -
-
-
Stadt
- {{ $user->account->city }} -
-
-
Land
- @if($user->account->country){{ $user->account->country->getLocated() }}@endif -
-
-
Telefon
- {{ $user->account->phone }} +
+
+ + + @if ($errors->has('shipping_salutation')) + + {{ $errors->first('shipping_salutation') }} + + @endif
+
+
+ + {{ Form::text('shipping_firstname', $user->account->first_name, array('placeholder'=>__('First name'), 'class'=>'form-control', 'required'=>true)) }} + @if ($errors->has('shipping_firstname')) + + {{ $errors->first('shipping_firstname') }} + + @endif + +
+
+ + {{ Form::text('shipping_lastname', $user->account->last_name, array('placeholder'=>__('Last name'), 'class'=>'form-control', 'required'=>true)) }} + @if ($errors->has('shipping_lastname')) + + {{ $errors->first('shipping_lastname') }} + + @endif +
+
+
+
+ + {{ Form::text('shipping_address', $user->account->address, array('placeholder'=>__('Street'), 'class'=>'form-control', 'required'=>true)) }} + @if ($errors->has('shipping_address')) + + {{ $errors->first('shipping_address') }} + + @endif +
+
+
+
+ + {{ Form::text('shipping_address_2', $user->account->address_2, array('placeholder'=>__('Wohnung / Gebäude (optional)'), 'class'=>'form-control')) }} +
+
+
+
+ + {{ Form::text('shipping_zipcode', $user->account->zipcode, array('placeholder'=>__('Postcode'), 'class'=>'form-control', 'required'=>true)) }} + @if ($errors->has('shipping_zipcode')) + + {{ $errors->first('shipping_zipcode') }} + + @endif +
+
+ + {{ Form::text('shipping_city', $user->account->city, array('placeholder'=>__('City'), 'class'=>'form-control', 'required'=>true)) }} + @if ($errors->has('shipping_city')) + + {{ $errors->first('shipping_city') }} + + @endif +
+
+
+
+ + + @if ($errors->has('shipping_state')) + + {{ $errors->first('shipping_state') }} + + @endif +
+
+
+
+ + {{ Form::text('shipping_phone', $user->account->phone, array('placeholder'=>__('Phone'), 'class'=>'form-control')) }} +
+
+
@else -
- @if($user->account->shipping_company) -
-
Firma
- {{ $user->account->shipping_company }} -
- @endif -
-
Anrede
- {{ \App\Services\HTMLHelper::getSalutationLang($user->account->shipping_salutation) }} -
-
-
Vorname
- {{ $user->account->shipping_firstname }} -
-
-
Nachname
- {{ $user->account->shipping_lastname }} + +
+
+
+ + {{ Form::text('shipping_company', $user->account->shipping_company, array('placeholder'=>__('Company name'), 'class'=>'form-control')) }}
-
-
-
Straße
- {{ $user->account->shipping_address }} -
-
-
Zusatz
- {{ $user->account->shipping_address_2 }} -
-
-
PLZ
- {{ $user->account->shipping_zipcode }} -
-
-
Stadt
- {{ $user->account->shipping_city }} -
-
-
Land
- @if($user->account->shipping_country){{ $user->account->shipping_country->getLocated() }}@endif -
-
-
Telefon
- {{ $user->account->shipping_phone }} +
+
+ + + @if ($errors->has('shipping_salutation')) + + {{ $errors->first('shipping_salutation') }} + + @endif
+
+
+ + {{ Form::text('shipping_firstname', $user->account->shipping_firstname, array('placeholder'=>__('First name'), 'class'=>'form-control', 'required'=>true)) }} + @if ($errors->has('shipping_firstname')) + + {{ $errors->first('shipping_firstname') }} + + @endif +
+
+ + {{ Form::text('shipping_lastname', $user->account->shipping_lastname, array('placeholder'=>__('Last Name'), 'class'=>'form-control', 'required'=>true)) }} + @if ($errors->has('shipping_lastname')) + + {{ $errors->first('shipping_lastname') }} + + @endif + +
+
+
+
+ + {{ Form::text('shipping_address', $user->account->shipping_address, array('placeholder'=>__('Street'), 'class'=>'form-control', 'required'=>true)) }} + @if ($errors->has('shipping_address')) + + {{ $errors->first('shipping_address') }} + + @endif +
+
+
+
+ + {{ Form::text('shipping_address_2', $user->account->shipping_address_2, array('placeholder'=>__('Wohnung / Gebäude (optional)'), 'class'=>'form-control')) }} + @if ($errors->has('shipping_address_2')) + + {{ $errors->first('shipping_address_2') }} + + @endif +
+
+
+
+ + {{ Form::text('shipping_zipcode', $user->account->shipping_zipcode, array('placeholder'=>__('Postcode'), 'class'=>'form-control', 'required'=>true)) }} + @if ($errors->has('shipping_zipcode')) + + {{ $errors->first('shipping_zipcode') }} + + @endif + +
+
+ + {{ Form::text('shipping_city', $user->account->shipping_city, array('placeholder'=>__('City'), 'class'=>'form-control', 'required'=>true)) }} + @if ($errors->has('shipping_city')) + + {{ $errors->first('shipping_city') }} + + @endif +
+
+
+
+ + + @if ($errors->has('shipping_state')) + + {{ $errors->first('shipping_state') }} + + @endif +
+
+ +
+
+ + {{ Form::text('shipping_phone', $user->account->shipping_phone, array('placeholder'=>__('Phone'), 'class'=>'form-control')) }} +
+
+
@endif @else

Fehler: Keine Adressdaten gefunden!

diff --git a/resources/views/user/order/shipping_ot.blade.php b/resources/views/user/order/shipping_ot.blade.php index df3502b..9086507 100644 --- a/resources/views/user/order/shipping_ot.blade.php +++ b/resources/views/user/order/shipping_ot.blade.php @@ -1,99 +1,210 @@ @if($shopping_user->same_as_billing) -
- @if($shopping_user->billing_company) -
-
Firma
- {{ $shopping_user->billing_company }} -
- @endif -
-
Anrede
- {{ \App\Services\HTMLHelper::getSalutationLang($shopping_user->billing_salutation) }} -
-
-
Vorname
- {{ $shopping_user->billing_firstname }} -
-
-
Nachname
- {{ $shopping_user->billing_lastname }} +
+
+
+ + {{ Form::text('shipping_company', $shopping_user->billing_company, array('placeholder'=>__('Company name'), 'class'=>'form-control')) }}
-
-
-
Straße
- {{ $shopping_user->billing_address }} -
-
-
Zusatz
- {{ $shopping_user->billing_address_2 }} -
-
-
PLZ
- {{ $shopping_user->billing_zipcode }} -
-
-
Stadt
- {{ $shopping_user->billing_city }} -
-
-
Land
- @if($shopping_user->billing_country){{ $shopping_user->billing_country->getLocated() }}@endif -
-
-
Telefon
- {{ $shopping_user->billing_phone }} +
+
+ + + @if ($errors->has('shipping_salutation')) + + {{ $errors->first('shipping_salutation') }} + + @endif
+
+
+ + {{ Form::text('shipping_firstname', $shopping_user->billing_firstname, array('placeholder'=>__('First name'), 'class'=>'form-control', 'required'=>true)) }} + @if ($errors->has('shipping_firstname')) + + {{ $errors->first('shipping_firstname') }} + + @endif + +
+
+ + {{ Form::text('shipping_lastname', $shopping_user->billing_lastname, array('placeholder'=>__('Last name'), 'class'=>'form-control', 'required'=>true)) }} + @if ($errors->has('shipping_lastname')) + + {{ $errors->first('shipping_lastname') }} + + @endif +
+
+
+
+ + {{ Form::text('shipping_address', $shopping_user->billing_address, array('placeholder'=>__('Street'), 'class'=>'form-control', 'required'=>true)) }} + @if ($errors->has('shipping_address')) + + {{ $errors->first('shipping_address') }} + + @endif +
+
+
+
+ + {{ Form::text('shipping_address_2', $shopping_user->billing_address_2, array('placeholder'=>__('Wohnung / Gebäude (optional)'), 'class'=>'form-control')) }} +
+
+
+
+ + {{ Form::text('shipping_zipcode', $shopping_user->billing_zipcode, array('placeholder'=>__('Postcode'), 'class'=>'form-control', 'required'=>true)) }} + @if ($errors->has('shipping_zipcode')) + + {{ $errors->first('shipping_zipcode') }} + + @endif +
+
+ + {{ Form::text('shipping_city', $shopping_user->billing_city, array('placeholder'=>__('City'), 'class'=>'form-control', 'required'=>true)) }} + @if ($errors->has('shipping_city')) + + {{ $errors->first('shipping_city') }} + + @endif +
+
+
+
+ + + @if ($errors->has('shipping_state')) + + {{ $errors->first('shipping_state') }} + + @endif +
+
+
+
+ + {{ Form::text('shipping_phone', $shopping_user->billing_phone, array('placeholder'=>__('Phone'), 'class'=>'form-control')) }} +
+
+
@else -
- @if($shopping_user->shipping_company) -
-
Firma
- {{ $shopping_user->shipping_company }} + +
+
+
+ + {{ Form::text('shipping_company', $shopping_user->shipping_company, array('placeholder'=>__('Company name'), 'class'=>'form-control')) }}
- @endif -
-
Anrede
- {{ \App\Services\HTMLHelper::getSalutationLang($shopping_user->shipping_salutation) }}
-
-
Vorname
- {{ $shopping_user->shipping_firstname }} +
+
+ + + @if ($errors->has('shipping_salutation')) + + {{ $errors->first('shipping_salutation') }} + + @endif +
-
-
Nachname
- {{ $shopping_user->shipping_lastname }} +
+
+ + {{ Form::text('shipping_firstname', $shopping_user->shipping_firstname, array('placeholder'=>__('First name'), 'class'=>'form-control', 'required'=>true)) }} + @if ($errors->has('shipping_firstname')) + + {{ $errors->first('shipping_firstname') }} + + @endif +
+
+ + {{ Form::text('shipping_lastname', $shopping_user->shipping_lastname, array('placeholder'=>__('Last Name'), 'class'=>'form-control', 'required'=>true)) }} + @if ($errors->has('shipping_lastname')) + + {{ $errors->first('shipping_lastname') }} + + @endif + +
+
+
+
+ + {{ Form::text('shipping_address', $shopping_user->shipping_address, array('placeholder'=>__('Street'), 'class'=>'form-control', 'required'=>true)) }} + @if ($errors->has('shipping_address')) + + {{ $errors->first('shipping_address') }} + + @endif +
+
+
+
+ + {{ Form::text('shipping_address_2', $shopping_user->shipping_address_2, array('placeholder'=>__('Wohnung / Gebäude (optional)'), 'class'=>'form-control')) }} + @if ($errors->has('shipping_address_2')) + + {{ $errors->first('shipping_address_2') }} + + @endif +
+
+
+
+ + {{ Form::text('shipping_zipcode', $shopping_user->shipping_zipcode, array('placeholder'=>__('Postcode'), 'class'=>'form-control', 'required'=>true)) }} + @if ($errors->has('shipping_zipcode')) + + {{ $errors->first('shipping_zipcode') }} + + @endif + +
+
+ + {{ Form::text('shipping_city', $shopping_user->shipping_city, array('placeholder'=>__('City'), 'class'=>'form-control', 'required'=>true)) }} + @if ($errors->has('shipping_city')) + + {{ $errors->first('shipping_city') }} + + @endif +
+
+
+
+ + + @if ($errors->has('shipping_state')) + + {{ $errors->first('shipping_state') }} + + @endif +
+
+ +
+
+ + {{ Form::text('shipping_phone', $shopping_user->shipping_phone, array('placeholder'=>__('Phone'), 'class'=>'form-control')) }} +
-
-
-
Straße
- {{ $shopping_user->shipping_address }} -
-
-
Zusatz
- {{ $shopping_user->shipping_address_2 }} -
-
-
PLZ
- {{ $shopping_user->shipping_zipcode }} -
-
-
Stadt
- {{ $shopping_user->shipping_city }} -
-
-
Land
- @if($shopping_user->shipping_country){{ $shopping_user->shipping_country->getLocated() }}@endif -
-
-
Telefon
- {{ $shopping_user->shipping_phone }} -
-
- @endif -
\ No newline at end of file + @endif \ No newline at end of file diff --git a/resources/views/user/order/yard_view_form.blade.php b/resources/views/user/order/yard_view_form.blade.php new file mode 100644 index 0000000..dfc4979 --- /dev/null +++ b/resources/views/user/order/yard_view_form.blade.php @@ -0,0 +1,115 @@ + +@if(Yard::instance('shopping')->content()->count()) + @if(Yard::instance('shopping')->compCount() > 0) + + +
+ + + + + + + + + + + + + @foreach(Yard::instance('shopping')->content() as $row) + @php($product = \App\Models\Product::find($row->id)) + + + + + + + + @endforeach + +
Produkt
Netto-Preis
AnzahlSumme
+
+ @if($row->options->has('image')) + + @else + + @endif +
+
{{ $row->name }}
+
+
Inhalt: {{ $product->contents }}
+
Art.-Nr.: {{ $product->number }}
+
+
+
+
+
{{ Yard::instance('shopping')->rowPriceNet($row, 3) }} €
+
+ @if($row->options->comp) +
1x KP
+ @else +
+ + + + +
+ @endif +
+
{{ Yard::instance('shopping')->rowSubtotalNet($row) }} €
+
+
+ +
+
+

Du hast {{ Yard::instance('shopping')->compCount() }} Artikel in Deinem Warenkorb

+

Gesamte Points: {{ Yard::instance('shopping')->points() }}

+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
Zwischensumme:{{ Yard::instance('shopping')->subtotal() }} €
Versandland:{{ Yard::instance('shopping')->getShippingCountryName() }}
Versandkosten: + {{ Yard::instance('shopping')->shippingNet() }} € +
Summe ohne MwSt: + {{ Yard::instance('shopping')->subtotalWithShipping() }} € +
zzgl. MwSt:{{ Yard::instance('shopping')->taxWithShipping() }} €
Gesamtsumme Brutto:{{ Yard::instance('shopping')->totalWithShipping() }} €
+ +
+
+
+
+
+ +
+

+ Du wirst auf unseren checkout Server weitergeletet, die Verbindung ist SSL verschlüsselt. + @endif + +@endif \ No newline at end of file diff --git a/resources/views/web/templates/checkout.blade.php b/resources/views/web/templates/checkout.blade.php index 9953f93..71ffe4b 100644 --- a/resources/views/web/templates/checkout.blade.php +++ b/resources/views/web/templates/checkout.blade.php @@ -322,7 +322,7 @@
-
+
@@ -630,9 +630,7 @@
- {!! Form::text('cc_cardcvc2', '', ['class' => 'form-control', 'id'=>'cc_cardcvc2', 'placeholder'=>'CVC*']) !!} -
diff --git a/routes/web.php b/routes/web.php index 4db63af..e86b316 100755 --- a/routes/web.php +++ b/routes/web.php @@ -252,9 +252,15 @@ Route::domain(config('app.pre_url_crm').config('app.domain').config('app.tld_car Route::get('/user/order/my/delivery/{for}/{id?}', 'User\OrderController@delivery')->name('user_order_my_delivery'); Route::post('/user/order/my/delivery/{for}/{id?}', 'User\OrderController@delivery')->name('user_order_my_delivery'); + Route::get('/user/order/my/list/{for}/{id?}', 'User\OrderController@list')->name('user_order_my_list'); Route::post('/user/order/my/list/{for}/{id?}', 'User\OrderController@list')->name('user_order_my_list'); + + Route::post('/user/order/my/payment/{for}/{id?}', 'User\OrderController@payment')->name('user_order_my_payment'); + Route::get('/user/order/my/datatable', 'User\OrderController@datatable')->name('user_order_my_datatable'); + Route::post('/user/order/my/perform/request/', 'User\OrderController@performRequest')->name('user_order_my_perform_request'); + //products images Route::post('/user/shop_on_site/upload/image', 'UserShopController@uploadOnSiteImage')->name('user_shop_on_site_upload_image'); Route::get('/user/shop_on_site/{image_id}/{user_shop_id}', 'UserShopController@deleteOnSiteImage')->name('user_shop_on_site_delete_image');