subtle changes in datagrid done and all datagrids have been refactored
This commit is contained in:
parent
a4485e2191
commit
6c8bdf20c0
|
|
@ -29,7 +29,7 @@ return [
|
|||
*
|
||||
* Accepted Value = integer
|
||||
*/
|
||||
'pagination' => 10,
|
||||
// 'pagination' => 10,
|
||||
|
||||
'operators' => [
|
||||
'eq' => "=",
|
||||
|
|
|
|||
|
|
@ -17,15 +17,19 @@ class AttributeDataGrid extends AbsGrid
|
|||
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = DB::table('attributes')->select('id')->addSelect($this->columns);
|
||||
$queryBuilder = DB::table('attributes')->select('id')->addSelect('id', 'code', 'admin_name', 'type', 'is_required', 'is_unique', 'value_per_locale', 'value_per_channel');
|
||||
|
||||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
||||
public function setIndex() {
|
||||
$this->index = 'id'; //the column that needs to be treated as index column
|
||||
}
|
||||
|
||||
public function addColumns()
|
||||
{
|
||||
$this->addColumn([
|
||||
'column' => 'id',
|
||||
'index' => 'id',
|
||||
'alias' => 'attributeId',
|
||||
'label' => 'ID',
|
||||
'type' => 'number',
|
||||
|
|
@ -35,7 +39,7 @@ class AttributeDataGrid extends AbsGrid
|
|||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'column' => 'code',
|
||||
'index' => 'code',
|
||||
'alias' => 'attributeCode',
|
||||
'label' => 'Code',
|
||||
'type' => 'string',
|
||||
|
|
@ -45,7 +49,7 @@ class AttributeDataGrid extends AbsGrid
|
|||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'column' => 'admin_name',
|
||||
'index' => 'admin_name',
|
||||
'alias' => 'attributeAdminName',
|
||||
'label' => 'Name',
|
||||
'type' => 'string',
|
||||
|
|
@ -55,7 +59,7 @@ class AttributeDataGrid extends AbsGrid
|
|||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'column' => 'type',
|
||||
'index' => 'type',
|
||||
'alias' => 'attributeType',
|
||||
'label' => 'Type',
|
||||
'type' => 'string',
|
||||
|
|
@ -65,7 +69,7 @@ class AttributeDataGrid extends AbsGrid
|
|||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'column' => 'is_required',
|
||||
'index' => 'is_required',
|
||||
'alias' => 'attributeRequired',
|
||||
'label' => 'Required',
|
||||
'type' => 'boolean',
|
||||
|
|
@ -75,7 +79,7 @@ class AttributeDataGrid extends AbsGrid
|
|||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'column' => 'is_unique',
|
||||
'index' => 'is_unique',
|
||||
'alias' => 'attributeIsUnique',
|
||||
'label' => 'Unique',
|
||||
'type' => 'boolean',
|
||||
|
|
@ -85,7 +89,7 @@ class AttributeDataGrid extends AbsGrid
|
|||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'column' => 'value_per_locale',
|
||||
'index' => 'value_per_locale',
|
||||
'alias' => 'attributeValuePerLocale',
|
||||
'label' => 'Locale Based',
|
||||
'type' => 'boolean',
|
||||
|
|
@ -95,7 +99,7 @@ class AttributeDataGrid extends AbsGrid
|
|||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'column' => 'value_per_channel',
|
||||
'index' => 'value_per_channel',
|
||||
'alias' => 'attributeValuePerChannel',
|
||||
'label' => 'Channel Based',
|
||||
'type' => 'boolean',
|
||||
|
|
@ -106,13 +110,13 @@ class AttributeDataGrid extends AbsGrid
|
|||
}
|
||||
|
||||
public function prepareActions() {
|
||||
$this->prepareAction([
|
||||
$this->addAction([
|
||||
'type' => 'Edit',
|
||||
'route' => 'admin.catalog.attributes.edit',
|
||||
'icon' => 'icon pencil-lg-icon'
|
||||
]);
|
||||
|
||||
$this->prepareAction([
|
||||
$this->addAction([
|
||||
'type' => 'Delete',
|
||||
'route' => 'admin.catalog.attributes.delete',
|
||||
'icon' => 'icon trash-icon'
|
||||
|
|
@ -120,23 +124,10 @@ class AttributeDataGrid extends AbsGrid
|
|||
}
|
||||
|
||||
public function prepareMassActions() {
|
||||
$this->prepareMassAction([
|
||||
$this->addMassAction([
|
||||
'type' => 'delete',
|
||||
'action' => route('admin.catalog.attributes.massdelete'),
|
||||
'method' => 'DELETE'
|
||||
]);
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
$this->addColumns();
|
||||
|
||||
$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]);
|
||||
}
|
||||
}
|
||||
|
|
@ -17,15 +17,19 @@ class AttributeFamilyDataGrid extends AbsGrid
|
|||
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = DB::table('attribute_families')->select('id')->addSelect($this->columns);
|
||||
$queryBuilder = DB::table('attribute_families')->select('id')->addSelect('id', 'code', 'name');
|
||||
|
||||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
||||
public function setIndex() {
|
||||
$this->index = 'id'; //the column that needs to be treated as index column
|
||||
}
|
||||
|
||||
public function addColumns()
|
||||
{
|
||||
$this->addColumn([
|
||||
'column' => 'id',
|
||||
'index' => 'id',
|
||||
'alias' => 'attributeFamilyId',
|
||||
'label' => 'ID',
|
||||
'type' => 'number',
|
||||
|
|
@ -35,7 +39,7 @@ class AttributeFamilyDataGrid extends AbsGrid
|
|||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'column' => 'code',
|
||||
'index' => 'code',
|
||||
'alias' => 'attributeFamilyCode',
|
||||
'label' => 'Code',
|
||||
'type' => 'string',
|
||||
|
|
@ -45,7 +49,7 @@ class AttributeFamilyDataGrid extends AbsGrid
|
|||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'column' => 'name',
|
||||
'index' => 'name',
|
||||
'alias' => 'attributeFamilyName',
|
||||
'label' => 'Name',
|
||||
'type' => 'string',
|
||||
|
|
@ -56,13 +60,13 @@ class AttributeFamilyDataGrid extends AbsGrid
|
|||
}
|
||||
|
||||
public function prepareActions() {
|
||||
$this->prepareAction([
|
||||
$this->addAction([
|
||||
'type' => 'Edit',
|
||||
'route' => 'admin.catalog.families.edit',
|
||||
'icon' => 'icon pencil-lg-icon'
|
||||
]);
|
||||
|
||||
$this->prepareAction([
|
||||
$this->addAction([
|
||||
'type' => 'Delete',
|
||||
'route' => 'admin.catalog.families.delete',
|
||||
// 'confirm_text' => trans('ui::app.datagrid.massaction.delete', ['resource' => 'product']),
|
||||
|
|
@ -87,17 +91,4 @@ class AttributeFamilyDataGrid extends AbsGrid
|
|||
// ]
|
||||
// ]);
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
$this->addColumns();
|
||||
|
||||
$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]);
|
||||
}
|
||||
}
|
||||
|
|
@ -17,15 +17,19 @@ class CategoryDataGrid extends AbsGrid
|
|||
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = DB::table('categories as cat')->select('cat.id')->addSelect($this->columns)->leftJoin('category_translations as ct', 'cat.id', '=', 'ct.category_id');
|
||||
$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');
|
||||
|
||||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
||||
public function setIndex() {
|
||||
$this->index = 'id'; //the column that needs to be treated as index column
|
||||
}
|
||||
|
||||
public function addColumns()
|
||||
{
|
||||
$this->addColumn([
|
||||
'column' => 'cat.id',
|
||||
'index' => 'cat.id',
|
||||
'alias' => 'catId',
|
||||
'label' => 'ID',
|
||||
'type' => 'number',
|
||||
|
|
@ -35,7 +39,7 @@ class CategoryDataGrid extends AbsGrid
|
|||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'column' => 'ct.name',
|
||||
'index' => 'ct.name',
|
||||
'alias' => 'catName',
|
||||
'label' => 'Name',
|
||||
'type' => 'string',
|
||||
|
|
@ -45,7 +49,7 @@ class CategoryDataGrid extends AbsGrid
|
|||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'column' => 'cat.position',
|
||||
'index' => 'cat.position',
|
||||
'alias' => 'catPosition',
|
||||
'label' => 'Position',
|
||||
'type' => 'string',
|
||||
|
|
@ -55,7 +59,7 @@ class CategoryDataGrid extends AbsGrid
|
|||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'column' => 'cat.status',
|
||||
'index' => 'cat.status',
|
||||
'alias' => 'catStatus',
|
||||
'label' => 'Type',
|
||||
'type' => 'boolean',
|
||||
|
|
@ -65,7 +69,7 @@ class CategoryDataGrid extends AbsGrid
|
|||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'column' => 'ct.locale',
|
||||
'index' => 'ct.locale',
|
||||
'alias' => 'catLocale',
|
||||
'label' => 'Locale',
|
||||
'type' => 'boolean',
|
||||
|
|
@ -76,13 +80,13 @@ class CategoryDataGrid extends AbsGrid
|
|||
}
|
||||
|
||||
public function prepareActions() {
|
||||
$this->prepareAction([
|
||||
$this->addAction([
|
||||
'type' => 'Edit',
|
||||
'route' => 'admin.catalog.products.edit',
|
||||
'icon' => 'icon pencil-lg-icon'
|
||||
]);
|
||||
|
||||
$this->prepareAction([
|
||||
$this->addAction([
|
||||
'type' => 'Delete',
|
||||
'route' => 'admin.catalog.products.delete',
|
||||
'confirm_text' => trans('ui::app.datagrid.massaction.delete', ['resource' => 'product']),
|
||||
|
|
@ -107,17 +111,4 @@ class CategoryDataGrid extends AbsGrid
|
|||
// ]
|
||||
// ]);
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
$this->addColumns();
|
||||
|
||||
$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]);
|
||||
}
|
||||
}
|
||||
|
|
@ -17,15 +17,19 @@ class ChannelDataGrid extends AbsGrid
|
|||
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = DB::table('channels')->select('id')->addSelect($this->columns);
|
||||
$queryBuilder = DB::table('channels')->addSelect('id', 'code', 'name', 'hostname');
|
||||
|
||||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
||||
public function setIndex() {
|
||||
$this->index = 'id'; //the column that needs to be treated as index column
|
||||
}
|
||||
|
||||
public function addColumns()
|
||||
{
|
||||
$this->addColumn([
|
||||
'column' => 'id',
|
||||
'index' => 'id',
|
||||
'alias' => 'channelId',
|
||||
'label' => 'ID',
|
||||
'type' => 'number',
|
||||
|
|
@ -35,7 +39,7 @@ class ChannelDataGrid extends AbsGrid
|
|||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'column' => 'code',
|
||||
'index' => 'code',
|
||||
'alias' => 'channelCode',
|
||||
'label' => 'Code',
|
||||
'type' => 'string',
|
||||
|
|
@ -45,7 +49,7 @@ class ChannelDataGrid extends AbsGrid
|
|||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'column' => 'name',
|
||||
'index' => 'name',
|
||||
'alias' => 'channelName',
|
||||
'label' => 'Name',
|
||||
'type' => 'string',
|
||||
|
|
@ -55,7 +59,7 @@ class ChannelDataGrid extends AbsGrid
|
|||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'column' => 'hostname',
|
||||
'index' => 'hostname',
|
||||
'alias' => 'channelHostname',
|
||||
'label' => 'Hostname',
|
||||
'type' => 'string',
|
||||
|
|
@ -66,13 +70,13 @@ class ChannelDataGrid extends AbsGrid
|
|||
}
|
||||
|
||||
public function prepareActions() {
|
||||
$this->prepareAction([
|
||||
$this->addAction([
|
||||
'type' => 'Edit',
|
||||
'route' => 'admin.channels.edit',
|
||||
'icon' => 'icon pencil-lg-icon'
|
||||
]);
|
||||
|
||||
$this->prepareAction([
|
||||
$this->addAction([
|
||||
'type' => 'Delete',
|
||||
'route' => 'admin.channels.delete',
|
||||
'confirm_text' => trans('ui::app.datagrid.massaction.delete', ['resource' => 'product']),
|
||||
|
|
@ -97,17 +101,4 @@ class ChannelDataGrid extends AbsGrid
|
|||
// ]
|
||||
// ]);
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
$this->addColumns();
|
||||
|
||||
$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]);
|
||||
}
|
||||
}
|
||||
|
|
@ -17,15 +17,19 @@ class CurrencyDataGrid extends AbsGrid
|
|||
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = DB::table('currencies')->select('id')->addSelect($this->columns);
|
||||
$queryBuilder = DB::table('currencies')->addSelect('id', 'name', 'code');
|
||||
|
||||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
||||
public function setIndex() {
|
||||
$this->index = 'id'; //the column that needs to be treated as index column
|
||||
}
|
||||
|
||||
public function addColumns()
|
||||
{
|
||||
$this->addColumn([
|
||||
'column' => 'id',
|
||||
'index' => 'id',
|
||||
'alias' => 'currencyId',
|
||||
'label' => 'ID',
|
||||
'type' => 'number',
|
||||
|
|
@ -35,7 +39,7 @@ class CurrencyDataGrid extends AbsGrid
|
|||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'column' => 'name',
|
||||
'index' => 'name',
|
||||
'alias' => 'currencyName',
|
||||
'label' => 'Name',
|
||||
'type' => 'string',
|
||||
|
|
@ -45,7 +49,7 @@ class CurrencyDataGrid extends AbsGrid
|
|||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'column' => 'code',
|
||||
'index' => 'code',
|
||||
'alias' => 'currencyCode',
|
||||
'label' => 'Code',
|
||||
'type' => 'string',
|
||||
|
|
@ -56,13 +60,13 @@ class CurrencyDataGrid extends AbsGrid
|
|||
}
|
||||
|
||||
public function prepareActions() {
|
||||
$this->prepareAction([
|
||||
$this->addAction([
|
||||
'type' => 'Edit',
|
||||
'route' => 'admin.currencies.edit',
|
||||
'icon' => 'icon pencil-lg-icon'
|
||||
]);
|
||||
|
||||
$this->prepareAction([
|
||||
$this->addAction([
|
||||
'type' => 'Delete',
|
||||
'route' => 'admin.currencies.delete',
|
||||
'icon' => 'icon trash-icon'
|
||||
|
|
@ -86,17 +90,4 @@ class CurrencyDataGrid extends AbsGrid
|
|||
// ]
|
||||
// ]);
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
$this->addColumns();
|
||||
|
||||
$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]);
|
||||
}
|
||||
}
|
||||
|
|
@ -17,11 +17,15 @@ class CustomerDataGrid extends AbsGrid
|
|||
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = DB::table('customers as cus')->select('cus.id')->addSelect($this->columns)->leftJoin('customer_groups as cg', 'cus.customer_group_id', '=', 'cg.id');
|
||||
$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');
|
||||
|
||||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
||||
public function setIndex() {
|
||||
$this->index = 'id'; //the column that needs to be treated as index column
|
||||
}
|
||||
|
||||
public function addColumns()
|
||||
{
|
||||
$this->addColumn([
|
||||
|
|
@ -67,13 +71,13 @@ class CustomerDataGrid extends AbsGrid
|
|||
}
|
||||
|
||||
public function prepareActions() {
|
||||
$this->prepareAction([
|
||||
$this->addAction([
|
||||
'type' => 'Edit',
|
||||
'route' => 'admin.customer.edit',
|
||||
'icon' => 'icon pencil-lg-icon'
|
||||
]);
|
||||
|
||||
$this->prepareAction([
|
||||
$this->addAction([
|
||||
'type' => 'Delete',
|
||||
'route' => 'admin.customer.delete',
|
||||
'icon' => 'icon trash-icon'
|
||||
|
|
@ -97,17 +101,4 @@ class CustomerDataGrid extends AbsGrid
|
|||
// ]
|
||||
// ]);
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
$this->addColumns();
|
||||
|
||||
$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]);
|
||||
}
|
||||
}
|
||||
|
|
@ -17,11 +17,15 @@ class CustomerGroupDataGrid extends AbsGrid
|
|||
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = DB::table('customer_groups')->select('id')->addSelect($this->columns);
|
||||
$queryBuilder = DB::table('customer_groups')->addSelect('id', 'name');
|
||||
|
||||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
||||
public function setIndex() {
|
||||
$this->index = 'id';
|
||||
}
|
||||
|
||||
public function addColumns()
|
||||
{
|
||||
$this->addColumn([
|
||||
|
|
@ -47,13 +51,13 @@ class CustomerGroupDataGrid extends AbsGrid
|
|||
}
|
||||
|
||||
public function prepareActions() {
|
||||
$this->prepareAction([
|
||||
$this->addAction([
|
||||
'type' => 'Edit',
|
||||
'route' => 'admin.customer.edit',
|
||||
'icon' => 'icon pencil-lg-icon'
|
||||
]);
|
||||
|
||||
$this->prepareAction([
|
||||
$this->addAction([
|
||||
'type' => 'Delete',
|
||||
'route' => 'admin.customer.delete',
|
||||
'icon' => 'icon trash-icon'
|
||||
|
|
@ -77,17 +81,4 @@ class CustomerGroupDataGrid extends AbsGrid
|
|||
// ]
|
||||
// ]);
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
$this->addColumns();
|
||||
|
||||
$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]);
|
||||
}
|
||||
}
|
||||
|
|
@ -17,15 +17,19 @@ class CustomerReviewDataGrid extends AbsGrid
|
|||
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = DB::table('product_reviews as pr')->select('pr.id')->addSelect($this->columns)->leftjoin('products_grid as pg', 'pr.product_id', '=', 'pg.id');
|
||||
$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');
|
||||
|
||||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
||||
public function setIndex() {
|
||||
$this->index = 'id';
|
||||
}
|
||||
|
||||
public function addColumns()
|
||||
{
|
||||
$this->addColumn([
|
||||
'column' => 'pr.id',
|
||||
'index' => 'pr.id',
|
||||
'alias' => 'reviewId',
|
||||
'label' => 'ID',
|
||||
'type' => 'number',
|
||||
|
|
@ -35,7 +39,7 @@ class CustomerReviewDataGrid extends AbsGrid
|
|||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'column' => 'pr.title',
|
||||
'index' => 'pr.title',
|
||||
'alias' => 'reviewTitle',
|
||||
'label' => 'Title',
|
||||
'type' => 'string',
|
||||
|
|
@ -45,7 +49,7 @@ class CustomerReviewDataGrid extends AbsGrid
|
|||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'column' => 'pr.comment',
|
||||
'index' => 'pr.comment',
|
||||
'alias' => 'reviewComment',
|
||||
'label' => 'Comment',
|
||||
'type' => 'string',
|
||||
|
|
@ -55,7 +59,7 @@ class CustomerReviewDataGrid extends AbsGrid
|
|||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'column' => 'pg.name',
|
||||
'index' => 'pg.name',
|
||||
'alias' => 'productName',
|
||||
'label' => 'Product',
|
||||
'type' => 'string',
|
||||
|
|
@ -65,7 +69,7 @@ class CustomerReviewDataGrid extends AbsGrid
|
|||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'column' => 'pr.status',
|
||||
'index' => 'pr.status',
|
||||
'alias' => 'reviewStatus',
|
||||
'label' => 'Status',
|
||||
'type' => 'boolean',
|
||||
|
|
@ -76,13 +80,13 @@ class CustomerReviewDataGrid extends AbsGrid
|
|||
}
|
||||
|
||||
public function prepareActions() {
|
||||
$this->prepareAction([
|
||||
$this->addAction([
|
||||
'type' => 'Edit',
|
||||
'route' => 'admin.customer.review.edit',
|
||||
'icon' => 'icon pencil-lg-icon'
|
||||
]);
|
||||
|
||||
$this->prepareAction([
|
||||
$this->addAction([
|
||||
'type' => 'Delete',
|
||||
'route' => 'admin.customer.review.delete',
|
||||
'icon' => 'icon trash-icon'
|
||||
|
|
@ -90,13 +94,13 @@ class CustomerReviewDataGrid extends AbsGrid
|
|||
}
|
||||
|
||||
public function prepareMassActions() {
|
||||
$this->prepareMassAction([
|
||||
$this->addMassAction([
|
||||
'type' => 'delete',
|
||||
'action' => route('admin.catalog.products.massdelete'),
|
||||
'method' => 'DELETE'
|
||||
]);
|
||||
|
||||
$this->prepareMassAction([
|
||||
$this->addMassAction([
|
||||
'type' => 'update',
|
||||
'action' => route('admin.catalog.products.massupdate'),
|
||||
'method' => 'PUT',
|
||||
|
|
@ -106,17 +110,4 @@ class CustomerReviewDataGrid extends AbsGrid
|
|||
]
|
||||
]);
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
$this->addColumns();
|
||||
|
||||
$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]);
|
||||
}
|
||||
}
|
||||
|
|
@ -17,15 +17,19 @@ class ExchangeRatesDataGrid extends AbsGrid
|
|||
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = DB::table('currency_exchange_rates as cer')->select('cer.id')->addSelect($this->columns)->leftJoin('currencies as curr', 'cer.target_currency', '=', 'curr.id');
|
||||
$queryBuilder = DB::table('currency_exchange_rates as cer')->addSelect('cer.id', 'curr.name', 'cer.rate')->leftJoin('currencies as curr', 'cer.target_currency', '=', 'curr.id');
|
||||
|
||||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
||||
public function setIndex() {
|
||||
$this->index = 'id';
|
||||
}
|
||||
|
||||
public function addColumns()
|
||||
{
|
||||
$this->addColumn([
|
||||
'column' => 'cer.id',
|
||||
'index' => 'cer.id',
|
||||
'alias' => 'exchId',
|
||||
'label' => 'ID',
|
||||
'type' => 'number',
|
||||
|
|
@ -35,7 +39,7 @@ class ExchangeRatesDataGrid extends AbsGrid
|
|||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'column' => 'curr.name',
|
||||
'index' => 'curr.name',
|
||||
'alias' => 'exchName',
|
||||
'label' => 'Currency Name',
|
||||
'type' => 'string',
|
||||
|
|
@ -45,7 +49,7 @@ class ExchangeRatesDataGrid extends AbsGrid
|
|||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'column' => 'cer.rate',
|
||||
'index' => 'cer.rate',
|
||||
'alias' => 'exchRate',
|
||||
'label' => 'Exchange Rate',
|
||||
'type' => 'string',
|
||||
|
|
@ -56,13 +60,13 @@ class ExchangeRatesDataGrid extends AbsGrid
|
|||
}
|
||||
|
||||
public function prepareActions() {
|
||||
$this->prepareAction([
|
||||
$this->addAction([
|
||||
'type' => 'Edit',
|
||||
'route' => 'admin.exchange_rates.edit',
|
||||
'icon' => 'icon pencil-lg-icon'
|
||||
]);
|
||||
|
||||
$this->prepareAction([
|
||||
$this->addAction([
|
||||
'type' => 'Delete',
|
||||
'route' => 'admin.exchange_rates.delete',
|
||||
'confirm_text' => trans('ui::app.datagrid.massaction.delete', ['resource' => 'Exchange Rate']),
|
||||
|
|
@ -87,17 +91,4 @@ class ExchangeRatesDataGrid extends AbsGrid
|
|||
// ]
|
||||
// ]);
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
$this->addColumns();
|
||||
|
||||
$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]);
|
||||
}
|
||||
}
|
||||
|
|
@ -17,15 +17,19 @@ class InventorySourcesDataGrid extends AbsGrid
|
|||
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = DB::table('inventory_sources')->select('id')->addSelect($this->columns);
|
||||
$queryBuilder = DB::table('inventory_sources')->addSelect('id', 'code', 'name', 'priority', 'status');
|
||||
|
||||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
||||
public function setIndex() {
|
||||
$this->index = 'id';
|
||||
}
|
||||
|
||||
public function addColumns()
|
||||
{
|
||||
$this->addColumn([
|
||||
'column' => 'id',
|
||||
'index' => 'id',
|
||||
'alias' => 'invId',
|
||||
'label' => 'ID',
|
||||
'type' => 'number',
|
||||
|
|
@ -35,7 +39,7 @@ class InventorySourcesDataGrid extends AbsGrid
|
|||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'column' => 'code',
|
||||
'index' => 'code',
|
||||
'alias' => 'invCode',
|
||||
'label' => 'Code',
|
||||
'type' => 'string',
|
||||
|
|
@ -45,7 +49,7 @@ class InventorySourcesDataGrid extends AbsGrid
|
|||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'column' => 'name',
|
||||
'index' => 'name',
|
||||
'alias' => 'invName',
|
||||
'label' => 'Name',
|
||||
'type' => 'string',
|
||||
|
|
@ -55,7 +59,7 @@ class InventorySourcesDataGrid extends AbsGrid
|
|||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'column' => 'priority',
|
||||
'index' => 'priority',
|
||||
'alias' => 'invPriority',
|
||||
'label' => 'Priority',
|
||||
'type' => 'string',
|
||||
|
|
@ -65,7 +69,7 @@ class InventorySourcesDataGrid extends AbsGrid
|
|||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'column' => 'status',
|
||||
'index' => 'status',
|
||||
'alias' => 'invStatus',
|
||||
'label' => 'Status',
|
||||
'type' => 'boolean',
|
||||
|
|
@ -76,13 +80,13 @@ class InventorySourcesDataGrid extends AbsGrid
|
|||
}
|
||||
|
||||
public function prepareActions() {
|
||||
$this->prepareAction([
|
||||
$this->addAction([
|
||||
'type' => 'Edit',
|
||||
'route' => 'admin.inventory_sources.edit',
|
||||
'icon' => 'icon pencil-lg-icon'
|
||||
]);
|
||||
|
||||
$this->prepareAction([
|
||||
$this->addAction([
|
||||
'type' => 'Delete',
|
||||
'route' => 'admin.inventory_sources.delete',
|
||||
'confirm_text' => trans('ui::app.datagrid.massaction.delete', ['resource' => 'Exchange Rate']),
|
||||
|
|
@ -107,17 +111,4 @@ class InventorySourcesDataGrid extends AbsGrid
|
|||
// ]
|
||||
// ]);
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
$this->addColumns();
|
||||
|
||||
$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]);
|
||||
}
|
||||
}
|
||||
|
|
@ -17,15 +17,19 @@ class LocalesDataGrid extends AbsGrid
|
|||
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = DB::table('locales')->select('id')->addSelect($this->columns);
|
||||
$queryBuilder = DB::table('locales')->addSelect('id', 'code', 'name');
|
||||
|
||||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
||||
public function setIndex() {
|
||||
$this->index = 'id';
|
||||
}
|
||||
|
||||
public function addColumns()
|
||||
{
|
||||
$this->addColumn([
|
||||
'column' => 'id',
|
||||
'index' => 'id',
|
||||
'alias' => 'localeId',
|
||||
'label' => 'ID',
|
||||
'type' => 'number',
|
||||
|
|
@ -35,7 +39,7 @@ class LocalesDataGrid extends AbsGrid
|
|||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'column' => 'code',
|
||||
'index' => 'code',
|
||||
'alias' => 'localeCode',
|
||||
'label' => 'Code',
|
||||
'type' => 'string',
|
||||
|
|
@ -45,7 +49,7 @@ class LocalesDataGrid extends AbsGrid
|
|||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'column' => 'name',
|
||||
'index' => 'name',
|
||||
'alias' => 'localeName',
|
||||
'label' => 'Name',
|
||||
'type' => 'string',
|
||||
|
|
@ -56,13 +60,13 @@ class LocalesDataGrid extends AbsGrid
|
|||
}
|
||||
|
||||
public function prepareActions() {
|
||||
$this->prepareAction([
|
||||
$this->addAction([
|
||||
'type' => 'Edit',
|
||||
'route' => 'admin.locales.edit',
|
||||
'icon' => 'icon pencil-lg-icon'
|
||||
]);
|
||||
|
||||
$this->prepareAction([
|
||||
$this->addAction([
|
||||
'type' => 'Delete',
|
||||
'route' => 'admin.locales.delete',
|
||||
'confirm_text' => trans('ui::app.datagrid.massaction.delete', ['resource' => 'Exchange Rate']),
|
||||
|
|
@ -87,17 +91,4 @@ class LocalesDataGrid extends AbsGrid
|
|||
// ]
|
||||
// ]);
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
$this->addColumns();
|
||||
|
||||
$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]);
|
||||
}
|
||||
}
|
||||
|
|
@ -17,15 +17,19 @@ class NewsLetterDataGrid extends AbsGrid
|
|||
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = DB::table('subscribers_list')->select('id')->addSelect($this->columns);
|
||||
$queryBuilder = DB::table('subscribers_list')->addSelect('id', 'is_subscribed', 'email');
|
||||
|
||||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
||||
public function setIndex() {
|
||||
$this->index = 'id';
|
||||
}
|
||||
|
||||
public function addColumns()
|
||||
{
|
||||
$this->addColumn([
|
||||
'column' => 'id',
|
||||
'index' => 'id',
|
||||
'alias' => 'subsId',
|
||||
'label' => 'ID',
|
||||
'type' => 'number',
|
||||
|
|
@ -35,7 +39,7 @@ class NewsLetterDataGrid extends AbsGrid
|
|||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'column' => 'is_subscribed',
|
||||
'index' => 'is_subscribed',
|
||||
'alias' => 'subsCode',
|
||||
'label' => 'Subscribed',
|
||||
'type' => 'string',
|
||||
|
|
@ -45,7 +49,7 @@ class NewsLetterDataGrid extends AbsGrid
|
|||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'column' => 'email',
|
||||
'index' => 'email',
|
||||
'alias' => 'subsEmail',
|
||||
'label' => 'Email',
|
||||
'type' => 'string',
|
||||
|
|
@ -56,13 +60,13 @@ class NewsLetterDataGrid extends AbsGrid
|
|||
}
|
||||
|
||||
public function prepareActions() {
|
||||
$this->prepareAction([
|
||||
$this->addAction([
|
||||
'type' => 'Edit',
|
||||
'route' => 'admin.customers.subscribers.edit',
|
||||
'icon' => 'icon pencil-lg-icon'
|
||||
]);
|
||||
|
||||
$this->prepareAction([
|
||||
$this->addAction([
|
||||
'type' => 'Delete',
|
||||
'route' => 'admin.customers.subscribers.delete',
|
||||
'confirm_text' => trans('ui::app.datagrid.massaction.delete', ['resource' => 'Exchange Rate']),
|
||||
|
|
@ -87,17 +91,4 @@ class NewsLetterDataGrid extends AbsGrid
|
|||
// ]
|
||||
// ]);
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
$this->addColumns();
|
||||
|
||||
$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]);
|
||||
}
|
||||
}
|
||||
|
|
@ -17,15 +17,19 @@ class RolesDataGrid extends AbsGrid
|
|||
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = DB::table('roles')->select('id')->addSelect($this->columns);
|
||||
$queryBuilder = DB::table('roles')->addSelect('id', 'name', 'permission_type');
|
||||
|
||||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
||||
public function setIndex() {
|
||||
$this->index = 'id';
|
||||
}
|
||||
|
||||
public function addColumns()
|
||||
{
|
||||
$this->addColumn([
|
||||
'column' => 'id',
|
||||
'index' => 'id',
|
||||
'alias' => 'roleId',
|
||||
'label' => 'ID',
|
||||
'type' => 'number',
|
||||
|
|
@ -35,7 +39,7 @@ class RolesDataGrid extends AbsGrid
|
|||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'column' => 'name',
|
||||
'index' => 'name',
|
||||
'alias' => 'roleName',
|
||||
'label' => 'Name',
|
||||
'type' => 'string',
|
||||
|
|
@ -45,7 +49,7 @@ class RolesDataGrid extends AbsGrid
|
|||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'column' => 'permission_type',
|
||||
'index' => 'permission_type',
|
||||
'alias' => 'roleType',
|
||||
'label' => 'Permission Type',
|
||||
'type' => 'string',
|
||||
|
|
@ -56,7 +60,7 @@ class RolesDataGrid extends AbsGrid
|
|||
}
|
||||
|
||||
public function prepareActions() {
|
||||
$this->prepareAction([
|
||||
$this->addAction([
|
||||
'type' => 'Edit',
|
||||
'route' => 'admin.roles.edit',
|
||||
'icon' => 'icon pencil-lg-icon'
|
||||
|
|
@ -80,17 +84,4 @@ class RolesDataGrid extends AbsGrid
|
|||
// ]
|
||||
// ]);
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
$this->addColumns();
|
||||
|
||||
$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]);
|
||||
}
|
||||
}
|
||||
|
|
@ -17,15 +17,19 @@ class SliderDataGrid extends AbsGrid
|
|||
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = DB::table('sliders as sl')->select('sl.id')->addSelect($this->columns)->leftJoin('channels as ch', 'sl.channel_id', '=', 'ch.id');
|
||||
$queryBuilder = DB::table('sliders as sl')->addSelect('sl.id', 'sl.title', 'ch.name')->leftJoin('channels as ch', 'sl.channel_id', '=', 'ch.id');
|
||||
|
||||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
||||
public function setIndex() {
|
||||
$this->index = 'id';
|
||||
}
|
||||
|
||||
public function addColumns()
|
||||
{
|
||||
$this->addColumn([
|
||||
'column' => 'sl.id',
|
||||
'index' => 'sl.id',
|
||||
'alias' => 'sliderId',
|
||||
'label' => 'ID',
|
||||
'type' => 'number',
|
||||
|
|
@ -35,7 +39,7 @@ class SliderDataGrid extends AbsGrid
|
|||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'column' => 'sl.title',
|
||||
'index' => 'sl.title',
|
||||
'alias' => 'sliderTitle',
|
||||
'label' => 'Tile',
|
||||
'type' => 'string',
|
||||
|
|
@ -45,7 +49,7 @@ class SliderDataGrid extends AbsGrid
|
|||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'column' => 'ch.name',
|
||||
'index' => 'ch.name',
|
||||
'alias' => 'channelName',
|
||||
'label' => 'Channel Name',
|
||||
'type' => 'string',
|
||||
|
|
@ -56,13 +60,13 @@ class SliderDataGrid extends AbsGrid
|
|||
}
|
||||
|
||||
public function prepareActions() {
|
||||
$this->prepareAction([
|
||||
$this->addAction([
|
||||
'type' => 'Edit',
|
||||
'route' => 'admin.sliders.edit',
|
||||
'icon' => 'icon pencil-lg-icon'
|
||||
]);
|
||||
|
||||
$this->prepareAction([
|
||||
$this->addAction([
|
||||
'type' => 'Delete',
|
||||
'route' => 'admin.sliders.delete',
|
||||
'icon' => 'icon trash-icon'
|
||||
|
|
@ -86,17 +90,4 @@ class SliderDataGrid extends AbsGrid
|
|||
// ]
|
||||
// ]);
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
$this->addColumns();
|
||||
|
||||
$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]);
|
||||
}
|
||||
}
|
||||
|
|
@ -17,15 +17,19 @@ class TaxCategoryDataGrid extends AbsGrid
|
|||
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = DB::table('tax_categories as tr')->select('tr.id')->addSelect($this->columns);
|
||||
$queryBuilder = DB::table('tax_categories')->addSelect('id', 'name', 'code');
|
||||
|
||||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
||||
public function setIndex() {
|
||||
$this->index = 'id';
|
||||
}
|
||||
|
||||
public function addColumns()
|
||||
{
|
||||
$this->addColumn([
|
||||
'column' => 'tr.id',
|
||||
'index' => 'id',
|
||||
'alias' => 'taxCatId',
|
||||
'label' => 'ID',
|
||||
'type' => 'number',
|
||||
|
|
@ -35,7 +39,7 @@ class TaxCategoryDataGrid extends AbsGrid
|
|||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'column' => 'tr.name',
|
||||
'index' => 'name',
|
||||
'alias' => 'taxCatName',
|
||||
'label' => 'Name',
|
||||
'type' => 'string',
|
||||
|
|
@ -45,7 +49,7 @@ class TaxCategoryDataGrid extends AbsGrid
|
|||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'column' => 'tr.code',
|
||||
'index' => 'code',
|
||||
'alias' => 'taxCatCode',
|
||||
'label' => 'Code',
|
||||
'type' => 'string',
|
||||
|
|
@ -56,13 +60,13 @@ class TaxCategoryDataGrid extends AbsGrid
|
|||
}
|
||||
|
||||
public function prepareActions() {
|
||||
$this->prepareAction([
|
||||
$this->addAction([
|
||||
'type' => 'Edit',
|
||||
'route' => 'admin.tax-categories.edit',
|
||||
'icon' => 'icon pencil-lg-icon'
|
||||
]);
|
||||
|
||||
$this->prepareAction([
|
||||
$this->addAction([
|
||||
'type' => 'Delete',
|
||||
'route' => 'admin.tax-categories.delete',
|
||||
'icon' => 'icon trash-icon'
|
||||
|
|
@ -86,17 +90,4 @@ class TaxCategoryDataGrid extends AbsGrid
|
|||
// ]
|
||||
// ]);
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
$this->addColumns();
|
||||
|
||||
$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]);
|
||||
}
|
||||
}
|
||||
|
|
@ -17,15 +17,19 @@ class TaxRateDataGrid extends AbsGrid
|
|||
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = DB::table('tax_rates as tr')->select('tr.id')->addSelect($this->columns);
|
||||
$queryBuilder = DB::table('tax_rates')->addSelect('id', 'identifier', 'state', 'country', 'tax_rate');
|
||||
|
||||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
||||
public function setIndex() {
|
||||
$this->index = 'id';
|
||||
}
|
||||
|
||||
public function addColumns()
|
||||
{
|
||||
$this->addColumn([
|
||||
'column' => 'tr.id',
|
||||
'index' => 'id',
|
||||
'alias' => 'taxRateId',
|
||||
'label' => 'ID',
|
||||
'type' => 'number',
|
||||
|
|
@ -35,7 +39,7 @@ class TaxRateDataGrid extends AbsGrid
|
|||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'column' => 'tr.identifier',
|
||||
'index' => 'identifier',
|
||||
'alias' => 'taxRateName',
|
||||
'label' => 'Identifier',
|
||||
'type' => 'string',
|
||||
|
|
@ -45,7 +49,7 @@ class TaxRateDataGrid extends AbsGrid
|
|||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'column' => 'tr.state',
|
||||
'index' => 'state',
|
||||
'alias' => 'taxRateState',
|
||||
'label' => 'State',
|
||||
'type' => 'string',
|
||||
|
|
@ -55,7 +59,7 @@ class TaxRateDataGrid extends AbsGrid
|
|||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'column' => 'tr.country',
|
||||
'index' => 'country',
|
||||
'alias' => 'taxRateCountry',
|
||||
'label' => 'Country',
|
||||
'type' => 'string',
|
||||
|
|
@ -65,7 +69,7 @@ class TaxRateDataGrid extends AbsGrid
|
|||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'column' => 'tr.tax_rate',
|
||||
'index' => 'tax_rate',
|
||||
'alias' => 'taxRate',
|
||||
'label' => 'Rate',
|
||||
'type' => 'string',
|
||||
|
|
@ -76,13 +80,13 @@ class TaxRateDataGrid extends AbsGrid
|
|||
}
|
||||
|
||||
public function prepareActions() {
|
||||
$this->prepareAction([
|
||||
$this->addAction([
|
||||
'type' => 'Edit',
|
||||
'route' => 'admin.tax-categories.edit',
|
||||
'icon' => 'icon pencil-lg-icon'
|
||||
]);
|
||||
|
||||
$this->prepareAction([
|
||||
$this->addAction([
|
||||
'type' => 'Delete',
|
||||
'route' => 'admin.tax-categories.delete',
|
||||
'icon' => 'icon trash-icon'
|
||||
|
|
@ -106,17 +110,4 @@ class TaxRateDataGrid extends AbsGrid
|
|||
// ]
|
||||
// ]);
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
$this->addColumns();
|
||||
|
||||
$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]);
|
||||
}
|
||||
}
|
||||
|
|
@ -17,15 +17,23 @@ class TestDataGrid extends AbsGrid
|
|||
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = DB::table('products_grid')->select('product_id as id')->addSelect($this->columns)->leftJoin('products', 'products_grid.product_id', '=', 'products.id')->where('products.parent_id', '=', null);
|
||||
$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([
|
||||
'column' => 'products_grid.product_id',
|
||||
'index' => 'products_grid.product_id',
|
||||
'alias' => 'productid',
|
||||
'label' => 'ID',
|
||||
'type' => 'number',
|
||||
|
|
@ -35,7 +43,7 @@ class TestDataGrid extends AbsGrid
|
|||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'column' => 'products_grid.sku',
|
||||
'index' => 'products_grid.sku',
|
||||
'alias' => 'productsku',
|
||||
'label' => 'SKU',
|
||||
'type' => 'string',
|
||||
|
|
@ -45,7 +53,7 @@ class TestDataGrid extends AbsGrid
|
|||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'column' => 'products_grid.name',
|
||||
'index' => 'products_grid.name',
|
||||
'alias' => 'productname',
|
||||
'label' => 'Name',
|
||||
'type' => 'string',
|
||||
|
|
@ -55,7 +63,7 @@ class TestDataGrid extends AbsGrid
|
|||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'column' => 'products.type',
|
||||
'index' => 'products.type',
|
||||
'alias' => 'producttype',
|
||||
'label' => 'Type',
|
||||
'type' => 'string',
|
||||
|
|
@ -65,7 +73,7 @@ class TestDataGrid extends AbsGrid
|
|||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'column' => 'products_grid.status',
|
||||
'index' => 'products_grid.status',
|
||||
'alias' => 'productstatus',
|
||||
'label' => 'Status',
|
||||
'type' => 'boolean',
|
||||
|
|
@ -75,7 +83,7 @@ class TestDataGrid extends AbsGrid
|
|||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'column' => 'products_grid.price',
|
||||
'index' => 'products_grid.price',
|
||||
'alias' => 'productprice',
|
||||
'label' => 'Price',
|
||||
'type' => 'number',
|
||||
|
|
@ -85,7 +93,8 @@ class TestDataGrid extends AbsGrid
|
|||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'column' => 'products_grid.quantity',
|
||||
// 'column' => 'products_grid.quantity',
|
||||
'index' => 'products_grid.quantity',
|
||||
'alias' => 'productqty',
|
||||
'label' => 'Quantity',
|
||||
'type' => 'number',
|
||||
|
|
@ -96,13 +105,13 @@ class TestDataGrid extends AbsGrid
|
|||
}
|
||||
|
||||
public function prepareActions() {
|
||||
$this->prepareAction([
|
||||
$this->addAction([
|
||||
'type' => 'Edit',
|
||||
'route' => 'admin.catalog.products.edit',
|
||||
'icon' => 'icon pencil-lg-icon'
|
||||
]);
|
||||
|
||||
$this->prepareAction([
|
||||
$this->addAction([
|
||||
'type' => 'Delete',
|
||||
'route' => 'admin.catalog.products.delete',
|
||||
'confirm_text' => trans('ui::app.datagrid.massaction.delete', ['resource' => 'product']),
|
||||
|
|
@ -111,13 +120,13 @@ class TestDataGrid extends AbsGrid
|
|||
}
|
||||
|
||||
public function prepareMassActions() {
|
||||
$this->prepareMassAction([
|
||||
$this->addMassAction([
|
||||
'type' => 'delete',
|
||||
'action' => route('admin.catalog.products.massdelete'),
|
||||
'method' => 'DELETE'
|
||||
]);
|
||||
|
||||
$this->prepareMassAction([
|
||||
$this->addMassAction([
|
||||
'type' => 'update',
|
||||
'action' => route('admin.catalog.products.massupdate'),
|
||||
'method' => 'PUT',
|
||||
|
|
@ -127,17 +136,4 @@ class TestDataGrid extends AbsGrid
|
|||
]
|
||||
]);
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
$this->addColumns();
|
||||
|
||||
$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,192 +2,113 @@
|
|||
|
||||
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' => 'string',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'width' => '100px',
|
||||
'wrapper' => function($value) {
|
||||
if($value == 0) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'index' => 'u.email',
|
||||
'alias' => 'adminEmail',
|
||||
'label' => 'Email',
|
||||
'type' => 'string',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'width' => '100px'
|
||||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'index' => 'ro.name',
|
||||
'alias' => 'rolename',
|
||||
'label' => 'Role',
|
||||
'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,
|
||||
// ]
|
||||
// ]);
|
||||
}
|
||||
}
|
||||
|
|
@ -11,31 +11,22 @@ use Illuminate\Http\Request;
|
|||
*/
|
||||
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 render();
|
||||
abstract public function setIndex();
|
||||
|
||||
/**
|
||||
* Parse the URL and get it ready to be used.
|
||||
|
|
@ -57,11 +48,7 @@ abstract class AbsGrid
|
|||
|
||||
public function addColumn($column)
|
||||
{
|
||||
if (isset($column['alias'])) {
|
||||
array_push($this->columns, $column['column'].' as '. $column['alias']);
|
||||
} else {
|
||||
array_push($this->columns, $column['column']);
|
||||
}
|
||||
array_push($this->columns, $column);
|
||||
|
||||
$this->setAllColumnDetails($column);
|
||||
}
|
||||
|
|
@ -76,11 +63,13 @@ abstract class AbsGrid
|
|||
$this->queryBuilder = $queryBuilder;
|
||||
}
|
||||
|
||||
public function prepareAction($action) {
|
||||
public function addAction($action)
|
||||
{
|
||||
array_push($this->actions, $action);
|
||||
}
|
||||
|
||||
public function prepareMassAction($massAction) {
|
||||
public function addMassAction($massAction)
|
||||
{
|
||||
array_push($this->massActions, $massAction);
|
||||
}
|
||||
|
||||
|
|
@ -109,7 +98,7 @@ abstract class AbsGrid
|
|||
if ($this->collection) {
|
||||
return $this->collection;
|
||||
} else {
|
||||
return $this->collection;
|
||||
dd('no records found');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -121,28 +110,30 @@ abstract class AbsGrid
|
|||
public function findColumnType($columnAlias) {
|
||||
foreach($this->allColumns as $column) {
|
||||
if($column['alias'] == $columnAlias) {
|
||||
return [$column['type'], $column['column']];
|
||||
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") {
|
||||
//case that don't need any resolving
|
||||
$count_keys = count(array_keys($info));
|
||||
|
||||
if ($count_keys == 1) {
|
||||
return $collection->orderBy(
|
||||
str_replace('_', '.', array_keys($info)[0]),
|
||||
array_values($info)[0]
|
||||
);
|
||||
} else {
|
||||
throw new \Exception('Multiple Sort keys Found, Please Resolve the URL Manually');
|
||||
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));
|
||||
|
||||
|
|
@ -150,11 +141,11 @@ abstract class AbsGrid
|
|||
throw new \Exception('Multiple Search keys Found, Please Resolve the URL Manually');
|
||||
}
|
||||
|
||||
if ($count_keys == 1) {
|
||||
return $collection->where(function () use($collection, $info) {
|
||||
if($count_keys == 1) {
|
||||
return $collection->where(function() use($collection, $info) {
|
||||
foreach ($this->allColumns as $column) {
|
||||
if($column['searchable'] == true)
|
||||
$collection->orWhere($column['column'], 'like', '%'.$info['all'].'%');
|
||||
$collection->orWhere($column['index'], 'like', '%'.$info['all'].'%');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -187,4 +178,19 @@ abstract class AbsGrid
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
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,28 +1,29 @@
|
|||
<tbody>
|
||||
@foreach($records as $key => $record)
|
||||
{{-- {{ dd($record) }} --}}
|
||||
|
||||
<tr>
|
||||
<?php $i=0 ?>
|
||||
@foreach($record as $key => $column)
|
||||
@if($i == 0)
|
||||
<td>
|
||||
<span class="checkbox">
|
||||
<input type="checkbox" v-model="dataIds" @change="select" :value="{{ $column }}">
|
||||
<label class="checkbox-view" for="checkbox1"></label>
|
||||
</span>
|
||||
</td>
|
||||
@endif
|
||||
<td>
|
||||
<span class="checkbox">
|
||||
<input type="checkbox" v-model="dataIds" @change="select" :value="{{ $record->{$index} }}">
|
||||
|
||||
@if($i > 0)
|
||||
<td>{{ $column }}</td>
|
||||
@endif
|
||||
<label class="checkbox-view" for="checkbox1"></label>
|
||||
</span>
|
||||
</td>
|
||||
|
||||
<?php $i++ ?>
|
||||
@foreach($record as $column)
|
||||
@if(isset($columns[$key]))
|
||||
@if(isset($columns[$key]['wrapper']))
|
||||
|
||||
@endif
|
||||
@endif
|
||||
<td>{{ $column }}</td>
|
||||
@endforeach
|
||||
|
||||
<td style="width: 50px;">
|
||||
<div class="actions">
|
||||
@foreach($actions as $action)
|
||||
<a href="{{ route($action['route'], $record->id) }}">
|
||||
<a href="{{ route($action['route'], $record->{$index}) }}">
|
||||
<span class="{{ $action['icon'] }}"></span>
|
||||
</a>
|
||||
@endforeach
|
||||
|
|
|
|||
|
|
@ -160,6 +160,7 @@
|
|||
|
||||
<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">
|
||||
|
|
@ -193,22 +194,24 @@
|
|||
</th>
|
||||
|
||||
@foreach($results['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>
|
||||
<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']])
|
||||
@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: () => ({
|
||||
|
|
@ -226,6 +229,9 @@
|
|||
allSelected: false,
|
||||
sortDesc: 'desc',
|
||||
sortAsc: 'asc',
|
||||
sortUpIcon: 'sort-up-icon',
|
||||
sortDownIcon: 'sort-down-icon',
|
||||
currentSortIcon: null,
|
||||
isActive: false,
|
||||
isHidden: true,
|
||||
searchValue: '',
|
||||
|
|
@ -245,7 +251,7 @@
|
|||
stringConditionSelect: false,
|
||||
booleanConditionSelect: false,
|
||||
numberConditionSelect: false,
|
||||
datetimeConditionSelect: false,
|
||||
datetimeConditionSelect: false
|
||||
}),
|
||||
|
||||
mounted: function() {
|
||||
|
|
@ -348,6 +354,12 @@
|
|||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue