Merge pull request #452 from prashant-webkul/development

Development
This commit is contained in:
JItendra Singh 2019-01-15 16:08:58 +05:30 committed by GitHub
commit cedfeb034a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
34 changed files with 488 additions and 549 deletions

View File

@ -63,7 +63,7 @@ Bagisto is using power of both of these frameworks and making best out of it out
**Run this Command** to download the project on to your local machine or server:
>> Note: If you have downloaded zip file then ignore this.
> Note: If you have downloaded zip file then ignore this.
~~~
composer create-project bagisto/bagisto
@ -89,12 +89,12 @@ default.
**Run these Commands Below**
>> Run this command, in case installing from the zip else skip this command (no need to run this command if you are creating project through composer):
> Run this command, in case installing from the zip else skip this command (no need to run this command if you are creating project through composer):
~~~
composer install
~~~
>> Continue run these command below:
> Continue run these command below:
~~~
php artisan migrate
~~~

View File

@ -5,7 +5,7 @@ return [
/**
* Default Select Value
*/
'select' => 'id',
'default_index' => 'id',
/**
* Default OrderBy
@ -30,7 +30,7 @@ return [
*
* Accepted Value = integer
*/
'pagination' => 10,
'paginate' => false,
'operators' => [
'eq' => "=",

View File

@ -6,19 +6,17 @@ use Webkul\Ui\DataGrid\DataGrid;
use DB;
/**
* Product Data Grid class
* 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
{
public $allColumns = [];
protected $itemsPerPage = 5; //overriding the default items per page
protected $index = 'id'; //the column that needs to be treated as index column
public function __construct()
{
$this->itemsPerPage = 10;
}
public function prepareQueryBuilder()
{
@ -27,17 +25,11 @@ class AttributeDataGrid extends DataGrid
$this->setQueryBuilder($queryBuilder);
}
public function setIndex()
{
$this->index = 'id'; //the column that needs to be treated as index column
}
public function addColumns()
{
$this->addColumn([
'index' => 'id',
'alias' => 'attributeId',
'label' => 'ID',
'label' => trans('admin::app.datagrid.id'),
'type' => 'number',
'searchable' => false,
'sortable' => true,
@ -46,8 +38,7 @@ class AttributeDataGrid extends DataGrid
$this->addColumn([
'index' => 'code',
'alias' => 'attributeCode',
'label' => 'Code',
'label' => trans('admin::app.datagrid.code'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
@ -56,8 +47,7 @@ class AttributeDataGrid extends DataGrid
$this->addColumn([
'index' => 'admin_name',
'alias' => 'attributeAdminName',
'label' => 'Name',
'label' => trans('admin::app.datagrid.admin-name'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
@ -66,8 +56,7 @@ class AttributeDataGrid extends DataGrid
$this->addColumn([
'index' => 'type',
'alias' => 'attributeType',
'label' => 'Type',
'label' => trans('admin::app.datagrid.type'),
'type' => 'string',
'sortable' => true,
'searchable' => true,
@ -76,8 +65,7 @@ class AttributeDataGrid extends DataGrid
$this->addColumn([
'index' => 'is_required',
'alias' => 'attributeRequired',
'label' => 'Required',
'label' => trans('admin::app.datagrid.required'),
'type' => 'boolean',
'sortable' => true,
'searchable' => false,
@ -92,8 +80,7 @@ class AttributeDataGrid extends DataGrid
$this->addColumn([
'index' => 'is_unique',
'alias' => 'attributeIsUnique',
'label' => 'Unique',
'label' => trans('admin::app.datagrid.unique'),
'type' => 'boolean',
'sortable' => true,
'searchable' => false,
@ -108,8 +95,7 @@ class AttributeDataGrid extends DataGrid
$this->addColumn([
'index' => 'value_per_locale',
'alias' => 'attributeValuePerLocale',
'label' => 'Locale Based',
'label' => trans('admin::app.datagrid.per-locale'),
'type' => 'boolean',
'sortable' => true,
'searchable' => false,
@ -124,8 +110,7 @@ class AttributeDataGrid extends DataGrid
$this->addColumn([
'index' => 'value_per_channel',
'alias' => 'attributeValuePerChannel',
'label' => 'Channel Based',
'label' => trans('admin::app.datagrid.per-channel'),
'type' => 'boolean',
'sortable' => true,
'searchable' => false,
@ -159,6 +144,7 @@ class AttributeDataGrid extends DataGrid
$this->addMassAction([
'type' => 'delete',
'action' => route('admin.catalog.attributes.massdelete'),
'label' => 'Delete',
'method' => 'DELETE'
]);
}

View File

@ -6,18 +6,16 @@ use Webkul\Ui\DataGrid\DataGrid;
use DB;
/**
* Product Data Grid class
* 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
{
public $allColumns = [];
protected $itemsPerPage = 5;
public function __construct() {
$this->itemsPerPage = 10;
}
protected $index = 'id'; //the column that needs to be treated as index column
public function prepareQueryBuilder()
{
@ -26,16 +24,11 @@ class AttributeFamilyDataGrid extends DataGrid
$this->setQueryBuilder($queryBuilder);
}
public function setIndex() {
$this->index = 'id'; //the column that needs to be treated as index column
}
public function addColumns()
{
$this->addColumn([
'index' => 'id',
'alias' => 'attributeFamilyId',
'label' => 'ID',
'label' => trans('admin::app.datagrid.id'),
'type' => 'number',
'searchable' => false,
'sortable' => true,
@ -44,8 +37,7 @@ class AttributeFamilyDataGrid extends DataGrid
$this->addColumn([
'index' => 'code',
'alias' => 'attributeFamilyCode',
'label' => 'Code',
'label' => trans('admin::app.datagrid.code'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
@ -54,8 +46,7 @@ class AttributeFamilyDataGrid extends DataGrid
$this->addColumn([
'index' => 'name',
'alias' => 'attributeFamilyName',
'label' => 'Name',
'label' => trans('admin::app.datagrid.name'),
'type' => 'string',
'searchable' => true,
'sortable' => true,

View File

@ -6,36 +6,27 @@ use Webkul\Ui\DataGrid\DataGrid;
use DB;
/**
* Product Data Grid class
* 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
{
public $allColumns = [];
public function __construct() {
$this->itemsPerPage = 10;
}
protected $index = 'category_id'; //the column that needs to be treated as index column
public function prepareQueryBuilder()
{
$queryBuilder = DB::table('categories as cat')->select('cat.id', 'ct.name', 'cat.position', 'cat.status', 'ct.locale')->leftJoin('category_translations as ct', 'cat.id', '=', 'ct.category_id');
$queryBuilder = DB::table('categories as cat')->select('cat.id as category_id', 'ct.name as category_name', 'cat.position as category_position', 'cat.status as category_status', 'ct.locale as category_locale')->leftJoin('category_translations as ct', 'cat.id', '=', 'ct.category_id');
$this->setQueryBuilder($queryBuilder);
}
public function setIndex() {
$this->index = 'id'; //the column that needs to be treated as index column
}
public function addColumns()
{
$this->addColumn([
'index' => 'cat.id',
'alias' => 'catId',
'label' => 'ID',
'index' => 'category_id',
'label' => trans('admin::app.datagrid.id'),
'type' => 'number',
'searchable' => false,
'sortable' => true,
@ -43,9 +34,8 @@ class CategoryDataGrid extends DataGrid
]);
$this->addColumn([
'index' => 'ct.name',
'alias' => 'catName',
'label' => 'Name',
'index' => 'category_name',
'label' => trans('admin::app.datagrid.name'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
@ -53,9 +43,8 @@ class CategoryDataGrid extends DataGrid
]);
$this->addColumn([
'index' => 'cat.position',
'alias' => 'catPosition',
'label' => 'Position',
'index' => 'category_position',
'label' => trans('admin::app.datagrid.position'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
@ -63,9 +52,8 @@ class CategoryDataGrid extends DataGrid
]);
$this->addColumn([
'index' => 'cat.status',
'alias' => 'catStatus',
'label' => 'Status',
'index' => 'category_status',
'label' => trans('admin::app.datagrid.status'),
'type' => 'boolean',
'sortable' => true,
'searchable' => true,
@ -79,9 +67,8 @@ class CategoryDataGrid extends DataGrid
]);
$this->addColumn([
'index' => 'ct.locale',
'alias' => 'catLocale',
'label' => 'Locale',
'index' => 'category_locale',
'label' => trans('admin::app.datagrid.locale'),
'type' => 'boolean',
'sortable' => true,
'searchable' => false,

View File

@ -6,18 +6,14 @@ use Webkul\Ui\DataGrid\DataGrid;
use DB;
/**
* Channel Data Grid class
* 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
{
public $allColumns = [];
public function __construct() {
$this->itemsPerPage = 10;
}
protected $index = 'id'; //the column that needs to be treated as index column
public function prepareQueryBuilder()
{
@ -26,16 +22,11 @@ class ChannelDataGrid extends DataGrid
$this->setQueryBuilder($queryBuilder);
}
public function setIndex() {
$this->index = 'id'; //the column that needs to be treated as index column
}
public function addColumns()
{
$this->addColumn([
'index' => 'id',
'alias' => 'channelId',
'label' => 'ID',
'label' => trans('admin::app.datagrid.id'),
'type' => 'number',
'searchable' => false,
'sortable' => true,
@ -44,8 +35,7 @@ class ChannelDataGrid extends DataGrid
$this->addColumn([
'index' => 'code',
'alias' => 'channelCode',
'label' => 'Code',
'label' => trans('admin::app.datagrid.code'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
@ -54,8 +44,7 @@ class ChannelDataGrid extends DataGrid
$this->addColumn([
'index' => 'name',
'alias' => 'channelName',
'label' => 'Name',
'label' => trans('admin::app.datagrid.name'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
@ -64,8 +53,7 @@ class ChannelDataGrid extends DataGrid
$this->addColumn([
'index' => 'hostname',
'alias' => 'channelHostname',
'label' => 'Hostname',
'label' => trans('admin::app.datagrid.hostname'),
'type' => 'string',
'sortable' => true,
'searchable' => true,

View File

@ -6,18 +6,14 @@ use Webkul\Ui\DataGrid\DataGrid;
use DB;
/**
* Currency Data Grid class
* 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
{
public $allColumns = [];
public function __construct() {
$this->itemsPerPage = 10;
}
protected $index = 'id'; //the column that needs to be treated as index column
public function prepareQueryBuilder()
{
@ -26,16 +22,11 @@ class CurrencyDataGrid extends DataGrid
$this->setQueryBuilder($queryBuilder);
}
public function setIndex() {
$this->index = 'id'; //the column that needs to be treated as index column
}
public function addColumns()
{
$this->addColumn([
'index' => 'id',
'alias' => 'currencyId',
'label' => 'ID',
'label' => trans('admin::app.datagrid.id'),
'type' => 'number',
'searchable' => false,
'sortable' => true,
@ -44,8 +35,7 @@ class CurrencyDataGrid extends DataGrid
$this->addColumn([
'index' => 'name',
'alias' => 'currencyName',
'label' => 'Name',
'label' => trans('admin::app.datagrid.name'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
@ -54,8 +44,7 @@ class CurrencyDataGrid extends DataGrid
$this->addColumn([
'index' => 'code',
'alias' => 'currencyCode',
'label' => 'Code',
'label' => trans('admin::app.datagrid.code'),
'type' => 'string',
'searchable' => true,
'sortable' => true,

View File

@ -6,36 +6,29 @@ use Webkul\Ui\DataGrid\DataGrid;
use DB;
/**
* Currency Data Grid class
* CustomerDataGrid class
*
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class CustomerDataGrid extends DataGrid
{
public $allColumns = [];
protected $itemsPerPage = 5;
public function __construct() {
$this->itemsPerPage = 10;
}
protected $index = 'customer_id'; //the column that needs to be treated as index column
public function prepareQueryBuilder()
{
$queryBuilder = DB::table('customers as cus')->addSelect('cus.id', 'cus.first_name', 'cus.email', 'cg.name')->leftJoin('customer_groups as cg', 'cus.customer_group_id', '=', 'cg.id');
$queryBuilder = DB::table('customers')->addSelect('customers.id as customer_id', 'customers.email as customer_email', 'customer_groups.name as customer_group_name')->addSelect(DB::raw('CONCAT(customers.first_name, " ", customers.last_name) as customer_full_name'))->leftJoin('customer_groups', 'customers.customer_group_id', '=', 'customer_groups.id');
$this->setQueryBuilder($queryBuilder);
}
public function setIndex() {
$this->index = 'id'; //the column that needs to be treated as index column
}
public function addColumns()
{
$this->addColumn([
'index' => 'cus.id',
'alias' => 'customerId',
'label' => 'ID',
'index' => 'customer_id',
'label' => trans('admin::app.datagrid.id'),
'type' => 'number',
'searchable' => false,
'sortable' => true,
@ -43,10 +36,8 @@ class CustomerDataGrid extends DataGrid
]);
$this->addColumn([
// 'column' => 'CONCAT(cus.first_name, " ", cus.last_name)',
'index' => 'cus.first_name',
'alias' => 'customerFullName',
'label' => 'Name',
'index' => 'customer_full_name',
'label' => trans('admin::app.datagrid.name'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
@ -54,9 +45,8 @@ class CustomerDataGrid extends DataGrid
]);
$this->addColumn([
'index' => 'cus.email',
'alias' => 'customerEmail',
'label' => 'Email',
'index' => 'customer_email',
'label' => trans('admin::app.datagrid.email'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
@ -64,9 +54,8 @@ class CustomerDataGrid extends DataGrid
]);
$this->addColumn([
'index' => 'cg.name',
'alias' => 'customerGroupName',
'label' => 'Group',
'index' => 'customer_group_name',
'label' => trans('admin::app.datagrid.group'),
'type' => 'string',
'searchable' => false,
'sortable' => true,

View File

@ -6,18 +6,14 @@ use Webkul\Ui\DataGrid\DataGrid;
use DB;
/**
* Currency Data Grid class
* 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
{
public $allColumns = [];
public function __construct() {
$this->itemsPerPage = 10;
}
protected $index = 'id'; //the column that needs to be treated as index column
public function prepareQueryBuilder()
{
@ -26,15 +22,10 @@ class CustomerGroupDataGrid extends DataGrid
$this->setQueryBuilder($queryBuilder);
}
public function setIndex() {
$this->index = 'id';
}
public function addColumns()
{
$this->addColumn([
'index' => 'id',
'alias' => 'groupId',
'label' => 'ID',
'type' => 'number',
'searchable' => false,
@ -43,9 +34,7 @@ class CustomerGroupDataGrid extends DataGrid
]);
$this->addColumn([
// 'column' => 'CONCAT(cus.first_name, " ", cus.last_name)',
'index' => 'name',
'alias' => 'groupName',
'label' => 'Name',
'type' => 'string',
'searchable' => true,

View File

@ -6,36 +6,27 @@ use Webkul\Ui\DataGrid\DataGrid;
use DB;
/**
* Currency Data Grid class
* 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
{
public $allColumns = [];
public function __construct() {
$this->itemsPerPage = 10;
}
protected $index = 'product_review_id'; //the column that needs to be treated as index column
public function prepareQueryBuilder()
{
$queryBuilder = DB::table('product_reviews as pr')->addSelect('pr.id', 'pr.title', 'pr.comment', 'pg.name', 'pr.status')->leftjoin('products_grid as pg', 'pr.product_id', '=', 'pg.id');
$queryBuilder = DB::table('product_reviews as pr')->addSelect('pr.id as product_review_id', 'pr.title as product_review_title', 'pr.comment as product_review_comment', 'pg.name as product_review_name', 'pr.status as product_review_status')->leftjoin('products_grid as pg', 'pr.product_id', '=', 'pg.id');
$this->setQueryBuilder($queryBuilder);
}
public function setIndex() {
$this->index = 'id';
}
public function addColumns()
{
$this->addColumn([
'index' => 'pr.id',
'alias' => 'reviewId',
'label' => 'ID',
'index' => 'product_review_id',
'label' => trans('admin::app.datagrid.id'),
'type' => 'number',
'searchable' => false,
'sortable' => true,
@ -43,9 +34,8 @@ class CustomerReviewDataGrid extends DataGrid
]);
$this->addColumn([
'index' => 'pr.title',
'alias' => 'reviewTitle',
'label' => 'Title',
'index' => 'product_review_title',
'label' => trans('admin::app.datagrid.title'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
@ -53,9 +43,8 @@ class CustomerReviewDataGrid extends DataGrid
]);
$this->addColumn([
'index' => 'pr.comment',
'alias' => 'reviewComment',
'label' => 'Comment',
'index' => 'product_review_comment',
'label' => trans('admin::app.datagrid.comment'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
@ -63,9 +52,8 @@ class CustomerReviewDataGrid extends DataGrid
]);
$this->addColumn([
'index' => 'pg.name',
'alias' => 'productName',
'label' => 'Product',
'index' => 'product_review_name',
'label' => trans('admin::app.datagrid.product-name'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
@ -73,9 +61,8 @@ class CustomerReviewDataGrid extends DataGrid
]);
$this->addColumn([
'index' => 'pr.status',
'alias' => 'reviewStatus',
'label' => 'Status',
'index' => 'product_review_status',
'label' => trans('admin::app.datagrid.status'),
'type' => 'boolean',
'searchable' => true,
'sortable' => true,
@ -107,12 +94,14 @@ class CustomerReviewDataGrid extends DataGrid
public function prepareMassActions() {
$this->addMassAction([
'type' => 'delete',
'label' => 'Delete',
'action' => route('admin.customer.review.massdelete'),
'method' => 'DELETE'
]);
$this->addMassAction([
'type' => 'update',
'label' => 'Update Status',
'action' => route('admin.customer.review.massupdate'),
'method' => 'PUT',
'options' => [

View File

@ -6,36 +6,27 @@ use Webkul\Ui\DataGrid\DataGrid;
use DB;
/**
* Product Data Grid class
* 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
{
public $allColumns = [];
public function __construct() {
$this->itemsPerPage = 10;
}
protected $index = 'currency_exch_id';
public function prepareQueryBuilder()
{
$queryBuilder = DB::table('currency_exchange_rates as cer')->addSelect('cer.id', 'curr.name', 'cer.rate')->leftJoin('currencies as curr', 'cer.target_currency', '=', 'curr.id');
$queryBuilder = DB::table('currency_exchange_rates as cer')->addSelect('cer.id as currency_exch_id', 'curr.name as currency_exch_name', 'cer.rate as currency_exch_rate')->leftJoin('currencies as curr', 'cer.target_currency', '=', 'curr.id');
$this->setQueryBuilder($queryBuilder);
}
public function setIndex() {
$this->index = 'id';
}
public function addColumns()
{
$this->addColumn([
'index' => 'cer.id',
'alias' => 'exchId',
'label' => 'ID',
'index' => 'currency_exch_id',
'label' => trans('admin::app.datagrid.id'),
'type' => 'number',
'searchable' => false,
'sortable' => true,
@ -43,9 +34,8 @@ class ExchangeRatesDataGrid extends DataGrid
]);
$this->addColumn([
'index' => 'curr.name',
'alias' => 'exchName',
'label' => 'Currency Name',
'index' => 'currency_exch_name',
'label' => trans('admin::app.datagrid.currency-name'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
@ -53,9 +43,8 @@ class ExchangeRatesDataGrid extends DataGrid
]);
$this->addColumn([
'index' => 'cer.rate',
'alias' => 'exchRate',
'label' => 'Exchange Rate',
'index' => 'currency_exch_rate',
'label' => trans('admin::app.datagrid.exch-rate'),
'type' => 'string',
'searchable' => true,
'sortable' => true,

View File

@ -6,18 +6,14 @@ use Webkul\Ui\DataGrid\DataGrid;
use DB;
/**
* Product Data Grid class
* 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
{
public $allColumns = [];
public function __construct() {
$this->itemsPerPage = 10;
}
protected $index = 'id';
public function prepareQueryBuilder()
{
@ -26,16 +22,11 @@ class InventorySourcesDataGrid extends DataGrid
$this->setQueryBuilder($queryBuilder);
}
public function setIndex() {
$this->index = 'id';
}
public function addColumns()
{
$this->addColumn([
'index' => 'id',
'alias' => 'invId',
'label' => 'ID',
'label' => trans('admin::app.datagrid.id'),
'type' => 'number',
'searchable' => false,
'sortable' => true,
@ -44,8 +35,7 @@ class InventorySourcesDataGrid extends DataGrid
$this->addColumn([
'index' => 'code',
'alias' => 'invCode',
'label' => 'Code',
'label' => trans('admin::app.datagrid.code'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
@ -54,8 +44,7 @@ class InventorySourcesDataGrid extends DataGrid
$this->addColumn([
'index' => 'name',
'alias' => 'invName',
'label' => 'Name',
'label' => trans('admin::app.datagrid.name'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
@ -64,8 +53,7 @@ class InventorySourcesDataGrid extends DataGrid
$this->addColumn([
'index' => 'priority',
'alias' => 'invPriority',
'label' => 'Priority',
'label' => trans('admin::app.datagrid.priority'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
@ -74,8 +62,7 @@ class InventorySourcesDataGrid extends DataGrid
$this->addColumn([
'index' => 'status',
'alias' => 'invStatus',
'label' => 'Status',
'label' => trans('admin::app.datagrid.status'),
'type' => 'boolean',
'searchable' => true,
'sortable' => true,

View File

@ -6,18 +6,14 @@ use Webkul\Ui\DataGrid\DataGrid;
use DB;
/**
* Product Data Grid class
* 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
{
public $allColumns = [];
public function __construct() {
$this->itemsPerPage = 10;
}
protected $index = 'id';
public function prepareQueryBuilder()
{
@ -26,16 +22,11 @@ class LocalesDataGrid extends DataGrid
$this->setQueryBuilder($queryBuilder);
}
public function setIndex() {
$this->index = 'id';
}
public function addColumns()
{
$this->addColumn([
'index' => 'id',
'alias' => 'localeId',
'label' => 'ID',
'label' => trans('admin::app.datagrid.id'),
'type' => 'number',
'searchable' => false,
'sortable' => true,
@ -44,8 +35,7 @@ class LocalesDataGrid extends DataGrid
$this->addColumn([
'index' => 'code',
'alias' => 'localeCode',
'label' => 'Code',
'label' => trans('admin::app.datagrid.code'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
@ -54,8 +44,7 @@ class LocalesDataGrid extends DataGrid
$this->addColumn([
'index' => 'name',
'alias' => 'localeName',
'label' => 'Name',
'label' => trans('admin::app.datagrid.name'),
'type' => 'string',
'searchable' => true,
'sortable' => true,

View File

@ -6,18 +6,14 @@ use Webkul\Ui\DataGrid\DataGrid;
use DB;
/**
* News Letter Grid class
* 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
{
public $allColumns = [];
public function __construct() {
$this->itemsPerPage = 10;
}
protected $index = 'id';
public function prepareQueryBuilder()
{
@ -26,16 +22,11 @@ class NewsLetterDataGrid extends DataGrid
$this->setQueryBuilder($queryBuilder);
}
public function setIndex() {
$this->index = 'id';
}
public function addColumns()
{
$this->addColumn([
'index' => 'id',
'alias' => 'subsId',
'label' => 'ID',
'label' => trans('admin::app.datagrid.id'),
'type' => 'number',
'searchable' => false,
'sortable' => true,
@ -44,8 +35,7 @@ class NewsLetterDataGrid extends DataGrid
$this->addColumn([
'index' => 'is_subscribed',
'alias' => 'subsCode',
'label' => 'Subscribed',
'label' => trans('admin::app.datagrid.subscribed'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
@ -60,8 +50,7 @@ class NewsLetterDataGrid extends DataGrid
$this->addColumn([
'index' => 'email',
'alias' => 'subsEmail',
'label' => 'Email',
'label' => trans('admin::app.datagrid.email'),
'type' => 'string',
'searchable' => true,
'sortable' => true,

View File

@ -6,36 +6,27 @@ use Webkul\Ui\DataGrid\DataGrid;
use DB;
/**
* Product Data Grid class
* 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
{
public $allColumns = [];
public function __construct() {
$this->itemsPerPage = 10;
}
protected $index = 'id';
public function prepareQueryBuilder()
{
$queryBuilder = DB::table('orders')->select('id', 'base_grand_total', 'grand_total', 'created_at', 'channel_name', 'status')->addSelect(DB::raw('CONCAT(customer_first_name, " ", customer_last_name) as fullname'));
$queryBuilder = DB::table('orders')->select('id', 'base_grand_total', 'grand_total', 'created_at', 'channel_name', 'status')->addSelect(DB::raw('CONCAT(customer_first_name, " ", customer_last_name) as full_name'));
$this->setQueryBuilder($queryBuilder);
}
public function setIndex() {
$this->index = 'id'; //the column that needs to be treated as index column
}
public function addColumns()
{
$this->addColumn([
'index' => 'id',
'alias' => 'orderId',
'label' => 'ID',
'label' => trans('admin::app.datagrid.id'),
'type' => 'number',
'searchable' => false,
'sortable' => true,
@ -44,8 +35,7 @@ class OrderDataGrid extends DataGrid
$this->addColumn([
'index' => 'base_grand_total',
'alias' => 'baseGrandTotal',
'label' => 'Base Total',
'label' => trans('admin::app.datagrid.base-total'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
@ -57,8 +47,7 @@ class OrderDataGrid extends DataGrid
$this->addColumn([
'index' => 'grand_total',
'alias' => 'grandTotal',
'label' => 'Grand Total',
'label' => trans('admin::app.datagrid.grand-total'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
@ -70,8 +59,7 @@ class OrderDataGrid extends DataGrid
$this->addColumn([
'index' => 'created_at',
'alias' => 'orderDate',
'label' => 'Order Date',
'label' => trans('admin::app.datagrid.order-date'),
'type' => 'string',
'sortable' => true,
'searchable' => true,
@ -80,8 +68,7 @@ class OrderDataGrid extends DataGrid
$this->addColumn([
'index' => 'channel_name',
'alias' => 'channelName',
'label' => 'Channel Name',
'label' => trans('admin::app.datagrid.channel-name'),
'type' => 'string',
'sortable' => true,
'searchable' => false,
@ -90,8 +77,7 @@ class OrderDataGrid extends DataGrid
$this->addColumn([
'index' => 'status',
'alias' => 'status',
'label' => 'Status',
'label' => trans('admin::app.datagrid.status'),
'type' => 'string',
'sortable' => true,
'searchable' => false,
@ -116,9 +102,8 @@ class OrderDataGrid extends DataGrid
]);
$this->addColumn([
'index' => 'fullname',
'alias' => 'fullName',
'label' => 'Billed To',
'index' => 'full_name',
'label' => trans('admin::app.datagrid.billed-to'),
'type' => 'string',
'searchable' => false,
'sortable' => true,

View File

@ -6,18 +6,14 @@ use Webkul\Ui\DataGrid\DataGrid;
use DB;
/**
* Product Data Grid class
* 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
{
public $allColumns = [];
public function __construct() {
$this->itemsPerPage = 10;
}
protected $index = 'id';
public function prepareQueryBuilder()
{
@ -26,16 +22,11 @@ class OrderInvoicesDataGrid extends DataGrid
$this->setQueryBuilder($queryBuilder);
}
public function setIndex() {
$this->index = 'id'; //the column that needs to be treated as index column
}
public function addColumns()
{
$this->addColumn([
'index' => 'id',
'alias' => 'invid',
'label' => 'ID',
'label' => trans('admin::app.datagrid.id'),
'type' => 'number',
'searchable' => false,
'sortable' => true,
@ -44,8 +35,7 @@ class OrderInvoicesDataGrid extends DataGrid
$this->addColumn([
'index' => 'order_id',
'alias' => 'orderId',
'label' => 'Order ID',
'label' => trans('admin::app.datagrid.order-id'),
'type' => 'number',
'searchable' => false,
'sortable' => true,
@ -54,8 +44,7 @@ class OrderInvoicesDataGrid extends DataGrid
$this->addColumn([
'index' => 'grand_total',
'alias' => 'invgrandtotal',
'label' => 'Grand Total',
'label' => trans('admin::app.datagrid.grand-total'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
@ -64,8 +53,7 @@ class OrderInvoicesDataGrid extends DataGrid
$this->addColumn([
'index' => 'created_at',
'alias' => 'invcreatedat',
'label' => 'Invoice Date',
'label' => trans('admin::app.datagrid.invoice-date'),
'type' => 'datetime',
'searchable' => true,
'sortable' => true,

View File

@ -6,36 +6,27 @@ use Webkul\Ui\DataGrid\DataGrid;
use DB;
/**
* Product Data Grid class
* 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
{
public $allColumns = [];
public function __construct() {
$this->itemsPerPage = 10;
}
protected $index = 'shipment_id';
public function prepareQueryBuilder()
{
$queryBuilder = DB::table('shipments as ship')->select('ship.id', 'ship.order_id', 'ship.total_qty', 'is.name', 'ors.created_at as orderdate', 'ship.created_at')->addSelect(DB::raw('CONCAT(ors.customer_first_name, " ", ors.customer_last_name) as custname'))->leftJoin('orders as ors', 'ship.order_id', '=', 'ors.id')->leftJoin('inventory_sources as is', 'ship.inventory_source_id', '=', 'is.id');
$queryBuilder = DB::table('shipments as ship')->select('ship.id as shipment_id', 'ship.order_id as shipment_order_id', 'ship.total_qty as shipment_total_qty', 'is.name as inventory_source_name', 'ors.created_at as orderdate', 'ship.created_at as shipment_created_at')->addSelect(DB::raw('CONCAT(ors.customer_first_name, " ", ors.customer_last_name) as custname'))->leftJoin('orders as ors', 'ship.order_id', '=', 'ors.id')->leftJoin('inventory_sources as is', 'ship.inventory_source_id', '=', 'is.id');
$this->setQueryBuilder($queryBuilder);
}
public function setIndex() {
$this->index = 'id'; //the column that needs to be treated as index column
}
public function addColumns()
{
$this->addColumn([
'index' => 'ship.id',
'alias' => 'shipId',
'label' => 'ID',
'index' => 'shipment_id',
'label' => trans('admin::app.datagrid.id'),
'type' => 'number',
'searchable' => false,
'sortable' => true,
@ -43,9 +34,8 @@ class OrderShipmentsDataGrid extends DataGrid
]);
$this->addColumn([
'index' => 'ship.order_id',
'alias' => 'orderId',
'label' => 'Order ID',
'index' => 'shipment_order_id',
'label' => trans('admin::app.datagrid.order-id'),
'type' => 'number',
'searchable' => false,
'sortable' => true,
@ -53,9 +43,8 @@ class OrderShipmentsDataGrid extends DataGrid
]);
$this->addColumn([
'index' => 'ship.total_qty',
'alias' => 'shipTotalQty',
'label' => 'Total Qty',
'index' => 'shipment_total_qty',
'label' => trans('admin::app.datagrid.total-qty'),
'type' => 'number',
'searchable' => true,
'sortable' => true,
@ -63,9 +52,8 @@ class OrderShipmentsDataGrid extends DataGrid
]);
$this->addColumn([
'index' => 'is.name',
'alias' => 'shipInventoryName',
'label' => 'Inventory Source',
'index' => 'inventory_source_name',
'label' => trans('admin::app.datagrid.inventory-source'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
@ -74,8 +62,7 @@ class OrderShipmentsDataGrid extends DataGrid
$this->addColumn([
'index' => 'orderdate',
'alias' => 'shipOrderDate',
'label' => 'Order Date',
'label' => trans('admin::app.datagrid.order-date'),
'type' => 'datetime',
'sortable' => true,
'searchable' => true,
@ -83,9 +70,8 @@ class OrderShipmentsDataGrid extends DataGrid
]);
$this->addColumn([
'index' => 'ship.created_at',
'alias' => 'shipDate',
'label' => 'Shipment Date',
'index' => 'shipment_created_at',
'label' => trans('admin::app.datagrid.shipment-date'),
'type' => 'datetime',
'sortable' => true,
'searchable' => false,
@ -94,8 +80,7 @@ class OrderShipmentsDataGrid extends DataGrid
$this->addColumn([
'index' => 'custname',
'alias' => 'shipTO',
'label' => 'Shipping To',
'label' => trans('admin::app.datagrid.shipment-to'),
'type' => 'string',
'sortable' => true,
'searchable' => false,

View File

@ -6,40 +6,27 @@ use Webkul\Ui\DataGrid\DataGrid;
use DB;
/**
* Product Data Grid class
* 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
{
public $allColumns = [];
public function __construct() {
$this->itemsPerPage = 10;
}
protected $index = 'product_id';
public function prepareQueryBuilder()
{
$queryBuilder = DB::table('products_grid')->addSelect('products_grid.product_id', 'products_grid.sku', 'products_grid.name', 'products.type', 'products_grid.status', 'products_grid.price', 'products_grid.quantity')->leftJoin('products', 'products_grid.product_id', '=', 'products.id');
$queryBuilder = DB::table('products_grid')->addSelect('products_grid.product_id as product_id', 'products_grid.sku as product_sku', 'products_grid.name as product_name', 'products.type as product_type', 'products_grid.status as product_status', 'products_grid.price as product_price', 'products_grid.quantity as product_quantity')->leftJoin('products', 'products_grid.product_id', '=', 'products.id');
$this->setQueryBuilder($queryBuilder);
}
public function setIndex() {
$this->index = 'product_id'; //the column that needs to be treated as index column
}
// public function setGridName() {
// $this->gridName = 'products_grid'; // should be the table name for getting proper index
// }
public function addColumns()
{
$this->addColumn([
'index' => 'products_grid.product_id',
'alias' => 'productid',
'label' => 'ID',
'index' => 'product_id',
'label' => trans('admin::app.datagrid.id'),
'type' => 'number',
'searchable' => false,
'sortable' => true,
@ -47,9 +34,8 @@ class ProductDataGrid extends DataGrid
]);
$this->addColumn([
'index' => 'products_grid.sku',
'alias' => 'productsku',
'label' => 'SKU',
'index' => 'product_sku',
'label' => trans('admin::app.datagrid.sku'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
@ -57,9 +43,8 @@ class ProductDataGrid extends DataGrid
]);
$this->addColumn([
'index' => 'products_grid.name',
'alias' => 'productname',
'label' => 'Name',
'index' => 'product_name',
'label' => trans('admin::app.datagrid.name'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
@ -67,9 +52,8 @@ class ProductDataGrid extends DataGrid
]);
$this->addColumn([
'index' => 'products.type',
'alias' => 'producttype',
'label' => 'Type',
'index' => 'product_type',
'label' => trans('admin::app.datagrid.type'),
'type' => 'string',
'sortable' => true,
'searchable' => true,
@ -77,9 +61,8 @@ class ProductDataGrid extends DataGrid
]);
$this->addColumn([
'index' => 'products_grid.status',
'alias' => 'productstatus',
'label' => 'Status',
'index' => 'product_status',
'label' => trans('admin::app.datagrid.status'),
'type' => 'boolean',
'sortable' => true,
'searchable' => false,
@ -93,9 +76,8 @@ class ProductDataGrid extends DataGrid
]);
$this->addColumn([
'index' => 'products_grid.price',
'alias' => 'productprice',
'label' => 'Price',
'index' => 'product_price',
'label' => trans('admin::app.datagrid.price'),
'type' => 'number',
'sortable' => true,
'searchable' => false,
@ -106,9 +88,8 @@ class ProductDataGrid extends DataGrid
]);
$this->addColumn([
'index' => 'products_grid.quantity',
'alias' => 'productqty',
'label' => 'Quantity',
'index' => 'product_quantity',
'label' => trans('admin::app.datagrid.qty'),
'type' => 'number',
'sortable' => true,
'searchable' => false,
@ -134,12 +115,14 @@ class ProductDataGrid extends DataGrid
public function prepareMassActions() {
$this->addMassAction([
'type' => 'delete',
'label' => 'Delete',
'action' => route('admin.catalog.products.massdelete'),
'method' => 'DELETE'
]);
$this->addMassAction([
'type' => 'update',
'label' => 'Update Status',
'action' => route('admin.catalog.products.massupdate'),
'method' => 'PUT',
'options' => [

View File

@ -6,18 +6,14 @@ use Webkul\Ui\DataGrid\DataGrid;
use DB;
/**
* News Letter Grid class
* 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
{
public $allColumns = [];
public function __construct() {
$this->itemsPerPage = 10;
}
protected $index = 'id';
public function prepareQueryBuilder()
{
@ -26,16 +22,11 @@ class RolesDataGrid extends DataGrid
$this->setQueryBuilder($queryBuilder);
}
public function setIndex() {
$this->index = 'id';
}
public function addColumns()
{
$this->addColumn([
'index' => 'id',
'alias' => 'roleId',
'label' => 'ID',
'label' => trans('admin::app.datagrid.id'),
'type' => 'number',
'searchable' => false,
'sortable' => true,
@ -44,8 +35,7 @@ class RolesDataGrid extends DataGrid
$this->addColumn([
'index' => 'name',
'alias' => 'roleName',
'label' => 'Name',
'label' => trans('admin::app.datagrid.name'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
@ -54,8 +44,7 @@ class RolesDataGrid extends DataGrid
$this->addColumn([
'index' => 'permission_type',
'alias' => 'roleType',
'label' => 'Permission Type',
'label' => trans('admin::app.datagrid.permission-type'),
'type' => 'string',
'searchable' => true,
'sortable' => true,

View File

@ -6,36 +6,27 @@ use Webkul\Ui\DataGrid\DataGrid;
use DB;
/**
* News Letter Grid class
* 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
{
public $allColumns = [];
public function __construct() {
$this->itemsPerPage = 10;
}
protected $index = 'slider_id';
public function prepareQueryBuilder()
{
$queryBuilder = DB::table('sliders as sl')->addSelect('sl.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 as slider_title', 'ch.name as channel_name')->leftJoin('channels as ch', 'sl.channel_id', '=', 'ch.id');
$this->setQueryBuilder($queryBuilder);
}
public function setIndex() {
$this->index = 'id';
}
public function addColumns()
{
$this->addColumn([
'index' => 'sl.id',
'alias' => 'sliderId',
'label' => 'ID',
'index' => 'slider_id',
'label' => trans('admin::app.datagrid.id'),
'type' => 'number',
'searchable' => false,
'sortable' => true,
@ -43,9 +34,8 @@ class SliderDataGrid extends DataGrid
]);
$this->addColumn([
'index' => 'sl.title',
'alias' => 'sliderTitle',
'label' => 'Tile',
'index' => 'slider_title',
'label' => trans('admin::app.datagrid.title'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
@ -53,9 +43,8 @@ class SliderDataGrid extends DataGrid
]);
$this->addColumn([
'index' => 'ch.name',
'alias' => 'channelName',
'label' => 'Channel Name',
'index' => 'channel_name',
'label' => trans('admin::app.datagrid.channel-name'),
'type' => 'string',
'searchable' => true,
'sortable' => true,

View File

@ -6,18 +6,14 @@ use Webkul\Ui\DataGrid\DataGrid;
use DB;
/**
* Tax Category Grid class
* 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
{
public $allColumns = [];
public function __construct() {
$this->itemsPerPage = 10;
}
protected $index = 'id';
public function prepareQueryBuilder()
{
@ -26,16 +22,11 @@ class TaxCategoryDataGrid extends DataGrid
$this->setQueryBuilder($queryBuilder);
}
public function setIndex() {
$this->index = 'id';
}
public function addColumns()
{
$this->addColumn([
'index' => 'id',
'alias' => 'taxCatId',
'label' => 'ID',
'label' => trans('admin::app.datagrid.id'),
'type' => 'number',
'searchable' => false,
'sortable' => true,
@ -44,8 +35,7 @@ class TaxCategoryDataGrid extends DataGrid
$this->addColumn([
'index' => 'name',
'alias' => 'taxCatName',
'label' => 'Name',
'label' => trans('admin::app.datagrid.name'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
@ -54,8 +44,7 @@ class TaxCategoryDataGrid extends DataGrid
$this->addColumn([
'index' => 'code',
'alias' => 'taxCatCode',
'label' => 'Code',
'label' => trans('admin::app.datagrid.code'),
'type' => 'string',
'searchable' => true,
'sortable' => true,

View File

@ -6,18 +6,14 @@ use Webkul\Ui\DataGrid\DataGrid;
use DB;
/**
* Tax Rate Grid class
* 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
{
public $allColumns = [];
public function __construct() {
$this->itemsPerPage = 10;
}
protected $index = 'id';
public function prepareQueryBuilder()
{
@ -26,16 +22,11 @@ class TaxRateDataGrid extends DataGrid
$this->setQueryBuilder($queryBuilder);
}
public function setIndex() {
$this->index = 'id';
}
public function addColumns()
{
$this->addColumn([
'index' => 'id',
'alias' => 'taxRateId',
'label' => 'ID',
'label' => trans('admin::app.datagrid.id'),
'type' => 'number',
'searchable' => false,
'sortable' => true,
@ -44,8 +35,7 @@ class TaxRateDataGrid extends DataGrid
$this->addColumn([
'index' => 'identifier',
'alias' => 'taxRateName',
'label' => 'Identifier',
'label' => trans('admin::app.datagrid.identifier'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
@ -54,8 +44,7 @@ class TaxRateDataGrid extends DataGrid
$this->addColumn([
'index' => 'state',
'alias' => 'taxRateState',
'label' => 'State',
'label' => trans('admin::app.datagrid.state'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
@ -64,8 +53,7 @@ class TaxRateDataGrid extends DataGrid
$this->addColumn([
'index' => 'country',
'alias' => 'taxRateCountry',
'label' => 'Country',
'label' => trans('admin::app.datagrid.country'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
@ -74,8 +62,7 @@ class TaxRateDataGrid extends DataGrid
$this->addColumn([
'index' => 'tax_rate',
'alias' => 'taxRate',
'label' => 'Rate',
'label' => trans('admin::app.datagrid.tax-rate'),
'type' => 'string',
'searchable' => true,
'sortable' => true,

View File

@ -6,36 +6,27 @@ use Webkul\Ui\DataGrid\DataGrid;
use DB;
/**
* News Letter Grid class
* 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
{
public $allColumns = [];
public function __construct() {
$this->itemsPerPage = 10;
}
protected $index = 'user_id';
public function prepareQueryBuilder()
{
$queryBuilder = DB::table('admins as u')->addSelect('u.id', 'u.name', 'u.status', 'u.email', 'ro.name')->leftJoin('roles as ro', 'u.role_id', '=', 'ro.id');
$queryBuilder = DB::table('admins as u')->addSelect('u.id as user_id', 'u.name as user_name', 'u.status as user_status', 'u.email as user_email', 'ro.name as role_name')->leftJoin('roles as ro', 'u.role_id', '=', 'ro.id');
$this->setQueryBuilder($queryBuilder);
}
public function setIndex() {
$this->index = 'id';
}
public function addColumns()
{
$this->addColumn([
'index' => 'u.id',
'alias' => 'adminId',
'label' => 'ID',
'index' => 'user_id',
'label' => trans('admin::app.datagrid.id'),
'type' => 'number',
'searchable' => false,
'sortable' => true,
@ -43,9 +34,8 @@ class UserDataGrid extends DataGrid
]);
$this->addColumn([
'index' => 'u.name',
'alias' => 'adminName',
'label' => 'Name',
'index' => 'user_name',
'label' => trans('admin::app.datagrid.name'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
@ -53,9 +43,8 @@ class UserDataGrid extends DataGrid
]);
$this->addColumn([
'index' => 'u.status',
'alias' => 'adminStatus',
'label' => 'Status',
'index' => 'user_status',
'label' => trans('admin::app.datagrid.status'),
'type' => 'boolean',
'searchable' => true,
'sortable' => true,
@ -70,9 +59,8 @@ class UserDataGrid extends DataGrid
]);
$this->addColumn([
'index' => 'u.email',
'alias' => 'adminEmail',
'label' => 'Email',
'index' => 'user_email',
'label' => trans('admin::app.datagrid.email'),
'type' => 'string',
'searchable' => true,
'sortable' => true,

View File

@ -103,7 +103,6 @@ class CustomerController extends Controller
'first_name' => 'string|required',
'last_name' => 'string|required',
'gender' => 'required',
'phone' => 'nullable|numeric|unique:customers,phone',
'email' => 'required|unique:customers,email',
'date_of_birth' => 'date|before:today'
]);
@ -112,7 +111,9 @@ class CustomerController extends Controller
$password = bcrypt(rand(100000,10000000));
$data['password']=$password;
$data['password'] = $password;
$data['is_verified'] = 1;
$this->customer->create($data);

View File

@ -99,8 +99,51 @@ return [
'method-error' => 'Error! Wrong method detected, please check mass action configuration',
'delete-success' => 'Selected index of :resource were successfully deleted',
'partial-action' => 'Some actions were not performed due restricted system constraints on :resource',
'update-success' => 'Selected index of :resource were successfully updated'
]
'update-success' => 'Selected index of :resource were successfully updated',
],
'id' => 'ID',
'status' => 'Status',
'code' => 'Code',
'admin-name' => 'Name',
'name' => 'Name',
'fullname' => 'Full Name',
'type' => 'Type',
'required' => 'Required',
'unique' => 'Unique',
'per-locale' => 'Locale Based',
'per-channel' => 'Channel Based',
'position' => 'Position',
'locale' => 'Locale',
'hostname' => 'Hostname',
'email' => 'Email',
'group' => 'Group',
'title' => 'Title',
'comment' => 'Comment',
'product-name' => 'Product',
'currency-name' => 'Currency Name',
'exch-rate' => 'Exchange Rate',
'priority' => 'Priority',
'subscribed' => 'Subscribed',
'base-total' => 'Base Total',
'grand-total' => 'Grand Total',
'order-date' => 'Order Date',
'channel-name' => 'Channel Name',
'billed-to' => 'Billed To',
'order-id' => 'Order Id',
'invoice-date' => 'Invoice Date',
'total-qty' => 'Total Qty',
'inventory-source' => 'Inventory Source',
'shipment-date' => 'Shipment Date',
'shipment-to' => 'Shipping To',
'sku' => 'SKU',
'price' => 'Price',
'qty' => 'Quantity',
'permission-type' => 'Permission Type',
'identifier' => 'Identifier',
'state' => 'State',
'country' => 'Country',
'tax-rate' => 'Rate'
],
'account' => [

View File

@ -67,7 +67,7 @@ class RegistrationController extends Controller
$data['channel_id'] = core()->getCurrentChannel()->id;
$data['is_verified'] = 0;
$data['is_verified'] = 1;
$data['customer_group_id'] = 1;

View File

@ -17,7 +17,7 @@ class Customer extends Authenticatable
protected $table = 'customers';
protected $fillable = ['first_name', 'channel_id', 'last_name', 'gender', 'date_of_birth', 'email', 'password', 'customer_group_id', 'subscribed_to_news_letter', 'is_verified', 'token', 'phone'];
protected $fillable = ['first_name', 'channel_id', 'last_name', 'gender', 'date_of_birth', 'email', 'password', 'customer_group_id', 'subscribed_to_news_letter', 'is_verified', 'token'];
protected $hidden = ['password', 'remember_token'];

View File

@ -203,7 +203,6 @@ class ProductController extends Controller
*/
public function massDestroy()
{
dd(request()->input());
$productIds = explode(',', request()->input('indexes'));
foreach ($productIds as $productId) {
@ -222,7 +221,6 @@ class ProductController extends Controller
*/
public function massUpdate()
{
dd(request()->input());
$data = request()->all();
if (!isset($data['massaction-type'])) {

View File

@ -5,16 +5,16 @@ namespace Webkul\Ui\DataGrid;
use Illuminate\Http\Request;
/**
* Product Data Grid class
* DataGrid class
*
* @author Jitendra Singh <jitendra@webkul.com>
* @author Prashant Singh <jitendra@webkul.com> @prashant-webkul
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
abstract class DataGrid
{
protected $index = null;
protected $columns = [];
protected $allColumns = [];
protected $completeColumnDetails = [];
protected $queryBuilder = [];
protected $collection = [];
protected $actions = [];
@ -22,13 +22,11 @@ abstract class DataGrid
protected $request;
protected $parse;
protected $enableMassAction = false;
protected $itemsPerPage = 0;
protected $enableAction = false;
protected $itemsPerPage = 10;
abstract public function prepareMassActions();
abstract public function prepareActions();
abstract public function prepareQueryBuilder();
abstract public function addColumns();
abstract public function setIndex();
/**
* Parse the URL and get it ready to be used.
@ -52,12 +50,12 @@ abstract class DataGrid
{
array_push($this->columns, $column);
$this->setAllColumnDetails($column);
$this->setCompleteColumnDetails($column);
}
public function setAllColumnDetails($column)
public function setCompleteColumnDetails($column)
{
array_push($this->allColumns, $column);
array_push($this->completeColumnDetails, $column);
}
public function setQueryBuilder($queryBuilder)
@ -68,6 +66,8 @@ abstract class DataGrid
public function addAction($action)
{
array_push($this->actions, $action);
$this->enableAction = true;
}
public function addMassAction($massAction)
@ -84,15 +84,18 @@ abstract class DataGrid
if(count($parsedUrl)) {
$filteredOrSortedCollection = $this->sortOrFilterCollection($this->collection = $this->queryBuilder, $parsedUrl);
if($this->itemsPerPage > 0) {
if(config('datagrid.paginate')) {
if($this->itemsPerPage > 0)
return $filteredOrSortedCollection->paginate($this->itemsPerPage)->appends(request()->except('page'));
} else {
return $filteredOrSortedCollection->get();
}
}
if(config('datagrid.paginate')) {
if ($this->itemsPerPage > 0) {
$this->collection = $this->queryBuilder->paginate($this->itemsPerPage)->appends(request()->except('page'));
}
} else {
$this->collection = $this->queryBuilder->get();
}
@ -107,8 +110,8 @@ abstract class DataGrid
*/
public function findColumnType($columnAlias)
{
foreach($this->allColumns as $column) {
if($column['alias'] == $columnAlias) {
foreach($this->completeColumnDetails as $column) {
if($column['index'] == $columnAlias) {
return [$column['type'], $column['index']];
}
}
@ -142,7 +145,7 @@ abstract class DataGrid
if($count_keys == 1) {
return $collection->where(function() use($collection, $info) {
foreach ($this->allColumns as $column) {
foreach ($this->completeColumnDetails as $column) {
if($column['searchable'] == true)
$collection->orWhere($column['index'], 'like', '%'.$info['all'].'%');
}
@ -182,14 +185,12 @@ abstract class DataGrid
{
$this->addColumns();
$this->setIndex();
$this->prepareActions();
$this->prepareMassActions();
$this->prepareQueryBuilder();
return view('ui::datagrid.table')->with('results', ['records' => $this->getCollection(), 'columns' => $this->allColumns, 'actions' => $this->actions, 'massactions' => $this->massActions, 'index' => $this->index, 'enableMassActions' => $this->enableMassAction, 'norecords' => trans('ui::datagrid.no-records')]);
return view('ui::datagrid.table')->with('results', ['records' => $this->getCollection(), 'columns' => $this->completeColumnDetails, 'actions' => $this->actions, 'massactions' => $this->massActions, 'index' => $this->index, 'enableMassActions' => $this->enableMassAction, 'enableActions' => $this->enableAction, 'norecords' => trans('ui::app.datagrid.no-records')]);
}
}

View File

@ -1,7 +1,8 @@
<tbody>
@if(count($records))
@foreach($records as $key => $record)
<tr>
@if($enableMassAction)
@if($enableMassActions)
<td>
<span class="checkbox">
<input type="checkbox" v-model="dataIds" @change="select" value="{{ $record->{$index} }}">
@ -29,6 +30,7 @@
@endif
@endforeach
@if($enableActions)
<td style="width: 50px;">
<div class="actions">
@foreach($actions as $action)
@ -38,6 +40,12 @@
@endforeach
</div>
</td>
@endif
</tr>
@endforeach
@else
<tr>
<td colspan="10" style="text-align: center;">{{$norecords}}</td>
</tr>
@endif
</tbody>

View File

@ -1,7 +1,7 @@
<div class="table">
<testgrid-filters></testgrid-filters>
@if(config('datagrid.pagination'))
@if(config('datagrid.paginate'))
@include('ui::datagrid.pagination', ['results' => $results['records']])
@endif
@ -35,7 +35,7 @@
<select class="filter-column-select control" v-model="filterColumn" v-on:click="getColumnOrAlias(filterColumn)">
<option selected disabled>Select Column</option>
@foreach($results['columns'] as $column)
<option value="{{ $column['alias'] }}">
<option value="{{ $column['index'] }}">
{{ $column['label'] }}
</option>
@endforeach
@ -135,7 +135,7 @@
</div>
</div>
<div class="filter-row-two">
<span class="filter-tag" v-if="filters.length > 0" v-for="filter in filters">
<span class="filter-tag" v-if="filters.length > 0" v-for="filter in filters" style="text-transform: uppercase;">
<span v-if="filter.column == 'sort'">@{{ filter.label }}</span>
<span v-else-if="filter.column == 'search'">Search</span>
<span v-else>@{{ filter.label }}</span>
@ -151,7 +151,7 @@
<thead v-if="massActionsToggle">
@if(isset($results['massactions']))
<tr class="mass-action" style="height: 63px;" v-if="massActionsToggle">
<th colspan="100" style="width: 100%;">
<th colspan="10" style="width: 100%;">
<div class="mass-action-wrapper" style="display: flex; flex-direction: row; align-items: center; justify-content: flex-start;">
<span class="massaction-remove" v-on:click="removeMassActions" style="margin-right: 10px;">
@ -165,7 +165,7 @@
<div class="control-group">
<select class="control" v-model="massActionType" @change="changeMassActionTarget" name="massaction-type">
<option v-for="(massAction, index) in massActions" :key="index">@{{ massAction.type }}</option>
<option v-for="(massAction, index) in massActions" :key="index" :value="massAction.type">@{{ massAction.label }}</option>
</select>
</div>
@ -185,7 +185,7 @@
<thead v-if="massActionsToggle == false">
<tr>
@if($results['enableMassActions'])
@if(count($results['records']) && $results['enableMassActions'])
<th class="grid_head" id="mastercheckbox" style="width: 50px;">
<span class="checkbox">
<input type="checkbox" v-model="allSelected" v-on:change="selectAll">
@ -196,18 +196,20 @@
@endif
@foreach($results['columns'] as $key => $column)
<th class="grid_head" style="width: {{ $column['width'] }}" v-on:click="sortCollection('{{ $column['alias'] }}')">
<th class="grid_head" style="width: {{ $column['width'] }}" v-on:click="sortCollection('{{ $column['index'] }}')">
{{ $column['label'] }}
</th>
@endforeach
@if($results['enableActions'])
<th>
Actions
{{ __('ui::app.datagrid.actions') }}
</th>
@endif
</tr>
</thead>
@include('ui::datagrid.body', ['records' => $results['records'], 'actions' => $results['actions'], 'index' => $results['index'], 'columns' => $results['columns'],'enableMassAction' => $results['enableMassActions']])
@include('ui::datagrid.body', ['records' => $results['records'], 'actions' => $results['actions'], 'index' => $results['index'], 'columns' => $results['columns'],'enableMassActions' => $results['enableMassActions'], 'enableActions' => $results['enableActions'], 'norecords' => $results['norecords']])
</table>
</div>
</script>
@ -265,7 +267,7 @@
this.columnOrAlias = columnOrAlias;
for(column in this.columns) {
if (this.columns[column].alias == this.columnOrAlias) {
if (this.columns[column].index == this.columnOrAlias) {
this.type = this.columns[column].type;
if(this.type == 'string') {
@ -312,7 +314,7 @@
label = '';
for(colIndex in this.columns) {
if(this.columns[colIndex].alias == this.columnOrAlias) {
if(this.columns[colIndex].index == this.columnOrAlias) {
label = this.columns[colIndex].label;
}
}
@ -332,7 +334,7 @@
label = '';
for(colIndex in this.columns) {
if(this.columns[colIndex].alias == this.columnOrAlias) {
if(this.columns[colIndex].index == this.columnOrAlias) {
label = this.columns[colIndex].label;
}
}
@ -344,7 +346,7 @@
label = '';
for(colIndex in this.columns) {
if(this.columns[colIndex].alias == this.columnOrAlias) {
if(this.columns[colIndex].index == this.columnOrAlias) {
label = this.columns[colIndex].label;
}
}
@ -602,7 +604,7 @@
label = '';
for(colIndex in this.columns) {
if(this.columns[colIndex].alias == obj.cond) {
if(this.columns[colIndex].index == obj.cond) {
obj.label = this.columns[colIndex].label;
}
}
@ -612,7 +614,7 @@
obj.label = '';
for(colIndex in this.columns) {
if(this.columns[colIndex].alias == obj.column) {
if(this.columns[colIndex].index == obj.column) {
obj.label = this.columns[colIndex].label;
}
}

View File

@ -0,0 +1,75 @@
<?php
namespace Tests\Feature;
use Tests\TestCase;
use Auth;
use App;
use Faker\Generator as Faker;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Webkul\Customer\Repositories\CustomerRepository as Customer;
class AuthTest extends TestCase
{
protected $customer;
/**
* To check if the customer can view the login page or not
*
* @return void
*/
public function testCustomerLoginPage()
{
config(['app.url' => 'http://127.0.0.1:8000']);
$response = $this->get('/customer/login');
$response->assertSuccessful();
$response->assertViewIs('shop::customers.session.index');
}
public function testCustomerResgistrationPage() {
config(['app.url' => 'http://127.0.0.1:8000']);
$response = $this->get('/customer/register');
$response->assertSuccessful();
$response->assertViewIs('shop::customers.signup.index');
}
public function testCustomerRegistration() {
$faker = \Faker\Factory::create();
$allCustomers = array();
$customers = app(Customer::class);
$created = $customers->create([
'first_name' => explode(' ',$faker->name)[0],
'last_name' => explode(' ',$faker->name)[0],
'channel_id' => core()->getCurrentChannel()->id,
'gender' => $faker->randomElement($array = array ('Male','Female', 'Other')),
'date_of_birth' => $faker->date($format = 'Y-m-d', $max = 'now'),
'email' => $faker->email,
'password' => bcrypt('12345678'),
'is_verified' => 1
]);
$this->assertEquals($created->id, $created->id);
}
public function testCustomerLogin() {
$customers = app(Customer::class);
$customer = $customers->find(1);
$user = ['email' => $customer->email, 'password' => $customer->password];
$this->assertAuthenticatedAs($user);
}
}

View File

@ -1,21 +0,0 @@
<?php
namespace Tests\Feature;
use Tests\TestCase;
use Illuminate\Foundation\Testing\RefreshDatabase;
class ExampleTest extends TestCase
{
/**
* A basic test example.
*
* @return void
*/
public function testBasicTest()
{
$response = $this->get('/');
$response->assertStatus(200);
}
}

View File

@ -0,0 +1,87 @@
<?php
namespace Tests\Feature;
use Tests\TestCase;
use Illuminate\Http\Request;
use Illuminate\Foundation\Testing\WithoutMiddleware;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Illuminate\Foundation\Testing\WithFaker;
use Illuminate\Foundation\Testing\RefreshDatabase;
class GeneralTest extends TestCase
{
/**
* Test for home page
*
* @return void
*/
public function testHomePage()
{
config(['app.url' => 'http://127.0.0.1:8000']);
$response = $this->get('/');
$response->assertStatus(200);
}
/**
* Test for customer login
*
* @return void
*/
public function testCustomerLoginPage()
{
config(['app.url' => 'http://127.0.0.1:8000']);
$response = $this->get('/customer/login');
$response->assertStatus(200);
}
/**
* Test for categories page
*
* @return void
*/
public function testCategoriesPage()
{
$categoryUrlSlug = 'marvel-figurines';
config(['app.url' => 'http://127.0.0.1:8000']);
$response = $this->get("/categories/{$categoryUrlSlug}");
$response->assertStatus(200);
}
/**
* Test for customer registration page
*
* @return void
*/
public function testCustomerRegistrationPage()
{
config(['app.url' => 'http://127.0.0.1:8000']);
$response = $this->get("/customer/register");
$response->assertStatus(200);
}
/**
* Test for checkout's cart page
*
* @return void
*/
public function testCartPage()
{
config(['app.url' => 'http://127.0.0.1:8000']);
$response = $this->get("/checkout/cart");
$response->assertStatus(200);
}
}