before merge

This commit is contained in:
prashant-webkul 2018-09-19 12:30:24 +05:30
parent a122a8ea9f
commit a24c789a3c
21 changed files with 691 additions and 198 deletions

View File

@ -3,7 +3,6 @@
@section('page_title')
@endsection
@stop
@section('content')

View File

@ -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')) {
/*

View File

@ -0,0 +1,59 @@
<?php
namespace Webkul\Cart\Http\ViewComposers;
use Illuminate\View\View;
use Illuminate\Support\Collection;
use Webkul\Cart\Repositories\CartRepository;
use Cookie;
use Cart;
/**
* cart List Composer on Navigation Menu
*
* @author Prashant Singh <prashant.singh852@webkul.com>
* @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);
}
}
}
}

View File

@ -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');
}
}

View File

@ -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);

View File

@ -0,0 +1,32 @@
<?php
namespace Webkul\Cart\Providers;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\ServiceProvider;
use View;
class ComposerServiceProvider extends ServiceProvider
{
/**
* Register bindings in the container.
*
* @return void
*/
public function boot()
{
//using the class based composers...
View::composer(['shop::layouts.header.index'], 'Webkul\Cart\Http\ViewComposers\CartComposer');
}
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
//
}
}

View File

@ -2,8 +2,6 @@
Route::group(['middleware' => ['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 () {

View File

@ -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);
},

View File

@ -0,0 +1,156 @@
<template>
<div>
<ul class="cart-dropdown" @click="dropOrHide">
<li class="cart-summary">
<span class="icon cart-icon"></span>
<span class="cart"><span class="cart-count" v-if="totalitems > 0">{{ totalitems }}</span>Products</span>
<span class="icon arrow-down-icon"></span>
</li>
</ul>
<div class="dropdown-cart" :class="{ show: toggle }">
<div class="dropdown-header">
<p class="heading">Cart Subtotal - $80</p>
<i class="icon icon-menu-close" @click="dropOrHide"></i>
</div>
<div class="dropdown-content">
<div class="item">
<div class="item-image">
<img />
</div>
<div class="item-details">
<div class="item-name">Some Item Name</div>
<div class="item-price">$ Some Price</div>
<div class="item-qty">Some Quantity</div>
</div>
</div>
</div>
<div class="dropdown-footer">
<a href="/">View Shopping Cart</a>
<button class="btn btn-primary btn-lg">CHECKOUT</button>
</div>
</div>
</div>
</template>
<script>
// define the item component
export default {
props: {
items: Array,
},
data(){
return {
toggle: true,
totalitems: 0,
cart_items: []
};
},
computed: {
makeDropdown() {
}
},
mounted: function() {
if(this.items != undefined)
this.initializeDropdown();
},
methods: {
dropOrHide: function() {
if(this.toggle == false) {
this.toggle = true;
} else {
this.toggle = false;
}
},
initializeDropdown: function() {
this.totalitems = this.items.length;
}
}
}
</script>
<style>
.show {
display: none;
}
.dropdown-cart {
position: absolute;
background: #FFFFFF;
border: 1px solid #E8E8E8;
box-shadow: 1px 3px 6px 0 rgba(0,0,0,0.40);
padding: 20px;
border-radius: 1px;
right: 10%;
top: 75px;
width: 387px;
z-index: 5;
}
.dropdown-cart > .dropdown-header {
width: 100%;
}
.dropdown-cart > .dropdown-header p{
display: inline;
line-height: 25px;
}
.dropdown-cart > .dropdown-header i{
cursor: pointer;
float: right;
height: 22px;
width: 22px;
}
.dropdown-content {
padding-top: 10px;
padding-bottom: 10px;
}
.dropdown-content .item{
display: flex;
flex-direction: row;
border-bottom: 1px solid #E8E8E8;
}
.dropdown-content .item img{
height: 75px;
width: 75px;
margin-right: 8px;
}
.item-details .item-name {
font-size: 16px;
font-weight: bold;
margin-bottom: 10px;
}
.item-details .item-price {
margin-bottom: 10px;
}
.item-details .item-qty {
margin-bottom: 10px;
}
.dropdown-footer {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
}
.dropdown-footer button {
border-radius: 0px;
}
</style>

View File

@ -29,7 +29,6 @@ export default {
computed: {
haveChildren() {
console.log(this.item);
return this.item.children.length ? true : false;
}
}

View File

@ -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;

View File

@ -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;

View File

@ -1,7 +1,5 @@
<div class="header" id="header">
<div class="header-top">
<div class="left-content">
<ul class="logo-container">
@ -57,6 +55,7 @@
<ul>
<li><a href="{{ route('customer.session.index') }}">Sign In</a></li>
<li><a href="{{ route('customer.register.index') }}">Sign Up</a></li>
</ul>
@ -66,18 +65,20 @@
@endguest
@auth('customer')
<div class="dropdown-list bottom-right" style="display: none;">
<div class="dropdown-container">
<label>Account</label>
<ul>
<li><a href="{{ route('customer.account.index') }}">Account</a></li>
<li><a href="{{ route('customer.profile.index') }}">Profile</a></li>
<li><a href="{{ route('customer.address.index') }}">Address</a></li>
<li><a href="{{ route('customer.wishlist.index') }}">Wishlist</a></li>
<li><a href="{{ route('customer.cart') }}">Cart</a></li>
{{-- <li><a href="{{ route('customer.cart') }}">Cart</a></li> --}}
<li><a href="{{ route('customer.orders.index') }}">Orders</a></li>
<li><a href="{{ route('customer.session.destroy') }}">Logout</a></li>
</ul>
@ -90,21 +91,7 @@
</ul>
<ul class="cart-dropdown">
<li class="cart-summary">
<span class="icon cart-icon"></span>
<span class="cart"><span class="cart-count">5</span>Products</span>
<span class="icon arrow-down-icon"></span>
</li>
</ul>
<cart-dropdown @if(isset($cart)) :items='@json($cart)' @endif></cart-dropdown>
{{-- Meant for responsive views only --}}
<ul class="ham-dropdown-container">
@ -138,13 +125,13 @@
</div>
<div class="suggestion">
<span> designer sarees </span>
<span>Designer sarees</span>
</div>
<div class="suggestion">
<span> India patter sarees </span>
<span>India patter sarees</span>
</div>
<div class="suggestion">
<span> Border Sarees </span>
<span>Border Sarees</span>
</div>
</div>
@ -155,93 +142,7 @@
</div>
@push('scripts')
<script>
window.onload = function() {
var sort = document.getElementById("sortable");
var search = document.getElementById("search");
sort.addEventListener("click", myFunction);
search.addEventListener("click", myFunction);
// function for changing icon for responsive header
function myFunction(){
let className = document.getElementById(this.id).className;
let slider = document.getElementsByClassName("slider-block");
let feature = document.getElementsByClassName("featured-products");
let newUpdate = document.getElementsByClassName("news-update");
for (let i=0 ; i < slider.length ; i++){
slider[i].style.display="none";
}
for (let i=0 ; i < feature.length ; i++){
feature[i].style.display="none";
}
for (let i=0 ; i < newUpdate.length ; i++){
newUpdate[i].style.display="none";
}
if( className == 'icon search-icon') {
search.classList.remove('icon', 'search-icon');
search.classList.add('icon', 'cross-icon');
sort.classList.remove('icon', 'cross-icon');
sort.classList.remove('icon', 'sortable-icon');
sort.classList.add('icon', 'sortable-icon');
document.getElementsByClassName("header-bottom")[0].style.display="none";
document.getElementsByClassName("search-suggestion")[0].style.display="block";
}else if ( className == 'icon sortable-icon'){
sort.classList.remove('icon', 'sortable-icon');
sort.classList.add('icon', 'cross-icon');
search.classList.remove('icon', 'cross-icon');
search.classList.remove('icon', 'search-icon');
search.classList.add('icon', 'search-icon');
document.getElementsByClassName("header-bottom")[0].style.display="block";
document.getElementsByClassName("search-suggestion")[0].style.display="none";
} else {
sort.classList.remove('icon', 'cross-icon');
search.classList.remove('icon', 'cross-icon');
sort.classList.remove('icon', 'sortable-icon');
search.classList.remove('icon', 'search-icon');
sort.classList.add('icon', 'sortable-icon');
search.classList.add('icon', 'search-icon');
document.getElementsByClassName("header-bottom")[0].style.display="none";
document.getElementsByClassName("search-suggestion")[0].style.display="none";
let slider = document.getElementsByClassName("slider-block");
let feature = document.getElementsByClassName("featured-products");
let newUpdate = document.getElementsByClassName("news-update");
for (let i=0 ; i < slider.length ; i++){this.id
slider[i].style.display="block";
}
for (let i=0 ; i < feature.length ; i++){
feature[i].style.display="block";
}
for (let i=0 ; i < newUpdate.length ; i++){
newUpdate[i].style.display="block";
}
}
}
}
</script>
@endpush

View File

@ -8,7 +8,6 @@
</div>
<div class="layouter">
{{-- {{ dd(session()->getId()) }} --}}
<form method="POST" action="{{ route('cart.add', $product->id) }}">
@csrf()

View File

@ -61,7 +61,6 @@
},
created () {
console.log(this.images[0])
this.changeImage(this.images[0])
this.prepareThumbs()

View File

@ -5,7 +5,7 @@
class='alert-wrapper'
>
<flash
v-for='(flash, index) in flashes'
v-for='(flash) in flashes'
:key='flash.uid'
:flash="flash"
@onRemoveFlash="removeFlash($event)"

View File

@ -105,13 +105,13 @@
<th class="grid_head" data-column-name="{{ $column->alias }}" data-column-label="{{ $column->label }}">{!! $column->sorting() !!}</th>
@endif
@endforeach
@if(isset($attribute_columns))
{{-- @if(isset($attribute_columns))
@foreach($attribute_columns as $key => $value)
<th>
{{ $value }}
</th>
@endforeach
@endif
@endif --}}
<th>
Actions
</th>
@ -131,11 +131,11 @@
<td class="">{!! $column->render($result) !!}</td>
@endforeach
@if(isset($attribute_columns))
{{-- @if(isset($attribute_columns))
@foreach ($attribute_columns as $atc)
<td>{{ $result->{$atc} }}</td>
@endforeach
@endif
@endif --}}
<td class="action">
@foreach($actions as $action)

View File

@ -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

View File

@ -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;

View File

@ -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 <style> tag
// load the styles
var content = __webpack_require__(33);
if(typeof content === 'string') content = [[module.i, content, '']];
if(content.locals) module.exports = content.locals;
// add the styles to the DOM
var update = __webpack_require__(20)("69b33cbc", content, false, {});
// Hot Module Replacement
if(false) {
// When the styles change, update the <style> tags
if(!content.locals) {
module.hot.accept("!!../../../../../node_modules/css-loader/index.js!../../../../../node_modules/vue-loader/lib/style-compiler/index.js?{\"vue\":true,\"id\":\"data-v-0f947e82\",\"scoped\":false,\"hasInlineConfig\":true}!../../../../../node_modules/vue-loader/lib/selector.js?type=styles&index=0!./cart-dropdown.vue", function() {
var newContent = require("!!../../../../../node_modules/css-loader/index.js!../../../../../node_modules/vue-loader/lib/style-compiler/index.js?{\"vue\":true,\"id\":\"data-v-0f947e82\",\"scoped\":false,\"hasInlineConfig\":true}!../../../../../node_modules/vue-loader/lib/selector.js?type=styles&index=0!./cart-dropdown.vue");
if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
update(newContent);
});
}
// When the module is disposed, remove the <style> tags
module.hot.dispose(function() { update(); });
}
/***/ }),
/* 33 */
/***/ (function(module, exports, __webpack_require__) {
exports = module.exports = __webpack_require__(19)(false);
// imports
// module
exports.push([module.i, "\n.show {\n display: none;\n}\n.dropdown-cart {\n position: absolute;\n background: #FFFFFF;\n border: 1px solid #E8E8E8;\n -webkit-box-shadow: 1px 3px 6px 0 rgba(0,0,0,0.40);\n box-shadow: 1px 3px 6px 0 rgba(0,0,0,0.40);\n padding: 20px;\n border-radius: 1px;\n right: 10%;\n top: 75px;\n width: 387px;\n z-index: 5;\n}\n.dropdown-cart > .dropdown-header {\n width: 100%;\n}\n.dropdown-cart > .dropdown-header p{\n display: inline;\n line-height: 25px;\n}\n.dropdown-cart > .dropdown-header i{\n cursor: pointer;\n float: right;\n height: 22px;\n width: 22px;\n}\n.dropdown-content {\n padding-top: 10px;\n padding-bottom: 10px;\n}\n.dropdown-content .item{\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-orient: horizontal;\n -webkit-box-direction: normal;\n -ms-flex-direction: row;\n flex-direction: row;\n border-bottom: 1px solid #E8E8E8;\n}\n.dropdown-content .item img{\n height: 75px;\n width: 75px;\n margin-right: 8px;\n}\n.item-details .item-name {\n font-size: 16px;\n font-weight: bold;\n margin-bottom: 10px;\n}\n.item-details .item-price {\n margin-bottom: 10px;\n}\n.item-details .item-qty {\n margin-bottom: 10px;\n}\n.dropdown-footer {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-orient: horizontal;\n -webkit-box-direction: normal;\n -ms-flex-direction: row;\n flex-direction: row;\n -webkit-box-pack: justify;\n -ms-flex-pack: justify;\n justify-content: space-between;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n}\n.dropdown-footer button {\n border-radius: 0px;\n}\n\n", ""]);
// exports
/***/ })
/******/ ]);

View File

@ -73,7 +73,7 @@
@else
<a href="{{ route('login') }}">Login</a>
<a href="{{ route('register') }}">Register</a>
@endauth
@endauthexample-component
</div>
@endif