diff --git a/packages/Webkul/Admin/src/DataGrids/AttributeDataGrid.php b/packages/Webkul/Admin/src/DataGrids/AttributeDataGrid.php new file mode 100644 index 000000000..640e10ebd --- /dev/null +++ b/packages/Webkul/Admin/src/DataGrids/AttributeDataGrid.php @@ -0,0 +1,191 @@ + @prashant-webkul + * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) + */ + +class AttributeDataGrid +{ + /** + * The Data Grid implementation. + * + * @var AttributeDataGrid + * for countries + */ + + public function createAttributeDataGrid() + { + + return DataGrid::make([ + 'name' => 'Attributes', + 'table' => 'attributes', + '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' => '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' => 'AdminName', + 'sortable' => true, + ], + [ + 'name' => 'type', + 'alias' => 'attributeType', + 'type' => 'string', + 'label' => 'Type', + 'sortable' => true, + ], + [ + 'name' => 'is_required', + 'alias' => 'attributeIsRequired', + 'type' => 'string', + 'label' => 'Required', + 'sortable' => true, + ], + [ + 'name' => 'is_unique', + 'alias' => 'attributeIsUnique', + 'type' => 'string', + 'label' => 'Unique', + 'sortable' => true, + ], + [ + 'name' => 'value_per_locale', + 'alias' => 'attributeValuePerLocale', + 'type' => 'string', + 'label' => 'ValuePerLocale', + 'sortable' => true, + ], + [ + 'name' => 'value_per_channel', + 'alias' => 'attributeValuePerChannel', + 'type' => 'string', + 'label' => 'ValuePerChannel', + '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->createAttributeDataGrid()->render(); + + } +} \ No newline at end of file diff --git a/packages/Webkul/Admin/src/DataGrids/AttributeFamilyDataGrid.php b/packages/Webkul/Admin/src/DataGrids/AttributeFamilyDataGrid.php index 2fdc93ddd..9a5dc85c4 100644 --- a/packages/Webkul/Admin/src/DataGrids/AttributeFamilyDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/AttributeFamilyDataGrid.php @@ -7,7 +7,7 @@ use Webkul\Ui\DataGrid\Facades\DataGrid; /** - * Countries DataGrid + * Attributes Family DataGrid * * @author Prashant Singh @prashant-webkul * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) @@ -71,21 +71,21 @@ class AttributeFamilyDataGrid [ 'name' => 'id', - 'alias' => 'attribute_family_id', + 'alias' => 'attributeFamilyId', 'type' => 'number', 'label' => 'ID', 'sortable' => true, ], [ 'name' => 'code', - 'alias' => 'attribute_family_code', + 'alias' => 'attributeFamilyCode', 'type' => 'string', 'label' => 'Code', 'sortable' => true, ], [ 'name' => 'name', - 'alias' => 'attribute_family_name', + 'alias' => 'attributeFamilyName', 'type' => 'string', 'label' => 'Code', 'sortable' => true, @@ -95,19 +95,19 @@ class AttributeFamilyDataGrid 'filterable' => [ [ 'column' => 'id', - 'alias' => 'attribute_family_id', + 'alias' => 'attributeFamilyId', 'type' => 'number', 'label' => 'ID', ], [ 'column' => 'code', - 'alias' => 'attribute_family_code', + 'alias' => 'attributeFamilyCode', 'type' => 'string', 'label' => 'Code', ], [ 'column' => 'name', - 'alias' => 'attribute_family_name', + 'alias' => 'attributeFamilyName', 'type' => 'string', 'label' => 'Name', ], diff --git a/packages/Webkul/Admin/src/DataGrids/CategoryDataGrid.php b/packages/Webkul/Admin/src/DataGrids/CategoryDataGrid.php new file mode 100644 index 000000000..5f85e2f2d --- /dev/null +++ b/packages/Webkul/Admin/src/DataGrids/CategoryDataGrid.php @@ -0,0 +1,172 @@ + @prashant-webkul + * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) + */ + +class CategoryDataGrid +{ + /** + * The Data Grid implementation. + * + * @var AttributeDataGrid + * for countries + */ + + public function createCategoryDataGrid() + { + + 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 + + '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' => 'category_translations as ct', + 'primaryKey' => 'cat.id', + 'condition' => '=', + 'secondaryKey' => 'ct.category_id', + ], [ + 'join' => 'leftjoin', + 'table' => 'category_translations as cta', + 'primaryKey' => 'cat.parent_id', + 'condition' => '=', + 'secondaryKey' => 'cta.category_id', + ], + + ], + + //use aliasing on secodary columns if join is performed + + 'columns' => [ + [ + 'name' => 'cat.id', + 'alias' => 'catID', + 'type' => 'number', + 'label' => 'Category ID', + 'sortable' => true, + ], [ + 'name' => 'ct.name', + 'alias' => 'catName', + 'type' => 'string', + 'label' => 'Category Name', + 'sortable' => false, + ], [ + 'name' => 'cat.position', + 'alias' => 'catPosition', + 'type' => 'string', + 'label' => 'Category Position', + 'sortable' => false, + ], [ + 'name' => 'cta.name', + 'alias' => 'parentName', + 'type' => 'string', + 'label' => 'Parent Name', + 'sortable' => true, + ], [ + 'name' => 'cat.status', + 'alias' => 'catStatus', + 'type' => 'string', + 'label' => 'Visible in Menu', + '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->createCategoryDataGrid()->render(); + + } +} \ No newline at end of file diff --git a/packages/Webkul/Admin/src/DataGrids/ChannelDataGrid.php b/packages/Webkul/Admin/src/DataGrids/ChannelDataGrid.php index b2ef60053..582ddc9e0 100644 --- a/packages/Webkul/Admin/src/DataGrids/ChannelDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/ChannelDataGrid.php @@ -98,19 +98,19 @@ class ChannelDataGrid 'filterable' => [ [ 'column' => 'id', - 'alias' => 'channel_id', + 'alias' => 'channelId', 'type' => 'number', 'label' => 'Channel ID', ], [ 'column' => 'code', - 'alias' => 'channel_code', + 'alias' => 'channelCode', 'type' => 'string', 'label' => 'Channel Code', ], [ 'column' => 'name', - 'alias' => 'channel_name', + 'alias' => 'channelName', 'type' => 'string', 'label' => 'Channel Name', ], diff --git a/packages/Webkul/Admin/src/DataGrids/CountryDataGrid.php b/packages/Webkul/Admin/src/DataGrids/CountryDataGrid.php index a3e91cbad..a5c0ddec3 100644 --- a/packages/Webkul/Admin/src/DataGrids/CountryDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/CountryDataGrid.php @@ -71,28 +71,28 @@ class CountryDataGrid [ 'name' => 'id', - 'alias' => 'country_id', + 'alias' => 'countryId', 'type' => 'number', 'label' => 'ID', 'sortable' => true, ], [ 'name' => 'code', - 'alias' => 'country_code', + 'alias' => 'countryCode', 'type' => 'string', 'label' => 'Code', 'sortable' => true, ], [ 'name' => 'name', - 'alias' => 'country_name', + 'alias' => 'countryName', 'type' => 'string', 'label' => 'Name', 'sortable' => true, ], [ 'name' => 'status', - 'alias' => 'country_status', + 'alias' => 'countryStatus', 'type' => 'number', 'label' => 'Code', 'sortable' => true, @@ -105,25 +105,25 @@ class CountryDataGrid 'filterable' => [ [ 'column' => 'id', - 'alias' => 'country_id', + 'alias' => 'countryId', 'type' => 'number', 'label' => 'ID', ], [ 'column' => 'code', - 'alias' => 'country_code', + 'alias' => 'countryCode', 'type' => 'string', 'label' => 'Code', ], [ 'column' => 'name', - 'alias' => 'country_name', + 'alias' => 'countryName', 'type' => 'string', 'label' => 'Name', ], [ 'column' => 'status', - 'alias' => 'country_status', + 'alias' => 'countryStatus', 'type' => 'number', 'label' => 'Code', ], diff --git a/packages/Webkul/Admin/src/DataGrids/CurrencyDataGrid.php b/packages/Webkul/Admin/src/DataGrids/CurrencyDataGrid.php index d23fba390..e672a7fe0 100644 --- a/packages/Webkul/Admin/src/DataGrids/CurrencyDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/CurrencyDataGrid.php @@ -70,21 +70,21 @@ class CurrencyDataGrid [ 'name' => 'id', - 'alias' => 'currency_id', + 'alias' => 'currencyId', 'type' => 'number', 'label' => 'ID', 'sortable' => true, ], [ 'name' => 'code', - 'alias' => 'currency_code', + 'alias' => 'currencyCode', 'type' => 'string', 'label' => 'Code', 'sortable' => true, ], [ 'name' => 'name', - 'alias' => 'currency_name', + 'alias' => 'currencyName', 'type' => 'string', 'label' => 'Name', 'sortable' => true, @@ -97,19 +97,19 @@ class CurrencyDataGrid 'filterable' => [ [ 'column' => 'id', - 'alias' => 'currency_id', + 'alias' => 'currencyId', 'type' => 'number', 'label' => 'ID', ], [ 'column' => 'code', - 'alias' => 'currency_code', + 'alias' => 'currencyCode', 'type' => 'string', 'label' => 'Code', ], [ 'column' => 'name', - 'alias' => 'currency_name', + 'alias' => 'currencyName', 'type' => 'string', 'label' => 'Name', ], diff --git a/packages/Webkul/Admin/src/DataGrids/ExchangeRatesDataGrid.php b/packages/Webkul/Admin/src/DataGrids/ExchangeRatesDataGrid.php index a2f66ae0d..af954a73a 100644 --- a/packages/Webkul/Admin/src/DataGrids/ExchangeRatesDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/ExchangeRatesDataGrid.php @@ -71,28 +71,28 @@ class ExchangeRatesDataGrid [ 'name' => 'id', - 'alias' => 'exch_id', + 'alias' => 'exchID', 'type' => 'number', 'label' => 'Rate ID', 'sortable' => true, ], [ 'name' => 'source_currency', - 'alias' => 'exch_source_currency', + 'alias' => 'exchSourceCurrency', 'type' => 'string', 'label' => 'Source Currency', 'sortable' => true, ], [ 'name' => 'target_currency', - 'alias' => 'exch_target_currency', + 'alias' => 'exchTargetCurrency', 'type' => 'string', 'label' => 'Target Currency', 'sortable' => true, ], [ 'name' => 'ratio', - 'alias' => 'exch_ratio', + 'alias' => 'exchRatio', 'type' => 'string', 'label' => 'Exchange Ratio', ], @@ -104,20 +104,20 @@ class ExchangeRatesDataGrid 'filterable' => [ [ 'column' => 'id', - 'alias' => 'exch_id', + 'alias' => 'exchId', 'type' => 'number', 'label' => 'Rate ID', ], [ 'column' => 'source_currency', - 'alias' => 'exch_source_currency', + 'alias' => 'exchSourceCurrency', 'type' => 'string', 'label' => 'Source Currency', 'sortable' => true, ], [ 'column' => 'target_currency', - 'alias' => 'exch_target_currency', + 'alias' => 'exchTargetCurrency', 'type' => 'string', 'label' => 'Target Currency', 'sortable' => true, diff --git a/packages/Webkul/Admin/src/DataGrids/InventorySourcesDataGrid.php b/packages/Webkul/Admin/src/DataGrids/InventorySourcesDataGrid.php index 2c17f7457..5bad6e70a 100644 --- a/packages/Webkul/Admin/src/DataGrids/InventorySourcesDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/InventorySourcesDataGrid.php @@ -69,35 +69,35 @@ class InventorySourcesDataGrid [ 'name' => 'id', - 'alias' => 'inventory_id', + 'alias' => 'inventoryID', 'type' => 'number', 'label' => 'ID', 'sortable' => true, ], [ 'name' => 'code', - 'alias' => 'inventory_code', + 'alias' => 'inventoryCode', 'type' => 'string', 'label' => 'Code', 'sortable' => true, ], [ 'name' => 'name', - 'alias' => 'inventory_name', + 'alias' => 'inventoryName', 'type' => 'string', 'label' => 'Name', 'sortable' => true, ], [ 'name' => 'priority', - 'alias' => 'inventory_priority', + 'alias' => 'inventoryPriority', 'type' => 'string', 'label' => 'Priority', 'sortable' => true, ], [ 'name' => 'status', - 'alias' => 'inventory_status', + 'alias' => 'inventoryStatus', 'type' => 'string', 'label' => 'Status', 'sortable' => true, @@ -110,19 +110,19 @@ class InventorySourcesDataGrid 'filterable' => [ [ 'column' => 'id', - 'alias' => 'inventory_id', + 'alias' => 'inventoryId', 'type' => 'number', 'label' => 'ID', ], [ 'column' => 'code', - 'alias' => 'inventory_code', + 'alias' => 'inventoryCode', 'type' => 'string', 'label' => 'Code', ], [ 'column' => 'name', - 'alias' => 'inventory_name', + 'alias' => 'inventoryName', 'type' => 'string', 'label' => 'Name', ], diff --git a/packages/Webkul/Admin/src/DataGrids/LocalesDataGrid.php b/packages/Webkul/Admin/src/DataGrids/LocalesDataGrid.php index ff2abe687..1f53304e4 100644 --- a/packages/Webkul/Admin/src/DataGrids/LocalesDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/LocalesDataGrid.php @@ -70,21 +70,21 @@ class LocalesDataGrid [ 'name' => 'id', - 'alias' => 'locale_id', + 'alias' => 'localeId', 'type' => 'number', 'label' => 'ID', 'sortable' => true, ], [ 'name' => 'code', - 'alias' => 'locale_code', + 'alias' => 'localeCode', 'type' => 'string', 'label' => 'Code', 'sortable' => true, ], [ 'name' => 'name', - 'alias' => 'locale_name', + 'alias' => 'localeName', 'type' => 'string', 'label' => 'Name', 'sortable' => true, @@ -97,19 +97,19 @@ class LocalesDataGrid 'filterable' => [ [ 'column' => 'id', - 'alias' => 'locale_id', + 'alias' => 'localeId', 'type' => 'number', 'label' => 'ID', ], [ 'column' => 'code', - 'alias' => 'locale_code', + 'alias' => 'localeCode', 'type' => 'string', 'label' => 'Code', ], [ 'column' => 'name', - 'alias' => 'locale_name', + 'alias' => 'localeName', 'type' => 'string', 'label' => 'Name', ], diff --git a/packages/Webkul/Admin/src/DataGrids/ProductDataGrid.php b/packages/Webkul/Admin/src/DataGrids/ProductDataGrid.php new file mode 100644 index 000000000..ee6970333 --- /dev/null +++ b/packages/Webkul/Admin/src/DataGrids/ProductDataGrid.php @@ -0,0 +1,129 @@ + @prashant-webkul + * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) + */ + +class ProductDataGrid +{ + /** + * The Data Grid implementation. + * + * @var AttributProductDataGrideDataGrid + * for countries + */ + + public function createProductDataGrid() + { + + return DataGrid::make([ + 'name' => 'Products', + 'table' => 'products as pr', + 'select' => 'pr.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', + ], + ], + + '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' => 'category_translations as ct', + // 'primaryKey' => 'cat.id', + // 'condition' => '=', + // 'secondaryKey' => 'ct.category_id', + // ], [ + // 'join' => 'leftjoin', + // 'table' => 'category_translations as cta', + // 'primaryKey' => 'cat.parent_id', + // 'condition' => '=', + // 'secondaryKey' => 'cta.category_id', + // ], + + ], + + //use aliasing on secodary columns if join is performed + + 'columns' => [ + //name, alias, type, label, sortable + [ + 'name' => 'pr.id', + 'alias' => 'productID', + 'type' => 'number', + 'label' => 'Product ID', + 'sortable' => true, + ], + [ + 'name' => 'pr.sku', + 'alias' => 'productCode', + 'type' => 'number', + 'label' => 'Product Code', + 'sortable' => true, + ], + ], + + 'filterable' => [ + + ], + + //don't use aliasing in case of searchables + + 'searchable' => [ + //column, type and label + ], + + //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->createProductDataGrid()->render(); + + } +} \ No newline at end of file diff --git a/packages/Webkul/Admin/src/DataGrids/RolesDataGrid.php b/packages/Webkul/Admin/src/DataGrids/RolesDataGrid.php index bc6d46f04..ab8d08b8b 100644 --- a/packages/Webkul/Admin/src/DataGrids/RolesDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/RolesDataGrid.php @@ -71,21 +71,21 @@ class RolesDataGrid [ 'name' => 'id', - 'alias' => 'r_id', + 'alias' => 'roleId', 'type' => 'number', 'label' => 'ID', 'sortable' => true, ], [ 'name' => 'name', - 'alias' => 'r_name', + 'alias' => 'roleName', 'type' => 'string', 'label' => 'Name', 'sortable' => true, ], [ 'name' => 'permission_type', - 'alias' => 'r_permission_type', + 'alias' => 'rolePermissionType', 'type' => 'string', 'label' => 'Permission Type', 'sortable' => true, @@ -98,19 +98,19 @@ class RolesDataGrid 'filterable' => [ [ 'column' => 'id', - 'alias' => 'r_id', + 'alias' => 'roleId', 'type' => 'number', 'label' => 'ID', ], [ 'column' => 'name', - 'alias' => 'r_name', + 'alias' => 'roleName', 'type' => 'string', 'label' => 'Name', ], [ 'column' => 'permission_type', - 'alias' => 'r_permission_type', + 'alias' => 'rolePermissionType', 'type' => 'string', 'label' => 'Permission Type', ], diff --git a/packages/Webkul/Admin/src/DataGrids/SliderDataGrid.php b/packages/Webkul/Admin/src/DataGrids/SliderDataGrid.php index 3c9d36b19..aac865c69 100644 --- a/packages/Webkul/Admin/src/DataGrids/SliderDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/SliderDataGrid.php @@ -70,27 +70,27 @@ class SliderDataGrid [ 'name' => 's.id', - 'alias' => 'slider_id', + 'alias' => 'sliderId', 'type' => 'number', 'label' => 'ID', 'sortable' => true, ], [ 'name' => 's.title', - 'alias' => 'slider_title', + 'alias' => 'sliderTitle', 'type' => 'string', 'label' => 'title', ], [ 'name' => 's.channel_id', - 'alias' => 'channel_id', + 'alias' => 'channelId', 'type' => 'string', 'label' => 'Channel ID', 'sortable' => true, ], [ 'name' => 'c.name', - 'alias' => 'channel_name', + 'alias' => 'channelName', 'type' => 'string', 'label' => 'Channel Name', 'sortable' => true, diff --git a/packages/Webkul/Admin/src/DataGrids/UserDataGrid.php b/packages/Webkul/Admin/src/DataGrids/UserDataGrid.php index 0a3e1d42c..2f195a248 100644 --- a/packages/Webkul/Admin/src/DataGrids/UserDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/UserDataGrid.php @@ -155,7 +155,7 @@ class UserDataGrid ], [ 'column' => 'r.id', - 'alias' => 'Role_ID', + 'alias' => 'xc', 'type' => 'number', 'label' => 'Role ID' ] diff --git a/packages/Webkul/Admin/src/Providers/EventServiceProvider.php b/packages/Webkul/Admin/src/Providers/EventServiceProvider.php index 4446d60cf..4c2004289 100644 --- a/packages/Webkul/Admin/src/Providers/EventServiceProvider.php +++ b/packages/Webkul/Admin/src/Providers/EventServiceProvider.php @@ -123,6 +123,13 @@ class EventServiceProvider extends ServiceProvider */ public function createProductFormAccordian() { + + Event::listen('admin.catalog.products.accordian.create', function() { + return ProductFormAccordian::create(function($accordian) { + Event::fire('admin.catalog.products.accordian.build', $accordian); + }); + }); + Event::listen('admin.catalog.products.accordian.build', function($accordian) { $accordian->add('inventories', 'Inventories', 'admin::catalog.products.accordians.inventories', 1); diff --git a/packages/Webkul/Admin/src/Resources/views/catalog/attributes/index.blade.php b/packages/Webkul/Admin/src/Resources/views/catalog/attributes/index.blade.php index d6305062d..f8befdc33 100644 --- a/packages/Webkul/Admin/src/Resources/views/catalog/attributes/index.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/catalog/attributes/index.blade.php @@ -15,7 +15,8 @@
- + @inject('attributes','Webkul\Admin\DataGrids\AttributeDataGrid') + {!! $attributes->render() !!}
@stop \ No newline at end of file diff --git a/packages/Webkul/Admin/src/Resources/views/catalog/categories/index.blade.php b/packages/Webkul/Admin/src/Resources/views/catalog/categories/index.blade.php index 54347e88e..c55e51270 100644 --- a/packages/Webkul/Admin/src/Resources/views/catalog/categories/index.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/catalog/categories/index.blade.php @@ -15,7 +15,8 @@
- + @inject('categories','Webkul\Admin\DataGrids\CategoryDataGrid') + {!! $categories->render() !!}
@stop \ No newline at end of file diff --git a/packages/Webkul/Admin/src/Resources/views/catalog/products/index.blade.php b/packages/Webkul/Admin/src/Resources/views/catalog/products/index.blade.php index 5d968cba8..039fc4a35 100644 --- a/packages/Webkul/Admin/src/Resources/views/catalog/products/index.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/catalog/products/index.blade.php @@ -15,7 +15,8 @@
- + @inject('product','Webkul\Admin\DataGrids\ProductDataGrid') + {!! $product->render() !!}
@stop \ No newline at end of file diff --git a/packages/Webkul/Product/src/Http/Controllers/ProductController.php b/packages/Webkul/Product/src/Http/Controllers/ProductController.php index 2e2806a82..1c435349c 100644 --- a/packages/Webkul/Product/src/Http/Controllers/ProductController.php +++ b/packages/Webkul/Product/src/Http/Controllers/ProductController.php @@ -24,28 +24,28 @@ class ProductController extends Controller * @var array */ protected $_config; - + /** * AttributeFamilyRepository object * * @var array */ protected $attributeFamily; - + /** * CategoryRepository object * * @var array */ protected $category; - + /** * InventorySourceRepository object * * @var array */ protected $inventorySource; - + /** * ProductRepository object * @@ -125,7 +125,7 @@ class ProductController extends Controller $this->validate(request(), [ 'type' => 'required', 'attribute_family_id' => 'required', - 'sku' => ['required', 'unique:products,sku', new \Webkul\Core\Contracts\Validations\Code] + 'sku' => ['required', 'unique:products,sku', new \Webkul\Core\Contracts\Validations\Slug] ]); $product = $this->product->create(request()->all()); diff --git a/packages/Webkul/Ui/src/DataGrid/DataGrid.php b/packages/Webkul/Ui/src/DataGrid/DataGrid.php index 6c799b6d6..bd212bdf2 100644 --- a/packages/Webkul/Ui/src/DataGrid/DataGrid.php +++ b/packages/Webkul/Ui/src/DataGrid/DataGrid.php @@ -724,7 +724,7 @@ class DataGrid //Run this if there are joins if (!empty($this->join)) { - foreach ($this->join as $join) { + foreach ($this->join as $index => $join) { $name = strtolower($join['join']); @@ -750,7 +750,8 @@ class DataGrid $alias2 = trim($exploded_secondary[0]); if ($alias1 == $alias2) { - $this->getQueryWithJoin(); + if($index==count($this->join)-1) + $this->getQueryWithJoin(); $alias_proper_secondary = true; } else { throw new \Exception('Aliases of Join table and the secondary key columns do not match');