Merge pull request #5 from jitendra-webkul/jitendra
Currency, Exchange Rate completed
This commit is contained in:
commit
5085395895
|
|
@ -8,6 +8,7 @@
|
|||
"php": "^7.1.3",
|
||||
"dimsav/laravel-translatable": "^9.0",
|
||||
"fideloper/proxy": "^4.0",
|
||||
"kalnoy/nestedset": "^4.3",
|
||||
"laravel/framework": "5.6.*",
|
||||
"laravel/tinker": "^1.0",
|
||||
"nwidart/laravel-modules": "^3.2",
|
||||
|
|
@ -26,7 +27,9 @@
|
|||
"webkul/laravel-admin": "self.version",
|
||||
"webkul/laravel-ui": "self.version",
|
||||
"webkul/laravel-core": "self.version",
|
||||
"webkul/laravel-attribute": "self.version"
|
||||
"webkul/laravel-category": "self.version",
|
||||
"webkul/laravel-attribute": "self.version",
|
||||
"webkul/laravel-channel": "self.version"
|
||||
},
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
|
|
@ -38,8 +41,11 @@
|
|||
"Webkul\\User\\": "packages/Webkul/User/src",
|
||||
"Webkul\\Admin\\": "packages/Webkul/Admin/src",
|
||||
"Webkul\\Ui\\": "packages/Webkul/Ui/src",
|
||||
"Webkul\\Category\\": "packages/Webkul/Category/src",
|
||||
"Webkul\\Attribute\\": "packages/Webkul/Attribute/src",
|
||||
"Webkul\\Core\\": "packages/Webkul/Core/src"
|
||||
"Webkul\\Core\\": "packages/Webkul/Core/src",
|
||||
"Webkul\\Channel\\": "packages/Webkul/Channel/src",
|
||||
"Webkul\\Inventory\\": "packages/Webkul/Inventory/src"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "1cfe5a0cb070df958cccb486627d42f2",
|
||||
"content-hash": "47eeeb44e8f067ec98ea469bd35acf54",
|
||||
"packages": [
|
||||
{
|
||||
"name": "commerceguys/intl",
|
||||
|
|
@ -617,6 +617,65 @@
|
|||
],
|
||||
"time": "2018-05-16T11:53:55+00:00"
|
||||
},
|
||||
{
|
||||
"name": "kalnoy/nestedset",
|
||||
"version": "v4.3.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/lazychaser/laravel-nestedset.git",
|
||||
"reference": "3265da51ef71238fc2d086b54eef7a75dd15c665"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/lazychaser/laravel-nestedset/zipball/3265da51ef71238fc2d086b54eef7a75dd15c665",
|
||||
"reference": "3265da51ef71238fc2d086b54eef7a75dd15c665",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"illuminate/database": "5.2 - 5.6",
|
||||
"illuminate/events": "5.2 - 5.6",
|
||||
"illuminate/support": "5.2 - 5.6",
|
||||
"php": ">=5.5.9"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "4.8.*"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "v4.2.x-dev"
|
||||
},
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Kalnoy\\Nestedset\\NestedSetServiceProvider"
|
||||
]
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Kalnoy\\Nestedset\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Alexander Kalnoy",
|
||||
"email": "lazychaser@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "Nested Set Model for Laravel 4-5",
|
||||
"keywords": [
|
||||
"database",
|
||||
"hierarchy",
|
||||
"laravel",
|
||||
"nested sets",
|
||||
"nsm"
|
||||
],
|
||||
"time": "2018-02-04T08:47:55+00:00"
|
||||
},
|
||||
{
|
||||
"name": "laravel/framework",
|
||||
"version": "v5.6.24",
|
||||
|
|
|
|||
|
|
@ -167,8 +167,11 @@ return [
|
|||
Webkul\User\Providers\UserServiceProvider::class,
|
||||
Webkul\Admin\Providers\AdminServiceProvider::class,
|
||||
Webkul\Ui\Providers\UiServiceProvider::class,
|
||||
Webkul\Category\Providers\CategoryServiceProvider::class,
|
||||
Webkul\Attribute\Providers\AttributeServiceProvider::class,
|
||||
Webkul\Core\Providers\CoreServiceProvider::class
|
||||
Webkul\Core\Providers\CoreServiceProvider::class,
|
||||
Webkul\Channel\Providers\ChannelServiceProvider::class,
|
||||
Webkul\Inventory\Providers\InventoryServiceProvider::class
|
||||
],
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -0,0 +1,116 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Locales
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Contains an array with the applications available locales.
|
||||
|
|
||||
*/
|
||||
'locales' => [
|
||||
'en',
|
||||
'fr',
|
||||
'es' => [
|
||||
'MX', // mexican spanish
|
||||
'CO', // colombian spanish
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Locale separator
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This is a string used to glue the language and the country when defining
|
||||
| the available locales. Example: if set to '-', then the locale for
|
||||
| colombian spanish will be saved as 'es-CO' into the database.
|
||||
|
|
||||
*/
|
||||
'locale_separator' => '-',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default locale
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| As a default locale, Translatable takes the locale of Laravel's
|
||||
| translator. If for some reason you want to override this,
|
||||
| you can specify what default should be used here.
|
||||
|
|
||||
*/
|
||||
'locale' => null,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Use fallback
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Determine if fallback locales are returned by default or not. To add
|
||||
| more flexibility and configure this option per "translatable"
|
||||
| instance, this value will be overridden by the property
|
||||
| $useTranslationFallback when defined
|
||||
|
|
||||
*/
|
||||
'use_fallback' => false,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Use fallback per property
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The property fallback feature will return the translated value of
|
||||
| the fallback locale if the property is empty for the selected
|
||||
| locale. Note that 'use_fallback' must be enabled.
|
||||
|
|
||||
*/
|
||||
'use_property_fallback' => true,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Fallback Locale
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| A fallback locale is the locale being used to return a translation
|
||||
| when the requested translation is not existing. To disable it
|
||||
| set it to false.
|
||||
|
|
||||
*/
|
||||
'fallback_locale' => 'en',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Translation Suffix
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Defines the default 'Translation' class suffix. For example, if
|
||||
| you want to use CountryTrans instead of CountryTranslation
|
||||
| application, set this to 'Trans'.
|
||||
|
|
||||
*/
|
||||
'translation_suffix' => 'Translation',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Locale key
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Defines the 'locale' field name, which is used by the
|
||||
| translation model.
|
||||
|
|
||||
*/
|
||||
'locale_key' => 'locale',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Always load translations when converting to array
|
||||
|--------------------------------------------------------------------------
|
||||
| Setting this to false will have a performance improvement but will
|
||||
| not return the translations when using toArray(), unless the
|
||||
| translations relationship is already loaded.
|
||||
|
|
||||
*/
|
||||
'to_array_always_loads_translations' => true,
|
||||
];
|
||||
|
|
@ -32,7 +32,7 @@ Route::group(['middleware' => ['web']], function () {
|
|||
|
||||
|
||||
// Admin Routes
|
||||
Route::group(['middleware' => ['admin']], function () {
|
||||
Route::group(['middleware' => ['admin', 'locale']], function () {
|
||||
Route::get('/logout', 'Webkul\User\Http\Controllers\SessionController@destroy')->defaults('_config', [
|
||||
'redirect' => 'admin.session.create'
|
||||
])->name('admin.session.destroy');
|
||||
|
|
@ -45,6 +45,28 @@ Route::group(['middleware' => ['web']], function () {
|
|||
// Catalog Routes
|
||||
Route::prefix('catalog')->group(function () {
|
||||
|
||||
// Catalog Category Routes
|
||||
Route::get('/categories', 'Webkul\Category\Http\Controllers\CategoryController@index')->defaults('_config', [
|
||||
'view' => 'admin::catalog.categories.index'
|
||||
])->name('admin.catalog.categories.index');
|
||||
|
||||
Route::get('/categories/create', 'Webkul\Category\Http\Controllers\CategoryController@create')->defaults('_config', [
|
||||
'view' => 'admin::catalog.categories.create'
|
||||
])->name('admin.catalog.categories.create');
|
||||
|
||||
Route::post('/categories/create', 'Webkul\Category\Http\Controllers\CategoryController@store')->defaults('_config', [
|
||||
'redirect' => 'admin.catalog.categories.index'
|
||||
])->name('admin.catalog.categories.store');
|
||||
|
||||
Route::get('/categories/edit/{id}', 'Webkul\Category\Http\Controllers\CategoryController@edit')->defaults('_config', [
|
||||
'view' => 'admin::catalog.categories.edit'
|
||||
])->name('admin.catalog.categories.edit');
|
||||
|
||||
Route::put('/categories/edit/{id}', 'Webkul\Category\Http\Controllers\CategoryController@update')->defaults('_config', [
|
||||
'redirect' => 'admin.catalog.categories.index'
|
||||
])->name('admin.catalog.categories.update');
|
||||
|
||||
|
||||
// Catalog Attribute Routes
|
||||
Route::get('/attributes', 'Webkul\Attribute\Http\Controllers\AttributeController@index')->defaults('_config', [
|
||||
'view' => 'admin::catalog.attributes.index'
|
||||
|
|
@ -65,6 +87,7 @@ Route::group(['middleware' => ['web']], function () {
|
|||
Route::put('/attributes/edit/{id}', 'Webkul\Attribute\Http\Controllers\AttributeController@update')->defaults('_config', [
|
||||
'redirect' => 'admin.catalog.attributes.index'
|
||||
])->name('admin.catalog.attributes.update');
|
||||
|
||||
|
||||
// Catalog Family Routes
|
||||
Route::get('/families', 'Webkul\Attribute\Http\Controllers\AttributeFamilyController@index')->defaults('_config', [
|
||||
|
|
@ -88,6 +111,7 @@ Route::group(['middleware' => ['web']], function () {
|
|||
])->name('admin.catalog.families.update');
|
||||
});
|
||||
|
||||
|
||||
// Datagrid Routes
|
||||
Route::get('/datagrid', 'Webkul\Admin\Http\Controllers\DataGridController@index')->name('admin.datagrid.index');
|
||||
|
||||
|
|
@ -137,11 +161,11 @@ Route::group(['middleware' => ['web']], function () {
|
|||
|
||||
// Locale Routes
|
||||
Route::get('/locales', 'Webkul\Core\Http\Controllers\LocaleController@index')->defaults('_config', [
|
||||
'view' => 'admin::locales.index'
|
||||
'view' => 'admin::settings.locales.index'
|
||||
])->name('admin.locales.index');
|
||||
|
||||
Route::get('/locales/create', 'Webkul\Core\Http\Controllers\LocaleController@create')->defaults('_config', [
|
||||
'view' => 'admin::locales.create'
|
||||
'view' => 'admin::settings.locales.create'
|
||||
])->name('admin.locales.create');
|
||||
|
||||
Route::post('/locales/create', 'Webkul\Core\Http\Controllers\LocaleController@store')->defaults('_config', [
|
||||
|
|
@ -149,6 +173,101 @@ Route::group(['middleware' => ['web']], function () {
|
|||
])->name('admin.locales.store');
|
||||
|
||||
|
||||
// Country Routes
|
||||
Route::get('/countries', 'Webkul\Core\Http\Controllers\CountryController@index')->defaults('_config', [
|
||||
'view' => 'admin::settings.countries.index'
|
||||
])->name('admin.countries.index');
|
||||
|
||||
Route::get('/countries/create', 'Webkul\Core\Http\Controllers\CountryController@create')->defaults('_config', [
|
||||
'view' => 'admin::settings.countries.create'
|
||||
])->name('admin.countries.create');
|
||||
|
||||
Route::post('/countries/create', 'Webkul\Core\Http\Controllers\CountryController@store')->defaults('_config', [
|
||||
'redirect' => 'admin.countries.index'
|
||||
])->name('admin.countries.store');
|
||||
|
||||
|
||||
// Country Routes
|
||||
Route::get('/currencies', 'Webkul\Core\Http\Controllers\CurrencyController@index')->defaults('_config', [
|
||||
'view' => 'admin::settings.currencies.index'
|
||||
])->name('admin.currencies.index');
|
||||
|
||||
Route::get('/currencies/create', 'Webkul\Core\Http\Controllers\CurrencyController@create')->defaults('_config', [
|
||||
'view' => 'admin::settings.currencies.create'
|
||||
])->name('admin.currencies.create');
|
||||
|
||||
Route::post('/currencies/create', 'Webkul\Core\Http\Controllers\CurrencyController@store')->defaults('_config', [
|
||||
'redirect' => 'admin.currencies.index'
|
||||
])->name('admin.currencies.store');
|
||||
|
||||
|
||||
// Country Routes
|
||||
Route::get('/exchange_rates', 'Webkul\Core\Http\Controllers\ExchangeRateController@index')->defaults('_config', [
|
||||
'view' => 'admin::settings.exchange_rates.index'
|
||||
])->name('admin.exchange_rates.index');
|
||||
|
||||
Route::get('/exchange_rates/create', 'Webkul\Core\Http\Controllers\ExchangeRateController@create')->defaults('_config', [
|
||||
'view' => 'admin::settings.exchange_rates.create'
|
||||
])->name('admin.exchange_rates.create');
|
||||
|
||||
Route::post('/exchange_rates/create', 'Webkul\Core\Http\Controllers\ExchangeRateController@store')->defaults('_config', [
|
||||
'redirect' => 'admin.exchange_rates.index'
|
||||
])->name('admin.exchange_rates.store');
|
||||
|
||||
Route::get('/exchange_rates/edit/{id}', 'Webkul\Core\Http\Controllers\ExchangeRateController@edit')->defaults('_config', [
|
||||
'view' => 'admin::settings.exchange_rates.edit'
|
||||
])->name('admin.exchange_rates.edit');
|
||||
|
||||
Route::put('/exchange_rates/edit/{id}', 'Webkul\Core\Http\Controllers\ExchangeRateController@update')->defaults('_config', [
|
||||
'redirect' => 'admin.exchange_rates.index'
|
||||
])->name('admin.exchange_rates.update');
|
||||
|
||||
|
||||
// Inventory Source Routes
|
||||
Route::get('/inventory_sources', 'Webkul\Inventory\Http\Controllers\InventorySourceController@index')->defaults('_config', [
|
||||
'view' => 'admin::settings.inventory_sources.index'
|
||||
])->name('admin.inventory_sources.index');
|
||||
|
||||
Route::get('/inventory_sources/create', 'Webkul\Inventory\Http\Controllers\InventorySourceController@create')->defaults('_config', [
|
||||
'view' => 'admin::settings.inventory_sources.create'
|
||||
])->name('admin.inventory_sources.create');
|
||||
|
||||
Route::post('/inventory_sources/create', 'Webkul\Inventory\Http\Controllers\InventorySourceController@store')->defaults('_config', [
|
||||
'redirect' => 'admin.inventory_sources.index'
|
||||
])->name('admin.inventory_sources.store');
|
||||
|
||||
Route::get('/inventory_sources/edit/{id}', 'Webkul\Inventory\Http\Controllers\InventorySourceController@edit')->defaults('_config', [
|
||||
'view' => 'admin::settings.inventory_sources.edit'
|
||||
])->name('admin.inventory_sources.edit');
|
||||
|
||||
Route::put('/inventory_sources/edit/{id}', 'Webkul\Inventory\Http\Controllers\InventorySourceController@update')->defaults('_config', [
|
||||
'redirect' => 'admin.inventory_sources.index'
|
||||
])->name('admin.inventory_sources.update');
|
||||
|
||||
|
||||
// Channel Routes
|
||||
Route::get('/channels', 'Webkul\Channel\Http\Controllers\ChannelController@index')->defaults('_config', [
|
||||
'view' => 'admin::settings.channels.index'
|
||||
])->name('admin.channels.index');
|
||||
|
||||
Route::get('/channels/create', 'Webkul\Channel\Http\Controllers\ChannelController@create')->defaults('_config', [
|
||||
'view' => 'admin::settings.channels.create'
|
||||
])->name('admin.channels.create');
|
||||
|
||||
Route::post('/channels/create', 'Webkul\Channel\Http\Controllers\ChannelController@store')->defaults('_config', [
|
||||
'redirect' => 'admin.channels.index'
|
||||
])->name('admin.channels.store');
|
||||
|
||||
Route::get('/channels/edit/{id}', 'Webkul\Channel\Http\Controllers\ChannelController@edit')->defaults('_config', [
|
||||
'view' => 'admin::settings.channels.edit'
|
||||
])->name('admin.channels.edit');
|
||||
|
||||
Route::put('/channels/edit/{id}', 'Webkul\Channel\Http\Controllers\ChannelController@update')->defaults('_config', [
|
||||
'redirect' => 'admin.channels.index'
|
||||
])->name('admin.channels.update');
|
||||
|
||||
|
||||
|
||||
// Admin Profile route
|
||||
Route::get('/account', 'Webkul\User\Http\Controllers\AccountController@edit')->defaults('_config', [
|
||||
'view' => 'admin::account.edit'
|
||||
|
|
|
|||
|
|
@ -39,7 +39,9 @@ class EventServiceProvider extends ServiceProvider
|
|||
Event::listen('admin.menu.build', function($menu) {
|
||||
$menu->add('dashboard', 'Dashboard', 'admin.dashboard.index', 1, 'dashboard-icon');
|
||||
|
||||
$menu->add('catalog', 'Catalog', 'admin.catalog.attributes.index', 3, 'catalog-icon');
|
||||
$menu->add('catalog', 'Catalog', 'admin.catalog.categories.index', 3, 'catalog-icon');
|
||||
|
||||
$menu->add('catalog.categories', 'Categories', 'admin.catalog.categories.index', 2);
|
||||
|
||||
$menu->add('catalog.attributes', 'Attributes', 'admin.catalog.attributes.index', 3);
|
||||
|
||||
|
|
@ -49,15 +51,25 @@ class EventServiceProvider extends ServiceProvider
|
|||
|
||||
$menu->add('configuration.account', 'My Account', 'admin.account.edit', 1);
|
||||
|
||||
$menu->add('settings', 'Settings', 'admin.users.index', 6, 'settings-icon');
|
||||
$menu->add('settings', 'Settings', 'admin.countries.index', 6, 'settings-icon');
|
||||
|
||||
$menu->add('settings.users', 'Users', 'admin.users.index', 1, '');
|
||||
$menu->add('settings.countries', 'Countries', 'admin.countries.index', 1, '');
|
||||
|
||||
$menu->add('settings.locales', 'Locales', 'admin.locales.index', 2, '');
|
||||
|
||||
$menu->add('settings.currencies', 'Currencies', 'admin.currencies.index', 3, '');
|
||||
|
||||
$menu->add('settings.exchange_rates', 'Exchange Rates', 'admin.exchange_rates.index', 4, '');
|
||||
|
||||
$menu->add('settings.inventory_sources', 'Inventory Sources', 'admin.inventory_sources.index', 5, '');
|
||||
|
||||
$menu->add('settings.channels', 'Channels', 'admin.channels.index', 5, '');
|
||||
|
||||
$menu->add('settings.users', 'Users', 'admin.users.index', 7, '');
|
||||
|
||||
$menu->add('settings.users.users', 'Users', 'admin.users.index', 1, '');
|
||||
|
||||
$menu->add('settings.users.roles', 'Roles', 'admin.roles.index', 2, '');
|
||||
|
||||
$menu->add('settings.locales', 'Locales', 'admin.locales.index', 2, '');
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,11 +35,16 @@ $(document).ready(function () {
|
|||
addServerErrors () {
|
||||
var scope = null;
|
||||
for (var key in serverErrors) {
|
||||
const field = this.$validator.fields.find({ name: key, scope: scope });
|
||||
var inputName = key;
|
||||
if(key.indexOf('.') !== -1) {
|
||||
inputName = key.replace(".", "[") + ']';
|
||||
}
|
||||
|
||||
const field = this.$validator.fields.find({ name: inputName, scope: scope });
|
||||
if (field) {
|
||||
this.$validator.errors.add({
|
||||
id: field.id,
|
||||
field: key,
|
||||
field: inputName,
|
||||
msg: serverErrors[key][0],
|
||||
scope: scope,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -165,15 +165,35 @@ body {
|
|||
}
|
||||
|
||||
.page-header {
|
||||
display: block;
|
||||
display: inline-block;
|
||||
margin-bottom: 20px;
|
||||
width: 100%;
|
||||
|
||||
.page-title {
|
||||
float: left;
|
||||
|
||||
h1 {
|
||||
margin-bottom: 0;
|
||||
vertical-align: middle;
|
||||
display: inline-block;
|
||||
}
|
||||
}
|
||||
|
||||
.page-action {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.control-group {
|
||||
width: 180px;
|
||||
display: inline-block;
|
||||
margin-bottom: 0;
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
.control {
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.page-content {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,67 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'account' => [
|
||||
'header-title' => 'My Account',
|
||||
'save-btn-title' => 'Save',
|
||||
'general' => 'General',
|
||||
'name' => 'Name',
|
||||
'email' => 'Email',
|
||||
'password' => 'Password',
|
||||
'confirm-password' => 'Confirm Password'
|
||||
],
|
||||
'users' => [
|
||||
'forget-password' => [
|
||||
'title' => 'Forget Password',
|
||||
'header-title' => 'Recover Password',
|
||||
'email' => 'Registered Email',
|
||||
'password' => 'Password',
|
||||
'confirm-password' => 'Confirm Password',
|
||||
'back-link-title' => 'Back to Sign In',
|
||||
'submit-btn-title' => 'Email Password Reset Link'
|
||||
],
|
||||
'reset-password' => [
|
||||
'title' => 'Reset Password',
|
||||
'title' => 'Reset Password',
|
||||
'email' => 'Registered Email',
|
||||
'back-link-title' => 'Back to Sign In',
|
||||
'submit-btn-title' => 'Reset Password'
|
||||
],
|
||||
'roles' => [
|
||||
'add-role-title' => 'Add Role',
|
||||
'edit-role-title' => 'Edit Role',
|
||||
'save-btn-title' => 'Save Role',
|
||||
'general' => 'General',
|
||||
'name' => 'Name',
|
||||
'description' => 'Description',
|
||||
'access-control' => 'Access Control',
|
||||
'permissions' => 'Permissions',
|
||||
'custom' => 'Custom',
|
||||
'all' => 'All'
|
||||
],
|
||||
'users' => [
|
||||
'add-user-title' => 'Add User',
|
||||
'edit-user-title' => 'Edit User',
|
||||
'save-btn-title' => 'Save User',
|
||||
'general' => 'General',
|
||||
'email' => 'Email',
|
||||
'name' => 'Name',
|
||||
'password' => 'Password',
|
||||
'confirm-password' => 'Confirm Password',
|
||||
'status-and-role' => 'Status and Role',
|
||||
'role' => 'Role',
|
||||
'status' => 'Status',
|
||||
'account-is-active' => 'Account is Active'
|
||||
],
|
||||
'sessions' => [
|
||||
'title' => 'Sign In',
|
||||
'email' => 'Email',
|
||||
'password' => 'Password',
|
||||
'forget-password-link-title' => 'Forget Password ?',
|
||||
'remember-me' => 'Remember Me',
|
||||
'submit-btn-title' => 'Sign In'
|
||||
]
|
||||
],
|
||||
'catalog' => [
|
||||
'attributes' => [
|
||||
'add-title' => 'Add Attribute',
|
||||
|
|
@ -43,6 +104,7 @@ return [
|
|||
'families' => 'Families',
|
||||
'add-family-btn-title' => 'Add Family',
|
||||
'add-title' => 'Add Family',
|
||||
'edit-title' => 'Edit Family',
|
||||
'save-btn-title' => 'Save Family',
|
||||
'general' => 'General',
|
||||
'code' => 'Family Code',
|
||||
|
|
@ -53,7 +115,106 @@ return [
|
|||
'attribute-code' => 'Code',
|
||||
'type' => 'Type',
|
||||
'add-attribute-title' => 'Add Attribute',
|
||||
'search' => 'Search'
|
||||
'search' => 'Search',
|
||||
'group-exist-error' => 'Group with same name already exists.'
|
||||
],
|
||||
'categories' => [
|
||||
'categories' => 'Categories',
|
||||
'add-title' => 'Add Category',
|
||||
'edit-title' => 'Edit Category',
|
||||
'save-btn-title' => 'Save Category',
|
||||
'general' => 'General',
|
||||
'name' => 'Name',
|
||||
'visible-in-menu' => 'Visible In Menu',
|
||||
'yes' => 'Yes',
|
||||
'no' => 'No',
|
||||
'position' => 'Position',
|
||||
'description-and-images' => 'Description and Images',
|
||||
'description' => 'Description',
|
||||
'parent-category' => 'Parent Category',
|
||||
'seo' => 'Search Engine Optimization',
|
||||
'slug' => 'Slug',
|
||||
'meta_title' => 'Meta Title',
|
||||
'meta_description' => 'Meta Description',
|
||||
'meta_keywords' => 'Meta Keywords',
|
||||
]
|
||||
],
|
||||
'settings' => [
|
||||
'locales' => [
|
||||
'add-locale-title' => 'Add Locale',
|
||||
'edit-locale-title' => 'Edit Locale',
|
||||
'add-title' => 'Add Locale',
|
||||
'save-btn-title' => 'Save Locale',
|
||||
'general' => 'General',
|
||||
'code' => 'Code',
|
||||
'name' => 'Name'
|
||||
],
|
||||
'countries' => [
|
||||
'add-title' => 'Add Counrty',
|
||||
'save-btn-title' => 'Save Counrty',
|
||||
'general' => 'General',
|
||||
'code' => 'Code',
|
||||
'name' => 'Name'
|
||||
],
|
||||
'currencies' => [
|
||||
'add-title' => 'Add Currency',
|
||||
'edit-title' => 'Edit Currency',
|
||||
'save-btn-title' => 'Save Currency',
|
||||
'general' => 'General',
|
||||
'code' => 'Code',
|
||||
'name' => 'Name',
|
||||
'symbol' => 'Symbol'
|
||||
],
|
||||
'exchange_rates' => [
|
||||
'title' => 'Exchange Rates',
|
||||
'add-title' => 'Add Exchange Rate',
|
||||
'edit-title' => 'Edit Exchange Rate',
|
||||
'save-btn-title' => 'Save Exchange Rate',
|
||||
'general' => 'General',
|
||||
'source_currency' => 'Source Currency',
|
||||
'target_currency' => 'Target Currency',
|
||||
'ratio' => 'Ratio'
|
||||
],
|
||||
'inventory_sources' => [
|
||||
'title' => 'Inventory Sources',
|
||||
'add-title' => 'Add Inventory Source',
|
||||
'edit-title' => 'Edit Inventory Source',
|
||||
'save-btn-title' => 'Save Inventory Source',
|
||||
'general' => 'General',
|
||||
'code' => 'Code',
|
||||
'name' => 'Name',
|
||||
'description' => 'Description',
|
||||
'source-is-active' => 'Source is Active',
|
||||
'contact-info' => 'Contact Information',
|
||||
'contact_name' => 'Name',
|
||||
'contact_email' => 'Email',
|
||||
'contact_number' => 'Contact Number',
|
||||
'contact_fax' => 'Fax',
|
||||
'address' => 'Source Address',
|
||||
'country' => 'Country',
|
||||
'state' => 'State',
|
||||
'city' => 'City',
|
||||
'street' => 'Street',
|
||||
'postcode' => 'Postcode',
|
||||
'priority' => 'Priority',
|
||||
'latitude' => 'Latitude',
|
||||
'longitude' => 'Longitude',
|
||||
'status' => 'Status'
|
||||
],
|
||||
'channels' => [
|
||||
'title' => 'Channels',
|
||||
'add-title' => 'Add Channel',
|
||||
'edit-title' => 'Edit Channel',
|
||||
'save-btn-title' => 'Save Channel',
|
||||
'general' => 'General',
|
||||
'code' => 'Code',
|
||||
'name' => 'Name',
|
||||
'description' => 'Description',
|
||||
'currencies-and-locales' => 'Currencies and Locales',
|
||||
'locales' => 'Locales',
|
||||
'default-locale' => 'Default Locale',
|
||||
'currencies' => 'Currencies',
|
||||
'base-currency' => 'Base Currency'
|
||||
]
|
||||
]
|
||||
];
|
||||
|
|
@ -6,13 +6,13 @@
|
|||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>
|
||||
{{ __('My Account') }}
|
||||
{{ __('admin::app.account.header-title') }}
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
<div class="page-action">
|
||||
<button type="submit" class="btn btn-lg btn-primary">
|
||||
{{ __('Save') }}
|
||||
{{ __('admin::app.account.save-btn-title') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -24,32 +24,32 @@
|
|||
|
||||
<input name="_method" type="hidden" value="PUT">
|
||||
|
||||
<accordian :title="'{{ __('General') }}'" :active="true">
|
||||
<accordian :title="'{{ __('admin::app.account.general') }}'" :active="true">
|
||||
<div slot="body">
|
||||
<div class="control-group" :class="[errors.has('name') ? 'has-error' : '']">
|
||||
<label for="name">{{ __('Name') }}</label>
|
||||
<label for="name" class="required">{{ __('admin::app.account.name') }}</label>
|
||||
<input type="text" v-validate="'required'" class="control" id="name" name="name" value="{{ $user->name }}"/>
|
||||
<span class="control-error" v-if="errors.has('name')">@{{ errors.first('name') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('email') ? 'has-error' : '']">
|
||||
<label for="email">{{ __('Email') }}</label>
|
||||
<label for="email">{{ __('admin::app.account.email') }}</label>
|
||||
<input type="text" v-validate="'required|email'" class="control" id="email" name="email" value="{{ $user->email }}"/>
|
||||
<span class="control-error" v-if="errors.has('email')">@{{ errors.first('email') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</accordian>
|
||||
|
||||
<accordian :title="'{{ __('Password') }}'" :active="true">
|
||||
<accordian :title="'{{ __('admin::app.account.password') }}'" :active="true">
|
||||
<div slot="body">
|
||||
<div class="control-group" :class="[errors.has('password') ? 'has-error' : '']">
|
||||
<label for="password">{{ __('Password') }}</label>
|
||||
<label for="password">{{ __('admin::app.account.password') }}</label>
|
||||
<input type="password" v-validate="'min:6'" class="control" id="password" name="password"/>
|
||||
<span class="control-error" v-if="errors.has('password')">@{{ errors.first('password') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('password_confirmation') ? 'has-error' : '']">
|
||||
<label for="password_confirmation">{{ __('Confirm Password') }}</label>
|
||||
<label for="password_confirmation">{{ __('admin::app.account.confirm-password') }}</label>
|
||||
<input type="password" v-validate="'min:6|confirmed:password'" class="control" id="password_confirmation" name="password_confirmation"/>
|
||||
<span class="control-error" v-if="errors.has('password_confirmation')">@{{ errors.first('password_confirmation') }}</span>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label for="type">{{ __('admin::app.catalog.attributes.type') }}</label>
|
||||
<label for="type" class="required">{{ __('admin::app.catalog.attributes.type') }}</label>
|
||||
<select class="control" id="type" name="type">
|
||||
<option value="text">{{ __('admin::app.catalog.attributes.text') }}</option>
|
||||
<option value="textarea">{{ __('admin::app.catalog.attributes.textarea') }}</option>
|
||||
|
|
@ -52,7 +52,7 @@
|
|||
<div slot="body">
|
||||
|
||||
<div class="control-group" :class="[errors.has('admin_name') ? 'has-error' : '']">
|
||||
<label for="admin_name">{{ __('admin::app.catalog.attributes.admin') }}</label>
|
||||
<label for="admin_name" class="required">{{ __('admin::app.catalog.attributes.admin') }}</label>
|
||||
<input type="text" v-validate="'required'" class="control" id="admin_name" name="admin_name" value="{{ old('admin_name') }}"/>
|
||||
<span class="control-error" v-if="errors.has('admin_name')">@{{ errors.first('admin_name') }}</span>
|
||||
</div>
|
||||
|
|
@ -196,7 +196,7 @@
|
|||
|
||||
<td>
|
||||
<div class="control-group" :class="[errors.has(sortOrderName(row)) ? 'has-error' : '']">
|
||||
<input type="text" v-validate="'required'" :name="sortOrderName(row)" class="control"/>
|
||||
<input type="text" v-validate="'required|numeric'" :name="sortOrderName(row)" class="control"/>
|
||||
<span class="control-error" v-if="errors.has(sortOrderName(row))">@{{ errors.first(sortOrderName(row)) }}</span>
|
||||
</div>
|
||||
</td>
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
<accordian :title="'{{ __('admin::app.catalog.attributes.general') }}'" :active="true">
|
||||
<div slot="body">
|
||||
<div class="control-group" :class="[errors.has('code') ? 'has-error' : '']">
|
||||
<label for="code">{{ __('admin::app.catalog.attributes.code') }}</label>
|
||||
<label for="code" class="required">{{ __('admin::app.catalog.attributes.code') }}</label>
|
||||
<input type="hidden" name="code" value="{{ old('code') ?: $attribute->code }}"/>
|
||||
<input type="text" v-validate="'required'" class="control" id="code" name="code" value="{{ old('code') ?: $attribute->code }}" disabled="disabled"/>
|
||||
<span class="control-error" v-if="errors.has('code')">@{{ errors.first('code') }}</span>
|
||||
|
|
@ -70,7 +70,7 @@
|
|||
<div slot="body">
|
||||
|
||||
<div class="control-group" :class="[errors.has('admin_name') ? 'has-error' : '']">
|
||||
<label for="admin_name">{{ __('admin::app.catalog.attributes.admin') }}</label>
|
||||
<label for="admin_name" class="required">{{ __('admin::app.catalog.attributes.admin') }}</label>
|
||||
<input type="text" v-validate="'required'" class="control" id="admin_name" name="admin_name" value="{{ old('admin_name') ?: $attribute->admin_name }}"/>
|
||||
<span class="control-error" v-if="errors.has('admin_name')">@{{ errors.first('admin_name') }}</span>
|
||||
</div>
|
||||
|
|
@ -79,7 +79,7 @@
|
|||
|
||||
<div class="control-group">
|
||||
<label for="locale-{{ $locale->code }}">{{ $locale->name . ' (' . $locale->code . ')' }}</label>
|
||||
<input type="text" class="control" id="locale-{{ $locale->code }}" name="<?php echo $locale->code; ?>[name]" value="{{ old($locale->code)['name'] ?: $attribute->translate($locale->code)->name }}"/>
|
||||
<input type="text" class="control" id="locale-{{ $locale->code }}" name="<?php echo $locale->code; ?>[name]" value="{{ old($locale->code)['name'] ?: $attribute->translate($locale->code)['name'] }}"/>
|
||||
</div>
|
||||
|
||||
@endforeach
|
||||
|
|
@ -243,7 +243,7 @@
|
|||
|
||||
<td>
|
||||
<div class="control-group" :class="[errors.has(sortOrderName(row)) ? 'has-error' : '']">
|
||||
<input type="text" v-validate="'required'" v-model="row['sort_order']" :name="sortOrderName(row)" class="control"/>
|
||||
<input type="text" v-validate="'required|numeric'" v-model="row['sort_order']" :name="sortOrderName(row)" class="control"/>
|
||||
<span class="control-error" v-if="errors.has(sortOrderName(row))">@{{ errors.first(sortOrderName(row)) }}</span>
|
||||
</div>
|
||||
</td>
|
||||
|
|
@ -282,7 +282,7 @@
|
|||
var row = {'id': '{{ $option->id }}', 'sort_order': '{{ $option->sort_order }}'};
|
||||
|
||||
@foreach(Webkul\Core\Models\Locale::all() as $locale)
|
||||
row['{{ $locale->code }}'] = '{{ $option->translate($locale->code)->label }}';
|
||||
row['{{ $locale->code }}'] = "{{ $option->translate($locale->code)['label'] }}";
|
||||
@endforeach
|
||||
|
||||
this.optionRows.push(row);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,116 @@
|
|||
@extends('admin::layouts.content')
|
||||
|
||||
@section('page_title')
|
||||
{{ __('admin::app.catalog.categories.add-title') }}
|
||||
@stop
|
||||
|
||||
@section('content')
|
||||
<div class="content">
|
||||
|
||||
<form method="POST" action="{{ route('admin.catalog.categories.store') }}">
|
||||
|
||||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>{{ __('admin::app.catalog.categories.add-title') }}</h1>
|
||||
</div>
|
||||
|
||||
<div class="page-action">
|
||||
<button type="submit" class="btn btn-lg btn-primary">
|
||||
{{ __('admin::app.catalog.categories.save-btn-title') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="page-content">
|
||||
<div class="form-container">
|
||||
@csrf()
|
||||
<input type="hidden" name="locale" value="all"/>
|
||||
|
||||
<accordian :title="'{{ __('admin::app.catalog.categories.general') }}'" :active="true">
|
||||
<div slot="body">
|
||||
|
||||
<div class="control-group" :class="[errors.has('name') ? 'has-error' : '']">
|
||||
<label for="name" class="required">{{ __('admin::app.catalog.categories.name') }}</label>
|
||||
<input type="text" 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('status') ? 'has-error' : '']">
|
||||
<label for="status" class="required">{{ __('admin::app.catalog.categories.visible-in-menu') }}</label>
|
||||
<select class="control" v-validate="'required'" id="status" name="status">
|
||||
<option value="1">
|
||||
{{ __('admin::app.catalog.categories.yes') }}
|
||||
</option>
|
||||
<option value="0">
|
||||
{{ __('admin::app.catalog.categories.no') }}
|
||||
</option>
|
||||
</select>
|
||||
<span class="control-error" v-if="errors.has('status')">@{{ errors.first('status') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('position') ? 'has-error' : '']">
|
||||
<label for="position" class="required">{{ __('admin::app.catalog.categories.position') }}</label>
|
||||
<input type="text" v-validate="'required|numeric'" class="control" id="position" name="position" value="{{ old('position') }}"/>
|
||||
<span class="control-error" v-if="errors.has('position')">@{{ errors.first('position') }}</span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</accordian>
|
||||
|
||||
<accordian :title="'{{ __('admin::app.catalog.categories.description-and-images') }}'" :active="true">
|
||||
<div slot="body">
|
||||
|
||||
<div class="control-group" :class="[errors.has('description') ? 'has-error' : '']">
|
||||
<label for="description" class="required">{{ __('admin::app.catalog.categories.description') }}</label>
|
||||
<textarea v-validate="'required'" class="control" id="description" name="description">{{ old('description') }}</textarea>
|
||||
<span class="control-error" v-if="errors.has('description')">@{{ errors.first('description') }}</span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</accordian>
|
||||
|
||||
<accordian :title="'{{ __('admin::app.catalog.categories.parent-category') }}'" :active="true">
|
||||
<div slot="body">
|
||||
|
||||
<tree-view value-field="id" name-field="parent_id" input-type="radio" items='@json($categories)'></tree-view>
|
||||
|
||||
</div>
|
||||
</accordian>
|
||||
|
||||
<accordian :title="'{{ __('admin::app.catalog.categories.seo') }}'" :active="true">
|
||||
<div slot="body">
|
||||
|
||||
<div class="control-group">
|
||||
<label for="meta_title">{{ __('admin::app.catalog.categories.meta_title') }}</label>
|
||||
<input type="text" class="control" id="meta_title" name="meta_title" value="{{ old('meta_title') }}"/>
|
||||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('slug') ? 'has-error' : '']">
|
||||
<label for="slug" class="required">{{ __('admin::app.catalog.categories.slug') }}</label>
|
||||
<input type="text" v-validate="'required'" class="control" id="slug" name="slug" value="{{ old('slug') }}"/>
|
||||
<span class="control-error" v-if="errors.has('slug')">@{{ errors.first('slug') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label for="meta_description">{{ __('admin::app.catalog.categories.meta_description') }}</label>
|
||||
<textarea class="control" id="meta_description" name="meta_description">{{ old('meta_description') }}</textarea>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label for="meta_keywords">{{ __('admin::app.catalog.categories.meta_keywords') }}</label>
|
||||
<textarea class="control" id="meta_keywords" name="meta_keywords">{{ old('meta_keywords') }}</textarea>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</accordian>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
@stop
|
||||
|
||||
@section('javascript')
|
||||
|
||||
@stop
|
||||
|
|
@ -0,0 +1,131 @@
|
|||
@extends('admin::layouts.content')
|
||||
|
||||
@section('page_title')
|
||||
{{ __('admin::app.catalog.categories.edit-title') }}
|
||||
@stop
|
||||
|
||||
@section('content')
|
||||
<div class="content">
|
||||
<?php $locale = request()->get('channel_locale') ?: channel()->getDefaultChannelLocale()->id; ?>
|
||||
|
||||
<form method="POST" action="">
|
||||
|
||||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>{{ __('admin::app.catalog.categories.edit-title') }}</h1>
|
||||
|
||||
<div class="control-group">
|
||||
<select class="control" id="locale-switcher" onChange="window.location.href = this.value">
|
||||
@foreach(Webkul\Channel\Models\Channel::all() as $channel)
|
||||
|
||||
<optgroup label="{{ $channel->name }}">
|
||||
|
||||
@foreach($channel->channel_locales as $channelLocale)
|
||||
<option value="{{ route('admin.catalog.categories.update', $category->id) . '?channel_locale=' . $channelLocale->id }}" {{ $channelLocale->id == $locale ? 'selected' : '' }}>
|
||||
{{ $channelLocale->locale->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
|
||||
</optgroup>
|
||||
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="page-action">
|
||||
<button type="submit" class="btn btn-lg btn-primary">
|
||||
{{ __('admin::app.catalog.categories.save-btn-title') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="page-content">
|
||||
<div class="form-container">
|
||||
@csrf()
|
||||
<input name="_method" type="hidden" value="PUT">
|
||||
|
||||
<accordian :title="'{{ __('admin::app.catalog.categories.general') }}'" :active="true">
|
||||
<div slot="body">
|
||||
|
||||
<div class="control-group" :class="[errors.has('{{$locale}}[name]') ? 'has-error' : '']">
|
||||
<label for="name" class="required">{{ __('admin::app.catalog.categories.name') }}</label>
|
||||
<input type="text" v-validate="'required'" class="control" id="name" name="{{$locale}}[name]" value="{{ old($locale)['name'] ?: $category->translate($locale)['name'] }}"/>
|
||||
<span class="control-error" v-if="errors.has('{{$locale}}[name]')">@{{ errors.first('{!!$locale!!}[name]') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('status') ? 'has-error' : '']">
|
||||
<label for="status" class="required">{{ __('admin::app.catalog.categories.visible-in-menu') }}</label>
|
||||
<select class="control" v-validate="'required'" id="status" name="status">
|
||||
<option value="1" {{ $category->status ? 'selected' : '' }}>
|
||||
{{ __('admin::app.catalog.categories.yes') }}
|
||||
</option>
|
||||
<option value="0" {{ $category->status ? '' : 'selected' }}>
|
||||
{{ __('admin::app.catalog.categories.no') }}
|
||||
</option>
|
||||
</select>
|
||||
<span class="control-error" v-if="errors.has('status')">@{{ errors.first('status') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('position') ? 'has-error' : '']">
|
||||
<label for="position">{{ __('admin::app.catalog.categories.position') }}</label>
|
||||
<input type="text" v-validate="'required|numeric'" class="control" id="position" name="position" value="{{ old('position') ?: $category->position }}"/>
|
||||
<span class="control-error" v-if="errors.has('position')">@{{ errors.first('position') }}</span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</accordian>
|
||||
|
||||
<accordian :title="'{{ __('admin::app.catalog.categories.description-and-images') }}'" :active="true">
|
||||
<div slot="body">
|
||||
|
||||
<div class="control-group" :class="[errors.has('{{$locale}}[description]') ? 'has-error' : '']">
|
||||
<label for="description" class="required">{{ __('admin::app.catalog.categories.description') }}</label>
|
||||
<textarea v-validate="'required'" class="control" id="description" name="{{$locale}}[description]">{{ old($locale)['description'] ?: $category->translate($locale)['description'] }}</textarea>
|
||||
<span class="control-error" v-if="errors.has('{{$locale}}[description]')">@{{ errors.first('{!!$locale!!}[description]') }}</span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</accordian>
|
||||
|
||||
<accordian :title="'{{ __('admin::app.catalog.categories.parent-category') }}'" :active="true">
|
||||
<div slot="body">
|
||||
|
||||
<tree-view value-field="id" name-field="parent_id" input-type="radio" items='@json($categories)' value='@json($category->parent_id)'></tree-view>
|
||||
|
||||
</div>
|
||||
</accordian>
|
||||
|
||||
<accordian :title="'{{ __('admin::app.catalog.categories.seo') }}'" :active="true">
|
||||
<div slot="body">
|
||||
|
||||
<div class="control-group">
|
||||
<label for="meta_title">{{ __('admin::app.catalog.categories.meta_title') }}</label>
|
||||
<input type="text" class="control" id="meta_title" name="{{$locale}}[meta_title]" value="{{ old($locale)['meta_title'] ?: $category->translate($locale)['meta_title'] }}"/>
|
||||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('{{$locale}}[slug]') ? 'has-error' : '']">
|
||||
<label for="slug" class="required">{{ __('admin::app.catalog.categories.slug') }}</label>
|
||||
<input type="text" v-validate="'required'" class="control" id="slug" name="{{$locale}}[slug]" value="{{ old($locale)['slug'] ?: $category->translate($locale)['slug'] }}"/>
|
||||
<span class="control-error" v-if="errors.has('{{$locale}}[slug]')">@{{ errors.first('{!!$locale!!}[slug]') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label for="meta_description">{{ __('admin::app.catalog.categories.meta_description') }}</label>
|
||||
<textarea class="control" id="meta_description" name="{{$locale}}[meta_description]">{{ old($locale)['meta_description'] ?: $category->translate($locale)['meta_description'] }}</textarea>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label for="meta_keywords">{{ __('admin::app.catalog.categories.meta_keywords') }}</label>
|
||||
<textarea class="control" id="meta_keywords" name="{{$locale}}[meta_keywords]">{{ old($locale)['meta_keywords'] ?: $category->translate($locale)['meta_keywords'] }}</textarea>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</accordian>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
@stop
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
@extends('admin::layouts.content')
|
||||
|
||||
@section('content')
|
||||
<div class="content">
|
||||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
Categories
|
||||
</div>
|
||||
|
||||
<div class="page-action">
|
||||
<a href="{{ route('admin.catalog.categories.create') }}" class="btn btn-lg btn-primary">
|
||||
{{ __('Add Category') }}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="page-content">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@stop
|
||||
|
|
@ -29,13 +29,13 @@
|
|||
<div slot="body">
|
||||
|
||||
<div class="control-group" :class="[errors.has('code') ? 'has-error' : '']">
|
||||
<label for="code">{{ __('admin::app.catalog.families.code') }}</label>
|
||||
<label for="code" class="required">{{ __('admin::app.catalog.families.code') }}</label>
|
||||
<input type="text" 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">{{ __('admin::app.catalog.families.name') }}</label>
|
||||
<label for="name" class="required">{{ __('admin::app.catalog.families.name') }}</label>
|
||||
<input type="text" 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>
|
||||
|
|
@ -78,14 +78,14 @@
|
|||
@csrf()
|
||||
|
||||
<div class="control-group" :class="[errors.has('add-group-form.groupName') ? 'has-error' : '']">
|
||||
<label for="groupName">{{ __('admin::app.catalog.families.name') }}</label>
|
||||
<label for="groupName" class="required">{{ __('admin::app.catalog.families.name') }}</label>
|
||||
<input type="text" v-validate="'required'" v-model="group.groupName" class="control" id="groupName" name="groupName"/>
|
||||
<span class="control-error" v-if="errors.has('add-group-form.groupName')">@{{ errors.first('add-group-form.groupName') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('add-group-form.position') ? 'has-error' : '']">
|
||||
<label for="position">{{ __('admin::app.catalog.families.position') }}</label>
|
||||
<input type="text" v-validate="'required'" v-model="group.position" class="control" id="position" name="position"/>
|
||||
<input type="text" v-validate="'required|numeric'" v-model="group.position" class="control" id="position" name="position"/>
|
||||
<span class="control-error" v-if="errors.has('add-group-form.position')">@{{ errors.first('add-group-form.position') }}</span>
|
||||
</div>
|
||||
|
||||
|
|
@ -101,7 +101,7 @@
|
|||
|
||||
<script type="text/x-template" id="group-list-template">
|
||||
<div>
|
||||
<group-item v-for='(group, index) in groups' :group="group" :attributes="attributes" :key="index" @onRemoveGroup="removeGroup($event)" @onAttributeAdd="addAttributes(index, $event)" @onAttributeRemove="removeAttribute(index, $event)"></group-item>
|
||||
<group-item v-for='(group, index) in groups' :group="group" :attributes="attributes" :key="index" :index="index" @onRemoveGroup="removeGroup($event)" @onAttributeAdd="addAttributes(index, $event)" @onAttributeRemove="removeAttribute(index, $event)"></group-item>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
|
|
@ -114,6 +114,9 @@
|
|||
</div>
|
||||
|
||||
<div slot="body">
|
||||
<input type="hidden" :name="groupInputName" :value="group.groupName"/>
|
||||
<input type="hidden":name="groupInputPosition" :value="group.position"/>
|
||||
|
||||
<div class="table" v-if="group.attributes.length" style="margin-bottom: 20px;">
|
||||
<table>
|
||||
<thead>
|
||||
|
|
@ -127,8 +130,11 @@
|
|||
|
||||
<tbody>
|
||||
<tr v-for='(attribute, index) in group.attributes'>
|
||||
<td>@{{ attribute.code }}</td>
|
||||
<td>@{{ attribute.name }}</td>
|
||||
<td>
|
||||
<input type="hidden" :name="groupAttributeInput" :value="attribute.id"/>
|
||||
@{{ attribute.code }}
|
||||
</td>
|
||||
<td>@{{ attribute.admin_name }}</td>
|
||||
<td>@{{ attribute.type }}</td>
|
||||
<td class="actions">
|
||||
<i class="icon trash-icon" @click="removeAttribute(attribute)"></i>
|
||||
|
|
@ -188,13 +194,32 @@
|
|||
addGroup (formScope) {
|
||||
this.$validator.validateAll(formScope).then((result) => {
|
||||
if (result) {
|
||||
groups.push(this.group);
|
||||
var this_this = this;
|
||||
|
||||
groups = this.sortGroups();
|
||||
|
||||
this.group = {'groupName': '', 'position': '', 'attributes': []};
|
||||
var filteredGroups = groups.filter(function(group) {
|
||||
return this_this.group.groupName.trim() === group.groupName.trim()
|
||||
})
|
||||
|
||||
this.$parent.closeModal();
|
||||
if(filteredGroups.length) {
|
||||
const field = this.$validator.fields.find({ name: 'groupName', scope: 'add-group-form' });
|
||||
|
||||
if (field) {
|
||||
this.$validator.errors.add({
|
||||
id: field.id,
|
||||
field: 'groupName',
|
||||
msg: "{{ __('admin::app.catalog.families.group-exist-error') }}",
|
||||
scope: 'add-group-form',
|
||||
});
|
||||
}
|
||||
} else {
|
||||
groups.push(this.group);
|
||||
|
||||
groups = this.sortGroups();
|
||||
|
||||
this.group = {'groupName': '', 'position': '', 'attributes': []};
|
||||
|
||||
this.$parent.closeModal();
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
|
@ -218,35 +243,66 @@
|
|||
|
||||
methods: {
|
||||
removeGroup (group) {
|
||||
group.attributes.forEach(function(attribute) {
|
||||
this.attributes.push(attribute);
|
||||
})
|
||||
|
||||
this.attributes = this.sortAttributes();
|
||||
|
||||
let index = groups.indexOf(group)
|
||||
|
||||
groups.splice(index, 1)
|
||||
},
|
||||
|
||||
addAttributes (groupIndex, attributeIds) {
|
||||
var this_this = this;
|
||||
attributeIds.forEach(function(attributeId) {
|
||||
var attribute = this_this.attributes.filter(attribute => attribute.id == attributeId)
|
||||
var attribute = this.attributes.filter(attribute => attribute.id == attributeId)
|
||||
|
||||
this.groups[groupIndex].attributes.push(attribute[0]);
|
||||
|
||||
this_this.groups[groupIndex].attributes.push(attribute[0]);
|
||||
let index = this.attributes.indexOf(attribute[0])
|
||||
|
||||
let index = this_this.attributes.indexOf(attribute)
|
||||
|
||||
this_this.attributes.splice(index, 1)
|
||||
this.attributes.splice(index, 1)
|
||||
})
|
||||
},
|
||||
|
||||
removeAttribute (groupIndex, attribute) {
|
||||
|
||||
let index = this.groups[groupIndex].attributes.indexOf(attribute)
|
||||
|
||||
this.groups[groupIndex].attributes.splice(index, 1)
|
||||
|
||||
this.attributes.push(attribute);
|
||||
|
||||
this.attributes = this.sortAttributes();
|
||||
},
|
||||
|
||||
sortAttributes () {
|
||||
return this.attributes.sort(function(a, b) {
|
||||
return a.id - b.id;
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Vue.component('group-item', {
|
||||
props: ['group', 'attributes'],
|
||||
props: ['index', 'group', 'attributes'],
|
||||
|
||||
template: "#group-item-template",
|
||||
|
||||
computed: {
|
||||
groupInputName () {
|
||||
return "attribute_groups[group_" + this.index + "][name]";
|
||||
},
|
||||
|
||||
groupInputPosition () {
|
||||
return "attribute_groups[group_" + this.index + "][position]";
|
||||
},
|
||||
|
||||
groupAttributeInput () {
|
||||
return "attribute_groups[group_" + this.index + "][attributes][]";
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
removeGroup () {
|
||||
this.$emit('onRemoveGroup', this.group)
|
||||
|
|
@ -257,6 +313,7 @@
|
|||
|
||||
$(e.target).prev().find('li input').each(function() {
|
||||
var attributeId = $(this).val();
|
||||
|
||||
if($(this).is(':checked')) {
|
||||
attributeIds.push(attributeId);
|
||||
|
||||
|
|
@ -270,7 +327,7 @@
|
|||
},
|
||||
|
||||
removeAttribute (attribute) {
|
||||
this.$emit('onAttributeRemove', attributeIds)
|
||||
this.$emit('onAttributeRemove', attribute)
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -0,0 +1,361 @@
|
|||
@extends('admin::layouts.content')
|
||||
|
||||
@section('page_title')
|
||||
{{ __('admin::app.catalog.families.edit-title') }}
|
||||
@stop
|
||||
|
||||
@section('content')
|
||||
<div class="content">
|
||||
<form method="POST" action="{{ route('admin.catalog.families.update', $attributeFamily->id) }}">
|
||||
|
||||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>{{ __('admin::app.catalog.families.edit-title') }}</h1>
|
||||
</div>
|
||||
|
||||
<div class="page-action">
|
||||
<button type="submit" class="btn btn-lg btn-primary">
|
||||
{{ __('admin::app.catalog.families.save-btn-title') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="page-content">
|
||||
|
||||
<div class="form-container">
|
||||
@csrf()
|
||||
<input name="_method" type="hidden" value="PUT">
|
||||
|
||||
<accordian :title="'{{ __('admin::app.catalog.families.general') }}'" :active="true">
|
||||
<div slot="body">
|
||||
|
||||
<div class="control-group" :class="[errors.has('code') ? 'has-error' : '']">
|
||||
<label for="code" class="required">{{ __('admin::app.catalog.families.code') }}</label>
|
||||
<input type="text" v-validate="'required'" class="control" id="code" name="code" value="{{ old('code') ?: $attributeFamily->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.catalog.families.name') }}</label>
|
||||
<input type="text" v-validate="'required'" class="control" id="name" name="name" value="{{ old('name') ?: $attributeFamily->name }}"/>
|
||||
<span class="control-error" v-if="errors.has('name')">@{{ errors.first('name') }}</span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</accordian>
|
||||
|
||||
<accordian :title="'{{ __('admin::app.catalog.families.groups') }}'" :active="true">
|
||||
<div slot="body">
|
||||
|
||||
<button type="button" class="btn btn-md btn-primary" @click="showModal('addGroup')">
|
||||
{{ __('admin::app.catalog.families.add-group-title') }}
|
||||
</button>
|
||||
|
||||
<group-list></group-list>
|
||||
</div>
|
||||
</accordian>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<modal id="addGroup" :is-open="modalIds.addGroup">
|
||||
<h3 slot="header">{{ __('admin::app.catalog.families.add-group-title') }}</h3>
|
||||
|
||||
<div slot="body">
|
||||
<group-form></group-form>
|
||||
</div>
|
||||
</modal>
|
||||
@stop
|
||||
|
||||
@section('javascript')
|
||||
|
||||
<script type="text/x-template" id="group-form-template">
|
||||
<form method="POST" action="{{ route('admin.catalog.families.store') }}" data-vv-scope="add-group-form" @submit.prevent="addGroup('add-group-form')">
|
||||
|
||||
<div class="page-content">
|
||||
<div class="form-container">
|
||||
@csrf()
|
||||
|
||||
<div class="control-group" :class="[errors.has('add-group-form.groupName') ? 'has-error' : '']">
|
||||
<label for="groupName" class="required">{{ __('admin::app.catalog.families.name') }}</label>
|
||||
<input type="text" v-validate="'required'" v-model="group.groupName" class="control" id="groupName" name="groupName"/>
|
||||
<span class="control-error" v-if="errors.has('add-group-form.groupName')">@{{ errors.first('add-group-form.groupName') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('add-group-form.position') ? 'has-error' : '']">
|
||||
<label for="position">{{ __('admin::app.catalog.families.position') }}</label>
|
||||
<input type="text" v-validate="'required|numeric'" v-model="group.position" class="control" id="position" name="position"/>
|
||||
<span class="control-error" v-if="errors.has('add-group-form.position')">@{{ errors.first('add-group-form.position') }}</span>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-lg btn-primary">
|
||||
{{ __('admin::app.catalog.families.add-group-title') }}
|
||||
</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</script>
|
||||
|
||||
<script type="text/x-template" id="group-list-template">
|
||||
<div style="margin-top: 20px">
|
||||
<group-item v-for='(group, index) in groups' :group="group" :attributes="attributes" :key="index" :index="index" @onRemoveGroup="removeGroup($event)" @onAttributeAdd="addAttributes(index, $event)" @onAttributeRemove="removeAttribute(index, $event)"></group-item>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/x-template" id="group-item-template">
|
||||
<accordian :title="group.groupName" :active="true">
|
||||
<div slot="header">
|
||||
<i class="icon expand-icon left"></i>
|
||||
<h1>@{{ group.name ? group.name : group.groupName }}</h1>
|
||||
<i class="icon trash-icon" @click="removeGroup()"></i>
|
||||
</div>
|
||||
|
||||
<div slot="body">
|
||||
<input type="hidden" :name="groupInputName" :value="group.name ? group.name : group.groupName"/>
|
||||
<input type="hidden":name="groupInputPosition" :value="group.position"/>
|
||||
|
||||
<div class="table" v-if="group.attributes.length" style="margin-bottom: 20px;">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{ __('admin::app.catalog.families.attribute-code') }}</th>
|
||||
<th>{{ __('admin::app.catalog.families.name') }}</th>
|
||||
<th>{{ __('admin::app.catalog.families.type') }}</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<tr v-for='(attribute, index) in group.attributes'>
|
||||
<td>
|
||||
<input type="hidden" :name="groupAttributeInput" :value="attribute.id"/>
|
||||
@{{ attribute.code }}
|
||||
</td>
|
||||
<td>@{{ attribute.admin_name }}</td>
|
||||
<td>@{{ attribute.type }}</td>
|
||||
<td class="actions">
|
||||
<i class="icon trash-icon" @click="removeAttribute(attribute)"></i>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<button type="button" class="btn btn-md btn-primary dropdown-toggle">
|
||||
{{ __('admin::app.catalog.families.add-attribute-title') }}
|
||||
</button>
|
||||
|
||||
<div class="dropdown-list" style="width: 240px">
|
||||
<div class="search-box">
|
||||
<input type="text" class="control" placeholder="{{ __('admin::app.catalog.families.search') }}">
|
||||
</div>
|
||||
|
||||
<div class="dropdown-container">
|
||||
<ul>
|
||||
<li v-for='(attribute, index) in attributes' :data-id="attribute.id">
|
||||
<span class="checkbox">
|
||||
<input type="checkbox" :id="attribute.id" :value="attribute.id"/>
|
||||
<label class="checkbox-view" :for="attribute.id"></label>
|
||||
@{{ attribute.admin_name }}
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<button type="button" class="btn btn-lg btn-primary" @click="addAttributes($event)">
|
||||
{{ __('admin::app.catalog.families.add-attribute-title') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</accordian>
|
||||
</script>
|
||||
|
||||
<script>
|
||||
// $(document).ready(function () {
|
||||
var groups = @json($attributeFamily->attribute_groups);
|
||||
var attributes = @json($attributes);
|
||||
|
||||
Vue.component('group-form', {
|
||||
|
||||
data: () => ({
|
||||
group: {
|
||||
'groupName': '',
|
||||
'position': '',
|
||||
'attributes': []
|
||||
}
|
||||
}),
|
||||
|
||||
template: '#group-form-template',
|
||||
|
||||
methods: {
|
||||
addGroup (formScope) {
|
||||
this.$validator.validateAll(formScope).then((result) => {
|
||||
if (result) {
|
||||
var this_this = this;
|
||||
|
||||
var filteredGroups = groups.filter(function(group) {
|
||||
return this_this.group.groupName.trim() === (group.name ? group.name.trim() : group.groupName.trim())
|
||||
})
|
||||
|
||||
if(filteredGroups.length) {
|
||||
const field = this.$validator.fields.find({ name: 'groupName', scope: 'add-group-form' });
|
||||
|
||||
if (field) {
|
||||
this.$validator.errors.add({
|
||||
id: field.id,
|
||||
field: 'groupName',
|
||||
msg: "{{ __('admin::app.catalog.families.group-exist-error') }}",
|
||||
scope: 'add-group-form',
|
||||
});
|
||||
}
|
||||
} else {
|
||||
groups.push(this.group);
|
||||
|
||||
groups = this.sortGroups();
|
||||
|
||||
this.group = {'groupName': '', 'position': '', 'attributes': []};
|
||||
|
||||
this.$parent.closeModal();
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
sortGroups () {
|
||||
return groups.sort(function(a, b) {
|
||||
return a.position - b.position;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Vue.component('group-list', {
|
||||
|
||||
template: '#group-list-template',
|
||||
|
||||
data: () => ({
|
||||
groups: groups,
|
||||
attributes: attributes
|
||||
}),
|
||||
|
||||
created () {
|
||||
this.groups.forEach(function(group) {
|
||||
group.attributes.forEach(function(attribute) {
|
||||
var attribute = this.attributes.filter(attributeTemp => attributeTemp.id == attribute.id)
|
||||
|
||||
if(attribute.length) {
|
||||
let index = this.attributes.indexOf(attribute[0])
|
||||
|
||||
this.attributes.splice(index, 1)
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
methods: {
|
||||
removeGroup (group) {
|
||||
group.attributes.forEach(function(attribute) {
|
||||
this.attributes.push(attribute);
|
||||
})
|
||||
|
||||
this.attributes = this.sortAttributes();
|
||||
|
||||
let index = groups.indexOf(group)
|
||||
|
||||
groups.splice(index, 1)
|
||||
},
|
||||
|
||||
addAttributes (groupIndex, attributeIds) {
|
||||
attributeIds.forEach(function(attributeId) {
|
||||
var attribute = this.attributes.filter(attribute => attribute.id == attributeId)
|
||||
|
||||
this.groups[groupIndex].attributes.push(attribute[0]);
|
||||
|
||||
let index = this.attributes.indexOf(attribute[0])
|
||||
|
||||
this.attributes.splice(index, 1)
|
||||
})
|
||||
},
|
||||
|
||||
removeAttribute (groupIndex, attribute) {
|
||||
let index = this.groups[groupIndex].attributes.indexOf(attribute)
|
||||
|
||||
this.groups[groupIndex].attributes.splice(index, 1)
|
||||
|
||||
this.attributes.push(attribute);
|
||||
|
||||
this.attributes = this.sortAttributes();
|
||||
},
|
||||
|
||||
sortAttributes () {
|
||||
return this.attributes.sort(function(a, b) {
|
||||
return a.id - b.id;
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Vue.component('group-item', {
|
||||
props: ['index', 'group', 'attributes'],
|
||||
|
||||
template: "#group-item-template",
|
||||
|
||||
computed: {
|
||||
groupInputName () {
|
||||
if(this.group.id)
|
||||
return "attribute_groups[" + this.group.id + "][name]";
|
||||
|
||||
return "attribute_groups[group_" + this.index + "][name]";
|
||||
},
|
||||
|
||||
groupInputPosition () {
|
||||
if(this.group.id)
|
||||
return "attribute_groups[" + this.group.id + "][position]";
|
||||
|
||||
return "attribute_groups[group_" + this.index + "][position]";
|
||||
},
|
||||
|
||||
groupAttributeInput () {
|
||||
if(this.group.id)
|
||||
return "attribute_groups[" + this.group.id + "][attributes][]";
|
||||
|
||||
return "attribute_groups[group_" + this.index + "][attributes][]";
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
removeGroup () {
|
||||
this.$emit('onRemoveGroup', this.group)
|
||||
},
|
||||
|
||||
addAttributes (e) {
|
||||
var attributeIds = [];
|
||||
|
||||
$(e.target).prev().find('li input').each(function() {
|
||||
var attributeId = $(this).val();
|
||||
|
||||
if($(this).is(':checked')) {
|
||||
attributeIds.push(attributeId);
|
||||
|
||||
$(this).prop('checked', false);
|
||||
}
|
||||
});
|
||||
|
||||
$('body').trigger('click')
|
||||
|
||||
this.$emit('onAttributeAdd', attributeIds)
|
||||
},
|
||||
|
||||
removeAttribute (attribute) {
|
||||
this.$emit('onAttributeRemove', attribute)
|
||||
}
|
||||
}
|
||||
});
|
||||
// });
|
||||
</script>
|
||||
@stop
|
||||
|
|
@ -0,0 +1,109 @@
|
|||
@extends('admin::layouts.content')
|
||||
|
||||
@section('page_title')
|
||||
{{ __('admin::app.settings.channels.add-title') }}
|
||||
@stop
|
||||
|
||||
@section('content')
|
||||
<div class="content">
|
||||
|
||||
<form method="POST" action="{{ route('admin.channels.store') }}" @submit.prevent="onSubmit">
|
||||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>{{ __('admin::app.settings.channels.add-title') }}</h1>
|
||||
</div>
|
||||
|
||||
<div class="page-action">
|
||||
<button type="submit" class="btn btn-lg btn-primary">
|
||||
{{ __('admin::app.settings.channels.save-btn-title') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="page-content">
|
||||
<div class="form-container">
|
||||
@csrf()
|
||||
|
||||
<accordian :title="'{{ __('admin::app.settings.channels.general') }}'" :active="true">
|
||||
<div slot="body">
|
||||
|
||||
<div class="control-group" :class="[errors.has('code') ? 'has-error' : '']">
|
||||
<label for="code" class="required">{{ __('admin::app.settings.channels.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.settings.channels.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.settings.channels.description') }}</label>
|
||||
<textarea class="control" id="description" name="description">{{ old('description') }}</textarea>
|
||||
<span class="control-error" v-if="errors.has('description')">@{{ errors.first('description') }}</span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</accordian>
|
||||
|
||||
<accordian :title="'{{ __('admin::app.settings.channels.currencies-and-locales') }}'" :active="true">
|
||||
<div slot="body">
|
||||
|
||||
<div class="control-group" :class="[errors.has('locales[]') ? 'has-error' : '']">
|
||||
<label for="locales" class="required">{{ __('admin::app.settings.channels.locales') }}</label>
|
||||
<select v-validate="'required'" class="control" id="locales" name="locales[]" multiple>
|
||||
@foreach(core()->allLocales() as $locale)
|
||||
<option value="{{ $locale->id }}" {{ old('locales') && in_array($locale->id, old('locales')) ? 'selected' : '' }}>
|
||||
{{ $locale->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<span class="control-error" v-if="errors.has('locales[]')">@{{ errors.first('locales[]') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('default_locale') ? 'has-error' : '']">
|
||||
<label for="default_locale" class="required">{{ __('admin::app.settings.channels.default-locale') }}</label>
|
||||
<select v-validate="'required'" class="control" id="default_locale" name="default_locale">
|
||||
@foreach(core()->allLocales() as $locale)
|
||||
<option value="{{ $locale->id }}" {{ old('default_locale') == $locale->id ? 'selected' : '' }}>
|
||||
{{ $locale->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<span class="control-error" v-if="errors.has('default_locale')">@{{ errors.first('default_locale') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('currencies[]') ? 'has-error' : '']">
|
||||
<label for="currencies" class="required">{{ __('admin::app.settings.channels.currencies') }}</label>
|
||||
<select v-validate="'required'" class="control" id="currencies" name="currencies[]" multiple>
|
||||
@foreach(core()->allCurrencies() as $currency)
|
||||
<option value="{{ $currency->id }}" {{ old('currencies') && in_array($currency->id, old('currencies')) ? 'selected' : '' }}>
|
||||
{{ $currency->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<span class="control-error" v-if="errors.has('currencies[]')">@{{ errors.first('currencies[]') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('base_currency') ? 'has-error' : '']">
|
||||
<label for="base_currency" class="required">{{ __('admin::app.settings.channels.base-currency') }}</label>
|
||||
<select v-validate="'required'" class="control" id="base_currency" name="base_currency">
|
||||
@foreach(core()->allCurrencies() as $currency)
|
||||
<option value="{{ $currency->id }}" {{ old('base_currency') == $currency->id ? 'selected' : '' }}>
|
||||
{{ $currency->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<span class="control-error" v-if="errors.has('base_currency')">@{{ errors.first('base_currency') }}</span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</accordian>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@stop
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
@extends('admin::layouts.content')
|
||||
|
||||
@section('content')
|
||||
<div class="content">
|
||||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
|
||||
</div>
|
||||
|
||||
<div class="page-action">
|
||||
<a href="{{ route('admin.channels.create') }}" class="btn btn-lg btn-primary">
|
||||
{{ __('admin::app.settings.channels.add-title') }}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="page-content">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@stop
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
@extends('admin::layouts.content')
|
||||
|
||||
@section('content')
|
||||
<div class="content">
|
||||
|
||||
<form method="POST" action="{{ route('admin.countries.store') }}" @submit.prevent="onSubmit">
|
||||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>{{ __('admin::app.settings.countries.add-title') }}</h1>
|
||||
</div>
|
||||
|
||||
<div class="page-action">
|
||||
<button type="submit" class="btn btn-lg btn-primary">
|
||||
{{ __('admin::app.settings.countries.save-btn-title') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="page-content">
|
||||
<div class="form-container">
|
||||
@csrf()
|
||||
|
||||
<accordian :title="'{{ __('admin::app.settings.countries.general') }}'" :active="true">
|
||||
<div slot="body">
|
||||
<div class="control-group" :class="[errors.has('code') ? 'has-error' : '']">
|
||||
<label for="code" class="required">{{ __('admin::app.settings.countries.code') }}</label>
|
||||
<input v-validate="'required'" class="control" id="code" name="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.settings.countries.name') }}</label>
|
||||
<input v-validate="'required'" class="control" id="name" name="name"/>
|
||||
<span class="control-error" v-if="errors.has('name')">@{{ errors.first('name') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</accordian>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@stop
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
@extends('admin::layouts.content')
|
||||
|
||||
@section('content')
|
||||
<div class="content">
|
||||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
|
||||
</div>
|
||||
|
||||
<div class="page-action">
|
||||
<a href="{{ route('admin.countries.create') }}" class="btn btn-lg btn-primary">
|
||||
{{ __('admin::app.settings.countries.add-title') }}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="page-content">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@stop
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
@extends('admin::layouts.content')
|
||||
|
||||
@section('content')
|
||||
<div class="content">
|
||||
|
||||
<form method="POST" action="{{ route('admin.currencies.store') }}" @submit.prevent="onSubmit">
|
||||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>{{ __('admin::app.settings.currencies.add-title') }}</h1>
|
||||
</div>
|
||||
|
||||
<div class="page-action">
|
||||
<button type="submit" class="btn btn-lg btn-primary">
|
||||
{{ __('admin::app.settings.currencies.save-btn-title') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="page-content">
|
||||
<div class="form-container">
|
||||
@csrf()
|
||||
|
||||
<accordian :title="'{{ __('admin::app.settings.currencies.general') }}'" :active="true">
|
||||
<div slot="body">
|
||||
<div class="control-group" :class="[errors.has('code') ? 'has-error' : '']">
|
||||
<label for="code" class="required">{{ __('admin::app.settings.currencies.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.settings.currencies.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('symbol') ? 'has-error' : '']">
|
||||
<label for="symbol" class="required">{{ __('admin::app.settings.currencies.symbol') }}</label>
|
||||
<input v-validate="'required'" class="control" id="symbol" name="symbol" value="{{ old('symbol') }}"/>
|
||||
<span class="control-error" v-if="errors.has('symbol')">@{{ errors.first('symbol') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</accordian>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@stop
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
@extends('admin::layouts.content')
|
||||
|
||||
@section('content')
|
||||
<div class="content">
|
||||
|
||||
<form method="POST" action="{{ route('admin.currencies.update', $currency->id) }}" @submit.prevent="onSubmit">
|
||||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>{{ __('admin::app.settings.currencies.edit-title') }}</h1>
|
||||
</div>
|
||||
|
||||
<div class="page-action">
|
||||
<button type="submit" class="btn btn-lg btn-primary">
|
||||
{{ __('admin::app.settings.currencies.save-btn-title') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="page-content">
|
||||
<div class="form-container">
|
||||
@csrf()
|
||||
<input name="_method" type="hidden" value="PUT">
|
||||
|
||||
<accordian :title="'{{ __('admin::app.settings.currencies.general') }}'" :active="true">
|
||||
<div slot="body">
|
||||
<div class="control-group" :class="[errors.has('code') ? 'has-error' : '']">
|
||||
<label for="code" class="required">{{ __('admin::app.settings.currencies.code') }}</label>
|
||||
<input v-validate="'required'" class="control" id="code" name="code" value="{{ old('code') ?: $currency->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.settings.currencies.name') }}</label>
|
||||
<input v-validate="'required'" class="control" id="name" name="name" value="{{ old('name') ?: $currency->name }}"/>
|
||||
<span class="control-error" v-if="errors.has('name')">@{{ errors.first('name') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('symbol') ? 'has-error' : '']">
|
||||
<label for="symbol" class="required">{{ __('admin::app.settings.currencies.symbol') }}</label>
|
||||
<input v-validate="'required'" class="control" id="symbol" name="symbol" value="{{ old('symbol') ?: $currency->symbol }}"/>
|
||||
<span class="control-error" v-if="errors.has('symbol')">@{{ errors.first('symbol') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</accordian>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@stop
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
@extends('admin::layouts.content')
|
||||
|
||||
@section('content')
|
||||
<div class="content">
|
||||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
|
||||
</div>
|
||||
|
||||
<div class="page-action">
|
||||
<a href="{{ route('admin.currencies.create') }}" class="btn btn-lg btn-primary">
|
||||
{{ __('admin::app.settings.currencies.add-title') }}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="page-content">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@stop
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
@extends('admin::layouts.content')
|
||||
|
||||
@section('page_title')
|
||||
{{ __('admin::app.settings.exchange_rates.add-title') }}
|
||||
@stop
|
||||
|
||||
@section('content')
|
||||
<div class="content">
|
||||
|
||||
<form method="POST" action="{{ route('admin.exchange_rates.store') }}" @submit.prevent="onSubmit">
|
||||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>{{ __('admin::app.settings.exchange_rates.add-title') }}</h1>
|
||||
</div>
|
||||
|
||||
<div class="page-action">
|
||||
<button type="submit" class="btn btn-lg btn-primary">
|
||||
{{ __('admin::app.settings.exchange_rates.save-btn-title') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="page-content">
|
||||
<div class="form-container">
|
||||
@csrf()
|
||||
|
||||
<accordian :title="'{{ __('admin::app.settings.exchange_rates.general') }}'" :active="true">
|
||||
<div slot="body">
|
||||
<div class="control-group" :class="[errors.has('source_currency') ? 'has-error' : '']">
|
||||
<label for="source_currency" class="required">{{ __('admin::app.settings.exchange_rates.source_currency') }}</label>
|
||||
<select v-validate="'required'" class="control" name="source_currency">
|
||||
@foreach($currencies as $currency)
|
||||
<option value="{{ $currency->id }}">{{ $currency->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<span class="control-error" v-if="errors.has('source_currency')">@{{ errors.first('source_currency') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('target_currency') ? 'has-error' : '']">
|
||||
<label for="target_currency" class="required">{{ __('admin::app.settings.exchange_rates.target_currency') }}</label>
|
||||
<select v-validate="'required'" class="control" name="target_currency">
|
||||
@foreach($currencies as $currency)
|
||||
<option value="{{ $currency->id }}">{{ $currency->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<span class="control-error" v-if="errors.has('target_currency')">@{{ errors.first('target_currency') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('ratio') ? 'has-error' : '']">
|
||||
<label for="ratio" class="required">{{ __('admin::app.settings.exchange_rates.ratio') }}</label>
|
||||
<input v-validate="'required'" class="control" id="ratio" name="ratio" value="{{ old('ratio') }}"/>
|
||||
<span class="control-error" v-if="errors.has('ratio')">@{{ errors.first('ratio') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</accordian>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@stop
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
@extends('admin::layouts.content')
|
||||
|
||||
@section('page_title')
|
||||
{{ __('admin::app.settings.exchange_rates.edit-title') }}
|
||||
@stop
|
||||
|
||||
@section('content')
|
||||
<div class="content">
|
||||
|
||||
<form method="POST" action="{{ route('admin.exchange_rates.update', $exchangeRate->id) }}" @submit.prevent="onSubmit">
|
||||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>{{ __('admin::app.settings.exchange_rates.edit-title') }}</h1>
|
||||
</div>
|
||||
|
||||
<div class="page-action">
|
||||
<button type="submit" class="btn btn-lg btn-primary">
|
||||
{{ __('admin::app.settings.exchange_rates.save-btn-title') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="page-content">
|
||||
<div class="form-container">
|
||||
@csrf()
|
||||
<input name="_method" type="hidden" value="PUT">
|
||||
|
||||
<accordian :title="'{{ __('admin::app.settings.exchange_rates.general') }}'" :active="true">
|
||||
<div slot="body">
|
||||
<div class="control-group" :class="[errors.has('source_currency') ? 'has-error' : '']">
|
||||
<label for="source_currency" class="required">{{ __('admin::app.settings.exchange_rates.source_currency') }}</label>
|
||||
<select v-validate="'required'" class="control" name="source_currency">
|
||||
@foreach($currencies as $currency)
|
||||
<option value="{{ $currency->id }}" {{ $exchangeRate->source_currency == $currency->id ? 'selected' : '' }}>
|
||||
{{ $currency->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<span class="control-error" v-if="errors.has('source_currency')">@{{ errors.first('source_currency') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('target_currency') ? 'has-error' : '']">
|
||||
<label for="target_currency" class="required">{{ __('admin::app.settings.exchange_rates.target_currency') }}</label>
|
||||
<select v-validate="'required'" class="control" name="target_currency">
|
||||
@foreach($currencies as $currency)
|
||||
<option value="{{ $currency->id }}" {{ $exchangeRate->target_currency == $currency->id ? 'selected' : '' }}>
|
||||
{{ $currency->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<span class="control-error" v-if="errors.has('target_currency')">@{{ errors.first('target_currency') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('ratio') ? 'has-error' : '']">
|
||||
<label for="ratio" class="required">{{ __('admin::app.settings.exchange_rates.ratio') }}</label>
|
||||
<input v-validate="'required'" class="control" id="ratio" name="ratio" value="{{ old('ratio') ?: $exchangeRate->ratio }}"/>
|
||||
<span class="control-error" v-if="errors.has('ratio')">@{{ errors.first('ratio') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</accordian>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@stop
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
@extends('admin::layouts.content')
|
||||
|
||||
@section('page_title')
|
||||
{{ __('admin::app.settings.exchange_rates.title') }}
|
||||
@stop
|
||||
|
||||
@section('content')
|
||||
<div class="content">
|
||||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
|
||||
</div>
|
||||
|
||||
<div class="page-action">
|
||||
<a href="{{ route('admin.exchange_rates.create') }}" class="btn btn-lg btn-primary">
|
||||
{{ __('admin::app.settings.exchange_rates.add-title') }}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="page-content">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@stop
|
||||
|
|
@ -0,0 +1,141 @@
|
|||
@extends('admin::layouts.content')
|
||||
|
||||
@section('page_title')
|
||||
{{ __('admin::app.settings.inventory_sources.add-title') }}
|
||||
@stop
|
||||
|
||||
@section('content')
|
||||
<div class="content">
|
||||
|
||||
<form method="POST" action="{{ route('admin.inventory_sources.store') }}" @submit.prevent="onSubmit">
|
||||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>{{ __('admin::app.settings.inventory_sources.add-title') }}</h1>
|
||||
</div>
|
||||
|
||||
<div class="page-action">
|
||||
<button type="submit" class="btn btn-lg btn-primary">
|
||||
{{ __('admin::app.settings.inventory_sources.save-btn-title') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="page-content">
|
||||
<div class="form-container">
|
||||
@csrf()
|
||||
|
||||
<accordian :title="'{{ __('admin::app.settings.inventory_sources.general') }}'" :active="true">
|
||||
<div slot="body">
|
||||
|
||||
<div class="control-group" :class="[errors.has('code') ? 'has-error' : '']">
|
||||
<label for="code" class="required">{{ __('admin::app.settings.inventory_sources.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.settings.inventory_sources.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">
|
||||
<label for="description">{{ __('admin::app.settings.inventory_sources.description') }}</label>
|
||||
<textarea class="control" id="description" name="description">{{ old('description') }}</textarea>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label for="latitude">{{ __('admin::app.settings.inventory_sources.latitude') }}</label>
|
||||
<input class="control" id="latitude" name="latitude" value="{{ old('latitude') }}"/>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label for="longitude">{{ __('admin::app.settings.inventory_sources.longitude') }}</label>
|
||||
<input class="control" id="longitude" name="longitude" value="{{ old('longitude') }}"/>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label for="priority">{{ __('admin::app.settings.inventory_sources.priority') }}</label>
|
||||
<input class="control" id="priority" name="priority" value="{{ old('priority') }}"/>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label for="status">{{ __('admin::app.settings.inventory_sources.status') }}</label>
|
||||
<span class="checkbox">
|
||||
<input type="checkbox" id="status" name="status" value="1">
|
||||
<label class="checkbox-view" for="status"></label>
|
||||
{{ __('admin::app.settings.inventory_sources.source-is-active') }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</accordian>
|
||||
|
||||
<accordian :title="'{{ __('admin::app.settings.inventory_sources.contact-info') }}'" :active="true">
|
||||
<div slot="body">
|
||||
|
||||
<div class="control-group">
|
||||
<label for="contact_name">{{ __('admin::app.settings.inventory_sources.contact_name') }}</label>
|
||||
<input class="control" id="contact_name" name="contact_name" value="{{ old('contact_name') }}"/>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label for="contact_email">{{ __('admin::app.settings.inventory_sources.contact_email') }}</label>
|
||||
<input class="control" id="contact_email" name="contact_email" value="{{ old('contact_email') }}"/>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label for="contact_number">{{ __('admin::app.settings.inventory_sources.contact_number') }}</label>
|
||||
<input class="control" id="contact_number" name="contact_number" value="{{ old('contact_number') }}"/>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label for="contact_fax">{{ __('admin::app.settings.inventory_sources.contact_fax') }}</label>
|
||||
<input class="control" id="country" name="contact_fax" value="{{ old('contact_fax') }}"/>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</accordian>
|
||||
|
||||
<accordian :title="'{{ __('admin::app.settings.inventory_sources.address') }}'" :active="true">
|
||||
<div slot="body">
|
||||
|
||||
<div class="control-group">
|
||||
<label for="country">{{ __('admin::app.settings.inventory_sources.country') }}</label>
|
||||
<select class="control" id="country" name="country">
|
||||
@foreach(country()->all() as $countryCoode => $countryName)
|
||||
<option value="{{ $countryCoode }}" {{ old('country') == $countryCoode ? 'selected' : '' }}>
|
||||
{{ $countryName }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label for="state">{{ __('admin::app.settings.inventory_sources.state') }}</label>
|
||||
<input class="control" id="state" name="state" value="{{ old('state') }}"/>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label for="city">{{ __('admin::app.settings.inventory_sources.city') }}</label>
|
||||
<input class="control" id="city" name="city" value="{{ old('city') }}"/>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label for="street">{{ __('admin::app.settings.inventory_sources.street') }}</label>
|
||||
<input class="control" id="street" name="street" value="{{ old('street') }}"/>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label for="postcode">{{ __('admin::app.settings.inventory_sources.postcode') }}</label>
|
||||
<input class="control" id="postcode" name="postcode" value="{{ old('postcode') }}"/>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</accordian>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@stop
|
||||
|
|
@ -0,0 +1,143 @@
|
|||
@extends('admin::layouts.content')
|
||||
|
||||
@section('page_title')
|
||||
{{ __('admin::app.settings.inventory_sources.edit-title') }}
|
||||
@stop
|
||||
|
||||
@section('content')
|
||||
<div class="content">
|
||||
|
||||
<form method="POST" action="{{ route('admin.inventory_sources.update', $inventorySource->id) }}" @submit.prevent="onSubmit">
|
||||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>{{ __('admin::app.settings.inventory_sources.edit-title') }}</h1>
|
||||
</div>
|
||||
|
||||
<div class="page-action">
|
||||
<button type="submit" class="btn btn-lg btn-primary">
|
||||
{{ __('admin::app.settings.inventory_sources.save-btn-title') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="page-content">
|
||||
<div class="form-container">
|
||||
@csrf()
|
||||
<input name="_method" type="hidden" value="PUT">
|
||||
|
||||
<accordian :title="'{{ __('admin::app.settings.inventory_sources.general') }}'" :active="true">
|
||||
<div slot="body">
|
||||
|
||||
<div class="control-group" :class="[errors.has('code') ? 'has-error' : '']">
|
||||
<label for="code" class="required">{{ __('admin::app.settings.inventory_sources.code') }}</label>
|
||||
<input v-validate="'required'" class="control" id="code" name="code" value="{{ old('code') ?: $inventorySource->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.settings.inventory_sources.name') }}</label>
|
||||
<input v-validate="'required'" class="control" id="name" name="name" value="{{ old('name') ?: $inventorySource->name }}"/>
|
||||
<span class="control-error" v-if="errors.has('name')">@{{ errors.first('name') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label for="description">{{ __('admin::app.settings.inventory_sources.description') }}</label>
|
||||
<textarea class="control" id="description" name="description">{{ old('description') ?: $inventorySource->description }}</textarea>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label for="latitude">{{ __('admin::app.settings.inventory_sources.latitude') }}</label>
|
||||
<input class="control" id="latitude" name="latitude" value="{{ old('latitude') ?: $inventorySource->latitude }}"/>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label for="longitude">{{ __('admin::app.settings.inventory_sources.longitude') }}</label>
|
||||
<input class="control" id="longitude" name="longitude" value="{{ old('longitude') ?: $inventorySource->longitude }}"/>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label for="priority">{{ __('admin::app.settings.inventory_sources.priority') }}</label>
|
||||
<input class="control" id="priority" name="priority" value="{{ old('priority') ?: $inventorySource->priority }}"/>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label for="status">{{ __('admin::app.settings.inventory_sources.status') }}</label>
|
||||
<span class="checkbox">
|
||||
<input type="checkbox" id="status" name="status" value="{{ $inventorySource->status }}" {{ $inventorySource->status ? 'checked' : '' }}>
|
||||
<label class="checkbox-view" for="status"></label>
|
||||
{{ __('admin::app.settings.inventory_sources.source-is-active') }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</accordian>
|
||||
|
||||
<accordian :title="'{{ __('admin::app.settings.inventory_sources.contact-info') }}'" :active="true">
|
||||
<div slot="body">
|
||||
|
||||
<div class="control-group">
|
||||
<label for="contact_name">{{ __('admin::app.settings.inventory_sources.contact_name') }}</label>
|
||||
<input class="control" id="contact_name" name="contact_name" value="{{ old('contact_name') ?: $inventorySource->contact_name }}"/>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label for="contact_email">{{ __('admin::app.settings.inventory_sources.contact_email') }}</label>
|
||||
<input class="control" id="contact_email" name="contact_email" value="{{ old('contact_email') ?: $inventorySource->symbol }}"/>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label for="contact_number">{{ __('admin::app.settings.inventory_sources.contact_number') }}</label>
|
||||
<input class="control" id="contact_number" name="contact_number" value="{{ old('contact_number') ?: $inventorySource->contact_number }}"/>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label for="contact_fax">{{ __('admin::app.settings.inventory_sources.contact_fax') }}</label>
|
||||
<input class="control" id="country" name="contact_fax" value="{{ old('contact_fax') ?: $inventorySource->contact_fax }}"/>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</accordian>
|
||||
|
||||
<accordian :title="'{{ __('admin::app.settings.inventory_sources.address') }}'" :active="true">
|
||||
<div slot="body">
|
||||
|
||||
<div class="control-group">
|
||||
<?php $selectedCountry = old('country') ?: $inventorySource->country ?>
|
||||
<label for="country">{{ __('admin::app.settings.inventory_sources.country') }}</label>
|
||||
<select class="control" id="country" name="country">
|
||||
@foreach(country()->all() as $countryCoode => $countryName)
|
||||
<option value="{{ $countryCoode }}" {{ $selectedCountry == $countryCoode ? 'selected' : '' }}>
|
||||
{{ $countryName }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label for="state">{{ __('admin::app.settings.inventory_sources.state') }}</label>
|
||||
<input class="control" id="state" name="state" value="{{ old('state') ?: $inventorySource->state }}"/>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label for="city">{{ __('admin::app.settings.inventory_sources.city') }}</label>
|
||||
<input class="control" id="city" name="city" value="{{ old('city') ?: $inventorySource->city }}"/>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label for="street">{{ __('admin::app.settings.inventory_sources.street') }}</label>
|
||||
<input class="control" id="street" name="street" value="{{ old('street') ?: $inventorySource->street }}"/>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label for="postcode">{{ __('admin::app.settings.inventory_sources.postcode') }}</label>
|
||||
<input class="control" id="postcode" name="postcode" value="{{ old('postcode') ?: $inventorySource->postcode }}"/>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</accordian>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@stop
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
@extends('admin::layouts.content')
|
||||
|
||||
@section('page_title')
|
||||
{{ __('admin::app.settings.inventory_sources.title') }}
|
||||
@stop
|
||||
|
||||
@section('content')
|
||||
<div class="content">
|
||||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
|
||||
</div>
|
||||
|
||||
<div class="page-action">
|
||||
<a href="{{ route('admin.inventory_sources.create') }}" class="btn btn-lg btn-primary">
|
||||
{{ __('admin::app.settings.inventory_sources.add-title') }}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="page-content">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@stop
|
||||
|
|
@ -1,17 +1,21 @@
|
|||
@extends('admin::layouts.content')
|
||||
|
||||
@section('page_title')
|
||||
{{ __('admin::app.settings.locales.add-locale-title') }}
|
||||
@stop
|
||||
|
||||
@section('content')
|
||||
<div class="content">
|
||||
|
||||
<form method="POST" action="{{ route('admin.locales.store') }}" @submit.prevent="onSubmit">
|
||||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>{{ __('Add Locale') }}</h1>
|
||||
<h1>{{ __('admin::app.settings.locales.add-title') }}</h1>
|
||||
</div>
|
||||
|
||||
<div class="page-action">
|
||||
<button type="submit" class="btn btn-lg btn-primary">
|
||||
{{ __('Save Locale') }}
|
||||
{{ __('admin::app.settings.locales.save-btn-title') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -20,16 +24,16 @@
|
|||
<div class="form-container">
|
||||
@csrf()
|
||||
|
||||
<accordian :title="'{{ __('General') }}'" :active="true">
|
||||
<accordian :title="'{{ __('admin::app.settings.locales.general') }}'" :active="true">
|
||||
<div slot="body">
|
||||
<div class="control-group" :class="[errors.has('code') ? 'has-error' : '']">
|
||||
<label for="code">{{ __('Code') }}</label>
|
||||
<label for="code">{{ __('admin::app.settings.locales.code') }}</label>
|
||||
<input v-validate="'required'" class="control" id="code" name="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">{{ __('Name') }}</label>
|
||||
<label for="name">{{ __('admin::app.settings.locales.name') }}</label>
|
||||
<input v-validate="'required'" class="control" id="name" name="name"/>
|
||||
<span class="control-error" v-if="errors.has('name')">@{{ errors.first('name') }}</span>
|
||||
</div>
|
||||
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
<div class="page-action">
|
||||
<a href="{{ route('admin.locales.create') }}" class="btn btn-lg btn-primary">
|
||||
{{ __('Add Locale') }}
|
||||
{{ __('admin::app.settings.locales.add-title') }}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
@extends('admin::layouts.anonymous-master')
|
||||
|
||||
@section('page_title')
|
||||
{{ __('Forget Password') }}
|
||||
{{ __('admin::app.users.forget-password.title') }}
|
||||
@stop
|
||||
|
||||
@section('css')
|
||||
|
|
@ -23,25 +23,25 @@
|
|||
|
||||
<div class="form-container" style="text-align: left">
|
||||
|
||||
<h1>{{ __('Recover Password') }}</h1>
|
||||
<h1>{{ __('admin::app.users.forget-password.header-title') }}</h1>
|
||||
|
||||
<form method="POST" action="{{ route('admin.forget-password.store') }}" @submit.prevent="onSubmit">
|
||||
@csrf
|
||||
|
||||
<div class="control-group" :class="[errors.has('email') ? 'has-error' : '']">
|
||||
<label for="email">{{ __('Registered Email') }}</label>
|
||||
<label for="email">{{ __('admin::app.users.forget-password.email') }}</label>
|
||||
<input type="text" v-validate="'required'" class="control" id="email" name="email" value="{{ old('email') }}"/>
|
||||
<span class="control-error" v-if="errors.has('email')">@{{ errors.first('email') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="button-group">
|
||||
<button class="btn btn-xl btn-primary">{{ __('Email Password Reset Link') }}</button>
|
||||
<button class="btn btn-xl btn-primary">{{ __('admin::app.users.forget-password.submit-btn-title') }}</button>
|
||||
</div>
|
||||
|
||||
<div class="control-group" style="margin-bottom: 0">
|
||||
<a href="{{ route('admin.session.create') }}">
|
||||
<i class="icon primary-back-icon"></i>
|
||||
{{ __('Back to Sign In') }}
|
||||
{{ __('admin::app.users.forget-password.back-link-title') }}
|
||||
</a>
|
||||
</div>
|
||||
</form>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
@extends('admin::layouts.anonymous-master')
|
||||
|
||||
@section('page_title')
|
||||
{{ __('Reset Password') }}
|
||||
{{ __('admin::app.users.reset-password.title') }}
|
||||
@stop
|
||||
|
||||
@section('css')
|
||||
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
<div class="form-container" style="text-align: left">
|
||||
|
||||
<h1>{{ __('Reset Password') }}</h1>
|
||||
<h1>{{ __('admin::app.users.reset-password.title') }}</h1>
|
||||
|
||||
<form method="POST" action="{{ route('admin.reset-password.store') }}" @submit.prevent="onSubmit">
|
||||
@csrf
|
||||
|
|
@ -31,31 +31,31 @@
|
|||
<input type="hidden" name="token" value="{{ $token }}">
|
||||
|
||||
<div class="control-group" :class="[errors.has('email') ? 'has-error' : '']">
|
||||
<label for="email">{{ __('Email') }}</label>
|
||||
<label for="email">{{ __('admin::app.users.reset-password.email') }}</label>
|
||||
<input type="text" v-validate="'required|email'" class="control" id="email" name="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">{{ __('Password') }}</label>
|
||||
<label for="password">{{ __('admin::app.users.reset-password.password') }}</label>
|
||||
<input type="password" v-validate="'required|min:6'" class="control" id="password" name="password"/>
|
||||
<span class="control-error" v-if="errors.has('password')">@{{ errors.first('password') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('password_confirmation') ? 'has-error' : '']">
|
||||
<label for="password_confirmation">{{ __('Confirm Password') }}</label>
|
||||
<label for="password_confirmation">{{ __('admin::app.users.reset-password.confirm-password') }}</label>
|
||||
<input type="password" v-validate="'required|min:6|confirmed:password'" class="control" id="password_confirmation" name="password_confirmation" data-vv-as="password"/>
|
||||
<span class="control-error" v-if="errors.has('password_confirmation')">@{{ errors.first('password_confirmation') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="button-group">
|
||||
<button type="submit" class="btn btn-xl btn-primary">{{ __('Reset Password') }}</button>
|
||||
<button type="submit" class="btn btn-xl btn-primary">{{ __('admin::app.users.reset-password.submit-btn-title') }}</button>
|
||||
</div>
|
||||
|
||||
<div class="control-group" style="margin-bottom: 0">
|
||||
<a href="{{ route('admin.session.create') }}">
|
||||
<i class="icon primary-back-icon"></i>
|
||||
{{ __('Back to Sign In') }}
|
||||
{{ __('admin::app.users.reset-password.back-link-title') }}
|
||||
</a>
|
||||
</div>
|
||||
</form>
|
||||
|
|
|
|||
|
|
@ -1,17 +1,21 @@
|
|||
@extends('admin::layouts.content')
|
||||
|
||||
@section('page_title')
|
||||
{{ __('admin::app.users.roles.add-role-title') }}
|
||||
@stop
|
||||
|
||||
@section('content')
|
||||
<div class="content">
|
||||
|
||||
<form method="POST" action="{{ route('admin.roles.store') }}" @submit.prevent="onSubmit">
|
||||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>{{ __('Add Role') }}</h1>
|
||||
<h1>{{ __('admin::app.users.roles.add-role-title') }}</h1>
|
||||
</div>
|
||||
|
||||
<div class="page-action">
|
||||
<button type="submit" class="btn btn-lg btn-primary">
|
||||
{{ __('Save Role') }}
|
||||
{{ __('admin::app.users.roles.save-btn-title') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -20,28 +24,28 @@
|
|||
<div class="form-container">
|
||||
@csrf()
|
||||
|
||||
<accordian :title="'{{ __('General') }}'" :active="true">
|
||||
<accordian :title="'{{ __('admin::app.users.roles.general') }}'" :active="true">
|
||||
<div slot="body">
|
||||
<div class="control-group" :class="[errors.has('name') ? 'has-error' : '']">
|
||||
<label for="name">{{ __('Name') }}</label>
|
||||
<label for="name" class="required">{{ __('admin::app.users.roles.name') }}</label>
|
||||
<input type="text" v-validate="'required'" class="control" id="email" name="name"/>
|
||||
<span class="control-error" v-if="errors.has('name')">@{{ errors.first('name') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label for="description">{{ __('Description') }}</label>
|
||||
<label for="description">{{ __('admin::app.users.roles.description') }}</label>
|
||||
<textarea class="control" id="description" name="description"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</accordian>
|
||||
|
||||
<accordian :title="'{{ __('Access Control') }}'" :active="true">
|
||||
<accordian :title="'{{ __('admin::app.users.roles.access-control') }}'" :active="true">
|
||||
<div slot="body">
|
||||
<div class="control-group">
|
||||
<label for="permission_type">{{ __('Permissions') }}</label>
|
||||
<label for="permission_type">{{ __('admin::app.users.roles.permissions') }}</label>
|
||||
<select class="control" name="permission_type" id="permission_type">
|
||||
<option value="custom">{{ __('Custom') }}</option>
|
||||
<option value="all">{{ __('All') }}</option>
|
||||
<option value="custom">{{ __('admin::app.users.roles.custom') }}</option>
|
||||
<option value="all">{{ __('admin::app.users.roles.all') }}</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,17 +1,21 @@
|
|||
@extends('admin::layouts.content')
|
||||
|
||||
@section('page_title')
|
||||
{{ __('admin::app.users.roles.edit-role-title') }}
|
||||
@stop
|
||||
|
||||
@section('content')
|
||||
<div class="content">
|
||||
|
||||
<form method="POST" action="{{ route('admin.roles.update', $role->id) }}" @submit.prevent="onSubmit">
|
||||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>{{ __('Edit Role') }}</h1>
|
||||
<h1>{{ __('admin::app.users.roles.edit-role-title') }}</h1>
|
||||
</div>
|
||||
|
||||
<div class="page-action">
|
||||
<button type="submit" class="btn btn-lg btn-primary">
|
||||
{{ __('Save Role') }}
|
||||
{{ __('admin::app.users.roles.save-btn-title') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -22,28 +26,28 @@
|
|||
|
||||
<input name="_method" type="hidden" value="PUT">
|
||||
|
||||
<accordian :title="'{{ __('General') }}'" :active="true">
|
||||
<accordian :title="'{{ __('admin::app.users.roles.general') }}'" :active="true">
|
||||
<div slot="body">
|
||||
<div class="control-group" :class="[errors.has('name') ? 'has-error' : '']">
|
||||
<label for="name">{{ __('Name') }}</label>
|
||||
<label for="name" class="required">{{ __('admin::app.users.roles.name') }}</label>
|
||||
<input type="text" v-validate="'required'" class="control" id="email" name="name" value="{{ $role->name }}"/>
|
||||
<span class="control-error" v-if="errors.has('name')">@{{ errors.first('name') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label for="description">{{ __('Description') }}</label>
|
||||
<label for="description">{{ __('admin::app.users.roles.description') }}</label>
|
||||
<textarea class="control" id="description" name="description">{{ $role->description }}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
</accordian>
|
||||
|
||||
<accordian :title="'{{ __('Access Control') }}'" :active="true">
|
||||
<accordian :title="'{{ __('admin::app.users.roles.access-control') }}'" :active="true">
|
||||
<div slot="body">
|
||||
<div class="control-group">
|
||||
<label for="permission_type">{{ __('Permissions') }}</label>
|
||||
<label for="permission_type">{{ __('admin::app.users.roles.permissions') }}</label>
|
||||
<select class="control" name="permission_type" id="permission_type">
|
||||
<option value="custom" {{ $role->permission_type == 'custom' ? 'selected' : '' }}>{{ __('Custom') }}</option>
|
||||
<option value="all" {{ $role->permission_type == 'all' ? 'selected' : '' }}>{{ __('All') }}</option>
|
||||
<option value="custom" {{ $role->permission_type == 'custom' ? 'selected' : '' }}>{{ __('admin::app.users.roles.custom') }}</option>
|
||||
<option value="all" {{ $role->permission_type == 'all' ? 'selected' : '' }}>{{ __('admin::app.users.roles.all') }}</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
@extends('admin::layouts.anonymous-master')
|
||||
|
||||
@section('page_title')
|
||||
{{ __('Sign In') }}
|
||||
{{ __('admin::app.users.sessions.title') }}
|
||||
@stop
|
||||
|
||||
@section('content')
|
||||
|
|
@ -12,37 +12,37 @@
|
|||
|
||||
<div class="form-container" style="text-align: left">
|
||||
|
||||
<h1>{{ __('Sign In') }}</h1>
|
||||
<h1>{{ __('admin::app.users.sessions.title') }}</h1>
|
||||
|
||||
<form method="POST" action="login" @submit.prevent="onSubmit">
|
||||
@csrf
|
||||
|
||||
<div class="control-group" :class="[errors.has('email') ? 'has-error' : '']">
|
||||
<label for="email">{{ __('Email') }}</label>
|
||||
<label for="email">{{ __('admin::app.users.sessions.email') }}</label>
|
||||
<input type="text" v-validate="'required'" class="control" id="email" name="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">{{ __('Password') }}</label>
|
||||
<label for="password">{{ __('admin::app.users.sessions.password') }}</label>
|
||||
<input type="password" v-validate="'required|min:6'" class="control" id="password" name="password"/>
|
||||
<span class="control-error" v-if="errors.has('password')">@{{ errors.first('password') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<a href="{{ route('admin.forget-password.create') }}">{{ __('Forget Password ?') }}</a>
|
||||
<a href="{{ route('admin.forget-password.create') }}">{{ __('admin::app.users.sessions.forget-password-link-title') }}</a>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<span class="checkbox">
|
||||
<input type="checkbox" id="remember" name="remember" value="1">
|
||||
<label class="checkbox-view" for="remember"></label>
|
||||
{{ __('Remember me') }}
|
||||
{{ __('admin::app.users.sessions.remember-me') }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="button-group">
|
||||
<button class="btn btn-xl btn-primary">{{ __('Sign In') }}</button>
|
||||
<button class="btn btn-xl btn-primary">{{ __('admin::app.users.sessions.submit-btn-title') }}</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,16 +1,20 @@
|
|||
@extends('admin::layouts.content')
|
||||
|
||||
@section('page_title')
|
||||
{{ __('admin::app.users.users.add-user-title') }}
|
||||
@stop
|
||||
|
||||
@section('content')
|
||||
<div class="content">
|
||||
<form method="POST" action="{{ route('admin.users.store') }}" @submit.prevent="onSubmit">
|
||||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>{{ __('Add User') }}</h1>
|
||||
<h1>{{ __('admin::app.users.users.add-user-title') }}</h1>
|
||||
</div>
|
||||
|
||||
<div class="page-action">
|
||||
<button type="submit" class="btn btn-lg btn-primary">
|
||||
{{ __('Save User') }}
|
||||
{{ __('admin::app.users.users.save-btn-title') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -19,16 +23,16 @@
|
|||
<div class="form-container">
|
||||
@csrf()
|
||||
|
||||
<accordian :title="'{{ __('General') }}'" :active="true">
|
||||
<accordian :title="'{{ __('admin::app.users.users.general') }}'" :active="true">
|
||||
<div slot="body">
|
||||
<div class="control-group" :class="[errors.has('name') ? 'has-error' : '']">
|
||||
<label for="name">{{ __('Name') }}</label>
|
||||
<label for="name" class="required">{{ __('admin::app.users.users.name') }}</label>
|
||||
<input type="text" v-validate="'required'" class="control" id="email" name="name"/>
|
||||
<span class="control-error" v-if="errors.has('name')">@{{ errors.first('name') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('email') ? 'has-error' : '']">
|
||||
<label for="email">{{ __('Email') }}</label>
|
||||
<label for="email">{{ __('admin::app.users.users.email') }}</label>
|
||||
<input type="text" v-validate="'required|email'" class="control" id="email" name="email"/>
|
||||
<span class="control-error" v-if="errors.has('email')">@{{ errors.first('email') }}</span>
|
||||
</div>
|
||||
|
|
@ -38,23 +42,23 @@
|
|||
<accordian :title="'{{ __('Password') }}'" :active="true">
|
||||
<div slot="body">
|
||||
<div class="control-group" :class="[errors.has('password') ? 'has-error' : '']">
|
||||
<label for="password">{{ __('Password') }}</label>
|
||||
<label for="password">{{ __('admin::app.users.users.password') }}</label>
|
||||
<input type="password" v-validate="'min:6|max:18'" class="control" id="password" name="password"/>
|
||||
<span class="control-error" v-if="errors.has('password')">@{{ errors.first('password') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('password_confirmation') ? 'has-error' : '']">
|
||||
<label for="password_confirmation">{{ __('Confirm Password') }}</label>
|
||||
<label for="password_confirmation">{{ __('admin::app.users.users.confirm-password') }}</label>
|
||||
<input type="password" v-validate="'min:6|max:18|confirmed:password'" class="control" id="password_confirmation" name="password_confirmation"/>
|
||||
<span class="control-error" v-if="errors.has('password_confirmation')">@{{ errors.first('password_confirmation') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</accordian>
|
||||
|
||||
<accordian :title="'{{ __('Status and Role') }}'" :active="true">
|
||||
<accordian :title="'{{ __('admin::app.users.users.status-and-role') }}'" :active="true">
|
||||
<div slot="body">
|
||||
<div class="control-group" :class="[errors.has('role_id') ? 'has-error' : '']">
|
||||
<label for="role">{{ __('Role') }}</label>
|
||||
<label for="role" class="required">{{ __('admin::app.users.users.role') }}</label>
|
||||
<select v-validate="'required'" class="control" name="role_id">
|
||||
@foreach($roles as $role)
|
||||
<option value="{{ $role->id }}">{{ $role->name }}</option>
|
||||
|
|
@ -64,11 +68,11 @@
|
|||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label for="status">{{ __('Status') }}</label>
|
||||
<label for="status">{{ __('admin::app.users.users.status') }}</label>
|
||||
<span class="checkbox">
|
||||
<input type="checkbox" id="status" name="status" value="1">
|
||||
<label class="checkbox-view" for="status"></label>
|
||||
{{ __('Account is Active') }}
|
||||
{{ __('admin::app.users.users.account-is-active') }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,16 +1,21 @@
|
|||
@extends('admin::layouts.content')
|
||||
|
||||
@section('page_title')
|
||||
{{ __('admin::app.users.users.edit-user-title') }}
|
||||
@stop
|
||||
|
||||
|
||||
@section('content')
|
||||
<div class="content">
|
||||
<form method="POST" action="{{ route('admin.users.update', $user->id) }}" @submit.prevent="onSubmit">
|
||||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>{{ __('Edit User') }}</h1>
|
||||
<h1>{{ __('admin::app.users.users.edit-user-title') }}</h1>
|
||||
</div>
|
||||
|
||||
<div class="page-action">
|
||||
<button type="submit" class="btn btn-lg btn-primary">
|
||||
{{ __('Save User') }}
|
||||
{{ __('admin::app.users.users.save-btn-title') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -20,42 +25,42 @@
|
|||
@csrf()
|
||||
<input name="_method" type="hidden" value="PUT">
|
||||
|
||||
<accordian :title="'{{ __('General') }}'" :active="true">
|
||||
<accordian :title="'{{ __('admin::app.users.users.general') }}'" :active="true">
|
||||
<div slot="body">
|
||||
<div class="control-group" :class="[errors.has('name') ? 'has-error' : '']">
|
||||
<label for="name">{{ __('Name') }}</label>
|
||||
<label for="name" class="required">{{ __('admin::app.users.users.name') }}</label>
|
||||
<input type="text" v-validate="'required'" class="control" id="email" name="name" value="{{ $user->name }}"/>
|
||||
<span class="control-error" v-if="errors.has('name')">@{{ errors.first('name') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('email') ? 'has-error' : '']">
|
||||
<label for="email">{{ __('Email') }}</label>
|
||||
<label for="email">{{ __('admin::app.users.users.email') }}</label>
|
||||
<input type="text" v-validate="'required|email'" class="control" id="email" name="email" value="{{ $user->email }}"/>
|
||||
<span class="control-error" v-if="errors.has('email')">@{{ errors.first('email') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</accordian>
|
||||
|
||||
<accordian :title="'{{ __('Password') }}'" :active="true">
|
||||
<accordian :title="'{{ __('admin::app.users.users.password') }}'" :active="true">
|
||||
<div slot="body">
|
||||
<div class="control-group" :class="[errors.has('password') ? 'has-error' : '']">
|
||||
<label for="password">{{ __('Password') }}</label>
|
||||
<label for="password">{{ __('admin::app.users.users.password') }}</label>
|
||||
<input type="password" v-validate="'min:6|max:18'" class="control" id="password" name="password"/>
|
||||
<span class="control-error" v-if="errors.has('password')">@{{ errors.first('password') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('password_confirmation') ? 'has-error' : '']">
|
||||
<label for="password_confirmation">{{ __('Confirm Password') }}</label>
|
||||
<label for="password_confirmation">{{ __('admin::app.users.users.confirm-password') }}</label>
|
||||
<input type="password" v-validate="'min:6|max:18|confirmed:password'" class="control" id="password_confirmation" name="password_confirmation"/>
|
||||
<span class="control-error" v-if="errors.has('password_confirmation')">@{{ errors.first('password_confirmation') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</accordian>
|
||||
|
||||
<accordian :title="'{{ __('Status and Role') }}'" :active="true">
|
||||
<accordian :title="'{{ __('admin::app.users.users.status-and-role') }}'" :active="true">
|
||||
<div slot="body">
|
||||
<div class="control-group" :class="[errors.has('role_id') ? 'has-error' : '']">
|
||||
<label for="role">{{ __('Role') }}</label>
|
||||
<label for="role" class="required">{{ __('admin::app.users.users.role') }}</label>
|
||||
<select v-validate="'required'" class="control" name="role_id">
|
||||
@foreach($roles as $role)
|
||||
<option value="{{ $role->id }}" {{ $user->role_id == $role->id ? 'selected' : '' }}>{{ $role->name }}</option>
|
||||
|
|
@ -65,11 +70,11 @@
|
|||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label for="status">{{ __('Status') }}</label>
|
||||
<label for="status">{{ __('admin::app.users.users.status') }}</label>
|
||||
<span class="checkbox">
|
||||
<input type="checkbox" id="status" name="status" value="{{ $user->status }}" {{ $user->status ? 'checked' : '' }}>
|
||||
<label class="checkbox-view" for="status"></label>
|
||||
{{ __('Account is Active') }}
|
||||
{{ __('admin::app.users.users.account-is-active') }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ class CreateAttributeFamiliesTable extends Migration
|
|||
{
|
||||
Schema::create('attribute_families', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('code');
|
||||
$table->string('name');
|
||||
$table->boolean('status')->default(0);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ class AttributeFamilyController extends Controller
|
|||
public function store()
|
||||
{
|
||||
$this->validate(request(), [
|
||||
'code' => ['required', 'unique:families,code', new \Webkul\Core\Contracts\Validations\Slug],
|
||||
'code' => ['required', 'unique:attribute_families,code', new \Webkul\Core\Contracts\Validations\Slug],
|
||||
'name' => 'required'
|
||||
]);
|
||||
|
||||
|
|
@ -94,11 +94,11 @@ class AttributeFamilyController extends Controller
|
|||
*/
|
||||
public function edit(Attribute $attribute, $id)
|
||||
{
|
||||
$attributeFamily = $this->attributeFamily->findOrFail($id);
|
||||
$attributeFamily = $this->attributeFamily->findOrFail($id, ['*'], ['attribute_groups.attributes']);
|
||||
|
||||
$attributes = $attribute->all(['id', 'code', 'admin_name', 'type']);
|
||||
|
||||
return view($this->_config['view'], compact('attributes', 'family'));
|
||||
return view($this->_config['view'], compact('attributeFamily', 'attributes'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -111,10 +111,11 @@ class AttributeFamilyController extends Controller
|
|||
public function update(Request $request, $id)
|
||||
{
|
||||
$this->validate(request(), [
|
||||
'code' => ['required', 'unique:families,code,' . $id, new \Webkul\Core\Contracts\Validations\Slug],
|
||||
'code' => ['required', 'unique:attribute_families,code,' . $id, new \Webkul\Core\Contracts\Validations\Slug],
|
||||
'name' => 'required'
|
||||
]);
|
||||
|
||||
|
||||
$this->attributeFamily->update(request()->all(), $id);
|
||||
|
||||
session()->flash('success', 'Family updated successfully.');
|
||||
|
|
|
|||
|
|
@ -2,14 +2,11 @@
|
|||
|
||||
namespace Webkul\Attribute\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Dimsav\Translatable\Translatable;
|
||||
use Webkul\Core\Eloquent\TranslatableModel;
|
||||
use Webkul\Attribute\Models\AttributeOption;
|
||||
|
||||
class Attribute extends Model
|
||||
class Attribute extends TranslatableModel
|
||||
{
|
||||
use Translatable;
|
||||
|
||||
public $translatedAttributes = ['name'];
|
||||
|
||||
protected $fillable = ['code', 'admin_name', 'type', 'is_required', 'is_unique', 'value_per_locale', 'value_per_channel', 'is_filterable', 'is_configurable'];
|
||||
|
|
|
|||
|
|
@ -8,6 +8,10 @@ use Webkul\Attribute\Models\AttributeGroup;
|
|||
|
||||
class AttributeFamily extends Model
|
||||
{
|
||||
public $timestamps = false;
|
||||
|
||||
protected $fillable = ['code', 'name'];
|
||||
|
||||
/**
|
||||
* Get all of the attributes for the attribute groups.
|
||||
*/
|
||||
|
|
@ -15,4 +19,12 @@ class AttributeFamily extends Model
|
|||
{
|
||||
return $this->hasManyThrough(Attribute::class, AttributeGroup::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all of the attribute groups.
|
||||
*/
|
||||
public function attribute_groups()
|
||||
{
|
||||
return $this->hasMany(AttributeGroup::class);
|
||||
}
|
||||
}
|
||||
|
|
@ -7,6 +7,10 @@ use Webkul\Attribute\Models\Attribute;
|
|||
|
||||
class AttributeGroup extends Model
|
||||
{
|
||||
public $timestamps = false;
|
||||
|
||||
protected $fillable = ['name', 'position'];
|
||||
|
||||
/**
|
||||
* Get the attributes that owns the attribute group.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -2,16 +2,14 @@
|
|||
|
||||
namespace Webkul\Attribute\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Webkul\Core\Eloquent\TranslatableModel;
|
||||
use Dimsav\Translatable\Translatable;
|
||||
use Webkul\Attribute\Models\Attribute;
|
||||
|
||||
class AttributeOption extends Model
|
||||
class AttributeOption extends TranslatableModel
|
||||
{
|
||||
public $timestamps = false;
|
||||
|
||||
use Translatable;
|
||||
|
||||
public $translatedAttributes = ['label'];
|
||||
|
||||
protected $fillable = ['sort_order'];
|
||||
|
|
|
|||
|
|
@ -52,7 +52,19 @@ class AttributeFamilyRepository extends Repository
|
|||
{
|
||||
$family = $this->model->create($data);
|
||||
|
||||
return $attribute;
|
||||
if(isset($data['attribute_groups'])) {
|
||||
foreach ($data['attribute_groups'] as $group) {
|
||||
$attributeGroup = $family->attribute_groups()->create($group);
|
||||
|
||||
if(isset($group['attributes'])) {
|
||||
foreach ($group['attributes'] as $attributeId) {
|
||||
$attributeGroup->attributes()->attach($attributeId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $family;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -67,6 +79,45 @@ class AttributeFamilyRepository extends Repository
|
|||
|
||||
$family->update($data);
|
||||
|
||||
$previousAttributeGroupIds = $family->attribute_groups()->pluck('id');
|
||||
|
||||
if(isset($data['attribute_groups'])) {
|
||||
foreach ($data['attribute_groups'] as $attributeGroupId => $attributeGroupInputs) {
|
||||
if (str_contains($attributeGroupId, 'group_')) {
|
||||
$attributeGroup = $family->attribute_groups()->create($attributeGroupInputs);
|
||||
|
||||
if(isset($attributeGroupInputs['attributes'])) {
|
||||
foreach ($attributeGroupInputs['attributes'] as $attributeId) {
|
||||
$attributeGroup->attributes()->attach($attributeId);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(($index = $previousAttributeGroupIds->search($attributeGroupId)) >= 0) {
|
||||
$previousAttributeGroupIds->forget($index);
|
||||
}
|
||||
|
||||
$attributeGroup = $this->attributeGroup->findOrFail($attributeGroupId);
|
||||
$attributeGroup->update($attributeGroupInputs);
|
||||
|
||||
$attributeIds = $attributeGroup->attributes()->pluck('id');
|
||||
|
||||
foreach ($attributeGroupInputs['attributes'] as $attributeId) {
|
||||
if(($index = $attributeIds->search($attributeId)) >= 0) {
|
||||
$attributeIds->forget($index);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($attributeIds as $attributeId) {
|
||||
$attributeGroup->deattach($attributeId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($previousAttributeGroupIds as $attributeGroupId) {
|
||||
$this->attributeGroup->delete($attributeGroupId);
|
||||
}
|
||||
|
||||
return $family;
|
||||
}
|
||||
}
|
||||
|
|
@ -7,16 +7,18 @@
|
|||
"email": "jitendra@webkul.com"
|
||||
}
|
||||
],
|
||||
"require": {},
|
||||
"require": {
|
||||
"baum/baum": "~1.1"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Webkul\\Attribute\\": "src/"
|
||||
"Webkul\\Category\\": "src/"
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Webkul\\Attribute\\Providers\\AttributeServiceProvider"
|
||||
"Webkul\\Category\\Providers\\CategoryServiceProvider"
|
||||
],
|
||||
"aliases": { }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Kalnoy\Nestedset\NestedSet;
|
||||
|
||||
class CreateCategoriesTable extends Migration
|
||||
{
|
||||
|
|
@ -15,10 +16,10 @@ class CreateCategoriesTable extends Migration
|
|||
{
|
||||
Schema::create('categories', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('code')->unique();
|
||||
$table->integer('position');
|
||||
$table->integer('parent_id')->unsigned()->nullable();
|
||||
$table->foreign('parent_id')->references('id')->on('categories')->onDelete('cascade');
|
||||
$table->integer('position')->default(0);
|
||||
$table->string('image')->nullable();
|
||||
$table->boolean('status')->default(0);
|
||||
NestedSet::columns($table);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateCategoryTranslationsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('category_translations', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->text('name');
|
||||
$table->string('slug');
|
||||
$table->text('description')->nullable();
|
||||
$table->text('meta_title')->nullable();
|
||||
$table->text('meta_description')->nullable();
|
||||
$table->text('meta_keywords')->nullable();
|
||||
$table->integer('category_id')->unsigned();
|
||||
$table->integer('locale_id')->unsigned();
|
||||
$table->unique(['category_id', 'locale_id']);
|
||||
$table->unique(['category_id', 'slug', 'locale_id']);
|
||||
$table->foreign('category_id')->references('id')->on('categories')->onDelete('cascade');
|
||||
$table->foreign('locale_id')->references('id')->on('channel_locales')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('category_translations');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,137 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Category\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Webkul\Category\Repositories\CategoryRepository as Category;
|
||||
|
||||
|
||||
/**
|
||||
* Catalog category controller
|
||||
*
|
||||
* @author Jitendra Singh <jitendra@webkul.com>
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
class CategoryController extends Controller
|
||||
{
|
||||
/**
|
||||
* Contains route related configuration
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_config;
|
||||
|
||||
/**
|
||||
* CategoryRepository object
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $category;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @param Webkul\Category\Repositories\CategoryRepository $category
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Category $category)
|
||||
{
|
||||
$this->category = $category;
|
||||
|
||||
$this->_config = request('_config');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return view($this->_config['view']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$categories = $this->category->getCategoryTree();
|
||||
|
||||
return view($this->_config['view'], compact('categories'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store()
|
||||
{
|
||||
$this->validate(request(), [
|
||||
'slug' => ['required', 'unique:category_translations,slug', new \Webkul\Core\Contracts\Validations\Slug],
|
||||
'name' => 'required'
|
||||
]);
|
||||
|
||||
$this->category->create(request()->all());
|
||||
|
||||
session()->flash('success', 'Category created successfully.');
|
||||
|
||||
return redirect()->route($this->_config['redirect']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$categories = $this->category->getCategoryTree($id);
|
||||
|
||||
$category = $this->category->findOrFail($id);
|
||||
|
||||
return view($this->_config['view'], compact('category', 'categories'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
$locale = request()->get('channel_locale') ?: channel()->getDefaultChannelLocale()->id;
|
||||
$this->validate(request(), [
|
||||
$locale . '.slug' => ['required', new \Webkul\Core\Contracts\Validations\Slug, function ($attribute, $value, $fail) use ($id) {
|
||||
if (!$this->category->isSlugUnique($id, $value)) {
|
||||
$fail('The :attribute has already been taken.');
|
||||
}
|
||||
}],
|
||||
$locale . '.name' => 'required',
|
||||
]);
|
||||
|
||||
$this->category->update(request()->all(), $id);
|
||||
|
||||
session()->flash('success', 'Category updated successfully.');
|
||||
|
||||
return redirect()->route($this->_config['redirect']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Category\Http\Controllers;
|
||||
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||
|
||||
class Controller extends BaseController
|
||||
{
|
||||
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Category\Models;
|
||||
|
||||
use Webkul\Core\Eloquent\TranslatableModel;
|
||||
use Kalnoy\Nestedset\NodeTrait;
|
||||
|
||||
class Category extends TranslatableModel
|
||||
{
|
||||
use NodeTrait;
|
||||
|
||||
public $translatedAttributes = ['name', 'description', 'slug', 'meta_title', 'meta_description', 'meta_keywords'];
|
||||
|
||||
protected $fillable = ['position', 'status', 'parent_id'];
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getLocaleKey()
|
||||
{
|
||||
return 'locale_id';
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Category\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class CategoryTranslation extends Model
|
||||
{
|
||||
public $timestamps = false;
|
||||
|
||||
protected $fillable = ['name', 'description', 'slug', 'meta_title', 'meta_description', 'meta_keywords'];
|
||||
}
|
||||
|
|
@ -0,0 +1,90 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Category\Repositories;
|
||||
|
||||
use Webkul\Core\Eloquent\Repository;
|
||||
use Webkul\Category\Models\Category;
|
||||
use Webkul\Channel\Repositories\ChannelLocaleRepository;
|
||||
use Illuminate\Container\Container as App;
|
||||
use Webkul\Category\Models\CategoryTranslation;
|
||||
|
||||
/**
|
||||
* Category Reposotory
|
||||
*
|
||||
* @author Jitendra Singh <jitendra@webkul.com>
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
class CategoryRepository extends Repository
|
||||
{
|
||||
|
||||
/**
|
||||
* ChannelLocaleRepository object
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $locale;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @param Webkul\Core\Repositories\ChannelLocaleRepository $locale
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(ChannelLocaleRepository $locale, App $app)
|
||||
{
|
||||
$this->locale = $locale;
|
||||
|
||||
parent::__construct($app);
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify Model class name
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
function model()
|
||||
{
|
||||
return 'Webkul\Category\Models\Category';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
* @return mixed
|
||||
*/
|
||||
public function create(array $data)
|
||||
{
|
||||
if(isset($data['locale']) && $data['locale'] == 'all') {
|
||||
$model = app()->make($this->model());
|
||||
|
||||
foreach($this->locale->all() as $locale) {
|
||||
foreach ($model->translatedAttributes as $attribute) {
|
||||
if(isset($data[$attribute])) {
|
||||
$data[$locale->id][$attribute] = $data[$attribute];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $this->model->create($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify category tree
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getCategoryTree($id = null) {
|
||||
return $id
|
||||
? Category::orderBy('position', 'ASC')->where('id', '!=', $id)->get()->toTree()
|
||||
: Category::orderBy('position', 'ASC')->get()->toTree();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks slug is unique or not based on locale
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isSlugUnique($id, $slug) {
|
||||
return CategoryTranslation::where('category_id', '!=', $id)->where('slug', '=', $slug)->first() ? false : true;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
/node_modules
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"name": "webkul/laravel-channel",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Jitendra Singh",
|
||||
"email": "jitendra@webkul.com"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"baum/baum": "~1.1"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Webkul\\Channel\\": "src/"
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Webkul\\Channel\\Providers\\ChannelServiceProvider"
|
||||
],
|
||||
"aliases": { }
|
||||
}
|
||||
},
|
||||
"minimum-stability": "dev"
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Channel;
|
||||
|
||||
use Webkul\Channel\Models\Channel as ChannelModel;
|
||||
|
||||
class Channel
|
||||
{
|
||||
public function getDefaultChannelLocale() {
|
||||
$channel = ChannelModel::first();
|
||||
|
||||
return $channel->channel_locales()->first();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateChannelsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('channels', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('code');
|
||||
$table->string('name');
|
||||
$table->text('description')->nullable();
|
||||
$table->integer('default_locale')->unsigned();
|
||||
$table->integer('base_currency')->unsigned();
|
||||
$table->foreign('default_locale')->references('id')->on('locales')->onDelete('cascade');
|
||||
$table->foreign('base_currency')->references('id')->on('currencies')->onDelete('cascade');
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('channel_currencies', function (Blueprint $table) {
|
||||
$table->integer('channel_id')->unsigned();
|
||||
$table->integer('currency_id')->unsigned();
|
||||
$table->primary(['channel_id', 'currency_id']);
|
||||
$table->foreign('channel_id')->references('id')->on('channels')->onDelete('cascade');
|
||||
$table->foreign('currency_id')->references('id')->on('currencies')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('channels');
|
||||
|
||||
Schema::dropIfExists('channel_currencies');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateChannelLocalesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('channel_locales', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('channel_id')->unsigned();
|
||||
$table->foreign('channel_id')->references('id')->on('channels')->onDelete('cascade');
|
||||
$table->integer('locale_id')->unsigned();
|
||||
$table->foreign('locale_id')->references('id')->on('locales')->onDelete('cascade');
|
||||
$table->unique(['channel_id', 'locale_id']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('channel_locales');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Channel\Facades;
|
||||
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
|
||||
class Channel extends Facade
|
||||
{
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'channel';
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,137 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Channel\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Webkul\Channel\Repositories\ChannelRepository as Channel;
|
||||
|
||||
|
||||
/**
|
||||
* Channel controller
|
||||
*
|
||||
* @author Jitendra Singh <jitendra@webkul.com>
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
class ChannelController extends Controller
|
||||
{
|
||||
/**
|
||||
* Contains route related configuration
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_config;
|
||||
|
||||
/**
|
||||
* ChannelRepository object
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $channel;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @param Webkul\Channel\Repositories\ChannelRepository $channel
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Channel $channel)
|
||||
{
|
||||
$this->channel = $channel;
|
||||
|
||||
$this->_config = request('_config');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return view($this->_config['view']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return view($this->_config['view']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store()
|
||||
{
|
||||
$this->validate(request(), [
|
||||
'code' => ['required', 'unique:channels,code', new \Webkul\Core\Contracts\Validations\Code],
|
||||
'name' => 'required',
|
||||
'locales' => 'required|array|min:1',
|
||||
'default_locale' => 'required',
|
||||
'currencies' => 'required|array|min:1',
|
||||
'base_currency' => 'required'
|
||||
]);
|
||||
|
||||
|
||||
$this->channel->create(request()->all());
|
||||
|
||||
session()->flash('success', 'Channel created successfully.');
|
||||
|
||||
return redirect()->route($this->_config['redirect']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$channel = $this->channel->findOrFail($id);
|
||||
|
||||
return view($this->_config['view'], compact('channel'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
$this->validate(request(), [
|
||||
'code' => ['required', 'unique:channels,code,' . $id, new \Webkul\Core\Contracts\Validations\Code],
|
||||
'name' => 'required',
|
||||
'locales' => 'required|array|min:1',
|
||||
'default_locale' => 'required',
|
||||
'currencies' => 'required|array|min:1',
|
||||
'base_currency' => 'required'
|
||||
]);
|
||||
|
||||
$this->channel->update(request()->all(), $id);
|
||||
|
||||
session()->flash('success', 'Channel updated successfully.');
|
||||
|
||||
return redirect()->route($this->_config['redirect']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Channel\Http\Controllers;
|
||||
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||
|
||||
class Controller extends BaseController
|
||||
{
|
||||
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
use Webkul\Channel\Channel;
|
||||
|
||||
if (! function_exists('channel')) {
|
||||
function channel()
|
||||
{
|
||||
return new Channel;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Channel\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Webkul\Channel\Models\ChannelLocale;
|
||||
use Webkul\Core\Models\Locale;
|
||||
use Webkul\Core\Models\Currency;
|
||||
|
||||
class Channel extends Model
|
||||
{
|
||||
protected $fillable = ['code', 'name', 'description', 'default_locale', 'base_currency'];
|
||||
|
||||
/**
|
||||
* Get the channel locales.
|
||||
*/
|
||||
public function channel_locales()
|
||||
{
|
||||
return $this->hasMany(ChannelLocale::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default locale
|
||||
*/
|
||||
public function default_locale()
|
||||
{
|
||||
return $this->belongsTo(Locale::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the channel locales.
|
||||
*/
|
||||
public function currencies()
|
||||
{
|
||||
return $this->belongsToMany(Currency::class, 'channel_currencies');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the base currency
|
||||
*/
|
||||
public function base_currency()
|
||||
{
|
||||
return $this->belongsTo(Currency::class);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Channel\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Webkul\Core\Models\Locale;
|
||||
|
||||
class ChannelLocale extends Model
|
||||
{
|
||||
/**
|
||||
* Get the locale
|
||||
*/
|
||||
public function locale()
|
||||
{
|
||||
return $this->belongsTo(Locale::class);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Channel\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Foundation\AliasLoader;
|
||||
use Illuminate\Routing\Router;
|
||||
use Webkul\Channel\Channel;
|
||||
use Webkul\Channel\Facades\ChannelFacade;
|
||||
|
||||
class ChannelServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Bootstrap services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot(Router $router)
|
||||
{
|
||||
include __DIR__ . '/../Http/helpers.php';
|
||||
|
||||
$this->loadMigrationsFrom(__DIR__ . '/../Database/Migrations');
|
||||
}
|
||||
|
||||
/**
|
||||
* Register services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$this->registerChannelFacade();
|
||||
}
|
||||
|
||||
/**
|
||||
* Register Bouncer as a singleton.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerChannelFacade()
|
||||
{
|
||||
$loader = AliasLoader::getInstance();
|
||||
$loader->alias('channel', ChannelFacade::class);
|
||||
|
||||
$this->app->singleton('channel', function () {
|
||||
return new Channel();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Channel\Repositories;
|
||||
|
||||
use Webkul\Core\Eloquent\Repository;
|
||||
|
||||
/**
|
||||
* Channel Locale Reposotory
|
||||
*
|
||||
* @author Jitendra Singh <jitendra@webkul.com>
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
class ChannelLocaleRepository extends Repository
|
||||
{
|
||||
/**
|
||||
* Specify Model class name
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
function model()
|
||||
{
|
||||
return 'Webkul\Channel\Models\ChannelLocale';
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Channel\Repositories;
|
||||
|
||||
use Webkul\Core\Eloquent\Repository;
|
||||
|
||||
/**
|
||||
* Channel Reposotory
|
||||
*
|
||||
* @author Jitendra Singh <jitendra@webkul.com>
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
class ChannelRepository extends Repository
|
||||
{
|
||||
/**
|
||||
* Specify Model class name
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
function model()
|
||||
{
|
||||
return 'Webkul\Channel\Models\Channel';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
* @return mixed
|
||||
*/
|
||||
public function create(array $data)
|
||||
{
|
||||
$channel = $this->model->create($data);
|
||||
|
||||
foreach ($data['locales'] as $group) {
|
||||
|
||||
}
|
||||
|
||||
foreach ($data['currencies'] as $group) {
|
||||
|
||||
}
|
||||
|
||||
return $channel;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Core\Contracts\Validations;
|
||||
|
||||
use Illuminate\Contracts\Validation\Rule;
|
||||
|
||||
class Code implements Rule
|
||||
{
|
||||
/**
|
||||
* Determine if the validation rule passes.
|
||||
*
|
||||
* @param string $attribute
|
||||
* @param mixed $value
|
||||
* @return bool
|
||||
*/
|
||||
public function passes($attribute, $value)
|
||||
{
|
||||
return preg_match('/^[a-zA-Z0-9_]*$/', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation error message.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function message()
|
||||
{
|
||||
return trans('core::validation.code');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Core;
|
||||
|
||||
use Webkul\Core\Models\Locale as LocaleModel;
|
||||
use Webkul\Core\Models\Currency as CurrencyModel;
|
||||
|
||||
class Core
|
||||
{
|
||||
public function allLocales() {
|
||||
return LocaleModel::all();
|
||||
}
|
||||
|
||||
public function allCurrencies() {
|
||||
return CurrencyModel::all();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Core;
|
||||
|
||||
use Webkul\Core\Models\Locale as LocaleModel;
|
||||
|
||||
class Locale
|
||||
{
|
||||
public function all() {
|
||||
return LocaleModel::all();
|
||||
}
|
||||
}
|
||||
|
|
@ -4,7 +4,7 @@ use Illuminate\Support\Facades\Schema;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateCategoryDescriptionTranslationsTable extends Migration
|
||||
class CreateCountriesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
|
|
@ -13,8 +13,11 @@ class CreateCategoryDescriptionTranslationsTable extends Migration
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('category_description_translations', function (Blueprint $table) {
|
||||
Schema::create('countries', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('code');
|
||||
$table->string('name');
|
||||
$table->boolean('status')->default(0);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
|
@ -26,6 +29,6 @@ class CreateCategoryDescriptionTranslationsTable extends Migration
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('category_description_translations');
|
||||
Schema::dropIfExists('countries');
|
||||
}
|
||||
}
|
||||
|
|
@ -4,7 +4,7 @@ use Illuminate\Support\Facades\Schema;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateCategoryNameTranslationTable extends Migration
|
||||
class CreateCurrenciesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
|
|
@ -13,8 +13,11 @@ class CreateCategoryNameTranslationTable extends Migration
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('category_name_translation', function (Blueprint $table) {
|
||||
Schema::create('currencies', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('code');
|
||||
$table->string('symbol');
|
||||
$table->string('name');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
|
@ -26,6 +29,6 @@ class CreateCategoryNameTranslationTable extends Migration
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('category_name_translation');
|
||||
Schema::dropIfExists('currencies');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateCurrencyExchangeRatesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('currency_exchange_rates', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('source_currency')->unsigned();
|
||||
$table->integer('target_currency')->unsigned();
|
||||
$table->decimal('ratio', 10, 5);
|
||||
$table->foreign('source_currency')->references('id')->on('currencies')->onDelete('cascade');
|
||||
$table->foreign('target_currency')->references('id')->on('currencies')->onDelete('cascade');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('currency_exchange_rates');
|
||||
}
|
||||
}
|
||||
|
|
@ -13,5 +13,10 @@ class LocalesTableSeeder extends Seeder
|
|||
$locale->code = 'en';
|
||||
$locale->name = 'English';
|
||||
$locale->save();
|
||||
|
||||
$locale = new Locale();
|
||||
$locale->code = 'fr';
|
||||
$locale->name = 'French';
|
||||
$locale->save();
|
||||
}
|
||||
}
|
||||
|
|
@ -48,9 +48,9 @@ abstract class Repository implements RepositoryInterface {
|
|||
* @param array $columns
|
||||
* @return mixed
|
||||
*/
|
||||
public function all($columns = ['*'])
|
||||
public function all($columns = ['*'], $with = [])
|
||||
{
|
||||
return $this->resetScope()->model->get($columns);
|
||||
return $this->resetScope()->model->with($with)->get($columns);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -94,12 +94,12 @@ abstract class Repository implements RepositoryInterface {
|
|||
|
||||
/**
|
||||
* @param $id
|
||||
* @param array $columns
|
||||
* @param array $columns->with($with)
|
||||
* @return mixed
|
||||
*/
|
||||
public function find($id, $columns = ['*'])
|
||||
public function find($id, $columns = ['*'], $with = [])
|
||||
{
|
||||
return $this->resetScope()->model->find($id, $columns);
|
||||
return $this->resetScope()->model->with($with)->find($id, $columns);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -107,9 +107,9 @@ abstract class Repository implements RepositoryInterface {
|
|||
* @param array $columns
|
||||
* @return mixed
|
||||
*/
|
||||
public function findOrFail($id, $columns = ['*'])
|
||||
public function findOrFail($id, $columns = ['*'], $with = [])
|
||||
{
|
||||
return $this->resetScope()->model->findOrFail($id, $columns);
|
||||
return $this->resetScope()->model->with($with)->findOrFail($id, $columns);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -118,9 +118,9 @@ abstract class Repository implements RepositoryInterface {
|
|||
* @param array $columns
|
||||
* @return mixed
|
||||
*/
|
||||
public function findBy($attribute, $value, $columns = ['*'])
|
||||
public function findBy($attribute, $value, $columns = ['*'], $with = [])
|
||||
{
|
||||
return $this->resetScope()->model->where($attribute, '=', $value)->first($columns);
|
||||
return $this->resetScope()->model->with($with)->where($attribute, '=', $value)->first($columns);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Core\Eloquent;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Dimsav\Translatable\Translatable;
|
||||
use Webkul\Core\Models\Locale;
|
||||
use Webkul\Channel\Models\ChannelLocale;
|
||||
|
||||
class TranslatableModel extends Model
|
||||
{
|
||||
use Translatable;
|
||||
|
||||
/**
|
||||
* @param string $key
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function isKeyALocale($key)
|
||||
{
|
||||
if(is_numeric($key)) {
|
||||
if(ChannelLocale::find($key))
|
||||
return true;
|
||||
} else {
|
||||
if(Locale::where('code', '=', $key)->first())
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
protected function locale()
|
||||
{
|
||||
return channel()->getDefaultChannelLocale()->id;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Core\Facades;
|
||||
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
|
||||
class Core extends Facade
|
||||
{
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'core';
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,84 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Core\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Webkul\Core\Models\Country;
|
||||
|
||||
/**
|
||||
* Country controller
|
||||
*
|
||||
* @author Jitendra Singh <jitendra@webkul.com>
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
class CountryController extends Controller
|
||||
{
|
||||
/**
|
||||
* Contains route related configuration
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_config;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->_config = request('_config');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return view($this->_config['view']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return view($this->_config['view']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
$this->validate(request(), [
|
||||
'code' => 'required|unique:countries,code',
|
||||
'name' => 'required'
|
||||
]);
|
||||
|
||||
Country::create(request(['code','name']));
|
||||
|
||||
session()->flash('success', 'Country created successfully.');
|
||||
|
||||
return redirect()->route($this->_config['redirect']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,95 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Core\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Webkul\Core\Repositories\CurrencyRepository as Currency;
|
||||
|
||||
/**
|
||||
* Currency controller
|
||||
*
|
||||
* @author Jitendra Singh <jitendra@webkul.com>
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
class CurrencyController extends Controller
|
||||
{
|
||||
/**
|
||||
* Contains route related configuration
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_config;
|
||||
|
||||
/**
|
||||
* CurrencyRepository object
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $currency;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @param Webkul\Core\Repositories\CurrencyRepository $currency
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Currency $currency)
|
||||
{
|
||||
$this->currency = $currency;
|
||||
|
||||
$this->_config = request('_config');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return view($this->_config['view']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return view($this->_config['view']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
$this->validate(request(), [
|
||||
'code' => 'required|unique:countries,code',
|
||||
'name' => 'required',
|
||||
'symbol' => 'required'
|
||||
]);
|
||||
|
||||
$this->currency->create(request()->all());
|
||||
|
||||
session()->flash('success', 'Currency created successfully.');
|
||||
|
||||
return redirect()->route($this->_config['redirect']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,150 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Core\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Webkul\Core\Repositories\ExchangeRateRepository as ExchangeRate;
|
||||
use Webkul\Core\Repositories\CurrencyRepository as Currency;
|
||||
|
||||
/**
|
||||
* ExchangeRate controller
|
||||
*
|
||||
* @author Jitendra Singh <jitendra@webkul.com>
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
class ExchangeRateController extends Controller
|
||||
{
|
||||
/**
|
||||
* Contains route related configuration
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_config;
|
||||
|
||||
/**
|
||||
* ExchangeRateRepository object
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $exchangeRate;
|
||||
|
||||
/**
|
||||
* CurrencyRepository object
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $currency;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @param Webkul\Core\Repositories\ExchangeRateRepository $exchangeRate
|
||||
* @param Webkul\Core\Repositories\CurrencyRepository $currency
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(ExchangeRate $exchangeRate, Currency $currency)
|
||||
{
|
||||
$this->exchangeRate = $exchangeRate;
|
||||
|
||||
$this->currency = $currency;
|
||||
|
||||
$this->_config = request('_config');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return view($this->_config['view']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$currencies = $this->currency->all();
|
||||
|
||||
return view($this->_config['view'], compact('currencies'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
$sourceCurrency = request()->get('source_currency');
|
||||
$this->validate(request(), [
|
||||
'source_currency' => 'required',
|
||||
'target_currency' => ['required', function ($attribute, $value, $fail) use ($sourceCurrency) {
|
||||
if ($value == $sourceCurrency) {
|
||||
$fail('The :attribute value should be different from source currency.');
|
||||
}
|
||||
}],
|
||||
'ratio' => 'required|numeric'
|
||||
]);
|
||||
|
||||
$this->exchangeRate->create(request()->all());
|
||||
|
||||
session()->flash('success', 'Exchange rate created successfully.');
|
||||
|
||||
return redirect()->route($this->_config['redirect']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$currencies = $this->currency->all();
|
||||
|
||||
$exchangeRate = $this->exchangeRate->findOrFail($id);
|
||||
|
||||
return view($this->_config['view'], compact('currencies', 'exchangeRate'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
$this->validate(request(), [
|
||||
'source_currency' => 'required',
|
||||
'target_currency' => 'required',
|
||||
'ratio' => 'required|numeric'
|
||||
]);
|
||||
|
||||
$this->exchangeRate->update(request()->all(), $id);
|
||||
|
||||
session()->flash('success', 'Exchange rate updated successfully.');
|
||||
|
||||
return redirect()->route($this->_config['redirect']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Core\Http\Middleware;
|
||||
|
||||
use Webkul\Core\Models\Locale as LocaleModel;
|
||||
use Webkul\Core\Repositories\LocaleRepository;
|
||||
use Closure;
|
||||
|
||||
class Locale
|
||||
{
|
||||
/**
|
||||
* @var \Webkul\Core\Repositories\LocaleRepository
|
||||
*/
|
||||
protected $locale;
|
||||
|
||||
/**
|
||||
* @param \Webkul\Core\Repositories\LocaleRepository $locale
|
||||
*/
|
||||
public function __construct(LocaleRepository $locale)
|
||||
{
|
||||
$this->locale = $locale;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
if($locale = $request->get('locale')) {
|
||||
if($this->locale->findBy('code', $locale)) {
|
||||
// app()->setLocale($locale);
|
||||
}
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
use Webkul\Core\Core;
|
||||
|
||||
if (! function_exists('core')) {
|
||||
function core()
|
||||
{
|
||||
return new Core;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Core\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Country extends Model
|
||||
{
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'code', 'name'
|
||||
];
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Core\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Currency extends Model
|
||||
{
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'code', 'name', 'symbol'
|
||||
];
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Core\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class CurrencyExchangeRate extends Model
|
||||
{
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'source_currency', 'target_currency', 'ratio'
|
||||
];
|
||||
}
|
||||
|
|
@ -3,7 +3,6 @@
|
|||
namespace Webkul\Core\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Webkul\User\Models\Admin;
|
||||
|
||||
class Locale extends Model
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,6 +6,9 @@ use Illuminate\Support\ServiceProvider;
|
|||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Routing\Router;
|
||||
use Illuminate\Foundation\AliasLoader;
|
||||
use Webkul\Core\Http\Middleware\Locale;
|
||||
use Webkul\Core\Core;
|
||||
use Webkul\Core\Facades\CoreFacade;
|
||||
|
||||
class CoreServiceProvider extends ServiceProvider
|
||||
{
|
||||
|
|
@ -16,15 +19,21 @@ class CoreServiceProvider extends ServiceProvider
|
|||
*/
|
||||
public function boot(Router $router)
|
||||
{
|
||||
include __DIR__ . '/../Http/helpers.php';
|
||||
|
||||
$this->loadMigrationsFrom(__DIR__ . '/../Database/Migrations');
|
||||
|
||||
$this->loadTranslationsFrom(__DIR__ . '/../Resources/lang', 'core');
|
||||
|
||||
$router->aliasMiddleware('locale', Locale::class);
|
||||
|
||||
$this->publishes([
|
||||
__DIR__ . '/../../publishable/lang' => public_path('vendor/webkul/core/lang'),
|
||||
], 'public');
|
||||
|
||||
Validator::extend('slug', 'Webkul\Core\Contracts\Validations\Slug@passes');
|
||||
|
||||
Validator::extend('code', 'Webkul\Core\Contracts\Validations\Code@passes');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -34,5 +43,21 @@ class CoreServiceProvider extends ServiceProvider
|
|||
*/
|
||||
public function register()
|
||||
{
|
||||
$this->registerCoreFacade();
|
||||
}
|
||||
|
||||
/**
|
||||
* Register Bouncer as a singleton.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerCoreFacade()
|
||||
{
|
||||
$loader = AliasLoader::getInstance();
|
||||
$loader->alias('core', CoreFacade::class);
|
||||
|
||||
$this->app->singleton('core', function () {
|
||||
return new Core();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Core\Repositories;
|
||||
|
||||
use Webkul\Core\Eloquent\Repository;
|
||||
|
||||
/**
|
||||
* Country Reposotory
|
||||
*
|
||||
* @author Jitendra Singh <jitendra@webkul.com>
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
class CountryRepository extends Repository
|
||||
{
|
||||
/**
|
||||
* Specify Model class name
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
function model()
|
||||
{
|
||||
return 'Webkul\Core\Models\Country';
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Core\Repositories;
|
||||
|
||||
use Webkul\Core\Eloquent\Repository;
|
||||
|
||||
/**
|
||||
* Currency Reposotory
|
||||
*
|
||||
* @author Jitendra Singh <jitendra@webkul.com>
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
class CurrencyRepository extends Repository
|
||||
{
|
||||
/**
|
||||
* Specify Model class name
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
function model()
|
||||
{
|
||||
return 'Webkul\Core\Models\Currency';
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Core\Repositories;
|
||||
|
||||
use Webkul\Core\Eloquent\Repository;
|
||||
|
||||
/**
|
||||
* ExchangeRate Reposotory
|
||||
*
|
||||
* @author Jitendra Singh <jitendra@webkul.com>
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
class ExchangeRateRepository extends Repository
|
||||
{
|
||||
/**
|
||||
* Specify Model class name
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
function model()
|
||||
{
|
||||
return 'Webkul\Core\Models\CurrencyExchangeRate';
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Core\Repositories;
|
||||
|
||||
use Webkul\Core\Eloquent\Repository;
|
||||
|
||||
/**
|
||||
* Locale Reposotory
|
||||
*
|
||||
* @author Jitendra Singh <jitendra@webkul.com>
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
class LocaleRepository extends Repository
|
||||
{
|
||||
/**
|
||||
* Specify Model class name
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
function model()
|
||||
{
|
||||
return 'Webkul\Core\Models\Locale';
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'slug' => 'The :attribute must be valid slug.'
|
||||
'slug' => 'The :attribute must be valid slug.',
|
||||
'code' => 'The :attribute must be valid.'
|
||||
];
|
||||
|
|
@ -0,0 +1 @@
|
|||
/node_modules
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"name": "webkul/laravel-inventory",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Jitendra Singh",
|
||||
"email": "jitendra@webkul.com"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"propaganistas/laravel-intl": "^2.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Webkul\\Inventory\\": "src/"
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Webkul\\Inventory\\InventoryServiceProvider"
|
||||
],
|
||||
"aliases": {}
|
||||
}
|
||||
},
|
||||
"minimum-stability": "dev"
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateInventorySourcesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('inventory_sources', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('code')->unique();
|
||||
$table->string('name');
|
||||
$table->text('description')->nullable();
|
||||
$table->string('contact_name')->nullable();
|
||||
$table->string('contact_email')->nullable();
|
||||
$table->string('contact_number')->nullable();
|
||||
$table->string('contact_fax')->nullable();
|
||||
$table->string('country')->nullable();
|
||||
$table->string('state')->nullable();
|
||||
$table->string('city')->nullable();
|
||||
$table->string('street')->nullable();
|
||||
$table->string('postcode');
|
||||
$table->integer('priority')->default(0);
|
||||
$table->decimal('latitude', 10, 5);
|
||||
$table->decimal('longitude', 10, 5);
|
||||
$table->boolean('status')->default(0);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('inventory_sources');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Inventory\Http\Controllers;
|
||||
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||
|
||||
class Controller extends BaseController
|
||||
{
|
||||
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
|
||||
}
|
||||
|
|
@ -0,0 +1,125 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Inventory\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Webkul\Inventory\Repositories\InventorySourceRepository as InventorySource;
|
||||
|
||||
/**
|
||||
* Inventory source controller
|
||||
*
|
||||
* @author Jitendra Singh <jitendra@webkul.com>
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
class InventorySourceController extends Controller
|
||||
{
|
||||
/**
|
||||
* Contains route related configuration
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_config;
|
||||
|
||||
/**
|
||||
* InventorySourceRepository object
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $inventorySource;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @param Webkul\Inventory\Repositories\InventorySourceRepository $inventorySource
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(InventorySource $inventorySource)
|
||||
{
|
||||
$this->inventorySource = $inventorySource;
|
||||
|
||||
$this->_config = request('_config');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return view($this->_config['view']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return view($this->_config['view']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store()
|
||||
{
|
||||
$this->validate(request(), [
|
||||
'name' => 'required'
|
||||
]);
|
||||
|
||||
$this->inventorySource->create(request()->all());
|
||||
|
||||
session()->flash('success', 'Inventory source created successfully.');
|
||||
|
||||
return redirect()->route($this->_config['redirect']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$inventorySource = $this->inventorySource->findOrFail($id);
|
||||
|
||||
return view($this->_config['view'], compact('inventorySource'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
$this->validate(request(), [
|
||||
'name' => 'required',
|
||||
]);
|
||||
|
||||
$this->inventorySource->update(request()->all(), $id);
|
||||
|
||||
session()->flash('success', 'Inventory source updated successfully.');
|
||||
|
||||
return redirect()->route($this->_config['redirect']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Inventory\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class InventorySource extends Model
|
||||
{
|
||||
protected $guarded = ['_token'];
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Inventory\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Foundation\AliasLoader;
|
||||
use Illuminate\Routing\Router;
|
||||
|
||||
class InventoryServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Bootstrap services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot(Router $router)
|
||||
{
|
||||
$this->loadMigrationsFrom(__DIR__ . '/../Database/Migrations');
|
||||
}
|
||||
|
||||
/**
|
||||
* Register services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue