diff --git a/.env.example b/.env.example index c3e5febd2..c62b5b3ed 100644 --- a/.env.example +++ b/.env.example @@ -4,10 +4,10 @@ APP_VERSION=1.0.0 APP_KEY= APP_DEBUG=true APP_URL=http://localhost -APP_TIMEZONE= -APP_LOCALE= +APP_TIMEZONE=Asia/Kolkata +APP_LOCALE=en LOG_CHANNEL=stack -APP_CURRENCY= +APP_CURRENCY=USD DB_CONNECTION=mysql DB_HOST=127.0.0.1 diff --git a/.github/ISSUE_TEMPLATE/1_Bug_report.md b/.github/ISSUE_TEMPLATE/1_Bug_report.md index 770fab9c5..7d4fe777c 100644 --- a/.github/ISSUE_TEMPLATE/1_Bug_report.md +++ b/.github/ISSUE_TEMPLATE/1_Bug_report.md @@ -7,7 +7,7 @@ about: 'Report a general library issue.' ### Title **Just a quick sentence to brief your trouble with Bagisto or something associated with it.** -**Please be calm, short and emaphasize on points.** +**Please be calm, short and emphasize on points.** ### Issue Description **Description helps the developers to understand the bug. It describes the problem encountered or some after effect of some kind.** diff --git a/README.md b/README.md index 96cac2e2c..7c2a59925 100755 --- a/README.md +++ b/README.md @@ -74,11 +74,11 @@ Take advantage of two of the hottest frameworks used in this project -- Laravel ### Installation and Configuration -**1. Try our new GUI installer to install Bagisto:** +**1. You can install Bagisto by using the GUI installer.** ##### a. Download zip from the link below: -[Download](https://github.com/bagisto/bagisto/archive/v0.1.6.zip) +[Download the latest release](https://github.com/bagisto/bagisto/releases/latest) ##### b. Extract the contents of zip and execute the project in your browser: @@ -92,7 +92,7 @@ or http(s)://example.com/public ~~~ -**2. Try our old fashioned way to install Bagisto:** +**2. Or you can install Bagisto from your console.** ##### Execute these commands below, in order @@ -100,44 +100,10 @@ http(s)://example.com/public 1. composer create-project bagisto/bagisto ~~~ -**Now, configure your database:** - -If the above command was completed successfully, then you'll find directory **bagisto** with all of the code inside it. - -Find file **.env** inside **bagisto** directory and set the environment variables listed below: - -* **APP_URL** -* **DB_CONNECTION** -* **DB_HOST** -* **DB_PORT** -* **DB_DATABASE** -* **DB_USERNAME** -* **DB_PASSWORD** - -Mailer environment variables are also required to be set up. This is because **Bagisto** needs to send emails to customers and admins depending on what events require notification. - ~~~ -2. php artisan migrate +2. php artisan bagisto:install ~~~ -~~~ -3. php artisan db:seed -~~~ - -~~~ -4. php artisan vendor:publish --> Press 0 and then press enter to publish all assets and configurations. -~~~ - -~~~ -5. php artisan storage:link -~~~ - -~~~ -6. composer dump-autoload -~~~ - - **To execute Bagisto**: ##### On server: diff --git a/composer.json b/composer.json index 42bba6f11..1323044ce 100755 --- a/composer.json +++ b/composer.json @@ -100,7 +100,8 @@ "Webkul\\CartRule\\": "packages/Webkul/CartRule/src", "Webkul\\Rule\\": "packages/Webkul/Rule/src", "Webkul\\CMS\\": "packages/Webkul/CMS/src", - "Webkul\\Velocity\\": "packages/Webkul/Velocity/src" + "Webkul\\Velocity\\": "packages/Webkul/Velocity/src", + "Webkul\\BookingProduct\\": "packages/Webkul/BookingProduct/src" } }, diff --git a/config/app.php b/config/app.php index 2458eb26e..1aa6d5677 100755 --- a/config/app.php +++ b/config/app.php @@ -267,6 +267,7 @@ return [ Webkul\Rule\Providers\RuleServiceProvider::class, Webkul\CMS\Providers\CMSServiceProvider::class, Webkul\Velocity\Providers\VelocityServiceProvider::class, + Webkul\BookingProduct\Providers\BookingProductServiceProvider::class, ], /* diff --git a/config/concord.php b/config/concord.php index 24c40b47a..e7ec5845e 100755 --- a/config/concord.php +++ b/config/concord.php @@ -21,6 +21,7 @@ return [ \Webkul\User\Providers\ModuleServiceProvider::class, \Webkul\CatalogRule\Providers\ModuleServiceProvider::class, \Webkul\CartRule\Providers\ModuleServiceProvider::class, - \Webkul\CMS\Providers\ModuleServiceProvider::class + \Webkul\CMS\Providers\ModuleServiceProvider::class, + \Webkul\BookingProduct\Providers\ModuleServiceProvider::class ] ]; \ No newline at end of file diff --git a/packages/Webkul/API/Http/Controllers/Shop/AddressController.php b/packages/Webkul/API/Http/Controllers/Shop/AddressController.php index 863710ac0..31b724864 100644 --- a/packages/Webkul/API/Http/Controllers/Shop/AddressController.php +++ b/packages/Webkul/API/Http/Controllers/Shop/AddressController.php @@ -5,12 +5,6 @@ namespace Webkul\API\Http\Controllers\Shop; use Webkul\Customer\Repositories\CustomerAddressRepository; use Webkul\API\Http\Resources\Customer\CustomerAddress as CustomerAddressResource; -/** - * Address controller - * - * @author Jitendra Singh - * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) - */ class AddressController extends Controller { /** @@ -30,18 +24,16 @@ class AddressController extends Controller /** * CustomerAddressRepository object * - * @var Object + * @var \Webkul\Customer\Repositories\CustomerAddressRepository */ protected $customerAddressRepository; /** * Controller instance * - * @param Webkul\Customer\Repositories\CustomerAddressRepository $customerAddressRepository + * @param Webkul\Customer\Repositories\CustomerAddressRepository $customerAddressRepository */ - public function __construct( - CustomerAddressRepository $customerAddressRepository - ) + public function __construct(CustomerAddressRepository $customerAddressRepository) { $this->guard = request()->has('token') ? 'api' : 'customer'; @@ -62,6 +54,7 @@ class AddressController extends Controller public function get() { $customer = auth($this->guard)->user(); + $addresses = $customer->addresses()->get(); return CustomerAddressResource::collection($addresses); @@ -77,25 +70,25 @@ class AddressController extends Controller $customer = auth($this->guard)->user(); request()->merge([ - 'address1' => implode(PHP_EOL, array_filter(request()->input('address1'))), - 'customer_id' => $customer->id + 'address1' => implode(PHP_EOL, array_filter(request()->input('address1'))), + 'customer_id' => $customer->id, ]); $this->validate(request(), [ 'address1' => 'string|required', - 'country' => 'string|required', - 'state' => 'string|required', - 'city' => 'string|required', + 'country' => 'string|required', + 'state' => 'string|required', + 'city' => 'string|required', 'postcode' => 'required', - 'phone' => 'required' + 'phone' => 'required', ]); $customerAddress = $this->customerAddressRepository->create(request()->all()); return response()->json([ - 'message' => 'Your address has been created successfully.', - 'data' => new CustomerAddressResource($customerAddress) - ]); + 'message' => 'Your address has been created successfully.', + 'data' => new CustomerAddressResource($customerAddress), + ]); } /** @@ -111,18 +104,18 @@ class AddressController extends Controller $this->validate(request(), [ 'address1' => 'string|required', - 'country' => 'string|required', - 'state' => 'string|required', - 'city' => 'string|required', + 'country' => 'string|required', + 'state' => 'string|required', + 'city' => 'string|required', 'postcode' => 'required', - 'phone' => 'required' + 'phone' => 'required', ]); $this->customerAddressRepository->update(request()->all(), request()->input('id')); return response()->json([ - 'message' => 'Your address has been updated successfully.', - 'data' => new CustomerAddressResource($this->customerAddressRepository->find(request()->input('id'))) - ]); + 'message' => 'Your address has been updated successfully.', + 'data' => new CustomerAddressResource($this->customerAddressRepository->find(request()->input('id'))), + ]); } } \ No newline at end of file diff --git a/packages/Webkul/API/Http/Controllers/Shop/CartController.php b/packages/Webkul/API/Http/Controllers/Shop/CartController.php index 545185a11..c06644456 100644 --- a/packages/Webkul/API/Http/Controllers/Shop/CartController.php +++ b/packages/Webkul/API/Http/Controllers/Shop/CartController.php @@ -9,12 +9,6 @@ use Webkul\API\Http\Resources\Checkout\Cart as CartResource; use Cart; use Webkul\Customer\Repositories\WishlistRepository; -/** - * Cart controller - * - * @author Jitendra Singh - * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) - */ class CartController extends Controller { /** @@ -27,30 +21,30 @@ class CartController extends Controller /** * CartRepository object * - * @var Object + * @var \Webkul\Checkout\Repositories\CartRepository */ protected $cartRepository; /** * CartItemRepository object * - * @var Object + * @var \Webkul\Checkout\Repositories\CartItemRepository */ protected $cartItemRepository; /** * WishlistRepository object * - * @var Object + * @var \Webkul\Checkout\Repositories\WishlistRepository */ protected $wishlistRepository; /** * Controller instance * - * @param Webkul\Checkout\Repositories\CartRepository $cartRepository - * @param Webkul\Checkout\Repositories\CartItemRepository $cartItemRepository - * @param Webkul\Checkout\Repositories\WishlistRepository $wishlistRepository + * @param \Webkul\Checkout\Repositories\CartRepository $cartRepository + * @param \Webkul\Checkout\Repositories\CartItemRepository $cartItemRepository + * @param \Webkul\Checkout\Repositories\WishlistRepository $wishlistRepository */ public function __construct( CartRepository $cartRepository, @@ -84,7 +78,7 @@ class CartController extends Controller $cart = Cart::getCart(); return response()->json([ - 'data' => $cart ? new CartResource($cart) : null + 'data' => $cart ? new CartResource($cart) : null, ]); } @@ -92,8 +86,7 @@ class CartController extends Controller /** * Store a newly created resource in storage. * - * @param int $id - * + * @param int $id * @return \Illuminate\Http\Response */ public function store($id) @@ -110,7 +103,7 @@ class CartController extends Controller $message = session()->get('warning') ?? session()->get('error'); return response()->json([ - 'error' => session()->get('warning') + 'error' => session()->get('warning'), ], 400); } @@ -126,7 +119,7 @@ class CartController extends Controller return response()->json([ 'message' => __('shop::app.checkout.cart.item.success'), - 'data' => $cart ? new CartResource($cart) : null + 'data' => $cart ? new CartResource($cart) : null, ]); } @@ -140,7 +133,7 @@ class CartController extends Controller foreach (request()->get('qty') as $qty) { if ($qty <= 0) { return response()->json([ - 'message' => trans('shop::app.checkout.cart.quantity.illegal') + 'message' => trans('shop::app.checkout.cart.quantity.illegal'), ], 401); } } @@ -161,7 +154,7 @@ class CartController extends Controller return response()->json([ 'message' => __('shop::app.checkout.cart.quantity.success'), - 'data' => $cart ? new CartResource($cart) : null + 'data' => $cart ? new CartResource($cart) : null, ]); } @@ -182,15 +175,14 @@ class CartController extends Controller return response()->json([ 'message' => __('shop::app.checkout.cart.item.success-remove'), - 'data' => $cart ? new CartResource($cart) : null + 'data' => $cart ? new CartResource($cart) : null, ]); } /** * Remove the specified resource from storage. * - * @param int $id - * + * @param int $id * @return \Illuminate\Http\Response */ public function destroyItem($id) @@ -207,15 +199,14 @@ class CartController extends Controller return response()->json([ 'message' => __('shop::app.checkout.cart.item.success-remove'), - 'data' => $cart ? new CartResource($cart) : null + 'data' => $cart ? new CartResource($cart) : null, ]); } /** - * Function to move a already added product to wishlist - * will run only on customer authentication. + * Function to move a already added product to wishlist will run only on customer authentication. * - * @param instance cartItem $id + * @param \Webkul\Checkout\Repositories\CartItemRepository $id */ public function moveToWishlist($id) { @@ -231,7 +222,7 @@ class CartController extends Controller return response()->json([ 'message' => __('shop::app.checkout.cart.move-to-wishlist-success'), - 'data' => $cart ? new CartResource($cart) : null + 'data' => $cart ? new CartResource($cart) : null, ]); } } \ 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 index 19a5b2390..34e0a6bb0 100755 --- a/packages/Webkul/API/Http/Controllers/Shop/CategoryController.php +++ b/packages/Webkul/API/Http/Controllers/Shop/CategoryController.php @@ -6,25 +6,19 @@ use Illuminate\Http\Request; use Webkul\Category\Repositories\CategoryRepository; use Webkul\API\Http\Resources\Catalog\Category as CategoryResource; -/** - * Category controller - * - * @author Jitendra Singh - * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) - */ class CategoryController extends Controller { /** * CategoryRepository object * - * @var array + * @var \Webkul\Category\Repositories\CategoryRepository */ protected $categoryRepository; /** * Create a new controller instance. * - * @param Webkul\Category\Repositories\CategoryRepository $categoryRepository + * @param Webkul\Category\Repositories\CategoryRepository $categoryRepository * @return void */ public function __construct(CategoryRepository $categoryRepository) @@ -40,7 +34,7 @@ class CategoryController extends Controller public function index() { return CategoryResource::collection( - $this->categoryRepository->getVisibleCategoryTree(request()->input('parent_id')) - ); + $this->categoryRepository->getVisibleCategoryTree(request()->input('parent_id')) + ); } } diff --git a/packages/Webkul/API/Http/Controllers/Shop/CheckoutController.php b/packages/Webkul/API/Http/Controllers/Shop/CheckoutController.php index bfd49f637..0915d73d2 100644 --- a/packages/Webkul/API/Http/Controllers/Shop/CheckoutController.php +++ b/packages/Webkul/API/Http/Controllers/Shop/CheckoutController.php @@ -15,12 +15,6 @@ use Webkul\Sales\Repositories\OrderRepository; use Illuminate\Support\Str; use Cart; -/** - * Checkout controller - * - * @author Jitendra Singh - * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) - */ class CheckoutController extends Controller { /** @@ -33,23 +27,23 @@ class CheckoutController extends Controller /** * CartRepository object * - * @var Object + * @var \Webkul\Checkout\Repositories\CartRepository */ protected $cartRepository; /** * CartItemRepository object * - * @var Object + * @var \Webkul\Checkout\Repositories\CartItemRepository */ protected $cartItemRepository; /** * Controller instance * - * @param Webkul\Checkout\Repositories\CartRepository $cartRepository - * @param Webkul\Checkout\Repositories\CartItemRepository $cartItemRepository - * @param Webkul\Sales\Repositories\OrderRepository $orderRepository + * @param \Webkul\Checkout\Repositories\CartRepository $cartRepository + * @param \Webkul\Checkout\Repositories\CartItemRepository $cartItemRepository + * @param \Webkul\Sales\Repositories\OrderRepository $orderRepository */ public function __construct( CartRepository $cartRepository, @@ -61,7 +55,6 @@ class CheckoutController extends Controller auth()->setDefaultDriver($this->guard); - // $this->middleware('auth:' . $this->guard); $this->_config = request('_config'); @@ -84,6 +77,7 @@ class CheckoutController extends Controller $data = request()->all(); $data['billing']['address1'] = implode(PHP_EOL, array_filter($data['billing']['address1'])); + $data['shipping']['address1'] = implode(PHP_EOL, array_filter($data['shipping']['address1'])); if (isset($data['billing']['id']) && str_contains($data['billing']['id'], 'address_')) { @@ -97,15 +91,16 @@ class CheckoutController extends Controller } - if (Cart::hasError() || ! Cart::saveCustomerAddress($data) || ! Shipping::collectRates()) + if (Cart::hasError() || ! Cart::saveCustomerAddress($data) || ! Shipping::collectRates()) { abort(400); + } $rates = []; foreach (Shipping::getGroupedAllShippingRates() as $code => $shippingMethod) { $rates[] = [ 'carrier_title' => $shippingMethod['carrier_title'], - 'rates' => CartShippingRateResource::collection(collect($shippingMethod['rates'])) + 'rates' => CartShippingRateResource::collection(collect($shippingMethod['rates'])), ]; } @@ -114,7 +109,7 @@ class CheckoutController extends Controller return response()->json([ 'data' => [ 'rates' => $rates, - 'cart' => new CartResource(Cart::getCart()) + 'cart' => new CartResource(Cart::getCart()), ] ]); } @@ -128,15 +123,19 @@ class CheckoutController extends Controller { $shippingMethod = request()->get('shipping_method'); - if (Cart::hasError() || !$shippingMethod || ! Cart::saveShippingMethod($shippingMethod)) + if (Cart::hasError() + || !$shippingMethod + || ! Cart::saveShippingMethod($shippingMethod) + ) { abort(400); + } Cart::collectTotals(); return response()->json([ 'data' => [ 'methods' => Payment::getPaymentMethods(), - 'cart' => new CartResource(Cart::getCart()) + 'cart' => new CartResource(Cart::getCart()), ] ]); } @@ -150,12 +149,13 @@ class CheckoutController extends Controller { $payment = request()->get('payment'); - if (Cart::hasError() || ! $payment || ! Cart::savePaymentMethod($payment)) + if (Cart::hasError() || ! $payment || ! Cart::savePaymentMethod($payment)) { abort(400); + } return response()->json([ 'data' => [ - 'cart' => new CartResource(Cart::getCart()) + 'cart' => new CartResource(Cart::getCart()), ] ]); } @@ -167,8 +167,9 @@ class CheckoutController extends Controller */ public function saveOrder() { - if (Cart::hasError()) + if (Cart::hasError()) { abort(400); + } Cart::collectTotals(); @@ -178,8 +179,8 @@ class CheckoutController extends Controller if ($redirectUrl = Payment::getRedirectUrl($cart)) { return response()->json([ - 'success' => true, - 'redirect_url' => $redirectUrl + 'success' => true, + 'redirect_url' => $redirectUrl, ]); } @@ -188,9 +189,9 @@ class CheckoutController extends Controller Cart::deActivateCart(); return response()->json([ - 'success' => true, - 'order' => new OrderResource($order), - ]); + 'success' => true, + 'order' => new OrderResource($order), + ]); } /** diff --git a/packages/Webkul/API/Http/Controllers/Shop/CoreController.php b/packages/Webkul/API/Http/Controllers/Shop/CoreController.php index 27290bdcd..9d76fee63 100755 --- a/packages/Webkul/API/Http/Controllers/Shop/CoreController.php +++ b/packages/Webkul/API/Http/Controllers/Shop/CoreController.php @@ -4,12 +4,6 @@ namespace Webkul\API\Http\Controllers\Shop; use Illuminate\Http\Request; -/** - * Core controller - * - * @author Jitendra Singh - * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) - */ class CoreController extends Controller { /** @@ -26,7 +20,7 @@ class CoreController extends Controller } return response()->json([ - 'data' => $configValues + 'data' => $configValues, ]); } @@ -38,7 +32,7 @@ class CoreController extends Controller public function getCountryStateGroup() { return response()->json([ - 'data' => core()->groupedStatesByCountries() + 'data' => core()->groupedStatesByCountries(), ]); } diff --git a/packages/Webkul/API/Http/Controllers/Shop/CustomerController.php b/packages/Webkul/API/Http/Controllers/Shop/CustomerController.php index c32816dbb..222898993 100644 --- a/packages/Webkul/API/Http/Controllers/Shop/CustomerController.php +++ b/packages/Webkul/API/Http/Controllers/Shop/CustomerController.php @@ -6,13 +6,6 @@ use Illuminate\Support\Facades\Event; use Webkul\Customer\Repositories\CustomerRepository; use Webkul\Customer\Repositories\CustomerGroupRepository; -/** - * Customer controller - * - * @author Jitendra Singh - * @author Vivek Sharma @vivek-webkul - * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) - */ class CustomerController extends Controller { /** @@ -25,22 +18,22 @@ class CustomerController extends Controller /** * Repository object * - * @var array + * @var \Webkul\Customer\Repositories\CustomerRepository */ protected $customerRepository; /** * Repository object * - * @var array + * @var \Webkul\Customer\Repositories\CustomerGroupRepository */ protected $customerGroupRepository; /** * Create a new controller instance. * - * @param \Webkul\Customer\Repositories\CustomerRepository $customerRepository - * @param \Webkul\Customer\Repositories\CustomerGroupRepository $customerGroupRepository + * @param \Webkul\Customer\Repositories\CustomerRepository $customerRepository + * @param \Webkul\Customer\Repositories\CustomerGroupRepository $customerGroupRepository * @return void */ public function __construct( @@ -57,23 +50,23 @@ class CustomerController extends Controller /** * Method to store user's sign up form data to DB. * - * @return Mixed + * @return \Illuminate\Http\Response */ public function create() { request()->validate([ 'first_name' => 'required', - 'last_name' => 'required', - 'email' => 'email|required|unique:customers,email', - 'password' => 'confirmed|min:6|required' + 'last_name' => 'required', + 'email' => 'email|required|unique:customers,email', + 'password' => 'confirmed|min:6|required', ]); $data = request()->input(); $data = array_merge($data, [ - 'password' => bcrypt($data['password']), - 'channel_id' => core()->getCurrentChannel()->id, - 'is_verified' => 1 + 'password' => bcrypt($data['password']), + 'channel_id' => core()->getCurrentChannel()->id, + 'is_verified' => 1, ]); $data['customer_group_id'] = $this->customerGroupRepository->findOneWhere(['code' => 'general'])->id; @@ -85,7 +78,7 @@ class CustomerController extends Controller Event::dispatch('customer.registration.after', $customer); return response()->json([ - 'message' => 'Your account has been created successfully.' - ]); + 'message' => 'Your account has been created successfully.', + ]); } } \ No newline at end of file diff --git a/packages/Webkul/API/Http/Controllers/Shop/ForgotPasswordController.php b/packages/Webkul/API/Http/Controllers/Shop/ForgotPasswordController.php index 50529541e..c485e2b70 100644 --- a/packages/Webkul/API/Http/Controllers/Shop/ForgotPasswordController.php +++ b/packages/Webkul/API/Http/Controllers/Shop/ForgotPasswordController.php @@ -5,12 +5,6 @@ namespace Webkul\API\Http\Controllers\Shop; use Illuminate\Foundation\Auth\SendsPasswordResetEmails; use Illuminate\Support\Facades\Password; -/** - * Forgot Password controller - * - * @author Jitendra Singh - * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) - */ class ForgotPasswordController extends Controller { use SendsPasswordResetEmails; @@ -23,20 +17,20 @@ class ForgotPasswordController extends Controller public function store() { $this->validate(request(), [ - 'email' => 'required|email' + 'email' => 'required|email', ]); $response = $this->broker()->sendResetLink(request(['email'])); if ($response == Password::RESET_LINK_SENT) { return response()->json([ - 'message' => trans($response) - ]); + 'message' => trans($response), + ]); } return response()->json([ - 'error' => trans($response) - ]); + 'error' => trans($response), + ]); } /** diff --git a/packages/Webkul/API/Http/Controllers/Shop/ProductController.php b/packages/Webkul/API/Http/Controllers/Shop/ProductController.php index 3f7c4acce..051982e51 100755 --- a/packages/Webkul/API/Http/Controllers/Shop/ProductController.php +++ b/packages/Webkul/API/Http/Controllers/Shop/ProductController.php @@ -7,25 +7,19 @@ use Illuminate\Http\Response; use Webkul\Product\Repositories\ProductRepository; use Webkul\API\Http\Resources\Catalog\Product as ProductResource; -/** - * Product controller - * - * @author Jitendra Singh - * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) - */ class ProductController extends Controller { /** * ProductRepository object * - * @var array + * @var \Webkul\Product\Repositories\ProductRepository */ protected $productRepository; /** * Create a new controller instance. * - * @param Webkul\Product\Repositories\ProductRepository $productRepository + * @param \Webkul\Product\Repositories\ProductRepository $productRepository * @return void */ public function __construct(ProductRepository $productRepository) @@ -46,36 +40,39 @@ class ProductController extends Controller /** * Returns a individual resource. * + * @param int $id * @return \Illuminate\Http\Response */ public function get($id) { return new ProductResource( - $this->productRepository->findOrFail($id) - ); + $this->productRepository->findOrFail($id) + ); } /** * Returns product's additional information. * + * @param int $id * @return \Illuminate\Http\Response */ public function additionalInformation($id) { return response()->json([ - 'data' => app('Webkul\Product\Helpers\View')->getAdditionalData($this->productRepository->findOrFail($id)) - ]); + 'data' => app('Webkul\Product\Helpers\View')->getAdditionalData($this->productRepository->findOrFail($id)), + ]); } /** * Returns product's additional information. * + * @param int $id * @return \Illuminate\Http\Response */ public function configurableConfig($id) { return response()->json([ - 'data' => app('Webkul\Product\Helpers\ConfigurableOption')->getConfigurationConfig($this->productRepository->findOrFail($id)) - ]); + 'data' => app('Webkul\Product\Helpers\ConfigurableOption')->getConfigurationConfig($this->productRepository->findOrFail($id)), + ]); } } diff --git a/packages/Webkul/API/Http/Controllers/Shop/ResourceController.php b/packages/Webkul/API/Http/Controllers/Shop/ResourceController.php index 2fdd8b859..5668bd64a 100644 --- a/packages/Webkul/API/Http/Controllers/Shop/ResourceController.php +++ b/packages/Webkul/API/Http/Controllers/Shop/ResourceController.php @@ -4,12 +4,6 @@ namespace Webkul\API\Http\Controllers\Shop; use Illuminate\Http\Request; -/** - * Resource Controller - * - * @author Jitendra Singh - * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) - */ class ResourceController extends Controller { /** @@ -29,7 +23,7 @@ class ResourceController extends Controller /** * Repository object * - * @var array + * @var \Webkul\Core\Eloquent\Repository */ protected $repository; @@ -87,18 +81,20 @@ class ResourceController extends Controller /** * Returns a individual resource. * + * @param int $id * @return \Illuminate\Http\Response */ public function get($id) { return new $this->_config['resource']( - $this->repository->findOrFail($id) - ); + $this->repository->findOrFail($id) + ); } /** * Delete's a individual resource. * + * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) @@ -108,7 +104,7 @@ class ResourceController extends Controller $this->repository->delete($id); return response()->json([ - 'message' => 'Item removed successfully.' - ]); + 'message' => 'Item removed successfully.', + ]); } } diff --git a/packages/Webkul/API/Http/Controllers/Shop/ReviewController.php b/packages/Webkul/API/Http/Controllers/Shop/ReviewController.php index 5121628be..2a5653ce3 100644 --- a/packages/Webkul/API/Http/Controllers/Shop/ReviewController.php +++ b/packages/Webkul/API/Http/Controllers/Shop/ReviewController.php @@ -6,12 +6,6 @@ use Illuminate\Http\Request; use Webkul\Product\Repositories\ProductReviewRepository; use Webkul\API\Http\Resources\Catalog\ProductReview as ProductReviewResource; -/** - * Review controller - * - * @author Jitendra Singh - * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) - */ class ReviewController extends Controller { /** @@ -24,14 +18,14 @@ class ReviewController extends Controller /** * ProductReviewRepository object * - * @var array + * @var \Webkul\Product\Repositories\ProductReviewRepository */ protected $reviewRepository; /** * Controller instance * - * @param Webkul\Product\Repositories\ProductReviewRepository $reviewRepository + * @param Webkul\Product\Repositories\ProductReviewRepository $reviewRepository */ public function __construct(ProductReviewRepository $reviewRepository) { @@ -46,6 +40,7 @@ class ReviewController extends Controller * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request + * @param int $id * @return \Illuminate\Http\Response */ public function store(Request $request, $id) @@ -60,16 +55,16 @@ class ReviewController extends Controller $data = array_merge(request()->all(), [ 'customer_id' => $customer ? $customer->id : null, - 'name' => $customer ? $customer->name : request()->input('name'), - 'status' => 'pending', - 'product_id' => $id + 'name' => $customer ? $customer->name : request()->input('name'), + 'status' => 'pending', + 'product_id' => $id, ]); $productReview = $this->reviewRepository->create($data); return response()->json([ - 'message' => 'Your review submitted successfully.', - 'data' => new ProductReviewResource($this->reviewRepository->find($productReview->id)) - ]); + 'message' => 'Your review submitted successfully.', + 'data' => new ProductReviewResource($this->reviewRepository->find($productReview->id)), + ]); } } \ No newline at end of file diff --git a/packages/Webkul/API/Http/Controllers/Shop/SessionController.php b/packages/Webkul/API/Http/Controllers/Shop/SessionController.php index 714d67efe..19370d917 100644 --- a/packages/Webkul/API/Http/Controllers/Shop/SessionController.php +++ b/packages/Webkul/API/Http/Controllers/Shop/SessionController.php @@ -6,18 +6,12 @@ use Illuminate\Support\Facades\Event; use Webkul\Customer\Repositories\CustomerRepository; use Webkul\API\Http\Resources\Customer\Customer as CustomerResource; -/** - * Session controller - * - * @author Jitendra Singh - * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) - */ class SessionController extends Controller { /** * Contains current guard * - * @var array + * @var string */ protected $guard; @@ -31,7 +25,7 @@ class SessionController extends Controller /** * Controller instance * - * @param Webkul\Customer\Repositories\CustomerRepository $customerRepository + * @param \Webkul\Customer\Repositories\CustomerRepository $customerRepository */ public function __construct(CustomerRepository $customerRepository) { @@ -49,13 +43,13 @@ class SessionController extends Controller /** * Method to store user's sign up form data to DB. * - * @return Mixed + * @return \Illuminate\Http\Response */ public function create() { request()->validate([ - 'email' => 'required|email', - 'password' => 'required' + 'email' => 'required|email', + 'password' => 'required', ]); $jwtToken = null; @@ -71,9 +65,9 @@ class SessionController extends Controller $customer = auth($this->guard)->user(); return response()->json([ - 'token' => $jwtToken, + 'token' => $jwtToken, 'message' => 'Logged in successfully.', - 'data' => new CustomerResource($customer) + 'data' => new CustomerResource($customer), ]); } @@ -87,7 +81,7 @@ class SessionController extends Controller $customer = auth($this->guard)->user(); return response()->json([ - 'data' => new CustomerResource($customer) + 'data' => new CustomerResource($customer), ]); } @@ -101,12 +95,12 @@ class SessionController extends Controller $customer = auth($this->guard)->user(); $this->validate(request(), [ - 'first_name' => 'required', - 'last_name' => 'required', - 'gender' => 'required', + 'first_name' => 'required', + 'last_name' => 'required', + 'gender' => 'required', 'date_of_birth' => 'nullable|date|before:today', - 'email' => 'email|unique:customers,email,' . $customer->id, - 'password' => 'confirmed|min:6' + 'email' => 'email|unique:customers,email,' . $customer->id, + 'password' => 'confirmed|min:6', ]); $data = request()->all(); @@ -124,9 +118,9 @@ class SessionController extends Controller $this->customerRepository->update($data, $customer->id); return response()->json([ - 'message' => 'Your account has been created successfully.', - 'data' => new CustomerResource($this->customerRepository->find($customer->id)) - ]); + 'message' => 'Your account has been created successfully.', + 'data' => new CustomerResource($this->customerRepository->find($customer->id)), + ]); } /** diff --git a/packages/Webkul/API/Http/Controllers/Shop/WishlistController.php b/packages/Webkul/API/Http/Controllers/Shop/WishlistController.php index be3eeb84f..5682abbb5 100644 --- a/packages/Webkul/API/Http/Controllers/Shop/WishlistController.php +++ b/packages/Webkul/API/Http/Controllers/Shop/WishlistController.php @@ -9,31 +9,25 @@ use Webkul\API\Http\Resources\Customer\Wishlist as WishlistResource; use Webkul\API\Http\Resources\Checkout\Cart as CartResource; use Cart; -/** - * Wishlist controller - * - * @author Jitendra Singh - * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) - */ class WishlistController extends Controller { /** * WishlistRepository object * - * @var object + * @var \Webkul\Customer\Repositories\WishlistRepository */ protected $wishlistRepository; /** * ProductRepository object * - * @var object + * @var \Webkul\Customer\Repositories\ProductRepository */ protected $productRepository; /** - * @param Webkul\Customer\Repositories\WishlistRepository $wishlistRepository - * @param Webkul\Product\Repositories\ProductRepository $productRepository + * @param \Webkul\Customer\Repositories\WishlistRepository $wishlistRepository + * @param \Webkul\Product\Repositories\ProductRepository $productRepository */ public function __construct( WishlistRepository $wishlistRepository, @@ -54,7 +48,7 @@ class WishlistController extends Controller /** * Function to add item to the wishlist. * - * @param integer $id + * @param int $id * @return \Illuminate\Http\Response */ public function create($id) @@ -64,46 +58,47 @@ class WishlistController extends Controller $customer = auth()->guard($this->guard)->user(); $wishlistItem = $this->wishlistRepository->findOneWhere([ - 'channel_id' => core()->getCurrentChannel()->id, - 'product_id' => $id, - 'customer_id' => $customer->id - ]); + 'channel_id' => core()->getCurrentChannel()->id, + 'product_id' => $id, + 'customer_id' => $customer->id, + ]); if (! $wishlistItem) { $wishlistItem = $this->wishlistRepository->create([ - 'channel_id' => core()->getCurrentChannel()->id, - 'product_id' => $id, - 'customer_id' => $customer->id - ]); + 'channel_id' => core()->getCurrentChannel()->id, + 'product_id' => $id, + 'customer_id' => $customer->id, + ]); return response()->json([ - 'data' => new WishlistResource($wishlistItem), - 'message' => trans('customer::app.wishlist.success') - ]); + 'data' => new WishlistResource($wishlistItem), + 'message' => trans('customer::app.wishlist.success'), + ]); } else { $this->wishlistRepository->delete($wishlistItem->id); return response()->json([ - 'data' => null, - 'message' => 'Item removed from wishlist successfully.' - ]); + 'data' => null, + 'message' => 'Item removed from wishlist successfully.', + ]); } } /** * Move product from wishlist to cart. * - * @param integer $id + * @param int $id * @return \Illuminate\Http\Response */ public function moveToCart($id) { $wishlistItem = $this->wishlistRepository->findOrFail($id); - if ($wishlistItem->customer_id != auth()->guard($this->guard)->user()->id) + if ($wishlistItem->customer_id != auth()->guard($this->guard)->user()->id) { return response()->json([ - 'message' => trans('shop::app.security-warning') - ], 400); + 'message' => trans('shop::app.security-warning'), + ], 400); + } $result = Cart::moveToCart($wishlistItem); @@ -113,14 +108,14 @@ class WishlistController extends Controller $cart = Cart::getCart(); return response()->json([ - 'data' => $cart ? new CartResource($cart) : null, - 'message' => trans('shop::app.wishlist.moved') - ]); + 'data' => $cart ? new CartResource($cart) : null, + 'message' => trans('shop::app.wishlist.moved'), + ]); } else { return response()->json([ - 'data' => -1, - 'error' => trans('shop::app.wishlist.option-missing') - ], 400); + 'data' => -1, + 'error' => trans('shop::app.wishlist.option-missing'), + ], 400); } } } \ No newline at end of file diff --git a/packages/Webkul/API/Http/Resources/Catalog/Attribute.php b/packages/Webkul/API/Http/Resources/Catalog/Attribute.php index 098b93f12..ca65e863e 100644 --- a/packages/Webkul/API/Http/Resources/Catalog/Attribute.php +++ b/packages/Webkul/API/Http/Resources/Catalog/Attribute.php @@ -15,14 +15,14 @@ class Attribute extends JsonResource public function toArray($request) { return [ - 'id' => $this->id, - 'code' => $this->code, - 'type' => $this->type, - 'name' => $this->name, + 'id' => $this->id, + 'code' => $this->code, + 'type' => $this->type, + 'name' => $this->name, 'swatch_type' => $this->swatch_type, - 'options' => AttributeOption::collection($this->options), - 'created_at' => $this->created_at, - 'updated_at' => $this->updated_at, + 'options' => AttributeOption::collection($this->options), + 'created_at' => $this->created_at, + 'updated_at' => $this->updated_at, ]; } } \ No newline at end of file diff --git a/packages/Webkul/API/Http/Resources/Catalog/AttributeFamily.php b/packages/Webkul/API/Http/Resources/Catalog/AttributeFamily.php index 6c6743531..0bd64e3c0 100644 --- a/packages/Webkul/API/Http/Resources/Catalog/AttributeFamily.php +++ b/packages/Webkul/API/Http/Resources/Catalog/AttributeFamily.php @@ -15,11 +15,11 @@ class AttributeFamily extends JsonResource public function toArray($request) { return [ - 'id' => $this->id, - 'code' => $this->code, - 'name' => $this->name, - 'status' => $this->status, - 'groups' => AttributeGroup::collection($this->attribute_groups), + 'id' => $this->id, + 'code' => $this->code, + 'name' => $this->name, + 'status' => $this->status, + 'groups' => AttributeGroup::collection($this->attribute_groups), 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, ]; diff --git a/packages/Webkul/API/Http/Resources/Catalog/AttributeGroup.php b/packages/Webkul/API/Http/Resources/Catalog/AttributeGroup.php index 81fbfbf8e..cc41c9fd1 100644 --- a/packages/Webkul/API/Http/Resources/Catalog/AttributeGroup.php +++ b/packages/Webkul/API/Http/Resources/Catalog/AttributeGroup.php @@ -15,11 +15,11 @@ class AttributeGroup extends JsonResource public function toArray($request) { return [ - 'id' => $this->id, - 'code' => $this->code, - 'name' => $this->name, + 'id' => $this->id, + 'code' => $this->code, + 'name' => $this->name, 'swatch_type' => $this->swatch_type, - 'attributes' => Attribute::collection($this->custom_attributes) + 'attributes' => Attribute::collection($this->custom_attributes) ]; } } \ No newline at end of file diff --git a/packages/Webkul/API/Http/Resources/Catalog/AttributeOption.php b/packages/Webkul/API/Http/Resources/Catalog/AttributeOption.php index ff4f21e8e..e0a9a8a5e 100644 --- a/packages/Webkul/API/Http/Resources/Catalog/AttributeOption.php +++ b/packages/Webkul/API/Http/Resources/Catalog/AttributeOption.php @@ -15,9 +15,9 @@ class AttributeOption extends JsonResource public function toArray($request) { return [ - 'id' => $this->id, - 'admin_name' => $this->admin_name, - 'label' => $this->label, + 'id' => $this->id, + 'admin_name' => $this->admin_name, + 'label' => $this->label, 'swatch_value' => $this->swatch_value ]; } diff --git a/packages/Webkul/API/Http/Resources/Catalog/Category.php b/packages/Webkul/API/Http/Resources/Catalog/Category.php index 2ecb649ac..f99af8723 100644 --- a/packages/Webkul/API/Http/Resources/Catalog/Category.php +++ b/packages/Webkul/API/Http/Resources/Catalog/Category.php @@ -15,19 +15,19 @@ class Category extends JsonResource public function toArray($request) { return [ - 'id' => $this->id, - 'code' => $this->code, - 'name' => $this->name, - 'slug' => $this->slug, - 'display_mode' => $this->display_mode, - 'description' => $this->description, - 'meta_title' => $this->meta_title, + 'id' => $this->id, + 'code' => $this->code, + 'name' => $this->name, + 'slug' => $this->slug, + 'display_mode' => $this->display_mode, + 'description' => $this->description, + 'meta_title' => $this->meta_title, 'meta_description' => $this->meta_description, - 'meta_keywords' => $this->meta_keywords, - 'status' => $this->status, - 'image_url' => $this->image_url, - 'created_at' => $this->created_at, - 'updated_at' => $this->updated_at, + 'meta_keywords' => $this->meta_keywords, + 'status' => $this->status, + 'image_url' => $this->image_url, + 'created_at' => $this->created_at, + 'updated_at' => $this->updated_at, ]; } } \ No newline at end of file diff --git a/packages/Webkul/API/Http/Resources/Catalog/Product.php b/packages/Webkul/API/Http/Resources/Catalog/Product.php index c4a1ec895..e81a7b872 100644 --- a/packages/Webkul/API/Http/Resources/Catalog/Product.php +++ b/packages/Webkul/API/Http/Resources/Catalog/Product.php @@ -32,23 +32,23 @@ class Product extends JsonResource $product = $this->product ? $this->product : $this; return [ - 'id' => $product->id, - 'type' => $product->type, - 'name' => $this->name, - 'url_key' => $this->url_key, - 'price' => $product->getTypeInstance()->getMinimalPrice(), - 'formated_price' => core()->currency($product->getTypeInstance()->getMinimalPrice()), - 'short_description' => $this->short_description, - 'description' => $this->description, - 'sku' => $this->sku, - 'images' => ProductImage::collection($product->images), - 'base_image' => $this->productImageHelper->getProductBaseImage($product), - 'variants' => Self::collection($this->variants), - 'in_stock' => $product->haveSufficientQuantity(1), + 'id' => $product->id, + 'type' => $product->type, + 'name' => $this->name, + 'url_key' => $this->url_key, + 'price' => $product->getTypeInstance()->getMinimalPrice(), + 'formated_price' => core()->currency($product->getTypeInstance()->getMinimalPrice()), + 'short_description' => $this->short_description, + 'description' => $this->description, + 'sku' => $this->sku, + 'images' => ProductImage::collection($product->images), + 'base_image' => $this->productImageHelper->getProductBaseImage($product), + 'variants' => Self::collection($this->variants), + 'in_stock' => $product->haveSufficientQuantity(1), $this->mergeWhen($product->getTypeInstance()->isComposite(), [ 'super_attributes' => Attribute::collection($product->super_attributes), ]), - 'special_price' => $this->when( + 'special_price' => $this->when( $product->getTypeInstance()->haveSpecialPrice(), $product->getTypeInstance()->getSpecialPrice() ), @@ -56,15 +56,15 @@ class Product extends JsonResource $product->getTypeInstance()->haveSpecialPrice(), core()->currency($product->getTypeInstance()->getSpecialPrice()) ), - 'reviews' => [ - 'total' => $total = $this->productReviewHelper->getTotalReviews($product), - 'total_rating' => $total ? $this->productReviewHelper->getTotalRating($product) : 0, + 'reviews' => [ + 'total' => $total = $this->productReviewHelper->getTotalReviews($product), + 'total_rating' => $total ? $this->productReviewHelper->getTotalRating($product) : 0, 'average_rating' => $total ? $this->productReviewHelper->getAverageRating($product) : 0, - 'percentage' => $total ? json_encode($this->productReviewHelper->getPercentageRating($product)) : [], + 'percentage' => $total ? json_encode($this->productReviewHelper->getPercentageRating($product)) : [], ], - 'is_saved' => false, - 'created_at' => $this->created_at, - 'updated_at' => $this->updated_at, + 'is_saved' => false, + 'created_at' => $this->created_at, + 'updated_at' => $this->updated_at, ]; } } \ No newline at end of file diff --git a/packages/Webkul/API/Http/Resources/Catalog/ProductImage.php b/packages/Webkul/API/Http/Resources/Catalog/ProductImage.php index cd4e574bf..a704b8ff6 100644 --- a/packages/Webkul/API/Http/Resources/Catalog/ProductImage.php +++ b/packages/Webkul/API/Http/Resources/Catalog/ProductImage.php @@ -15,13 +15,13 @@ class ProductImage extends JsonResource public function toArray($request) { return [ - 'id' => $this->id, - 'path' => $this->path, - 'url' => $this->url, + 'id' => $this->id, + 'path' => $this->path, + 'url' => $this->url, 'original_image_url' => $this->url, - 'small_image_url' => url('cache/small/' . $this->path), - 'medium_image_url' => url('cache/medium/' . $this->path), - 'large_image_url' => url('cache/large/' . $this->path) + 'small_image_url' => url('cache/small/' . $this->path), + 'medium_image_url' => url('cache/medium/' . $this->path), + 'large_image_url' => url('cache/large/' . $this->path) ]; } } \ No newline at end of file diff --git a/packages/Webkul/API/Http/Resources/Catalog/ProductReview.php b/packages/Webkul/API/Http/Resources/Catalog/ProductReview.php index a2902b598..94e37820b 100644 --- a/packages/Webkul/API/Http/Resources/Catalog/ProductReview.php +++ b/packages/Webkul/API/Http/Resources/Catalog/ProductReview.php @@ -16,14 +16,14 @@ class ProductReview extends JsonResource public function toArray($request) { return [ - 'id' => $this->id, - 'title' => $this->title, - 'rating' => number_format($this->rating, 1, '.', ''), - 'comment' => $this->comment, - 'name' => $this->name, - 'status' => $this->status, - 'product' => new Product($this->product), - 'customer' => $this->when($this->customer_id, new CustomerResource($this->customer)), + 'id' => $this->id, + 'title' => $this->title, + 'rating' => number_format($this->rating, 1, '.', ''), + 'comment' => $this->comment, + 'name' => $this->name, + 'status' => $this->status, + 'product' => new Product($this->product), + 'customer' => $this->when($this->customer_id, new CustomerResource($this->customer)), 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, ]; diff --git a/packages/Webkul/API/Http/Resources/Checkout/Cart.php b/packages/Webkul/API/Http/Resources/Checkout/Cart.php index 028d42f43..041937f2d 100644 --- a/packages/Webkul/API/Http/Resources/Checkout/Cart.php +++ b/packages/Webkul/API/Http/Resources/Checkout/Cart.php @@ -24,52 +24,52 @@ class Cart extends JsonResource return [ 'id' => $this->id, - 'customer_email' => $this->customer_email, - 'customer_first_name' => $this->customer_first_name, - 'customer_last_name' => $this->customer_last_name, - 'shipping_method' => $this->shipping_method, - 'coupon_code' => $this->coupon_code, - 'is_gift' => $this->is_gift, - 'items_count' => $this->items_count, - 'items_qty' => $this->items_qty, - 'exchange_rate' => $this->exchange_rate, - 'global_currency_code' => $this->global_currency_code, - 'base_currency_code' => $this->base_currency_code, - 'channel_currency_code' => $this->channel_currency_code, - 'cart_currency_code' => $this->cart_currency_code, - 'grand_total' => $this->grand_total, - 'formated_grand_total' => core()->formatPrice($this->grand_total, $this->cart_currency_code), - 'base_grand_total' => $this->base_grand_total, + 'customer_email' => $this->customer_email, + 'customer_first_name' => $this->customer_first_name, + 'customer_last_name' => $this->customer_last_name, + 'shipping_method' => $this->shipping_method, + 'coupon_code' => $this->coupon_code, + 'is_gift' => $this->is_gift, + 'items_count' => $this->items_count, + 'items_qty' => $this->items_qty, + 'exchange_rate' => $this->exchange_rate, + 'global_currency_code' => $this->global_currency_code, + 'base_currency_code' => $this->base_currency_code, + 'channel_currency_code' => $this->channel_currency_code, + 'cart_currency_code' => $this->cart_currency_code, + 'grand_total' => $this->grand_total, + 'formated_grand_total' => core()->formatPrice($this->grand_total, $this->cart_currency_code), + 'base_grand_total' => $this->base_grand_total, 'formated_base_grand_total' => core()->formatBasePrice($this->base_grand_total), - 'sub_total' => $this->sub_total, - 'formated_sub_total' => core()->formatPrice($this->sub_total, $this->cart_currency_code), - 'base_sub_total' => $this->base_sub_total, - 'formated_base_sub_total' => core()->formatBasePrice($this->base_sub_total), - 'tax_total' => $this->tax_total, - 'formated_tax_total' => core()->formatPrice($this->tax_total, $this->cart_currency_code), - 'base_tax_total' => $this->base_tax_total, - 'formated_base_tax_total' => core()->formatBasePrice($this->base_tax_total), - 'discount' => $this->discount, - 'formated_discount' => core()->formatPrice($this->discount, $this->cart_currency_code), - 'base_discount' => $this->base_discount, - 'formated_base_discount' => core()->formatBasePrice($this->base_discount), - 'checkout_method' => $this->checkout_method, - 'is_guest' => $this->is_guest, - 'is_active' => $this->is_active, - 'conversion_time' => $this->conversion_time, - 'customer' => $this->when($this->customer_id, new CustomerResource($this->customer)), - 'channel' => $this->when($this->channel_id, new ChannelResource($this->channel)), - 'items' => CartItem::collection($this->items), - 'selected_shipping_rate' => new CartShippingRate($this->selected_shipping_rate), - 'payment' => new CartPayment($this->payment), - 'billing_address' => new CartAddress($this->billing_address), - 'shipping_address' => new CartAddress($this->shipping_address), - 'created_at' => $this->created_at, - 'updated_at' => $this->updated_at, - 'taxes' => json_encode($taxes, JSON_FORCE_OBJECT), - 'formated_taxes' => json_encode($formatedTaxes, JSON_FORCE_OBJECT), - 'base_taxes' => json_encode($baseTaxes, JSON_FORCE_OBJECT), - 'formated_base_taxes' => json_encode($formatedBaseTaxes, JSON_FORCE_OBJECT), + 'sub_total' => $this->sub_total, + 'formated_sub_total' => core()->formatPrice($this->sub_total, $this->cart_currency_code), + 'base_sub_total' => $this->base_sub_total, + 'formated_base_sub_total' => core()->formatBasePrice($this->base_sub_total), + 'tax_total' => $this->tax_total, + 'formated_tax_total' => core()->formatPrice($this->tax_total, $this->cart_currency_code), + 'base_tax_total' => $this->base_tax_total, + 'formated_base_tax_total' => core()->formatBasePrice($this->base_tax_total), + 'discount' => $this->discount, + 'formated_discount' => core()->formatPrice($this->discount, $this->cart_currency_code), + 'base_discount' => $this->base_discount, + 'formated_base_discount' => core()->formatBasePrice($this->base_discount), + 'checkout_method' => $this->checkout_method, + 'is_guest' => $this->is_guest, + 'is_active' => $this->is_active, + 'conversion_time' => $this->conversion_time, + 'customer' => $this->when($this->customer_id, new CustomerResource($this->customer)), + 'channel' => $this->when($this->channel_id, new ChannelResource($this->channel)), + 'items' => CartItem::collection($this->items), + 'selected_shipping_rate' => new CartShippingRate($this->selected_shipping_rate), + 'payment' => new CartPayment($this->payment), + 'billing_address' => new CartAddress($this->billing_address), + 'shipping_address' => new CartAddress($this->shipping_address), + 'created_at' => $this->created_at, + 'updated_at' => $this->updated_at, + 'taxes' => json_encode($taxes, JSON_FORCE_OBJECT), + 'formated_taxes' => json_encode($formatedTaxes, JSON_FORCE_OBJECT), + 'base_taxes' => json_encode($baseTaxes, JSON_FORCE_OBJECT), + 'formated_base_taxes' => json_encode($formatedBaseTaxes, JSON_FORCE_OBJECT), ]; } diff --git a/packages/Webkul/API/Http/Resources/Checkout/CartAddress.php b/packages/Webkul/API/Http/Resources/Checkout/CartAddress.php index 1bed8697c..0ff7f7987 100644 --- a/packages/Webkul/API/Http/Resources/Checkout/CartAddress.php +++ b/packages/Webkul/API/Http/Resources/Checkout/CartAddress.php @@ -16,19 +16,19 @@ class CartAddress extends JsonResource { return [ 'id' => $this->id, - 'first_name' => $this->first_name, - 'last_name' => $this->last_name, - 'name' => $this->name, - 'email' => $this->email, - 'address1' => explode(PHP_EOL, $this->address1), - 'country' => $this->country, + 'first_name' => $this->first_name, + 'last_name' => $this->last_name, + 'name' => $this->name, + 'email' => $this->email, + 'address1' => explode(PHP_EOL, $this->address1), + 'country' => $this->country, 'country_name' => core()->country_name($this->country), - 'state' => $this->state, - 'city' => $this->city, - 'postcode' => $this->postcode, - 'phone' => $this->phone, - 'created_at' => $this->created_at, - 'updated_at' => $this->updated_at, + 'state' => $this->state, + 'city' => $this->city, + 'postcode' => $this->postcode, + 'phone' => $this->phone, + 'created_at' => $this->created_at, + 'updated_at' => $this->updated_at, ]; } } \ No newline at end of file diff --git a/packages/Webkul/API/Http/Resources/Checkout/CartItem.php b/packages/Webkul/API/Http/Resources/Checkout/CartItem.php index 37c36684e..9f3418734 100644 --- a/packages/Webkul/API/Http/Resources/Checkout/CartItem.php +++ b/packages/Webkul/API/Http/Resources/Checkout/CartItem.php @@ -16,42 +16,42 @@ class CartItem extends JsonResource public function toArray($request) { return [ - 'id' => $this->id, - 'quantity' => $this->quantity, - 'sku' => $this->sku, - 'type' => $this->type, - 'name' => $this->name, - 'coupon_code' => $this->coupon_code, - 'weight' => $this->weight, - 'total_weight' => $this->total_weight, - 'base_total_weight' => $this->base_total_weight, - 'price' => $this->price, - 'formated_price' => core()->formatPrice($this->price, $this->cart->cart_currency_code), - 'base_price' => $this->base_price, - 'formated_base_price' => core()->formatBasePrice($this->base_price), - 'custom_price' => $this->custom_price, - 'formated_custom_price' => core()->formatPrice($this->custom_price, $this->cart->cart_currency_code), - 'total' => $this->total, - 'formated_total' => core()->formatPrice($this->total, $this->cart->cart_currency_code), - 'base_total' => $this->base_total, - 'formated_base_total' => core()->formatBasePrice($this->base_total), - 'tax_percent' => $this->tax_percent, - 'tax_amount' => $this->tax_amount, - 'formated_tax_amount' => core()->formatPrice($this->tax_amount, $this->cart->cart_currency_code), - 'base_tax_amount' => $this->base_tax_amount, - 'formated_base_tax_amount' => core()->formatBasePrice($this->base_tax_amount), - 'discount_percent' => $this->discount_percent, - 'discount_amount' => $this->discount_amount, - 'formated_discount_amount' => core()->formatPrice($this->discount_amount, $this->cart->cart_currency_code), - 'base_discount_amount' => $this->base_discount_amount, + 'id' => $this->id, + 'quantity' => $this->quantity, + 'sku' => $this->sku, + 'type' => $this->type, + 'name' => $this->name, + 'coupon_code' => $this->coupon_code, + 'weight' => $this->weight, + 'total_weight' => $this->total_weight, + 'base_total_weight' => $this->base_total_weight, + 'price' => $this->price, + 'formated_price' => core()->formatPrice($this->price, $this->cart->cart_currency_code), + 'base_price' => $this->base_price, + 'formated_base_price' => core()->formatBasePrice($this->base_price), + 'custom_price' => $this->custom_price, + 'formated_custom_price' => core()->formatPrice($this->custom_price, $this->cart->cart_currency_code), + 'total' => $this->total, + 'formated_total' => core()->formatPrice($this->total, $this->cart->cart_currency_code), + 'base_total' => $this->base_total, + 'formated_base_total' => core()->formatBasePrice($this->base_total), + 'tax_percent' => $this->tax_percent, + 'tax_amount' => $this->tax_amount, + 'formated_tax_amount' => core()->formatPrice($this->tax_amount, $this->cart->cart_currency_code), + 'base_tax_amount' => $this->base_tax_amount, + 'formated_base_tax_amount' => core()->formatBasePrice($this->base_tax_amount), + 'discount_percent' => $this->discount_percent, + 'discount_amount' => $this->discount_amount, + 'formated_discount_amount' => core()->formatPrice($this->discount_amount, $this->cart->cart_currency_code), + 'base_discount_amount' => $this->base_discount_amount, 'formated_base_discount_amount' => core()->formatBasePrice($this->base_discount_amount), - 'additional' => is_array($this->resource->additional) - ? $this->resource->additional - : json_decode($this->resource->additional, true), - 'child' => new self($this->child), - 'product' => $this->when($this->product_id, new ProductResource($this->product)), - 'created_at' => $this->created_at, - 'updated_at' => $this->updated_at, + 'additional' => is_array($this->resource->additional) + ? $this->resource->additional + : json_decode($this->resource->additional, true), + 'child' => new self($this->child), + 'product' => $this->when($this->product_id, new ProductResource($this->product)), + 'created_at' => $this->created_at, + 'updated_at' => $this->updated_at, ]; } } \ No newline at end of file diff --git a/packages/Webkul/API/Http/Resources/Checkout/CartPayment.php b/packages/Webkul/API/Http/Resources/Checkout/CartPayment.php index 8ab0c28ac..530144708 100644 --- a/packages/Webkul/API/Http/Resources/Checkout/CartPayment.php +++ b/packages/Webkul/API/Http/Resources/Checkout/CartPayment.php @@ -15,11 +15,11 @@ class CartPayment extends JsonResource public function toArray($request) { return [ - 'id' => $this->id, - 'method' => $this->method, + 'id' => $this->id, + 'method' => $this->method, 'method_title' => core()->getConfigData('sales.paymentmethods.' . $this->method . '.title'), - 'created_at' => $this->created_at, - 'updated_at' => $this->updated_at + 'created_at' => $this->created_at, + 'updated_at' => $this->updated_at ]; } } \ No newline at end of file diff --git a/packages/Webkul/API/Http/Resources/Checkout/CartShippingRate.php b/packages/Webkul/API/Http/Resources/Checkout/CartShippingRate.php index 370697be5..bb0204672 100644 --- a/packages/Webkul/API/Http/Resources/Checkout/CartShippingRate.php +++ b/packages/Webkul/API/Http/Resources/Checkout/CartShippingRate.php @@ -18,18 +18,18 @@ class CartShippingRate extends JsonResource $cart = Cart::getCart(); return [ - 'id' => $this->id, - 'carrier' => $this->carrier, - 'carrier_title' => $this->carrier_title, - 'method' => $this->method, - 'method_title' => $this->method_title, - 'method_description' => $this->method_description, - 'price' => $this->price, - 'formated_price' => core()->formatPrice($this->price, $cart->cart_currency_code), - 'base_price' => $this->base_price, + 'id' => $this->id, + 'carrier' => $this->carrier, + 'carrier_title' => $this->carrier_title, + 'method' => $this->method, + 'method_title' => $this->method_title, + 'method_description' => $this->method_description, + 'price' => $this->price, + 'formated_price' => core()->formatPrice($this->price, $cart->cart_currency_code), + 'base_price' => $this->base_price, 'formated_base_price' => core()->formatBasePrice($this->base_price), - 'created_at' => $this->created_at, - 'updated_at' => $this->updated_at + 'created_at' => $this->created_at, + 'updated_at' => $this->updated_at ]; } } \ No newline at end of file diff --git a/packages/Webkul/API/Http/Resources/Core/Channel.php b/packages/Webkul/API/Http/Resources/Core/Channel.php index e85085ce0..4298e3b44 100644 --- a/packages/Webkul/API/Http/Resources/Core/Channel.php +++ b/packages/Webkul/API/Http/Resources/Core/Channel.php @@ -18,25 +18,25 @@ class Channel extends JsonResource public function toArray($request) { return [ - 'id' => $this->id, - 'code' => $this->code, - 'name' => $this->name, - 'description' => $this->description, - 'timezone' => $this->timezone, - 'theme' => $this->theme, + 'id' => $this->id, + 'code' => $this->code, + 'name' => $this->name, + 'description' => $this->description, + 'timezone' => $this->timezone, + 'theme' => $this->theme, 'home_page_content' => $this->home_page_content, - 'footer_content' => $this->footer_content, - 'hostname' => $this->hostname, - 'logo' => $this->logo, - 'logo_url' => $this->logo_url, - 'favicon' => $this->favicon, - 'favicon_url' => $this->favicon_url, - 'default_locale' => $this->when($this->default_locale_id, new LocaleResource($this->default_locale)), - 'base_currency' => $this->when($this->default_currency_id, new CurrencyResource($this->default_currency)), - 'root_category_id' => $this->root_category_id, - 'root_category' => $this->when($this->root_category_id, new CategoryResource($this->root_category)), - 'created_at' => $this->created_at, - 'updated_at' => $this->updated_at, + 'footer_content' => $this->footer_content, + 'hostname' => $this->hostname, + 'logo' => $this->logo, + 'logo_url' => $this->logo_url, + 'favicon' => $this->favicon, + 'favicon_url' => $this->favicon_url, + 'default_locale' => $this->when($this->default_locale_id, new LocaleResource($this->default_locale)), + 'base_currency' => $this->when($this->default_currency_id, new CurrencyResource($this->default_currency)), + 'root_category_id' => $this->root_category_id, + 'root_category' => $this->when($this->root_category_id, new CategoryResource($this->root_category)), + 'created_at' => $this->created_at, + 'updated_at' => $this->updated_at, ]; } } \ No newline at end of file diff --git a/packages/Webkul/API/Http/Resources/Core/Country.php b/packages/Webkul/API/Http/Resources/Core/Country.php index 46f13f0c1..92c18cb17 100644 --- a/packages/Webkul/API/Http/Resources/Core/Country.php +++ b/packages/Webkul/API/Http/Resources/Core/Country.php @@ -15,7 +15,7 @@ class Country extends JsonResource public function toArray($request) { return [ - 'id' => $this->id, + 'id' => $this->id, 'code' => $this->code, 'name' => $this->name ]; diff --git a/packages/Webkul/API/Http/Resources/Core/Currency.php b/packages/Webkul/API/Http/Resources/Core/Currency.php index 5ef066daa..dd8169ec6 100644 --- a/packages/Webkul/API/Http/Resources/Core/Currency.php +++ b/packages/Webkul/API/Http/Resources/Core/Currency.php @@ -15,9 +15,9 @@ class Currency extends JsonResource public function toArray($request) { return [ - 'id' => $this->id, - 'code' => $this->code, - 'name' => $this->name, + 'id' => $this->id, + 'code' => $this->code, + 'name' => $this->name, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, ]; diff --git a/packages/Webkul/API/Http/Resources/Core/Locale.php b/packages/Webkul/API/Http/Resources/Core/Locale.php index 21e5e4399..9cdd7c8e8 100644 --- a/packages/Webkul/API/Http/Resources/Core/Locale.php +++ b/packages/Webkul/API/Http/Resources/Core/Locale.php @@ -15,9 +15,9 @@ class Locale extends JsonResource public function toArray($request) { return [ - 'id' => $this->id, - 'code' => $this->code, - 'name' => $this->name, + 'id' => $this->id, + 'code' => $this->code, + 'name' => $this->name, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, ]; diff --git a/packages/Webkul/API/Http/Resources/Core/Slider.php b/packages/Webkul/API/Http/Resources/Core/Slider.php index fada15f9b..76bf0fc37 100644 --- a/packages/Webkul/API/Http/Resources/Core/Slider.php +++ b/packages/Webkul/API/Http/Resources/Core/Slider.php @@ -15,10 +15,10 @@ class Slider extends JsonResource public function toArray($request) { return [ - 'id' => $this->id, - 'title' => $this->title, + 'id' => $this->id, + 'title' => $this->title, 'image_url' => $this->image_url, - 'content' => $this->content + 'content' => $this->content ]; } } \ No newline at end of file diff --git a/packages/Webkul/API/Http/Resources/Customer/Customer.php b/packages/Webkul/API/Http/Resources/Customer/Customer.php index 7e7a98485..31f1a3b5f 100644 --- a/packages/Webkul/API/Http/Resources/Customer/Customer.php +++ b/packages/Webkul/API/Http/Resources/Customer/Customer.php @@ -15,18 +15,18 @@ class Customer extends JsonResource public function toArray($request) { return [ - 'id' => $this->id, - 'email' => $this->email, - 'first_name' => $this->first_name, - 'last_name' => $this->last_name, - 'name' => $this->name, - 'gender' => $this->gender, + 'id' => $this->id, + 'email' => $this->email, + 'first_name' => $this->first_name, + 'last_name' => $this->last_name, + 'name' => $this->name, + 'gender' => $this->gender, 'date_of_birth' => $this->date_of_birth, - 'phone' => $this->phone, - 'status' => $this->status, - 'group' => $this->when($this->customer_group_id, new CustomerGroup($this->group)), - 'created_at' => $this->created_at, - 'updated_at' => $this->updated_at, + 'phone' => $this->phone, + 'status' => $this->status, + 'group' => $this->when($this->customer_group_id, new CustomerGroup($this->group)), + 'created_at' => $this->created_at, + 'updated_at' => $this->updated_at, ]; } } \ No newline at end of file diff --git a/packages/Webkul/API/Http/Resources/Customer/CustomerAddress.php b/packages/Webkul/API/Http/Resources/Customer/CustomerAddress.php index 3b792e195..111cdb31c 100644 --- a/packages/Webkul/API/Http/Resources/Customer/CustomerAddress.php +++ b/packages/Webkul/API/Http/Resources/Customer/CustomerAddress.php @@ -15,16 +15,16 @@ class CustomerAddress extends JsonResource public function toArray($request) { return [ - 'id' => $this->id, - 'address1' => explode(PHP_EOL, $this->address1), - 'country' => $this->country, + 'id' => $this->id, + 'address1' => explode(PHP_EOL, $this->address1), + 'country' => $this->country, 'country_name' => core()->country_name($this->country), - 'state' => $this->state, - 'city' => $this->city, - 'postcode' => $this->postcode, - 'phone' => $this->phone, - 'created_at' => $this->created_at, - 'updated_at' => $this->updated_at, + 'state' => $this->state, + 'city' => $this->city, + 'postcode' => $this->postcode, + 'phone' => $this->phone, + 'created_at' => $this->created_at, + 'updated_at' => $this->updated_at, ]; } } \ No newline at end of file diff --git a/packages/Webkul/API/Http/Resources/Customer/CustomerGroup.php b/packages/Webkul/API/Http/Resources/Customer/CustomerGroup.php index 80765deb2..fdda10af0 100644 --- a/packages/Webkul/API/Http/Resources/Customer/CustomerGroup.php +++ b/packages/Webkul/API/Http/Resources/Customer/CustomerGroup.php @@ -15,8 +15,8 @@ class CustomerGroup extends JsonResource public function toArray($request) { return [ - 'id' => $this->id, - 'name' => $this->name, + 'id' => $this->id, + 'name' => $this->name, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, ]; diff --git a/packages/Webkul/API/Http/Resources/Customer/Wishlist.php b/packages/Webkul/API/Http/Resources/Customer/Wishlist.php index 75b04de44..809f75da3 100644 --- a/packages/Webkul/API/Http/Resources/Customer/Wishlist.php +++ b/packages/Webkul/API/Http/Resources/Customer/Wishlist.php @@ -16,8 +16,8 @@ class Wishlist extends JsonResource public function toArray($request) { return [ - 'id' => $this->id, - 'product' => new ProductResource($this->product), + 'id' => $this->id, + 'product' => new ProductResource($this->product), 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, ]; diff --git a/packages/Webkul/API/Http/Resources/Inventory/InventorySource.php b/packages/Webkul/API/Http/Resources/Inventory/InventorySource.php index fab464195..dcb8a4b23 100644 --- a/packages/Webkul/API/Http/Resources/Inventory/InventorySource.php +++ b/packages/Webkul/API/Http/Resources/Inventory/InventorySource.php @@ -15,25 +15,25 @@ class InventorySource extends JsonResource public function toArray($request) { return [ - 'id' => $this->id, - 'code' => $this->code, - 'name' => $this->name, - 'description' => $this->description, - 'contact_name' => $this->contact_name, - 'contact_email' => $this->contact_email, + 'id' => $this->id, + 'code' => $this->code, + 'name' => $this->name, + 'description' => $this->description, + 'contact_name' => $this->contact_name, + 'contact_email' => $this->contact_email, 'contact_number' => $this->contact_number, - 'contact_fax' => $this->contact_fax, - 'country' => $this->country, - 'state' => $this->state, - 'city' => $this->city, - 'street' => $this->street, - 'postcode' => $this->postcode, - 'priority' => $this->priority, - 'latitude' => $this->latitude, - 'longitude' => $this->collongitudeongitudeuntry, - 'status' => $this->status, - 'created_at' => $this->created_at, - 'updated_at' => $this->updated_at, + 'contact_fax' => $this->contact_fax, + 'country' => $this->country, + 'state' => $this->state, + 'city' => $this->city, + 'street' => $this->street, + 'postcode' => $this->postcode, + 'priority' => $this->priority, + 'latitude' => $this->latitude, + 'longitude' => $this->collongitudeongitudeuntry, + 'status' => $this->status, + 'created_at' => $this->created_at, + 'updated_at' => $this->updated_at ]; } } \ No newline at end of file diff --git a/packages/Webkul/API/Http/Resources/Sales/Invoice.php b/packages/Webkul/API/Http/Resources/Sales/Invoice.php index 239056f25..8c5a8dcc2 100644 --- a/packages/Webkul/API/Http/Resources/Sales/Invoice.php +++ b/packages/Webkul/API/Http/Resources/Sales/Invoice.php @@ -15,37 +15,37 @@ class Invoice extends JsonResource public function toArray($request) { return [ - 'id' => $this->id, - 'state' => $this->state, - 'email_sent' => $this->email_sent, - 'total_qty' => $this->total_qty, - 'base_currency_code' => $this->base_currency_code, - 'channel_currency_code' => $this->channel_currency_code, - 'order_currency_code' => $this->order_currency_code, - 'sub_total' => $this->sub_total, - 'formated_sub_total' => core()->formatPrice($this->sub_total, $this->order_currency_code), - 'base_sub_total' => $this->base_sub_total, - 'formated_base_sub_total' => core()->formatBasePrice($this->base_sub_total), - 'grand_total' => $this->grand_total, - 'formated_grand_total' => core()->formatPrice($this->grand_total, $this->order_currency_code), - 'base_grand_total' => $this->base_grand_total, - 'formated_base_grand_total' => core()->formatBasePrice($this->base_grand_total), - 'shipping_amount' => $this->shipping_amount, - 'formated_shipping_amount' => core()->formatPrice($this->shipping_amount, $this->order_currency_code), - 'base_shipping_amount' => $this->base_shipping_amount, + 'id' => $this->id, + 'state' => $this->state, + 'email_sent' => $this->email_sent, + 'total_qty' => $this->total_qty, + 'base_currency_code' => $this->base_currency_code, + 'channel_currency_code' => $this->channel_currency_code, + 'order_currency_code' => $this->order_currency_code, + 'sub_total' => $this->sub_total, + 'formated_sub_total' => core()->formatPrice($this->sub_total, $this->order_currency_code), + 'base_sub_total' => $this->base_sub_total, + 'formated_base_sub_total' => core()->formatBasePrice($this->base_sub_total), + 'grand_total' => $this->grand_total, + 'formated_grand_total' => core()->formatPrice($this->grand_total, $this->order_currency_code), + 'base_grand_total' => $this->base_grand_total, + 'formated_base_grand_total' => core()->formatBasePrice($this->base_grand_total), + 'shipping_amount' => $this->shipping_amount, + 'formated_shipping_amount' => core()->formatPrice($this->shipping_amount, $this->order_currency_code), + 'base_shipping_amount' => $this->base_shipping_amount, 'formated_base_shipping_amount' => core()->formatBasePrice($this->base_shipping_amount), - 'tax_amount' => $this->tax_amount, - 'formated_tax_amount' => core()->formatPrice($this->tax_amount, $this->order_currency_code), - 'base_tax_amount' => $this->base_tax_amount, - 'formated_base_tax_amount' => core()->formatBasePrice($this->base_tax_amount), - 'discount_amount' => $this->discount_amount, - 'formated_discount_amount' => core()->formatPrice($this->discount_amount, $this->order_currency_code), - 'base_discount_amount' => $this->base_discount_amount, + 'tax_amount' => $this->tax_amount, + 'formated_tax_amount' => core()->formatPrice($this->tax_amount, $this->order_currency_code), + 'base_tax_amount' => $this->base_tax_amount, + 'formated_base_tax_amount' => core()->formatBasePrice($this->base_tax_amount), + 'discount_amount' => $this->discount_amount, + 'formated_discount_amount' => core()->formatPrice($this->discount_amount, $this->order_currency_code), + 'base_discount_amount' => $this->base_discount_amount, 'formated_base_discount_amount' => core()->formatBasePrice($this->base_discount_amount), - 'order_address' => new OrderAddress($this->address), - 'transaction_id' => $this->transaction_id, - 'items' => InvoiceItem::collection($this->items), - 'created_at' => $this->created_at + 'order_address' => new OrderAddress($this->address), + 'transaction_id' => $this->transaction_id, + 'items' => InvoiceItem::collection($this->items), + 'created_at' => $this->created_at ]; } } \ No newline at end of file diff --git a/packages/Webkul/API/Http/Resources/Sales/InvoiceItem.php b/packages/Webkul/API/Http/Resources/Sales/InvoiceItem.php index c5fd3d09b..bfdd0d7d3 100644 --- a/packages/Webkul/API/Http/Resources/Sales/InvoiceItem.php +++ b/packages/Webkul/API/Http/Resources/Sales/InvoiceItem.php @@ -15,34 +15,34 @@ class InvoiceItem extends JsonResource public function toArray($request) { return [ - 'id' => $this->id, - 'name' => $this->name, - // 'product' => $this->when($this->product, new ProductResource($this->product)), - 'description' => $this->description, - 'sku' => $this->sku, - 'description' => $this->description, - 'qty' => $this->qty, - 'price' => $this->price, - 'formated_price' => core()->formatPrice($this->price, $this->invoice->order_currency_code), - 'base_price' => $this->base_price, - 'formated_base_price' => core()->formatBasePrice($this->base_price), - 'total' => $this->total, - 'formated_total' => core()->formatPrice($this->total, $this->invoice->order_currency_code), - 'base_total' => $this->base_total, - 'formated_base_total' => core()->formatBasePrice($this->base_total), - 'tax_amount' => $this->tax_amount, - 'formated_tax_amount' => core()->formatPrice($this->tax_amount, $this->invoice->order_currency_code), - 'base_tax_amount' => $this->base_tax_amount, - 'formated_base_tax_amount' => core()->formatBasePrice($this->base_tax_amount), - 'grand_total' => $this->total + $this->tax_amount, - 'formated_grand_total' => core()->formatPrice($this->total + $this->tax_amount, $this->invoice->order_currency_code), - 'base_grand_total' => $this->base_total + $this->base_tax_amount, + 'id' => $this->id, + 'name' => $this->name, + // 'product' => $this->when($this->product, new ProductResource($this->product)), + 'description' => $this->description, + 'sku' => $this->sku, + 'description' => $this->description, + 'qty' => $this->qty, + 'price' => $this->price, + 'formated_price' => core()->formatPrice($this->price, $this->invoice->order_currency_code), + 'base_price' => $this->base_price, + 'formated_base_price' => core()->formatBasePrice($this->base_price), + 'total' => $this->total, + 'formated_total' => core()->formatPrice($this->total, $this->invoice->order_currency_code), + 'base_total' => $this->base_total, + 'formated_base_total' => core()->formatBasePrice($this->base_total), + 'tax_amount' => $this->tax_amount, + 'formated_tax_amount' => core()->formatPrice($this->tax_amount, $this->invoice->order_currency_code), + 'base_tax_amount' => $this->base_tax_amount, + 'formated_base_tax_amount' => core()->formatBasePrice($this->base_tax_amount), + 'grand_total' => $this->total + $this->tax_amount, + 'formated_grand_total' => core()->formatPrice($this->total + $this->tax_amount, $this->invoice->order_currency_code), + 'base_grand_total' => $this->base_total + $this->base_tax_amount, 'formated_base_grand_total' => core()->formatBasePrice($this->base_total + $this->base_tax_amount), - 'additional' => is_array($this->resource->additional) - ? $this->resource->additional - : json_decode($this->resource->additional, true), - 'child' => new self($this->child), - 'children' => Self::collection($this->children) + 'additional' => is_array($this->resource->additional) + ? $this->resource->additional + : json_decode($this->resource->additional, true), + 'child' => new self($this->child), + 'children' => Self::collection($this->children) ]; } } \ No newline at end of file diff --git a/packages/Webkul/API/Http/Resources/Sales/OrderAddress.php b/packages/Webkul/API/Http/Resources/Sales/OrderAddress.php index bb18a5a6a..78e3db345 100644 --- a/packages/Webkul/API/Http/Resources/Sales/OrderAddress.php +++ b/packages/Webkul/API/Http/Resources/Sales/OrderAddress.php @@ -15,19 +15,19 @@ class OrderAddress extends JsonResource public function toArray($request) { return [ - 'id' => $this->id, - 'email' => $this->email, - 'first_name' => $this->first_name, - 'last_name' => $this->last_name, - 'address1' => explode(PHP_EOL, $this->address1), - 'country' => $this->country, + 'id' => $this->id, + 'email' => $this->email, + 'first_name' => $this->first_name, + 'last_name' => $this->last_name, + 'address1' => explode(PHP_EOL, $this->address1), + 'country' => $this->country, 'country_name' => core()->country_name($this->country), - 'state' => $this->state, - 'city' => $this->city, - 'postcode' => $this->postcode, - 'phone' => $this->phone, - 'created_at' => $this->created_at, - 'updated_at' => $this->updated_at, + 'state' => $this->state, + 'city' => $this->city, + 'postcode' => $this->postcode, + 'phone' => $this->phone, + 'created_at' => $this->created_at, + 'updated_at' => $this->updated_at, ]; } } \ No newline at end of file diff --git a/packages/Webkul/API/Http/Resources/Sales/OrderItem.php b/packages/Webkul/API/Http/Resources/Sales/OrderItem.php index a6420b480..f7eb3b8cb 100644 --- a/packages/Webkul/API/Http/Resources/Sales/OrderItem.php +++ b/packages/Webkul/API/Http/Resources/Sales/OrderItem.php @@ -16,70 +16,70 @@ class OrderItem extends JsonResource public function toArray($request) { return [ - 'id' => $this->id, - 'sku' => $this->sku, - 'type' => $this->type, - 'name' => $this->name, - 'product' => $this->when($this->product, new ProductResource($this->product)), - 'coupon_code' => $this->coupon_code, - 'weight' => $this->weight, - 'total_weight' => $this->total_weight, - 'qty_ordered' => $this->qty_ordered, - 'qty_canceled' => $this->qty_canceled, - 'qty_invoiced' => $this->qty_invoiced, - 'qty_shipped' => $this->qty_shipped, - 'qty_refunded' => $this->qty_refunded, - 'price' => $this->price, - 'formated_price' => core()->formatPrice($this->price, $this->order->order_currency_code), - 'base_price' => $this->base_price, - 'formated_base_price' => core()->formatBasePrice($this->base_price), - 'total' => $this->total, - 'formated_total' => core()->formatPrice($this->total, $this->order->order_currency_code), - 'base_total' => $this->base_total, - 'formated_base_total' => core()->formatBasePrice($this->base_total), - 'total_invoiced' => $this->total_invoiced, - 'formated_total_invoiced' => core()->formatPrice($this->total_invoiced, $this->order->order_currency_code), - 'base_total_invoiced' => $this->base_total_invoiced, - 'formated_base_total_invoiced' => core()->formatBasePrice($this->base_total_invoiced), - 'amount_refunded' => $this->amount_refunded, - 'formated_amount_refunded' => core()->formatPrice($this->amount_refunded, $this->order->order_currency_code), - 'base_amount_refunded' => $this->base_amount_refunded, - 'formated_base_amount_refunded' => core()->formatBasePrice($this->base_amount_refunded), - 'discount_percent' => $this->discount_percent, - 'discount_amount' => $this->discount_amount, - 'formated_discount_amount' => core()->formatPrice($this->discount_amount, $this->order->order_currency_code), - 'base_discount_amount' => $this->base_discount_amount, - 'formated_base_discount_amount' => core()->formatBasePrice($this->base_discount_amount), - 'discount_invoiced' => $this->discount_invoiced, - 'formated_discount_invoiced' => core()->formatPrice($this->discount_invoiced, $this->order->order_currency_code), - 'base_discount_invoiced' => $this->base_discount_invoiced, - 'formated_base_discount_invoiced' => core()->formatBasePrice($this->base_discount_invoiced), - 'discount_refunded' => $this->discount_refunded, - 'formated_discount_refunded' => core()->formatPrice($this->discount_refunded, $this->order->order_currency_code), - 'base_discount_refunded' => $this->base_discount_refunded, - 'formated_base_discount_refunded' => core()->formatBasePrice($this->base_discount_refunded), - 'tax_percent' => $this->tax_percent, - 'tax_amount' => $this->tax_amount, - 'formated_tax_amount' => core()->formatPrice($this->tax_amount, $this->order->order_currency_code), - 'base_tax_amount' => $this->base_tax_amount, - 'formated_base_tax_amount' => core()->formatBasePrice($this->base_tax_amount), - 'tax_amount_invoiced' => $this->tax_amount_invoiced, - 'formated_tax_amount_invoiced' => core()->formatPrice($this->tax_amount_invoiced, $this->order->order_currency_code), - 'base_tax_amount_invoiced' => $this->base_tax_amount_invoiced, + 'id' => $this->id, + 'sku' => $this->sku, + 'type' => $this->type, + 'name' => $this->name, + 'product' => $this->when($this->product, new ProductResource($this->product)), + 'coupon_code' => $this->coupon_code, + 'weight' => $this->weight, + 'total_weight' => $this->total_weight, + 'qty_ordered' => $this->qty_ordered, + 'qty_canceled' => $this->qty_canceled, + 'qty_invoiced' => $this->qty_invoiced, + 'qty_shipped' => $this->qty_shipped, + 'qty_refunded' => $this->qty_refunded, + 'price' => $this->price, + 'formated_price' => core()->formatPrice($this->price, $this->order->order_currency_code), + 'base_price' => $this->base_price, + 'formated_base_price' => core()->formatBasePrice($this->base_price), + 'total' => $this->total, + 'formated_total' => core()->formatPrice($this->total, $this->order->order_currency_code), + 'base_total' => $this->base_total, + 'formated_base_total' => core()->formatBasePrice($this->base_total), + 'total_invoiced' => $this->total_invoiced, + 'formated_total_invoiced' => core()->formatPrice($this->total_invoiced, $this->order->order_currency_code), + 'base_total_invoiced' => $this->base_total_invoiced, + 'formated_base_total_invoiced' => core()->formatBasePrice($this->base_total_invoiced), + 'amount_refunded' => $this->amount_refunded, + 'formated_amount_refunded' => core()->formatPrice($this->amount_refunded, $this->order->order_currency_code), + 'base_amount_refunded' => $this->base_amount_refunded, + 'formated_base_amount_refunded' => core()->formatBasePrice($this->base_amount_refunded), + 'discount_percent' => $this->discount_percent, + 'discount_amount' => $this->discount_amount, + 'formated_discount_amount' => core()->formatPrice($this->discount_amount, $this->order->order_currency_code), + 'base_discount_amount' => $this->base_discount_amount, + 'formated_base_discount_amount' => core()->formatBasePrice($this->base_discount_amount), + 'discount_invoiced' => $this->discount_invoiced, + 'formated_discount_invoiced' => core()->formatPrice($this->discount_invoiced, $this->order->order_currency_code), + 'base_discount_invoiced' => $this->base_discount_invoiced, + 'formated_base_discount_invoiced' => core()->formatBasePrice($this->base_discount_invoiced), + 'discount_refunded' => $this->discount_refunded, + 'formated_discount_refunded' => core()->formatPrice($this->discount_refunded, $this->order->order_currency_code), + 'base_discount_refunded' => $this->base_discount_refunded, + 'formated_base_discount_refunded' => core()->formatBasePrice($this->base_discount_refunded), + 'tax_percent' => $this->tax_percent, + 'tax_amount' => $this->tax_amount, + 'formated_tax_amount' => core()->formatPrice($this->tax_amount, $this->order->order_currency_code), + 'base_tax_amount' => $this->base_tax_amount, + 'formated_base_tax_amount' => core()->formatBasePrice($this->base_tax_amount), + 'tax_amount_invoiced' => $this->tax_amount_invoiced, + 'formated_tax_amount_invoiced' => core()->formatPrice($this->tax_amount_invoiced, $this->order->order_currency_code), + 'base_tax_amount_invoiced' => $this->base_tax_amount_invoiced, 'formated_base_tax_amount_invoiced' => core()->formatBasePrice($this->base_tax_amount_invoiced), - 'tax_amount_refunded' => $this->tax_amount_refunded, - 'formated_tax_amount_refunded' => core()->formatPrice($this->tax_amount_refunded, $this->order->order_currency_code), - 'base_tax_amount_refunded' => $this->base_tax_amount_refunded, + 'tax_amount_refunded' => $this->tax_amount_refunded, + 'formated_tax_amount_refunded' => core()->formatPrice($this->tax_amount_refunded, $this->order->order_currency_code), + 'base_tax_amount_refunded' => $this->base_tax_amount_refunded, 'formated_base_tax_amount_refunded' => core()->formatBasePrice($this->base_tax_amount_refunded), - 'grant_total' => $this->total + $this->tax_amount, - 'formated_grant_total' => core()->formatPrice($this->total + $this->tax_amount, $this->order->order_currency_code), - 'base_grant_total' => $this->base_total + $this->base_tax_amount, - 'formated_base_grant_total' => core()->formatPrice($this->base_total + $this->base_tax_amount, $this->order->order_currency_code), - 'additional' => is_array($this->resource->additional) - ? $this->resource->additional - : json_decode($this->resource->additional, true), - 'child' => new self($this->child), - 'children' => Self::collection($this->children) + 'grant_total' => $this->total + $this->tax_amount, + 'formated_grant_total' => core()->formatPrice($this->total + $this->tax_amount, $this->order->order_currency_code), + 'base_grant_total' => $this->base_total + $this->base_tax_amount, + 'formated_base_grant_total' => core()->formatPrice($this->base_total + $this->base_tax_amount, $this->order->order_currency_code), + 'additional' => is_array($this->resource->additional) + ? $this->resource->additional + : json_decode($this->resource->additional, true), + 'child' => new self($this->child), + 'children' => Self::collection($this->children) ]; } } \ No newline at end of file diff --git a/packages/Webkul/API/Http/Resources/Sales/Shipment.php b/packages/Webkul/API/Http/Resources/Sales/Shipment.php index 6e9df69b1..74aade44a 100644 --- a/packages/Webkul/API/Http/Resources/Sales/Shipment.php +++ b/packages/Webkul/API/Http/Resources/Sales/Shipment.php @@ -17,17 +17,17 @@ class Shipment extends JsonResource public function toArray($request) { return [ - 'id' => $this->id, - 'status' => $this->status, - 'total_qty' => $this->total_qty, - 'total_weight' => $this->total_weight, - 'carrier_code' => $this->carrier_code, - 'carrier_title' => $this->carrier_title, - 'track_number' => $this->track_number, - 'email_sent' => $this->email_sent, - 'customer' => $this->when($this->customer_id, new CustomerResource($this->customer)), + 'id' => $this->id, + 'status' => $this->status, + 'total_qty' => $this->total_qty, + 'total_weight' => $this->total_weight, + 'carrier_code' => $this->carrier_code, + 'carrier_title' => $this->carrier_title, + 'track_number' => $this->track_number, + 'email_sent' => $this->email_sent, + 'customer' => $this->when($this->customer_id, new CustomerResource($this->customer)), 'inventory_source' => $this->when($this->inventory_source_id, new InventorySourceResource($this->inventory_source)), - 'items' => ShipmentItem::collection($this->items), + 'items' => ShipmentItem::collection($this->items), ]; } } \ No newline at end of file diff --git a/packages/Webkul/API/Http/Resources/Sales/ShipmentItem.php b/packages/Webkul/API/Http/Resources/Sales/ShipmentItem.php index 678af6d6f..da57b0358 100644 --- a/packages/Webkul/API/Http/Resources/Sales/ShipmentItem.php +++ b/packages/Webkul/API/Http/Resources/Sales/ShipmentItem.php @@ -15,23 +15,23 @@ class ShipmentItem extends JsonResource public function toArray($request) { return [ - 'id' => $this->id, - 'name' => $this->name, - 'description' => $this->description, - 'sku' => $this->sku, - 'qty' => $this->qty, - 'weight' => $this->weight, - 'price' => $this->price, - 'formated_price' => core()->formatPrice($this->price, $this->shipment->order->order_currency_code), - 'base_price' => $this->base_price, + 'id' => $this->id, + 'name' => $this->name, + 'description' => $this->description, + 'sku' => $this->sku, + 'qty' => $this->qty, + 'weight' => $this->weight, + 'price' => $this->price, + 'formated_price' => core()->formatPrice($this->price, $this->shipment->order->order_currency_code), + 'base_price' => $this->base_price, 'formated_base_price' => core()->formatBasePrice($this->base_price), - 'total' => $this->total, - 'formated_total' => core()->formatPrice($this->total, $this->shipment->order->order_currency_code), - 'base_total' => $this->base_total, + 'total' => $this->total, + 'formated_total' => core()->formatPrice($this->total, $this->shipment->order->order_currency_code), + 'base_total' => $this->base_total, 'formated_base_total' => core()->formatBasePrice($this->base_total), - 'additional' => is_array($this->resource->additional) - ? $this->resource->additional - : json_decode($this->resource->additional, true) + 'additional' => is_array($this->resource->additional) + ? $this->resource->additional + : json_decode($this->resource->additional, true) ]; } } \ No newline at end of file diff --git a/packages/Webkul/Admin/src/Config/acl.php b/packages/Webkul/Admin/src/Config/acl.php index 8b28872db..da1c7d9dd 100755 --- a/packages/Webkul/Admin/src/Config/acl.php +++ b/packages/Webkul/Admin/src/Config/acl.php @@ -2,420 +2,420 @@ return [ [ - 'key' => 'dashboard', - 'name' => 'admin::app.acl.dashboard', + 'key' => 'dashboard', + 'name' => 'admin::app.acl.dashboard', 'route' => 'admin.dashboard.index', - 'sort' => 1 + 'sort' => 1, ], [ - 'key' => 'sales', - 'name' => 'admin::app.acl.sales', + 'key' => 'sales', + 'name' => 'admin::app.acl.sales', 'route' => 'admin.sales.orders.index', - 'sort' => 2 + 'sort' => 2, ], [ - 'key' => 'sales.orders', - 'name' => 'admin::app.acl.orders', + 'key' => 'sales.orders', + 'name' => 'admin::app.acl.orders', 'route' => 'admin.sales.orders.index', - 'sort' => 1 + 'sort' => 1, ], [ - 'key' => 'sales.invoices', - 'name' => 'admin::app.acl.invoices', + 'key' => 'sales.invoices', + 'name' => 'admin::app.acl.invoices', 'route' => 'admin.sales.invoices.index', - 'sort' => 2 + 'sort' => 2, ], [ - 'key' => 'sales.shipments', - 'name' => 'admin::app.acl.shipments', + 'key' => 'sales.shipments', + 'name' => 'admin::app.acl.shipments', 'route' => 'admin.sales.shipments.index', - 'sort' => 3 + 'sort' => 3, ], [ - 'key' => 'catalog', - 'name' => 'admin::app.acl.catalog', + 'key' => 'catalog', + 'name' => 'admin::app.acl.catalog', 'route' => 'admin.catalog.index', - 'sort' => 3 + 'sort' => 3, ], [ - 'key' => 'catalog.products', - 'name' => 'admin::app.acl.products', + 'key' => 'catalog.products', + 'name' => 'admin::app.acl.products', 'route' => 'admin.catalog.products.index', - 'sort' => 1 + 'sort' => 1, ], [ - 'key' => 'catalog.products.create', - 'name' => 'admin::app.acl.create', + 'key' => 'catalog.products.create', + 'name' => 'admin::app.acl.create', 'route' => 'admin.catalog.products.create', - 'sort' => 1 + 'sort' => 1, ], [ - 'key' => 'catalog.products.edit', - 'name' => 'admin::app.acl.edit', + 'key' => 'catalog.products.edit', + 'name' => 'admin::app.acl.edit', 'route' => 'admin.catalog.products.edit', - 'sort' => 2 + 'sort' => 2, ], [ - 'key' => 'catalog.products.delete', - 'name' => 'admin::app.acl.delete', + 'key' => 'catalog.products.delete', + 'name' => 'admin::app.acl.delete', 'route' => 'admin.catalog.products.delete', - 'sort' => 3 + 'sort' => 3, ], [ - 'key' => 'catalog.categories', - 'name' => 'admin::app.acl.categories', + 'key' => 'catalog.categories', + 'name' => 'admin::app.acl.categories', 'route' => 'admin.catalog.categories.index', - 'sort' => 2 + 'sort' => 2, ], [ - 'key' => 'catalog.categories.create', - 'name' => 'admin::app.acl.create', + 'key' => 'catalog.categories.create', + 'name' => 'admin::app.acl.create', 'route' => 'admin.catalog.categories.create', - 'sort' => 1 + 'sort' => 1, ], [ - 'key' => 'catalog.categories.edit', - 'name' => 'admin::app.acl.edit', + 'key' => 'catalog.categories.edit', + 'name' => 'admin::app.acl.edit', 'route' => 'admin.catalog.categories.edit', - 'sort' => 2 + 'sort' => 2, ], [ - 'key' => 'catalog.categories.delete', - 'name' => 'admin::app.acl.delete', + 'key' => 'catalog.categories.delete', + 'name' => 'admin::app.acl.delete', 'route' => 'admin.catalog.categories.delete', - 'sort' => 3 + 'sort' => 3, ], [ - 'key' => 'catalog.attributes', - 'name' => 'admin::app.acl.attributes', + 'key' => 'catalog.attributes', + 'name' => 'admin::app.acl.attributes', 'route' => 'admin.catalog.attributes.index', - 'sort' => 3 + 'sort' => 3, ], [ - 'key' => 'catalog.attributes.create', - 'name' => 'admin::app.acl.create', + 'key' => 'catalog.attributes.create', + 'name' => 'admin::app.acl.create', 'route' => 'admin.catalog.attributes.create', - 'sort' => 1 + 'sort' => 1, ], [ - 'key' => 'catalog.attributes.edit', - 'name' => 'admin::app.acl.edit', + 'key' => 'catalog.attributes.edit', + 'name' => 'admin::app.acl.edit', 'route' => 'admin.catalog.attributes.edit', - 'sort' => 2 + 'sort' => 2, ], [ - 'key' => 'catalog.attributes.delete', - 'name' => 'admin::app.acl.delete', + 'key' => 'catalog.attributes.delete', + 'name' => 'admin::app.acl.delete', 'route' => 'admin.catalog.attributes.delete', - 'sort' => 3 + 'sort' => 3, ], [ - 'key' => 'catalog.families', - 'name' => 'admin::app.acl.attribute-families', + 'key' => 'catalog.families', + 'name' => 'admin::app.acl.attribute-families', 'route' => 'admin.catalog.families.index', - 'sort' => 4 + 'sort' => 4, ], [ - 'key' => 'catalog.families.create', - 'name' => 'admin::app.acl.create', + 'key' => 'catalog.families.create', + 'name' => 'admin::app.acl.create', 'route' => 'admin.catalog.families.create', - 'sort' => 1 + 'sort' => 1, ], [ - 'key' => 'catalog.families.edit', - 'name' => 'admin::app.acl.edit', + 'key' => 'catalog.families.edit', + 'name' => 'admin::app.acl.edit', 'route' => 'admin.catalog.families.edit', - 'sort' => 2 + 'sort' => 2, ], [ - 'key' => 'catalog.families.delete', - 'name' => 'admin::app.acl.delete', + 'key' => 'catalog.families.delete', + 'name' => 'admin::app.acl.delete', 'route' => 'admin.catalog.families.delete', - 'sort' => 3 + 'sort' => 3, ], [ - 'key' => 'customers', - 'name' => 'admin::app.acl.customers', + 'key' => 'customers', + 'name' => 'admin::app.acl.customers', 'route' => 'admin.customer.index', - 'sort' => 4 + 'sort' => 4, ], [ - 'key' => 'customers.customers', - 'name' => 'admin::app.acl.customers', + 'key' => 'customers.customers', + 'name' => 'admin::app.acl.customers', 'route' => 'admin.customer.index', - 'sort' => 1 + 'sort' => 1, ], [ - 'key' => 'customers.customers.create', - 'name' => 'admin::app.acl.create', + 'key' => 'customers.customers.create', + 'name' => 'admin::app.acl.create', 'route' => 'admin.customer.create', - 'sort' => 1 + 'sort' => 1, ], [ - 'key' => 'customers.customers.edit', - 'name' => 'admin::app.acl.edit', + 'key' => 'customers.customers.edit', + 'name' => 'admin::app.acl.edit', 'route' => 'admin.customer.edit', - 'sort' => 2 + 'sort' => 2, ], [ - 'key' => 'customers.customers.delete', - 'name' => 'admin::app.acl.delete', + 'key' => 'customers.customers.delete', + 'name' => 'admin::app.acl.delete', 'route' => 'admin.customer.delete', - 'sort' => 3 + 'sort' => 3, ], [ - 'key' => 'customers.groups', - 'name' => 'admin::app.acl.groups', + 'key' => 'customers.groups', + 'name' => 'admin::app.acl.groups', 'route' => 'admin.groups.index', - 'sort' => 2 + 'sort' => 2, ], [ - 'key' => 'customers.groups.create', - 'name' => 'admin::app.acl.create', + 'key' => 'customers.groups.create', + 'name' => 'admin::app.acl.create', 'route' => 'admin.groups.create', - 'sort' => 1 + 'sort' => 1, ], [ - 'key' => 'customers.groups.edit', - 'name' => 'admin::app.acl.edit', + 'key' => 'customers.groups.edit', + 'name' => 'admin::app.acl.edit', 'route' => 'admin.groups.edit', - 'sort' => 2 + 'sort' => 2, ], [ - 'key' => 'customers.groups.delete', - 'name' => 'admin::app.acl.delete', + 'key' => 'customers.groups.delete', + 'name' => 'admin::app.acl.delete', 'route' => 'admin.groups.delete', - 'sort' => 3 + 'sort' => 3, ], [ - 'key' => 'customers.reviews', - 'name' => 'admin::app.acl.reviews', + 'key' => 'customers.reviews', + 'name' => 'admin::app.acl.reviews', 'route' => 'admin.customer.review.index', - 'sort' => 3 + 'sort' => 3, ], [ - 'key' => 'customers.reviews.edit', - 'name' => 'admin::app.acl.edit', + 'key' => 'customers.reviews.edit', + 'name' => 'admin::app.acl.edit', 'route' => 'admin.customer.review.edit', - 'sort' => 1 + 'sort' => 1, ], [ - 'key' => 'customers.reviews.delete', - 'name' => 'admin::app.acl.delete', + 'key' => 'customers.reviews.delete', + 'name' => 'admin::app.acl.delete', 'route' => 'admin.customer.review.delete', - 'sort' => 2 + 'sort' => 2, ], [ - 'key' => 'configuration', - 'name' => 'admin::app.acl.configure', + 'key' => 'configuration', + 'name' => 'admin::app.acl.configure', 'route' => 'admin.configuration.index', - 'sort' => 5 + 'sort' => 5, ], [ - 'key' => 'settings', - 'name' => 'admin::app.acl.settings', + 'key' => 'settings', + 'name' => 'admin::app.acl.settings', 'route' => 'admin.users.index', - 'sort' => 6 + 'sort' => 6, ], [ - 'key' => 'settings.locales', - 'name' => 'admin::app.acl.locales', + 'key' => 'settings.locales', + 'name' => 'admin::app.acl.locales', 'route' => 'admin.locales.index', - 'sort' => 1 + 'sort' => 1, ], [ - 'key' => 'settings.locales.create', - 'name' => 'admin::app.acl.create', + 'key' => 'settings.locales.create', + 'name' => 'admin::app.acl.create', 'route' => 'admin.locales.create', - 'sort' => 1 + 'sort' => 1, ], [ - 'key' => 'settings.locales.edit', - 'name' => 'admin::app.acl.edit', + 'key' => 'settings.locales.edit', + 'name' => 'admin::app.acl.edit', 'route' => 'admin.locales.edit', - 'sort' => 2 + 'sort' => 2, ], [ - 'key' => 'settings.locales.delete', - 'name' => 'admin::app.acl.delete', + 'key' => 'settings.locales.delete', + 'name' => 'admin::app.acl.delete', 'route' => 'admin.locales.delete', - 'sort' => 3 + 'sort' => 3, ], [ - 'key' => 'settings.currencies', - 'name' => 'admin::app.acl.currencies', + 'key' => 'settings.currencies', + 'name' => 'admin::app.acl.currencies', 'route' => 'admin.currencies.index', - 'sort' => 2 + 'sort' => 2, ], [ - 'key' => 'settings.currencies.create', - 'name' => 'admin::app.acl.create', + 'key' => 'settings.currencies.create', + 'name' => 'admin::app.acl.create', 'route' => 'admin.currencies.create', - 'sort' => 1 + 'sort' => 1, ], [ - 'key' => 'settings.currencies.edit', - 'name' => 'admin::app.acl.edit', + 'key' => 'settings.currencies.edit', + 'name' => 'admin::app.acl.edit', 'route' => 'admin.currencies.edit', - 'sort' => 2 + 'sort' => 2, ], [ - 'key' => 'settings.currencies.delete', - 'name' => 'admin::app.acl.delete', + 'key' => 'settings.currencies.delete', + 'name' => 'admin::app.acl.delete', 'route' => 'admin.currencies.delete', - 'sort' => 3 + 'sort' => 3, ], [ - 'key' => 'settings.exchange_rates', - 'name' => 'admin::app.acl.exchange-rates', + 'key' => 'settings.exchange_rates', + 'name' => 'admin::app.acl.exchange-rates', 'route' => 'admin.exchange_rates.index', - 'sort' => 3 + 'sort' => 3, ], [ - 'key' => 'settings.exchange_rates.create', - 'name' => 'admin::app.acl.create', + 'key' => 'settings.exchange_rates.create', + 'name' => 'admin::app.acl.create', 'route' => 'admin.exchange_rates.create', - 'sort' => 1 + 'sort' => 1, ], [ - 'key' => 'settings.exchange_rates.edit', - 'name' => 'admin::app.acl.edit', + 'key' => 'settings.exchange_rates.edit', + 'name' => 'admin::app.acl.edit', 'route' => 'admin.exchange_rates.edit', - 'sort' => 2 + 'sort' => 2, ], [ - 'key' => 'settings.exchange_rates.delete', - 'name' => 'admin::app.acl.delete', + 'key' => 'settings.exchange_rates.delete', + 'name' => 'admin::app.acl.delete', 'route' => 'admin.exchange_rates.delete', - 'sort' => 3 + 'sort' => 3, ], [ - 'key' => 'settings.inventory_sources', - 'name' => 'admin::app.acl.inventory-sources', + 'key' => 'settings.inventory_sources', + 'name' => 'admin::app.acl.inventory-sources', 'route' => 'admin.inventory_sources.index', - 'sort' => 4 + 'sort' => 4, ], [ - 'key' => 'settings.inventory_sources.create', - 'name' => 'admin::app.acl.create', + 'key' => 'settings.inventory_sources.create', + 'name' => 'admin::app.acl.create', 'route' => 'admin.inventory_sources.create', - 'sort' => 1 + 'sort' => 1, ], [ - 'key' => 'settings.inventory_sources.edit', - 'name' => 'admin::app.acl.edit', + 'key' => 'settings.inventory_sources.edit', + 'name' => 'admin::app.acl.edit', 'route' => 'admin.inventory_sources.edit', - 'sort' => 2 + 'sort' => 2, ], [ - 'key' => 'settings.inventory_sources.delete', - 'name' => 'admin::app.acl.delete', + 'key' => 'settings.inventory_sources.delete', + 'name' => 'admin::app.acl.delete', 'route' => 'admin.inventory_sources.delete', - 'sort' => 3 + 'sort' => 3, ], [ - 'key' => 'settings.channels', - 'name' => 'admin::app.acl.channels', + 'key' => 'settings.channels', + 'name' => 'admin::app.acl.channels', 'route' => 'admin.channels.index', - 'sort' => 5 + 'sort' => 5, ], [ - 'key' => 'settings.channels.create', - 'name' => 'admin::app.acl.create', + 'key' => 'settings.channels.create', + 'name' => 'admin::app.acl.create', 'route' => 'admin.channels.create', - 'sort' => 1 + 'sort' => 1, ], [ - 'key' => 'settings.channels.edit', - 'name' => 'admin::app.acl.edit', + 'key' => 'settings.channels.edit', + 'name' => 'admin::app.acl.edit', 'route' => 'admin.channels.edit', - 'sort' => 2 + 'sort' => 2, ], [ - 'key' => 'settings.channels.delete', - 'name' => 'admin::app.acl.delete', + 'key' => 'settings.channels.delete', + 'name' => 'admin::app.acl.delete', 'route' => 'admin.channels.delete', - 'sort' => 3 + 'sort' => 3, ], [ - 'key' => 'settings.users', - 'name' => 'admin::app.acl.users', + 'key' => 'settings.users', + 'name' => 'admin::app.acl.users', 'route' => 'admin.users.index', - 'sort' => 6 + 'sort' => 6, ], [ - 'key' => 'settings.users.users', - 'name' => 'admin::app.acl.users', + 'key' => 'settings.users.users', + 'name' => 'admin::app.acl.users', 'route' => 'admin.users.index', - 'sort' => 1 + 'sort' => 1, ], [ - 'key' => 'settings.users.users.create', - 'name' => 'admin::app.acl.create', + 'key' => 'settings.users.users.create', + 'name' => 'admin::app.acl.create', 'route' => 'admin.users.create', - 'sort' => 1 + 'sort' => 1, ], [ - 'key' => 'settings.users.users.edit', - 'name' => 'admin::app.acl.edit', + 'key' => 'settings.users.users.edit', + 'name' => 'admin::app.acl.edit', 'route' => 'admin.users.edit', - 'sort' => 2 + 'sort' => 2, ], [ - 'key' => 'settings.users.users.delete', - 'name' => 'admin::app.acl.delete', + 'key' => 'settings.users.users.delete', + 'name' => 'admin::app.acl.delete', 'route' => 'admin.users.delete', - 'sort' => 3 + 'sort' => 3, ], [ - 'key' => 'settings.users.roles', - 'name' => 'admin::app.acl.roles', + 'key' => 'settings.users.roles', + 'name' => 'admin::app.acl.roles', 'route' => 'admin.roles.index', - 'sort' => 2 + 'sort' => 2, ], [ - 'key' => 'settings.users.roles.create', - 'name' => 'admin::app.acl.create', + 'key' => 'settings.users.roles.create', + 'name' => 'admin::app.acl.create', 'route' => 'admin.roles.create', - 'sort' => 1 + 'sort' => 1, ], [ - 'key' => 'settings.users.roles.edit', - 'name' => 'admin::app.acl.edit', + 'key' => 'settings.users.roles.edit', + 'name' => 'admin::app.acl.edit', 'route' => 'admin.roles.edit', - 'sort' => 2 + 'sort' => 2, ], [ - 'key' => 'settings.users.roles.delete', - 'name' => 'admin::app.acl.delete', + 'key' => 'settings.users.roles.delete', + 'name' => 'admin::app.acl.delete', 'route' => 'admin.roles.delete', - 'sort' => 3 + 'sort' => 3, ], [ - 'key' => 'settings.sliders', - 'name' => 'admin::app.acl.sliders', + 'key' => 'settings.sliders', + 'name' => 'admin::app.acl.sliders', 'route' => 'admin.sliders.index', - 'sort' => 7 + 'sort' => 7, ], [ - 'key' => 'settings.sliders.create', - 'name' => 'admin::app.acl.create', + 'key' => 'settings.sliders.create', + 'name' => 'admin::app.acl.create', 'route' => 'admin.sliders.create', - 'sort' => 1 + 'sort' => 1, ], [ - 'key' => 'settings.sliders.edit', - 'name' => 'admin::app.acl.edit', + 'key' => 'settings.sliders.edit', + 'name' => 'admin::app.acl.edit', 'route' => 'admin.sliders.edit', - 'sort' => 2 + 'sort' => 2, ], [ - 'key' => 'settings.sliders.delete', - 'name' => 'admin::app.acl.delete', + 'key' => 'settings.sliders.delete', + 'name' => 'admin::app.acl.delete', 'route' => 'admin.sliders.delete', - 'sort' => 3 + 'sort' => 3, ], [ - 'key' => 'settings.taxes', - 'name' => 'admin::app.acl.taxes', + 'key' => 'settings.taxes', + 'name' => 'admin::app.acl.taxes', 'route' => 'admin.tax-categories.index', - 'sort' => 8 + 'sort' => 8, ], [ - 'key' => 'settings.taxes.tax-categories', - 'name' => 'admin::app.acl.tax-categories', + 'key' => 'settings.taxes.tax-categories', + 'name' => 'admin::app.acl.tax-categories', 'route' => 'admin.tax-categories.index', - 'sort' => 1 + 'sort' => 1, ], [ - 'key' => 'settings.taxes.tax-categories.create', - 'name' => 'admin::app.acl.create', + 'key' => 'settings.taxes.tax-categories.create', + 'name' => 'admin::app.acl.create', 'route' => 'admin.tax-categories.create', - 'sort' => 1 + 'sort' => 1, ], [ - 'key' => 'settings.taxes.tax-categories.edit', - 'name' => 'admin::app.acl.edit', + 'key' => 'settings.taxes.tax-categories.edit', + 'name' => 'admin::app.acl.edit', 'route' => 'admin.tax-categories.edit', - 'sort' => 2 + 'sort' => 2, ], [ - 'key' => 'settings.taxes.tax-categories.delete', - 'name' => 'admin::app.acl.delete', + 'key' => 'settings.taxes.tax-categories.delete', + 'name' => 'admin::app.acl.delete', 'route' => 'admin.tax-categories.delete', - 'sort' => 3 + 'sort' => 3, ], [ - 'key' => 'settings.taxes.tax-rates', - 'name' => 'admin::app.acl.tax-rates', + 'key' => 'settings.taxes.tax-rates', + 'name' => 'admin::app.acl.tax-rates', 'route' => 'admin.tax-rates.index', - 'sort' => 2 + 'sort' => 2, ], [ - 'key' => 'settings.taxes.tax-rates.create', - 'name' => 'admin::app.acl.create', + 'key' => 'settings.taxes.tax-rates.create', + 'name' => 'admin::app.acl.create', 'route' => 'admin.tax-rates.create', - 'sort' => 1 + 'sort' => 1, ], [ - 'key' => 'settings.taxes.tax-rates.edit', - 'name' => 'admin::app.acl.edit', + 'key' => 'settings.taxes.tax-rates.edit', + 'name' => 'admin::app.acl.edit', 'route' => 'admin.tax-rates.edit', - 'sort' => 2 + 'sort' => 2, ], [ - 'key' => 'settings.taxes.tax-rates.delete', - 'name' => 'admin::app.acl.delete', + 'key' => 'settings.taxes.tax-rates.delete', + 'name' => 'admin::app.acl.delete', 'route' => 'admin.tax-rates.delete', - 'sort' => 3 + 'sort' => 3, ], [ - 'key' => 'promotions', - 'name' => 'admin::app.acl.promotions', + 'key' => 'promotions', + 'name' => 'admin::app.acl.promotions', 'route' => 'admin.cart-rules.index', - 'sort' => 7 + 'sort' => 7, ], [ - 'key' => 'promotions.cart-rules', - 'name' => 'admin::app.acl.cart-rules', + 'key' => 'promotions.cart-rules', + 'name' => 'admin::app.acl.cart-rules', 'route' => 'admin.cart-rules.index', - 'sort' => 1 + 'sort' => 1, ], [ - 'key' => 'promotions.cart-rules.create', - 'name' => 'admin::app.acl.create', + 'key' => 'promotions.cart-rules.create', + 'name' => 'admin::app.acl.create', 'route' => 'admin.cart-rules.create', - 'sort' => 1 + 'sort' => 1, ], [ - 'key' => 'promotions.cart-rules.edit', - 'name' => 'admin::app.acl.edit', + 'key' => 'promotions.cart-rules.edit', + 'name' => 'admin::app.acl.edit', 'route' => 'admin.cart-rules.edit', - 'sort' => 2 + 'sort' => 2, ], [ - 'key' => 'promotions.cart-rules.delete', - 'name' => 'admin::app.acl.delete', + 'key' => 'promotions.cart-rules.delete', + 'name' => 'admin::app.acl.delete', 'route' => 'admin.cart-rules.delete', - 'sort' => 3 + 'sort' => 3, ], ]; diff --git a/packages/Webkul/Admin/src/Config/menu.php b/packages/Webkul/Admin/src/Config/menu.php index ce1da1d85..426ef3edc 100755 --- a/packages/Webkul/Admin/src/Config/menu.php +++ b/packages/Webkul/Admin/src/Config/menu.php @@ -2,214 +2,214 @@ return [ [ - 'key' => 'dashboard', - 'name' => 'admin::app.layouts.dashboard', - 'route' => 'admin.dashboard.index', - 'sort' => 1, - 'icon-class' => 'dashboard-icon' + 'key' => 'dashboard', + 'name' => 'admin::app.layouts.dashboard', + 'route' => 'admin.dashboard.index', + 'sort' => 1, + 'icon-class' => 'dashboard-icon', ], [ - 'key' => 'sales', - 'name' => 'admin::app.layouts.sales', - 'route' => 'admin.sales.orders.index', - 'sort' => 2, - 'icon-class' => 'sales-icon' + 'key' => 'sales', + 'name' => 'admin::app.layouts.sales', + 'route' => 'admin.sales.orders.index', + 'sort' => 2, + 'icon-class' => 'sales-icon', ], [ - 'key' => 'sales.orders', - 'name' => 'admin::app.layouts.orders', - 'route' => 'admin.sales.orders.index', - 'sort' => 1, - 'icon-class' => '' + 'key' => 'sales.orders', + 'name' => 'admin::app.layouts.orders', + 'route' => 'admin.sales.orders.index', + 'sort' => 1, + 'icon-class' => '', ], [ - 'key' => 'sales.shipments', - 'name' => 'admin::app.layouts.shipments', - 'route' => 'admin.sales.shipments.index', - 'sort' => 2, - 'icon-class' => '' + 'key' => 'sales.shipments', + 'name' => 'admin::app.layouts.shipments', + 'route' => 'admin.sales.shipments.index', + 'sort' => 2, + 'icon-class' => '', ], [ - 'key' => 'sales.invoices', - 'name' => 'admin::app.layouts.invoices', - 'route' => 'admin.sales.invoices.index', - 'sort' => 3, - 'icon-class' => '' + 'key' => 'sales.invoices', + 'name' => 'admin::app.layouts.invoices', + 'route' => 'admin.sales.invoices.index', + 'sort' => 3, + 'icon-class' => '', ], [ - 'key' => 'sales.refunds', - 'name' => 'admin::app.layouts.refunds', - 'route' => 'admin.sales.refunds.index', - 'sort' => 4, - 'icon-class' => '' + 'key' => 'sales.refunds', + 'name' => 'admin::app.layouts.refunds', + 'route' => 'admin.sales.refunds.index', + 'sort' => 4, + 'icon-class' => '', ], [ - 'key' => 'catalog', - 'name' => 'admin::app.layouts.catalog', - 'route' => 'admin.catalog.products.index', - 'sort' => 3, - 'icon-class' => 'catalog-icon' + 'key' => 'catalog', + 'name' => 'admin::app.layouts.catalog', + 'route' => 'admin.catalog.products.index', + 'sort' => 3, + 'icon-class' => 'catalog-icon', ], [ - 'key' => 'catalog.products', - 'name' => 'admin::app.layouts.products', - 'route' => 'admin.catalog.products.index', - 'sort' => 1, - 'icon-class' => '' + 'key' => 'catalog.products', + 'name' => 'admin::app.layouts.products', + 'route' => 'admin.catalog.products.index', + 'sort' => 1, + 'icon-class' => '', ], [ - 'key' => 'catalog.categories', - 'name' => 'admin::app.layouts.categories', - 'route' => 'admin.catalog.categories.index', - 'sort' => 3, - 'icon-class' => '' + 'key' => 'catalog.categories', + 'name' => 'admin::app.layouts.categories', + 'route' => 'admin.catalog.categories.index', + 'sort' => 3, + 'icon-class' => '', ], [ - 'key' => 'catalog.attributes', - 'name' => 'admin::app.layouts.attributes', - 'route' => 'admin.catalog.attributes.index', - 'sort' => 2, - 'icon-class' => '' + 'key' => 'catalog.attributes', + 'name' => 'admin::app.layouts.attributes', + 'route' => 'admin.catalog.attributes.index', + 'sort' => 2, + 'icon-class' => '', ], [ - 'key' => 'catalog.families', - 'name' => 'admin::app.layouts.attribute-families', - 'route' => 'admin.catalog.families.index', - 'sort' => 4, - 'icon-class' => '' + 'key' => 'catalog.families', + 'name' => 'admin::app.layouts.attribute-families', + 'route' => 'admin.catalog.families.index', + 'sort' => 4, + 'icon-class' => '', ], [ - 'key' => 'customers', - 'name' => 'admin::app.layouts.customers', - 'route' => 'admin.customer.index', - 'sort' => 4, - 'icon-class' => 'customer-icon' + 'key' => 'customers', + 'name' => 'admin::app.layouts.customers', + 'route' => 'admin.customer.index', + 'sort' => 4, + 'icon-class' => 'customer-icon', ], [ - 'key' => 'customers.customers', - 'name' => 'admin::app.layouts.customers', - 'route' => 'admin.customer.index', - 'sort' => 1, - 'icon-class' => '' + 'key' => 'customers.customers', + 'name' => 'admin::app.layouts.customers', + 'route' => 'admin.customer.index', + 'sort' => 1, + 'icon-class' => '', ], [ - 'key' => 'customers.groups', - 'name' => 'admin::app.layouts.groups', - 'route' => 'admin.groups.index', - 'sort' => 2, - 'icon-class' => '' + 'key' => 'customers.groups', + 'name' => 'admin::app.layouts.groups', + 'route' => 'admin.groups.index', + 'sort' => 2, + 'icon-class' => '', ], [ - 'key' => 'customers.reviews', - 'name' => 'admin::app.layouts.reviews', - 'route' => 'admin.customer.review.index', - 'sort' => 3, - 'icon-class' => '' + 'key' => 'customers.reviews', + 'name' => 'admin::app.layouts.reviews', + 'route' => 'admin.customer.review.index', + 'sort' => 3, + 'icon-class' => '', ], [ - 'key' => 'customers.subscribers', - 'name' => 'admin::app.layouts.newsletter-subscriptions', - 'route' => 'admin.customers.subscribers.index', - 'sort' => 4, - 'icon-class' => '' + 'key' => 'customers.subscribers', + 'name' => 'admin::app.layouts.newsletter-subscriptions', + 'route' => 'admin.customers.subscribers.index', + 'sort' => 4, + 'icon-class' => '', ], [ - 'key' => 'configuration', - 'name' => 'admin::app.layouts.configure', - 'route' => 'admin.configuration.index', - 'sort' => 7, - 'icon-class' => 'configuration-icon' + 'key' => 'configuration', + 'name' => 'admin::app.layouts.configure', + 'route' => 'admin.configuration.index', + 'sort' => 7, + 'icon-class' => 'configuration-icon', ], [ - 'key' => 'settings', - 'name' => 'admin::app.layouts.settings', - 'route' => 'admin.locales.index', - 'sort' => 6, - 'icon-class' => 'settings-icon' + 'key' => 'settings', + 'name' => 'admin::app.layouts.settings', + 'route' => 'admin.locales.index', + 'sort' => 6, + 'icon-class' => 'settings-icon', ], [ - 'key' => 'settings.locales', - 'name' => 'admin::app.layouts.locales', - 'route' => 'admin.locales.index', - 'sort' => 1, - 'icon-class' => '' + 'key' => 'settings.locales', + 'name' => 'admin::app.layouts.locales', + 'route' => 'admin.locales.index', + 'sort' => 1, + 'icon-class' => '', ], [ - 'key' => 'settings.currencies', - 'name' => 'admin::app.layouts.currencies', - 'route' => 'admin.currencies.index', - 'sort' => 2, - 'icon-class' => '' + 'key' => 'settings.currencies', + 'name' => 'admin::app.layouts.currencies', + 'route' => 'admin.currencies.index', + 'sort' => 2, + 'icon-class' => '', ], [ - 'key' => 'settings.exchange_rates', - 'name' => 'admin::app.layouts.exchange-rates', - 'route' => 'admin.exchange_rates.index', - 'sort' => 3, - 'icon-class' => '' + 'key' => 'settings.exchange_rates', + 'name' => 'admin::app.layouts.exchange-rates', + 'route' => 'admin.exchange_rates.index', + 'sort' => 3, + 'icon-class' => '', ], [ - 'key' => 'settings.inventory_sources', - 'name' => 'admin::app.layouts.inventory-sources', - 'route' => 'admin.inventory_sources.index', - 'sort' => 4, - 'icon-class' => '' + 'key' => 'settings.inventory_sources', + 'name' => 'admin::app.layouts.inventory-sources', + 'route' => 'admin.inventory_sources.index', + 'sort' => 4, + 'icon-class' => '', ], [ - 'key' => 'settings.channels', - 'name' => 'admin::app.layouts.channels', - 'route' => 'admin.channels.index', - 'sort' => 5, - 'icon-class' => '' + 'key' => 'settings.channels', + 'name' => 'admin::app.layouts.channels', + 'route' => 'admin.channels.index', + 'sort' => 5, + 'icon-class' => '', ], [ - 'key' => 'settings.users', - 'name' => 'admin::app.layouts.users', - 'route' => 'admin.users.index', - 'sort' => 6, - 'icon-class' => '' + 'key' => 'settings.users', + 'name' => 'admin::app.layouts.users', + 'route' => 'admin.users.index', + 'sort' => 6, + 'icon-class' => '', ], [ - 'key' => 'settings.users.users', - 'name' => 'admin::app.layouts.users', - 'route' => 'admin.users.index', - 'sort' => 1, - 'icon-class' => '' + 'key' => 'settings.users.users', + 'name' => 'admin::app.layouts.users', + 'route' => 'admin.users.index', + 'sort' => 1, + 'icon-class' => '', ], [ - 'key' => 'settings.users.roles', - 'name' => 'admin::app.layouts.roles', - 'route' => 'admin.roles.index', - 'sort' => 2, - 'icon-class' => '' + 'key' => 'settings.users.roles', + 'name' => 'admin::app.layouts.roles', + 'route' => 'admin.roles.index', + 'sort' => 2, + 'icon-class' => '', ], [ - 'key' => 'settings.sliders', - 'name' => 'admin::app.layouts.sliders', - 'route' => 'admin.sliders.index', - 'sort' => 7, - 'icon-class' => '' + 'key' => 'settings.sliders', + 'name' => 'admin::app.layouts.sliders', + 'route' => 'admin.sliders.index', + 'sort' => 7, + 'icon-class' => '', ], [ - 'key' => 'settings.taxes', - 'name' => 'admin::app.layouts.taxes', - 'route' => 'admin.tax-categories.index', - 'sort' => 8, - 'icon-class' => '' + 'key' => 'settings.taxes', + 'name' => 'admin::app.layouts.taxes', + 'route' => 'admin.tax-categories.index', + 'sort' => 8, + 'icon-class' => '', ], [ - 'key' => 'settings.taxes.tax-categories', - 'name' => 'admin::app.layouts.tax-categories', - 'route' => 'admin.tax-categories.index', - 'sort' => 1, - 'icon-class' => '' + 'key' => 'settings.taxes.tax-categories', + 'name' => 'admin::app.layouts.tax-categories', + 'route' => 'admin.tax-categories.index', + 'sort' => 1, + 'icon-class' => '', ], [ - 'key' => 'settings.taxes.tax-rates', - 'name' => 'admin::app.layouts.tax-rates', - 'route' => 'admin.tax-rates.index', - 'sort' => 2, - 'icon-class' => '' + 'key' => 'settings.taxes.tax-rates', + 'name' => 'admin::app.layouts.tax-rates', + 'route' => 'admin.tax-rates.index', + 'sort' => 2, + 'icon-class' => '', ], [ - 'key' => 'promotions', - 'name' => 'admin::app.layouts.promotions', - 'route' => 'admin.catalog-rules.index', - 'sort' => 5, - 'icon-class' => 'promotion-icon' + 'key' => 'promotions', + 'name' => 'admin::app.layouts.promotions', + 'route' => 'admin.catalog-rules.index', + 'sort' => 5, + 'icon-class' => 'promotion-icon', ], [ - 'key' => 'promotions.catalog-rules', - 'name' => 'admin::app.promotions.catalog-rules.title', - 'route' => 'admin.catalog-rules.index', - 'sort' => 1, - 'icon-class' => '' + 'key' => 'promotions.catalog-rules', + 'name' => 'admin::app.promotions.catalog-rules.title', + 'route' => 'admin.catalog-rules.index', + 'sort' => 1, + 'icon-class' => '', ], [ - 'key' => 'promotions.cart-rules', - 'name' => 'admin::app.promotions.cart-rules.title', - 'route' => 'admin.cart-rules.index', - 'sort' => 2, - 'icon-class' => '' + 'key' => 'promotions.cart-rules', + 'name' => 'admin::app.promotions.cart-rules.title', + 'route' => 'admin.cart-rules.index', + 'sort' => 2, + 'icon-class' => '', ], [ - 'key' => 'cms', - 'name' => 'admin::app.layouts.cms', - 'route' => 'admin.cms.index', - 'sort' => 5, - 'icon-class' => 'cms-icon' + 'key' => 'cms', + 'name' => 'admin::app.layouts.cms', + 'route' => 'admin.cms.index', + 'sort' => 5, + 'icon-class' => 'cms-icon', ], [ - 'key' => 'cms.pages', - 'name' => 'admin::app.cms.pages.pages', - 'route' => 'admin.cms.index', - 'sort' => 1, - 'icon-class' => '' + 'key' => 'cms.pages', + 'name' => 'admin::app.cms.pages.pages', + 'route' => 'admin.cms.index', + 'sort' => 1, + 'icon-class' => '', ] ]; \ No newline at end of file diff --git a/packages/Webkul/Admin/src/Config/system.php b/packages/Webkul/Admin/src/Config/system.php index 6daa45a16..5e053eac5 100644 --- a/packages/Webkul/Admin/src/Config/system.php +++ b/packages/Webkul/Admin/src/Config/system.php @@ -48,16 +48,7 @@ return [ ], [ 'name' => 'footer_toggle', 'title' => 'admin::app.admin.system.footer-toggle', - 'type' => 'select', - 'options' => [ - [ - 'title' => 'True', - 'value' => 1, - ], [ - 'title' => 'False', - 'value' => 0, - ], - ], + 'type' => 'boolean', 'locale_based' => true, 'channel_based' => true, ], diff --git a/packages/Webkul/Admin/src/DataGrids/AddressDataGrid.php b/packages/Webkul/Admin/src/DataGrids/AddressDataGrid.php index f397ee46e..fd9a84761 100644 --- a/packages/Webkul/Admin/src/DataGrids/AddressDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/AddressDataGrid.php @@ -2,66 +2,58 @@ namespace Webkul\Admin\DataGrids; -use DB; +use Illuminate\Support\Facades\DB; use Webkul\Ui\DataGrid\DataGrid; -use Webkul\Customer\Repositories\CustomerRepository as Customer; +use Webkul\Customer\Repositories\CustomerRepository; -/** - * Address Data Grid class - * - * @author Vivek Sharma - * @copyright 2019 Webkul Software Pvt Ltd (http://www.webkul.com) - */ class AddressDataGrid extends DataGrid { /** - * - * @var integer + * @var string */ public $index = 'address_id'; - protected $sortOrder = 'desc'; //asc or desc + /** + * @var string + */ + protected $sortOrder = 'desc'; /** * CustomerRepository object * * @var object - */ - protected $customer; + */ + protected $customerRepository; /** - * Create a new controller instance. + * Create a new datagrid instance. * - * @param Webkul\Customer\Repositories\CustomerRepository $customer + * @param Webkul\Customer\Repositories\CustomerRepository $customerRepository * @return void */ - public function __construct( - Customer $customer - ) + public function __construct(CustomerRepository $customerRepository) { - parent::__construct(); + $this->customerRepository = $customerRepository; - $this->customer = $customer; + parent::__construct(); } public function prepareQueryBuilder() { - - $customer = $this->customer->find(request('id')); + $customer = $this->customerRepository->find(request('id')); $queryBuilder = DB::table('customer_addresses as ca') - ->leftJoin('countries', 'ca.country', '=', 'countries.code') - ->leftJoin('customers as c', 'ca.customer_id', '=', 'c.id') - ->addSelect('ca.id as address_id', 'ca.company_name', 'ca.address1', 'ca.country', DB::raw('' . DB::getTablePrefix() . 'countries.name as country_name'), 'ca.state', 'ca.city', 'ca.postcode', 'ca.phone', 'ca.default_address') - ->where('c.id', $customer->id); + ->leftJoin('countries', 'ca.country', '=', 'countries.code') + ->leftJoin('customers as c', 'ca.customer_id', '=', 'c.id') + ->addSelect('ca.id as address_id', 'ca.company_name', 'ca.address1', 'ca.country', DB::raw('' . DB::getTablePrefix() . 'countries.name as country_name'), 'ca.state', 'ca.city', 'ca.postcode', 'ca.phone', 'ca.default_address') + ->where('c.id', $customer->id); $queryBuilder = $queryBuilder->leftJoin('country_states', function($qb) { $qb->on('ca.state', 'country_states.code') - ->on('countries.id', 'country_states.country_id'); + ->on('countries.id', 'country_states.country_id'); }); - $queryBuilder - ->groupBy('ca.id') + $queryBuilder->groupBy('ca.id') ->addSelect(DB::raw(DB::getTablePrefix() . 'country_states.default_name as state_name')); $this->addFilter('address_id', 'ca.id'); @@ -78,102 +70,102 @@ class AddressDataGrid extends DataGrid public function addColumns() { - $this->addColumn([ - 'index' => 'address_id', - 'label' => trans('admin::app.customers.addresses.address-id'), - 'type' => 'number', + 'index' => 'address_id', + 'label' => trans('admin::app.customers.addresses.address-id'), + 'type' => 'number', 'searchable' => true, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); $this->addColumn([ - 'index' => 'address1', - 'label' => trans('admin::app.customers.addresses.address-1'), - 'type' => 'string', + 'index' => 'address1', + 'label' => trans('admin::app.customers.addresses.address-1'), + 'type' => 'string', 'searchable' => true, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); $this->addColumn([ - 'index' => 'city', - 'label' => trans('admin::app.customers.addresses.city'), - 'type' => 'string', + 'index' => 'city', + 'label' => trans('admin::app.customers.addresses.city'), + 'type' => 'string', 'searchable' => true, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); $this->addColumn([ - 'index' => 'state_name', - 'label' => trans('admin::app.customers.addresses.state-name'), - 'type' => 'string', + 'index' => 'state_name', + 'label' => trans('admin::app.customers.addresses.state-name'), + 'type' => 'string', 'searchable' => true, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); $this->addColumn([ - 'index' => 'country_name', - 'label' => trans('admin::app.customers.addresses.country-name'), - 'type' => 'string', + 'index' => 'country_name', + 'label' => trans('admin::app.customers.addresses.country-name'), + 'type' => 'string', 'searchable' => true, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); $this->addColumn([ - 'index' => 'postcode', - 'label' => trans('admin::app.customers.addresses.postcode'), - 'type' => 'string', + 'index' => 'postcode', + 'label' => trans('admin::app.customers.addresses.postcode'), + 'type' => 'string', 'searchable' => true, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); $this->addColumn([ - 'index' => 'default_address', - 'label' => trans('admin::app.customers.addresses.default-address'), - 'type' => 'boolean', - 'sortable' => true, + 'index' => 'default_address', + 'label' => trans('admin::app.customers.addresses.default-address'), + 'type' => 'boolean', + 'sortable' => true, 'searchable' => false, - 'closure' => true, - 'wrapper' => function($row) { - if ($row->default_address == 1) + 'closure' => true, + 'wrapper' => function($row) { + if ($row->default_address == 1) { return '' . trans('admin::app.customers.addresses.yes') . ''; - else + } else { return trans('admin::app.customers.addresses.dash'); - } + } + }, ]); } public function prepareActions() { $this->addAction([ - 'type' => 'Edit', - 'method' => 'GET', //use post only for redirects only - 'route' => 'admin.customer.addresses.edit', - 'icon' => 'icon pencil-lg-icon' + 'title' => trans('admin::app.datagrid.edit'), + 'method' => 'GET', + 'route' => 'admin.customer.addresses.edit', + 'icon' => 'icon pencil-lg-icon', ]); $this->addAction([ - 'type' => 'Delete', - 'method' => 'POST', - 'route' => 'admin.customer.addresses.delete', + 'title' => trans('admin::app.datagrid.delete'), + 'method' => 'POST', + 'route' => 'admin.customer.addresses.delete', 'confirm_text' => trans('ui::app.datagrid.massaction.delete', ['resource' => 'address']), - 'icon' => 'icon trash-icon' + 'icon' => 'icon trash-icon', ]); } public function prepareMassActions() { $this->addMassAction([ - 'type' => 'delete', - 'label' => trans('admin::app.customers.addresses.delete'), + 'type' => 'delete', + 'label' => trans('admin::app.customers.addresses.delete'), 'action' => route('admin.customer.addresses.massdelete', request('id')), - 'method' => 'DELETE' + 'method' => 'DELETE', ]); } } \ 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 05ff46cc3..cf46f2b9b 100755 --- a/packages/Webkul/Admin/src/DataGrids/AttributeDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/AttributeDataGrid.php @@ -2,26 +2,20 @@ namespace Webkul\Admin\DataGrids; +use Illuminate\Support\Facades\DB; use Webkul\Ui\DataGrid\DataGrid; -use DB; -/** - * AttributeDataGrid class - * - * @author Prashant Singh @prashant-webkul - * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) - */ class AttributeDataGrid extends DataGrid { - protected $index = 'id'; // column that needs to be treated as index column + protected $index = 'id'; - protected $sortOrder = 'desc'; // asc or desc + protected $sortOrder = 'desc'; public function prepareQueryBuilder() { $queryBuilder = DB::table('attributes') - ->select('id') - ->addSelect('id', 'code', 'admin_name', 'type', 'is_required', 'is_unique', 'value_per_locale', 'value_per_channel'); + ->select('id') + ->addSelect('id', 'code', 'admin_name', 'type', 'is_required', 'is_unique', 'value_per_locale', 'value_per_channel'); $this->setQueryBuilder($queryBuilder); } @@ -29,126 +23,130 @@ class AttributeDataGrid extends DataGrid public function addColumns() { $this->addColumn([ - 'index' => 'id', - 'label' => trans('admin::app.datagrid.id'), - 'type' => 'number', + 'index' => 'id', + 'label' => trans('admin::app.datagrid.id'), + 'type' => 'number', 'searchable' => false, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); $this->addColumn([ - 'index' => 'code', - 'label' => trans('admin::app.datagrid.code'), - 'type' => 'string', + 'index' => 'code', + 'label' => trans('admin::app.datagrid.code'), + 'type' => 'string', 'searchable' => true, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); $this->addColumn([ - 'index' => 'admin_name', - 'label' => trans('admin::app.name'), - 'type' => 'string', + 'index' => 'admin_name', + 'label' => trans('admin::app.name'), + 'type' => 'string', 'searchable' => true, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); $this->addColumn([ - 'index' => 'type', - 'label' => trans('admin::app.type'), - 'type' => 'string', - 'sortable' => true, + 'index' => 'type', + 'label' => trans('admin::app.type'), + 'type' => 'string', + 'sortable' => true, 'searchable' => true, - 'filterable' => true + 'filterable' => true, ]); $this->addColumn([ - 'index' => 'is_required', - 'label' => trans('admin::app.required'), - 'type' => 'boolean', - 'sortable' => true, + 'index' => 'is_required', + 'label' => trans('admin::app.required'), + 'type' => 'boolean', + 'sortable' => true, 'searchable' => false, - 'wrapper' => function($value) { - if ($value->is_required == 1) - return 'True'; - else - return 'False'; - } + 'wrapper' => function($value) { + if ($value->is_required == 1) { + return trans('admin::app.datagrid.true'); + } else { + return trans('admin::app.datagrid.false'); + } + }, ]); $this->addColumn([ - 'index' => 'is_unique', - 'label' => trans('admin::app.unique'), - 'type' => 'boolean', - 'sortable' => true, + 'index' => 'is_unique', + 'label' => trans('admin::app.unique'), + 'type' => 'boolean', + 'sortable' => true, 'searchable' => false, 'filterable' => true, - 'wrapper' => function($value) { - if ($value->is_unique == 1) - return 'True'; - else - return 'False'; - } + 'wrapper' => function($value) { + if ($value->is_unique == 1) { + return trans('admin::app.datagrid.true'); + } else { + return trans('admin::app.datagrid.false'); + } + }, ]); $this->addColumn([ - 'index' => 'value_per_locale', - 'label' => trans('admin::app.locale-based'), - 'type' => 'boolean', - 'sortable' => true, + 'index' => 'value_per_locale', + 'label' => trans('admin::app.locale-based'), + 'type' => 'boolean', + 'sortable' => true, 'searchable' => false, 'filterable' => true, - 'wrapper' => function($value) { - if ($value->value_per_locale == 1) - return 'True'; - else - return 'False'; - } + 'wrapper' => function($value) { + if ($value->value_per_locale == 1) { + return trans('admin::app.datagrid.true'); + } else { + return trans('admin::app.datagrid.false'); + } + }, ]); $this->addColumn([ - 'index' => 'value_per_channel', - 'label' => trans('admin::app.channel-based'), - 'type' => 'boolean', - 'sortable' => true, + 'index' => 'value_per_channel', + 'label' => trans('admin::app.channel-based'), + 'type' => 'boolean', + 'sortable' => true, 'searchable' => false, 'filterable' => true, - 'wrapper' => function($value) { - if ($value->value_per_channel == 1) - return 'True'; - else - return 'False'; - } + 'wrapper' => function($value) { + if ($value->value_per_channel == 1) { + return trans('admin::app.datagrid.true'); + } else { + return trans('admin::app.datagrid.false'); + } + }, ]); } public function prepareActions() { $this->addAction([ - 'title' => 'Edit Attribute', - 'method' => 'GET', //use get for redirects only - 'route' => 'admin.catalog.attributes.edit', - 'icon' => 'icon pencil-lg-icon' + 'title' => trans('admin::app.datagrid.edit'), + 'method' => 'GET', + 'route' => 'admin.catalog.attributes.edit', + 'icon' => 'icon pencil-lg-icon', ]); $this->addAction([ - 'title' => 'Delete Attribute', - 'method' => 'POST', // other than get request it fires ajax and self refreshes datagrid - 'route' => 'admin.catalog.attributes.delete', - 'icon' => 'icon trash-icon' + 'title' => trans('admin::app.datagrid.delete'), + 'method' => 'POST', + 'route' => 'admin.catalog.attributes.delete', + 'icon' => 'icon trash-icon', ]); } public function prepareMassActions() { $this->addMassAction([ - 'type' => 'delete', + 'type' => 'delete', 'action' => route('admin.catalog.attributes.massdelete'), - 'label' => trans('admin::app.datagrid.delete'), - 'index' => 'admin_name', - 'method' => 'DELETE' + 'label' => trans('admin::app.datagrid.delete'), + 'index' => 'admin_name', + 'method' => 'DELETE', ]); } } diff --git a/packages/Webkul/Admin/src/DataGrids/AttributeFamilyDataGrid.php b/packages/Webkul/Admin/src/DataGrids/AttributeFamilyDataGrid.php index b0d4141cb..5c4084dd4 100755 --- a/packages/Webkul/Admin/src/DataGrids/AttributeFamilyDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/AttributeFamilyDataGrid.php @@ -2,20 +2,14 @@ namespace Webkul\Admin\DataGrids; +use Illuminate\Support\Facades\DB; use Webkul\Ui\DataGrid\DataGrid; -use DB; -/** - * AttributeFamilyDataGrid Class - * - * @author Prashant Singh @prashant-webkul - * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) - */ class AttributeFamilyDataGrid extends DataGrid { - protected $index = 'id'; //the column that needs to be treated as index column + protected $index = 'id'; - protected $sortOrder = 'desc'; //asc or desc + protected $sortOrder = 'desc'; public function prepareQueryBuilder() { @@ -27,47 +21,47 @@ class AttributeFamilyDataGrid extends DataGrid public function addColumns() { $this->addColumn([ - 'index' => 'id', - 'label' => trans('admin::app.id'), - 'type' => 'number', + 'index' => 'id', + 'label' => trans('admin::app.id'), + 'type' => 'number', 'searchable' => false, - 'sortable' => true, + 'sortable' => true, + 'filterable' => true, + ]); + + $this->addColumn([ + 'index' => 'code', + 'label' => trans('admin::app.code'), + 'type' => 'string', + 'searchable' => true, + 'sortable' => true, 'filterable' => true ]); $this->addColumn([ - 'index' => 'code', - 'label' => trans('admin::app.code'), - 'type' => 'string', + 'index' => 'name', + 'label' => trans('admin::app.name'), + 'type' => 'string', 'searchable' => true, - 'sortable' => true, - 'filterable' => true - ]); - - $this->addColumn([ - 'index' => 'name', - 'label' => trans('admin::app.name'), - 'type' => 'string', - 'searchable' => true, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); } - public function prepareActions() { + public function prepareActions() + { $this->addAction([ - 'title' => 'Edit Attribute Family', - 'method' => 'GET', // use GET request only for redirect purposes - 'route' => 'admin.catalog.families.edit', - 'icon' => 'icon pencil-lg-icon' + 'title' => trans('admin::app.datagrid.edit'), + 'method' => 'GET', + 'route' => 'admin.catalog.families.edit', + 'icon' => 'icon pencil-lg-icon', ]); $this->addAction([ - 'title' => 'Delete Attribute Family', - 'method' => 'POST', // use GET request only for redirect purposes and POST for rest - 'route' => 'admin.catalog.families.delete', - // 'confirm_text' => trans('ui::app.datagrid.massaction.delete', ['resource' => 'product']), - 'icon' => 'icon trash-icon' + 'title' => trans('admin::app.datagrid.delete'), + 'method' => 'POST', + 'route' => 'admin.catalog.families.delete', + 'icon' => 'icon trash-icon', ]); } } \ No newline at end of file diff --git a/packages/Webkul/Admin/src/DataGrids/CMSPageDataGrid.php b/packages/Webkul/Admin/src/DataGrids/CMSPageDataGrid.php index e2f6f61f1..9a33f9006 100644 --- a/packages/Webkul/Admin/src/DataGrids/CMSPageDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/CMSPageDataGrid.php @@ -2,15 +2,9 @@ namespace Webkul\Admin\DataGrids; +use Illuminate\Support\Facades\DB; use Webkul\Ui\DataGrid\DataGrid; -use DB; -/** - * CMSPagesDataGrid class - * - * @author Prashant Singh @prashant-webkul - * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) - */ class CMSPageDataGrid extends DataGrid { protected $index = 'id'; @@ -20,11 +14,11 @@ class CMSPageDataGrid extends DataGrid public function prepareQueryBuilder() { $queryBuilder = DB::table('cms_pages') - ->select('cms_pages.id', 'cms_page_translations.page_title', 'cms_page_translations.url_key') - ->leftJoin('cms_page_translations', function($leftJoin) { - $leftJoin->on('cms_pages.id', '=', 'cms_page_translations.cms_page_id') - ->where('cms_page_translations.locale', app()->getLocale()); - }); + ->select('cms_pages.id', 'cms_page_translations.page_title', 'cms_page_translations.url_key') + ->leftJoin('cms_page_translations', function($leftJoin) { + $leftJoin->on('cms_pages.id', '=', 'cms_page_translations.cms_page_id') + ->where('cms_page_translations.locale', app()->getLocale()); + }); $this->addFilter('id', 'cms_pages.id'); @@ -34,56 +28,57 @@ class CMSPageDataGrid extends DataGrid public function addColumns() { $this->addColumn([ - 'index' => 'id', - 'label' => trans('admin::app.datagrid.id'), - 'type' => 'number', + 'index' => 'id', + 'label' => trans('admin::app.datagrid.id'), + 'type' => 'number', 'searchable' => false, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); $this->addColumn([ - 'index' => 'page_title', - 'label' => trans('admin::app.cms.pages.page-title'), - 'type' => 'string', + 'index' => 'page_title', + 'label' => trans('admin::app.cms.pages.page-title'), + 'type' => 'string', 'searchable' => true, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); $this->addColumn([ - 'index' => 'url_key', - 'label' => trans('admin::app.datagrid.url-key'), - 'type' => 'string', + 'index' => 'url_key', + 'label' => trans('admin::app.datagrid.url-key'), + 'type' => 'string', 'searchable' => true, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); } - public function prepareActions() { + public function prepareActions() + { $this->addAction([ - 'title' => 'Edit CMSPage', + 'title' => trans('admin::app.datagrid.edit'), 'method' => 'GET', - 'route' => 'admin.cms.edit', - 'icon' => 'icon pencil-lg-icon' + 'route' => 'admin.cms.edit', + 'icon' => 'icon pencil-lg-icon', ]); $this->addAction([ - 'title' => 'Delete CMSPage', + 'title' => trans('admin::app.datagrid.delete'), 'method' => 'POST', - 'route' => 'admin.cms.delete', - 'icon' => 'icon trash-icon' + 'route' => 'admin.cms.delete', + 'icon' => 'icon trash-icon', ]); } public function prepareMassActions() { $this->addMassAction([ - 'type' => 'delete', - 'label' => trans('admin::app.datagrid.delete'), + 'type' => 'delete', + 'label' => trans('admin::app.datagrid.delete'), 'action' => route('admin.cms.mass-delete'), - 'method' => 'DELETE' + 'method' => 'DELETE', ]); } } \ No newline at end of file diff --git a/packages/Webkul/Admin/src/DataGrids/CartRuleCouponDataGrid.php b/packages/Webkul/Admin/src/DataGrids/CartRuleCouponDataGrid.php index f4eeac150..965e7138f 100644 --- a/packages/Webkul/Admin/src/DataGrids/CartRuleCouponDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/CartRuleCouponDataGrid.php @@ -2,15 +2,9 @@ namespace Webkul\Admin\DataGrids; +use Illuminate\Support\Facades\DB; use Webkul\Ui\DataGrid\DataGrid; -use DB; -/** - * CartRuleCouponDataGrid class - * - * @author Jitendra Singh - * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) - */ class CartRuleCouponDataGrid extends DataGrid { protected $index = 'id'; @@ -20,8 +14,8 @@ class CartRuleCouponDataGrid extends DataGrid public function prepareQueryBuilder() { $queryBuilder = DB::table('cart_rule_coupons') - ->addSelect('id', 'code', 'created_at', 'expired_at', 'times_used') - ->where('cart_rule_coupons.cart_rule_id', collect(request()->segments())->last()); + ->addSelect('id', 'code', 'created_at', 'expired_at', 'times_used') + ->where('cart_rule_coupons.cart_rule_id', collect(request()->segments())->last()); $this->setQueryBuilder($queryBuilder); } @@ -29,58 +23,58 @@ class CartRuleCouponDataGrid extends DataGrid public function addColumns() { $this->addColumn([ - 'index' => 'id', - 'label' => trans('admin::app.datagrid.id'), - 'type' => 'number', + 'index' => 'id', + 'label' => trans('admin::app.datagrid.id'), + 'type' => 'number', 'searchable' => false, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); $this->addColumn([ - 'index' => 'code', - 'label' => trans('admin::app.datagrid.coupon-code'), - 'type' => 'string', + 'index' => 'code', + 'label' => trans('admin::app.datagrid.coupon-code'), + 'type' => 'string', 'searchable' => true, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); $this->addColumn([ - 'index' => 'created_at', - 'label' => trans('admin::app.datagrid.created-date'), - 'type' => 'datetime', - 'sortable' => true, + 'index' => 'created_at', + 'label' => trans('admin::app.datagrid.created-date'), + 'type' => 'datetime', + 'sortable' => true, 'searchable' => false, - 'filterable' => true + 'filterable' => true, ]); $this->addColumn([ - 'index' => 'expired_at', - 'label' => trans('admin::app.datagrid.expiration-date'), - 'type' => 'datetime', - 'sortable' => true, + 'index' => 'expired_at', + 'label' => trans('admin::app.datagrid.expiration-date'), + 'type' => 'datetime', + 'sortable' => true, 'searchable' => false, - 'filterable' => true + 'filterable' => true, ]); $this->addColumn([ - 'index' => 'times_used', - 'label' => trans('admin::app.datagrid.times-used'), - 'type' => 'number', + 'index' => 'times_used', + 'label' => trans('admin::app.datagrid.times-used'), + 'type' => 'number', 'searchable' => true, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); } public function prepareMassActions() { $this->addMassAction([ - 'type' => 'delete', + 'type' => 'delete', 'action' => route('admin.cart-rule-coupons.mass-delete'), - 'label' => trans('admin::app.datagrid.delete'), - 'method' => 'DELETE' + 'label' => trans('admin::app.datagrid.delete'), + 'method' => 'DELETE', ]); } } diff --git a/packages/Webkul/Admin/src/DataGrids/CartRuleDataGrid.php b/packages/Webkul/Admin/src/DataGrids/CartRuleDataGrid.php index c6efb9517..ad7e167bb 100644 --- a/packages/Webkul/Admin/src/DataGrids/CartRuleDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/CartRuleDataGrid.php @@ -2,15 +2,9 @@ namespace Webkul\Admin\DataGrids; +use Illuminate\Support\Facades\DB; use Webkul\Ui\DataGrid\DataGrid; -use DB; -/** - * Cart Rule DataGrid class - * - * @author Jitendra Singh - * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) - */ class CartRuleDataGrid extends DataGrid { protected $index = 'id'; @@ -20,14 +14,13 @@ class CartRuleDataGrid extends DataGrid public function prepareQueryBuilder() { $queryBuilder = DB::table('cart_rules') - ->leftJoin('cart_rule_coupons', function($leftJoin) { - $leftJoin->on('cart_rule_coupons.cart_rule_id', '=', 'cart_rules.id') - ->where('cart_rule_coupons.is_primary', 1); - }) - ->addSelect('cart_rules.id', 'name', 'cart_rule_coupons.code as coupon_code', 'status', 'starts_from', 'ends_till', 'sort_order'); + ->leftJoin('cart_rule_coupons', function($leftJoin) { + $leftJoin->on('cart_rule_coupons.cart_rule_id', '=', 'cart_rules.id') + ->where('cart_rule_coupons.is_primary', 1); + }) + ->addSelect('cart_rules.id', 'name', 'cart_rule_coupons.code as coupon_code', 'status', 'starts_from', 'ends_till', 'sort_order'); $this->addFilter('id', 'cart_rules.id'); - $this->addFilter('coupon_code', 'cart_rule_coupons.code'); $this->setQueryBuilder($queryBuilder); @@ -36,89 +29,90 @@ class CartRuleDataGrid extends DataGrid public function addColumns() { $this->addColumn([ - 'index' => 'id', - 'label' => trans('admin::app.datagrid.id'), - 'type' => 'number', + 'index' => 'id', + 'label' => trans('admin::app.datagrid.id'), + 'type' => 'number', 'searchable' => false, - 'sortable' => true, - 'filterable' => true - ]); - - $this->addColumn([ - 'index' => 'name', - 'label' => trans('admin::app.datagrid.name'), - 'type' => 'string', - 'searchable' => true, - 'sortable' => true, - 'filterable' => true - ]); - - $this->addColumn([ - 'index' => 'coupon_code', - 'label' => trans('admin::app.datagrid.coupon-code'), - 'type' => 'string', - 'searchable' => true, - 'sortable' => true, - 'filterable' => true - ]); - - $this->addColumn([ - 'index' => 'starts_from', - 'label' => trans('admin::app.datagrid.start'), - 'type' => 'datetime', - 'sortable' => true, - 'searchable' => false, - 'filterable' => true - ]); - - $this->addColumn([ - 'index' => 'ends_till', - 'label' => trans('admin::app.datagrid.end'), - 'type' => 'datetime', - 'sortable' => true, - 'searchable' => false, - 'filterable' => true - ]); - - $this->addColumn([ - 'index' => 'status', - 'label' => trans('admin::app.status'), - 'type' => 'boolean', - 'searchable' => true, - 'sortable' => true, + 'sortable' => true, 'filterable' => true, - 'wrapper' => function($value) { - if ($value->status == 1) - return trans('admin::app.datagrid.active'); - else - return trans('admin::app.datagrid.inactive'); - } ]); $this->addColumn([ - 'index' => 'sort_order', - 'label' => trans('admin::app.datagrid.priority'), - 'type' => 'number', + 'index' => 'name', + 'label' => trans('admin::app.datagrid.name'), + 'type' => 'string', 'searchable' => true, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, + ]); + + $this->addColumn([ + 'index' => 'coupon_code', + 'label' => trans('admin::app.datagrid.coupon-code'), + 'type' => 'string', + 'searchable' => true, + 'sortable' => true, + 'filterable' => true, + ]); + + $this->addColumn([ + 'index' => 'starts_from', + 'label' => trans('admin::app.datagrid.start'), + 'type' => 'datetime', + 'sortable' => true, + 'searchable' => false, + 'filterable' => true, + ]); + + $this->addColumn([ + 'index' => 'ends_till', + 'label' => trans('admin::app.datagrid.end'), + 'type' => 'datetime', + 'sortable' => true, + 'searchable' => false, + 'filterable' => true, + ]); + + $this->addColumn([ + 'index' => 'status', + 'label' => trans('admin::app.status'), + 'type' => 'boolean', + 'searchable' => true, + 'sortable' => true, + 'filterable' => true, + 'wrapper' => function($value) { + if ($value->status == 1) { + return trans('admin::app.datagrid.active'); + } else { + return trans('admin::app.datagrid.inactive'); + } + }, + ]); + + $this->addColumn([ + 'index' => 'sort_order', + 'label' => trans('admin::app.datagrid.priority'), + 'type' => 'number', + 'searchable' => true, + 'sortable' => true, + 'filterable' => true, ]); } public function prepareActions() { $this->addAction([ - 'title' => 'Edit Cart Rule', + 'title' => trans('admin::app.datagrid.edit'), 'method' => 'GET', - 'route' => 'admin.cart-rules.edit', - 'icon' => 'icon pencil-lg-icon' + 'route' => 'admin.cart-rules.edit', + 'icon' => 'icon pencil-lg-icon', ]); $this->addAction([ - 'title' => 'Delete Cart Rule', + 'title' => trans('admin::app.datagrid.delete'), 'method' => 'POST', - 'route' => 'admin.cart-rules.delete', - 'icon' => 'icon trash-icon' + 'route' => 'admin.cart-rules.delete', + 'icon' => 'icon trash-icon', ]); } } diff --git a/packages/Webkul/Admin/src/DataGrids/CatalogRuleDataGrid.php b/packages/Webkul/Admin/src/DataGrids/CatalogRuleDataGrid.php index e57e977a1..540afc637 100644 --- a/packages/Webkul/Admin/src/DataGrids/CatalogRuleDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/CatalogRuleDataGrid.php @@ -2,15 +2,9 @@ namespace Webkul\Admin\DataGrids; +use Illuminate\Support\Facades\DB; use Webkul\Ui\DataGrid\DataGrid; -use DB; -/** - * Catalog Rule DataGrid class - * - * @author Jitendra Singh - * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) - */ class CatalogRuleDataGrid extends DataGrid { protected $index = 'id'; @@ -20,7 +14,7 @@ class CatalogRuleDataGrid extends DataGrid public function prepareQueryBuilder() { $queryBuilder = DB::table('catalog_rules') - ->addSelect('catalog_rules.id', 'name', 'status', 'starts_from', 'ends_till', 'sort_order'); + ->addSelect('catalog_rules.id', 'name', 'status', 'starts_from', 'ends_till', 'sort_order'); $this->setQueryBuilder($queryBuilder); } @@ -28,80 +22,81 @@ class CatalogRuleDataGrid extends DataGrid public function addColumns() { $this->addColumn([ - 'index' => 'id', - 'label' => trans('admin::app.datagrid.id'), - 'type' => 'number', + 'index' => 'id', + 'label' => trans('admin::app.datagrid.id'), + 'type' => 'number', 'searchable' => false, - 'sortable' => true, - 'filterable' => true - ]); - - $this->addColumn([ - 'index' => 'name', - 'label' => trans('admin::app.datagrid.name'), - 'type' => 'string', - 'searchable' => true, - 'sortable' => true, - 'filterable' => true - ]); - - $this->addColumn([ - 'index' => 'starts_from', - 'label' => trans('admin::app.datagrid.start'), - 'type' => 'datetime', - 'sortable' => true, - 'searchable' => false, - 'filterable' => true - ]); - - $this->addColumn([ - 'index' => 'ends_till', - 'label' => trans('admin::app.datagrid.end'), - 'type' => 'datetime', - 'sortable' => true, - 'searchable' => false, - 'filterable' => true - ]); - - $this->addColumn([ - 'index' => 'status', - 'label' => trans('admin::app.status'), - 'type' => 'boolean', - 'searchable' => true, - 'sortable' => true, + 'sortable' => true, 'filterable' => true, - 'wrapper' => function($value) { - if ($value->status == 1) - return trans('admin::app.datagrid.active'); - else - return trans('admin::app.datagrid.inactive'); - } ]); $this->addColumn([ - 'index' => 'sort_order', - 'label' => trans('admin::app.datagrid.priority'), - 'type' => 'number', + 'index' => 'name', + 'label' => trans('admin::app.datagrid.name'), + 'type' => 'string', 'searchable' => true, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, + ]); + + $this->addColumn([ + 'index' => 'starts_from', + 'label' => trans('admin::app.datagrid.start'), + 'type' => 'datetime', + 'sortable' => true, + 'searchable' => false, + 'filterable' => true, + ]); + + $this->addColumn([ + 'index' => 'ends_till', + 'label' => trans('admin::app.datagrid.end'), + 'type' => 'datetime', + 'sortable' => true, + 'searchable' => false, + 'filterable' => true, + ]); + + $this->addColumn([ + 'index' => 'status', + 'label' => trans('admin::app.status'), + 'type' => 'boolean', + 'searchable' => true, + 'sortable' => true, + 'filterable' => true, + 'wrapper' => function($value) { + if ($value->status == 1) { + return trans('admin::app.datagrid.active'); + } else { + return trans('admin::app.datagrid.inactive'); + } + }, + ]); + + $this->addColumn([ + 'index' => 'sort_order', + 'label' => trans('admin::app.datagrid.priority'), + 'type' => 'number', + 'searchable' => true, + 'sortable' => true, + 'filterable' => true, ]); } public function prepareActions() { $this->addAction([ - 'title' => 'Edit Catalog Rule', + 'title' => trans('admin::app.datagrid.edit'), 'method' => 'GET', - 'route' => 'admin.catalog-rules.edit', - 'icon' => 'icon pencil-lg-icon' + 'route' => 'admin.catalog-rules.edit', + 'icon' => 'icon pencil-lg-icon', ]); $this->addAction([ - 'title' => 'Delete Catalog Rule', + 'title' => trans('admin::app.datagrid.delete'), 'method' => 'POST', - 'route' => 'admin.catalog-rules.delete', - 'icon' => 'icon trash-icon' + 'route' => 'admin.catalog-rules.delete', + 'icon' => 'icon trash-icon', ]); } } diff --git a/packages/Webkul/Admin/src/DataGrids/CategoryDataGrid.php b/packages/Webkul/Admin/src/DataGrids/CategoryDataGrid.php index 44b174a7b..092814009 100755 --- a/packages/Webkul/Admin/src/DataGrids/CategoryDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/CategoryDataGrid.php @@ -2,32 +2,26 @@ namespace Webkul\Admin\DataGrids; +use Illuminate\Support\Facades\DB; use Webkul\Ui\DataGrid\DataGrid; -use DB; -/** - * CategoryDataGrid Class - * - * @author Prashant Singh @prashant-webkul - * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) - */ class CategoryDataGrid extends DataGrid { - protected $index = 'category_id'; //the column that needs to be treated as index column + protected $index = 'category_id'; - protected $sortOrder = 'desc'; //asc or desc + protected $sortOrder = 'desc'; public function prepareQueryBuilder() { $queryBuilder = DB::table('categories as cat') - ->select('cat.id as category_id', 'ct.name', 'cat.position', 'cat.status', 'ct.locale', - DB::raw('COUNT(DISTINCT ' . DB::getTablePrefix() . 'pc.product_id) as count')) - ->leftJoin('category_translations as ct', function($leftJoin) { - $leftJoin->on('cat.id', '=', 'ct.category_id') - ->where('ct.locale', app()->getLocale()); - }) - ->leftJoin('product_categories as pc', 'cat.id', '=', 'pc.category_id') - ->groupBy('cat.id'); + ->select('cat.id as category_id', 'ct.name', 'cat.position', 'cat.status', 'ct.locale', + DB::raw('COUNT(DISTINCT ' . DB::getTablePrefix() . 'pc.product_id) as count')) + ->leftJoin('category_translations as ct', function($leftJoin) { + $leftJoin->on('cat.id', '=', 'ct.category_id') + ->where('ct.locale', app()->getLocale()); + }) + ->leftJoin('product_categories as pc', 'cat.id', '=', 'pc.category_id') + ->groupBy('cat.id'); $this->addFilter('category_id', 'cat.id'); @@ -38,71 +32,73 @@ class CategoryDataGrid extends DataGrid public function addColumns() { $this->addColumn([ - 'index' => 'category_id', - 'label' => trans('admin::app.datagrid.id'), - 'type' => 'number', + 'index' => 'category_id', + 'label' => trans('admin::app.datagrid.id'), + 'type' => 'number', 'searchable' => false, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); $this->addColumn([ - 'index' => 'name', - 'label' => trans('admin::app.datagrid.name'), - 'type' => 'string', + 'index' => 'name', + 'label' => trans('admin::app.datagrid.name'), + 'type' => 'string', 'searchable' => true, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); $this->addColumn([ - 'index' => 'position', - 'label' => trans('admin::app.datagrid.position'), - 'type' => 'number', + 'index' => 'position', + 'label' => trans('admin::app.datagrid.position'), + 'type' => 'number', 'searchable' => false, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); $this->addColumn([ - 'index' => 'status', - 'label' => trans('admin::app.datagrid.status'), - 'type' => 'boolean', - 'sortable' => true, + 'index' => 'status', + 'label' => trans('admin::app.datagrid.status'), + 'type' => 'boolean', + 'sortable' => true, 'searchable' => true, 'filterable' => true, - 'wrapper' => function($value) { - if ($value->status == 1) - return 'Active'; - else - return 'Inactive'; - } + 'wrapper' => function($value) { + if ($value->status == 1) { + return trans('admin::app.datagrid.active'); + } else { + return trans('admin::app.datagrid.inactive'); + } + }, ]); $this->addColumn([ - 'index' => 'count', - 'label' => trans('admin::app.datagrid.no-of-products'), - 'type' => 'number', - 'sortable' => true, + 'index' => 'count', + 'label' => trans('admin::app.datagrid.no-of-products'), + 'type' => 'number', + 'sortable' => true, 'searchable' => false, - 'filterable' => false + 'filterable' => false, ]); } - public function prepareActions() { + public function prepareActions() + { $this->addAction([ - 'title' => 'Edit Category', - 'method' => 'GET', // use GET request only for redirect purposes - 'route' => 'admin.catalog.categories.edit', - 'icon' => 'icon pencil-lg-icon' + 'title' => trans('admin::app.datagrid.edit'), + 'method' => 'GET', + 'route' => 'admin.catalog.categories.edit', + 'icon' => 'icon pencil-lg-icon', ]); $this->addAction([ - 'title' => 'Delete Category', - 'method' => 'POST', // use GET request only for redirect purposes - 'route' => 'admin.catalog.categories.delete', + 'title' => trans('admin::app.datagrid.delete'), + 'method' => 'POST', + 'route' => 'admin.catalog.categories.delete', 'confirm_text' => trans('ui::app.datagrid.massaction.delete', ['resource' => 'product']), - 'icon' => 'icon trash-icon' + 'icon' => 'icon trash-icon', ]); } } \ No newline at end of file diff --git a/packages/Webkul/Admin/src/DataGrids/ChannelDataGrid.php b/packages/Webkul/Admin/src/DataGrids/ChannelDataGrid.php index faddf7634..8547237f6 100755 --- a/packages/Webkul/Admin/src/DataGrids/ChannelDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/ChannelDataGrid.php @@ -2,20 +2,14 @@ namespace Webkul\Admin\DataGrids; +use Illuminate\Support\Facades\DB; use Webkul\Ui\DataGrid\DataGrid; -use DB; -/** - * ChannelDataGrid class - * - * @author Prashant Singh @prashant-webkul - * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) - */ class ChannelDataGrid extends DataGrid { - protected $index = 'id'; //the column that needs to be treated as index column + protected $index = 'id'; - protected $sortOrder = 'desc'; //asc or desc + protected $sortOrder = 'desc'; public function prepareQueryBuilder() { @@ -27,56 +21,57 @@ class ChannelDataGrid extends DataGrid public function addColumns() { $this->addColumn([ - 'index' => 'id', - 'label' => trans('admin::app.datagrid.id'), - 'type' => 'number', + 'index' => 'id', + 'label' => trans('admin::app.datagrid.id'), + 'type' => 'number', 'searchable' => false, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); $this->addColumn([ - 'index' => 'code', - 'label' => trans('admin::app.datagrid.code'), - 'type' => 'string', + 'index' => 'code', + 'label' => trans('admin::app.datagrid.code'), + 'type' => 'string', 'searchable' => true, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); $this->addColumn([ - 'index' => 'name', - 'label' => trans('admin::app.datagrid.name'), - 'type' => 'string', + 'index' => 'name', + 'label' => trans('admin::app.datagrid.name'), + 'type' => 'string', 'searchable' => true, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); $this->addColumn([ - 'index' => 'hostname', - 'label' => trans('admin::app.datagrid.hostname'), - 'type' => 'string', - 'sortable' => true, + 'index' => 'hostname', + 'label' => trans('admin::app.datagrid.hostname'), + 'type' => 'string', + 'sortable' => true, 'searchable' => true, - 'filterable' => true + 'filterable' => true, ]); } - public function prepareActions() { + public function prepareActions() + { $this->addAction([ - 'title' => 'Edit Channel', - 'method' => 'GET', // use GET request only for redirect purposes - 'route' => 'admin.channels.edit', - 'icon' => 'icon pencil-lg-icon' + 'title' => trans('admin::app.datagrid.edit'), + 'method' => 'GET', + 'route' => 'admin.channels.edit', + 'icon' => 'icon pencil-lg-icon', ]); $this->addAction([ - 'title' => 'Delete Channel', - 'method' => 'POST', // use GET request only for redirect purposes - 'route' => 'admin.channels.delete', + 'title' => trans('admin::app.datagrid.delete'), + 'method' => 'POST', + 'route' => 'admin.channels.delete', 'confirm_text' => trans('ui::app.datagrid.massaction.delete', ['resource' => 'product']), - 'icon' => 'icon trash-icon' + 'icon' => 'icon trash-icon', ]); } } \ No newline at end of file diff --git a/packages/Webkul/Admin/src/DataGrids/CouponsDataGrid.php b/packages/Webkul/Admin/src/DataGrids/CouponsDataGrid.php index ea6c4b026..4af55c2b2 100644 --- a/packages/Webkul/Admin/src/DataGrids/CouponsDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/CouponsDataGrid.php @@ -2,26 +2,20 @@ namespace Webkul\Admin\DataGrids; +use Illuminate\Support\Facades\DB; use Webkul\Ui\DataGrid\DataGrid; -use DB; -/** - * Cart Rule DataGrid class - * - * @author Prashant Singh @prashant-webkul - * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) - */ class CartRuleCouponsDataGrid extends DataGrid { - protected $index = 'id'; //the column that needs to be treated as index column + protected $index = 'id'; - protected $sortOrder = 'desc'; //asc or desc + protected $sortOrder = 'desc'; public function prepareQueryBuilder() { $queryBuilder = DB::table('cart_rules') - ->select('id') - ->addSelect('id', 'code', 'limit', 'usage_per_customer', 'usage_throttle'); + ->select('id') + ->addSelect('id', 'code', 'limit', 'usage_per_customer', 'usage_throttle'); $this->setQueryBuilder($queryBuilder); } @@ -29,68 +23,55 @@ class CartRuleCouponsDataGrid extends DataGrid public function addColumns() { $this->addColumn([ - 'index' => 'id', - 'label' => trans('admin::app.datagrid.id'), - 'type' => 'number', + 'index' => 'id', + 'label' => trans('admin::app.datagrid.id'), + 'type' => 'number', 'searchable' => false, - 'sortable' => true, - 'filterable' => true - ]); - - $this->addColumn([ - 'index' => 'code', - 'label' => trans('admin::app.datagrid.code'), - 'type' => 'string', - 'searchable' => false, - 'sortable' => true, - 'filterable' => true - ]); - - $this->addColumn([ - 'index' => 'limit', - 'label' => trans('admin::app.datagrid.limit'), - 'type' => 'string', - 'searchable' => false, - 'sortable' => true, - 'filterable' => true - ]); - - $this->addColumn([ - 'index' => 'limit', - 'label' => trans('admin::app.datagrid.limit'), - 'type' => 'string', - 'searchable' => false, - 'sortable' => true, - 'filterable' => true - ]); - - $this->addColumn([ - 'index' => 'usage_per_customer', - 'label' => trans('admin::app.datagrid.usage-per-customer'), - 'type' => 'boolean', - 'searchable' => false, - 'sortable' => true, + 'sortable' => true, 'filterable' => true, - 'wrapper' => function($value) { - if ($value->end_other_rules == 1) - return 'true'; - else - return 'false'; - } ]); - } - public function prepareActions() - { - } + $this->addColumn([ + 'index' => 'code', + 'label' => trans('admin::app.datagrid.code'), + 'type' => 'string', + 'searchable' => false, + 'sortable' => true, + 'filterable' => true, + ]); - public function prepareMassActions() - { - // $this->addMassAction([ - // 'type' => 'delete', - // 'action' => route('admin.catalog.attributes.massdelete'), - // 'label' => trans('admin::app.datagrid.delete'), - // 'method' => 'DELETE' - // ]); + $this->addColumn([ + 'index' => 'limit', + 'label' => trans('admin::app.datagrid.limit'), + 'type' => 'string', + 'searchable' => false, + 'sortable' => true, + 'filterable' => true, + ]); + + $this->addColumn([ + 'index' => 'limit', + 'label' => trans('admin::app.datagrid.limit'), + 'type' => 'string', + 'searchable' => false, + 'sortable' => true, + 'filterable' => true, + ]); + + $this->addColumn([ + 'index' => 'usage_per_customer', + 'label' => trans('admin::app.datagrid.usage-per-customer'), + 'type' => 'boolean', + 'searchable' => false, + 'sortable' => true, + 'filterable' => true, + 'wrapper' => function($value) { + if ($value->end_other_rules == 1) { + return trans('admin::app.datagrid.true'); + } else { + return trans('admin::app.datagrid.false'); + } + }, + ]); } } diff --git a/packages/Webkul/Admin/src/DataGrids/CurrencyDataGrid.php b/packages/Webkul/Admin/src/DataGrids/CurrencyDataGrid.php index 48810b6e8..63b9a1dcf 100755 --- a/packages/Webkul/Admin/src/DataGrids/CurrencyDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/CurrencyDataGrid.php @@ -2,20 +2,14 @@ namespace Webkul\Admin\DataGrids; +use Illuminate\Support\Facades\DB; use Webkul\Ui\DataGrid\DataGrid; -use DB; -/** - * CurrencyDataGrid class - * - * @author Prashant Singh @prashant-webkul - * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) - */ class CurrencyDataGrid extends DataGrid { - protected $index = 'id'; //the column that needs to be treated as index column + protected $index = 'id'; - protected $sortOrder = 'desc'; //asc or desc + protected $sortOrder = 'desc'; public function prepareQueryBuilder() { @@ -27,46 +21,47 @@ class CurrencyDataGrid extends DataGrid public function addColumns() { $this->addColumn([ - 'index' => 'id', - 'label' => trans('admin::app.datagrid.id'), - 'type' => 'number', + 'index' => 'id', + 'label' => trans('admin::app.datagrid.id'), + 'type' => 'number', 'searchable' => false, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); $this->addColumn([ - 'index' => 'name', - 'label' => trans('admin::app.datagrid.name'), - 'type' => 'string', + 'index' => 'name', + 'label' => trans('admin::app.datagrid.name'), + 'type' => 'string', 'searchable' => true, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); $this->addColumn([ - 'index' => 'code', - 'label' => trans('admin::app.datagrid.code'), - 'type' => 'string', + 'index' => 'code', + 'label' => trans('admin::app.datagrid.code'), + 'type' => 'string', 'searchable' => true, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); } - public function prepareActions() { + public function prepareActions() + { $this->addAction([ - 'title' => 'Edit Currency', - 'method' => 'GET', // use GET request only for redirect purposes - 'route' => 'admin.currencies.edit', - 'icon' => 'icon pencil-lg-icon' + 'title' => trans('admin::app.datagrid.edit'), + 'method' => 'GET', + 'route' => 'admin.currencies.edit', + 'icon' => 'icon pencil-lg-icon', ]); $this->addAction([ - 'title' => 'Delete Currency', - 'method' => 'POST', // use GET request only for redirect purposes - 'route' => 'admin.currencies.delete', - 'icon' => 'icon trash-icon' + 'title' => trans('admin::app.datagrid.delete'), + 'method' => 'POST', + 'route' => 'admin.currencies.delete', + 'icon' => 'icon trash-icon', ]); } } \ No newline at end of file diff --git a/packages/Webkul/Admin/src/DataGrids/CustomerDataGrid.php b/packages/Webkul/Admin/src/DataGrids/CustomerDataGrid.php index 6ffaaa713..2af7c38e7 100755 --- a/packages/Webkul/Admin/src/DataGrids/CustomerDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/CustomerDataGrid.php @@ -2,30 +2,23 @@ namespace Webkul\Admin\DataGrids; +use Illuminate\Support\Facades\DB; use Webkul\Ui\DataGrid\DataGrid; -use DB; -/** - * CustomerDataGrid class - * - * @author Prashant Singh @prashant-webkul - * @author Vivek Sharma @viveksh-webkul - * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) - */ class CustomerDataGrid extends DataGrid { - protected $index = 'customer_id'; //the column that needs to be treated as index column + protected $index = 'customer_id'; - protected $sortOrder = 'desc'; //asc or desc + protected $sortOrder = 'desc'; protected $itemsPerPage = 10; public function prepareQueryBuilder() { $queryBuilder = DB::table('customers') - ->leftJoin('customer_groups', 'customers.customer_group_id', '=', 'customer_groups.id') - ->addSelect('customers.id as customer_id', 'customers.email', 'customer_groups.name', 'customers.phone', 'customers.gender', 'status') - ->addSelect(DB::raw('CONCAT(' . DB::getTablePrefix() . 'customers.first_name, " ", ' . DB::getTablePrefix() . 'customers.last_name) as full_name')); + ->leftJoin('customer_groups', 'customers.customer_group_id', '=', 'customer_groups.id') + ->addSelect('customers.id as customer_id', 'customers.email', 'customer_groups.name', 'customers.phone', 'customers.gender', 'status') + ->addSelect(DB::raw('CONCAT(' . DB::getTablePrefix() . 'customers.first_name, " ", ' . DB::getTablePrefix() . 'customers.last_name) as full_name')); $this->addFilter('customer_id', 'customers.id'); $this->addFilter('full_name', DB::raw('CONCAT(' . DB::getTablePrefix() . 'customers.first_name, " ", ' . DB::getTablePrefix() . 'customers.last_name)')); @@ -38,119 +31,122 @@ class CustomerDataGrid extends DataGrid public function addColumns() { $this->addColumn([ - 'index' => 'customer_id', - 'label' => trans('admin::app.datagrid.id'), - 'type' => 'number', + 'index' => 'customer_id', + 'label' => trans('admin::app.datagrid.id'), + 'type' => 'number', 'searchable' => false, - 'sortable' => true, - 'filterable' => true - ]); - - $this->addColumn([ - 'index' => 'full_name', - 'label' => trans('admin::app.datagrid.name'), - 'type' => 'string', - 'searchable' => true, - 'sortable' => true, - 'filterable' => true - ]); - - $this->addColumn([ - 'index' => 'email', - 'label' => trans('admin::app.datagrid.email'), - 'type' => 'string', - 'searchable' => true, - 'sortable' => true, - 'filterable' => true - ]); - - $this->addColumn([ - 'index' => 'name', - 'label' => trans('admin::app.datagrid.group'), - 'type' => 'string', - 'searchable' => false, - 'sortable' => true, - 'filterable' => true - ]); - - $this->addColumn([ - 'index' => 'phone', - 'label' => trans('admin::app.datagrid.phone'), - 'type' => 'number', - 'searchable' => true, - 'sortable' => true, - 'filterable' => false, - 'closure' => true, - 'wrapper' => function ($row) { - if (! $row->phone) - return '-'; - else - return $row->phone; - } - ]); - - $this->addColumn([ - 'index' => 'gender', - 'label' => trans('admin::app.datagrid.gender'), - 'type' => 'string', - 'searchable' => false, - 'sortable' => true, - 'filterable' => false, - 'closure' => true, - 'wrapper' => function ($row) { - if (! $row->gender) - return '-'; - else - return $row->gender; - } - ]); - - $this->addColumn([ - 'index' => 'status', - 'label' => trans('admin::app.datagrid.status'), - 'type' => 'boolean', - 'searchable' => false, - 'sortable' => true, + 'sortable' => true, 'filterable' => true, - 'closure' => true, - 'wrapper' => function ($row) { + ]); + + $this->addColumn([ + 'index' => 'full_name', + 'label' => trans('admin::app.datagrid.name'), + 'type' => 'string', + 'searchable' => true, + 'sortable' => true, + 'filterable' => true, + ]); + + $this->addColumn([ + 'index' => 'email', + 'label' => trans('admin::app.datagrid.email'), + 'type' => 'string', + 'searchable' => true, + 'sortable' => true, + 'filterable' => true, + ]); + + $this->addColumn([ + 'index' => 'name', + 'label' => trans('admin::app.datagrid.group'), + 'type' => 'string', + 'searchable' => false, + 'sortable' => true, + 'filterable' => true, + ]); + + $this->addColumn([ + 'index' => 'phone', + 'label' => trans('admin::app.datagrid.phone'), + 'type' => 'number', + 'searchable' => true, + 'sortable' => true, + 'filterable' => false, + 'closure' => true, + 'wrapper' => function ($row) { + if (! $row->phone) { + return '-'; + } else { + return $row->phone; + } + }, + ]); + + $this->addColumn([ + 'index' => 'gender', + 'label' => trans('admin::app.datagrid.gender'), + 'type' => 'string', + 'searchable' => false, + 'sortable' => true, + 'filterable' => false, + 'closure' => true, + 'wrapper' => function ($row) { + if (! $row->gender) { + return '-'; + } else { + return $row->gender; + } + }, + ]); + + $this->addColumn([ + 'index' => 'status', + 'label' => trans('admin::app.datagrid.status'), + 'type' => 'boolean', + 'searchable' => false, + 'sortable' => true, + 'filterable' => true, + 'closure' => true, + 'wrapper' => function ($row) { if ($row->status == 1) { return ''. trans('admin::app.customers.customers.active') .''; } else { return ''. trans('admin::app.customers.customers.inactive') .''; } - } + }, ]); } - public function prepareActions() { + public function prepareActions() + { $this->addAction([ - 'method' => 'GET', // use GET request only for redirect purposes - 'route' => 'admin.customer.edit', - 'icon' => 'icon pencil-lg-icon', - 'title' => trans('admin::app.customers.customers.edit-help-title') + 'method' => 'GET', + 'route' => 'admin.customer.edit', + 'icon' => 'icon pencil-lg-icon', + 'title' => trans('admin::app.customers.customers.edit-help-title'), ]); $this->addAction([ - 'type' => 'Edit', - 'method' => 'GET', //use post only for redirects only - 'route' => 'admin.customer.addresses.index', - 'icon' => 'icon list-icon', - 'title' => trans('admin::app.customers.customers.addresses') + 'type' => 'Edit', + 'method' => 'GET', + 'route' => 'admin.customer.addresses.index', + 'icon' => 'icon list-icon', + 'title' => trans('admin::app.customers.customers.addresses'), ]); $this->addAction([ - 'method' => 'POST', // use GET request only for redirect purposes - 'route' => 'admin.customer.delete', - 'icon' => 'icon trash-icon', - 'title' => trans('admin::app.customers.customers.delete-help-title') + 'method' => 'POST', + 'route' => 'admin.customer.delete', + 'icon' => 'icon trash-icon', + 'title' => trans('admin::app.customers.customers.delete-help-title'), ]); $this->addAction([ 'method' => 'GET', - 'route' => 'admin.customer.note.create', - 'icon' => 'icon note-icon', - 'title' => trans('admin::app.customers.note.help-title') + 'route' => 'admin.customer.note.create', + 'icon' => 'icon note-icon', + 'title' => trans('admin::app.customers.note.help-title'), ]); } @@ -160,23 +156,21 @@ class CustomerDataGrid extends DataGrid public function prepareMassActions() { $this->addMassAction([ - 'type' => 'delete', - 'label' => trans('admin::app.datagrid.delete'), + 'type' => 'delete', + 'label' => trans('admin::app.datagrid.delete'), 'action' => route('admin.customer.mass-delete'), 'method' => 'PUT', ]); $this->addMassAction([ - 'type' => 'update', - 'label' => trans('admin::app.datagrid.update-status'), - 'action' => route('admin.customer.mass-update'), - 'method' => 'PUT', + 'type' => 'update', + 'label' => trans('admin::app.datagrid.update-status'), + 'action' => route('admin.customer.mass-update'), + 'method' => 'PUT', 'options' => [ - 'Active' => 1, - 'Inactive' => 0 - ] + 'Active' => 1, + 'Inactive' => 0, + ], ]); - - $this->enableMassAction = true; } } \ No newline at end of file diff --git a/packages/Webkul/Admin/src/DataGrids/CustomerGroupDataGrid.php b/packages/Webkul/Admin/src/DataGrids/CustomerGroupDataGrid.php index 77ae624de..0316cfa24 100755 --- a/packages/Webkul/Admin/src/DataGrids/CustomerGroupDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/CustomerGroupDataGrid.php @@ -2,20 +2,14 @@ namespace Webkul\Admin\DataGrids; +use Illuminate\Support\Facades\DB; use Webkul\Ui\DataGrid\DataGrid; -use DB; -/** - * CustomerDataGrid class - * - * @author Prashant Singh @prashant-webkul - * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) - */ class CustomerGroupDataGrid extends DataGrid { - protected $index = 'id'; //the column that needs to be treated as index column + protected $index = 'id'; - protected $sortOrder = 'desc'; //asc or desc + protected $sortOrder = 'desc'; public function prepareQueryBuilder() { @@ -27,46 +21,47 @@ class CustomerGroupDataGrid extends DataGrid public function addColumns() { $this->addColumn([ - 'index' => 'id', - 'label' => trans('admin::app.datagrid.id'), - 'type' => 'number', + 'index' => 'id', + 'label' => trans('admin::app.datagrid.id'), + 'type' => 'number', 'searchable' => false, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); $this->addColumn([ - 'index' => 'code', - 'label' => trans('admin::app.datagrid.code'), - 'type' => 'string', + 'index' => 'code', + 'label' => trans('admin::app.datagrid.code'), + 'type' => 'string', 'searchable' => false, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); $this->addColumn([ - 'index' => 'name', - 'label' => trans('admin::app.datagrid.name'), - 'type' => 'string', + 'index' => 'name', + 'label' => trans('admin::app.datagrid.name'), + 'type' => 'string', 'searchable' => true, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); } - public function prepareActions() { + public function prepareActions() + { $this->addAction([ - 'title' => 'Edit Customer Group', - 'method' => 'GET', // use GET request only for redirect purposes - 'route' => 'admin.groups.edit', - 'icon' => 'icon pencil-lg-icon' + 'title' => trans('admin::app.datagrid.edit'), + 'method' => 'GET', + 'route' => 'admin.groups.edit', + 'icon' => 'icon pencil-lg-icon', ]); $this->addAction([ - 'title' => 'Delete Customer Group', - 'method' => 'POST', // use GET request only for redirect purposes - 'route' => 'admin.groups.delete', - 'icon' => 'icon trash-icon' + 'title' => trans('admin::app.datagrid.delete'), + 'method' => 'POST', + 'route' => 'admin.groups.delete', + 'icon' => 'icon trash-icon', ]); } } \ No newline at end of file diff --git a/packages/Webkul/Admin/src/DataGrids/CustomerReviewDataGrid.php b/packages/Webkul/Admin/src/DataGrids/CustomerReviewDataGrid.php index c5d71b4a1..257d3c8a8 100755 --- a/packages/Webkul/Admin/src/DataGrids/CustomerReviewDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/CustomerReviewDataGrid.php @@ -2,20 +2,14 @@ namespace Webkul\Admin\DataGrids; +use Illuminate\Support\Facades\DB; use Webkul\Ui\DataGrid\DataGrid; -use DB; -/** - * CustomerReviewDataGrid Class - * - * @author Prashant Singh @prashant-webkul - * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) - */ class CustomerReviewDataGrid extends DataGrid { - protected $index = 'product_review_id'; //column that needs to be treated as index column + protected $index = 'product_review_id'; - protected $sortOrder = 'desc'; //asc or desc + protected $sortOrder = 'desc'; public function prepareQueryBuilder() { @@ -35,95 +29,98 @@ class CustomerReviewDataGrid extends DataGrid public function addColumns() { $this->addColumn([ - 'index' => 'product_review_id', - 'label' => trans('admin::app.datagrid.id'), - 'type' => 'number', + 'index' => 'product_review_id', + 'label' => trans('admin::app.datagrid.id'), + 'type' => 'number', 'searchable' => false, - 'sortable' => true, - 'filterable' => true - ]); - - $this->addColumn([ - 'index' => 'title', - 'label' => trans('admin::app.datagrid.title'), - 'type' => 'string', - 'searchable' => true, - 'sortable' => true, - 'filterable' => true - ]); - - $this->addColumn([ - 'index' => 'comment', - 'label' => trans('admin::app.datagrid.comment'), - 'type' => 'string', - 'searchable' => true, - 'sortable' => true, - 'filterable' => true - ]); - - $this->addColumn([ - 'index' => 'product_name', - 'label' => trans('admin::app.datagrid.product-name'), - 'type' => 'string', - 'searchable' => true, - 'sortable' => true, - 'filterable' => false - ]); - - $this->addColumn([ - 'index' => 'product_review_status', - 'label' => trans('admin::app.datagrid.status'), - 'type' => 'string', - 'searchable' => true, - 'sortable' => true, - 'width' => '100px', + 'sortable' => true, 'filterable' => true, - 'closure' => true, - 'wrapper' => function ($value) { - if ($value->product_review_status == 'approved') - return 'Approved'; - else if ($value->product_review_status == "pending") - return 'Pending'; - else if ($value->product_review_status == "disapproved") - return 'Disapproved'; + ]); + + $this->addColumn([ + 'index' => 'title', + 'label' => trans('admin::app.datagrid.title'), + 'type' => 'string', + 'searchable' => true, + 'sortable' => true, + 'filterable' => true, + ]); + + $this->addColumn([ + 'index' => 'comment', + 'label' => trans('admin::app.datagrid.comment'), + 'type' => 'string', + 'searchable' => true, + 'sortable' => true, + 'filterable' => true, + ]); + + $this->addColumn([ + 'index' => 'product_name', + 'label' => trans('admin::app.datagrid.product-name'), + 'type' => 'string', + 'searchable' => true, + 'sortable' => true, + 'filterable' => false, + ]); + + $this->addColumn([ + 'index' => 'product_review_status', + 'label' => trans('admin::app.datagrid.status'), + 'type' => 'string', + 'searchable' => true, + 'sortable' => true, + 'width' => '100px', + 'filterable' => true, + 'closure' => true, + 'wrapper' => function ($value) { + if ($value->product_review_status == 'approved') { + return '' . trans('admin::app.datagrid.approved') . ''; + } elseif ($value->product_review_status == "pending") { + return '' . trans('admin::app.datagrid.pending') . ''; + } elseif ($value->product_review_status == "disapproved") { + return '' . trans('admin::app.datagrid.disapproved') . ''; + } }, ]); } - public function prepareActions() { + public function prepareActions() + { $this->addAction([ - 'title' => 'Edit Customer Review', - 'method' => 'GET', // use GET request only for redirect purposes - 'route' => 'admin.customer.review.edit', - 'icon' => 'icon pencil-lg-icon' + 'title' => trans('admin::app.datagrid.edit'), + 'method' => 'GET', + 'route' => 'admin.customer.review.edit', + 'icon' => 'icon pencil-lg-icon', ]); $this->addAction([ - 'title' => 'Delete Customer Review', - 'method' => 'POST', // use GET request only for redirect purposes - 'route' => 'admin.customer.review.delete', - 'icon' => 'icon trash-icon' + 'title' => trans('admin::app.datagrid.delete'), + 'method' => 'POST', + 'route' => 'admin.customer.review.delete', + 'icon' => 'icon trash-icon', ]); } - public function prepareMassActions() { + public function prepareMassActions() + { $this->addMassAction([ - 'type' => 'delete', - 'label' => trans('admin::app.datagrid.delete'), + 'type' => 'delete', + 'label' => trans('admin::app.datagrid.delete'), 'action' => route('admin.customer.review.massdelete'), - 'method' => 'DELETE' + 'method' => 'DELETE', ]); $this->addMassAction([ - 'type' => 'update', - 'label' => trans('admin::app.datagrid.update-status'), - 'action' => route('admin.customer.review.massupdate'), - 'method' => 'PUT', + 'type' => 'update', + 'label' => trans('admin::app.datagrid.update-status'), + 'action' => route('admin.customer.review.massupdate'), + 'method' => 'PUT', 'options' => [ - 'Pending' => 0, - 'Approve' => 1, - 'Disapprove' => 2 - ] + 'Pending' => 0, + 'Approve' => 1, + 'Disapprove' => 2, + ], ]); } } \ No newline at end of file diff --git a/packages/Webkul/Admin/src/DataGrids/ExchangeRatesDataGrid.php b/packages/Webkul/Admin/src/DataGrids/ExchangeRatesDataGrid.php index 3357b34fc..468b43af9 100755 --- a/packages/Webkul/Admin/src/DataGrids/ExchangeRatesDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/ExchangeRatesDataGrid.php @@ -2,24 +2,20 @@ namespace Webkul\Admin\DataGrids; +use Illuminate\Support\Facades\DB; use Webkul\Ui\DataGrid\DataGrid; -use DB; -/** - * ExchangeRateDataGrid Class - * - * @author Prashant Singh @prashant-webkul - * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) - */ class ExchangeRatesDataGrid extends DataGrid { protected $index = 'currency_exch_id'; - protected $sortOrder = 'desc'; //asc or desc + protected $sortOrder = 'desc'; public function prepareQueryBuilder() { - $queryBuilder = DB::table('currency_exchange_rates as cer')->addSelect('cer.id as currency_exch_id', 'curr.name', 'cer.rate')->leftJoin('currencies as curr', 'cer.target_currency', '=', 'curr.id'); + $queryBuilder = DB::table('currency_exchange_rates as cer') + ->leftJoin('currencies as curr', 'cer.target_currency', '=', 'curr.id') + ->addSelect('cer.id as currency_exch_id', 'curr.name', 'cer.rate'); $this->addFilter('currency_exch_id', 'cer.id'); @@ -29,47 +25,48 @@ class ExchangeRatesDataGrid extends DataGrid public function addColumns() { $this->addColumn([ - 'index' => 'currency_exch_id', - 'label' => trans('admin::app.datagrid.id'), - 'type' => 'number', + 'index' => 'currency_exch_id', + 'label' => trans('admin::app.datagrid.id'), + 'type' => 'number', 'searchable' => false, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); $this->addColumn([ - 'index' => 'name', - 'label' => trans('admin::app.datagrid.currency-name'), - 'type' => 'string', + 'index' => 'name', + 'label' => trans('admin::app.datagrid.currency-name'), + 'type' => 'string', 'searchable' => true, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); $this->addColumn([ - 'index' => 'rate', - 'label' => trans('admin::app.datagrid.exch-rate'), - 'type' => 'number', + 'index' => 'rate', + 'label' => trans('admin::app.datagrid.exch-rate'), + 'type' => 'number', 'searchable' => true, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); } - public function prepareActions() { + public function prepareActions() + { $this->addAction([ - 'title' => 'Edit Exchange Rate', - 'method' => 'GET', // use GET request only for redirect purposes - 'route' => 'admin.exchange_rates.edit', - 'icon' => 'icon pencil-lg-icon' + 'title' => trans('admin::app.datagrid.edit'), + 'method' => 'GET', + 'route' => 'admin.exchange_rates.edit', + 'icon' => 'icon pencil-lg-icon', ]); $this->addAction([ - 'title' => 'Delete Exchange Rate', - 'method' => 'POST', // use GET request only for redirect purposes - 'route' => 'admin.exchange_rates.delete', + 'title' => trans('admin::app.datagrid.delete'), + 'method' => 'POST', + 'route' => 'admin.exchange_rates.delete', 'confirm_text' => trans('ui::app.datagrid.massaction.delete', ['resource' => 'Exchange Rate']), - 'icon' => 'icon trash-icon' + 'icon' => 'icon trash-icon', ]); } } \ No newline at end of file diff --git a/packages/Webkul/Admin/src/DataGrids/InventorySourcesDataGrid.php b/packages/Webkul/Admin/src/DataGrids/InventorySourcesDataGrid.php index 018eb784a..5ec09313d 100755 --- a/packages/Webkul/Admin/src/DataGrids/InventorySourcesDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/InventorySourcesDataGrid.php @@ -2,20 +2,14 @@ namespace Webkul\Admin\DataGrids; +use Illuminate\Support\Facades\DB; use Webkul\Ui\DataGrid\DataGrid; -use DB; -/** - * InventorySourcesDataGrid Class - * - * @author Prashant Singh @prashant-webkul - * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) - */ class InventorySourcesDataGrid extends DataGrid { protected $index = 'id'; - protected $sortOrder = 'desc'; //asc or desc + protected $sortOrder = 'desc'; public function prepareQueryBuilder() { @@ -27,71 +21,73 @@ class InventorySourcesDataGrid extends DataGrid public function addColumns() { $this->addColumn([ - 'index' => 'id', - 'label' => trans('admin::app.datagrid.id'), - 'type' => 'number', + 'index' => 'id', + 'label' => trans('admin::app.datagrid.id'), + 'type' => 'number', 'searchable' => false, - 'sortable' => true, - 'filterable' => true - ]); - - $this->addColumn([ - 'index' => 'code', - 'label' => trans('admin::app.datagrid.code'), - 'type' => 'string', - 'searchable' => true, - 'sortable' => true, - 'filterable' => true - ]); - - $this->addColumn([ - 'index' => 'name', - 'label' => trans('admin::app.datagrid.name'), - 'type' => 'string', - 'searchable' => true, - 'sortable' => true, - 'filterable' => true - ]); - - $this->addColumn([ - 'index' => 'priority', - 'label' => trans('admin::app.datagrid.priority'), - 'type' => 'number', - 'searchable' => true, - 'sortable' => true, - 'filterable' => true - ]); - - $this->addColumn([ - 'index' => 'status', - 'label' => trans('admin::app.datagrid.status'), - 'type' => 'boolean', - 'searchable' => true, - 'sortable' => true, + 'sortable' => true, 'filterable' => true, - 'wrapper' => function($value) { - if ($value->status == 1) - return 'Active'; - else - return 'Inactive'; - } + ]); + + $this->addColumn([ + 'index' => 'code', + 'label' => trans('admin::app.datagrid.code'), + 'type' => 'string', + 'searchable' => true, + 'sortable' => true, + 'filterable' => true, + ]); + + $this->addColumn([ + 'index' => 'name', + 'label' => trans('admin::app.datagrid.name'), + 'type' => 'string', + 'searchable' => true, + 'sortable' => true, + 'filterable' => true, + ]); + + $this->addColumn([ + 'index' => 'priority', + 'label' => trans('admin::app.datagrid.priority'), + 'type' => 'number', + 'searchable' => true, + 'sortable' => true, + 'filterable' => true, + ]); + + $this->addColumn([ + 'index' => 'status', + 'label' => trans('admin::app.datagrid.status'), + 'type' => 'boolean', + 'searchable' => true, + 'sortable' => true, + 'filterable' => true, + 'wrapper' => function($value) { + if ($value->status == 1) { + return trans('admin::app.datagrid.active'); + } else { + return trans('admin::app.datagrid.inactive'); + } + }, ]); } - public function prepareActions() { + public function prepareActions() + { $this->addAction([ - 'title' => 'Edit Inventory Source', - 'method' => 'GET', // use GET request only for redirect purposes - 'route' => 'admin.inventory_sources.edit', - 'icon' => 'icon pencil-lg-icon' + 'title' => trans('admin::app.datagrid.edit'), + 'method' => 'GET', + 'route' => 'admin.inventory_sources.edit', + 'icon' => 'icon pencil-lg-icon', ]); $this->addAction([ - 'title' => 'Delete Inventory Source', - 'method' => 'POST', // use GET request only for redirect purposes - 'route' => 'admin.inventory_sources.delete', + 'title' => trans('admin::app.datagrid.delete'), + 'method' => 'POST', + 'route' => 'admin.inventory_sources.delete', 'confirm_text' => trans('ui::app.datagrid.massaction.delete', ['resource' => 'Exchange Rate']), - 'icon' => 'icon trash-icon' + 'icon' => 'icon trash-icon', ]); } } \ No newline at end of file diff --git a/packages/Webkul/Admin/src/DataGrids/LocalesDataGrid.php b/packages/Webkul/Admin/src/DataGrids/LocalesDataGrid.php index 59f13d130..1bd30cf7c 100755 --- a/packages/Webkul/Admin/src/DataGrids/LocalesDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/LocalesDataGrid.php @@ -2,20 +2,14 @@ namespace Webkul\Admin\DataGrids; +use Illuminate\Support\Facades\DB; use Webkul\Ui\DataGrid\DataGrid; -use DB; -/** - * LocalesDataGrid Class - * - * @author Prashant Singh @prashant-webkul - * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) - */ class LocalesDataGrid extends DataGrid { protected $index = 'id'; - protected $sortOrder = 'desc'; //asc or desc + protected $sortOrder = 'desc'; public function prepareQueryBuilder() { @@ -27,63 +21,65 @@ class LocalesDataGrid extends DataGrid public function addColumns() { $this->addColumn([ - 'index' => 'id', - 'label' => trans('admin::app.datagrid.id'), - 'type' => 'number', + 'index' => 'id', + 'label' => trans('admin::app.datagrid.id'), + 'type' => 'number', 'searchable' => false, - 'sortable' => true, - 'filterable' => true - ]); - - $this->addColumn([ - 'index' => 'code', - 'label' => trans('admin::app.datagrid.code'), - 'type' => 'string', - 'searchable' => true, - 'sortable' => true, - 'filterable' => true - ]); - - $this->addColumn([ - 'index' => 'name', - 'label' => trans('admin::app.datagrid.name'), - 'type' => 'string', - 'searchable' => true, - 'sortable' => true, - 'filterable' => true - ]); - - $this->addColumn([ - 'index' => 'direction', - 'label' => trans('admin::app.datagrid.direction'), - 'type' => 'string', - 'searchable' => true, - 'sortable' => true, + 'sortable' => true, 'filterable' => true, - 'closure' => true, - 'wrapper' => function ($value) { - if ($value->direction == 'ltr') + ]); + + $this->addColumn([ + 'index' => 'code', + 'label' => trans('admin::app.datagrid.code'), + 'type' => 'string', + 'searchable' => true, + 'sortable' => true, + 'filterable' => true, + ]); + + $this->addColumn([ + 'index' => 'name', + 'label' => trans('admin::app.datagrid.name'), + 'type' => 'string', + 'searchable' => true, + 'sortable' => true, + 'filterable' => true, + ]); + + $this->addColumn([ + 'index' => 'direction', + 'label' => trans('admin::app.datagrid.direction'), + 'type' => 'string', + 'searchable' => true, + 'sortable' => true, + 'filterable' => true, + 'closure' => true, + 'wrapper' => function ($value) { + if ($value->direction == 'ltr') { return trans('admin::app.datagrid.ltr'); - else + } else { return trans('admin::app.datagrid.rtl'); - } + } + }, ]); } - public function prepareActions() { + public function prepareActions() + { $this->addAction([ - 'title' => 'Edit Locales', - 'method' => 'GET', // use GET request only for redirect purposes - 'route' => 'admin.locales.edit', - 'icon' => 'icon pencil-lg-icon' + 'title' => trans('admin::app.datagrid.edit'), + 'method' => 'GET', + 'route' => 'admin.locales.edit', + 'icon' => 'icon pencil-lg-icon', ]); $this->addAction([ - 'title' => 'Delete Locales', - 'method' => 'POST', // use GET request only for redirect purposes - 'route' => 'admin.locales.delete', + 'title' => trans('admin::app.datagrid.delete'), + 'method' => 'POST', + 'route' => 'admin.locales.delete', 'confirm_text' => trans('ui::app.datagrid.massaction.delete', ['resource' => 'Exchange Rate']), - 'icon' => 'icon trash-icon' + 'icon' => 'icon trash-icon', ]); } } \ No newline at end of file diff --git a/packages/Webkul/Admin/src/DataGrids/NewsLetterDataGrid.php b/packages/Webkul/Admin/src/DataGrids/NewsLetterDataGrid.php index acf76450c..c3a025e3d 100755 --- a/packages/Webkul/Admin/src/DataGrids/NewsLetterDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/NewsLetterDataGrid.php @@ -2,20 +2,14 @@ namespace Webkul\Admin\DataGrids; +use Illuminate\Support\Facades\DB; use Webkul\Ui\DataGrid\DataGrid; -use DB; -/** - * NewsLetterDataGrid Class - * - * @author Prashant Singh @prashant-webkul - * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) - */ class NewsLetterDataGrid extends DataGrid { protected $index = 'id'; - protected $sortOrder = 'desc'; //asc or desc + protected $sortOrder = 'desc'; public function prepareQueryBuilder() { @@ -27,53 +21,55 @@ class NewsLetterDataGrid extends DataGrid public function addColumns() { $this->addColumn([ - 'index' => 'id', - 'label' => trans('admin::app.datagrid.id'), - 'type' => 'number', + 'index' => 'id', + 'label' => trans('admin::app.datagrid.id'), + 'type' => 'number', 'searchable' => false, - 'sortable' => true, - 'filterable' => true - ]); - - $this->addColumn([ - 'index' => 'is_subscribed', - 'label' => trans('admin::app.datagrid.subscribed'), - 'type' => 'string', - 'searchable' => false, - 'sortable' => true, + 'sortable' => true, 'filterable' => true, - 'wrapper' => function($value) { - if ($value->is_subscribed == 1) - return 'True'; - else - return 'False'; - } ]); $this->addColumn([ - 'index' => 'email', - 'label' => trans('admin::app.datagrid.email'), - 'type' => 'string', + 'index' => 'is_subscribed', + 'label' => trans('admin::app.datagrid.subscribed'), + 'type' => 'string', + 'searchable' => false, + 'sortable' => true, + 'filterable' => true, + 'wrapper' => function($value) { + if ($value->is_subscribed == 1) { + return trans('admin::app.datagrid.true'); + } else { + return trans('admin::app.datagrid.false'); + } + }, + ]); + + $this->addColumn([ + 'index' => 'email', + 'label' => trans('admin::app.datagrid.email'), + 'type' => 'string', 'searchable' => true, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); } - public function prepareActions() { + public function prepareActions() + { $this->addAction([ - 'title' => 'Edit News Letter', - 'method' => 'GET', // use GET request only for redirect purposes - 'route' => 'admin.customers.subscribers.edit', - 'icon' => 'icon pencil-lg-icon' + 'title' => trans('admin::app.datagrid.edit'), + 'method' => 'GET', + 'route' => 'admin.customers.subscribers.edit', + 'icon' => 'icon pencil-lg-icon', ]); $this->addAction([ - 'title' => 'Delete News Letter', - 'method' => 'POST', // use GET request only for redirect purposes - 'route' => 'admin.customers.subscribers.delete', + 'title' => trans('admin::app.datagrid.delete'), + 'method' => 'POST', + 'route' => 'admin.customers.subscribers.delete', 'confirm_text' => trans('ui::app.datagrid.massaction.delete', ['resource' => 'Exchange Rate']), - 'icon' => 'icon trash-icon' + 'icon' => 'icon trash-icon', ]); } } \ No newline at end of file diff --git a/packages/Webkul/Admin/src/DataGrids/OrderDataGrid.php b/packages/Webkul/Admin/src/DataGrids/OrderDataGrid.php index 6fefb315d..718cb4071 100755 --- a/packages/Webkul/Admin/src/DataGrids/OrderDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/OrderDataGrid.php @@ -2,35 +2,29 @@ namespace Webkul\Admin\DataGrids; +use Illuminate\Support\Facades\DB; use Webkul\Ui\DataGrid\DataGrid; -use DB; -/** - * OrderDataGrid Class - * - * @author Prashant Singh @prashant-webkul - * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) - */ class OrderDataGrid extends DataGrid { protected $index = 'id'; - protected $sortOrder = 'desc'; //asc or desc + protected $sortOrder = 'desc'; public function prepareQueryBuilder() { $queryBuilder = DB::table('orders') - ->leftJoin('order_address as order_address_shipping', function($leftJoin) { - $leftJoin->on('order_address_shipping.order_id', '=', 'orders.id') - ->where('order_address_shipping.address_type', 'shipping'); - }) - ->leftJoin('order_address as order_address_billing', function($leftJoin) { - $leftJoin->on('order_address_billing.order_id', '=', 'orders.id') - ->where('order_address_billing.address_type', 'billing'); - }) - ->addSelect('orders.id','orders.increment_id', 'orders.base_sub_total', 'orders.base_grand_total', 'orders.created_at', 'channel_name', 'status') - ->addSelect(DB::raw('CONCAT(' . DB::getTablePrefix() . 'order_address_billing.first_name, " ", ' . DB::getTablePrefix() . 'order_address_billing.last_name) as billed_to')) - ->addSelect(DB::raw('CONCAT(' . DB::getTablePrefix() . 'order_address_shipping.first_name, " ", ' . DB::getTablePrefix() . 'order_address_shipping.last_name) as shipped_to')); + ->leftJoin('order_address as order_address_shipping', function($leftJoin) { + $leftJoin->on('order_address_shipping.order_id', '=', 'orders.id') + ->where('order_address_shipping.address_type', 'shipping'); + }) + ->leftJoin('order_address as order_address_billing', function($leftJoin) { + $leftJoin->on('order_address_billing.order_id', '=', 'orders.id') + ->where('order_address_billing.address_type', 'billing'); + }) + ->addSelect('orders.id','orders.increment_id', 'orders.base_sub_total', 'orders.base_grand_total', 'orders.created_at', 'channel_name', 'status') + ->addSelect(DB::raw('CONCAT(' . DB::getTablePrefix() . 'order_address_billing.first_name, " ", ' . DB::getTablePrefix() . 'order_address_billing.last_name) as billed_to')) + ->addSelect(DB::raw('CONCAT(' . DB::getTablePrefix() . 'order_address_shipping.first_name, " ", ' . DB::getTablePrefix() . 'order_address_shipping.last_name) as shipped_to')); $this->addFilter('billed_to', DB::raw('CONCAT(' . DB::getTablePrefix() . 'order_address_billing.first_name, " ", ' . DB::getTablePrefix() . 'order_address_billing.last_name)')); $this->addFilter('shipped_to', DB::raw('CONCAT(' . DB::getTablePrefix() . 'order_address_shipping.first_name, " ", ' . DB::getTablePrefix() . 'order_address_shipping.last_name)')); @@ -43,101 +37,103 @@ class OrderDataGrid extends DataGrid public function addColumns() { $this->addColumn([ - 'index' => 'increment_id', - 'label' => trans('admin::app.datagrid.id'), - 'type' => 'string', + 'index' => 'increment_id', + 'label' => trans('admin::app.datagrid.id'), + 'type' => 'string', 'searchable' => false, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); $this->addColumn([ - 'index' => 'base_sub_total', - 'label' => trans('admin::app.datagrid.sub-total'), - 'type' => 'price', + 'index' => 'base_sub_total', + 'label' => trans('admin::app.datagrid.sub-total'), + 'type' => 'price', 'searchable' => false, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); $this->addColumn([ - 'index' => 'base_grand_total', - 'label' => trans('admin::app.datagrid.grand-total'), - 'type' => 'price', + 'index' => 'base_grand_total', + 'label' => trans('admin::app.datagrid.grand-total'), + 'type' => 'price', 'searchable' => false, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); $this->addColumn([ - 'index' => 'created_at', - 'label' => trans('admin::app.datagrid.order-date'), - 'type' => 'datetime', - 'sortable' => true, + 'index' => 'created_at', + 'label' => trans('admin::app.datagrid.order-date'), + 'type' => 'datetime', + 'sortable' => true, 'searchable' => false, - 'filterable' => true + 'filterable' => true, ]); $this->addColumn([ - 'index' => 'channel_name', - 'label' => trans('admin::app.datagrid.channel-name'), - 'type' => 'string', - 'sortable' => true, + 'index' => 'channel_name', + 'label' => trans('admin::app.datagrid.channel-name'), + 'type' => 'string', + 'sortable' => true, 'searchable' => true, - 'filterable' => true + 'filterable' => true, ]); $this->addColumn([ - 'index' => 'status', - 'label' => trans('admin::app.datagrid.status'), - 'type' => 'string', - 'sortable' => true, + 'index' => 'status', + 'label' => trans('admin::app.datagrid.status'), + 'type' => 'string', + 'sortable' => true, 'searchable' => true, - 'closure' => true, + 'closure' => true, 'filterable' => true, 'wrapper' => function ($value) { - if ($value->status == 'processing') + if ($value->status == 'processing') { return ''. trans('admin::app.sales.orders.order-status-processing') .''; - else if ($value->status == 'completed') + } elseif ($value->status == 'completed') { return ''. trans('admin::app.sales.orders.order-status-success') .''; - else if ($value->status == "canceled") + } elseif ($value->status == "canceled") { return ''. trans('admin::app.sales.orders.order-status-canceled') .''; - else if ($value->status == "closed") + } elseif ($value->status == "closed") { return ''. trans('admin::app.sales.orders.order-status-closed') .''; - else if ($value->status == "pending") + } elseif ($value->status == "pending") { return ''. trans('admin::app.sales.orders.order-status-pending') .''; - else if ($value->status == "pending_payment") + } elseif ($value->status == "pending_payment") { return ''. trans('admin::app.sales.orders.order-status-pending-payment') .''; - else if ($value->status == "fraud") + } elseif ($value->status == "fraud") { return ''. trans('admin::app.sales.orders.order-status-fraud') . ''; - } + } + }, ]); $this->addColumn([ - 'index' => 'billed_to', - 'label' => trans('admin::app.datagrid.billed-to'), - 'type' => 'string', + 'index' => 'billed_to', + 'label' => trans('admin::app.datagrid.billed-to'), + 'type' => 'string', 'searchable' => true, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); $this->addColumn([ - 'index' => 'shipped_to', - 'label' => trans('admin::app.datagrid.shipped-to'), - 'type' => 'string', + 'index' => 'shipped_to', + 'label' => trans('admin::app.datagrid.shipped-to'), + 'type' => 'string', 'searchable' => true, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); } - public function prepareActions() { + public function prepareActions() + { $this->addAction([ - 'title' => 'Order View', - 'method' => 'GET', // use GET request only for redirect purposes - 'route' => 'admin.sales.orders.view', - 'icon' => 'icon eye-icon' + 'title' => trans('admin::app.datagrid.view'), + 'method' => 'GET', + 'route' => 'admin.sales.orders.view', + 'icon' => 'icon eye-icon', ]); } } \ No newline at end of file diff --git a/packages/Webkul/Admin/src/DataGrids/OrderInvoicesDataGrid.php b/packages/Webkul/Admin/src/DataGrids/OrderInvoicesDataGrid.php index 06a218085..11b545ef7 100755 --- a/packages/Webkul/Admin/src/DataGrids/OrderInvoicesDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/OrderInvoicesDataGrid.php @@ -2,26 +2,20 @@ namespace Webkul\Admin\DataGrids; +use Illuminate\Support\Facades\DB; use Webkul\Ui\DataGrid\DataGrid; -use DB; -/** - * OrderInvoicesDataGrid Class - * - * @author Prashant Singh @prashant-webkul - * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) - */ class OrderInvoicesDataGrid extends DataGrid { protected $index = 'id'; - protected $sortOrder = 'desc'; //asc or desc + protected $sortOrder = 'desc'; public function prepareQueryBuilder() { $queryBuilder = DB::table('invoices') - ->leftJoin('orders as ors', 'invoices.order_id', '=', 'ors.id') - ->select('invoices.id as id', 'ors.increment_id as order_id', 'invoices.state as state', 'invoices.base_grand_total as base_grand_total', 'invoices.created_at as created_at'); + ->leftJoin('orders as ors', 'invoices.order_id', '=', 'ors.id') + ->select('invoices.id as id', 'ors.increment_id as order_id', 'invoices.state as state', 'invoices.base_grand_total as base_grand_total', 'invoices.created_at as created_at'); $this->addFilter('id', 'invoices.id'); $this->addFilter('order_id', 'ors.increment_id'); @@ -34,48 +28,49 @@ class OrderInvoicesDataGrid extends DataGrid public function addColumns() { $this->addColumn([ - 'index' => 'id', - 'label' => trans('admin::app.datagrid.id'), - 'type' => 'number', + 'index' => 'id', + 'label' => trans('admin::app.datagrid.id'), + 'type' => 'number', 'searchable' => false, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); $this->addColumn([ - 'index' => 'order_id', - 'label' => trans('admin::app.datagrid.order-id'), - 'type' => 'string', + 'index' => 'order_id', + 'label' => trans('admin::app.datagrid.order-id'), + 'type' => 'string', 'searchable' => true, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); $this->addColumn([ - 'index' => 'base_grand_total', - 'label' => trans('admin::app.datagrid.grand-total'), - 'type' => 'price', + 'index' => 'base_grand_total', + 'label' => trans('admin::app.datagrid.grand-total'), + 'type' => 'price', 'searchable' => true, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); $this->addColumn([ - 'index' => 'created_at', - 'label' => trans('admin::app.datagrid.invoice-date'), - 'type' => 'datetime', + 'index' => 'created_at', + 'label' => trans('admin::app.datagrid.invoice-date'), + 'type' => 'datetime', 'searchable' => true, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); } - public function prepareActions() { + public function prepareActions() + { $this->addAction([ - 'title' => 'Order Invoice View', - 'method' => 'GET', // use GET request only for redirect purposes - 'route' => 'admin.sales.invoices.view', - 'icon' => 'icon eye-icon' + 'title' => trans('admin::app.datagrid.view'), + 'method' => 'GET', + 'route' => 'admin.sales.invoices.view', + 'icon' => 'icon eye-icon', ]); } } \ No newline at end of file diff --git a/packages/Webkul/Admin/src/DataGrids/OrderRefundDataGrid.php b/packages/Webkul/Admin/src/DataGrids/OrderRefundDataGrid.php index 787b1512e..320182382 100755 --- a/packages/Webkul/Admin/src/DataGrids/OrderRefundDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/OrderRefundDataGrid.php @@ -2,31 +2,25 @@ namespace Webkul\Admin\DataGrids; +use Illuminate\Support\Facades\DB; use Webkul\Ui\DataGrid\DataGrid; -use DB; -/** - * OrderRefundDataGrid Class - * - * @author Prashant Singh - * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) - */ class OrderRefundDataGrid extends DataGrid { protected $index = 'id'; - protected $sortOrder = 'desc'; //asc or desc + protected $sortOrder = 'desc'; public function prepareQueryBuilder() { $queryBuilder = DB::table('refunds') - ->select('refunds.id', 'orders.increment_id', 'refunds.state', 'refunds.base_grand_total', 'refunds.created_at') - ->leftJoin('orders', 'refunds.order_id', '=', 'orders.id') - ->leftJoin('order_address as order_address_billing', function($leftJoin) { - $leftJoin->on('order_address_billing.order_id', '=', 'orders.id') - ->where('order_address_billing.address_type', 'billing'); - }) - ->addSelect(DB::raw('CONCAT(' . DB::getTablePrefix() . 'order_address_billing.first_name, " ", ' . DB::getTablePrefix() . 'order_address_billing.last_name) as billed_to')); + ->select('refunds.id', 'orders.increment_id', 'refunds.state', 'refunds.base_grand_total', 'refunds.created_at') + ->leftJoin('orders', 'refunds.order_id', '=', 'orders.id') + ->leftJoin('order_address as order_address_billing', function($leftJoin) { + $leftJoin->on('order_address_billing.order_id', '=', 'orders.id') + ->where('order_address_billing.address_type', 'billing'); + }) + ->addSelect(DB::raw('CONCAT(' . DB::getTablePrefix() . 'order_address_billing.first_name, " ", ' . DB::getTablePrefix() . 'order_address_billing.last_name) as billed_to')); $this->addFilter('billed_to', DB::raw('CONCAT(' . DB::getTablePrefix() . 'order_address_billing.first_name, " ", ' . DB::getTablePrefix() . 'order_address_billing.last_name)')); $this->addFilter('id', 'refunds.id'); @@ -41,57 +35,58 @@ class OrderRefundDataGrid extends DataGrid public function addColumns() { $this->addColumn([ - 'index' => 'id', - 'label' => trans('admin::app.datagrid.id'), - 'type' => 'number', + 'index' => 'id', + 'label' => trans('admin::app.datagrid.id'), + 'type' => 'number', 'searchable' => false, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); $this->addColumn([ - 'index' => 'increment_id', - 'label' => trans('admin::app.datagrid.order-id'), - 'type' => 'string', + 'index' => 'increment_id', + 'label' => trans('admin::app.datagrid.order-id'), + 'type' => 'string', 'searchable' => true, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); $this->addColumn([ - 'index' => 'base_grand_total', - 'label' => trans('admin::app.datagrid.refunded'), - 'type' => 'price', + 'index' => 'base_grand_total', + 'label' => trans('admin::app.datagrid.refunded'), + 'type' => 'price', 'searchable' => true, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); $this->addColumn([ - 'index' => 'billed_to', - 'label' => trans('admin::app.datagrid.billed-to'), - 'type' => 'string', + 'index' => 'billed_to', + 'label' => trans('admin::app.datagrid.billed-to'), + 'type' => 'string', 'searchable' => true, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); $this->addColumn([ - 'index' => 'created_at', - 'label' => trans('admin::app.datagrid.refund-date'), - 'type' => 'datetime', + 'index' => 'created_at', + 'label' => trans('admin::app.datagrid.refund-date'), + 'type' => 'datetime', 'searchable' => true, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); } - public function prepareActions() { + public function prepareActions() + { $this->addAction([ - 'title' => 'Order Refund View', - 'method' => 'GET', // use GET request only for redirect purposes - 'route' => 'admin.sales.refunds.view', - 'icon' => 'icon eye-icon' + 'title' => trans('admin::app.datagrid.view'), + 'method' => 'GET', + 'route' => 'admin.sales.refunds.view', + 'icon' => 'icon eye-icon', ]); } } \ No newline at end of file diff --git a/packages/Webkul/Admin/src/DataGrids/OrderShipmentsDataGrid.php b/packages/Webkul/Admin/src/DataGrids/OrderShipmentsDataGrid.php index a254af897..d126c7f2a 100755 --- a/packages/Webkul/Admin/src/DataGrids/OrderShipmentsDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/OrderShipmentsDataGrid.php @@ -2,33 +2,27 @@ namespace Webkul\Admin\DataGrids; +use Illuminate\Support\Facades\DB; use Webkul\Ui\DataGrid\DataGrid; -use DB; -/** - * OrderShipmentsDataGrid Class - * - * @author Prashant Singh @prashant-webkul - * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) - */ class OrderShipmentsDataGrid extends DataGrid { protected $index = 'shipment_id'; - protected $sortOrder = 'desc'; //asc or desc + protected $sortOrder = 'desc'; public function prepareQueryBuilder() { $queryBuilder = DB::table('shipments') - ->leftJoin('order_address as order_address_shipping', function($leftJoin) { - $leftJoin->on('order_address_shipping.order_id', '=', 'shipments.order_id') - ->where('order_address_shipping.address_type', 'shipping'); - }) - ->leftJoin('orders as ors', 'shipments.order_id', '=', 'ors.id') - ->leftJoin('inventory_sources as is', 'shipments.inventory_source_id', '=', 'is.id') - ->select('shipments.id as shipment_id', 'ors.increment_id as shipment_order_id', 'shipments.total_qty as shipment_total_qty', 'ors.created_at as order_date', 'shipments.created_at as shipment_created_at') - ->addSelect(DB::raw('CONCAT(' . DB::getTablePrefix() . 'order_address_shipping.first_name, " ", ' . DB::getTablePrefix() . 'order_address_shipping.last_name) as shipped_to')) - ->selectRaw('IF(' . DB::getTablePrefix() . 'shipments.inventory_source_id IS NOT NULL,' . DB::getTablePrefix() . 'is.name, ' . DB::getTablePrefix() . 'shipments.inventory_source_name) as inventory_source_name'); + ->leftJoin('order_address as order_address_shipping', function($leftJoin) { + $leftJoin->on('order_address_shipping.order_id', '=', 'shipments.order_id') + ->where('order_address_shipping.address_type', 'shipping'); + }) + ->leftJoin('orders as ors', 'shipments.order_id', '=', 'ors.id') + ->leftJoin('inventory_sources as is', 'shipments.inventory_source_id', '=', 'is.id') + ->select('shipments.id as shipment_id', 'ors.increment_id as shipment_order_id', 'shipments.total_qty as shipment_total_qty', 'ors.created_at as order_date', 'shipments.created_at as shipment_created_at') + ->addSelect(DB::raw('CONCAT(' . DB::getTablePrefix() . 'order_address_shipping.first_name, " ", ' . DB::getTablePrefix() . 'order_address_shipping.last_name) as shipped_to')) + ->selectRaw('IF(' . DB::getTablePrefix() . 'shipments.inventory_source_id IS NOT NULL,' . DB::getTablePrefix() . 'is.name, ' . DB::getTablePrefix() . 'shipments.inventory_source_name) as inventory_source_name'); $this->addFilter('shipment_id', 'shipments.id'); $this->addFilter('shipment_order_id', 'ors.increment_id'); @@ -44,75 +38,76 @@ class OrderShipmentsDataGrid extends DataGrid public function addColumns() { $this->addColumn([ - 'index' => 'shipment_id', - 'label' => trans('admin::app.datagrid.id'), - 'type' => 'number', + 'index' => 'shipment_id', + 'label' => trans('admin::app.datagrid.id'), + 'type' => 'number', 'searchable' => false, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); $this->addColumn([ - 'index' => 'shipment_order_id', - 'label' => trans('admin::app.datagrid.order-id'), - 'type' => 'string', + 'index' => 'shipment_order_id', + 'label' => trans('admin::app.datagrid.order-id'), + 'type' => 'string', 'searchable' => true, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); $this->addColumn([ - 'index' => 'shipment_total_qty', - 'label' => trans('admin::app.datagrid.total-qty'), - 'type' => 'number', + 'index' => 'shipment_total_qty', + 'label' => trans('admin::app.datagrid.total-qty'), + 'type' => 'number', 'searchable' => false, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); $this->addColumn([ - 'index' => 'inventory_source_name', - 'label' => trans('admin::app.datagrid.inventory-source'), - 'type' => 'string', + 'index' => 'inventory_source_name', + 'label' => trans('admin::app.datagrid.inventory-source'), + 'type' => 'string', 'searchable' => true, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); $this->addColumn([ - 'index' => 'order_date', - 'label' => trans('admin::app.datagrid.order-date'), - 'type' => 'datetime', - 'sortable' => true, + 'index' => 'order_date', + 'label' => trans('admin::app.datagrid.order-date'), + 'type' => 'datetime', + 'sortable' => true, 'searchable' => false, - 'filterable' => true + 'filterable' => true, ]); $this->addColumn([ - 'index' => 'shipment_created_at', - 'label' => trans('admin::app.datagrid.shipment-date'), - 'type' => 'datetime', - 'sortable' => true, + 'index' => 'shipment_created_at', + 'label' => trans('admin::app.datagrid.shipment-date'), + 'type' => 'datetime', + 'sortable' => true, 'searchable' => false, - 'filterable' => true + 'filterable' => true, ]); $this->addColumn([ - 'index' => 'shipped_to', - 'label' => trans('admin::app.datagrid.shipment-to'), - 'type' => 'string', - 'sortable' => true, + 'index' => 'shipped_to', + 'label' => trans('admin::app.datagrid.shipment-to'), + 'type' => 'string', + 'sortable' => true, 'searchable' => true, - 'filterable' => true + 'filterable' => true, ]); } - public function prepareActions() { + public function prepareActions() + { $this->addAction([ - 'title' => 'Order Shipment View', - 'method' => 'GET', // use GET request only for redirect purposes - 'route' => 'admin.sales.shipments.view', - 'icon' => 'icon eye-icon' + 'title' => trans('admin::app.datagrid.view'), + 'method' => 'GET', + 'route' => 'admin.sales.shipments.view', + 'icon' => 'icon eye-icon', ]); } } \ No newline at end of file diff --git a/packages/Webkul/Admin/src/DataGrids/ProductDataGrid.php b/packages/Webkul/Admin/src/DataGrids/ProductDataGrid.php index edf8dcd2e..3a35601e9 100644 --- a/packages/Webkul/Admin/src/DataGrids/ProductDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/ProductDataGrid.php @@ -5,15 +5,9 @@ namespace Webkul\Admin\DataGrids; use Webkul\Ui\DataGrid\DataGrid; use Illuminate\Support\Facades\DB; -/** - * ProductDataGrid Class - * - * @author Prashant Singh @prashant-webkul - * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) - */ class ProductDataGrid extends DataGrid { - protected $sortOrder = 'desc'; //asc or desc + protected $sortOrder = 'desc'; protected $index = 'product_id'; @@ -28,25 +22,26 @@ class ProductDataGrid extends DataGrid parent::__construct(); $this->locale = request()->get('locale') ?? 'all'; + $this->channel = request()->get('channel') ?? 'all'; } public function prepareQueryBuilder() { $queryBuilder = DB::table('product_flat') - ->leftJoin('products', 'product_flat.product_id', '=', 'products.id') - ->leftJoin('attribute_families', 'products.attribute_family_id', '=', 'attribute_families.id') - ->leftJoin('product_inventories', 'product_flat.product_id', '=', 'product_inventories.product_id') - ->select( - 'product_flat.product_id as product_id', - 'products.sku as product_sku', - 'product_flat.name as product_name', - 'products.type as product_type', - 'product_flat.status', - 'product_flat.price', - 'attribute_families.name as attribute_family', - DB::raw('SUM(DISTINCT ' . DB::getTablePrefix() . 'product_inventories.qty) as quantity') - ); + ->leftJoin('products', 'product_flat.product_id', '=', 'products.id') + ->leftJoin('attribute_families', 'products.attribute_family_id', '=', 'attribute_families.id') + ->leftJoin('product_inventories', 'product_flat.product_id', '=', 'product_inventories.product_id') + ->select( + 'product_flat.product_id as product_id', + 'products.sku as product_sku', + 'product_flat.name as product_name', + 'products.type as product_type', + 'product_flat.status', + 'product_flat.price', + 'attribute_families.name as attribute_family', + DB::raw('SUM(DISTINCT ' . DB::getTablePrefix() . 'product_inventories.qty) as quantity') + ); if ($this->locale !== 'all') { $queryBuilder->where('locale', $this->locale); @@ -73,131 +68,131 @@ class ProductDataGrid extends DataGrid public function addColumns() { $this->addColumn([ - 'index' => 'product_id', - 'label' => trans('admin::app.datagrid.id'), - 'type' => 'number', + 'index' => 'product_id', + 'label' => trans('admin::app.datagrid.id'), + 'type' => 'number', 'searchable' => false, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); $this->addColumn([ - 'index' => 'product_sku', - 'label' => trans('admin::app.datagrid.sku'), - 'type' => 'string', + 'index' => 'product_sku', + 'label' => trans('admin::app.datagrid.sku'), + 'type' => 'string', 'searchable' => true, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); $this->addColumn([ - 'index' => 'product_name', - 'label' => trans('admin::app.datagrid.name'), - 'type' => 'string', + 'index' => 'product_name', + 'label' => trans('admin::app.datagrid.name'), + 'type' => 'string', 'searchable' => true, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); $this->addColumn([ - 'index' => 'attribute_family', - 'label' => trans('admin::app.datagrid.attribute-family'), - 'type' => 'string', + 'index' => 'attribute_family', + 'label' => trans('admin::app.datagrid.attribute-family'), + 'type' => 'string', 'searchable' => true, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); $this->addColumn([ - 'index' => 'product_type', - 'label' => trans('admin::app.datagrid.type'), - 'type' => 'string', - 'sortable' => true, + 'index' => 'product_type', + 'label' => trans('admin::app.datagrid.type'), + 'type' => 'string', + 'sortable' => true, 'searchable' => true, - 'filterable' => true + 'filterable' => true, ]); $this->addColumn([ - 'index' => 'status', - 'label' => trans('admin::app.datagrid.status'), - 'type' => 'boolean', - 'sortable' => true, + 'index' => 'status', + 'label' => trans('admin::app.datagrid.status'), + 'type' => 'boolean', + 'sortable' => true, 'searchable' => false, 'filterable' => true, - 'wrapper' => function($value) { - if ($value->status == 1) - return 'Active'; - else - return 'Inactive'; - } + 'wrapper' => function($value) { + if ($value->status == 1) { + return trans('admin::app.datagrid.active'); + } else { + return trans('admin::app.datagrid.inactive'); + } + }, ]); $this->addColumn([ - 'index' => 'price', - 'label' => trans('admin::app.datagrid.price'), - 'type' => 'price', - 'sortable' => true, + 'index' => 'price', + 'label' => trans('admin::app.datagrid.price'), + 'type' => 'price', + 'sortable' => true, 'searchable' => false, - 'filterable' => true + 'filterable' => true, ]); $this->addColumn([ - 'index' => 'quantity', - 'label' => trans('admin::app.datagrid.qty'), - 'type' => 'number', - 'sortable' => true, + 'index' => 'quantity', + 'label' => trans('admin::app.datagrid.qty'), + 'type' => 'number', + 'sortable' => true, 'searchable' => false, 'filterable' => false, - 'wrapper' => function($value) { - if (is_null($value->quantity)) + 'wrapper' => function($value) { + if (is_null($value->quantity)) { return 0; - else + } else { return $value->quantity; - } + } + }, ]); } - public function prepareActions() { + public function prepareActions() + { $this->addAction([ - 'title' => 'Edit Product', + 'title' => trans('admin::app.datagrid.edit'), + 'method' => 'GET', + 'route' => 'admin.catalog.products.edit', + 'icon' => 'icon pencil-lg-icon', 'condition' => function() { return true; }, - 'method' => 'GET', // use GET request only for redirect purposes - 'route' => 'admin.catalog.products.edit', - 'icon' => 'icon pencil-lg-icon' ]); $this->addAction([ - 'title' => 'Delete Product', - 'method' => 'POST', // use GET request only for redirect purposes - 'route' => 'admin.catalog.products.delete', + 'title' => trans('admin::app.datagrid.delete'), + 'method' => 'POST', + 'route' => 'admin.catalog.products.delete', 'confirm_text' => trans('ui::app.datagrid.massaction.delete', ['resource' => 'product']), - 'icon' => 'icon trash-icon' + 'icon' => 'icon trash-icon', ]); - - $this->enableAction = true; } - public function prepareMassActions() { + public function prepareMassActions() + { $this->addMassAction([ - 'type' => 'delete', - 'label' => trans('admin::app.datagrid.delete'), + 'type' => 'delete', + 'label' => trans('admin::app.datagrid.delete'), 'action' => route('admin.catalog.products.massdelete'), - 'method' => 'DELETE' + 'method' => 'DELETE', ]); $this->addMassAction([ - 'type' => 'update', - 'label' => trans('admin::app.datagrid.update-status'), - 'action' => route('admin.catalog.products.massupdate'), - 'method' => 'PUT', + 'type' => 'update', + 'label' => trans('admin::app.datagrid.update-status'), + 'action' => route('admin.catalog.products.massupdate'), + 'method' => 'PUT', 'options' => [ - 'Active' => 1, - 'Inactive' => 0 - ] + 'Active' => 1, + 'Inactive' => 0, + ], ]); - - $this->enableMassAction = true; } } \ No newline at end of file diff --git a/packages/Webkul/Admin/src/DataGrids/RolesDataGrid.php b/packages/Webkul/Admin/src/DataGrids/RolesDataGrid.php index 1dde27f2e..32201e269 100755 --- a/packages/Webkul/Admin/src/DataGrids/RolesDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/RolesDataGrid.php @@ -2,20 +2,14 @@ namespace Webkul\Admin\DataGrids; +use Illuminate\Support\Facades\DB; use Webkul\Ui\DataGrid\DataGrid; -use DB; -/** - * RolesDataGrid Class - * - * @author Prashant Singh @prashant-webkul - * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) - */ class RolesDataGrid extends DataGrid { protected $index = 'id'; - protected $sortOrder = 'desc'; //asc or desc + protected $sortOrder = 'desc'; public function prepareQueryBuilder() { @@ -27,47 +21,48 @@ class RolesDataGrid extends DataGrid public function addColumns() { $this->addColumn([ - 'index' => 'id', - 'label' => trans('admin::app.datagrid.id'), - 'type' => 'number', + 'index' => 'id', + 'label' => trans('admin::app.datagrid.id'), + 'type' => 'number', 'searchable' => false, - 'sortable' => true, - 'width' => '40px', - 'filterable' => true + 'sortable' => true, + 'width' => '40px', + 'filterable' => true, ]); $this->addColumn([ - 'index' => 'name', - 'label' => trans('admin::app.datagrid.name'), - 'type' => 'string', + 'index' => 'name', + 'label' => trans('admin::app.datagrid.name'), + 'type' => 'string', 'searchable' => true, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); $this->addColumn([ - 'index' => 'permission_type', - 'label' => trans('admin::app.datagrid.permission-type'), - 'type' => 'string', + 'index' => 'permission_type', + 'label' => trans('admin::app.datagrid.permission-type'), + 'type' => 'string', 'searchable' => true, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); } - public function prepareActions() { + public function prepareActions() + { $this->addAction([ - 'title' => 'Edit', - 'method' => 'GET', // use GET request only for redirect purposes - 'route' => 'admin.roles.edit', - 'icon' => 'icon pencil-lg-icon' + 'title' => trans('admin::app.datagrid.edit'), + 'method' => 'GET', + 'route' => 'admin.roles.edit', + 'icon' => 'icon pencil-lg-icon', ]); $this->addAction([ - 'title' => 'Delete', - 'method' => 'POST', // use GET request only for redirect purposes - 'route' => 'admin.roles.delete', - 'icon' => 'icon trash-icon' + 'title' => trans('admin::app.datagrid.delete'), + 'method' => 'POST', + 'route' => 'admin.roles.delete', + 'icon' => 'icon trash-icon', ]); } } \ No newline at end of file diff --git a/packages/Webkul/Admin/src/DataGrids/SliderDataGrid.php b/packages/Webkul/Admin/src/DataGrids/SliderDataGrid.php index 830bd003c..f0fa7fd78 100755 --- a/packages/Webkul/Admin/src/DataGrids/SliderDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/SliderDataGrid.php @@ -2,25 +2,20 @@ namespace Webkul\Admin\DataGrids; +use Illuminate\Support\Facades\DB; use Webkul\Ui\DataGrid\DataGrid; -use DB; -/** - * SliderDataGrid Class - * - * @author Prashant Singh @prashant-webkul - * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) - */ class SliderDataGrid extends DataGrid { protected $index = 'slider_id'; - protected $sortOrder = 'desc'; //asc or desc + protected $sortOrder = 'desc'; public function prepareQueryBuilder() { - $queryBuilder = DB::table('sliders as sl')->addSelect('sl.id as slider_id', 'sl.title', 'ch.name')->leftJoin('channels as ch', 'sl.channel_id', '=', - 'ch.id'); + $queryBuilder = DB::table('sliders as sl') + ->addSelect('sl.id as slider_id', 'sl.title', 'ch.name') + ->leftJoin('channels as ch', 'sl.channel_id', '=', 'ch.id'); $this->addFilter('slider_id', 'sl.id'); $this->addFilter('channel_name', 'ch.name'); @@ -31,46 +26,47 @@ class SliderDataGrid extends DataGrid public function addColumns() { $this->addColumn([ - 'index' => 'slider_id', - 'label' => trans('admin::app.datagrid.id'), - 'type' => 'number', + 'index' => 'slider_id', + 'label' => trans('admin::app.datagrid.id'), + 'type' => 'number', 'searchable' => false, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); $this->addColumn([ - 'index' => 'title', - 'label' => trans('admin::app.datagrid.title'), - 'type' => 'string', + 'index' => 'title', + 'label' => trans('admin::app.datagrid.title'), + 'type' => 'string', 'searchable' => true, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); $this->addColumn([ - 'index' => 'name', - 'label' => trans('admin::app.datagrid.channel-name'), - 'type' => 'string', + 'index' => 'name', + 'label' => trans('admin::app.datagrid.channel-name'), + 'type' => 'string', 'searchable' => true, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); } - public function prepareActions() { + public function prepareActions() + { $this->addAction([ - 'title' => 'Edit Slider', - 'method' => 'GET', // use GET request only for redirect purposes - 'route' => 'admin.sliders.edit', - 'icon' => 'icon pencil-lg-icon' + 'title' => trans('admin::app.datagrid.edit'), + 'method' => 'GET', + 'route' => 'admin.sliders.edit', + 'icon' => 'icon pencil-lg-icon', ]); $this->addAction([ - 'title' => 'Delete Slider', - 'method' => 'POST', // use GET request only for redirect purposes - 'route' => 'admin.sliders.delete', - 'icon' => 'icon trash-icon' + 'title' => trans('admin::app.datagrid.delete'), + 'method' => 'POST', + 'route' => 'admin.sliders.delete', + 'icon' => 'icon trash-icon', ]); } } \ No newline at end of file diff --git a/packages/Webkul/Admin/src/DataGrids/TaxCategoryDataGrid.php b/packages/Webkul/Admin/src/DataGrids/TaxCategoryDataGrid.php index 948fc6372..9329d1ee6 100755 --- a/packages/Webkul/Admin/src/DataGrids/TaxCategoryDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/TaxCategoryDataGrid.php @@ -2,20 +2,14 @@ namespace Webkul\Admin\DataGrids; +use Illuminate\Support\Facades\DB; use Webkul\Ui\DataGrid\DataGrid; -use DB; -/** - * TaxCategoryDataGrid Class - * - * @author Prashant Singh @prashant-webkul - * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) - */ class TaxCategoryDataGrid extends DataGrid { protected $index = 'id'; - protected $sortOrder = 'desc'; //asc or desc + protected $sortOrder = 'desc'; public function prepareQueryBuilder() { @@ -27,46 +21,47 @@ class TaxCategoryDataGrid extends DataGrid public function addColumns() { $this->addColumn([ - 'index' => 'id', - 'label' => trans('admin::app.datagrid.id'), - 'type' => 'number', + 'index' => 'id', + 'label' => trans('admin::app.datagrid.id'), + 'type' => 'number', 'searchable' => false, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); $this->addColumn([ - 'index' => 'name', - 'label' => trans('admin::app.datagrid.name'), - 'type' => 'string', + 'index' => 'name', + 'label' => trans('admin::app.datagrid.name'), + 'type' => 'string', 'searchable' => true, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); $this->addColumn([ - 'index' => 'code', - 'label' => trans('admin::app.datagrid.code'), - 'type' => 'string', + 'index' => 'code', + 'label' => trans('admin::app.datagrid.code'), + 'type' => 'string', 'searchable' => true, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); } - public function prepareActions() { + public function prepareActions() + { $this->addAction([ - 'title' => 'Edit Tax Category', - 'method' => 'GET', // use GET request only for redirect purposes - 'route' => 'admin.tax-categories.edit', - 'icon' => 'icon pencil-lg-icon' + 'title' => trans('admin::app.datagrid.edit'), + 'method' => 'GET', + 'route' => 'admin.tax-categories.edit', + 'icon' => 'icon pencil-lg-icon', ]); $this->addAction([ - 'title' => 'Delete Tax Category', - 'method' => 'POST', // use GET request only for redirect purposes - 'route' => 'admin.tax-categories.delete', - 'icon' => 'icon trash-icon' + 'title' => trans('admin::app.datagrid.delete'), + 'method' => 'POST', + 'route' => 'admin.tax-categories.delete', + 'icon' => 'icon trash-icon', ]); } } \ No newline at end of file diff --git a/packages/Webkul/Admin/src/DataGrids/TaxRateDataGrid.php b/packages/Webkul/Admin/src/DataGrids/TaxRateDataGrid.php index 8812bc2ba..45f0a6c9b 100755 --- a/packages/Webkul/Admin/src/DataGrids/TaxRateDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/TaxRateDataGrid.php @@ -2,20 +2,14 @@ namespace Webkul\Admin\DataGrids; +use Illuminate\Support\Facades\DB; use Webkul\Ui\DataGrid\DataGrid; -use DB; -/** - * TaxRateDataGrid Class - * - * @author Prashant Singh @prashant-webkul - * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) - */ class TaxRateDataGrid extends DataGrid { protected $index = 'id'; - protected $sortOrder = 'desc'; //asc or desc + protected $sortOrder = 'desc'; public function prepareQueryBuilder() { @@ -27,97 +21,99 @@ class TaxRateDataGrid extends DataGrid public function addColumns() { $this->addColumn([ - 'index' => 'id', - 'label' => trans('admin::app.datagrid.id'), - 'type' => 'number', + 'index' => 'id', + 'label' => trans('admin::app.datagrid.id'), + 'type' => 'number', 'searchable' => false, - 'sortable' => true, - 'filterable' => true - ]); - - $this->addColumn([ - 'index' => 'identifier', - 'label' => trans('admin::app.datagrid.identifier'), - 'type' => 'string', - 'searchable' => true, - 'sortable' => true, - 'filterable' => true - ]); - - $this->addColumn([ - 'index' => 'state', - 'label' => trans('admin::app.datagrid.state'), - 'type' => 'string', - 'searchable' => true, - 'sortable' => true, + 'sortable' => true, 'filterable' => true, - 'wrapper' => function($value) { - if (empty($value->state)) + ]); + + $this->addColumn([ + 'index' => 'identifier', + 'label' => trans('admin::app.datagrid.identifier'), + 'type' => 'string', + 'searchable' => true, + 'sortable' => true, + 'filterable' => true, + ]); + + $this->addColumn([ + 'index' => 'state', + 'label' => trans('admin::app.datagrid.state'), + 'type' => 'string', + 'searchable' => true, + 'sortable' => true, + 'filterable' => true, + 'wrapper' => function($value) { + if (empty($value->state)) { return '*'; - else + } else { return $value->state; - } + } + }, ]); $this->addColumn([ - 'index' => 'country', - 'label' => trans('admin::app.datagrid.country'), - 'type' => 'string', + 'index' => 'country', + 'label' => trans('admin::app.datagrid.country'), + 'type' => 'string', 'searchable' => true, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); $this->addColumn([ - 'index' => 'zip_code', - 'label' => trans('admin::app.configuration.tax-rates.zip_code'), - 'type' => 'string', + 'index' => 'zip_code', + 'label' => trans('admin::app.configuration.tax-rates.zip_code'), + 'type' => 'string', 'searchable' => true, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); $this->addColumn([ - 'index' => 'zip_from', - 'label' => trans('admin::app.configuration.tax-rates.zip_from'), - 'type' => 'string', + 'index' => 'zip_from', + 'label' => trans('admin::app.configuration.tax-rates.zip_from'), + 'type' => 'string', 'searchable' => true, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); $this->addColumn([ - 'index' => 'zip_to', - 'label' => trans('admin::app.configuration.tax-rates.zip_to'), - 'type' => 'string', + 'index' => 'zip_to', + 'label' => trans('admin::app.configuration.tax-rates.zip_to'), + 'type' => 'string', 'searchable' => true, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); $this->addColumn([ - 'index' => 'tax_rate', - 'label' => trans('admin::app.datagrid.tax-rate'), - 'type' => 'number', + 'index' => 'tax_rate', + 'label' => trans('admin::app.datagrid.tax-rate'), + 'type' => 'number', 'searchable' => true, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); } - public function prepareActions() { + public function prepareActions() + { $this->addAction([ - 'title' => 'Edit Tax Rate', - 'method' => 'GET', // use GET request only for redirect purposes - 'route' => 'admin.tax-rates.store', - 'icon' => 'icon pencil-lg-icon' + 'title' => trans('admin::app.datagrid.edit'), + 'method' => 'GET', + 'route' => 'admin.tax-rates.store', + 'icon' => 'icon pencil-lg-icon', ]); $this->addAction([ - 'title' => 'Delete Tax Rate', - 'method' => 'POST', // use GET request only for redirect purposes - 'route' => 'admin.tax-rates.delete', - 'icon' => 'icon trash-icon' + 'title' => trans('admin::app.datagrid.delete'), + 'method' => 'POST', + 'route' => 'admin.tax-rates.delete', + 'icon' => 'icon trash-icon', ]); } } \ No newline at end of file diff --git a/packages/Webkul/Admin/src/DataGrids/UserDataGrid.php b/packages/Webkul/Admin/src/DataGrids/UserDataGrid.php index e145de46a..44601be07 100755 --- a/packages/Webkul/Admin/src/DataGrids/UserDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/UserDataGrid.php @@ -2,24 +2,20 @@ namespace Webkul\Admin\DataGrids; +use Illuminate\Support\Facades\DB; use Webkul\Ui\DataGrid\DataGrid; -use DB; -/** - * UserDataGrid Class - * - * @author Prashant Singh @prashant-webkul - * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) - */ class UserDataGrid extends DataGrid { protected $index = 'user_id'; - protected $sortOrder = 'desc'; //asc or desc + protected $sortOrder = 'desc'; public function prepareQueryBuilder() { - $queryBuilder = DB::table('admins as u')->addSelect('u.id as user_id', 'u.name as user_name', 'u.status', 'u.email', 'ro.name as role_name')->leftJoin('roles as ro', 'u.role_id', '=', 'ro.id'); + $queryBuilder = DB::table('admins as u') + ->leftJoin('roles as ro', 'u.role_id', '=', 'ro.id') + ->addSelect('u.id as user_id', 'u.name as user_name', 'u.status', 'u.email', 'ro.name as role_name'); $this->addFilter('user_id', 'u.id'); $this->addFilter('user_name', 'u.name'); @@ -31,71 +27,72 @@ class UserDataGrid extends DataGrid public function addColumns() { $this->addColumn([ - 'index' => 'user_id', - 'label' => trans('admin::app.datagrid.id'), - 'type' => 'number', + 'index' => 'user_id', + 'label' => trans('admin::app.datagrid.id'), + 'type' => 'number', 'searchable' => false, - 'sortable' => true, - 'filterable' => true - ]); - - $this->addColumn([ - 'index' => 'user_name', - 'label' => trans('admin::app.datagrid.name'), - 'type' => 'string', - 'searchable' => true, - 'sortable' => true, - 'filterable' => true - ]); - - $this->addColumn([ - 'index' => 'status', - 'label' => trans('admin::app.datagrid.status'), - 'type' => 'boolean', - 'searchable' => true, - 'sortable' => true, + 'sortable' => true, 'filterable' => true, - 'wrapper' => function($value) { + ]); + + $this->addColumn([ + 'index' => 'user_name', + 'label' => trans('admin::app.datagrid.name'), + 'type' => 'string', + 'searchable' => true, + 'sortable' => true, + 'filterable' => true, + ]); + + $this->addColumn([ + 'index' => 'status', + 'label' => trans('admin::app.datagrid.status'), + 'type' => 'boolean', + 'searchable' => true, + 'sortable' => true, + 'filterable' => true, + 'wrapper' => function($value) { if ($value->status == 1) { - return 'Active'; + return trans('admin::app.datagrid.active'); } else { - return 'Inactive'; + return trans('admin::app.datagrid.inactive'); } - } + }, ]); $this->addColumn([ - 'index' => 'email', - 'label' => trans('admin::app.datagrid.email'), - 'type' => 'string', + 'index' => 'email', + 'label' => trans('admin::app.datagrid.email'), + 'type' => 'string', 'searchable' => true, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); $this->addColumn([ - 'index' => 'role_name', - 'label' => trans('admin::app.datagrid.role'), - 'type' => 'string', + 'index' => 'role_name', + 'label' => trans('admin::app.datagrid.role'), + 'type' => 'string', 'searchable' => true, - 'sortable' => true, - 'filterable' => true + 'sortable' => true, + 'filterable' => true, ]); } - public function prepareActions() { + public function prepareActions() + { $this->addAction([ - 'title' => 'Edit User', - 'method' => 'GET', // use GET request only for redirect purposes - 'route' => 'admin.users.edit', - 'icon' => 'icon pencil-lg-icon' + 'title' => trans('admin::app.datagrid.edit'), + 'method' => 'GET', + 'route' => 'admin.users.edit', + 'icon' => 'icon pencil-lg-icon', ]); $this->addAction([ - 'title' => 'Delete User', - 'method' => 'POST', // use GET request only for redirect purposes - 'route' => 'admin.users.delete', - 'icon' => 'icon trash-icon' + 'title' => trans('admin::app.datagrid.delete'), + 'method' => 'POST', + 'route' => 'admin.users.delete', + 'icon' => 'icon trash-icon', ]); } } \ No newline at end of file diff --git a/packages/Webkul/Admin/src/Exceptions/Handler.php b/packages/Webkul/Admin/src/Exceptions/Handler.php index cfbf7c63d..42328c22b 100755 --- a/packages/Webkul/Admin/src/Exceptions/Handler.php +++ b/packages/Webkul/Admin/src/Exceptions/Handler.php @@ -5,7 +5,6 @@ namespace Webkul\Admin\Exceptions; use Exception; use Illuminate\Auth\AuthenticationException; use Illuminate\Database\Eloquent\PDOException; -use Illuminate\Database\Eloquent\ErrorException; use Illuminate\Database\Eloquent\ModelNotFoundException; use Symfony\Component\HttpKernel\Exception\HttpException; use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; @@ -23,7 +22,7 @@ class Handler extends ExceptionHandler * Render an exception into an HTTP response. * * @param \Illuminate\Http\Request $request - * @param \Exception $exception + * @param \Exception $exception * @return \Illuminate\Http\Response */ public function render($request, Exception $exception) @@ -34,9 +33,9 @@ class Handler extends ExceptionHandler $statusCode = in_array($exception->getStatusCode(), [401, 403, 404, 503]) ? $exception->getStatusCode() : 500; return $this->response($path, $statusCode); - } else if ($exception instanceof ModelNotFoundException) { + } elseif ($exception instanceof ModelNotFoundException) { return $this->response($path, 404); - } else if ($exception instanceof PDOException) { + } elseif ($exception instanceof PDOException) { return $this->response($path, 500); } @@ -68,10 +67,10 @@ class Handler extends ExceptionHandler { if (request()->expectsJson()) { return response()->json([ - 'error' => isset($this->jsonErrorMessages[$statusCode]) - ? $this->jsonErrorMessages[$statusCode] - : 'Something went wrong, please try again later.' - ], $statusCode); + 'error' => isset($this->jsonErrorMessages[$statusCode]) + ? $this->jsonErrorMessages[$statusCode] + : 'Something went wrong, please try again later.' + ], $statusCode); } return response()->view("{$path}::errors.{$statusCode}", [], $statusCode); diff --git a/packages/Webkul/Admin/src/Exports/DataGridExport.php b/packages/Webkul/Admin/src/Exports/DataGridExport.php index 9b6289b1e..42a7d1974 100755 --- a/packages/Webkul/Admin/src/Exports/DataGridExport.php +++ b/packages/Webkul/Admin/src/Exports/DataGridExport.php @@ -6,22 +6,14 @@ use Illuminate\Contracts\View\View; use Maatwebsite\Excel\Concerns\FromView; use Maatwebsite\Excel\Concerns\ShouldAutoSize; -/** - * DataGridExport class - * - * @author Rahul Shukla - * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) - */ - class DataGridExport implements FromView, ShouldAutoSize { - /** * DataGrid instance * * @var mixed */ - protected $gridData = array(); + protected $gridData = []; /** * Create a new instance. @@ -40,7 +32,7 @@ class DataGridExport implements FromView, ShouldAutoSize */ public function view(): View { - $columns = array(); + $columns = []; foreach($this->gridData as $key => $gridData) { $columns = array_keys((array) $gridData); diff --git a/packages/Webkul/Admin/src/Http/Controllers/ConfigurationController.php b/packages/Webkul/Admin/src/Http/Controllers/ConfigurationController.php index 5accd15e6..b62228784 100755 --- a/packages/Webkul/Admin/src/Http/Controllers/ConfigurationController.php +++ b/packages/Webkul/Admin/src/Http/Controllers/ConfigurationController.php @@ -8,12 +8,6 @@ use Webkul\Core\Tree; use Illuminate\Support\Facades\Storage; use Webkul\Admin\Http\Requests\ConfigurationForm; -/** - * Configuration controller - * - * @author Jitendra Singh - * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) - */ class ConfigurationController extends Controller { /** @@ -26,7 +20,7 @@ class ConfigurationController extends Controller /** * CoreConfigRepository object * - * @var array + * @var \Webkul\Core\Repositories\CoreConfigRepository */ protected $coreConfigRepository; @@ -39,7 +33,7 @@ class ConfigurationController extends Controller /** * Create a new controller instance. * - * @param \Webkul\Core\Repositories\CoreConfigRepository $coreConfigRepository + * @param \Webkul\Core\Repositories\CoreConfigRepository $coreConfigRepository * @return void */ public function __construct(CoreConfigRepository $coreConfigRepository) @@ -51,7 +45,6 @@ class ConfigurationController extends Controller $this->_config = request('_config'); $this->prepareConfigTree(); - } /** @@ -114,7 +107,7 @@ class ConfigurationController extends Controller /** * Store a newly created resource in storage. * - * @param \Webkul\Admin\Http\Requests\ConfigurationForm $request + * @param \Webkul\Admin\Http\Requests\ConfigurationForm $request * @return \Illuminate\Http\Response */ public function store(ConfigurationForm $request) @@ -147,8 +140,7 @@ class ConfigurationController extends Controller } /** - * @param $secondItem - * + * @param string $secondItem * @return array */ private function getSlugs($secondItem): array diff --git a/packages/Webkul/Admin/src/Http/Controllers/Customer/AddressController.php b/packages/Webkul/Admin/src/Http/Controllers/Customer/AddressController.php index d44921463..459a7af52 100644 --- a/packages/Webkul/Admin/src/Http/Controllers/Customer/AddressController.php +++ b/packages/Webkul/Admin/src/Http/Controllers/Customer/AddressController.php @@ -4,15 +4,9 @@ namespace Webkul\Admin\Http\Controllers\Customer; use Webkul\Customer\Rules\VatIdRule; use Webkul\Admin\Http\Controllers\Controller; -use Webkul\Customer\Repositories\CustomerRepository as Customer; -use Webkul\Customer\Repositories\CustomerAddressRepository as CustomerAddress; +use Webkul\Customer\Repositories\CustomerRepository; +use Webkul\Customer\Repositories\CustomerAddressRepository; -/** - * Customer's Address controller - * - * @author Vivek Sharma - * @copyright 2019 Webkul Software Pvt Ltd (http://www.webkul.com) - */ class AddressController extends Controller { /** @@ -25,32 +19,32 @@ class AddressController extends Controller /** * Customer Repository object * - * @var object + * @var \Webkul\Customer\Repositories\CustomerRepository */ - protected $customer; + protected $customerRepository; /** * CustomerAddress Repository object * - * @var object + * @var \Webkul\Customer\Repositories\CustomerAddressRepository */ - protected $customerAddress; + protected $customerAddressRepository; /** * Create a new controller instance. * - * @param Webkul\Customer\Repositories\CustomerAddressRepository $customerAddress - * + * @param \Webkul\Customer\Repositories\CustomerRepository $customerRepository + * @param \Webkul\Customer\Repositories\CustomerAddressRepository $customerAddressRepository * @return void */ public function __construct( - Customer $customer, - CustomerAddress $customerAddress + CustomerRepository $customerRepository, + CustomerAddressRepository $customerAddressRepository ) { - $this->customer = $customer; + $this->customerRepository = $customerRepository; - $this->customerAddress = $customerAddress; + $this->customerAddressRepository = $customerAddressRepository; $this->_config = request('_config'); } @@ -58,11 +52,12 @@ class AddressController extends Controller /** * Method to populate the seller order page which will be populated. * - * @return Mixed + * @param int $id + * @return \Illuminate\View\View */ public function index($id) { - $customer = $this->customer->find($id); + $customer = $this->customerRepository->find($id); return view($this->_config['view'], compact('customer')); } @@ -70,11 +65,12 @@ class AddressController extends Controller /** * Show the form for creating a new resource. * - * @return \Illuminate\Http\Response + * @param int $id + * @return \Illuminate\View\View */ public function create($id) { - $customer = $this->customer->find($id); + $customer = $this->customerRepository->find($id); return view($this->_config['view'], compact('customer')); } @@ -103,7 +99,7 @@ class AddressController extends Controller 'vat_id' => new VatIdRule(), ]); - if ($this->customerAddress->create($data)) { + if ($this->customerAddressRepository->create($data)) { session()->flash('success', trans('admin::app.customers.addresses.success-create')); return redirect()->route('admin.customer.addresses.index', ['id' => $data['customer_id']]); @@ -117,20 +113,21 @@ class AddressController extends Controller /** * Display a listing of the resource. * - * @return Mixed + * @param int $id + * @return \Illuminate\View\View */ public function edit($id) { - $address = $this->customerAddress->find($id); + $address = $this->customerAddressRepository->find($id); return view($this->_config['view'], compact('address')); } /** - * Edit's the premade resource of customer called - * Address. + * Edit's the premade resource of customer called Address. * - * @return redirect + * @param int $id + * @return \Illuminate\Http\Response */ public function update($id) { @@ -149,11 +146,10 @@ class AddressController extends Controller $data = collect(request()->input())->except('_token')->toArray(); - $address = $this->customerAddress->find($id); + $address = $this->customerAddressRepository->find($id); if ($address) { - - $this->customerAddress->update($data, $id); + $this->customerAddressRepository->update($data, $id); session()->flash('success', trans('admin::app.customers.addresses.success-update')); @@ -165,13 +161,12 @@ class AddressController extends Controller /** * Remove the specified resource from storage. * - * @param int $id - * + * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { - $this->customerAddress->delete($id); + $this->customerAddressRepository->delete($id); session()->flash('success', trans('admin::app.customers.addresses.success-delete')); @@ -181,14 +176,15 @@ class AddressController extends Controller /** * Mass Delete the customer's addresses * - * @return response + * @param int $id + * @return \Illuminate\Http\Response */ public function massDestroy($id) { $addressIds = explode(',', request()->input('indexes')); foreach ($addressIds as $addressId) { - $this->customerAddress->delete($addressId); + $this->customerAddressRepository->delete($addressId); } session()->flash('success', trans('admin::app.customers.addresses.success-mass-delete')); diff --git a/packages/Webkul/Admin/src/Http/Controllers/Customer/CustomerController.php b/packages/Webkul/Admin/src/Http/Controllers/Customer/CustomerController.php index 60edb2f32..98cbb7072 100755 --- a/packages/Webkul/Admin/src/Http/Controllers/Customer/CustomerController.php +++ b/packages/Webkul/Admin/src/Http/Controllers/Customer/CustomerController.php @@ -9,12 +9,6 @@ use Webkul\Core\Repositories\ChannelRepository; use Webkul\Admin\Mail\NewCustomerNotification; use Mail; -/** - * Customer controlller - * - * @author Rahul Shukla - * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) - */ class CustomerController extends Controller { /** @@ -27,30 +21,30 @@ class CustomerController extends Controller /** * CustomerRepository object * - * @var array + * @var \Webkul\Customer\Repositories\CustomerRepository */ protected $customerRepository; /** * CustomerGroupRepository object * - * @var array + * @var \Webkul\Customer\Repositories\CustomerGroupRepository */ protected $customerGroupRepository; /** * ChannelRepository object * - * @var array + * @var \Webkul\Core\Repositories\ChannelRepository */ protected $channelRepository; /** * Create a new controller instance. * - * @param \Webkul\Customer\Repositories\CustomerRepository $customerRepository - * @param \Webkul\Customer\Repositories\CustomerGroupRepository $customerGroupRepository - * @param \Webkul\Core\Repositories\ChannelRepository $channelRepository + * @param \Webkul\Customer\Repositories\CustomerRepository $customerRepository + * @param \Webkul\Customer\Repositories\CustomerGroupRepository $customerGroupRepository + * @param \Webkul\Core\Repositories\ChannelRepository $channelRepository */ public function __construct( CustomerRepository $customerRepository, @@ -136,8 +130,7 @@ class CustomerController extends Controller /** * Show the form for editing the specified resource. * - * @param int $id - * + * @param int $id * @return \Illuminate\View\View */ public function edit($id) @@ -154,8 +147,7 @@ class CustomerController extends Controller /** * Update the specified resource in storage. * - * @param int $id - * + * @param int $id * @return \Illuminate\Http\Response */ public function update($id) @@ -182,8 +174,7 @@ class CustomerController extends Controller /** * Remove the specified resource from storage. * - * @param int $id - * + * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) @@ -206,6 +197,7 @@ class CustomerController extends Controller /** * To load the note taking screen for the customers * + * @param int $id * @return \Illuminate\View\View */ public function createNote($id) @@ -218,7 +210,7 @@ class CustomerController extends Controller /** * To store the response of the note in storage * - * @return redirect + * @return \Illuminate\Http\Response */ public function storeNote() { @@ -228,9 +220,7 @@ class CustomerController extends Controller $customer = $this->customerRepository->find(request()->input('_customer')); - $noteTaken = $customer->update([ - 'notes' => request()->input('notes'), - ]); + $noteTaken = $customer->update(['notes' => request()->input('notes')]); if ($noteTaken) { session()->flash('success', 'Note taken'); @@ -244,7 +234,7 @@ class CustomerController extends Controller /** * To mass update the customer * - * @return redirect + * @return \Illuminate\Http\Response */ public function massUpdate() { @@ -254,9 +244,7 @@ class CustomerController extends Controller foreach ($customerIds as $customerId) { $customer = $this->customerRepository->find($customerId); - $customer->update([ - 'status' => $updateOption, - ]); + $customer->update(['status' => $updateOption]); } session()->flash('success', trans('admin::app.customers.customers.mass-update-success')); @@ -267,16 +255,14 @@ class CustomerController extends Controller /** * To mass delete the customer * - * @return redirect + * @return \Illuminate\Http\Response */ public function massDestroy() { $customerIds = explode(',', request()->input('indexes')); foreach ($customerIds as $customerId) { - $this->customerRepository->deleteWhere([ - 'id' => $customerId, - ]); + $this->customerRepository->deleteWhere(['id' => $customerId]); } session()->flash('success', trans('admin::app.customers.customers.mass-destroy-success')); diff --git a/packages/Webkul/Admin/src/Http/Controllers/Customer/CustomerGroupController.php b/packages/Webkul/Admin/src/Http/Controllers/Customer/CustomerGroupController.php index f4b4499bf..45adba153 100755 --- a/packages/Webkul/Admin/src/Http/Controllers/Customer/CustomerGroupController.php +++ b/packages/Webkul/Admin/src/Http/Controllers/Customer/CustomerGroupController.php @@ -5,12 +5,6 @@ namespace Webkul\Admin\Http\Controllers\Customer; use Webkul\Admin\Http\Controllers\Controller; use Webkul\Customer\Repositories\CustomerGroupRepository; -/** - * Customer Group controlller - * - * @author Rahul Shukla - * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) - */ class CustomerGroupController extends Controller { /** @@ -23,14 +17,14 @@ class CustomerGroupController extends Controller /** * CustomerGroupRepository object * - * @var array + * @var \Webkul\Customer\Repositories\CustomerGroupRepository */ protected $customerGroupRepository; /** * Create a new controller instance. * - * @param \Webkul\Customer\Repositories\CustomerGroupRepository $customerGroupRepository; + * @param \Webkul\Customer\Repositories\CustomerGroupRepository $customerGroupRepository; * @return void */ public function __construct(CustomerGroupRepository $customerGroupRepository) @@ -130,7 +124,7 @@ class CustomerGroupController extends Controller if ($customerGroup->is_user_defined == 0) { session()->flash('warning', trans('admin::app.customers.customers.group-default')); - } else if (count($customerGroup->customer) > 0) { + } elseif (count($customerGroup->customer) > 0) { session()->flash('warning', trans('admin::app.response.customer-associate', ['name' => 'Customer Group'])); } else { try { diff --git a/packages/Webkul/Admin/src/Http/Controllers/DashboardController.php b/packages/Webkul/Admin/src/Http/Controllers/DashboardController.php index 08a81d355..70717e83c 100755 --- a/packages/Webkul/Admin/src/Http/Controllers/DashboardController.php +++ b/packages/Webkul/Admin/src/Http/Controllers/DashboardController.php @@ -9,84 +9,78 @@ use Webkul\Sales\Repositories\OrderItemRepository; use Webkul\Customer\Repositories\CustomerRepository; use Webkul\Product\Repositories\ProductInventoryRepository; -/** - * Dashboard controller - * - * @author Jitendra Singh - * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) - */ class DashboardController extends Controller { /** * Display a listing of the resource. * - * @return \Illuminate\Http\Response + * @var array */ protected $_config; /** * OrderRepository object * - * @var Object + * @var \Webkul\Sales\Repositories\OrderRepository */ protected $orderRepository; /** * OrderItemRepository object * - * @var Object + * @var \Webkul\Sales\Repositories\OrderItemRepository */ protected $orderItemRepository; /** * CustomerRepository object * - * @var Object + * @var \Webkul\Customer\Repositories\CustomerRepository */ protected $customerRepository; /** * ProductInventoryRepository object * - * @var Object + * @var \Webkul\Product\Repositories\ProductInventoryRepository */ protected $productInventoryRepository; /** * string object * - * @var Object + * @var \Illuminate\Support\Carbon */ protected $startDate; /** * string object * - * @var Object + * @var \Illuminate\Support\Carbon */ protected $lastStartDate; /** * string object * - * @var Object + * @var \Illuminate\Support\Carbon */ protected $endDate; /** * string object * - * @var Object + * @var \Illuminate\Support\Carbon */ protected $lastEndDate; /** * Create a new controller instance. * - * @param \Webkul\Sales\Repositories\OrderRepository $orderRepository - * @param \Webkul\Sales\Repositories\OrderItemRepository $orderItemRepository - * @param \Webkul\Customer\Repositories\CustomerRepository $customerRepository - * @param \Webkul\Product\Repositories\ProductInventoryRepository $productInventoryRepository + * @param \Webkul\Sales\Repositories\OrderRepository $orderRepository + * @param \Webkul\Sales\Repositories\OrderItemRepository $orderItemRepository + * @param \Webkul\Customer\Repositories\CustomerRepository $customerRepository + * @param \Webkul\Product\Repositories\ProductInventoryRepository $productInventoryRepository * @return void */ public function __construct( @@ -112,12 +106,15 @@ class DashboardController extends Controller /** * Returns percentage difference * - * @return integer + * @param int $previous + * @param int $current + * @return int */ public function getPercentageChange($previous, $current) { - if (! $previous) + if (! $previous) { return $current ? 100 : 0; + } return ($current - $previous) / $previous * 100; } @@ -132,30 +129,30 @@ class DashboardController extends Controller $this->setStartEndDate(); $statistics = [ - 'total_customers' => [ + 'total_customers' => [ 'previous' => $previous = $this->getCustomersBetweenDates($this->lastStartDate, $this->lastEndDate)->count(), - 'current' => $current = $this->getCustomersBetweenDates($this->startDate, $this->endDate)->count(), - 'progress' => $this->getPercentageChange($previous, $current) + 'current' => $current = $this->getCustomersBetweenDates($this->startDate, $this->endDate)->count(), + 'progress' => $this->getPercentageChange($previous, $current), ], - 'total_orders' => [ + 'total_orders' => [ 'previous' => $previous = $this->previousOrders()->count(), - 'current' => $current = $this->currentOrders()->count(), - 'progress' => $this->getPercentageChange($previous, $current) + 'current' => $current = $this->currentOrders()->count(), + 'progress' => $this->getPercentageChange($previous, $current), ], - 'total_sales' => [ + 'total_sales' => [ 'previous' => $previous = $this->previousOrders()->sum('base_grand_total_invoiced') - $this->previousOrders()->sum('base_grand_total_refunded'), - 'current' => $current = $this->currentOrders()->sum('base_grand_total_invoiced') - $this->currentOrders()->sum('base_grand_total_refunded'), - 'progress' => $this->getPercentageChange($previous, $current) + 'current' => $current = $this->currentOrders()->sum('base_grand_total_invoiced') - $this->currentOrders()->sum('base_grand_total_refunded'), + 'progress' => $this->getPercentageChange($previous, $current), ], - 'avg_sales' => [ + 'avg_sales' => [ 'previous' => $previous = $this->previousOrders()->avg('base_grand_total_invoiced') - $this->previousOrders()->avg('base_grand_total_refunded'), - 'current' => $current = $this->currentOrders()->avg('base_grand_total_invoiced') - $this->currentOrders()->avg('base_grand_total_refunded'), - 'progress' => $this->getPercentageChange($previous, $current) + 'current' => $current = $this->currentOrders()->avg('base_grand_total_invoiced') - $this->currentOrders()->avg('base_grand_total_refunded'), + 'progress' => $this->getPercentageChange($previous, $current), ], - 'top_selling_categories' => $this->getTopSellingCategories(), - 'top_selling_products' => $this->getTopSellingProducts(), + 'top_selling_categories' => $this->getTopSellingCategories(), + 'top_selling_products' => $this->getTopSellingProducts(), 'customer_with_most_sales' => $this->getCustomerWithMostSales(), - 'stock_threshold' => $this->getStockThreshold(), + 'stock_threshold' => $this->getStockThreshold(), ]; foreach (core()->getTimeInterval($this->startDate, $this->endDate) as $interval) { @@ -173,80 +170,81 @@ class DashboardController extends Controller /** * Returns the list of top selling categories * - * @return Collection + * @return \Illuminate\Support\Collection */ public function getTopSellingCategories() { return $this->orderItemRepository->getModel() - ->leftJoin('products', 'order_items.product_id', 'products.id') - ->leftJoin('product_categories', 'products.id', 'product_categories.product_id') - ->leftJoin('categories', 'product_categories.category_id', 'categories.id') - ->leftJoin('category_translations', 'categories.id', 'category_translations.category_id') - ->where('category_translations.locale', app()->getLocale()) - ->where('order_items.created_at', '>=', $this->startDate) - ->where('order_items.created_at', '<=', $this->endDate) - ->addSelect(DB::raw('SUM(qty_invoiced - qty_refunded) as total_qty_invoiced')) - ->addSelect(DB::raw('COUNT(' . DB::getTablePrefix() . 'products.id) as total_products')) - ->addSelect('order_items.id', 'categories.id as category_id', 'category_translations.name') - ->groupBy('categories.id') - ->havingRaw('SUM(qty_invoiced - qty_refunded) > 0') - ->orderBy('total_qty_invoiced', 'DESC') - ->limit(5) - ->get(); + ->leftJoin('products', 'order_items.product_id', 'products.id') + ->leftJoin('product_categories', 'products.id', 'product_categories.product_id') + ->leftJoin('categories', 'product_categories.category_id', 'categories.id') + ->leftJoin('category_translations', 'categories.id', 'category_translations.category_id') + ->where('category_translations.locale', app()->getLocale()) + ->where('order_items.created_at', '>=', $this->startDate) + ->where('order_items.created_at', '<=', $this->endDate) + ->addSelect(DB::raw('SUM(qty_invoiced - qty_refunded) as total_qty_invoiced')) + ->addSelect(DB::raw('COUNT(' . DB::getTablePrefix() . 'products.id) as total_products')) + ->addSelect('order_items.id', 'categories.id as category_id', 'category_translations.name') + ->groupBy('categories.id') + ->havingRaw('SUM(qty_invoiced - qty_refunded) > 0') + ->orderBy('total_qty_invoiced', 'DESC') + ->limit(5) + ->get(); } /** * Return stock threshold. * - * @return Collection + * @return \Illuminate\Support\Collection */ public function getStockThreshold() { return $this->productInventoryRepository->getModel() - ->leftJoin('products', 'product_inventories.product_id', 'products.id') - ->select(DB::raw('SUM(qty) as total_qty')) - ->addSelect('product_inventories.product_id') - ->groupBy('product_id') - ->orderBy('total_qty', 'ASC') - ->limit(5) - ->get(); + ->leftJoin('products', 'product_inventories.product_id', 'products.id') + ->select(DB::raw('SUM(qty) as total_qty')) + ->addSelect('product_inventories.product_id') + ->groupBy('product_id') + ->orderBy('total_qty', 'ASC') + ->limit(5) + ->get(); } /** * Returns top selling products - * @return Collection + * + * @return \Illuminate\Support\Collection */ public function getTopSellingProducts() { return $this->orderItemRepository->getModel() - ->select(DB::raw('SUM(qty_ordered) as total_qty_ordered')) - ->addSelect('id', 'product_id', 'product_type', 'name') - ->where('order_items.created_at', '>=', $this->startDate) - ->where('order_items.created_at', '<=', $this->endDate) - ->whereNull('parent_id') - ->groupBy('product_id') - ->orderBy('total_qty_ordered', 'DESC') - ->limit(5) - ->get(); + ->select(DB::raw('SUM(qty_ordered) as total_qty_ordered')) + ->addSelect('id', 'product_id', 'product_type', 'name') + ->where('order_items.created_at', '>=', $this->startDate) + ->where('order_items.created_at', '<=', $this->endDate) + ->whereNull('parent_id') + ->groupBy('product_id') + ->orderBy('total_qty_ordered', 'DESC') + ->limit(5) + ->get(); } /** * Returns top selling products * - * @return Collection + * @return \Illuminate\Support\Collection */ public function getCustomerWithMostSales() { return $this->orderRepository->getModel() - ->select(DB::raw('SUM(base_grand_total) as total_base_grand_total')) - ->addSelect(DB::raw('COUNT(id) as total_orders')) - ->addSelect('id', 'customer_id', 'customer_email', 'customer_first_name', 'customer_last_name') - ->where('orders.created_at', '>=', $this->startDate) - ->where('orders.created_at', '<=', $this->endDate) - ->groupBy('customer_email') - ->orderBy('total_base_grand_total', 'DESC') - ->limit(5) - ->get(); + ->select(DB::raw('SUM(base_grand_total) as total_base_grand_total')) + ->addSelect(DB::raw('COUNT(id) as total_orders')) + ->addSelect('id', 'customer_id', 'customer_email', 'customer_first_name', 'customer_last_name') + ->where('orders.created_at', '>=', $this->startDate) + ->where('orders.created_at', '<=', $this->endDate) + ->groupBy('customer_email') + ->orderBy('total_base_grand_total', 'DESC') + ->limit(5) + ->get(); } /** @@ -257,15 +255,16 @@ class DashboardController extends Controller public function setStartEndDate() { $this->startDate = request()->get('start') - ? Carbon::createFromTimeString(request()->get('start') . " 00:00:01") - : Carbon::createFromTimeString(Carbon::now()->subDays(30)->format('Y-m-d') . " 00:00:01"); + ? Carbon::createFromTimeString(request()->get('start') . " 00:00:01") + : Carbon::createFromTimeString(Carbon::now()->subDays(30)->format('Y-m-d') . " 00:00:01"); $this->endDate = request()->get('end') - ? Carbon::createFromTimeString(request()->get('end') . " 23:59:59") - : Carbon::now(); + ? Carbon::createFromTimeString(request()->get('end') . " 23:59:59") + : Carbon::now(); - if ($this->endDate > Carbon::now()) + if ($this->endDate > Carbon::now()) { $this->endDate = Carbon::now(); + } $this->lastStartDate = clone $this->startDate; $this->lastEndDate = clone $this->startDate; @@ -277,7 +276,7 @@ class DashboardController extends Controller /** * Returns previous order query * - * @return mixed + * @return Illuminate\Database\Query\Builder */ private function previousOrders() { @@ -287,7 +286,7 @@ class DashboardController extends Controller /** * Returns current order query * - * @return mixed + * @return Illuminate\Database\Query\Builder */ private function currentOrders() { @@ -297,7 +296,9 @@ class DashboardController extends Controller /** * Returns orders between two dates * - * @return mixed + * @param \Illuminate\Support\Carbon $start + * @param \Illuminate\Support\Carbon $end + * @return Illuminate\Database\Query\Builder */ private function getOrdersBetweenDate($start, $end) { @@ -309,7 +310,9 @@ class DashboardController extends Controller /** * Returns customers between two dates * - * @return mixed + * @param \Illuminate\Support\Carbon $start + * @param \Illuminate\Support\Carbon $end + * @return Illuminate\Database\Query\Builder */ private function getCustomersBetweenDates($start, $end) { diff --git a/packages/Webkul/Admin/src/Http/Controllers/Development/DashboardController.php b/packages/Webkul/Admin/src/Http/Controllers/Development/DashboardController.php index 89dbecf9a..639369332 100755 --- a/packages/Webkul/Admin/src/Http/Controllers/Development/DashboardController.php +++ b/packages/Webkul/Admin/src/Http/Controllers/Development/DashboardController.php @@ -4,12 +4,6 @@ namespace Webkul\Admin\Http\Controllers\Development; use Webkul\Admin\Http\Controllers\Controller; -/** - * Dashboard controller - * - * @author Alexey Khachatryan - * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) - */ class DashboardController extends Controller { /** diff --git a/packages/Webkul/Admin/src/Http/Controllers/ExportController.php b/packages/Webkul/Admin/src/Http/Controllers/ExportController.php index 1267d40b2..911c1e6f0 100755 --- a/packages/Webkul/Admin/src/Http/Controllers/ExportController.php +++ b/packages/Webkul/Admin/src/Http/Controllers/ExportController.php @@ -5,21 +5,23 @@ namespace Webkul\Admin\Http\Controllers; use Webkul\Admin\Exports\DataGridExport; use Excel; -/** - * Export controlller - * - * @author Rahul Shukla - * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) - */ class ExportController extends Controller { protected $exportableGrids = [ - 'OrderDataGrid', 'OrderInvoicesDataGrid', 'OrderShipmentsDataGrid', 'OrderRefundDataGrid', 'CustomerDataGrid', 'TaxRateDataGrid', 'ProductDataGrid', 'CMSPageDataGrid' + 'OrderDataGrid', + 'OrderInvoicesDataGrid', + 'OrderShipmentsDataGrid', + 'OrderRefundDataGrid', + 'CustomerDataGrid', + 'TaxRateDataGrid', + 'ProductDataGrid', + 'CMSPageDataGrid', ]; /** * Create a new controller instance. * + * @return void */ public function __construct() { @@ -38,6 +40,7 @@ class ExportController extends Controller $format = $criteria['format']; $gridName = explode('\\', $criteria['gridName']); + $path = '\Webkul\Admin\DataGrids'.'\\'.last($gridName); $proceed = false; @@ -53,9 +56,10 @@ class ExportController extends Controller } $gridInstance = new $path; + $records = $gridInstance->export(); - if (count($records) == 0) { + if (! count($records)) { session()->flash('warning', trans('admin::app.export.no-records')); return redirect()->back(); diff --git a/packages/Webkul/Admin/src/Http/Controllers/Sales/InvoiceController.php b/packages/Webkul/Admin/src/Http/Controllers/Sales/InvoiceController.php index ebda162a7..3931fc268 100755 --- a/packages/Webkul/Admin/src/Http/Controllers/Sales/InvoiceController.php +++ b/packages/Webkul/Admin/src/Http/Controllers/Sales/InvoiceController.php @@ -7,12 +7,6 @@ use Webkul\Sales\Repositories\OrderRepository; use Webkul\Sales\Repositories\InvoiceRepository; use PDF; -/** - * Sales Invoice controller - * - * @author Jitendra Singh - * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) - */ class InvoiceController extends Controller { /** @@ -25,22 +19,22 @@ class InvoiceController extends Controller /** * OrderRepository object * - * @var array + * @var \Webkul\Sales\Repositories\OrderRepository */ protected $orderRepository; /** * InvoiceRepository object * - * @var array + * @var \Webkul\Sales\Repositories\InvoiceRepository */ protected $invoiceRepository; /** * Create a new controller instance. * - * @param \Webkul\Sales\Repositories\OrderRepository $orderRepository - * @param \Webkul\Sales\Repositories\InvoiceRepository $invoiceRepository + * @param \Webkul\Sales\Repositories\OrderRepository $orderRepository + * @param \Webkul\Sales\Repositories\InvoiceRepository $invoiceRepository * @return void */ public function __construct( @@ -70,7 +64,7 @@ class InvoiceController extends Controller /** * Show the form for creating a new resource. * - * @param int $orderId + * @param int $orderId * @return \Illuminate\View\View */ public function create($orderId) @@ -83,7 +77,7 @@ class InvoiceController extends Controller /** * Store a newly created resource in storage. * - * @param int $orderId + * @param int $orderId * @return \Illuminate\Http\Response */ public function store($orderId) @@ -103,6 +97,7 @@ class InvoiceController extends Controller $data = request()->all(); $haveProductToInvoice = false; + foreach ($data['invoice']['items'] as $itemId => $qty) { if ($qty) { $haveProductToInvoice = true; diff --git a/packages/Webkul/Admin/src/Http/Controllers/Sales/OrderController.php b/packages/Webkul/Admin/src/Http/Controllers/Sales/OrderController.php index 19906800e..01b0e9142 100755 --- a/packages/Webkul/Admin/src/Http/Controllers/Sales/OrderController.php +++ b/packages/Webkul/Admin/src/Http/Controllers/Sales/OrderController.php @@ -5,12 +5,6 @@ namespace Webkul\Admin\Http\Controllers\Sales; use Webkul\Admin\Http\Controllers\Controller; use Webkul\Sales\Repositories\OrderRepository; -/** - * Sales Order controller - * - * @author Jitendra Singh - * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) - */ class OrderController extends Controller { /** @@ -23,14 +17,14 @@ class OrderController extends Controller /** * OrderRepository object * - * @var array + * @var \Webkul\Sales\Repositories\OrderRepository */ protected $orderRepository; /** * Create a new controller instance. * - * @param \Webkul\Sales\Repositories\OrderRepository $orderRepository + * @param \Webkul\Sales\Repositories\OrderRepository $orderRepository * @return void */ public function __construct(OrderRepository $orderRepository) @@ -40,7 +34,6 @@ class OrderController extends Controller $this->_config = request('_config'); $this->orderRepository = $orderRepository; - } /** diff --git a/packages/Webkul/Admin/src/Http/Controllers/Sales/RefundController.php b/packages/Webkul/Admin/src/Http/Controllers/Sales/RefundController.php index 47a891a25..48a23125b 100755 --- a/packages/Webkul/Admin/src/Http/Controllers/Sales/RefundController.php +++ b/packages/Webkul/Admin/src/Http/Controllers/Sales/RefundController.php @@ -7,12 +7,6 @@ use Webkul\Sales\Repositories\OrderRepository; use Webkul\Sales\Repositories\OrderItemRepository; use Webkul\Sales\Repositories\RefundRepository; -/** - * Sales Refund controller - * - * @author Jitendra Singh - * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) - */ class RefundController extends Controller { /** @@ -25,30 +19,30 @@ class RefundController extends Controller /** * OrderRepository object * - * @var Object + * @var \Webkul\Sales\Repositories\OrderRepository */ protected $orderRepository; /** * OrderItemRepository object * - * @var Object + * @var \Webkul\Sales\Repositories\OrderItemRepository */ protected $orderItemRepository; /** * RefundRepository object * - * @var Object + * @var \Webkul\Sales\Repositories\RefundRepository */ protected $refundRepository; /** * Create a new controller instance. * - * @param \Webkul\Sales\Repositories\OrderRepository $orderRepository - * @param \Webkul\Sales\Repositories\OrderItemRepository $orderItemRepository - * @param \Webkul\Sales\Repositories\RefundRepository $refundRepository + * @param \Webkul\Sales\Repositories\OrderRepository $orderRepository + * @param \Webkul\Sales\Repositories\OrderItemRepository $orderItemRepository + * @param \Webkul\Sales\Repositories\RefundRepository $refundRepository * @return void */ public function __construct( @@ -81,7 +75,7 @@ class RefundController extends Controller /** * Show the form for creating a new resource. * - * @param int $orderId + * @param int $orderId * @return \Illuminate\Http\View */ public function create($orderId) @@ -94,7 +88,7 @@ class RefundController extends Controller /** * Store a newly created resource in storage. * - * @param int $orderId + * @param int $orderId * @return \Illuminate\Http\Response */ public function store($orderId) @@ -108,7 +102,7 @@ class RefundController extends Controller } $this->validate(request(), [ - 'refund.items.*' => 'required|numeric|min:0' + 'refund.items.*' => 'required|numeric|min:0', ]); $data = request()->all(); @@ -141,15 +135,16 @@ class RefundController extends Controller /** * Store a newly created resource in storage. * - * @param int $orderId + * @param int $orderId * @return \Illuminate\Http\JsonResponse */ public function updateQty($orderId) { $data = $this->refundRepository->getOrderItemsRefundSummary(request()->all(), $orderId); - if (! $data) + if (! $data) { return response(''); + } return response()->json($data); } @@ -157,7 +152,7 @@ class RefundController extends Controller /** * Show the view for the specified resource. * - * @param int $id + * @param int $id * @return \Illuminate\Http\View */ public function view($id) diff --git a/packages/Webkul/Admin/src/Http/Controllers/Sales/ShipmentController.php b/packages/Webkul/Admin/src/Http/Controllers/Sales/ShipmentController.php index 059ce1ae7..42239458b 100755 --- a/packages/Webkul/Admin/src/Http/Controllers/Sales/ShipmentController.php +++ b/packages/Webkul/Admin/src/Http/Controllers/Sales/ShipmentController.php @@ -7,12 +7,6 @@ use Webkul\Sales\Repositories\OrderRepository; use Webkul\Sales\Repositories\OrderItemRepository; use Webkul\Sales\Repositories\ShipmentRepository; -/** - * Sales Shipment controller - * - * @author Jitendra Singh - * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) - */ class ShipmentController extends Controller { /** @@ -25,30 +19,30 @@ class ShipmentController extends Controller /** * OrderRepository object * - * @var mixed + * @var \Webkul\Sales\Repositories\OrderRepository */ protected $orderRepository; /** * OrderItemRepository object * - * @var mixed + * @var \Webkul\Sales\Repositories\OrderItemRepository */ protected $orderItemRepository; /** * ShipmentRepository object * - * @var mixed + * @var \Webkul\Sales\Repositories\ShipmentRepository */ protected $shipmentRepository; /** * Create a new controller instance. * - * @param \Webkul\Sales\Repositories\ShipmentRepository $shipmentRepository - * @param \Webkul\Sales\Repositories\OrderRepository $orderRepository - * @param \Webkul\Sales\Repositories\OrderitemRepository $orderItemRepository + * @param \Webkul\Sales\Repositories\ShipmentRepository $shipmentRepository + * @param \Webkul\Sales\Repositories\OrderRepository $orderRepository + * @param \Webkul\Sales\Repositories\OrderitemRepository $orderItemRepository * @return void */ public function __construct( @@ -81,7 +75,7 @@ class ShipmentController extends Controller /** * Show the form for creating a new resource. * - * @param int $orderId + * @param int $orderId * @return \Illuminate\View\View */ public function create($orderId) @@ -100,7 +94,7 @@ class ShipmentController extends Controller /** * Store a newly created resource in storage. * - * @param int $orderId + * @param int $orderId * @return \Illuminate\Http\Response */ public function store($orderId) @@ -115,9 +109,9 @@ class ShipmentController extends Controller $this->validate(request(), [ 'shipment.carrier_title' => 'required', - 'shipment.track_number' => 'required', - 'shipment.source' => 'required', - 'shipment.items.*.*' => 'required|numeric|min:0', + 'shipment.track_number' => 'required', + 'shipment.source' => 'required', + 'shipment.items.*.*' => 'required|numeric|min:0', ]); $data = request()->all(); @@ -138,13 +132,14 @@ class ShipmentController extends Controller /** * Checks if requested quantity available or not * - * @param array $data - * @return boolean + * @param array $data + * @return bool */ public function isInventoryValidate(&$data) { - if (! isset($data['shipment']['items'])) + if (! isset($data['shipment']['items'])) { return ; + } $valid = false; @@ -154,13 +149,15 @@ class ShipmentController extends Controller if ($qty = $inventorySource[$inventorySourceId]) { $orderItem = $this->orderItemRepository->find($itemId); - if ($orderItem->qty_to_ship < $qty) + if ($orderItem->qty_to_ship < $qty) { return false; + } if ($orderItem->getTypeInstance()->isComposite()) { foreach ($orderItem->children as $child) { - if (! $child->qty_ordered) + if (! $child->qty_ordered) { continue; + } $finalQty = ($child->qty_ordered / $orderItem->qty_ordered) * $qty; @@ -168,16 +165,18 @@ class ShipmentController extends Controller ->where('inventory_source_id', $inventorySourceId) ->sum('qty'); - if ($child->qty_to_ship < $finalQty || $availableQty < $finalQty) + if ($child->qty_to_ship < $finalQty || $availableQty < $finalQty) { return false; + } } } else { $availableQty = $orderItem->product->inventories() ->where('inventory_source_id', $inventorySourceId) ->sum('qty'); - if ($orderItem->qty_to_ship < $qty || $availableQty < $qty) + if ($orderItem->qty_to_ship < $qty || $availableQty < $qty) { return false; + } } $valid = true; diff --git a/packages/Webkul/Admin/src/Http/Requests/ConfigurationForm.php b/packages/Webkul/Admin/src/Http/Requests/ConfigurationForm.php index 88063814c..4611ad6b5 100644 --- a/packages/Webkul/Admin/src/Http/Requests/ConfigurationForm.php +++ b/packages/Webkul/Admin/src/Http/Requests/ConfigurationForm.php @@ -26,16 +26,11 @@ class ConfigurationForm extends FormRequest { $this->rules = []; - // if (request()->has('sales.orderSettings.order_number')) { - // $this->rules = [ - // 'sales.orderSettings.order_number.order_number_prefix' => 'required|regex:/^[a-zA-Z0-9$%^&*@]+$/u', - // 'sales.orderSettings.order_number.order_number_suffix' => 'required|regex:/^[a-zA-Z0-9$%^&*@]+$/u', - // ]; - // } - - if (request()->has('general.design.admin_logo.logo_image') && ! request()->input('general.design.admin_logo.logo_image.delete')) { + if (request()->has('general.design.admin_logo.logo_image') + && ! request()->input('general.design.admin_logo.logo_image.delete') + ) { $this->rules = [ - 'general.design.admin_logo.logo_image' => 'required|mimes:jpeg,bmp,png,jpg' + 'general.design.admin_logo.logo_image' => 'required|mimes:jpeg,bmp,png,jpg', ]; } @@ -46,13 +41,11 @@ class ConfigurationForm extends FormRequest * Get the error messages for the defined validation rules. * * @return array - */ + */ public function messages() { return [ - // 'sales.orderSettings.order_number.order_number_prefix.regex' => 'Invalid format. Can not use #.', - // 'sales.orderSettings.order_number.order_number_suffix.regex' => 'Invalid format. Can not use #.', - 'general.design.admin_logo.logo_image.mimes' => 'Invalid file format. Use only jpeg, bmp, png, jpg.' + 'general.design.admin_logo.logo_image.mimes' => 'Invalid file format. Use only jpeg, bmp, png, jpg.', ]; } } diff --git a/packages/Webkul/Admin/src/Imports/DataGridImport.php b/packages/Webkul/Admin/src/Imports/DataGridImport.php index 07ed1b7b7..76c6b35e6 100644 --- a/packages/Webkul/Admin/src/Imports/DataGridImport.php +++ b/packages/Webkul/Admin/src/Imports/DataGridImport.php @@ -7,20 +7,12 @@ use Maatwebsite\Excel\Concerns\ToCollection; use Maatwebsite\Excel\Concerns\WithHeadingRow; use Maatwebsite\Excel\Concerns\Importable; - -/** - * DataGridImport class - * - * @author Rahul Shukla - * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) -*/ - class DataGridImport implements ToCollection, WithHeadingRow { use Importable; /** - * @param array $row + * @param Illuminate\Support\Collection $row * @return void */ public function collection(Collection $rows) diff --git a/packages/Webkul/Admin/src/Listeners/Order.php b/packages/Webkul/Admin/src/Listeners/Order.php index c6b7e7947..41385ddab 100755 --- a/packages/Webkul/Admin/src/Listeners/Order.php +++ b/packages/Webkul/Admin/src/Listeners/Order.php @@ -11,19 +11,14 @@ use Webkul\Admin\Mail\NewInventorySourceNotification; use Webkul\Admin\Mail\CancelOrderNotification; use Webkul\Admin\Mail\NewRefundNotification; -/** - * Order event handler - * - * @author Jitendra Singh - * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) - */ class Order { /** - * @param mixed $order - * * Send new order Mail to the customer and admin + * + * @param \Webkul\Sales\Contracts\Order $order + * @return void */ public function sendNewOrderMail($order) { @@ -43,9 +38,10 @@ class Order } /** - * @param mixed $invoice - * * Send new invoice mail to the customer + * + * @param \Webkul\Sales\Contracts\Invoice $invoice + * @return void */ public function sendNewInvoiceMail($invoice) { @@ -64,9 +60,10 @@ class Order } /** - * @param mixed $refund - * * Send new refund mail to the customer + * + * @param \Webkul\Sales\Contracts\Refund $refund + * @return void */ public function sendNewRefundMail($refund) { @@ -81,9 +78,10 @@ class Order } /** - * @param mixed $shipment - * * Send new shipment mail to the customer + * + * @param \Webkul\Sales\Contracts\Shipment $refund + * @return void */ public function sendNewShipmentMail($shipment) { @@ -107,8 +105,8 @@ class Order } /** - * @param mixed $order - * + * @param \Webkul\Sales\Contracts\Order $order + * @return void */ public function sendCancelOrderMail($order) { diff --git a/packages/Webkul/Admin/src/Mail/CancelOrderNotification.php b/packages/Webkul/Admin/src/Mail/CancelOrderNotification.php index b13a93b58..b020bba9f 100644 --- a/packages/Webkul/Admin/src/Mail/CancelOrderNotification.php +++ b/packages/Webkul/Admin/src/Mail/CancelOrderNotification.php @@ -11,11 +11,15 @@ class CancelOrderNotification extends Mailable { use Queueable, SerializesModels; - /* - * @var Order - * */ + /** + * @var \Webkul\Sales\Contracts\Order + */ public $order; + /** + * @param \Webkul\Sales\Contracts\Order $order + * @return void + */ public function __construct($order) { $this->order = $order; @@ -24,7 +28,7 @@ class CancelOrderNotification extends Mailable public function build() { return $this->to($this->order->customer_email, $this->order->customer_full_name) - ->subject(trans('shop::app.mail.order.cancel.subject')) - ->view('shop::emails.sales.order-cancel'); + ->subject(trans('shop::app.mail.order.cancel.subject')) + ->view('shop::emails.sales.order-cancel'); } } \ No newline at end of file diff --git a/packages/Webkul/Admin/src/Mail/NewAdminNotification.php b/packages/Webkul/Admin/src/Mail/NewAdminNotification.php index b31a4ab1c..fd1426030 100644 --- a/packages/Webkul/Admin/src/Mail/NewAdminNotification.php +++ b/packages/Webkul/Admin/src/Mail/NewAdminNotification.php @@ -7,12 +7,6 @@ use Illuminate\Mail\Mailable; use Illuminate\Queue\SerializesModels; use Illuminate\Contracts\Queue\ShouldQueue; -/** - * New Admin Mail class - * - * @author Jitendra Singh - * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) - */ class NewAdminNotification extends Mailable { use Queueable, SerializesModels; @@ -20,14 +14,14 @@ class NewAdminNotification extends Mailable /** * The order instance. * - * @var Order + * @var \Webkul\Sales\Contracts\Order */ public $order; - /** * Create a new message instance. - * + * + * @param \Webkul\Sales\Contracts\Order $order * @return void */ public function __construct($order) @@ -43,7 +37,7 @@ class NewAdminNotification extends Mailable public function build() { return $this->to(config('mail.admin.address')) - ->subject(trans('shop::app.mail.order.subject')) - ->view('shop::emails.sales.new-admin-order'); + ->subject(trans('shop::app.mail.order.subject')) + ->view('shop::emails.sales.new-admin-order'); } } \ No newline at end of file diff --git a/packages/Webkul/Admin/src/Mail/NewCustomerNotification.php b/packages/Webkul/Admin/src/Mail/NewCustomerNotification.php index 4af9308e6..c80d68399 100644 --- a/packages/Webkul/Admin/src/Mail/NewCustomerNotification.php +++ b/packages/Webkul/Admin/src/Mail/NewCustomerNotification.php @@ -7,12 +7,6 @@ use Illuminate\Mail\Mailable; use Illuminate\Queue\SerializesModels; use Illuminate\Contracts\Queue\ShouldQueue; -/** - * New Admin Mail class - * - * @author Rahul Shukla - * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) - */ class NewCustomerNotification extends Mailable { use Queueable, SerializesModels; @@ -20,23 +14,28 @@ class NewCustomerNotification extends Mailable /** * The customer instance. * - * @var customer + * @var \Webkul\Customer\Contracts\Customer */ public $customer; /** * The password instance. * - * @var password + * @var string */ public $password; /** * Create a new message instance. - * + * + * @param \Webkul\Customer\Contracts\Customer $order + * @param string $password * @return void */ - public function __construct($customer, $password) + public function __construct( + $customer, + $password + ) { $this->customer = $customer; @@ -51,7 +50,7 @@ class NewCustomerNotification extends Mailable public function build() { return $this->to($this->customer->email) - ->subject(trans('shop::app.mail.customer.new.subject')) - ->view('shop::emails.customer.new-customer')->with(['customer' => $this->customer, 'password' => $this->password]); + ->subject(trans('shop::app.mail.customer.new.subject')) + ->view('shop::emails.customer.new-customer')->with(['customer' => $this->customer, 'password' => $this->password]); } } \ No newline at end of file diff --git a/packages/Webkul/Admin/src/Mail/NewInventorySourceNotification.php b/packages/Webkul/Admin/src/Mail/NewInventorySourceNotification.php index 4ed66f352..931d55a09 100644 --- a/packages/Webkul/Admin/src/Mail/NewInventorySourceNotification.php +++ b/packages/Webkul/Admin/src/Mail/NewInventorySourceNotification.php @@ -7,12 +7,6 @@ use Illuminate\Mail\Mailable; use Illuminate\Queue\SerializesModels; use Illuminate\Contracts\Queue\ShouldQueue; -/** - * New InventorySource Notification Mail class - * - * @author Jitendra Singh - * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) - */ class NewInventorySourceNotification extends Mailable { use Queueable, SerializesModels; @@ -20,14 +14,14 @@ class NewInventorySourceNotification extends Mailable /** * The shipment instance. * - * @var Shipment + * @var \Webkul\Customer\Contracts\Shipment */ public $shipment; /** * Create a new message instance. * - * @param mixed $shipment + * @param \Webkul\Customer\Contracts\Shipment $shipment * @return void */ public function __construct($shipment) @@ -43,10 +37,11 @@ class NewInventorySourceNotification extends Mailable public function build() { $order = $this->shipment->order; + $inventory = $this->shipment->inventory_source; return $this->to($inventory->contact_email, $inventory->name) - ->subject(trans('shop::app.mail.shipment.subject', ['order_id' => $order->increment_id])) - ->view('shop::emails.sales.new-inventorysource-shipment'); + ->subject(trans('shop::app.mail.shipment.subject', ['order_id' => $order->increment_id])) + ->view('shop::emails.sales.new-inventorysource-shipment'); } } diff --git a/packages/Webkul/Admin/src/Mail/NewInvoiceNotification.php b/packages/Webkul/Admin/src/Mail/NewInvoiceNotification.php index 2b9cf68e3..a8bf2fba9 100755 --- a/packages/Webkul/Admin/src/Mail/NewInvoiceNotification.php +++ b/packages/Webkul/Admin/src/Mail/NewInvoiceNotification.php @@ -7,12 +7,6 @@ use Illuminate\Mail\Mailable; use Illuminate\Queue\SerializesModels; use Illuminate\Contracts\Queue\ShouldQueue; -/** - * New Invoice Mail class - * - * @author Jitendra Singh - * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) - */ class NewInvoiceNotification extends Mailable { use Queueable, SerializesModels; @@ -20,14 +14,14 @@ class NewInvoiceNotification extends Mailable /** * The invoice instance. * - * @var Invoice + * @param \Webkul\Customer\Contracts\Invoice $invoice */ public $invoice; /** * Create a new message instance. * - * @param mixed $invoice + * @param \Webkul\Customer\Contracts\Invoice $invoice * @return void */ public function __construct($invoice) @@ -45,7 +39,7 @@ class NewInvoiceNotification extends Mailable $order = $this->invoice->order; return $this->to($order->customer_email, $order->customer_full_name) - ->subject(trans('shop::app.mail.invoice.subject', ['order_id' => $order->increment_id])) - ->view('shop::emails.sales.new-invoice'); + ->subject(trans('shop::app.mail.invoice.subject', ['order_id' => $order->increment_id])) + ->view('shop::emails.sales.new-invoice'); } } diff --git a/packages/Webkul/Admin/src/Mail/NewOrderNotification.php b/packages/Webkul/Admin/src/Mail/NewOrderNotification.php index cc1f332af..ca4b8c680 100755 --- a/packages/Webkul/Admin/src/Mail/NewOrderNotification.php +++ b/packages/Webkul/Admin/src/Mail/NewOrderNotification.php @@ -7,12 +7,6 @@ use Illuminate\Mail\Mailable; use Illuminate\Queue\SerializesModels; use Illuminate\Contracts\Queue\ShouldQueue; -/** - * New Order Mail class - * - * @author Jitendra Singh - * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) - */ class NewOrderNotification extends Mailable { use Queueable, SerializesModels; @@ -20,13 +14,14 @@ class NewOrderNotification extends Mailable /** * The order instance. * - * @var Order + * @var \Webkul\Sales\Contracts\Order $order */ public $order; /** * Create a new message instance. * + * @param \Webkul\Sales\Contracts\Order $order * @return void */ public function __construct($order) @@ -42,7 +37,7 @@ class NewOrderNotification extends Mailable public function build() { return $this->to($this->order->customer_email, $this->order->customer_full_name) - ->subject(trans('shop::app.mail.order.subject')) - ->view('shop::emails.sales.new-order'); + ->subject(trans('shop::app.mail.order.subject')) + ->view('shop::emails.sales.new-order'); } } diff --git a/packages/Webkul/Admin/src/Mail/NewRefundNotification.php b/packages/Webkul/Admin/src/Mail/NewRefundNotification.php index 2de6230cd..3e1d04bf6 100644 --- a/packages/Webkul/Admin/src/Mail/NewRefundNotification.php +++ b/packages/Webkul/Admin/src/Mail/NewRefundNotification.php @@ -7,12 +7,6 @@ use Illuminate\Mail\Mailable; use Illuminate\Queue\SerializesModels; use Illuminate\Contracts\Queue\ShouldQueue; -/** - * New Refund Mail class - * - * @author Jitendra Singh - * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) - */ class NewRefundNotification extends Mailable { use Queueable, SerializesModels; @@ -20,14 +14,14 @@ class NewRefundNotification extends Mailable /** * The refund instance. * - * @var Refund + * @var \Webkul\Sales\Contracts\Refund */ public $refund; /** * Create a new message instance. * - * @param mixed $refund + * @param \Webkul\Sales\Contracts\Refund $refund * @return void */ public function __construct($refund) @@ -45,7 +39,7 @@ class NewRefundNotification extends Mailable $order = $this->refund->order; return $this->to($order->customer_email, $order->customer_full_name) - ->subject(trans('shop::app.mail.refund.subject', ['order_id' => $order->increment_id])) - ->view('shop::emails.sales.new-refund'); + ->subject(trans('shop::app.mail.refund.subject', ['order_id' => $order->increment_id])) + ->view('shop::emails.sales.new-refund'); } } diff --git a/packages/Webkul/Admin/src/Mail/NewShipmentNotification.php b/packages/Webkul/Admin/src/Mail/NewShipmentNotification.php index 9b53c49a3..f18ab994e 100755 --- a/packages/Webkul/Admin/src/Mail/NewShipmentNotification.php +++ b/packages/Webkul/Admin/src/Mail/NewShipmentNotification.php @@ -7,12 +7,6 @@ use Illuminate\Mail\Mailable; use Illuminate\Queue\SerializesModels; use Illuminate\Contracts\Queue\ShouldQueue; -/** - * New Shipment Mail class - * - * @author Jitendra Singh - * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) - */ class NewShipmentNotification extends Mailable { use Queueable, SerializesModels; @@ -20,14 +14,14 @@ class NewShipmentNotification extends Mailable /** * The shipment instance. * - * @var Shipment + * @var \Webkul\Sales\Contracts\Shipment */ public $shipment; /** * Create a new message instance. * - * @param mixed $shipment + * @param \Webkul\Sales\Contracts\Shipment $shipment * @return void */ public function __construct($shipment) @@ -45,7 +39,7 @@ class NewShipmentNotification extends Mailable $order = $this->shipment->order; return $this->to($order->customer_email, $order->customer_full_name) - ->subject(trans('shop::app.mail.shipment.subject', ['order_id' => $order->increment_id])) - ->view('shop::emails.sales.new-shipment'); + ->subject(trans('shop::app.mail.shipment.subject', ['order_id' => $order->increment_id])) + ->view('shop::emails.sales.new-shipment'); } } diff --git a/packages/Webkul/Admin/src/Providers/AdminServiceProvider.php b/packages/Webkul/Admin/src/Providers/AdminServiceProvider.php index 987f84924..97f1f36ec 100755 --- a/packages/Webkul/Admin/src/Providers/AdminServiceProvider.php +++ b/packages/Webkul/Admin/src/Providers/AdminServiceProvider.php @@ -8,12 +8,6 @@ use Illuminate\Contracts\Debug\ExceptionHandler; use Webkul\Admin\Exceptions\Handler; use Webkul\Core\Tree; -/** - * Admin service provider - * - * @author Jitendra Singh - * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) - */ class AdminServiceProvider extends ServiceProvider { /** @@ -139,8 +133,9 @@ class AdminServiceProvider extends ServiceProvider { static $tree; - if ($tree) + if ($tree) { return $tree; + } $tree = Tree::create(); diff --git a/packages/Webkul/Admin/src/Resources/lang/ar/app.php b/packages/Webkul/Admin/src/Resources/lang/ar/app.php index 43d916fae..2b682a75e 100644 --- a/packages/Webkul/Admin/src/Resources/lang/ar/app.php +++ b/packages/Webkul/Admin/src/Resources/lang/ar/app.php @@ -150,7 +150,31 @@ return [ 'role' => 'الدور', 'sub-total' => 'المجموع الفرعي', 'no-of-products' => 'عدد المنتجات', + 'attribute-family' => 'Attribute Family', + 'starts-from' => 'Starts From', + 'ends-till' => 'Ends Till', + 'per-cust' => 'Per Customer', + 'usage-throttle' => 'Usage Times', + 'for-guest' => 'For Guest', + 'order_number' => 'Order Number', + 'refund-date' => 'Refund Date', 'refunded' => 'Refunded', + 'start' => 'Start', + 'end' => 'End', + 'active' => 'Active', + 'inactive' => 'Inactive', + 'true' => 'True', + 'false' => 'False', + 'approved' => 'Approved', + 'pending' => 'Pending', + 'disapproved' => 'Disapproved', + 'coupon-code' => 'Coupon Code', + 'times-used' => 'Times Used', + 'created-date' => 'Created Date', + 'expiration-date' => 'Expiration Date', + 'edit' => 'Edit', + 'delete' => 'Delete', + 'view' => 'View', 'rtl' => 'RTL', 'ltr' => 'LTR', 'update-status' => 'Update Status' diff --git a/packages/Webkul/Admin/src/Resources/lang/en/app.php b/packages/Webkul/Admin/src/Resources/lang/en/app.php index e9a4a18d9..070286f58 100755 --- a/packages/Webkul/Admin/src/Resources/lang/en/app.php +++ b/packages/Webkul/Admin/src/Resources/lang/en/app.php @@ -209,11 +209,18 @@ return [ 'end' => 'End', 'active' => 'Active', 'inactive' => 'Inactive', + 'true' => 'True', + 'false' => 'False', + 'approved' => 'Approved', + 'pending' => 'Pending', + 'disapproved' => 'Disapproved', 'coupon-code' => 'Coupon Code', 'times-used' => 'Times Used', 'created-date' => 'Created Date', 'expiration-date' => 'Expiration Date', + 'edit' => 'Edit', 'delete' => 'Delete', + 'view' => 'View', 'rtl' => 'RTL', 'ltr' => 'LTR', 'update-status' => 'Update Status' @@ -565,6 +572,7 @@ return [ 'file' => 'File', 'checkbox' => 'Checkbox', 'use_in_flat' => "Create in Product Flat Table", + 'is_comparable' => "Attribute is comparable", 'default_null_option' => 'Create default empty option', ], 'families' => [ diff --git a/packages/Webkul/Admin/src/Resources/lang/fa/app.php b/packages/Webkul/Admin/src/Resources/lang/fa/app.php index 0e24d3a3b..141e91b45 100644 --- a/packages/Webkul/Admin/src/Resources/lang/fa/app.php +++ b/packages/Webkul/Admin/src/Resources/lang/fa/app.php @@ -156,18 +156,31 @@ return [ 'role' => 'نقش', 'sub-total' => 'زیر مجموع', 'no-of-products' => 'تعداد محصولات', - 'attribute-family' => 'ویژگی خانواده', - 'starts-from' => 'شروع می شود از', - 'ends-till' => 'پایان می یابد', - 'per-cust' => 'به ازای هر مشتری', - 'usage-throttle' => 'بار استفاده', - 'for-guest' => 'برای مهمان', - 'end_other_rules' => 'پایان قوانین دیگر', - 'action_type' => 'نوع عملیات', - 'disc_quantity' => 'مقدار استفاده نشده', - 'disc_threshold' => 'آستانه استفاده نشده', - 'use_coupon' => 'استافده از کوپن', + 'attribute-family' => 'Attribute Family', + 'starts-from' => 'Starts From', + 'ends-till' => 'Ends Till', + 'per-cust' => 'Per Customer', + 'usage-throttle' => 'Usage Times', + 'for-guest' => 'For Guest', + 'order_number' => 'Order Number', + 'refund-date' => 'Refund Date', 'refunded' => 'Refunded', + 'start' => 'Start', + 'end' => 'End', + 'active' => 'Active', + 'inactive' => 'Inactive', + 'true' => 'True', + 'false' => 'False', + 'approved' => 'Approved', + 'pending' => 'Pending', + 'disapproved' => 'Disapproved', + 'coupon-code' => 'Coupon Code', + 'times-used' => 'Times Used', + 'created-date' => 'Created Date', + 'expiration-date' => 'Expiration Date', + 'edit' => 'Edit', + 'delete' => 'Delete', + 'view' => 'View', 'rtl' => 'RTL', 'ltr' => 'LTR', 'update-status' => 'Update Status' diff --git a/packages/Webkul/Admin/src/Resources/lang/nl/app.php b/packages/Webkul/Admin/src/Resources/lang/nl/app.php index 8bf18e59b..5e599fb44 100644 --- a/packages/Webkul/Admin/src/Resources/lang/nl/app.php +++ b/packages/Webkul/Admin/src/Resources/lang/nl/app.php @@ -197,26 +197,33 @@ return [ 'sub-total' => 'Subtotaal', 'no-of-products' => 'Aantal producten', 'attribute-family' => 'Attribute Family', - 'starts-from' => 'Van', - 'ends-till' => 'Tot', - 'per-cust' => 'Per klant', + 'starts-from' => 'Starts From', + 'ends-till' => 'Ends Till', + 'per-cust' => 'Per Customer', 'usage-throttle' => 'Usage Times', - 'for-guest' => 'Voor gast', - 'order_number' => 'Bestelnummer ', + 'for-guest' => 'For Guest', + 'order_number' => 'Order Number', 'refund-date' => 'Refund Date', - 'refunded' => 'Teruggestort', + 'refunded' => 'Refunded', 'start' => 'Start', - 'end' => 'Einde', - 'active' => 'Actief', - 'inactive' => 'Inactief', + 'end' => 'End', + 'active' => 'Active', + 'inactive' => 'Inactive', + 'true' => 'True', + 'false' => 'False', + 'approved' => 'Approved', + 'pending' => 'Pending', + 'disapproved' => 'Disapproved', 'coupon-code' => 'Coupon Code', - 'times-used' => 'Keer gebruikt', + 'times-used' => 'Times Used', 'created-date' => 'Created Date', - 'expiration-date' => 'Vervaldatum', - 'delete' => 'Verwijder', + 'expiration-date' => 'Expiration Date', + 'edit' => 'Edit', + 'delete' => 'Delete', + 'view' => 'View', 'rtl' => 'RTL', 'ltr' => 'LTR', - 'update-status' => 'Status bijwerken' + 'update-status' => 'Update Status' ], 'account' => [ diff --git a/packages/Webkul/Admin/src/Resources/lang/pt_BR/app.php b/packages/Webkul/Admin/src/Resources/lang/pt_BR/app.php index 8a2703ebb..23f734175 100755 --- a/packages/Webkul/Admin/src/Resources/lang/pt_BR/app.php +++ b/packages/Webkul/Admin/src/Resources/lang/pt_BR/app.php @@ -155,7 +155,25 @@ return [ 'per-cust' => 'Por cliente', 'usage-throttle' => 'Tempos de uso', 'for-guest' => 'Para convidados', + 'order_number' => 'Order Number', + 'refund-date' => 'Refund Date', 'refunded' => 'Refunded', + 'start' => 'Start', + 'end' => 'End', + 'active' => 'Active', + 'inactive' => 'Inactive', + 'true' => 'True', + 'false' => 'False', + 'approved' => 'Approved', + 'pending' => 'Pending', + 'disapproved' => 'Disapproved', + 'coupon-code' => 'Coupon Code', + 'times-used' => 'Times Used', + 'created-date' => 'Created Date', + 'expiration-date' => 'Expiration Date', + 'edit' => 'Edit', + 'delete' => 'Delete', + 'view' => 'View', 'rtl' => 'RTL', 'ltr' => 'LTR', 'update-status' => 'Update Status' diff --git a/packages/Webkul/Admin/src/Resources/views/catalog/attributes/create.blade.php b/packages/Webkul/Admin/src/Resources/views/catalog/attributes/create.blade.php index 94477e2ca..a52168b11 100755 --- a/packages/Webkul/Admin/src/Resources/views/catalog/attributes/create.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/catalog/attributes/create.blade.php @@ -213,6 +213,14 @@ +
+ + +
+ {!! view_render_event('bagisto.admin.catalog.attribute.create_form_accordian.configuration.controls.after') !!} diff --git a/packages/Webkul/Admin/src/Resources/views/catalog/attributes/edit.blade.php b/packages/Webkul/Admin/src/Resources/views/catalog/attributes/edit.blade.php index 3829c67b6..0a8db6bac 100755 --- a/packages/Webkul/Admin/src/Resources/views/catalog/attributes/edit.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/catalog/attributes/edit.blade.php @@ -278,6 +278,18 @@ +
+ + +
+ {!! view_render_event('bagisto.admin.catalog.attribute.edit_form_accordian.configuration.controls.after', ['attribute' => $attribute]) !!} diff --git a/packages/Webkul/Admin/src/Resources/views/catalog/products/accordians/grouped-products.blade.php b/packages/Webkul/Admin/src/Resources/views/catalog/products/accordians/grouped-products.blade.php index 8a3908f3b..20fef053c 100644 --- a/packages/Webkul/Admin/src/Resources/views/catalog/products/accordians/grouped-products.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/catalog/products/accordians/grouped-products.blade.php @@ -203,9 +203,9 @@ computed: { inputName: function () { if (this.groupedProduct.id) - return "links[" + this.groupedProduct.id + "]"; + return 'links[' + this.groupedProduct.id + ']'; - return "links[link_" + this.index + "]"; + return 'links[link_' + this.index + ']'; } }, diff --git a/packages/Webkul/Admin/src/Resources/views/catalog/products/edit.blade.php b/packages/Webkul/Admin/src/Resources/views/catalog/products/edit.blade.php index 6adba4afc..c1cfcf2e1 100755 --- a/packages/Webkul/Admin/src/Resources/views/catalog/products/edit.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/catalog/products/edit.blade.php @@ -77,23 +77,23 @@ @foreach ($customAttributes as $attribute) code == 'guest_checkout' && ! core()->getConfigData('catalog.products.guest-checkout.allow-guest-checkout')) { - continue; - } + if ($attribute->code == 'guest_checkout' && ! core()->getConfigData('catalog.products.guest-checkout.allow-guest-checkout')) { + continue; + } - $validations = []; + $validations = []; - if ($attribute->is_required) { - array_push($validations, 'required'); - } + if ($attribute->is_required) { + array_push($validations, 'required'); + } - if ($attribute->type == 'price') { - array_push($validations, 'decimal'); - } + if ($attribute->type == 'price') { + array_push($validations, 'decimal'); + } - array_push($validations, $attribute->validation); + array_push($validations, $attribute->validation); - $validations = implode('|', array_filter($validations)); + $validations = implode('|', array_filter($validations)); ?> @if (view()->exists($typeView = 'admin::catalog.products.field-types.' . $attribute->type)) diff --git a/packages/Webkul/Admin/src/Resources/views/cms/create.blade.php b/packages/Webkul/Admin/src/Resources/views/cms/create.blade.php index 2ad5a0f13..d833e4911 100644 --- a/packages/Webkul/Admin/src/Resources/views/cms/create.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/cms/create.blade.php @@ -11,7 +11,7 @@