From a24c789a3c12ca6138a64fb04c24b43770137a67 Mon Sep 17 00:00:00 2001 From: prashant-webkul Date: Wed, 19 Sep 2018 12:30:24 +0530 Subject: [PATCH] before merge --- .../views/users/users/index.blade.php | 1 - packages/Webkul/Cart/src/Cart.php | 136 ++++++--- .../src/Http/ViewComposers/CartComposer.php | 59 ++++ packages/Webkul/Cart/src/Models/Cart.php | 3 +- .../src/Providers/CartServiceProvider.php | 8 +- .../src/Providers/ComposerServiceProvider.php | 32 +++ packages/Webkul/Shop/src/Http/routes.php | 22 -- .../Shop/src/Resources/assets/js/app.js | 2 + .../assets/js/components/cart-dropdown.vue | 156 +++++++++++ .../assets/js/components/category-item.vue | 1 - .../Shop/src/Resources/assets/sass/app.scss | 27 +- .../Shop/src/Resources/assets/sass/icons.scss | 10 +- .../views/layouts/header/index.blade.php | 121 +------- .../Resources/views/products/view.blade.php | 1 - .../views/products/view/gallery.blade.php | 1 - .../assets/js/components/flash-wrapper.vue | 2 +- .../views/datagrid/table/default.blade.php | 8 +- packages/Webkul/Ui/webpack.mix.js | 2 +- public/themes/default/assets/css/shop.css | 30 +- public/themes/default/assets/js/shop.js | 265 +++++++++++++++++- resources/views/welcome.blade.php | 2 +- 21 files changed, 691 insertions(+), 198 deletions(-) create mode 100644 packages/Webkul/Cart/src/Http/ViewComposers/CartComposer.php create mode 100644 packages/Webkul/Cart/src/Providers/ComposerServiceProvider.php create mode 100644 packages/Webkul/Shop/src/Resources/assets/js/components/cart-dropdown.vue diff --git a/packages/Webkul/Admin/src/Resources/views/users/users/index.blade.php b/packages/Webkul/Admin/src/Resources/views/users/users/index.blade.php index fc4a1d6c3..466bd0e47 100644 --- a/packages/Webkul/Admin/src/Resources/views/users/users/index.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/users/users/index.blade.php @@ -3,7 +3,6 @@ @section('page_title') @endsection -@stop @section('content') diff --git a/packages/Webkul/Cart/src/Cart.php b/packages/Webkul/Cart/src/Cart.php index 9969c4f23..a580a8789 100644 --- a/packages/Webkul/Cart/src/Cart.php +++ b/packages/Webkul/Cart/src/Cart.php @@ -32,74 +32,88 @@ class Cart { protected $customer; - public function __construct(CartRepository $cart, CartProductRepository $cartProduct, CustomerRepository $customer) { + //Cookie expiry limit in minutes + protected $minutes = 150; + + public function __construct(CartRepository $cart, CartProductRepository $cartProduct, CustomerRepository $customer ,$minutes = 150) { $this->customer = $customer; $this->cart = $cart; $this->cartProduct = $cartProduct; + + $this->minutes = $minutes; } public function guestUnitAdd($id) { + //empty array for storing the products $products = array(); - $minutes = 150; - if(Cookie::has('cart_session_id')) { + //getting the cart session id from cookie $cart_session_id = Cookie::get('cart_session_id'); + //finding current cart instance in the database table. $current_cart = $this->cart->findOneByField('session_id', $cart_session_id); - // dd('Cookie = ',$cart_session_id, 'Session = ', session()->get('cart_session_id'), 'DB = ', $current_cart->session_id); - + //check there is any cart or not if(isset($current_cart)) { $current_cart_id = $current_cart['id'] ?? $current_cart->id; $current_cart_session_id = $current_cart['session_id'] ?? $current_cart->session_id; } else { + //if someone deleted then take the flow to the normal $this->repairCart($cart_session_id, $id); } - + //matching the session id present in the cookie and database are same or not. if((session()->get('cart_session_id') == Cookie::get('cart_session_id')) && ($current_cart_session_id == session()->get('cart_session_id'))) { $current_cart_products = array(); $current_cart_products = $this->cart->getProducts($current_cart_id); + //checking new product coming in the cart is new or previously added item. foreach($current_cart_products as $key => $value) { $product_id = $value['id'] ?? $value->id; if($product_id == $id) { + //create status code to communicate with session flash session()->flash('error', 'Item Already In Cart'); + //remove this its temporary dump('Item Already In Cart'); return redirect()->back(); } } + //cart data being attached to the instace. $cart_data = $this->cart->attach($current_cart_id, $id, 1); + //getting the products after being attached to cart instance $cart_products = $this->cart->getProducts($current_cart_id); + //storing the information in session. session()->put('cart_data', [$current_cart, $cart_products]); - session()->flash('Success', 'Item Added In Cart'); + session()->flash('Success', 'Item Added To Cart Successfully'); dump($cart_products); + //return the control to the controller return redirect()->back(); } else { - //repair the cart + //repair the cart, will remake the session + //and add the product in the new cart instance. $this->repairCart($cart_session_id, $id); } } else { - //create a new cart instance. + //function call $this->createNewCart($id); } } @@ -112,23 +126,20 @@ class Cart { * Session. * * @return mixed - */ + */ public function createNewCart($id) { - $minutes = 120; $fresh_cart_session_id = session()->getId(); - Cookie::queue('cart_session_id', $fresh_cart_session_id, $minutes); - - $cart_session_id = $this->makeCartSession($fresh_cart_session_id); - $data['session_id'] = $fresh_cart_session_id; $data['channel_id'] = core()->getCurrentChannel()->id; if($cart = $this->cart->create($data)) { + $this->makeCartSession($fresh_cart_session_id); + $new_cart_id = $cart->id ?? $cart['id']; $cart_product['product_id'] = $id; @@ -141,7 +152,7 @@ class Cart { session()->put('cart_data', [$cart, $cart_product]); - session()->flash('success', 'Product Added To Cart'); + session()->flash('success', 'Item Added To Cart Successfully'); return redirect()->back(); } @@ -156,9 +167,12 @@ class Cart { * cart. */ public function makeCartSession($cart_session_id) { - session()->put('cart_session_id', $cart_session_id); - return session()->get('cart_session_id'); + $fresh_cart_session_id = $cart_session_id; + + Cookie::queue('cart_session_id', $fresh_cart_session_id, $this->minutes); + + session()->put('cart_session_id', $fresh_cart_session_id); } @@ -170,8 +184,7 @@ class Cart { * * @return mixed */ - - public function repairCart($cart_session_id, $product_id) { + public function repairCart($cart_session_id ="null", $product_id = 0) { if($cart_session_id == session()->get('cart_session_id')) { $data['session_id'] = $cart_session_id; @@ -184,7 +197,7 @@ class Cart { $this->cart->attach($cart_id, $product_id, 1); - session()->flash('success', 'Product Added In Cart'); + session()->flash('success', 'Item Added To Cart Successfully'); return redirect()->back(); @@ -212,8 +225,8 @@ class Cart { public function guestUnitRemove($id) { //remove the products here - if(Cookie::has('session_c')) { - $products = unserialize(Cookie::get('session_c')); + if(Cookie::has('session_cart_id')) { + $products = unserialize(Cookie::get('session_cart_id')); foreach($products as $key => $value) { if($value == $id) { @@ -221,7 +234,7 @@ class Cart { array_push($products, $id); - Cookie::queue('session_c', serialize($products)); + Cookie::queue('session_cart_id', serialize($products)); return redirect()->back(); } @@ -239,46 +252,80 @@ class Cart { $products = array(); - // $customerLoggedIn = auth()->guard('customer')->check(); - - // //customer is authenticated - // if ($customerLoggedIn) { - //assuming that there is data in cookie and customer's cart also. + if(!auth()->guard('customer')->check()) { + throw new \Exception('This function is protected for auth customers only.'); + } $data['customer_id'] = auth()->guard('customer')->user()->id; $data['channel_id'] = core()->getCurrentChannel()->id; - $customerCart = $this->cart->findOneByField('customer_id', $data['customer_id']); + $customer_cart = $this->cart->findOneByField('customer_id', $data['customer_id']); //if there are products already in cart of that customer. - $customerCartId = $customerCart->id ?? $customerCart['id']; + $customer_cart_id = $customer_cart->id ?? $customer_cart['id']; - $customerCartProducts = $this->cart->getProducts($customerCartId); + /** + * Check if their any + * instance of current + * customer in the cart + * table. + */ + if(isset($customer_cart)) { + $customer_cart_products = $this->cart->getProducts($customer_cart_id); - if (isset($customerCartProducts)) { + if (isset($customer_cart_products)) { - foreach ($customerCartProducts as $previousCartProduct) { + foreach ($customer_cart_products as $customer_cart_product) { + if($customer_cart_product->id == $id) { + dump('Item already exists in cart'); - if($previousCartProduct->id == $id) { - dd('product already exists in cart'); + session()->flash('error', 'Item already exists in cart'); - session()->flash('error', 'Product already exists in cart'); + return redirect()->back(); - return redirect()->back(); + //maybe increase the quantity in here + } } + //add the product in the cart + + $this->cart->attach($customer_cart_id, $id, 1); + + session()->flash('success', 'Item Added To Cart Successfully'); + + return redirect()->back(); + } else { + $this->cart->destroy($customer_cart_id); + + session()->flash('error', 'Try Adding The Item Again'); + + dd('cart instance without any product found, delete it and create a new one for the current product id'); + + return redirect()->back(); } - //add the product in the cart + } else { + /** + * this will work + * for logged in users + * and they do not have + * any cart instance + * found in the database. + */ - $product['product_id'] = $id; + if($new_cart = $this->cart->create($data)) { + $new_cart_id = $new_cart->id ?? $new_cart['id']; - $product['quantity'] = 1; + $this->cart->attach($new_cart_id, $id, 1); - $product['cart_id'] = $customerCartId; + session()->flash('success', 'Item Added To Cart Successfully'); - $this->cartProduct->create($product); + return redirect()->back(); - return redirect()->back(); + } else { + session()->flash('error', 'Cannot Add Item in Cart'); + + return redirect()->back(); + } } } @@ -301,7 +348,6 @@ class Cart { */ public function mergeCart() { - //considering cookie as a source of truth. if(Cookie::has('cart_session_id')) { /* diff --git a/packages/Webkul/Cart/src/Http/ViewComposers/CartComposer.php b/packages/Webkul/Cart/src/Http/ViewComposers/CartComposer.php new file mode 100644 index 000000000..a216c1d5c --- /dev/null +++ b/packages/Webkul/Cart/src/Http/ViewComposers/CartComposer.php @@ -0,0 +1,59 @@ + + * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) + */ + +class CartComposer +{ + + /** + * The cart implementation + * for shop bundle's navigation + * menu + */ + protected $cart; + + /** + * Bind data to the view. + * + * @param View $view + * @return void + */ + public function __construct(CartRepository $cart) { + $this->cart = $cart; + } + + public function compose(View $view) { + if(auth()->guard('customer')->check()) { + $cart = $this->cart->findOneByField('customer_id', auth()->guard('customer')->user()->id); + + $cart_products = $this->cart->getProducts($cart['id']); + + // dd($cart_products); + + $view->with('cart', $cart_products); + + } else { + if(Cookie::has('cart_session_id')) { + $cart = $this->cart->findOneByField('session_id', Cookie::get('cart_session_id')); + + $cart_products = $this->cart->getProducts($cart['id']); + + $view->with('cart', $cart_products); + } + } + } +} diff --git a/packages/Webkul/Cart/src/Models/Cart.php b/packages/Webkul/Cart/src/Models/Cart.php index 20f376f67..f1591cdb4 100644 --- a/packages/Webkul/Cart/src/Models/Cart.php +++ b/packages/Webkul/Cart/src/Models/Cart.php @@ -10,11 +10,12 @@ class Cart extends Model { protected $table = 'cart'; - protected $fillable = ['customer_id','session_id','channel_id','coupon_code','is_gift']; + protected $fillable = ['customer_id', 'session_id', 'channel_id', 'coupon_code', 'is_gift']; protected $hidden = ['coupon_code']; public function with_products() { + return $this->belongsToMany(Product::class, 'cart_products')->withPivot('id', 'product_id','quantity', 'cart_id'); } } diff --git a/packages/Webkul/Cart/src/Providers/CartServiceProvider.php b/packages/Webkul/Cart/src/Providers/CartServiceProvider.php index f05e1cb39..ac8fc304b 100644 --- a/packages/Webkul/Cart/src/Providers/CartServiceProvider.php +++ b/packages/Webkul/Cart/src/Providers/CartServiceProvider.php @@ -9,6 +9,7 @@ use Illuminate\Foundation\AliasLoader; use Webkul\User\Http\Middleware\RedirectIfNotAdmin; use Webkul\Customer\Http\Middleware\RedirectIfNotCustomer; use Webkul\Cart\Facades\Cart; +use Webkul\Cart\Providers\ComposerServiceProvider; class CartServiceProvider extends ServiceProvider { @@ -19,9 +20,9 @@ class CartServiceProvider extends ServiceProvider $router->aliasMiddleware('admin', RedirectIfNotAdmin::class); - // $router->aliasMiddleware('customer', RedirectIfNotCustomer::class); + $router->aliasMiddleware('customer', RedirectIfNotCustomer::class); - $this->register(EventServiceProvider::class); + $this->app->register(ComposerServiceProvider::class); } /** @@ -41,6 +42,9 @@ class CartServiceProvider extends ServiceProvider */ protected function registerFacades() { + + //to make the cart facade and bind the + //alias to the class needed to be called. $loader = AliasLoader::getInstance(); $loader->alias('cart', Cart::class); diff --git a/packages/Webkul/Cart/src/Providers/ComposerServiceProvider.php b/packages/Webkul/Cart/src/Providers/ComposerServiceProvider.php new file mode 100644 index 000000000..3f62d51c7 --- /dev/null +++ b/packages/Webkul/Cart/src/Providers/ComposerServiceProvider.php @@ -0,0 +1,32 @@ + ['web']], function () { - Route::get('/test', 'Webkul\Cart\Http\Controllers\CartController@test'); - Route::get('/', 'Webkul\Shop\Http\Controllers\HomeController@index')->defaults('_config', [ 'view' => 'shop::home.index' ])->name('store.home'); @@ -29,15 +27,8 @@ Route::group(['middleware' => ['web']], function () { Route::post('product/remove/{id}', 'Webkul\Cart\Http\Controllers\CartController@remove')->name('cart.remove'); - // Route::post('product/customer/cart/add/{id}', 'Webkul\Cart\Http\Controllers\CartController@add')->name('cart.customer.add'); - - // Route::post('product/customer/cart/remove/{id}', 'Webkul\Cart\Http\Controllers\CartController@remove')->name('cart.customer.remove'); - - Route::get('product/customer/cart/merge', 'Webkul\Cart\Http\Controllers\CartController@handleMerge')->name('cart.merge'); - //Routes for product cart ends - // Product Review routes Route::get('/reviews/{slug}/{id}', 'Webkul\Shop\Http\Controllers\ReviewController@show')->defaults('_config', [ 'view' => 'shop::products.reviews.index' @@ -55,13 +46,6 @@ Route::group(['middleware' => ['web']], function () { 'redirect' => 'admin.reviews.index' ])->name('admin.reviews.store'); - // Route::post('/reviews/create/{slug}', 'Webkul\Core\Http\Controllers\ReviewController@store')->defaults('_config', [ - // 'redirect' => 'admin.reviews.index' - // ])->name('admin.reviews.store'); - - - // Route::view('/products/{slug}', 'shop::store.product.details.index'); - Route::view('/cart', 'shop::store.product.view.cart.index'); //customer routes starts here Route::prefix('customer')->group(function () { @@ -92,12 +76,6 @@ Route::group(['middleware' => ['web']], function () { 'redirect' => 'customer.session.index' ])->name('customer.session.destroy'); - Route::view('/cart', 'shop::store.product.cart.cart.index')->name('customer.cart'); - - Route::view('/product', 'shop::store.product.details.home.index')->name('customer.product'); - - Route::view('/product/review', 'shop::store.product.review.index')->name('customer.product.review'); - //customer account Route::prefix('account')->group(function () { diff --git a/packages/Webkul/Shop/src/Resources/assets/js/app.js b/packages/Webkul/Shop/src/Resources/assets/js/app.js index 320d65719..9c192b635 100644 --- a/packages/Webkul/Shop/src/Resources/assets/js/app.js +++ b/packages/Webkul/Shop/src/Resources/assets/js/app.js @@ -8,6 +8,7 @@ Vue.component("category-nav", require("./components/category-nav.vue")); Vue.component("category-item", require("./components/category-item.vue")); Vue.component("image-slider", require("./components/image-slider.vue")); Vue.component("vue-slider", require("vue-slider-component")); +Vue.component("cart-dropdown", require("./components/cart-dropdown.vue")); $(document).ready(function () { @@ -50,6 +51,7 @@ $(document).ready(function () { const flashes = this.$refs.flashes; flashMessages.forEach(function (flash) { + console.log(flash); flashes.addFlash(flash); }, this); }, diff --git a/packages/Webkul/Shop/src/Resources/assets/js/components/cart-dropdown.vue b/packages/Webkul/Shop/src/Resources/assets/js/components/cart-dropdown.vue new file mode 100644 index 000000000..9b27c8634 --- /dev/null +++ b/packages/Webkul/Shop/src/Resources/assets/js/components/cart-dropdown.vue @@ -0,0 +1,156 @@ + + + \ No newline at end of file diff --git a/packages/Webkul/Shop/src/Resources/assets/js/components/category-item.vue b/packages/Webkul/Shop/src/Resources/assets/js/components/category-item.vue index 4ff3508ad..e38dc943f 100644 --- a/packages/Webkul/Shop/src/Resources/assets/js/components/category-item.vue +++ b/packages/Webkul/Shop/src/Resources/assets/js/components/category-item.vue @@ -29,7 +29,6 @@ export default { computed: { haveChildren() { - console.log(this.item); return this.item.children.length ? true : false; } } diff --git a/packages/Webkul/Shop/src/Resources/assets/sass/app.scss b/packages/Webkul/Shop/src/Resources/assets/sass/app.scss index 799e0760b..f3689ae9b 100644 --- a/packages/Webkul/Shop/src/Resources/assets/sass/app.scss +++ b/packages/Webkul/Shop/src/Resources/assets/sass/app.scss @@ -21,6 +21,7 @@ body { .header { margin-top: 16px; margin-bottom: 21px; + user-select: none; .header-top { margin-bottom: 16px; @@ -293,7 +294,6 @@ body { .nav li li:hover > a:first-child:nth-last-child(2):before { right: 10px; } - } } @@ -310,7 +310,7 @@ body { .header-top { margin-bottom: 16px; display: flex; - max-width: 92%; + // max-width: 92%; width: 100%; margin-left: auto; margin-right: auto; @@ -482,7 +482,7 @@ body { .header-top { margin-bottom: 16px; display: flex; - max-width: 92%; + // max-width: 92%; width: 100%; margin-left: auto; margin-right: auto; @@ -1007,6 +1007,27 @@ section.slider-block { } } +//responsive for main-container-wrapper + +@media all and (max-width: 480px) { + .main-container-wrapper { + width: 100% !important; + margin-left: auto; + margin-right: auto; + } +} + +@media all and (min-width: 481px) and (max-width: 920px) { + .main-container-wrapper { + width: 90%; + margin-left: auto; + margin-right: auto; + } +} + + + + .product-price { font-size: 16px; margin-bottom: 14px; diff --git a/packages/Webkul/Shop/src/Resources/assets/sass/icons.scss b/packages/Webkul/Shop/src/Resources/assets/sass/icons.scss index e8ce2979e..762f456ae 100644 --- a/packages/Webkul/Shop/src/Resources/assets/sass/icons.scss +++ b/packages/Webkul/Shop/src/Resources/assets/sass/icons.scss @@ -3,7 +3,7 @@ background-size: cover; } -.dropdown-right-icon{ +.dropdown-right-icon { background-image:URL('../images/icon-dropdown-left.svg'); width: 8px; height: 8px; @@ -11,6 +11,14 @@ margin-bottom: 2px; } +.icon-menu-close { + background-image:URL('../images/icon-menu-close.svg'); + width: 8px; + height: 8px; + margin-left:auto; + margin-bottom: 2px; +} + .grid-view-icon { background-image:URL('../images/icon-grid-view.svg'); width: 24px; diff --git a/packages/Webkul/Shop/src/Resources/views/layouts/header/index.blade.php b/packages/Webkul/Shop/src/Resources/views/layouts/header/index.blade.php index d15ab5888..0fdee9e33 100644 --- a/packages/Webkul/Shop/src/Resources/views/layouts/header/index.blade.php +++ b/packages/Webkul/Shop/src/Resources/views/layouts/header/index.blade.php @@ -1,7 +1,5 @@ @push('scripts') - - - @endpush \ No newline at end of file diff --git a/packages/Webkul/Shop/src/Resources/views/products/view.blade.php b/packages/Webkul/Shop/src/Resources/views/products/view.blade.php index 1f53659fc..feaa5bd83 100644 --- a/packages/Webkul/Shop/src/Resources/views/products/view.blade.php +++ b/packages/Webkul/Shop/src/Resources/views/products/view.blade.php @@ -8,7 +8,6 @@
- {{-- {{ dd(session()->getId()) }} --}}
@csrf() diff --git a/packages/Webkul/Shop/src/Resources/views/products/view/gallery.blade.php b/packages/Webkul/Shop/src/Resources/views/products/view/gallery.blade.php index 54c605929..e5ddae8a6 100644 --- a/packages/Webkul/Shop/src/Resources/views/products/view/gallery.blade.php +++ b/packages/Webkul/Shop/src/Resources/views/products/view/gallery.blade.php @@ -61,7 +61,6 @@ }, created () { - console.log(this.images[0]) this.changeImage(this.images[0]) this.prepareThumbs() diff --git a/packages/Webkul/Ui/src/Resources/assets/js/components/flash-wrapper.vue b/packages/Webkul/Ui/src/Resources/assets/js/components/flash-wrapper.vue index f22019967..902807869 100644 --- a/packages/Webkul/Ui/src/Resources/assets/js/components/flash-wrapper.vue +++ b/packages/Webkul/Ui/src/Resources/assets/js/components/flash-wrapper.vue @@ -5,7 +5,7 @@ class='alert-wrapper' > {!! $column->sorting() !!} @endif @endforeach - @if(isset($attribute_columns)) + {{-- @if(isset($attribute_columns)) @foreach($attribute_columns as $key => $value) {{ $value }} @endforeach - @endif + @endif --}} Actions @@ -131,11 +131,11 @@ {!! $column->render($result) !!} @endforeach - @if(isset($attribute_columns)) + {{-- @if(isset($attribute_columns)) @foreach ($attribute_columns as $atc) {{ $result->{$atc} }} @endforeach - @endif + @endif --}} @foreach($actions as $action) diff --git a/packages/Webkul/Ui/webpack.mix.js b/packages/Webkul/Ui/webpack.mix.js index 32804fbcc..4fa81616a 100644 --- a/packages/Webkul/Ui/webpack.mix.js +++ b/packages/Webkul/Ui/webpack.mix.js @@ -14,7 +14,7 @@ mix.js( ], "js/ui.js" ) - // .copy(__dirname + "/src/Resources/assets/images", publicPath + "/images") + .copy(__dirname + "/src/Resources/assets/images", publicPath + "/images") .sass(__dirname + "/src/Resources/assets/sass/app.scss", "css/ui.css") .options({ processCssUrls: false diff --git a/public/themes/default/assets/css/shop.css b/public/themes/default/assets/css/shop.css index b674c2995..da3cdc0de 100644 --- a/public/themes/default/assets/css/shop.css +++ b/public/themes/default/assets/css/shop.css @@ -11,6 +11,14 @@ margin-bottom: 2px; } +.icon-menu-close { + background-image: URL("../images/icon-menu-close.svg"); + width: 8px; + height: 8px; + margin-left: auto; + margin-bottom: 2px; +} + .grid-view-icon { background-image: URL("../images/icon-grid-view.svg"); width: 24px; @@ -40,6 +48,10 @@ body { .header { margin-top: 16px; margin-bottom: 21px; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; } .header .header-top { @@ -380,7 +392,6 @@ body { display: -webkit-box; display: -ms-flexbox; display: flex; - max-width: 92%; width: 100%; margin-left: auto; margin-right: auto; @@ -533,7 +544,6 @@ body { display: -webkit-box; display: -ms-flexbox; display: flex; - max-width: 92%; width: 100%; margin-left: auto; margin-right: auto; @@ -1057,6 +1067,22 @@ section.slider-block div.slider-content div.slider-control .light-right-icon { width: 100%; } +@media all and (max-width: 480px) { + .main-container-wrapper { + width: 100% !important; + margin-left: auto; + margin-right: auto; + } +} + +@media all and (min-width: 481px) and (max-width: 920px) { + .main-container-wrapper { + width: 90%; + margin-left: auto; + margin-right: auto; + } +} + .product-price { font-size: 16px; margin-bottom: 14px; diff --git a/public/themes/default/assets/js/shop.js b/public/themes/default/assets/js/shop.js index 92989e592..ea917445b 100644 --- a/public/themes/default/assets/js/shop.js +++ b/public/themes/default/assets/js/shop.js @@ -221,6 +221,7 @@ Vue.component("category-nav", __webpack_require__(10)); Vue.component("category-item", __webpack_require__(13)); Vue.component("image-slider", __webpack_require__(16)); Vue.component("vue-slider", __webpack_require__(24)); +Vue.component("cart-dropdown", __webpack_require__(29)); $(document).ready(function () { @@ -263,6 +264,7 @@ $(document).ready(function () { var flashes = this.$refs.flashes; flashMessages.forEach(function (flash) { + console.log(flash); flashes.addFlash(flash); }, this); }, @@ -29279,7 +29281,6 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); computed: { haveChildren: function haveChildren() { - console.log(this.item); return this.item.children.length ? true : false; } } @@ -29920,5 +29921,267 @@ if (false) { // removed by extract-text-webpack-plugin +/***/ }), +/* 26 */, +/* 27 */, +/* 28 */, +/* 29 */ +/***/ (function(module, exports, __webpack_require__) { + +var disposed = false +function injectStyle (ssrContext) { + if (disposed) return + __webpack_require__(32) +} +var normalizeComponent = __webpack_require__(1) +/* script */ +var __vue_script__ = __webpack_require__(30) +/* template */ +var __vue_template__ = __webpack_require__(31) +/* template functional */ +var __vue_template_functional__ = false +/* styles */ +var __vue_styles__ = injectStyle +/* scopeId */ +var __vue_scopeId__ = null +/* moduleIdentifier (server only) */ +var __vue_module_identifier__ = null +var Component = normalizeComponent( + __vue_script__, + __vue_template__, + __vue_template_functional__, + __vue_styles__, + __vue_scopeId__, + __vue_module_identifier__ +) +Component.options.__file = "src/Resources/assets/js/components/cart-dropdown.vue" + +/* hot reload */ +if (false) {(function () { + var hotAPI = require("vue-hot-reload-api") + hotAPI.install(require("vue"), false) + if (!hotAPI.compatible) return + module.hot.accept() + if (!module.hot.data) { + hotAPI.createRecord("data-v-0f947e82", Component.options) + } else { + hotAPI.reload("data-v-0f947e82", Component.options) + } + module.hot.dispose(function (data) { + disposed = true + }) +})()} + +module.exports = Component.exports + + +/***/ }), +/* 30 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// + + +// define the item component + +/* harmony default export */ __webpack_exports__["default"] = ({ + props: { + items: Array + }, + + data: function data() { + return { + toggle: true, + totalitems: 0, + cart_items: [] + }; + }, + + + computed: { + makeDropdown: function makeDropdown() {} + }, + + mounted: function mounted() { + if (this.items != undefined) this.initializeDropdown(); + }, + + methods: { + dropOrHide: function dropOrHide() { + if (this.toggle == false) { + this.toggle = true; + } else { + this.toggle = false; + } + }, + + initializeDropdown: function initializeDropdown() { + this.totalitems = this.items.length; + } + } +}); + +/***/ }), +/* 31 */ +/***/ (function(module, exports, __webpack_require__) { + +var render = function() { + var _vm = this + var _h = _vm.$createElement + var _c = _vm._self._c || _h + return _c("div", [ + _c("ul", { staticClass: "cart-dropdown", on: { click: _vm.dropOrHide } }, [ + _c("li", { staticClass: "cart-summary" }, [ + _c("span", { staticClass: "icon cart-icon" }), + _vm._v(" "), + _c("span", { staticClass: "cart" }, [ + _vm.totalitems > 0 + ? _c("span", { staticClass: "cart-count" }, [ + _vm._v(_vm._s(_vm.totalitems)) + ]) + : _vm._e(), + _vm._v("Products") + ]), + _vm._v(" "), + _c("span", { staticClass: "icon arrow-down-icon" }) + ]) + ]), + _vm._v(" "), + _c("div", { staticClass: "dropdown-cart", class: { show: _vm.toggle } }, [ + _c("div", { staticClass: "dropdown-header" }, [ + _c("p", { staticClass: "heading" }, [_vm._v("Cart Subtotal - $80")]), + _vm._v(" "), + _c("i", { + staticClass: "icon icon-menu-close", + on: { click: _vm.dropOrHide } + }) + ]), + _vm._v(" "), + _vm._m(0), + _vm._v(" "), + _vm._m(1) + ]) + ]) +} +var staticRenderFns = [ + function() { + var _vm = this + var _h = _vm.$createElement + var _c = _vm._self._c || _h + return _c("div", { staticClass: "dropdown-content" }, [ + _c("div", { staticClass: "item" }, [ + _c("div", { staticClass: "item-image" }, [_c("img")]), + _vm._v(" "), + _c("div", { staticClass: "item-details" }, [ + _c("div", { staticClass: "item-name" }, [_vm._v("Some Item Name")]), + _vm._v(" "), + _c("div", { staticClass: "item-price" }, [_vm._v("$ Some Price")]), + _vm._v(" "), + _c("div", { staticClass: "item-qty" }, [_vm._v("Some Quantity")]) + ]) + ]) + ]) + }, + function() { + var _vm = this + var _h = _vm.$createElement + var _c = _vm._self._c || _h + return _c("div", { staticClass: "dropdown-footer" }, [ + _c("a", { attrs: { href: "/" } }, [_vm._v("View Shopping Cart")]), + _vm._v(" "), + _c("button", { staticClass: "btn btn-primary btn-lg" }, [ + _vm._v("CHECKOUT") + ]) + ]) + } +] +render._withStripped = true +module.exports = { render: render, staticRenderFns: staticRenderFns } +if (false) { + module.hot.accept() + if (module.hot.data) { + require("vue-hot-reload-api") .rerender("data-v-0f947e82", module.exports) + } +} + +/***/ }), +/* 32 */ +/***/ (function(module, exports, __webpack_require__) { + +// style-loader: Adds some css to the DOM by adding a