diff --git a/composer.json b/composer.json index 5bbba23f3..b67e85057 100644 --- a/composer.json +++ b/composer.json @@ -38,7 +38,8 @@ "webkul/laravel-category": "self.version", "webkul/laravel-product": "self.version", "webkul/laravel-shop": "self.version", - "webkul/laravel-theme": "self.version" + "webkul/laravel-theme": "self.version", + "webkul/laravel-shipping": "self.version" }, "autoload": { "classmap": [ @@ -57,7 +58,9 @@ "Webkul\\Customer\\": "packages/Webkul/Customer/src", "Webkul\\Inventory\\": "packages/Webkul/Inventory/src", "Webkul\\Product\\": "packages/Webkul/Product/src", - "Webkul\\Theme\\": "packages/Webkul/Theme/src" + "Webkul\\Theme\\": "packages/Webkul/Theme/src", + "Webkul\\Cart\\": "packages/Webkul/Cart/src", + "Webkul\\Shipping\\": "packages/Webkul/Shipping/src" } }, "autoload-dev": { diff --git a/config/app.php b/config/app.php index d9aa90898..b0f6ebc94 100644 --- a/config/app.php +++ b/config/app.php @@ -172,6 +172,8 @@ return [ //Laravel Intervention Intervention\Image\ImageServiceProvider::class, + + //Repository Prettus\Repository\Providers\RepositoryServiceProvider::class, //Webkul packages @@ -187,7 +189,9 @@ return [ Webkul\Product\Providers\ProductServiceProvider::class, Webkul\Shop\Providers\ShopServiceProvider::class, Webkul\Customer\Providers\CustomerServiceProvider::class, - Webkul\Theme\Providers\ThemeServiceProvider::class + Webkul\Theme\Providers\ThemeServiceProvider::class, + Webkul\Cart\Providers\CartServiceProvider::class, + Webkul\Shipping\Providers\ShippingServiceProvider::class, ], /* diff --git a/config/carrier.php b/config/carrier.php new file mode 100644 index 000000000..c6da8a2f0 --- /dev/null +++ b/config/carrier.php @@ -0,0 +1,51 @@ + [ + [ + 'code' => 'flatrate_one', + 'title' => 'Flatrate One', + 'name' => 'fixed 20% discount for today', + 'description' => 'this is a flat rate', + 'status' => '1', + 'price' => '10', + 'type' => [ + 'per_unit' => 'Per Unit', + 'per order' => 'Per Order', + ], + 'class' => 'Webkul\Shipping\Helper\Rate', + ], + + [ + 'code' => 'flatrate_two', + 'title' => 'Flatrate Two', + 'name' => 'fixed 50% discount till 10/10/2018', + 'description' => 'this is a flat rate', + 'status' => '1', + 'price' => '100', + 'type' => [ + 'per unit' => 'Per Unit', + 'per order' => 'Per Order', + ], + 'class' => 'Webkul\Shipping\Helper\Rate', + ], + + [ + 'code' => 'flatrate_three', + 'title' => 'Flatrate Three', + 'name' => 'fixed 30% discount', + 'description' => 'this is a flat rate', + 'status' => '1', + 'price' => '1000', + 'type' => [ + 'per unit' => 'Per Unit', + 'per order' => 'Per Order', + ], + 'class' => 'Webkul\Shipping\Helper\Rate', + ] + ] + +] + +?> \ 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 582ddc9e0..fcb325618 100644 --- a/packages/Webkul/Admin/src/DataGrids/ChannelDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/ChannelDataGrid.php @@ -71,21 +71,21 @@ class ChannelDataGrid [ 'name' => 'id', - 'alias' => 'channel_id', + 'alias' => 'channelID', 'type' => 'number', 'label' => 'Channel ID', 'sortable' => true, ], [ 'name' => 'code', - 'alias' => 'channel_code', + 'alias' => 'channelCode', 'type' => 'string', 'label' => 'Channel Code', 'sortable' => true, ], [ 'name' => 'name', - 'alias' => 'channel_name', + 'alias' => 'channelName', 'type' => 'string', 'label' => 'Channel Name', 'sortable' => true, @@ -98,7 +98,7 @@ class ChannelDataGrid 'filterable' => [ [ 'column' => 'id', - 'alias' => 'channelId', + 'alias' => 'channelID', 'type' => 'number', 'label' => 'Channel ID', ], diff --git a/packages/Webkul/Admin/src/DataGrids/CustomerDataGrid.php b/packages/Webkul/Admin/src/DataGrids/CustomerDataGrid.php new file mode 100644 index 000000000..0ac003829 --- /dev/null +++ b/packages/Webkul/Admin/src/DataGrids/CustomerDataGrid.php @@ -0,0 +1,184 @@ + @rahul-webkul + * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) + */ + +class CustomerDataGrid +{ + /** + * The CustomerDataGrid + * implementation. + * + * @var CustomerDataGrid + */ + + public function createCustomerDataGrid() + { + + return DataGrid::make([ + 'name' => 'Customer', + 'table' => 'customers', + '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' => 'customerId', + 'type' => 'number', + 'label' => 'ID', + 'sortable' => true, + ], + [ + 'name' => 'first_name', + 'alias' => 'customerFirstName', + 'type' => 'string', + 'label' => 'Name', + 'sortable' => true, + ], + [ + 'name' => 'email', + 'alias' => 'customerEmail', + 'type' => 'string', + 'label' => 'Email', + 'sortable' => true, + ], + [ + 'name' => 'phone', + 'alias' => 'customerPhone', + 'type' => 'number', + 'label' => 'Phone', + 'sortable' => true, + ], + [ + 'name' => 'customer_group_id', + 'alias' => 'customerGroupId', + 'type' => 'number', + 'label' => 'Customer Group', + 'sortable' => true, + ], + ], + + //don't use aliasing in case of filters + + 'filterable' => [ + + [ + 'name' => 'id', + 'alias' => 'customerId', + 'type' => 'number', + 'label' => 'ID', + ], + [ + 'name' => 'first_name', + 'alias' => 'customerFirstName', + 'type' => 'string', + 'label' => 'Name', + ], + [ + 'name' => 'phone', + 'alias' => 'customerPhone', + 'type' => 'number', + 'label' => 'Phone', + ], + [ + 'name' => 'email', + 'alias' => 'customerEmail', + 'type' => 'string', + 'label' => 'Comment', + ], + [ + 'name' => 'customer_group_id', + 'alias' => 'customerGroupId', + 'type' => 'number', + 'label' => 'Status', + ], + ], + + //don't use aliasing in case of searchables + + 'searchable' => [ + [ + 'column' => 'first_name', + 'type' => 'string', + 'label' => 'Title', + ], + [ + 'column' => 'email', + 'type' => 'string', + 'label' => 'Rating', + ], + ], + + //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->createCustomerDataGrid()->render(); + + } +} \ No newline at end of file diff --git a/packages/Webkul/Admin/src/DataGrids/CustomerReviewDataGrid.php b/packages/Webkul/Admin/src/DataGrids/CustomerReviewDataGrid.php new file mode 100644 index 000000000..f28a22b61 --- /dev/null +++ b/packages/Webkul/Admin/src/DataGrids/CustomerReviewDataGrid.php @@ -0,0 +1,183 @@ + @rahul-webkul + * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) + */ + +class CustomerReviewDataGrid +{ + /** + * The CustomerReviewDataGrid + * implementation. + * + * @var ReviewsDataGrid + * for Reviews + */ + + public function createCustomerReviewDataGrid() + { + + return DataGrid::make([ + 'name' => 'Review', + 'table' => 'product_reviews', + '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' => 'reviewId', + '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' => 'countryStatus', + 'type' => 'number', + 'label' => 'Status', + 'sortable' => true, + ], + + ], + + //don't use aliasing in case of filters + + 'filterable' => [ + [ + 'name' => 'id', + 'alias' => 'countryId', + 'type' => 'number', + 'label' => 'ID', + ], + [ + 'name' => 'title', + 'alias' => 'titleName', + 'type' => 'string', + 'label' => 'Title', + ], + [ + 'name' => 'rating', + 'alias' => 'productRating', + 'type' => 'number', + 'label' => 'Rating', + ], + [ + 'name' => 'comment', + 'alias' => 'productComment', + 'type' => 'string', + 'label' => 'Comment', + ], + [ + 'name' => 'status', + 'alias' => 'countryStatus', + 'type' => 'number', + 'label' => 'Code', + ], + ], + + //don't use aliasing in case of searchables + + 'searchable' => [ + [ + 'column' => 'title', + 'type' => 'string', + 'label' => 'Title', + ], + [ + 'column' => 'rating', + 'type' => 'number', + 'label' => 'Rating', + ], + ], + + //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->createCustomerReviewDataGrid()->render(); + } +} \ No newline at end of file diff --git a/packages/Webkul/Admin/src/DataGrids/InventorySourcesDataGrid.php b/packages/Webkul/Admin/src/DataGrids/InventorySourcesDataGrid.php index 5bad6e70a..876587c00 100644 --- a/packages/Webkul/Admin/src/DataGrids/InventorySourcesDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/InventorySourcesDataGrid.php @@ -42,7 +42,7 @@ class InventorySourcesDataGrid 'actions' => [ [ 'type' => 'Edit', - 'route' => route('admin.datagrid.delete'), + 'route' => route('admin.datagrid.edit'), 'confirm_text' => 'Do you really edit this record?', 'icon' => 'icon pencil-lg-icon', ], [ @@ -110,7 +110,7 @@ class InventorySourcesDataGrid 'filterable' => [ [ 'column' => 'id', - 'alias' => 'inventoryId', + 'alias' => 'inventoryID', 'type' => 'number', 'label' => 'ID', ], diff --git a/packages/Webkul/Admin/src/DataGrids/ProductDataGrid.php b/packages/Webkul/Admin/src/DataGrids/ProductDataGrid.php index 63287c074..86d330715 100644 --- a/packages/Webkul/Admin/src/DataGrids/ProductDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/ProductDataGrid.php @@ -6,7 +6,6 @@ use Illuminate\View\View; use Webkul\Ui\DataGrid\Facades\ProductGrid; use Webkul\Channel\Repositories\ChannelRepository; use Webkul\Product\Repositories\ProductRepository; - /** * Product DataGrid * @@ -24,7 +23,6 @@ class ProductDataGrid public function createProductDataGrid() { - return ProductGrid::make([ 'name' => 'Products', 'table' => 'products as prods', @@ -77,10 +75,15 @@ class ProductDataGrid 'primaryKey' => 'prods.id', 'condition' => '=', 'secondaryKey' => 'pav.product_id', - 'withAttributes' => true + 'withAttributes' => [ + 'condition' => [ + 'attribute_id' => 2, + 'select' => 'name', + ] + ] ], - //for getting the inventory quantity of a product + // for getting the inventory quantity of a product [ 'join' => 'leftjoin', 'table' => 'product_inventories as pi', @@ -120,17 +123,9 @@ class ProductDataGrid 'name' => 'pi.qty', 'alias' => 'ProductQuantity', 'type' => 'string', - 'label' => 'Product Quatity', + 'label' => 'Product Quantity', 'sortable' => false, ], - // [ - // 'name' => 'pav.attribute_id', - // 'alias' => 'AttributeID', - // 'type' => 'string', - // 'label' => 'Attribute ID', - // 'sortable' => false, - - // ], ], 'filterable' => [ @@ -156,7 +151,7 @@ class ProductDataGrid [ 'name' => 'pi.qty', 'alias' => 'ProductQuantity', - 'type' => 'string', + 'type' => 'number', 'label' => 'Product Quatity', ], ], diff --git a/packages/Webkul/Admin/src/DataGrids/SliderDataGrid.php b/packages/Webkul/Admin/src/DataGrids/SliderDataGrid.php index aac865c69..361c6cb43 100644 --- a/packages/Webkul/Admin/src/DataGrids/SliderDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/SliderDataGrid.php @@ -100,24 +100,24 @@ class SliderDataGrid //don't use aliasing in case of filters 'filterable' => [ - // [ - // 'column' => 'id', - // 'alias' => 'locale_id', - // 'type' => 'number', - // 'label' => 'ID', - // ], - // [ - // 'column' => 'code', - // 'alias' => 'locale_code', - // 'type' => 'string', - // 'label' => 'Code', - // ], - // [ - // 'column' => 'name', - // 'alias' => 'locale_name', - // 'type' => 'string', - // 'label' => 'Name', - // ], + [ + 'column' => 'id', + 'alias' => 'locale_id', + 'type' => 'number', + 'label' => 'ID', + ], + [ + 'column' => 'code', + 'alias' => 'locale_code', + 'type' => 'string', + 'label' => 'Code', + ], + [ + 'column' => 'name', + 'alias' => 'locale_name', + 'type' => 'string', + 'label' => 'Name', + ], ], //don't use aliasing in case of searchables diff --git a/packages/Webkul/Admin/src/DataGrids/TaxRateDataGrid.php b/packages/Webkul/Admin/src/DataGrids/TaxRateDataGrid.php new file mode 100644 index 000000000..be5b5c12e --- /dev/null +++ b/packages/Webkul/Admin/src/DataGrids/TaxRateDataGrid.php @@ -0,0 +1,199 @@ + @prashant-webkul + * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) + */ + +class TaxRateDataGrid +{ + /** + * The Tax Rule Data + * Grid implementation. + * + * @var TaxRateDataGrid + */ + public function createTaxRateDataGrid() + { + + return DataGrid::make([ + + 'name' => 'Tax Rates', + 'table' => 'tax_rates as tr', + 'select' => 'tr.id', + 'perpage' => 10, + 'aliased' => true, //use this with false as default and true in case of joins + + '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' => route('admin.datagrid.delete'), + 'confirm_text' => 'Do you really wanis?', + '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' => 'tr.id', + 'alias' => 'ID', + 'type' => 'number', + 'label' => 'ID', + 'sortable' => true, + ], + [ + 'name' => 'tr.identifier', + 'alias' => 'identifier', + 'type' => 'string', + 'label' => 'Identifier', + 'sortable' => true, + // 'wrapper' => function ($value, $object) { + // return '' . $object->Name . ''; + // }, + ], + [ + 'name' => 'tr.state', + 'alias' => 'state', + 'type' => 'string', + 'label' => 'State', + 'sortable' => true, + ], + [ + 'name' => 'tr.country', + 'alias' => 'country', + 'type' => 'string', + 'label' => 'Country', + 'sortable' => true, + ], + + [ + 'name' => 'tr.tax_rate', + 'alias' => 'tax_rate', + 'type' => 'number', + 'label' => 'Tax Rate', + 'sortable' => true, + ], + ], + //don't use aliasing in case of filters + 'filterable' => [ + [ + 'name' => 'tr.id', + 'alias' => 'ID', + 'type' => 'number', + 'label' => 'ID', + ], + [ + 'name' => 'tr.identifier', + 'alias' => 'identifier', + 'type' => 'string', + 'label' => 'Identifier', + ], + [ + 'name' => 'tr.state', + 'alias' => 'state', + 'type' => 'string', + 'label' => 'State', + ], + [ + 'name' => 'tr.country', + 'alias' => 'country', + 'type' => 'string', + 'label' => 'Country', + ], + + [ + 'name' => 'tr.tax_rate', + 'alias' => 'tax_rate', + 'type' => 'number', + 'label' => 'Tax Rate', + ], + ], + //don't use aliasing in case of searchables + 'searchable' => [ + [ + 'column' => 'tr.identifier', + 'type' => 'string', + 'label' => 'Identifier', + ], + [ + 'column' => 'tr.state', + 'type' => 'string', + 'label' => 'State', + ], + [ + 'column' => 'tr.country', + 'type' => 'string', + 'label' => 'Country', + ], + + [ + 'column' => 'tr.tax_rate', + 'type' => 'number', + 'label' => 'Tax Rate', + ], + ], + 'operators' => [ + 'eq' => "=", + 'lt' => "<", + 'gt' => ">", + 'lte' => "<=", + 'gte' => ">=", + 'neqs' => "<>", + 'neqn' => "!=", + 'like' => "like", + 'nlike' => "not like", + ], + // 'css' => [] + + ]); + + } + + public function render() { + + return $this->createTaxRateDataGrid()->render(); + + } +} \ No newline at end of file diff --git a/packages/Webkul/Admin/src/DataGrids/TaxRuleDataGrid.php b/packages/Webkul/Admin/src/DataGrids/TaxRuleDataGrid.php new file mode 100644 index 000000000..753cbc779 --- /dev/null +++ b/packages/Webkul/Admin/src/DataGrids/TaxRuleDataGrid.php @@ -0,0 +1,160 @@ + @prashant-webkul + * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) + */ + +class TaxRuleDataGrid +{ + /** + * The Tax Rule Data + * Grid implementation. + * + * @var TaxRuleDataGrid + */ + public function createTaxRuleDataGrid() + { + + return DataGrid::make([ + + 'name' => 'Tax Rule', + 'table' => 'tax_categories as tr', + 'select' => 'tr.id', + 'perpage' => 10, + 'aliased' => true, //use this with false as default and true in case of joins + + 'massoperations' =>[ + [ + 'route' => route('admin.datagrid.delete'), + 'method' => 'DELETE', + 'label' => 'Delete', + 'type' => 'button', + ], + [ + 'route' => route('admin.datagrid.index'), + 'method' => 'POST', + 'label' => 'View Grid', + 'type' => 'select', + 'options' =>[ + 1 => 'Edit', + 2 => 'Set', + 3 => 'Change Status' + ] + ], + ], + 'actions' => [ + [ + 'type' => 'Edit', + 'route' => route('admin.datagrid.delete'), + 'confirm_text' => 'Do you really wanis?', + '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' => 'tr.id', + 'alias' => 'ID', + 'type' => 'number', + 'label' => 'ID', + 'sortable' => true, + ], + [ + 'name' => 'tr.name', + 'alias' => 'Name', + 'type' => 'string', + 'label' => 'Name', + 'sortable' => true, + // 'wrapper' => function ($value, $object) { + // return '' . $object->Name . ''; + // }, + ], + [ + 'name' => 'tr.code', + 'alias' => 'code', + 'type' => 'string', + 'label' => 'Code', + 'sortable' => true, + ], + ], + //don't use aliasing in case of filters + 'filterable' => [ + [ + 'column' => 'tr.name', + 'alias' => 'Name', + 'type' => 'number', + 'label' => 'Name' + ], + [ + 'column' => 'tr.id', + 'alias' => 'ID', + 'type' => 'number', + 'label' => 'ID' + ], + [ + 'column' => 'tr.code', + 'alias' => 'code', + 'type' => 'string', + 'label' => 'Code' + ] + ], + //don't use aliasing in case of searchables + 'searchable' => [ + [ + 'column' => 'tr.code', + 'type' => 'string', + 'label' => 'Code' + ], + [ + 'column' => 'tr.name', + 'type' => 'string', + 'label' => 'Name' + ] + ], + 'operators' => [ + 'eq' => "=", + 'lt' => "<", + 'gt' => ">", + 'lte' => "<=", + 'gte' => ">=", + 'neqs' => "<>", + 'neqn' => "!=", + 'like' => "like", + 'nlike' => "not like", + ], + // 'css' => [] + + ]); + + } + + public function render() { + + return $this->createTaxRuleDataGrid()->render(); + + } +} \ No newline at end of file diff --git a/packages/Webkul/Admin/src/DataGrids/UserDataGrid.php b/packages/Webkul/Admin/src/DataGrids/UserDataGrid.php index 2f195a248..85432930a 100644 --- a/packages/Webkul/Admin/src/DataGrids/UserDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/UserDataGrid.php @@ -25,6 +25,7 @@ class UserDataGrid { return DataGrid::make([ + 'name' => 'Admins', 'table' => 'admins as u', 'select' => 'u.id', @@ -38,23 +39,23 @@ class UserDataGrid 'label' => 'Delete', 'type' => 'button', ], - // [ - // 'route' => route('admin.datagrid.index'), - // 'method' => 'POST', - // 'label' => 'View Grid', - // 'type' => 'select', - // 'options' =>[ - // 1 => 'Edit', - // 2 => 'Set', - // 3 => 'Change Status' - // ] - // ], + [ + 'route' => route('admin.datagrid.index'), + 'method' => 'POST', + 'label' => 'View Grid', + 'type' => 'select', + 'options' =>[ + 1 => 'Edit', + 2 => 'Set', + 3 => 'Change Status' + ] + ], ], 'actions' => [ [ 'type' => 'Edit', 'route' => route('admin.datagrid.delete'), - 'confirm_text' => 'Do you really want to do this?', + 'confirm_text' => 'Do you really wanis?', 'icon' => 'icon pencil-lg-icon', ], [ @@ -83,8 +84,8 @@ class UserDataGrid 'label' => 'Admin ID', 'sortable' => true, 'wrapper' => function ($value, $object) { - return '' . $object->ID . ''; - }, + return '' . $object->ID . ''; + }, ], [ 'name' => 'u.name', @@ -93,8 +94,8 @@ class UserDataGrid 'label' => 'Name', 'sortable' => true, 'wrapper' => function ($value, $object) { - return '' . $object->Name . ''; - }, + return '' . $object->Name . ''; + }, ], [ 'name' => 'u.email', @@ -117,27 +118,6 @@ class UserDataGrid 'label' => 'Role ID', 'sortable' => true, ], - // [ - // 'name' => 'a.first_name', - // 'type' => 'string', - // 'label' => 'Admin Name', - // 'sortable' => true, - // 'filterable' => true, - // // will create on run time query - // // 'filter' => [ - // // 'function' => 'where', // orwhere - // // 'condition' => ['name', '=', 'Admin'] // multiarray - // // ], - // 'attributes' => [ - // 'class' => 'class-a class-b', - // 'data-attr' => 'whatever you want', - // 'onclick' => "window.alert('alert from datagrid column')" - // ], - // 'wrapper' => function ($value, $object) { - // return '' . $object->first_name . ''; - // }, - // ], - ], //don't use aliasing in case of filters 'filterable' => [ diff --git a/packages/Webkul/Admin/src/Datagrids/User.php b/packages/Webkul/Admin/src/Datagrids/User.php deleted file mode 100644 index dcc975ea8..000000000 --- a/packages/Webkul/Admin/src/Datagrids/User.php +++ /dev/null @@ -1,151 +0,0 @@ - 'Admins', - 'table' => 'admins as u', - 'select' => 'u.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' => '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 '' . $object->ID . ''; - }, - ], [ - 'name' => 'u.name', - 'alias' => 'Name', - 'type' => 'string', - 'label' => 'Name', - 'sortable' => true, - 'wrapper' => function ($value, $object) { - return '' . $object->Name . ''; - }, - ], [ - 'name' => 'u.email', - 'alias' => 'Email', - 'type' => 'string', - 'label' => 'E-Mail', - 'sortable' => true, - ], [ - 'name' => 'r.name', - 'alias' => 'xa', - 'type' => 'string', - 'label' => 'Role Name', - 'sortable' => true, - ], [ - 'name' => 'r.id', - 'alias' => 'xc', - 'type' => 'string', - 'label' => 'Role ID', - 'sortable' => true, - ] - ], - //don't use aliasing in case of filters - 'filterable' => [ - [ - 'column' => 'u.name', - 'alias' => 'Name', - 'type' => 'string', - 'label' => 'Name' - ], [ - 'column' => 'u.email', - 'alias' => 'Email', - 'type' => 'string', - 'label' => 'Email' - ], [ - 'column' => 'u.id', - 'alias' => 'ID', - 'type' => 'number', - 'label' => 'Admin ID' - ], [ - 'column' => 'r.id', - 'alias' => 'Role_ID', - 'type' => 'number', - 'label' => 'Role ID' - ] - ], - //don't use aliasing in case of searchables - 'searchable' => [ - [ - 'column' => 'u.email', - 'type' => 'string', - 'label' => 'E-Mail' - ], [ - 'column' => 'u.name', - 'type' => 'string', - 'label' => 'Name' - ] - ], - 'operators' => [ - 'eq' => "=", - 'lt' => "<", - 'gt' => ">", - 'lte' => "<=", - 'gte' => ">=", - 'neqs' => "<>", - 'neqn' => "!=", - 'like' => "like", - 'nlike' => "not like", - ], - ]); - } - - public function render() - { - return $this->createDatagrid()->render(); - } -} \ No newline at end of file diff --git a/packages/Webkul/Admin/src/Http/Controllers/DashboardController.php b/packages/Webkul/Admin/src/Http/Controllers/DashboardController.php index 22422ed62..5bee6cde8 100644 --- a/packages/Webkul/Admin/src/Http/Controllers/DashboardController.php +++ b/packages/Webkul/Admin/src/Http/Controllers/DashboardController.php @@ -24,6 +24,8 @@ class DashboardController extends Controller public function __construct() { $this->_config = request('_config'); + + $this->middleware('admin'); } public function index() { diff --git a/packages/Webkul/Admin/src/Http/Controllers/DataGridController.php b/packages/Webkul/Admin/src/Http/Controllers/DataGridController.php index 6b4d52397..de3fa9e8d 100644 --- a/packages/Webkul/Admin/src/Http/Controllers/DataGridController.php +++ b/packages/Webkul/Admin/src/Http/Controllers/DataGridController.php @@ -15,6 +15,7 @@ use Webkul\Ui\DataGrid\Facades\DataGrid; */ class DataGridController extends Controller { + /** * Display a listing of the resource. * diff --git a/packages/Webkul/Admin/src/Http/routes.php b/packages/Webkul/Admin/src/Http/routes.php index ffa52dcad..a98ff0be2 100644 --- a/packages/Webkul/Admin/src/Http/routes.php +++ b/packages/Webkul/Admin/src/Http/routes.php @@ -9,7 +9,7 @@ Route::group(['middleware' => ['web']], function () { Route::post('/login', 'Webkul\User\Http\Controllers\SessionController@store')->defaults('_config', [ 'redirect' => 'admin.dashboard.index' - ])->name('admin.forget-password.store'); + ])->name('admin.session.store'); // Forget Password Routes @@ -36,10 +36,52 @@ Route::group(['middleware' => ['web']], function () { 'redirect' => 'admin.session.create' ])->name('admin.session.destroy'); - // Dashboard Route - Route::get('/dashboard', 'Webkul\Admin\Http\Controllers\DashboardController@index')->name('admin.dashboard.index'); + Route::get('dashboard', 'Webkul\Admin\Http\Controllers\DashboardController@index')->name('admin.dashboard.index'); + //Customers Management Routes + + Route::get('customer', 'Webkul\Core\Http\Controllers\CustomerController@index')->defaults('_config', [ + 'view' => 'admin::customers.index' + ])->name('admin.customer.index'); + + Route::get('customer/orders', 'Webkul\Core\Http\Controllers\CustomerController@index')->defaults('_config',[ + 'view' => 'admin::customers.orders.index' + ])->name('admin.customer.orders.index'); + + Route::get('customer/reviews', 'Webkul\Shop\Http\Controllers\ReviewController@index')->defaults('_config',[ + 'view' => 'admin::customers.review.index' + ])->name('admin.customer.review.index'); + + Route::get('customer/create', 'Webkul\Core\Http\Controllers\CustomerController@create')->defaults('_config',[ + 'view' => 'admin::customers.create' + ])->name('admin.customer.create'); + + Route::post('customer/create', 'Webkul\Core\Http\Controllers\CustomerController@store')->defaults('_config',[ + 'redirect' => 'admin.customer.index' + ])->name('admin.customer.store'); + + Route::get('customer/reviews/edit/{id}', 'Webkul\Shop\Http\Controllers\ReviewController@edit')->defaults('_config',[ + 'view' => 'admin::customers.review.edit' + ])->name('admin.customer.review.edit'); + + Route::put('customer/reviews/edit/{id}', 'Webkul\Shop\Http\Controllers\ReviewController@update')->defaults('_config', [ + 'redirect' => 'admin.customer.review.index' + ])->name('admin.customer.review.update'); + + Route::get('customer/edit/{id}', 'Webkul\Core\Http\Controllers\CustomerController@edit')->defaults('_config',[ + 'view' => 'admin::customers.edit' + ])->name('admin.customer.edit'); + + Route::put('customer/reviews/edit/{id}', 'Webkul\Core\Http\Controllers\CustomerController@update')->defaults('_config', [ + 'redirect' => 'admin.customer.index' + ])->name('admin.customer.update'); + + // dummy number i.e-1 is used for creating view only + + Route::get('customer/orders/1', 'Webkul\User\Http\Controllers\UserController@index')->defaults('_config', [ + 'view' => 'admin::customers.orders.order' + ])->name('admin.customer.orders.order'); // Catalog Routes Route::prefix('catalog')->group(function () { @@ -140,6 +182,8 @@ Route::group(['middleware' => ['web']], function () { Route::any('datagrid/massaction/delete', 'Webkul\Admin\Http\Controllers\DataGridController@massDelete')->name('admin.datagrid.delete'); + Route::any('datagrid/massaction/edit','Webkul\Admin\Http\Controllers\DataGridController@massUpdate')->name('admin.datagrid.edit'); + // User Routes Route::get('/users', 'Webkul\User\Http\Controllers\UserController@index')->defaults('_config', [ 'view' => 'admin::users.users.index' @@ -313,6 +357,56 @@ Route::group(['middleware' => ['web']], function () { Route::post('/slider/create','Webkul\Shop\Http\Controllers\SliderController@store')->defaults('_config',[ 'redirect' => 'admin::sliders.index' ])->name('admin.sliders.store'); + + //tax routes + Route::prefix('tax')->group(function () { + + Route::get('taxrule', 'Webkul\Core\Http\Controllers\TaxController@index')->defaults('_config', [ + 'view' => 'admin::tax.taxrule.index' + ])->name('admin.taxrule.index'); + + // tax rule routes + Route::get('taxrule/create', 'Webkul\Core\Http\Controllers\TaxCategoryController@show')->defaults('_config', [ + 'view' => 'admin::tax.taxrule.create.create' + ])->name('admin.taxrule.show'); + + Route::post('taxrule/create', 'Webkul\Core\Http\Controllers\TaxCategoryController@create')->defaults('_config', [ + 'redirect' => 'admin.taxrule.index' + ])->name('admin.taxrule.create'); + + Route::get('/taxrule/edit/{id}', 'Webkul\Core\Http\Controllers\TaxCategoryController@edit')->defaults('_config', [ + 'view' => 'admin::tax.taxrule.edit.edit' + ])->name('admin.taxrule.edit'); + + Route::put('/taxrule/edit/{id}', 'Webkul\Core\Http\Controllers\TaxCategoryController@update')->defaults('_config', [ + 'redirect' => 'admin.taxrule.index' + ])->name('admin.taxrule.update'); + + //tax rule ends + + //tax rate + + Route::get('taxrate', 'Webkul\Core\Http\Controllers\TaxRateController@index')->defaults('_config', [ + 'view' => 'admin::tax.taxrate.index' + ])->name('admin.taxrate.index'); + + Route::get('taxrate/create', 'Webkul\Core\Http\Controllers\TaxRateController@show')->defaults('_config', [ + 'view' => 'admin::tax.taxrate.create.taxrate' + ])->name('admin.taxrate.show'); + + Route::post('taxrate/create', 'Webkul\Core\Http\Controllers\TaxRateController@create')->defaults('_config', [ + 'redirect' => 'admin.taxrate.index' + ])->name('admin.taxrate.create'); + + Route::get('taxrate/edit/{id}', 'Webkul\Core\Http\Controllers\TaxRateController@edit')->defaults('_config', [ + 'view' => 'admin::tax.taxrate.edit.edit' + ])->name('admin.taxrate.store'); + + Route::put('taxrate/update/{id}', 'Webkul\Core\Http\Controllers\TaxRateController@update')->defaults('_config', [ + 'redirect' => 'admin.taxrate.index' + ])->name('admin.taxrate.update'); + }); + //tax rate ends }); }); }); diff --git a/packages/Webkul/Admin/src/Providers/EventServiceProvider.php b/packages/Webkul/Admin/src/Providers/EventServiceProvider.php index 237924c66..accef9ceb 100644 --- a/packages/Webkul/Admin/src/Providers/EventServiceProvider.php +++ b/packages/Webkul/Admin/src/Providers/EventServiceProvider.php @@ -52,6 +52,18 @@ class EventServiceProvider extends ServiceProvider $menu->add('catalog.families', 'Families', 'admin.catalog.families.index', 4); + $menu->add('customers', 'Customers', 'admin.customer.index', 5, 'customer-icon'); + + $menu->add('customers.customers', 'Customers', 'admin.customer.index', 1, ''); + + $menu->add('customers.orders', 'Orders', 'admin.customer.orders.index', 2, ''); + + $menu->add('customers.reviews', 'Review', 'admin.customer.review.index', 3, ''); + + // $menu->add('customers.blocked_customer', 'Blocked Customers', 'admin.account.edit', 2, ''); + + // $menu->add('customers.allowed_customer', 'Allowed Customers', 'admin.account.edit', 4, ''); + $menu->add('configuration', 'Configure', 'admin.account.edit', 6, 'configuration-icon'); $menu->add('configuration.account', 'My Account', 'admin.account.edit', 1); @@ -77,6 +89,12 @@ class EventServiceProvider extends ServiceProvider $menu->add('settings.users.roles', 'Roles', 'admin.roles.index', 2, ''); $menu->add('settings.sliders', 'Create Sliders', 'admin.sliders.index', 8, ''); + + $menu->add('settings.tax', 'Taxes', 'admin.taxrule.index', 9, ''); + + $menu->add('settings.tax.taxrule', 'Add Tax Rules', 'admin.taxrule.index', 1, ''); + + $menu->add('settings.tax.taxrate', 'Add Tax Rates', 'admin.taxrate.index', 2, ''); }); } diff --git a/packages/Webkul/Admin/src/Resources/assets/images/Angle-Right.svg b/packages/Webkul/Admin/src/Resources/assets/images/Angle-Right.svg new file mode 100644 index 000000000..12f46305c --- /dev/null +++ b/packages/Webkul/Admin/src/Resources/assets/images/Angle-Right.svg @@ -0,0 +1,10 @@ + + \ No newline at end of file diff --git a/packages/Webkul/Admin/src/Resources/assets/images/Icon-Graph-Green.svg b/packages/Webkul/Admin/src/Resources/assets/images/Icon-Graph-Green.svg new file mode 100644 index 000000000..ba589b67d --- /dev/null +++ b/packages/Webkul/Admin/src/Resources/assets/images/Icon-Graph-Green.svg @@ -0,0 +1,14 @@ + + \ No newline at end of file diff --git a/packages/Webkul/Admin/src/Resources/assets/sass/app.scss b/packages/Webkul/Admin/src/Resources/assets/sass/app.scss index 2235e587f..506819344 100644 --- a/packages/Webkul/Admin/src/Resources/assets/sass/app.scss +++ b/packages/Webkul/Admin/src/Resources/assets/sass/app.scss @@ -249,3 +249,53 @@ body { // } // } // } + + + +// admin dashboard css + +.dashboard-content { + + .dashboard-stats { + display: flex; + + } + + .graph-category { + display: flex; + margin-top: 25px; + } + + .sale-stock { + display: flex; + margin-top: 25px; + } + +} + +// admin dashboard css ends here + + +// customer oder css for admin start here + +.order-place-detail { + + .order-account-information { + margin-left: 10px; + } + + .address { + margin-left: 10px; + } + + .payment-shipping{ + margin-left: 10px; + } + + .order-products{ + margin-left: 10px; + } +} + + +// customer oder css for admin end here diff --git a/packages/Webkul/Admin/src/Resources/lang/en/app.php b/packages/Webkul/Admin/src/Resources/lang/en/app.php index af15f95c7..37eafd1c0 100644 --- a/packages/Webkul/Admin/src/Resources/lang/en/app.php +++ b/packages/Webkul/Admin/src/Resources/lang/en/app.php @@ -41,7 +41,7 @@ return [ 'all' => 'All' ], 'users' => [ - 'title' => 'Users', + 'title' => 'User', 'add-user-title' => 'Add User', 'edit-user-title' => 'Edit User', 'save-btn-title' => 'Save User', @@ -175,6 +175,43 @@ return [ 'meta_keywords' => 'Meta Keywords', ] ], + + 'configuration' => [ + 'tax' => [ + 'title' => 'Taxes', + 'add-title' => 'Add Tax Rule' + ], + 'taxrule' => [ + 'title' => 'Add Tax Rule', + 'create' => 'Create Tax Rule', + 'general' => 'Tax Rule', + 'select-channel' => 'Select Channel', + 'name' => 'Name', + 'code' => 'Code', + 'description' => 'Description', + 'select-taxrates' => 'Select Tax Rates', + 'edit' => [ + 'title' => 'Edit Tax Rule', + 'edit-button-title' => 'Edit Rule' + ] + ], + 'taxrate' => [ + 'title' => 'Add Tax Rate', + 'general' => 'Tax Rate', + 'identifier' => 'Identifier', + 'is_zip' => 'Enable Zip Range', + 'zip_from' => 'Zip From', + 'zip_to' => 'Zip To', + 'state' => 'State', + 'country' => 'Country', + 'tax_rate' => 'Rate', + 'edit' => [ + 'title' => 'Edit Tax Rate', + 'edit-button-title' => 'Edit Rate' + ] + ], + ], + 'settings' => [ 'locales' => [ 'title' => 'Locales', @@ -265,5 +302,24 @@ return [ 'content' => 'Content', 'channels' => 'Channel' ], + ], + 'customers' => [ + 'customers' => [ + 'title' => 'Customers', + 'first_name' => 'First Name', + 'last_name' => 'Last Name', + 'gender' => 'Gender', + 'email' => 'Email', + 'date_of_birth' => 'Date of Birth', + 'phone' => 'Phone', + 'customer_group' => 'Customer Group' + ], + 'reviews' => [ + 'title' => 'Title', + 'name' => 'Reviews', + 'rating' => 'Rating', + 'status' => 'Status', + 'comment' => 'Comment' + ] ] ]; \ No newline at end of file diff --git a/packages/Webkul/Admin/src/Resources/views/account/edit.blade.php b/packages/Webkul/Admin/src/Resources/views/account/edit.blade.php index 75f44f617..5eed7df25 100644 --- a/packages/Webkul/Admin/src/Resources/views/account/edit.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/account/edit.blade.php @@ -18,7 +18,7 @@