merge conflict

This commit is contained in:
rahul shukla 2018-09-08 14:22:46 +05:30
commit d0e0b64445
115 changed files with 3435 additions and 505 deletions

View File

@ -56,7 +56,8 @@
"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"
}
},
"autoload-dev": {

View File

@ -172,6 +172,8 @@ return [
//Laravel Intervention
Intervention\Image\ImageServiceProvider::class,
//Repository
Prettus\Repository\Providers\RepositoryServiceProvider::class,
//Webkul packages
@ -187,7 +189,8 @@ 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,
],
/*

View File

@ -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',
],

View File

@ -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',
],

View File

@ -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',
],
],

View File

@ -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

View File

@ -0,0 +1,199 @@
<?php
namespace Webkul\Admin\DataGrids;
use Illuminate\View\View;
use Webkul\Ui\DataGrid\Facades\DataGrid;
/**
* Tax Rates DataGrid
*
* @author Prashant Singh <prashant.singh852@webkul.com> @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 '<a class="color-red">' . $object->Name . '</a>';
// },
],
[
'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();
}
}

View File

@ -0,0 +1,160 @@
<?php
namespace Webkul\Admin\DataGrids;
use Illuminate\View\View;
use Webkul\Ui\DataGrid\Facades\DataGrid;
/**
* Tax Rules DataGrid
*
* @author Prashant Singh <prashant.singh852@webkul.com> @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 '<a class="color-red">' . $object->Name . '</a>';
// },
],
[
'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();
}
}

View File

@ -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 '<a class="color-red">' . $object->ID . '</a>';
},
return '<a class="color-red">' . $object->ID . '</a>';
},
],
[
'name' => 'u.name',
@ -93,8 +94,8 @@ class UserDataGrid
'label' => 'Name',
'sortable' => true,
'wrapper' => function ($value, $object) {
return '<a class="color-red">' . $object->Name . '</a>';
},
return '<a class="color-red">' . $object->Name . '</a>';
},
],
[
'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 '<a href="'.$value.'">' . $object->first_name . '</a>';
// },
// ],
],
//don't use aliasing in case of filters
'filterable' => [

View File

@ -1,151 +0,0 @@
<?php
namespace Webkul\Admin\Datagrids;
use Illuminate\View\View;
use Webkul\Ui\DataGrid\Facades\DataGrid;
class User
{
/**
* Create datagrid.
*
* @return void
*/
public function createDatagrid()
{
return DataGrid::make([
'name' => '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 '<a class="color-red">' . $object->ID . '</a>';
},
], [
'name' => 'u.name',
'alias' => 'Name',
'type' => 'string',
'label' => 'Name',
'sortable' => true,
'wrapper' => function ($value, $object) {
return '<a class="color-red">' . $object->Name . '</a>';
},
], [
'name' => 'u.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();
}
}

View File

@ -24,6 +24,8 @@ class DashboardController extends Controller
public function __construct()
{
$this->_config = request('_config');
$this->middleware('admin');
}
public function index()
{

View File

@ -15,6 +15,7 @@ use Webkul\Ui\DataGrid\Facades\DataGrid;
*/
class DataGridController extends Controller
{
/**
* Display a listing of the resource.
*

View File

@ -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
@ -174,6 +174,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'
@ -347,6 +349,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
});
});
});

View File

@ -89,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, '');
});
}

View File

@ -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',

View File

@ -18,7 +18,7 @@
</div>
<div class="page-content">
<div class="form-container">
@csrf()

View File

@ -47,7 +47,7 @@
{{ $currency->name }}
</option>
@endforeach
</select>
</select>
<span class="control-error" v-if="errors.has('target_currency')">@{{ errors.first('target_currency') }}</span>
</div>

View File

@ -0,0 +1,93 @@
@extends('admin::layouts.content')
@section('page_title')
{{ __('admin::app.configuration.taxrate.title') }}
@stop
@section('content')
<div class="content">
<form method="POST" action="{{ route('admin.taxrate.create') }}" @submit.prevent="onSubmit">
<div class="page-header">
<div class="page-title">
<h1>{{ __('admin::app.configuration.taxrate.title') }}</h1>
</div>
<div class="page-action">
<button type="submit" class="btn btn-lg btn-primary">
{{ __('admin::app.configuration.taxrule.create') }}
</button>
</div>
</div>
<div class="page-content">
<div class="form-container">
@csrf()
<accordian :title="'{{ __('admin::app.configuration.taxrate.general') }}'" :active="true">
<div slot="body">
<div class="control-group" :class="[errors.has('identifier') ? 'has-error' : '']">
<label for="identifier" class="required">{{ __('admin::app.configuration.taxrate.identifier') }}</label>
<input v-validate="'required'" class="control" id="identifier" name="identifier" value="{{ old('identifier') }}"/>
<span class="control-error" v-if="errors.has('identifier')">@{{ errors.first('identifier') }}</span>
</div>
<div class="control-group">
<span class="checkbox">
<input type="checkbox" id="is_zip" name="is_zip">
<label class="checkbox-view" for="is_zip"></label>
Enable Zip Range
</span>
</div>
<div class="control-group" :class="[errors.has('zip_from') ? 'has-error' : '']">
<label for="zip_from" class="required">{{ __('admin::app.configuration.taxrate.zip_from') }}</label>
<input v-validate="'numeric'" class="control" id="zip_from" name="zip_from" value="{{ old('zip_from') }}"/>
<span class="control-error" v-if="errors.has('zip_from')">@{{ errors.first('zip_from') }}</span>
</div>
<div class="control-group" :class="[errors.has('zip_to') ? 'has-error' : '']">
<label for="zip_to" class="required">{{ __('admin::app.configuration.taxrate.zip_to') }}</label>
<input v-validate="'numeric'" class="control" id="zip_to" name="zip_to" value="{{ old('zip_to') }}"/>
<span class="control-error" v-if="errors.has('zip_to')">@{{ errors.first('zip_to') }}</span>
</div>
<div class="control-group" :class="[errors.has('state') ? 'has-error' : '']">
<label for="state" class="required">{{ __('admin::app.configuration.taxrate.state') }}</label>
<input v-validate="'required'" class="control" id="state" name="state" value="{{ old('state') }}"/>
<span class="control-error" v-if="errors.has('state')">@{{ errors.first('state') }}</span>
</div>
<div class="control-group" :class="[errors.has('country') ? 'has-error' : '']">
<label for="country" class="required">{{ __('admin::app.configuration.taxrate.country') }}</label>
<input v-validate="'required'" class="control" id="country" name="country" value="{{ old('country') }}"/>
<span class="control-error" v-if="errors.has('country')">@{{ errors.first('country') }}</span>
</div>
<div class="control-group" :class="[errors.has('tax_rate') ? 'has-error' : '']">
<label for="tax_rate" class="required">{{ __('admin::app.configuration.taxrate.tax_rate') }}</label>
<input v-validate="'required'" class="control" id="tax_rate" name="tax_rate" value="{{ old('tax_rate') }}"/>
<span class="control-error" v-if="errors.has('tax_rate')">@{{ errors.first('tax_rate') }}</span>
</div>
</div>
</accordian>
</div>
</div>
</form>
</div>
@stop

View File

@ -0,0 +1,93 @@
@extends('admin::layouts.content')
@section('page_title')
{{ __('admin::app.configuration.taxrate.title') }}
@stop
@section('content')
<div class="content">
<form method="POST" action="{{ route('admin.taxrate.update', $data['id']) }}" @submit.prevent="onSubmit">
<div class="page-header">
<div class="page-title">
<h1>{{ __('admin::app.configuration.taxrate.edit.title') }}</h1>
</div>
<div class="page-action">
<button type="submit" class="btn btn-lg btn-primary">
{{ __('admin::app.configuration.taxrate.edit.edit-button-title') }}
</button>
</div>
</div>
<div class="page-content">
<div class="form-container">
@method('PUT')
@csrf()
<accordian :title="'{{ __('admin::app.configuration.taxrate.general') }}'" :active="true">
<div slot="body">
<div class="control-group" :class="[errors.has('identifier') ? 'has-error' : '']">
<label for="identifier" class="required">{{ __('admin::app.configuration.taxrate.identifier') }}</label>
<input v-validate="'required'" class="control" id="identifier" name="identifier" value="{{ $data['identifier'] }}"/>
<span class="control-error" v-if="errors.has('identifier')">@{{ errors.first('identifier') }}</span>
</div>
<div class="control-group">
<span class="checkbox">
<input type="checkbox" id="is_zip" name="is_zip">
<label class="checkbox-view" for="is_zip"></label>
Enable Zip Range
</span>
</div>
<div class="control-group" :class="[errors.has('zip_from') ? 'has-error' : '']">
<label for="zip_from" class="required">{{ __('admin::app.configuration.taxrate.zip_from') }}</label>
<input v-validate="'numeric'" class="control" id="zip_from" name="zip_from" value="{{ $data['zip_from'] }}" />
<span class="control-error" v-if="errors.has('zip_from')">@{{ errors.first('zip_from') }}</span>
</div>
<div class="control-group" :class="[errors.has('zip_to') ? 'has-error' : '']">
<label for="zip_to" class="required">{{ __('admin::app.configuration.taxrate.zip_to') }}</label>
<input v-validate="'numeric'" class="control" id="zip_to" name="zip_to" value="{{ $data['zip_to'] }}" />
<span class="control-error" v-if="errors.has('zip_to')">@{{ errors.first('zip_to') }}</span>
</div>
<div class="control-group" :class="[errors.has('state') ? 'has-error' : '']">
<label for="state" class="required">{{ __('admin::app.configuration.taxrate.state') }}</label>
<input v-validate="'required'" class="control" id="state" name="state" value="{{ $data['state'] }}" />
<span class="control-error" v-if="errors.has('state')">@{{ errors.first('state') }}</span>
</div>
<div class="control-group" :class="[errors.has('country') ? 'has-error' : '']">
<label for="country" class="required">{{ __('admin::app.configuration.taxrate.country') }}</label>
<input v-validate="'required'" class="control" id="country" name="country" value="{{ $data['country'] }}" />
<span class="control-error" v-if="errors.has('country')">@{{ errors.first('country') }}</span>
</div>
<div class="control-group" :class="[errors.has('tax_rate') ? 'has-error' : '']">
<label for="tax_rate" class="required">{{ __('admin::app.configuration.taxrate.tax_rate') }}</label>
<input v-validate="'required'" class="control" id="tax_rate" name="tax_rate" value="{{ $data['tax_rate'] }}" />
<span class="control-error" v-if="errors.has('tax_rate')">@{{ errors.first('tax_rate') }}</span>
</div>
</div>
</accordian>
</div>
</div>
</form>
</div>
@stop

View File

@ -0,0 +1,26 @@
@extends('admin::layouts.content')
@section('page_title')
{{ __('admin::app.configuration.taxrate.title') }}
@stop
@section('content')
<div class="content">
<div class="page-header">
<div class="page-title">
<h1>{{ __('admin::app.configuration.taxrate.title') }}</h1>
</div>
<div class="page-action">
<a href="{{ route('admin.taxrate.show') }}" class="btn btn-lg btn-primary">
{{ __('admin::app.configuration.taxrate.title') }}
</a>
</div>
</div>
<div class="page-content">
@inject('taxrates', 'Webkul\Admin\DataGrids\TaxRateDataGrid')
{!! $taxrates->render() !!}
</div>
</div>
@endsection

View File

@ -0,0 +1,87 @@
@extends('admin::layouts.content')
@section('page_title')
{{ __('admin::app.configuration.taxrule.title') }}
@stop
@section('content')
<div class="content">
<form method="POST" action="{{ route('admin.taxrule.create') }}" @submit.prevent="onSubmit">
<div class="page-header">
<div class="page-title">
<h1>{{ __('admin::app.configuration.taxrule.title') }}</h1>
</div>
<div class="page-action">
<button type="submit" class="btn btn-lg btn-primary">
{{ __('admin::app.configuration.taxrule.create') }}
</button>
</div>
</div>
<div class="page-content">
<div class="form-container">
@csrf()
<accordian :title="'{{ __('admin::app.configuration.taxrule.general') }}'" :active="true">
<div slot="body">
<div class="control-group" :class="[errors.has('channel') ? 'has-error' : '']">
<label for="channel" class="required">{{ __('admin::app.configuration.taxrule.select-channel') }}</label>
<select class="control" name="channel_id">
@foreach(core()->getAllChannels() as $channelModel)
<option value="{{ $channelModel->id }}">
{{ $channelModel->name }}
</option>
@endforeach
</select>
<span class="control-error" v-if="errors.has('channel')">@{{ errors.first('channel') }}</span>
</div>
<div class="control-group" :class="[errors.has('code') ? 'has-error' : '']">
<label for="code" class="required">{{ __('admin::app.configuration.taxrule.code') }}</label>
<input v-validate="'required'" class="control" id="code" name="code" value="{{ old('code') }}"/>
<span class="control-error" v-if="errors.has('code')">@{{ errors.first('code') }}</span>
</div>
<div class="control-group" :class="[errors.has('name') ? 'has-error' : '']">
<label for="name" class="required">{{ __('admin::app.configuration.taxrule.name') }}</label>
<input v-validate="'required'" class="control" id="name" name="name" value="{{ old('name') }}"/>
<span class="control-error" v-if="errors.has('name')">@{{ errors.first('name') }}</span>
</div>
<div class="control-group" :class="[errors.has('description') ? 'has-error' : '']">
<label for="description" class="required">{{ __('admin::app.configuration.taxrule.description') }}</label>
<textarea v-validate="'required'" class="control" id="description" name="description" value="{{ old('description') }}"></textarea>
<span class="control-error" v-if="errors.has('description')">@{{ errors.first('description') }}</span>
</div>
<div class="control-group" :class="[errors.has('taxrates') ? 'has-error' : '']">
<label for="taxrates" class="required">{{ __('admin::app.configuration.taxrule.select-taxrates') }}</label>
<select multiple="multiple" v-validate="'required'" class="control" id="taxrates" name="taxrates[]" value="{{ old('taxrates') }}">
@foreach($taxRates as $taxRate)
<option value="{{ $taxRate['id'] }}">{{ $taxRate['identifier'] }}</option>
@endforeach
</select>
<span class="control-error" v-if="errors.has('taxrates')">@{{ errors.first('taxrates') }}</span>
</div>
</div>
</accordian>
</div>
</div>
</form>
</div>
@stop

View File

@ -0,0 +1,99 @@
@extends('admin::layouts.content')
@section('page_title')
{{ __('admin::app.configuration.taxrate.title') }}
@stop
@section('content')
<div class="content">
<form method="POST" action="{{ route('admin.taxrule.update', $data[0][0]['id']) }}" @submit.prevent="onSubmit">
<div class="page-header">
<div class="page-title">
<h1>{{ __('admin::app.configuration.taxrule.edit.title') }}</h1>
</div>
<div class="page-action">
<button type="submit" class="btn btn-lg btn-primary">
{{ __('admin::app.configuration.taxrule.edit.edit-button-title') }}
</button>
</div>
</div>
<div class="page-content">
<div class="form-container">
@csrf()
@method('PUT')
<accordian :title="'{{ __('admin::app.configuration.taxrule.general') }}'" :active="true">
<div slot="body">
<div class="control-group" :class="[errors.has('channel') ? 'has-error' : '']">
<label for="channel" class="required">{{ __('admin::app.configuration.taxrule.select-channel') }}</label>
<select class="control" name="channel">
@foreach(core()->getAllChannels() as $channelModel)
<option @if($data[0][0]['channel_id'] == $channelModel->id) selected @endif value="{{ $channelModel->id }}">
{{ $channelModel->name }}
</option>
@endforeach
</select>
<span class="control-error" v-if="errors.has('channel')">@{{ errors.first('channel') }}</span>
</div>
<div class="control-group" :class="[errors.has('code') ? 'has-error' : '']">
<label for="code" class="required">{{ __('admin::app.configuration.taxrule.code') }}</label>
<input v-validate="'required'" class="control" id="code" name="code" value="{{ $data[0][0]['code'] }}"/>
<span class="control-error" v-if="errors.has('code')">@{{ errors.first('code') }}</span>
</div>
<div class="control-group" :class="[errors.has('name') ? 'has-error' : '']">
<label for="name" class="required">{{ __('admin::app.configuration.taxrule.name') }}</label>
<input v-validate="'required'" class="control" id="name" name="name" value="{{ $data[0][0]['name'] }}"/>
<span class="control-error" v-if="errors.has('name')">@{{ errors.first('name') }}</span>
</div>
<div class="control-group" :class="[errors.has('description') ? 'has-error' : '']">
<label for="description" class="required">{{ __('admin::app.configuration.taxrule.description') }}</label>
<textarea v-validate="'required'" class="control" id="description" name="description">{{ $data[0][0]['description'] }}</textarea>
<span class="control-error" v-if="errors.has('description')">@{{ errors.first('description') }}</span>
</div>
<div class="control-group" :class="[errors.has('taxrates') ? 'has-error' : '']">
<label for="taxrates" class="required">{{ __('admin::app.configuration.taxrule.select-taxrates') }}</label>
@inject('taxRates', 'Webkul\Core\Repositories\TaxRatesRepository')
<select multiple="multiple" class="control" id="taxrates" name="taxrates[]" v-validate="'required'">
@foreach($taxRates->all() as $taxRate)
<option value="{{ $taxRate->id }}"
@foreach($data[1] as $selectedRate)
@if($taxRate->id == $selectedRate['id'])
selected
@endif
@endforeach>
{{ $taxRate->identifier }}
</option>
@endforeach
</select>
<span class="control-error" v-if="errors.has('taxrates')">@{{ errors.first('taxrates[]') }}</span>
</div>
</div>
</accordian>
</div>
</div>
</form>
</div>
@stop

View File

@ -0,0 +1,22 @@
@extends('admin::layouts.content')
@section('content')
<div class="content">
<div class="page-header">
<div class="page-title">
<h1>{{ __('admin::app.configuration.tax.title') }}</h1>
</div>
<div class="page-action">
<a href="{{ route('admin.taxrule.show') }}" class="btn btn-lg btn-primary">
{{ __('admin::app.configuration.tax.add-title') }}
</a>
</div>
</div>
<div class="page-content">
@inject('taxrule','Webkul\Admin\DataGrids\TaxRuleDataGrid')
{!! $taxrule->render() !!}
</div>
</div>
@stop

View File

@ -14,7 +14,7 @@
<h1>{{ __('admin::app.users.sessions.title') }}</h1>
<form method="POST" action="login" @submit.prevent="onSubmit">
<form method="POST" action="{{ route('admin.session.store') }}" @submit.prevent="onSubmit">
@csrf
<div class="control-group" :class="[errors.has('email') ? 'has-error' : '']">
@ -40,14 +40,14 @@
{{ __('admin::app.users.sessions.remember-me') }}
</span>
</div>
<div class="button-group">
<button class="btn btn-xl btn-primary">{{ __('admin::app.users.sessions.submit-btn-title') }}</button>
</div>
</form>
</div>
</div>
</div>

View File

@ -6,8 +6,6 @@
@section('content')
@inject ('datagrid', 'Webkul\Admin\Datagrids\User')
<div class="content">
<div class="page-header">
<div class="page-title">

View File

@ -21,7 +21,7 @@ class AttributeController extends Controller
* @var array
*/
protected $_config;
/**
* AttributeRepository object
*
@ -37,6 +37,8 @@ class AttributeController extends Controller
*/
public function __construct(Attribute $attribute)
{
$this->middleware('admin');
$this->attribute = $attribute;
$this->_config = request('_config');
@ -109,7 +111,7 @@ class AttributeController extends Controller
'admin_name' => 'required',
'type' => 'required'
]);
$this->attribute->update(request()->all(), $id);
session()->flash('success', 'Attribute updated successfully.');

View File

@ -22,7 +22,7 @@ class AttributeFamilyController extends Controller
* @var array
*/
protected $_config;
/**
* AttributeFamilyRepository object
*
@ -38,6 +38,8 @@ class AttributeFamilyController extends Controller
*/
public function __construct(AttributeFamily $attributeFamily)
{
$this->middleware('admin');
$this->attributeFamily = $attributeFamily;
$this->_config = request('_config');
@ -62,7 +64,7 @@ class AttributeFamilyController extends Controller
public function create(Attribute $attribute)
{
$attributeFamily = $this->attributeFamily->with(['attribute_groups.custom_attributes'])->findOneByField('code', 'default');
$custom_attributes = $attribute->all(['id', 'code', 'admin_name', 'type']);
return view($this->_config['view'], compact('custom_attributes', 'attributeFamily'));
@ -116,7 +118,7 @@ class AttributeFamilyController extends Controller
'code' => ['required', 'unique:attribute_families,code,' . $id, new \Webkul\Core\Contracts\Validations\Code],
'name' => 'required'
]);
$this->attributeFamily->update(request()->all(), $id);

View File

@ -4,6 +4,7 @@ namespace Webkul\Attribute\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Routing\Router;
use Webkul\User\Http\Middleware\RedirectIfNotAdmin;
class AttributeServiceProvider extends ServiceProvider
{
@ -14,6 +15,8 @@ class AttributeServiceProvider extends ServiceProvider
*/
public function boot(Router $router)
{
$router->aliasMiddleware('admin', RedirectIfNotAdmin::class);
$this->loadMigrationsFrom(__DIR__ . '/../Database/Migrations');
}
@ -24,6 +27,6 @@ class AttributeServiceProvider extends ServiceProvider
*/
public function register()
{
}
}

View File

@ -0,0 +1,26 @@
{
"name": "webkul/laravel-cart",
"description": "Cart Package for customer.",
"license": "MIT",
"authors": [
{
"name": "prashant-webkul",
"email": "prashant.singh852@webkul.com"
}
],
"require": {},
"autoload": {
"psr-4": {
"Webkul\\Cart\\": "src/"
}
},
"extra": {
"laravel": {
"providers": [
"Webkul\\Cart\\Providers\\CartServiceProvider"
],
"aliases": {}
}
},
"minimum-stability": "dev"
}

View File

@ -0,0 +1,38 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateCartTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('cart', function (Blueprint $table) {
$table->increments('id');
$table->integer('customer_id')->unsigned()->nullable();
$table->foreign('customer_id')->references('id')->on('customers');
$table->string('session_id')->nullable();
$table->integer('channel_id')->unsigned();
$table->foreign('channel_id')->references('id')->on('channels');
$table->string('coupon_code')->nullable();
$table->boolean('is_gift')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('cart');
}
}

View File

@ -0,0 +1,39 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateCartItemsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('cart_items', function (Blueprint $table) {
$table->increments('id');
$table->integer('product_id')->unsigned();
$table->foreign('product_id')->references('id')->on('products');
$table->integer('quantity')->unsigned()->default(1);
$table->integer('cart_id')->unsigned();
$table->foreign('cart_id')->references('id')->on('cart');
$table->integer('tax_category_id')->unsigned()->nullable();
$table->foreign('tax_category_id')->references('id')->on('tax_categories');
$table->string('coupon_code')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('cart_items');
}
}

View File

@ -0,0 +1,45 @@
<?php
namespace Webkul\Cart\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Webkul\Cart\Repositories\CartRepository;
use Webkul\Cart\Repositories\CartItemsRepository;
use Session;
/**
* Cart controller for the customer
* and guest users for adding and
* removing the products in the
* cart.
*
* @author Prashant Singh <prashant.singh852@webkul.com>
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class CartController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
protected $_config;
protected $cart;
public function __construct(CartRepository $cart)
{
$this->middleware(['customer', 'guest']);
$this->_config = request('_config');
$this->cart = $cart;
}
public function add() {
return "Adding Items to Cart";
}
}

View File

@ -0,0 +1,12 @@
<?php
namespace Webkul\Cart\Models;
class Cart
{
protected $table = 'cart';
protected $fillable = ['customer_id','session_id','channel_id','coupon_code','is_gift'];
protected $hidden = ['coupon_code'];
}

View File

@ -0,0 +1,10 @@
<?php
namespace Webkul\Cart\Models;
class CartItems
{
protected $table = 'cart_items';
protected $fillable = ['product_id','quantity','cart_id','tax_category_id','coupon_code'];
}

View File

@ -0,0 +1,28 @@
<?php
namespace Webkul\Cart\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Routing\Router;
use Webkul\Customer\Http\Middleware\RedirectIfNotCustomer;
class CartServiceProvider extends ServiceProvider
{
public function boot(Router $router)
{
$router->aliasMiddleware('customer', RedirectIfNotCustomer::class);
$this->loadMigrationsFrom(__DIR__ . '/../Database/migrations');
}
/**
* Register services.
*
* @return void
*/
public function register()
{
// $this->app->bind('datagrid', 'Webkul\Ui\DataGrid\DataGrid');
}
}

View File

@ -0,0 +1,54 @@
<?php
namespace Webkul\Cart\Repositories;
use Webkul\Core\Eloquent\Repository;
/**
* Cart Items Reposotory
*
* @author Prashant Singh <prashant.singh852@webkul.com>
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class CartItemsRepository extends Repository
{
/**
* Specify Model class name
*
* @return mixed
*/
function model()
{
return 'Webkul\Cart\Models\CartItems';
}
/**
* @param array $data
* @return mixed
*/
public function create(array $data)
{
$cartitems = $this->model->create($data);
return $cartitems;
}
/**
* @param array $data
* @param $id
* @param string $attribute
* @return mixed
*/
public function update(array $data, $id, $attribute = "id")
{
$cartitems = $this->find($id);
$cartitems->update($data);
return $cartitems;
}
}

View File

@ -0,0 +1,54 @@
<?php
namespace Webkul\Cart\Repositories;
use Webkul\Core\Eloquent\Repository;
/**
* Cart Reposotory
*
* @author Prashant Singh <prashant.singh852@webkul.com>
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class CartRepository extends Repository
{
/**
* Specify Model class name
*
* @return mixed
*/
function model()
{
return 'Webkul\Cart\Models\Cart';
}
/**
* @param array $data
* @return mixed
*/
public function create(array $data)
{
$cart = $this->model->create($data);
return $cart;
}
/**
* @param array $data
* @param $id
* @param string $attribute
* @return mixed
*/
public function update(array $data, $id, $attribute = "id")
{
$cart = $this->find($id);
$cart->update($data);
return $cart;
}
}

View File

@ -20,7 +20,7 @@ class CategoryController extends Controller
* @var array
*/
protected $_config;
/**
* CategoryRepository object
*
@ -36,6 +36,8 @@ class CategoryController extends Controller
*/
public function __construct(Category $category)
{
$this->middleware('admin');
$this->category = $category;
$this->_config = request('_config');

View File

@ -5,6 +5,7 @@ namespace Webkul\Category\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Foundation\AliasLoader;
use Illuminate\Routing\Router;
use Webkul\User\Http\Middleware\RedirectIfNotAdmin;
class CategoryServiceProvider extends ServiceProvider
{
@ -15,6 +16,8 @@ class CategoryServiceProvider extends ServiceProvider
*/
public function boot(Router $router)
{
$router->aliasMiddleware('admin', RedirectIfNotAdmin::class);
$this->loadMigrationsFrom(__DIR__ . '/../Database/Migrations');
}
@ -25,6 +28,6 @@ class CategoryServiceProvider extends ServiceProvider
*/
public function register()
{
}
}

View File

@ -6,6 +6,8 @@ use Carbon\Carbon;
use Webkul\Core\Models\Channel as ChannelModel;
use Webkul\Core\Models\Locale as LocaleModel;
use Webkul\Core\Models\Currency as CurrencyModel;
use Webkul\Core\Models\TaxCategory as TaxCategory;
use Webkul\Core\Models\TaxRate as TaxRate;
class Core
{
@ -141,7 +143,7 @@ class Core
$currencyCode = $channel->base_currency;
// $currencyCode = $channel->base_currency->code;
return currency($price, $currencyCode);
}
@ -213,6 +215,27 @@ class Core
// $timezonelist = \DateTimeZone::listIdentifiers(\DateTimeZone::ALL);
/**
* Find all the tax
* rates associated
* with a tax category.
*
* @return Array
*/
public function withRates($id) {
return TaxCategory::findOrFail($id)->tax_rates;
}
/**
* To fetch all
* tax rates.
*
* @return Collection
*/
public function getAllTaxRates() {
return TaxRate::all();
}
/**
* Format date using current channel.

View File

@ -0,0 +1,42 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateTaxCategoriesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('tax_categories', function (Blueprint $table) {
$table->increments('id');
$table->integer('channel_id')->unsigned();
$table->foreign('channel_id')->references('id')->on('channels')->onDelete('cascade');
$table->string('code')->unique();
$table->string('name')->unique();
$table->longtext('description');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('tax_rules');
}
}

View File

@ -0,0 +1,46 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateTaxRatesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('tax_rates', function (Blueprint $table) {
$table->increments('id');
$table->string('identifier')->unique();
$table->boolean('is_zip_from')->default(0);
$table->integer('zip_from')->unsigned()->nullable();
$table->integer('zip_to')->unsigned()->nullable();
$table->string('state');
$table->string('country');
$table->float('tax_rate', 6, 4);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('tax_rates');
}
}

View File

@ -0,0 +1,42 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateTaxMappingsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('tax_categories_tax_rates', function (Blueprint $table) {
$table->increments('id');
$table->integer('tax_category_id')->unsigned();
$table->foreign('tax_category_id')->references('id')->on('tax_categories')->onDelete('cascade');
$table->integer('tax_rate_id')->unsigned();
$table->foreign('tax_rate_id')->references('id')->on('tax_rates')->onDelete('cascade');
$table->unique(['tax_category_id', 'tax_rate_id'], 'tax_map_index_unique');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('tax_map');
}
}

View File

@ -21,7 +21,7 @@ class ChannelController extends Controller
* @var array
*/
protected $_config;
/**
* ChannelRepository object
*
@ -37,6 +37,8 @@ class ChannelController extends Controller
*/
public function __construct(Channel $channel)
{
$this->middleware('admin');
$this->channel = $channel;
$this->_config = request('_config');

View File

@ -20,7 +20,7 @@ class CountryController extends Controller
* @var array
*/
protected $_config;
/**
* CountryRepository object
*
@ -36,6 +36,8 @@ class CountryController extends Controller
*/
public function __construct(Country $country)
{
$this->middleware('admin');
$this->country = $country;
$this->_config = request('_config');

View File

@ -20,7 +20,7 @@ class CurrencyController extends Controller
* @var array
*/
protected $_config;
/**
* CurrencyRepository object
*
@ -36,6 +36,8 @@ class CurrencyController extends Controller
*/
public function __construct(Currency $currency)
{
$this->middleware('admin');
$this->currency = $currency;
$this->_config = request('_config');
@ -81,7 +83,7 @@ class CurrencyController extends Controller
return redirect()->route($this->_config['redirect']);
}
/**
* Remove the specified resource from storage.
*

View File

@ -21,14 +21,14 @@ class ExchangeRateController extends Controller
* @var array
*/
protected $_config;
/**
* ExchangeRateRepository object
*
* @var array
*/
protected $exchangeRate;
/**
* CurrencyRepository object
*
@ -45,6 +45,8 @@ class ExchangeRateController extends Controller
*/
public function __construct(ExchangeRate $exchangeRate, Currency $currency)
{
$this->middleware('admin');
$this->exchangeRate = $exchangeRate;
$this->currency = $currency;
@ -129,7 +131,7 @@ class ExchangeRateController extends Controller
'target_currency' => 'required',
'ratio' => 'required|numeric'
]);
$this->exchangeRate->update(request()->all(), $id);
session()->flash('success', 'Exchange rate updated successfully.');

View File

@ -20,7 +20,7 @@ class LocaleController extends Controller
* @var array
*/
protected $_config;
/**
* LocaleRepository object
*
@ -36,6 +36,8 @@ class LocaleController extends Controller
*/
public function __construct(Locale $locale)
{
$this->middleware('admin');
$this->locale = $locale;
$this->_config = request('_config');

View File

@ -0,0 +1,177 @@
<?php
namespace Webkul\Core\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Webkul\Channel\Channel as Channel;
use Webkul\Core\Repositories\TaxCategoriesRepository as TaxRule;
use Webkul\Core\Repositories\TaxRatesRepository as TaxRate;
use Webkul\Core\Repositories\TaxMapRepository as TaxMap;
/**
* Tax controller
*
* @author Prashant Singh <prashant.singh852@webkul.com>
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class TaxCategoryController extends Controller
{
/**
* Contains route related configuration
*
* @var array
*/
protected $_config;
/**
* Contains the current
* channel.
*
* @var string
*/
protected $currentChannelId;
/**
* Tax Rule Repository object
*
* @var array
*/
protected $taxRule;
/**
* Create a new controller instance.
*
* @param Webkul\Core\Repositories\TaxCategoriesRepository $taxRule
* @return void
*/
public function __construct(TaxRule $taxRule, TaxRate $taxRate, TaxMap $taxMap)
{
$this->middleware('admin');
$this->currentChannelId = core()->getCurrentChannel()->id;
$this->taxRule = $taxRule;
$this->taxRate = $taxRate;
$this->taxMap = $taxMap;
$this->_config = request('_config');
}
/**
* Function to show
* the tax rule form
*
* @return view
*/
public function show()
{
return view($this->_config['view'])->with('taxRates', $this->taxRate->all());
}
/**
* Function to create
* the tax rule.
*
* @return view
*/
public function create()
{
$data = request()->input();
$this->validate(request(), [
'code' => 'required|string|unique:tax_categories,id',
'name' => 'required|string|unique:tax_categories,name',
'description' => 'required|string'
]);
if($currentTaxRule = $this->taxRule->create(request()->input())) {
$allTaxRules = $data['taxrates'];
$this->taxRule->onlyAttach($currentTaxRule->id, $allTaxRules);
session()->flash('success', 'New Tax Rule Created');
return redirect()->route($this->_config['redirect']);
} else {
session()->flash('error', 'Cannot create the tax rule');
}
return view($this->_config['view']);
}
/**
* To show the edit
* form form the tax
* rule
*
* @return view
*/
public function edit($id) {
$taxRates = core()->withRates($id)->toArray();
$taxRule = $this->taxRule->findByField('id', $id)->toArray();
return view($this->_config['view'])->with('data', [$taxRule, $taxRates]);
}
/**
* To update the
* tax rule
*
* @return view
*/
public function update($id) {
//return the tax rule data with the mapping table data also,
//allow the user to change the tax rates associated with the
// rule also.
$this->validate(request(), [
'channel' => 'required|numeric',
'code' => 'required|string|unique:tax_categories,id,'.$id,
'name' => 'required|string|unique:tax_categories,name,'.$id,
'description' => 'required|string',
'taxrates' => 'array|required'
]);
$data['channel_id'] = request()->input('channel');
$data['code'] = request()->input('code');
$data['name'] = request()->input('name');
$data['description'] = request()->input('description');
if($this->taxRate->update($data, $id)) {
$this->taxRule->syncAndDetach($id, request()->input('taxrates'));
session()->flash('success', 'Tax Category is successfully edited.');
return redirect()->route($this->_config['redirect']);
} else {
session()->flash('error', 'Tax Category Cannot be Updated Successfully.');
return redirect()->back();
}
}
/**
* Destroy a tax rule
*
* @return mixed
*/
public function destroy($id) {
if($this->taxRule()->delete($id)) {
session()->flash('success', 'The tax rule is successfully deleted');
return redirect()->back();
}
}
}

View File

@ -0,0 +1,92 @@
<?php
namespace Webkul\Core\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Webkul\Core\Repositories\ChannelRepository as Channel;
use Webkul\Core\Repositories\TaxCategoriesRepository as TaxRule;
use Webkul\Core\Repositories\TaxRatesRepository as TaxRate;
use Webkul\Core\Repositories\TaxMapRepository as TaxMap;
/**
* Tax controller
*
* @author Prashant Singh <prashant.singh852@webkul.com>
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class TaxController extends Controller
{
/**
* Contains route related configuration
*
* @var array
*/
protected $_config;
/**
* ChannelRepository object
*
* @var array
*/
protected $channel;
/**
* Tax Rule Repository object
*
* @var array
*/
protected $taxRule;
/**
* Tax Rate Repository object
*
* @var array
*/
protected $taxRate;
/**
* Tax Map Repository object
*
* @var array
*/
protected $taxMap;
/**
* Create a new controller instance.
*
* @param Webkul\Core\Repositories\ChannelRepository $channel
* @param Webkul\Core\Repositories\TaxCategoriesRepository $taxRule
* @param Webkul\Core\Repositories\TaxRatesRepository $taxRate
* @param Webkul\Core\Repositories\TaxMapRepository $taxMap
* @return void
*/
public function __construct(Channel $channel, TaxRule $taxRule, TaxRate $taxRate, TaxMap $taxMap)
{
$this->middleware('admin');
$this->channel = $channel;
$this->taxRule = $taxRule;
$this->taxRate = $taxRate;
$this->taxMap = $taxMap;
$this->_config = request('_config');
}
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
return view($this->_config['view']);
}
}

View File

@ -0,0 +1,146 @@
<?php
namespace Webkul\Core\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Webkul\Core\Repositories\TaxRatesRepository as TaxRate;
/**
* Tax controller
*
* @author Prashant Singh <prashant.singh852@webkul.com>
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class TaxRateController extends Controller
{
/**
* Contains route related configuration
*
* @var array
*/
protected $_config;
/**
* Tax Rate Repository object
*
* @var array
*/
protected $taxRate;
/**
* Create a new controller instance.
*
* @param Webkul\Core\Repositories\TaxRatesRepository $taxRate
* @return void
*/
public function __construct(TaxRate $taxRate)
{
$this->middleware('admin');
$this->taxRate = $taxRate;
$this->_config = request('_config');
}
/**
* Display a listing
* resource for the
* available tax rates.
*
* @return mixed
*/
public function index() {
return view($this->_config['view']);
}
/**
* Display a create
* form for tax rate
*
* @return view
*/
public function show()
{
return view($this->_config['view']);
}
/**
* Create the tax rate
*
* @return mixed
*/
public function create() {
$this->validate(request(), [
'identifier' => 'required|string|unique:tax_rates,identifier',
'is_zip' => 'sometimes|confirmed',
'zip_from' => 'nullable|numeric|required_with:is_zip',
'zip_to' => 'nullable|numeric|required_with:is_zip,zip_from',
'state' => 'required|string',
'country' => 'required|string',
'tax_rate' => 'required|numeric'
]);
if($this->taxRate->create(request()->input())) {
session()->flash('success', 'Tax Rate Created Successfully');
return redirect()->route($this->_config['redirect']);
} else {
session()->flash('error', 'Cannot Create Tax Rate');
return redirect()->back();
}
return redirect()->back();
}
/**
* Show the edit form
* for the previously
* created tax rates.
*
* @return mixed
*/
public function edit($id) {
$data = collect($this->taxRate->findOneByField('id', $id));
return view($this->_config['view'])->with('data', $data);
}
/**
* Edit the previous
* tax rate
*
* @return mixed
*/
public function update($id) {
$this->validate(request(), [
'identifier' => 'required|string|unique:tax_rates,identifier,'.$id,
'is_zip' => 'sometimes|confirmed',
'zip_from' => 'nullable|numeric|required_with:is_zip',
'zip_to' => 'nullable|numeric|required_with:is_zip,zip_from',
'state' => 'required|string',
'country' => 'required|string',
'tax_rate' => 'required|numeric'
]);
if($this->taxRate->update(request()->input(), $id)) {
session()->flash('success', 'Tax Rate Updated Successfully');
return redirect()->route($this->_config['redirect']);
} else {
session()->flash('error', 'Cannot Create Tax Rate');
return redirect()->back();
}
return redirect()->back();
}
}

View File

@ -0,0 +1,27 @@
<?php
namespace Webkul\Core\Models;
use Illuminate\Database\Eloquent\Model;
use Webkul\Core\Models\TaxRate;
use Webkul\Core\Models\TaxMap;
class TaxCategory extends Model
{
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $table = 'tax_categories';
protected $fillable = [
'channel_id' ,'code', 'name' ,'description'
];
//for joining the two way pivot table
public function tax_rates() {
return $this->belongsToMany(TaxRate::class, 'tax_categories_tax_rates', 'tax_category_id')->withPivot('id');
}
}

View File

@ -0,0 +1,23 @@
<?php
namespace Webkul\Core\Models;
use Illuminate\Database\Eloquent\Model;
use Webkul\Core\Models\TaxCategory;
use Webkul\Core\Models\TaxRate;
class TaxMap extends Model
{
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $table = 'tax_categories_tax_rates';
protected $fillable = [
'tax_category_id', 'tax_rate_id'
];
}

View File

@ -0,0 +1,25 @@
<?php
namespace Webkul\Core\Models;
use Illuminate\Database\Eloquent\Model;
use Webkul\Core\Models\TaxCategory;
class TaxRate extends Model
{
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $table = 'tax_rates';
protected $fillable = [
'identifier', 'is_zip_from', 'zip_from', 'zip_to', 'state', 'country', 'tax_rate'
];
public function tax_categories() {
return $this->belongsToMany(TaxCategory::class, 'tax_categories_tax_rates', 'tax_rate_id', 'id');
}
}

View File

@ -7,6 +7,8 @@ use Illuminate\Support\Facades\Validator;
use Illuminate\Routing\Router;
use Illuminate\Foundation\AliasLoader;
use Webkul\Core\Http\Middleware\Locale;
use Webkul\User\Http\Middleware\RedirectIfNotAdmin;
use Webkul\Customer\Http\Middleware\RedirectIfNotCustomer;
use Webkul\Core\Core;
use Webkul\Core\Facades\CoreFacade;
@ -27,6 +29,10 @@ class CoreServiceProvider extends ServiceProvider
$router->aliasMiddleware('locale', Locale::class);
$router->aliasMiddleware('admin', RedirectIfNotAdmin::class);
$router->aliasMiddleware('customer', RedirectIfNotCustomer::class);
$this->publishes([
__DIR__ . '/../../publishable/lang' => public_path('vendor/webkul/core/lang'),
], 'public');

View File

@ -1,7 +1,7 @@
<?php
<?php
namespace Webkul\Core\Repositories;
use Webkul\Core\Eloquent\Repository;
/**

View File

@ -28,7 +28,7 @@ class SliderRepository extends Repository
*/
public function create(array $data)
{
$image = request()->hasFile('image');
$image = request()->file('image');
$image_name = uniqid(20).'.'.$image->getClientOriginalExtension();

View File

@ -0,0 +1,82 @@
<?php
namespace Webkul\Core\Repositories;
use Webkul\Core\Eloquent\Repository;
/**
* Tax Rule Reposotory
*
* @author Prashant Singh <prashant.singh852@webkul.com>
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class TaxCategoriesRepository extends Repository
{
/**
* Specify Model class name
*
* @return mixed
*/
function model()
{
return 'Webkul\Core\Models\TaxCategory';
}
/**
* @param array $data
* @return mixed
*/
public function create(array $data)
{
$taxRule = $this->model->create($data);
return $taxRule;
}
/**
* @param array $data
* @param $id
* @param string $attribute
*
* @return mixed
*/
public function update(array $data, $id, $attribute = "id")
{
$taxRule = $this->find($id);
$taxRule->update($data);
return $taxmap;
}
/**
* Method to attach
* associations
*
* @return mixed
*/
public function onlyAttach($id, $taxRates) {
foreach($taxRates as $key => $value) {
$this->model->findOrFail($id)->tax_rates()->attach($id, ['tax_category_id' => $id, 'tax_rate_id' => $value]);
}
}
/**
* Method to detach
* and attach the
* associations
*
* @return mixed
*/
public function syncAndDetach($id, $taxRates) {
$this->model->findOrFail($id)->tax_rates()->detach();
foreach($taxRates as $key => $value) {
$this->model->findOrFail($id)->tax_rates()->attach($id, ['tax_category_id' => $id, 'tax_rate_id' => $value]);
}
}
}

View File

@ -0,0 +1,50 @@
<?php
namespace Webkul\Core\Repositories;
use Webkul\Core\Eloquent\Repository;
/**
* Tax Mapping Reposotory
*
* @author Prashant Singh <prashant.singh852@webkul.com>
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class TaxMapRepository extends Repository
{
/**
* Specify Model class name
*
* @return mixed
*/
function model()
{
return 'Webkul\Core\Models\TaxMap';
}
/**
* @param array $data
* @return mixed
*/
public function create(array $data)
{
$taxMap = $this->model->create($data);
return $taxMap;
}
/**
* @param array $data
* @param $id
* @param string $attribute
* @return mixed
*/
public function update(array $data, $id, $attribute = "id")
{
$taxMap = $this->find($id);
$taxMap->update($data);
return $taxMap;
}
}

View File

@ -0,0 +1,50 @@
<?php
namespace Webkul\Core\Repositories;
use Webkul\Core\Eloquent\Repository;
/**
* Tax Rate Reposotory
*
* @author Prashant Singh <prashant.singh852@webkul.com>
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class TaxRatesRepository extends Repository
{
/**
* Specify Model class name
*
* @return mixed
*/
function model()
{
return 'Webkul\Core\Models\TaxRate';
}
/**
* @param array $data
* @return mixed
*/
public function create(array $data)
{
$taxRate = $this->model->create($data);
return $taxRate;
}
/**
* @param array $data
* @param $id
* @param string $attribute
* @return mixed
*/
public function update(array $data, $id, $attribute = "id")
{
$taxRate = $this->find($id);
$taxRate->update($data);
return $taxRate;
}
}

View File

@ -0,0 +1,47 @@
<?php
namespace Webkul\Customer\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Webkul\Customer\Repositories\CustomerRepository;
use Webkul\Customer\Repositories\CustomerAddressRepository;
use Auth;
/**
* Account Controlller for the customers
* basically will control the landing
* behavior for custome and group of
* customers.
*
* @author Prashant Singh <prashant.singh852@webkul.com>
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class AccountController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
protected $_config;
protected $customer;
protected $address;
public function __construct(CustomerRepository $customer, CustomerAddressRepository $address)
{
$this->middleware('customer');
$this->_config = request('_config');
$this->customer = $customer;
$this->address = $address;
}
public function index() {
return view($this->_config['view']);
}
}

View File

@ -0,0 +1,192 @@
<?php
namespace Webkul\Customer\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Webkul\Customer\Repositories\CustomerRepository;
use Webkul\Customer\Repositories\CustomerAddressRepository;
use Auth;
/**
* Customer controlller for the customer
* basically for the tasks of customers
* which will be done after customer
* authenticastion.
*
* @author Prashant Singh <prashant.singh852@webkul.com>
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class AddressController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
protected $_config;
protected $customer;
protected $address;
public function __construct(CustomerRepository $customer, CustomerAddressRepository $address)
{
$this->middleware('customer');
$this->_config = request('_config');
$this->customer = $customer;
$this->address = $address;
}
/**
* Getting logged in
* customer helper
* @return Array
*/
private function getCustomer($id) {
$customer = collect($this->customer->findOneWhere(['id'=>$id]));
return $customer;
}
/**
* Getting logged in
* customer address
* helper
* @return Array
*/
private function getAddress($id) {
$address = collect($this->address->findOneWhere(['customer_id'=>$id]));
return $address;
}
/**
* Address Route
* index page
* @return View
*/
public function index() {
$id = auth()->guard('customer')->user()->id;
$customer = $this->getCustomer($id);
$address = $this->getAddress($id);
return view($this->_config['view'])->with('address', $address);
}
/**
* Show the address
* create form
* @return View
*/
public function show() {
return view($this->_config['view']);
}
/**
* Create a new
* address for
* customer.
*
* @return View
*/
public function create() {
$id = auth()->guard('customer')->user()->id;
$data = collect(request()->input())->except('_token')->toArray();
$this->validate(request(), [
'address1' => 'string|required',
'address2' => 'string|required',
'country' => 'string|required',
'state' => 'string|required',
'city' => 'string|required',
'postcode' => 'numeric|required',
]);
$cust_id['customer_id'] = $id;
$data = array_merge($cust_id, $data);
$address = $this->getAddress($id);
if(count($address) == 0 || $address->isEmpty()) {
if($this->address->create($data)) {
session()->flash('success', 'Address have been successfully added.');
return redirect()->route($this->_config['redirect']);
} else {
session()->flash('error', 'Address cannot be added.');
return redirect()->back();
}
} else {
session()->flash('error', 'Cannot create a new address due to previously existing address');
return redirect()-route('customer.address.edit');
}
}
/**
* For editing the
* existing address
* of the customer
*
* @return View
*/
public function showEdit() {
$id = auth()->guard('customer')->user()->id;
$address = $this->getAddress($id);
return view($this->_config['view'])->with('address', $address);
}
public function edit() {
$id = auth()->guard('customer')->user()->id;
$this->validate(request(), [
'address1' => 'string|required',
'address2' => 'string|required',
'country' => 'string|required',
'state' => 'string|required',
'city' => 'string|required',
'postcode' => 'numeric|required',
]);
$data = collect(request()->input())->except('_token')->toArray();
$address = $this->getAddress($id);
if($this->address->update($data, $id)) {
Session()->flash('success','Address Updated Successfully.');
return redirect()->route('customer.address.index');
} else {
Session()->flash('success','Address Cannot be Updated.');
return redirect()->route('customer.address.edit');
}
}
}

View File

@ -4,8 +4,9 @@ namespace Webkul\Customer\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Routing\Controller;
use Webkul\Customer\Repositories\CustomerRepository;
use Webkul\Customer\Models\Customer;
use Auth;
/**
* Customer controlller for the customer
@ -24,11 +25,16 @@ class CustomerController extends Controller
* @return \Illuminate\Http\Response
*/
protected $_config;
protected $customer;
public function __construct()
public function __construct(CustomerRepository $customer)
{
$this->middleware('customer');
$this->_config = request('_config');
$this->customer = $customer;
}
/**
@ -37,23 +43,108 @@ class CustomerController extends Controller
* authentication
* @return view
*/
private function getCustomer($id)
{
$customer = collect(Customer::find($id));
private function getCustomer($id) {
$customer = collect($this->customer->findOneWhere(['id'=>$id]));
return $customer;
}
public function profile()
{
/**
* Taking the customer
* to profile details
* page
* @return View
*/
public function index() {
$id = auth()->guard('customer')->user()->id;
$customer = $this->getCustomer($id);
return view($this->_config['view'])->with('customer', $customer);
}
public function editProfile()
{
/**
* For loading the
* edit form page.
*
* @return View
*/
public function editIndex() {
$id = auth()->guard('customer')->user()->id;
$customer = $this->getCustomer($id);
return view($this->_config['view'])->with('customer', $customer);
}
/**
* Edit function
* for editing customer
* profile.
*
* @return Redirect.
*/
public function edit() {
$id = auth()->guard('customer')->user()->id;
$this->validate(request(), [
'first_name' => 'string',
'last_name' => 'string',
'gender' => 'required',
'date_of_birth' => 'date',
'phone' => 'string|size:10',
'email' => 'email|unique:customers,email,'.$id,
'password' => 'confirmed|required_if:oldpassword,!=,null'
]);
$data = collect(request()->input())->except('_token')->toArray();
if($data['oldpassword'] == null) {
$data = collect(request()->input())->except(['_token','password','password_confirmation','oldpassword'])->toArray();
if($this->customer->update($data, $id)) {
Session()->flash('success','Profile Updated Successfully');
return redirect()->back();
} else {
Session()->flash('success','Profile Updated Successfully');
return redirect()->back();
}
} else {
$data = collect(request()->input())->except(['_token','oldpassword'])->toArray();
$data['password'] = bcrypt($data['password']);
if($this->customer->update($data, $id)) {
Session()->flash('success','Profile Updated Successfully');
return redirect()->back();
} else {
Session()->flash('success','Profile Updated Successfully');
return redirect()->back();
}
}
}
public function orders() {
return view($this->_config['view']);
}
public function wishlist() {
return view($this->_config['view']);
}
public function reviews() {
return view($this->_config['view']);
}
public function address() {
return view($this->_config['view']);
}
}

View File

@ -0,0 +1,61 @@
<?php
namespace Webkul\Customer\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Webkul\Customer\Repositories\CustomerRepository;
use Auth;
/**
* Customer controlller for the customer
* basically for the tasks of customers
* which will be done after customer
* authenticastion.
*
* @author Prashant Singh <prashant.singh852@webkul.com>
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class OrdersController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
protected $_config;
protected $customer;
public function __construct(CustomerRepository $customer)
{
$this->middleware('customer');
$this->_config = request('_config');
$this->customer = $customer;
}
/**
* For taking the customer
* to the dashboard after
* authentication
* @return view
*/
private function getCustomer($id) {
$customer = collect($this->customer->findOneWhere(['id'=>$id]));
return $customer;
}
public function index() {
$id = auth()->guard('customer')->user()->id;
$customer = $this->getCustomer($id);
return view($this->_config['view'])->with('customer', $customer);
}
public function orders() {
return view($this->_config['view']);
}
}

View File

@ -5,10 +5,10 @@ namespace Webkul\Customer\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Routing\Controller;
use Webkul\Customer\Models\Customer;
use Webkul\Customer\Repositories\CustomerRepository;
/**
* Dashboard controller
* Registration controller
*
* @author Prashant Singh <prashant.singh852@webkul.com>
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
@ -21,10 +21,13 @@ class RegistrationController extends Controller
* @return \Illuminate\Http\Response
*/
protected $_config;
protected $customer;
public function __construct()
public function __construct(CustomerRepository $customer)
{
$this->_config = request('_config');
$this->customer = $customer;
}
/**
@ -43,25 +46,30 @@ class RegistrationController extends Controller
*/
public function create(Request $request)
{
// return $request->except('_token'); //don't let csrf token to be openly printed
$request->validate([
'first_name' => 'string|required',
'last_name' => 'string|required',
'email' => 'email|required',
'password' => 'confirmed|min:8|required'
'password' => 'confirmed|min:6|required'
]);
$customer = new \Webkul\Customer\Models\Customer();
$customer->first_name = $request->first_name;
$customer->last_name = $request->last_name;
$customer->email = $request->email;
$customer->password = bcrypt($request->password);
// dd('hello1');
if ($customer->save()) {
$registrationData = $request->except('_token');
if ($this->customer->create($registrationData)) {
session()->flash('success', 'Account created successfully.');
return redirect()->route($this->_config['redirect']);
} else {
session()->flash('error', 'Cannot Create Your Account.');
return redirect()->back();
}
}
}

View File

@ -0,0 +1,61 @@
<?php
namespace Webkul\Customer\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Webkul\Customer\Repositories\CustomerRepository;
use Auth;
/**
* Customer controlller for the customer
* basically for the tasks of customers
* which will be done after customer
* authenticastion.
*
* @author Prashant Singh <prashant.singh852@webkul.com>
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class ReviewsController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
protected $_config;
protected $customer;
public function __construct(CustomerRepository $customer)
{
$this->middleware('customer');
$this->_config = request('_config');
$this->customer = $customer;
}
/**
* For taking the customer
* to the dashboard after
* authentication
* @return view
*/
private function getCustomer($id) {
$customer = collect($this->customer->findOneWhere(['id'=>$id]));
return $customer;
}
public function index() {
$id = auth()->guard('customer')->user()->id;
$customer = $this->getCustomer($id);
return view($this->_config['view'])->with('customer', $customer);
}
public function reviews() {
return view($this->_config['view']);
}
}

View File

@ -24,12 +24,20 @@ class SessionController extends Controller
public function __construct()
{
$this->middleware('customer')->except(['show','create']);
$this->_config = request('_config');
}
public function show()
{
return view($this->_config['view']);
if(auth()->guard('customer')->check()) {
return redirect()->route('customer.account.index');
} else {
return view($this->_config['view']);
}
}
public function create(Request $request)
@ -39,15 +47,13 @@ class SessionController extends Controller
'password' => 'required'
]);
// $remember = request('remember');
if (!auth()->guard('customer')->attempt(request(['email', 'password']))) {
dd('cannot be authorized');
session()->flash('error', 'Please check your credentials and try again.');
session()->flash('error', 'Please check your credentials and try again.');
return back();
}
return redirect()->route($this->_config['redirect']);
return redirect()->intended(route($this->_config['redirect']));
}
public function destroy($id)
@ -55,4 +61,4 @@ class SessionController extends Controller
auth()->guard('customer')->logout();
return redirect()->route($this->_config['redirect']);
}
}
}

View File

@ -0,0 +1,61 @@
<?php
namespace Webkul\Customer\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Webkul\Customer\Repositories\CustomerRepository;
use Auth;
/**
* Customer controlller for the customer
* basically for the tasks of customers
* which will be done after customer
* authenticastion.
*
* @author Prashant Singh <prashant.singh852@webkul.com>
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class WishlistController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
protected $_config;
protected $customer;
public function __construct(CustomerRepository $customer)
{
$this->middleware('customer');
$this->_config = request('_config');
$this->customer = $customer;
}
/**
* For taking the customer
* to the dashboard after
* authentication
* @return view
*/
private function getCustomer($id) {
$customer = collect($this->customer->findOneWhere(['id'=>$id]));
return $customer;
}
public function index() {
$id = auth()->guard('customer')->user()->id;
$customer = $this->getCustomer($id);
return view($this->_config['view'])->with('customer', $customer);
}
public function wishlist() {
return view($this->_config['view']);
}
}

View File

@ -9,6 +9,13 @@ use Illuminate\Support\Facades\URL;
class Menu
{
public $items = array();
public $current;
public $currentKey;
public function __construct() {
$this->current = Request::url();
}
public static function create($callback)
{
@ -26,4 +33,19 @@ class Menu
];
array_push($this->items, $item);
}
/**
* Method to find the active links
*
* @param array $item Item that
* needs to be checked if active
* @return string
*/
public function getActive($item)
{
$url = trim($item['url'], '/');
if ((strpos($this->current, $url) !== false) || (strpos($this->currentKey, $item['key']) === 0)) {
return 'active';
}
}
}

View File

@ -17,7 +17,7 @@ class Customer extends Authenticatable
protected $table = 'customers';
protected $fillable = ['first_name', 'last_name', 'gender', 'date_of_birth','phone','email','customer_group_id','subscribed_to_news_letter'];
protected $fillable = ['first_name', 'last_name', 'gender', 'date_of_birth','phone','email','password','customer_group_id','subscribed_to_news_letter'];
protected $hidden = ['password','remember_token'];

View File

@ -6,4 +6,6 @@ use Illuminate\Database\Eloquent\Model;
class CustomersAddress extends Model
{
protected $table = 'customer_addresses';
protected $fillable = ['customer_id' ,'address1', 'address2', 'country', 'state', 'city', 'postcode'];
}

View File

@ -13,8 +13,6 @@ class CustomerServiceProvider extends ServiceProvider
{
public function boot(Router $router)
{
// include __DIR__ . '/../Http/routes.php';
$this->publishes([
__DIR__ . '/../../publishable/assets' => public_path('vendor/webkul/customer/assets'),
], 'public');

View File

@ -34,8 +34,17 @@ class EventServiceProvider extends ServiceProvider
});
Event::listen('customer.menu.build', function ($menu) {
$menu->add('customer.account.profile', 'Profile');
$menu->add('customer.account.profile', 'Wishlist');
$menu->add('customer.profile.index', 'Profile');
$menu->add('customer.orders.index', 'Orders');
$menu->add('customer.address.index', 'Address');
$menu->add('customer.reviews.index', 'Reviews');
$menu->add('customer.wishlist.index', 'Wishlist');
});
}
}

View File

@ -0,0 +1,54 @@
<?php
namespace Webkul\Customer\Repositories;
use Webkul\Core\Eloquent\Repository;
/**
* Customer Reposotory
*
* @author Prashant Singh <prashant.singh852@webkul.com>
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class CustomerAddressRepository extends Repository
{
/**
* Specify Model class name
*
* @return mixed
*/
function model()
{
return 'Webkul\Customer\Models\CustomersAddress';
}
/**
* @param array $data
* @return mixed
*/
public function create(array $data)
{
$address = $this->model->create($data);
return $address;
}
/**
* @param array $data
* @param $id
* @param string $attribute
* @return mixed
*/
public function update(array $data, $id, $attribute = "id")
{
$address = $this->findOneByField('customer_id', $id);
$address->update($data);
return $address;
}
}

View File

@ -0,0 +1,54 @@
<?php
namespace Webkul\Customer\Repositories;
use Webkul\Core\Eloquent\Repository;
/**
* Customer Reposotory
*
* @author Prashant Singh <prashant.singh852@webkul.com>
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class CustomerRepository extends Repository
{
/**
* Specify Model class name
*
* @return mixed
*/
function model()
{
return 'Webkul\Customer\Models\Customer';
}
/**
* @param array $data
* @return mixed
*/
public function create(array $data)
{
$customer = $this->model->create($data);
return $customer;
}
/**
* @param array $data
* @param $id
* @param string $attribute
* @return mixed
*/
public function update(array $data, $id, $attribute = "id")
{
$customer = $this->find($id);
$customer->update($data);
return $customer;
}
}

View File

@ -5,6 +5,7 @@ namespace Webkul\Inventory\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Foundation\AliasLoader;
use Illuminate\Routing\Router;
use Webkul\User\Http\Middleware\RedirectIfNotAdmin;
class InventoryServiceProvider extends ServiceProvider
{
@ -15,6 +16,8 @@ class InventoryServiceProvider extends ServiceProvider
*/
public function boot(Router $router)
{
$router->aliasMiddleware('admin', RedirectIfNotAdmin::class);
$this->loadMigrationsFrom(__DIR__ . '/../Database/Migrations');
}

View File

@ -85,10 +85,10 @@ class ProductForm extends FormRequest
foreach ($attributes as $attribute) {
if($attribute->code == 'sku')
continue;
if($product->type == 'configurable' && in_array($attribute->code, ['price', 'cost', 'special_price', 'special_price_from', 'special_price_to', 'width', 'height', 'depth', 'weight']))
continue;
$validations = [];
if($attribute->is_required) {
array_push($validations, 'required');

View File

@ -121,7 +121,7 @@ class Product extends Model
{
return $this->belongsToMany(self::class, 'product_cross_sells');
}
/**
* @param string $key
*

View File

@ -1,7 +1,7 @@
<?php
<?php
namespace Webkul\Product\Repositories;
use Illuminate\Container\Container as App;
use Webkul\Core\Eloquent\Repository;
use Webkul\Attribute\Repositories\AttributeRepository;
@ -211,7 +211,7 @@ class ProductRepository extends Repository
}
$this->productInventory->saveInventories($data, $product);
$this->productImage->uploadImages($data, $product);
return $product;
@ -322,7 +322,7 @@ class ProductRepository extends Repository
'channel' => $attribute->value_per_channel ? $data['channel'] : null,
'locale' => $attribute->value_per_locale ? $data['locale'] : null
]);
if(!$attributeValue) {
$this->attributeValue->create([
'product_id' => $id,

View File

@ -31,8 +31,8 @@ use Webkul\Channel\Channel as Channel;
$current_channel = core()->getCurrentChannel();
$all_sliders = $this->sliders->findOneWhere(['channel_id'=>$current_channel['id']]);
$all_sliders = $this->sliders->findWhere(['channel_id'=>$current_channel['id']]);
return view($this->_config['view'])->with('data',$all_sliders);
return view($this->_config['view'])->with('sliderData',$all_sliders->toArray());
}
}

View File

@ -4,7 +4,7 @@ Route::group(['middleware' => ['web']], function () {
Route::get('/', 'Webkul\Shop\Http\Controllers\HomeController@index')->defaults('_config', [
'view' => 'shop::home.index'
]);
])->name('store.home');
Route::get('/categories/{slug}', 'Webkul\Shop\Http\Controllers\CategoryController@index')->defaults('_config', [
'view' => 'shop::products.index'
@ -48,10 +48,9 @@ Route::group(['middleware' => ['web']], function () {
// ])->name('admin.reviews.store');
// Route::view('/products/{slug}', 'shop::store.product.details.index');
Route::view('/cart', 'shop::store.product.view.cart.index');
// Route::view('/products/{slug}', 'shop::products.view');
//customer routes starts here
Route::prefix('customer')->group(function () {
@ -61,7 +60,7 @@ Route::group(['middleware' => ['web']], function () {
])->name('customer.session.index');
Route::post('login', 'Webkul\Customer\Http\Controllers\SessionController@create')->defaults('_config', [
'redirect' => 'customer.account.profile'
'redirect' => 'customer.account.index'
])->name('customer.session.create');
@ -71,7 +70,7 @@ Route::group(['middleware' => ['web']], function () {
])->name('customer.register.index');
Route::post('register', 'Webkul\Customer\Http\Controllers\RegistrationController@create')->defaults('_config', [
'redirect' => 'customer.account.profile',
'redirect' => 'customer.account.index',
])->name('customer.register.create'); //redirect attribute will get changed immediately to account.index when account's index page will be made
// Auth Routes
@ -82,16 +81,77 @@ Route::group(['middleware' => ['web']], function () {
'redirect' => 'customer.session.index'
])->name('customer.session.destroy');
Route::view('/cart', 'shop::store.product.cart.cart.index')->name('customer.cart');
Route::view('/product', 'shop::store.product.details.home.index')->name('customer.product');
Route::view('/product/review', 'shop::store.product.review.index')->name('customer.product.review');
//customer account
Route::prefix('account')->group(function () {
Route::get('profile', 'Webkul\Customer\Http\Controllers\CustomerController@profile')->defaults('_config', [
Route::get('index', 'Webkul\Customer\Http\Controllers\AccountController@index')->defaults('_config', [
'view' => 'shop::customers.account.index'
])->name('customer.account.index');
/* Profile Routes Starts Here */
Route::get('profile', 'Webkul\Customer\Http\Controllers\CustomerController@index')->defaults('_config', [
'view' => 'shop::customers.account.profile.index'
])->name('customer.account.profile');
])->name('customer.profile.index');
//profile edit
Route::get('profile/edit', 'Webkul\Customer\Http\Controllers\CustomerController@editProfile')->defaults('_config', [
Route::get('profile/edit', 'Webkul\Customer\Http\Controllers\CustomerController@editIndex')->defaults('_config', [
'view' => 'shop::customers.account.profile.edit'
])->name('customer.profile.edit');
Route::post('profile/edit', 'Webkul\Customer\Http\Controllers\CustomerController@edit')->defaults('_config', [
'view' => 'shop::customers.account.profile.edit'
])->name('customer.profile.edit');
/* Profile Routes Ends Here */
/* Routes for Addresses */
Route::get('address/index', 'Webkul\Customer\Http\Controllers\AddressController@index')->defaults('_config', [
'view' => 'shop::customers.account.address.address'
])->name('customer.address.index');
Route::get('address/create', 'Webkul\Customer\Http\Controllers\AddressController@show')->defaults('_config', [
'view' => 'shop::customers.account.address.create'
])->name('customer.address.create');
Route::post('address/create', 'Webkul\Customer\Http\Controllers\AddressController@create')->defaults('_config', [
'view' => 'shop::customers.account.address.address',
'redirect' => 'customer.address.index'
])->name('customer.address.create');
Route::get('address/edit', 'Webkul\Customer\Http\Controllers\AddressController@showEdit')->defaults('_config', [
'view' => 'shop::customers.account.address.edit'
])->name('customer.address.edit');
Route::post('address/edit', 'Webkul\Customer\Http\Controllers\AddressController@edit')->defaults('_config', [
'view' => 'shop::customers.account.address.address'
])->name('customer.address.edit');
/* Routes for Addresses ends here */
/* Wishlist route */
Route::get('wishlist', 'Webkul\Customer\Http\Controllers\WishlistController@wishlist')->defaults('_config', [
'view' => 'shop::customers.account.wishlist.wishlist'
])->name('customer.wishlist.index');
/* Orders route */
Route::get('orders', 'Webkul\Customer\Http\Controllers\OrdersController@orders')->defaults('_config', [
'view' => 'shop::customers.account.orders.orders'
])->name('customer.orders.index');
/* Reviews route */
Route::get('reviews', 'Webkul\Customer\Http\Controllers\CustomerController@reviews')->defaults('_config', [
'view' => 'shop::customers.account.reviews.reviews'
])->name('customer.reviews.index');
});
});
});

View File

@ -1,41 +0,0 @@
<?php
namespace Webkul\Customer\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\View;
use Webkul\Shop\Menu;
class EventServiceProvider extends ServiceProvider
{
/**
* Bootstrap services.
*
* @return void
*/
public function boot()
{
$this->createStoreNavigationMenu();
}
/**
* This method fires an event for menu creation, any package can add their menu item by listening to the customer.menu.build event
*
* @return void
*/
public function createStoreNavigationMenu()
{
Event::listen('shop.navmenu.create', function () {
return Menu::create(function ($menu) {
Event::fire('shop.navmenu.build', $menu);
});
});
Event::listen('shop.navmenu.build', function ($menu) {
$menu->add('customer.account.profile', 'Profile');
$menu->add('customer.account.profile', 'Wishlist');
});
}
}

View File

@ -4,8 +4,6 @@ window.VeeValidate = require("vee-validate");
Vue.use(VeeValidate);
//pure JS for resizing of browser purposes only
Vue.component("category-nav", require("./components/category-nav.vue"));
Vue.component("category-item", require("./components/category-item.vue"));
Vue.component("image-slider", require("./components/image-slider.vue"));

View File

@ -1,6 +1,6 @@
<template>
<li>
<a href="">{{ this.item['translations'][0].name }}&emsp;<i class="icon dropdown-right-icon"
<a :href="this.item['translations'][0].slug">{{ this.item['translations'][0].name }}&emsp;<i class="icon dropdown-right-icon"
v-if="haveChildren && item.parent_id != null"></i></a>
<ul v-if="haveChildren">
<category-item
@ -29,6 +29,7 @@ export default {
computed: {
haveChildren() {
console.log(this.item);
return this.item.children.length ? true : false;
}
}

View File

@ -9,7 +9,7 @@
:parent="index">
</category-item>
<li>
<img src="vendor/webkul/shop/assets/images/offer-zone.svg"/>
<img src="http://localhost/bagisto/public/vendor/webkul/shop/assets/images/offer-zone.svg"/>
<span>Offer Zone</span>
</li>

View File

@ -767,7 +767,6 @@ section.slider-block {
margin-right: 10%;
.content-container {
display: inline-block;
width: 100%;
}
@ -778,7 +777,7 @@ section.slider-block {
.product-grid {
display: grid;
grid-gap: 30px;
grid-gap: 15px;
&.max-2-col {
grid-template-columns: repeat(2, minmax(250px, 1fr));
@ -1269,11 +1268,12 @@ section.slider-block {
//edit form
.edit-form-content {
padding: 0px 25px;
margin-left: 5.5%;
margin-top: 1%;
width: 100%;
.edit-text {
.title {
margin-bottom: 2%;
margin-left: auto;
margin-right: auto;
@ -1283,13 +1283,36 @@ section.slider-block {
.edit-form {
display: flex;
background: $background-color;
border: 1px solid $border-color;
flex-direction: column;
min-height: 345px;
padding: 25px;
// padding: 25px;
}
}
//edit form ends
//address form
.address-form-content {
padding: 0px 25px;
margin-left: 5.5%;
margin-top: 1%;
width: 100%;
.title {
margin-bottom: 2%;
margin-left: auto;
margin-right: auto;
font-size: 24px;
}
.address-form {
display: flex;
background: $background-color;
flex-direction: column;
min-height: 345px;
// padding: 25px;
}
}
//address form ends
}
//account ends here

View File

@ -0,0 +1,63 @@
@extends('shop::layouts.master')
@section('content-wrapper')
<div class="account-content">
@include('shop::customers.account.partials.sidemenu')
<div class="profile">
<div class="section-head">
<span class="profile-heading">Address</span>
<span class="profile-edit"><a href="{{ route('customer.address.edit') }}">Edit</a></span>
<div class="horizontal-rule"></div>
</div>
<div class="profile-content">
@if($address->isEmpty())
<div>You don't have any saved addresses here, please create a new one by clicking the link below.</div>
<br/>
<a href="{{ route('customer.address.create') }}">Create Address</a>
@else
<table>
<tbody>
<tr>
<td>Address 1</td>
<td>{{ $address['address1'] }}</td>
</tr>
<tr>
<td>Address 2</td>
<td>{{ $address['address2'] }}</td>
</tr>
<tr>
<td>Country</td>
<td>{{ $address['country'] }}</td>
</tr>
<tr>
<td>State</td>
<td>{{ $address['state'] }}</td>
</tr>
<tr>
<td>City</td>
<td>{{ $address['city'] }}</td>
</tr>
<tr>
<td>Postcode</td>
<td>{{ $address['postcode'] }}</td>
</tr>
</tbody>
</table>
@endif
</div>
</div>
</div>
@endsection

View File

@ -0,0 +1,59 @@
@extends('shop::layouts.master')
@section('content-wrapper')
<div class="account-content">
@include('shop::customers.account.partials.sidemenu')
<div class="address-form-content">
<div class="title">Add Address</div>
<form method="post" action="{{ route('customer.address.create') }}">
<div class="edit-form">
@csrf
<div class="control-group" :class="[errors.has('address1') ? 'has-error' : '']">
<label for="first_name">Address Line 1</label>
<input type="text" class="control" name="address1" v-validate="'required'">
<span class="control-error" v-if="errors.has('address1')">@{{ errors.first('address1') }}</span>
</div>
<div class="control-group" :class="[errors.has('address2') ? 'has-error' : '']">
<label for="address2">Address Line 2</label>
<input type="text" class="control" name="address2" v-validate="'required'">
<span class="control-error" v-if="errors.has('address2')">@{{ errors.first('address2') }}</span>
</div>
<div class="control-group" :class="[errors.has('country') ? 'has-error' : '']">
<label for="country">Country</label>
<input type="text" class="control" name="country" v-validate="'required'">
<span class="control-error" v-if="errors.has('country')">@{{ errors.first('country') }}</span>
</div>
<div class="control-group" :class="[errors.has('state') ? 'has-error' : '']">
<label for="state">State</label>
<input type="text" class="control" name="state" v-validate="'required'">
<span class="control-error" v-if="errors.has('state')">@{{ errors.first('state') }}</span>
</div>
<div class="control-group" :class="[errors.has('city') ? 'has-error' : '']">
<label for="city">City</label>
<input type="text" class="control" name="city" v-validate="'required'">
<span class="control-error" v-if="errors.has('city')">@{{ errors.first('city') }}</span>
</div>
<div class="control-group" :class="[errors.has('postcode') ? 'has-error' : '']">
<label for="postcode">Postcode</label>
<input type="text" class="control" name="postcode" v-validate="'required|digits:6'">
<span class="control-error" v-if="errors.has('postcode')">@{{ errors.first('postcode') }}</span>
</div>
<div class="button-group">
<input class="btn btn-primary btn-lg" type="submit" value="Create Address">
</div>
</div>
</form>
</div>
</div>
@endsection

View File

@ -0,0 +1,58 @@
@extends('shop::layouts.master')
@section('content-wrapper')
<div class="account-content">
@include('shop::customers.account.partials.sidemenu')
<div class="address-form-content">
<div class="title">Add Address</div>
<form method="post" action="{{ route('customer.address.edit') }}">
<div class="edit-form">
@csrf
<div class="control-group" :class="[errors.has('address1') ? 'has-error' : '']">
<label for="first_name">Address Line 1</label>
<input type="text" class="control" name="address1" v-validate="'required'" value ="{{ $address['address1'] }}">
<span class="control-error" v-if="errors.has('address1')">@{{ errors.first('address1') }}</span>
</div>
<div class="control-group" :class="[errors.has('address2') ? 'has-error' : '']">
<label for="address2">Address Line 2</label>
<input type="text" class="control" name="address2" v-validate="'required'" value ="{{ $address['address2'] }}">
<span class="control-error" v-if="errors.has('address2')">@{{ errors.first('address2') }}</span>
</div>
<div class="control-group" :class="[errors.has('country') ? 'has-error' : '']">
<label for="country">Country</label>
<input type="text" class="control" name="country" v-validate="'required'" value ="{{ $address['country'] }}">
<span class="control-error" v-if="errors.has('country')">@{{ errors.first('country') }}</span>
</div>
<div class="control-group" :class="[errors.has('state') ? 'has-error' : '']">
<label for="state">state</label>
<input type="text" class="control" name="state" v-validate="'required'" value ="{{ $address['state'] }}">
<span class="control-error" v-if="errors.has('state')">@{{ errors.first('state') }}</span>
</div>
<div class="control-group" :class="[errors.has('city') ? 'has-error' : '']">
<label for="city">city</label>
<input type="text" class="control" name="city" v-validate="'required|alpha_spaces'" value ="{{ $address['city'] }}">
<span class="control-error" v-if="errors.has('city')">@{{ errors.first('city') }}</span>
</div>
<div class="control-group" :class="[errors.has('postcode') ? 'has-error' : '']">
<label for="postcode">Postcode</label>
<input type="text" class="control" name="postcode" v-validate="'required|digits:10'" value ="{{ $address['postcode'] }}">
<span class="control-error" v-if="errors.has('postcode')">@{{ errors.first('postcode') }}</span>
</div>
<div class="button-group">
<input class="btn btn-primary btn-lg" type="submit" value="Edit Address">
</div>
</div>
</form>
</div>
</div>
@endsection

View File

@ -0,0 +1,7 @@
@extends('shop::layouts.master')
@section('content-wrapper')
<div class="account-content">
@include('shop::customers.account.partials.sidemenu')
<h1>Account Index Page</h1>
</div>
@endsection

View File

@ -0,0 +1 @@
<h1>Customer past orders page</h1>

View File

@ -1,5 +1,7 @@
<ul class="account-side-menu">
@foreach($menu->items as $key=>$value)
<li class="{{ request()->is('*/account/profile') ? 'active' : '' }}"><a href="{{ $value['url'] }}">{{ $value['name'] }}</a></li>
<li><a href="{{ $value['url'] }}">{{ $value['name'] }}</a></li>
@endforeach
</ul>

View File

@ -7,55 +7,68 @@
<div class="edit-form-content">
<div class="edit-text">Edit Profile</div>
<div class="title">Edit Profile</div>
<form method="post" action="{{ route('customer.register.create') }}">
<form method="post" action="{{ route('customer.profile.edit') }}">
<div class="edit-form">
{{ csrf_field() }}
@csrf
<div class="control-group">
<div class="control-group" :class="[errors.has('first_name') ? 'has-error' : '']">
<label for="first_name">First Name</label>
<input type="text" class="control" name="first_name" value="{{ $customer['first_name'] }}" v-validate="'required'"> {{-- <span>@{{ errors.first('first_name') }}</span> --}}
<input type="text" class="control" name="first_name" value="{{ $customer['first_name'] }}" v-validate="'required'">
<span class="control-error" v-if="errors.has('first_name')">@{{ errors.first('first_name') }}</span>
</div>
<div class="control-group">
<div class="control-group" :class="[errors.has('last_name') ? 'has-error' : '']">
<label for="last_name">Last Name</label>
<input type="text" class="control" name="last_name" value="{{ $customer['last_name'] }}" v-validate="'required'"> {{-- <span>@{{ errors.first('last_name') }}</span> --}}
<input type="text" class="control" name="last_name" value="{{ $customer['last_name'] }}" v-validate="'required'">
<span class="control-error" v-if="errors.has('last_name')">@{{ errors.first('last_name') }}</span>
</div>
<div class="control-group">
<label for="email">Email</label>
<input type="email" class="control" name="email" value="{{ $customer['email'] }}" v-validate="'required'"> {{-- <span>@{{ errors.first('email') }}</span> --}}
</div>
<div class="control-group">
<div class="control-group" :class="[errors.has('gender') ? 'has-error' : '']">
<label for="email">Gender</label>
<select name="gender" class="control" value="{{ $customer['gender'] }}" v-validate="'required'">
<option value="Male">Male</option>
<option value="Female">Female</option>
</select> {{-- <span>@{{ errors.first('gender') }}</span> --}}
<select name="gender" class="control" v-validate="'required'">
<option value="Male" @if($customer['gender']=="Male") selected @endif>Male</option>
<option value="Female" @if($customer['gender']=="Female") selected @endif>Female</option>
</select>
<span class="control-error" v-if="errors.has('gender')">@{{ errors.first('gender') }}</span>
</div>
<div class="control-group">
<label for="dob">Date of Birth</label>
<input type="date" class="control" name="dob" value="{{ $customer['date_of_birth'] }}" v-validate="'required'"> {{-- <span>@{{ errors.first('first_name') }}</span> --}}
<div class="control-group" :class="[errors.has('date_of_birth') ? 'has-error' : '']">
<label for="date_of_birth">Date of Birth</label>
<input type="date" class="control" name="date_of_birth" value="{{ $customer['date_of_birth'] }}" v-validate="'required'">
<span class="control-error" v-if="errors.has('date_of_birth')">@{{ errors.first('date_of_birth') }}</span>
</div>
<div class="control-group">
<div class="control-group" :class="[errors.has('phone') ? 'has-error' : '']">
<label for="phone">Phone</label>
<input type="text" class="control" name="phone" value="{{ $customer['phone'] }}" v-validate="'required'"> {{-- <span>@{{ errors.first('phone') }}</span> --}}
<input type="text" class="control" name="phone" value="{{ $customer['phone'] }}" v-validate="'required|digits:10'">
<span class="control-error" v-if="errors.has('phone')">@{{ errors.first('phone') }}</span>
</div>
<div class="control-group">
<div class="control-group" :class="[errors.has('email') ? 'has-error' : '']">
<label for="email">Email</label>
<input type="email" class="control" name="email" value="{{ $customer['email'] }}" v-validate="'required'">
<span class="control-error" v-if="errors.has('email')">@{{ errors.first('email') }}</span>
</div>
<div class="control-group" :class="[errors.has('old_password') ? 'has-error' : '']">
<label for="password">Old Password</label>
<input type="oldpassword" class="control" name="oldpassword">
<span class="control-error" v-if="errors.has('oldpassword')">@{{ errors.first('oldpassword') }}</span>
</div>
<div class="control-group" :class="[errors.has('password') ? 'has-error' : '']">
<label for="password">Password</label>
<input type="password" class="control" name="password">
<span class="control-error" v-if="errors.has('password')">@{{ errors.first('password') }}</span>
</div>
<div class="control-group">
<label for="password">Confirm Password</label>
<input type="password" class="control" name="password">
<input type="password" class="control" name="password_confirmation">
<span>@{{ errors.first('password') }}</span>
</div>
<div class="button-group">

View File

@ -0,0 +1 @@
<h1>Customer Reviews page</h1>

View File

@ -0,0 +1 @@
<h1>Wishlist page here</h1>

View File

@ -18,13 +18,13 @@
<div class="control-group" :class="[errors.has('email') ? 'has-error' : '']">
<label for="email">{{ __('shop::app.customer.login-form.email') }}</label>
<input type="text" class="control" name="email" v-validate="'required|email'">
<input type="text" class="control" name="email" v-validate="'required|email'" value="{{ old('email') }}">
<span class="control-error" v-if="errors.has('email')">@{{ errors.first('email') }}</span>
</div>
<div class="control-group" :class="[errors.has('password') ? 'has-error' : '']">
<label for="password">{{ __('shop::app.customer.login-form.password') }}</label>
<input type="password" class="control" name="password" v-validate="'required|min:8|max:100'">
<input type="password" class="control" name="password" v-validate="'required|min:6'" value="{{ old('password') }}">
<span class="control-error" v-if="errors.has('password')">@{{ errors.first('password') }}</span>
</div>

View File

@ -18,25 +18,25 @@
<div class="control-group" :class="[errors.has('first_name') ? 'has-error' : '']">
<label for="first_name">{{ __('shop::app.customer.signup-form.firstname') }}</label>
<input type="text" class="control" name="first_name" v-validate="'required'">
<input type="text" class="control" name="first_name" v-validate="'required'" value="{{ old('first_name') }}">
<span class="control-error" v-if="errors.has('first_name')">@{{ errors.first('first_name') }}</span>
</div>
<div class="control-group" :class="[errors.has('last_name') ? 'has-error' : '']">
<label for="last_name">{{ __('shop::app.customer.signup-form.lastname') }}</label>
<input type="text" class="control" name="last_name" v-validate="'required'">
<input type="text" class="control" name="last_name" v-validate="'required'" value="{{ old('last_name') }}">
<span class="control-error" v-if="errors.has('last_name')">@{{ errors.first('last_name') }}</span>
</div>
<div class="control-group" :class="[errors.has('email') ? 'has-error' : '']">
<label for="email">{{ __('shop::app.customer.signup-form.email') }}</label>
<input type="email" class="control" name="email" v-validate="'required|email'">
<input type="email" class="control" name="email" v-validate="'required|email'" value="{{ old('email') }}">
<span class="control-error" v-if="errors.has('email')">@{{ errors.first('email') }}</span>
</div>
<div class="control-group" :class="[errors.has('password') ? 'has-error' : '']">
<label for="password">{{ __('shop::app.customer.signup-form.password') }}</label>
<input type="password" class="control" name="password" v-validate="'required|min:6'" ref="password">
<input type="password" class="control" name="password" v-validate="'required|min:6'" ref="password" value="{{ old('password') }}">
<span class="control-error" v-if="errors.has('password')">@{{ errors.first('password') }}</span>
</div>

View File

@ -1,5 +1,6 @@
<section class="featured-products">
<div class="featured-heading">
{{ $session_id = session()->getId() }}<br/>
New Products<br/>
<span class="featured-seperator" style="color:lightgrey;">_____</span>
</div>
@ -67,7 +68,7 @@
<span><img src="vendor/webkul/shop/assets/images/wishadd.svg" /></span>
</div>
</div>
<div class="product-card">
<div class="product-image">
<img src="vendor/webkul/shop/assets/images/new.png" />

View File

@ -1,5 +1,5 @@
<section class="slider-block">
<image-slider :slides='@json($data)'> </image-slider>
<image-slider :slides='@json($sliderData)'> </image-slider>
</section>

View File

@ -6,8 +6,8 @@
<ul class="logo-container">
<li>
<a href="">
<img class="logo" src="{{asset('themes/default/assets/images/Logo.svg')}}" />
<a href="{{ route('store.home') }}">
<img class="logo" src="{{ asset('vendor/webkul/shop/assets/images/logo.svg') }}" />
</a>
</li>
</ul>
@ -48,20 +48,43 @@
</div>
<div class="dropdown-list bottom-right" style="display: none;">
@guest
<div class="dropdown-list bottom-right" style="display: none;">
<div class="dropdown-container">
<div class="dropdown-container">
<label>Account</label>
<label>Account</label>
<ul>
<li><a href="{{ route('customer.session.index') }}">Sign In</a></li>
<li><a href="{{ route('customer.register.index') }}">Sign Up</a></li>
</ul>
<ul>
<li><a href="{{ route('customer.session.index') }}">Sign In</a></li>
<li><a href="{{ route('customer.register.index') }}">Sign Up</a></li>
</ul>
</div>
</div>
@endguest
@auth('customer')
<div class="dropdown-list bottom-right" style="display: none;">
</div>
<div class="dropdown-container">
<label>Account</label>
<ul>
<li><a href="{{ route('customer.account.index') }}">Account</a></li>
<li><a href="{{ route('customer.profile.index') }}">Profile</a></li>
<li><a href="{{ route('customer.address.index') }}">Address</a></li>
<li><a href="{{ route('customer.wishlist.index') }}">Wishlist</a></li>
<li><a href="{{ route('customer.cart') }}">Cart</a></li>
<li><a href="{{ route('customer.orders.index') }}">Orders</a></li>
<li><a href="{{ route('customer.session.destroy') }}">Logout</a></li>
</ul>
</div>
</div>
@endauth
</li>
@ -104,9 +127,9 @@
</div>
</div>
{{-- Triggered on responsive mode only --}}
<div class="search-suggestion">
<div class="search-content">
<span class="icon search-icon"></span>
@ -131,12 +154,12 @@
</div>
@push('scripts')
@push('scripts')
<script>
window.onload = function() {
var sort = document.getElementById("sortable");
var search = document.getElementById("search");
@ -146,7 +169,7 @@
// function for changing icon for responsive header
function myFunction(){
let className = document.getElementById(this.id).className;
let slider = document.getElementsByClassName("slider-block");
@ -177,7 +200,7 @@
document.getElementsByClassName("search-suggestion")[0].style.display="block";
}else if ( className == 'icon sortable-icon'){
sort.classList.remove('icon', 'sortable-icon');
sort.classList.add('icon', 'cross-icon');

Some files were not shown because too many files have changed in this diff Show More