Merge pull request #12 from ghermans/master
This commit is contained in:
commit
7f7d79728f
|
|
@ -1,11 +1,11 @@
|
|||
APP_NAME=Bagisto
|
||||
APP_ENV=local
|
||||
APP_VERSION=1.0.0
|
||||
APP_VERSION=1.1.0
|
||||
APP_KEY=
|
||||
APP_DEBUG=true
|
||||
APP_URL=http://localhost
|
||||
APP_TIMEZONE=
|
||||
APP_LOCALE=
|
||||
APP_LOCALE=en
|
||||
LOG_CHANNEL=stack
|
||||
APP_CURRENCY=
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
APP_NAME=Laravel
|
||||
APP_ENV=local
|
||||
APP_VERSION=1.0.0
|
||||
APP_VERSION=1.1.0
|
||||
APP_KEY=base64:G4KY3tUsTaY9ONo1n/QyJvVLQZdJDgbIkSJswFK01HE=
|
||||
APP_DEBUG=true
|
||||
APP_URL=http://localhost
|
||||
|
|
|
|||
|
|
@ -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.**
|
||||
|
|
|
|||
|
|
@ -2,6 +2,171 @@
|
|||
|
||||
#### This changelog consists the bug & security fixes and new features being included in the releases listed below.
|
||||
|
||||
## **v1.1.0 (20th of March 2020)** - *Release*
|
||||
|
||||
* [feature] Added new booking type product.
|
||||
|
||||
* [feature] Impletment compare product feature.
|
||||
|
||||
* [feature] Impletment compare product feature.
|
||||
|
||||
* #2541 [fixed] - Showing product's price with the price including tax
|
||||
|
||||
* #2552 [fixed] - error mysql 8
|
||||
|
||||
* #2556 [fixed] - Logo and favicon broken
|
||||
|
||||
* #2562 [fixed] - error catalog/categories/create
|
||||
|
||||
* #2563 [fixed] - error add in cart
|
||||
|
||||
* #2567 [fixed] - Error 404 found when click on compare product image
|
||||
|
||||
* #2568 [fixed] - Getting exception when update to default theme from the comparison page
|
||||
|
||||
* #2572 [fixed] - custom attribute values are not show in comparison product
|
||||
|
||||
* #2573 [fixed] - Add to wishlist icon is missing with each product in comparison page
|
||||
|
||||
* #2574 [fixed] - Quick view popup should be closed when click add to compare
|
||||
|
||||
* #2575 [fixed] - compare feature is not working from the product page for logged In customer
|
||||
|
||||
* #2576 [fixed] - Compare icon is missing for new products
|
||||
|
||||
* #2577 [fixed] - GUI installer stuck at Migration & Seed
|
||||
|
||||
* #2578 [fixed] - Impossible to create the root directory
|
||||
|
||||
* #2579 [fixed] - error menu mobile
|
||||
|
||||
* #2580 [fixed] - error recently viewed products in mobile
|
||||
|
||||
* #2581 [fixed] - admin/configuration/general/design
|
||||
|
||||
* #2583 [fixed] - Display 3D product preivew image
|
||||
|
||||
* #2584 [fixed] - Not getting root category name, in categories.
|
||||
|
||||
* #2585 [fixed] - Product name , description and short description gets removed on editing the product.
|
||||
|
||||
* #2586 [fixed] - APP_TIMEZONE and APP_LOCALE values should be available in env file.
|
||||
|
||||
* #2587 [fixed] - Getting some warning during installation.
|
||||
|
||||
* #2589 [fixed] - Getting exception on editing header content on php 7.4.
|
||||
|
||||
* #2596 [fixed] - Allow Email Verification field is given twice, once in Configure->Customers->Setting and in Configure->Admin->Email.Currently if field is enable from any one grid and disable from other grid, then its not working.
|
||||
|
||||
* #2597 [fixed] - Not getting email for "Send Inventory Source Notification E-mail".
|
||||
|
||||
* #2599 [fixed] - login required when add compare product from the category page
|
||||
|
||||
* #2601 [fixed] - all comparable product remove from list only when single product remove
|
||||
|
||||
* #2602 [fixed] - Catalog default image height should be equal to the original image in Velocity
|
||||
|
||||
* #2604 [fixed] - Not able to make product as comparable from the category page as logged In user
|
||||
|
||||
* #2605 [fixed] - Attribute is comparable (yes/no) option is missing when add new attribute
|
||||
|
||||
* #2606 [fixed] - custom attributes are not Visible on Product View Page on Front-end
|
||||
|
||||
* #2608 [fixed] - Getting exception on creating category.
|
||||
|
||||
* #2609 [fixed] - product removed from comparison page when update product by name
|
||||
|
||||
* #2611 [fixed] - installer error
|
||||
|
||||
* #2613 [fixed] - Propaganistas/Laravel-Intl is abandoned
|
||||
|
||||
* #2619 [fixed] - Issue when category slug & product slug are same
|
||||
|
||||
* #2621 [fixed] - i create a site and it is up kind of noting works
|
||||
|
||||
* #2626 [fixed] - Tax rates zipcode is still required when enable zip range is disabled
|
||||
|
||||
* #2630 [fixed] - Error exception when add booking product
|
||||
|
||||
* #2634 [fixed] - console error when select slots in default booking
|
||||
|
||||
* #2635 [fixed] - Default Booking details remove from edit page for many booking of one day
|
||||
|
||||
* #2636 [fixed] - Error alert when add to cart a simple product from the home page
|
||||
|
||||
* #2638 [fixed] - customer status is not translated in customer list
|
||||
|
||||
* #2639 [fixed] - category slug field should show warning if saved blank header content
|
||||
|
||||
* #2643 [fixed] - Getting exception when add appointment booking
|
||||
|
||||
* #2645 [fixed] - Error on adding product to cart
|
||||
|
||||
* #2649 [fixed] - Incorrect slot time for one booking many days in product page
|
||||
|
||||
* #2650 [fixed] - remove slot duration from the booking product page
|
||||
|
||||
* #2654 [fixed] - warning should be removed once slot field is selected
|
||||
|
||||
* #2658 [fixed] - slot, duration, break time are not saved for appointment booking
|
||||
|
||||
* #2660 [fixed] - guest capacity value is not saved in table booking
|
||||
|
||||
* #2661 [fixed] - Charged_per drop down value is not updating for table booking
|
||||
|
||||
* #2284 [fixed] - Layout issue in pt_BR locale.
|
||||
|
||||
* #2468 [fixed] - Guest user is able to checkout if guest checkout is disabled.
|
||||
|
||||
* #2517 [fixed] - Product description text gets selected if click on drop down icon on product page
|
||||
|
||||
* #2549 [fixed] - Invoices aren't legally valid.
|
||||
|
||||
* #2571 [fixed] - compare icon should classify the total compare product added in the comparison page
|
||||
|
||||
* #2592 [fixed] - No menu for the logged in user when clicking over comparison
|
||||
|
||||
* #2593 [fixed] - Cannot read property 'disabled' of undefined" on filter price
|
||||
|
||||
* #2594 [fixed] - After refund quantity of product increases.
|
||||
|
||||
* #2595 [fixed] - Category image size issue in velocity theme.
|
||||
|
||||
* #2610 [fixed] - some of the attribute values aren't visible in comparison page
|
||||
|
||||
* #2616 [fixed] - Tiny Bug on Admin Pages
|
||||
|
||||
* #2637 [fixed] - blank admin page if username contains whitespaces in email configuration
|
||||
|
||||
* #2640 [fixed] - product moved to cart still showing in wishlist
|
||||
|
||||
* #2641 [fixed] - Issue on wishlist page for guest user
|
||||
|
||||
* #2644 [fixed] - Add an option to set encryption to none during installation
|
||||
|
||||
* #2646 [fixed] - error missing wishlist or compare icon on mobile view
|
||||
|
||||
* #2666 [fixed] - fix the UI for booking product in cart page
|
||||
|
||||
* #2667 [fixed] - By default wishlist option is selected in cart
|
||||
|
||||
* #2669 [fixed] - Booking product should be removed from the cart when selected slot time expired
|
||||
|
||||
* #2671 [fixed] - Error on moving booking product to wishlist
|
||||
|
||||
* #2672 [fixed] - wrong price calculated in cart for rental booking
|
||||
|
||||
* #2674 [fixed] - Rental booking added to cart without selecting date in velocity
|
||||
|
||||
* #2677 [fixed] - error on cart when rental booking update from backend
|
||||
|
||||
* #2678 [fixed] - UI issue in rental booking product page
|
||||
|
||||
* #2693 [fixed] - Booking product page - add to cart button js error
|
||||
|
||||
* #2707 [fixed] Getting exception when generate invoice in appointment booking
|
||||
|
||||
|
||||
## **v1.0.0 (24th of February 2020)** - *Release*
|
||||
|
||||
* #2377 [fixed] - Getting exception on creating a new category under any other category.
|
||||
|
|
|
|||
|
|
@ -58,4 +58,4 @@ Below is an example of a valid Bagisto doc block. Note that the @param attribute
|
|||
protected function registerFacades($loader, $concrete = null, $shared = false)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
|
|
|
|||
42
README.md
42
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:
|
||||
|
|
|
|||
|
|
@ -3,9 +3,13 @@
|
|||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Webkul\Product\Repositories\ProductRepository as Product;
|
||||
use Webkul\Product\Helpers\GenerateProduct;
|
||||
|
||||
/**
|
||||
* Class GenerateProducts
|
||||
*
|
||||
* @package App\Console\Commands
|
||||
*/
|
||||
class GenerateProducts extends Command
|
||||
{
|
||||
/**
|
||||
|
|
@ -54,12 +58,24 @@ class GenerateProducts extends Command
|
|||
if (! is_string($this->argument('value')) || ! is_numeric($this->argument('quantity'))) {
|
||||
$this->info('Illegal parameters or value of parameters are passed');
|
||||
} else {
|
||||
if (strtolower($this->argument('value')) == 'product' || strtolower($this->argument('value')) == 'products') {
|
||||
$quantity = intval($this->argument('quantity'));
|
||||
if (strtolower($this->argument('value')) == 'product' || strtolower($this->argument('value')) == 'products') {
|
||||
$quantity = (int)$this->argument('quantity');
|
||||
|
||||
// @see https://laravel.com/docs/6.x/artisan#writing-output
|
||||
// @see https://symfony.com/doc/current/components/console/helpers/progressbar.html
|
||||
$bar = $this->output->createProgressBar($quantity);
|
||||
|
||||
$this->line("Generating $quantity {$this->argument('value')}.");
|
||||
|
||||
$bar->start();
|
||||
|
||||
$generatedProducts = 0;
|
||||
$this->generateProduct->generateDemoBrand();
|
||||
while ($quantity > 0) {
|
||||
try {
|
||||
$result = $this->generateProduct->create();
|
||||
$generatedProducts++;
|
||||
$bar->advance();
|
||||
} catch (\Exception $e) {
|
||||
report($e);
|
||||
continue;
|
||||
|
|
@ -68,10 +84,13 @@ class GenerateProducts extends Command
|
|||
$quantity--;
|
||||
}
|
||||
|
||||
if ($result)
|
||||
$this->info('Product(s) created successfully.');
|
||||
else
|
||||
|
||||
if ($result) {
|
||||
$bar->finish();
|
||||
$this->info("\n$generatedProducts Product(s) created successfully.");
|
||||
} else {
|
||||
$this->info('Product(s) cannot be created successfully.');
|
||||
}
|
||||
} else {
|
||||
$this->line('Sorry, this generate option is invalid.');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
"barryvdh/laravel-dompdf": "0.8.5",
|
||||
"doctrine/dbal": "2.9.2",
|
||||
"fideloper/proxy": "^4.0",
|
||||
"flynsarmy/db-blade-compiler": "*",
|
||||
"flynsarmy/db-blade-compiler": "^5.5",
|
||||
"guzzlehttp/guzzle": "~6.0",
|
||||
"intervention/image": "^2.4",
|
||||
"intervention/imagecache": "^2.3",
|
||||
|
|
@ -33,21 +33,20 @@
|
|||
"maatwebsite/excel": "3.1.18",
|
||||
"nwidart/laravel-modules": "^3.2",
|
||||
"prettus/l5-repository": "^2.6",
|
||||
"tymon/jwt-auth": "^1.0.0",
|
||||
"barryvdh/laravel-debugbar": "^3.1",
|
||||
"fzaninotto/faker": "^1.4"
|
||||
"tymon/jwt-auth": "^1.0.0"
|
||||
},
|
||||
|
||||
"require-dev": {
|
||||
"codeception/codeception": "^4.0",
|
||||
"codeception/codeception": "4.1.1",
|
||||
"codeception/module-asserts": "^1.1",
|
||||
"codeception/module-filesystem": "^1.0",
|
||||
"codeception/module-laravel5": "^1.0",
|
||||
"filp/whoops": "^2.0",
|
||||
"laravel/dusk": "^5.7.0",
|
||||
"mockery/mockery": "^1.0",
|
||||
"nunomaduro/collision": "^2.0",
|
||||
"phpunit/phpunit": "^7.0"
|
||||
"phpunit/phpunit": "^7.0",
|
||||
"barryvdh/laravel-debugbar": "^3.1",
|
||||
"fzaninotto/faker": "^1.4"
|
||||
},
|
||||
|
||||
"replace": {
|
||||
|
|
@ -101,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"
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -153,7 +153,7 @@ return [
|
|||
/*
|
||||
Application Version
|
||||
*/
|
||||
'version' => env('APP_VERSION', '0.1.6'),
|
||||
'version' => env('APP_VERSION', '1.1.0'),
|
||||
|
||||
/**
|
||||
* Blacklisting attributes while debugging
|
||||
|
|
@ -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,
|
||||
],
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ return [
|
|||
*/
|
||||
|
||||
\Webkul\Attribute\Providers\ModuleServiceProvider::class,
|
||||
\Webkul\BookingProduct\Providers\ModuleServiceProvider::class,
|
||||
\Webkul\Category\Providers\ModuleServiceProvider::class,
|
||||
\Webkul\Checkout\Providers\ModuleServiceProvider::class,
|
||||
\Webkul\Core\Providers\ModuleServiceProvider::class,
|
||||
|
|
@ -21,6 +22,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\Velocity\Providers\ModuleServiceProvider::class,
|
||||
]
|
||||
];
|
||||
|
|
@ -9,14 +9,14 @@ return [
|
|||
|
|
||||
| Debugbar is enabled by default, when debug is set to true in app.php.
|
||||
| You can override the value by setting enable to true or false instead of null.
|
||||
|
|
||||
|
|
||||
| You can provide an array of URI's that must be ignored (eg. 'api/*')
|
||||
|
|
||||
*/
|
||||
|
||||
'enabled' => env('DEBUGBAR_ENABLED', null),
|
||||
'except' => [
|
||||
//
|
||||
'telescope*'
|
||||
],
|
||||
|
||||
/*
|
||||
|
|
@ -79,7 +79,7 @@ return [
|
|||
|
|
||||
*/
|
||||
'error_handler' => false,
|
||||
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Clockwork integration
|
||||
|
|
@ -110,7 +110,7 @@ return [
|
|||
'db' => true, // Show database (PDO) queries and bindings
|
||||
'views' => true, // Views with their data
|
||||
'route' => true, // Current route information
|
||||
'auth' => true, // Display Laravel authentication status
|
||||
'auth' => false, // Display Laravel authentication status
|
||||
'gate' => true, // Display Laravel Gate checks
|
||||
'session' => true, // Display session data
|
||||
'symfony_request' => true, // Only one can be enabled..
|
||||
|
|
@ -122,6 +122,7 @@ return [
|
|||
'files' => false, // Show the included files
|
||||
'config' => false, // Display config settings
|
||||
'cache' => false, // Display cache events
|
||||
'models' => false, // Display models
|
||||
],
|
||||
|
||||
/*
|
||||
|
|
@ -143,7 +144,7 @@ return [
|
|||
'timeline' => false, // Add the queries to the timeline
|
||||
'explain' => [ // Show EXPLAIN output on queries
|
||||
'enabled' => false,
|
||||
'types' => ['SELECT'], // ['SELECT', 'INSERT', 'UPDATE', 'DELETE']; for MySQL 5.6.3+
|
||||
'types' => ['SELECT'], // // workaround ['SELECT'] only. https://github.com/barryvdh/laravel-debugbar/issues/888 ['SELECT', 'INSERT', 'UPDATE', 'DELETE']; for MySQL 5.6.3+
|
||||
],
|
||||
'hints' => true, // Show hints for common mistakes
|
||||
],
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
use Maatwebsite\Excel\Excel;
|
||||
|
||||
return [
|
||||
|
||||
'exports' => [
|
||||
|
||||
/*
|
||||
|
|
@ -18,20 +19,9 @@ return [
|
|||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Temporary path
|
||||
| Pre-calculate formulas during export
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When exporting files, we use a temporary file, before storing
|
||||
| or downloading. Here you can customize that path.
|
||||
|
|
||||
*/
|
||||
'temp_path' => sys_get_temp_dir(),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Pre-calculate formulas during export
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
'pre_calculate_formulas' => false,
|
||||
|
||||
/*
|
||||
|
|
@ -69,6 +59,22 @@ return [
|
|||
*/
|
||||
'formatter' => 'slug',
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| CSV Settings
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Configure e.g. delimiter, enclosure and line ending for CSV imports.
|
||||
|
|
||||
*/
|
||||
'csv' => [
|
||||
'delimiter' => ',',
|
||||
'enclosure' => '"',
|
||||
'escape_character' => '\\',
|
||||
'contiguous' => false,
|
||||
'input_encoding' => 'UTF-8',
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|
|
@ -109,4 +115,71 @@ return [
|
|||
*/
|
||||
'pdf' => Excel::DOMPDF,
|
||||
],
|
||||
|
||||
'value_binder' => [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Value Binder
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| PhpSpreadsheet offers a way to hook into the process of a value being
|
||||
| written to a cell. In there some assumptions are made on how the
|
||||
| value should be formatted. If you want to change those defaults,
|
||||
| you can implement your own default value binder.
|
||||
|
|
||||
*/
|
||||
'default' => Maatwebsite\Excel\DefaultValueBinder::class,
|
||||
],
|
||||
|
||||
'transactions' => [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Transaction Handler
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| By default the import is wrapped in a transaction. This is useful
|
||||
| for when an import may fail and you want to retry it. With the
|
||||
| transactions, the previous import gets rolled-back.
|
||||
|
|
||||
| You can disable the transaction handler by setting this to null.
|
||||
| Or you can choose a custom made transaction handler here.
|
||||
|
|
||||
| Supported handlers: null|db
|
||||
|
|
||||
*/
|
||||
'handler' => 'db',
|
||||
],
|
||||
|
||||
'temporary_files' => [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Local Temporary Path
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When exporting and importing files, we use a temporary file, before
|
||||
| storing reading or downloading. Here you can customize that path.
|
||||
|
|
||||
*/
|
||||
'local_path' => sys_get_temp_dir(),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Remote Temporary Disk
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When dealing with a multi server setup with queues in which you
|
||||
| cannot rely on having a shared local temporary path, you might
|
||||
| want to store the temporary file on a shared disk. During the
|
||||
| queue executing, we'll retrieve the temporary file from that
|
||||
| location instead. When left to null, it will always use
|
||||
| the local path. This setting only has effect when using
|
||||
| in conjunction with queued imports and exports.
|
||||
|
|
||||
*/
|
||||
'remote_disk' => null,
|
||||
|
||||
],
|
||||
];
|
||||
|
|
|
|||
|
|
@ -52,9 +52,9 @@ return array(
|
|||
*/
|
||||
|
||||
'templates' => array(
|
||||
'small' => 'Webkul\Product\CacheFilters\Small',
|
||||
'small' => 'Webkul\Product\CacheFilters\Small',
|
||||
'medium' => 'Webkul\Product\CacheFilters\Medium',
|
||||
'large' => 'Webkul\Product\CacheFilters\Large',
|
||||
'large' => 'Webkul\Product\CacheFilters\Large',
|
||||
),
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -216,7 +216,8 @@ return [
|
|||
'orderBy' => 'orderBy',
|
||||
'sortedBy' => 'sortedBy',
|
||||
'with' => 'with',
|
||||
'searchJoin' => 'searchJoin'
|
||||
'searchJoin' => 'searchJoin',
|
||||
'withCount' => 'withCount'
|
||||
]
|
||||
],
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -2,6 +2,21 @@
|
|||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Console Commands
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option allows you to add additional Artisan commands that should
|
||||
| be available within the Tinker environment. Once the command is in
|
||||
| this array you may execute the command in Tinker using its name.
|
||||
|
|
||||
*/
|
||||
|
||||
'commands' => [
|
||||
// App\Console\Commands\ExampleCommand::class,
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Alias Blacklist
|
||||
|
|
@ -13,6 +28,8 @@ return [
|
|||
|
|
||||
*/
|
||||
|
||||
'dont_alias' => [],
|
||||
'dont_alias' => [
|
||||
'App\Nova',
|
||||
],
|
||||
|
||||
];
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ return [
|
|||
| colombian spanish will be saved as 'es-CO' into the database.
|
||||
|
|
||||
*/
|
||||
'locale_separator' => '_',
|
||||
'locale_separator' => '-',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
@ -39,6 +39,8 @@ return [
|
|||
| As a default locale, Translatable takes the locale of Laravel's
|
||||
| translator. If for some reason you want to override this,
|
||||
| you can specify what default should be used here.
|
||||
| If you set a value here it will only use the current config value
|
||||
| and never fallback to the translator one.
|
||||
|
|
||||
*/
|
||||
'locale' => null,
|
||||
|
|
@ -76,10 +78,26 @@ return [
|
|||
| A fallback locale is the locale being used to return a translation
|
||||
| when the requested translation is not existing. To disable it
|
||||
| set it to false.
|
||||
| If set to null it will loop through all configured locales until
|
||||
| one existing is found or end of list reached. The locales are looped
|
||||
| from top to bottom and for country based locales the simple one
|
||||
| is used first. So "es" will be checked before "es_MX".
|
||||
|
|
||||
*/
|
||||
'fallback_locale' => 'en',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Translation Model Namespace
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Defines the default 'Translation' class namespace. For example, if
|
||||
| you want to use App\Translations\CountryTranslation instead of App\CountryTranslation
|
||||
| set this to 'App\Translations'.
|
||||
|
|
||||
*/
|
||||
'translation_model_namespace' => null,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Translation Suffix
|
||||
|
|
@ -113,4 +131,19 @@ return [
|
|||
|
|
||||
*/
|
||||
'to_array_always_loads_translations' => true,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Configure the default behavior of the rule factory
|
||||
|--------------------------------------------------------------------------
|
||||
| The default values used to control the behavior of the RuleFactory.
|
||||
| Here you can set your own default format and delimiters for
|
||||
| your whole app.
|
||||
*
|
||||
*/
|
||||
'rule_factory' => [
|
||||
'format' => \Astrotomic\Translatable\Validation\RuleFactory::FORMAT_ARRAY,
|
||||
'prefix' => '%',
|
||||
'suffix' => '%',
|
||||
],
|
||||
];
|
||||
|
|
|
|||
|
|
@ -15,31 +15,36 @@ return [
|
|||
* of your proxy (e.g. if using ELB or similar).
|
||||
*
|
||||
*/
|
||||
'proxies' => null, // [<ip addresses>,], '*'
|
||||
'proxies' => null, // [<ip addresses>,], '*', '<ip addresses>,'
|
||||
|
||||
/*
|
||||
* To trust one or more specific proxies that connect
|
||||
* directly to your server, use an array of IP addresses:
|
||||
* directly to your server, use an array or a string separated by comma of IP addresses:
|
||||
*/
|
||||
# 'proxies' => ['192.168.1.1'],
|
||||
// 'proxies' => ['192.168.1.1'],
|
||||
// 'proxies' => '192.168.1.1, 192.168.1.2',
|
||||
|
||||
/*
|
||||
* Or, to trust all proxies that connect
|
||||
* directly to your server, use a "*"
|
||||
*/
|
||||
# 'proxies' => '*',
|
||||
// 'proxies' => '*',
|
||||
|
||||
/*
|
||||
* Which headers to use to detect proxy related data (For, Host, Proto, Port)
|
||||
*
|
||||
*
|
||||
* Options include:
|
||||
*
|
||||
*
|
||||
* - Illuminate\Http\Request::HEADER_X_FORWARDED_ALL (use all x-forwarded-* headers to establish trust)
|
||||
* - Illuminate\Http\Request::HEADER_FORWARDED (use the FORWARDED header to establish trust)
|
||||
*
|
||||
* - Illuminate\Http\Request::HEADER_X_FORWARDED_AWS_ELB (If you are using AWS Elastic Load Balancer)
|
||||
*
|
||||
* - 'HEADER_X_FORWARDED_ALL' (use all x-forwarded-* headers to establish trust)
|
||||
* - 'HEADER_FORWARDED' (use the FORWARDED header to establish trust)
|
||||
* - 'HEADER_X_FORWARDED_AWS_ELB' (If you are using AWS Elastic Load Balancer)
|
||||
*
|
||||
* @link https://symfony.com/doc/current/deployment/proxies.html
|
||||
*/
|
||||
'headers' => Illuminate\Http\Request::HEADER_X_FORWARDED_ALL,
|
||||
|
||||
|
||||
];
|
||||
|
|
|
|||
|
|
@ -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 <jitendra@webkul.com>
|
||||
* @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'))),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -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 <jitendra@webkul.com>
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
class CartController extends Controller
|
||||
{
|
||||
/**
|
||||
|
|
@ -27,37 +21,36 @@ 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,
|
||||
CartItemRepository $cartItemRepository,
|
||||
WishlistRepository $wishlistRepository
|
||||
)
|
||||
{
|
||||
) {
|
||||
$this->guard = request()->has('token') ? 'api' : 'customer';
|
||||
|
||||
auth()->setDefaultDriver($this->guard);
|
||||
|
|
@ -85,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,
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
@ -101,7 +94,7 @@ class CartController extends Controller
|
|||
if (request()->get('is_buy_now')) {
|
||||
Event::dispatch('shop.item.buy-now', $id);
|
||||
}
|
||||
|
||||
|
||||
Event::dispatch('checkout.cart.item.add.before', $id);
|
||||
|
||||
$result = Cart::addProduct($id, request()->except('_token'));
|
||||
|
|
@ -110,12 +103,13 @@ class CartController extends Controller
|
|||
$message = session()->get('warning') ?? session()->get('error');
|
||||
|
||||
return response()->json([
|
||||
'error' => session()->get('warning')
|
||||
], 400);
|
||||
'error' => session()->get('warning'),
|
||||
], 400);
|
||||
}
|
||||
|
||||
if ($customer = auth($this->guard)->user())
|
||||
if ($customer = auth($this->guard)->user()) {
|
||||
$this->wishlistRepository->deleteWhere(['product_id' => $id, 'customer_id' => $customer->id]);
|
||||
}
|
||||
|
||||
Event::dispatch('checkout.cart.item.add.after', $result);
|
||||
|
||||
|
|
@ -124,9 +118,9 @@ class CartController extends Controller
|
|||
$cart = Cart::getCart();
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Product added to cart successfully.',
|
||||
'data' => $cart ? new CartResource($cart) : null
|
||||
]);
|
||||
'message' => __('shop::app.checkout.cart.item.success'),
|
||||
'data' => $cart ? new CartResource($cart) : null,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -136,11 +130,11 @@ class CartController extends Controller
|
|||
*/
|
||||
public function update()
|
||||
{
|
||||
foreach (request()->get('qty') as$qty) {
|
||||
foreach (request()->get('qty') as $qty) {
|
||||
if ($qty <= 0) {
|
||||
return response()->json([
|
||||
'message' => trans('shop::app.checkout.cart.quantity.illegal')
|
||||
], 401);
|
||||
'message' => trans('shop::app.checkout.cart.quantity.illegal'),
|
||||
], 401);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -159,9 +153,9 @@ class CartController extends Controller
|
|||
$cart = Cart::getCart();
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Cart updated successfully.',
|
||||
'data' => $cart ? new CartResource($cart) : null
|
||||
]);
|
||||
'message' => __('shop::app.checkout.cart.quantity.success'),
|
||||
'data' => $cart ? new CartResource($cart) : null,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -180,9 +174,9 @@ class CartController extends Controller
|
|||
$cart = Cart::getCart();
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Cart removed successfully.',
|
||||
'data' => $cart ? new CartResource($cart) : null
|
||||
]);
|
||||
'message' => __('shop::app.checkout.cart.item.success-remove'),
|
||||
'data' => $cart ? new CartResource($cart) : null,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -204,16 +198,15 @@ class CartController extends Controller
|
|||
$cart = Cart::getCart();
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Cart removed successfully.',
|
||||
'data' => $cart ? new CartResource($cart) : null
|
||||
]);
|
||||
'message' => __('shop::app.checkout.cart.item.success-remove'),
|
||||
'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)
|
||||
{
|
||||
|
|
@ -228,8 +221,8 @@ class CartController extends Controller
|
|||
$cart = Cart::getCart();
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Cart item moved to wishlist successfully.',
|
||||
'data' => $cart ? new CartResource($cart) : null
|
||||
]);
|
||||
'message' => __('shop::app.checkout.cart.move-to-wishlist-success'),
|
||||
'data' => $cart ? new CartResource($cart) : null,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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 <jitendra@webkul.com>
|
||||
* @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'))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,12 +15,6 @@ use Webkul\Sales\Repositories\OrderRepository;
|
|||
use Illuminate\Support\Str;
|
||||
use Cart;
|
||||
|
||||
/**
|
||||
* Checkout controller
|
||||
*
|
||||
* @author Jitendra Singh <jitendra@webkul.com>
|
||||
* @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),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -4,12 +4,6 @@ namespace Webkul\API\Http\Controllers\Shop;
|
|||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
/**
|
||||
* Core controller
|
||||
*
|
||||
* @author Jitendra Singh <jitendra@webkul.com>
|
||||
* @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(),
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,13 +6,6 @@ use Illuminate\Support\Facades\Event;
|
|||
use Webkul\Customer\Repositories\CustomerRepository;
|
||||
use Webkul\Customer\Repositories\CustomerGroupRepository;
|
||||
|
||||
/**
|
||||
* Customer controller
|
||||
*
|
||||
* @author Jitendra Singh <jitendra@webkul.com>
|
||||
* @author Vivek Sharma <viveksh047@webkul.com> @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.',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -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 <jitendra@webkul.com>
|
||||
* @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),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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 <jitendra@webkul.com>
|
||||
* @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)),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,12 +4,6 @@ namespace Webkul\API\Http\Controllers\Shop;
|
|||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
/**
|
||||
* Resource Controller
|
||||
*
|
||||
* @author Jitendra Singh <jitendra@webkul.com>
|
||||
* @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.',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 <jitendra@webkul.com>
|
||||
* @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)),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -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 <jitendra@webkul.com>
|
||||
* @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)),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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 <jitendra@webkul.com>
|
||||
* @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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -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,
|
||||
];
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -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
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -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,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -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)
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -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,
|
||||
];
|
||||
|
|
|
|||
|
|
@ -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_amount,
|
||||
'formated_discount' => core()->formatPrice($this->discount_amount, $this->cart_currency_code),
|
||||
'base_discount' => $this->base_discount_amount,
|
||||
'formated_base_discount' => core()->formatBasePrice($this->base_discount_amount),
|
||||
'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),
|
||||
];
|
||||
}
|
||||
|
||||
|
|
@ -93,4 +93,4 @@ class Cart extends JsonResource
|
|||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -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,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -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
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -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
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -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,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -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
|
||||
];
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
];
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
];
|
||||
|
|
|
|||
|
|
@ -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
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -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,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -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,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -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,
|
||||
];
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
];
|
||||
|
|
|
|||
|
|
@ -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
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -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
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -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)
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -11,99 +11,100 @@ class Order extends JsonResource
|
|||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request
|
||||
* @param \Illuminate\Http\Request
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'status' => $this->status,
|
||||
'status_label' => $this->status_label,
|
||||
'channel_name' => $this->channel_name,
|
||||
'is_guest' => $this->is_guest,
|
||||
'customer_email' => $this->customer_email,
|
||||
'customer_first_name' => $this->customer_first_name,
|
||||
'customer_last_name' => $this->customer_last_name,
|
||||
'shipping_method' => $this->shipping_method,
|
||||
'shipping_title' => $this->shipping_title,
|
||||
'payment_title' => core()->getConfigData('sales.paymentmethods.' . $this->payment->method . '.title'),
|
||||
'shipping_description' => $this->shipping_description,
|
||||
'coupon_code' => $this->coupon_code,
|
||||
'is_gift' => $this->is_gift,
|
||||
'total_item_count' => $this->total_item_count,
|
||||
'total_qty_ordered' => $this->total_qty_ordered,
|
||||
'base_currency_code' => $this->base_currency_code,
|
||||
'channel_currency_code' => $this->channel_currency_code,
|
||||
'order_currency_code' => $this->order_currency_code,
|
||||
'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),
|
||||
'grand_total_invoiced' => $this->grand_total_invoiced,
|
||||
'formated_grand_total_invoiced' => core()->formatPrice($this->grand_total_invoiced, $this->order_currency_code),
|
||||
'base_grand_total_invoiced' => $this->base_grand_total_invoiced,
|
||||
'id' => $this->id,
|
||||
'status' => $this->status,
|
||||
'status_label' => $this->status_label,
|
||||
'channel_name' => $this->channel_name,
|
||||
'is_guest' => $this->is_guest,
|
||||
'customer_email' => $this->customer_email,
|
||||
'customer_first_name' => $this->customer_first_name,
|
||||
'customer_last_name' => $this->customer_last_name,
|
||||
'shipping_method' => $this->shipping_method,
|
||||
'shipping_title' => $this->shipping_title,
|
||||
'payment_title' => core()->getConfigData('sales.paymentmethods.' . $this->payment->method . '.title'),
|
||||
'shipping_description' => $this->shipping_description,
|
||||
'coupon_code' => $this->coupon_code,
|
||||
'is_gift' => $this->is_gift,
|
||||
'total_item_count' => $this->total_item_count,
|
||||
'total_qty_ordered' => $this->total_qty_ordered,
|
||||
'base_currency_code' => $this->base_currency_code,
|
||||
'channel_currency_code' => $this->channel_currency_code,
|
||||
'order_currency_code' => $this->order_currency_code,
|
||||
'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),
|
||||
'grand_total_invoiced' => $this->grand_total_invoiced,
|
||||
'formated_grand_total_invoiced' => core()->formatPrice($this->grand_total_invoiced, $this->order_currency_code),
|
||||
'base_grand_total_invoiced' => $this->base_grand_total_invoiced,
|
||||
'formated_base_grand_total_invoiced' => core()->formatBasePrice($this->base_grand_total_invoiced),
|
||||
'grand_total_refunded' => $this->grand_total_refunded,
|
||||
'formated_grand_total_refunded' => core()->formatPrice($this->grand_total_refunded, $this->order_currency_code),
|
||||
'base_grand_total_refunded' => $this->base_grand_total_refunded,
|
||||
'grand_total_refunded' => $this->grand_total_refunded,
|
||||
'formated_grand_total_refunded' => core()->formatPrice($this->grand_total_refunded, $this->order_currency_code),
|
||||
'base_grand_total_refunded' => $this->base_grand_total_refunded,
|
||||
'formated_base_grand_total_refunded' => core()->formatBasePrice($this->base_grand_total_refunded),
|
||||
'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),
|
||||
'sub_total_invoiced' => $this->sub_total_invoiced,
|
||||
'formated_sub_total_invoiced' => core()->formatPrice($this->sub_total_invoiced, $this->order_currency_code),
|
||||
'base_sub_total_invoiced' => $this->base_sub_total_invoiced,
|
||||
'formated_base_sub_total_invoiced' => core()->formatBasePrice($this->base_sub_total_invoiced),
|
||||
'sub_total_refunded' => $this->sub_total_refunded,
|
||||
'formated_sub_total_refunded' => core()->formatPrice($this->sub_total_refunded, $this->order_currency_code),
|
||||
'discount_percent' => $this->discount_percent,
|
||||
'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),
|
||||
'discount_invoiced' => $this->discount_invoiced,
|
||||
'formated_discount_invoiced' => core()->formatPrice($this->discount_invoiced, $this->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_currency_code),
|
||||
'base_discount_refunded' => $this->base_discount_refunded,
|
||||
'formated_base_discount_refunded' => core()->formatBasePrice($this->base_discount_refunded),
|
||||
'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),
|
||||
'tax_amount_invoiced' => $this->tax_amount_invoiced,
|
||||
'formated_tax_amount_invoiced' => core()->formatPrice($this->tax_amount_invoiced, $this->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_currency_code),
|
||||
'base_tax_amount_refunded' => $this->base_tax_amount_refunded,
|
||||
'formated_base_tax_amount_refunded' => core()->formatBasePrice($this->base_tax_amount_refunded),
|
||||
'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),
|
||||
'shipping_invoiced' => $this->shipping_invoiced,
|
||||
'formated_shipping_invoiced' => core()->formatPrice($this->shipping_invoiced, $this->order_currency_code),
|
||||
'base_shipping_invoiced' => $this->base_shipping_invoiced,
|
||||
'formated_base_shipping_invoiced' => core()->formatBasePrice($this->base_shipping_invoiced),
|
||||
'shipping_refunded' => $this->shipping_refunded,
|
||||
'formated_shipping_refunded' => core()->formatPrice($this->shipping_refunded, $this->order_currency_code),
|
||||
'base_shipping_refunded' => $this->base_shipping_refunded,
|
||||
'formated_base_shipping_refunded' => core()->formatBasePrice($this->base_shipping_refunded),
|
||||
'customer' => $this->when($this->customer_id, new CustomerResource($this->customer)),
|
||||
'channel' => $this->when($this->channel_id, new ChannelResource($this->channel)),
|
||||
'shipping_address' => new OrderAddress($this->shipping_address),
|
||||
'billing_address' => new OrderAddress($this->billing_address),
|
||||
'updated_at' => $this->updated_at,
|
||||
'items' => OrderItem::collection($this->items),
|
||||
'invoices' => Invoice::collection($this->invoices),
|
||||
'shipments' => Shipment::collection($this->shipments),
|
||||
'created_at' => $this->created_at
|
||||
'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),
|
||||
'sub_total_invoiced' => $this->sub_total_invoiced,
|
||||
'formated_sub_total_invoiced' => core()->formatPrice($this->sub_total_invoiced, $this->order_currency_code),
|
||||
'base_sub_total_invoiced' => $this->base_sub_total_invoiced,
|
||||
'formated_base_sub_total_invoiced' => core()->formatBasePrice($this->base_sub_total_invoiced),
|
||||
'sub_total_refunded' => $this->sub_total_refunded,
|
||||
'formated_sub_total_refunded' => core()->formatPrice($this->sub_total_refunded, $this->order_currency_code),
|
||||
'discount_percent' => $this->discount_percent,
|
||||
'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),
|
||||
'discount_invoiced' => $this->discount_invoiced,
|
||||
'formated_discount_invoiced' => core()->formatPrice($this->discount_invoiced, $this->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_currency_code),
|
||||
'base_discount_refunded' => $this->base_discount_refunded,
|
||||
'formated_base_discount_refunded' => core()->formatBasePrice($this->base_discount_refunded),
|
||||
'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),
|
||||
'tax_amount_invoiced' => $this->tax_amount_invoiced,
|
||||
'formated_tax_amount_invoiced' => core()->formatPrice($this->tax_amount_invoiced, $this->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_currency_code),
|
||||
'base_tax_amount_refunded' => $this->base_tax_amount_refunded,
|
||||
'formated_base_tax_amount_refunded' => core()->formatBasePrice($this->base_tax_amount_refunded),
|
||||
'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),
|
||||
'shipping_invoiced' => $this->shipping_invoiced,
|
||||
'formated_shipping_invoiced' => core()->formatPrice($this->shipping_invoiced, $this->order_currency_code),
|
||||
'base_shipping_invoiced' => $this->base_shipping_invoiced,
|
||||
'formated_base_shipping_invoiced' => core()->formatBasePrice($this->base_shipping_invoiced),
|
||||
'shipping_refunded' => $this->shipping_refunded,
|
||||
'formated_shipping_refunded' => core()->formatPrice($this->shipping_refunded, $this->order_currency_code),
|
||||
'base_shipping_refunded' => $this->base_shipping_refunded,
|
||||
'formated_base_shipping_refunded' => core()->formatBasePrice($this->base_shipping_refunded),
|
||||
'customer' => $this->when($this->customer_id, new CustomerResource($this->customer)),
|
||||
'channel' => $this->when($this->channel_id, new ChannelResource($this->channel)),
|
||||
'shipping_address' => new OrderAddress($this->shipping_address),
|
||||
'billing_address' => new OrderAddress($this->billing_address),
|
||||
'updated_at' => $this->updated_at,
|
||||
'items' => OrderItem::collection($this->items),
|
||||
'invoices' => Invoice::collection($this->invoices),
|
||||
'shipments' => Shipment::collection($this->shipments),
|
||||
'created_at' => $this->created_at,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -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,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -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)
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -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),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -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)
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -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,
|
||||
],
|
||||
];
|
||||
|
||||
|
|
|
|||
|
|
@ -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' => '',
|
||||
]
|
||||
];
|
||||
|
|
@ -30,6 +30,37 @@ return [
|
|||
'channel_based' => true,
|
||||
],
|
||||
],
|
||||
], [
|
||||
'key' => 'general.general.email_settings',
|
||||
'name' => 'admin::app.admin.system.email-settings',
|
||||
'sort' => 1,
|
||||
'fields' => [
|
||||
[
|
||||
'name' => 'sender_name',
|
||||
'title' => 'admin::app.admin.system.email-sender-name',
|
||||
'type' => 'text',
|
||||
'validation' => 'required|max:50',
|
||||
'channel_based' => true,
|
||||
], [
|
||||
'name' => 'shop_email_from',
|
||||
'title' => 'admin::app.admin.system.shop-email-from',
|
||||
'type' => 'text',
|
||||
'validation' => 'required|email',
|
||||
'channel_based' => true,
|
||||
], [
|
||||
'name' => 'admin_name',
|
||||
'title' => 'admin::app.admin.system.admin-name',
|
||||
'type' => 'text',
|
||||
'validation' => 'required|max:50',
|
||||
'channel_based' => true,
|
||||
], [
|
||||
'name' => 'admin_email',
|
||||
'title' => 'admin::app.admin.system.admin-email',
|
||||
'type' => 'text',
|
||||
'validation' => 'required|email',
|
||||
'channel_based' => true,
|
||||
],
|
||||
],
|
||||
], [
|
||||
'key' => 'general.content',
|
||||
'name' => 'admin::app.admin.system.content',
|
||||
|
|
@ -48,16 +79,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,
|
||||
],
|
||||
|
|
|
|||
|
|
@ -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 <viveksh047@webkul.com>
|
||||
* @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 '<span class="badge badge-md badge-success"">' . trans('admin::app.customers.addresses.yes') . '</span>';
|
||||
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',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -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.singh852@webkul.com> @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',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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.singh852@webkul.com> @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',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -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.singh852@webkul.com> @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',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -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 <jitendra@webkul.com>
|
||||
* @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',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 <jitendra@webkul.com>
|
||||
* @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',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 <jitendra@webkul.com>
|
||||
* @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',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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.singh852@webkul.com> @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',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -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.singh852@webkul.com> @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',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -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.singh852@webkul.com> @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');
|
||||
}
|
||||
},
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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.singh852@webkul.com> @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',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -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.singh852@webkul.com> @prashant-webkul
|
||||
* @author Vivek Sharma <viveksh047@webkul.com> @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 '<span class="badge badge-md badge-success">'. trans('admin::app.customers.customers.active') .'</span>';
|
||||
} else {
|
||||
return '<span class="badge badge-md badge-danger">'. trans('admin::app.customers.customers.inactive') .'</span>';
|
||||
}
|
||||
}
|
||||
},
|
||||
]);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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.singh852@webkul.com> @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',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -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.singh852@webkul.com> @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 '<span class="badge badge-md badge-success">Approved</span>';
|
||||
else if ($value->product_review_status == "pending")
|
||||
return '<span class="badge badge-md badge-warning">Pending</span>';
|
||||
else if ($value->product_review_status == "disapproved")
|
||||
return '<span class="badge badge-md badge-danger">Disapproved</span>';
|
||||
]);
|
||||
|
||||
$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 '<span class="badge badge-md badge-success">' . trans('admin::app.datagrid.approved') . '</span>';
|
||||
} elseif ($value->product_review_status == "pending") {
|
||||
return '<span class="badge badge-md badge-warning">' . trans('admin::app.datagrid.pending') . '</span>';
|
||||
} elseif ($value->product_review_status == "disapproved") {
|
||||
return '<span class="badge badge-md badge-danger">' . trans('admin::app.datagrid.disapproved') . '</span>';
|
||||
}
|
||||
},
|
||||
]);
|
||||
}
|
||||
|
||||
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,
|
||||
],
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -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.singh852@webkul.com> @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',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -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.singh852@webkul.com> @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',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -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.singh852@webkul.com> @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',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -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.singh852@webkul.com> @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',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -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.singh852@webkul.com> @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 '<span class="badge badge-md badge-success">'. trans('admin::app.sales.orders.order-status-processing') .'</span>';
|
||||
else if ($value->status == 'completed')
|
||||
} elseif ($value->status == 'completed') {
|
||||
return '<span class="badge badge-md badge-success">'. trans('admin::app.sales.orders.order-status-success') .'</span>';
|
||||
else if ($value->status == "canceled")
|
||||
} elseif ($value->status == "canceled") {
|
||||
return '<span class="badge badge-md badge-danger">'. trans('admin::app.sales.orders.order-status-canceled') .'</span>';
|
||||
else if ($value->status == "closed")
|
||||
} elseif ($value->status == "closed") {
|
||||
return '<span class="badge badge-md badge-info">'. trans('admin::app.sales.orders.order-status-closed') .'</span>';
|
||||
else if ($value->status == "pending")
|
||||
} elseif ($value->status == "pending") {
|
||||
return '<span class="badge badge-md badge-warning">'. trans('admin::app.sales.orders.order-status-pending') .'</span>';
|
||||
else if ($value->status == "pending_payment")
|
||||
} elseif ($value->status == "pending_payment") {
|
||||
return '<span class="badge badge-md badge-warning">'. trans('admin::app.sales.orders.order-status-pending-payment') .'</span>';
|
||||
else if ($value->status == "fraud")
|
||||
} elseif ($value->status == "fraud") {
|
||||
return '<span class="badge badge-md badge-danger">'. trans('admin::app.sales.orders.order-status-fraud') . '</span>';
|
||||
}
|
||||
}
|
||||
},
|
||||
]);
|
||||
|
||||
$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',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -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.singh852@webkul.com> @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',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -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 <jitendra@webkul.com>
|
||||
* @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',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -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.singh852@webkul.com> @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',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -5,15 +5,9 @@ namespace Webkul\Admin\DataGrids;
|
|||
use Webkul\Ui\DataGrid\DataGrid;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
/**
|
||||
* ProductDataGrid Class
|
||||
*
|
||||
* @author Prashant Singh <prashant.singh852@webkul.com> @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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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.singh852@webkul.com> @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',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -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.singh852@webkul.com> @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',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -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.singh852@webkul.com> @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',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -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.singh852@webkul.com> @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',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -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.singh852@webkul.com> @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',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -6,22 +6,14 @@ use Illuminate\Contracts\View\View;
|
|||
use Maatwebsite\Excel\Concerns\FromView;
|
||||
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
||||
|
||||
/**
|
||||
* DataGridExport class
|
||||
*
|
||||
* @author Rahul Shukla <rahulshukla.symfony517@webkul.com>
|
||||
* @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);
|
||||
|
|
|
|||
|
|
@ -8,12 +8,6 @@ use Webkul\Core\Tree;
|
|||
use Illuminate\Support\Facades\Storage;
|
||||
use Webkul\Admin\Http\Requests\ConfigurationForm;
|
||||
|
||||
/**
|
||||
* Configuration controller
|
||||
*
|
||||
* @author Jitendra Singh <jitendra@webkul.com>
|
||||
* @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
|
||||
|
|
|
|||
|
|
@ -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 <viveksh047@webkul.com>
|
||||
* @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'));
|
||||
|
|
|
|||
|
|
@ -9,12 +9,6 @@ use Webkul\Core\Repositories\ChannelRepository;
|
|||
use Webkul\Admin\Mail\NewCustomerNotification;
|
||||
use Mail;
|
||||
|
||||
/**
|
||||
* Customer controlller
|
||||
*
|
||||
* @author Rahul Shukla <rahulshukla.symfony517@webkul.com>
|
||||
* @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'));
|
||||
|
|
|
|||
|
|
@ -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 <rahulshukla.symfony517@webkul.com>
|
||||
* @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 {
|
||||
|
|
|
|||
|
|
@ -9,84 +9,78 @@ use Webkul\Sales\Repositories\OrderItemRepository;
|
|||
use Webkul\Customer\Repositories\CustomerRepository;
|
||||
use Webkul\Product\Repositories\ProductInventoryRepository;
|
||||
|
||||
/**
|
||||
* Dashboard controller
|
||||
*
|
||||
* @author Jitendra Singh <jitendra@webkul.com>
|
||||
* @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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,12 +4,6 @@ namespace Webkul\Admin\Http\Controllers\Development;
|
|||
|
||||
use Webkul\Admin\Http\Controllers\Controller;
|
||||
|
||||
/**
|
||||
* Dashboard controller
|
||||
*
|
||||
* @author Alexey Khachatryan <info@khachatryan.org>
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
class DashboardController extends Controller
|
||||
{
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -5,21 +5,23 @@ namespace Webkul\Admin\Http\Controllers;
|
|||
use Webkul\Admin\Exports\DataGridExport;
|
||||
use Excel;
|
||||
|
||||
/**
|
||||
* Export controlller
|
||||
*
|
||||
* @author Rahul Shukla <rahulshukla.symfony517@webkul.com>
|
||||
* @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();
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue