diff --git a/packages/Webkul/Admin/src/DataGrids/AttributeDataGrid.php b/packages/Webkul/Admin/src/DataGrids/AttributeDataGrid.php index 640e10ebd..982033ebc 100644 --- a/packages/Webkul/Admin/src/DataGrids/AttributeDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/AttributeDataGrid.php @@ -29,10 +29,10 @@ class AttributeDataGrid 'name' => 'Attributes', 'table' => 'attributes', 'select' => 'id', - 'perpage' => 10, - 'aliased' => false, //use this with false as default and true in case of joins + 'perpage' => 5, + 'aliased' => true, - 'massoperations' =>[ + 'massoperations' => [ [ 'route' => route('admin.datagrid.delete'), 'method' => 'DELETE', @@ -55,20 +55,11 @@ class AttributeDataGrid ], ], - 'join' => [ - // [ - // 'join' => 'leftjoin', - // 'table' => 'roles as r', - // 'primaryKey' => 'u.role_id', - // 'condition' => '=', - // 'secondaryKey' => 'r.id', - // ] - ], + 'join' => [], //use aliasing on secodary columns if join is performed 'columns' => [ - [ 'name' => 'id', 'alias' => 'attributeId', @@ -95,73 +86,106 @@ class AttributeDataGrid 'alias' => 'attributeType', 'type' => 'string', 'label' => 'Type', - 'sortable' => true, + 'sortable' => false, ], [ 'name' => 'is_required', 'alias' => 'attributeIsRequired', 'type' => 'string', 'label' => 'Required', - 'sortable' => true, + 'sortable' => false, + 'wrapper' => function ($value) { + if($value == 0) + return "False"; + else + return "True"; + }, ], [ 'name' => 'is_unique', 'alias' => 'attributeIsUnique', 'type' => 'string', 'label' => 'Unique', - 'sortable' => true, + 'sortable' => false, + 'wrapper' => function ($value) { + if($value == 0) + return "False"; + else + return "True"; + }, ], [ 'name' => 'value_per_locale', 'alias' => 'attributeValuePerLocale', 'type' => 'string', 'label' => 'ValuePerLocale', - 'sortable' => true, + 'sortable' => false, + 'wrapper' => function ($value) { + if($value == 0) + return "False"; + else + return "True"; + }, ], [ 'name' => 'value_per_channel', 'alias' => 'attributeValuePerChannel', 'type' => 'string', 'label' => 'ValuePerChannel', - 'sortable' => true, + 'sortable' => false, + 'wrapper' => function ($value) { + if($value == 0) + return "False"; + else + return "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', - // ], + [ + 'column' => 'id', + 'alias' => 'attributeId', + 'type' => 'number', + 'label' => 'ID', + ], + [ + 'column' => 'code', + 'alias' => 'attributeCode', + 'type' => 'string', + 'label' => 'Code', + ], + [ + 'column' => 'admin_name', + 'alias' => 'attributeAdminName', + 'type' => 'string', + 'label' => 'AdminName', + ], + [ + 'column' => 'type', + 'alias' => 'attributeType', + 'type' => 'string', + 'label' => 'Type', + ], ], //don't use aliasing in case of searchables - 'searchable' => [ - // [ - // 'column' => 'name', - // 'type' => 'string', - // 'label' => 'Name', - // ], - // [ - // 'column' => 'code', - // 'type' => 'string', - // 'label' => 'Code', - // ], + [ + '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 @@ -176,16 +200,14 @@ class AttributeDataGrid 'like' => "like", 'nlike' => "not like", ], - // 'css' => [] + // 'css' => [] ]); } public function render() { - return $this->createAttributeDataGrid()->render(); - } } \ No newline at end of file diff --git a/packages/Webkul/Admin/src/DataGrids/CategoryDataGrid.php b/packages/Webkul/Admin/src/DataGrids/CategoryDataGrid.php index 5f85e2f2d..08012cfb2 100644 --- a/packages/Webkul/Admin/src/DataGrids/CategoryDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/CategoryDataGrid.php @@ -69,7 +69,6 @@ class CategoryDataGrid 'condition' => '=', 'secondaryKey' => 'cta.category_id', ], - ], //use aliasing on secodary columns if join is performed @@ -105,44 +104,56 @@ class CategoryDataGrid 'type' => 'string', 'label' => 'Visible in Menu', 'sortable' => true, + 'wrapper' => function ($value) { + if($value == 0) + return "False"; + else + return "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', - // ], + [ + 'column' => 'cat.id', + 'alias' => 'catID', + 'type' => 'number', + 'label' => 'Category ID', + ], [ + 'column' => 'ct.name', + 'alias' => 'catName', + 'type' => 'string', + 'label' => 'Category Name', + ], [ + 'column' => 'cta.name', + 'alias' => 'parentName', + 'type' => 'string', + 'label' => 'Parent Name', + ], [ + 'column' => 'cat.status', + 'alias' => 'catStatus', + 'type' => 'string', + 'label' => 'Visible in Menu', + ], ], //don't use aliasing in case of searchables 'searchable' => [ - // [ - // 'column' => 'name', - // 'type' => 'string', - // 'label' => 'Name', - // ], - // [ - // 'column' => 'code', - // 'type' => 'string', - // 'label' => 'Code', - // ], + [ + 'column' => 'cat.id', + 'type' => 'number', + 'label' => 'Category ID', + ], [ + 'column' => 'ct.name', + 'type' => 'string', + 'label' => 'Category Name', + ], [ + 'column' => 'cat.status', + 'type' => 'string', + 'label' => 'Visible in Menu', + ] ], //list of viable operators that will be used @@ -158,14 +169,11 @@ class CategoryDataGrid 'nlike' => "not like", ], // 'css' => [] - ]); - } public function render() { - return $this->createCategoryDataGrid()->render(); } diff --git a/packages/Webkul/Admin/src/DataGrids/CustomerDataGrid.php b/packages/Webkul/Admin/src/DataGrids/CustomerDataGrid.php index 592b0f5b4..070694ca2 100644 --- a/packages/Webkul/Admin/src/DataGrids/CustomerDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/CustomerDataGrid.php @@ -30,14 +30,14 @@ class CustomerDataGrid 'table' => 'customers', 'select' => 'id', 'perpage' => 10, - 'aliased' => false, //use this with false as default and true in case of joins + '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', + 'type' => 'button', //select || button only ], ], @@ -56,53 +56,45 @@ class CustomerDataGrid ], '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' => 'customerId', + 'alias' => 'ID', 'type' => 'number', - 'label' => 'ID', + 'label' => 'Customer ID', 'sortable' => true, ], [ 'name' => 'first_name', - 'alias' => 'customerFirstName', + 'alias' => 'FirstName', 'type' => 'string', - 'label' => 'Name', - 'sortable' => true, + 'label' => 'Customer First Name', + 'sortable' => false, ], [ 'name' => 'email', - 'alias' => 'customerEmail', + 'alias' => 'Email', 'type' => 'string', - 'label' => 'Email', - 'sortable' => true, + 'label' => 'Customer E-Mail', + 'sortable' => false, ], [ 'name' => 'phone', - 'alias' => 'customerPhone', + 'alias' => 'Phone', 'type' => 'number', - 'label' => 'Phone', + 'label' => 'Customer Phone', 'sortable' => true, ], [ 'name' => 'customer_group_id', - 'alias' => 'customerGroupId', + 'alias' => 'CustomerGroupId', 'type' => 'number', 'label' => 'Customer Group', - 'sortable' => true, + 'sortable' => false, ], ], @@ -111,49 +103,31 @@ class CustomerDataGrid 'filterable' => [ [ - 'name' => 'id', - 'alias' => 'customerId', + 'column' => 'id', + 'alias' => 'ID', 'type' => 'number', - 'label' => 'ID', + 'label' => 'Customer ID', ], [ - 'name' => 'first_name', - 'alias' => 'customerFirstName', + 'column' => 'first_name', + 'alias' => 'FirstName', 'type' => 'string', - 'label' => 'Name', - ], - [ - 'name' => 'email', - 'alias' => 'customerEmail', - 'type' => 'string', - 'label' => 'Email', - ], - [ - 'name' => 'phone', - 'alias' => 'customerPhone', - 'type' => 'number', - 'label' => 'Phone', - ], - [ - 'name' => 'customer_group_id', - 'alias' => 'customerGroupId', - 'type' => 'string', - 'label' => 'Customer Group', - ], + 'label' => 'Customer First Name', + ] ], //don't use aliasing in case of searchables 'searchable' => [ [ - 'column' => 'first_name', + 'column' => 'FirstName', 'type' => 'string', - 'label' => 'Title', + 'label' => 'Customer First Name', ], [ 'column' => 'email', 'type' => 'string', - 'label' => 'Rating', + 'label' => 'Customer E-Mail', ], ], diff --git a/packages/Webkul/Admin/src/DataGrids/CustomerReviewDataGrid.php b/packages/Webkul/Admin/src/DataGrids/CustomerReviewDataGrid.php index fff921c47..2360e9e89 100644 --- a/packages/Webkul/Admin/src/DataGrids/CustomerReviewDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/CustomerReviewDataGrid.php @@ -19,7 +19,7 @@ class CustomerReviewDataGrid * The CustomerReviewDataGrid * implementation. * - * @var ReviewsDataGrid + * @var CustomerReviewsDataGrid * for Reviews */ @@ -57,13 +57,6 @@ class CustomerReviewDataGrid ], 'join' => [ - // [ - // 'join' => 'leftjoin', - // 'table' => 'roles as r', - // 'primaryKey' => 'u.role_id', - // 'condition' => '=', - // 'secondaryKey' => 'r.id', - // ] ], //use aliasing on secodary columns if join is performed @@ -76,67 +69,51 @@ class CustomerReviewDataGrid 'type' => 'number', 'label' => 'ID', 'sortable' => true, - ], - [ + ], [ 'name' => 'title', 'alias' => 'titleName', 'type' => 'string', 'label' => 'Title', 'sortable' => true, - ], - [ - 'name' => 'rating', - 'alias' => 'productRating', - 'type' => 'number', - 'label' => 'Rating', - 'sortable' => true, - ], - [ + ], [ 'name' => 'comment', 'alias' => 'productComment', 'type' => 'string', 'label' => 'Comment', 'sortable' => true, - ], - [ + ], [ 'name' => 'status', 'alias' => 'reviewStatus', 'type' => 'number', 'label' => 'Status', 'sortable' => true, ], - ], //don't use aliasing in case of filters - 'filterable' => [ [ - 'name' => 'id', + 'column' => 'id', 'alias' => 'reviewId', 'type' => 'number', 'label' => 'ID', - ], - [ - 'name' => 'title', + ], [ + 'column' => 'title', 'alias' => 'titleName', 'type' => 'string', 'label' => 'Title', - ], - [ - 'name' => 'rating', + ], [ + 'column' => 'rating', 'alias' => 'productRating', 'type' => 'number', 'label' => 'Rating', - ], - [ - 'name' => 'comment', + ], [ + 'column' => 'comment', 'alias' => 'productComment', 'type' => 'string', 'label' => 'Comment', - ], - [ - 'name' => 'status', + ], [ + 'column' => 'status', 'alias' => 'reviewStatus', 'type' => 'string', 'label' => 'Status', @@ -144,14 +121,12 @@ class CustomerReviewDataGrid ], //don't use aliasing in case of searchables - 'searchable' => [ [ 'column' => 'title', 'type' => 'string', 'label' => 'Title', - ], - [ + ], [ 'column' => 'rating', 'type' => 'number', 'label' => 'Rating', diff --git a/packages/Webkul/Admin/src/DataGrids/InventorySourcesDataGrid.php b/packages/Webkul/Admin/src/DataGrids/InventorySourcesDataGrid.php index 876587c00..85d091a3b 100644 --- a/packages/Webkul/Admin/src/DataGrids/InventorySourcesDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/InventorySourcesDataGrid.php @@ -64,7 +64,6 @@ class InventorySourcesDataGrid ], //use aliasing on secodary columns if join is performed - 'columns' => [ [ @@ -73,34 +72,36 @@ class InventorySourcesDataGrid 'type' => 'number', 'label' => 'ID', 'sortable' => true, - ], - [ + ], [ 'name' => 'code', 'alias' => 'inventoryCode', 'type' => 'string', 'label' => 'Code', - 'sortable' => true, - ], - [ + 'sortable' => false, + ], [ 'name' => 'name', 'alias' => 'inventoryName', 'type' => 'string', 'label' => 'Name', - 'sortable' => true, - ], - [ + 'sortable' => false, + ], [ 'name' => 'priority', 'alias' => 'inventoryPriority', 'type' => 'string', 'label' => 'Priority', 'sortable' => true, - ], - [ + ], [ 'name' => 'status', 'alias' => 'inventoryStatus', 'type' => 'string', 'label' => 'Status', 'sortable' => true, + 'wrapper' => function ($value) { + if($value == 0) + return "In Active"; + else + return "Active"; + }, ], ], diff --git a/packages/Webkul/Admin/src/DataGrids/OrderDataGrid.php b/packages/Webkul/Admin/src/DataGrids/OrderDataGrid.php new file mode 100644 index 000000000..5324637a4 --- /dev/null +++ b/packages/Webkul/Admin/src/DataGrids/OrderDataGrid.php @@ -0,0 +1,179 @@ + @prashant-webkul + * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) + */ + +class OrderDataGrid +{ + /** + * The Data Grid implementation. + * + * @var AttributeDataGrid + * for countries + */ + + public function createCategoryDataGrid() + { + + return DataGrid::make([ + 'name' => 'Orders', + 'table' => 'orders as ord', + 'select' => 'ord.id', + 'perpage' => 5, + '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, + 'wrapper' => function ($value) { + if($value == 0) + return "False"; + else + return "True"; + }, + ], + + ], + + 'filterable' => [ + [ + 'column' => 'cat.id', + 'alias' => 'catID', + 'type' => 'number', + 'label' => 'Category ID', + ], [ + 'column' => 'ct.name', + 'alias' => 'catName', + 'type' => 'string', + 'label' => 'Category Name', + ], [ + 'column' => 'cta.name', + 'alias' => 'parentName', + 'type' => 'string', + 'label' => 'Parent Name', + ], [ + 'column' => 'cat.status', + 'alias' => 'catStatus', + 'type' => 'string', + 'label' => 'Visible in Menu', + ], + ], + + //don't use aliasing in case of searchables + + 'searchable' => [ + [ + 'column' => 'cat.id', + 'type' => 'number', + 'label' => 'Category ID', + ], [ + 'column' => 'ct.name', + 'type' => 'string', + 'label' => 'Category Name', + ], [ + 'column' => 'cat.status', + 'type' => 'string', + 'label' => 'Visible in Menu', + ] + ], + + //list of viable operators that will be used + 'operators' => [ + 'eq' => "=", + 'lt' => "<", + 'gt' => ">", + 'lte' => "<=", + 'gte' => ">=", + 'neqs' => "<>", + 'neqn' => "!=", + 'like' => "like", + 'nlike' => "not like", + ], + // 'css' => [] + ]); + } + + public function render() + { + return $this->createCategoryDataGrid()->render(); + + } +} \ No newline at end of file diff --git a/packages/Webkul/Admin/src/DataGrids/ProductDataGrid.php b/packages/Webkul/Admin/src/DataGrids/ProductDataGrid.php index 25cf5249d..74e236511 100644 --- a/packages/Webkul/Admin/src/DataGrids/ProductDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/ProductDataGrid.php @@ -129,25 +129,25 @@ class ProductDataGrid 'filterable' => [ //column, type, and label [ - 'name' => 'prods.id', + 'column' => 'prods.id', 'alias' => 'productID', 'type' => 'number', 'label' => 'ID', ], [ - 'name' => 'prods.sku', + 'column' => 'prods.sku', 'alias' => 'productCode', 'type' => 'string', 'label' => 'SKU', ], [ - 'name' => 'attfam.name', + 'column' => 'attfam.name', 'alias' => 'FamilyName', 'type' => 'string', 'label' => 'Family Name', ], [ - 'name' => 'pi.qty', + 'column' => 'pi.qty', 'alias' => 'ProductQuantity', 'type' => 'number', 'label' => 'Product Quatity', diff --git a/packages/Webkul/Admin/src/DataGrids/SliderDataGrid.php b/packages/Webkul/Admin/src/DataGrids/SliderDataGrid.php index 361c6cb43..759fb0f45 100644 --- a/packages/Webkul/Admin/src/DataGrids/SliderDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/SliderDataGrid.php @@ -67,28 +67,25 @@ class SliderDataGrid //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' => false + ], [ 'name' => 's.channel_id', 'alias' => 'channelId', 'type' => 'string', 'label' => 'Channel ID', - 'sortable' => true, - ], - [ + 'sortable' => false, + ], [ 'name' => 'c.name', 'alias' => 'channelName', 'type' => 'string', @@ -98,41 +95,31 @@ class SliderDataGrid ], //don't use aliasing in case of filters - 'filterable' => [ [ - 'column' => 'id', - 'alias' => 'locale_id', + 'column' => 's.id', + 'alias' => 'sliderId', 'type' => 'number', - 'label' => 'ID', - ], - [ - 'column' => 'code', - 'alias' => 'locale_code', + 'label' => 'ID' + ], [ + 'column' => 's.title', + 'alias' => 'SliderTitle', 'type' => 'string', - 'label' => 'Code', - ], - [ - 'column' => 'name', - 'alias' => 'locale_name', - 'type' => 'string', - 'label' => 'Name', + 'label' => 'Slider Title' ], ], //don't use aliasing in case of searchables - 'searchable' => [ - // [ - // 'column' => 'name', - // 'type' => 'string', - // 'label' => 'Name', - // ], - // [ - // 'column' => 'code', - // 'type' => 'string', - // 'label' => 'Code', - // ], + [ + 'column' => 's.id', + 'type' => 'number', + 'label' => 'ID' + ], [ + 'column' => 's.title', + 'type' => 'string', + 'label' => 'Slider Title' + ] ], //list of viable operators that will be used @@ -148,9 +135,7 @@ class SliderDataGrid 'nlike' => "not like", ], // 'css' => [] - ]); - } public function render() diff --git a/packages/Webkul/Admin/src/DataGrids/TaxRateDataGrid.php b/packages/Webkul/Admin/src/DataGrids/TaxRateDataGrid.php index e51d10f11..f93464664 100644 --- a/packages/Webkul/Admin/src/DataGrids/TaxRateDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/TaxRateDataGrid.php @@ -24,7 +24,6 @@ class TaxRateDataGrid { return DataGrid::make([ - 'name' => 'Tax Rates', 'table' => 'tax_rates as tr', 'select' => 'tr.id', @@ -64,21 +63,13 @@ class TaxRateDataGrid 'icon' => 'icon trash-icon', ], ], - 'join' => [ - // [ - // 'join' => 'leftjoin', - // 'table' => 'roles as r', - // 'primaryKey' => 'u.role_id', - // 'condition' => '=', - // 'secondaryKey' => 'r.id', - // ] - ], + 'join' => [], //use aliasing on secodary columns if join is performed 'columns' => [ [ 'name' => 'tr.id', - 'alias' => 'ID', + 'alias' => 'id', 'type' => 'number', 'label' => 'ID', 'sortable' => true, @@ -90,7 +81,7 @@ class TaxRateDataGrid 'label' => 'Identifier', 'sortable' => true, // 'wrapper' => function ($value, $object) { - // return '' . $object->Name . ''; + // return '' . $object->identifier . ''; // }, ], [ @@ -119,32 +110,27 @@ class TaxRateDataGrid //don't use aliasing in case of filters 'filterable' => [ [ - 'name' => 'tr.id', + 'column' => 'tr.id', 'alias' => 'ID', 'type' => 'number', 'label' => 'ID', - ], - [ - 'name' => 'tr.identifier', + ], [ + 'column' => 'tr.identifier', 'alias' => 'identifier', 'type' => 'string', 'label' => 'Identifier', - ], - [ - 'name' => 'tr.state', + ], [ + 'column' => 'tr.state', 'alias' => 'state', 'type' => 'string', 'label' => 'State', - ], - [ - 'name' => 'tr.country', + ], [ + 'column' => 'tr.country', 'alias' => 'country', 'type' => 'string', 'label' => 'Country', - ], - - [ - 'name' => 'tr.tax_rate', + ], [ + 'column' => 'tr.tax_rate', 'alias' => 'tax_rate', 'type' => 'number', 'label' => 'Tax Rate', @@ -157,22 +143,6 @@ class TaxRateDataGrid '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' => "=", diff --git a/packages/Webkul/Checkout/src/Cart.php b/packages/Webkul/Checkout/src/Cart.php index eebafe9b8..4128e88ca 100644 --- a/packages/Webkul/Checkout/src/Cart.php +++ b/packages/Webkul/Checkout/src/Cart.php @@ -107,8 +107,6 @@ class Cart { { $product = $this->product->findOneByField('id', $productId); - // dd($product); - //Check if the product's information is proper or not. if(!isset($data['product']) || !isset($data['quantity'])) { session()->flash('error', trans('shop::app.checkout.cart.integrity.missing_fields')); @@ -961,4 +959,24 @@ class Cart { return $finalData; } + + /** + * Move to Cart + * + * Move a wishlist item to cart + */ + public function moveToCart($productId) { + $data = [ + 'product' => $productId, + 'quantity' => 1, + ]; + + $result = $this->add($productId, $data); + + if($result instanceof Collection || $result == true) { + return true; + } else { + return false; + } + } } \ No newline at end of file diff --git a/packages/Webkul/Customer/src/Http/Controllers/WishlistController.php b/packages/Webkul/Customer/src/Http/Controllers/WishlistController.php index 5b3e1a7af..600431d22 100644 --- a/packages/Webkul/Customer/src/Http/Controllers/WishlistController.php +++ b/packages/Webkul/Customer/src/Http/Controllers/WishlistController.php @@ -5,7 +5,9 @@ namespace Webkul\Customer\Http\Controllers; use Illuminate\Http\Request; use Illuminate\Http\Response; use Webkul\Customer\Repositories\CustomerRepository; +use Webkul\Product\Repositories\ProductRepository; use Webkul\Customer\Repositories\WishlistRepository; +use Cart; use Auth; /** @@ -26,13 +28,15 @@ class WishlistController extends Controller protected $wishlist; + protected $product; + /** * Initializes the required repository instances. * * @param $customer * @param $wishlist */ - public function __construct(CustomerRepository $customer, WishlistRepository $wishlist) + public function __construct(CustomerRepository $customer, WishlistRepository $wishlist, ProductRepository $product) { $this->middleware('customer'); @@ -41,6 +45,8 @@ class WishlistController extends Controller $this->customer = $customer; $this->wishlist = $wishlist; + + $this->product = $product; } /** @@ -67,6 +73,15 @@ class WishlistController extends Controller * @param integer $itemId */ public function add($itemId) { + $product = $this->product->findOneByField('id', $itemId); + + if($product->type == "configurable") { + $slug = $product->url_key; + + session()->flash('warning', trans('customer::app.wishlist.select-options')); + + return redirect()->route('shop.products.index', $slug); + } $data = [ 'channel_id' => core()->getCurrentChannel()->id, @@ -111,12 +126,45 @@ class WishlistController extends Controller } } + /** + * Add the configurable product + * to the wishlist. + * + * @return response + */ + public function addconfigurable($urlkey) { + dd($urlkey); + session()->flash('warning', trans('Select options before adding to wishlist')); + return redirect()->route('shop.products.index', $urlkey); + } + /** * Function to move item from wishlist to cart. * * @param integer $itemId */ - public function moveToCart() { - dd('adding item to wishlist'); + public function moveAll() { + Cart::moveAllToCart(); + } + + /** + * Function to move item from wishlist to cart. + * + * @param integer $itemId + */ + public function move($productId) { + $result = Cart::moveToCart($productId); + + $wishlist = $this->wishlist->findWhere(['customer_id' => auth()->guard('customer')->user()->id, 'product_id' => $productId]); + + if($this->wishlist->delete($wishlist[0]->id)) { + session()->flash('success', 'Item Moved To Cart Successfully'); + + return redirect()->back(); + } else { + session()->flash('error', 'Item Cannot Be Moved To Cart Successfully'); + + return redirect()->back(); + } } } diff --git a/packages/Webkul/Customer/src/Resources/lang/en/app.php b/packages/Webkul/Customer/src/Resources/lang/en/app.php index 470145c57..30f59002c 100644 --- a/packages/Webkul/Customer/src/Resources/lang/en/app.php +++ b/packages/Webkul/Customer/src/Resources/lang/en/app.php @@ -7,6 +7,7 @@ return [ 'already' => 'Item Already Present In Your Wishlist', 'removed' => 'Item Successfully Added To Wishlist', 'remove-fail' => 'Item Cannot Be Removed From Wishlist', - 'empty' => 'You Don\'t Have Any Items In Your Wishlist' + 'empty' => 'You Don\'t Have Any Items In Your Wishlist', + 'select-options' => 'Need To Select Options Before Adding To Wishlist' ], ]; \ No newline at end of file diff --git a/packages/Webkul/Product/src/Helpers/Review.php b/packages/Webkul/Product/src/Helpers/Review.php index 992e53971..0cc496b9d 100644 --- a/packages/Webkul/Product/src/Helpers/Review.php +++ b/packages/Webkul/Product/src/Helpers/Review.php @@ -7,7 +7,7 @@ class Review extends AbstractProduct /** * Returns the product's avg rating * - * @param Product $product + * @param Product $product * @return float */ public function getReviews($product) @@ -18,7 +18,7 @@ class Review extends AbstractProduct /** * Returns the product's avg rating * - * @param Product $product + * @param Product $product * @return float */ public function getAverageRating($product) diff --git a/packages/Webkul/Shop/src/Http/routes.php b/packages/Webkul/Shop/src/Http/routes.php index 8a89f7159..444862394 100644 --- a/packages/Webkul/Shop/src/Http/routes.php +++ b/packages/Webkul/Shop/src/Http/routes.php @@ -1,6 +1,7 @@ ['web']], function () { + Route::get('/', 'Webkul\Shop\Http\Controllers\HomeController@index')->defaults('_config', [ 'view' => 'shop::home.index' ])->name('shop.home.index'); @@ -119,6 +120,10 @@ Route::group(['middleware' => ['web']], function () { Route::get('wishlist/remove/{id}', 'Webkul\Customer\Http\Controllers\WishlistController@remove')->name('customer.wishlist.remove'); + Route::get('wishlist/move/{id}', 'Webkul\Customer\Http\Controllers\WishlistController@move')->name('customer.wishlist.move'); + + Route::get('wishlist/moveall', 'Webkul\Customer\Http\Controllers\WishlistController@moveAll')->name('customer.wishlist.moveall'); + //customer account Route::prefix('account')->group(function () { @@ -163,7 +168,6 @@ Route::group(['middleware' => ['web']], function () { Route::post('address/edit', 'Webkul\Customer\Http\Controllers\AddressController@edit')->defaults('_config', [ 'redirect' => 'customer.address.index' ])->name('customer.address.edit'); - /* Routes for Addresses ends here */ /* Wishlist route */ @@ -188,5 +192,4 @@ Route::group(['middleware' => ['web']], function () { }); }); //customer routes end here - }); diff --git a/packages/Webkul/Shop/src/Resources/assets/images/cross-icon-adj.svg b/packages/Webkul/Shop/src/Resources/assets/images/cross-icon-adj.svg new file mode 100644 index 000000000..d62bc542c --- /dev/null +++ b/packages/Webkul/Shop/src/Resources/assets/images/cross-icon-adj.svg @@ -0,0 +1,11 @@ + + + + Artboard + Created with Sketch. + + + + + + \ No newline at end of file diff --git a/packages/Webkul/Shop/src/Resources/assets/sass/app.scss b/packages/Webkul/Shop/src/Resources/assets/sass/app.scss index 43e4137d8..0c6107496 100644 --- a/packages/Webkul/Shop/src/Resources/assets/sass/app.scss +++ b/packages/Webkul/Shop/src/Resources/assets/sass/app.scss @@ -481,7 +481,7 @@ section.slider-block { } .nav a:first-child{ - margin-left: 20px; + // margin-left: 20px; } .nav li > .icon{ @@ -1658,62 +1658,52 @@ section.review { .review-layouter { display: flex; - flex-flow: row; - margin-top: 20px; + flex-direction: row; .product-info { - .image { - border:1px solid red; - + .product-image { img { + display: block; height: 280px; width: 280px; } } - .heading { + .product-name { margin-top: 20px; span { font-size: 24px; - } } - .price { + .product-price { margin-top: 10px; .pro-price { font-size: 24px; color: $disc-price; - } .pro-price-not { margin-left: 10px; color: $disc-price-pro; - } .offer { margin-left: 10px; - } } } - .review-info { + .review-form { margin-left: 20px; width: 49%; .heading { margin-top: 10px; - span { - - } - .btn.btn-primary.right { float: right; margin-top: -10px; diff --git a/packages/Webkul/Shop/src/Resources/assets/sass/components.scss b/packages/Webkul/Shop/src/Resources/assets/sass/components.scss index b37e216e4..de24f9f32 100644 --- a/packages/Webkul/Shop/src/Resources/assets/sass/components.scss +++ b/packages/Webkul/Shop/src/Resources/assets/sass/components.scss @@ -1,3 +1,57 @@ +.product-card { + + .product-image { + max-height: 350px; + max-width: 280px; + margin-bottom: 10px; + background: #F2F2F2; + + img { + display: block; + width: 100%; + } + } + + .product-name { + margin-bottom: 14px; + width: 100%; + color: $font-color; + + a { + color: $font-color; + } + } + + .product-description { + display: none; + } + + .product-ratings { + width: 100%; + + .icon { + width: 16px; + height: 16px; + } + } + + .cart-wish-wrap { + display: inline-flex; + justify-content: flex-start; + align-items: center; + height: 40px; + + .addtocart { + margin-right: 10px; + text-transform: uppercase; + } + + .add-to-wishlist { + margin-top: 5px; + } + } +} + // product card, requires no changes for responsiveness. .product-grid-4 { display: grid; @@ -43,55 +97,6 @@ } } -.product-card { - - .product-image { - max-height: 350px; - max-width: 280px; - margin-bottom: 10px; - background: #F2F2F2; - - img { - display: block; - width: 100%; - } - } - - .product-name { - margin-bottom: 14px; - width: 100%; - color: $font-color; - - a { - color: $font-color; - } - } - - .product-description { - display: none; - } - - .product-ratings { - width: 100%; - - .icon { - width: 16px; - height: 16px; - } - } - - .cart-fav-seg { - display: inline-flex; - align-items: center; - - .addtocart { - margin-right: 10px; - text-transform: uppercase; - white-space: nowrap; - } - - } -} //wishlist icon hover properties .add-to-wishlist { @@ -140,7 +145,7 @@ text-align: left; } - .account-edit { + .account-action { font-size: 17px; margin-top: 1%; color: $brand-color; diff --git a/packages/Webkul/Shop/src/Resources/assets/sass/icons.scss b/packages/Webkul/Shop/src/Resources/assets/sass/icons.scss index b0eacb07b..d6d741b6b 100644 --- a/packages/Webkul/Shop/src/Resources/assets/sass/icons.scss +++ b/packages/Webkul/Shop/src/Resources/assets/sass/icons.scss @@ -15,8 +15,12 @@ background-image:URL('../images/icon-menu-close.svg'); width: 24px; height: 24px; - margin-left:auto; - margin-bottom: 2px; +} + +.icon-menu-close-adj { + background-image:URL('../images/cross-icon-adj.svg'); + width: 32px; + height: 32px; } .grid-view-icon { diff --git a/packages/Webkul/Shop/src/Resources/lang/en/app.php b/packages/Webkul/Shop/src/Resources/lang/en/app.php index 1943ef3d8..879c8df7d 100644 --- a/packages/Webkul/Shop/src/Resources/lang/en/app.php +++ b/packages/Webkul/Shop/src/Resources/lang/en/app.php @@ -11,6 +11,13 @@ return [ ] ], + 'reviews' => [ + 'add-review-page-title' => 'Add Review', + 'write-review' => 'Write a review', + 'review-title' => 'Give Your Review a Title', + 'empty' => 'You Haven\'t Reviewed Any Product Yet' + ], + 'customer' => [ 'signup-text' => [ 'account_exists' => 'Already have an account', @@ -191,7 +198,11 @@ return [ 'wishlist' => [ 'title' => 'Wishlist', 'deleteall' => 'Delete All', - 'moveall' => 'Move All Products To Cart' + 'moveall' => 'Move All Products To Cart', + 'move-to-cart' => 'Move To Cart', + 'empty' => 'You Have No Items In Your Wishlist', + 'add' => 'Item Successfully Added To Wishlist', + 'remove' => 'Item Successfully Removed From Wishlist' ], 'checkout' => [ diff --git a/packages/Webkul/Shop/src/Resources/views/customers/account/address/address.blade.php b/packages/Webkul/Shop/src/Resources/views/customers/account/address/address.blade.php index 2e29b4de5..ce7c36d75 100644 --- a/packages/Webkul/Shop/src/Resources/views/customers/account/address/address.blade.php +++ b/packages/Webkul/Shop/src/Resources/views/customers/account/address/address.blade.php @@ -16,7 +16,7 @@ {{ __('shop::app.customer.account.address.index.title') }} @if(!$address->isEmpty()) - + {{ __('shop::app.customer.account.address.index.edit') }} diff --git a/packages/Webkul/Shop/src/Resources/views/customers/account/address/create.blade.php b/packages/Webkul/Shop/src/Resources/views/customers/account/address/create.blade.php index aa2752cb7..e6bdef52b 100644 --- a/packages/Webkul/Shop/src/Resources/views/customers/account/address/create.blade.php +++ b/packages/Webkul/Shop/src/Resources/views/customers/account/address/create.blade.php @@ -7,7 +7,7 @@ @include('shop::customers.account.partials.sidemenu')