Assets compiled for production
This commit is contained in:
commit
9c1612d0ab
|
|
@ -146,6 +146,24 @@ return [
|
||||||
*/
|
*/
|
||||||
'editor' =>'vscode',
|
'editor' =>'vscode',
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Debug blacklisting
|
||||||
|
*/
|
||||||
|
'debug_blacklist' => [
|
||||||
|
'_ENV' => [
|
||||||
|
'APP_KEY',
|
||||||
|
'DB_PASSWORD'
|
||||||
|
],
|
||||||
|
|
||||||
|
'_SERVER' => [
|
||||||
|
'APP_KEY',
|
||||||
|
'DB_PASSWORD'
|
||||||
|
],
|
||||||
|
|
||||||
|
'_POST' => [
|
||||||
|
'password'
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
'providers' => [
|
'providers' => [
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,89 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default Select Value
|
||||||
|
*/
|
||||||
|
'select' => 'id',
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default OrderBy
|
||||||
|
*
|
||||||
|
* * Accepted Values = Array
|
||||||
|
*/
|
||||||
|
'order' => [
|
||||||
|
'column' => 'id',
|
||||||
|
'direction' => 'desc'
|
||||||
|
],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Select distinct records only
|
||||||
|
*
|
||||||
|
* Accepted Values = True || False
|
||||||
|
*/
|
||||||
|
'distinct' => true,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default pagination
|
||||||
|
*
|
||||||
|
* Accepted Value = integer
|
||||||
|
*/
|
||||||
|
// 'pagination' => 10,
|
||||||
|
|
||||||
|
'operators' => [
|
||||||
|
'eq' => "=",
|
||||||
|
'lt' => "<",
|
||||||
|
'gt' => ">",
|
||||||
|
'lte' => "<=",
|
||||||
|
'gte' => ">=",
|
||||||
|
'neqs' => "<>",
|
||||||
|
'neqn' => "!=",
|
||||||
|
'eqo' => "<=>",
|
||||||
|
'like' => "like",
|
||||||
|
'blike' => "like binary",
|
||||||
|
'nlike' => "not like",
|
||||||
|
'ilike' => "ilike",
|
||||||
|
'and' => "&",
|
||||||
|
'bor' => "|",
|
||||||
|
'regex' => "regexp",
|
||||||
|
'notregex' => "not regexp",
|
||||||
|
// 14 => "^",
|
||||||
|
// 15 => "<<",
|
||||||
|
// 16 => ">>",
|
||||||
|
// 17 => "rlike",
|
||||||
|
// 20 => "~",
|
||||||
|
// 21 => "~*",
|
||||||
|
// 22 => "!~",
|
||||||
|
// 23 => "!~*",
|
||||||
|
// 24 => "similar to",
|
||||||
|
// 25 => "not similar to",
|
||||||
|
// 26 => "not ilike",
|
||||||
|
// 27 => "~~*",
|
||||||
|
// 28 => "!~~*"
|
||||||
|
],
|
||||||
|
|
||||||
|
'bindings' => [
|
||||||
|
0 => "select",
|
||||||
|
1 => "from",
|
||||||
|
2 => "join",
|
||||||
|
3 => "where",
|
||||||
|
4 => "having",
|
||||||
|
5 => "order",
|
||||||
|
6 => "union"
|
||||||
|
],
|
||||||
|
|
||||||
|
'selectcomponents' => [
|
||||||
|
0 => "aggregate",
|
||||||
|
1 => "columns",
|
||||||
|
2 => "from",
|
||||||
|
3 => "joins",
|
||||||
|
4 => "wheres",
|
||||||
|
5 => "groups",
|
||||||
|
6 => "havings",
|
||||||
|
7 => "orders",
|
||||||
|
8 => "limit",
|
||||||
|
9 => "offset",
|
||||||
|
10 => "lock",
|
||||||
|
]
|
||||||
|
];
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -1,4 +1,4 @@
|
||||||
{
|
{
|
||||||
"/js/admin.js": "/js/admin.js?id=c70dacdf945a32e04b77",
|
"/js/admin.js": "/js/admin.js?id=c70dacdf945a32e04b77",
|
||||||
"/css/admin.css": "/css/admin.css?id=d40a640933cbcc121f1d"
|
"/css/admin.css": "/css/admin.css?id=3e790c2215bf5c60ac21"
|
||||||
}
|
}
|
||||||
|
|
@ -2,213 +2,156 @@
|
||||||
|
|
||||||
namespace Webkul\Admin\DataGrids;
|
namespace Webkul\Admin\DataGrids;
|
||||||
|
|
||||||
use Illuminate\View\View;
|
use Webkul\Ui\DataGrid\AbsGrid;
|
||||||
use Webkul\Ui\DataGrid\Facades\DataGrid;
|
use DB;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attributes DataGrid
|
* Product Data Grid 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
|
class AttributeDataGrid extends AbsGrid
|
||||||
{
|
{
|
||||||
|
public $allColumns = [];
|
||||||
|
|
||||||
/**
|
public function prepareQueryBuilder()
|
||||||
* The Data Grid implementation for Attributes
|
|
||||||
*/
|
|
||||||
public function createAttributeDataGrid()
|
|
||||||
{
|
{
|
||||||
|
$queryBuilder = DB::table('attributes')->select('id')->addSelect('id', 'code', 'admin_name', 'type', 'is_required', 'is_unique', 'value_per_locale', 'value_per_channel');
|
||||||
|
|
||||||
return DataGrid::make([
|
$this->setQueryBuilder($queryBuilder);
|
||||||
'name' => 'Attributes',
|
}
|
||||||
'table' => 'attributes',
|
|
||||||
'select' => 'id',
|
|
||||||
'perpage' => 10,
|
|
||||||
'aliased' => true,
|
|
||||||
|
|
||||||
'massoperations' => [
|
public function setIndex() {
|
||||||
0 => [
|
$this->index = 'id'; //the column that needs to be treated as index column
|
||||||
'type' => 'delete', //all lower case will be shifted in the configuration file for better control and increased fault tolerance
|
}
|
||||||
'action' => route('admin.catalog.attributes.massdelete'),
|
|
||||||
'method' => 'DELETE'
|
|
||||||
]
|
|
||||||
],
|
|
||||||
|
|
||||||
'actions' => [
|
public function addColumns()
|
||||||
[
|
{
|
||||||
'type' => 'Edit',
|
$this->addColumn([
|
||||||
'route' => 'admin.catalog.attributes.edit',
|
'index' => 'id',
|
||||||
'confirm_text' => 'Do you really want to edit this record?',
|
|
||||||
'icon' => 'icon pencil-lg-icon',
|
|
||||||
], [
|
|
||||||
'type' => 'Delete',
|
|
||||||
'route' => 'admin.catalog.attributes.delete',
|
|
||||||
'confirm_text' => 'Do you really want to delete this record?',
|
|
||||||
'icon' => 'icon trash-icon',
|
|
||||||
],
|
|
||||||
],
|
|
||||||
|
|
||||||
'join' => [],
|
|
||||||
|
|
||||||
//use aliasing on secodary columns if join is performed
|
|
||||||
'columns' => [
|
|
||||||
[
|
|
||||||
'name' => 'id',
|
|
||||||
'alias' => 'attributeId',
|
'alias' => 'attributeId',
|
||||||
'type' => 'number',
|
|
||||||
'label' => 'ID',
|
'label' => 'ID',
|
||||||
'sortable' => true,
|
|
||||||
], [
|
|
||||||
'name' => 'code',
|
|
||||||
'alias' => 'attributeCode',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Code',
|
|
||||||
'sortable' => true,
|
|
||||||
], [
|
|
||||||
'name' => 'admin_name',
|
|
||||||
'alias' => 'attributeAdminName',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Name',
|
|
||||||
'sortable' => true,
|
|
||||||
], [
|
|
||||||
'name' => 'type',
|
|
||||||
'alias' => 'attributeType',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Type',
|
|
||||||
'sortable' => true,
|
|
||||||
], [
|
|
||||||
'name' => 'is_required',
|
|
||||||
'alias' => 'attributeIsRequired',
|
|
||||||
'type' => 'boolean',
|
|
||||||
'label' => 'Required',
|
|
||||||
'sortable' => true,
|
|
||||||
'wrapper' => function ($value) {
|
|
||||||
if($value == 0)
|
|
||||||
return "False";
|
|
||||||
else
|
|
||||||
return "True";
|
|
||||||
},
|
|
||||||
], [
|
|
||||||
'name' => 'is_unique',
|
|
||||||
'alias' => 'attributeIsUnique',
|
|
||||||
'type' => 'boolean',
|
|
||||||
'label' => 'Unique',
|
|
||||||
'sortable' => true,
|
|
||||||
'wrapper' => function ($value) {
|
|
||||||
if($value == 0)
|
|
||||||
return "False";
|
|
||||||
else
|
|
||||||
return "True";
|
|
||||||
},
|
|
||||||
], [
|
|
||||||
'name' => 'value_per_locale',
|
|
||||||
'alias' => 'attributeValuePerLocale',
|
|
||||||
'type' => 'boolean',
|
|
||||||
'label' => 'Locale based',
|
|
||||||
'sortable' => true,
|
|
||||||
'wrapper' => function ($value) {
|
|
||||||
if($value == 0)
|
|
||||||
return "False";
|
|
||||||
else
|
|
||||||
return "True";
|
|
||||||
},
|
|
||||||
], [
|
|
||||||
'name' => 'value_per_channel',
|
|
||||||
'alias' => 'attributeValuePerChannel',
|
|
||||||
'type' => 'boolean',
|
|
||||||
'label' => 'Channel based',
|
|
||||||
'sortable' => true,
|
|
||||||
'wrapper' => function ($value) {
|
|
||||||
if($value == 0)
|
|
||||||
return "False";
|
|
||||||
else
|
|
||||||
return "True";
|
|
||||||
},
|
|
||||||
]
|
|
||||||
],
|
|
||||||
|
|
||||||
'filterable' => [
|
|
||||||
[
|
|
||||||
'column' => 'id',
|
|
||||||
'alias' => 'attributeId',
|
|
||||||
'type' => 'number',
|
'type' => 'number',
|
||||||
'label' => 'ID',
|
'searchable' => false,
|
||||||
], [
|
'sortable' => true,
|
||||||
'column' => 'code',
|
'width' => '40px'
|
||||||
'alias' => 'attributeCode',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Code',
|
|
||||||
], [
|
|
||||||
'column' => 'admin_name',
|
|
||||||
'alias' => 'attributeAdminName',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Name',
|
|
||||||
], [
|
|
||||||
'column' => 'type',
|
|
||||||
'alias' => 'attributeType',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Type',
|
|
||||||
], [
|
|
||||||
'column' => 'is_required',
|
|
||||||
'alias' => 'attributeIsRequired',
|
|
||||||
'type' => 'boolean',
|
|
||||||
'label' => 'Required',
|
|
||||||
], [
|
|
||||||
'column' => 'is_unique',
|
|
||||||
'alias' => 'attributeIsUnique',
|
|
||||||
'type' => 'boolean',
|
|
||||||
'label' => 'Unique',
|
|
||||||
], [
|
|
||||||
'column' => 'value_per_locale',
|
|
||||||
'alias' => 'attributeValuePerLocale',
|
|
||||||
'type' => 'boolean',
|
|
||||||
'label' => 'Locale based',
|
|
||||||
], [
|
|
||||||
'column' => 'value_per_channel',
|
|
||||||
'alias' => 'attributeValuePerChannel',
|
|
||||||
'type' => 'boolean',
|
|
||||||
'label' => 'Channel based',
|
|
||||||
]
|
|
||||||
],
|
|
||||||
|
|
||||||
//don't use aliasing in case of searchables
|
|
||||||
'searchable' => [
|
|
||||||
[
|
|
||||||
'column' => 'code',
|
|
||||||
'alias' => 'attributeCode',
|
|
||||||
'type' => 'string',
|
|
||||||
], [
|
|
||||||
'column' => 'admin_name',
|
|
||||||
'alias' => 'attributeAdminName',
|
|
||||||
'type' => 'string',
|
|
||||||
], [
|
|
||||||
'column' => 'type',
|
|
||||||
'alias' => 'attributeType',
|
|
||||||
'type' => 'string',
|
|
||||||
],
|
|
||||||
],
|
|
||||||
|
|
||||||
//list of viable operators that will be used
|
|
||||||
'operators' => [
|
|
||||||
'eq' => "=",
|
|
||||||
'lt' => "<",
|
|
||||||
'gt' => ">",
|
|
||||||
'lte' => "<=",
|
|
||||||
'gte' => ">=",
|
|
||||||
'neqs' => "<>",
|
|
||||||
'neqn' => "!=",
|
|
||||||
'like' => "like",
|
|
||||||
'nlike' => "not like",
|
|
||||||
],
|
|
||||||
|
|
||||||
// 'css' => []
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
$this->addColumn([
|
||||||
|
'index' => 'code',
|
||||||
|
'alias' => 'attributeCode',
|
||||||
|
'label' => 'Code',
|
||||||
|
'type' => 'string',
|
||||||
|
'searchable' => true,
|
||||||
|
'sortable' => true,
|
||||||
|
'width' => '100px'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->addColumn([
|
||||||
|
'index' => 'admin_name',
|
||||||
|
'alias' => 'attributeAdminName',
|
||||||
|
'label' => 'Name',
|
||||||
|
'type' => 'string',
|
||||||
|
'searchable' => true,
|
||||||
|
'sortable' => true,
|
||||||
|
'width' => '100px'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->addColumn([
|
||||||
|
'index' => 'type',
|
||||||
|
'alias' => 'attributeType',
|
||||||
|
'label' => 'Type',
|
||||||
|
'type' => 'string',
|
||||||
|
'sortable' => true,
|
||||||
|
'searchable' => true,
|
||||||
|
'width' => '100px'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->addColumn([
|
||||||
|
'index' => 'is_required',
|
||||||
|
'alias' => 'attributeRequired',
|
||||||
|
'label' => 'Required',
|
||||||
|
'type' => 'boolean',
|
||||||
|
'sortable' => true,
|
||||||
|
'searchable' => false,
|
||||||
|
'width' => '100px',
|
||||||
|
'wrapper' => function($value){
|
||||||
|
if($value == 1)
|
||||||
|
return 'True';
|
||||||
|
else
|
||||||
|
return 'False';
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->addColumn([
|
||||||
|
'index' => 'is_unique',
|
||||||
|
'alias' => 'attributeIsUnique',
|
||||||
|
'label' => 'Unique',
|
||||||
|
'type' => 'boolean',
|
||||||
|
'sortable' => true,
|
||||||
|
'searchable' => false,
|
||||||
|
'width' => '100px',
|
||||||
|
'wrapper' => function($value){
|
||||||
|
if($value == 1)
|
||||||
|
return 'True';
|
||||||
|
else
|
||||||
|
return 'False';
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->addColumn([
|
||||||
|
'index' => 'value_per_locale',
|
||||||
|
'alias' => 'attributeValuePerLocale',
|
||||||
|
'label' => 'Locale Based',
|
||||||
|
'type' => 'boolean',
|
||||||
|
'sortable' => true,
|
||||||
|
'searchable' => false,
|
||||||
|
'width' => '100px',
|
||||||
|
'wrapper' => function($value){
|
||||||
|
if($value == 1)
|
||||||
|
return 'True';
|
||||||
|
else
|
||||||
|
return 'False';
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->addColumn([
|
||||||
|
'index' => 'value_per_channel',
|
||||||
|
'alias' => 'attributeValuePerChannel',
|
||||||
|
'label' => 'Channel Based',
|
||||||
|
'type' => 'boolean',
|
||||||
|
'sortable' => true,
|
||||||
|
'searchable' => false,
|
||||||
|
'width' => '100px',
|
||||||
|
'wrapper' => function($value){
|
||||||
|
if($value == 1)
|
||||||
|
return 'True';
|
||||||
|
else
|
||||||
|
return 'False';
|
||||||
|
}
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render()
|
public function prepareActions() {
|
||||||
{
|
$this->addAction([
|
||||||
return $this->createAttributeDataGrid()->render();
|
'type' => 'Edit',
|
||||||
|
'route' => 'admin.catalog.attributes.edit',
|
||||||
|
'icon' => 'icon pencil-lg-icon'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->addAction([
|
||||||
|
'type' => 'Delete',
|
||||||
|
'route' => 'admin.catalog.attributes.delete',
|
||||||
|
'icon' => 'icon trash-icon'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function prepareMassActions() {
|
||||||
|
$this->addMassAction([
|
||||||
|
'type' => 'delete',
|
||||||
|
'action' => route('admin.catalog.attributes.massdelete'),
|
||||||
|
'method' => 'DELETE'
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2,143 +2,93 @@
|
||||||
|
|
||||||
namespace Webkul\Admin\DataGrids;
|
namespace Webkul\Admin\DataGrids;
|
||||||
|
|
||||||
use Illuminate\View\View;
|
use Webkul\Ui\DataGrid\AbsGrid;
|
||||||
use Webkul\Ui\DataGrid\Facades\DataGrid;
|
use DB;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attributes Family DataGrid
|
* Product Data Grid 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
|
class AttributeFamilyDataGrid extends AbsGrid
|
||||||
{
|
{
|
||||||
|
public $allColumns = [];
|
||||||
|
|
||||||
/**
|
public function prepareQueryBuilder()
|
||||||
* The Data Grid implementation for Attribute Families
|
|
||||||
*/
|
|
||||||
public function createAttributeFamilyDataGrid()
|
|
||||||
{
|
{
|
||||||
|
$queryBuilder = DB::table('attribute_families')->select('id')->addSelect('id', 'code', 'name');
|
||||||
|
|
||||||
return DataGrid::make([
|
$this->setQueryBuilder($queryBuilder);
|
||||||
'name' => 'Attribute Family',
|
}
|
||||||
'table' => 'attribute_families',
|
|
||||||
'select' => 'id',
|
|
||||||
'perpage' => 10,
|
|
||||||
'aliased' => false, //use this with false as default and true in case of joins
|
|
||||||
|
|
||||||
'massoperations' =>[
|
public function setIndex() {
|
||||||
// [
|
$this->index = 'id'; //the column that needs to be treated as index column
|
||||||
// 'route' => route('admin.datagrid.delete'),
|
}
|
||||||
// 'method' => 'DELETE',
|
|
||||||
// 'label' => 'Delete',
|
|
||||||
// 'type' => 'button',
|
|
||||||
// ],
|
|
||||||
],
|
|
||||||
|
|
||||||
'actions' => [
|
public function addColumns()
|
||||||
[
|
{
|
||||||
'type' => 'Edit',
|
$this->addColumn([
|
||||||
'route' => 'admin.catalog.families.edit',
|
'index' => 'id',
|
||||||
'confirm_text' => 'Do you really want to edit this record?',
|
|
||||||
'icon' => 'icon pencil-lg-icon',
|
|
||||||
], [
|
|
||||||
'type' => 'Delete',
|
|
||||||
'route' => 'admin.catalog.families.delete',
|
|
||||||
'confirm_text' => 'Do you really want to delete this record?',
|
|
||||||
'icon' => 'icon trash-icon',
|
|
||||||
],
|
|
||||||
],
|
|
||||||
|
|
||||||
'join' => [
|
|
||||||
// [
|
|
||||||
// 'join' => 'leftjoin',
|
|
||||||
// 'table' => 'roles as r',
|
|
||||||
// 'primaryKey' => 'u.role_id',
|
|
||||||
// 'condition' => '=',
|
|
||||||
// 'secondaryKey' => 'r.id',
|
|
||||||
// ]
|
|
||||||
],
|
|
||||||
|
|
||||||
//use aliasing on secodary columns if join is performed
|
|
||||||
|
|
||||||
'columns' => [
|
|
||||||
[
|
|
||||||
'name' => 'id',
|
|
||||||
'alias' => 'attributeFamilyId',
|
'alias' => 'attributeFamilyId',
|
||||||
'type' => 'number',
|
|
||||||
'label' => 'ID',
|
'label' => 'ID',
|
||||||
'sortable' => true,
|
|
||||||
], [
|
|
||||||
'name' => 'code',
|
|
||||||
'alias' => 'attributeFamilyCode',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Code',
|
|
||||||
'sortable' => true,
|
|
||||||
], [
|
|
||||||
'name' => 'name',
|
|
||||||
'alias' => 'attributeFamilyName',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Name',
|
|
||||||
'sortable' => true,
|
|
||||||
],
|
|
||||||
],
|
|
||||||
|
|
||||||
'filterable' => [
|
|
||||||
[
|
|
||||||
'column' => 'id',
|
|
||||||
'alias' => 'attributeFamilyId',
|
|
||||||
'type' => 'number',
|
'type' => 'number',
|
||||||
'label' => 'ID',
|
'searchable' => false,
|
||||||
], [
|
'sortable' => true,
|
||||||
'column' => 'code',
|
'width' => '40px'
|
||||||
'alias' => 'attributeFamilyCode',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Code',
|
|
||||||
], [
|
|
||||||
'column' => 'name',
|
|
||||||
'alias' => 'attributeFamilyName',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Name',
|
|
||||||
],
|
|
||||||
],
|
|
||||||
|
|
||||||
//don't use aliasing in case of searchables
|
|
||||||
|
|
||||||
'searchable' => [
|
|
||||||
[
|
|
||||||
'column' => 'name',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Name',
|
|
||||||
], [
|
|
||||||
'column' => 'code',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Code',
|
|
||||||
],
|
|
||||||
],
|
|
||||||
|
|
||||||
//list of viable operators that will be used
|
|
||||||
'operators' => [
|
|
||||||
'eq' => "=",
|
|
||||||
'lt' => "<",
|
|
||||||
'gt' => ">",
|
|
||||||
'lte' => "<=",
|
|
||||||
'gte' => ">=",
|
|
||||||
'neqs' => "<>",
|
|
||||||
'neqn' => "!=",
|
|
||||||
'like' => "like",
|
|
||||||
'nlike' => "not like",
|
|
||||||
],
|
|
||||||
// 'css' => []
|
|
||||||
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
$this->addColumn([
|
||||||
|
'index' => 'code',
|
||||||
|
'alias' => 'attributeFamilyCode',
|
||||||
|
'label' => 'Code',
|
||||||
|
'type' => 'string',
|
||||||
|
'searchable' => true,
|
||||||
|
'sortable' => true,
|
||||||
|
'width' => '100px'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->addColumn([
|
||||||
|
'index' => 'name',
|
||||||
|
'alias' => 'attributeFamilyName',
|
||||||
|
'label' => 'Name',
|
||||||
|
'type' => 'string',
|
||||||
|
'searchable' => true,
|
||||||
|
'sortable' => true,
|
||||||
|
'width' => '100px'
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render()
|
public function prepareActions() {
|
||||||
{
|
$this->addAction([
|
||||||
|
'type' => 'Edit',
|
||||||
|
'route' => 'admin.catalog.families.edit',
|
||||||
|
'icon' => 'icon pencil-lg-icon'
|
||||||
|
]);
|
||||||
|
|
||||||
return $this->createAttributeFamilyDataGrid()->render();
|
$this->addAction([
|
||||||
|
'type' => 'Delete',
|
||||||
|
'route' => 'admin.catalog.families.delete',
|
||||||
|
// 'confirm_text' => trans('ui::app.datagrid.massaction.delete', ['resource' => 'product']),
|
||||||
|
'icon' => 'icon trash-icon'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function prepareMassActions() {
|
||||||
|
// $this->prepareMassAction([
|
||||||
|
// 'type' => 'delete',
|
||||||
|
// 'action' => route('admin.catalog.familites.massdelete'),
|
||||||
|
// 'method' => 'DELETE'
|
||||||
|
// ]);
|
||||||
|
|
||||||
|
// $this->prepareMassAction([
|
||||||
|
// 'type' => 'update',
|
||||||
|
// 'action' => route('admin.catalog.familites.massupdate'),
|
||||||
|
// 'method' => 'PUT',
|
||||||
|
// 'options' => [
|
||||||
|
// 0 => true,
|
||||||
|
// 1 => false,
|
||||||
|
// ]
|
||||||
|
// ]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2,167 +2,119 @@
|
||||||
|
|
||||||
namespace Webkul\Admin\DataGrids;
|
namespace Webkul\Admin\DataGrids;
|
||||||
|
|
||||||
use Illuminate\View\View;
|
use Webkul\Ui\DataGrid\AbsGrid;
|
||||||
use Webkul\Ui\DataGrid\Facades\DataGrid;
|
use DB;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Category DataGrid
|
* Product Data Grid 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
|
class CategoryDataGrid extends AbsGrid
|
||||||
{
|
{
|
||||||
|
public $allColumns = [];
|
||||||
|
|
||||||
/**
|
public function prepareQueryBuilder()
|
||||||
* The Data Grid implementation for category
|
|
||||||
*/
|
|
||||||
public function createCategoryDataGrid()
|
|
||||||
{
|
{
|
||||||
|
$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');
|
||||||
|
|
||||||
return DataGrid::make([
|
$this->setQueryBuilder($queryBuilder);
|
||||||
'name' => 'Categories',
|
}
|
||||||
'table' => 'categories as cat',
|
|
||||||
'select' => 'cat.id',
|
|
||||||
'perpage' => 10,
|
|
||||||
'aliased' => true, //use this with false as default and true in case of joins
|
|
||||||
|
|
||||||
'massoperations' =>[
|
public function setIndex() {
|
||||||
// [
|
$this->index = 'id'; //the column that needs to be treated as index column
|
||||||
// 'route' => route('admin.datagrid.delete'),
|
}
|
||||||
// 'method' => 'DELETE',
|
|
||||||
// 'label' => 'Delete',
|
|
||||||
// 'type' => 'button',
|
|
||||||
// ],
|
|
||||||
],
|
|
||||||
|
|
||||||
'actions' => [
|
public function addColumns()
|
||||||
[
|
{
|
||||||
'type' => 'Edit',
|
$this->addColumn([
|
||||||
'route' => 'admin.catalog.categories.edit',
|
'index' => 'cat.id',
|
||||||
'confirm_text' => 'Do you really want to edit this record?',
|
'alias' => 'catId',
|
||||||
'icon' => 'icon pencil-lg-icon',
|
|
||||||
], [
|
|
||||||
'type' => 'Delete',
|
|
||||||
'route' => 'admin.catalog.categories.delete',
|
|
||||||
'confirm_text' => 'Do you really want to delete this record?',
|
|
||||||
'icon' => 'icon trash-icon',
|
|
||||||
],
|
|
||||||
],
|
|
||||||
|
|
||||||
'join' => [
|
|
||||||
[
|
|
||||||
'join' => 'leftjoin',
|
|
||||||
'table' => 'category_translations as ct',
|
|
||||||
'primaryKey' => 'cat.id',
|
|
||||||
'condition' => '=',
|
|
||||||
'secondaryKey' => 'ct.category_id',
|
|
||||||
],
|
|
||||||
],
|
|
||||||
|
|
||||||
//use aliasing on secodary columns if join is performed
|
|
||||||
|
|
||||||
'columns' => [
|
|
||||||
[
|
|
||||||
'name' => 'cat.id',
|
|
||||||
'alias' => 'catid',
|
|
||||||
'type' => 'number',
|
|
||||||
'label' => 'ID',
|
'label' => 'ID',
|
||||||
|
'type' => 'number',
|
||||||
|
'searchable' => false,
|
||||||
'sortable' => true,
|
'sortable' => true,
|
||||||
], [
|
'width' => '40px'
|
||||||
'name' => 'ct.name',
|
]);
|
||||||
'alias' => 'catname',
|
|
||||||
'type' => 'string',
|
$this->addColumn([
|
||||||
|
'index' => 'ct.name',
|
||||||
|
'alias' => 'catName',
|
||||||
'label' => 'Name',
|
'label' => 'Name',
|
||||||
'sortable' => true,
|
|
||||||
], [
|
|
||||||
'name' => 'cat.position',
|
|
||||||
'alias' => 'catposition',
|
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
|
'searchable' => true,
|
||||||
|
'sortable' => true,
|
||||||
|
'width' => '100px'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->addColumn([
|
||||||
|
'index' => 'cat.position',
|
||||||
|
'alias' => 'catPosition',
|
||||||
'label' => 'Position',
|
'label' => 'Position',
|
||||||
|
'type' => 'string',
|
||||||
|
'searchable' => true,
|
||||||
'sortable' => true,
|
'sortable' => true,
|
||||||
], [
|
'width' => '100px'
|
||||||
'name' => 'cat.status',
|
]);
|
||||||
'alias' => 'catstatus',
|
|
||||||
|
$this->addColumn([
|
||||||
|
'index' => 'cat.status',
|
||||||
|
'alias' => 'catStatus',
|
||||||
|
'label' => 'Status',
|
||||||
'type' => 'boolean',
|
'type' => 'boolean',
|
||||||
'label' => 'Visible in Menu',
|
|
||||||
'sortable' => true,
|
'sortable' => true,
|
||||||
|
'searchable' => true,
|
||||||
|
'width' => '100px',
|
||||||
'wrapper' => function($value){
|
'wrapper' => function($value){
|
||||||
if($value == 0)
|
if($value == 1)
|
||||||
return "False";
|
return 'Active';
|
||||||
else
|
else
|
||||||
return "True";
|
return 'Inactive';
|
||||||
},
|
}
|
||||||
], [
|
]);
|
||||||
'name' => 'ct.locale',
|
|
||||||
'alias' => 'catlocale',
|
$this->addColumn([
|
||||||
'type' => 'string',
|
'index' => 'ct.locale',
|
||||||
|
'alias' => 'catLocale',
|
||||||
'label' => 'Locale',
|
'label' => 'Locale',
|
||||||
'sortable' => true,
|
|
||||||
'filter' => [
|
|
||||||
'function' => 'orWhere',
|
|
||||||
'condition' => ['ct.locale', app()->getLocale()]
|
|
||||||
],
|
|
||||||
]
|
|
||||||
],
|
|
||||||
|
|
||||||
'filterable' => [
|
|
||||||
[
|
|
||||||
'column' => 'cat.id',
|
|
||||||
'alias' => 'catid',
|
|
||||||
'type' => 'number',
|
|
||||||
'label' => 'ID',
|
|
||||||
], [
|
|
||||||
'column' => 'ct.name',
|
|
||||||
'alias' => 'catname',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Name',
|
|
||||||
], [
|
|
||||||
'column' => 'cat.status',
|
|
||||||
'alias' => 'catstatus',
|
|
||||||
'type' => 'boolean',
|
'type' => 'boolean',
|
||||||
'label' => 'Visible in Menu',
|
'sortable' => true,
|
||||||
],
|
'searchable' => false,
|
||||||
],
|
'width' => '100px'
|
||||||
|
|
||||||
//don't use aliasing in case of searchables
|
|
||||||
|
|
||||||
'searchable' => [
|
|
||||||
[
|
|
||||||
'column' => 'cat.id',
|
|
||||||
'type' => 'number',
|
|
||||||
'label' => 'ID',
|
|
||||||
], [
|
|
||||||
'column' => 'ct.name',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Name',
|
|
||||||
], [
|
|
||||||
'column' => 'cat.status',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Visible in Menu',
|
|
||||||
]
|
|
||||||
],
|
|
||||||
|
|
||||||
//list of viable operators that will be used
|
|
||||||
'operators' => [
|
|
||||||
'eq' => "=",
|
|
||||||
'lt' => "<",
|
|
||||||
'gt' => ">",
|
|
||||||
'lte' => "<=",
|
|
||||||
'gte' => ">=",
|
|
||||||
'neqs' => "<>",
|
|
||||||
'neqn' => "!=",
|
|
||||||
'like' => "like",
|
|
||||||
'nlike' => "not like",
|
|
||||||
],
|
|
||||||
// 'css' => []
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render()
|
public function prepareActions() {
|
||||||
{
|
$this->addAction([
|
||||||
return $this->createCategoryDataGrid()->render();
|
'type' => 'Edit',
|
||||||
|
'route' => 'admin.catalog.products.edit',
|
||||||
|
'icon' => 'icon pencil-lg-icon'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->addAction([
|
||||||
|
'type' => 'Delete',
|
||||||
|
'route' => 'admin.catalog.products.delete',
|
||||||
|
'confirm_text' => trans('ui::app.datagrid.massaction.delete', ['resource' => 'product']),
|
||||||
|
'icon' => 'icon trash-icon'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function prepareMassActions() {
|
||||||
|
// $this->prepareMassAction([
|
||||||
|
// 'type' => 'delete',
|
||||||
|
// 'action' => route('admin.catalog.products.massdelete'),
|
||||||
|
// 'method' => 'DELETE'
|
||||||
|
// ]);
|
||||||
|
|
||||||
|
// $this->prepareMassAction([
|
||||||
|
// 'type' => 'update',
|
||||||
|
// 'action' => route('admin.catalog.products.massupdate'),
|
||||||
|
// 'method' => 'PUT',
|
||||||
|
// 'options' => [
|
||||||
|
// 0 => true,
|
||||||
|
// 1 => false,
|
||||||
|
// ]
|
||||||
|
// ]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2,157 +2,103 @@
|
||||||
|
|
||||||
namespace Webkul\Admin\DataGrids;
|
namespace Webkul\Admin\DataGrids;
|
||||||
|
|
||||||
use Illuminate\View\View;
|
use Webkul\Ui\DataGrid\AbsGrid;
|
||||||
use Webkul\Ui\DataGrid\Facades\DataGrid;
|
use DB;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Channels DataGrid
|
* Channel Data Grid 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
|
class ChannelDataGrid extends AbsGrid
|
||||||
{
|
{
|
||||||
|
public $allColumns = [];
|
||||||
|
|
||||||
/**
|
public function prepareQueryBuilder()
|
||||||
* The Data Grid implementation for channel
|
|
||||||
*/
|
|
||||||
public function createChannelsDataGrid()
|
|
||||||
{
|
{
|
||||||
|
$queryBuilder = DB::table('channels')->addSelect('id', 'code', 'name', 'hostname');
|
||||||
|
|
||||||
return DataGrid::make([
|
$this->setQueryBuilder($queryBuilder);
|
||||||
'name' => 'Channels',
|
}
|
||||||
'table' => 'channels',
|
|
||||||
'select' => 'id',
|
|
||||||
'perpage' => 10,
|
|
||||||
'aliased' => false, //use this with false as default and true in case of joins
|
|
||||||
|
|
||||||
'massoperations' =>[
|
public function setIndex() {
|
||||||
// [
|
$this->index = 'id'; //the column that needs to be treated as index column
|
||||||
// 'route' => route('admin.datagrid.delete'),
|
}
|
||||||
// 'method' => 'DELETE',
|
|
||||||
// 'label' => 'Delete',
|
|
||||||
// 'type' => 'button',
|
|
||||||
// ],
|
|
||||||
],
|
|
||||||
|
|
||||||
'actions' => [
|
public function addColumns()
|
||||||
[
|
{
|
||||||
'type' => 'Edit',
|
$this->addColumn([
|
||||||
'route' => 'admin.channels.edit',
|
'index' => 'id',
|
||||||
'confirm_text' => 'Do you really want to edit this record?',
|
'alias' => 'channelId',
|
||||||
'icon' => 'icon pencil-lg-icon',
|
|
||||||
], [
|
|
||||||
'type' => 'Delete',
|
|
||||||
'route' => 'admin.channels.delete',
|
|
||||||
'confirm_text' => 'Do you really want to delete this record?',
|
|
||||||
'icon' => 'icon trash-icon',
|
|
||||||
],
|
|
||||||
],
|
|
||||||
|
|
||||||
'join' => [
|
|
||||||
// [
|
|
||||||
// 'join' => 'leftjoin',
|
|
||||||
// 'table' => 'roles as r',
|
|
||||||
// 'primaryKey' => 'u.role_id',
|
|
||||||
// 'condition' => '=',
|
|
||||||
// 'secondaryKey' => 'r.id',
|
|
||||||
// ]
|
|
||||||
],
|
|
||||||
|
|
||||||
//use aliasing on secodary columns if join is performed
|
|
||||||
|
|
||||||
'columns' => [
|
|
||||||
[
|
|
||||||
'name' => 'id',
|
|
||||||
'alias' => 'channelID',
|
|
||||||
'type' => 'number',
|
|
||||||
'label' => 'ID',
|
'label' => 'ID',
|
||||||
'sortable' => true,
|
|
||||||
], [
|
|
||||||
'name' => 'code',
|
|
||||||
'alias' => 'channelCode',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Code',
|
|
||||||
'sortable' => true,
|
|
||||||
], [
|
|
||||||
'name' => 'name',
|
|
||||||
'alias' => 'channelName',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Name',
|
|
||||||
'sortable' => true,
|
|
||||||
], [
|
|
||||||
'name' => 'hostname',
|
|
||||||
'alias' => 'channelHostName',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Host Name',
|
|
||||||
'sortable' => true,
|
|
||||||
],
|
|
||||||
],
|
|
||||||
|
|
||||||
//don't use aliasing in case of filters
|
|
||||||
'filterable' => [
|
|
||||||
[
|
|
||||||
'column' => 'id',
|
|
||||||
'alias' => 'channelID',
|
|
||||||
'type' => 'number',
|
'type' => 'number',
|
||||||
'label' => 'ID',
|
'searchable' => false,
|
||||||
], [
|
'sortable' => true,
|
||||||
'column' => 'code',
|
'width' => '40px'
|
||||||
'alias' => 'channelCode',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Code',
|
|
||||||
], [
|
|
||||||
'column' => 'name',
|
|
||||||
'alias' => 'channelName',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Name',
|
|
||||||
],
|
|
||||||
],
|
|
||||||
|
|
||||||
//don't use aliasing in case of searchables
|
|
||||||
|
|
||||||
'searchable' => [
|
|
||||||
[
|
|
||||||
'column' => 'name',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Name',
|
|
||||||
], [
|
|
||||||
'column' => 'code',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Code',
|
|
||||||
], [
|
|
||||||
'column' => 'hostname',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Host Name',
|
|
||||||
], [
|
|
||||||
'column' => 'name',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Name',
|
|
||||||
],
|
|
||||||
],
|
|
||||||
|
|
||||||
//list of viable operators that will be used
|
|
||||||
'operators' => [
|
|
||||||
'eq' => "=",
|
|
||||||
'lt' => "<",
|
|
||||||
'gt' => ">",
|
|
||||||
'lte' => "<=",
|
|
||||||
'gte' => ">=",
|
|
||||||
'neqs' => "<>",
|
|
||||||
'neqn' => "!=",
|
|
||||||
'like' => "like",
|
|
||||||
'nlike' => "not like",
|
|
||||||
],
|
|
||||||
// 'css' => []
|
|
||||||
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
$this->addColumn([
|
||||||
|
'index' => 'code',
|
||||||
|
'alias' => 'channelCode',
|
||||||
|
'label' => 'Code',
|
||||||
|
'type' => 'string',
|
||||||
|
'searchable' => true,
|
||||||
|
'sortable' => true,
|
||||||
|
'width' => '100px'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->addColumn([
|
||||||
|
'index' => 'name',
|
||||||
|
'alias' => 'channelName',
|
||||||
|
'label' => 'Name',
|
||||||
|
'type' => 'string',
|
||||||
|
'searchable' => true,
|
||||||
|
'sortable' => true,
|
||||||
|
'width' => '100px'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->addColumn([
|
||||||
|
'index' => 'hostname',
|
||||||
|
'alias' => 'channelHostname',
|
||||||
|
'label' => 'Hostname',
|
||||||
|
'type' => 'string',
|
||||||
|
'sortable' => true,
|
||||||
|
'searchable' => true,
|
||||||
|
'width' => '100px'
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render()
|
public function prepareActions() {
|
||||||
{
|
$this->addAction([
|
||||||
return $this->createChannelsDataGrid()->render();
|
'type' => 'Edit',
|
||||||
|
'route' => 'admin.channels.edit',
|
||||||
|
'icon' => 'icon pencil-lg-icon'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->addAction([
|
||||||
|
'type' => 'Delete',
|
||||||
|
'route' => 'admin.channels.delete',
|
||||||
|
'confirm_text' => trans('ui::app.datagrid.massaction.delete', ['resource' => 'product']),
|
||||||
|
'icon' => 'icon trash-icon'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function prepareMassActions() {
|
||||||
|
// $this->prepareMassAction([
|
||||||
|
// 'type' => 'delete',
|
||||||
|
// 'action' => route('admin.catalog.products.massdelete'),
|
||||||
|
// 'method' => 'DELETE'
|
||||||
|
// ]);
|
||||||
|
|
||||||
|
// $this->prepareMassAction([
|
||||||
|
// 'type' => 'update',
|
||||||
|
// 'action' => route('admin.catalog.products.massupdate'),
|
||||||
|
// 'method' => 'PUT',
|
||||||
|
// 'options' => [
|
||||||
|
// 0 => true,
|
||||||
|
// 1 => false,
|
||||||
|
// ]
|
||||||
|
// ]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2,165 +2,112 @@
|
||||||
|
|
||||||
namespace Webkul\Admin\DataGrids;
|
namespace Webkul\Admin\DataGrids;
|
||||||
|
|
||||||
use Illuminate\View\View;
|
use Webkul\Ui\DataGrid\AbsGrid;
|
||||||
use Webkul\Ui\DataGrid\Facades\DataGrid;
|
use DB;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Countries DataGrid
|
* Product Data Grid 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 CountryDataGrid
|
class CountryDataGrid extends AbsGrid
|
||||||
{
|
{
|
||||||
|
public $allColumns = [];
|
||||||
|
|
||||||
/**
|
public function prepareQueryBuilder()
|
||||||
* The Data Grid implementation for countries
|
|
||||||
*/
|
|
||||||
public function createCountryDataGrid()
|
|
||||||
{
|
{
|
||||||
|
$queryBuilder = DB::table('countries')->select('id')->addSelect($this->columns);
|
||||||
|
|
||||||
return DataGrid::make([
|
$this->setQueryBuilder($queryBuilder);
|
||||||
'name' => 'Countries',
|
}
|
||||||
'table' => 'countries',
|
|
||||||
'select' => 'id',
|
|
||||||
'perpage' => 10,
|
|
||||||
'aliased' => false, //use this with false as default and true in case of joins
|
|
||||||
|
|
||||||
'massoperations' =>[
|
public function addColumns()
|
||||||
// [
|
{
|
||||||
// 'route' => route('admin.datagrid.delete'),
|
$this->addColumn([
|
||||||
// 'method' => 'DELETE',
|
|
||||||
// 'label' => 'Delete',
|
|
||||||
// 'type' => 'button',
|
|
||||||
// ],
|
|
||||||
],
|
|
||||||
|
|
||||||
'actions' => [
|
|
||||||
[
|
|
||||||
'type' => 'Edit',
|
|
||||||
'route' => route('admin.datagrid.delete'),
|
|
||||||
'confirm_text' => 'Do you really want to edit this record?',
|
|
||||||
'icon' => 'icon pencil-lg-icon',
|
|
||||||
], [
|
|
||||||
'type' => 'Delete',
|
|
||||||
'route' => route('admin.datagrid.delete'),
|
|
||||||
'confirm_text' => 'Do you really want to delete this record?',
|
|
||||||
'icon' => 'icon trash-icon',
|
|
||||||
],
|
|
||||||
],
|
|
||||||
|
|
||||||
'join' => [
|
|
||||||
// [
|
|
||||||
// 'join' => 'leftjoin',
|
|
||||||
// 'table' => 'roles as r',
|
|
||||||
// 'primaryKey' => 'u.role_id',
|
|
||||||
// 'condition' => '=',
|
|
||||||
// 'secondaryKey' => 'r.id',
|
|
||||||
// ]
|
|
||||||
],
|
|
||||||
|
|
||||||
//use aliasing on secodary columns if join is performed
|
|
||||||
|
|
||||||
'columns' => [
|
|
||||||
[
|
|
||||||
'name' => 'id',
|
|
||||||
'alias' => 'countryId',
|
|
||||||
'type' => 'number',
|
|
||||||
'label' => 'ID',
|
|
||||||
'sortable' => true,
|
|
||||||
], [
|
|
||||||
'name' => 'code',
|
|
||||||
'alias' => 'countryCode',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Code',
|
|
||||||
'sortable' => true,
|
|
||||||
], [
|
|
||||||
'name' => 'name',
|
|
||||||
'alias' => 'countryName',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Name',
|
|
||||||
'sortable' => true,
|
|
||||||
], [
|
|
||||||
'name' => 'status',
|
|
||||||
'alias' => 'countryStatus',
|
|
||||||
'type' => 'number',
|
|
||||||
'label' => 'Code',
|
|
||||||
'sortable' => true,
|
|
||||||
],
|
|
||||||
|
|
||||||
],
|
|
||||||
|
|
||||||
//don't use aliasing in case of filters
|
|
||||||
'filterable' => [
|
|
||||||
[
|
|
||||||
'column' => 'id',
|
'column' => 'id',
|
||||||
'alias' => 'countryId',
|
'alias' => 'countryId',
|
||||||
'type' => 'number',
|
|
||||||
'label' => 'ID',
|
'label' => 'ID',
|
||||||
], [
|
|
||||||
'column' => 'code',
|
|
||||||
'alias' => 'countryCode',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Code',
|
|
||||||
], [
|
|
||||||
'column' => 'name',
|
|
||||||
'alias' => 'countryName',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Name',
|
|
||||||
], [
|
|
||||||
'column' => 'status',
|
|
||||||
'alias' => 'countryStatus',
|
|
||||||
'type' => 'number',
|
'type' => 'number',
|
||||||
'label' => 'Code',
|
'searchable' => false,
|
||||||
],
|
'sortable' => true,
|
||||||
],
|
'width' => '40px'
|
||||||
|
|
||||||
//don't use aliasing in case of searchables
|
|
||||||
|
|
||||||
'searchable' => [
|
|
||||||
[
|
|
||||||
'column' => 'name',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Name',
|
|
||||||
], [
|
|
||||||
'column' => 'code',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Code',
|
|
||||||
], [
|
|
||||||
'column' => 'name',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Name',
|
|
||||||
], [
|
|
||||||
'column' => 'status',
|
|
||||||
'type' => 'number',
|
|
||||||
'label' => 'Code',
|
|
||||||
]
|
|
||||||
],
|
|
||||||
|
|
||||||
//list of viable operators that will be used
|
|
||||||
'operators' => [
|
|
||||||
'eq' => "=",
|
|
||||||
'lt' => "<",
|
|
||||||
'gt' => ">",
|
|
||||||
'lte' => "<=",
|
|
||||||
'gte' => ">=",
|
|
||||||
'neqs' => "<>",
|
|
||||||
'neqn' => "!=",
|
|
||||||
'like' => "like",
|
|
||||||
'nlike' => "not like",
|
|
||||||
],
|
|
||||||
// 'css' => []
|
|
||||||
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
$this->addColumn([
|
||||||
|
'column' => 'code',
|
||||||
|
'alias' => 'countryCode',
|
||||||
|
'label' => 'Code',
|
||||||
|
'type' => 'string',
|
||||||
|
'searchable' => true,
|
||||||
|
'sortable' => true,
|
||||||
|
'width' => '100px'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->addColumn([
|
||||||
|
'column' => 'name',
|
||||||
|
'alias' => 'countryName',
|
||||||
|
'label' => 'Name',
|
||||||
|
'type' => 'string',
|
||||||
|
'searchable' => true,
|
||||||
|
'sortable' => true,
|
||||||
|
'width' => '100px'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->addColumn([
|
||||||
|
'column' => 'status',
|
||||||
|
'alias' => 'countryStatus',
|
||||||
|
'label' => 'Status',
|
||||||
|
'type' => 'number',
|
||||||
|
'sortable' => true,
|
||||||
|
'searchable' => true,
|
||||||
|
'width' => '100px'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function prepareActions() {
|
||||||
|
$this->prepareAction([
|
||||||
|
'type' => 'Edit',
|
||||||
|
'route' => 'admin.catalog.products.edit',
|
||||||
|
'icon' => 'icon pencil-lg-icon'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->prepareAction([
|
||||||
|
'type' => 'Delete',
|
||||||
|
'route' => 'admin.catalog.products.delete',
|
||||||
|
'confirm_text' => trans('ui::app.datagrid.massaction.delete', ['resource' => 'product']),
|
||||||
|
'icon' => 'icon trash-icon'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function prepareMassActions() {
|
||||||
|
// $this->prepareMassAction([
|
||||||
|
// 'type' => 'delete',
|
||||||
|
// 'action' => route('admin.catalog.products.massdelete'),
|
||||||
|
// 'method' => 'DELETE'
|
||||||
|
// ]);
|
||||||
|
|
||||||
|
// $this->prepareMassAction([
|
||||||
|
// 'type' => 'update',
|
||||||
|
// 'action' => route('admin.catalog.products.massupdate'),
|
||||||
|
// 'method' => 'PUT',
|
||||||
|
// 'options' => [
|
||||||
|
// 0 => true,
|
||||||
|
// 1 => false,
|
||||||
|
// ]
|
||||||
|
// ]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render()
|
public function render()
|
||||||
{
|
{
|
||||||
|
$this->addColumns();
|
||||||
|
|
||||||
return $this->createCountryDataGrid()->render();
|
$this->prepareActions();
|
||||||
|
|
||||||
|
$this->prepareMassActions();
|
||||||
|
|
||||||
|
$this->prepareQueryBuilder();
|
||||||
|
|
||||||
|
return view('ui::testgrid.table')->with('results', ['records' => $this->getCollection(), 'columns' => $this->allColumns, 'actions' => $this->actions, 'massactions' => $this->massActions]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2,146 +2,92 @@
|
||||||
|
|
||||||
namespace Webkul\Admin\DataGrids;
|
namespace Webkul\Admin\DataGrids;
|
||||||
|
|
||||||
use Illuminate\View\View;
|
use Webkul\Ui\DataGrid\AbsGrid;
|
||||||
use Webkul\Ui\DataGrid\Facades\DataGrid;
|
use DB;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Currencies DataGrid
|
* Currency Data Grid 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
|
class CurrencyDataGrid extends AbsGrid
|
||||||
{
|
{
|
||||||
|
public $allColumns = [];
|
||||||
|
|
||||||
/**
|
public function prepareQueryBuilder()
|
||||||
* The Data Grid implementation for currencies
|
|
||||||
*/
|
|
||||||
public function createCurrencyDataGrid()
|
|
||||||
{
|
{
|
||||||
|
$queryBuilder = DB::table('currencies')->addSelect('id', 'name', 'code');
|
||||||
|
|
||||||
return DataGrid::make([
|
$this->setQueryBuilder($queryBuilder);
|
||||||
'name' => 'Currencies',
|
}
|
||||||
'table' => 'currencies',
|
|
||||||
'select' => 'id',
|
|
||||||
'perpage' => 10,
|
|
||||||
'aliased' => false, //use this with false as default and true in case of joins
|
|
||||||
|
|
||||||
'massoperations' =>[
|
public function setIndex() {
|
||||||
0 => [
|
$this->index = 'id'; //the column that needs to be treated as index column
|
||||||
'type' => 'delete', //all lower case will be shifted in the configuration file for better control and increased fault tolerance
|
}
|
||||||
'action' => route('admin.currencies.massdelete'),
|
|
||||||
'method' => 'DELETE'
|
|
||||||
]
|
|
||||||
],
|
|
||||||
|
|
||||||
'actions' => [
|
public function addColumns()
|
||||||
[
|
{
|
||||||
'type' => 'Edit',
|
$this->addColumn([
|
||||||
'route' => 'admin.currencies.edit',
|
'index' => 'id',
|
||||||
// 'confirm_text' => 'Do you really want to edit this record?',
|
|
||||||
'icon' => 'icon pencil-lg-icon',
|
|
||||||
], [
|
|
||||||
'type' => 'Delete',
|
|
||||||
'route' => 'admin.currencies.delete',
|
|
||||||
'confirm_text' => 'Do you really want to delete this record?',
|
|
||||||
'icon' => 'icon trash-icon',
|
|
||||||
],
|
|
||||||
],
|
|
||||||
|
|
||||||
'join' => [
|
|
||||||
// [
|
|
||||||
// 'join' => 'leftjoin',
|
|
||||||
// 'table' => 'roles as r',
|
|
||||||
// 'primaryKey' => 'u.role_id',
|
|
||||||
// 'condition' => '=',
|
|
||||||
// 'secondaryKey' => 'r.id',
|
|
||||||
// ]
|
|
||||||
],
|
|
||||||
|
|
||||||
//use aliasing on secodary columns if join is performed
|
|
||||||
'columns' => [
|
|
||||||
[
|
|
||||||
'name' => 'id',
|
|
||||||
'alias' => 'currencyId',
|
'alias' => 'currencyId',
|
||||||
'type' => 'number',
|
|
||||||
'label' => 'ID',
|
'label' => 'ID',
|
||||||
'sortable' => true,
|
|
||||||
], [
|
|
||||||
'name' => 'code',
|
|
||||||
'alias' => 'currencyCode',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Code',
|
|
||||||
'sortable' => true,
|
|
||||||
], [
|
|
||||||
'name' => 'name',
|
|
||||||
'alias' => 'currencyName',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Name',
|
|
||||||
'sortable' => true,
|
|
||||||
],
|
|
||||||
|
|
||||||
],
|
|
||||||
|
|
||||||
//don't use aliasing in case of filters
|
|
||||||
|
|
||||||
'filterable' => [
|
|
||||||
[
|
|
||||||
'column' => 'id',
|
|
||||||
'alias' => 'currencyId',
|
|
||||||
'type' => 'number',
|
'type' => 'number',
|
||||||
'label' => 'ID',
|
'searchable' => false,
|
||||||
], [
|
'sortable' => true,
|
||||||
'column' => 'code',
|
'width' => '40px'
|
||||||
'alias' => 'currencyCode',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Code',
|
|
||||||
], [
|
|
||||||
'column' => 'name',
|
|
||||||
'alias' => 'currencyName',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Name',
|
|
||||||
],
|
|
||||||
],
|
|
||||||
|
|
||||||
//don't use aliasing in case of searchables
|
|
||||||
|
|
||||||
'searchable' => [
|
|
||||||
[
|
|
||||||
'column' => 'id',
|
|
||||||
'alias' => 'currencyId',
|
|
||||||
'type' => 'number',
|
|
||||||
], [
|
|
||||||
'column' => 'name',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Name',
|
|
||||||
], [
|
|
||||||
'column' => 'code',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Code',
|
|
||||||
],
|
|
||||||
],
|
|
||||||
|
|
||||||
//list of viable operators that will be used
|
|
||||||
'operators' => [
|
|
||||||
'eq' => "=",
|
|
||||||
'lt' => "<",
|
|
||||||
'gt' => ">",
|
|
||||||
'lte' => "<=",
|
|
||||||
'gte' => ">=",
|
|
||||||
'neqs' => "<>",
|
|
||||||
'neqn' => "!=",
|
|
||||||
'like' => "like",
|
|
||||||
'nlike' => "not like",
|
|
||||||
],
|
|
||||||
// 'css' => []
|
|
||||||
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
$this->addColumn([
|
||||||
|
'index' => 'name',
|
||||||
|
'alias' => 'currencyName',
|
||||||
|
'label' => 'Name',
|
||||||
|
'type' => 'string',
|
||||||
|
'searchable' => true,
|
||||||
|
'sortable' => true,
|
||||||
|
'width' => '100px'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->addColumn([
|
||||||
|
'index' => 'code',
|
||||||
|
'alias' => 'currencyCode',
|
||||||
|
'label' => 'Code',
|
||||||
|
'type' => 'string',
|
||||||
|
'searchable' => true,
|
||||||
|
'sortable' => true,
|
||||||
|
'width' => '100px'
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render()
|
public function prepareActions() {
|
||||||
{
|
$this->addAction([
|
||||||
return $this->createCurrencyDataGrid()->render();
|
'type' => 'Edit',
|
||||||
|
'route' => 'admin.currencies.edit',
|
||||||
|
'icon' => 'icon pencil-lg-icon'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->addAction([
|
||||||
|
'type' => 'Delete',
|
||||||
|
'route' => 'admin.currencies.delete',
|
||||||
|
'icon' => 'icon trash-icon'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function prepareMassActions() {
|
||||||
|
// $this->prepareMassAction([
|
||||||
|
// 'type' => 'delete',
|
||||||
|
// 'action' => route('admin.catalog.products.massdelete'),
|
||||||
|
// 'method' => 'DELETE'
|
||||||
|
// ]);
|
||||||
|
|
||||||
|
// $this->prepareMassAction([
|
||||||
|
// 'type' => 'update',
|
||||||
|
// 'action' => route('admin.catalog.products.massupdate'),
|
||||||
|
// 'method' => 'PUT',
|
||||||
|
// 'options' => [
|
||||||
|
// 0 => true,
|
||||||
|
// 1 => false,
|
||||||
|
// ]
|
||||||
|
// ]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2,154 +2,103 @@
|
||||||
|
|
||||||
namespace Webkul\Admin\DataGrids;
|
namespace Webkul\Admin\DataGrids;
|
||||||
|
|
||||||
use Illuminate\View\View;
|
use Webkul\Ui\DataGrid\AbsGrid;
|
||||||
use Webkul\Ui\DataGrid\Facades\DataGrid;
|
use DB;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Customer DataGrid
|
* Currency Data Grid class
|
||||||
*
|
*
|
||||||
* @author Rahul Shukla <rahulshukla.symfony517@webkul.com> @rahul-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
|
class CustomerDataGrid extends AbsGrid
|
||||||
{
|
{
|
||||||
|
public $allColumns = [];
|
||||||
|
|
||||||
/**
|
public function prepareQueryBuilder()
|
||||||
* The CustomerDataGrid implementation.
|
|
||||||
*/
|
|
||||||
public function createCustomerDataGrid()
|
|
||||||
{
|
{
|
||||||
|
$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');
|
||||||
|
|
||||||
return DataGrid::make([
|
$this->setQueryBuilder($queryBuilder);
|
||||||
'name' => 'Customer',
|
}
|
||||||
'table' => 'customers as cus',
|
|
||||||
'select' => 'cus.id',
|
|
||||||
'perpage' => 10,
|
|
||||||
'aliased' => true, //use this with false as default and true in case of joins
|
|
||||||
|
|
||||||
'massoperations' =>[
|
public function setIndex() {
|
||||||
// [
|
$this->index = 'id'; //the column that needs to be treated as index column
|
||||||
// 'route' => route('admin.datagrid.delete'),
|
}
|
||||||
// 'method' => 'DELETE',
|
|
||||||
// 'label' => 'Delete',
|
|
||||||
// 'type' => 'button', //select || button only
|
|
||||||
// ],
|
|
||||||
],
|
|
||||||
|
|
||||||
'actions' => [
|
public function addColumns()
|
||||||
[
|
{
|
||||||
'type' => 'Edit',
|
$this->addColumn([
|
||||||
'route' => 'admin.customer.edit',
|
'index' => 'cus.id',
|
||||||
'confirm_text' => 'Do you really want to edit this record?',
|
'alias' => 'customerId',
|
||||||
'icon' => 'icon pencil-lg-icon',
|
|
||||||
], [
|
|
||||||
'type' => 'Delete',
|
|
||||||
'route' => 'admin.customer.delete',
|
|
||||||
'confirm_text' => 'Do you really want to delete this record?',
|
|
||||||
'icon' => 'icon trash-icon',
|
|
||||||
],
|
|
||||||
],
|
|
||||||
|
|
||||||
'join' => [
|
|
||||||
[
|
|
||||||
'join' => 'leftjoin',
|
|
||||||
'table' => 'customer_groups as cg',
|
|
||||||
'primaryKey' => 'cus.customer_group_id',
|
|
||||||
'condition' => '=',
|
|
||||||
'secondaryKey' => 'cg.id',
|
|
||||||
]
|
|
||||||
],
|
|
||||||
|
|
||||||
//use aliasing on secodary columns if join is performed
|
|
||||||
'columns' => [
|
|
||||||
[
|
|
||||||
'name' => 'cus.id',
|
|
||||||
'alias' => 'ID',
|
|
||||||
'type' => 'number',
|
|
||||||
'label' => 'ID',
|
'label' => 'ID',
|
||||||
'sortable' => true,
|
|
||||||
], [
|
|
||||||
'name' => 'CONCAT(first_name, " ", last_name)',
|
|
||||||
'alias' => 'Name',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Name',
|
|
||||||
'sortable' => true,
|
|
||||||
], [
|
|
||||||
'name' => 'email',
|
|
||||||
'alias' => 'Email',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Email',
|
|
||||||
'sortable' => false,
|
|
||||||
], [
|
|
||||||
'name' => 'cg.name',
|
|
||||||
'alias' => 'CustomerGroupName',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Group Name',
|
|
||||||
'sortable' => false,
|
|
||||||
],
|
|
||||||
],
|
|
||||||
|
|
||||||
//don't use aliasing in case of filters
|
|
||||||
'filterable' => [
|
|
||||||
[
|
|
||||||
'column' => 'cus.id',
|
|
||||||
'alias' => 'ID',
|
|
||||||
'type' => 'number',
|
'type' => 'number',
|
||||||
'label' => 'ID',
|
'searchable' => false,
|
||||||
], [
|
'sortable' => true,
|
||||||
'column' => 'email',
|
'width' => '40px'
|
||||||
'alias' => 'Email',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Email',
|
|
||||||
], [
|
|
||||||
'column' => 'cg.name',
|
|
||||||
'alias' => 'CustomerGroupName',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Group Name',
|
|
||||||
], [
|
|
||||||
'column' => 'CONCAT(first_name, " ", last_name)',
|
|
||||||
'alias' => 'Name',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Name',
|
|
||||||
],
|
|
||||||
],
|
|
||||||
|
|
||||||
//don't use aliasing in case of searchables
|
|
||||||
|
|
||||||
'searchable' => [
|
|
||||||
[
|
|
||||||
'column' => 'FirstName',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'First Name',
|
|
||||||
], [
|
|
||||||
'column' => 'email',
|
|
||||||
'alias' => 'Email',
|
|
||||||
'type' => 'string',
|
|
||||||
],
|
|
||||||
],
|
|
||||||
|
|
||||||
//list of viable operators that will be used
|
|
||||||
'operators' => [
|
|
||||||
'eq' => "=",
|
|
||||||
'lt' => "<",
|
|
||||||
'gt' => ">",
|
|
||||||
'lte' => "<=",
|
|
||||||
'gte' => ">=",
|
|
||||||
'neqs' => "<>",
|
|
||||||
'neqn' => "!=",
|
|
||||||
'like' => "like",
|
|
||||||
'nlike' => "not like",
|
|
||||||
],
|
|
||||||
// 'css' => []
|
|
||||||
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
$this->addColumn([
|
||||||
|
// 'column' => 'CONCAT(cus.first_name, " ", cus.last_name)',
|
||||||
|
'index' => 'cus.first_name',
|
||||||
|
'alias' => 'customerFullName',
|
||||||
|
'label' => 'Name',
|
||||||
|
'type' => 'string',
|
||||||
|
'searchable' => true,
|
||||||
|
'sortable' => true,
|
||||||
|
'width' => '100px'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->addColumn([
|
||||||
|
'index' => 'cus.email',
|
||||||
|
'alias' => 'customerEmail',
|
||||||
|
'label' => 'Email',
|
||||||
|
'type' => 'string',
|
||||||
|
'searchable' => true,
|
||||||
|
'sortable' => true,
|
||||||
|
'width' => '100px'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->addColumn([
|
||||||
|
'index' => 'cg.name',
|
||||||
|
'alias' => 'customerGroupName',
|
||||||
|
'label' => 'Group',
|
||||||
|
'type' => 'string',
|
||||||
|
'searchable' => false,
|
||||||
|
'sortable' => true,
|
||||||
|
'width' => '100px'
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render($pagination = true)
|
public function prepareActions() {
|
||||||
{
|
$this->addAction([
|
||||||
|
'type' => 'Edit',
|
||||||
|
'route' => 'admin.customer.edit',
|
||||||
|
'icon' => 'icon pencil-lg-icon'
|
||||||
|
]);
|
||||||
|
|
||||||
return $this->createCustomerDataGrid()->render($pagination);
|
$this->addAction([
|
||||||
|
'type' => 'Delete',
|
||||||
|
'route' => 'admin.customer.delete',
|
||||||
|
'icon' => 'icon trash-icon'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function prepareMassActions() {
|
||||||
|
// $this->prepareMassAction([
|
||||||
|
// 'type' => 'delete',
|
||||||
|
// 'action' => route('admin.catalog.products.massdelete'),
|
||||||
|
// 'method' => 'DELETE'
|
||||||
|
// ]);
|
||||||
|
|
||||||
|
// $this->prepareMassAction([
|
||||||
|
// 'type' => 'update',
|
||||||
|
// 'action' => route('admin.catalog.products.massupdate'),
|
||||||
|
// 'method' => 'PUT',
|
||||||
|
// 'options' => [
|
||||||
|
// 0 => true,
|
||||||
|
// 1 => false,
|
||||||
|
// ]
|
||||||
|
// ]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2,136 +2,83 @@
|
||||||
|
|
||||||
namespace Webkul\Admin\DataGrids;
|
namespace Webkul\Admin\DataGrids;
|
||||||
|
|
||||||
use Illuminate\View\View;
|
use Webkul\Ui\DataGrid\AbsGrid;
|
||||||
use Webkul\Ui\DataGrid\Facades\DataGrid;
|
use DB;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Customer Group DataGrid
|
* Currency Data Grid class
|
||||||
*
|
*
|
||||||
* @author Rahul Shukla <rahulshukla.symfony517@webkul.com>
|
* @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
|
class CustomerGroupDataGrid extends AbsGrid
|
||||||
{
|
{
|
||||||
|
public $allColumns = [];
|
||||||
|
|
||||||
/**
|
public function prepareQueryBuilder()
|
||||||
* The Customer Group Data Grid implementation.
|
|
||||||
*/
|
|
||||||
public function createCustomerGroupDataGrid()
|
|
||||||
{
|
{
|
||||||
|
$queryBuilder = DB::table('customer_groups')->addSelect('id', 'name');
|
||||||
|
|
||||||
return DataGrid::make([
|
$this->setQueryBuilder($queryBuilder);
|
||||||
|
}
|
||||||
|
|
||||||
'name' => 'Customer Group',
|
public function setIndex() {
|
||||||
'table' => 'customer_groups as cg',
|
$this->index = 'id';
|
||||||
'select' => 'cg.id',
|
}
|
||||||
'perpage' => 10,
|
|
||||||
'aliased' => true, //use this with false as default and true in case of joins
|
|
||||||
|
|
||||||
'massoperations' =>[
|
public function addColumns()
|
||||||
// [
|
{
|
||||||
// 'route' => route('admin.datagrid.delete'),
|
$this->addColumn([
|
||||||
// 'method' => 'DELETE',
|
'index' => 'id',
|
||||||
// 'label' => 'Delete',
|
'alias' => 'groupId',
|
||||||
// 'type' => 'button',
|
|
||||||
// ],
|
|
||||||
// [
|
|
||||||
// 'route' => route('admin.datagrid.index'),
|
|
||||||
// 'method' => 'POST',
|
|
||||||
// 'label' => 'View Grid',
|
|
||||||
// 'type' => 'select',
|
|
||||||
// 'options' =>[
|
|
||||||
// 1 => 'Edit',
|
|
||||||
// 2 => 'Set',
|
|
||||||
// 3 => 'Change Status'
|
|
||||||
// ]
|
|
||||||
// ],
|
|
||||||
],
|
|
||||||
'actions' => [
|
|
||||||
[
|
|
||||||
'type' => 'Edit',
|
|
||||||
'route' => 'admin.groups.edit',
|
|
||||||
'confirm_text' => 'Do you really want to edit this record?',
|
|
||||||
'icon' => 'icon pencil-lg-icon',
|
|
||||||
], [
|
|
||||||
'type' => 'Delete',
|
|
||||||
'route' => 'admin.groups.delete',
|
|
||||||
'confirm_text' => 'Do you really want to delete this record?',
|
|
||||||
'icon' => 'icon trash-icon',
|
|
||||||
],
|
|
||||||
],
|
|
||||||
'join' => [
|
|
||||||
// [
|
|
||||||
// 'join' => 'leftjoin',
|
|
||||||
// 'table' => 'roles as r',
|
|
||||||
// 'primaryKey' => 'u.role_id',
|
|
||||||
// 'condition' => '=',
|
|
||||||
// 'secondaryKey' => 'r.id',
|
|
||||||
// ]
|
|
||||||
],
|
|
||||||
|
|
||||||
//use aliasing on secodary columns if join is performed
|
|
||||||
'columns' => [
|
|
||||||
[
|
|
||||||
'name' => 'cg.id',
|
|
||||||
'alias' => 'ID',
|
|
||||||
'type' => 'number',
|
|
||||||
'label' => 'ID',
|
'label' => 'ID',
|
||||||
'sortable' => true,
|
|
||||||
], [
|
|
||||||
'name' => 'cg.name',
|
|
||||||
'alias' => 'Name',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Name',
|
|
||||||
'sortable' => true,
|
|
||||||
],
|
|
||||||
],
|
|
||||||
|
|
||||||
//don't use aliasing in case of filters
|
|
||||||
'filterable' => [
|
|
||||||
[
|
|
||||||
'column' => 'cg.name',
|
|
||||||
'alias' => 'Name',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Name'
|
|
||||||
], [
|
|
||||||
'column' => 'cg.id',
|
|
||||||
'alias' => 'ID',
|
|
||||||
'type' => 'number',
|
'type' => 'number',
|
||||||
'label' => 'ID'
|
'searchable' => false,
|
||||||
],
|
'sortable' => true,
|
||||||
],
|
'width' => '40px'
|
||||||
//don't use aliasing in case of searchables
|
|
||||||
'searchable' => [
|
|
||||||
[
|
|
||||||
'column' => 'cg.id',
|
|
||||||
'type' => 'number',
|
|
||||||
'label' => 'Id'
|
|
||||||
], [
|
|
||||||
'column' => 'cg.name',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Name'
|
|
||||||
]
|
|
||||||
],
|
|
||||||
|
|
||||||
'operators' => [
|
|
||||||
'eq' => "=",
|
|
||||||
'lt' => "<",
|
|
||||||
'gt' => ">",
|
|
||||||
'lte' => "<=",
|
|
||||||
'gte' => ">=",
|
|
||||||
'neqs' => "<>",
|
|
||||||
'neqn' => "!=",
|
|
||||||
'like' => "like",
|
|
||||||
'nlike' => "not like",
|
|
||||||
],
|
|
||||||
// 'css' => []
|
|
||||||
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
$this->addColumn([
|
||||||
|
// 'column' => 'CONCAT(cus.first_name, " ", cus.last_name)',
|
||||||
|
'index' => 'name',
|
||||||
|
'alias' => 'groupName',
|
||||||
|
'label' => 'Name',
|
||||||
|
'type' => 'string',
|
||||||
|
'searchable' => true,
|
||||||
|
'sortable' => true,
|
||||||
|
'width' => '100px'
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render() {
|
public function prepareActions() {
|
||||||
return $this->createCustomerGroupDataGrid()->render();
|
$this->addAction([
|
||||||
|
'type' => 'Edit',
|
||||||
|
'route' => 'admin.customer.edit',
|
||||||
|
'icon' => 'icon pencil-lg-icon'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->addAction([
|
||||||
|
'type' => 'Delete',
|
||||||
|
'route' => 'admin.customer.delete',
|
||||||
|
'icon' => 'icon trash-icon'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function prepareMassActions() {
|
||||||
|
// $this->prepareMassAction([
|
||||||
|
// 'type' => 'delete',
|
||||||
|
// 'action' => route('admin.catalog.products.massdelete'),
|
||||||
|
// 'method' => 'DELETE'
|
||||||
|
// ]);
|
||||||
|
|
||||||
|
// $this->prepareMassAction([
|
||||||
|
// 'type' => 'update',
|
||||||
|
// 'action' => route('admin.catalog.products.massupdate'),
|
||||||
|
// 'method' => 'PUT',
|
||||||
|
// 'options' => [
|
||||||
|
// 0 => true,
|
||||||
|
// 1 => false,
|
||||||
|
// ]
|
||||||
|
// ]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2,105 +2,80 @@
|
||||||
|
|
||||||
namespace Webkul\Admin\DataGrids;
|
namespace Webkul\Admin\DataGrids;
|
||||||
|
|
||||||
use Illuminate\View\View;
|
use Webkul\Ui\DataGrid\AbsGrid;
|
||||||
use Webkul\Ui\DataGrid\Facades\DataGrid;
|
use DB;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CustomerReview DataGrid
|
* Currency Data Grid class
|
||||||
*
|
*
|
||||||
* @author Rahul Shukla <rahulshukla.symfony517@webkul.com> @rahul-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
|
class CustomerReviewDataGrid extends AbsGrid
|
||||||
{
|
{
|
||||||
|
public $allColumns = [];
|
||||||
|
|
||||||
/**
|
public function prepareQueryBuilder()
|
||||||
* The ProductReviewDataGrid implementation for Product Reviews
|
|
||||||
*/
|
|
||||||
public function createCustomerReviewDataGrid()
|
|
||||||
{
|
{
|
||||||
|
$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');
|
||||||
|
|
||||||
return DataGrid::make([
|
$this->setQueryBuilder($queryBuilder);
|
||||||
'name' => 'Review',
|
}
|
||||||
'table' => 'product_reviews as pr',
|
|
||||||
'select' => 'pr.id',
|
|
||||||
'perpage' => 10,
|
|
||||||
'aliased' => true, //use this with false as default and true in case of joins
|
|
||||||
|
|
||||||
'massoperations' =>[
|
public function setIndex() {
|
||||||
0 => [
|
$this->index = 'id';
|
||||||
'type' => 'delete', //all lower case will be shifted in the configuration file for better control and increased fault tolerance
|
}
|
||||||
'action' => route('admin.customer.review.massdelete'),
|
|
||||||
'method' => 'DELETE'
|
|
||||||
], 1 => [
|
|
||||||
'type' => 'update', //all lower case will be shifted in the configuration file for better control and increased fault tolerance
|
|
||||||
'action' => route('admin.customer.review.massupdate'),
|
|
||||||
'method' => 'PUT',
|
|
||||||
'options' => [
|
|
||||||
0 => 'Disapprove',
|
|
||||||
1 => 'Approve',
|
|
||||||
]
|
|
||||||
]
|
|
||||||
],
|
|
||||||
|
|
||||||
'actions' => [
|
public function addColumns()
|
||||||
[
|
{
|
||||||
'type' => 'Edit',
|
$this->addColumn([
|
||||||
'route' => 'admin.customer.review.edit',
|
'index' => 'pr.id',
|
||||||
'confirm_text' => 'Do you really want to edit this record?',
|
|
||||||
'icon' => 'icon pencil-lg-icon',
|
|
||||||
], [
|
|
||||||
'type' => 'Delete',
|
|
||||||
'route' => 'admin.customer.review.delete',
|
|
||||||
'confirm_text' => 'Do you really want to delete this record?',
|
|
||||||
'icon' => 'icon trash-icon',
|
|
||||||
],
|
|
||||||
],
|
|
||||||
|
|
||||||
'join' => [
|
|
||||||
[
|
|
||||||
'join' => 'leftjoin',
|
|
||||||
'table' => 'products_grid as pt',
|
|
||||||
'primaryKey' => 'pr.product_id',
|
|
||||||
'condition' => '=',
|
|
||||||
'secondaryKey' => 'pt.product_id',
|
|
||||||
]
|
|
||||||
],
|
|
||||||
|
|
||||||
//use aliasing on secodary columns if join is performed
|
|
||||||
|
|
||||||
'columns' => [
|
|
||||||
[
|
|
||||||
'name' => 'pr.id',
|
|
||||||
'alias' => 'reviewId',
|
'alias' => 'reviewId',
|
||||||
'type' => 'number',
|
|
||||||
'label' => 'ID',
|
'label' => 'ID',
|
||||||
'sortable' => true,
|
|
||||||
], [
|
|
||||||
'name' => 'pr.title',
|
|
||||||
'alias' => 'titleName',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Title',
|
|
||||||
'sortable' => true,
|
|
||||||
], [
|
|
||||||
'name' => 'pr.comment',
|
|
||||||
'alias' => 'productComment',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Comment',
|
|
||||||
'sortable' => true,
|
|
||||||
], [
|
|
||||||
'name' => 'pt.name',
|
|
||||||
'alias' => 'productName',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Product Name',
|
|
||||||
'sortable' => true,
|
|
||||||
], [
|
|
||||||
'name' => 'pr.status',
|
|
||||||
'alias' => 'reviewStatus',
|
|
||||||
'type' => 'number',
|
'type' => 'number',
|
||||||
'label' => 'Status',
|
'searchable' => false,
|
||||||
'sortable' => true,
|
'sortable' => true,
|
||||||
|
'width' => '40px'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->addColumn([
|
||||||
|
'index' => 'pr.title',
|
||||||
|
'alias' => 'reviewTitle',
|
||||||
|
'label' => 'Title',
|
||||||
|
'type' => 'string',
|
||||||
|
'searchable' => true,
|
||||||
|
'sortable' => true,
|
||||||
|
'width' => '100px'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->addColumn([
|
||||||
|
'index' => 'pr.comment',
|
||||||
|
'alias' => 'reviewComment',
|
||||||
|
'label' => 'Comment',
|
||||||
|
'type' => 'string',
|
||||||
|
'searchable' => true,
|
||||||
|
'sortable' => true,
|
||||||
|
'width' => '100px'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->addColumn([
|
||||||
|
'index' => 'pg.name',
|
||||||
|
'alias' => 'productName',
|
||||||
|
'label' => 'Product',
|
||||||
|
'type' => 'string',
|
||||||
|
'searchable' => true,
|
||||||
|
'sortable' => true,
|
||||||
|
'width' => '100px'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->addColumn([
|
||||||
|
'index' => 'pr.status',
|
||||||
|
'alias' => 'reviewStatus',
|
||||||
|
'label' => 'Status',
|
||||||
|
'type' => 'boolean',
|
||||||
|
'searchable' => true,
|
||||||
|
'sortable' => true,
|
||||||
|
'width' => '100px',
|
||||||
'closure' => true,
|
'closure' => true,
|
||||||
'wrapper' => function ($value) {
|
'wrapper' => function ($value) {
|
||||||
if($value == 'approved')
|
if($value == 'approved')
|
||||||
|
|
@ -108,76 +83,38 @@ class CustomerReviewDataGrid
|
||||||
else if($value == "pending")
|
else if($value == "pending")
|
||||||
return '<span class="badge badge-md badge-warning">Pending</span>';
|
return '<span class="badge badge-md badge-warning">Pending</span>';
|
||||||
},
|
},
|
||||||
],
|
]);
|
||||||
],
|
}
|
||||||
|
|
||||||
//don't use aliasing in case of filters
|
|
||||||
'filterable' => [
|
|
||||||
[
|
|
||||||
'column' => 'pr.id',
|
|
||||||
'alias' => 'reviewId',
|
|
||||||
'type' => 'number',
|
|
||||||
'label' => 'ID',
|
|
||||||
], [
|
|
||||||
'column' => 'pr.title',
|
|
||||||
'alias' => 'titleName',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Title',
|
|
||||||
], [
|
|
||||||
'column' => 'pr.comment',
|
|
||||||
'alias' => 'productComment',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Comment',
|
|
||||||
], [
|
|
||||||
'column' => 'pt.name',
|
|
||||||
'alias' => 'productName',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Product Name',
|
|
||||||
], [
|
|
||||||
'column' => 'pr.status',
|
|
||||||
'alias' => 'reviewStatus',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Status',
|
|
||||||
],
|
|
||||||
],
|
|
||||||
|
|
||||||
//don't use aliasing in case of searchables
|
|
||||||
'searchable' => [
|
|
||||||
[
|
|
||||||
'column' => 'title',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Title',
|
|
||||||
], [
|
|
||||||
'column' => 'rating',
|
|
||||||
'type' => 'number',
|
|
||||||
'label' => 'Rating',
|
|
||||||
], [
|
|
||||||
'column' => 'pt.name',
|
|
||||||
'alias' => 'productName',
|
|
||||||
'type' => 'string',
|
|
||||||
],
|
|
||||||
],
|
|
||||||
|
|
||||||
//list of viable operators that will be used
|
|
||||||
'operators' => [
|
|
||||||
'eq' => "=",
|
|
||||||
'lt' => "<",
|
|
||||||
'gt' => ">",
|
|
||||||
'lte' => "<=",
|
|
||||||
'gte' => ">=",
|
|
||||||
'neqs' => "<>",
|
|
||||||
'neqn' => "!=",
|
|
||||||
'like' => "like",
|
|
||||||
'nlike' => "not like",
|
|
||||||
],
|
|
||||||
// 'css' => []
|
|
||||||
|
|
||||||
|
public function prepareActions() {
|
||||||
|
$this->addAction([
|
||||||
|
'type' => 'Edit',
|
||||||
|
'route' => 'admin.customer.review.edit',
|
||||||
|
'icon' => 'icon pencil-lg-icon'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
$this->addAction([
|
||||||
|
'type' => 'Delete',
|
||||||
|
'route' => 'admin.customer.review.delete',
|
||||||
|
'icon' => 'icon trash-icon'
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render()
|
public function prepareMassActions() {
|
||||||
{
|
$this->addMassAction([
|
||||||
return $this->createCustomerReviewDataGrid()->render();
|
'type' => 'delete',
|
||||||
|
'action' => route('admin.catalog.products.massdelete'),
|
||||||
|
'method' => 'DELETE'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->addMassAction([
|
||||||
|
'type' => 'update',
|
||||||
|
'action' => route('admin.catalog.products.massupdate'),
|
||||||
|
'method' => 'PUT',
|
||||||
|
'options' => [
|
||||||
|
0 => true,
|
||||||
|
1 => false,
|
||||||
|
]
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2,141 +2,93 @@
|
||||||
|
|
||||||
namespace Webkul\Admin\DataGrids;
|
namespace Webkul\Admin\DataGrids;
|
||||||
|
|
||||||
use Illuminate\View\View;
|
use Webkul\Ui\DataGrid\AbsGrid;
|
||||||
use Webkul\Ui\DataGrid\Facades\DataGrid;
|
use DB;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Exchange Rates DataGrid
|
* Product Data Grid 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
|
class ExchangeRatesDataGrid extends AbsGrid
|
||||||
{
|
{
|
||||||
|
public $allColumns = [];
|
||||||
|
|
||||||
/**
|
public function prepareQueryBuilder()
|
||||||
* The Data Grid implementation for Exchange Rates
|
|
||||||
*/
|
|
||||||
public function createExchangeRatesDataGrid()
|
|
||||||
{
|
{
|
||||||
|
$queryBuilder = DB::table('currency_exchange_rates as cer')->addSelect('cer.id', 'curr.name', 'cer.rate')->leftJoin('currencies as curr', 'cer.target_currency', '=', 'curr.id');
|
||||||
|
|
||||||
return DataGrid::make([
|
$this->setQueryBuilder($queryBuilder);
|
||||||
'name' => 'Exchange Rates',
|
}
|
||||||
'table' => 'currency_exchange_rates as cer',
|
|
||||||
'select' => 'cer.id',
|
|
||||||
'perpage' => 10,
|
|
||||||
'aliased' => true, //use this with false as default and true in case of joins
|
|
||||||
|
|
||||||
'massoperations' =>[
|
public function setIndex() {
|
||||||
// [
|
$this->index = 'id';
|
||||||
// 'route' => route('admin.datagrid.delete'),
|
}
|
||||||
// 'method' => 'DELETE',
|
|
||||||
// 'label' => 'Delete',
|
|
||||||
// 'type' => 'button',
|
|
||||||
// ],
|
|
||||||
],
|
|
||||||
|
|
||||||
'actions' => [
|
public function addColumns()
|
||||||
[
|
{
|
||||||
'type' => 'Edit',
|
$this->addColumn([
|
||||||
'route' => 'admin.exchange_rates.edit',
|
'index' => 'cer.id',
|
||||||
'confirm_text' => 'Do you really want to edit this record?',
|
'alias' => 'exchId',
|
||||||
'icon' => 'icon pencil-lg-icon',
|
'label' => 'ID',
|
||||||
], [
|
|
||||||
'type' => 'Delete',
|
|
||||||
'route' => 'admin.exchange_rates.delete',
|
|
||||||
'confirm_text' => 'Do you really want to delete this record?',
|
|
||||||
'icon' => 'icon trash-icon',
|
|
||||||
],
|
|
||||||
],
|
|
||||||
|
|
||||||
'join' => [
|
|
||||||
[
|
|
||||||
'join' => 'leftjoin',
|
|
||||||
'table' => 'currencies as curr',
|
|
||||||
'primaryKey' => 'cer.target_currency',
|
|
||||||
'condition' => '=',
|
|
||||||
'secondaryKey' => 'curr.id',
|
|
||||||
]
|
|
||||||
],
|
|
||||||
|
|
||||||
//use aliasing on secodary columns if join is performed
|
|
||||||
|
|
||||||
'columns' => [
|
|
||||||
[
|
|
||||||
'name' => 'cer.id',
|
|
||||||
'alias' => 'exchid',
|
|
||||||
'type' => 'number',
|
'type' => 'number',
|
||||||
'label' => 'Rate ID',
|
'searchable' => false,
|
||||||
'sortable' => true,
|
'sortable' => true,
|
||||||
], [
|
'width' => '40px'
|
||||||
'name' => 'curr.name',
|
|
||||||
'alias' => 'exchcurrname',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Currency Name',
|
|
||||||
'sortable' => true,
|
|
||||||
], [
|
|
||||||
'name' => 'cer.rate',
|
|
||||||
'alias' => 'exchrate',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Exchange Rate',
|
|
||||||
'sortable' => true
|
|
||||||
],
|
|
||||||
],
|
|
||||||
|
|
||||||
//don't use aliasing in case of filters
|
|
||||||
'filterable' => [
|
|
||||||
[
|
|
||||||
'column' => 'cer.id',
|
|
||||||
'alias' => 'exchid',
|
|
||||||
'type' => 'number',
|
|
||||||
'label' => 'Rate ID',
|
|
||||||
], [
|
|
||||||
'column' => 'curr.name',
|
|
||||||
'alias' => 'exchcurrname',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Currency Name',
|
|
||||||
], [
|
|
||||||
'column' => 'cer.rate',
|
|
||||||
'alias' => 'exchrate',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Exchange Rate',
|
|
||||||
],
|
|
||||||
],
|
|
||||||
|
|
||||||
//don't use aliasing in case of searchables
|
|
||||||
'searchable' => [
|
|
||||||
[
|
|
||||||
'column' => 'exchcurrname',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Currency Name',
|
|
||||||
], [
|
|
||||||
'column' => 'cer.rate',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Exchange Rate',
|
|
||||||
],
|
|
||||||
],
|
|
||||||
|
|
||||||
//list of viable operators that will be used
|
|
||||||
'operators' => [
|
|
||||||
'eq' => "=",
|
|
||||||
'lt' => "<",
|
|
||||||
'gt' => ">",
|
|
||||||
'lte' => "<=",
|
|
||||||
'gte' => ">=",
|
|
||||||
'neqs' => "<>",
|
|
||||||
'neqn' => "!=",
|
|
||||||
'like' => "like",
|
|
||||||
'nlike' => "not like",
|
|
||||||
],
|
|
||||||
// 'css' => []
|
|
||||||
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
$this->addColumn([
|
||||||
|
'index' => 'curr.name',
|
||||||
|
'alias' => 'exchName',
|
||||||
|
'label' => 'Currency Name',
|
||||||
|
'type' => 'string',
|
||||||
|
'searchable' => true,
|
||||||
|
'sortable' => true,
|
||||||
|
'width' => '100px'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->addColumn([
|
||||||
|
'index' => 'cer.rate',
|
||||||
|
'alias' => 'exchRate',
|
||||||
|
'label' => 'Exchange Rate',
|
||||||
|
'type' => 'string',
|
||||||
|
'searchable' => true,
|
||||||
|
'sortable' => true,
|
||||||
|
'width' => '100px'
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render()
|
public function prepareActions() {
|
||||||
{
|
$this->addAction([
|
||||||
return $this->createExchangeRatesDataGrid()->render();
|
'type' => 'Edit',
|
||||||
|
'route' => 'admin.exchange_rates.edit',
|
||||||
|
'icon' => 'icon pencil-lg-icon'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->addAction([
|
||||||
|
'type' => 'Delete',
|
||||||
|
'route' => 'admin.exchange_rates.delete',
|
||||||
|
'confirm_text' => trans('ui::app.datagrid.massaction.delete', ['resource' => 'Exchange Rate']),
|
||||||
|
'icon' => 'icon trash-icon'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function prepareMassActions() {
|
||||||
|
// $this->prepareMassAction([
|
||||||
|
// 'type' => 'delete',
|
||||||
|
// 'action' => route('admin.catalog.products.massdelete'),
|
||||||
|
// 'method' => 'DELETE'
|
||||||
|
// ]);
|
||||||
|
|
||||||
|
// $this->prepareMassAction([
|
||||||
|
// 'type' => 'update',
|
||||||
|
// 'action' => route('admin.catalog.products.massupdate'),
|
||||||
|
// 'method' => 'PUT',
|
||||||
|
// 'options' => [
|
||||||
|
// 0 => true,
|
||||||
|
// 1 => false,
|
||||||
|
// ]
|
||||||
|
// ]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2,169 +2,119 @@
|
||||||
|
|
||||||
namespace Webkul\Admin\DataGrids;
|
namespace Webkul\Admin\DataGrids;
|
||||||
|
|
||||||
use Illuminate\View\View;
|
use Webkul\Ui\DataGrid\AbsGrid;
|
||||||
use Webkul\Ui\DataGrid\Facades\DataGrid;
|
use DB;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Inventory Sources DataGrid
|
* Product Data Grid 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
|
class InventorySourcesDataGrid extends AbsGrid
|
||||||
{
|
{
|
||||||
|
public $allColumns = [];
|
||||||
|
|
||||||
/**
|
public function prepareQueryBuilder()
|
||||||
* The Data Grid implementation for Inventory Sources
|
|
||||||
*/
|
|
||||||
public function createInventorySourcesDataGrid()
|
|
||||||
{
|
{
|
||||||
return DataGrid::make([
|
$queryBuilder = DB::table('inventory_sources')->addSelect('id', 'code', 'name', 'priority', 'status');
|
||||||
'name' => 'Inventory Sources',
|
|
||||||
'table' => 'inventory_sources',
|
|
||||||
'select' => 'id',
|
|
||||||
'perpage' => 10,
|
|
||||||
'aliased' => false, //use this with false as default and true in case of joins
|
|
||||||
|
|
||||||
'massoperations' =>[
|
$this->setQueryBuilder($queryBuilder);
|
||||||
// [
|
}
|
||||||
// 'route' => route('admin.datagrid.delete'),
|
|
||||||
// 'method' => 'DELETE',
|
|
||||||
// 'label' => 'Delete',
|
|
||||||
// 'type' => 'button',
|
|
||||||
// ],
|
|
||||||
],
|
|
||||||
|
|
||||||
'actions' => [
|
public function setIndex() {
|
||||||
[
|
$this->index = 'id';
|
||||||
'type' => 'Edit',
|
}
|
||||||
'route' => 'admin.inventory_sources.edit',
|
|
||||||
'confirm_text' => 'Do you really want to edit this record?',
|
|
||||||
'icon' => 'icon pencil-lg-icon',
|
|
||||||
], [
|
|
||||||
'type' => 'Delete',
|
|
||||||
'route' => 'admin.inventory_sources.delete',
|
|
||||||
'confirm_text' => 'Do you really want to delete this record?',
|
|
||||||
'icon' => 'icon trash-icon',
|
|
||||||
],
|
|
||||||
],
|
|
||||||
|
|
||||||
'join' => [
|
public function addColumns()
|
||||||
// [
|
{
|
||||||
// 'join' => 'leftjoin',
|
$this->addColumn([
|
||||||
// 'table' => 'roles as r',
|
'index' => 'id',
|
||||||
// 'primaryKey' => 'u.role_id',
|
'alias' => 'invId',
|
||||||
// 'condition' => '=',
|
|
||||||
// 'secondaryKey' => 'r.id',
|
|
||||||
// ]
|
|
||||||
],
|
|
||||||
|
|
||||||
//use aliasing on secodary columns if join is performed
|
|
||||||
'columns' => [
|
|
||||||
|
|
||||||
[
|
|
||||||
'name' => 'id',
|
|
||||||
'alias' => 'inventoryID',
|
|
||||||
'type' => 'number',
|
|
||||||
'label' => 'ID',
|
'label' => 'ID',
|
||||||
|
'type' => 'number',
|
||||||
|
'searchable' => false,
|
||||||
'sortable' => true,
|
'sortable' => true,
|
||||||
], [
|
'width' => '40px'
|
||||||
'name' => 'code',
|
]);
|
||||||
'alias' => 'inventoryCode',
|
|
||||||
'type' => 'string',
|
$this->addColumn([
|
||||||
|
'index' => 'code',
|
||||||
|
'alias' => 'invCode',
|
||||||
'label' => 'Code',
|
'label' => 'Code',
|
||||||
'sortable' => true,
|
|
||||||
], [
|
|
||||||
'name' => 'name',
|
|
||||||
'alias' => 'inventoryName',
|
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
|
'searchable' => true,
|
||||||
|
'sortable' => true,
|
||||||
|
'width' => '100px'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->addColumn([
|
||||||
|
'index' => 'name',
|
||||||
|
'alias' => 'invName',
|
||||||
'label' => 'Name',
|
'label' => 'Name',
|
||||||
'sortable' => true,
|
|
||||||
], [
|
|
||||||
'name' => 'priority',
|
|
||||||
'alias' => 'inventoryPriority',
|
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
|
'searchable' => true,
|
||||||
|
'sortable' => true,
|
||||||
|
'width' => '100px'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->addColumn([
|
||||||
|
'index' => 'priority',
|
||||||
|
'alias' => 'invPriority',
|
||||||
'label' => 'Priority',
|
'label' => 'Priority',
|
||||||
|
'type' => 'string',
|
||||||
|
'searchable' => true,
|
||||||
'sortable' => true,
|
'sortable' => true,
|
||||||
], [
|
'width' => '100px'
|
||||||
'name' => 'status',
|
]);
|
||||||
'alias' => 'inventoryStatus',
|
|
||||||
'type' => 'boolean',
|
$this->addColumn([
|
||||||
|
'index' => 'status',
|
||||||
|
'alias' => 'invStatus',
|
||||||
'label' => 'Status',
|
'label' => 'Status',
|
||||||
|
'type' => 'boolean',
|
||||||
|
'searchable' => true,
|
||||||
'sortable' => true,
|
'sortable' => true,
|
||||||
|
'width' => '100px',
|
||||||
'wrapper' => function($value){
|
'wrapper' => function($value){
|
||||||
if($value == 0)
|
if($value == 1)
|
||||||
return "In Active";
|
return 'Active';
|
||||||
else
|
else
|
||||||
return "Active";
|
return 'Inactive';
|
||||||
},
|
}
|
||||||
],
|
|
||||||
|
|
||||||
],
|
|
||||||
|
|
||||||
//don't use aliasing in case of filters
|
|
||||||
|
|
||||||
'filterable' => [
|
|
||||||
[
|
|
||||||
'column' => 'id',
|
|
||||||
'alias' => 'inventoryID',
|
|
||||||
'type' => 'number',
|
|
||||||
'label' => 'ID',
|
|
||||||
], [
|
|
||||||
'column' => 'code',
|
|
||||||
'alias' => 'inventoryCode',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Code',
|
|
||||||
], [
|
|
||||||
'column' => 'name',
|
|
||||||
'alias' => 'inventoryName',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Name',
|
|
||||||
], [
|
|
||||||
'name' => 'status',
|
|
||||||
'alias' => 'inventoryStatus',
|
|
||||||
'type' => 'boolean',
|
|
||||||
'label' => 'Status',
|
|
||||||
],
|
|
||||||
],
|
|
||||||
|
|
||||||
//don't use aliasing in case of searchables
|
|
||||||
|
|
||||||
'searchable' => [
|
|
||||||
[
|
|
||||||
'column' => 'name',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Name',
|
|
||||||
], [
|
|
||||||
'column' => 'code',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Code',
|
|
||||||
], [
|
|
||||||
'column' => 'name',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Name',
|
|
||||||
],
|
|
||||||
],
|
|
||||||
|
|
||||||
//list of viable operators that will be used
|
|
||||||
'operators' => [
|
|
||||||
'eq' => "=",
|
|
||||||
'lt' => "<",
|
|
||||||
'gt' => ">",
|
|
||||||
'lte' => "<=",
|
|
||||||
'gte' => ">=",
|
|
||||||
'neqs' => "<>",
|
|
||||||
'neqn' => "!=",
|
|
||||||
'like' => "like",
|
|
||||||
'nlike' => "not like",
|
|
||||||
],
|
|
||||||
// 'css' => []
|
|
||||||
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render()
|
public function prepareActions() {
|
||||||
{
|
$this->addAction([
|
||||||
return $this->createInventorySourcesDataGrid()->render();
|
'type' => 'Edit',
|
||||||
|
'route' => 'admin.inventory_sources.edit',
|
||||||
|
'icon' => 'icon pencil-lg-icon'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->addAction([
|
||||||
|
'type' => 'Delete',
|
||||||
|
'route' => 'admin.inventory_sources.delete',
|
||||||
|
'confirm_text' => trans('ui::app.datagrid.massaction.delete', ['resource' => 'Exchange Rate']),
|
||||||
|
'icon' => 'icon trash-icon'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function prepareMassActions() {
|
||||||
|
// $this->prepareMassAction([
|
||||||
|
// 'type' => 'delete',
|
||||||
|
// 'action' => route('admin.catalog.products.massdelete'),
|
||||||
|
// 'method' => 'DELETE'
|
||||||
|
// ]);
|
||||||
|
|
||||||
|
// $this->prepareMassAction([
|
||||||
|
// 'type' => 'update',
|
||||||
|
// 'action' => route('admin.catalog.products.massupdate'),
|
||||||
|
// 'method' => 'PUT',
|
||||||
|
// 'options' => [
|
||||||
|
// 0 => true,
|
||||||
|
// 1 => false,
|
||||||
|
// ]
|
||||||
|
// ]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2,141 +2,93 @@
|
||||||
|
|
||||||
namespace Webkul\Admin\DataGrids;
|
namespace Webkul\Admin\DataGrids;
|
||||||
|
|
||||||
use Illuminate\View\View;
|
use Webkul\Ui\DataGrid\AbsGrid;
|
||||||
use Webkul\Ui\DataGrid\Facades\DataGrid;
|
use DB;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Locales DataGrid
|
* Product Data Grid 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
|
class LocalesDataGrid extends AbsGrid
|
||||||
{
|
{
|
||||||
|
public $allColumns = [];
|
||||||
|
|
||||||
/**
|
public function prepareQueryBuilder()
|
||||||
* The Data Grid implementation for countries
|
|
||||||
*/
|
|
||||||
public function createCountryDataGrid()
|
|
||||||
{
|
{
|
||||||
|
$queryBuilder = DB::table('locales')->addSelect('id', 'code', 'name');
|
||||||
|
|
||||||
return DataGrid::make([
|
$this->setQueryBuilder($queryBuilder);
|
||||||
'name' => 'Locales',
|
}
|
||||||
'table' => 'locales',
|
|
||||||
'select' => 'id',
|
|
||||||
'perpage' => 10,
|
|
||||||
'aliased' => false, //use this with false as default and true in case of joins
|
|
||||||
|
|
||||||
'massoperations' =>[
|
public function setIndex() {
|
||||||
// [
|
$this->index = 'id';
|
||||||
// 'route' => route('admin.datagrid.delete'),
|
}
|
||||||
// 'method' => 'DELETE',
|
|
||||||
// 'label' => 'Delete',
|
|
||||||
// 'type' => 'button',
|
|
||||||
// ],
|
|
||||||
],
|
|
||||||
|
|
||||||
'actions' => [
|
public function addColumns()
|
||||||
[
|
{
|
||||||
'type' => 'Edit',
|
$this->addColumn([
|
||||||
'route' => 'admin.locales.edit',
|
'index' => 'id',
|
||||||
// 'confirm_text' => 'Do you really want to edit this record?',
|
|
||||||
'icon' => 'icon pencil-lg-icon',
|
|
||||||
], [
|
|
||||||
'type' => 'Delete',
|
|
||||||
'route' => 'admin.locales.delete',
|
|
||||||
'confirm_text' => 'Do you really want to delete this record?',
|
|
||||||
'icon' => 'icon trash-icon',
|
|
||||||
],
|
|
||||||
],
|
|
||||||
|
|
||||||
'join' => [
|
|
||||||
// [
|
|
||||||
// 'join' => 'leftjoin',
|
|
||||||
// 'table' => 'roles as r',
|
|
||||||
// 'primaryKey' => 'u.role_id',
|
|
||||||
// 'condition' => '=',
|
|
||||||
// 'secondaryKey' => 'r.id',
|
|
||||||
// ]
|
|
||||||
],
|
|
||||||
|
|
||||||
//use aliasing as attribute
|
|
||||||
'columns' => [
|
|
||||||
[
|
|
||||||
'name' => 'id',
|
|
||||||
'alias' => 'localeId',
|
'alias' => 'localeId',
|
||||||
'type' => 'number',
|
|
||||||
'label' => 'ID',
|
'label' => 'ID',
|
||||||
'sortable' => true,
|
|
||||||
], [
|
|
||||||
'name' => 'code',
|
|
||||||
'alias' => 'localeCode',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Code',
|
|
||||||
'sortable' => true,
|
|
||||||
], [
|
|
||||||
'name' => 'name',
|
|
||||||
'alias' => 'localeName',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Name',
|
|
||||||
'sortable' => true,
|
|
||||||
],
|
|
||||||
|
|
||||||
],
|
|
||||||
|
|
||||||
//don't use aliasing in case of filters
|
|
||||||
'filterable' => [
|
|
||||||
[
|
|
||||||
'column' => 'id',
|
|
||||||
'alias' => 'localeId',
|
|
||||||
'type' => 'number',
|
'type' => 'number',
|
||||||
'label' => 'ID',
|
'searchable' => false,
|
||||||
], [
|
'sortable' => true,
|
||||||
'column' => 'code',
|
'width' => '40px'
|
||||||
'alias' => 'localeCode',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Code',
|
|
||||||
], [
|
|
||||||
'column' => 'name',
|
|
||||||
'alias' => 'localeName',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Name',
|
|
||||||
],
|
|
||||||
],
|
|
||||||
|
|
||||||
//don't use aliasing in case of searchables
|
|
||||||
'searchable' => [
|
|
||||||
[
|
|
||||||
'column' => 'name',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Name',
|
|
||||||
], [
|
|
||||||
'column' => 'code',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Code',
|
|
||||||
],
|
|
||||||
],
|
|
||||||
|
|
||||||
//list of viable operators that will be used
|
|
||||||
'operators' => [
|
|
||||||
'eq' => "=",
|
|
||||||
'lt' => "<",
|
|
||||||
'gt' => ">",
|
|
||||||
'lte' => "<=",
|
|
||||||
'gte' => ">=",
|
|
||||||
'neqs' => "<>",
|
|
||||||
'neqn' => "!=",
|
|
||||||
'like' => "like",
|
|
||||||
'nlike' => "not like",
|
|
||||||
],
|
|
||||||
// 'css' => []
|
|
||||||
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
$this->addColumn([
|
||||||
|
'index' => 'code',
|
||||||
|
'alias' => 'localeCode',
|
||||||
|
'label' => 'Code',
|
||||||
|
'type' => 'string',
|
||||||
|
'searchable' => true,
|
||||||
|
'sortable' => true,
|
||||||
|
'width' => '100px'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->addColumn([
|
||||||
|
'index' => 'name',
|
||||||
|
'alias' => 'localeName',
|
||||||
|
'label' => 'Name',
|
||||||
|
'type' => 'string',
|
||||||
|
'searchable' => true,
|
||||||
|
'sortable' => true,
|
||||||
|
'width' => '100px'
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render()
|
public function prepareActions() {
|
||||||
{
|
$this->addAction([
|
||||||
return $this->createCountryDataGrid()->render();
|
'type' => 'Edit',
|
||||||
|
'route' => 'admin.locales.edit',
|
||||||
|
'icon' => 'icon pencil-lg-icon'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->addAction([
|
||||||
|
'type' => 'Delete',
|
||||||
|
'route' => 'admin.locales.delete',
|
||||||
|
'confirm_text' => trans('ui::app.datagrid.massaction.delete', ['resource' => 'Exchange Rate']),
|
||||||
|
'icon' => 'icon trash-icon'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function prepareMassActions() {
|
||||||
|
// $this->prepareMassAction([
|
||||||
|
// 'type' => 'delete',
|
||||||
|
// 'action' => route('admin.catalog.products.massdelete'),
|
||||||
|
// 'method' => 'DELETE'
|
||||||
|
// ]);
|
||||||
|
|
||||||
|
// $this->prepareMassAction([
|
||||||
|
// 'type' => 'update',
|
||||||
|
// 'action' => route('admin.catalog.products.massupdate'),
|
||||||
|
// 'method' => 'PUT',
|
||||||
|
// 'options' => [
|
||||||
|
// 0 => true,
|
||||||
|
// 1 => false,
|
||||||
|
// ]
|
||||||
|
// ]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2,140 +2,99 @@
|
||||||
|
|
||||||
namespace Webkul\Admin\DataGrids;
|
namespace Webkul\Admin\DataGrids;
|
||||||
|
|
||||||
use Illuminate\View\View;
|
use Webkul\Ui\DataGrid\AbsGrid;
|
||||||
use Webkul\Ui\DataGrid\Facades\DataGrid;
|
use DB;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* orderDataGrid
|
* News Letter Grid 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
|
class NewsLetterDataGrid extends AbsGrid
|
||||||
{
|
{
|
||||||
|
public $allColumns = [];
|
||||||
|
|
||||||
/**
|
public function prepareQueryBuilder()
|
||||||
* The Data Grid implementation for orders
|
|
||||||
*/
|
|
||||||
public function newsLetterDataGrid()
|
|
||||||
{
|
{
|
||||||
|
$queryBuilder = DB::table('subscribers_list')->addSelect('id', 'is_subscribed', 'email');
|
||||||
|
|
||||||
return DataGrid::make([
|
$this->setQueryBuilder($queryBuilder);
|
||||||
'name' => 'Subscriberslist',
|
}
|
||||||
'table' => 'subscribers_list as sublist',
|
|
||||||
'select' => 'sublist.id',
|
|
||||||
'perpage' => 10,
|
|
||||||
'aliased' => false,
|
|
||||||
//True in case of joins else aliasing key required on all cases
|
|
||||||
|
|
||||||
'massoperations' =>[
|
public function setIndex() {
|
||||||
// [
|
$this->index = 'id';
|
||||||
// 'route' => route('admin.datagrid.delete'),
|
}
|
||||||
// 'method' => 'DELETE',
|
|
||||||
// 'label' => 'Delete',
|
|
||||||
// 'type' => 'button',
|
|
||||||
// ],
|
|
||||||
],
|
|
||||||
|
|
||||||
'actions' => [
|
public function addColumns()
|
||||||
[
|
{
|
||||||
'type' => 'Edit',
|
$this->addColumn([
|
||||||
'route' => 'admin.customers.subscribers.edit',
|
'index' => 'id',
|
||||||
// 'confirm_text' => 'Do you really want to delete this record?',
|
'alias' => 'subsId',
|
||||||
'icon' => 'icon pencil-lg-icon',
|
|
||||||
], [
|
|
||||||
'type' => 'Delete',
|
|
||||||
'route' => 'admin.customers.subscribers.delete',
|
|
||||||
'confirm_text' => 'Do you really want to delete this record?',
|
|
||||||
'icon' => 'icon trash-icon',
|
|
||||||
],
|
|
||||||
],
|
|
||||||
|
|
||||||
'join' => [],
|
|
||||||
|
|
||||||
//use aliasing on secodary columns if join is performed
|
|
||||||
'columns' => [
|
|
||||||
[
|
|
||||||
'name' => 'sublist.id',
|
|
||||||
'alias' => 'subid',
|
|
||||||
'type' => 'number',
|
|
||||||
'label' => 'ID',
|
'label' => 'ID',
|
||||||
'sortable' => true
|
'type' => 'number',
|
||||||
], [
|
'searchable' => false,
|
||||||
'name' => 'sublist.is_subscribed',
|
|
||||||
'alias' => 'issubs',
|
|
||||||
'type' => 'boolean',
|
|
||||||
'label' => 'Subscribed',
|
|
||||||
'sortable' => true,
|
'sortable' => true,
|
||||||
|
'width' => '40px'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->addColumn([
|
||||||
|
'index' => 'is_subscribed',
|
||||||
|
'alias' => 'subsCode',
|
||||||
|
'label' => 'Subscribed',
|
||||||
|
'type' => 'string',
|
||||||
|
'searchable' => true,
|
||||||
|
'sortable' => true,
|
||||||
|
'width' => '100px',
|
||||||
'wrapper' => function($value){
|
'wrapper' => function($value){
|
||||||
if($value == 0)
|
if($value == 1)
|
||||||
return "False";
|
return 'True';
|
||||||
else
|
else
|
||||||
return "True";
|
return 'False';
|
||||||
},
|
}
|
||||||
], [
|
]);
|
||||||
'name' => 'sublist.email',
|
|
||||||
'alias' => 'subsemail',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Email',
|
|
||||||
'sortable' => true
|
|
||||||
]
|
|
||||||
],
|
|
||||||
|
|
||||||
'filterable' => [
|
$this->addColumn([
|
||||||
[
|
'index' => 'email',
|
||||||
'column' => 'sublist.id',
|
'alias' => 'subsEmail',
|
||||||
'alias' => 'subid',
|
|
||||||
'type' => 'number',
|
|
||||||
'label' => 'ID',
|
|
||||||
], [
|
|
||||||
'column' => 'sublist.is_subscribed',
|
|
||||||
'alias' => 'issubs',
|
|
||||||
'type' => 'boolean',
|
|
||||||
'label' => 'Subscribed',
|
|
||||||
], [
|
|
||||||
'column' => 'sublist.email',
|
|
||||||
'alias' => 'subsemail',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Email',
|
'label' => 'Email',
|
||||||
]
|
|
||||||
],
|
|
||||||
//don't use aliasing in case of searchables
|
|
||||||
|
|
||||||
'searchable' => [
|
|
||||||
[
|
|
||||||
'column' => 'sublist.id',
|
|
||||||
'type' => 'number',
|
|
||||||
'label' => 'ID',
|
|
||||||
], [
|
|
||||||
'column' => 'sublist.is_subscribed',
|
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'label' => 'Subscribed',
|
'searchable' => true,
|
||||||
], [
|
'sortable' => true,
|
||||||
'column' => 'sublist.email',
|
'width' => '100px'
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Email',
|
|
||||||
]
|
|
||||||
],
|
|
||||||
|
|
||||||
//list of viable operators that will be used
|
|
||||||
'operators' => [
|
|
||||||
'eq' => "=",
|
|
||||||
'lt' => "<",
|
|
||||||
'gt' => ">",
|
|
||||||
'lte' => "<=",
|
|
||||||
'gte' => ">=",
|
|
||||||
'neqs' => "<>",
|
|
||||||
'neqn' => "!=",
|
|
||||||
'like' => "like",
|
|
||||||
'nlike' => "not like",
|
|
||||||
],
|
|
||||||
// 'css' => []
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render()
|
public function prepareActions() {
|
||||||
{
|
$this->addAction([
|
||||||
return $this->newsLetterDataGrid()->render();
|
'type' => 'Edit',
|
||||||
|
'route' => 'admin.customers.subscribers.edit',
|
||||||
|
'icon' => 'icon pencil-lg-icon'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->addAction([
|
||||||
|
'type' => 'Delete',
|
||||||
|
'route' => 'admin.customers.subscribers.delete',
|
||||||
|
'confirm_text' => trans('ui::app.datagrid.massaction.delete', ['resource' => 'Exchange Rate']),
|
||||||
|
'icon' => 'icon trash-icon'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function prepareMassActions() {
|
||||||
|
// $this->prepareMassAction([
|
||||||
|
// 'type' => 'delete',
|
||||||
|
// 'action' => route('admin.catalog.products.massdelete'),
|
||||||
|
// 'method' => 'DELETE'
|
||||||
|
// ]);
|
||||||
|
|
||||||
|
// $this->prepareMassAction([
|
||||||
|
// 'type' => 'update',
|
||||||
|
// 'action' => route('admin.catalog.products.massupdate'),
|
||||||
|
// 'method' => 'PUT',
|
||||||
|
// 'options' => [
|
||||||
|
// 0 => true,
|
||||||
|
// 1 => false,
|
||||||
|
// ]
|
||||||
|
// ]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2,102 +2,97 @@
|
||||||
|
|
||||||
namespace Webkul\Admin\DataGrids;
|
namespace Webkul\Admin\DataGrids;
|
||||||
|
|
||||||
use Illuminate\View\View;
|
use Webkul\Ui\DataGrid\AbsGrid;
|
||||||
use Webkul\Ui\DataGrid\Facades\DataGrid;
|
use DB;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* OrderDataGrid
|
* Product Data Grid 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
|
class OrderDataGrid extends AbsGrid
|
||||||
{
|
{
|
||||||
|
public $allColumns = [];
|
||||||
|
|
||||||
/**
|
public function prepareQueryBuilder()
|
||||||
* The Data Grid implementation for orders
|
|
||||||
*/
|
|
||||||
public function createOrderDataGrid()
|
|
||||||
{
|
{
|
||||||
return DataGrid::make([
|
$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'));
|
||||||
'name' => 'orders',
|
|
||||||
'table' => 'orders as or',
|
|
||||||
'select' => 'or.id',
|
|
||||||
'perpage' => 10,
|
|
||||||
'aliased' => false, //True in case of joins else aliasing key required on all cases
|
|
||||||
|
|
||||||
'massoperations' =>[
|
$this->setQueryBuilder($queryBuilder);
|
||||||
// [
|
}
|
||||||
// 'route' => route('admin.datagrid.delete'),
|
|
||||||
// 'method' => 'DELETE',
|
|
||||||
// 'label' => 'Delete',
|
|
||||||
// 'type' => 'button',
|
|
||||||
// ],
|
|
||||||
],
|
|
||||||
|
|
||||||
'actions' => [
|
public function setIndex() {
|
||||||
[
|
$this->index = 'id'; //the column that needs to be treated as index column
|
||||||
'type' => 'View',
|
}
|
||||||
'route' => 'admin.sales.orders.view',
|
|
||||||
// 'confirm_text' => 'Do you really want to view this record?',
|
|
||||||
'icon' => 'icon eye-icon',
|
|
||||||
'icon-alt' => 'View'
|
|
||||||
]
|
|
||||||
],
|
|
||||||
|
|
||||||
'join' => [],
|
public function addColumns()
|
||||||
|
{
|
||||||
//use aliasing on secodary columns if join is performed
|
$this->addColumn([
|
||||||
'columns' => [
|
'index' => 'id',
|
||||||
[
|
'alias' => 'orderId',
|
||||||
'name' => 'or.id',
|
|
||||||
'alias' => 'orderid',
|
|
||||||
'type' => 'number',
|
|
||||||
'label' => 'ID',
|
'label' => 'ID',
|
||||||
|
'type' => 'number',
|
||||||
|
'searchable' => false,
|
||||||
'sortable' => true,
|
'sortable' => true,
|
||||||
], [
|
'width' => '40px'
|
||||||
'name' => 'CONCAT(or.customer_first_name, " ", or.customer_last_name)',
|
]);
|
||||||
'alias' => 'oafirstname',
|
|
||||||
'type' => 'string',
|
$this->addColumn([
|
||||||
'label' => 'Billed To',
|
'index' => 'base_grand_total',
|
||||||
'sortable' => false,
|
'alias' => 'baseGrandTotal',
|
||||||
], [
|
|
||||||
'name' => 'or.base_grand_total',
|
|
||||||
'alias' => 'orbasegrandtotal',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Base Total',
|
'label' => 'Base Total',
|
||||||
|
'type' => 'string',
|
||||||
|
'searchable' => true,
|
||||||
'sortable' => true,
|
'sortable' => true,
|
||||||
|
'width' => '100px',
|
||||||
'wrapper' => function ($value) {
|
'wrapper' => function ($value) {
|
||||||
return core()->formatBasePrice($value);
|
return core()->formatBasePrice($value);
|
||||||
}
|
}
|
||||||
], [
|
]);
|
||||||
'name' => 'or.grand_total',
|
|
||||||
'alias' => 'oagrandtotal',
|
$this->addColumn([
|
||||||
'type' => 'string',
|
'index' => 'grand_total',
|
||||||
|
'alias' => 'grandTotal',
|
||||||
'label' => 'Grand Total',
|
'label' => 'Grand Total',
|
||||||
'sortable' => false,
|
'type' => 'string',
|
||||||
|
'searchable' => true,
|
||||||
|
'sortable' => true,
|
||||||
|
'width' => '100px',
|
||||||
'wrapper' => function ($value) {
|
'wrapper' => function ($value) {
|
||||||
return core()->formatBasePrice($value);
|
return core()->formatBasePrice($value);
|
||||||
}
|
}
|
||||||
], [
|
]);
|
||||||
'name' => 'or.created_at',
|
|
||||||
'alias' => 'createdat',
|
$this->addColumn([
|
||||||
'type' => 'datetime',
|
'index' => 'created_at',
|
||||||
|
'alias' => 'orderDate',
|
||||||
'label' => 'Order Date',
|
'label' => 'Order Date',
|
||||||
'sortable' => true,
|
|
||||||
], [
|
|
||||||
'name' => 'or.channel_name',
|
|
||||||
'alias' => 'channelname',
|
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
|
'sortable' => true,
|
||||||
|
'searchable' => true,
|
||||||
|
'width' => '100px',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->addColumn([
|
||||||
|
'index' => 'channel_name',
|
||||||
|
'alias' => 'channelName',
|
||||||
'label' => 'Channel Name',
|
'label' => 'Channel Name',
|
||||||
'sortable' => true,
|
|
||||||
], [
|
|
||||||
'name' => 'or.status',
|
|
||||||
'alias' => 'orstatus',
|
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'label' => 'Status',
|
|
||||||
'sortable' => true,
|
'sortable' => true,
|
||||||
'closure' => true, //to be used when ever wrappers or callables are used
|
'searchable' => false,
|
||||||
|
'width' => '100px'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->addColumn([
|
||||||
|
'index' => 'status',
|
||||||
|
'alias' => 'status',
|
||||||
|
'label' => 'Status',
|
||||||
|
'type' => 'string',
|
||||||
|
'sortable' => true,
|
||||||
|
'searchable' => false,
|
||||||
|
'width' => '100px',
|
||||||
|
'closure' => true,
|
||||||
'wrapper' => function ($value) {
|
'wrapper' => function ($value) {
|
||||||
if($value == 'processing')
|
if($value == 'processing')
|
||||||
return '<span class="badge badge-md badge-success">Processing</span>';
|
return '<span class="badge badge-md badge-success">Processing</span>';
|
||||||
|
|
@ -113,66 +108,33 @@ class OrderDataGrid
|
||||||
return '<span class="badge badge-md badge-warning">Pending Payment</span>';
|
return '<span class="badge badge-md badge-warning">Pending Payment</span>';
|
||||||
else if($value == "fraud")
|
else if($value == "fraud")
|
||||||
return '<span class="badge badge-md badge-danger">Fraud</span>';
|
return '<span class="badge badge-md badge-danger">Fraud</span>';
|
||||||
},
|
}
|
||||||
],
|
]);
|
||||||
],
|
|
||||||
|
|
||||||
'filterable' => [
|
$this->addColumn([
|
||||||
[
|
'index' => 'fullname',
|
||||||
'column' => 'or.id',
|
'alias' => 'fullName',
|
||||||
'alias' => 'orderid',
|
|
||||||
'type' => 'number',
|
|
||||||
'label' => 'ID',
|
|
||||||
], [
|
|
||||||
'column' => 'or.status',
|
|
||||||
'alias' => 'orstatus',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Status'
|
|
||||||
], [
|
|
||||||
'column' => 'or.created_at',
|
|
||||||
'alias' => 'createdat',
|
|
||||||
'type' => 'datetime',
|
|
||||||
'label' => 'Order Date',
|
|
||||||
], [
|
|
||||||
'column' => 'CONCAT(or.customer_first_name, " ", or.customer_last_name)',
|
|
||||||
'alias' => 'oafirstname',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Billed To',
|
'label' => 'Billed To',
|
||||||
],
|
|
||||||
],
|
|
||||||
|
|
||||||
//don't use aliasing in case of searchables
|
|
||||||
'searchable' => [
|
|
||||||
[
|
|
||||||
'column' => 'or.id',
|
|
||||||
'alias' => 'orderid',
|
|
||||||
'type' => 'number',
|
|
||||||
], [
|
|
||||||
'column' => 'or.status',
|
|
||||||
'alias' => 'orstatus',
|
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
]
|
'searchable' => false,
|
||||||
],
|
'sortable' => true,
|
||||||
|
'width' => '100px'
|
||||||
//list of viable operators that will be used
|
|
||||||
'operators' => [
|
|
||||||
'eq' => "=",
|
|
||||||
'lt' => "<",
|
|
||||||
'gt' => ">",
|
|
||||||
'lte' => "<=",
|
|
||||||
'gte' => ">=",
|
|
||||||
'neqs' => "<>",
|
|
||||||
'neqn' => "!=",
|
|
||||||
'like' => "like",
|
|
||||||
'nlike' => "not like",
|
|
||||||
],
|
|
||||||
|
|
||||||
// 'css' => []
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render($pagination = true)
|
public function prepareActions() {
|
||||||
{
|
$this->addAction([
|
||||||
return $this->createOrderDataGrid()->render($pagination);
|
'type' => 'View',
|
||||||
|
'route' => 'admin.sales.orders.view',
|
||||||
|
'icon' => 'icon eye-icon'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function prepareMassActions() {
|
||||||
|
// $this->addMassAction([
|
||||||
|
// 'type' => 'delete',
|
||||||
|
// 'action' => route('admin.catalog.attributes.massdelete'),
|
||||||
|
// 'method' => 'DELETE'
|
||||||
|
// ]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2,156 +2,86 @@
|
||||||
|
|
||||||
namespace Webkul\Admin\DataGrids;
|
namespace Webkul\Admin\DataGrids;
|
||||||
|
|
||||||
use Illuminate\View\View;
|
use Webkul\Ui\DataGrid\AbsGrid;
|
||||||
use Webkul\Ui\DataGrid\Facades\DataGrid;
|
use DB;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* OrderInvoicesDataGrid
|
* Product Data Grid 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
|
class OrderInvoicesDataGrid extends AbsGrid
|
||||||
{
|
{
|
||||||
|
public $allColumns = [];
|
||||||
|
|
||||||
/**
|
public function prepareQueryBuilder()
|
||||||
* The Order invoices Data Grid implementation for invoices of orders
|
|
||||||
*/
|
|
||||||
public function createOrderInvoicesDataGrid()
|
|
||||||
{
|
{
|
||||||
|
$queryBuilder = DB::table('invoices')->select('id', 'order_id', 'state', 'grand_total', 'created_at');
|
||||||
|
|
||||||
return DataGrid::make([
|
$this->setQueryBuilder($queryBuilder);
|
||||||
'name' => 'invoices',
|
}
|
||||||
'table' => 'invoices as inv',
|
|
||||||
'select' => 'inv.id',
|
|
||||||
'perpage' => 10,
|
|
||||||
'aliased' => false,
|
|
||||||
|
|
||||||
'massoperations' =>[
|
public function setIndex() {
|
||||||
// [
|
$this->index = 'id'; //the column that needs to be treated as index column
|
||||||
// 'route' => route('admin.datagrid.delete'),
|
}
|
||||||
// 'method' => 'DELETE',
|
|
||||||
// 'label' => 'Delete',
|
|
||||||
// 'type' => 'button',
|
|
||||||
// ],
|
|
||||||
],
|
|
||||||
|
|
||||||
'actions' => [
|
public function addColumns()
|
||||||
[
|
{
|
||||||
'type' => 'View',
|
$this->addColumn([
|
||||||
'route' => 'admin.sales.invoices.view',
|
'index' => 'id',
|
||||||
// 'confirm_text' => 'Do you really want to view this record?',
|
|
||||||
'icon' => 'icon eye-icon',
|
|
||||||
'icon-alt' => 'View'
|
|
||||||
],
|
|
||||||
],
|
|
||||||
|
|
||||||
'join' => [
|
|
||||||
// [
|
|
||||||
// 'join' => 'leftjoin',
|
|
||||||
// 'table' => 'orders as ors',
|
|
||||||
// 'primaryKey' => 'inv.order_id',
|
|
||||||
// 'condition' => '=',
|
|
||||||
// 'secondaryKey' => 'ors.id',
|
|
||||||
// ]
|
|
||||||
],
|
|
||||||
|
|
||||||
//use aliasing on secodary columns if join is performed
|
|
||||||
|
|
||||||
'columns' => [
|
|
||||||
[
|
|
||||||
'name' => 'inv.id',
|
|
||||||
'alias' => 'invid',
|
'alias' => 'invid',
|
||||||
'type' => 'number',
|
|
||||||
'label' => 'ID',
|
'label' => 'ID',
|
||||||
'sortable' => true
|
|
||||||
], [
|
|
||||||
'name' => 'inv.order_id',
|
|
||||||
'alias' => 'invorderid',
|
|
||||||
'type' => 'number',
|
'type' => 'number',
|
||||||
'label' => 'Order ID',
|
'searchable' => false,
|
||||||
'sortable' => true
|
|
||||||
], [
|
|
||||||
'name' => 'inv.state',
|
|
||||||
'alias' => 'invstate',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'State',
|
|
||||||
'sortable' => true
|
|
||||||
], [
|
|
||||||
'name' => 'inv.grand_total',
|
|
||||||
'alias' => 'invgrandtotal',
|
|
||||||
'type' => 'number',
|
|
||||||
'label' => 'Amount',
|
|
||||||
'sortable' => true,
|
'sortable' => true,
|
||||||
'wrapper' => function ($value) {
|
'width' => '40px'
|
||||||
return core()->formatBasePrice($value);
|
]);
|
||||||
},
|
|
||||||
], [
|
|
||||||
'name' => 'inv.created_at',
|
|
||||||
'alias' => 'invcreated_at',
|
|
||||||
'type' => 'datetime',
|
|
||||||
'label' => 'Invoice Date',
|
|
||||||
'sortable' => true
|
|
||||||
]
|
|
||||||
],
|
|
||||||
|
|
||||||
'filterable' => [
|
$this->addColumn([
|
||||||
[
|
'index' => 'order_id',
|
||||||
'column' => 'inv.id',
|
'alias' => 'orderId',
|
||||||
'alias' => 'invid',
|
|
||||||
'type' => 'number',
|
|
||||||
'label' => 'ID',
|
|
||||||
], [
|
|
||||||
'column' => 'inv.order_id',
|
|
||||||
'alias' => 'invorderid',
|
|
||||||
'type' => 'number',
|
|
||||||
'label' => 'Order ID',
|
'label' => 'Order ID',
|
||||||
], [
|
|
||||||
'column' => 'inv.state',
|
|
||||||
'alias' => 'invstate',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'State',
|
|
||||||
], [
|
|
||||||
'column' => 'inv.grand_total',
|
|
||||||
'alias' => 'invgrandtotal',
|
|
||||||
'type' => 'number',
|
'type' => 'number',
|
||||||
'label' => 'Amount',
|
'searchable' => false,
|
||||||
], [
|
'sortable' => true,
|
||||||
'column' => 'inv.created_at',
|
'width' => '100px'
|
||||||
'alias' => 'invcreated_at',
|
]);
|
||||||
'type' => 'datetime',
|
|
||||||
|
$this->addColumn([
|
||||||
|
'index' => 'grand_total',
|
||||||
|
'alias' => 'invgrandtotal',
|
||||||
|
'label' => 'Grand Total',
|
||||||
|
'type' => 'string',
|
||||||
|
'searchable' => true,
|
||||||
|
'sortable' => true,
|
||||||
|
'width' => '100px',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->addColumn([
|
||||||
|
'index' => 'created_at',
|
||||||
|
'alias' => 'invcreatedat',
|
||||||
'label' => 'Invoice Date',
|
'label' => 'Invoice Date',
|
||||||
]
|
'type' => 'datetime',
|
||||||
],
|
'searchable' => true,
|
||||||
//don't use aliasing in case of searchables
|
'sortable' => true,
|
||||||
|
'width' => '100px',
|
||||||
'searchable' => [
|
|
||||||
// [
|
|
||||||
// 'column' => 'or.id',
|
|
||||||
// 'alias' => 'orderid',
|
|
||||||
// 'type' => 'number',
|
|
||||||
// 'label' => 'ID',
|
|
||||||
// ]
|
|
||||||
],
|
|
||||||
|
|
||||||
//list of viable operators that will be used
|
|
||||||
'operators' => [
|
|
||||||
'eq' => "=",
|
|
||||||
'lt' => "<",
|
|
||||||
'gt' => ">",
|
|
||||||
'lte' => "<=",
|
|
||||||
'gte' => ">=",
|
|
||||||
'neqs' => "<>",
|
|
||||||
'neqn' => "!=",
|
|
||||||
'like' => "like",
|
|
||||||
'nlike' => "not like",
|
|
||||||
],
|
|
||||||
// 'css' => []
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render($pagination = true)
|
public function prepareActions() {
|
||||||
{
|
$this->addAction([
|
||||||
return $this->createOrderInvoicesDataGrid()->render($pagination);
|
'type' => 'View',
|
||||||
|
'route' => 'admin.sales.invoices.view',
|
||||||
|
'icon' => 'icon eye-icon'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function prepareMassActions() {
|
||||||
|
// $this->addMassAction([
|
||||||
|
// 'type' => 'delete',
|
||||||
|
// 'action' => route('admin.catalog.attributes.massdelete'),
|
||||||
|
// 'method' => 'DELETE'
|
||||||
|
// ]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2,154 +2,116 @@
|
||||||
|
|
||||||
namespace Webkul\Admin\DataGrids;
|
namespace Webkul\Admin\DataGrids;
|
||||||
|
|
||||||
use Illuminate\View\View;
|
use Webkul\Ui\DataGrid\AbsGrid;
|
||||||
use Webkul\Ui\DataGrid\Facades\DataGrid;
|
|
||||||
use DB;
|
use DB;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* OrderShipmentsDataGrid
|
* Product Data Grid 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
|
class OrderShipmentsDataGrid extends AbsGrid
|
||||||
{
|
{
|
||||||
|
public $allColumns = [];
|
||||||
|
|
||||||
/**
|
public function prepareQueryBuilder()
|
||||||
* The Order Shipments Data Grid implementation for shipments of orders
|
|
||||||
*/
|
|
||||||
public function createOrderShipmentsDataGrid()
|
|
||||||
{
|
{
|
||||||
return DataGrid::make([
|
$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');
|
||||||
'name' => 'shipments',
|
|
||||||
'table' => 'shipments as ship',
|
|
||||||
'select' => 'ship.id',
|
|
||||||
'perpage' => 10,
|
|
||||||
'aliased' => true,
|
|
||||||
|
|
||||||
'massoperations' =>[
|
$this->setQueryBuilder($queryBuilder);
|
||||||
// [
|
}
|
||||||
// 'route' => route('admin.datagrid.delete'),
|
|
||||||
// 'method' => 'DELETE',
|
|
||||||
// 'label' => 'Delete',
|
|
||||||
// 'type' => 'button',
|
|
||||||
// ],
|
|
||||||
],
|
|
||||||
|
|
||||||
'actions' => [
|
public function setIndex() {
|
||||||
[
|
$this->index = 'id'; //the column that needs to be treated as index column
|
||||||
'type' => 'View',
|
}
|
||||||
'route' => 'admin.sales.shipments.view',
|
|
||||||
// 'confirm_text' => 'Do you really want to view this record?',
|
|
||||||
'icon' => 'icon eye-icon',
|
|
||||||
'icon-alt' => 'View'
|
|
||||||
],
|
|
||||||
],
|
|
||||||
|
|
||||||
'join' => [
|
public function addColumns()
|
||||||
[
|
{
|
||||||
'join' => 'leftjoin',
|
$this->addColumn([
|
||||||
'table' => 'orders as ors',
|
'index' => 'ship.id',
|
||||||
'primaryKey' => 'ship.order_id',
|
'alias' => 'shipId',
|
||||||
'condition' => '=',
|
|
||||||
'secondaryKey' => 'ors.id',
|
|
||||||
], [
|
|
||||||
'join' => 'leftjoin',
|
|
||||||
'table' => 'inventory_sources as is',
|
|
||||||
'primaryKey' => 'ship.inventory_source_id',
|
|
||||||
'condition' => '=',
|
|
||||||
'secondaryKey' => 'is.id',
|
|
||||||
]
|
|
||||||
],
|
|
||||||
|
|
||||||
//use aliasing on secodary columns if join is performed
|
|
||||||
'columns' => [
|
|
||||||
[
|
|
||||||
'name' => 'ship.id',
|
|
||||||
'alias' => 'shipID',
|
|
||||||
'type' => 'number',
|
|
||||||
'label' => 'ID',
|
'label' => 'ID',
|
||||||
'sortable' => true
|
|
||||||
], [
|
|
||||||
'name' => 'ship.order_id',
|
|
||||||
'alias' => 'orderid',
|
|
||||||
'type' => 'number',
|
'type' => 'number',
|
||||||
|
'searchable' => false,
|
||||||
|
'sortable' => true,
|
||||||
|
'width' => '40px'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->addColumn([
|
||||||
|
'index' => 'ship.order_id',
|
||||||
|
'alias' => 'orderId',
|
||||||
'label' => 'Order ID',
|
'label' => 'Order ID',
|
||||||
'sortable' => true
|
|
||||||
], [
|
|
||||||
'name' => 'ship.total_qty',
|
|
||||||
'alias' => 'shiptotalqty',
|
|
||||||
'type' => 'number',
|
'type' => 'number',
|
||||||
'label' => 'Total Quantity',
|
'searchable' => false,
|
||||||
'sortable' => true
|
'sortable' => true,
|
||||||
], [
|
'width' => '100px'
|
||||||
'name' => 'CONCAT(ors.customer_first_name, " ", ors.customer_last_name)',
|
]);
|
||||||
'alias' => 'ordercustomerfirstname',
|
|
||||||
'type' => 'string',
|
$this->addColumn([
|
||||||
'label' => 'Customer Name',
|
'index' => 'ship.total_qty',
|
||||||
'sortable' => false,
|
'alias' => 'shipTotalQty',
|
||||||
], [
|
'label' => 'Total Qty',
|
||||||
'name' => 'is.name',
|
'type' => 'number',
|
||||||
'alias' => 'inventorySourceName',
|
'searchable' => true,
|
||||||
'type' => 'string',
|
'sortable' => true,
|
||||||
|
'width' => '100px',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->addColumn([
|
||||||
|
'index' => 'is.name',
|
||||||
|
'alias' => 'shipInventoryName',
|
||||||
'label' => 'Inventory Source',
|
'label' => 'Inventory Source',
|
||||||
'sortable' => true
|
'type' => 'string',
|
||||||
], [
|
'searchable' => true,
|
||||||
'name' => 'ors.created_at',
|
'sortable' => true,
|
||||||
'alias' => 'orscreated',
|
'width' => '100px',
|
||||||
'type' => 'date',
|
]);
|
||||||
|
|
||||||
|
$this->addColumn([
|
||||||
|
'index' => 'orderdate',
|
||||||
|
'alias' => 'shipOrderDate',
|
||||||
'label' => 'Order Date',
|
'label' => 'Order Date',
|
||||||
'sortable' => true
|
|
||||||
], [
|
|
||||||
'name' => 'ship.created_at',
|
|
||||||
'alias' => 'shipdate',
|
|
||||||
'type' => 'datetime',
|
'type' => 'datetime',
|
||||||
'label' => 'Shipment Date',
|
'sortable' => true,
|
||||||
'sortable' => true
|
'searchable' => true,
|
||||||
]
|
'width' => '100px'
|
||||||
],
|
]);
|
||||||
|
|
||||||
'filterable' => [
|
$this->addColumn([
|
||||||
[
|
'index' => 'ship.created_at',
|
||||||
'column' => 'ship.id',
|
'alias' => 'shipDate',
|
||||||
'alias' => 'shipID',
|
'label' => 'Shipment Date',
|
||||||
'type' => 'number',
|
|
||||||
'label' => 'ID',
|
|
||||||
], [
|
|
||||||
'column' => 'ship.created_at',
|
|
||||||
'alias' => 'shipdate',
|
|
||||||
'type' => 'datetime',
|
'type' => 'datetime',
|
||||||
'label' => 'Shipment Date',
|
'sortable' => true,
|
||||||
]
|
'searchable' => false,
|
||||||
],
|
'width' => '100px'
|
||||||
//don't use aliasing in case of searchables
|
]);
|
||||||
|
|
||||||
'searchable' => [
|
$this->addColumn([
|
||||||
// [
|
'index' => 'custname',
|
||||||
// 'column' => 'ors.customer_first_name',
|
'alias' => 'shipTO',
|
||||||
// 'alias' => 'ordercustomerfirstname',
|
'label' => 'Shipping To',
|
||||||
// 'type' => 'string',
|
'type' => 'string',
|
||||||
// ]
|
'sortable' => true,
|
||||||
],
|
'searchable' => false,
|
||||||
|
'width' => '100px'
|
||||||
//list of viable operators that will be used
|
|
||||||
'operators' => [
|
|
||||||
'eq' => "=",
|
|
||||||
'lt' => "<",
|
|
||||||
'gt' => ">",
|
|
||||||
'lte' => "<=",
|
|
||||||
'gte' => ">=",
|
|
||||||
'neqs' => "<>",
|
|
||||||
'neqn' => "!=",
|
|
||||||
'like' => "like",
|
|
||||||
'nlike' => "not like",
|
|
||||||
],
|
|
||||||
// 'css' => []
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render($pagination = true)
|
public function prepareActions() {
|
||||||
{
|
$this->addAction([
|
||||||
return $this->createOrderShipmentsDataGrid()->render($pagination);
|
'type' => 'View',
|
||||||
|
'route' => 'admin.sales.orders.view',
|
||||||
|
'icon' => 'icon eye-icon'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function prepareMassActions() {
|
||||||
|
// $this->addMassAction([
|
||||||
|
// 'type' => 'delete',
|
||||||
|
// 'action' => route('admin.catalog.attributes.massdelete'),
|
||||||
|
// 'method' => 'DELETE'
|
||||||
|
// ]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2,137 +2,86 @@
|
||||||
|
|
||||||
namespace Webkul\Admin\DataGrids;
|
namespace Webkul\Admin\DataGrids;
|
||||||
|
|
||||||
use Illuminate\View\View;
|
use Webkul\Ui\DataGrid\AbsGrid;
|
||||||
use Webkul\Ui\DataGrid\Facades\DataGrid;
|
use DB;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User Roles DataGrid
|
* News Letter Grid 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
|
class RolesDataGrid extends AbsGrid
|
||||||
{
|
{
|
||||||
/**
|
public $allColumns = [];
|
||||||
* The Data Grid implementation for Roles
|
|
||||||
*/
|
public function prepareQueryBuilder()
|
||||||
public function createRolesDataGrid()
|
|
||||||
{
|
{
|
||||||
|
$queryBuilder = DB::table('roles')->addSelect('id', 'name', 'permission_type');
|
||||||
|
|
||||||
return DataGrid::make([
|
$this->setQueryBuilder($queryBuilder);
|
||||||
'name' => 'Roles',
|
}
|
||||||
'table' => 'roles',
|
|
||||||
'select' => 'id',
|
|
||||||
'perpage' => 10,
|
|
||||||
'aliased' => false, //use this with false as default and true in case of joins
|
|
||||||
|
|
||||||
'massoperations' =>[
|
public function setIndex() {
|
||||||
// [
|
$this->index = 'id';
|
||||||
// 'route' => route('admin.datagrid.delete'),
|
}
|
||||||
// 'method' => 'DELETE',
|
|
||||||
// 'label' => 'Delete',
|
|
||||||
// 'type' => 'button',
|
|
||||||
// ],
|
|
||||||
],
|
|
||||||
|
|
||||||
'actions' => [
|
public function addColumns()
|
||||||
[
|
{
|
||||||
'type' => 'Edit',
|
$this->addColumn([
|
||||||
'route' => 'admin.roles.edit',
|
'index' => 'id',
|
||||||
'confirm_text' => 'Do you really want to edit this record?',
|
|
||||||
'icon' => 'icon pencil-lg-icon',
|
|
||||||
]
|
|
||||||
],
|
|
||||||
|
|
||||||
'join' => [
|
|
||||||
// [
|
|
||||||
// 'join' => 'leftjoin',
|
|
||||||
// 'table' => 'roles as r',
|
|
||||||
// 'primaryKey' => 'u.role_id',
|
|
||||||
// 'condition' => '=',
|
|
||||||
// 'secondaryKey' => 'r.id',
|
|
||||||
// ]
|
|
||||||
],
|
|
||||||
|
|
||||||
//use aliasing on secodary columns if join is performed
|
|
||||||
|
|
||||||
'columns' => [
|
|
||||||
[
|
|
||||||
'name' => 'id',
|
|
||||||
'alias' => 'roleId',
|
'alias' => 'roleId',
|
||||||
'type' => 'number',
|
|
||||||
'label' => 'ID',
|
'label' => 'ID',
|
||||||
'sortable' => true,
|
|
||||||
], [
|
|
||||||
'name' => 'name',
|
|
||||||
'alias' => 'roleName',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Name',
|
|
||||||
'sortable' => true,
|
|
||||||
], [
|
|
||||||
'name' => 'permission_type',
|
|
||||||
'alias' => 'rolePermissionType',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Permission Type',
|
|
||||||
'sortable' => true,
|
|
||||||
],
|
|
||||||
],
|
|
||||||
|
|
||||||
//don't use aliasing in case of filters
|
|
||||||
|
|
||||||
'filterable' => [
|
|
||||||
[
|
|
||||||
'column' => 'id',
|
|
||||||
'alias' => 'roleId',
|
|
||||||
'type' => 'number',
|
'type' => 'number',
|
||||||
'label' => 'ID',
|
'searchable' => false,
|
||||||
], [
|
'sortable' => true,
|
||||||
'column' => 'name',
|
'width' => '40px'
|
||||||
'alias' => 'roleName',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Name',
|
|
||||||
], [
|
|
||||||
'column' => 'permission_type',
|
|
||||||
'alias' => 'rolePermissionType',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Permission Type',
|
|
||||||
],
|
|
||||||
],
|
|
||||||
|
|
||||||
//don't use aliasing in case of searchables
|
|
||||||
|
|
||||||
'searchable' => [
|
|
||||||
[
|
|
||||||
'column' => 'name',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Name',
|
|
||||||
], [
|
|
||||||
'column' => 'permission_type',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Permission Type',
|
|
||||||
],
|
|
||||||
],
|
|
||||||
|
|
||||||
//list of viable operators that will be used
|
|
||||||
'operators' => [
|
|
||||||
'eq' => "=",
|
|
||||||
'lt' => "<",
|
|
||||||
'gt' => ">",
|
|
||||||
'lte' => "<=",
|
|
||||||
'gte' => ">=",
|
|
||||||
'neqs' => "<>",
|
|
||||||
'neqn' => "!=",
|
|
||||||
'like' => "like",
|
|
||||||
'nlike' => "not like",
|
|
||||||
],
|
|
||||||
// 'css' => []
|
|
||||||
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
$this->addColumn([
|
||||||
|
'index' => 'name',
|
||||||
|
'alias' => 'roleName',
|
||||||
|
'label' => 'Name',
|
||||||
|
'type' => 'string',
|
||||||
|
'searchable' => true,
|
||||||
|
'sortable' => true,
|
||||||
|
'width' => '100px'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->addColumn([
|
||||||
|
'index' => 'permission_type',
|
||||||
|
'alias' => 'roleType',
|
||||||
|
'label' => 'Permission Type',
|
||||||
|
'type' => 'string',
|
||||||
|
'searchable' => true,
|
||||||
|
'sortable' => true,
|
||||||
|
'width' => '100px'
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render()
|
public function prepareActions() {
|
||||||
{
|
$this->addAction([
|
||||||
return $this->createRolesDataGrid()->render();
|
'type' => 'Edit',
|
||||||
|
'route' => 'admin.roles.edit',
|
||||||
|
'icon' => 'icon pencil-lg-icon'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function prepareMassActions() {
|
||||||
|
// $this->prepareMassAction([
|
||||||
|
// 'type' => 'delete',
|
||||||
|
// 'action' => route('admin.catalog.products.massdelete'),
|
||||||
|
// 'method' => 'DELETE'
|
||||||
|
// ]);
|
||||||
|
|
||||||
|
// $this->prepareMassAction([
|
||||||
|
// 'type' => 'update',
|
||||||
|
// 'action' => route('admin.catalog.products.massupdate'),
|
||||||
|
// 'method' => 'PUT',
|
||||||
|
// 'options' => [
|
||||||
|
// 0 => true,
|
||||||
|
// 1 => false,
|
||||||
|
// ]
|
||||||
|
// ]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2,143 +2,92 @@
|
||||||
|
|
||||||
namespace Webkul\Admin\DataGrids;
|
namespace Webkul\Admin\DataGrids;
|
||||||
|
|
||||||
use Illuminate\View\View;
|
use Webkul\Ui\DataGrid\AbsGrid;
|
||||||
use Webkul\Ui\DataGrid\Facades\DataGrid;
|
use DB;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sliders DataGrid
|
* News Letter Grid 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
|
class SliderDataGrid extends AbsGrid
|
||||||
{
|
{
|
||||||
|
public $allColumns = [];
|
||||||
|
|
||||||
/**
|
public function prepareQueryBuilder()
|
||||||
* The Data Grid implementation for Sliders
|
|
||||||
*/
|
|
||||||
public function createSliderDataGrid()
|
|
||||||
{
|
{
|
||||||
|
$queryBuilder = DB::table('sliders as sl')->addSelect('sl.id', 'sl.title', 'ch.name')->leftJoin('channels as ch', 'sl.channel_id', '=', 'ch.id');
|
||||||
|
|
||||||
return DataGrid::make([
|
$this->setQueryBuilder($queryBuilder);
|
||||||
'name' => 'Sliders',
|
}
|
||||||
'table' => 'sliders as s',
|
|
||||||
'select' => 's.id',
|
|
||||||
'perpage' => 10,
|
|
||||||
'aliased' => true, //use this with false as default and true in case of joins
|
|
||||||
|
|
||||||
'massoperations' =>[
|
public function setIndex() {
|
||||||
// [
|
$this->index = 'id';
|
||||||
// 'route' => route('admin.datagrid.delete'),
|
}
|
||||||
// 'method' => 'DELETE',
|
|
||||||
// 'label' => 'Delete',
|
|
||||||
// 'type' => 'button',
|
|
||||||
// ],
|
|
||||||
],
|
|
||||||
|
|
||||||
'actions' => [
|
public function addColumns()
|
||||||
[
|
{
|
||||||
'type' => 'Edit',
|
$this->addColumn([
|
||||||
'route' => 'admin.sliders.edit',
|
'index' => 'sl.id',
|
||||||
'confirm_text' => 'Do you really want to edit this record?',
|
|
||||||
'icon' => 'icon pencil-lg-icon',
|
|
||||||
], [
|
|
||||||
'type' => 'Delete',
|
|
||||||
'route' => 'admin.sliders.delete',
|
|
||||||
'confirm_text' => 'Do you really want to delete this record?',
|
|
||||||
'icon' => 'icon trash-icon',
|
|
||||||
],
|
|
||||||
],
|
|
||||||
|
|
||||||
'join' => [
|
|
||||||
[
|
|
||||||
'join' => 'leftjoin',
|
|
||||||
'table' => 'channels as c',
|
|
||||||
'primaryKey' => 's.channel_id',
|
|
||||||
'condition' => '=',
|
|
||||||
'secondaryKey' => 'c.id',
|
|
||||||
]
|
|
||||||
],
|
|
||||||
|
|
||||||
//use aliasing on secodary columns if join is performed
|
|
||||||
|
|
||||||
'columns' => [
|
|
||||||
[
|
|
||||||
'name' => 's.id',
|
|
||||||
'alias' => 'sliderId',
|
'alias' => 'sliderId',
|
||||||
'type' => 'number',
|
|
||||||
'label' => 'ID',
|
'label' => 'ID',
|
||||||
'sortable' => true,
|
|
||||||
], [
|
|
||||||
'name' => 's.title',
|
|
||||||
'alias' => 'sliderTitle',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'title',
|
|
||||||
'sortable' => true
|
|
||||||
], [
|
|
||||||
'name' => 'c.name',
|
|
||||||
'alias' => 'channelName',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Channel Name',
|
|
||||||
'sortable' => true,
|
|
||||||
],
|
|
||||||
],
|
|
||||||
|
|
||||||
//don't use aliasing in case of filters
|
|
||||||
'filterable' => [
|
|
||||||
[
|
|
||||||
'column' => 's.id',
|
|
||||||
'alias' => 'sliderId',
|
|
||||||
'type' => 'number',
|
'type' => 'number',
|
||||||
'label' => 'ID'
|
'searchable' => false,
|
||||||
], [
|
'sortable' => true,
|
||||||
'column' => 's.title',
|
'width' => '40px'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->addColumn([
|
||||||
|
'index' => 'sl.title',
|
||||||
'alias' => 'sliderTitle',
|
'alias' => 'sliderTitle',
|
||||||
|
'label' => 'Tile',
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'label' => 'title'
|
'searchable' => true,
|
||||||
], [
|
'sortable' => true,
|
||||||
'column' => 'c.name',
|
'width' => '100px'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->addColumn([
|
||||||
|
'index' => 'ch.name',
|
||||||
'alias' => 'channelName',
|
'alias' => 'channelName',
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Channel Name',
|
'label' => 'Channel Name',
|
||||||
]
|
|
||||||
],
|
|
||||||
|
|
||||||
//don't use aliasing in case of searchables
|
|
||||||
'searchable' => [
|
|
||||||
[
|
|
||||||
'column' => 's.id',
|
|
||||||
'type' => 'number',
|
|
||||||
'label' => 'ID'
|
|
||||||
], [
|
|
||||||
'column' => 's.title',
|
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'label' => 'Slider Title'
|
'searchable' => true,
|
||||||
], [
|
'sortable' => true,
|
||||||
'column' => 'c.name',
|
'width' => '100px'
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Channel Name',
|
|
||||||
]
|
|
||||||
],
|
|
||||||
|
|
||||||
//list of viable operators that will be used
|
|
||||||
'operators' => [
|
|
||||||
'eq' => "=",
|
|
||||||
'lt' => "<",
|
|
||||||
'gt' => ">",
|
|
||||||
'lte' => "<=",
|
|
||||||
'gte' => ">=",
|
|
||||||
'neqs' => "<>",
|
|
||||||
'neqn' => "!=",
|
|
||||||
'like' => "like",
|
|
||||||
'nlike' => "not like",
|
|
||||||
],
|
|
||||||
// 'css' => []
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render()
|
public function prepareActions() {
|
||||||
{
|
$this->addAction([
|
||||||
return $this->createSliderDataGrid()->render();
|
'type' => 'Edit',
|
||||||
|
'route' => 'admin.sliders.edit',
|
||||||
|
'icon' => 'icon pencil-lg-icon'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->addAction([
|
||||||
|
'type' => 'Delete',
|
||||||
|
'route' => 'admin.sliders.delete',
|
||||||
|
'icon' => 'icon trash-icon'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function prepareMassActions() {
|
||||||
|
// $this->prepareMassAction([
|
||||||
|
// 'type' => 'delete',
|
||||||
|
// 'action' => route('admin.catalog.products.massdelete'),
|
||||||
|
// 'method' => 'DELETE'
|
||||||
|
// ]);
|
||||||
|
|
||||||
|
// $this->prepareMassAction([
|
||||||
|
// 'type' => 'update',
|
||||||
|
// 'action' => route('admin.catalog.products.massupdate'),
|
||||||
|
// 'method' => 'PUT',
|
||||||
|
// 'options' => [
|
||||||
|
// 0 => true,
|
||||||
|
// 1 => false,
|
||||||
|
// ]
|
||||||
|
// ]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2,151 +2,92 @@
|
||||||
|
|
||||||
namespace Webkul\Admin\DataGrids;
|
namespace Webkul\Admin\DataGrids;
|
||||||
|
|
||||||
use Illuminate\View\View;
|
use Webkul\Ui\DataGrid\AbsGrid;
|
||||||
use Webkul\Ui\DataGrid\Facades\DataGrid;
|
use DB;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tax Category DataGrid
|
* Tax Category Grid 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 AbsGrid
|
||||||
class TaxCategoryDataGrid
|
|
||||||
{
|
{
|
||||||
|
public $allColumns = [];
|
||||||
|
|
||||||
/**
|
public function prepareQueryBuilder()
|
||||||
* The Tax Category Data Grid implementation.
|
|
||||||
*/
|
|
||||||
public function createTaxCategoryDataGrid()
|
|
||||||
{
|
{
|
||||||
|
$queryBuilder = DB::table('tax_categories')->addSelect('id', 'name', 'code');
|
||||||
|
|
||||||
return DataGrid::make([
|
$this->setQueryBuilder($queryBuilder);
|
||||||
|
}
|
||||||
|
|
||||||
'name' => 'Tax Category',
|
public function setIndex() {
|
||||||
'table' => 'tax_categories as tr',
|
$this->index = 'id';
|
||||||
'select' => 'tr.id',
|
}
|
||||||
'perpage' => 10,
|
|
||||||
'aliased' => true, //use this with false as default and true in case of joins
|
|
||||||
|
|
||||||
'massoperations' =>[
|
public function addColumns()
|
||||||
// [
|
{
|
||||||
// 'route' => route('admin.datagrid.delete'),
|
$this->addColumn([
|
||||||
// 'method' => 'DELETE',
|
'index' => 'id',
|
||||||
// 'label' => 'Delete',
|
'alias' => 'taxCatId',
|
||||||
// 'type' => 'button',
|
|
||||||
// ],
|
|
||||||
// [
|
|
||||||
// 'route' => route('admin.datagrid.index'),
|
|
||||||
// 'method' => 'POST',
|
|
||||||
// 'label' => 'View Grid',
|
|
||||||
// 'type' => 'select',
|
|
||||||
// 'options' =>[
|
|
||||||
// 1 => 'Edit',
|
|
||||||
// 2 => 'Set',
|
|
||||||
// 3 => 'Change Status'
|
|
||||||
// ]
|
|
||||||
// ],
|
|
||||||
],
|
|
||||||
'actions' => [
|
|
||||||
[
|
|
||||||
'type' => 'Edit',
|
|
||||||
'route' => 'admin.tax-categories.edit',
|
|
||||||
'confirm_text' => 'Do you really want to edit this record?',
|
|
||||||
'icon' => 'icon pencil-lg-icon',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'type' => 'Delete',
|
|
||||||
'route' => 'admin.tax-categories.delete',
|
|
||||||
'confirm_text' => 'Do you really want to delete this record?',
|
|
||||||
'icon' => 'icon trash-icon',
|
|
||||||
],
|
|
||||||
],
|
|
||||||
'join' => [
|
|
||||||
// [
|
|
||||||
// 'join' => 'leftjoin',
|
|
||||||
// 'table' => 'roles as r',
|
|
||||||
// 'primaryKey' => 'u.role_id',
|
|
||||||
// 'condition' => '=',
|
|
||||||
// 'secondaryKey' => 'r.id',
|
|
||||||
// ]
|
|
||||||
],
|
|
||||||
|
|
||||||
//use aliasing on secodary columns if join is performed
|
|
||||||
'columns' => [
|
|
||||||
[
|
|
||||||
'name' => 'tr.id',
|
|
||||||
'alias' => 'ID',
|
|
||||||
'type' => 'number',
|
|
||||||
'label' => 'ID',
|
'label' => 'ID',
|
||||||
'sortable' => true,
|
|
||||||
], [
|
|
||||||
'name' => 'tr.name',
|
|
||||||
'alias' => 'Name',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Name',
|
|
||||||
'sortable' => true,
|
|
||||||
], [
|
|
||||||
'name' => 'tr.code',
|
|
||||||
'alias' => 'code',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Code',
|
|
||||||
'sortable' => true,
|
|
||||||
],
|
|
||||||
],
|
|
||||||
|
|
||||||
//don't use aliasing in case of filters
|
|
||||||
'filterable' => [
|
|
||||||
[
|
|
||||||
'column' => 'tr.id',
|
|
||||||
'alias' => 'ID',
|
|
||||||
'type' => 'number',
|
'type' => 'number',
|
||||||
'label' => 'ID'
|
'searchable' => false,
|
||||||
], [
|
'sortable' => true,
|
||||||
'column' => 'tr.name',
|
'width' => '40px'
|
||||||
'alias' => 'Name',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Name'
|
|
||||||
], [
|
|
||||||
'column' => 'tr.code',
|
|
||||||
'alias' => 'code',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Code'
|
|
||||||
]
|
|
||||||
],
|
|
||||||
|
|
||||||
//don't use aliasing in case of searchables
|
|
||||||
'searchable' => [
|
|
||||||
[
|
|
||||||
'column' => 'tr.code',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Code'
|
|
||||||
], [
|
|
||||||
'column' => 'tr.name',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Name'
|
|
||||||
]
|
|
||||||
],
|
|
||||||
'operators' => [
|
|
||||||
'eq' => "=",
|
|
||||||
'lt' => "<",
|
|
||||||
'gt' => ">",
|
|
||||||
'lte' => "<=",
|
|
||||||
'gte' => ">=",
|
|
||||||
'neqs' => "<>",
|
|
||||||
'neqn' => "!=",
|
|
||||||
'like' => "like",
|
|
||||||
'nlike' => "not like",
|
|
||||||
],
|
|
||||||
// 'css' => []
|
|
||||||
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
$this->addColumn([
|
||||||
|
'index' => 'name',
|
||||||
|
'alias' => 'taxCatName',
|
||||||
|
'label' => 'Name',
|
||||||
|
'type' => 'string',
|
||||||
|
'searchable' => true,
|
||||||
|
'sortable' => true,
|
||||||
|
'width' => '100px'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->addColumn([
|
||||||
|
'index' => 'code',
|
||||||
|
'alias' => 'taxCatCode',
|
||||||
|
'label' => 'Code',
|
||||||
|
'type' => 'string',
|
||||||
|
'searchable' => true,
|
||||||
|
'sortable' => true,
|
||||||
|
'width' => '100px'
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render() {
|
public function prepareActions() {
|
||||||
|
$this->addAction([
|
||||||
|
'type' => 'Edit',
|
||||||
|
'route' => 'admin.tax-categories.edit',
|
||||||
|
'icon' => 'icon pencil-lg-icon'
|
||||||
|
]);
|
||||||
|
|
||||||
return $this->createTaxCategoryDataGrid()->render();
|
$this->addAction([
|
||||||
|
'type' => 'Delete',
|
||||||
|
'route' => 'admin.tax-categories.delete',
|
||||||
|
'icon' => 'icon trash-icon'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function prepareMassActions() {
|
||||||
|
// $this->prepareMassAction([
|
||||||
|
// 'type' => 'delete',
|
||||||
|
// 'action' => route('admin.catalog.products.massdelete'),
|
||||||
|
// 'method' => 'DELETE'
|
||||||
|
// ]);
|
||||||
|
|
||||||
|
// $this->prepareMassAction([
|
||||||
|
// 'type' => 'update',
|
||||||
|
// 'action' => route('admin.catalog.products.massupdate'),
|
||||||
|
// 'method' => 'PUT',
|
||||||
|
// 'options' => [
|
||||||
|
// 0 => true,
|
||||||
|
// 1 => false,
|
||||||
|
// ]
|
||||||
|
// ]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2,172 +2,112 @@
|
||||||
|
|
||||||
namespace Webkul\Admin\DataGrids;
|
namespace Webkul\Admin\DataGrids;
|
||||||
|
|
||||||
use Illuminate\View\View;
|
use Webkul\Ui\DataGrid\AbsGrid;
|
||||||
use Webkul\Ui\DataGrid\Facades\DataGrid;
|
use DB;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tax Rates DataGrid
|
* Tax Rate Grid 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
|
class TaxRateDataGrid extends AbsGrid
|
||||||
{
|
{
|
||||||
|
public $allColumns = [];
|
||||||
|
|
||||||
/**
|
public function prepareQueryBuilder()
|
||||||
* The Tax Category Data Grid implementation.
|
|
||||||
*/
|
|
||||||
public function createTaxRateDataGrid()
|
|
||||||
{
|
{
|
||||||
|
$queryBuilder = DB::table('tax_rates')->addSelect('id', 'identifier', 'state', 'country', 'tax_rate');
|
||||||
|
|
||||||
return DataGrid::make([
|
$this->setQueryBuilder($queryBuilder);
|
||||||
'name' => 'Tax Rates',
|
}
|
||||||
'table' => 'tax_rates as tr',
|
|
||||||
'select' => 'tr.id',
|
|
||||||
'perpage' => 10,
|
|
||||||
'aliased' => true, //use this with false as default and true in case of joins
|
|
||||||
|
|
||||||
'massoperations' =>[
|
public function setIndex() {
|
||||||
// [
|
$this->index = 'id';
|
||||||
// 'route' => route('admin.datagrid.delete'),
|
}
|
||||||
// 'method' => 'DELETE',
|
|
||||||
// 'label' => 'Delete',
|
|
||||||
// 'type' => 'button',
|
|
||||||
// ],
|
|
||||||
// [
|
|
||||||
// 'route' => route('admin.datagrid.index'),
|
|
||||||
// 'method' => 'POST',
|
|
||||||
// 'label' => 'View Grid',
|
|
||||||
// 'type' => 'select',
|
|
||||||
// 'options' =>[
|
|
||||||
// 1 => 'Edit',
|
|
||||||
// 2 => 'Set',
|
|
||||||
// 3 => 'Change Status'
|
|
||||||
// ]
|
|
||||||
// ],
|
|
||||||
],
|
|
||||||
'actions' => [
|
|
||||||
[
|
|
||||||
'type' => 'Edit',
|
|
||||||
'route' => 'admin.tax-rates.store',
|
|
||||||
'confirm_text' => 'Do you really want to edit this record?',
|
|
||||||
'icon' => 'icon pencil-lg-icon',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'type' => 'Delete',
|
|
||||||
'route' => 'admin.tax-rates.delete',
|
|
||||||
'confirm_text' => 'Do you really want to delete this record?',
|
|
||||||
'icon' => 'icon trash-icon',
|
|
||||||
],
|
|
||||||
],
|
|
||||||
'join' => [],
|
|
||||||
|
|
||||||
//use aliasing on secodary columns if join is performed
|
public function addColumns()
|
||||||
'columns' => [
|
{
|
||||||
[
|
$this->addColumn([
|
||||||
'name' => 'tr.id',
|
'index' => 'id',
|
||||||
'alias' => 'id',
|
'alias' => 'taxRateId',
|
||||||
'type' => 'number',
|
|
||||||
'label' => 'ID',
|
'label' => 'ID',
|
||||||
'sortable' => true,
|
|
||||||
], [
|
|
||||||
'name' => 'tr.identifier',
|
|
||||||
'alias' => 'identifier',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Identifier',
|
|
||||||
'sortable' => true,
|
|
||||||
// 'wrapper' => function ($value, $object) {
|
|
||||||
// return '<a class="color-red">' . $object->identifier . '</a>';
|
|
||||||
// },
|
|
||||||
], [
|
|
||||||
'name' => 'tr.state',
|
|
||||||
'alias' => 'state',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'State',
|
|
||||||
'sortable' => true,
|
|
||||||
], [
|
|
||||||
'name' => 'tr.country',
|
|
||||||
'alias' => 'country',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Country',
|
|
||||||
'sortable' => true,
|
|
||||||
], [
|
|
||||||
'name' => 'tr.tax_rate',
|
|
||||||
'alias' => 'taxrate',
|
|
||||||
'type' => 'number',
|
'type' => 'number',
|
||||||
'label' => 'Tax Rate',
|
'searchable' => false,
|
||||||
'sortable' => true,
|
'sortable' => true,
|
||||||
],
|
'width' => '40px'
|
||||||
],
|
|
||||||
//don't use aliasing in case of filters
|
|
||||||
'filterable' => [
|
|
||||||
[
|
|
||||||
'column' => 'tr.id',
|
|
||||||
'alias' => 'ID',
|
|
||||||
'type' => 'number',
|
|
||||||
'label' => 'ID',
|
|
||||||
], [
|
|
||||||
'column' => 'tr.identifier',
|
|
||||||
'alias' => 'identifier',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Identifier',
|
|
||||||
], [
|
|
||||||
'column' => 'tr.state',
|
|
||||||
'alias' => 'state',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'State',
|
|
||||||
], [
|
|
||||||
'column' => 'tr.country',
|
|
||||||
'alias' => 'country',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Country',
|
|
||||||
], [
|
|
||||||
'column' => 'tr.tax_rate',
|
|
||||||
'alias' => 'taxrate',
|
|
||||||
'type' => 'number',
|
|
||||||
'label' => 'Tax Rate',
|
|
||||||
],
|
|
||||||
],
|
|
||||||
//don't use aliasing in case of searchables
|
|
||||||
'searchable' => [
|
|
||||||
[
|
|
||||||
'column' => 'tr.identifier',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Identifier',
|
|
||||||
], [
|
|
||||||
'column' => 'tr.state',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'State',
|
|
||||||
], [
|
|
||||||
'column' => 'tr.country',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Country',
|
|
||||||
], [
|
|
||||||
'column' => 'tr.tax_rate',
|
|
||||||
'type' => 'number',
|
|
||||||
'label' => 'Tax Rate',
|
|
||||||
],
|
|
||||||
],
|
|
||||||
'operators' => [
|
|
||||||
'eq' => "=",
|
|
||||||
'lt' => "<",
|
|
||||||
'gt' => ">",
|
|
||||||
'lte' => "<=",
|
|
||||||
'gte' => ">=",
|
|
||||||
'neqs' => "<>",
|
|
||||||
'neqn' => "!=",
|
|
||||||
'like' => "like",
|
|
||||||
'nlike' => "not like",
|
|
||||||
],
|
|
||||||
// 'css' => []
|
|
||||||
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
$this->addColumn([
|
||||||
|
'index' => 'identifier',
|
||||||
|
'alias' => 'taxRateName',
|
||||||
|
'label' => 'Identifier',
|
||||||
|
'type' => 'string',
|
||||||
|
'searchable' => true,
|
||||||
|
'sortable' => true,
|
||||||
|
'width' => '100px'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->addColumn([
|
||||||
|
'index' => 'state',
|
||||||
|
'alias' => 'taxRateState',
|
||||||
|
'label' => 'State',
|
||||||
|
'type' => 'string',
|
||||||
|
'searchable' => true,
|
||||||
|
'sortable' => true,
|
||||||
|
'width' => '100px'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->addColumn([
|
||||||
|
'index' => 'country',
|
||||||
|
'alias' => 'taxRateCountry',
|
||||||
|
'label' => 'Country',
|
||||||
|
'type' => 'string',
|
||||||
|
'searchable' => true,
|
||||||
|
'sortable' => true,
|
||||||
|
'width' => '100px'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->addColumn([
|
||||||
|
'index' => 'tax_rate',
|
||||||
|
'alias' => 'taxRate',
|
||||||
|
'label' => 'Rate',
|
||||||
|
'type' => 'string',
|
||||||
|
'searchable' => true,
|
||||||
|
'sortable' => true,
|
||||||
|
'width' => '100px'
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render() {
|
public function prepareActions() {
|
||||||
|
$this->addAction([
|
||||||
|
'type' => 'Edit',
|
||||||
|
'route' => 'admin.tax-categories.edit',
|
||||||
|
'icon' => 'icon pencil-lg-icon'
|
||||||
|
]);
|
||||||
|
|
||||||
return $this->createTaxRateDataGrid()->render();
|
$this->addAction([
|
||||||
|
'type' => 'Delete',
|
||||||
|
'route' => 'admin.tax-categories.delete',
|
||||||
|
'icon' => 'icon trash-icon'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function prepareMassActions() {
|
||||||
|
// $this->prepareMassAction([
|
||||||
|
// 'type' => 'delete',
|
||||||
|
// 'action' => route('admin.catalog.products.massdelete'),
|
||||||
|
// 'method' => 'DELETE'
|
||||||
|
// ]);
|
||||||
|
|
||||||
|
// $this->prepareMassAction([
|
||||||
|
// 'type' => 'update',
|
||||||
|
// 'action' => route('admin.catalog.products.massupdate'),
|
||||||
|
// 'method' => 'PUT',
|
||||||
|
// 'options' => [
|
||||||
|
// 0 => true,
|
||||||
|
// 1 => false,
|
||||||
|
// ]
|
||||||
|
// ]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,147 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Webkul\Admin\DataGrids;
|
||||||
|
|
||||||
|
use Webkul\Ui\DataGrid\AbsGrid;
|
||||||
|
use DB;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Product Data Grid class
|
||||||
|
*
|
||||||
|
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
|
||||||
|
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||||
|
*/
|
||||||
|
class TestDataGrid extends AbsGrid
|
||||||
|
{
|
||||||
|
public $allColumns = [];
|
||||||
|
|
||||||
|
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');
|
||||||
|
|
||||||
|
$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',
|
||||||
|
'type' => 'number',
|
||||||
|
'searchable' => false,
|
||||||
|
'sortable' => true,
|
||||||
|
'width' => '40px'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->addColumn([
|
||||||
|
'index' => 'products_grid.sku',
|
||||||
|
'alias' => 'productsku',
|
||||||
|
'label' => 'SKU',
|
||||||
|
'type' => 'string',
|
||||||
|
'searchable' => true,
|
||||||
|
'sortable' => true,
|
||||||
|
'width' => '100px'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->addColumn([
|
||||||
|
'index' => 'products_grid.name',
|
||||||
|
'alias' => 'productname',
|
||||||
|
'label' => 'Name',
|
||||||
|
'type' => 'string',
|
||||||
|
'searchable' => true,
|
||||||
|
'sortable' => true,
|
||||||
|
'width' => '100px'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->addColumn([
|
||||||
|
'index' => 'products.type',
|
||||||
|
'alias' => 'producttype',
|
||||||
|
'label' => 'Type',
|
||||||
|
'type' => 'string',
|
||||||
|
'sortable' => true,
|
||||||
|
'searchable' => true,
|
||||||
|
'width' => '100px'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->addColumn([
|
||||||
|
'index' => 'products_grid.status',
|
||||||
|
'alias' => 'productstatus',
|
||||||
|
'label' => 'Status',
|
||||||
|
'type' => 'boolean',
|
||||||
|
'sortable' => true,
|
||||||
|
'searchable' => false,
|
||||||
|
'width' => '100px',
|
||||||
|
'wrapper' => function($value) {
|
||||||
|
if($value == 1)
|
||||||
|
return 'Active';
|
||||||
|
else
|
||||||
|
return 'Inactive';
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->addColumn([
|
||||||
|
'index' => 'products_grid.price',
|
||||||
|
'alias' => 'productprice',
|
||||||
|
'label' => 'Price',
|
||||||
|
'type' => 'number',
|
||||||
|
'sortable' => true,
|
||||||
|
'searchable' => false,
|
||||||
|
'width' => '100px',
|
||||||
|
'wrapper' => function($value) {
|
||||||
|
return core()->formatBasePrice($value);
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->addColumn([
|
||||||
|
'index' => 'products_grid.quantity',
|
||||||
|
'alias' => 'productqty',
|
||||||
|
'label' => 'Quantity',
|
||||||
|
'type' => 'number',
|
||||||
|
'sortable' => true,
|
||||||
|
'searchable' => false,
|
||||||
|
'width' => '100px'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function prepareActions() {
|
||||||
|
$this->addAction([
|
||||||
|
'type' => 'Edit',
|
||||||
|
'route' => 'admin.catalog.products.edit',
|
||||||
|
'icon' => 'icon pencil-lg-icon'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->addAction([
|
||||||
|
'type' => 'Delete',
|
||||||
|
'route' => 'admin.catalog.products.delete',
|
||||||
|
'confirm_text' => trans('ui::app.datagrid.massaction.delete', ['resource' => 'product']),
|
||||||
|
'icon' => 'icon trash-icon'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function prepareMassActions() {
|
||||||
|
$this->addMassAction([
|
||||||
|
'type' => 'delete',
|
||||||
|
'action' => route('admin.catalog.products.massdelete'),
|
||||||
|
'method' => 'DELETE'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->addMassAction([
|
||||||
|
'type' => 'update',
|
||||||
|
'action' => route('admin.catalog.products.massupdate'),
|
||||||
|
'method' => 'PUT',
|
||||||
|
'options' => [
|
||||||
|
0 => true,
|
||||||
|
1 => false,
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -2,192 +2,103 @@
|
||||||
|
|
||||||
namespace Webkul\Admin\DataGrids;
|
namespace Webkul\Admin\DataGrids;
|
||||||
|
|
||||||
use Illuminate\View\View;
|
use Webkul\Ui\DataGrid\AbsGrid;
|
||||||
use Webkul\Ui\DataGrid\Facades\DataGrid;
|
use DB;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Users DataGrid
|
* News Letter Grid 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
|
class UserDataGrid extends AbsGrid
|
||||||
{
|
{
|
||||||
|
public $allColumns = [];
|
||||||
|
|
||||||
/**
|
public function prepareQueryBuilder()
|
||||||
* The Data Grid implementation for admin users
|
|
||||||
*/
|
|
||||||
public function createUserDataGrid()
|
|
||||||
{
|
{
|
||||||
|
$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');
|
||||||
|
|
||||||
return DataGrid::make([
|
$this->setQueryBuilder($queryBuilder);
|
||||||
|
}
|
||||||
|
|
||||||
'name' => 'Admins',
|
public function setIndex() {
|
||||||
'table' => 'admins as u',
|
$this->index = 'id';
|
||||||
'select' => 'u.id',
|
}
|
||||||
'perpage' => 10,
|
|
||||||
'aliased' => true, //use this with false as default and true in case of joins
|
|
||||||
|
|
||||||
'massoperations' => [
|
public function addColumns()
|
||||||
// [
|
{
|
||||||
// 'route' => route('admin.datagrid.delete'),
|
$this->addColumn([
|
||||||
// 'method' => 'DELETE',
|
'index' => 'u.id',
|
||||||
// 'label' => 'Delete',
|
'alias' => 'adminId',
|
||||||
// 'type' => 'button',
|
'label' => 'ID',
|
||||||
// ],
|
|
||||||
// [
|
|
||||||
// 'route' => route('admin.datagrid.index'),
|
|
||||||
// 'method' => 'POST',
|
|
||||||
// 'label' => 'View Grid',
|
|
||||||
// 'type' => 'select',
|
|
||||||
// 'options' =>[
|
|
||||||
// 1 => 'Edit',
|
|
||||||
// 2 => 'Set',
|
|
||||||
// 3 => 'Change Status'
|
|
||||||
// ]
|
|
||||||
// ],
|
|
||||||
],
|
|
||||||
|
|
||||||
'actions' => [
|
|
||||||
[
|
|
||||||
'type' => 'Edit',
|
|
||||||
'route' => 'admin.users.edit',
|
|
||||||
'confirm_text' => 'Do you really want to edit this record?',
|
|
||||||
'icon' => 'icon pencil-lg-icon',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'type' => 'Delete',
|
|
||||||
'route' => 'admin.users.delete',
|
|
||||||
'confirm_text' => 'Do you really want to delete this record?',
|
|
||||||
'icon' => 'icon trash-icon',
|
|
||||||
],
|
|
||||||
],
|
|
||||||
'join' => [
|
|
||||||
[
|
|
||||||
'join' => 'leftjoin',
|
|
||||||
'table' => 'roles as r',
|
|
||||||
'primaryKey' => 'u.role_id',
|
|
||||||
'condition' => '=',
|
|
||||||
'secondaryKey' => 'r.id',
|
|
||||||
]
|
|
||||||
],
|
|
||||||
|
|
||||||
//use aliasing on secodary columns if join is performed
|
|
||||||
'columns' => [
|
|
||||||
[
|
|
||||||
'name' => 'u.id',
|
|
||||||
'alias' => 'ID',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Admin ID',
|
|
||||||
'sortable' => true,
|
|
||||||
// 'wrapper' => function ($value, $object) {
|
|
||||||
// return '<a class="color-red">' . $object->ID . '</a>';
|
|
||||||
// },
|
|
||||||
], [
|
|
||||||
'name' => 'u.name',
|
|
||||||
'alias' => 'Name',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Name',
|
|
||||||
'sortable' => true,
|
|
||||||
// 'wrapper' => function ($value, $object) {
|
|
||||||
// return '<a class="color-red">' . $object->Name . '</a>';
|
|
||||||
// },
|
|
||||||
], [
|
|
||||||
'name' => 'u.status',
|
|
||||||
'alias' => 'Status',
|
|
||||||
'type' => 'boolean',
|
|
||||||
'label' => 'Status',
|
|
||||||
'sortable' => true,
|
|
||||||
'wrapper' => function ($value) {
|
|
||||||
if($value == 1)
|
|
||||||
return "Active";
|
|
||||||
else
|
|
||||||
return "Inactive";
|
|
||||||
},
|
|
||||||
], [
|
|
||||||
'name' => 'u.email',
|
|
||||||
'alias' => 'Email',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Email',
|
|
||||||
'sortable' => true,
|
|
||||||
], [
|
|
||||||
'name' => 'r.name',
|
|
||||||
'alias' => 'rolename',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Role Name',
|
|
||||||
'sortable' => true,
|
|
||||||
],
|
|
||||||
],
|
|
||||||
|
|
||||||
//don't use aliasing in case of filters
|
|
||||||
'filterable' => [
|
|
||||||
[
|
|
||||||
'column' => 'u.id',
|
|
||||||
'alias' => 'ID',
|
|
||||||
'type' => 'number',
|
'type' => 'number',
|
||||||
'label' => 'Admin ID'
|
'searchable' => false,
|
||||||
], [
|
'sortable' => true,
|
||||||
'column' => 'u.name',
|
'width' => '40px'
|
||||||
'alias' => 'Name',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Name'
|
|
||||||
], [
|
|
||||||
'column' => 'u.email',
|
|
||||||
'alias' => 'Email',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Email'
|
|
||||||
], [
|
|
||||||
'column' => 'r.name',
|
|
||||||
'alias' => 'rolename',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Role Name'
|
|
||||||
], [
|
|
||||||
'name' => 'u.status',
|
|
||||||
'alias' => 'Status',
|
|
||||||
'type' => 'boolean',
|
|
||||||
'label' => 'Status'
|
|
||||||
]
|
|
||||||
],
|
|
||||||
|
|
||||||
//don't use aliasing in case of searchables
|
|
||||||
'searchable' => [
|
|
||||||
[
|
|
||||||
'column' => 'u.email',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Email'
|
|
||||||
], [
|
|
||||||
'column' => 'u.name',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Name'
|
|
||||||
], [
|
|
||||||
'column' => 'u.email',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Email',
|
|
||||||
], [
|
|
||||||
'column' => 'r.name',
|
|
||||||
'type' => 'string',
|
|
||||||
'label' => 'Role Name',
|
|
||||||
]
|
|
||||||
],
|
|
||||||
|
|
||||||
'operators' => [
|
|
||||||
'eq' => "=",
|
|
||||||
'lt' => "<",
|
|
||||||
'gt' => ">",
|
|
||||||
'lte' => "<=",
|
|
||||||
'gte' => ">=",
|
|
||||||
'neqs' => "<>",
|
|
||||||
'neqn' => "!=",
|
|
||||||
'like' => "like",
|
|
||||||
'nlike' => "not like",
|
|
||||||
],
|
|
||||||
|
|
||||||
// 'css' => []
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
$this->addColumn([
|
||||||
|
'index' => 'u.name',
|
||||||
|
'alias' => 'adminName',
|
||||||
|
'label' => 'Name',
|
||||||
|
'type' => 'string',
|
||||||
|
'searchable' => true,
|
||||||
|
'sortable' => true,
|
||||||
|
'width' => '100px'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->addColumn([
|
||||||
|
'index' => 'u.status',
|
||||||
|
'alias' => 'adminStatus',
|
||||||
|
'label' => 'Status',
|
||||||
|
'type' => 'boolean',
|
||||||
|
'searchable' => true,
|
||||||
|
'sortable' => true,
|
||||||
|
'width' => '100px',
|
||||||
|
'wrapper' => function($value) {
|
||||||
|
if($value == 1) {
|
||||||
|
return 'Active';
|
||||||
|
} else {
|
||||||
|
return 'Inactive';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->addColumn([
|
||||||
|
'index' => 'u.email',
|
||||||
|
'alias' => 'adminEmail',
|
||||||
|
'label' => 'Email',
|
||||||
|
'type' => 'string',
|
||||||
|
'searchable' => true,
|
||||||
|
'sortable' => true,
|
||||||
|
'width' => '100px'
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render() {
|
public function prepareActions() {
|
||||||
return $this->createUserDataGrid()->render();
|
$this->addAction([
|
||||||
|
'type' => 'Edit',
|
||||||
|
'route' => 'admin.roles.edit',
|
||||||
|
'icon' => 'icon pencil-lg-icon'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function prepareMassActions() {
|
||||||
|
// $this->prepareMassAction([
|
||||||
|
// 'type' => 'delete',
|
||||||
|
// 'action' => route('admin.catalog.products.massdelete'),
|
||||||
|
// 'method' => 'DELETE'
|
||||||
|
// ]);
|
||||||
|
|
||||||
|
// $this->prepareMassAction([
|
||||||
|
// 'type' => 'update',
|
||||||
|
// 'action' => route('admin.catalog.products.massupdate'),
|
||||||
|
// 'method' => 'PUT',
|
||||||
|
// 'options' => [
|
||||||
|
// 0 => true,
|
||||||
|
// 1 => false,
|
||||||
|
// ]
|
||||||
|
// ]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -4,11 +4,11 @@ namespace Webkul\Admin\Http\Controllers;
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Http\Response;
|
use Illuminate\Http\Response;
|
||||||
use Illuminate\Routing\Controller;
|
use Webkul\Admin\Http\Controllers\Controller;
|
||||||
use Webkul\Ui\DataGrid\Facades\DataGrid;
|
use Webkul\Admin\DataGrids\TestDataGrid;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DataGrid controller
|
* TestDataGrid controller
|
||||||
*
|
*
|
||||||
* @author Nikhil Malik <nikhil@webkul.com> @ysmnikhil
|
* @author Nikhil Malik <nikhil@webkul.com> @ysmnikhil
|
||||||
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
|
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
|
||||||
|
|
@ -16,6 +16,18 @@ use Webkul\Ui\DataGrid\Facades\DataGrid;
|
||||||
*/
|
*/
|
||||||
class DataGridController extends Controller
|
class DataGridController extends Controller
|
||||||
{
|
{
|
||||||
|
protected $_config;
|
||||||
|
protected $testgrid;
|
||||||
|
|
||||||
|
public function __construct(TestDataGrid $testgrid)
|
||||||
|
{
|
||||||
|
$this->middleware('admin');
|
||||||
|
|
||||||
|
$this->_config = request('_config');
|
||||||
|
|
||||||
|
$this->testgrid = $testgrid;
|
||||||
|
}
|
||||||
|
|
||||||
public function massDelete() {
|
public function massDelete() {
|
||||||
dd(request()->all());
|
dd(request()->all());
|
||||||
}
|
}
|
||||||
|
|
@ -23,4 +35,8 @@ class DataGridController extends Controller
|
||||||
public function massUpdate() {
|
public function massUpdate() {
|
||||||
dd(request()->all());
|
dd(request()->all());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testGrid() {
|
||||||
|
return $this->testgrid->render();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,10 @@ Route::group(['middleware' => ['web']], function () {
|
||||||
'view' => 'admin::users.sessions.create'
|
'view' => 'admin::users.sessions.create'
|
||||||
])->name('admin.session.create');
|
])->name('admin.session.create');
|
||||||
|
|
||||||
|
Route::get('/testgrid', 'Webkul\Admin\Http\Controllers\DataGridController@testGrid')->defaults('_config', [
|
||||||
|
'view' => 'admin::catalog.categories.test'
|
||||||
|
]);
|
||||||
|
|
||||||
//login post route to admin auth controller
|
//login post route to admin auth controller
|
||||||
Route::post('/login', 'Webkul\User\Http\Controllers\SessionController@store')->defaults('_config', [
|
Route::post('/login', 'Webkul\User\Http\Controllers\SessionController@store')->defaults('_config', [
|
||||||
'redirect' => 'admin.dashboard.index'
|
'redirect' => 'admin.dashboard.index'
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,20 @@ body {
|
||||||
min-height: 100%;
|
min-height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
::-webkit-scrollbar {
|
||||||
|
width: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
::-webkit-scrollbar-track {
|
||||||
|
-webkit-box-shadow: inset 0 0 6px rgba(255, 255, 255, 0.3);
|
||||||
|
border-radius: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
::-webkit-scrollbar-thumb {
|
||||||
|
border-radius: 10px;
|
||||||
|
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.5);
|
||||||
|
}
|
||||||
|
|
||||||
.navbar-top {
|
.navbar-top {
|
||||||
height: 60px;
|
height: 60px;
|
||||||
background: #ffffff;
|
background: #ffffff;
|
||||||
|
|
@ -157,7 +171,7 @@ body {
|
||||||
}
|
}
|
||||||
|
|
||||||
.content {
|
.content {
|
||||||
padding: 25px 0;
|
margin-top: 25px;
|
||||||
|
|
||||||
&.full-page {
|
&.full-page {
|
||||||
padding: 25px;
|
padding: 25px;
|
||||||
|
|
|
||||||
|
|
@ -575,6 +575,7 @@ return [
|
||||||
'country' => 'Country',
|
'country' => 'Country',
|
||||||
'male' => 'Male',
|
'male' => 'Male',
|
||||||
'female' => 'Female',
|
'female' => 'Female',
|
||||||
|
'phone' => 'Phone',
|
||||||
'created' => 'Customer created successfully.',
|
'created' => 'Customer created successfully.',
|
||||||
'updated' => 'Customer updated successfully.',
|
'updated' => 'Customer updated successfully.',
|
||||||
'deleted' => 'Customer deleted successfully.',
|
'deleted' => 'Customer deleted successfully.',
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
@extends('admin::layouts.content')
|
||||||
|
|
||||||
|
@section('page_title')
|
||||||
|
{{ __('admin::app.customers.customers.title') }}
|
||||||
|
@stop
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<div class="content">
|
||||||
|
<div class="page-header">
|
||||||
|
<div class="page-title">
|
||||||
|
<h1>{{ __('admin::app.customers.customers.title') }}</h1>
|
||||||
|
</div>
|
||||||
|
<div class="page-action">
|
||||||
|
<a href="{{ route('admin.customer.create') }}" class="btn btn-lg btn-primary">
|
||||||
|
{{ __('admin::app.customers.customers.add-title') }}
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="page-content">
|
||||||
|
<h1>Test the grid here</h1>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
||||||
|
|
@ -148,7 +148,7 @@
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<div class="control-group" :class="[errors.has(variantInputName + '[price]') ? 'has-error' : '']">
|
<div class="control-group" :class="[errors.has(variantInputName + '[weight]') ? 'has-error' : '']">
|
||||||
<input type="text" v-validate="'required'" v-model="variant.weight" :name="[variantInputName + '[weight]']" class="control" data-vv-as=""{{ __('admin::app.catalog.products.weight') }}""/>
|
<input type="text" v-validate="'required'" v-model="variant.weight" :name="[variantInputName + '[weight]']" class="control" data-vv-as=""{{ __('admin::app.catalog.products.weight') }}""/>
|
||||||
<span class="control-error" v-if="errors.has(variantInputName + '[weight]')">@{{ errors.first(variantInputName + '[weight]') }}</span>
|
<span class="control-error" v-if="errors.has(variantInputName + '[weight]')">@{{ errors.first(variantInputName + '[weight]') }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
@stop
|
@stop
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
<div class="content">
|
<div class="content" style="height: 100%;">
|
||||||
<div class="page-header">
|
<div class="page-header">
|
||||||
<div class="page-title">
|
<div class="page-title">
|
||||||
<h1>{{ __('admin::app.catalog.products.title') }}</h1>
|
<h1>{{ __('admin::app.catalog.products.title') }}</h1>
|
||||||
|
|
@ -19,8 +19,11 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="page-content">
|
<div class="page-content">
|
||||||
@inject('product','Webkul\Admin\DataGrids\ProductDataGrid')
|
{{-- @inject('product','Webkul\Admin\DataGrids\ProductDataGrid')
|
||||||
{!! $product->render() !!}
|
{!! $product->render() !!} --}}
|
||||||
|
|
||||||
|
@inject('products', 'Webkul\Admin\DataGrids\TestDataGrid')
|
||||||
|
{!! $products->render() !!}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@stop
|
@stop
|
||||||
|
|
@ -90,13 +90,6 @@
|
||||||
|
|
||||||
<select v-validate="'{{ $validations }}'" class="control" id="{{ $firstField }}[{{ $secondField }}][{{ $thirdField }}][{{ $field['name'] }}]" name="{{ $firstField }}[{{ $secondField }}][{{ $thirdField }}][{{ $field['name'] }}][]" data-vv-as=""{{ $field['name'] }}"" multiple>
|
<select v-validate="'{{ $validations }}'" class="control" id="{{ $firstField }}[{{ $secondField }}][{{ $thirdField }}][{{ $field['name'] }}]" name="{{ $firstField }}[{{ $secondField }}][{{ $thirdField }}][{{ $field['name'] }}][]" data-vv-as=""{{ $field['name'] }}"" multiple>
|
||||||
|
|
||||||
@if (isset($field['repository']))
|
|
||||||
@foreach($value as $option)
|
|
||||||
<option value="{{ $option['name'] }}" {{ in_array($option['name'], explode(',', $selectedOption)) ? 'selected' : ''}}>
|
|
||||||
{{ $option['name'] }}
|
|
||||||
</option>
|
|
||||||
@endforeach
|
|
||||||
@else
|
|
||||||
@foreach($field['options'] as $option)
|
@foreach($field['options'] as $option)
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
@ -109,29 +102,29 @@
|
||||||
$selectedOption = core()->getConfigData($name) ?? '';
|
$selectedOption = core()->getConfigData($name) ?? '';
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<option value="{{ $value }}" {{ $value == $selectedOption ? 'selected' : ''}}>
|
<option value="{{ $value }}" {{ in_array($option['value'], explode(',', $selectedOption)) ? 'selected' : ''}}>
|
||||||
{{ $option['title'] }}
|
{{ $option['title'] }}
|
||||||
</option>
|
</option>
|
||||||
|
|
||||||
@endforeach
|
@endforeach
|
||||||
@endif
|
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
@elseif ($field['type'] == 'country')
|
@elseif ($field['type'] == 'country')
|
||||||
|
|
||||||
<select type="text" v-validate="'required'" class="control" id="country" name="{{ $firstField }}[{{ $secondField }}][{{ $thirdField }}][{{ $field['name'] }}]" data-vv-as=""{{ __('admin::app.customers.customers.country') }}"" onchange="myFunction()">
|
<?php
|
||||||
<option value=""></option>
|
$countryCode = core()->getConfigData($name) ?? '';
|
||||||
|
?>
|
||||||
|
|
||||||
@foreach (core()->countries() as $country)
|
<country code = {{ $countryCode }}></country>
|
||||||
|
|
||||||
<option value="{{ $country->code }}">
|
@elseif ($field['type'] == 'state')
|
||||||
{{ $country->name }}
|
|
||||||
</option>
|
|
||||||
|
|
||||||
@endforeach
|
<?php
|
||||||
</select>
|
$stateCode = core()->getConfigData($name) ?? '';
|
||||||
|
?>
|
||||||
|
|
||||||
|
<state code = {{ $stateCode }}></state>
|
||||||
|
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
|
|
@ -140,30 +133,107 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@push('scripts')
|
@push('scripts')
|
||||||
|
|
||||||
|
<script type="text/x-template" id="country-template">
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<select type="text" v-validate="'required'" class="control" id="{{ $firstField }}[{{ $secondField }}][{{ $thirdField }}][{{ $field['name'] }}]" name="{{ $firstField }}[{{ $secondField }}][{{ $thirdField }}][{{ $field['name'] }}]" v-model="country" data-vv-as=""{{ __('admin::app.customers.customers.country') }}"" @change="someHandler">
|
||||||
|
<option value=""></option>
|
||||||
|
|
||||||
|
@foreach (core()->countries() as $country)
|
||||||
|
|
||||||
|
<option value="{{ $country->code }}">{{ $country->name }}</option>
|
||||||
|
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
Vue.component('country', {
|
||||||
|
|
||||||
function myFunction() {
|
template: '#country-template',
|
||||||
var countryId = document.getElementById("country").value;
|
|
||||||
var countryStates = <?php echo json_encode(core()->groupedStatesByCountries()) ;?>;
|
|
||||||
|
|
||||||
for (var key in countryStates) {
|
inject: ['$validator'],
|
||||||
if(key == countryId){
|
|
||||||
|
|
||||||
|
props: ['code'],
|
||||||
|
|
||||||
for(state in countryStates[key]) {
|
data: () => ({
|
||||||
console.log(state);
|
country: "",
|
||||||
}
|
}),
|
||||||
}
|
|
||||||
|
mounted() {
|
||||||
|
this.country = this.code;
|
||||||
|
this.someHandler()
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
someHandler() {
|
||||||
|
this.$root.$emit('sendCountryCode', this.country)
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
}
|
<script type="text/x-template" id="state-template">
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<input type="text" v-validate="'required'" v-if="!haveStates()" class="control" v-model="state" id="{{ $firstField }}[{{ $secondField }}][{{ $thirdField }}][state]" name="{{ $firstField }}[{{ $secondField }}][{{ $thirdField }}][state]" data-vv-as=""{{ __('admin::app.customers.customers.state') }}""/>
|
||||||
|
|
||||||
|
<select v-validate="'required'" v-if="haveStates()" class="control" v-model="state" id="{{ $firstField }}[{{ $secondField }}][{{ $thirdField }}][state]" name="{{ $firstField }}[{{ $secondField }}][{{ $thirdField }}][state]" data-vv-as=""{{ __('admin::app.customers.customers.state') }}"" >
|
||||||
|
|
||||||
|
<option value="">{{ __('admin::app.customers.customers.select-state') }}</option>
|
||||||
|
|
||||||
|
<option v-for='(state, index) in countryStates[country]' :value="state.code">
|
||||||
|
@{{ state.default_name }}
|
||||||
|
</option>
|
||||||
|
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
Vue.component('state', {
|
||||||
|
|
||||||
|
template: '#state-template',
|
||||||
|
|
||||||
|
inject: ['$validator'],
|
||||||
|
|
||||||
|
props: ['code'],
|
||||||
|
|
||||||
|
data: () => ({
|
||||||
|
|
||||||
|
state: "",
|
||||||
|
|
||||||
|
country: "",
|
||||||
|
|
||||||
|
countryStates: @json(core()->groupedStatesByCountries())
|
||||||
|
}),
|
||||||
|
|
||||||
|
mounted() {
|
||||||
|
this.state = this.code
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
haveStates() {
|
||||||
|
this.$root.$on('sendCountryCode', (country) => {
|
||||||
|
this.country = country;
|
||||||
|
})
|
||||||
|
|
||||||
|
if(this.countryStates[this.country] && this.countryStates[this.country].length)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
}
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@endpush
|
@endpush
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,12 @@
|
||||||
<span class="control-error" v-if="errors.has('date_of_birth')">@{{ errors.first('date_of_birth') }}</span>
|
<span class="control-error" v-if="errors.has('date_of_birth')">@{{ errors.first('date_of_birth') }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="control-group" :class="[errors.has('phone') ? 'has-error' : '']">
|
||||||
|
<label for="phone">{{ __('admin::app.customers.customers.phone') }}</label>
|
||||||
|
<input type="text" class="control" name="phone" v-validate="'numeric|max:10'" value="{{ old('phone') }}" data-vv-as=""{{ __('admin::app.customers.customers.phone') }}"">
|
||||||
|
<span class="control-error" v-if="errors.has('phone')">@{{ errors.first('phone') }}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label for="customerGroup" >{{ __('admin::app.customers.customers.customer_group') }}</label>
|
<label for="customerGroup" >{{ __('admin::app.customers.customers.customer_group') }}</label>
|
||||||
<select class="control" name="customer_group_id">
|
<select class="control" name="customer_group_id">
|
||||||
|
|
|
||||||
|
|
@ -34,19 +34,20 @@
|
||||||
|
|
||||||
<div class="control-group" :class="[errors.has('first_name') ? 'has-error' : '']">
|
<div class="control-group" :class="[errors.has('first_name') ? 'has-error' : '']">
|
||||||
<label for="first_name" class="required"> {{ __('admin::app.customers.customers.first_name') }}</label>
|
<label for="first_name" class="required"> {{ __('admin::app.customers.customers.first_name') }}</label>
|
||||||
<input type="text" class="control" name="first_name" v-validate="'required'" value="{{$customer->first_name}}" data-vv-as=""{{ __('shop::app.customers.customers.first_name') }}""/>
|
<input type="text" class="control" name="first_name" v-validate="'required'" value="{{$customer->first_name}}"
|
||||||
|
data-vv-as=""{{ __('shop::app.customer.signup-form.firstname') }}""/>
|
||||||
<span class="control-error" v-if="errors.has('first_name')">@{{ errors.first('first_name') }}</span>
|
<span class="control-error" v-if="errors.has('first_name')">@{{ errors.first('first_name') }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="control-group" :class="[errors.has('last_name') ? 'has-error' : '']">
|
<div class="control-group" :class="[errors.has('last_name') ? 'has-error' : '']">
|
||||||
<label for="last_name" class="required"> {{ __('admin::app.customers.customers.last_name') }}</label>
|
<label for="last_name" class="required"> {{ __('admin::app.customers.customers.last_name') }}</label>
|
||||||
<input type="text" class="control" name="last_name" v-validate="'required'" value="{{$customer->last_name}}" data-vv-as=""{{ __('shop::app.customers.customers.last_name') }}""/>
|
<input type="text" class="control" name="last_name" v-validate="'required'" value="{{$customer->last_name}}" data-vv-as=""{{ __('shop::app.customer.signup-form.lastname') }}"">
|
||||||
<span class="control-error" v-if="errors.has('last_name')">@{{ errors.first('last_name') }}</span>
|
<span class="control-error" v-if="errors.has('last_name')">@{{ errors.first('last_name') }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="control-group" :class="[errors.has('email') ? 'has-error' : '']">
|
<div class="control-group" :class="[errors.has('email') ? 'has-error' : '']">
|
||||||
<label for="email" class="required"> {{ __('admin::app.customers.customers.email') }}</label>
|
<label for="email" class="required"> {{ __('admin::app.customers.customers.email') }}</label>
|
||||||
<input type="email" class="control" name="email" v-validate="'required|email'" value="{{$customer->email}}" data-vv-as=""{{ __('shop::app.customers.customers.email') }}""/>
|
<input type="email" class="control" name="email" v-validate="'required|email'" value="{{$customer->email}}" data-vv-as=""{{ __('shop::app.customer.signup-form.email') }}"">
|
||||||
<span class="control-error" v-if="errors.has('email')">@{{ errors.first('email') }}</span>
|
<span class="control-error" v-if="errors.has('email')">@{{ errors.first('email') }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -65,6 +66,12 @@
|
||||||
<span class="control-error" v-if="errors.has('date_of_birth')">@{{ errors.first('date_of_birth') }}</span>
|
<span class="control-error" v-if="errors.has('date_of_birth')">@{{ errors.first('date_of_birth') }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="control-group" :class="[errors.has('phone') ? 'has-error' : '']">
|
||||||
|
<label for="phone">{{ __('admin::app.customers.customers.phone') }}</label>
|
||||||
|
<input type="text" class="control" name="phone" v-validate="'numeric|max:10'" value="{{ $customer->phone }}" data-vv-as=""{{ __('admin::app.customers.customers.phone') }}"">
|
||||||
|
<span class="control-error" v-if="errors.has('phone')">@{{ errors.first('phone') }}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label for="customerGroup" >{{ __('admin::app.customers.customers.customer_group') }}</label>
|
<label for="customerGroup" >{{ __('admin::app.customers.customers.customer_group') }}</label>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,12 +12,12 @@
|
||||||
<h1>{{ __('admin::app.customers.customers.title') }}</h1>
|
<h1>{{ __('admin::app.customers.customers.title') }}</h1>
|
||||||
</div>
|
</div>
|
||||||
<div class="page-action">
|
<div class="page-action">
|
||||||
<div class="export" @click="showModal('downloadDataGrid')">
|
{{-- <div class="export" @click="showModal('downloadDataGrid')">
|
||||||
<i class="export-icon"></i>
|
<i class="export-icon"></i>
|
||||||
<span >
|
<span >
|
||||||
{{ __('admin::app.export.export') }}
|
{{ __('admin::app.export.export') }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div> --}}
|
||||||
|
|
||||||
<a href="{{ route('admin.customer.create') }}" class="btn btn-lg btn-primary">
|
<a href="{{ route('admin.customer.create') }}" class="btn btn-lg btn-primary">
|
||||||
{{ __('admin::app.customers.customers.add-title') }}
|
{{ __('admin::app.customers.customers.add-title') }}
|
||||||
|
|
@ -32,18 +32,18 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<modal id="downloadDataGrid" :is-open="modalIds.downloadDataGrid">
|
{{-- <modal id="downloadDataGrid" :is-open="modalIds.downloadDataGrid">
|
||||||
<h3 slot="header">{{ __('admin::app.export.download') }}</h3>
|
<h3 slot="header">{{ __('admin::app.export.download') }}</h3>
|
||||||
<div slot="body">
|
<div slot="body">
|
||||||
<export-form></export-form>
|
<export-form></export-form>
|
||||||
</div>
|
</div>
|
||||||
</modal>
|
</modal> --}}
|
||||||
|
|
||||||
@stop
|
@stop
|
||||||
|
|
||||||
@push('scripts')
|
@push('scripts')
|
||||||
|
|
||||||
<script type="text/x-template" id="export-form-template">
|
{{-- <script type="text/x-template" id="export-form-template">
|
||||||
<form method="POST" action="{{ route('admin.datagrid.export') }}">
|
<form method="POST" action="{{ route('admin.datagrid.export') }}">
|
||||||
|
|
||||||
<div class="page-content">
|
<div class="page-content">
|
||||||
|
|
@ -81,7 +81,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script> --}}
|
||||||
|
|
||||||
@endpush
|
@endpush
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body style="scroll-behavior: smooth;">
|
||||||
<div id="app">
|
<div id="app">
|
||||||
|
|
||||||
<flash-wrapper ref='flashes'></flash-wrapper>
|
<flash-wrapper ref='flashes'></flash-wrapper>
|
||||||
|
|
|
||||||
|
|
@ -11,14 +11,14 @@
|
||||||
<h1>{{ __('admin::app.sales.invoices.title') }}</h1>
|
<h1>{{ __('admin::app.sales.invoices.title') }}</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="page-action">
|
{{-- <div class="page-action">
|
||||||
<div class="export" @click="showModal('downloadDataGrid')">
|
<div class="export" @click="showModal('downloadDataGrid')">
|
||||||
<i class="export-icon"></i>
|
<i class="export-icon"></i>
|
||||||
<span>
|
<span>
|
||||||
{{ __('admin::app.export.export') }}
|
{{ __('admin::app.export.export') }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div> --}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="page-content">
|
<div class="page-content">
|
||||||
|
|
@ -27,18 +27,18 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<modal id="downloadDataGrid" :is-open="modalIds.downloadDataGrid">
|
{{-- <modal id="downloadDataGrid" :is-open="modalIds.downloadDataGrid">
|
||||||
<h3 slot="header">{{ __('admin::app.export.download') }}</h3>
|
<h3 slot="header">{{ __('admin::app.export.download') }}</h3>
|
||||||
<div slot="body">
|
<div slot="body">
|
||||||
<export-form></export-form>
|
<export-form></export-form>
|
||||||
</div>
|
</div>
|
||||||
</modal>
|
</modal> --}}
|
||||||
|
|
||||||
@stop
|
@stop
|
||||||
|
|
||||||
@push('scripts')
|
@push('scripts')
|
||||||
|
|
||||||
<script type="text/x-template" id="export-form-template">
|
{{-- <script type="text/x-template" id="export-form-template">
|
||||||
<form method="POST" action="{{ route('admin.datagrid.export') }}">
|
<form method="POST" action="{{ route('admin.datagrid.export') }}">
|
||||||
|
|
||||||
<div class="page-content">
|
<div class="page-content">
|
||||||
|
|
@ -76,6 +76,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script> --}}
|
||||||
|
|
||||||
@endpush
|
@endpush
|
||||||
|
|
@ -11,14 +11,14 @@
|
||||||
<h1>{{ __('admin::app.sales.orders.title') }}</h1>
|
<h1>{{ __('admin::app.sales.orders.title') }}</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="page-action">
|
{{-- <div class="page-action">
|
||||||
<div class="export" @click="showModal('downloadDataGrid')">
|
<div class="export" @click="showModal('downloadDataGrid')">
|
||||||
<i class="export-icon"></i>
|
<i class="export-icon"></i>
|
||||||
<span>
|
<span>
|
||||||
{{ __('admin::app.export.export') }}
|
{{ __('admin::app.export.export') }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div> --}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="page-content">
|
<div class="page-content">
|
||||||
|
|
@ -27,18 +27,18 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<modal id="downloadDataGrid" :is-open="modalIds.downloadDataGrid">
|
{{-- <modal id="downloadDataGrid" :is-open="modalIds.downloadDataGrid">
|
||||||
<h3 slot="header">{{ __('admin::app.export.download') }}</h3>
|
<h3 slot="header">{{ __('admin::app.export.download') }}</h3>
|
||||||
<div slot="body">
|
<div slot="body">
|
||||||
<export-form></export-form>
|
<export-form></export-form>
|
||||||
</div>
|
</div>
|
||||||
</modal>
|
</modal> --}}
|
||||||
|
|
||||||
@stop
|
@stop
|
||||||
|
|
||||||
@push('scripts')
|
@push('scripts')
|
||||||
|
|
||||||
<script type="text/x-template" id="export-form-template">
|
{{-- <script type="text/x-template" id="export-form-template">
|
||||||
<form method="POST" action="{{ route('admin.datagrid.export') }}">
|
<form method="POST" action="{{ route('admin.datagrid.export') }}">
|
||||||
|
|
||||||
<div class="page-content">
|
<div class="page-content">
|
||||||
|
|
@ -65,7 +65,7 @@
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
</script>
|
</script> --}}
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
Vue.component('export-form', {
|
Vue.component('export-form', {
|
||||||
|
|
|
||||||
|
|
@ -11,14 +11,14 @@
|
||||||
<h1>{{ __('admin::app.sales.shipments.title') }}</h1>
|
<h1>{{ __('admin::app.sales.shipments.title') }}</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="page-action">
|
{{-- <div class="page-action">
|
||||||
<div class="export" @click="showModal('downloadDataGrid')">
|
<div class="export" @click="showModal('downloadDataGrid')">
|
||||||
<i class="export-icon"></i>
|
<i class="export-icon"></i>
|
||||||
<span>
|
<span>
|
||||||
{{ __('admin::app.export.export') }}
|
{{ __('admin::app.export.export') }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div> --}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="page-content">
|
<div class="page-content">
|
||||||
|
|
@ -27,18 +27,18 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<modal id="downloadDataGrid" :is-open="modalIds.downloadDataGrid">
|
{{-- <modal id="downloadDataGrid" :is-open="modalIds.downloadDataGrid">
|
||||||
<h3 slot="header">{{ __('admin::app.export.download') }}</h3>
|
<h3 slot="header">{{ __('admin::app.export.download') }}</h3>
|
||||||
<div slot="body">
|
<div slot="body">
|
||||||
<export-form></export-form>
|
<export-form></export-form>
|
||||||
</div>
|
</div>
|
||||||
</modal>
|
</modal> --}}
|
||||||
|
|
||||||
@stop
|
@stop
|
||||||
|
|
||||||
@push('scripts')
|
@push('scripts')
|
||||||
|
|
||||||
<script type="text/x-template" id="export-form-template">
|
{{-- <script type="text/x-template" id="export-form-template">
|
||||||
<form method="POST" action="{{ route('admin.datagrid.export') }}">
|
<form method="POST" action="{{ route('admin.datagrid.export') }}">
|
||||||
|
|
||||||
<div class="page-content">
|
<div class="page-content">
|
||||||
|
|
@ -76,6 +76,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script> --}}
|
||||||
|
|
||||||
@endpush
|
@endpush
|
||||||
|
|
@ -695,7 +695,6 @@ class Core
|
||||||
foreach (config('core') as $coreData) {
|
foreach (config('core') as $coreData) {
|
||||||
if (isset($coreData['fields'])) {
|
if (isset($coreData['fields'])) {
|
||||||
foreach ($coreData['fields'] as $field) {
|
foreach ($coreData['fields'] as $field) {
|
||||||
|
|
||||||
$name = $coreData['key'] . '.' . $field['name'];
|
$name = $coreData['key'] . '.' . $field['name'];
|
||||||
|
|
||||||
if ($name == $fieldName ) {
|
if ($name == $fieldName ) {
|
||||||
|
|
|
||||||
|
|
@ -99,6 +99,7 @@ class CustomerController extends Controller
|
||||||
'gender' => 'required',
|
'gender' => 'required',
|
||||||
'date_of_birth' => 'date|before:today',
|
'date_of_birth' => 'date|before:today',
|
||||||
'email' => 'email|unique:customers,email,'.$id,
|
'email' => 'email|unique:customers,email,'.$id,
|
||||||
|
'phone' => 'nullable|numeric|unique:customers,phone,'. $id,
|
||||||
'password' => 'confirmed'
|
'password' => 'confirmed'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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'];
|
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 $hidden = ['password', 'remember_token'];
|
protected $hidden = ['password', 'remember_token'];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,9 +35,6 @@ return [
|
||||||
[
|
[
|
||||||
'title' => 'Pending',
|
'title' => 'Pending',
|
||||||
'value' => 'pending'
|
'value' => 'pending'
|
||||||
], [
|
|
||||||
'title' => 'Approved',
|
|
||||||
'value' => 'Approved'
|
|
||||||
], [
|
], [
|
||||||
'title' => 'Pending Payment',
|
'title' => 'Pending Payment',
|
||||||
'value' => 'pending_payment'
|
'value' => 'pending_payment'
|
||||||
|
|
@ -86,9 +83,6 @@ return [
|
||||||
[
|
[
|
||||||
'title' => 'Pending',
|
'title' => 'Pending',
|
||||||
'value' => 'pending'
|
'value' => 'pending'
|
||||||
], [
|
|
||||||
'title' => 'Approved',
|
|
||||||
'value' => 'Approved'
|
|
||||||
], [
|
], [
|
||||||
'title' => 'Pending Payment',
|
'title' => 'Pending Payment',
|
||||||
'value' => 'pending_payment'
|
'value' => 'pending_payment'
|
||||||
|
|
@ -137,9 +131,6 @@ return [
|
||||||
[
|
[
|
||||||
'title' => 'Pending',
|
'title' => 'Pending',
|
||||||
'value' => 'pending'
|
'value' => 'pending'
|
||||||
], [
|
|
||||||
'title' => 'Approved',
|
|
||||||
'value' => 'Approved'
|
|
||||||
], [
|
], [
|
||||||
'title' => 'Pending Payment',
|
'title' => 'Pending Payment',
|
||||||
'value' => 'pending_payment'
|
'value' => 'pending_payment'
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ class Toolbar extends AbstractProduct
|
||||||
'created_at-desc' => 'newest-first',
|
'created_at-desc' => 'newest-first',
|
||||||
'created_at-asc' => 'oldest-first',
|
'created_at-asc' => 'oldest-first',
|
||||||
'price-asc' => 'cheapest-first',
|
'price-asc' => 'cheapest-first',
|
||||||
'price-desc' => 'expansive-first'
|
'price-desc' => 'expensive-first'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ use Webkul\Product\Repositories\ProductGridRepository as ProductGrid;
|
||||||
use Webkul\Attribute\Repositories\AttributeFamilyRepository as AttributeFamily;
|
use Webkul\Attribute\Repositories\AttributeFamilyRepository as AttributeFamily;
|
||||||
use Webkul\Category\Repositories\CategoryRepository as Category;
|
use Webkul\Category\Repositories\CategoryRepository as Category;
|
||||||
use Webkul\Inventory\Repositories\InventorySourceRepository as InventorySource;
|
use Webkul\Inventory\Repositories\InventorySourceRepository as InventorySource;
|
||||||
|
use Webkul\Admin\DataGrids\TestDataGrid;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Product controller
|
* Product controller
|
||||||
|
|
@ -202,6 +203,7 @@ 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) {
|
||||||
|
|
@ -220,12 +222,17 @@ 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'])) {
|
||||||
return redirect()->back();
|
return redirect()->back();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!$data['massaction-type'] == 'update') {
|
||||||
|
return redirect()->back();
|
||||||
|
}
|
||||||
|
|
||||||
$productIds = explode(',', $data['indexes']);
|
$productIds = explode(',', $data['indexes']);
|
||||||
|
|
||||||
foreach ($productIds as $productId) {
|
foreach ($productIds as $productId) {
|
||||||
|
|
|
||||||
|
|
@ -1,27 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Webkul\Sales\Repositories;
|
|
||||||
|
|
||||||
use Illuminate\Container\Container as App;
|
|
||||||
use Webkul\Core\Eloquent\Repository;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ShipmentItem Reposotory
|
|
||||||
*
|
|
||||||
* @author Jitendra Singh <jitendra@webkul.com>
|
|
||||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
|
||||||
*/
|
|
||||||
|
|
||||||
class ShipmentItemRepository extends Repository
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Specify Model class name
|
|
||||||
*
|
|
||||||
* @return Mixed
|
|
||||||
*/
|
|
||||||
|
|
||||||
function model()
|
|
||||||
{
|
|
||||||
return 'Webkul\Sales\Contracts\ShipmentItem';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -106,16 +106,21 @@ return [
|
||||||
'name' => 'Origin',
|
'name' => 'Origin',
|
||||||
'sort' => 0,
|
'sort' => 0,
|
||||||
'fields' => [
|
'fields' => [
|
||||||
// [
|
|
||||||
// 'name' => 'country',
|
|
||||||
// 'title' => 'Country',
|
|
||||||
// 'type' => 'country_state',
|
|
||||||
// 'stateName' => 'state'
|
|
||||||
// 'validation' => 'required',
|
|
||||||
// 'channel_based' => true,
|
|
||||||
// 'locale_based' => true
|
|
||||||
// ],
|
|
||||||
[
|
[
|
||||||
|
'name' => 'country',
|
||||||
|
'title' => 'Country',
|
||||||
|
'type' => 'country',
|
||||||
|
'validation' => 'required',
|
||||||
|
'channel_based' => true,
|
||||||
|
'locale_based' => true
|
||||||
|
], [
|
||||||
|
'name' => 'state',
|
||||||
|
'title' => 'State',
|
||||||
|
'type' => 'state',
|
||||||
|
'validation' => 'required',
|
||||||
|
'channel_based' => true,
|
||||||
|
'locale_based' => true
|
||||||
|
], [
|
||||||
'name' => 'address1',
|
'name' => 'address1',
|
||||||
'title' => 'Address Line 1',
|
'title' => 'Address Line 1',
|
||||||
'type' => 'text',
|
'type' => 'text',
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,12 @@
|
||||||
<span class="control-error" v-if="errors.has('email')">@{{ errors.first('email') }}</span>
|
<span class="control-error" v-if="errors.has('email')">@{{ errors.first('email') }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="control-group" :class="[errors.has('phone') ? 'has-error' : '']">
|
||||||
|
<label for="phone">{{ __('shop::app.customer.account.profile.phone') }}</label>
|
||||||
|
<input type="text" class="control" name="phone" v-validate="'numeric|max:10'" value="{{ old('phone') ?? $customer->phone }}" data-vv-as=""{{ __('shop::app.customer.account.profile.phone') }}"">
|
||||||
|
<span class="control-error" v-if="errors.has('phone')">@{{ errors.first('phone') }}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="control-group" :class="[errors.has('oldpassword') ? 'has-error' : '']">
|
<div class="control-group" :class="[errors.has('oldpassword') ? 'has-error' : '']">
|
||||||
<label for="password">{{ __('shop::app.customer.account.profile.opassword') }}</label>
|
<label for="password">{{ __('shop::app.customer.account.profile.opassword') }}</label>
|
||||||
<input type="password" class="control" name="oldpassword" data-vv-as=""{{ __('shop::app.customer.account.profile.opassword') }}"" v-validate="'min:6'">
|
<input type="password" class="control" name="oldpassword" data-vv-as=""{{ __('shop::app.customer.account.profile.opassword') }}"" v-validate="'min:6'">
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,11 @@
|
||||||
<td>{{ $customer->email }}</td>
|
<td>{{ $customer->email }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>{{ __('shop::app.customer.account.profile.phone') }}</td>
|
||||||
|
<td>{{ $customer->phone }}</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
{{-- @if($customer->subscribed_to_news_letter == 1)
|
{{-- @if($customer->subscribed_to_news_letter == 1)
|
||||||
<tr>
|
<tr>
|
||||||
<td> {{ __('shop::app.footer.subscribe-newsletter') }}</td>
|
<td> {{ __('shop::app.footer.subscribe-newsletter') }}</td>
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -1,4 +1,4 @@
|
||||||
{
|
{
|
||||||
"/js/ui.js": "/js/ui.js?id=c3ee60fd11e29aca2922",
|
"/js/ui.js": "/js/ui.js?id=c3ee60fd11e29aca2922",
|
||||||
"/css/ui.css": "/css/ui.css?id=0b2b51d90a970c9a4219"
|
"/css/ui.css": "/css/ui.css?id=1edd188de8c037f174a0"
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,196 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Webkul\Ui\DataGrid;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
/**
|
||||||
|
* Product Data Grid class
|
||||||
|
*
|
||||||
|
* @author Jitendra Singh <jitendra@webkul.com>
|
||||||
|
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||||
|
*/
|
||||||
|
abstract class AbsGrid
|
||||||
|
{
|
||||||
|
protected $index = null;
|
||||||
|
protected $columns = [];
|
||||||
|
protected $allColumns = [];
|
||||||
|
protected $queryBuilder = [];
|
||||||
|
protected $collection = [];
|
||||||
|
protected $actions = [];
|
||||||
|
protected $massActions = [];
|
||||||
|
protected $request;
|
||||||
|
protected $parse;
|
||||||
|
// protected $gridName = null;
|
||||||
|
|
||||||
|
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.
|
||||||
|
*/
|
||||||
|
private function parse()
|
||||||
|
{
|
||||||
|
$parsed = [];
|
||||||
|
$unparsed = url()->full();
|
||||||
|
|
||||||
|
if (count(explode('?', $unparsed)) > 1) {
|
||||||
|
$to_be_parsed = explode('?', $unparsed)[1];
|
||||||
|
|
||||||
|
parse_str($to_be_parsed, $parsed);
|
||||||
|
unset($parsed['page']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $parsed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addColumn($column)
|
||||||
|
{
|
||||||
|
array_push($this->columns, $column);
|
||||||
|
|
||||||
|
$this->setAllColumnDetails($column);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setAllColumnDetails($column)
|
||||||
|
{
|
||||||
|
array_push($this->allColumns, $column);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setQueryBuilder($queryBuilder)
|
||||||
|
{
|
||||||
|
$this->queryBuilder = $queryBuilder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addAction($action)
|
||||||
|
{
|
||||||
|
array_push($this->actions, $action);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addMassAction($massAction)
|
||||||
|
{
|
||||||
|
array_push($this->massActions, $massAction);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCollection()
|
||||||
|
{
|
||||||
|
$p = $this->parse();
|
||||||
|
|
||||||
|
if(count($p)) {
|
||||||
|
$filteredOrSortedCollection = $this->sortOrFilterCollection($this->collection = $this->queryBuilder, $p);
|
||||||
|
|
||||||
|
// return $filteredOrSortedCollection->get();
|
||||||
|
|
||||||
|
if (config()->has('datagrid.pagination')) {
|
||||||
|
return $filteredOrSortedCollection->paginate(config('datagrid.pagination'));
|
||||||
|
} else {
|
||||||
|
return $filteredOrSortedCollection->get();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (config()->has('datagrid.pagination')) {
|
||||||
|
$this->collection = $this->queryBuilder->paginate(config('datagrid.pagination'));
|
||||||
|
} else {
|
||||||
|
$this->collection = $this->queryBuilder->get();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->collection) {
|
||||||
|
return $this->collection;
|
||||||
|
} else {
|
||||||
|
dd('no records found');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To find the alias of the column and by taking the column name.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function findColumnType($columnAlias) {
|
||||||
|
foreach($this->allColumns as $column) {
|
||||||
|
if($column['alias'] == $columnAlias) {
|
||||||
|
return [$column['type'], $column['index']];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function sortOrFilterCollection($collection, $parseInfo) {
|
||||||
|
|
||||||
|
foreach($parseInfo as $key => $info) {
|
||||||
|
$columnType = $this->findColumnType($key)[0];
|
||||||
|
$columnName = $this->findColumnType($key)[1];
|
||||||
|
|
||||||
|
if($key == "sort") {
|
||||||
|
$count_keys = count(array_keys($info));
|
||||||
|
|
||||||
|
if ($count_keys > 1) {
|
||||||
|
throw new \Exception('Fatal Error! Multiple Sort keys Found, Please Resolve the URL Manually');
|
||||||
|
}
|
||||||
|
|
||||||
|
$columnName = $this->findColumnType(array_keys($info)[0]);
|
||||||
|
|
||||||
|
return $collection->orderBy(
|
||||||
|
$columnName[1],
|
||||||
|
array_values($info)[0]
|
||||||
|
);
|
||||||
|
} else if($key == "search") {
|
||||||
|
$count_keys = count(array_keys($info));
|
||||||
|
|
||||||
|
if($count_keys > 1) {
|
||||||
|
throw new \Exception('Multiple Search keys Found, Please Resolve the URL Manually');
|
||||||
|
}
|
||||||
|
|
||||||
|
if($count_keys == 1) {
|
||||||
|
return $collection->where(function() use($collection, $info) {
|
||||||
|
foreach ($this->allColumns as $column) {
|
||||||
|
if($column['searchable'] == true)
|
||||||
|
$collection->orWhere($column['index'], 'like', '%'.$info['all'].'%');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (array_keys($info)[0] == "like" || array_keys($info)[0] == "nlike") {
|
||||||
|
foreach ($info as $condition => $filter_value) {
|
||||||
|
return $collection->where(
|
||||||
|
$columnName,
|
||||||
|
config("datagrid.operators.{$condition}"),
|
||||||
|
'%'.$filter_value.'%'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
foreach ($info as $condition => $filter_value) {
|
||||||
|
if($columnType == 'datetime') {
|
||||||
|
return $collection->whereDate(
|
||||||
|
$columnName,
|
||||||
|
config("datagrid.operators.{$condition}"),
|
||||||
|
$filter_value
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return $collection->where(
|
||||||
|
$columnName,
|
||||||
|
config("datagrid.operators.{$condition}"),
|
||||||
|
$filter_value
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function render()
|
||||||
|
{
|
||||||
|
$this->addColumns();
|
||||||
|
|
||||||
|
$this->setIndex();
|
||||||
|
|
||||||
|
$this->prepareActions();
|
||||||
|
|
||||||
|
$this->prepareMassActions();
|
||||||
|
|
||||||
|
$this->prepareQueryBuilder();
|
||||||
|
|
||||||
|
return view('ui::testgrid.table')->with('results', ['records' => $this->getCollection(), 'columns' => $this->allColumns, 'actions' => $this->actions, 'massactions' => $this->massActions, 'index' => $this->index]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Webkul\Ui\DataGrid;
|
namespace Webkul\Ui\DataGrid;
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
|
@ -20,8 +21,6 @@ use URL;
|
||||||
*
|
*
|
||||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
class DataGrid
|
class DataGrid
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
@ -30,7 +29,6 @@ class DataGrid
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
|
|
||||||
protected $name;
|
protected $name;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -39,7 +37,6 @@ class DataGrid
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
|
|
||||||
protected $select;
|
protected $select;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -47,7 +44,6 @@ class DataGrid
|
||||||
* Table
|
* Table
|
||||||
* @var Boolean for aliasing
|
* @var Boolean for aliasing
|
||||||
*/
|
*/
|
||||||
|
|
||||||
protected $aliased;
|
protected $aliased;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -88,15 +84,14 @@ class DataGrid
|
||||||
protected $columns;
|
protected $columns;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* array of columns
|
* array of columns to be filtered
|
||||||
* to be filtered
|
*
|
||||||
* @var Array
|
* @var Array
|
||||||
*/
|
*/
|
||||||
protected $filterable;
|
protected $filterable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* array of columns
|
* array of columns to be searched
|
||||||
* to be searched
|
|
||||||
*
|
*
|
||||||
* @var Array
|
* @var Array
|
||||||
*/
|
*/
|
||||||
|
|
@ -125,12 +120,14 @@ class DataGrid
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Actions $action
|
* Actions $action
|
||||||
|
*
|
||||||
* @var action
|
* @var action
|
||||||
*/
|
*/
|
||||||
protected $actions;
|
protected $actions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* URL parse $parsed
|
* URL parse $parsed
|
||||||
|
*
|
||||||
* @var parse
|
* @var parse
|
||||||
*/
|
*/
|
||||||
protected $parsed;
|
protected $parsed;
|
||||||
|
|
@ -162,43 +159,45 @@ class DataGrid
|
||||||
// list($name, $select, $table, $join, $columns) = array_values($args);
|
// list($name, $select, $table, $join, $columns) = array_values($args);
|
||||||
$name = $select = $aliased = $table = false;
|
$name = $select = $aliased = $table = false;
|
||||||
$join = $columns = $filterable = $searchable =
|
$join = $columns = $filterable = $searchable =
|
||||||
$massoperations = $css = $operators = $actions = [];
|
$massoperations = $css = $actions = [];
|
||||||
|
|
||||||
extract($args);
|
extract($args);
|
||||||
return $this->build($name, $select, $filterable, $searchable, $massoperations, $aliased, $perpage, $table, $join, $columns, $css, $operators,$actions);
|
|
||||||
|
return $this->build($name, $select, $filterable, $searchable, $massoperations, $aliased, $perpage, $table, $join, $columns, $css, $actions);
|
||||||
}
|
}
|
||||||
|
|
||||||
//This assigns the private and public properties of the datagrid classes from make functions
|
//This assigns the private and public properties of the datagrid classes from make functions
|
||||||
public function build (
|
public function build (
|
||||||
$name = null,
|
string $name = null,
|
||||||
$select = false,
|
string $select = null,
|
||||||
array $filterable = [],
|
array $filterable = [],
|
||||||
array $searchable = [],
|
array $searchable = [],
|
||||||
array $massoperations = [],
|
array $massoperations = [],
|
||||||
bool $aliased = false,
|
bool $aliased = false,
|
||||||
$perpage = 0,
|
int $perpage = 0,
|
||||||
$table = null,
|
string $table = null,
|
||||||
array $join = [],
|
array $join = [],
|
||||||
array $columns = null,
|
array $columns = null,
|
||||||
array $css = [],
|
array $css = [],
|
||||||
array $operators = [],
|
|
||||||
array $actions = [],
|
array $actions = [],
|
||||||
Pagination $pagination = null
|
Pagination $pagination = null
|
||||||
) {
|
) {
|
||||||
$this->request = Request::capture();
|
$this->request = Request::capture();
|
||||||
$this->setName($name);
|
$this->setName($name);
|
||||||
|
$this->setAlias($aliased);
|
||||||
|
$this->setTable($table);
|
||||||
$this->setSelect($select);
|
$this->setSelect($select);
|
||||||
$this->setFilterable($filterable);
|
$this->setFilterable($filterable);
|
||||||
$this->setSearchable($filterable);
|
$this->setSearchable($filterable);
|
||||||
$this->setMassOperations($massoperations);
|
$this->setMassOperations($massoperations);
|
||||||
$this->setAlias($aliased);
|
|
||||||
$this->setPerPage($perpage);
|
$this->setPerPage($perpage);
|
||||||
$this->setTable($table);
|
|
||||||
$this->setJoin($join);
|
$this->setJoin($join);
|
||||||
$this->addColumns($columns, true);
|
$this->addColumns($columns, true);
|
||||||
$this->setCss($css);
|
$this->setCss($css);
|
||||||
$this->setOperators($operators);
|
$this->setOperators();
|
||||||
$this->setActions($actions);
|
$this->setActions($actions);
|
||||||
// $this->addPagination($pagination);
|
// $this->addPagination($pagination);
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -207,7 +206,6 @@ class DataGrid
|
||||||
*
|
*
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public function setName(string $name)
|
public function setName(string $name)
|
||||||
{
|
{
|
||||||
$this->name = $name ? : 'Default' . time();
|
$this->name = $name ? : 'Default' . time();
|
||||||
|
|
@ -219,18 +217,28 @@ class DataGrid
|
||||||
*
|
*
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public function setSelect($select)
|
public function setSelect($select)
|
||||||
{
|
{
|
||||||
$this->select = $select ? : false;
|
if (!$select) {
|
||||||
|
$select = config('datagrid.select');
|
||||||
|
|
||||||
|
if ($this->aliased) {
|
||||||
|
$alias = $this->findTableAlias();
|
||||||
|
|
||||||
|
$select = $alias.'.'.$select;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->select = $select;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Filterable
|
* Set Filterable
|
||||||
|
*
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public function setFilterable(array $filterable)
|
public function setFilterable(array $filterable)
|
||||||
{
|
{
|
||||||
$this->filterable = $filterable ? : [];
|
$this->filterable = $filterable ? : [];
|
||||||
|
|
@ -239,9 +247,9 @@ class DataGrid
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Searchable columns
|
* Set Searchable columns
|
||||||
|
*
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public function setSearchable($searchable)
|
public function setSearchable($searchable)
|
||||||
{
|
{
|
||||||
$this->searchable = $searchable ? : [];
|
$this->searchable = $searchable ? : [];
|
||||||
|
|
@ -250,9 +258,9 @@ class DataGrid
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set mass operations
|
* Set mass operations
|
||||||
|
*
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public function setMassOperations($massops)
|
public function setMassOperations($massops)
|
||||||
{
|
{
|
||||||
$this->massoperations = $massops ? : [];
|
$this->massoperations = $massops ? : [];
|
||||||
|
|
@ -260,13 +268,10 @@ class DataGrid
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set alias parameter
|
* Set alias parameter to know whether aliasing is true or not.
|
||||||
* to know whether
|
|
||||||
* aliasing is true or not.
|
|
||||||
*
|
*
|
||||||
* @return $this.
|
* @return $this.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public function setAlias(bool $aliased)
|
public function setAlias(bool $aliased)
|
||||||
{
|
{
|
||||||
$this->aliased = $aliased ? : false;
|
$this->aliased = $aliased ? : false;
|
||||||
|
|
@ -274,13 +279,10 @@ class DataGrid
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the default
|
* Set the default pagination for data grid.
|
||||||
* pagination for
|
|
||||||
* data grid.
|
|
||||||
*
|
*
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public function setPerPage($perpage)
|
public function setPerPage($perpage)
|
||||||
{
|
{
|
||||||
$this->perpage = $perpage ? : 5;
|
$this->perpage = $perpage ? : 5;
|
||||||
|
|
@ -288,12 +290,10 @@ class DataGrid
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set table name in front
|
* Set table name in front of query scope.
|
||||||
* of query scope.
|
|
||||||
*
|
*
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public function setTable(string $table)
|
public function setTable(string $table)
|
||||||
{
|
{
|
||||||
$this->table = $table ?: false;
|
$this->table = $table ?: false;
|
||||||
|
|
@ -301,12 +301,10 @@ class DataGrid
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set join bag if
|
* Set join bag if present.
|
||||||
* present.
|
|
||||||
*
|
*
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public function setJoin(array $join)
|
public function setJoin(array $join)
|
||||||
{
|
{
|
||||||
$this->join = $join ?: [];
|
$this->join = $join ?: [];
|
||||||
|
|
@ -315,20 +313,45 @@ class DataGrid
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds the custom css rules
|
* Adds the custom css rules
|
||||||
* @retun $this
|
*
|
||||||
|
* @return $this
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private function setCss($css = [])
|
private function setCss($css = [])
|
||||||
{
|
{
|
||||||
$this->css = new Css($css);
|
$this->css = new Css($css);
|
||||||
return $this->css;
|
return $this->css;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* setFilterableColumns
|
* Adds operands to be used for query condition
|
||||||
|
*
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
|
public function setOperators()
|
||||||
|
{
|
||||||
|
$operands = [
|
||||||
|
'eq' => "=",
|
||||||
|
'lt' => "<",
|
||||||
|
'gt' => ">",
|
||||||
|
'lte' => "<=",
|
||||||
|
'gte' => ">=",
|
||||||
|
'neqs' => "<>",
|
||||||
|
'neqn' => "!=",
|
||||||
|
'like' => "like",
|
||||||
|
'nlike' => "not like",
|
||||||
|
];
|
||||||
|
|
||||||
|
$this->operators = $operands;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* setFilterableColumns
|
||||||
|
*
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
// public function setFilterableColumns($filterable_columns = [])
|
// public function setFilterableColumns($filterable_columns = [])
|
||||||
// {
|
// {
|
||||||
// $this->join = $filterable_columns ?: [];
|
// $this->join = $filterable_columns ?: [];
|
||||||
|
|
@ -336,11 +359,25 @@ class DataGrid
|
||||||
// }
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Section actions bag
|
* get alias of the leftmost table
|
||||||
* here.
|
*
|
||||||
|
* @return null|string
|
||||||
|
*/
|
||||||
|
public function findTableAlias() {
|
||||||
|
if($this->aliased) {
|
||||||
|
$alias = trim(explode('as', $this->table)[1]);
|
||||||
|
} else {
|
||||||
|
$alias = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $alias;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Section actions bag here.
|
||||||
|
*
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public function setActions($actions = []) {
|
public function setActions($actions = []) {
|
||||||
$this->actions = $actions ?: [];
|
$this->actions = $actions ?: [];
|
||||||
return $this;
|
return $this;
|
||||||
|
|
@ -351,17 +388,18 @@ class DataGrid
|
||||||
*
|
*
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public function addColumns($columns = [], $reCreate = false)
|
public function addColumns($columns = [], $reCreate = false)
|
||||||
{
|
{
|
||||||
if ($reCreate) {
|
if ($reCreate) {
|
||||||
$this->columns = new Collection();
|
$this->columns = new Collection();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($columns) {
|
if ($columns) {
|
||||||
foreach ($columns as $column) {
|
foreach ($columns as $column) {
|
||||||
$this->addColumn($column);
|
$this->addColumn($column);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -370,7 +408,6 @@ class DataGrid
|
||||||
*
|
*
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public function addColumn($column = [])
|
public function addColumn($column = [])
|
||||||
{
|
{
|
||||||
if ($column instanceof Column) {
|
if ($column instanceof Column) {
|
||||||
|
|
@ -380,16 +417,15 @@ class DataGrid
|
||||||
} else {
|
} else {
|
||||||
throw new \Exception("DataGrid: Add Column argument is not valid!");
|
throw new \Exception("DataGrid: Add Column argument is not valid!");
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add ColumnMultiple.
|
* Add multiple columns, not being used currently
|
||||||
* Currently is not
|
*
|
||||||
* of any use.
|
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private function addColumnMultiple($column = [], $multiple = false)
|
private function addColumnMultiple($column = [], $multiple = false)
|
||||||
{
|
{
|
||||||
if ($column instanceof Column) {
|
if ($column instanceof Column) {
|
||||||
|
|
@ -419,16 +455,6 @@ class DataGrid
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds expressional verbs to be used
|
|
||||||
* @return $this
|
|
||||||
*/
|
|
||||||
public function setOperators(array $operators)
|
|
||||||
{
|
|
||||||
$this->operators = $operators ?: [];
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add Pagination.
|
* Add Pagination.
|
||||||
*
|
*
|
||||||
|
|
@ -443,27 +469,28 @@ class DataGrid
|
||||||
} else {
|
} else {
|
||||||
throw new \Exception("DataGrid: Pagination argument is not valid!");
|
throw new \Exception("DataGrid: Pagination argument is not valid!");
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used for selecting
|
* Used for selecting the columns got in make from controller.
|
||||||
* the columns got in
|
*
|
||||||
* make from controller.
|
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
private function getSelect()
|
private function getSelect()
|
||||||
{
|
{
|
||||||
$select = [];
|
$select = [];
|
||||||
|
|
||||||
|
if ($this->select) {
|
||||||
|
$this->query->addselect($this->select);
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($this->columns as $column) {
|
foreach ($this->columns as $column) {
|
||||||
$this->query->addselect(DB::raw($column->name.' as '.$column->alias));
|
$this->query->addselect(DB::raw($column->name.' as '.$column->alias));
|
||||||
}
|
}
|
||||||
|
|
||||||
// $this->query->select(...$select);
|
// $this->query->select(...$select);
|
||||||
|
|
||||||
if ($this->select) {
|
|
||||||
$this->query->addselect($this->select);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -473,7 +500,7 @@ class DataGrid
|
||||||
* name.
|
* name.
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function findAlias($column_alias) {
|
public function findColumnAlias($column_alias) {
|
||||||
foreach($this->columns as $column) {
|
foreach($this->columns as $column) {
|
||||||
if($column->alias == $column_alias) {
|
if($column->alias == $column_alias) {
|
||||||
return $column->name;
|
return $column->name;
|
||||||
|
|
@ -488,7 +515,7 @@ class DataGrid
|
||||||
* name.
|
* name.
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function findType($column_alias) {
|
public function findColumnType($column_alias) {
|
||||||
foreach($this->columns as $column) {
|
foreach($this->columns as $column) {
|
||||||
if($column->alias == $column_alias) {
|
if($column->alias == $column_alias) {
|
||||||
return $column->type;
|
return $column->type;
|
||||||
|
|
@ -497,14 +524,13 @@ class DataGrid
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse the URL
|
* Parse the URL and get it ready to be used.
|
||||||
* and get it ready
|
|
||||||
* to be used.
|
|
||||||
*/
|
*/
|
||||||
private function parse()
|
private function parse()
|
||||||
{
|
{
|
||||||
$parsed = [];
|
$parsed = [];
|
||||||
$unparsed = url()->full();
|
$unparsed = url()->full();
|
||||||
|
|
||||||
if (count(explode('?', $unparsed)) > 1) {
|
if (count(explode('?', $unparsed)) > 1) {
|
||||||
$to_be_parsed = explode('?', $unparsed)[1];
|
$to_be_parsed = explode('?', $unparsed)[1];
|
||||||
|
|
||||||
|
|
@ -519,17 +545,24 @@ class DataGrid
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ->join('contacts', 'users.id', '=', 'contacts.user_id')
|
* ->join('contacts', 'users.id', '=', 'contacts.user_id')
|
||||||
|
*
|
||||||
* @return $this->query
|
* @return $this->query
|
||||||
*/
|
*/
|
||||||
private function getQueryWithJoin()
|
private function getQueryWithJoin()
|
||||||
{
|
{
|
||||||
foreach ($this->join as $join) {
|
foreach ($this->join as $join) {
|
||||||
$this->query->{$join['join']}($join['table'], $join['primaryKey'], $join['condition'], $join['secondaryKey']);
|
$this->query->{$join['join']}($join['table'], $join['primaryKey'], $join['condition'], $join['secondaryKey']);
|
||||||
|
|
||||||
|
if(isset($join['conditions'])) {
|
||||||
|
// dd($join['conditions']['condition'][0], $join['conditions']['condition'][1]);
|
||||||
|
$this->query->{$join['join']}($join['table'], $join['primaryKey'], $join['condition'], $join['secondaryKey'])->where($join['conditions']['condition'][0], $join['conditions']['condition'][1]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getQueryWithColumnFilters()
|
private function getQueryWithColumnFilters()
|
||||||
{
|
{
|
||||||
|
// config()->set('key', $value);
|
||||||
foreach ($this->columns as $column) {
|
foreach ($this->columns as $column) {
|
||||||
if ($column->filter) { // if the filter bag in array exists then these will be applied.
|
if ($column->filter) { // if the filter bag in array exists then these will be applied.
|
||||||
// if (count($column->filter['condition']) == count($column->filter['condition'], COUNT_RECURSIVE)) {
|
// if (count($column->filter['condition']) == count($column->filter['condition'], COUNT_RECURSIVE)) {
|
||||||
|
|
@ -567,13 +600,13 @@ class DataGrid
|
||||||
|
|
||||||
if ($this->aliased) { //aliasing is expected in this case or it will be changed to presence of join bag
|
if ($this->aliased) { //aliasing is expected in this case or it will be changed to presence of join bag
|
||||||
foreach ($parsed as $key=>$value) {
|
foreach ($parsed as $key=>$value) {
|
||||||
$column_name = $this->findAlias($key);
|
$column_name = $this->findColumnAlias($key);
|
||||||
$column_type = $this->findType($key);
|
$column_type = $this->findColumnType($key);
|
||||||
|
|
||||||
if ($key == "sort") {
|
if ($key == "sort") {
|
||||||
//resolve the case with the column helper class
|
//resolve the case with the column helper class
|
||||||
if(substr_count($key,'_') >= 1)
|
if(substr_count($key,'_') >= 1)
|
||||||
$column_name = $this->findAlias($key);
|
$column_name = $this->findColumnAlias($key);
|
||||||
|
|
||||||
//case that don't need any resolving
|
//case that don't need any resolving
|
||||||
$count_keys = count(array_keys($value));
|
$count_keys = count(array_keys($value));
|
||||||
|
|
@ -599,7 +632,7 @@ class DataGrid
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
$column_name = $this->findAlias($key);
|
$column_name = $this->findColumnAlias($key);
|
||||||
if (array_keys($value)[0]=="like" || array_keys($value)[0]=="nlike") {
|
if (array_keys($value)[0]=="like" || array_keys($value)[0]=="nlike") {
|
||||||
foreach ($value as $condition => $filter_value) {
|
foreach ($value as $condition => $filter_value) {
|
||||||
if (strpos($column_name, 'CONCAT') !== false) {
|
if (strpos($column_name, 'CONCAT') !== false) {
|
||||||
|
|
@ -640,7 +673,6 @@ class DataGrid
|
||||||
} else {
|
} else {
|
||||||
//this is the case for the non aliasing.
|
//this is the case for the non aliasing.
|
||||||
foreach ($parsed as $key => $value) {
|
foreach ($parsed as $key => $value) {
|
||||||
|
|
||||||
if ($key=="sort") {
|
if ($key=="sort") {
|
||||||
|
|
||||||
//case that don't need any resolving
|
//case that don't need any resolving
|
||||||
|
|
@ -672,8 +704,8 @@ class DataGrid
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// $column_name = $key;
|
// $column_name = $key;
|
||||||
$column_name = $this->findAlias($key);
|
$column_name = $this->findColumnAlias($key);
|
||||||
$column_type = $this->findType($key);
|
$column_type = $this->findColumnType($key);
|
||||||
|
|
||||||
if (array_keys($value)[0]=="like" || array_keys($value)[0]=="nlike") {
|
if (array_keys($value)[0]=="like" || array_keys($value)[0]=="nlike") {
|
||||||
foreach ($value as $condition => $filter_value) {
|
foreach ($value as $condition => $filter_value) {
|
||||||
|
|
@ -712,7 +744,6 @@ class DataGrid
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -811,7 +842,9 @@ class DataGrid
|
||||||
$this->getQueryWithFilters();
|
$this->getQueryWithFilters();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($pagination == 'true') {
|
if ($pagination == 'true' && config('datagrid.distinct')) {
|
||||||
|
$this->results = $this->query->orderBy($this->select, 'desc')->distinct()->paginate($this->perpage)->appends(request()->except('page'));
|
||||||
|
} else if($pagination == 'true' && !config('datagrid.distinct')) {
|
||||||
$this->results = $this->query->orderBy($this->select, 'desc')->paginate($this->perpage)->appends(request()->except('page'));
|
$this->results = $this->query->orderBy($this->select, 'desc')->paginate($this->perpage)->appends(request()->except('page'));
|
||||||
}else {
|
}else {
|
||||||
$this->results = $this->query->orderBy($this->select, 'desc')->get();
|
$this->results = $this->query->orderBy($this->select, 'desc')->get();
|
||||||
|
|
@ -842,13 +875,10 @@ class DataGrid
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Main Render Function,
|
* Main Render Function, it renders views responsible for loading datagrid.
|
||||||
* it renders views responsible
|
|
||||||
* for loading datagrid.
|
|
||||||
*
|
*
|
||||||
* @return view
|
* @return view
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public function render($pagination = true)
|
public function render($pagination = true)
|
||||||
{
|
{
|
||||||
$this->getDbQueryResults($pagination);
|
$this->getDbQueryResults($pagination);
|
||||||
|
|
|
||||||
|
|
@ -159,7 +159,6 @@ class Column extends AbstractFillable
|
||||||
|
|
||||||
public function render($obj)
|
public function render($obj)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (property_exists($obj, ($this->aliasing = $this->alias))) {
|
if (property_exists($obj, ($this->aliasing = $this->alias))) {
|
||||||
$this->value = $obj->{$this->aliasing};
|
$this->value = $obj->{$this->aliasing};
|
||||||
$this->wrap($obj);
|
$this->wrap($obj);
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ use Illuminate\Pagination\Paginator;
|
||||||
|
|
||||||
class Pagination extends Paginator
|
class Pagination extends Paginator
|
||||||
{
|
{
|
||||||
const LIMIT = 20;
|
const LIMIT = 10;
|
||||||
const OFFSET = 0;
|
const OFFSET = 0;
|
||||||
const VIEW = '';
|
const VIEW = '';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -354,8 +354,7 @@ h2 {
|
||||||
.checkbox {
|
.checkbox {
|
||||||
position: relative;
|
position: relative;
|
||||||
display: block;
|
display: block;
|
||||||
vertical-align: middle;
|
// vertical-align: middle;
|
||||||
margin: 0px 5px 5px 0px;
|
|
||||||
|
|
||||||
input {
|
input {
|
||||||
left: 0;
|
left: 0;
|
||||||
|
|
|
||||||
|
|
@ -1,257 +1,106 @@
|
||||||
/* Data grid css starts here */
|
|
||||||
.grid-container {
|
.grid-container {
|
||||||
.filter-wrapper {
|
|
||||||
display: block;
|
display: block;
|
||||||
box-sizing: border-box;
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
.filter-row-one,
|
|
||||||
.filter-row-two {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.filter-row-one {
|
.filter-row-one {
|
||||||
height: 40px;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: space-between;
|
|
||||||
|
|
||||||
.search-filter {
|
|
||||||
.control {
|
|
||||||
font-family: "montserrat", sans-serif;
|
|
||||||
padding-left: 10px;
|
|
||||||
width: 380px;
|
|
||||||
height: 36px;
|
|
||||||
border: 2px solid $control-border-color;
|
|
||||||
border-radius: 3px;
|
|
||||||
border-right: 0px;
|
|
||||||
border-top-right-radius: 0px;
|
|
||||||
border-bottom-right-radius: 0px;
|
|
||||||
font-size: 14px;
|
|
||||||
}
|
|
||||||
.ic-wrapper {
|
|
||||||
display: block;
|
|
||||||
height: 36px;
|
|
||||||
width: 36px;
|
|
||||||
border: 2px solid $control-border-color;
|
|
||||||
border-left: none;
|
|
||||||
border-radius: 2px;
|
|
||||||
|
|
||||||
.search-icon {
|
|
||||||
margin-left: 4px;
|
|
||||||
margin-top: 4px;
|
|
||||||
height: 24px;
|
|
||||||
width: 24px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.dropdown-filters {
|
|
||||||
display: inline-flex;
|
|
||||||
|
|
||||||
.more-filters {
|
|
||||||
|
|
||||||
.dropdown-toggle {
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
font-family: "montserrat", sans-serif;
|
|
||||||
padding-left: 5px;
|
|
||||||
height: 36px;
|
|
||||||
width: 150px;
|
|
||||||
border: 2px solid $control-border-color;
|
|
||||||
border-radius: 2px;
|
|
||||||
background-color: $color-white;
|
|
||||||
color: $filter-toggle-color;
|
|
||||||
font-size: 14px;
|
|
||||||
|
|
||||||
.dropdown-header {
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
align-items: center;
|
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
.arrow-down-icon {
|
margin-bottom: 10px;
|
||||||
margin-right: 5px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.dropdown-list {
|
|
||||||
.dropdown-container {
|
|
||||||
ul {
|
|
||||||
li.filter-column-dropdown {
|
|
||||||
.filter-column-select {
|
|
||||||
width: 100%;
|
|
||||||
background: $color-white;
|
|
||||||
border: 2px solid $control-border-color;
|
|
||||||
border-radius: 3px;
|
|
||||||
height: 36px;
|
|
||||||
display: inline-block;
|
|
||||||
vertical-align: middle;
|
|
||||||
-webkit-transition: 0.2s
|
|
||||||
cubic-bezier(0.4, 0, 0.2, 1);
|
|
||||||
transition: 0.2s
|
|
||||||
cubic-bezier(0.4, 0, 0.2, 1);
|
|
||||||
padding: 0px 5px;
|
|
||||||
font-family: "montserrat", sans-serif;
|
|
||||||
margin-top: 10px;
|
|
||||||
margin-bottom: 5px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
li {
|
|
||||||
select {
|
|
||||||
background: $color-white;
|
|
||||||
border: 2px solid $control-border-color;
|
|
||||||
border-radius: 3px;
|
|
||||||
height: 36px;
|
|
||||||
width: 100%;
|
|
||||||
display: inline-block;
|
|
||||||
vertical-align: middle;
|
|
||||||
-webkit-transition: 0.2s
|
|
||||||
cubic-bezier(0.4, 0, 0.2, 1);
|
|
||||||
transition: 0.2s
|
|
||||||
cubic-bezier(0.4, 0, 0.2, 1);
|
|
||||||
padding: 0px 5px;
|
|
||||||
font-family: "montserrat", sans-serif;
|
|
||||||
margin-top: 10px;
|
|
||||||
margin-bottom: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
input {
|
|
||||||
background: #fff;
|
|
||||||
border: 2px solid #c7c7c7;
|
|
||||||
border-radius: 3px;
|
|
||||||
height: 36px;
|
|
||||||
width: 100%;
|
|
||||||
display: inline-block;
|
|
||||||
vertical-align: middle;
|
|
||||||
-webkit-transition: 0.2s
|
|
||||||
cubic-bezier(0.4, 0, 0.2, 1);
|
|
||||||
transition: 0.2s
|
|
||||||
cubic-bezier(0.4, 0, 0.2, 1);
|
|
||||||
padding: 0px 5px;
|
|
||||||
font-family: "montserrat", sans-serif;
|
|
||||||
margin-top: 10px;
|
|
||||||
margin-bottom: 5px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.filter-condition-dropdown-string {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
.filter-condition-dropdown-number {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
.filter-condition-dropdown-datetime {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
.filter-condition-dropdown-boolean {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.filter-response-string {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
.filter-response-boolean {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
.filter-response-datetime {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
.filter-response-number {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.filter-row-two {
|
.filter-row-two {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
width: 100%;
|
||||||
flex-wrap: wrap;
|
|
||||||
margin-top: 6px;
|
|
||||||
margin-bottom: 6px;
|
|
||||||
|
|
||||||
.filter-one {
|
|
||||||
margin-right: 10px;
|
|
||||||
|
|
||||||
.filter-name {
|
|
||||||
margin-right: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.filter-value {
|
|
||||||
display: inline-flex;
|
|
||||||
background: #e7e7e7;
|
|
||||||
padding-left: 5px;
|
|
||||||
color: $color-black-shade;
|
|
||||||
vertical-align: middle;
|
|
||||||
|
|
||||||
.f-value {
|
|
||||||
margin: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.cross-icon {
|
|
||||||
margin: 5px;
|
|
||||||
height: 18px !important;
|
|
||||||
width: 18px !important;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.table {
|
|
||||||
thead {
|
|
||||||
.mass-action-wrapper {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
margin-bottom: 10px;
|
||||||
.massaction-remove {
|
|
||||||
margin-top: 4px;
|
|
||||||
margin-right: 10px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.selected-items {
|
.search-filter {
|
||||||
margin-right: 15px;
|
display: flex;
|
||||||
}
|
flex-direction: row;
|
||||||
}
|
align-items: center;
|
||||||
tr {
|
justify-content: flex-start;
|
||||||
th.grid_head {
|
|
||||||
|
|
||||||
.sort-down-icon, .sort-up-icon {
|
.control {
|
||||||
|
background: #ffffff;
|
||||||
|
border: 2px solid $control-border-color;
|
||||||
|
border-right: none;
|
||||||
|
border-top-right-radius: 0px;
|
||||||
|
border-bottom-right-radius: 0px;
|
||||||
|
border-radius: 3px;
|
||||||
|
height: 36px;
|
||||||
|
width: 360px;
|
||||||
|
padding-left: 10px;
|
||||||
|
font-size: 15px;
|
||||||
|
color: #8E8E8E;
|
||||||
|
}
|
||||||
|
|
||||||
|
.contorl:focus {
|
||||||
|
border-color: $brand-color;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-wrapper {
|
||||||
|
border: 2px solid $control-border-color;
|
||||||
|
border-radius: 3px;
|
||||||
|
border-top-left-radius: 0px;
|
||||||
|
border-bottom-left-radius: 0px;
|
||||||
|
height: 36px;
|
||||||
|
width: 36px;
|
||||||
|
margin-left: -1px;
|
||||||
|
|
||||||
|
.search-icon {
|
||||||
|
margin-top: 3px;
|
||||||
|
margin-left: 3px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.dropdown-header {
|
||||||
|
display: inline-flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
height: 36px;
|
||||||
|
width: 202px;
|
||||||
|
border: 2px solid $control-border-color;
|
||||||
|
border-radius: 3px;
|
||||||
|
color: #8E8E8E;
|
||||||
|
padding: 0px 5px 0px 5px;
|
||||||
|
|
||||||
|
.arrow-icon-down {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-tag {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
font-size: 14px;
|
||||||
|
height: 28px;
|
||||||
|
border-radius: 2px;
|
||||||
|
|
||||||
|
.wrapper {
|
||||||
margin-left: 5px;
|
margin-left: 5px;
|
||||||
margin-top: -3px;
|
padding: 0px 5px 0px 5px;
|
||||||
vertical-align: middle;
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
background: #E7E7E7;
|
||||||
|
font-size: 14px;
|
||||||
|
height: 28px;
|
||||||
|
color: #000311;
|
||||||
|
letter-spacing: -0.22px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
th.grid_head.sortable {
|
.filter-tag:not(first-child) {
|
||||||
cursor: pointer;
|
margin-left: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
th {
|
|
||||||
text-transform: capitalize;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
tbody {
|
|
||||||
td.action {
|
|
||||||
a:first-child {
|
|
||||||
margin-right: 10px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.pagination {
|
|
||||||
margin-top:20px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* DataGrid css ends in here */
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
<div class="filter-row-one">
|
<div class="filter-row-one">
|
||||||
<div class="search-filter" style="display: inline-flex; align-items: center;">
|
<div class="search-filter" style="display: inline-flex; align-items: center;">
|
||||||
<input type="search" id="search-field" class="control" placeholder="Search Here..." value="" />
|
<input type="search" id="search-field" class="control" placeholder="Search Here..." value="" />
|
||||||
|
|
||||||
<div class="ic-wrapper">
|
<div class="ic-wrapper">
|
||||||
<span class="icon search-icon search-btn"></span>
|
<span class="icon search-icon search-btn"></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -160,6 +160,7 @@
|
||||||
//remove the filter and from clicking on cross icon on tag
|
//remove the filter and from clicking on cross icon on tag
|
||||||
$('.remove-filter').on('click', function() {
|
$('.remove-filter').on('click', function() {
|
||||||
var id = $(this).parents('.filter-one').attr('id');
|
var id = $(this).parents('.filter-one').attr('id');
|
||||||
|
|
||||||
if(allFilters.length == 1) {
|
if(allFilters.length == 1) {
|
||||||
allFilters.pop();
|
allFilters.pop();
|
||||||
var uri = window.location.href.toString();
|
var uri = window.location.href.toString();
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,41 @@
|
||||||
|
<tbody>
|
||||||
|
@foreach($records as $key => $record)
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<span class="checkbox">
|
||||||
|
<input type="checkbox" v-model="dataIds" @change="select" :value="{{ $record->{$index} }}">
|
||||||
|
|
||||||
|
<label class="checkbox-view" for="checkbox1"></label>
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
@foreach($columns as $column)
|
||||||
|
@php
|
||||||
|
$index = explode('.', $column['index']);
|
||||||
|
|
||||||
|
$index = end($index);
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
@if(isset($column['wrapper']))
|
||||||
|
@if(isset($column['closure']) && $column['closure'] == true)
|
||||||
|
<td>{!! $column['wrapper']($record->{$index}) !!}</td>
|
||||||
|
@else
|
||||||
|
<td>{{ $column['wrapper']($record->{$index}) }}</td>
|
||||||
|
@endif
|
||||||
|
@else
|
||||||
|
<td>{{ $record->{$index} }}</td>
|
||||||
|
@endif
|
||||||
|
@endforeach
|
||||||
|
|
||||||
|
<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>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
</tbody>
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
<div class="filter-wrapper">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class="grid_head" id="mastercheckbox" style="width: 50px;">
|
||||||
|
<span class="checkbox">
|
||||||
|
<input type="checkbox" id="mastercheckbox">
|
||||||
|
<label class="checkbox-view" for="checkbox"></label>
|
||||||
|
</span>
|
||||||
|
</th>
|
||||||
|
|
||||||
|
@foreach($columns as $key => $column)
|
||||||
|
<th class="grid_head" data-column-alias="{{ $column['alias'] }}" data-column-name="{{ $column['column'] }}" data-column-sortable="{{ $column['sortable'] }}" data-column-type="{{ $column['type'] }}" style="width: {{ $column['width'] }}" v-on:click="sortCollection({{ $column['alias'] }})">{{ $column['label'] }}</th>
|
||||||
|
@endforeach
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
<div class="pagination">
|
||||||
|
{{ $results->links() }}
|
||||||
|
</div>
|
||||||
|
|
@ -0,0 +1,639 @@
|
||||||
|
<div class="table">
|
||||||
|
<testgrid-filters></testgrid-filters>
|
||||||
|
|
||||||
|
@if(config('datagrid.pagination'))
|
||||||
|
@include('ui::testgrid.pagination', ['results' => $results['records']])
|
||||||
|
@endif
|
||||||
|
|
||||||
|
@push('scripts')
|
||||||
|
<script type="text/x-template" id="testgrid-filters">
|
||||||
|
{{-- start filter here --}}
|
||||||
|
<div class="grid-container">
|
||||||
|
<div class="filter-row-one" id="testgrid-filters">
|
||||||
|
<div class="search-filter">
|
||||||
|
<input type="search" id="search-field" class="control" placeholder="Search Here..." v-model="searchValue" />
|
||||||
|
<div class="icon-wrapper">
|
||||||
|
<span class="icon search-icon search-btn" v-on:click="searchCollection(searchValue)"></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="dropdown-filters">
|
||||||
|
<div class="more-filters">
|
||||||
|
<div class="dropdown-toggle">
|
||||||
|
<div class="dropdown-header">
|
||||||
|
<span class="name">Filter</span>
|
||||||
|
<i class="icon arrow-down-icon active"></i>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="dropdown-list bottom-right" style="display: none;">
|
||||||
|
<div class="dropdown-container">
|
||||||
|
<ul>
|
||||||
|
<li class="filter-column-dropdown">
|
||||||
|
<div class="control-group">
|
||||||
|
<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'] }}">
|
||||||
|
{{ $column['label'] }}
|
||||||
|
</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
{{-- suitable for string columns --}}
|
||||||
|
<li class="filter-condition-dropdown-string" v-if='stringConditionSelect'>
|
||||||
|
<div class="control-group">
|
||||||
|
<select class="control" v-model="stringCondition">
|
||||||
|
<option selected disabled>Select Condition</option>
|
||||||
|
<option value="like">Contains</option>
|
||||||
|
<option value="nlike">Does not contains</option>
|
||||||
|
<option value="eq">Is equal to</option>
|
||||||
|
<option value="neqs">Is not equal to</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
{{-- Response fields based on the type of columns to be filtered --}}
|
||||||
|
<li class="filter-condition-dropdown-string" v-if='stringCondition != null'>
|
||||||
|
<div class="control-group">
|
||||||
|
<input type="text" class="control response-string" placeholder="String Value here" v-model="stringValue" />
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
{{-- suitable for numeric columns --}}
|
||||||
|
<li class="filter-condition-dropdown-number" v-if='numberConditionSelect'>
|
||||||
|
<div class="control-group">
|
||||||
|
<select class="control" v-model="numberCondition">
|
||||||
|
<option selected disabled>Select Condition</option>
|
||||||
|
<option value="eq">Is equal to</option>
|
||||||
|
<option value="neqs">Is not equal to</option>
|
||||||
|
<option value="gt">Greater than</option>
|
||||||
|
<option value="lt">Less than</option>
|
||||||
|
<option value="gte">Greater than equals to</option>
|
||||||
|
<option value="lte">Less than equals to</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="filter-response-number" v-if='numberCondition != null'>
|
||||||
|
<div class="control-group">
|
||||||
|
<input type="number" class="control response-number" placeholder="Numeric Value here" v-model="numberValue"/>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
{{-- suitable for boolean columns --}}
|
||||||
|
<li class="filter-condition-dropdown-boolean" v-if='booleanConditionSelect'>
|
||||||
|
<div class="control-group">
|
||||||
|
<select class="control" v-model="booleanCondition">
|
||||||
|
<option selected disabled>Select Condition</option>
|
||||||
|
<option value="eq">Is equal to</option>
|
||||||
|
<option value="neqs">Is no equal to</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="filter-condition-dropdown-boolean" v-if='booleanCondition != null'>
|
||||||
|
<div class="control-group">
|
||||||
|
<select class="control" v-model="booleanValue">
|
||||||
|
<option selected disabled>Select Value</option>
|
||||||
|
<option value="1">True / Active</option>
|
||||||
|
<option value="0">False / Inactive</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
{{-- suitable for date/time columns --}}
|
||||||
|
<li class="filter-condition-dropdown-datetime" v-if='datetimeConditionSelect'>
|
||||||
|
<div class="control-group">
|
||||||
|
<select class="control" v-model="datetimeCondition">
|
||||||
|
<option selected disabled>Select Condition</option>
|
||||||
|
<option value="eq">Is equal to</option>
|
||||||
|
<option value="neqs">Is not equal to</option>
|
||||||
|
<option value="gt">Greater than</option>
|
||||||
|
<option value="lt">Less than</option>
|
||||||
|
<option value="gte">Greater than equals to</option>
|
||||||
|
<option value="lte">Less than equals to</option>
|
||||||
|
{{-- <option value="btw">Is Between</option> --}}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="filter-condition-dropdown-boolean" v-if='datetimeCondition != null'>
|
||||||
|
<div class="control-group">
|
||||||
|
<input class="control" v-model="datetimeValue" type="date">
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<button class="btn btn-sm btn-primary apply-filter" v-on:click="getResponse">Apply</button>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="filter-row-two">
|
||||||
|
<span class="filter-tag" v-if="filters.length > 0" v-for="filter in filters">
|
||||||
|
<span v-if="filter.column == 'sort'">@{{ filter.cond }}</span>
|
||||||
|
<span v-else-if="filter.column == 'search'">Search</span>
|
||||||
|
<span v-else>@{{ filter.column }}</span>
|
||||||
|
|
||||||
|
<span class="wrapper">
|
||||||
|
@{{ filter.val }}
|
||||||
|
<span class="icon cross-icon" v-on:click="removeFilter(filter)"></span>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<thead v-if="massActionsToggle">
|
||||||
|
@if(isset($results['massactions']))
|
||||||
|
<tr class="mass-action" style="height: 63px;" v-if="massActionsToggle">
|
||||||
|
<th colspan="100" 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;">
|
||||||
|
<span class="icon checkbox-dash-icon"></span>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<form method="POST" id="mass-action-form" style="display: inline-flex;" action="">
|
||||||
|
@csrf()
|
||||||
|
|
||||||
|
<input type="hidden" id="indexes" name="indexes" v-model="dataIds">
|
||||||
|
|
||||||
|
<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>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="control-group" style="margin-left: 10px;" v-if="massActionType == 'update'">
|
||||||
|
<select class="control" v-model="massActionUpdateValue" name="update-options">
|
||||||
|
<option v-for="(massActionValue, id) in massActionValues" :value="massActionValue">@{{ massActionValue }}</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<input type="submit" class="btn btn-sm btn-primary" style="margin-left: 10px;">
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
@endif
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<thead v-if="massActionsToggle == false">
|
||||||
|
<tr>
|
||||||
|
<th class="grid_head" id="mastercheckbox" style="width: 50px;">
|
||||||
|
<span class="checkbox">
|
||||||
|
<input type="checkbox" v-model="allSelected" v-on:change="selectAll">
|
||||||
|
|
||||||
|
<label class="checkbox-view" for="checkbox"></label>
|
||||||
|
</span>
|
||||||
|
</th>
|
||||||
|
|
||||||
|
@foreach($results['columns'] as $key => $column)
|
||||||
|
<th class="grid_head" style="width: {{ $column['width'] }}" v-on:click="sortCollection('{{ $column['alias'] }}')">
|
||||||
|
{{ $column['label'] }}
|
||||||
|
</th>
|
||||||
|
@endforeach
|
||||||
|
|
||||||
|
<th>
|
||||||
|
Actions
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
@include('ui::testgrid.body', ['records' => $results['records'], 'actions' => $results['actions'], 'index' => $results['index'], 'columns' => $results['columns']])
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
Vue.component('testgrid-filters', {
|
||||||
|
template: '#testgrid-filters',
|
||||||
|
|
||||||
|
data: () => ({
|
||||||
|
gridCurrentData: @json($results['records']),
|
||||||
|
massActions: @json($results['massactions']),
|
||||||
|
massActionsToggle: false,
|
||||||
|
massActionTarget: null,
|
||||||
|
massActionType: null,
|
||||||
|
massActionValues: [],
|
||||||
|
massActionTargets: [],
|
||||||
|
massActionUpdateValue: null,
|
||||||
|
url: new URL(window.location.href),
|
||||||
|
currentSort: null,
|
||||||
|
dataIds: [],
|
||||||
|
allSelected: false,
|
||||||
|
sortDesc: 'desc',
|
||||||
|
sortAsc: 'asc',
|
||||||
|
sortUpIcon: 'sort-up-icon',
|
||||||
|
sortDownIcon: 'sort-down-icon',
|
||||||
|
currentSortIcon: null,
|
||||||
|
isActive: false,
|
||||||
|
isHidden: true,
|
||||||
|
searchValue: '',
|
||||||
|
filterColumn: true,
|
||||||
|
filters: [],
|
||||||
|
columnOrAlias: '',
|
||||||
|
type: null,
|
||||||
|
columns : @json($results['columns']),
|
||||||
|
stringCondition: null,
|
||||||
|
booleanCondition: null,
|
||||||
|
numberCondition: null,
|
||||||
|
datetimeCondition: null,
|
||||||
|
stringValue: null,
|
||||||
|
booleanValue: null,
|
||||||
|
datetimeValue: '2000-01-01',
|
||||||
|
numberValue: 0,
|
||||||
|
stringConditionSelect: false,
|
||||||
|
booleanConditionSelect: false,
|
||||||
|
numberConditionSelect: false,
|
||||||
|
datetimeConditionSelect: false
|
||||||
|
}),
|
||||||
|
|
||||||
|
mounted: function() {
|
||||||
|
this.setParamsAndUrl();
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
getColumnOrAlias(columnOrAlias) {
|
||||||
|
this.columnOrAlias = columnOrAlias;
|
||||||
|
|
||||||
|
for(column in this.columns) {
|
||||||
|
if (this.columns[column].alias == this.columnOrAlias) {
|
||||||
|
this.type = this.columns[column].type;
|
||||||
|
|
||||||
|
if(this.type == 'string') {
|
||||||
|
this.stringConditionSelect = true;
|
||||||
|
this.datetimeConditionSelect = false;
|
||||||
|
this.booleanConditionSelect = false;
|
||||||
|
this.numberConditionSelect = false;
|
||||||
|
|
||||||
|
this.nullify();
|
||||||
|
} else if(this.type == 'datetime') {
|
||||||
|
this.datetimeConditionSelect = true;
|
||||||
|
this.stringConditionSelect = false;
|
||||||
|
this.booleanConditionSelect = false;
|
||||||
|
this.numberConditionSelect = false;
|
||||||
|
|
||||||
|
this.nullify();
|
||||||
|
} else if(this.type == 'boolean') {
|
||||||
|
this.booleanConditionSelect = true;
|
||||||
|
this.datetimeConditionSelect = false;
|
||||||
|
this.stringConditionSelect = false;
|
||||||
|
this.numberConditionSelect = false;
|
||||||
|
|
||||||
|
this.nullify();
|
||||||
|
} else if(this.type == 'number') {
|
||||||
|
this.numberConditionSelect = true;
|
||||||
|
this.booleanConditionSelect = false;
|
||||||
|
this.datetimeConditionSelect = false;
|
||||||
|
this.stringConditionSelect = false;
|
||||||
|
|
||||||
|
this.nullify();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
nullify() {
|
||||||
|
this.stringCondition = null;
|
||||||
|
this.datetimeCondition = null;
|
||||||
|
this.booleanCondition = null;
|
||||||
|
this.numberCondition = null;
|
||||||
|
},
|
||||||
|
|
||||||
|
getResponse() {
|
||||||
|
if(this.type == 'string') {
|
||||||
|
this.formURL(this.columnOrAlias, this.stringCondition, this.stringValue)
|
||||||
|
} else if(this.type == 'number') {
|
||||||
|
this.formURL(this.columnOrAlias, this.numberCondition, this.numberValue);
|
||||||
|
} else if(this.type == 'boolean') {
|
||||||
|
this.formURL(this.columnOrAlias, this.booleanCondition, this.booleanValue);
|
||||||
|
} else if(this.type == 'datetime') {
|
||||||
|
this.formURL(this.columnOrAlias, this.datetimeCondition, this.datetimeValue);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
sortCollection(alias) {
|
||||||
|
this.formURL("sort", alias, this.sortAsc);
|
||||||
|
},
|
||||||
|
|
||||||
|
searchCollection(searchValue) {
|
||||||
|
this.formURL("search", 'all', searchValue);
|
||||||
|
},
|
||||||
|
|
||||||
|
// function triggered to check whether the query exists or not and then call the make filters from the url
|
||||||
|
setParamsAndUrl() {
|
||||||
|
params = (new URL(window.location.href)).search;
|
||||||
|
|
||||||
|
if(params.slice(1, params.length).length > 0) {
|
||||||
|
this.arrayFromUrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
for(id in this.massActions) {
|
||||||
|
targetObj = {
|
||||||
|
'type': this.massActions[id].type,
|
||||||
|
'action': this.massActions[id].action
|
||||||
|
};
|
||||||
|
|
||||||
|
this.massActionTargets.push(targetObj);
|
||||||
|
|
||||||
|
targetObj = {};
|
||||||
|
|
||||||
|
if(this.massActions[id].type == 'update') {
|
||||||
|
this.massActionValues = this.massActions[id].options;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
findCurrentSort() {
|
||||||
|
for(i in this.filters) {
|
||||||
|
if(this.filters[i].column == 'sort') {
|
||||||
|
this.currentSort = this.filters[i].val;
|
||||||
|
|
||||||
|
// if(this.currentSort = 'asc') {
|
||||||
|
// this.currentSortIcon = this.sortUpIcon;
|
||||||
|
// } else {
|
||||||
|
// this.currentSortIcon = this.sortDownIcon;
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
changeMassActionTarget() {
|
||||||
|
if(this.massActionType == 'delete') {
|
||||||
|
for(i in this.massActionTargets) {
|
||||||
|
if(this.massActionTargets[i].type == 'delete') {
|
||||||
|
this.massActionTarget = this.massActionTargets[i].action;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(this.massActionType == 'update') {
|
||||||
|
for(i in this.massActionTargets) {
|
||||||
|
if(this.massActionTargets[i].type == 'update') {
|
||||||
|
this.massActionTarget = this.massActionTargets[i].action;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
document.getElementById('mass-action-form').action = this.massActionTarget;
|
||||||
|
},
|
||||||
|
|
||||||
|
//make array of filters, sort and search
|
||||||
|
formURL(column, condition, response) {
|
||||||
|
var obj = {};
|
||||||
|
|
||||||
|
if(column == "" || condition == "" || response == "" || column == null || condition == null || response == null) {
|
||||||
|
alert('{{ __('ui::app.datagrid.filter-fields-missing') }}');
|
||||||
|
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
if(this.filters.length > 0) {
|
||||||
|
if(column != "sort" && column != "search") {
|
||||||
|
filterRepeated = 0;
|
||||||
|
|
||||||
|
for(j = 0; j < this.filters.length; j++) {
|
||||||
|
if(this.filters[j].column == column) {
|
||||||
|
if(this.filters[j].cond == condition && this.filters[j].val == response) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
filterRepeated = 1;
|
||||||
|
|
||||||
|
this.filters[j].cond = condition;
|
||||||
|
this.filters[j].val = response;
|
||||||
|
|
||||||
|
this.makeURL();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(filterRepeated == 0) {
|
||||||
|
obj.column = column;
|
||||||
|
obj.cond = condition;
|
||||||
|
obj.val = response;
|
||||||
|
|
||||||
|
|
||||||
|
this.filters.push(obj);
|
||||||
|
obj = {};
|
||||||
|
|
||||||
|
this.makeURL();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(column == "sort") {
|
||||||
|
sort_exists = 0;
|
||||||
|
|
||||||
|
for(j = 0; j < this.filters.length; j++) {
|
||||||
|
if(this.filters[j].column == "sort") {
|
||||||
|
if(this.filters[j].column == column && this.filters[j].cond == condition) {
|
||||||
|
this.findCurrentSort();
|
||||||
|
|
||||||
|
if(this.currentSort == "asc") {
|
||||||
|
this.filters[j].column = column;
|
||||||
|
this.filters[j].cond = condition;
|
||||||
|
this.filters[j].val = this.sortDesc;
|
||||||
|
|
||||||
|
this.makeURL();
|
||||||
|
} else {
|
||||||
|
this.filters[j].column = column;
|
||||||
|
this.filters[j].cond = condition;
|
||||||
|
this.filters[j].val = this.sortAsc;
|
||||||
|
|
||||||
|
this.makeURL();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.filters[j].column = column;
|
||||||
|
this.filters[j].cond = condition;
|
||||||
|
this.filters[j].val = response;
|
||||||
|
|
||||||
|
this.makeURL();
|
||||||
|
}
|
||||||
|
|
||||||
|
sort_exists = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(sort_exists == 0) {
|
||||||
|
if(this.currentSort == null)
|
||||||
|
this.currentSort = this.sortAsc;
|
||||||
|
|
||||||
|
obj.column = column;
|
||||||
|
obj.cond = condition;
|
||||||
|
obj.val = this.currentSort;
|
||||||
|
|
||||||
|
this.filters.push(obj);
|
||||||
|
|
||||||
|
obj = {};
|
||||||
|
|
||||||
|
this.makeURL();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(column == "search") {
|
||||||
|
search_found = 0;
|
||||||
|
|
||||||
|
for(j = 0;j < this.filters.length;j++) {
|
||||||
|
if(this.filters[j].column == "search") {
|
||||||
|
this.filters[j].column = column;
|
||||||
|
this.filters[j].cond = condition;
|
||||||
|
this.filters[j].val = response;
|
||||||
|
|
||||||
|
this.makeURL();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(j = 0;j < this.filters.length;j++) {
|
||||||
|
if(this.filters[j].column == "search") {
|
||||||
|
search_found = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(search_found == 0) {
|
||||||
|
obj.column = column;
|
||||||
|
obj.cond = condition;
|
||||||
|
obj.val = response;
|
||||||
|
|
||||||
|
this.filters.push(obj);
|
||||||
|
|
||||||
|
obj = {};
|
||||||
|
|
||||||
|
this.makeURL();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
obj.column = column;
|
||||||
|
obj.cond = condition;
|
||||||
|
obj.val = response;
|
||||||
|
|
||||||
|
this.filters.push(obj);
|
||||||
|
|
||||||
|
obj = {};
|
||||||
|
|
||||||
|
this.makeURL();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// make the url from the array and redirect
|
||||||
|
makeURL() {
|
||||||
|
newParams = '';
|
||||||
|
|
||||||
|
for(i = 0; i < this.filters.length; i++) {
|
||||||
|
if(i == 0) {
|
||||||
|
newParams = '?' + this.filters[i].column + '[' + this.filters[i].cond + ']' + '=' + this.filters[i].val;
|
||||||
|
} else {
|
||||||
|
newParams = newParams + '&' + this.filters[i].column + '[' + this.filters[i].cond + ']' + '=' + this.filters[i].val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var uri = window.location.href.toString();
|
||||||
|
|
||||||
|
var clean_uri = uri.substring(0, uri.indexOf("?")).trim();
|
||||||
|
|
||||||
|
window.location.href = clean_uri + newParams;
|
||||||
|
},
|
||||||
|
|
||||||
|
//make the filter array from url after being redirected
|
||||||
|
arrayFromUrl() {
|
||||||
|
var obj = {};
|
||||||
|
processedUrl = this.url.search.slice(1, this.url.length);
|
||||||
|
splitted = [];
|
||||||
|
moreSplitted = [];
|
||||||
|
|
||||||
|
splitted = processedUrl.split('&');
|
||||||
|
|
||||||
|
for(i = 0; i < splitted.length; i++) {
|
||||||
|
moreSplitted.push(splitted[i].split('='));
|
||||||
|
}
|
||||||
|
|
||||||
|
for(i = 0; i < moreSplitted.length; i++) {
|
||||||
|
col = moreSplitted[i][0].replace(']','').split('[')[0];
|
||||||
|
cond = moreSplitted[i][0].replace(']','').split('[')[1]
|
||||||
|
val = moreSplitted[i][1];
|
||||||
|
|
||||||
|
obj.column = col;
|
||||||
|
obj.cond = cond;
|
||||||
|
obj.val = val;
|
||||||
|
|
||||||
|
if(col != undefined && cond != undefined && val != undefined)
|
||||||
|
this.filters.push(obj);
|
||||||
|
|
||||||
|
obj = {};
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
removeFilter(filter) {
|
||||||
|
for(i in this.filters) {
|
||||||
|
if(this.filters[i].col == filter.col && this.filters[i].cond == filter.cond && this.filters[i].val == filter.val) {
|
||||||
|
this.filters.splice(i, 1);
|
||||||
|
|
||||||
|
this.makeURL();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
//triggered when any select box is clicked in the datagrid
|
||||||
|
select() {
|
||||||
|
console.log(this.dataIds);
|
||||||
|
|
||||||
|
this.allSelected = false;
|
||||||
|
|
||||||
|
this.massActionsToggle = true;
|
||||||
|
},
|
||||||
|
|
||||||
|
//triggered when master checkbox is clicked
|
||||||
|
selectAll() {
|
||||||
|
this.dataIds = [];
|
||||||
|
|
||||||
|
this.massActionsToggle = true;
|
||||||
|
|
||||||
|
if (this.allSelected) {
|
||||||
|
if(this.gridCurrentData.hasOwnProperty("data")) {
|
||||||
|
for (currentData in this.gridCurrentData.data) {
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
for(currentId in this.gridCurrentData.data[currentData]) {
|
||||||
|
if(i==0)
|
||||||
|
this.dataIds.push(this.gridCurrentData.data[currentData][currentId]);
|
||||||
|
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (currentData in this.gridCurrentData) {
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
for(currentId in this.gridCurrentData[currentData]) {
|
||||||
|
if(i==0)
|
||||||
|
this.dataIds.push(this.gridCurrentData[currentData][currentId]);
|
||||||
|
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(this.dataIds);
|
||||||
|
},
|
||||||
|
|
||||||
|
removeMassActions() {
|
||||||
|
this.dataIds = [];
|
||||||
|
|
||||||
|
this.massActionsToggle = false;
|
||||||
|
|
||||||
|
this.allSelected = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
@endpush
|
||||||
|
</div>
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
*
|
|
||||||
!.gitignore
|
|
||||||
Loading…
Reference in New Issue