Merge pull request #442 from prashant-webkul/development
Datagrid refactoring
This commit is contained in:
commit
1f6a59cf69
|
|
@ -146,6 +146,24 @@ return [
|
|||
*/
|
||||
'editor' =>'vscode',
|
||||
|
||||
/**
|
||||
* Debug blacklisting
|
||||
*/
|
||||
'debug_blacklist' => [
|
||||
'_ENV' => [
|
||||
'APP_KEY',
|
||||
'DB_PASSWORD'
|
||||
],
|
||||
|
||||
'_SERVER' => [
|
||||
'APP_KEY',
|
||||
'DB_PASSWORD'
|
||||
],
|
||||
|
||||
'_POST' => [
|
||||
'password'
|
||||
],
|
||||
],
|
||||
|
||||
'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",
|
||||
]
|
||||
];
|
||||
|
|
@ -2,213 +2,156 @@
|
|||
|
||||
namespace Webkul\Admin\DataGrids;
|
||||
|
||||
use Illuminate\View\View;
|
||||
use Webkul\Ui\DataGrid\Facades\DataGrid;
|
||||
use Webkul\Ui\DataGrid\AbsGrid;
|
||||
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)
|
||||
*/
|
||||
class AttributeDataGrid
|
||||
class AttributeDataGrid extends AbsGrid
|
||||
{
|
||||
public $allColumns = [];
|
||||
|
||||
/**
|
||||
* The Data Grid implementation for Attributes
|
||||
*/
|
||||
public function createAttributeDataGrid()
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = DB::table('attributes')->select('id')->addSelect('id', 'code', 'admin_name', 'type', 'is_required', 'is_unique', 'value_per_locale', 'value_per_channel');
|
||||
|
||||
return DataGrid::make([
|
||||
'name' => 'Attributes',
|
||||
'table' => 'attributes',
|
||||
'select' => 'id',
|
||||
'perpage' => 10,
|
||||
'aliased' => true,
|
||||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
||||
'massoperations' => [
|
||||
0 => [
|
||||
'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'
|
||||
]
|
||||
],
|
||||
public function setIndex() {
|
||||
$this->index = 'id'; //the column that needs to be treated as index column
|
||||
}
|
||||
|
||||
'actions' => [
|
||||
[
|
||||
'type' => 'Edit',
|
||||
'route' => 'admin.catalog.attributes.edit',
|
||||
'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',
|
||||
'type' => 'number',
|
||||
'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',
|
||||
'label' => 'ID',
|
||||
], [
|
||||
'column' => 'code',
|
||||
'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' => []
|
||||
public function addColumns()
|
||||
{
|
||||
$this->addColumn([
|
||||
'index' => 'id',
|
||||
'alias' => 'attributeId',
|
||||
'label' => 'ID',
|
||||
'type' => 'number',
|
||||
'searchable' => false,
|
||||
'sortable' => true,
|
||||
'width' => '40px'
|
||||
]);
|
||||
|
||||
$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()
|
||||
{
|
||||
return $this->createAttributeDataGrid()->render();
|
||||
public function prepareActions() {
|
||||
$this->addAction([
|
||||
'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;
|
||||
|
||||
use Illuminate\View\View;
|
||||
use Webkul\Ui\DataGrid\Facades\DataGrid;
|
||||
use Webkul\Ui\DataGrid\AbsGrid;
|
||||
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)
|
||||
*/
|
||||
class AttributeFamilyDataGrid
|
||||
class AttributeFamilyDataGrid extends AbsGrid
|
||||
{
|
||||
public $allColumns = [];
|
||||
|
||||
/**
|
||||
* The Data Grid implementation for Attribute Families
|
||||
*/
|
||||
public function createAttributeFamilyDataGrid()
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = DB::table('attribute_families')->select('id')->addSelect('id', 'code', 'name');
|
||||
|
||||
return DataGrid::make([
|
||||
'name' => 'Attribute Family',
|
||||
'table' => 'attribute_families',
|
||||
'select' => 'id',
|
||||
'perpage' => 10,
|
||||
'aliased' => false, //use this with false as default and true in case of joins
|
||||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
||||
'massoperations' =>[
|
||||
// [
|
||||
// 'route' => route('admin.datagrid.delete'),
|
||||
// 'method' => 'DELETE',
|
||||
// 'label' => 'Delete',
|
||||
// 'type' => 'button',
|
||||
// ],
|
||||
],
|
||||
|
||||
'actions' => [
|
||||
[
|
||||
'type' => 'Edit',
|
||||
'route' => 'admin.catalog.families.edit',
|
||||
'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',
|
||||
'type' => 'number',
|
||||
'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',
|
||||
'label' => 'ID',
|
||||
], [
|
||||
'column' => 'code',
|
||||
'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' => []
|
||||
public function setIndex() {
|
||||
$this->index = 'id'; //the column that needs to be treated as index column
|
||||
}
|
||||
|
||||
public function addColumns()
|
||||
{
|
||||
$this->addColumn([
|
||||
'index' => 'id',
|
||||
'alias' => 'attributeFamilyId',
|
||||
'label' => 'ID',
|
||||
'type' => 'number',
|
||||
'searchable' => false,
|
||||
'sortable' => true,
|
||||
'width' => '40px'
|
||||
]);
|
||||
|
||||
$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;
|
||||
|
||||
use Illuminate\View\View;
|
||||
use Webkul\Ui\DataGrid\Facades\DataGrid;
|
||||
|
||||
use Webkul\Ui\DataGrid\AbsGrid;
|
||||
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)
|
||||
*/
|
||||
class CategoryDataGrid
|
||||
class CategoryDataGrid extends AbsGrid
|
||||
{
|
||||
public $allColumns = [];
|
||||
|
||||
/**
|
||||
* The Data Grid implementation for category
|
||||
*/
|
||||
public function createCategoryDataGrid()
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = DB::table('categories as cat')->select('cat.id', 'ct.name', 'cat.position', 'cat.status', 'ct.locale')->leftJoin('category_translations as ct', 'cat.id', '=', 'ct.category_id');
|
||||
|
||||
return DataGrid::make([
|
||||
'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
|
||||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
||||
'massoperations' =>[
|
||||
// [
|
||||
// 'route' => route('admin.datagrid.delete'),
|
||||
// 'method' => 'DELETE',
|
||||
// 'label' => 'Delete',
|
||||
// 'type' => 'button',
|
||||
// ],
|
||||
],
|
||||
public function setIndex() {
|
||||
$this->index = 'id'; //the column that needs to be treated as index column
|
||||
}
|
||||
|
||||
'actions' => [
|
||||
[
|
||||
'type' => 'Edit',
|
||||
'route' => 'admin.catalog.categories.edit',
|
||||
'confirm_text' => 'Do you really want to edit this record?',
|
||||
'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',
|
||||
],
|
||||
],
|
||||
public function addColumns()
|
||||
{
|
||||
$this->addColumn([
|
||||
'index' => 'cat.id',
|
||||
'alias' => 'catId',
|
||||
'label' => 'ID',
|
||||
'type' => 'number',
|
||||
'searchable' => false,
|
||||
'sortable' => true,
|
||||
'width' => '40px'
|
||||
]);
|
||||
|
||||
'join' => [
|
||||
[
|
||||
'join' => 'leftjoin',
|
||||
'table' => 'category_translations as ct',
|
||||
'primaryKey' => 'cat.id',
|
||||
'condition' => '=',
|
||||
'secondaryKey' => 'ct.category_id',
|
||||
],
|
||||
],
|
||||
$this->addColumn([
|
||||
'index' => 'ct.name',
|
||||
'alias' => 'catName',
|
||||
'label' => 'Name',
|
||||
'type' => 'string',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'width' => '100px'
|
||||
]);
|
||||
|
||||
//use aliasing on secodary columns if join is performed
|
||||
$this->addColumn([
|
||||
'index' => 'cat.position',
|
||||
'alias' => 'catPosition',
|
||||
'label' => 'Position',
|
||||
'type' => 'string',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'width' => '100px'
|
||||
]);
|
||||
|
||||
'columns' => [
|
||||
[
|
||||
'name' => 'cat.id',
|
||||
'alias' => 'catid',
|
||||
'type' => 'number',
|
||||
'label' => 'ID',
|
||||
'sortable' => true,
|
||||
], [
|
||||
'name' => 'ct.name',
|
||||
'alias' => 'catname',
|
||||
'type' => 'string',
|
||||
'label' => 'Name',
|
||||
'sortable' => true,
|
||||
], [
|
||||
'name' => 'cat.position',
|
||||
'alias' => 'catposition',
|
||||
'type' => 'string',
|
||||
'label' => 'Position',
|
||||
'sortable' => true,
|
||||
], [
|
||||
'name' => 'cat.status',
|
||||
'alias' => 'catstatus',
|
||||
'type' => 'boolean',
|
||||
'label' => 'Visible in Menu',
|
||||
'sortable' => true,
|
||||
'wrapper' => function ($value) {
|
||||
if($value == 0)
|
||||
return "False";
|
||||
else
|
||||
return "True";
|
||||
},
|
||||
], [
|
||||
'name' => 'ct.locale',
|
||||
'alias' => 'catlocale',
|
||||
'type' => 'string',
|
||||
'label' => 'Locale',
|
||||
'sortable' => true,
|
||||
'filter' => [
|
||||
'function' => 'orWhere',
|
||||
'condition' => ['ct.locale', app()->getLocale()]
|
||||
],
|
||||
]
|
||||
],
|
||||
$this->addColumn([
|
||||
'index' => 'cat.status',
|
||||
'alias' => 'catStatus',
|
||||
'label' => 'Status',
|
||||
'type' => 'boolean',
|
||||
'sortable' => true,
|
||||
'searchable' => true,
|
||||
'width' => '100px',
|
||||
'wrapper' => function($value){
|
||||
if($value == 1)
|
||||
return 'Active';
|
||||
else
|
||||
return 'Inactive';
|
||||
}
|
||||
]);
|
||||
|
||||
'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',
|
||||
'label' => 'Visible in Menu',
|
||||
],
|
||||
],
|
||||
|
||||
//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' => []
|
||||
$this->addColumn([
|
||||
'index' => 'ct.locale',
|
||||
'alias' => 'catLocale',
|
||||
'label' => 'Locale',
|
||||
'type' => 'boolean',
|
||||
'sortable' => true,
|
||||
'searchable' => false,
|
||||
'width' => '100px'
|
||||
]);
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return $this->createCategoryDataGrid()->render();
|
||||
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->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;
|
||||
|
||||
use Illuminate\View\View;
|
||||
use Webkul\Ui\DataGrid\Facades\DataGrid;
|
||||
|
||||
use Webkul\Ui\DataGrid\AbsGrid;
|
||||
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)
|
||||
*/
|
||||
class ChannelDataGrid
|
||||
class ChannelDataGrid extends AbsGrid
|
||||
{
|
||||
public $allColumns = [];
|
||||
|
||||
/**
|
||||
* The Data Grid implementation for channel
|
||||
*/
|
||||
public function createChannelsDataGrid()
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = DB::table('channels')->addSelect('id', 'code', 'name', 'hostname');
|
||||
|
||||
return DataGrid::make([
|
||||
'name' => 'Channels',
|
||||
'table' => 'channels',
|
||||
'select' => 'id',
|
||||
'perpage' => 10,
|
||||
'aliased' => false, //use this with false as default and true in case of joins
|
||||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
||||
'massoperations' =>[
|
||||
// [
|
||||
// 'route' => route('admin.datagrid.delete'),
|
||||
// 'method' => 'DELETE',
|
||||
// 'label' => 'Delete',
|
||||
// 'type' => 'button',
|
||||
// ],
|
||||
],
|
||||
|
||||
'actions' => [
|
||||
[
|
||||
'type' => 'Edit',
|
||||
'route' => 'admin.channels.edit',
|
||||
'confirm_text' => 'Do you really want to edit this record?',
|
||||
'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',
|
||||
'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',
|
||||
'label' => 'ID',
|
||||
], [
|
||||
'column' => 'code',
|
||||
'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' => []
|
||||
public function setIndex() {
|
||||
$this->index = 'id'; //the column that needs to be treated as index column
|
||||
}
|
||||
|
||||
public function addColumns()
|
||||
{
|
||||
$this->addColumn([
|
||||
'index' => 'id',
|
||||
'alias' => 'channelId',
|
||||
'label' => 'ID',
|
||||
'type' => 'number',
|
||||
'searchable' => false,
|
||||
'sortable' => true,
|
||||
'width' => '40px'
|
||||
]);
|
||||
|
||||
$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()
|
||||
{
|
||||
return $this->createChannelsDataGrid()->render();
|
||||
public function prepareActions() {
|
||||
$this->addAction([
|
||||
'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;
|
||||
|
||||
use Illuminate\View\View;
|
||||
use Webkul\Ui\DataGrid\Facades\DataGrid;
|
||||
|
||||
use Webkul\Ui\DataGrid\AbsGrid;
|
||||
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)
|
||||
*/
|
||||
class CountryDataGrid
|
||||
class CountryDataGrid extends AbsGrid
|
||||
{
|
||||
public $allColumns = [];
|
||||
|
||||
/**
|
||||
* The Data Grid implementation for countries
|
||||
*/
|
||||
public function createCountryDataGrid()
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = DB::table('countries')->select('id')->addSelect($this->columns);
|
||||
|
||||
return DataGrid::make([
|
||||
'name' => 'Countries',
|
||||
'table' => 'countries',
|
||||
'select' => 'id',
|
||||
'perpage' => 10,
|
||||
'aliased' => false, //use this with false as default and true in case of joins
|
||||
|
||||
'massoperations' =>[
|
||||
// [
|
||||
// 'route' => route('admin.datagrid.delete'),
|
||||
// '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',
|
||||
'alias' => 'countryId',
|
||||
'type' => 'number',
|
||||
'label' => 'ID',
|
||||
], [
|
||||
'column' => 'code',
|
||||
'alias' => 'countryCode',
|
||||
'type' => 'string',
|
||||
'label' => 'Code',
|
||||
], [
|
||||
'column' => 'name',
|
||||
'alias' => 'countryName',
|
||||
'type' => 'string',
|
||||
'label' => 'Name',
|
||||
], [
|
||||
'column' => 'status',
|
||||
'alias' => 'countryStatus',
|
||||
'type' => 'number',
|
||||
'label' => 'Code',
|
||||
],
|
||||
],
|
||||
|
||||
//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->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
||||
public function addColumns()
|
||||
{
|
||||
$this->addColumn([
|
||||
'column' => 'id',
|
||||
'alias' => 'countryId',
|
||||
'label' => 'ID',
|
||||
'type' => 'number',
|
||||
'searchable' => false,
|
||||
'sortable' => true,
|
||||
'width' => '40px'
|
||||
]);
|
||||
|
||||
$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()
|
||||
{
|
||||
$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;
|
||||
|
||||
use Illuminate\View\View;
|
||||
use Webkul\Ui\DataGrid\Facades\DataGrid;
|
||||
use Webkul\Ui\DataGrid\AbsGrid;
|
||||
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)
|
||||
*/
|
||||
class CurrencyDataGrid
|
||||
class CurrencyDataGrid extends AbsGrid
|
||||
{
|
||||
public $allColumns = [];
|
||||
|
||||
/**
|
||||
* The Data Grid implementation for currencies
|
||||
*/
|
||||
public function createCurrencyDataGrid()
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = DB::table('currencies')->addSelect('id', 'name', 'code');
|
||||
|
||||
return DataGrid::make([
|
||||
'name' => 'Currencies',
|
||||
'table' => 'currencies',
|
||||
'select' => 'id',
|
||||
'perpage' => 10,
|
||||
'aliased' => false, //use this with false as default and true in case of joins
|
||||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
||||
'massoperations' =>[
|
||||
0 => [
|
||||
'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' => [
|
||||
[
|
||||
'type' => 'Edit',
|
||||
'route' => 'admin.currencies.edit',
|
||||
// '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',
|
||||
'type' => 'number',
|
||||
'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',
|
||||
'label' => 'ID',
|
||||
], [
|
||||
'column' => 'code',
|
||||
'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' => []
|
||||
public function setIndex() {
|
||||
$this->index = 'id'; //the column that needs to be treated as index column
|
||||
}
|
||||
|
||||
public function addColumns()
|
||||
{
|
||||
$this->addColumn([
|
||||
'index' => 'id',
|
||||
'alias' => 'currencyId',
|
||||
'label' => 'ID',
|
||||
'type' => 'number',
|
||||
'searchable' => false,
|
||||
'sortable' => true,
|
||||
'width' => '40px'
|
||||
]);
|
||||
|
||||
$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()
|
||||
{
|
||||
return $this->createCurrencyDataGrid()->render();
|
||||
public function prepareActions() {
|
||||
$this->addAction([
|
||||
'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;
|
||||
|
||||
use Illuminate\View\View;
|
||||
use Webkul\Ui\DataGrid\Facades\DataGrid;
|
||||
use Webkul\Ui\DataGrid\AbsGrid;
|
||||
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)
|
||||
*/
|
||||
class CustomerDataGrid
|
||||
class CustomerDataGrid extends AbsGrid
|
||||
{
|
||||
public $allColumns = [];
|
||||
|
||||
/**
|
||||
* The CustomerDataGrid implementation.
|
||||
*/
|
||||
public function createCustomerDataGrid()
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = DB::table('customers as cus')->addSelect('cus.id', 'cus.first_name', 'cus.email', 'cg.name')->leftJoin('customer_groups as cg', 'cus.customer_group_id', '=', 'cg.id');
|
||||
|
||||
return DataGrid::make([
|
||||
'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
|
||||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
||||
'massoperations' =>[
|
||||
// [
|
||||
// 'route' => route('admin.datagrid.delete'),
|
||||
// 'method' => 'DELETE',
|
||||
// 'label' => 'Delete',
|
||||
// 'type' => 'button', //select || button only
|
||||
// ],
|
||||
],
|
||||
|
||||
'actions' => [
|
||||
[
|
||||
'type' => 'Edit',
|
||||
'route' => 'admin.customer.edit',
|
||||
'confirm_text' => 'Do you really want to edit this record?',
|
||||
'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',
|
||||
'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',
|
||||
'label' => 'ID',
|
||||
], [
|
||||
'column' => 'email',
|
||||
'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' => []
|
||||
public function setIndex() {
|
||||
$this->index = 'id'; //the column that needs to be treated as index column
|
||||
}
|
||||
|
||||
public function addColumns()
|
||||
{
|
||||
$this->addColumn([
|
||||
'index' => 'cus.id',
|
||||
'alias' => 'customerId',
|
||||
'label' => 'ID',
|
||||
'type' => 'number',
|
||||
'searchable' => false,
|
||||
'sortable' => true,
|
||||
'width' => '40px'
|
||||
]);
|
||||
|
||||
$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;
|
||||
|
||||
use Illuminate\View\View;
|
||||
use Webkul\Ui\DataGrid\Facades\DataGrid;
|
||||
use Webkul\Ui\DataGrid\AbsGrid;
|
||||
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)
|
||||
*/
|
||||
class CustomerGroupDataGrid
|
||||
class CustomerGroupDataGrid extends AbsGrid
|
||||
{
|
||||
public $allColumns = [];
|
||||
|
||||
/**
|
||||
* The Customer Group Data Grid implementation.
|
||||
*/
|
||||
public function createCustomerGroupDataGrid()
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = DB::table('customer_groups')->addSelect('id', 'name');
|
||||
|
||||
return DataGrid::make([
|
||||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
||||
'name' => 'Customer Group',
|
||||
'table' => 'customer_groups as cg',
|
||||
'select' => 'cg.id',
|
||||
'perpage' => 10,
|
||||
'aliased' => true, //use this with false as default and true in case of joins
|
||||
|
||||
'massoperations' =>[
|
||||
// [
|
||||
// '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.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',
|
||||
'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',
|
||||
'label' => 'ID'
|
||||
],
|
||||
],
|
||||
//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' => []
|
||||
public function setIndex() {
|
||||
$this->index = 'id';
|
||||
}
|
||||
|
||||
public function addColumns()
|
||||
{
|
||||
$this->addColumn([
|
||||
'index' => 'id',
|
||||
'alias' => 'groupId',
|
||||
'label' => 'ID',
|
||||
'type' => 'number',
|
||||
'searchable' => false,
|
||||
'sortable' => true,
|
||||
'width' => '40px'
|
||||
]);
|
||||
|
||||
$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() {
|
||||
return $this->createCustomerGroupDataGrid()->render();
|
||||
public function prepareActions() {
|
||||
$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,182 +2,119 @@
|
|||
|
||||
namespace Webkul\Admin\DataGrids;
|
||||
|
||||
use Illuminate\View\View;
|
||||
use Webkul\Ui\DataGrid\Facades\DataGrid;
|
||||
|
||||
use Webkul\Ui\DataGrid\AbsGrid;
|
||||
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)
|
||||
*/
|
||||
class CustomerReviewDataGrid
|
||||
class CustomerReviewDataGrid extends AbsGrid
|
||||
{
|
||||
public $allColumns = [];
|
||||
|
||||
/**
|
||||
* The ProductReviewDataGrid implementation for Product Reviews
|
||||
*/
|
||||
public function createCustomerReviewDataGrid()
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = DB::table('product_reviews as pr')->addSelect('pr.id', 'pr.title', 'pr.comment', 'pg.name', 'pr.status')->leftjoin('products_grid as pg', 'pr.product_id', '=', 'pg.id');
|
||||
|
||||
return DataGrid::make([
|
||||
'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
|
||||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
||||
'massoperations' =>[
|
||||
0 => [
|
||||
'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' => [
|
||||
[
|
||||
'type' => 'Edit',
|
||||
'route' => 'admin.customer.review.edit',
|
||||
'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',
|
||||
'type' => 'number',
|
||||
'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',
|
||||
'label' => 'Status',
|
||||
'sortable' => true,
|
||||
'closure' => true,
|
||||
'wrapper' => function ($value) {
|
||||
if($value == 'approved')
|
||||
return '<span class="badge badge-md badge-success">Approved</span>';
|
||||
else if($value == "pending")
|
||||
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 setIndex() {
|
||||
$this->index = 'id';
|
||||
}
|
||||
|
||||
public function addColumns()
|
||||
{
|
||||
$this->addColumn([
|
||||
'index' => 'pr.id',
|
||||
'alias' => 'reviewId',
|
||||
'label' => 'ID',
|
||||
'type' => 'number',
|
||||
'searchable' => false,
|
||||
'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,
|
||||
'wrapper' => function ($value) {
|
||||
if($value == 'approved')
|
||||
return '<span class="badge badge-md badge-success">Approved</span>';
|
||||
else if($value == "pending")
|
||||
return '<span class="badge badge-md badge-warning">Pending</span>';
|
||||
},
|
||||
]);
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return $this->createCustomerReviewDataGrid()->render();
|
||||
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 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,141 +2,93 @@
|
|||
|
||||
namespace Webkul\Admin\DataGrids;
|
||||
|
||||
use Illuminate\View\View;
|
||||
use Webkul\Ui\DataGrid\Facades\DataGrid;
|
||||
use Webkul\Ui\DataGrid\AbsGrid;
|
||||
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)
|
||||
*/
|
||||
class ExchangeRatesDataGrid
|
||||
class ExchangeRatesDataGrid extends AbsGrid
|
||||
{
|
||||
public $allColumns = [];
|
||||
|
||||
/**
|
||||
* The Data Grid implementation for Exchange Rates
|
||||
*/
|
||||
public function createExchangeRatesDataGrid()
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = DB::table('currency_exchange_rates as cer')->addSelect('cer.id', 'curr.name', 'cer.rate')->leftJoin('currencies as curr', 'cer.target_currency', '=', 'curr.id');
|
||||
|
||||
return DataGrid::make([
|
||||
'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
|
||||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
||||
'massoperations' =>[
|
||||
// [
|
||||
// 'route' => route('admin.datagrid.delete'),
|
||||
// 'method' => 'DELETE',
|
||||
// 'label' => 'Delete',
|
||||
// 'type' => 'button',
|
||||
// ],
|
||||
],
|
||||
|
||||
'actions' => [
|
||||
[
|
||||
'type' => 'Edit',
|
||||
'route' => 'admin.exchange_rates.edit',
|
||||
'confirm_text' => 'Do you really want to edit this record?',
|
||||
'icon' => 'icon pencil-lg-icon',
|
||||
], [
|
||||
'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',
|
||||
'label' => 'Rate ID',
|
||||
'sortable' => true,
|
||||
], [
|
||||
'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' => []
|
||||
public function setIndex() {
|
||||
$this->index = 'id';
|
||||
}
|
||||
|
||||
public function addColumns()
|
||||
{
|
||||
$this->addColumn([
|
||||
'index' => 'cer.id',
|
||||
'alias' => 'exchId',
|
||||
'label' => 'ID',
|
||||
'type' => 'number',
|
||||
'searchable' => false,
|
||||
'sortable' => true,
|
||||
'width' => '40px'
|
||||
]);
|
||||
|
||||
$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()
|
||||
{
|
||||
return $this->createExchangeRatesDataGrid()->render();
|
||||
public function prepareActions() {
|
||||
$this->addAction([
|
||||
'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;
|
||||
|
||||
use Illuminate\View\View;
|
||||
use Webkul\Ui\DataGrid\Facades\DataGrid;
|
||||
use Webkul\Ui\DataGrid\AbsGrid;
|
||||
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)
|
||||
*/
|
||||
class InventorySourcesDataGrid
|
||||
class InventorySourcesDataGrid extends AbsGrid
|
||||
{
|
||||
public $allColumns = [];
|
||||
|
||||
/**
|
||||
* The Data Grid implementation for Inventory Sources
|
||||
*/
|
||||
public function createInventorySourcesDataGrid()
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
return DataGrid::make([
|
||||
'name' => 'Inventory Sources',
|
||||
'table' => 'inventory_sources',
|
||||
'select' => 'id',
|
||||
'perpage' => 10,
|
||||
'aliased' => false, //use this with false as default and true in case of joins
|
||||
$queryBuilder = DB::table('inventory_sources')->addSelect('id', 'code', 'name', 'priority', 'status');
|
||||
|
||||
'massoperations' =>[
|
||||
// [
|
||||
// 'route' => route('admin.datagrid.delete'),
|
||||
// 'method' => 'DELETE',
|
||||
// 'label' => 'Delete',
|
||||
// 'type' => 'button',
|
||||
// ],
|
||||
],
|
||||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
||||
'actions' => [
|
||||
[
|
||||
'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',
|
||||
],
|
||||
],
|
||||
public function setIndex() {
|
||||
$this->index = 'id';
|
||||
}
|
||||
|
||||
'join' => [
|
||||
// [
|
||||
// 'join' => 'leftjoin',
|
||||
// 'table' => 'roles as r',
|
||||
// 'primaryKey' => 'u.role_id',
|
||||
// 'condition' => '=',
|
||||
// 'secondaryKey' => 'r.id',
|
||||
// ]
|
||||
],
|
||||
public function addColumns()
|
||||
{
|
||||
$this->addColumn([
|
||||
'index' => 'id',
|
||||
'alias' => 'invId',
|
||||
'label' => 'ID',
|
||||
'type' => 'number',
|
||||
'searchable' => false,
|
||||
'sortable' => true,
|
||||
'width' => '40px'
|
||||
]);
|
||||
|
||||
//use aliasing on secodary columns if join is performed
|
||||
'columns' => [
|
||||
$this->addColumn([
|
||||
'index' => 'code',
|
||||
'alias' => 'invCode',
|
||||
'label' => 'Code',
|
||||
'type' => 'string',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'width' => '100px'
|
||||
]);
|
||||
|
||||
[
|
||||
'name' => 'id',
|
||||
'alias' => 'inventoryID',
|
||||
'type' => 'number',
|
||||
'label' => 'ID',
|
||||
'sortable' => true,
|
||||
], [
|
||||
'name' => 'code',
|
||||
'alias' => 'inventoryCode',
|
||||
'type' => 'string',
|
||||
'label' => 'Code',
|
||||
'sortable' => true,
|
||||
], [
|
||||
'name' => 'name',
|
||||
'alias' => 'inventoryName',
|
||||
'type' => 'string',
|
||||
'label' => 'Name',
|
||||
'sortable' => true,
|
||||
], [
|
||||
'name' => 'priority',
|
||||
'alias' => 'inventoryPriority',
|
||||
'type' => 'string',
|
||||
'label' => 'Priority',
|
||||
'sortable' => true,
|
||||
], [
|
||||
'name' => 'status',
|
||||
'alias' => 'inventoryStatus',
|
||||
'type' => 'boolean',
|
||||
'label' => 'Status',
|
||||
'sortable' => true,
|
||||
'wrapper' => function ($value) {
|
||||
if($value == 0)
|
||||
return "In Active";
|
||||
else
|
||||
return "Active";
|
||||
},
|
||||
],
|
||||
$this->addColumn([
|
||||
'index' => 'name',
|
||||
'alias' => 'invName',
|
||||
'label' => 'Name',
|
||||
'type' => 'string',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'width' => '100px'
|
||||
]);
|
||||
|
||||
],
|
||||
|
||||
//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' => []
|
||||
$this->addColumn([
|
||||
'index' => 'priority',
|
||||
'alias' => 'invPriority',
|
||||
'label' => 'Priority',
|
||||
'type' => 'string',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'width' => '100px'
|
||||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'index' => 'status',
|
||||
'alias' => 'invStatus',
|
||||
'label' => 'Status',
|
||||
'type' => 'boolean',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'width' => '100px',
|
||||
'wrapper' => function($value){
|
||||
if($value == 1)
|
||||
return 'Active';
|
||||
else
|
||||
return 'Inactive';
|
||||
}
|
||||
]);
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return $this->createInventorySourcesDataGrid()->render();
|
||||
public function prepareActions() {
|
||||
$this->addAction([
|
||||
'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;
|
||||
|
||||
use Illuminate\View\View;
|
||||
use Webkul\Ui\DataGrid\Facades\DataGrid;
|
||||
use Webkul\Ui\DataGrid\AbsGrid;
|
||||
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)
|
||||
*/
|
||||
class LocalesDataGrid
|
||||
class LocalesDataGrid extends AbsGrid
|
||||
{
|
||||
public $allColumns = [];
|
||||
|
||||
/**
|
||||
* The Data Grid implementation for countries
|
||||
*/
|
||||
public function createCountryDataGrid()
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = DB::table('locales')->addSelect('id', 'code', 'name');
|
||||
|
||||
return DataGrid::make([
|
||||
'name' => 'Locales',
|
||||
'table' => 'locales',
|
||||
'select' => 'id',
|
||||
'perpage' => 10,
|
||||
'aliased' => false, //use this with false as default and true in case of joins
|
||||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
||||
'massoperations' =>[
|
||||
// [
|
||||
// 'route' => route('admin.datagrid.delete'),
|
||||
// 'method' => 'DELETE',
|
||||
// 'label' => 'Delete',
|
||||
// 'type' => 'button',
|
||||
// ],
|
||||
],
|
||||
|
||||
'actions' => [
|
||||
[
|
||||
'type' => 'Edit',
|
||||
'route' => 'admin.locales.edit',
|
||||
// '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',
|
||||
'type' => 'number',
|
||||
'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',
|
||||
'label' => 'ID',
|
||||
], [
|
||||
'column' => 'code',
|
||||
'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' => []
|
||||
public function setIndex() {
|
||||
$this->index = 'id';
|
||||
}
|
||||
|
||||
public function addColumns()
|
||||
{
|
||||
$this->addColumn([
|
||||
'index' => 'id',
|
||||
'alias' => 'localeId',
|
||||
'label' => 'ID',
|
||||
'type' => 'number',
|
||||
'searchable' => false,
|
||||
'sortable' => true,
|
||||
'width' => '40px'
|
||||
]);
|
||||
|
||||
$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()
|
||||
{
|
||||
return $this->createCountryDataGrid()->render();
|
||||
public function prepareActions() {
|
||||
$this->addAction([
|
||||
'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;
|
||||
|
||||
use Illuminate\View\View;
|
||||
use Webkul\Ui\DataGrid\Facades\DataGrid;
|
||||
use Webkul\Ui\DataGrid\AbsGrid;
|
||||
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)
|
||||
*/
|
||||
class NewsLetterDataGrid
|
||||
class NewsLetterDataGrid extends AbsGrid
|
||||
{
|
||||
public $allColumns = [];
|
||||
|
||||
/**
|
||||
* The Data Grid implementation for orders
|
||||
*/
|
||||
public function newsLetterDataGrid()
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = DB::table('subscribers_list')->addSelect('id', 'is_subscribed', 'email');
|
||||
|
||||
return DataGrid::make([
|
||||
'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
|
||||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
||||
'massoperations' =>[
|
||||
// [
|
||||
// 'route' => route('admin.datagrid.delete'),
|
||||
// 'method' => 'DELETE',
|
||||
// 'label' => 'Delete',
|
||||
// 'type' => 'button',
|
||||
// ],
|
||||
],
|
||||
public function setIndex() {
|
||||
$this->index = 'id';
|
||||
}
|
||||
|
||||
'actions' => [
|
||||
[
|
||||
'type' => 'Edit',
|
||||
'route' => 'admin.customers.subscribers.edit',
|
||||
// 'confirm_text' => 'Do you really want to delete this record?',
|
||||
'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',
|
||||
],
|
||||
],
|
||||
public function addColumns()
|
||||
{
|
||||
$this->addColumn([
|
||||
'index' => 'id',
|
||||
'alias' => 'subsId',
|
||||
'label' => 'ID',
|
||||
'type' => 'number',
|
||||
'searchable' => false,
|
||||
'sortable' => true,
|
||||
'width' => '40px'
|
||||
]);
|
||||
|
||||
'join' => [],
|
||||
$this->addColumn([
|
||||
'index' => 'is_subscribed',
|
||||
'alias' => 'subsCode',
|
||||
'label' => 'Subscribed',
|
||||
'type' => 'string',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'width' => '100px',
|
||||
'wrapper' => function($value){
|
||||
if($value == 1)
|
||||
return 'True';
|
||||
else
|
||||
return 'False';
|
||||
}
|
||||
]);
|
||||
|
||||
//use aliasing on secodary columns if join is performed
|
||||
'columns' => [
|
||||
[
|
||||
'name' => 'sublist.id',
|
||||
'alias' => 'subid',
|
||||
'type' => 'number',
|
||||
'label' => 'ID',
|
||||
'sortable' => true
|
||||
], [
|
||||
'name' => 'sublist.is_subscribed',
|
||||
'alias' => 'issubs',
|
||||
'type' => 'boolean',
|
||||
'label' => 'Subscribed',
|
||||
'sortable' => true,
|
||||
'wrapper' => function ($value) {
|
||||
if($value == 0)
|
||||
return "False";
|
||||
else
|
||||
return "True";
|
||||
},
|
||||
], [
|
||||
'name' => 'sublist.email',
|
||||
'alias' => 'subsemail',
|
||||
'type' => 'string',
|
||||
'label' => 'Email',
|
||||
'sortable' => true
|
||||
]
|
||||
],
|
||||
|
||||
'filterable' => [
|
||||
[
|
||||
'column' => 'sublist.id',
|
||||
'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',
|
||||
]
|
||||
],
|
||||
//don't use aliasing in case of searchables
|
||||
|
||||
'searchable' => [
|
||||
[
|
||||
'column' => 'sublist.id',
|
||||
'type' => 'number',
|
||||
'label' => 'ID',
|
||||
], [
|
||||
'column' => 'sublist.is_subscribed',
|
||||
'type' => 'string',
|
||||
'label' => 'Subscribed',
|
||||
], [
|
||||
'column' => 'sublist.email',
|
||||
'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' => []
|
||||
$this->addColumn([
|
||||
'index' => 'email',
|
||||
'alias' => 'subsEmail',
|
||||
'label' => 'Email',
|
||||
'type' => 'string',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'width' => '100px'
|
||||
]);
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return $this->newsLetterDataGrid()->render();
|
||||
public function prepareActions() {
|
||||
$this->addAction([
|
||||
'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,177 +2,139 @@
|
|||
|
||||
namespace Webkul\Admin\DataGrids;
|
||||
|
||||
use Illuminate\View\View;
|
||||
use Webkul\Ui\DataGrid\Facades\DataGrid;
|
||||
use Webkul\Ui\DataGrid\AbsGrid;
|
||||
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)
|
||||
*/
|
||||
class OrderDataGrid
|
||||
class OrderDataGrid extends AbsGrid
|
||||
{
|
||||
public $allColumns = [];
|
||||
|
||||
/**
|
||||
* The Data Grid implementation for orders
|
||||
*/
|
||||
public function createOrderDataGrid()
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
return DataGrid::make([
|
||||
'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
|
||||
$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'));
|
||||
|
||||
'massoperations' =>[
|
||||
// [
|
||||
// 'route' => route('admin.datagrid.delete'),
|
||||
// 'method' => 'DELETE',
|
||||
// 'label' => 'Delete',
|
||||
// 'type' => 'button',
|
||||
// ],
|
||||
],
|
||||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
||||
'actions' => [
|
||||
[
|
||||
'type' => 'View',
|
||||
'route' => 'admin.sales.orders.view',
|
||||
// 'confirm_text' => 'Do you really want to view this record?',
|
||||
'icon' => 'icon eye-icon',
|
||||
'icon-alt' => 'View'
|
||||
]
|
||||
],
|
||||
public function setIndex() {
|
||||
$this->index = 'id'; //the column that needs to be treated as index column
|
||||
}
|
||||
|
||||
'join' => [],
|
||||
public function addColumns()
|
||||
{
|
||||
$this->addColumn([
|
||||
'index' => 'id',
|
||||
'alias' => 'orderId',
|
||||
'label' => 'ID',
|
||||
'type' => 'number',
|
||||
'searchable' => false,
|
||||
'sortable' => true,
|
||||
'width' => '40px'
|
||||
]);
|
||||
|
||||
//use aliasing on secodary columns if join is performed
|
||||
'columns' => [
|
||||
[
|
||||
'name' => 'or.id',
|
||||
'alias' => 'orderid',
|
||||
'type' => 'number',
|
||||
'label' => 'ID',
|
||||
'sortable' => true,
|
||||
], [
|
||||
'name' => 'CONCAT(or.customer_first_name, " ", or.customer_last_name)',
|
||||
'alias' => 'oafirstname',
|
||||
'type' => 'string',
|
||||
'label' => 'Billed To',
|
||||
'sortable' => false,
|
||||
], [
|
||||
'name' => 'or.base_grand_total',
|
||||
'alias' => 'orbasegrandtotal',
|
||||
'type' => 'string',
|
||||
'label' => 'Base Total',
|
||||
'sortable' => true,
|
||||
'wrapper' => function ($value) {
|
||||
return core()->formatBasePrice($value);
|
||||
}
|
||||
], [
|
||||
'name' => 'or.grand_total',
|
||||
'alias' => 'oagrandtotal',
|
||||
'type' => 'string',
|
||||
'label' => 'Grand Total',
|
||||
'sortable' => false,
|
||||
'wrapper' => function ($value) {
|
||||
return core()->formatBasePrice($value);
|
||||
}
|
||||
], [
|
||||
'name' => 'or.created_at',
|
||||
'alias' => 'createdat',
|
||||
'type' => 'datetime',
|
||||
'label' => 'Order Date',
|
||||
'sortable' => true,
|
||||
], [
|
||||
'name' => 'or.channel_name',
|
||||
'alias' => 'channelname',
|
||||
'type' => 'string',
|
||||
'label' => 'Channel Name',
|
||||
'sortable' => true,
|
||||
], [
|
||||
'name' => 'or.status',
|
||||
'alias' => 'orstatus',
|
||||
'type' => 'string',
|
||||
'label' => 'Status',
|
||||
'sortable' => true,
|
||||
'closure' => true, //to be used when ever wrappers or callables are used
|
||||
'wrapper' => function ($value) {
|
||||
if($value == 'processing')
|
||||
return '<span class="badge badge-md badge-success">Processing</span>';
|
||||
else if($value == 'completed')
|
||||
return '<span class="badge badge-md badge-success">Completed</span>';
|
||||
else if($value == "canceled")
|
||||
return '<span class="badge badge-md badge-danger">Canceled</span>';
|
||||
else if($value == "closed")
|
||||
return '<span class="badge badge-md badge-info">Closed</span>';
|
||||
else if($value == "pending")
|
||||
return '<span class="badge badge-md badge-warning">Pending</span>';
|
||||
else if($value == "pending_payment")
|
||||
return '<span class="badge badge-md badge-warning">Pending Payment</span>';
|
||||
else if($value == "fraud")
|
||||
return '<span class="badge badge-md badge-danger">Fraud</span>';
|
||||
},
|
||||
],
|
||||
],
|
||||
$this->addColumn([
|
||||
'index' => 'base_grand_total',
|
||||
'alias' => 'baseGrandTotal',
|
||||
'label' => 'Base Total',
|
||||
'type' => 'string',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'width' => '100px',
|
||||
'wrapper' => function ($value) {
|
||||
return core()->formatBasePrice($value);
|
||||
}
|
||||
]);
|
||||
|
||||
'filterable' => [
|
||||
[
|
||||
'column' => 'or.id',
|
||||
'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',
|
||||
],
|
||||
],
|
||||
$this->addColumn([
|
||||
'index' => 'grand_total',
|
||||
'alias' => 'grandTotal',
|
||||
'label' => 'Grand Total',
|
||||
'type' => 'string',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'width' => '100px',
|
||||
'wrapper' => function ($value) {
|
||||
return core()->formatBasePrice($value);
|
||||
}
|
||||
]);
|
||||
|
||||
//don't use aliasing in case of searchables
|
||||
'searchable' => [
|
||||
[
|
||||
'column' => 'or.id',
|
||||
'alias' => 'orderid',
|
||||
'type' => 'number',
|
||||
], [
|
||||
'column' => 'or.status',
|
||||
'alias' => 'orstatus',
|
||||
'type' => 'string',
|
||||
]
|
||||
],
|
||||
$this->addColumn([
|
||||
'index' => 'created_at',
|
||||
'alias' => 'orderDate',
|
||||
'label' => 'Order Date',
|
||||
'type' => 'string',
|
||||
'sortable' => true,
|
||||
'searchable' => true,
|
||||
'width' => '100px',
|
||||
]);
|
||||
|
||||
//list of viable operators that will be used
|
||||
'operators' => [
|
||||
'eq' => "=",
|
||||
'lt' => "<",
|
||||
'gt' => ">",
|
||||
'lte' => "<=",
|
||||
'gte' => ">=",
|
||||
'neqs' => "<>",
|
||||
'neqn' => "!=",
|
||||
'like' => "like",
|
||||
'nlike' => "not like",
|
||||
],
|
||||
$this->addColumn([
|
||||
'index' => 'channel_name',
|
||||
'alias' => 'channelName',
|
||||
'label' => 'Channel Name',
|
||||
'type' => 'string',
|
||||
'sortable' => true,
|
||||
'searchable' => false,
|
||||
'width' => '100px'
|
||||
]);
|
||||
|
||||
// 'css' => []
|
||||
$this->addColumn([
|
||||
'index' => 'status',
|
||||
'alias' => 'status',
|
||||
'label' => 'Status',
|
||||
'type' => 'string',
|
||||
'sortable' => true,
|
||||
'searchable' => false,
|
||||
'width' => '100px',
|
||||
'closure' => true,
|
||||
'wrapper' => function ($value) {
|
||||
if($value == 'processing')
|
||||
return '<span class="badge badge-md badge-success">Processing</span>';
|
||||
else if($value == 'completed')
|
||||
return '<span class="badge badge-md badge-success">Completed</span>';
|
||||
else if($value == "canceled")
|
||||
return '<span class="badge badge-md badge-danger">Canceled</span>';
|
||||
else if($value == "closed")
|
||||
return '<span class="badge badge-md badge-info">Closed</span>';
|
||||
else if($value == "pending")
|
||||
return '<span class="badge badge-md badge-warning">Pending</span>';
|
||||
else if($value == "pending_payment")
|
||||
return '<span class="badge badge-md badge-warning">Pending Payment</span>';
|
||||
else if($value == "fraud")
|
||||
return '<span class="badge badge-md badge-danger">Fraud</span>';
|
||||
}
|
||||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'index' => 'fullname',
|
||||
'alias' => 'fullName',
|
||||
'label' => 'Billed To',
|
||||
'type' => 'string',
|
||||
'searchable' => false,
|
||||
'sortable' => true,
|
||||
'width' => '100px'
|
||||
]);
|
||||
}
|
||||
|
||||
public function render($pagination = true)
|
||||
{
|
||||
return $this->createOrderDataGrid()->render($pagination);
|
||||
public function prepareActions() {
|
||||
$this->addAction([
|
||||
'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;
|
||||
|
||||
use Illuminate\View\View;
|
||||
use Webkul\Ui\DataGrid\Facades\DataGrid;
|
||||
use Webkul\Ui\DataGrid\AbsGrid;
|
||||
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)
|
||||
*/
|
||||
class OrderInvoicesDataGrid
|
||||
class OrderInvoicesDataGrid extends AbsGrid
|
||||
{
|
||||
public $allColumns = [];
|
||||
|
||||
/**
|
||||
* The Order invoices Data Grid implementation for invoices of orders
|
||||
*/
|
||||
public function createOrderInvoicesDataGrid()
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = DB::table('invoices')->select('id', 'order_id', 'state', 'grand_total', 'created_at');
|
||||
|
||||
return DataGrid::make([
|
||||
'name' => 'invoices',
|
||||
'table' => 'invoices as inv',
|
||||
'select' => 'inv.id',
|
||||
'perpage' => 10,
|
||||
'aliased' => false,
|
||||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
||||
'massoperations' =>[
|
||||
// [
|
||||
// 'route' => route('admin.datagrid.delete'),
|
||||
// 'method' => 'DELETE',
|
||||
// 'label' => 'Delete',
|
||||
// 'type' => 'button',
|
||||
// ],
|
||||
],
|
||||
public function setIndex() {
|
||||
$this->index = 'id'; //the column that needs to be treated as index column
|
||||
}
|
||||
|
||||
'actions' => [
|
||||
[
|
||||
'type' => 'View',
|
||||
'route' => 'admin.sales.invoices.view',
|
||||
// 'confirm_text' => 'Do you really want to view this record?',
|
||||
'icon' => 'icon eye-icon',
|
||||
'icon-alt' => 'View'
|
||||
],
|
||||
],
|
||||
public function addColumns()
|
||||
{
|
||||
$this->addColumn([
|
||||
'index' => 'id',
|
||||
'alias' => 'invid',
|
||||
'label' => 'ID',
|
||||
'type' => 'number',
|
||||
'searchable' => false,
|
||||
'sortable' => true,
|
||||
'width' => '40px'
|
||||
]);
|
||||
|
||||
'join' => [
|
||||
// [
|
||||
// 'join' => 'leftjoin',
|
||||
// 'table' => 'orders as ors',
|
||||
// 'primaryKey' => 'inv.order_id',
|
||||
// 'condition' => '=',
|
||||
// 'secondaryKey' => 'ors.id',
|
||||
// ]
|
||||
],
|
||||
$this->addColumn([
|
||||
'index' => 'order_id',
|
||||
'alias' => 'orderId',
|
||||
'label' => 'Order ID',
|
||||
'type' => 'number',
|
||||
'searchable' => false,
|
||||
'sortable' => true,
|
||||
'width' => '100px'
|
||||
]);
|
||||
|
||||
//use aliasing on secodary columns if join is performed
|
||||
$this->addColumn([
|
||||
'index' => 'grand_total',
|
||||
'alias' => 'invgrandtotal',
|
||||
'label' => 'Grand Total',
|
||||
'type' => 'string',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'width' => '100px',
|
||||
]);
|
||||
|
||||
'columns' => [
|
||||
[
|
||||
'name' => 'inv.id',
|
||||
'alias' => 'invid',
|
||||
'type' => 'number',
|
||||
'label' => 'ID',
|
||||
'sortable' => true
|
||||
], [
|
||||
'name' => 'inv.order_id',
|
||||
'alias' => 'invorderid',
|
||||
'type' => 'number',
|
||||
'label' => 'Order ID',
|
||||
'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,
|
||||
'wrapper' => function ($value) {
|
||||
return core()->formatBasePrice($value);
|
||||
},
|
||||
], [
|
||||
'name' => 'inv.created_at',
|
||||
'alias' => 'invcreated_at',
|
||||
'type' => 'datetime',
|
||||
'label' => 'Invoice Date',
|
||||
'sortable' => true
|
||||
]
|
||||
],
|
||||
|
||||
'filterable' => [
|
||||
[
|
||||
'column' => 'inv.id',
|
||||
'alias' => 'invid',
|
||||
'type' => 'number',
|
||||
'label' => 'ID',
|
||||
], [
|
||||
'column' => 'inv.order_id',
|
||||
'alias' => 'invorderid',
|
||||
'type' => 'number',
|
||||
'label' => 'Order ID',
|
||||
], [
|
||||
'column' => 'inv.state',
|
||||
'alias' => 'invstate',
|
||||
'type' => 'string',
|
||||
'label' => 'State',
|
||||
], [
|
||||
'column' => 'inv.grand_total',
|
||||
'alias' => 'invgrandtotal',
|
||||
'type' => 'number',
|
||||
'label' => 'Amount',
|
||||
], [
|
||||
'column' => 'inv.created_at',
|
||||
'alias' => 'invcreated_at',
|
||||
'type' => 'datetime',
|
||||
'label' => 'Invoice Date',
|
||||
]
|
||||
],
|
||||
//don't use aliasing in case of searchables
|
||||
|
||||
'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' => []
|
||||
$this->addColumn([
|
||||
'index' => 'created_at',
|
||||
'alias' => 'invcreatedat',
|
||||
'label' => 'Invoice Date',
|
||||
'type' => 'datetime',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'width' => '100px',
|
||||
]);
|
||||
}
|
||||
|
||||
public function render($pagination = true)
|
||||
{
|
||||
return $this->createOrderInvoicesDataGrid()->render($pagination);
|
||||
public function prepareActions() {
|
||||
$this->addAction([
|
||||
'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;
|
||||
|
||||
use Illuminate\View\View;
|
||||
use Webkul\Ui\DataGrid\Facades\DataGrid;
|
||||
use Webkul\Ui\DataGrid\AbsGrid;
|
||||
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)
|
||||
*/
|
||||
class OrderShipmentsDataGrid
|
||||
class OrderShipmentsDataGrid extends AbsGrid
|
||||
{
|
||||
public $allColumns = [];
|
||||
|
||||
/**
|
||||
* The Order Shipments Data Grid implementation for shipments of orders
|
||||
*/
|
||||
public function createOrderShipmentsDataGrid()
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
return DataGrid::make([
|
||||
'name' => 'shipments',
|
||||
'table' => 'shipments as ship',
|
||||
'select' => 'ship.id',
|
||||
'perpage' => 10,
|
||||
'aliased' => true,
|
||||
$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');
|
||||
|
||||
'massoperations' =>[
|
||||
// [
|
||||
// 'route' => route('admin.datagrid.delete'),
|
||||
// 'method' => 'DELETE',
|
||||
// 'label' => 'Delete',
|
||||
// 'type' => 'button',
|
||||
// ],
|
||||
],
|
||||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
||||
'actions' => [
|
||||
[
|
||||
'type' => 'View',
|
||||
'route' => 'admin.sales.shipments.view',
|
||||
// 'confirm_text' => 'Do you really want to view this record?',
|
||||
'icon' => 'icon eye-icon',
|
||||
'icon-alt' => 'View'
|
||||
],
|
||||
],
|
||||
public function setIndex() {
|
||||
$this->index = 'id'; //the column that needs to be treated as index column
|
||||
}
|
||||
|
||||
'join' => [
|
||||
[
|
||||
'join' => 'leftjoin',
|
||||
'table' => 'orders as ors',
|
||||
'primaryKey' => 'ship.order_id',
|
||||
'condition' => '=',
|
||||
'secondaryKey' => 'ors.id',
|
||||
], [
|
||||
'join' => 'leftjoin',
|
||||
'table' => 'inventory_sources as is',
|
||||
'primaryKey' => 'ship.inventory_source_id',
|
||||
'condition' => '=',
|
||||
'secondaryKey' => 'is.id',
|
||||
]
|
||||
],
|
||||
public function addColumns()
|
||||
{
|
||||
$this->addColumn([
|
||||
'index' => 'ship.id',
|
||||
'alias' => 'shipId',
|
||||
'label' => 'ID',
|
||||
'type' => 'number',
|
||||
'searchable' => false,
|
||||
'sortable' => true,
|
||||
'width' => '40px'
|
||||
]);
|
||||
|
||||
//use aliasing on secodary columns if join is performed
|
||||
'columns' => [
|
||||
[
|
||||
'name' => 'ship.id',
|
||||
'alias' => 'shipID',
|
||||
'type' => 'number',
|
||||
'label' => 'ID',
|
||||
'sortable' => true
|
||||
], [
|
||||
'name' => 'ship.order_id',
|
||||
'alias' => 'orderid',
|
||||
'type' => 'number',
|
||||
'label' => 'Order ID',
|
||||
'sortable' => true
|
||||
], [
|
||||
'name' => 'ship.total_qty',
|
||||
'alias' => 'shiptotalqty',
|
||||
'type' => 'number',
|
||||
'label' => 'Total Quantity',
|
||||
'sortable' => true
|
||||
], [
|
||||
'name' => 'CONCAT(ors.customer_first_name, " ", ors.customer_last_name)',
|
||||
'alias' => 'ordercustomerfirstname',
|
||||
'type' => 'string',
|
||||
'label' => 'Customer Name',
|
||||
'sortable' => false,
|
||||
], [
|
||||
'name' => 'is.name',
|
||||
'alias' => 'inventorySourceName',
|
||||
'type' => 'string',
|
||||
'label' => 'Inventory Source',
|
||||
'sortable' => true
|
||||
], [
|
||||
'name' => 'ors.created_at',
|
||||
'alias' => 'orscreated',
|
||||
'type' => 'date',
|
||||
'label' => 'Order Date',
|
||||
'sortable' => true
|
||||
], [
|
||||
'name' => 'ship.created_at',
|
||||
'alias' => 'shipdate',
|
||||
'type' => 'datetime',
|
||||
'label' => 'Shipment Date',
|
||||
'sortable' => true
|
||||
]
|
||||
],
|
||||
$this->addColumn([
|
||||
'index' => 'ship.order_id',
|
||||
'alias' => 'orderId',
|
||||
'label' => 'Order ID',
|
||||
'type' => 'number',
|
||||
'searchable' => false,
|
||||
'sortable' => true,
|
||||
'width' => '100px'
|
||||
]);
|
||||
|
||||
'filterable' => [
|
||||
[
|
||||
'column' => 'ship.id',
|
||||
'alias' => 'shipID',
|
||||
'type' => 'number',
|
||||
'label' => 'ID',
|
||||
], [
|
||||
'column' => 'ship.created_at',
|
||||
'alias' => 'shipdate',
|
||||
'type' => 'datetime',
|
||||
'label' => 'Shipment Date',
|
||||
]
|
||||
],
|
||||
//don't use aliasing in case of searchables
|
||||
$this->addColumn([
|
||||
'index' => 'ship.total_qty',
|
||||
'alias' => 'shipTotalQty',
|
||||
'label' => 'Total Qty',
|
||||
'type' => 'number',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'width' => '100px',
|
||||
]);
|
||||
|
||||
'searchable' => [
|
||||
// [
|
||||
// 'column' => 'ors.customer_first_name',
|
||||
// 'alias' => 'ordercustomerfirstname',
|
||||
// 'type' => 'string',
|
||||
// ]
|
||||
],
|
||||
$this->addColumn([
|
||||
'index' => 'is.name',
|
||||
'alias' => 'shipInventoryName',
|
||||
'label' => 'Inventory Source',
|
||||
'type' => 'string',
|
||||
'searchable' => true,
|
||||
'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' => []
|
||||
$this->addColumn([
|
||||
'index' => 'orderdate',
|
||||
'alias' => 'shipOrderDate',
|
||||
'label' => 'Order Date',
|
||||
'type' => 'datetime',
|
||||
'sortable' => true,
|
||||
'searchable' => true,
|
||||
'width' => '100px'
|
||||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'index' => 'ship.created_at',
|
||||
'alias' => 'shipDate',
|
||||
'label' => 'Shipment Date',
|
||||
'type' => 'datetime',
|
||||
'sortable' => true,
|
||||
'searchable' => false,
|
||||
'width' => '100px'
|
||||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'index' => 'custname',
|
||||
'alias' => 'shipTO',
|
||||
'label' => 'Shipping To',
|
||||
'type' => 'string',
|
||||
'sortable' => true,
|
||||
'searchable' => false,
|
||||
'width' => '100px'
|
||||
]);
|
||||
}
|
||||
|
||||
public function render($pagination = true)
|
||||
{
|
||||
return $this->createOrderShipmentsDataGrid()->render($pagination);
|
||||
public function prepareActions() {
|
||||
$this->addAction([
|
||||
'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;
|
||||
|
||||
use Illuminate\View\View;
|
||||
use Webkul\Ui\DataGrid\Facades\DataGrid;
|
||||
use Webkul\Ui\DataGrid\AbsGrid;
|
||||
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)
|
||||
*/
|
||||
class RolesDataGrid
|
||||
class RolesDataGrid extends AbsGrid
|
||||
{
|
||||
/**
|
||||
* The Data Grid implementation for Roles
|
||||
*/
|
||||
public function createRolesDataGrid()
|
||||
public $allColumns = [];
|
||||
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = DB::table('roles')->addSelect('id', 'name', 'permission_type');
|
||||
|
||||
return DataGrid::make([
|
||||
'name' => 'Roles',
|
||||
'table' => 'roles',
|
||||
'select' => 'id',
|
||||
'perpage' => 10,
|
||||
'aliased' => false, //use this with false as default and true in case of joins
|
||||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
||||
'massoperations' =>[
|
||||
// [
|
||||
// 'route' => route('admin.datagrid.delete'),
|
||||
// 'method' => 'DELETE',
|
||||
// 'label' => 'Delete',
|
||||
// 'type' => 'button',
|
||||
// ],
|
||||
],
|
||||
|
||||
'actions' => [
|
||||
[
|
||||
'type' => 'Edit',
|
||||
'route' => 'admin.roles.edit',
|
||||
'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',
|
||||
'type' => 'number',
|
||||
'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',
|
||||
'label' => 'ID',
|
||||
], [
|
||||
'column' => 'name',
|
||||
'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' => []
|
||||
public function setIndex() {
|
||||
$this->index = 'id';
|
||||
}
|
||||
|
||||
public function addColumns()
|
||||
{
|
||||
$this->addColumn([
|
||||
'index' => 'id',
|
||||
'alias' => 'roleId',
|
||||
'label' => 'ID',
|
||||
'type' => 'number',
|
||||
'searchable' => false,
|
||||
'sortable' => true,
|
||||
'width' => '40px'
|
||||
]);
|
||||
|
||||
$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()
|
||||
{
|
||||
return $this->createRolesDataGrid()->render();
|
||||
public function prepareActions() {
|
||||
$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,
|
||||
// ]
|
||||
// ]);
|
||||
}
|
||||
}
|
||||
|
|
@ -2,143 +2,92 @@
|
|||
|
||||
namespace Webkul\Admin\DataGrids;
|
||||
|
||||
use Illuminate\View\View;
|
||||
use Webkul\Ui\DataGrid\Facades\DataGrid;
|
||||
use Webkul\Ui\DataGrid\AbsGrid;
|
||||
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)
|
||||
*/
|
||||
class SliderDataGrid
|
||||
class SliderDataGrid extends AbsGrid
|
||||
{
|
||||
public $allColumns = [];
|
||||
|
||||
/**
|
||||
* The Data Grid implementation for Sliders
|
||||
*/
|
||||
public function createSliderDataGrid()
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = DB::table('sliders as sl')->addSelect('sl.id', 'sl.title', 'ch.name')->leftJoin('channels as ch', 'sl.channel_id', '=', 'ch.id');
|
||||
|
||||
return DataGrid::make([
|
||||
'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
|
||||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
||||
'massoperations' =>[
|
||||
// [
|
||||
// 'route' => route('admin.datagrid.delete'),
|
||||
// 'method' => 'DELETE',
|
||||
// 'label' => 'Delete',
|
||||
// 'type' => 'button',
|
||||
// ],
|
||||
],
|
||||
public function setIndex() {
|
||||
$this->index = 'id';
|
||||
}
|
||||
|
||||
'actions' => [
|
||||
[
|
||||
'type' => 'Edit',
|
||||
'route' => 'admin.sliders.edit',
|
||||
'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',
|
||||
],
|
||||
],
|
||||
public function addColumns()
|
||||
{
|
||||
$this->addColumn([
|
||||
'index' => 'sl.id',
|
||||
'alias' => 'sliderId',
|
||||
'label' => 'ID',
|
||||
'type' => 'number',
|
||||
'searchable' => false,
|
||||
'sortable' => true,
|
||||
'width' => '40px'
|
||||
]);
|
||||
|
||||
'join' => [
|
||||
[
|
||||
'join' => 'leftjoin',
|
||||
'table' => 'channels as c',
|
||||
'primaryKey' => 's.channel_id',
|
||||
'condition' => '=',
|
||||
'secondaryKey' => 'c.id',
|
||||
]
|
||||
],
|
||||
$this->addColumn([
|
||||
'index' => 'sl.title',
|
||||
'alias' => 'sliderTitle',
|
||||
'label' => 'Tile',
|
||||
'type' => 'string',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'width' => '100px'
|
||||
]);
|
||||
|
||||
//use aliasing on secodary columns if join is performed
|
||||
|
||||
'columns' => [
|
||||
[
|
||||
'name' => 's.id',
|
||||
'alias' => 'sliderId',
|
||||
'type' => 'number',
|
||||
'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',
|
||||
'label' => 'ID'
|
||||
], [
|
||||
'column' => 's.title',
|
||||
'alias' => 'sliderTitle',
|
||||
'type' => 'string',
|
||||
'label' => 'title'
|
||||
], [
|
||||
'column' => 'c.name',
|
||||
'alias' => 'channelName',
|
||||
'type' => 'string',
|
||||
'label' => 'Channel Name',
|
||||
]
|
||||
],
|
||||
|
||||
//don't use aliasing in case of searchables
|
||||
'searchable' => [
|
||||
[
|
||||
'column' => 's.id',
|
||||
'type' => 'number',
|
||||
'label' => 'ID'
|
||||
], [
|
||||
'column' => 's.title',
|
||||
'type' => 'string',
|
||||
'label' => 'Slider Title'
|
||||
], [
|
||||
'column' => 'c.name',
|
||||
'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' => []
|
||||
$this->addColumn([
|
||||
'index' => 'ch.name',
|
||||
'alias' => 'channelName',
|
||||
'label' => 'Channel Name',
|
||||
'type' => 'string',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'width' => '100px'
|
||||
]);
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return $this->createSliderDataGrid()->render();
|
||||
public function prepareActions() {
|
||||
$this->addAction([
|
||||
'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;
|
||||
|
||||
use Illuminate\View\View;
|
||||
use Webkul\Ui\DataGrid\Facades\DataGrid;
|
||||
use Webkul\Ui\DataGrid\AbsGrid;
|
||||
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)
|
||||
*/
|
||||
|
||||
class TaxCategoryDataGrid
|
||||
class TaxCategoryDataGrid extends AbsGrid
|
||||
{
|
||||
public $allColumns = [];
|
||||
|
||||
/**
|
||||
* The Tax Category Data Grid implementation.
|
||||
*/
|
||||
public function createTaxCategoryDataGrid()
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = DB::table('tax_categories')->addSelect('id', 'name', 'code');
|
||||
|
||||
return DataGrid::make([
|
||||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
||||
'name' => 'Tax Category',
|
||||
'table' => 'tax_categories as tr',
|
||||
'select' => 'tr.id',
|
||||
'perpage' => 10,
|
||||
'aliased' => true, //use this with false as default and true in case of joins
|
||||
|
||||
'massoperations' =>[
|
||||
// [
|
||||
// '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-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',
|
||||
'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',
|
||||
'label' => 'ID'
|
||||
], [
|
||||
'column' => 'tr.name',
|
||||
'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' => []
|
||||
public function setIndex() {
|
||||
$this->index = 'id';
|
||||
}
|
||||
|
||||
public function addColumns()
|
||||
{
|
||||
$this->addColumn([
|
||||
'index' => 'id',
|
||||
'alias' => 'taxCatId',
|
||||
'label' => 'ID',
|
||||
'type' => 'number',
|
||||
'searchable' => false,
|
||||
'sortable' => true,
|
||||
'width' => '40px'
|
||||
]);
|
||||
|
||||
$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;
|
||||
|
||||
use Illuminate\View\View;
|
||||
use Webkul\Ui\DataGrid\Facades\DataGrid;
|
||||
use Webkul\Ui\DataGrid\AbsGrid;
|
||||
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)
|
||||
*/
|
||||
class TaxRateDataGrid
|
||||
class TaxRateDataGrid extends AbsGrid
|
||||
{
|
||||
public $allColumns = [];
|
||||
|
||||
/**
|
||||
* The Tax Category Data Grid implementation.
|
||||
*/
|
||||
public function createTaxRateDataGrid()
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = DB::table('tax_rates')->addSelect('id', 'identifier', 'state', 'country', 'tax_rate');
|
||||
|
||||
return DataGrid::make([
|
||||
'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
|
||||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
||||
'massoperations' =>[
|
||||
// [
|
||||
// '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
|
||||
'columns' => [
|
||||
[
|
||||
'name' => 'tr.id',
|
||||
'alias' => 'id',
|
||||
'type' => 'number',
|
||||
'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',
|
||||
'label' => 'Tax Rate',
|
||||
'sortable' => true,
|
||||
],
|
||||
],
|
||||
//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' => []
|
||||
public function setIndex() {
|
||||
$this->index = 'id';
|
||||
}
|
||||
|
||||
public function addColumns()
|
||||
{
|
||||
$this->addColumn([
|
||||
'index' => 'id',
|
||||
'alias' => 'taxRateId',
|
||||
'label' => 'ID',
|
||||
'type' => 'number',
|
||||
'searchable' => false,
|
||||
'sortable' => true,
|
||||
'width' => '40px'
|
||||
]);
|
||||
|
||||
$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;
|
||||
|
||||
use Illuminate\View\View;
|
||||
use Webkul\Ui\DataGrid\Facades\DataGrid;
|
||||
use Webkul\Ui\DataGrid\AbsGrid;
|
||||
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)
|
||||
*/
|
||||
class UserDataGrid
|
||||
class UserDataGrid extends AbsGrid
|
||||
{
|
||||
public $allColumns = [];
|
||||
|
||||
/**
|
||||
* The Data Grid implementation for admin users
|
||||
*/
|
||||
public function createUserDataGrid()
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = DB::table('admins as u')->addSelect('u.id', 'u.name', 'u.status', 'u.email', 'ro.name')->leftJoin('roles as ro', 'u.role_id', '=', 'ro.id');
|
||||
|
||||
return DataGrid::make([
|
||||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
||||
'name' => 'Admins',
|
||||
'table' => 'admins as u',
|
||||
'select' => 'u.id',
|
||||
'perpage' => 10,
|
||||
'aliased' => true, //use this with false as default and true in case of joins
|
||||
public function setIndex() {
|
||||
$this->index = 'id';
|
||||
}
|
||||
|
||||
'massoperations' => [
|
||||
// [
|
||||
// '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.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',
|
||||
'label' => 'Admin ID'
|
||||
], [
|
||||
'column' => 'u.name',
|
||||
'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' => []
|
||||
public function addColumns()
|
||||
{
|
||||
$this->addColumn([
|
||||
'index' => 'u.id',
|
||||
'alias' => 'adminId',
|
||||
'label' => 'ID',
|
||||
'type' => 'number',
|
||||
'searchable' => false,
|
||||
'sortable' => true,
|
||||
'width' => '40px'
|
||||
]);
|
||||
|
||||
$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() {
|
||||
return $this->createUserDataGrid()->render();
|
||||
public function prepareActions() {
|
||||
$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\Response;
|
||||
use Illuminate\Routing\Controller;
|
||||
use Webkul\Ui\DataGrid\Facades\DataGrid;
|
||||
use Webkul\Admin\Http\Controllers\Controller;
|
||||
use Webkul\Admin\DataGrids\TestDataGrid;
|
||||
|
||||
/**
|
||||
* DataGrid controller
|
||||
* TestDataGrid controller
|
||||
*
|
||||
* @author Nikhil Malik <nikhil@webkul.com> @ysmnikhil
|
||||
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
|
||||
|
|
@ -16,6 +16,18 @@ use Webkul\Ui\DataGrid\Facades\DataGrid;
|
|||
*/
|
||||
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() {
|
||||
dd(request()->all());
|
||||
}
|
||||
|
|
@ -23,4 +35,8 @@ class DataGridController extends Controller
|
|||
public function massUpdate() {
|
||||
dd(request()->all());
|
||||
}
|
||||
|
||||
public function testGrid() {
|
||||
return $this->testgrid->render();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,10 @@ Route::group(['middleware' => ['web']], function () {
|
|||
'view' => 'admin::users.sessions.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
|
||||
Route::post('/login', 'Webkul\User\Http\Controllers\SessionController@store')->defaults('_config', [
|
||||
'redirect' => 'admin.dashboard.index'
|
||||
|
|
|
|||
|
|
@ -15,6 +15,20 @@ body {
|
|||
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 {
|
||||
height: 60px;
|
||||
background: #ffffff;
|
||||
|
|
@ -157,7 +171,7 @@ body {
|
|||
}
|
||||
|
||||
.content {
|
||||
padding: 25px 0;
|
||||
margin-top: 25px;
|
||||
|
||||
&.full-page {
|
||||
padding: 25px;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
@stop
|
||||
|
||||
@section('content')
|
||||
<div class="content">
|
||||
<div class="content" style="height: 100%;">
|
||||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>{{ __('admin::app.catalog.products.title') }}</h1>
|
||||
|
|
@ -19,8 +19,11 @@
|
|||
</div>
|
||||
|
||||
<div class="page-content">
|
||||
@inject('product','Webkul\Admin\DataGrids\ProductDataGrid')
|
||||
{!! $product->render() !!}
|
||||
{{-- @inject('product','Webkul\Admin\DataGrids\ProductDataGrid')
|
||||
{!! $product->render() !!} --}}
|
||||
|
||||
@inject('products', 'Webkul\Admin\DataGrids\TestDataGrid')
|
||||
{!! $products->render() !!}
|
||||
</div>
|
||||
</div>
|
||||
@stop
|
||||
|
|
@ -12,12 +12,12 @@
|
|||
<h1>{{ __('admin::app.customers.customers.title') }}</h1>
|
||||
</div>
|
||||
<div class="page-action">
|
||||
<div class="export" @click="showModal('downloadDataGrid')">
|
||||
{{-- <div class="export" @click="showModal('downloadDataGrid')">
|
||||
<i class="export-icon"></i>
|
||||
<span >
|
||||
{{ __('admin::app.export.export') }}
|
||||
</span>
|
||||
</div>
|
||||
</div> --}}
|
||||
|
||||
<a href="{{ route('admin.customer.create') }}" class="btn btn-lg btn-primary">
|
||||
{{ __('admin::app.customers.customers.add-title') }}
|
||||
|
|
@ -32,18 +32,18 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<modal id="downloadDataGrid" :is-open="modalIds.downloadDataGrid">
|
||||
{{-- <modal id="downloadDataGrid" :is-open="modalIds.downloadDataGrid">
|
||||
<h3 slot="header">{{ __('admin::app.export.download') }}</h3>
|
||||
<div slot="body">
|
||||
<export-form></export-form>
|
||||
</div>
|
||||
</modal>
|
||||
</modal> --}}
|
||||
|
||||
@stop
|
||||
|
||||
@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') }}">
|
||||
|
||||
<div class="page-content">
|
||||
|
|
@ -81,7 +81,7 @@
|
|||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</script> --}}
|
||||
|
||||
@endpush
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<body style="scroll-behavior: smooth;">
|
||||
<div id="app">
|
||||
|
||||
<flash-wrapper ref='flashes'></flash-wrapper>
|
||||
|
|
|
|||
|
|
@ -11,14 +11,14 @@
|
|||
<h1>{{ __('admin::app.sales.invoices.title') }}</h1>
|
||||
</div>
|
||||
|
||||
<div class="page-action">
|
||||
{{-- <div class="page-action">
|
||||
<div class="export" @click="showModal('downloadDataGrid')">
|
||||
<i class="export-icon"></i>
|
||||
<span>
|
||||
{{ __('admin::app.export.export') }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div> --}}
|
||||
</div>
|
||||
|
||||
<div class="page-content">
|
||||
|
|
@ -27,18 +27,18 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<modal id="downloadDataGrid" :is-open="modalIds.downloadDataGrid">
|
||||
{{-- <modal id="downloadDataGrid" :is-open="modalIds.downloadDataGrid">
|
||||
<h3 slot="header">{{ __('admin::app.export.download') }}</h3>
|
||||
<div slot="body">
|
||||
<export-form></export-form>
|
||||
</div>
|
||||
</modal>
|
||||
</modal> --}}
|
||||
|
||||
@stop
|
||||
|
||||
@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') }}">
|
||||
|
||||
<div class="page-content">
|
||||
|
|
@ -76,6 +76,6 @@
|
|||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</script> --}}
|
||||
|
||||
@endpush
|
||||
|
|
@ -11,14 +11,14 @@
|
|||
<h1>{{ __('admin::app.sales.orders.title') }}</h1>
|
||||
</div>
|
||||
|
||||
<div class="page-action">
|
||||
{{-- <div class="page-action">
|
||||
<div class="export" @click="showModal('downloadDataGrid')">
|
||||
<i class="export-icon"></i>
|
||||
<span>
|
||||
{{ __('admin::app.export.export') }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div> --}}
|
||||
</div>
|
||||
|
||||
<div class="page-content">
|
||||
|
|
@ -27,18 +27,18 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<modal id="downloadDataGrid" :is-open="modalIds.downloadDataGrid">
|
||||
{{-- <modal id="downloadDataGrid" :is-open="modalIds.downloadDataGrid">
|
||||
<h3 slot="header">{{ __('admin::app.export.download') }}</h3>
|
||||
<div slot="body">
|
||||
<export-form></export-form>
|
||||
</div>
|
||||
</modal>
|
||||
</modal> --}}
|
||||
|
||||
@stop
|
||||
|
||||
@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') }}">
|
||||
|
||||
<div class="page-content">
|
||||
|
|
@ -65,7 +65,7 @@
|
|||
</button>
|
||||
|
||||
</form>
|
||||
</script>
|
||||
</script> --}}
|
||||
|
||||
<script>
|
||||
Vue.component('export-form', {
|
||||
|
|
|
|||
|
|
@ -11,14 +11,14 @@
|
|||
<h1>{{ __('admin::app.sales.shipments.title') }}</h1>
|
||||
</div>
|
||||
|
||||
<div class="page-action">
|
||||
{{-- <div class="page-action">
|
||||
<div class="export" @click="showModal('downloadDataGrid')">
|
||||
<i class="export-icon"></i>
|
||||
<span>
|
||||
{{ __('admin::app.export.export') }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div> --}}
|
||||
</div>
|
||||
|
||||
<div class="page-content">
|
||||
|
|
@ -27,18 +27,18 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<modal id="downloadDataGrid" :is-open="modalIds.downloadDataGrid">
|
||||
{{-- <modal id="downloadDataGrid" :is-open="modalIds.downloadDataGrid">
|
||||
<h3 slot="header">{{ __('admin::app.export.download') }}</h3>
|
||||
<div slot="body">
|
||||
<export-form></export-form>
|
||||
</div>
|
||||
</modal>
|
||||
</modal> --}}
|
||||
|
||||
@stop
|
||||
|
||||
@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') }}">
|
||||
|
||||
<div class="page-content">
|
||||
|
|
@ -76,6 +76,6 @@
|
|||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</script> --}}
|
||||
|
||||
@endpush
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
const { mix } = require("laravel-mix");
|
||||
require("laravel-mix-merge-manifest");
|
||||
|
||||
var publicPath = 'publishable/assets';
|
||||
// var publicPath = "../../../public/vendor/webkul/admin/assets";
|
||||
// var publicPath = 'publishable/assets';
|
||||
var publicPath = "../../../public/vendor/webkul/admin/assets";
|
||||
|
||||
mix.setPublicPath(publicPath).mergeManifest();
|
||||
mix.disableNotifications();
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ class Toolbar extends AbstractProduct
|
|||
'created_at-desc' => 'newest-first',
|
||||
'created_at-asc' => 'oldest-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\Category\Repositories\CategoryRepository as Category;
|
||||
use Webkul\Inventory\Repositories\InventorySourceRepository as InventorySource;
|
||||
use Webkul\Admin\DataGrids\TestDataGrid;
|
||||
|
||||
/**
|
||||
* Product controller
|
||||
|
|
@ -202,6 +203,7 @@ class ProductController extends Controller
|
|||
*/
|
||||
public function massDestroy()
|
||||
{
|
||||
dd(request()->input());
|
||||
$productIds = explode(',', request()->input('indexes'));
|
||||
|
||||
foreach ($productIds as $productId) {
|
||||
|
|
@ -220,12 +222,17 @@ class ProductController extends Controller
|
|||
*/
|
||||
public function massUpdate()
|
||||
{
|
||||
dd(request()->input());
|
||||
$data = request()->all();
|
||||
|
||||
if (!isset($data['massaction-type'])) {
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
if(!$data['massaction-type'] == 'update') {
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
$productIds = explode(',', $data['indexes']);
|
||||
|
||||
foreach ($productIds as $productId) {
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -1,4 +1,4 @@
|
|||
{
|
||||
"/js/ui.js": "/js/ui.js?id=c3ee60fd11e29aca2922",
|
||||
"/css/ui.css": "/css/ui.css?id=0b2b51d90a970c9a4219"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
namespace Webkul\Ui\DataGrid;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
|
@ -20,8 +21,6 @@ use URL;
|
|||
*
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
|
||||
|
||||
class DataGrid
|
||||
{
|
||||
|
||||
|
|
@ -30,7 +29,6 @@ class DataGrid
|
|||
*
|
||||
* @var string
|
||||
*/
|
||||
|
||||
protected $name;
|
||||
|
||||
|
||||
|
|
@ -39,7 +37,6 @@ class DataGrid
|
|||
*
|
||||
* @var string
|
||||
*/
|
||||
|
||||
protected $select;
|
||||
|
||||
|
||||
|
|
@ -47,7 +44,6 @@ class DataGrid
|
|||
* Table
|
||||
* @var Boolean for aliasing
|
||||
*/
|
||||
|
||||
protected $aliased;
|
||||
|
||||
|
||||
|
|
@ -88,15 +84,14 @@ class DataGrid
|
|||
protected $columns;
|
||||
|
||||
/**
|
||||
* array of columns
|
||||
* to be filtered
|
||||
* array of columns to be filtered
|
||||
*
|
||||
* @var Array
|
||||
*/
|
||||
protected $filterable;
|
||||
|
||||
/**
|
||||
* array of columns
|
||||
* to be searched
|
||||
* array of columns to be searched
|
||||
*
|
||||
* @var Array
|
||||
*/
|
||||
|
|
@ -125,24 +120,26 @@ class DataGrid
|
|||
|
||||
/**
|
||||
* Actions $action
|
||||
*
|
||||
* @var action
|
||||
*/
|
||||
protected $actions;
|
||||
|
||||
/**
|
||||
* URL parse $parsed
|
||||
*
|
||||
* @var parse
|
||||
*/
|
||||
protected $parsed;
|
||||
|
||||
/*
|
||||
public function __construct(
|
||||
/*
|
||||
public function __construct (
|
||||
$name = null ,
|
||||
$table = null ,
|
||||
array $join = [],
|
||||
Collection $columns = null,
|
||||
Pagination $pagination = null
|
||||
){
|
||||
) {
|
||||
$this->make(
|
||||
$name,
|
||||
$table,
|
||||
|
|
@ -162,43 +159,45 @@ class DataGrid
|
|||
// list($name, $select, $table, $join, $columns) = array_values($args);
|
||||
$name = $select = $aliased = $table = false;
|
||||
$join = $columns = $filterable = $searchable =
|
||||
$massoperations = $css = $operators = $actions = [];
|
||||
$massoperations = $css = $actions = [];
|
||||
|
||||
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
|
||||
public function build(
|
||||
$name = null,
|
||||
$select = false,
|
||||
public function build (
|
||||
string $name = null,
|
||||
string $select = null,
|
||||
array $filterable = [],
|
||||
array $searchable = [],
|
||||
array $massoperations = [],
|
||||
bool $aliased = false,
|
||||
$perpage = 0,
|
||||
$table = null,
|
||||
int $perpage = 0,
|
||||
string $table = null,
|
||||
array $join = [],
|
||||
array $columns = null,
|
||||
array $css = [],
|
||||
array $operators = [],
|
||||
array $actions = [],
|
||||
Pagination $pagination = null
|
||||
) {
|
||||
$this->request = Request::capture();
|
||||
$this->setName($name);
|
||||
$this->setAlias($aliased);
|
||||
$this->setTable($table);
|
||||
$this->setSelect($select);
|
||||
$this->setFilterable($filterable);
|
||||
$this->setSearchable($filterable);
|
||||
$this->setMassOperations($massoperations);
|
||||
$this->setAlias($aliased);
|
||||
$this->setPerPage($perpage);
|
||||
$this->setTable($table);
|
||||
$this->setJoin($join);
|
||||
$this->addColumns($columns, true);
|
||||
$this->setCss($css);
|
||||
$this->setOperators($operators);
|
||||
$this->setOperators();
|
||||
$this->setActions($actions);
|
||||
// $this->addPagination($pagination);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
|
@ -207,10 +206,9 @@ class DataGrid
|
|||
*
|
||||
* @return $this
|
||||
*/
|
||||
|
||||
public function setName(string $name)
|
||||
{
|
||||
$this->name = $name ?: 'Default' . time();
|
||||
$this->name = $name ? : 'Default' . time();
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
|
@ -219,18 +217,28 @@ class DataGrid
|
|||
*
|
||||
* @return $this
|
||||
*/
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Filterable
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
|
||||
public function setFilterable(array $filterable)
|
||||
{
|
||||
$this->filterable = $filterable ? : [];
|
||||
|
|
@ -239,9 +247,9 @@ class DataGrid
|
|||
|
||||
/**
|
||||
* Set Searchable columns
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
|
||||
public function setSearchable($searchable)
|
||||
{
|
||||
$this->searchable = $searchable ? : [];
|
||||
|
|
@ -250,9 +258,9 @@ class DataGrid
|
|||
|
||||
/**
|
||||
* Set mass operations
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
|
||||
public function setMassOperations($massops)
|
||||
{
|
||||
$this->massoperations = $massops ? : [];
|
||||
|
|
@ -260,13 +268,10 @@ class DataGrid
|
|||
}
|
||||
|
||||
/**
|
||||
* Set alias parameter
|
||||
* to know whether
|
||||
* aliasing is true or not.
|
||||
* Set alias parameter to know whether aliasing is true or not.
|
||||
*
|
||||
* @return $this.
|
||||
*/
|
||||
|
||||
public function setAlias(bool $aliased)
|
||||
{
|
||||
$this->aliased = $aliased ? : false;
|
||||
|
|
@ -274,13 +279,10 @@ class DataGrid
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the default
|
||||
* pagination for
|
||||
* data grid.
|
||||
* Set the default pagination for data grid.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
|
||||
public function setPerPage($perpage)
|
||||
{
|
||||
$this->perpage = $perpage ? : 5;
|
||||
|
|
@ -288,12 +290,10 @@ class DataGrid
|
|||
}
|
||||
|
||||
/**
|
||||
* Set table name in front
|
||||
* of query scope.
|
||||
* Set table name in front of query scope.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
|
||||
public function setTable(string $table)
|
||||
{
|
||||
$this->table = $table ?: false;
|
||||
|
|
@ -301,12 +301,10 @@ class DataGrid
|
|||
}
|
||||
|
||||
/**
|
||||
* Set join bag if
|
||||
* present.
|
||||
* Set join bag if present.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
|
||||
public function setJoin(array $join)
|
||||
{
|
||||
$this->join = $join ?: [];
|
||||
|
|
@ -315,20 +313,45 @@ class DataGrid
|
|||
|
||||
/**
|
||||
* Adds the custom css rules
|
||||
* @retun $this
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
|
||||
private function setCss($css = [])
|
||||
{
|
||||
$this->css = new Css($css);
|
||||
return $this->css;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* setFilterableColumns
|
||||
* Adds operands to be used for query condition
|
||||
*
|
||||
* @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 = [])
|
||||
// {
|
||||
// $this->join = $filterable_columns ?: [];
|
||||
|
|
@ -336,11 +359,25 @@ class DataGrid
|
|||
// }
|
||||
|
||||
/**
|
||||
* Section actions bag
|
||||
* here.
|
||||
* get alias of the leftmost table
|
||||
*
|
||||
* @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
|
||||
*/
|
||||
|
||||
public function setActions($actions = []) {
|
||||
$this->actions = $actions ?: [];
|
||||
return $this;
|
||||
|
|
@ -351,17 +388,18 @@ class DataGrid
|
|||
*
|
||||
* @return $this
|
||||
*/
|
||||
|
||||
public function addColumns($columns = [], $reCreate = false)
|
||||
{
|
||||
if ($reCreate) {
|
||||
$this->columns = new Collection();
|
||||
}
|
||||
|
||||
if ($columns) {
|
||||
foreach ($columns as $column) {
|
||||
$this->addColumn($column);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
|
@ -370,7 +408,6 @@ class DataGrid
|
|||
*
|
||||
* @return $this
|
||||
*/
|
||||
|
||||
public function addColumn($column = [])
|
||||
{
|
||||
if ($column instanceof Column) {
|
||||
|
|
@ -380,16 +417,15 @@ class DataGrid
|
|||
} else {
|
||||
throw new \Exception("DataGrid: Add Column argument is not valid!");
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add ColumnMultiple.
|
||||
* Currently is not
|
||||
* of any use.
|
||||
* Add multiple columns, not being used currently
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
|
||||
private function addColumnMultiple($column = [], $multiple = false)
|
||||
{
|
||||
if ($column instanceof Column) {
|
||||
|
|
@ -419,16 +455,6 @@ class DataGrid
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds expressional verbs to be used
|
||||
* @return $this
|
||||
*/
|
||||
public function setOperators(array $operators)
|
||||
{
|
||||
$this->operators = $operators ?: [];
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add Pagination.
|
||||
*
|
||||
|
|
@ -443,27 +469,28 @@ class DataGrid
|
|||
} else {
|
||||
throw new \Exception("DataGrid: Pagination argument is not valid!");
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used for selecting
|
||||
* the columns got in
|
||||
* make from controller.
|
||||
* Used for selecting the columns got in make from controller.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
private function getSelect()
|
||||
{
|
||||
$select = [];
|
||||
|
||||
if ($this->select) {
|
||||
$this->query->addselect($this->select);
|
||||
}
|
||||
|
||||
foreach ($this->columns as $column) {
|
||||
$this->query->addselect(DB::raw($column->name.' as '.$column->alias));
|
||||
}
|
||||
|
||||
// $this->query->select(...$select);
|
||||
|
||||
if ($this->select) {
|
||||
$this->query->addselect($this->select);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -473,7 +500,7 @@ class DataGrid
|
|||
* name.
|
||||
* @return string
|
||||
*/
|
||||
public function findAlias($column_alias) {
|
||||
public function findColumnAlias($column_alias) {
|
||||
foreach($this->columns as $column) {
|
||||
if($column->alias == $column_alias) {
|
||||
return $column->name;
|
||||
|
|
@ -488,7 +515,7 @@ class DataGrid
|
|||
* name.
|
||||
* @return string
|
||||
*/
|
||||
public function findType($column_alias) {
|
||||
public function findColumnType($column_alias) {
|
||||
foreach($this->columns as $column) {
|
||||
if($column->alias == $column_alias) {
|
||||
return $column->type;
|
||||
|
|
@ -497,14 +524,13 @@ class DataGrid
|
|||
}
|
||||
|
||||
/**
|
||||
* Parse the URL
|
||||
* and get it ready
|
||||
* to be used.
|
||||
* 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];
|
||||
|
||||
|
|
@ -519,17 +545,24 @@ class DataGrid
|
|||
|
||||
/**
|
||||
* ->join('contacts', 'users.id', '=', 'contacts.user_id')
|
||||
*
|
||||
* @return $this->query
|
||||
*/
|
||||
private function getQueryWithJoin()
|
||||
{
|
||||
foreach ($this->join as $join) {
|
||||
$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()
|
||||
{
|
||||
// config()->set('key', $value);
|
||||
foreach ($this->columns as $column) {
|
||||
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)) {
|
||||
|
|
@ -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
|
||||
foreach ($parsed as $key=>$value) {
|
||||
$column_name = $this->findAlias($key);
|
||||
$column_type = $this->findType($key);
|
||||
$column_name = $this->findColumnAlias($key);
|
||||
$column_type = $this->findColumnType($key);
|
||||
|
||||
if ($key == "sort") {
|
||||
//resolve the case with the column helper class
|
||||
if(substr_count($key,'_') >= 1)
|
||||
$column_name = $this->findAlias($key);
|
||||
$column_name = $this->findColumnAlias($key);
|
||||
|
||||
//case that don't need any resolving
|
||||
$count_keys = count(array_keys($value));
|
||||
|
|
@ -599,7 +632,7 @@ class DataGrid
|
|||
}
|
||||
});
|
||||
} else {
|
||||
$column_name = $this->findAlias($key);
|
||||
$column_name = $this->findColumnAlias($key);
|
||||
if (array_keys($value)[0]=="like" || array_keys($value)[0]=="nlike") {
|
||||
foreach ($value as $condition => $filter_value) {
|
||||
if (strpos($column_name, 'CONCAT') !== false) {
|
||||
|
|
@ -640,7 +673,6 @@ class DataGrid
|
|||
} else {
|
||||
//this is the case for the non aliasing.
|
||||
foreach ($parsed as $key => $value) {
|
||||
|
||||
if ($key=="sort") {
|
||||
|
||||
//case that don't need any resolving
|
||||
|
|
@ -672,8 +704,8 @@ class DataGrid
|
|||
|
||||
} else {
|
||||
// $column_name = $key;
|
||||
$column_name = $this->findAlias($key);
|
||||
$column_type = $this->findType($key);
|
||||
$column_name = $this->findColumnAlias($key);
|
||||
$column_type = $this->findColumnType($key);
|
||||
|
||||
if (array_keys($value)[0]=="like" || array_keys($value)[0]=="nlike") {
|
||||
foreach ($value as $condition => $filter_value) {
|
||||
|
|
@ -712,7 +744,6 @@ class DataGrid
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -811,9 +842,11 @@ class DataGrid
|
|||
$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'));
|
||||
} else {
|
||||
}else {
|
||||
$this->results = $this->query->orderBy($this->select, 'desc')->get();
|
||||
}
|
||||
|
||||
|
|
@ -842,13 +875,10 @@ class DataGrid
|
|||
}
|
||||
|
||||
/**
|
||||
* Main Render Function,
|
||||
* it renders views responsible
|
||||
* for loading datagrid.
|
||||
* Main Render Function, it renders views responsible for loading datagrid.
|
||||
*
|
||||
* @return view
|
||||
*/
|
||||
|
||||
public function render($pagination = true)
|
||||
{
|
||||
$this->getDbQueryResults($pagination);
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ abstract class AbstractFillable
|
|||
break;
|
||||
}
|
||||
|
||||
if($error) throw new \Exception($error);
|
||||
if ($error) throw new \Exception($error);
|
||||
$this->{$key} = $value;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -159,7 +159,6 @@ class Column extends AbstractFillable
|
|||
|
||||
public function render($obj)
|
||||
{
|
||||
|
||||
if (property_exists($obj, ($this->aliasing = $this->alias))) {
|
||||
$this->value = $obj->{$this->aliasing};
|
||||
$this->wrap($obj);
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ use Illuminate\Pagination\Paginator;
|
|||
|
||||
class Pagination extends Paginator
|
||||
{
|
||||
const LIMIT = 20;
|
||||
const LIMIT = 10;
|
||||
const OFFSET = 0;
|
||||
const VIEW = '';
|
||||
|
||||
|
|
|
|||
|
|
@ -354,8 +354,7 @@ h2 {
|
|||
.checkbox {
|
||||
position: relative;
|
||||
display: block;
|
||||
vertical-align: middle;
|
||||
margin: 0px 5px 5px 0px;
|
||||
// vertical-align: middle;
|
||||
|
||||
input {
|
||||
left: 0;
|
||||
|
|
|
|||
|
|
@ -1,257 +1,106 @@
|
|||
/* Data grid css starts here */
|
||||
.grid-container {
|
||||
.filter-wrapper {
|
||||
display: block;
|
||||
box-sizing: border-box;
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.filter-row-one,
|
||||
.filter-row-two {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
}
|
||||
.filter-row-one {
|
||||
height: 40px;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
.filter-row-one {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.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;
|
||||
.filter-row-two {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
flex-direction: row;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.search-icon {
|
||||
margin-left: 4px;
|
||||
margin-top: 4px;
|
||||
height: 24px;
|
||||
width: 24px;
|
||||
}
|
||||
}
|
||||
}
|
||||
.search-filter {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
|
||||
.dropdown-filters {
|
||||
display: inline-flex;
|
||||
|
||||
.more-filters {
|
||||
|
||||
.dropdown-toggle {
|
||||
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%;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
|
||||
.arrow-down-icon {
|
||||
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 {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.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;
|
||||
}
|
||||
.table {
|
||||
thead {
|
||||
.mass-action-wrapper {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
|
||||
.massaction-remove {
|
||||
margin-top: 4px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
.contorl:focus {
|
||||
border-color: $brand-color;
|
||||
}
|
||||
|
||||
.selected-items {
|
||||
margin-right: 15px;
|
||||
}
|
||||
}
|
||||
tr {
|
||||
th.grid_head {
|
||||
.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;
|
||||
|
||||
.sort-down-icon, .sort-up-icon {
|
||||
margin-left: 5px;
|
||||
margin-top: -3px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
|
||||
th.grid_head.sortable {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
th {
|
||||
text-transform: capitalize;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tbody {
|
||||
td.action {
|
||||
a:first-child {
|
||||
margin-right: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.pagination {
|
||||
margin-top:20px;
|
||||
.search-icon {
|
||||
margin-top: 3px;
|
||||
margin-left: 3px;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* DataGrid css ends in here */
|
||||
|
||||
.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;
|
||||
padding: 0px 5px 0px 5px;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
background: #E7E7E7;
|
||||
font-size: 14px;
|
||||
height: 28px;
|
||||
color: #000311;
|
||||
letter-spacing: -0.22px;
|
||||
}
|
||||
}
|
||||
|
||||
.filter-tag:not(first-child) {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
<div class="filter-row-one">
|
||||
<div class="search-filter" style="display: inline-flex; align-items: center;">
|
||||
<input type="search" id="search-field" class="control" placeholder="Search Here..." value="" />
|
||||
|
||||
<div class="ic-wrapper">
|
||||
<span class="icon search-icon search-btn"></span>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -133,26 +133,26 @@
|
|||
var conditionUsed = $('.filter-condition-dropdown-number').find(':selected').val();
|
||||
var response = $('.response-number').val();
|
||||
|
||||
formURL(selectedColumn,conditionUsed,response,params,col_label);
|
||||
formURL(selectedColumn,conditionUsed,response,params, col_label);
|
||||
}
|
||||
if(typeValue == 'string') {
|
||||
var conditionUsed = $('.filter-condition-dropdown-string').find(':selected').val();
|
||||
var response = $('.response-string').val();
|
||||
|
||||
formURL(selectedColumn,conditionUsed,response,params,col_label);
|
||||
formURL(selectedColumn,conditionUsed,response,params, col_label);
|
||||
}
|
||||
if(typeValue == 'datetime') {
|
||||
var conditionUsed = $('.filter-condition-dropdown-datetime').find(':selected').val();
|
||||
var response = $('.response-datetime').val();
|
||||
|
||||
formURL(selectedColumn,conditionUsed,response,params,col_label);
|
||||
formURL(selectedColumn,conditionUsed,response,params, col_label);
|
||||
}
|
||||
if(typeValue == 'boolean') { //use select dropdown with two values true and false
|
||||
// console.log('boolean');
|
||||
var conditionUsed = $('.filter-condition-dropdown-boolean').find(':selected').val();
|
||||
var response = $('.response-boolean').val();
|
||||
|
||||
formURL(selectedColumn,conditionUsed,response,params,col_label);
|
||||
formURL(selectedColumn,conditionUsed,response,params, col_label);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
@ -160,6 +160,7 @@
|
|||
//remove the filter and from clicking on cross icon on tag
|
||||
$('.remove-filter').on('click', function() {
|
||||
var id = $(this).parents('.filter-one').attr('id');
|
||||
|
||||
if(allFilters.length == 1) {
|
||||
allFilters.pop();
|
||||
var uri = window.location.href.toString();
|
||||
|
|
@ -298,10 +299,10 @@
|
|||
|
||||
//make the url from the array and redirect
|
||||
function makeURL(repetition = false) {
|
||||
if(allFilters.length>0 && repetition == false)
|
||||
if(allFilters.length > 0 && repetition == false)
|
||||
{
|
||||
for(i=0;i<allFilters.length;i++) {
|
||||
if(i==0) {
|
||||
for(i = 0; i < allFilters.length; i++) {
|
||||
if(i == 0) {
|
||||
url = '?' + allFilters[i].column + '[' + allFilters[i].cond + ']' + '=' + allFilters[i].val;
|
||||
} else {
|
||||
url = url + '&' + allFilters[i].column + '[' + allFilters[i].cond + ']' + '=' + allFilters[i].val;
|
||||
|
|
@ -445,9 +446,9 @@
|
|||
sort_exists = 0;
|
||||
for(j = 0; j<allFilters.length; j++) {
|
||||
if(allFilters[j].column == "sort") {
|
||||
if(allFilters[j].column==column && allFilters[j].cond==condition && allFilters[j].val==response) {
|
||||
if(allFilters[j].column == column && allFilters[j].cond == condition && allFilters[j].val == response) {
|
||||
|
||||
if(response=="asc") {
|
||||
if(response == "asc") {
|
||||
allFilters[j].column = column;
|
||||
allFilters[j].cond = condition;
|
||||
allFilters[j].val = "desc";
|
||||
|
|
|
|||
|
|
@ -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,8 +1,8 @@
|
|||
const { mix } = require("laravel-mix");
|
||||
require("laravel-mix-merge-manifest");
|
||||
|
||||
var publicPath = 'publishable/assets';
|
||||
// var publicPath = "../../../public/vendor/webkul/ui/assets";
|
||||
// var publicPath = 'publishable/assets';
|
||||
var publicPath = "../../../public/vendor/webkul/ui/assets";
|
||||
|
||||
mix.setPublicPath(publicPath).mergeManifest();
|
||||
mix.disableNotifications();
|
||||
|
|
|
|||
Loading…
Reference in New Issue