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: **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 composer create-project bagisto/bagisto
@ -89,12 +89,12 @@ default.
**Run these Commands Below** **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 composer install
~~~ ~~~
>> Continue run these command below: > Continue run these command below:
~~~ ~~~
php artisan migrate php artisan migrate
~~~ ~~~

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -6,36 +6,27 @@ use Webkul\Ui\DataGrid\DataGrid;
use DB; use DB;
/** /**
* Product Data Grid class * ExchangeRateDataGrid Class
* *
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul * @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/ */
class ExchangeRatesDataGrid extends DataGrid class ExchangeRatesDataGrid extends DataGrid
{ {
public $allColumns = []; protected $index = 'currency_exch_id';
public function __construct() {
$this->itemsPerPage = 10;
}
public function prepareQueryBuilder() 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); $this->setQueryBuilder($queryBuilder);
} }
public function setIndex() {
$this->index = 'id';
}
public function addColumns() public function addColumns()
{ {
$this->addColumn([ $this->addColumn([
'index' => 'cer.id', 'index' => 'currency_exch_id',
'alias' => 'exchId', 'label' => trans('admin::app.datagrid.id'),
'label' => 'ID',
'type' => 'number', 'type' => 'number',
'searchable' => false, 'searchable' => false,
'sortable' => true, 'sortable' => true,
@ -43,9 +34,8 @@ class ExchangeRatesDataGrid extends DataGrid
]); ]);
$this->addColumn([ $this->addColumn([
'index' => 'curr.name', 'index' => 'currency_exch_name',
'alias' => 'exchName', 'label' => trans('admin::app.datagrid.currency-name'),
'label' => 'Currency Name',
'type' => 'string', 'type' => 'string',
'searchable' => true, 'searchable' => true,
'sortable' => true, 'sortable' => true,
@ -53,9 +43,8 @@ class ExchangeRatesDataGrid extends DataGrid
]); ]);
$this->addColumn([ $this->addColumn([
'index' => 'cer.rate', 'index' => 'currency_exch_rate',
'alias' => 'exchRate', 'label' => trans('admin::app.datagrid.exch-rate'),
'label' => 'Exchange Rate',
'type' => 'string', 'type' => 'string',
'searchable' => true, 'searchable' => true,
'sortable' => true, 'sortable' => true,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -6,40 +6,27 @@ use Webkul\Ui\DataGrid\DataGrid;
use DB; use DB;
/** /**
* Product Data Grid class * ProductDataGrid Class
* *
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul * @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/ */
class ProductDataGrid extends DataGrid class ProductDataGrid extends DataGrid
{ {
public $allColumns = []; protected $index = 'product_id';
public function __construct() {
$this->itemsPerPage = 10;
}
public function prepareQueryBuilder() 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); $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() public function addColumns()
{ {
$this->addColumn([ $this->addColumn([
'index' => 'products_grid.product_id', 'index' => 'product_id',
'alias' => 'productid', 'label' => trans('admin::app.datagrid.id'),
'label' => 'ID',
'type' => 'number', 'type' => 'number',
'searchable' => false, 'searchable' => false,
'sortable' => true, 'sortable' => true,
@ -47,9 +34,8 @@ class ProductDataGrid extends DataGrid
]); ]);
$this->addColumn([ $this->addColumn([
'index' => 'products_grid.sku', 'index' => 'product_sku',
'alias' => 'productsku', 'label' => trans('admin::app.datagrid.sku'),
'label' => 'SKU',
'type' => 'string', 'type' => 'string',
'searchable' => true, 'searchable' => true,
'sortable' => true, 'sortable' => true,
@ -57,9 +43,8 @@ class ProductDataGrid extends DataGrid
]); ]);
$this->addColumn([ $this->addColumn([
'index' => 'products_grid.name', 'index' => 'product_name',
'alias' => 'productname', 'label' => trans('admin::app.datagrid.name'),
'label' => 'Name',
'type' => 'string', 'type' => 'string',
'searchable' => true, 'searchable' => true,
'sortable' => true, 'sortable' => true,
@ -67,9 +52,8 @@ class ProductDataGrid extends DataGrid
]); ]);
$this->addColumn([ $this->addColumn([
'index' => 'products.type', 'index' => 'product_type',
'alias' => 'producttype', 'label' => trans('admin::app.datagrid.type'),
'label' => 'Type',
'type' => 'string', 'type' => 'string',
'sortable' => true, 'sortable' => true,
'searchable' => true, 'searchable' => true,
@ -77,9 +61,8 @@ class ProductDataGrid extends DataGrid
]); ]);
$this->addColumn([ $this->addColumn([
'index' => 'products_grid.status', 'index' => 'product_status',
'alias' => 'productstatus', 'label' => trans('admin::app.datagrid.status'),
'label' => 'Status',
'type' => 'boolean', 'type' => 'boolean',
'sortable' => true, 'sortable' => true,
'searchable' => false, 'searchable' => false,
@ -93,9 +76,8 @@ class ProductDataGrid extends DataGrid
]); ]);
$this->addColumn([ $this->addColumn([
'index' => 'products_grid.price', 'index' => 'product_price',
'alias' => 'productprice', 'label' => trans('admin::app.datagrid.price'),
'label' => 'Price',
'type' => 'number', 'type' => 'number',
'sortable' => true, 'sortable' => true,
'searchable' => false, 'searchable' => false,
@ -106,9 +88,8 @@ class ProductDataGrid extends DataGrid
]); ]);
$this->addColumn([ $this->addColumn([
'index' => 'products_grid.quantity', 'index' => 'product_quantity',
'alias' => 'productqty', 'label' => trans('admin::app.datagrid.qty'),
'label' => 'Quantity',
'type' => 'number', 'type' => 'number',
'sortable' => true, 'sortable' => true,
'searchable' => false, 'searchable' => false,
@ -134,12 +115,14 @@ class ProductDataGrid extends DataGrid
public function prepareMassActions() { public function prepareMassActions() {
$this->addMassAction([ $this->addMassAction([
'type' => 'delete', 'type' => 'delete',
'label' => 'Delete',
'action' => route('admin.catalog.products.massdelete'), 'action' => route('admin.catalog.products.massdelete'),
'method' => 'DELETE' 'method' => 'DELETE'
]); ]);
$this->addMassAction([ $this->addMassAction([
'type' => 'update', 'type' => 'update',
'label' => 'Update Status',
'action' => route('admin.catalog.products.massupdate'), 'action' => route('admin.catalog.products.massupdate'),
'method' => 'PUT', 'method' => 'PUT',
'options' => [ 'options' => [

View File

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

View File

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

View File

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

View File

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

View File

@ -6,36 +6,27 @@ use Webkul\Ui\DataGrid\DataGrid;
use DB; use DB;
/** /**
* News Letter Grid class * UserDataGrid Class
* *
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul * @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/ */
class UserDataGrid extends DataGrid class UserDataGrid extends DataGrid
{ {
public $allColumns = []; protected $index = 'user_id';
public function __construct() {
$this->itemsPerPage = 10;
}
public function prepareQueryBuilder() 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); $this->setQueryBuilder($queryBuilder);
} }
public function setIndex() {
$this->index = 'id';
}
public function addColumns() public function addColumns()
{ {
$this->addColumn([ $this->addColumn([
'index' => 'u.id', 'index' => 'user_id',
'alias' => 'adminId', 'label' => trans('admin::app.datagrid.id'),
'label' => 'ID',
'type' => 'number', 'type' => 'number',
'searchable' => false, 'searchable' => false,
'sortable' => true, 'sortable' => true,
@ -43,9 +34,8 @@ class UserDataGrid extends DataGrid
]); ]);
$this->addColumn([ $this->addColumn([
'index' => 'u.name', 'index' => 'user_name',
'alias' => 'adminName', 'label' => trans('admin::app.datagrid.name'),
'label' => 'Name',
'type' => 'string', 'type' => 'string',
'searchable' => true, 'searchable' => true,
'sortable' => true, 'sortable' => true,
@ -53,9 +43,8 @@ class UserDataGrid extends DataGrid
]); ]);
$this->addColumn([ $this->addColumn([
'index' => 'u.status', 'index' => 'user_status',
'alias' => 'adminStatus', 'label' => trans('admin::app.datagrid.status'),
'label' => 'Status',
'type' => 'boolean', 'type' => 'boolean',
'searchable' => true, 'searchable' => true,
'sortable' => true, 'sortable' => true,
@ -70,9 +59,8 @@ class UserDataGrid extends DataGrid
]); ]);
$this->addColumn([ $this->addColumn([
'index' => 'u.email', 'index' => 'user_email',
'alias' => 'adminEmail', 'label' => trans('admin::app.datagrid.email'),
'label' => 'Email',
'type' => 'string', 'type' => 'string',
'searchable' => true, 'searchable' => true,
'sortable' => true, 'sortable' => true,

View File

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

View File

@ -99,8 +99,51 @@ return [
'method-error' => 'Error! Wrong method detected, please check mass action configuration', 'method-error' => 'Error! Wrong method detected, please check mass action configuration',
'delete-success' => 'Selected index of :resource were successfully deleted', 'delete-success' => 'Selected index of :resource were successfully deleted',
'partial-action' => 'Some actions were not performed due restricted system constraints on :resource', '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' => [ 'account' => [

View File

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

View File

@ -17,7 +17,7 @@ class Customer extends Authenticatable
protected $table = 'customers'; 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']; protected $hidden = ['password', 'remember_token'];

View File

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

View File

@ -5,16 +5,16 @@ namespace Webkul\Ui\DataGrid;
use Illuminate\Http\Request; 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) * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/ */
abstract class DataGrid abstract class DataGrid
{ {
protected $index = null; protected $index = null;
protected $columns = []; protected $columns = [];
protected $allColumns = []; protected $completeColumnDetails = [];
protected $queryBuilder = []; protected $queryBuilder = [];
protected $collection = []; protected $collection = [];
protected $actions = []; protected $actions = [];
@ -22,13 +22,11 @@ abstract class DataGrid
protected $request; protected $request;
protected $parse; protected $parse;
protected $enableMassAction = false; 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 prepareQueryBuilder();
abstract public function addColumns(); abstract public function addColumns();
abstract public function setIndex();
/** /**
* Parse the URL and get it ready to be used. * Parse the URL and get it ready to be used.
@ -52,12 +50,12 @@ abstract class DataGrid
{ {
array_push($this->columns, $column); 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) public function setQueryBuilder($queryBuilder)
@ -68,6 +66,8 @@ abstract class DataGrid
public function addAction($action) public function addAction($action)
{ {
array_push($this->actions, $action); array_push($this->actions, $action);
$this->enableAction = true;
} }
public function addMassAction($massAction) public function addMassAction($massAction)
@ -84,15 +84,18 @@ abstract class DataGrid
if(count($parsedUrl)) { if(count($parsedUrl)) {
$filteredOrSortedCollection = $this->sortOrFilterCollection($this->collection = $this->queryBuilder, $parsedUrl); $filteredOrSortedCollection = $this->sortOrFilterCollection($this->collection = $this->queryBuilder, $parsedUrl);
if($this->itemsPerPage > 0) { if(config('datagrid.paginate')) {
return $filteredOrSortedCollection->paginate($this->itemsPerPage)->appends(request()->except('page')); if($this->itemsPerPage > 0)
return $filteredOrSortedCollection->paginate($this->itemsPerPage)->appends(request()->except('page'));
} else { } else {
return $filteredOrSortedCollection->get(); return $filteredOrSortedCollection->get();
} }
} }
if ($this->itemsPerPage > 0) { if(config('datagrid.paginate')) {
$this->collection = $this->queryBuilder->paginate($this->itemsPerPage)->appends(request()->except('page')); if ($this->itemsPerPage > 0) {
$this->collection = $this->queryBuilder->paginate($this->itemsPerPage)->appends(request()->except('page'));
}
} else { } else {
$this->collection = $this->queryBuilder->get(); $this->collection = $this->queryBuilder->get();
} }
@ -107,8 +110,8 @@ abstract class DataGrid
*/ */
public function findColumnType($columnAlias) public function findColumnType($columnAlias)
{ {
foreach($this->allColumns as $column) { foreach($this->completeColumnDetails as $column) {
if($column['alias'] == $columnAlias) { if($column['index'] == $columnAlias) {
return [$column['type'], $column['index']]; return [$column['type'], $column['index']];
} }
} }
@ -142,7 +145,7 @@ abstract class DataGrid
if($count_keys == 1) { if($count_keys == 1) {
return $collection->where(function() use($collection, $info) { return $collection->where(function() use($collection, $info) {
foreach ($this->allColumns as $column) { foreach ($this->completeColumnDetails as $column) {
if($column['searchable'] == true) if($column['searchable'] == true)
$collection->orWhere($column['index'], 'like', '%'.$info['all'].'%'); $collection->orWhere($column['index'], 'like', '%'.$info['all'].'%');
} }
@ -182,14 +185,12 @@ abstract class DataGrid
{ {
$this->addColumns(); $this->addColumns();
$this->setIndex();
$this->prepareActions(); $this->prepareActions();
$this->prepareMassActions(); $this->prepareMassActions();
$this->prepareQueryBuilder(); $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,43 +1,51 @@
<tbody> <tbody>
@foreach($records as $key => $record) @if(count($records))
<tr> @foreach($records as $key => $record)
@if($enableMassAction) <tr>
<td> @if($enableMassActions)
<span class="checkbox"> <td>
<input type="checkbox" v-model="dataIds" @change="select" value="{{ $record->{$index} }}"> <span class="checkbox">
<input type="checkbox" v-model="dataIds" @change="select" value="{{ $record->{$index} }}">
<label class="checkbox-view" for="checkbox"></label> <label class="checkbox-view" for="checkbox"></label>
</span> </span>
</td> </td>
@endif
@foreach($columns as $column)
@php
$columnIndex = explode('.', $column['index']);
$columnIndex = end($columnIndex);
@endphp
@if(isset($column['wrapper']))
@if(isset($column['closure']) && $column['closure'] == true)
<td>{!! $column['wrapper']($record->{$columnIndex}) !!}</td>
@else
<td>{{ $column['wrapper']($record->{$columnIndex}) }}</td>
@endif
@else
<td>{{ $record->{$columnIndex} }}</td>
@endif @endif
@endforeach
<td style="width: 50px;"> @foreach($columns as $column)
<div class="actions"> @php
@foreach($actions as $action) $columnIndex = explode('.', $column['index']);
<a href="{{ route($action['route'], $record->{$index}) }}">
<span class="{{ $action['icon'] }}"></span> $columnIndex = end($columnIndex);
</a> @endphp
@endforeach
</div> @if(isset($column['wrapper']))
</td> @if(isset($column['closure']) && $column['closure'] == true)
<td>{!! $column['wrapper']($record->{$columnIndex}) !!}</td>
@else
<td>{{ $column['wrapper']($record->{$columnIndex}) }}</td>
@endif
@else
<td>{{ $record->{$columnIndex} }}</td>
@endif
@endforeach
@if($enableActions)
<td style="width: 50px;">
<div class="actions">
@foreach($actions as $action)
<a href="{{ route($action['route'], $record->{$index}) }}">
<span class="{{ $action['icon'] }}"></span>
</a>
@endforeach
</div>
</td>
@endif
</tr>
@endforeach
@else
<tr>
<td colspan="10" style="text-align: center;">{{$norecords}}</td>
</tr> </tr>
@endforeach @endif
</tbody> </tbody>

View File

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