diff --git a/packages/Webkul/Admin/src/DataGrids/AttributeFamilyDataGrid.php b/packages/Webkul/Admin/src/DataGrids/AttributeFamilyDataGrid.php new file mode 100644 index 000000000..2fdc93ddd --- /dev/null +++ b/packages/Webkul/Admin/src/DataGrids/AttributeFamilyDataGrid.php @@ -0,0 +1,155 @@ + @prashant-webkul + * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) + */ + +class AttributeFamilyDataGrid +{ + /** + * The Data Grid implementation. + * + * @var CountryComposer + * for countries + */ + + public function createAttributeFamilyDataGrid() + { + + 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 + + '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 do this?', + 'icon' => 'icon pencil-lg-icon', + ], [ + 'type' => 'Delete', + 'route' => route('admin.datagrid.delete'), + 'confirm_text' => 'Do you really want to do this?', + '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' => 'attribute_family_id', + 'type' => 'number', + 'label' => 'ID', + 'sortable' => true, + ], + [ + 'name' => 'code', + 'alias' => 'attribute_family_code', + 'type' => 'string', + 'label' => 'Code', + 'sortable' => true, + ], + [ + 'name' => 'name', + 'alias' => 'attribute_family_name', + 'type' => 'string', + 'label' => 'Code', + 'sortable' => true, + ], + ], + + 'filterable' => [ + [ + 'column' => 'id', + 'alias' => 'attribute_family_id', + 'type' => 'number', + 'label' => 'ID', + ], + [ + 'column' => 'code', + 'alias' => 'attribute_family_code', + 'type' => 'string', + 'label' => 'Code', + ], + [ + 'column' => 'name', + 'alias' => 'attribute_family_name', + '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 render() + { + + return $this->createAttributeFamilyDataGrid()->render(); + + } +} \ No newline at end of file diff --git a/packages/Webkul/Admin/src/DataGrids/ChannelsDataGrid.php b/packages/Webkul/Admin/src/DataGrids/ChannelDataGrid.php similarity index 99% rename from packages/Webkul/Admin/src/DataGrids/ChannelsDataGrid.php rename to packages/Webkul/Admin/src/DataGrids/ChannelDataGrid.php index 2efa69aeb..b2ef60053 100644 --- a/packages/Webkul/Admin/src/DataGrids/ChannelsDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/ChannelDataGrid.php @@ -13,7 +13,7 @@ use Webkul\Ui\DataGrid\Facades\DataGrid; * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) */ -class ChannelsDataGrid +class ChannelDataGrid { /** * The Data Grid implementation. diff --git a/packages/Webkul/Admin/src/DataGrids/CurrenciesDataGrid.php b/packages/Webkul/Admin/src/DataGrids/CurrencyDataGrid.php similarity index 99% rename from packages/Webkul/Admin/src/DataGrids/CurrenciesDataGrid.php rename to packages/Webkul/Admin/src/DataGrids/CurrencyDataGrid.php index ec58fad13..d23fba390 100644 --- a/packages/Webkul/Admin/src/DataGrids/CurrenciesDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/CurrencyDataGrid.php @@ -12,7 +12,7 @@ use Webkul\Ui\DataGrid\Facades\DataGrid; * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) */ -class CurrenciesDataGrid +class CurrencyDataGrid { /** * The Data Grid implementation. diff --git a/packages/Webkul/Admin/src/Resources/views/catalog/families/index.blade.php b/packages/Webkul/Admin/src/Resources/views/catalog/families/index.blade.php index e9a0ec81e..504bf291b 100644 --- a/packages/Webkul/Admin/src/Resources/views/catalog/families/index.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/catalog/families/index.blade.php @@ -15,7 +15,8 @@