diff --git a/composer.json b/composer.json index f449e009b..5280854d0 100644 --- a/composer.json +++ b/composer.json @@ -11,6 +11,7 @@ "php": "^7.1.3", "barryvdh/laravel-dompdf": "^0.8.0@dev", "dimsav/laravel-translatable": "^9.0", + "doctrine/dbal": "^2.9@dev", "fideloper/proxy": "^4.0", "flynsarmy/db-blade-compiler": "*", "intervention/image": "^2.4", diff --git a/packages/Webkul/API/Http/Controllers/Customer/AddressController.php b/packages/Webkul/API/Http/Controllers/Customer/AddressController.php index df23f31d3..633ce6dec 100644 --- a/packages/Webkul/API/Http/Controllers/Customer/AddressController.php +++ b/packages/Webkul/API/Http/Controllers/Customer/AddressController.php @@ -6,8 +6,10 @@ use Webkul\API\Http\Controllers\Controller; use Illuminate\Http\Request; use Illuminate\Http\Response; use Illuminate\Support\Facades\Event; +use Webkul\Customer\Repositories\CustomerAddressRepository as CustomerAddress; use Auth; use Cart; +use Validator; /** * Address controller for the APIs Customer Address @@ -18,33 +20,107 @@ use Cart; class AddressController extends Controller { protected $customer; + protected $customerAddress; - public function __construct() + public function __construct(CustomerAddress $customerAddress) { + $this->middleware('auth:customer'); + + $this->customerAddress = $customerAddress; + if(auth()->guard('customer')->check()) { $this->customer = auth()->guard('customer')->user(); } else { - return response()->json('Unauthorized', 401); + $this->customer['message'] = 'unauthorized'; + $this->unAuthorized(); } } + public function unAuthorized() { + return response()->json($this->customer, 401); + } + /** * To get the details of user to display on profile * * @return response JSON */ - public function getAddress() { - $addresses = $this->customer->addresses; + public function get() { + if($this->customer == false) { + return response()->json($this->customer, 401); + } else { + $addresses = $this->customer->addresses; - return response()->json($addresses, 200); + return response()->json($addresses, 200); + } } - public function getDefaultAddress() { + public function getDefault() { + if($this->customer == false) { + return response()->json($this->customer, 401); + } else { + $defaultAddress = $this->customer->default_address; + + if ($defaultAddress->count() > 0) { + return response()->json($defaultAddress, 200); + } else { + return response()->json(['false, default address not found'], 200); + } + } + } + + public function create() { + $data = request()->all(); + + $validator = Validator::make(request()->all(), [ + 'address1' => 'string|required', + 'address2' => 'string', + 'country' => 'string|required', + 'state' => 'string|required', + 'city' => 'string|required', + 'postcode' => 'required', + 'phone' => 'required' + ]); + + if ($validator->fails()) { + return response()->json($validator->messages(), 400); + } + + $cust_id['customer_id'] = $this->customer->id; + $data = array_merge($cust_id, $data); + + if($this->customer->addresses->count() == 0) { + $data['default_address'] = 1; + } + + $result = $this->customerAddress->create($data); + + if($result) { + return response()->json(true, 200); + } else { + return response()->json(false, 200); + } + } + + public function delete($id) { + $result = $this->customerAddress->delete($id); + + return response()->json($result, 200); + } + + public function makeDefault($id) { $defaultAddress = $this->customer->default_address; - if($defaultAddress->count() > 0) - return response()->json($defaultAddress, 200); - else + if($defaultAddress != null && $defaultAddress->count() > 0) { + $defaultAddress->update(['default_address' => 0]); + } + + if($this->customerAddress->find($id)->default_address == 1) { return response()->json(false, 200); + } + + $result = $this->customerAddress->update(['default_address' => 1], $id); + + return response()->json($result, 200); } } \ No newline at end of file diff --git a/packages/Webkul/API/Http/Controllers/Customer/AuthController.php b/packages/Webkul/API/Http/Controllers/Customer/AuthController.php index 603ccd4d7..d0b1976b0 100644 --- a/packages/Webkul/API/Http/Controllers/Customer/AuthController.php +++ b/packages/Webkul/API/Http/Controllers/Customer/AuthController.php @@ -18,14 +18,6 @@ use Cart; */ class AuthController extends Controller { - public function __construct() - { - // $this->middleware('customer')->except(['show','create']); - // $this->_config = request('_config'); - // $subscriber = new CustomerEventsHandler; - // Event::subscribe($subscriber); - } - /** * To get the details of user to display on profile * @@ -34,10 +26,19 @@ class AuthController extends Controller public function create() { $data = request()->except('_token'); - if(!auth()->guard('customer')->attempt($data)) { - return response()->json('Incorrect Credentials', 200); + if(!auth()->guard('customer')->check()) { + if(!auth()->guard('customer')->attempt($data)) { + return response()->json(['message' => 'unauthenticated', 'details' => 'invalid creds'], 401); + } else { + return response()->json(['message' => 'authenticated', 'user' => auth()->guard('customer')->user()], 200); + } } else { - return response()->json(auth()->guard('customer')->user(), 200); + return response()->json(['message' => 'already authenticated'], 200); } } + + public function destroy() { + auth()->guard('customer')->logout(); + return response()->json(['message' => 'logged out'], 200); + } } \ No newline at end of file diff --git a/packages/Webkul/API/Http/Controllers/Customer/CustomerController.php b/packages/Webkul/API/Http/Controllers/Customer/CustomerController.php index e1a74f30d..b2bf1203b 100644 --- a/packages/Webkul/API/Http/Controllers/Customer/CustomerController.php +++ b/packages/Webkul/API/Http/Controllers/Customer/CustomerController.php @@ -8,6 +8,8 @@ use Illuminate\Http\Response; use Illuminate\Support\Facades\Event; use Auth; use Cart; +use Validator; +use Hash; /** * Customer controller for the APIs of Profile customer @@ -24,16 +26,91 @@ class CustomerController extends Controller if(auth()->guard('customer')->check()) { $this->customer = auth()->guard('customer')->user(); } else { - return response()->json('Unauthorized', 401); + $this->customer['message'] = 'unauthorized'; + $this->unAuthorized(); } } + public function unAuthorized() { + return response()->json($this->customer, 401); + } + /** * To get the details of user to display on profile + * Only accepts the id of simple or configurable product * * @return response JSON */ - public function getProfile() { - return $this->customer; + public function getProfile() + { + return response()->json($this->customer, 200); } + + public function updateProfile($id) + { + $validator = Validator::make(request()->all(), [ + 'first_name' => 'string|required', + 'last_name' => 'string|required', + 'gender' => 'required', + 'date_of_birth' => 'date', + 'email' => 'email|required|unique:customers,email,'.$id, + 'password' => 'confirmed|required_if:oldpassword,!=,null' + ]); + + if ($validator->fails()) { + return response()->json($validator->messages(), 400); + } + + $data = collect(request()->all())->toArray(); + + if($data['oldpassword'] == null) { + $data = collect(request()->input())->except([ 'oldpassword', 'password', 'password_confirmation'])->toArray(); + } else { + if(Hash::check($data['oldpassword'], auth()->guard('customer')->user()->password)) { + $data = collect(request()->input())->toArray(); + + $data['password'] = bcrypt($data['password']); + } else { + return response()->json('Old password does not match', 200); + } + } + + $result = $this->customer->update($data); + + if($result) { + return response()->json(true, 200); + } else { + return response()->json(false, 200); + } + } + + /** + * Get all instances of cart for currently logged in customer + * + * @return collection Cart + */ + public function getAllCart() { + $carts = $this->customer->carts; + + if($cart->count() > 0) { + return response()->json(['message' => 'successful','items' => $cart], 200); + } else { + return response()->json(['message' => 'empty', 'items' => null], 200); + } + } + + public function getActiveCart() { + $cart = Cart::getCart(); + + if($cart == null) { + return response()->json(['message' => 'empty', 'items' => 'null']); + } + + if($cart->count() > 0 ) { + return response()->json(['message' => 'success', 'items' => $cart]); + } else { + return response()->json(['message' => 'empty', 'items' => 'null']); + } + } + } \ No newline at end of file diff --git a/packages/Webkul/API/Http/Controllers/Customer/RegistrationController.php b/packages/Webkul/API/Http/Controllers/Customer/RegistrationController.php new file mode 100644 index 000000000..ee6a07465 --- /dev/null +++ b/packages/Webkul/API/Http/Controllers/Customer/RegistrationController.php @@ -0,0 +1,55 @@ + @prashant-webkul + * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) + */ +class RegistrationController extends Controller +{ + protected $customer; + + public function __construct(Customer $customer) { + $this->customer = $customer; + } + + public function create() { + $validator = Validator::make(request()->all(), [ + 'first_name' => 'string|required', + 'last_name' => 'string|required', + 'email' => 'email|required|unique:customers,email', + 'password' => 'confirmed|min:6|required', + 'agreement' => 'required' + ]); + + if ($validator->fails()) { + return response()->json($validator->messages(), 400); + } + + $data = request()->all(); + + $data['password'] = bcrypt($data['password']); + + $data['channel_id'] = core()->getCurrentChannel()->id; + + $data['is_verified'] = 0; + + $result = $this->customer->create($data); + + if ($result) { + return response()->json(true, 200); + } else { + return response()->json(false, 200); + } + } +} \ No newline at end of file diff --git a/packages/Webkul/API/Http/Controllers/Customer/WishlistController.php b/packages/Webkul/API/Http/Controllers/Customer/WishlistController.php index a975d3d14..d2fbd9446 100644 --- a/packages/Webkul/API/Http/Controllers/Customer/WishlistController.php +++ b/packages/Webkul/API/Http/Controllers/Customer/WishlistController.php @@ -5,6 +5,8 @@ namespace Webkul\API\Http\Controllers\Customer; use Webkul\API\Http\Controllers\Controller; use Illuminate\Http\Request; use Illuminate\Http\Response; +use Webkul\Product\Repositories\ProductRepository as Product; +use Webkul\Customer\Repositories\WishlistRepository as Wishlist; use Auth; use Cart; @@ -17,16 +19,26 @@ use Cart; class WishlistController extends Controller { protected $customer; + protected $product; + protected $wishlist; - public function __construct() + public function __construct(Product $product, Wishlist $wishlist) { if(auth()->guard('customer')->check()) { + $this->product = $product; + $this->wishlist = $wishlist; $this->customer = auth()->guard('customer')->user(); } else { - return response()->json('Unauthorized', 401); + $this->customer['message'] = 'unauthorized'; + $this->unAuthorized(); } } + public function unAuthorized() + { + return response()->json($this->customer, 401); + } + public function getWishlist() { $wishlist = $this->customer->wishlist_items; @@ -34,7 +46,57 @@ class WishlistController extends Controller if($wishlist->count() > 0) { return response()->json($wishlist, 200); } else { - return response()->json('Wishlist Empty', 200); + return response()->json(['message' => 'Wishlist Empty', 'Items' => null], 200); + } + } + + /** + * Function to add item to the wishlist. + * Only accepts the id of simple or configurable product + * + * @param integer $productId + */ + public function add($productId) + { + $product = $this->product->findOneByField('id', $productId); + + $data = [ + 'channel_id' => core()->getCurrentChannel()->id, + 'product_id' => $productId, + 'customer_id' => auth()->guard('customer')->user()->id + ]; + + //accidental case if some one adds id of the product in the anchor tag amd gives id of a variant. + if($product->parent_id != null) { + $data['product_id'] = $productId = $product->parent_id; + } + + $checked = $this->wishlist->findWhere(['channel_id' => core()->getCurrentChannel()->id, 'product_id' => $productId, 'customer_id' => auth()->guard('customer')->user()->id]); + + if($checked->isEmpty()) { + if($wishlistItem = $this->wishlist->create($data)) { + return response()->json(['message' => 'Successfully Added Item To Wishlist', 'items' => $wishlistItem], 200); + } else { + return response()->json(['message' => 'Error! Cannot Add Item To Wishlist', 'items' => null], 401); + } + } else { + return response()->json(['message' => trans('customer::app.wishlist.already'), 'items' => null], 200); + } + } + + /** + * Function to remove item to the wishlist. + * + * @param integer $itemId + */ + public function delete($itemId) + { + $result = $this->wishlist->deleteWhere(['customer_id' => auth()->guard('customer')->user()->id, 'channel_id' => core()->getCurrentChannel()->id, 'id' => $itemId]); + + if($result) { + return response()->json(['message' => 'Item Successfully Removed From Wishlist', 'status' => $result]); + } else { + return response()->json(['message' => 'Error! While Removing Item From Wishlist', 'status' => $result]); } } } \ No newline at end of file diff --git a/packages/Webkul/API/Http/Controllers/Product/ProductController.php b/packages/Webkul/API/Http/Controllers/Product/ProductController.php index 1565ed5e1..de3452dc7 100644 --- a/packages/Webkul/API/Http/Controllers/Product/ProductController.php +++ b/packages/Webkul/API/Http/Controllers/Product/ProductController.php @@ -6,32 +6,70 @@ use Webkul\API\Http\Controllers\Controller; use Illuminate\Http\Request; use Illuminate\Http\Response; use Webkul\Product\Repositories\ProductRepository as Product; -use Auth; /** - * Product controller for the APIs of Getting Products + * Product controller * * @author Prashant Singh @prashant-webkul * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) */ class ProductController extends Controller { + /** + * Contains route related configuration + * + * @var array + */ + protected $_config; + + /** + * ProductRepository object + * + * @var array + */ protected $product; - public function __construct(Product $product) + /** + * Create a new controller instance. + * + * @param Webkul\Product\Repositories\ProductRepository $product + * @return void + */ + public function __construct( Product $product) { $this->product = $product; + + $this->_config = request('_config'); } - public function getAllProducts() { + /** + * Display a listing of the resource. + * + * @param string $slug + * @return \Illuminate\Http\Response + */ + public function getBySlug($slug) + { + $product = $this->product->findBySlugOrFail($slug); + + return response()->json(['message' => 'success', 'product' => $product]); + } + + public function getAll() { $products = $this->product->all(); return response()->json($products, 200); } - public function getNewProducts() { - $newProducts = $this->product->getNewProduct(); + public function getNew() { + $newProducts = $this->product->getNewProducts(); return response()->json($newProducts, 200); } -} \ No newline at end of file + + public function getFeatured() { + $featuredProducts = $this->product->getFeaturedProducts(); + + return response()->json($featuredProducts, 200); + } +} diff --git a/packages/Webkul/API/Http/Controllers/Product/ReviewController.php b/packages/Webkul/API/Http/Controllers/Product/ReviewController.php new file mode 100644 index 000000000..0f7140e9f --- /dev/null +++ b/packages/Webkul/API/Http/Controllers/Product/ReviewController.php @@ -0,0 +1,127 @@ + @prashant-webkul + * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) + */ +class ReviewController extends Controller +{ + /** + * Contains route related configuration + * + * @var array + */ + protected $_config; + + /** + * ProductRepository object + * + * @var array + */ + protected $product; + + /** + * ProductReviewRepository object + * + * @var array + */ + protected $productReview; + + /** + * Review helper Object + * + */ + protected $reviewHelper; + + /** + * Create a new controller instance. + * + * @param Webkul\Product\Repositories\ProductRepository $product + * @param Webkul\Product\Repositories\ProductReviewRepository $productReview + * @return void + */ + public function __construct(Product $product, ProductReview $productReview, Review $reviewHelper) + { + // $this->middleware('customer')->only(['create', 'store', 'destroy']); + + $this->product = $product; + + $this->productReview = $productReview; + + $this->reviewHelper = $reviewHelper; + + $this->_config = request('_config'); + } + + /** + * Store a newly created resource in storage. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Http\Response + */ + public function store(Request $request , $id) + { + $this->validate(request(), [ + 'comment' => 'required', + 'rating' => 'required', + 'title' => 'required', + ]); + + $data = request()->all(); + + $customer_id = auth()->guard('customer')->user()->id; + + $data['status'] = 'pending'; + $data['product_id'] = $id; + $data['customer_id'] = $customer_id; + + $result = $this->productReview->create($data); + + if($result) { + return response()->json(['message' => 'success', 'status' => $result]); + } else { + return response()->json(['message' => 'failed', 'status' => $result]); + } + } + + /** + * Display reviews accroding to product. + * + * @param string $slug + * @return \Illuminate\Http\Response + */ + public function show($slug) + { + $product = $this->product->findBySlugOrFail($slug); + + $productReviews = $this->reviewHelper->getReviews($product)->get(); + + return $productReviews; + } + + /** + * Delete the review of the current product + * + * @return response + */ + public function destroy($id) + { + $this->productReview->delete($id); + + session()->flash('success', 'Product Review Successfully Deleted'); + + return redirect()->back(); + } +} diff --git a/packages/Webkul/API/Http/Controllers/Shop/CartController.php b/packages/Webkul/API/Http/Controllers/Shop/CartController.php index 47b975ce7..836aec630 100644 --- a/packages/Webkul/API/Http/Controllers/Shop/CartController.php +++ b/packages/Webkul/API/Http/Controllers/Shop/CartController.php @@ -6,9 +6,11 @@ use Webkul\API\Http\Controllers\Controller; use Illuminate\Http\Request; use Illuminate\Http\Response; use Illuminate\Support\Facades\Event; -use Auth; -// use Cart; use Webkul\Checkout\Repositories\CartRepository; +use Webkul\Checkout\Repositories\CartItemRepository as CartItem; +use Webkul\API\Http\Controllers\Shop\Presenter as Presenter; +use Auth; +use Cart; /** * Cart controller for the APIs of User Cart @@ -19,31 +21,106 @@ use Webkul\Checkout\Repositories\CartRepository; class CartController extends Controller { protected $customer; - protected $cart; + protected $cartItem; - public function __construct(CartRepository $cart) + public function __construct(CartRepository $cart, CartItem $cartItem) { $this->cart = $cart; - if(auth()->guard('customer')->check()) { - $this->customer = auth()->guard('customer')->user(); + $this->cartItem = $cartItem; + } + + /** + * Function to get the current cart instance for customer or guest + * + * @return Response array && Collection Cart + */ + public function get() { + $cart = Cart::getCart(); + + if($cart == null || $cart == 'null') { + return response()->json(['message' => 'empty', 'items' => null]); + } + + return response()->json(['message' => 'success', 'items' => $cart]); + } + + /** + * Function for guests user to add the product in the cart. + * + * @return Mixed + */ + public function add($id) { + $result = Cart::add($id, request()->all()); + + if($result) { + Cart::collectTotals(); + + return response()->json(['message' => 'successful', 'items' => Cart::getCart()->items]); } else { - return response()->json('Unauthorized', 401); + return response()->json(['message' => 'failed', 'items' => Cart::getCart()->items]); } } - public function getAllCart() { - $carts = $this->customer->carts; + /** + * Removes the item from the cart if it exists + * + * @param integer $itemId + */ + public function remove($itemId) { + $result = Cart::removeItem($itemId); - if($cart->count() > 0) { - return response()->json($cart, 200); - } else { - return response()->json('Cart Empty', 200); - } + Cart::collectTotals(); + + return response()->json(['message' => $result, 'items' => Cart::getCart()]); } - public function getActiveCart() { - return $this->customer->cart; + /** + * Before checkout starts or full details on the cart + * + * @return response json + */ + public function onePage() { + $cart = Cart::getCart(); + + if($cart == null || $cart == 'null') { + return response()->json(['message' => 'empty', 'items' => null]); + } + + $presenter = new Presenter(); + $summary = $presenter->onePagePresenter($cart); + + return response()->json(['message' => 'success', 'items' => $cart->items, 'summary' => $summary]); + } + + /** + * Updates the quantity of the items present in the cart. + * + * @return response JSON + */ + public function updateOnePage() { + $request = request()->except('_token'); + + foreach($request['qty'] as $id => $quantity) { + if($quantity <= 0) { + return response()->json(['message' => 'Illegal Quantity', 'status' => 'error']); + } + } + + foreach($request['qty'] as $key => $value) { + $item = $this->cartItem->findOneByField('id', $key); + + $data['quantity'] = $value; + + $result = Cart::updateItem($item->product_id, $data, $key); + + unset($item); + unset($data); + } + + Cart::collectTotals(); + + return response()->json(['message' => 'success', 'items' => Cart::getCart()]); } } \ No newline at end of file diff --git a/packages/Webkul/API/Http/Controllers/Shop/CategoryController.php b/packages/Webkul/API/Http/Controllers/Shop/CategoryController.php new file mode 100644 index 000000000..56a0ba14e --- /dev/null +++ b/packages/Webkul/API/Http/Controllers/Shop/CategoryController.php @@ -0,0 +1,49 @@ + @prashant-webkul + * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) + */ +class CategoryController extends Controller +{ + /** + * The category implementation. + * + * for shop bundle's navigation + * menu + */ + protected $category; + + /** + * Category Repository DI. + * + * @param $category Category Instance + * @return void + */ + public function __construct(Category $category) + { + $this->category = $category; + } + + public function get() { + $categories = []; + + foreach ($this->category->getVisibleCategoryTree() as $category) { + array_push($categories, collect($category)); + } + + return $categories; + } + +} \ No newline at end of file diff --git a/packages/Webkul/API/Http/Controllers/Shop/Presenter.php b/packages/Webkul/API/Http/Controllers/Shop/Presenter.php new file mode 100644 index 000000000..fc06bfd24 --- /dev/null +++ b/packages/Webkul/API/Http/Controllers/Shop/Presenter.php @@ -0,0 +1,22 @@ +grand_total; + $cartSummary['tax_total'] = $cart->tax_total; + $cartSummary['total_items'] = $cart->items_count; + $cartSummary['total_items_qty'] = $cart->items_qty; + $cartSummary['total_items_qty'] = $cart->items_qty; + + return $cartSummary; + } +} \ No newline at end of file diff --git a/packages/Webkul/API/Http/api.php b/packages/Webkul/API/Http/api.php index 396c14e4f..0da15a760 100644 --- a/packages/Webkul/API/Http/api.php +++ b/packages/Webkul/API/Http/api.php @@ -1,39 +1,76 @@ 'Webkul\API\Http\Controllers\Customer', 'prefix' => 'api/customer'], function ($router) { + //customer registration API + Route::post('/register', 'RegistrationController@create'); + //auth route for customer Route::post('login', 'AuthController@create'); + //auth route for customer + Route::post('logout', 'AuthController@destroy'); - //get user - Route::get('get/user', 'CustomerController@getProfile'); + //get customer profile + Route::get('get/profile', 'CustomerController@getProfile'); + Route::put('update/profile/{id}', 'CustomerController@updateProfile'); //wishlist + //get wishlist Route::get('get/wishlist', 'WishlistController@getWishlist'); + //add the item in the wishlist + Route::get('add/wishlist/{id}', 'WishlistController@add'); + //delete the item from the wishlist + Route::get('delete/wishlist/{id}', 'WishlistController@delete'); + //Move the item from the wishlist to cart + // Route::get('delete/wishlist/{id}', 'WishlistController@delete'); //address - Route::get('get/address', 'AddressController@getAddress'); - Route::get('get/default/address', 'AddressController@getDefaultAddress'); -}); + Route::get('get/address', 'AddressController@get'); + Route::get('get/default/address', 'AddressController@getDefault'); + Route::post('create/address', 'AddressController@create'); + Route::put('make/default/address/{id}', 'AddressController@makeDefault'); + Route::delete('delete/address/{id}', 'AddressController@delete'); -Route::group(['namespace' => 'Webkul\API\Http\Controllers\Shop', 'prefix' => 'api/cart'], function ($router) { - - //cart + //cart -> not to be used //active + inactive instances of cart for the current logged in user - Route::get('get/all', 'CartController@getAllCart'); - + Route::get('get/all', 'CustomerController@getAllCart'); //active instances of cart for the current logged in user - Route::get('get/active', 'CartController@getActiveCart'); - - //inactive instances of cart for the current logged in user - Route::get('get/inactive', 'CartController@getInactiveCart'); + Route::get('get/active', 'CustomerController@getActiveCart'); }); +//all the cart related API for customer and guests +Route::group(['namespace' => 'Webkul\API\Http\Controllers\Shop', 'prefix' => 'api/cart'], function ($router) { + //cart + Route::get('get', 'CartController@get'); + //add item in the cart + Route::post('add/{id}', 'CartController@add'); + //remove item to the cart + Route::get('remove/{id}', 'CartController@remove'); + //get cart and all item for cart checkout + Route::get('/onepage', 'CartController@onePage'); + //update OnePage + Route::put('/update/onepage', 'CartController@updateOnePage'); +}); + +//all the product related API to be used for store front Route::group(['namespace' => 'Webkul\API\Http\Controllers\Product', 'prefix' => 'api/product'], function ($router) { //product - //to fetch the new product - Route::get('get/all', 'ProductController@getAllProducts'); + //to get all products + Route::get('get/all', 'ProductController@getAll'); + //to fetch the new products + Route::get('get/new', 'ProductController@getNew'); + //to fetch the featured product + Route::get('get/featured', 'ProductController@getFeatured'); + //to get the product by its slug + Route::get('get/{slug}', 'ProductController@getBySlug'); + + //product reviews get and create + //to get the reviews of the product + Route::get('review/{slug}', 'ReviewController@show'); + //to store the review for a product + Route::post('review/{slug}', 'ReviewController@create'); }); -Route::group(['namespace' => 'Webkul\API\Http\Controllers\Admin', 'prefix' => 'api/admin'], function ($router) { - +//all the shop related API to be used for store front +Route::group(['namespace' => 'Webkul\API\Http\Controllers\Shop', 'prefix' => 'api/shop'], function ($router) { + Route::get('get/category', 'CategoryController@get'); }); \ No newline at end of file diff --git a/packages/Webkul/Admin/src/DataGrids/AttributeDataGrid.php b/packages/Webkul/Admin/src/DataGrids/AttributeDataGrid.php index 50a5dd83f..65e0b823e 100644 --- a/packages/Webkul/Admin/src/DataGrids/AttributeDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/AttributeDataGrid.php @@ -5,7 +5,6 @@ namespace Webkul\Admin\DataGrids; use Illuminate\View\View; use Webkul\Ui\DataGrid\Facades\DataGrid; - /** * Attributes DataGrid * @@ -33,12 +32,12 @@ class AttributeDataGrid 'aliased' => true, 'massoperations' => [ - [ - 'route' => route('admin.datagrid.delete'), - 'method' => 'DELETE', - 'label' => 'Delete', - 'type' => 'button', - ], + // [ + // 'route' => route('admin.datagrid.delete'), + // 'method' => 'DELETE', + // 'label' => 'Delete', + // 'type' => 'button', + // ], ], 'actions' => [ @@ -148,20 +147,17 @@ class AttributeDataGrid 'alias' => 'attributeId', 'type' => 'number', 'label' => 'ID', - ], - [ + ], [ 'column' => 'code', 'alias' => 'attributeCode', 'type' => 'string', 'label' => 'Code', - ], - [ + ], [ 'column' => 'admin_name', 'alias' => 'attributeAdminName', 'type' => 'string', - 'label' => 'AdminName', - ], - [ + 'label' => 'Name', + ], [ 'column' => 'type', 'alias' => 'attributeType', 'type' => 'string', @@ -175,13 +171,11 @@ class AttributeDataGrid 'column' => 'code', 'alias' => 'attributeCode', 'type' => 'string', - ], - [ + ], [ 'column' => 'admin_name', 'alias' => 'attributeAdminName', 'type' => 'string', - ], - [ + ], [ 'column' => 'type', 'alias' => 'attributeType', 'type' => 'string', diff --git a/packages/Webkul/Admin/src/DataGrids/AttributeFamilyDataGrid.php b/packages/Webkul/Admin/src/DataGrids/AttributeFamilyDataGrid.php index 9a5dc85c4..9ff9261ba 100644 --- a/packages/Webkul/Admin/src/DataGrids/AttributeFamilyDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/AttributeFamilyDataGrid.php @@ -33,12 +33,12 @@ class AttributeFamilyDataGrid 'aliased' => false, //use this with false as default and true in case of joins 'massoperations' =>[ - [ - 'route' => route('admin.datagrid.delete'), - 'method' => 'DELETE', - 'label' => 'Delete', - 'type' => 'button', - ], + // [ + // 'route' => route('admin.datagrid.delete'), + // 'method' => 'DELETE', + // 'label' => 'Delete', + // 'type' => 'button', + // ], ], 'actions' => [ @@ -87,7 +87,7 @@ class AttributeFamilyDataGrid 'name' => 'name', 'alias' => 'attributeFamilyName', 'type' => 'string', - 'label' => 'Code', + 'label' => 'Name', 'sortable' => true, ], ], diff --git a/packages/Webkul/Admin/src/DataGrids/CategoryDataGrid.php b/packages/Webkul/Admin/src/DataGrids/CategoryDataGrid.php index 2f4d0f9eb..1fc176f52 100644 --- a/packages/Webkul/Admin/src/DataGrids/CategoryDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/CategoryDataGrid.php @@ -33,12 +33,12 @@ class CategoryDataGrid 'aliased' => true, //use this with false as default and true in case of joins 'massoperations' =>[ - [ - 'route' => route('admin.datagrid.delete'), - 'method' => 'DELETE', - 'label' => 'Delete', - 'type' => 'button', - ], + // [ + // 'route' => route('admin.datagrid.delete'), + // 'method' => 'DELETE', + // 'label' => 'Delete', + // 'type' => 'button', + // ], ], 'actions' => [ @@ -112,7 +112,7 @@ class CategoryDataGrid 'alias' => 'cat_locale', 'type' => 'string', 'label' => 'Locale', - 'sortable' => true, + 'sortable' => false, 'filter' => [ 'function' => 'orWhere', 'condition' => ['ct.locale', app()->getLocale()] @@ -123,12 +123,12 @@ class CategoryDataGrid 'filterable' => [ [ 'column' => 'cat.id', - 'alias' => 'catID', + 'alias' => 'cat_id', 'type' => 'number', 'label' => 'Category ID', ], [ 'column' => 'ct.name', - 'alias' => 'catName', + 'alias' => 'cat_name', 'type' => 'string', 'label' => 'Category Name', ], @@ -140,7 +140,7 @@ class CategoryDataGrid // ], [ 'column' => 'cat.status', - 'alias' => 'catStatus', + 'alias' => 'cat_status', 'type' => 'string', 'label' => 'Visible in Menu', ], diff --git a/packages/Webkul/Admin/src/DataGrids/ChannelDataGrid.php b/packages/Webkul/Admin/src/DataGrids/ChannelDataGrid.php index 6d2c9243c..eceb562d8 100644 --- a/packages/Webkul/Admin/src/DataGrids/ChannelDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/ChannelDataGrid.php @@ -33,12 +33,12 @@ class ChannelDataGrid 'aliased' => false, //use this with false as default and true in case of joins 'massoperations' =>[ - [ - 'route' => route('admin.datagrid.delete'), - 'method' => 'DELETE', - 'label' => 'Delete', - 'type' => 'button', - ], + // [ + // 'route' => route('admin.datagrid.delete'), + // 'method' => 'DELETE', + // 'label' => 'Delete', + // 'type' => 'button', + // ], ], 'actions' => [ diff --git a/packages/Webkul/Admin/src/DataGrids/CountryDataGrid.php b/packages/Webkul/Admin/src/DataGrids/CountryDataGrid.php index a5c0ddec3..01abdfe6e 100644 --- a/packages/Webkul/Admin/src/DataGrids/CountryDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/CountryDataGrid.php @@ -33,12 +33,12 @@ class CountryDataGrid 'aliased' => false, //use this with false as default and true in case of joins 'massoperations' =>[ - [ - 'route' => route('admin.datagrid.delete'), - 'method' => 'DELETE', - 'label' => 'Delete', - 'type' => 'button', - ], + // [ + // 'route' => route('admin.datagrid.delete'), + // 'method' => 'DELETE', + // 'label' => 'Delete', + // 'type' => 'button', + // ], ], 'actions' => [ diff --git a/packages/Webkul/Admin/src/DataGrids/CurrencyDataGrid.php b/packages/Webkul/Admin/src/DataGrids/CurrencyDataGrid.php index a4c81b178..9b4162f46 100644 --- a/packages/Webkul/Admin/src/DataGrids/CurrencyDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/CurrencyDataGrid.php @@ -32,12 +32,12 @@ class CurrencyDataGrid 'aliased' => false, //use this with false as default and true in case of joins 'massoperations' =>[ - [ - 'route' => route('admin.datagrid.delete'), - 'method' => 'DELETE', - 'label' => 'Delete', - 'type' => 'button', - ], + // [ + // 'route' => route('admin.datagrid.delete'), + // 'method' => 'DELETE', + // 'label' => 'Delete', + // 'type' => 'button', + // ], ], 'actions' => [ diff --git a/packages/Webkul/Admin/src/DataGrids/CustomerDataGrid.php b/packages/Webkul/Admin/src/DataGrids/CustomerDataGrid.php index 16328fbe8..06d9235ae 100644 --- a/packages/Webkul/Admin/src/DataGrids/CustomerDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/CustomerDataGrid.php @@ -31,12 +31,12 @@ class CustomerDataGrid 'aliased' => true, //use this with false as default and true in case of joins 'massoperations' =>[ - [ - 'route' => route('admin.datagrid.delete'), - 'method' => 'DELETE', - 'label' => 'Delete', - 'type' => 'button', //select || button only - ], + // [ + // 'route' => route('admin.datagrid.delete'), + // 'method' => 'DELETE', + // 'label' => 'Delete', + // 'type' => 'button', //select || button only + // ], ], 'actions' => [ diff --git a/packages/Webkul/Admin/src/DataGrids/CustomerGroupDataGrid.php b/packages/Webkul/Admin/src/DataGrids/CustomerGroupDataGrid.php index 3efe26e16..37649ee86 100644 --- a/packages/Webkul/Admin/src/DataGrids/CustomerGroupDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/CustomerGroupDataGrid.php @@ -32,23 +32,23 @@ class CustomerGroupDataGrid 'aliased' => true, //use this with false as default and true in case of joins 'massoperations' =>[ - [ - 'route' => route('admin.datagrid.delete'), - 'method' => 'DELETE', - 'label' => 'Delete', - 'type' => 'button', - ], - [ - 'route' => route('admin.datagrid.index'), - 'method' => 'POST', - 'label' => 'View Grid', - 'type' => 'select', - 'options' =>[ - 1 => 'Edit', - 2 => 'Set', - 3 => 'Change Status' - ] - ], + // [ + // 'route' => route('admin.datagrid.delete'), + // 'method' => 'DELETE', + // 'label' => 'Delete', + // 'type' => 'button', + // ], + // [ + // 'route' => route('admin.datagrid.index'), + // 'method' => 'POST', + // 'label' => 'View Grid', + // 'type' => 'select', + // 'options' =>[ + // 1 => 'Edit', + // 2 => 'Set', + // 3 => 'Change Status' + // ] + // ], ], 'actions' => [ [ diff --git a/packages/Webkul/Admin/src/DataGrids/ExchangeRatesDataGrid.php b/packages/Webkul/Admin/src/DataGrids/ExchangeRatesDataGrid.php index aae8fa614..67ac589b2 100644 --- a/packages/Webkul/Admin/src/DataGrids/ExchangeRatesDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/ExchangeRatesDataGrid.php @@ -33,12 +33,12 @@ class ExchangeRatesDataGrid 'aliased' => true, //use this with false as default and true in case of joins 'massoperations' =>[ - [ - 'route' => route('admin.datagrid.delete'), - 'method' => 'DELETE', - 'label' => 'Delete', - 'type' => 'button', - ], + // [ + // 'route' => route('admin.datagrid.delete'), + // 'method' => 'DELETE', + // 'label' => 'Delete', + // 'type' => 'button', + // ], ], 'actions' => [ @@ -68,54 +68,47 @@ class ExchangeRatesDataGrid //use aliasing on secodary columns if join is performed 'columns' => [ - [ 'name' => 'cer.id', - 'alias' => 'exchID', + 'alias' => 'exchid', 'type' => 'number', 'label' => 'Rate ID', 'sortable' => true, - ], - [ + ], [ 'name' => 'curr.name', - 'alias' => 'currencyname', + 'alias' => 'exchcurrname', 'type' => 'string', 'label' => 'Currency Name', 'sortable' => true, - ], - [ + ], [ 'name' => 'cer.rate', - 'alias' => 'exchRate', + 'alias' => 'exchrate', 'type' => 'string', 'label' => 'Exchange Rate', ], ], //don't use aliasing in case of filters - 'filterable' => [ [ 'column' => 'cer.id', - 'alias' => 'exchId', + 'alias' => 'exchid', 'type' => 'number', 'label' => 'Rate ID', - ], - [ + ], [ 'column' => 'curr.name', - 'alias' => 'exchTargetCurrency', + 'alias' => 'exchcurrname', 'type' => 'string', - 'label' => 'Target Currency', - 'sortable' => true, + 'label' => 'Currency Name', ], ], //don't use aliasing in case of searchables - 'searchable' => [ [ - 'column' => 'target_currency', + 'column' => 'exchcurrname', 'type' => 'string', - 'label' => 'Target Currency', + 'label' => 'Currency Name', ], ], diff --git a/packages/Webkul/Admin/src/DataGrids/InventorySourcesDataGrid.php b/packages/Webkul/Admin/src/DataGrids/InventorySourcesDataGrid.php index 54dce8ae1..8dcf9bfe6 100644 --- a/packages/Webkul/Admin/src/DataGrids/InventorySourcesDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/InventorySourcesDataGrid.php @@ -31,12 +31,12 @@ class InventorySourcesDataGrid 'aliased' => false, //use this with false as default and true in case of joins 'massoperations' =>[ - [ - 'route' => route('admin.datagrid.delete'), - 'method' => 'DELETE', - 'label' => 'Delete', - 'type' => 'button', - ], + // [ + // 'route' => route('admin.datagrid.delete'), + // 'method' => 'DELETE', + // 'label' => 'Delete', + // 'type' => 'button', + // ], ], 'actions' => [ diff --git a/packages/Webkul/Admin/src/DataGrids/LocalesDataGrid.php b/packages/Webkul/Admin/src/DataGrids/LocalesDataGrid.php index d9f3d051c..c134a0f88 100644 --- a/packages/Webkul/Admin/src/DataGrids/LocalesDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/LocalesDataGrid.php @@ -32,12 +32,12 @@ class LocalesDataGrid 'aliased' => false, //use this with false as default and true in case of joins 'massoperations' =>[ - [ - 'route' => route('admin.datagrid.delete'), - 'method' => 'DELETE', - 'label' => 'Delete', - 'type' => 'button', - ], + // [ + // 'route' => route('admin.datagrid.delete'), + // 'method' => 'DELETE', + // 'label' => 'Delete', + // 'type' => 'button', + // ], ], 'actions' => [ diff --git a/packages/Webkul/Admin/src/DataGrids/OrderInvoicesDataGrid.php b/packages/Webkul/Admin/src/DataGrids/OrderInvoicesDataGrid.php index 92c735b4c..f98f24d6a 100644 --- a/packages/Webkul/Admin/src/DataGrids/OrderInvoicesDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/OrderInvoicesDataGrid.php @@ -31,21 +31,22 @@ class OrderInvoicesDataGrid 'aliased' => false, 'massoperations' =>[ - [ - 'route' => route('admin.datagrid.delete'), - 'method' => 'DELETE', - 'label' => 'Delete', - 'type' => 'button', - ], + // [ + // 'route' => route('admin.datagrid.delete'), + // 'method' => 'DELETE', + // 'label' => 'Delete', + // 'type' => 'button', + // ], ], 'actions' => [ + [ + 'type' => 'View', + 'route' => route('admin.datagrid.delete'), + 'confirm_text' => 'Do you really want to do this?', + 'icon' => 'icon pencil-lg-icon', + ], // [ - // 'type' => 'View', - // 'route' => route('admin.datagrid.delete'), - // 'confirm_text' => 'Do you really want to do this?', - // 'icon' => 'icon pencil-lg-icon', - // ], [ // 'type' => 'Delete', // 'route' => route('admin.datagrid.delete'), // 'confirm_text' => 'Do you really want to do this?', @@ -53,7 +54,15 @@ class OrderInvoicesDataGrid // ] ], - 'join' => [], + 'join' => [ + [ + 'join' => 'leftjoin', + 'table' => 'orders as ors', + 'primaryKey' => 'inv.order_id', + 'condition' => '=', + 'secondaryKey' => 'ors.id', + ] + ], //use aliasing on secodary columns if join is performed @@ -65,23 +74,29 @@ class OrderInvoicesDataGrid 'label' => 'ID', 'sortable' => true ], [ - 'name' => 'inv.state', - 'alias' => 'invstate', + 'name' => 'inv.order_id', + 'alias' => 'invorderid', 'type' => 'number', - 'label' => 'State', + 'label' => 'Order ID', 'sortable' => true ], [ - 'name' => 'inv.total_qty', - 'alias' => 'invtotalqty', - 'type' => 'number', - 'label' => 'Quantity', - 'sortable' => true + 'name' => 'inv.state', + 'alias' => 'invstate', + 'type' => 'string', + 'label' => 'State', + 'sortable' => false ], [ 'name' => 'inv.grand_total', 'alias' => 'invgrandtotal', 'type' => 'number', - 'label' => 'Grand Total', - 'sortable' => true + 'label' => 'Amount', + 'sortable' => false + ], [ + 'name' => 'inv.created_at', + 'alias' => 'invcreated_at', + 'type' => 'date', + 'label' => 'Invoice Date', + 'sortable' => false ] ], diff --git a/packages/Webkul/Admin/src/DataGrids/OrderShipmentsDataGrid.php b/packages/Webkul/Admin/src/DataGrids/OrderShipmentsDataGrid.php index bbd835aaa..1429b7407 100644 --- a/packages/Webkul/Admin/src/DataGrids/OrderShipmentsDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/OrderShipmentsDataGrid.php @@ -4,6 +4,7 @@ namespace Webkul\Admin\DataGrids; use Illuminate\View\View; use Webkul\Ui\DataGrid\Facades\DataGrid; +use DB; /** * OrderShipmentsDataGrid @@ -22,41 +23,42 @@ class OrderShipmentsDataGrid */ public function createOrderShipmentsDataGrid() { - return DataGrid::make([ 'name' => 'shipments', 'table' => 'shipments as ship', 'select' => 'ship.id', 'perpage' => 10, - 'aliased' => false, + 'aliased' => true, 'massoperations' =>[ - [ - 'route' => route('admin.datagrid.delete'), - 'method' => 'DELETE', - 'label' => 'Delete', - 'type' => 'button', - ], + // [ + // 'route' => route('admin.datagrid.delete'), + // 'method' => 'DELETE', + // 'label' => 'Delete', + // 'type' => 'button', + // ], ], 'actions' => [ - // [ - // 'type' => 'View', - // 'route' => route('admin.datagrid.delete'), - // 'confirm_text' => 'Do you really want to do this?', - // 'icon' => 'icon pencil-lg-icon', - // ], [ - // 'type' => 'Delete', - // 'route' => route('admin.datagrid.delete'), - // 'confirm_text' => 'Do you really want to do this?', - // 'icon' => 'icon trash-icon', - // ] + [ + 'type' => 'View', + 'route' => route('admin.datagrid.delete'), + 'confirm_text' => 'Do you really want to do this?', + 'icon' => 'icon pencil-lg-icon', + ], ], - 'join' => [], + 'join' => [ + [ + 'join' => 'leftjoin', + 'table' => 'orders as ors', + 'primaryKey' => 'ship.order_id', + 'condition' => '=', + 'secondaryKey' => 'ors.id', + ] + ], //use aliasing on secodary columns if join is performed - 'columns' => [ [ 'name' => 'ship.id', @@ -64,6 +66,33 @@ class OrderShipmentsDataGrid 'type' => 'number', 'label' => 'ID', 'sortable' => true + ], [ + 'name' => 'ship.order_id', + 'alias' => 'order_id', + 'type' => 'number', + 'label' => 'Order ID', + 'sortable' => true + ], [ + 'name' => 'ship.total_qty', + 'alias' => 'total_qty', + 'type' => 'number', + 'label' => 'Total Quantity', + 'sortable' => true + ], [ + 'name' => 'ors.customer_first_name', + 'alias' => 'order_customer_first_name', + 'type' => 'string', + 'label' => 'Customer Name', + 'sortable' => false, + // 'wrapper' => function($value) { + // return $value.$last_name; + // } + ], [ + 'name' => 'ors.created_at', + 'alias' => 'orscreated', + 'type' => 'date', + 'label' => 'Order Date', + 'sortable' => true ], [ 'name' => 'ship.status', 'alias' => 'shipstatus', @@ -81,8 +110,16 @@ class OrderShipmentsDataGrid return 'Closed'; else if($value == "pending") return 'Pending'; + else + return 'Un-Attended'; }, - ], + ], [ + 'name' => 'ship.created_at', + 'alias' => 'ship_date', + 'type' => 'string', + 'label' => 'Shipment Date', + 'sortable' => false + ] ], 'filterable' => [ diff --git a/packages/Webkul/Admin/src/DataGrids/ProductDataGrid.php b/packages/Webkul/Admin/src/DataGrids/ProductDataGrid.php index a9c5fa443..27df69211 100644 --- a/packages/Webkul/Admin/src/DataGrids/ProductDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/ProductDataGrid.php @@ -168,7 +168,6 @@ class ProductDataGrid 'nlike' => "not like", ], // 'css' => [] - ]); } diff --git a/packages/Webkul/Admin/src/DataGrids/ProductReviewDataGrid.php b/packages/Webkul/Admin/src/DataGrids/ProductReviewDataGrid.php index 9ba659de2..5b6c3ce87 100644 --- a/packages/Webkul/Admin/src/DataGrids/ProductReviewDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/ProductReviewDataGrid.php @@ -34,12 +34,12 @@ class ProductReviewDataGrid 'aliased' => true, //use this with false as default and true in case of joins 'massoperations' =>[ - [ - 'route' => route('admin.datagrid.delete'), - 'method' => 'DELETE', - 'label' => 'Delete', - 'type' => 'button', - ], + // [ + // 'route' => route('admin.datagrid.delete'), + // 'method' => 'DELETE', + // 'label' => 'Delete', + // 'type' => 'button', + // ], ], 'actions' => [ diff --git a/packages/Webkul/Admin/src/DataGrids/RolesDataGrid.php b/packages/Webkul/Admin/src/DataGrids/RolesDataGrid.php index 74cc41cac..0d36da193 100644 --- a/packages/Webkul/Admin/src/DataGrids/RolesDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/RolesDataGrid.php @@ -33,12 +33,12 @@ class RolesDataGrid 'aliased' => false, //use this with false as default and true in case of joins 'massoperations' =>[ - [ - 'route' => route('admin.datagrid.delete'), - 'method' => 'DELETE', - 'label' => 'Delete', - 'type' => 'button', - ], + // [ + // 'route' => route('admin.datagrid.delete'), + // 'method' => 'DELETE', + // 'label' => 'Delete', + // 'type' => 'button', + // ], ], 'actions' => [ diff --git a/packages/Webkul/Admin/src/DataGrids/SliderDataGrid.php b/packages/Webkul/Admin/src/DataGrids/SliderDataGrid.php index 766dbfff2..14287c7c9 100644 --- a/packages/Webkul/Admin/src/DataGrids/SliderDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/SliderDataGrid.php @@ -32,12 +32,12 @@ class SliderDataGrid 'aliased' => true, //use this with false as default and true in case of joins 'massoperations' =>[ - [ - 'route' => route('admin.datagrid.delete'), - 'method' => 'DELETE', - 'label' => 'Delete', - 'type' => 'button', - ], + // [ + // 'route' => route('admin.datagrid.delete'), + // 'method' => 'DELETE', + // 'label' => 'Delete', + // 'type' => 'button', + // ], ], 'actions' => [ diff --git a/packages/Webkul/Admin/src/DataGrids/TaxCategoryDataGrid.php b/packages/Webkul/Admin/src/DataGrids/TaxCategoryDataGrid.php index d4e589a54..d84f10bfe 100644 --- a/packages/Webkul/Admin/src/DataGrids/TaxCategoryDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/TaxCategoryDataGrid.php @@ -32,23 +32,23 @@ class TaxCategoryDataGrid 'aliased' => true, //use this with false as default and true in case of joins 'massoperations' =>[ - [ - 'route' => route('admin.datagrid.delete'), - 'method' => 'DELETE', - 'label' => 'Delete', - 'type' => 'button', - ], - [ - 'route' => route('admin.datagrid.index'), - 'method' => 'POST', - 'label' => 'View Grid', - 'type' => 'select', - 'options' =>[ - 1 => 'Edit', - 2 => 'Set', - 3 => 'Change Status' - ] - ], + // [ + // 'route' => route('admin.datagrid.delete'), + // 'method' => 'DELETE', + // 'label' => 'Delete', + // 'type' => 'button', + // ], + // [ + // 'route' => route('admin.datagrid.index'), + // 'method' => 'POST', + // 'label' => 'View Grid', + // 'type' => 'select', + // 'options' =>[ + // 1 => 'Edit', + // 2 => 'Set', + // 3 => 'Change Status' + // ] + // ], ], 'actions' => [ [ diff --git a/packages/Webkul/Admin/src/DataGrids/TaxRateDataGrid.php b/packages/Webkul/Admin/src/DataGrids/TaxRateDataGrid.php index f93464664..b94780144 100644 --- a/packages/Webkul/Admin/src/DataGrids/TaxRateDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/TaxRateDataGrid.php @@ -31,23 +31,23 @@ class TaxRateDataGrid 'aliased' => true, //use this with false as default and true in case of joins 'massoperations' =>[ - [ - 'route' => route('admin.datagrid.delete'), - 'method' => 'DELETE', - 'label' => 'Delete', - 'type' => 'button', - ], - [ - 'route' => route('admin.datagrid.index'), - 'method' => 'POST', - 'label' => 'View Grid', - 'type' => 'select', - 'options' =>[ - 1 => 'Edit', - 2 => 'Set', - 3 => 'Change Status' - ] - ], + // [ + // 'route' => route('admin.datagrid.delete'), + // 'method' => 'DELETE', + // 'label' => 'Delete', + // 'type' => 'button', + // ], + // [ + // 'route' => route('admin.datagrid.index'), + // 'method' => 'POST', + // 'label' => 'View Grid', + // 'type' => 'select', + // 'options' =>[ + // 1 => 'Edit', + // 2 => 'Set', + // 3 => 'Change Status' + // ] + // ], ], 'actions' => [ [ diff --git a/packages/Webkul/Admin/src/DataGrids/UserDataGrid.php b/packages/Webkul/Admin/src/DataGrids/UserDataGrid.php index ad35971d1..c1928ae3f 100644 --- a/packages/Webkul/Admin/src/DataGrids/UserDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/UserDataGrid.php @@ -32,25 +32,26 @@ class UserDataGrid 'perpage' => 10, 'aliased' => true, //use this with false as default and true in case of joins - 'massoperations' =>[ - [ - 'route' => route('admin.datagrid.delete'), - 'method' => 'DELETE', - 'label' => 'Delete', - 'type' => 'button', - ], - [ - 'route' => route('admin.datagrid.index'), - 'method' => 'POST', - 'label' => 'View Grid', - 'type' => 'select', - 'options' =>[ - 1 => 'Edit', - 2 => 'Set', - 3 => 'Change Status' - ] - ], + 'massoperations' => [ + // [ + // 'route' => route('admin.datagrid.delete'), + // 'method' => 'DELETE', + // 'label' => 'Delete', + // 'type' => 'button', + // ], + // [ + // 'route' => route('admin.datagrid.index'), + // 'method' => 'POST', + // 'label' => 'View Grid', + // 'type' => 'select', + // 'options' =>[ + // 1 => 'Edit', + // 2 => 'Set', + // 3 => 'Change Status' + // ] + // ], ], + 'actions' => [ [ 'type' => 'Edit', diff --git a/packages/Webkul/Admin/src/Listeners/Product.php b/packages/Webkul/Admin/src/Listeners/Product.php index e716e8c65..5968e76d9 100644 --- a/packages/Webkul/Admin/src/Listeners/Product.php +++ b/packages/Webkul/Admin/src/Listeners/Product.php @@ -4,10 +4,8 @@ namespace Webkul\Admin\Listeners; use Webkul\Product\Repositories\ProductRepository; use Webkul\Product\Repositories\ProductGridRepository; - use Webkul\Product\Helpers\Price; - /** * Products Event handler * @@ -15,7 +13,6 @@ use Webkul\Product\Helpers\Price; * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) */ class Product { - /** * Product Repository Object */ @@ -28,7 +25,6 @@ class Product { */ Protected $price; - /** * Product Grid Repository Object */ @@ -43,87 +39,19 @@ class Product { $this->price = $price; } - /** - * Prepare the data from the product created - * - * @return array $data - */ - public function prepareData($product) { - $gridObject = []; - $variantObjects = []; - - $gridObject = [ - 'product_id' => $product->id, - 'sku' => $product->sku, - 'type' => $product->type, - 'attribute_family_name' => $product->attribute_family->name, - ]; - - if($this->productGrid->findOneByField('product_id', $product->id)) { - $gridObject['name'] = $product->name; - $gridObject['status'] = $product->status; - - if($product->type == 'configurable') { - $gridObject['quantity'] = 0; - $gridObject['price'] = 0; - - $variants = $product->variants; - - if(count($variants)) { - foreach($variants as $variant) { - $variantObject = [ - 'product_id' => $variant->id, - 'sku' => $variant->sku, - 'type' => $variant->type, - 'attribute_family_name' => $variant->toArray()['attribute_family']['name'], - 'name' => $variant->name, - 'status' => $variant->status, - ]; - - $qty = 0; - //inventories and inventory sources relation for the variants return empty or null collection objects only - foreach($variant->inventories()->get() as $inventory_source) { - $qty = $qty + $inventory_source->qty; - } - - $variantObject['price'] = $variant->price; - $variantObject['quantity'] = $qty; - - array_push($variantObjects, $variantObject); - - $qty = 0; - } - } - } else { - $qty = 0; - - foreach($product->inventories()->get() as $inventory_source) { - $qty = $qty + $inventory_source->qty; - } - - $gridObject['price'] = $product->price; - $gridObject['quantity'] = $qty; - - $qty = 0; - } - } - return [ - 'parent' => $gridObject, - 'variants' => $variantObjects - ]; - } - /** * Creates a new entry in the product grid whenever a new product is created. * * @return boolean */ public function afterProductCreated($product) { - $data = $this->prepareData($product); + $result = $this->productCreated($product); - $result = $this->saveProduct($product, $data); - - return $result; + if($result) { + return true; + } else { + return false; + } } /** @@ -131,38 +59,41 @@ class Product { * * @return boolean */ - public function saveProduct($product, $data) { + public function productCreated($product) { + $gridObject = [ + 'product_id' => $product->id, + 'sku' => $product->sku, + 'type' => $product->type, + 'attribute_family_name' => 'default', + 'name' => $product->name, + 'quantity' => 0, + 'status' => $product->status, + 'price' => $product->price + ]; - $productGridObject = $this->productGrid->findOneByField('product_id', $product->id); - // dd($product, $data, $productGridObject); - if(!is_null($productGridObject)) { - if($product->type == 'simple') { - $r = $productGridObject->update($data['parent']); - } else { - $productGridObject->update($data['parent']); + $variants = []; - if(count($data['variants'])) { - foreach($data['variants'] as $variant) { - $variantObject = $this->productGrid->findOneByField('product_id', $variant['product_id']); + $this->productGrid->create($gridObject); - if(!is_null($variantObject)) { - $variantObject->update($variant); - } else { - $this->productGrid->create($variant); - } - } - } - } - } else { - $this->productGrid->create($data['parent']); + if($product->type == 'configurable') { + $variants = $product->variants()->get(); - //no need for these lines - if(count($data['variants'])) { - foreach($data['variants'] as $variant) { - $this->productGrid->create($variant); - } + foreach($variants as $variant) { + $variantObj = [ + 'product_id' => $variant->id, + 'sku' => $variant->sku, + 'type' => $variant->type, + 'attibute_family_name' => 'default', + 'name' => $variant->name, + 'quantity' => 0, + 'status' => $variant->status, + 'price' => $variant->price, + ]; + + $this->productGrid->create($variantObj); } } + return true; } @@ -171,7 +102,114 @@ class Product { * * @return boolean */ - public function beforeProductUpdate($productId) { + // public function beforeProductUpdate($productId) { + // return true; + // } + + /** + * Event handle for after.product.update + * + * @return boolean + */ + public function afterProductUpdate($product) { + $result = $this->productUpdated($product); + + return $result; + } + + /** + * This will be invoked from afterProductUpdate + * + * @return boolean + */ + public function productUpdated($product) { + $productGridObject = $this->productGrid->findOneByField('product_id', $product->id); + + if(!$productGridObject) { + return false; + } + + $gridObject = [ + 'product_id' => $product->id, + 'sku' => $product->sku, + 'type' => $product->type, + 'attribute_family_name' => 'default', + 'name' => $product->name, + 'status' => $product->status, + ]; + + if($product->type == 'configurable') { + $gridObject['quantity'] = 0; + $gridObject['price'] = 0; + } else { + $qty = 0; + //inventories and inventory sources relation for the variants return empty or null collection objects only + foreach($product->inventories()->get() as $inventory_source) { + $qty = $qty + $inventory_source->qty; + } + + $gridObject['quantity'] = $qty; + $gridObject['price'] = $product->price; + } + + $this->productGrid->update($gridObject, $productGridObject->id); + + if ($product->type == 'configurable') { + $variants = $product->variants()->get(); + + foreach($variants as $variant) { + $variantObj = [ + 'product_id' => $variant->id, + 'sku' => $variant->sku, + 'type' => $variant->type, + 'attibute_family_name' => 'name', + 'name' => $variant->name, + 'status' => $variant->status, + 'price' => $variant->price, + ]; + + $qty = 0; + + //inventories and inventory sources relation for the variants return empty or null collection objects only + foreach($variant->inventories()->get() as $inventory_source) { + $qty = $qty + $inventory_source->qty; + } + + $variantObj['quantity'] = $qty; + + $qty = 0; + + $productGridVariant = $this->productGrid->findOneByField('product_id', $variant->id); + + if(isset($productGridVariant)) { + $this->productGrid->update($variantObj, $productGridVariant->id); + } else { + $variantObj = [ + 'product_id' => $variant->id, + 'sku' => $variant->sku, + 'type' => $variant->type, + 'attibute_family_name' => 'default', + 'name' => $variant->name, + 'status' => $variant->status, + 'price' => $variant->price, + ]; + + $qty = 0; + + //inventories and inventory sources relation for the variants return empty or null collection objects only + foreach($variant->inventories()->get() as $inventory_source) { + $qty = $qty + $inventory_source->qty; + } + + $variantObj['quantity'] = $qty; + + $qty = 0; + + $this->productGrid->create($variantObj); + } + } + } + return true; } diff --git a/packages/Webkul/Admin/src/Resources/lang/en/app.php b/packages/Webkul/Admin/src/Resources/lang/en/app.php index 1ac25a510..b7dd75bc2 100644 --- a/packages/Webkul/Admin/src/Resources/lang/en/app.php +++ b/packages/Webkul/Admin/src/Resources/lang/en/app.php @@ -448,6 +448,57 @@ return [ 'delete-success' => 'Cannot Delete The Last Slider Item', 'delete-fail' => 'Slider Item Successfully Deleted' ], + + 'tax-categories' => [ + 'title' => 'Tax Categories', + 'add-title' => 'Create Tax Category', + 'edit-title' => 'Edit Tax Category', + 'save-btn-title' => 'Save Tax Category', + 'general' => 'Tax Category', + 'select-channel' => 'Select Channel', + 'name' => 'Name', + 'code' => 'Code', + 'description' => 'Description', + 'select-taxrates' => 'Select Tax Rates', + 'edit' => [ + 'title' => 'Edit Tax Category', + 'edit-button-title' => 'Edit Tax Category' + ], + 'create-success' => 'New Tax Category Created', + 'create-error' => 'Error, While Creating Tax Category', + 'update-success' => 'Successfully Updated Tax Category', + 'update-error' => 'Error While Updating Tax Category', + 'atleast-one' => 'Cannot Delete The Last Tax Category', + 'delete' => 'Tax Category Successfully Deleted' + ], + + 'tax-rates' => [ + 'title' => 'Tax Rates', + 'add-title' => 'Create Tax Rate', + 'edit-title' => 'Edit Tax Rate', + 'save-btn-title' => 'Create Tax Rate', + 'general' => 'Tax Rate', + 'identifier' => 'Identifier', + 'is_zip' => 'Enable Zip Range', + 'zip_from' => 'Zip From', + 'zip_to' => 'Zip To', + 'state' => 'State', + 'select-state' => 'Select a region, state or province.', + 'country' => 'Country', + 'tax_rate' => 'Rate', + 'edit' => [ + 'title' => 'Edit Tax Rate', + 'edit-button-title' => 'Edit Rate' + ], + 'zip_code' => 'Zip Code', + 'is_zip' => 'Enable Zip Range', + 'create-success' => 'Tax Rate Created Successfully', + 'create-error' => 'Cannot Create Tax Rate', + 'update-success' => 'Tax Rate Updated Successfully', + 'update-error' => 'Error! Tax Rate Cannot Be Updated', + 'delete' => 'Tax Rate Deleted Successfully', + 'atleast-one' => 'Cannot Delete Last Tax Rate' + ], ], 'customers' => [ diff --git a/packages/Webkul/Admin/src/Resources/views/tax/tax-categories/create.blade.php b/packages/Webkul/Admin/src/Resources/views/tax/tax-categories/create.blade.php index 79b421559..dcc6bc8d4 100644 --- a/packages/Webkul/Admin/src/Resources/views/tax/tax-categories/create.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/tax/tax-categories/create.blade.php @@ -1,7 +1,7 @@ @extends('admin::layouts.content') @section('page_title') - {{ __('admin::app.configuration.tax-categories.add-title') }} + {{ __('admin::app.settings.tax-categories.add-title') }} @stop @section('content') @@ -9,12 +9,12 @@
@@ -62,7 +62,7 @@ @{{ errors.first('description') }} -
+
- @{{ errors.first('taxrates') }} + @{{ errors.first('taxrates[]') }}
diff --git a/packages/Webkul/Admin/src/Resources/views/tax/tax-categories/edit.blade.php b/packages/Webkul/Admin/src/Resources/views/tax/tax-categories/edit.blade.php index a45d0c1a3..f5b0cd481 100644 --- a/packages/Webkul/Admin/src/Resources/views/tax/tax-categories/edit.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/tax/tax-categories/edit.blade.php @@ -1,7 +1,7 @@ @extends('admin::layouts.content') @section('page_title') - {{ __('admin::app.configuration.tax-categories.title') }} + {{ __('admin::app.settings.tax-categories.title') }} @stop @section('content') @@ -9,12 +9,12 @@ @@ -23,72 +23,49 @@
@csrf() @method('PUT') - -
+
+ -
- + - @foreach(core()->getAllChannels() as $channelModel) + - + @endforeach + - @endforeach - + @{{ errors.first('channel') }} +
- @{{ errors.first('channel') }} -
+
+ -
- + - +
+ + - @{{ errors.first('code') }} -
+
+ + -
- +
+ - - - @{{ errors.first('name') }} -
- -
- - - - - @{{ errors.first('description') }} -
- -
- - - @inject('taxRates', 'Webkul\Tax\Repositories\TaxRateRepository') - - - - @{{ errors.first('taxrates[]') }} -
- -
- + @inject('taxRates', 'Webkul\Tax\Repositories\TaxRateRepository') + + @{{ errors.first('taxrates[]') }} +
diff --git a/packages/Webkul/Admin/src/Resources/views/tax/tax-categories/index.blade.php b/packages/Webkul/Admin/src/Resources/views/tax/tax-categories/index.blade.php index d482a2238..8695309da 100644 --- a/packages/Webkul/Admin/src/Resources/views/tax/tax-categories/index.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/tax/tax-categories/index.blade.php @@ -1,19 +1,19 @@ @extends('admin::layouts.content') @section('page_title') - {{ __('admin::app.configuration.tax-categories.title') }} + {{ __('admin::app.settings.tax-categories.title') }} @stop @section('content')
diff --git a/packages/Webkul/Admin/src/Resources/views/tax/tax-rates/create.blade.php b/packages/Webkul/Admin/src/Resources/views/tax/tax-rates/create.blade.php index 93dbea6c0..ca6f986d8 100644 --- a/packages/Webkul/Admin/src/Resources/views/tax/tax-rates/create.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/tax/tax-rates/create.blade.php @@ -1,7 +1,7 @@ @extends('admin::layouts.content') @section('page_title') - {{ __('admin::app.configuration.tax-rates.add-title') }} + {{ __('admin::app.settings.tax-rates.add-title') }} @stop @section('content') @@ -9,12 +9,12 @@
@@ -47,7 +47,7 @@ - {{ __('admin::app.configuration.tax-rates.is_zip') }} + {{ __('admin::app.settings.tax-rates.is_zip') }}
diff --git a/packages/Webkul/Admin/src/Resources/views/tax/tax-rates/edit.blade.php b/packages/Webkul/Admin/src/Resources/views/tax/tax-rates/edit.blade.php index 5e773e13e..796e55731 100644 --- a/packages/Webkul/Admin/src/Resources/views/tax/tax-rates/edit.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/tax/tax-rates/edit.blade.php @@ -1,7 +1,7 @@ @extends('admin::layouts.content') @section('page_title') - {{ __('admin::app.configuration.tax-rates.edit-title') }} + {{ __('admin::app.settings.tax-rates.edit-title') }} @stop @section('content') @@ -9,12 +9,12 @@ @@ -22,7 +22,7 @@
@method('PUT') - + @csrf()
diff --git a/packages/Webkul/Admin/src/Resources/views/tax/tax-rates/index.blade.php b/packages/Webkul/Admin/src/Resources/views/tax/tax-rates/index.blade.php index 413037f46..83bf5d43a 100644 --- a/packages/Webkul/Admin/src/Resources/views/tax/tax-rates/index.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/tax/tax-rates/index.blade.php @@ -1,19 +1,19 @@ @extends('admin::layouts.content') @section('page_title') - {{ __('admin::app.configuration.tax-rates.title') }} + {{ __('admin::app.settings.tax-rates.title') }} @stop @section('content')
diff --git a/packages/Webkul/Admin/src/Resources/views/users/users/edit.blade.php b/packages/Webkul/Admin/src/Resources/views/users/users/edit.blade.php index b79c07e2c..f4d64caa9 100644 --- a/packages/Webkul/Admin/src/Resources/views/users/users/edit.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/users/users/edit.blade.php @@ -4,7 +4,6 @@ {{ __('admin::app.users.users.edit-user-title') }} @stop - @section('content')
diff --git a/packages/Webkul/Checkout/src/Cart.php b/packages/Webkul/Checkout/src/Cart.php index b3237f3d4..ec723c65d 100644 --- a/packages/Webkul/Checkout/src/Cart.php +++ b/packages/Webkul/Checkout/src/Cart.php @@ -325,7 +325,9 @@ class Cart { /** * Update the cartItem on cart checkout page and if already added item is added again - * + * @param $id product_id of cartItem instance + * @param $data new requested quantities by customer + * @param $itemId is id from cartItem instance * @return boolean */ public function updateItem($id, $data, $itemId) @@ -371,7 +373,6 @@ class Cart { return false; } - } /** @@ -388,7 +389,10 @@ class Cart { if($cart->items()->get()->count() == 0) { $this->cart->delete($cart->id); - $this->deActivateCart(); + // $this->deActivateCart(); + if(session()->has('cart')) { + session()->forget('cart'); + } } session()->flash('success', trans('shop::app.checkout.cart.item.success-remove')); diff --git a/packages/Webkul/Checkout/src/Database/Migrations/2018_11_21_144411_create_cart_item_inventories_table.php b/packages/Webkul/Checkout/src/Database/Migrations/2018_11_21_144411_create_cart_item_inventories_table.php index f1f9418d9..fd74ea4f6 100644 --- a/packages/Webkul/Checkout/src/Database/Migrations/2018_11_21_144411_create_cart_item_inventories_table.php +++ b/packages/Webkul/Checkout/src/Database/Migrations/2018_11_21_144411_create_cart_item_inventories_table.php @@ -15,7 +15,7 @@ class CreateCartItemInventoriesTable extends Migration { Schema::create('cart_item_inventories', function (Blueprint $table) { $table->increments('id'); - $table->integer('qty')->default(0); + $table->integer('qty')->unsigned()->default(0); $table->integer('inventory_source_id')->unsigned()->nullable(); $table->integer('cart_item_id')->unsigned()->nullable(); $table->timestamps(); diff --git a/packages/Webkul/Checkout/src/Models/Cart.php b/packages/Webkul/Checkout/src/Models/Cart.php index dcd18493b..201e5b2d2 100644 --- a/packages/Webkul/Checkout/src/Models/Cart.php +++ b/packages/Webkul/Checkout/src/Models/Cart.php @@ -19,10 +19,16 @@ class Cart extends Model protected $with = ['items', 'items.child', 'shipping_address', 'billing_address', 'selected_shipping_rate', 'payment']; + /** + * To get relevant associated items with the cart instance + */ public function items() { return $this->hasMany(CartItem::class)->whereNull('parent_id'); } + /** + * To get all the associated items with the cart instance even the parent and child items of configurable products + */ public function all_items() { return $this->hasMany(CartItem::class); } diff --git a/packages/Webkul/Core/src/Database/Migrations/2018_11_27_174449_change_content_column_in_sliders_table.php b/packages/Webkul/Core/src/Database/Migrations/2018_11_27_174449_change_content_column_in_sliders_table.php new file mode 100644 index 000000000..785d202a5 --- /dev/null +++ b/packages/Webkul/Core/src/Database/Migrations/2018_11_27_174449_change_content_column_in_sliders_table.php @@ -0,0 +1,32 @@ +text('content')->nullable()->change(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('sliders', function (Blueprint $table) { + $table->string('content')->change(); + }); + } +} diff --git a/packages/Webkul/Customer/src/Database/migrations/2018_11_17_165758_add_is_verified_column_in_customers_table.php b/packages/Webkul/Customer/src/Database/migrations/2018_11_17_165758_add_is_verified_column_in_customers_table.php new file mode 100644 index 000000000..2f764e150 --- /dev/null +++ b/packages/Webkul/Customer/src/Database/migrations/2018_11_17_165758_add_is_verified_column_in_customers_table.php @@ -0,0 +1,36 @@ +boolean('is_verified')->default(0)->after('subscribed_to_news_letter'); + $table->string('token')->nullable()->after('is_verified'); + $table->dropColumn('gender'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('customers', function (Blueprint $table) { + $table->dropColumn('is_verified'); + $table->dropColumn('token'); + $table->enum('gender', ['Male', 'Female'])->after('last_name'); + }); + } +} \ No newline at end of file diff --git a/packages/Webkul/Customer/src/Database/migrations/2018_11_26_110500_change_gender_column_in_customers_table.php b/packages/Webkul/Customer/src/Database/migrations/2018_11_26_110500_change_gender_column_in_customers_table.php new file mode 100644 index 000000000..013ef50e4 --- /dev/null +++ b/packages/Webkul/Customer/src/Database/migrations/2018_11_26_110500_change_gender_column_in_customers_table.php @@ -0,0 +1,32 @@ +string('gender')->length(50)->nullable()->after('last_name'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('customers', function (Blueprint $table) { + $table->dropColumn('gender'); + }); + } +} diff --git a/packages/Webkul/Customer/src/Http/Controllers/AddressController.php b/packages/Webkul/Customer/src/Http/Controllers/AddressController.php index 35a5c1ec4..ef292e343 100644 --- a/packages/Webkul/Customer/src/Http/Controllers/AddressController.php +++ b/packages/Webkul/Customer/src/Http/Controllers/AddressController.php @@ -73,6 +73,7 @@ class AddressController extends Controller $this->validate(request(), [ 'address1' => 'string|required', + 'address2' => 'string', 'country' => 'string|required', 'state' => 'string|required', 'city' => 'string|required', diff --git a/packages/Webkul/Customer/src/Http/Controllers/CustomerController.php b/packages/Webkul/Customer/src/Http/Controllers/CustomerController.php index 1d6c172f2..8d0e9ab3b 100644 --- a/packages/Webkul/Customer/src/Http/Controllers/CustomerController.php +++ b/packages/Webkul/Customer/src/Http/Controllers/CustomerController.php @@ -8,6 +8,7 @@ use Webkul\Customer\Repositories\CustomerRepository; use Webkul\Product\Repositories\ProductReviewRepository as ProductReview; use Webkul\Customer\Models\Customer; use Auth; +use Hash; /** * Customer controlller for the customer basically for the tasks of customers which will be done after customer authentication. @@ -94,41 +95,57 @@ class CustomerController extends Controller $id = auth()->guard('customer')->user()->id; $this->validate(request(), [ - 'first_name' => 'string', 'last_name' => 'string', 'gender' => 'required', 'date_of_birth' => 'date', 'email' => 'email|unique:customers,email,'.$id, 'password' => 'confirmed|required_if:oldpassword,!=,null' - ]); $data = collect(request()->input())->except('_token')->toArray(); + if($data['date_of_birth'] == "") { + unset($data['date_of_birth']); + } + if($data['oldpassword'] == null) { $data = collect(request()->input())->except(['_token','password','password_confirmation','oldpassword'])->toArray(); - + + if($data['date_of_birth'] == "") { + unset($data['date_of_birth']); + } + if($this->customer->update($data, $id)) { - Session()->flash('success','Profile Updated Successfully'); + Session()->flash('success', trans('shop::app.customer.account.profile.edit-success')); return redirect()->back(); } else { - Session()->flash('success','Profile Updated Successfully'); + Session()->flash('success', trans('shop::app.customer.account.profile.edit-fail')); return redirect()->back(); } } else { - $data = collect(request()->input())->except(['_token','oldpassword'])->toArray(); + if(Hash::check($data['oldpassword'], auth()->guard('customer')->user()->password)) { + $data = collect(request()->input())->except(['_token','oldpassword'])->toArray(); - $data['password'] = bcrypt($data['password']); + $data['password'] = bcrypt($data['password']); + + if($data['date_of_birth'] == "") { + unset($data['date_of_birth']); + } + } else { + session()->flash('warning', trans('shop::app.customer.account.profile.unmatch')); + + return redirect()->back(); + } if($this->customer->update($data, $id)) { - Session()->flash('success','Profile Updated Successfully'); + Session()->flash('success', trans('shop::app.customer.account.profile.edit-success')); return redirect()->back(); } else { - Session()->flash('success','Profile Updated Successfully'); + Session()->flash('success', trans('shop::app.customer.account.profile.edit-fail')); return redirect()->back(); } diff --git a/packages/Webkul/Customer/src/Http/Controllers/RegistrationController.php b/packages/Webkul/Customer/src/Http/Controllers/RegistrationController.php index f7770af29..85a0f0ada 100644 --- a/packages/Webkul/Customer/src/Http/Controllers/RegistrationController.php +++ b/packages/Webkul/Customer/src/Http/Controllers/RegistrationController.php @@ -4,8 +4,11 @@ namespace Webkul\Customer\Http\Controllers; use Illuminate\Http\Request; use Illuminate\Http\Response; +use Illuminate\Support\Facades\Mail; +use Webkul\Customer\Mail\VerificationEmail; use Illuminate\Routing\Controller; use Webkul\Customer\Repositories\CustomerRepository; +use Cookie; /** * Registration controller @@ -23,9 +26,10 @@ class RegistrationController extends Controller protected $_config; protected $customer; - - public function __construct(CustomerRepository $customer) - { + /** + * @param CustomerRepository object $customer + */ + public function __construct(CustomerRepository $customer) { $this->_config = request('_config'); $this->customer = $customer; } @@ -35,8 +39,7 @@ class RegistrationController extends Controller * * @return view */ - public function show() - { + public function show() { return view($this->_config['view']); } @@ -45,8 +48,7 @@ class RegistrationController extends Controller * * @return Mixed */ - public function create(Request $request) - { + public function create(Request $request) { $request->validate([ 'first_name' => 'string|required', 'last_name' => 'string|required', @@ -61,18 +63,76 @@ class RegistrationController extends Controller $data['channel_id'] = core()->getCurrentChannel()->id; - if ($this->customer->create($data)) { + $data['is_verified'] = 0; - session()->flash('success', 'Account Created Successfully'); + $verificationData['email'] = $data['email']; + $verificationData['token'] = md5(uniqid(rand(), true)); + $data['token'] = $verificationData['token']; + $created = $this->customer->create($data); - return redirect()->back(); + if ($created) { + try { + session()->flash('success', trans('shop::app.customer.signup-form.success')); - // return redirect()->route($this->_config['redirect'])->with('message', 'Account Created Successfully, Try To Log In'); + Mail::send(new VerificationEmail($verificationData)); + } catch(\Exception $e) { + session()->flash('info', trans('shop::app.customer.signup-form.success-verify-email-not-sent')); + return redirect()->route($this->_config['redirect']); + } + + + return redirect()->route($this->_config['redirect']); } else { - session()->flash('error', 'Cannot Create Your Account'); + session()->flash('error', trans('shop::app.customer.signup-form.failed')); return redirect()->back(); } } -} + + /** + * Method to verify account + * + */ + public function verifyAccount($token) { + $customer = $this->customer->findOneByField('token', $token); + + if($customer) { + $customer->update(['is_verified' => 1, 'token' => 'NULL']); + + session()->flash('success', trans('shop::app.customer.signup-form.verified')); + } else { + session()->flash('warning', trans('shop::app.customer.signup-form.verify-failed')); + } + + return redirect()->route('customer.session.index'); + } + + public function resendVerificationEmail($email) { + $verificationData['email'] = $email; + $verificationData['token'] = md5(uniqid(rand(), true)); + + $customer = $this->customer->findOneByField('email', $email); + + $this->customer->update(['token' => $verificationData['token']], $customer->id); + + try { + Mail::send(new VerificationEmail($verificationData)); + + if(Cookie::has('enable-resend')) { + \Cookie::queue(\Cookie::forget('enable-resend')); + } + + if(Cookie::has('email-for-resend')) { + \Cookie::queue(\Cookie::forget('email-for-resend')); + } + } catch(\Exception $e) { + session()->flash('success', trans('shop::app.customer.signup-form.verification-not-sent')); + + return redirect()->back(); + } + session()->flash('success', trans('shop::app.customer.signup-form.verification-sent')); + + return redirect()->back(); + } +} \ No newline at end of file diff --git a/packages/Webkul/Customer/src/Http/Controllers/ResetPasswordController.php b/packages/Webkul/Customer/src/Http/Controllers/ResetPasswordController.php index 744219235..b2a759593 100644 --- a/packages/Webkul/Customer/src/Http/Controllers/ResetPasswordController.php +++ b/packages/Webkul/Customer/src/Http/Controllers/ResetPasswordController.php @@ -62,7 +62,6 @@ class ResetPasswordController extends Controller */ public function store() { - //dd(request()->input()); $this->validate(request(), [ 'token' => 'required', 'email' => 'required|email', @@ -74,7 +73,7 @@ class ResetPasswordController extends Controller $this->resetPassword($customer, $password); } ); - // dd($response); + if($response == Password::PASSWORD_RESET) { return redirect()->route($this->_config['redirect']); } diff --git a/packages/Webkul/Customer/src/Http/Controllers/SessionController.php b/packages/Webkul/Customer/src/Http/Controllers/SessionController.php index faddfd706..9a873853b 100644 --- a/packages/Webkul/Customer/src/Http/Controllers/SessionController.php +++ b/packages/Webkul/Customer/src/Http/Controllers/SessionController.php @@ -8,6 +8,7 @@ use Illuminate\Support\Facades\Event; use Webkul\Customer\Models\Customer; use Webkul\Customer\Http\Listeners\CustomerEventsHandler; use Cart; +use Cookie; /** * Session controller for the user customer @@ -38,7 +39,7 @@ class SessionController extends Controller public function show() { if(auth()->guard('customer')->check()) { - return redirect()->route('customer.account.index'); + return redirect()->route('customer.session.index'); } else { return view($this->_config['view']); } @@ -52,8 +53,21 @@ class SessionController extends Controller ]); if (!auth()->guard('customer')->attempt(request(['email', 'password']))) { - session()->flash('error', 'Please check your credentials and try again.'); - return back(); + session()->flash('error', trans('shop::app.customer.login-form.invalid-creds')); + + return redirect()->back(); + } + + if(auth()->guard('customer')->user()->is_verified == 0) { + session()->flash('info', trans('shop::app.customer.login-form.verify-first')); + + Cookie::queue(Cookie::make('enable-resend', 'true', 1)); + + Cookie::queue(Cookie::make('email-for-resend', $request->input('email'), 1)); + + auth()->guard('customer')->logout(); + + return redirect()->back(); } //Event passed to prepare cart after login diff --git a/packages/Webkul/Customer/src/Http/Controllers/WishlistController.php b/packages/Webkul/Customer/src/Http/Controllers/WishlistController.php index 25e8a3d95..384ccd0f5 100644 --- a/packages/Webkul/Customer/src/Http/Controllers/WishlistController.php +++ b/packages/Webkul/Customer/src/Http/Controllers/WishlistController.php @@ -55,7 +55,7 @@ class WishlistController extends Controller 'channel_id' => core()->getCurrentChannel()->id, 'customer_id' => auth()->guard('customer')->user()->id] ); - // dd($wishlistItems->count()); + return view($this->_config['view'])->with('items', $wishlistItems); } @@ -75,6 +75,12 @@ class WishlistController extends Controller $checked = $this->wishlist->findWhere(['channel_id' => core()->getCurrentChannel()->id, 'product_id' => $itemId, 'customer_id' => auth()->guard('customer')->user()->id]); + //accidental case if some one adds id of the product in the anchor tag amd gives id of a variant. + if($product->parent_id != null) { + $product = $this->product->findOneByField('id', $product->parent_id); + $data['product_id'] = $product->parent_id; + } + if($checked->isEmpty()) { if($this->wishlist->create($data)) { session()->flash('success', trans('customer::app.wishlist.success')); @@ -143,7 +149,7 @@ class WishlistController extends Controller return redirect()->back(); } - session()->flash('warning', trans('shop::app.checkout.cart.add-config-warning')); + session()->flash('info', trans('shop::app.checkout.cart.add-config-warning')); return redirect()->route('shop.products.index', $wishlistItem->product->url_key); } diff --git a/packages/Webkul/Customer/src/Mail/VerificationEmail.php b/packages/Webkul/Customer/src/Mail/VerificationEmail.php new file mode 100644 index 000000000..ef874a335 --- /dev/null +++ b/packages/Webkul/Customer/src/Mail/VerificationEmail.php @@ -0,0 +1,37 @@ + + * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) + */ +class VerificationEmail extends Mailable +{ + use Queueable, SerializesModels; + + public $verificationData; + + public function __construct($verificationData) { + $this->verificationData = $verificationData; + } + + /** + * Build the message. + * + * @return $this + */ + public function build() + { + return $this->to($this->verificationData['email']) + ->subject('Verification email') + ->view('shop::emails.customer.verification-email')->with('data', ['email' => $this->verificationData['email'], 'token' => $this->verificationData['token']]); + } +} \ No newline at end of file diff --git a/packages/Webkul/Customer/src/Models/Customer.php b/packages/Webkul/Customer/src/Models/Customer.php index 80e339739..2790409ee 100644 --- a/packages/Webkul/Customer/src/Models/Customer.php +++ b/packages/Webkul/Customer/src/Models/Customer.php @@ -16,7 +16,7 @@ class Customer extends Authenticatable protected $table = 'customers'; - protected $fillable = ['first_name', 'channel_id', 'last_name', 'gender', 'date_of_birth', 'email', 'password', 'customer_group_id', 'subscribed_to_news_letter']; + protected $fillable = ['first_name', 'channel_id', 'last_name', 'gender', 'date_of_birth', 'email', 'password', 'customer_group_id', 'subscribed_to_news_letter', 'is_verified', 'token']; protected $hidden = ['password', 'remember_token']; diff --git a/packages/Webkul/Product/src/Database/Migrations/2018_11_27_113535_remove_cost_column_from_datagrid.php b/packages/Webkul/Product/src/Database/Migrations/2018_11_27_113535_remove_cost_column_from_datagrid.php new file mode 100644 index 000000000..53d287c51 --- /dev/null +++ b/packages/Webkul/Product/src/Database/Migrations/2018_11_27_113535_remove_cost_column_from_datagrid.php @@ -0,0 +1,36 @@ +dropColumn('cost'); + }); + } + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + if (Schema::hasTable('product_grid')) { + Schema::table('products_grid', function (Blueprint $table) { + $table->string('cost'); + }); + } + } +} diff --git a/packages/Webkul/Product/src/Http/Controllers/ProductController.php b/packages/Webkul/Product/src/Http/Controllers/ProductController.php index 437568991..af08a8716 100644 --- a/packages/Webkul/Product/src/Http/Controllers/ProductController.php +++ b/packages/Webkul/Product/src/Http/Controllers/ProductController.php @@ -185,7 +185,7 @@ class ProductController extends Controller $product = $this->product->update(request()->all(), $id); //after update of product - Event::fire('product.save.after', $product); + Event::fire('product.update.after', $product); session()->flash('success', 'Product updated successfully.'); @@ -212,6 +212,9 @@ class ProductController extends Controller return redirect()->back(); } + /* + * To be manually invoked when data is seeded into products + */ public function sync() { Event::fire('products.datagrid.create', true); } diff --git a/packages/Webkul/Shop/src/Http/Controllers/SubscriptionController.php b/packages/Webkul/Shop/src/Http/Controllers/SubscriptionController.php index 129d4c86a..122fd3cf1 100644 --- a/packages/Webkul/Shop/src/Http/Controllers/SubscriptionController.php +++ b/packages/Webkul/Shop/src/Http/Controllers/SubscriptionController.php @@ -19,7 +19,6 @@ use Webkul\Core\Repositories\SubscribersListRepository as Subscription; */ class SubscriptionController extends Controller { - /** * User object * @@ -48,17 +47,13 @@ class SubscriptionController extends Controller */ public function __construct(Customer $customer, Subscription $subscription) { - $this->user = auth()->guard('customer')->user(); - - $this->customer = $customer; - $this->subscription = $subscription; $this->_config = request('_config'); } /** - * Subscribes Customers and Guests to subscription mailing list and checks if already subscribed + * Subscribes email to the email subscription list */ public function subscribe() { @@ -70,44 +65,27 @@ class SubscriptionController extends Controller $unique = 0; - if(auth()->guard('customer')->check()) { - $unique = function() use($email) { - $count = $this->customer->findWhere(['email' => $email]); + $alreadySubscribed = $this->subscription->findWhere(['email' => $email]); - if($count->count() > 0 && $count->first()->subscribed_to_news_letter == 1) { - return 0; - } else { - return 1; - } - }; - } else { - $alreadySubscribed = $this->subscription->findWhere(['email' => $email]); - - $unique = function() use($alreadySubscribed){ - if($alreadySubscribed->count() > 0) { - return 0; - } else { - return 1; - } - }; - } + $unique = function() use($alreadySubscribed){ + if($alreadySubscribed->count() > 0 ) { + return 0; + } else { + return 1; + } + }; if($unique()) { $token = uniqid(); + $result = false; - if(!auth()->guard('customer')->check()) { - $result = $this->subscription->create([ - 'email' => $email, - 'channel_id' => core()->getCurrentChannel()->id, - 'is_subscribed' => 1, - 'token' => $token - ]); - } else { - $user = auth()->guard('customer')->user(); - - $result = $user->update(['subscribed_to_news_letter' => 1]); - } + $result = $this->subscription->create([ + 'email' => $email, + 'channel_id' => core()->getCurrentChannel()->id, + 'is_subscribed' => 1, + 'token' => $token + ]); if(!$result) { session()->flash('error', trans('shop::app.subscription.not-subscribed')); @@ -121,12 +99,8 @@ class SubscriptionController extends Controller Mail::send(new SubscriptionEmail($subscriptionData)); session()->flash('success', trans('shop::app.subscription.subscribed')); - - return redirect()->back(); } else { session()->flash('error', trans('shop::app.subscription.already')); - - return redirect()->back(); } return redirect()->back(); @@ -138,6 +112,14 @@ class SubscriptionController extends Controller * @var string $token */ public function unsubscribe($token) { - dd('unsubscribing'); + $subscriber = $this->subscription->findOneByField('token', $token); + + if($subscriber->count() > 0 && $subscriber->is_subscribed == 1 &&$subscriber->update(['is_subscribed' => 0])) { + session()->flash('info', trans('shop::app.subscription.unsubscribed')); + } else { + session()->flash('info', trans('shop::app.subscription.already-unsub')); + } + + return redirect()->route('shop.home.index'); } -} +} \ No newline at end of file diff --git a/packages/Webkul/Shop/src/Http/routes.php b/packages/Webkul/Shop/src/Http/routes.php index da31b580b..7ba04e971 100644 --- a/packages/Webkul/Shop/src/Http/routes.php +++ b/packages/Webkul/Shop/src/Http/routes.php @@ -12,7 +12,7 @@ Route::group(['middleware' => ['web', 'theme', 'locale', 'currency']], function Route::get('/subscribe', 'Webkul\Shop\Http\Controllers\SubscriptionController@subscribe')->name('shop.subscribe'); //unsubscribe - Route::get('/unsubscribe', 'Webkul\Shop\Http\Controllers\SubscriptionController@unSubscribe')->name('shop.unsubscribe'); + Route::get('/unsubscribe/{token}', 'Webkul\Shop\Http\Controllers\SubscriptionController@unsubscribe')->name('shop.unsubscribe'); //Store front header nav-menu fetch Route::get('/categories/{slug}', 'Webkul\Shop\Http\Controllers\CategoryController@index')->defaults('_config', [ @@ -125,7 +125,7 @@ Route::group(['middleware' => ['web', 'theme', 'locale', 'currency']], function // Reset Password Form Store Route::post('/reset-password', 'Webkul\Customer\Http\Controllers\ResetPasswordController@store')->defaults('_config', [ - 'redirect' => 'customer.session.index' + 'redirect' => 'customer.profile.index' ])->name('customer.reset-password.store'); // Login Routes @@ -150,6 +150,12 @@ Route::group(['middleware' => ['web', 'theme', 'locale', 'currency']], function 'redirect' => 'customer.session.index', ])->name('customer.register.create'); + //verify account + Route::get('/verify-account/{token}', 'Webkul\Customer\Http\Controllers\RegistrationController@verifyAccount')->name('customer.verify'); + + //resend verification email + Route::get('/resend/verification/{email}', 'Webkul\Customer\Http\Controllers\RegistrationController@resendVerificationEmail')->name('customer.resend.verification-email'); + // Auth Routes Route::group(['middleware' => ['customer']], function () { diff --git a/packages/Webkul/Shop/src/Mail/SubscriptionEmail.php b/packages/Webkul/Shop/src/Mail/SubscriptionEmail.php index 31f306135..295b2883d 100644 --- a/packages/Webkul/Shop/src/Mail/SubscriptionEmail.php +++ b/packages/Webkul/Shop/src/Mail/SubscriptionEmail.php @@ -6,7 +6,6 @@ use Illuminate\Bus\Queueable; use Illuminate\Mail\Mailable; use Illuminate\Queue\SerializesModels; use Illuminate\Contracts\Queue\ShouldQueue; - /** * Subscriber Mail class * @@ -16,13 +15,10 @@ use Illuminate\Contracts\Queue\ShouldQueue; class SubscriptionEmail extends Mailable { use Queueable, SerializesModels; - public $subscriptionData; - public function __construct($subscriptionData) { $this->subscriptionData = $subscriptionData; } - /** * Build the message. * @@ -34,4 +30,4 @@ class SubscriptionEmail extends Mailable ->subject('subscription email') ->view('shop::emails.customer.subscription-email')->with('data', ['content' => 'You Are Subscribed', 'token' => $this->subscriptionData['token']]); } -} +} \ No newline at end of file diff --git a/packages/Webkul/Shop/src/Resources/assets/sass/app.scss b/packages/Webkul/Shop/src/Resources/assets/sass/app.scss index e0e662b24..ef3d50f3d 100644 --- a/packages/Webkul/Shop/src/Resources/assets/sass/app.scss +++ b/packages/Webkul/Shop/src/Resources/assets/sass/app.scss @@ -198,6 +198,15 @@ input { } } +/* Verify Email */ +.verify-account { + width: 100%; + height: 30px; + background-color: $border-color; + line-height: 30px; + text-align: center; +} + /* Show the indicator (dot/circle) when checked */ .radio-container input:checked ~ .checkmark:after { display: block; @@ -918,7 +927,7 @@ section.slider-block { } .dropdown-content .item-details{ - height: 75px; + max-height: 125px; } .item-details .item-name { @@ -927,6 +936,12 @@ section.slider-block { margin-bottom: 8px; } + .item-details .item-options { + font-size: 16px; + font-weight: bold; + margin-bottom: 8px; + } + .item-details .item-price { margin-bottom: 8px; } @@ -1643,6 +1658,7 @@ section.product-detail { width: 100%; max-height: 480px; height: 100%; + box-shadow: 1px 1px 2px $border-color; img { width: 100%; @@ -1680,11 +1696,12 @@ section.product-detail { display: none; flex-direction: row; margin-top: 10px; + width: 79.5%; + float: right; justify-content: space-between; .addtocart { - border-radius: 0px; width: 49%; background: black; white-space: nowrap; @@ -1692,9 +1709,7 @@ section.product-detail { } .buynow { - border-radius: 0px; width: 49%; - float:right; white-space: nowrap; text-transform: uppercase; } diff --git a/packages/Webkul/Shop/src/Resources/lang/en/app.php b/packages/Webkul/Shop/src/Resources/lang/en/app.php index 478e4ed9e..ad2bede1f 100644 --- a/packages/Webkul/Shop/src/Resources/lang/en/app.php +++ b/packages/Webkul/Shop/src/Resources/lang/en/app.php @@ -8,7 +8,9 @@ return [ 'home' => [ 'page-title' => 'Bagisto - Home', 'featured-products' => 'Featured Products', - 'new-products' => 'New Products' + 'new-products' => 'New Products', + 'verify-email' => 'Verify Your Email Account', + 'resend-verify-email' => 'Resend Verification Email' ], 'header' => [ @@ -35,7 +37,9 @@ return [ 'subscribe' => 'Subscribe', 'subscribed' => 'You Are Now Subscribed To Subscription Emails', 'not-subscribed' => 'You Cannot Be Subscribed To Subscription Emails, Try Again After Some time', - 'already' => 'You Are Already Subscribed To Our Subscription List' + 'already' => 'You Are Already Subscribed To Our Subscription List', + 'unsubscribed' => 'You Are Unsubscribed From Bagisto Subscription Mails', + 'already-unsub' => 'You Are Already Unsubscribed' ], 'search' => [ @@ -73,7 +77,17 @@ return [ 'agree' => 'Agree', 'terms' => 'Terms', 'conditions' => 'Conditions', - 'using' => 'by using this website' + 'using' => 'by using this website', + 'agreement' => 'Agreement', + 'success' => 'Account Created Successfully, An Email Has Been Sent To Your For Account Verification', + 'success-verify-email-not-sent' => 'Account Created Successfully, But Verification Email Is Not Sent', + 'failed' => 'Error! Cannot Create Your Account, Try Again Later', + 'already-verified' => 'Your Account is already verified Or Please Try Sending A New Verification Email Again', + 'verification-not-sent' => 'Error! Problem In Sending Verification Email, Try Again Later', + 'verification-sent' => 'Verification Email Sent', + 'verified' => 'Your Account Has Been Verified, Try To Login Now', + 'verify-failed' => 'We Cannot Verify Your Mail Account', + 'dont-have-account' => 'You Do Not Have Account With Us', ], 'login-text' => [ @@ -89,7 +103,10 @@ return [ 'forgot_pass' => 'Forgot Password?', 'button_title' => 'Sign In', 'remember' => 'Remember Me', - 'footer' => '© Copyright 2018 Webkul Software, All rights reserved' + 'footer' => '© Copyright 2018 Webkul Software, All rights reserved', + 'invalid-creds' => 'Please Check Your Credentials And Try Again', + 'verify-first' => 'Verify Your Email Account First', + 'resend-verification' => 'Resend Verification Mail Again' ], 'forgot-password' => [ @@ -119,6 +136,10 @@ return [ 'edit' => 'Edit', ], + 'edit-success' => 'Profile Updated Successfully', + 'edit-fail' => 'Error! Profile Cannot Be Updated, Please Try Again Later', + 'unmatch' => 'The Old Password Does Not Match', + 'fname' => 'First Name', 'lname' => 'Last Name', 'gender' => 'Gender', @@ -362,6 +383,7 @@ return [ 'continue' => 'Continue', 'shipping-method' => 'Shipping Method', 'payment-information' => 'Payment Information', + 'payment-method' => 'Payment Method', 'summary' => 'Summary of Order', 'price' => 'Price', 'quantity' => 'Quantity', diff --git a/packages/Webkul/Shop/src/Resources/views/checkout/cart/index.blade.php b/packages/Webkul/Shop/src/Resources/views/checkout/cart/index.blade.php index d4938ec8c..aa5b1cf77 100644 --- a/packages/Webkul/Shop/src/Resources/views/checkout/cart/index.blade.php +++ b/packages/Webkul/Shop/src/Resources/views/checkout/cart/index.blade.php @@ -5,28 +5,20 @@ @stop @section('content-wrapper') - @inject ('productImageHelper', 'Webkul\Product\Helpers\ProductImage') -
- @if ($cart) -
{{ __('shop::app.checkout.cart.title') }}
-
- @csrf - @foreach($cart->items as $item) - type == "configurable") $productBaseImage = $productImageHelper->getProductBaseImage($item->child->product); @@ -64,7 +56,7 @@
- +
@{{ errors.first('qty[{!!$item->id!!}]') }} @@ -73,13 +65,15 @@ {{ __('shop::app.checkout.cart.remove-link') }} - - @if($item->parent_id != 'null' ||$item->parent_id != null) - {{ __('shop::app.checkout.cart.move-to-wishlist') }} - @else - {{ __('shop::app.checkout.cart.move-to-wishlist') }} - @endif - + @auth('customer') + + @if($item->parent_id != 'null' ||$item->parent_id != null) + {{ __('shop::app.checkout.cart.move-to-wishlist') }} + @else + {{ __('shop::app.checkout.cart.move-to-wishlist') }} + @endif + + @endauth
@if (!cart()->isItemHaveQuantity($item)) diff --git a/packages/Webkul/Shop/src/Resources/views/checkout/cart/mini-cart.blade.php b/packages/Webkul/Shop/src/Resources/views/checkout/cart/mini-cart.blade.php index 8c87977c3..e55f7673a 100644 --- a/packages/Webkul/Shop/src/Resources/views/checkout/cart/mini-cart.blade.php +++ b/packages/Webkul/Shop/src/Resources/views/checkout/cart/mini-cart.blade.php @@ -21,54 +21,43 @@ @@ -38,29 +38,29 @@
- + @{{ errors.first('city') }}
- + @{{ errors.first('postcode') }}
- + @{{ errors.first('phone') }}
- + --}}
- +
diff --git a/packages/Webkul/Shop/src/Resources/views/customers/account/address/edit.blade.php b/packages/Webkul/Shop/src/Resources/views/customers/account/address/edit.blade.php index 2fc82a904..04a9691f0 100644 --- a/packages/Webkul/Shop/src/Resources/views/customers/account/address/edit.blade.php +++ b/packages/Webkul/Shop/src/Resources/views/customers/account/address/edit.blade.php @@ -25,7 +25,7 @@
- + @{{ errors.first('address1') }}
@@ -39,19 +39,19 @@
- + @{{ errors.first('city') }}
- + @{{ errors.first('postcode') }}
- + @{{ errors.first('phone') }}
diff --git a/packages/Webkul/Shop/src/Resources/views/customers/account/orders/index.blade.php b/packages/Webkul/Shop/src/Resources/views/customers/account/orders/index.blade.php index 7ef7bdff5..cf9dd9011 100644 --- a/packages/Webkul/Shop/src/Resources/views/customers/account/orders/index.blade.php +++ b/packages/Webkul/Shop/src/Resources/views/customers/account/orders/index.blade.php @@ -11,12 +11,13 @@