data grid bugs fixed
This commit is contained in:
commit
86a5cb93dd
|
|
@ -1,7 +1,7 @@
|
||||||
php artisan make:controller UserController && mv app/Http/Controllers/UserController.php packages/Webkul/User/src/Ht
|
php artisan make:controller UserController && mv app/Http/Controllers/UserController.php packages/Webkul/User/src/Ht
|
||||||
tp/Controllers
|
tp/Controllers
|
||||||
|
|
||||||
php artisan make:migration foo --path=packages/Webkul/User/src/Database/migrations
|
php artisan make:migration foo --path=packages/Webkul/User/src/Database/Migrations
|
||||||
|
|
||||||
php artisan db:seed --class=Webkul\\User\\Database\\Seeders\\DatabaseSeeder
|
php artisan db:seed --class=Webkul\\User\\Database\\Seeders\\DatabaseSeeder
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@
|
||||||
"php": "^7.1.3",
|
"php": "^7.1.3",
|
||||||
"dimsav/laravel-translatable": "^9.0",
|
"dimsav/laravel-translatable": "^9.0",
|
||||||
"fideloper/proxy": "^4.0",
|
"fideloper/proxy": "^4.0",
|
||||||
|
"kalnoy/nestedset": "^4.3",
|
||||||
"laravel/framework": "5.6.*",
|
"laravel/framework": "5.6.*",
|
||||||
"laravel/tinker": "^1.0",
|
"laravel/tinker": "^1.0",
|
||||||
"nwidart/laravel-modules": "^3.2",
|
"nwidart/laravel-modules": "^3.2",
|
||||||
|
|
@ -30,7 +31,10 @@
|
||||||
"webkul/laravel-ui": "self.version",
|
"webkul/laravel-ui": "self.version",
|
||||||
"webkul/laravel-core": "self.version",
|
"webkul/laravel-core": "self.version",
|
||||||
"webkul/laravel-attribute": "self.version",
|
"webkul/laravel-attribute": "self.version",
|
||||||
"webkul/laravel-customer": "self.version"
|
"webkul/laravel-customer": "self.version",
|
||||||
|
"webkul/laravel-category": "self.version",
|
||||||
|
"webkul/laravel-channel": "self.version",
|
||||||
|
"webkul/laravel-product": "self.version"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"classmap": [
|
"classmap": [
|
||||||
|
|
@ -42,10 +46,14 @@
|
||||||
"Webkul\\User\\": "packages/Webkul/User/src",
|
"Webkul\\User\\": "packages/Webkul/User/src",
|
||||||
"Webkul\\Admin\\": "packages/Webkul/Admin/src",
|
"Webkul\\Admin\\": "packages/Webkul/Admin/src",
|
||||||
"Webkul\\Ui\\": "packages/Webkul/Ui/src",
|
"Webkul\\Ui\\": "packages/Webkul/Ui/src",
|
||||||
|
"Webkul\\Category\\": "packages/Webkul/Category/src",
|
||||||
"Webkul\\Attribute\\": "packages/Webkul/Attribute/src",
|
"Webkul\\Attribute\\": "packages/Webkul/Attribute/src",
|
||||||
"Webkul\\Shop\\": "packages/Webkul/Shop/src",
|
"Webkul\\Shop\\": "packages/Webkul/Shop/src",
|
||||||
"Webkul\\Core\\": "packages/Webkul/Core/src",
|
"Webkul\\Core\\": "packages/Webkul/Core/src",
|
||||||
"Webkul\\Customer\\": "packages/Webkul/Customer/src"
|
"Webkul\\Customer\\": "packages/Webkul/Customer/src",
|
||||||
|
"Webkul\\Channel\\": "packages/Webkul/Channel/src",
|
||||||
|
"Webkul\\Inventory\\": "packages/Webkul/Inventory/src",
|
||||||
|
"Webkul\\Product\\": "packages/Webkul/Product/src"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"autoload-dev": {
|
"autoload-dev": {
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "e246cc7d779ef4098f86e289fe65a215",
|
"content-hash": "47eeeb44e8f067ec98ea469bd35acf54",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "commerceguys/intl",
|
"name": "commerceguys/intl",
|
||||||
|
|
@ -617,6 +617,65 @@
|
||||||
],
|
],
|
||||||
"time": "2018-05-16T11:53:55+00:00"
|
"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",
|
"name": "laravel/framework",
|
||||||
"version": "v5.6.27",
|
"version": "v5.6.27",
|
||||||
|
|
|
||||||
|
|
@ -174,10 +174,14 @@ return [
|
||||||
Webkul\User\Providers\UserServiceProvider::class,
|
Webkul\User\Providers\UserServiceProvider::class,
|
||||||
Webkul\Admin\Providers\AdminServiceProvider::class,
|
Webkul\Admin\Providers\AdminServiceProvider::class,
|
||||||
Webkul\Ui\Providers\UiServiceProvider::class,
|
Webkul\Ui\Providers\UiServiceProvider::class,
|
||||||
|
Webkul\Category\Providers\CategoryServiceProvider::class,
|
||||||
Webkul\Attribute\Providers\AttributeServiceProvider::class,
|
Webkul\Attribute\Providers\AttributeServiceProvider::class,
|
||||||
Webkul\Core\Providers\CoreServiceProvider::class,
|
Webkul\Core\Providers\CoreServiceProvider::class,
|
||||||
Webkul\Shop\Providers\ShopServiceProvider::class,
|
Webkul\Shop\Providers\ShopServiceProvider::class,
|
||||||
Webkul\Customer\Providers\CustomerServiceProvider::class,
|
Webkul\Customer\Providers\CustomerServiceProvider::class,
|
||||||
|
Webkul\Channel\Providers\ChannelServiceProvider::class,
|
||||||
|
Webkul\Inventory\Providers\InventoryServiceProvider::class,
|
||||||
|
Webkul\Product\Providers\ProductServiceProvider::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,
|
||||||
|
];
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|
||||||
'guards' => [
|
'guards' => [
|
||||||
'web' => [
|
'web' => [
|
||||||
'driver' => 'session',
|
'driver' => 'session',
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ Route::group(['middleware' => ['web']], function () {
|
||||||
|
|
||||||
|
|
||||||
// Admin Routes
|
// Admin Routes
|
||||||
Route::group(['middleware' => ['admin']], function () {
|
Route::group(['middleware' => ['admin', 'locale']], function () {
|
||||||
Route::get('/logout', 'Webkul\User\Http\Controllers\SessionController@destroy')->defaults('_config', [
|
Route::get('/logout', 'Webkul\User\Http\Controllers\SessionController@destroy')->defaults('_config', [
|
||||||
'redirect' => 'admin.session.create'
|
'redirect' => 'admin.session.create'
|
||||||
])->name('admin.session.destroy');
|
])->name('admin.session.destroy');
|
||||||
|
|
@ -43,6 +43,39 @@ Route::group(['middleware' => ['web']], function () {
|
||||||
|
|
||||||
// Catalog Routes
|
// Catalog Routes
|
||||||
Route::prefix('catalog')->group(function () {
|
Route::prefix('catalog')->group(function () {
|
||||||
|
|
||||||
|
// Catalog Product Routes
|
||||||
|
Route::get('/products', 'Webkul\Product\Http\Controllers\ProductController@index')->defaults('_config', [
|
||||||
|
'view' => 'admin::catalog.products.index'
|
||||||
|
])->name('admin.catalog.products.index');
|
||||||
|
|
||||||
|
Route::get('/products/create', 'Webkul\Product\Http\Controllers\ProductController@create')->defaults('_config', [
|
||||||
|
'view' => 'admin::catalog.products.create'
|
||||||
|
])->name('admin.catalog.products.create');
|
||||||
|
|
||||||
|
// 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', [
|
Route::get('/attributes', 'Webkul\Attribute\Http\Controllers\AttributeController@index')->defaults('_config', [
|
||||||
'view' => 'admin::catalog.attributes.index'
|
'view' => 'admin::catalog.attributes.index'
|
||||||
])->name('admin.catalog.attributes.index');
|
])->name('admin.catalog.attributes.index');
|
||||||
|
|
@ -54,8 +87,39 @@ Route::group(['middleware' => ['web']], function () {
|
||||||
Route::post('/attributes/create', 'Webkul\Attribute\Http\Controllers\AttributeController@store')->defaults('_config', [
|
Route::post('/attributes/create', 'Webkul\Attribute\Http\Controllers\AttributeController@store')->defaults('_config', [
|
||||||
'redirect' => 'admin.catalog.attributes.index'
|
'redirect' => 'admin.catalog.attributes.index'
|
||||||
])->name('admin.catalog.attributes.store');
|
])->name('admin.catalog.attributes.store');
|
||||||
|
|
||||||
|
Route::get('/attributes/edit/{id}', 'Webkul\Attribute\Http\Controllers\AttributeController@edit')->defaults('_config', [
|
||||||
|
'view' => 'admin::catalog.attributes.edit'
|
||||||
|
])->name('admin.catalog.attributes.edit');
|
||||||
|
|
||||||
|
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', [
|
||||||
|
'view' => 'admin::catalog.families.index'
|
||||||
|
])->name('admin.catalog.families.index');
|
||||||
|
|
||||||
|
Route::get('/families/create', 'Webkul\Attribute\Http\Controllers\AttributeFamilyController@create')->defaults('_config', [
|
||||||
|
'view' => 'admin::catalog.families.create'
|
||||||
|
])->name('admin.catalog.families.create');
|
||||||
|
|
||||||
|
Route::post('/families/create', 'Webkul\Attribute\Http\Controllers\AttributeFamilyController@store')->defaults('_config', [
|
||||||
|
'redirect' => 'admin.catalog.families.index'
|
||||||
|
])->name('admin.catalog.families.store');
|
||||||
|
|
||||||
|
Route::get('/families/edit/{id}', 'Webkul\Attribute\Http\Controllers\AttributeFamilyController@edit')->defaults('_config', [
|
||||||
|
'view' => 'admin::catalog.families.edit'
|
||||||
|
])->name('admin.catalog.families.edit');
|
||||||
|
|
||||||
|
Route::put('/families/edit/{id}', 'Webkul\Attribute\Http\Controllers\AttributeFamilyController@update')->defaults('_config', [
|
||||||
|
'redirect' => 'admin.catalog.families.index'
|
||||||
|
])->name('admin.catalog.families.update');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// Datagrid Routes
|
// Datagrid Routes
|
||||||
//for datagrid and its loading, filtering, sorting and queries
|
//for datagrid and its loading, filtering, sorting and queries
|
||||||
Route::get('datagrid', 'Webkul\Admin\Http\Controllers\DataGridController@index')->name('admin.datagrid.index');
|
Route::get('datagrid', 'Webkul\Admin\Http\Controllers\DataGridController@index')->name('admin.datagrid.index');
|
||||||
|
|
@ -108,11 +172,11 @@ Route::group(['middleware' => ['web']], function () {
|
||||||
|
|
||||||
// Locale Routes
|
// Locale Routes
|
||||||
Route::get('/locales', 'Webkul\Core\Http\Controllers\LocaleController@index')->defaults('_config', [
|
Route::get('/locales', 'Webkul\Core\Http\Controllers\LocaleController@index')->defaults('_config', [
|
||||||
'view' => 'admin::locales.index'
|
'view' => 'admin::settings.locales.index'
|
||||||
])->name('admin.locales.index');
|
])->name('admin.locales.index');
|
||||||
|
|
||||||
Route::get('/locales/create', 'Webkul\Core\Http\Controllers\LocaleController@create')->defaults('_config', [
|
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');
|
])->name('admin.locales.create');
|
||||||
|
|
||||||
Route::post('/locales/create', 'Webkul\Core\Http\Controllers\LocaleController@store')->defaults('_config', [
|
Route::post('/locales/create', 'Webkul\Core\Http\Controllers\LocaleController@store')->defaults('_config', [
|
||||||
|
|
@ -120,6 +184,101 @@ Route::group(['middleware' => ['web']], function () {
|
||||||
])->name('admin.locales.store');
|
])->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
|
// Admin Profile route
|
||||||
Route::get('/account', 'Webkul\User\Http\Controllers\AccountController@edit')->defaults('_config', [
|
Route::get('/account', 'Webkul\User\Http\Controllers\AccountController@edit')->defaults('_config', [
|
||||||
'view' => 'admin::account.edit'
|
'view' => 'admin::account.edit'
|
||||||
|
|
|
||||||
|
|
@ -39,23 +39,39 @@ class EventServiceProvider extends ServiceProvider
|
||||||
Event::listen('admin.menu.build', function($menu) {
|
Event::listen('admin.menu.build', function($menu) {
|
||||||
$menu->add('dashboard', 'Dashboard', 'admin.dashboard.index', 1, 'dashboard-icon');
|
$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.products.index', 3, 'catalog-icon');
|
||||||
|
|
||||||
|
$menu->add('catalog.products', 'Products', 'admin.catalog.products.index', 1);
|
||||||
|
|
||||||
|
$menu->add('catalog.categories', 'Categories', 'admin.catalog.categories.index', 2);
|
||||||
|
|
||||||
$menu->add('catalog.attributes', 'Attributes', 'admin.catalog.attributes.index', 3);
|
$menu->add('catalog.attributes', 'Attributes', 'admin.catalog.attributes.index', 3);
|
||||||
|
|
||||||
|
$menu->add('catalog.families', 'Families', 'admin.catalog.families.index', 4);
|
||||||
|
|
||||||
$menu->add('configuration', 'Configure', 'admin.account.edit', 6, 'configuration-icon');
|
$menu->add('configuration', 'Configure', 'admin.account.edit', 6, 'configuration-icon');
|
||||||
|
|
||||||
$menu->add('configuration.account', 'My Account', 'admin.account.edit', 1);
|
$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.users', 'Users', 'admin.users.index', 1, '');
|
||||||
|
|
||||||
$menu->add('settings.users.roles', 'Roles', 'admin.roles.index', 2, '');
|
$menu->add('settings.users.roles', 'Roles', 'admin.roles.index', 2, '');
|
||||||
|
|
||||||
$menu->add('settings.locales', 'Locales', 'admin.locales.index', 2, '');
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,23 +23,51 @@ $(document).ready(function() {
|
||||||
methods: {
|
methods: {
|
||||||
onSubmit: function(e) {
|
onSubmit: function(e) {
|
||||||
this.$validator.validateAll().then(result => {
|
this.$validator.validateAll().then(result => {
|
||||||
|
$(document).ready(function () {
|
||||||
|
Vue.config.ignoredElements = [
|
||||||
|
'option-wrapper',
|
||||||
|
'group-form',
|
||||||
|
'group-list'
|
||||||
|
];
|
||||||
|
|
||||||
|
var app = new Vue({
|
||||||
|
el: '#app',
|
||||||
|
|
||||||
|
data: {
|
||||||
|
modalIds: {}
|
||||||
|
},
|
||||||
|
|
||||||
|
mounted () {
|
||||||
|
this.addServerErrors()
|
||||||
|
this.addFlashMessages()
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
onSubmit (e) {
|
||||||
|
this.$validator.validateAll().then((result) => {
|
||||||
if (result) {
|
if (result) {
|
||||||
e.target.submit();
|
e.target.submit();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
addServerErrors: function() {
|
addServerErrors () {
|
||||||
var scope = null;
|
var scope = null;
|
||||||
for (var key in serverErrors) {
|
for (var key in serverErrors) {
|
||||||
const field = this.$validator.fields.find({
|
const field = this.$validator.fields.find({
|
||||||
name: key,
|
name: key,
|
||||||
scope: scope
|
scope: scope
|
||||||
});
|
});
|
||||||
|
var inputName = key;
|
||||||
|
if(key.indexOf('.') !== -1) {
|
||||||
|
inputName = key.replace(".", "[") + ']';
|
||||||
|
}
|
||||||
|
|
||||||
|
const field = this.$validator.fields.find({ name: inputName, scope: scope });
|
||||||
if (field) {
|
if (field) {
|
||||||
this.$validator.errors.add({
|
this.$validator.errors.add({
|
||||||
id: field.id,
|
id: field.id,
|
||||||
field: key,
|
field: inputName,
|
||||||
msg: serverErrors[key][0],
|
msg: serverErrors[key][0],
|
||||||
scope: scope
|
scope: scope
|
||||||
});
|
});
|
||||||
|
|
@ -53,6 +81,10 @@ $(document).ready(function() {
|
||||||
flashMessages.forEach(function(flash) {
|
flashMessages.forEach(function(flash) {
|
||||||
flashes.addFlash(flash);
|
flashes.addFlash(flash);
|
||||||
}, this);
|
}, this);
|
||||||
|
},
|
||||||
|
|
||||||
|
showModal (id) {
|
||||||
|
this.$set(this.modalIds, id, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -118,7 +118,6 @@ body {
|
||||||
right: 0;
|
right: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
bottom: 0px;
|
bottom: 0px;
|
||||||
z-index: 1;
|
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
|
|
||||||
|
|
@ -154,7 +153,7 @@ body {
|
||||||
|
|
||||||
.content-wrapper {
|
.content-wrapper {
|
||||||
padding: 25px 25px 25px 305px;
|
padding: 25px 25px 25px 305px;
|
||||||
overflow-y: auto;
|
// overflow-y: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.content {
|
.content {
|
||||||
|
|
@ -165,15 +164,35 @@ body {
|
||||||
}
|
}
|
||||||
|
|
||||||
.page-header {
|
.page-header {
|
||||||
display: block;
|
display: inline-block;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
.page-title {
|
.page-title {
|
||||||
float: left;
|
float: left;
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
margin-bottom: 0;
|
||||||
|
vertical-align: middle;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.page-action {
|
.page-action {
|
||||||
float: right;
|
float: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.control-group {
|
||||||
|
width: 180px;
|
||||||
|
display: inline-block;
|
||||||
|
margin-bottom: 0;
|
||||||
|
margin-left: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.control {
|
||||||
|
width: 100%;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.page-content {
|
.page-content {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,229 @@
|
||||||
|
<?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' => [
|
||||||
|
'products' => [
|
||||||
|
'products' => 'products',
|
||||||
|
'add-product-btn-title' => 'Add Product',
|
||||||
|
'add-title' => 'Add Product',
|
||||||
|
'edit-title' => 'Edit Product',
|
||||||
|
'save-btn-title' => 'Save Product',
|
||||||
|
],
|
||||||
|
'attributes' => [
|
||||||
|
'add-title' => 'Add Attribute',
|
||||||
|
'edit-title' => 'Edit Attribute',
|
||||||
|
'save-btn-title' => 'Save Attribute',
|
||||||
|
'general' => 'General',
|
||||||
|
'code' => 'Attribute Code',
|
||||||
|
'type' => 'Attribute Type',
|
||||||
|
'text' => 'Text',
|
||||||
|
'textarea' => 'Textarea',
|
||||||
|
'price' => 'Price',
|
||||||
|
'boolean' => 'Boolean',
|
||||||
|
'select' => 'Select',
|
||||||
|
'multiselect' => 'Multiselect',
|
||||||
|
'checkbox' => 'Checkbox',
|
||||||
|
'datetime' => 'Datetime',
|
||||||
|
'date' => 'Date',
|
||||||
|
'label' => 'label',
|
||||||
|
'admin' => 'Admin',
|
||||||
|
'options' => 'Options',
|
||||||
|
'position' => 'Position',
|
||||||
|
'add-option-btn-title' => 'Add Option',
|
||||||
|
'validations' => 'Validations',
|
||||||
|
'input_validation' => 'Input Validation',
|
||||||
|
'is_required' => 'Is Required',
|
||||||
|
'is_unique' => 'Is Unique',
|
||||||
|
'number' => 'Number',
|
||||||
|
'decimal' => 'Decimal',
|
||||||
|
'email' => 'Email',
|
||||||
|
'url' => 'URL',
|
||||||
|
'configuration' => 'Configuration',
|
||||||
|
'status' => 'Status',
|
||||||
|
'yes' => 'Yes',
|
||||||
|
'no' => 'No',
|
||||||
|
'value_per_locale' => 'Value Per Locale',
|
||||||
|
'value_per_channel' => 'Value Per Channel',
|
||||||
|
'value_per_channel' => 'Value Per Channel',
|
||||||
|
'is_filterable' => 'Use in Layered Navigation',
|
||||||
|
'is_configurable' => 'Use To Create Configurable Product'
|
||||||
|
],
|
||||||
|
'families' => [
|
||||||
|
'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',
|
||||||
|
'name' => 'Name',
|
||||||
|
'groups' => 'Groups',
|
||||||
|
'add-group-title' => 'Add Group',
|
||||||
|
'position' => 'Position',
|
||||||
|
'attribute-code' => 'Code',
|
||||||
|
'type' => 'Type',
|
||||||
|
'add-attribute-title' => 'Add Attributes',
|
||||||
|
'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-header">
|
||||||
<div class="page-title">
|
<div class="page-title">
|
||||||
<h1>
|
<h1>
|
||||||
{{ __('My Account') }}
|
{{ __('admin::app.account.header-title') }}
|
||||||
</h1>
|
</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="page-action">
|
<div class="page-action">
|
||||||
<button type="submit" class="btn btn-lg btn-primary">
|
<button type="submit" class="btn btn-lg btn-primary">
|
||||||
{{ __('Save') }}
|
{{ __('admin::app.account.save-btn-title') }}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -24,32 +24,32 @@
|
||||||
|
|
||||||
<input name="_method" type="hidden" value="PUT">
|
<input name="_method" type="hidden" value="PUT">
|
||||||
|
|
||||||
<accordian :title="'{{ __('General') }}'" :active="true">
|
<accordian :title="'{{ __('admin::app.account.general') }}'" :active="true">
|
||||||
<div class="accordian-content">
|
<div slot="body">
|
||||||
<div class="control-group" :class="[errors.has('name') ? 'has-error' : '']">
|
<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 }}"/>
|
<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>
|
<span class="control-error" v-if="errors.has('name')">@{{ errors.first('name') }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="control-group" :class="[errors.has('email') ? 'has-error' : '']">
|
<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 }}"/>
|
<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>
|
<span class="control-error" v-if="errors.has('email')">@{{ errors.first('email') }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</accordian>
|
</accordian>
|
||||||
|
|
||||||
<accordian :title="'{{ __('Password') }}'" :active="true">
|
<accordian :title="'{{ __('admin::app.account.password') }}'" :active="true">
|
||||||
<div class="accordian-content">
|
<div slot="body">
|
||||||
<div class="control-group" :class="[errors.has('password') ? 'has-error' : '']">
|
<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"/>
|
<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>
|
<span class="control-error" v-if="errors.has('password')">@{{ errors.first('password') }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="control-group" :class="[errors.has('password_confirmation') ? 'has-error' : '']">
|
<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"/>
|
<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>
|
<span class="control-error" v-if="errors.has('password_confirmation')">@{{ errors.first('password_confirmation') }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,22 @@
|
||||||
@extends('admin::layouts.content')
|
@extends('admin::layouts.content')
|
||||||
|
|
||||||
|
@section('page_title')
|
||||||
|
{{ __('admin::app.catalog.attributes.add-title') }}
|
||||||
|
@stop
|
||||||
|
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<form method="POST" action="{{ route('admin.catalog.attributes.store') }}">
|
<form method="POST" action="{{ route('admin.catalog.attributes.store') }}" @submit.prevent="onSubmit">
|
||||||
|
|
||||||
<div class="page-header">
|
<div class="page-header">
|
||||||
<div class="page-title">
|
<div class="page-title">
|
||||||
<h1>{{ __('Add Attribute') }}</h1>
|
<h1>{{ __('admin::app.catalog.attributes.add-title') }}</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="page-action">
|
<div class="page-action">
|
||||||
<button type="submit" class="btn btn-lg btn-primary">
|
<button type="submit" class="btn btn-lg btn-primary">
|
||||||
{{ __('Save Attribute') }}
|
{{ __('admin::app.catalog.attributes.save-btn-title') }}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -20,44 +25,45 @@
|
||||||
<div class="form-container">
|
<div class="form-container">
|
||||||
@csrf()
|
@csrf()
|
||||||
|
|
||||||
<accordian :title="'{{ __('General') }}'" :active="true">
|
<accordian :title="'{{ __('admin::app.catalog.attributes.general') }}'" :active="true">
|
||||||
<div class="accordian-content">
|
<div slot="body">
|
||||||
<div class="control-group" :class="[errors.has('code') ? 'has-error' : '']">
|
<div class="control-group" :class="[errors.has('code') ? 'has-error' : '']">
|
||||||
<label for="code">{{ __('Attribute Code') }}</label>
|
<label for="code">{{ __('admin::app.catalog.attributes.code') }}</label>
|
||||||
<input type="text" v-validate="'required'" class="control" id="code" name="code" value="{{ old('code') }}"/>
|
<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>
|
<span class="control-error" v-if="errors.has('code')">@{{ errors.first('code') }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label for="type">{{ __('Attribute Type') }}</label>
|
<label for="type" class="required">{{ __('admin::app.catalog.attributes.type') }}</label>
|
||||||
<select class="control" id="type" name="type">
|
<select class="control" id="type" name="type">
|
||||||
<option value="text">{{ __('Text') }}</option>
|
<option value="text">{{ __('admin::app.catalog.attributes.text') }}</option>
|
||||||
<option value="textarea">{{ __('Textarea') }}</option>
|
<option value="textarea">{{ __('admin::app.catalog.attributes.textarea') }}</option>
|
||||||
<option value="integer">{{ __('Integer') }}</option>
|
<option value="price">{{ __('admin::app.catalog.attributes.price') }}</option>
|
||||||
<option value="select">{{ __('Select') }}</option>
|
<option value="boolean">{{ __('admin::app.catalog.attributes.boolean') }}</option>
|
||||||
<option value="multiselect">{{ __('Multiselect') }}</option>
|
<option value="select">{{ __('admin::app.catalog.attributes.select') }}</option>
|
||||||
<option value="checkbox">{{ __('Multiselect') }}</option>
|
<option value="multiselect">{{ __('admin::app.catalog.attributes.multiselect') }}</option>
|
||||||
<option value="datetime">{{ __('Datetime') }}</option>
|
<option value="checkbox">{{ __('admin::app.catalog.attributes.checkbox') }}</option>
|
||||||
<option value="date">{{ __('Date') }}</option>
|
<option value="datetime">{{ __('admin::app.catalog.attributes.datetime') }}</option>
|
||||||
|
<option value="date">{{ __('admin::app.catalog.attributes.date') }}</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</accordian>
|
</accordian>
|
||||||
|
|
||||||
<accordian :title="'{{ __('Label') }}'" :active="true">
|
<accordian :title="'{{ __('admin::app.catalog.attributes.label') }}'" :active="true">
|
||||||
<div class="accordian-content">
|
<div slot="body">
|
||||||
|
|
||||||
<div class="control-group" :class="[errors.has('name') ? 'has-error' : '']">
|
<div class="control-group" :class="[errors.has('admin_name') ? 'has-error' : '']">
|
||||||
<label for="name">{{ __('Admin') }}</label>
|
<label for="admin_name" class="required">{{ __('admin::app.catalog.attributes.admin') }}</label>
|
||||||
<input type="text" v-validate="'required'" class="control" id="name" name="name"/>
|
<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('name')">@{{ errors.first('name') }}</span>
|
<span class="control-error" v-if="errors.has('admin_name')">@{{ errors.first('admin_name') }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@foreach(Webkul\Core\Models\Locale::all() as $locale)
|
@foreach(Webkul\Core\Models\Locale::all() as $locale)
|
||||||
|
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label for="locale-{{ $locale->code }}">{{ $locale->name . ' (' . $locale->code . ')' }}</label>
|
<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]"/>
|
<input type="text" class="control" id="locale-{{ $locale->code }}" name="<?php echo $locale->code; ?>[name]" value="{{ old($locale->code)['name'] }}"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@endforeach
|
@endforeach
|
||||||
|
|
@ -65,13 +71,93 @@
|
||||||
</div>
|
</div>
|
||||||
</accordian>
|
</accordian>
|
||||||
|
|
||||||
<accordian :title="'{{ __('Options') }}'" :active="true" :class-name="'hide'" :id="'options'">
|
<div class="hide">
|
||||||
|
<accordian :title="'{{ __('admin::app.catalog.attributes.options') }}'" :active="true" :id="'options'">
|
||||||
|
<div slot="body">
|
||||||
|
|
||||||
|
<option-wrapper></option-wrapper>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</accordian>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<accordian :title="'{{ __('admin::app.catalog.attributes.validations') }}'" :active="true">
|
||||||
|
<div slot="body">
|
||||||
|
|
||||||
|
<div class="control-group">
|
||||||
|
<label for="is_required">{{ __('admin::app.catalog.attributes.is_required') }}</label>
|
||||||
|
<select class="control" id="is_required" name="is_required">
|
||||||
|
<option value="0">{{ __('admin::app.catalog.attributes.no') }}</option>
|
||||||
|
<option value="1">{{ __('admin::app.catalog.attributes.yes') }}</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="control-group">
|
||||||
|
<label for="is_unique">{{ __('admin::app.catalog.attributes.is_unique') }}</label>
|
||||||
|
<select class="control" id="is_unique" name="is_unique">
|
||||||
|
<option value="0">{{ __('admin::app.catalog.attributes.no') }}</option>
|
||||||
|
<option value="1">{{ __('admin::app.catalog.attributes.yes') }}</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="control-group">
|
||||||
|
<label for="validation">{{ __('admin::app.catalog.attributes.input_validation') }}</label>
|
||||||
|
<select class="control" id="validation" name="validation">
|
||||||
|
<option value=""></option>
|
||||||
|
<option value="number">{{ __('admin::app.catalog.attributes.number') }}</option>
|
||||||
|
<option value="decimal">{{ __('admin::app.catalog.attributes.decimal') }}</option>
|
||||||
|
<option value="email">{{ __('admin::app.catalog.attributes.email') }}</option>
|
||||||
|
<option value="url">{{ __('admin::app.catalog.attributes.url') }}</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
</accordian>
|
</accordian>
|
||||||
|
|
||||||
<accordian :title="'{{ __('Validations') }}'" :active="true">
|
<accordian :title="'{{ __('admin::app.catalog.attributes.configuration') }}'" :active="true">
|
||||||
</accordian>
|
<div slot="body">
|
||||||
|
|
||||||
<accordian :title="'{{ __('Configuration') }}'" :active="true">
|
<div class="control-group">
|
||||||
|
<label for="status">{{ __('admin::app.catalog.attributes.status') }}</label>
|
||||||
|
<select class="control" id="status" name="status">
|
||||||
|
<option value="1">{{ __('admin::app.catalog.attributes.yes') }}</option>
|
||||||
|
<option value="0">{{ __('admin::app.catalog.attributes.no') }}</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="control-group">
|
||||||
|
<label for="value_per_locale">{{ __('admin::app.catalog.attributes.value_per_locale') }}</label>
|
||||||
|
<select class="control" id="value_per_locale" name="value_per_locale">
|
||||||
|
<option value="0">{{ __('admin::app.catalog.attributes.no') }}</option>
|
||||||
|
<option value="1">{{ __('admin::app.catalog.attributes.yes') }}</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="control-group">
|
||||||
|
<label for="value_per_channel">{{ __('admin::app.catalog.attributes.value_per_channel') }}</label>
|
||||||
|
<select class="control" id="value_per_channel" name="value_per_channel">
|
||||||
|
<option value="0">{{ __('admin::app.catalog.attributes.no') }}</option>
|
||||||
|
<option value="1">{{ __('admin::app.catalog.attributes.yes') }}</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="control-group">
|
||||||
|
<label for="is_filterable">{{ __('admin::app.catalog.attributes.is_filterable') }}</label>
|
||||||
|
<select class="control" id="is_filterable" name="is_filterable">
|
||||||
|
<option value="0">{{ __('admin::app.catalog.attributes.no') }}</option>
|
||||||
|
<option value="1">{{ __('admin::app.catalog.attributes.yes') }}</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="control-group">
|
||||||
|
<label for="is_configurable">{{ __('admin::app.catalog.attributes.is_configurable') }}</label>
|
||||||
|
<select class="control" id="is_configurable" name="is_configurable">
|
||||||
|
<option value="0">{{ __('admin::app.catalog.attributes.no') }}</option>
|
||||||
|
<option value="1">{{ __('admin::app.catalog.attributes.yes') }}</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
</accordian>
|
</accordian>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -81,5 +167,109 @@
|
||||||
@stop
|
@stop
|
||||||
|
|
||||||
@section('javascript')
|
@section('javascript')
|
||||||
|
<script type="text/x-template" id="options-template">
|
||||||
|
<div>
|
||||||
|
<div class="table">
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
@foreach(Webkul\Core\Models\Locale::all() as $locale)
|
||||||
|
|
||||||
|
<th>{{ $locale->name . ' (' . $locale->code . ')' }}</th>
|
||||||
|
|
||||||
|
@endforeach
|
||||||
|
|
||||||
|
<th>{{ __('admin::app.catalog.attributes.position') }}</th>
|
||||||
|
|
||||||
|
<th></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
<tr v-for="row in optionRows">
|
||||||
|
@foreach(Webkul\Core\Models\Locale::all() as $locale)
|
||||||
|
<td>
|
||||||
|
<div class="control-group" :class="[errors.has(localeInputName(row, '{{ $locale->code }}')) ? 'has-error' : '']">
|
||||||
|
<input type="text" v-validate="'required'" v-model="row['{{ $locale->code }}']" :name="localeInputName(row, '{{ $locale->code }}')" class="control"/>
|
||||||
|
<span class="control-error" v-if="errors.has(localeInputName(row, '{{ $locale->code }}'))">@{{ errors.first(localeInputName(row, '{!! $locale->code !!}')) }}</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
@endforeach
|
||||||
|
|
||||||
|
<td>
|
||||||
|
<div class="control-group" :class="[errors.has(sortOrderName(row)) ? 'has-error' : '']">
|
||||||
|
<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>
|
||||||
|
|
||||||
|
<td class="actions">
|
||||||
|
<i class="icon trash-icon" @click="removeRow(row)"></i>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button type="button" class="btn btn-lg btn-primary" id="add-option-btn" style="margin-top: 20px" @click="addOptionRow()">
|
||||||
|
{{ __('admin::app.catalog.attributes.add-option-btn-title') }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$(document).ready(function () {
|
||||||
|
$('#type').on('change', function (e) {
|
||||||
|
if(['select', 'multiselect', 'checkbox'].indexOf($(e.target).val()) === -1) {
|
||||||
|
$('#options').parent().addClass('hide')
|
||||||
|
} else {
|
||||||
|
$('#options').parent().removeClass('hide')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
var optionWrapper = Vue.component('option-wrapper', {
|
||||||
|
|
||||||
|
template: '#options-template',
|
||||||
|
|
||||||
|
data: () => ({
|
||||||
|
optionRowCount: 0,
|
||||||
|
optionRows: []
|
||||||
|
}),
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
addOptionRow () {
|
||||||
|
var rowCount = this.optionRowCount++;
|
||||||
|
var row = {'id': 'option_' + rowCount};
|
||||||
|
|
||||||
|
@foreach(Webkul\Core\Models\Locale::all() as $locale)
|
||||||
|
row['{{ $locale->code }}'] = '';
|
||||||
|
@endforeach
|
||||||
|
|
||||||
|
this.optionRows.push(row);
|
||||||
|
},
|
||||||
|
|
||||||
|
removeRow (row) {
|
||||||
|
var index = this.optionRows.indexOf(row)
|
||||||
|
Vue.delete(this.optionRows, index);
|
||||||
|
},
|
||||||
|
|
||||||
|
localeInputName (row, locale) {
|
||||||
|
return 'options[' + row.id + '][' + locale + '][label]';
|
||||||
|
},
|
||||||
|
|
||||||
|
sortOrderName (row) {
|
||||||
|
return 'options[' + row.id + '][sort_order]';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
new Vue({
|
||||||
|
el: '#options',
|
||||||
|
|
||||||
|
components: {
|
||||||
|
optionWrapper: optionWrapper
|
||||||
|
},
|
||||||
|
})
|
||||||
|
});
|
||||||
|
</script>
|
||||||
@stop
|
@stop
|
||||||
|
|
@ -0,0 +1,343 @@
|
||||||
|
@extends('admin::layouts.content')
|
||||||
|
|
||||||
|
@section('page_title')
|
||||||
|
{{ __('admin::app.catalog.attributes.edit-title') }}
|
||||||
|
@stop
|
||||||
|
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<div class="content">
|
||||||
|
<form method="POST" action="{{ route('admin.catalog.attributes.update', $attribute->id) }}" @submit.prevent="onSubmit">
|
||||||
|
|
||||||
|
<div class="page-header">
|
||||||
|
<div class="page-title">
|
||||||
|
<h1>{{ __('admin::app.catalog.attributes.edit-title') }}</h1>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="page-action">
|
||||||
|
<button type="submit" class="btn btn-lg btn-primary">
|
||||||
|
{{ __('admin::app.catalog.attributes.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.attributes.general') }}'" :active="true">
|
||||||
|
<div slot="body">
|
||||||
|
<div class="control-group" :class="[errors.has('code') ? 'has-error' : '']">
|
||||||
|
<label for="code" class="required">{{ __('admin::app.catalog.attributes.code') }}</label>
|
||||||
|
<input type="text" v-validate="'required'" class="control" id="code" name="code" value="{{ $attribute->code }}" disabled="disabled"/>
|
||||||
|
<input type="hidden" name="code" value="{{ $attribute->code }}"/>
|
||||||
|
<span class="control-error" v-if="errors.has('code')">@{{ errors.first('code') }}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="control-group">
|
||||||
|
<?php $selectedOption = old('type') ?: $attribute->type ?>
|
||||||
|
<label for="type">{{ __('admin::app.catalog.attributes.type') }}</label>
|
||||||
|
<select class="control" id="type" disabled="disabled">
|
||||||
|
<option value="text" {{ $selectedOption == 'text' ? 'selected' : '' }}>
|
||||||
|
{{ __('admin::app.catalog.attributes.text') }}
|
||||||
|
</option>
|
||||||
|
<option value="textarea" {{ $selectedOption == 'textarea' ? 'selected' : '' }}>
|
||||||
|
{{ __('admin::app.catalog.attributes.textarea') }}
|
||||||
|
</option>
|
||||||
|
<option value="price" {{ $selectedOption == 'price' ? 'selected' : '' }}>
|
||||||
|
{{ __('admin::app.catalog.attributes.price') }}
|
||||||
|
</option>
|
||||||
|
<option value="boolean" {{ $selectedOption == 'boolean' ? 'selected' : '' }}>
|
||||||
|
{{ __('admin::app.catalog.attributes.boolean') }}
|
||||||
|
</option>
|
||||||
|
<option value="select" {{ $selectedOption == 'select' ? 'selected' : '' }}>
|
||||||
|
{{ __('admin::app.catalog.attributes.select') }}
|
||||||
|
</option>
|
||||||
|
<option value="multiselect" {{ $selectedOption == 'multiselect' ? 'selected' : '' }}>
|
||||||
|
{{ __('admin::app.catalog.attributes.multiselect') }}
|
||||||
|
</option>
|
||||||
|
<option value="checkbox" {{ $selectedOption == 'checkbox' ? 'selected' : '' }}>
|
||||||
|
{{ __('admin::app.catalog.attributes.checkbox') }}
|
||||||
|
</option>
|
||||||
|
<option value="datetime" {{ $selectedOption == 'datetime' ? 'selected' : '' }}>
|
||||||
|
{{ __('admin::app.catalog.attributes.datetime') }}
|
||||||
|
</option>
|
||||||
|
<option value="date" {{ $selectedOption == 'date' ? 'selected' : '' }}>
|
||||||
|
{{ __('admin::app.catalog.attributes.date') }}
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
<input type="hidden" name="type" value="{{ $attribute->type }}"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</accordian>
|
||||||
|
|
||||||
|
<accordian :title="'{{ __('admin::app.catalog.attributes.label') }}'" :active="true">
|
||||||
|
<div slot="body">
|
||||||
|
|
||||||
|
<div class="control-group" :class="[errors.has('admin_name') ? 'has-error' : '']">
|
||||||
|
<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>
|
||||||
|
|
||||||
|
@foreach(Webkul\Core\Models\Locale::all() as $locale)
|
||||||
|
|
||||||
|
<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'] }}"/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@endforeach
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</accordian>
|
||||||
|
|
||||||
|
<div class="<?php in_array($attribute->type, ['select', 'multiselect', 'checkbox']) ?: 'hide' ?>">
|
||||||
|
<accordian :title="'{{ __('admin::app.catalog.attributes.options') }}'" :active="true" :id="'options'">
|
||||||
|
<div slot="body">
|
||||||
|
|
||||||
|
<option-wrapper></option-wrapper>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</accordian>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<accordian :title="'{{ __('admin::app.catalog.attributes.validations') }}'" :active="true">
|
||||||
|
<div slot="body">
|
||||||
|
|
||||||
|
<div class="control-group">
|
||||||
|
<label for="is_required">{{ __('admin::app.catalog.attributes.is_required') }}</label>
|
||||||
|
<select class="control" id="is_required" name="is_required">
|
||||||
|
<option value="0" {{ $attribute->is_required ? '' : 'selected' }}>{{ __('admin::app.catalog.attributes.no') }}</option>
|
||||||
|
<option value="1" {{ $attribute->is_required ? 'selected' : '' }}>{{ __('admin::app.catalog.attributes.yes') }}</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="control-group">
|
||||||
|
<label for="is_unique">{{ __('admin::app.catalog.attributes.is_unique') }}</label>
|
||||||
|
<select class="control" id="is_unique" name="is_unique">
|
||||||
|
<option value="0" {{ $attribute->is_unique ? '' : 'selected' }}>
|
||||||
|
{{ __('admin::app.catalog.attributes.no') }}
|
||||||
|
</option>
|
||||||
|
<option value="1" {{ $attribute->is_unique ? 'selected' : '' }}>
|
||||||
|
{{ __('admin::app.catalog.attributes.yes') }}
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="control-group">
|
||||||
|
<?php $selectedValidation = old('input_validation') ?: $attribute->input_validation ?>
|
||||||
|
<label for="validation">{{ __('admin::app.catalog.attributes.input_validation') }}</label>
|
||||||
|
<select class="control" id="validation" name="validation">
|
||||||
|
<option value=""></option>
|
||||||
|
<option value="number" {{ $selectedValidation == 'number' ? 'selected' : '' }}>
|
||||||
|
{{ __('admin::app.catalog.attributes.number') }}
|
||||||
|
</option>
|
||||||
|
<option value="decimal" {{ $selectedValidation == 'decimal' ? 'selected' : '' }}>
|
||||||
|
{{ __('admin::app.catalog.attributes.decimal') }}
|
||||||
|
</option>
|
||||||
|
<option value="email" {{ $selectedValidation == 'email' ? 'selected' : '' }}>
|
||||||
|
{{ __('admin::app.catalog.attributes.email') }}
|
||||||
|
</option>
|
||||||
|
<option value="url" {{ $selectedValidation == 'url' ? 'selected' : '' }}>
|
||||||
|
{{ __('admin::app.catalog.attributes.url') }}
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</accordian>
|
||||||
|
|
||||||
|
<accordian :title="'{{ __('admin::app.catalog.attributes.configuration') }}'" :active="true">
|
||||||
|
<div slot="body">
|
||||||
|
|
||||||
|
<div class="control-group">
|
||||||
|
<label for="status">{{ __('admin::app.catalog.attributes.status') }}</label>
|
||||||
|
<select class="control" id="status" name="status">
|
||||||
|
<option value="1" {{ $attribute->status ? 'selected' : '' }}>
|
||||||
|
{{ __('admin::app.catalog.attributes.yes') }}
|
||||||
|
</option>
|
||||||
|
<option value="0" {{ $attribute->status ? '' : 'selected' }}>
|
||||||
|
{{ __('admin::app.catalog.attributes.no') }}
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="control-group">
|
||||||
|
<label for="value_per_locale">{{ __('admin::app.catalog.attributes.value_per_locale') }}</label>
|
||||||
|
<select class="control" id="value_per_locale" name="value_per_locale">
|
||||||
|
<option value="0" {{ $attribute->value_per_locale ? '' : 'selected' }}>
|
||||||
|
{{ __('admin::app.catalog.attributes.no') }}
|
||||||
|
</option>
|
||||||
|
<option value="1" {{ $attribute->value_per_locale ? 'selected' : '' }}>
|
||||||
|
{{ __('admin::app.catalog.attributes.yes') }}
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="control-group">
|
||||||
|
<label for="value_per_channel">{{ __('admin::app.catalog.attributes.value_per_channel') }}</label>
|
||||||
|
<select class="control" id="value_per_channel" name="value_per_channel">
|
||||||
|
<option value="0" {{ $attribute->value_per_channel ? '' : 'selected' }}>
|
||||||
|
{{ __('admin::app.catalog.attributes.no') }}
|
||||||
|
</option>
|
||||||
|
<option value="1" {{ $attribute->value_per_channel ? 'selected' : '' }}>
|
||||||
|
{{ __('admin::app.catalog.attributes.yes') }}
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="control-group">
|
||||||
|
<label for="is_filterable">{{ __('admin::app.catalog.attributes.is_filterable') }}</label>
|
||||||
|
<select class="control" id="is_filterable" name="is_filterable">
|
||||||
|
<option value="0" {{ $attribute->is_filterable ? '' : 'selected' }}>
|
||||||
|
{{ __('admin::app.catalog.attributes.no') }}
|
||||||
|
</option>
|
||||||
|
<option value="1" {{ $attribute->is_filterable ? 'selected' : '' }}>
|
||||||
|
{{ __('admin::app.catalog.attributes.yes') }}
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="control-group">
|
||||||
|
<label for="is_configurable">{{ __('admin::app.catalog.attributes.is_configurable') }}</label>
|
||||||
|
<select class="control" id="is_configurable" name="is_configurable">
|
||||||
|
<option value="0" {{ $attribute->is_configurable ? '' : 'selected' }}>
|
||||||
|
{{ __('admin::app.catalog.attributes.no') }}
|
||||||
|
</option>
|
||||||
|
<option value="1" {{ $attribute->is_configurable ? 'selected' : '' }}>
|
||||||
|
{{ __('admin::app.catalog.attributes.yes') }}
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</accordian>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
@stop
|
||||||
|
|
||||||
|
@section('javascript')
|
||||||
|
<script type="text/x-template" id="options-template">
|
||||||
|
<div>
|
||||||
|
<div class="table">
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
@foreach(Webkul\Core\Models\Locale::all() as $locale)
|
||||||
|
|
||||||
|
<th>{{ $locale->name . ' (' . $locale->code . ')' }}</th>
|
||||||
|
|
||||||
|
@endforeach
|
||||||
|
|
||||||
|
<th>{{ __('admin::app.catalog.attributes.position') }}</th>
|
||||||
|
|
||||||
|
<th></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
<tr v-for="row in optionRows">
|
||||||
|
@foreach(Webkul\Core\Models\Locale::all() as $locale)
|
||||||
|
<td>
|
||||||
|
<div class="control-group" :class="[errors.has(localeInputName(row, '{{ $locale->code }}')) ? 'has-error' : '']">
|
||||||
|
<input type="text" v-validate="'required'" v-model="row['{{ $locale->code }}']" :name="localeInputName(row, '{{ $locale->code }}')" class="control"/>
|
||||||
|
<span class="control-error" v-if="errors.has(localeInputName(row, '{{ $locale->code }}'))">@{{ errors.first(localeInputName(row, '{!! $locale->code !!}')) }}</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
@endforeach
|
||||||
|
|
||||||
|
<td>
|
||||||
|
<div class="control-group" :class="[errors.has(sortOrderName(row)) ? 'has-error' : '']">
|
||||||
|
<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>
|
||||||
|
|
||||||
|
<td class="actions">
|
||||||
|
<i class="icon trash-icon" @click="removeRow(row)"></i>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button type="button" class="btn btn-lg btn-primary" id="add-option-btn" style="margin-top: 20px" @click="addOptionRow()">
|
||||||
|
{{ __('admin::app.catalog.attributes.add-option-btn-title') }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$(document).ready(function () {
|
||||||
|
$('#type').on('change', function (e) {
|
||||||
|
if(['select', 'multiselect', 'checkbox'].indexOf($(e.target).val()) === -1) {
|
||||||
|
$('#options').parent().addClass('hide')
|
||||||
|
} else {
|
||||||
|
$('#options').parent().removeClass('hide')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
var optionWrapper = Vue.component('option-wrapper', {
|
||||||
|
|
||||||
|
template: '#options-template',
|
||||||
|
|
||||||
|
created () {
|
||||||
|
@foreach($attribute->options as $option)
|
||||||
|
this.optionRowCount++;
|
||||||
|
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'] }}";
|
||||||
|
@endforeach
|
||||||
|
|
||||||
|
this.optionRows.push(row);
|
||||||
|
@endforeach
|
||||||
|
},
|
||||||
|
|
||||||
|
data: () => ({
|
||||||
|
optionRowCount: 0,
|
||||||
|
optionRows: []
|
||||||
|
}),
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
addOptionRow () {
|
||||||
|
var rowCount = this.optionRowCount++;
|
||||||
|
var row = {'id': 'option_' + rowCount};
|
||||||
|
|
||||||
|
@foreach(Webkul\Core\Models\Locale::all() as $locale)
|
||||||
|
row['{{ $locale->code }}'] = '';
|
||||||
|
@endforeach
|
||||||
|
|
||||||
|
this.optionRows.push(row);
|
||||||
|
},
|
||||||
|
|
||||||
|
removeRow (row) {
|
||||||
|
var index = this.optionRows.indexOf(row)
|
||||||
|
Vue.delete(this.optionRows, index);
|
||||||
|
},
|
||||||
|
|
||||||
|
localeInputName (row, locale) {
|
||||||
|
return 'options[' + row.id + '][' + locale + '][label]';
|
||||||
|
},
|
||||||
|
|
||||||
|
sortOrderName (row) {
|
||||||
|
return 'options[' + row.id + '][sort_order]';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
new Vue({
|
||||||
|
el: '#options',
|
||||||
|
|
||||||
|
components: {
|
||||||
|
optionWrapper: optionWrapper
|
||||||
|
},
|
||||||
|
})
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
@stop
|
||||||
|
|
@ -0,0 +1,118 @@
|
||||||
|
@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') }}" @submit.prevent="onSubmit">
|
||||||
|
|
||||||
|
<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>
|
||||||
|
|
||||||
|
@if($categories->count())
|
||||||
|
<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>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<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,133 @@
|
||||||
|
@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()->getDefaultChannelLocaleCode(); ?>
|
||||||
|
|
||||||
|
<form method="POST" action="" @submit.prevent="onSubmit">
|
||||||
|
|
||||||
|
<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(channel()->getChannelWithLocales() as $channel)
|
||||||
|
|
||||||
|
<optgroup label="{{ $channel->name }}">
|
||||||
|
|
||||||
|
@foreach($channel->locales as $channelLocale)
|
||||||
|
<option value="{{ route('admin.catalog.categories.update', $category->id) . '?channel_locale=' . $channel->code . '-' . $channelLocale->code }}" {{ ($channel->code . '-' . $channelLocale->code) == $locale ? 'selected' : '' }}>
|
||||||
|
{{ $channelLocale->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>
|
||||||
|
|
||||||
|
@if($categories->count())
|
||||||
|
<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>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<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
|
||||||
|
|
@ -0,0 +1,343 @@
|
||||||
|
@extends('admin::layouts.content')
|
||||||
|
|
||||||
|
@section('page_title')
|
||||||
|
{{ __('admin::app.catalog.families.add-title') }}
|
||||||
|
@stop
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<div class="content">
|
||||||
|
<form method="POST" action="{{ route('admin.catalog.families.store') }}" @submit.prevent="onSubmit">
|
||||||
|
|
||||||
|
<div class="page-header">
|
||||||
|
<div class="page-title">
|
||||||
|
<h1>{{ __('admin::app.catalog.families.add-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()
|
||||||
|
|
||||||
|
<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') }}"/>
|
||||||
|
<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') }}"/>
|
||||||
|
<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>
|
||||||
|
<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()" v-if="group.is_user_defined"></i>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div slot="body">
|
||||||
|
<input type="hidden" :name="[groupInputName + '[name]']" :value="group.name ? group.name : group.groupName"/>
|
||||||
|
<input type="hidden" :name="[groupInputName + '[position]']" :value="group.position"/>
|
||||||
|
<input type="hidden" :name="[groupInputName + '[is_user_defined]']" :value="group.is_user_defined"/>
|
||||||
|
|
||||||
|
<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="[groupInputName + '[attributes][][id]']" :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)" v-if="attribute.is_user_defined"></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>
|
||||||
|
var groups = @json($attributeFamily ? $attributeFamily->attribute_groups : []);
|
||||||
|
var attributes = @json($attributes);
|
||||||
|
|
||||||
|
Vue.component('group-form', {
|
||||||
|
|
||||||
|
data: () => ({
|
||||||
|
group: {
|
||||||
|
'groupName': '',
|
||||||
|
'position': '',
|
||||||
|
'is_user_defined': 1,
|
||||||
|
'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': '', 'is_user_defined': 1, '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 () {
|
||||||
|
return "attribute_groups[group_" + this.index + "]";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
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,345 @@
|
||||||
|
@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) }}" @submit.prevent="onSubmit">
|
||||||
|
|
||||||
|
<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' : '']">
|
||||||
|
<input type="text" v-validate="'required'" name="code" class="control" id="code" value="{{ $attributeFamily->code }}" disabled="disabled"/>
|
||||||
|
<input type="hidden" name="code" value="{{ $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()" v-if="group.is_user_defined"></i>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div slot="body">
|
||||||
|
<input type="hidden" :name="[groupInputName + '[name]']" :value="group.name ? group.name : group.groupName"/>
|
||||||
|
<input type="hidden":name="[groupInputName + '[position]']" :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="[groupInputName + '[attributes][][id]']" :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)" v-if="attribute.is_user_defined"></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>
|
||||||
|
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 + "]";
|
||||||
|
|
||||||
|
return "attribute_groups[group_" + this.index + "]";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
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,21 @@
|
||||||
|
@extends('admin::layouts.content')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<div class="content">
|
||||||
|
<div class="page-header">
|
||||||
|
<div class="page-title">
|
||||||
|
{{ __('admin::app.catalog.families.families') }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="page-action">
|
||||||
|
<a href="{{ route('admin.catalog.families.create') }}" class="btn btn-lg btn-primary">
|
||||||
|
{{ __('admin::app.catalog.families.add-family-btn-title') }}
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="page-content">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@stop
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
@extends('admin::layouts.content')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<div class="content">
|
||||||
|
<div class="page-header">
|
||||||
|
<div class="page-title">
|
||||||
|
{{ __('admin::app.catalog.products.products') }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="page-action">
|
||||||
|
<a href="{{ route('admin.catalog.products.create') }}" class="btn btn-lg btn-primary">
|
||||||
|
{{ __('admin::app.catalog.products.add-product-btn-title') }}
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="page-content">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@stop
|
||||||
|
|
@ -54,5 +54,6 @@
|
||||||
|
|
||||||
@yield('javascript')
|
@yield('javascript')
|
||||||
|
|
||||||
|
<div class="modal-overlay"></div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
@ -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,114 @@
|
||||||
|
@extends('admin::layouts.content')
|
||||||
|
|
||||||
|
@section('page_title')
|
||||||
|
{{ __('admin::app.settings.channels.edit-title') }}
|
||||||
|
@stop
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<div class="content">
|
||||||
|
|
||||||
|
<form method="POST" action="{{ route('admin.channels.update', $channel->id) }}" @submit.prevent="onSubmit">
|
||||||
|
<div class="page-header">
|
||||||
|
<div class="page-title">
|
||||||
|
<h1>{{ __('admin::app.settings.channels.edit-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()
|
||||||
|
<input name="_method" type="hidden" value="PUT">
|
||||||
|
|
||||||
|
<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') ?: $channel->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') ?: $channel->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') ?: $channel->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>
|
||||||
|
<?php $selectedOptionIds = old('locales') ?: $channel->locales->pluck('id')->toArray() ?>
|
||||||
|
<select v-validate="'required'" class="control" id="locales" name="locales[]" multiple>
|
||||||
|
@foreach(core()->allLocales() as $locale)
|
||||||
|
<option value="{{ $locale->id }}" {{ in_array($locale->id, $selectedOptionIds) ? '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>
|
||||||
|
<?php $selectedOption = old('default_locale') ?: $channel->default_locale ?>
|
||||||
|
<select v-validate="'required'" class="control" id="default_locale" name="default_locale">
|
||||||
|
@foreach(core()->allLocales() as $locale)
|
||||||
|
<option value="{{ $locale->id }}" {{ $selectedOption == $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>
|
||||||
|
<?php $selectedOptionIds = old('currencies') ?: $channel->currencies->pluck('id')->toArray() ?>
|
||||||
|
<select v-validate="'required'" class="control" id="currencies" name="currencies[]" multiple>
|
||||||
|
@foreach(core()->allCurrencies() as $currency)
|
||||||
|
<option value="{{ $currency->id }}" {{ in_array($currency->id, $selectedOptionIds) ? '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>
|
||||||
|
<?php $selectedOption = old('base_currency') ?: $channel->base_currency ?>
|
||||||
|
<select v-validate="'required'" class="control" id="base_currency" name="base_currency">
|
||||||
|
@foreach(core()->allCurrencies() as $currency)
|
||||||
|
<option value="{{ $currency->id }}" {{ $selectedOption == $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')
|
@extends('admin::layouts.content')
|
||||||
|
|
||||||
|
@section('page_title')
|
||||||
|
{{ __('admin::app.settings.locales.add-locale-title') }}
|
||||||
|
@stop
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
<div class="content">
|
<div class="content">
|
||||||
|
|
||||||
<form method="POST" action="{{ route('admin.locales.store') }}" @submit.prevent="onSubmit">
|
<form method="POST" action="{{ route('admin.locales.store') }}" @submit.prevent="onSubmit">
|
||||||
<div class="page-header">
|
<div class="page-header">
|
||||||
<div class="page-title">
|
<div class="page-title">
|
||||||
<h1>{{ __('Add Locale') }}</h1>
|
<h1>{{ __('admin::app.settings.locales.add-title') }}</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="page-action">
|
<div class="page-action">
|
||||||
<button type="submit" class="btn btn-lg btn-primary">
|
<button type="submit" class="btn btn-lg btn-primary">
|
||||||
{{ __('Save Locale') }}
|
{{ __('admin::app.settings.locales.save-btn-title') }}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -20,16 +24,16 @@
|
||||||
<div class="form-container">
|
<div class="form-container">
|
||||||
@csrf()
|
@csrf()
|
||||||
|
|
||||||
<accordian :title="'{{ __('General') }}'" :active="true">
|
<accordian :title="'{{ __('admin::app.settings.locales.general') }}'" :active="true">
|
||||||
<div class="accordian-content">
|
<div slot="body">
|
||||||
<div class="control-group" :class="[errors.has('code') ? 'has-error' : '']">
|
<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"/>
|
<input v-validate="'required'" class="control" id="code" name="code"/>
|
||||||
<span class="control-error" v-if="errors.has('code')">@{{ errors.first('code') }}</span>
|
<span class="control-error" v-if="errors.has('code')">@{{ errors.first('code') }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="control-group" :class="[errors.has('name') ? 'has-error' : '']">
|
<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"/>
|
<input v-validate="'required'" class="control" id="name" name="name"/>
|
||||||
<span class="control-error" v-if="errors.has('name')">@{{ errors.first('name') }}</span>
|
<span class="control-error" v-if="errors.has('name')">@{{ errors.first('name') }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
<div class="page-action">
|
<div class="page-action">
|
||||||
<a href="{{ route('admin.locales.create') }}" class="btn btn-lg btn-primary">
|
<a href="{{ route('admin.locales.create') }}" class="btn btn-lg btn-primary">
|
||||||
{{ __('Add Locale') }}
|
{{ __('admin::app.settings.locales.add-title') }}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
@extends('admin::layouts.anonymous-master')
|
@extends('admin::layouts.anonymous-master')
|
||||||
|
|
||||||
@section('page_title')
|
@section('page_title')
|
||||||
{{ __('Forget Password') }}
|
{{ __('admin::app.users.forget-password.title') }}
|
||||||
@stop
|
@stop
|
||||||
|
|
||||||
@section('css')
|
@section('css')
|
||||||
|
|
@ -23,25 +23,25 @@
|
||||||
|
|
||||||
<div class="form-container" style="text-align: left">
|
<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">
|
<form method="POST" action="{{ route('admin.forget-password.store') }}" @submit.prevent="onSubmit">
|
||||||
@csrf
|
@csrf
|
||||||
|
|
||||||
<div class="control-group" :class="[errors.has('email') ? 'has-error' : '']">
|
<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') }}"/>
|
<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>
|
<span class="control-error" v-if="errors.has('email')">@{{ errors.first('email') }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="button-group">
|
<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>
|
||||||
|
|
||||||
<div class="control-group" style="margin-bottom: 0">
|
<div class="control-group" style="margin-bottom: 0">
|
||||||
<a href="{{ route('admin.session.create') }}">
|
<a href="{{ route('admin.session.create') }}">
|
||||||
<i class="icon primary-back-icon"></i>
|
<i class="icon primary-back-icon"></i>
|
||||||
{{ __('Back to Sign In') }}
|
{{ __('admin::app.users.forget-password.back-link-title') }}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
@extends('admin::layouts.anonymous-master')
|
@extends('admin::layouts.anonymous-master')
|
||||||
|
|
||||||
@section('page_title')
|
@section('page_title')
|
||||||
{{ __('Reset Password') }}
|
{{ __('admin::app.users.reset-password.title') }}
|
||||||
@stop
|
@stop
|
||||||
|
|
||||||
@section('css')
|
@section('css')
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
<div class="form-container" style="text-align: left">
|
<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">
|
<form method="POST" action="{{ route('admin.reset-password.store') }}" @submit.prevent="onSubmit">
|
||||||
@csrf
|
@csrf
|
||||||
|
|
@ -31,31 +31,31 @@
|
||||||
<input type="hidden" name="token" value="{{ $token }}">
|
<input type="hidden" name="token" value="{{ $token }}">
|
||||||
|
|
||||||
<div class="control-group" :class="[errors.has('email') ? 'has-error' : '']">
|
<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') }}"/>
|
<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>
|
<span class="control-error" v-if="errors.has('email')">@{{ errors.first('email') }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="control-group" :class="[errors.has('password') ? 'has-error' : '']">
|
<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"/>
|
<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>
|
<span class="control-error" v-if="errors.has('password')">@{{ errors.first('password') }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="control-group" :class="[errors.has('password_confirmation') ? 'has-error' : '']">
|
<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"/>
|
<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>
|
<span class="control-error" v-if="errors.has('password_confirmation')">@{{ errors.first('password_confirmation') }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="button-group">
|
<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>
|
||||||
|
|
||||||
<div class="control-group" style="margin-bottom: 0">
|
<div class="control-group" style="margin-bottom: 0">
|
||||||
<a href="{{ route('admin.session.create') }}">
|
<a href="{{ route('admin.session.create') }}">
|
||||||
<i class="icon primary-back-icon"></i>
|
<i class="icon primary-back-icon"></i>
|
||||||
{{ __('Back to Sign In') }}
|
{{ __('admin::app.users.reset-password.back-link-title') }}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,21 @@
|
||||||
@extends('admin::layouts.content')
|
@extends('admin::layouts.content')
|
||||||
|
|
||||||
|
@section('page_title')
|
||||||
|
{{ __('admin::app.users.roles.add-role-title') }}
|
||||||
|
@stop
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
<div class="content">
|
<div class="content">
|
||||||
|
|
||||||
<form method="POST" action="{{ route('admin.roles.store') }}" @submit.prevent="onSubmit">
|
<form method="POST" action="{{ route('admin.roles.store') }}" @submit.prevent="onSubmit">
|
||||||
<div class="page-header">
|
<div class="page-header">
|
||||||
<div class="page-title">
|
<div class="page-title">
|
||||||
<h1>{{ __('Add Role') }}</h1>
|
<h1>{{ __('admin::app.users.roles.add-role-title') }}</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="page-action">
|
<div class="page-action">
|
||||||
<button type="submit" class="btn btn-lg btn-primary">
|
<button type="submit" class="btn btn-lg btn-primary">
|
||||||
{{ __('Save Role') }}
|
{{ __('admin::app.users.roles.save-btn-title') }}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -20,28 +24,28 @@
|
||||||
<div class="form-container">
|
<div class="form-container">
|
||||||
@csrf()
|
@csrf()
|
||||||
|
|
||||||
<accordian :title="'{{ __('General') }}'" :active="true">
|
<accordian :title="'{{ __('admin::app.users.roles.general') }}'" :active="true">
|
||||||
<div class="accordian-content">
|
<div slot="body">
|
||||||
<div class="control-group" :class="[errors.has('name') ? 'has-error' : '']">
|
<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"/>
|
<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>
|
<span class="control-error" v-if="errors.has('name')">@{{ errors.first('name') }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="control-group">
|
<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>
|
<textarea class="control" id="description" name="description"></textarea>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</accordian>
|
</accordian>
|
||||||
|
|
||||||
<accordian :title="'{{ __('Access Control') }}'" :active="true">
|
<accordian :title="'{{ __('admin::app.users.roles.access-control') }}'" :active="true">
|
||||||
<div class="accordian-content">
|
<div slot="body">
|
||||||
<div class="control-group">
|
<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">
|
<select class="control" name="permission_type" id="permission_type">
|
||||||
<option value="custom">{{ __('Custom') }}</option>
|
<option value="custom">{{ __('admin::app.users.roles.custom') }}</option>
|
||||||
<option value="all">{{ __('All') }}</option>
|
<option value="all">{{ __('admin::app.users.roles.all') }}</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,21 @@
|
||||||
@extends('admin::layouts.content')
|
@extends('admin::layouts.content')
|
||||||
|
|
||||||
|
@section('page_title')
|
||||||
|
{{ __('admin::app.users.roles.edit-role-title') }}
|
||||||
|
@stop
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
<div class="content">
|
<div class="content">
|
||||||
|
|
||||||
<form method="POST" action="{{ route('admin.roles.update', $role->id) }}" @submit.prevent="onSubmit">
|
<form method="POST" action="{{ route('admin.roles.update', $role->id) }}" @submit.prevent="onSubmit">
|
||||||
<div class="page-header">
|
<div class="page-header">
|
||||||
<div class="page-title">
|
<div class="page-title">
|
||||||
<h1>{{ __('Edit Role') }}</h1>
|
<h1>{{ __('admin::app.users.roles.edit-role-title') }}</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="page-action">
|
<div class="page-action">
|
||||||
<button type="submit" class="btn btn-lg btn-primary">
|
<button type="submit" class="btn btn-lg btn-primary">
|
||||||
{{ __('Save Role') }}
|
{{ __('admin::app.users.roles.save-btn-title') }}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -22,28 +26,28 @@
|
||||||
|
|
||||||
<input name="_method" type="hidden" value="PUT">
|
<input name="_method" type="hidden" value="PUT">
|
||||||
|
|
||||||
<accordian :title="'{{ __('General') }}'" :active="true">
|
<accordian :title="'{{ __('admin::app.users.roles.general') }}'" :active="true">
|
||||||
<div class="accordian-content">
|
<div slot="body">
|
||||||
<div class="control-group" :class="[errors.has('name') ? 'has-error' : '']">
|
<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 }}"/>
|
<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>
|
<span class="control-error" v-if="errors.has('name')">@{{ errors.first('name') }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="control-group">
|
<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>
|
<textarea class="control" id="description" name="description">{{ $role->description }}</textarea>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</accordian>
|
</accordian>
|
||||||
|
|
||||||
<accordian :title="'{{ __('Access Control') }}'" :active="true">
|
<accordian :title="'{{ __('admin::app.users.roles.access-control') }}'" :active="true">
|
||||||
<div class="accordian-content">
|
<div slot="body">
|
||||||
<div class="control-group">
|
<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">
|
<select class="control" name="permission_type" id="permission_type">
|
||||||
<option value="custom" {{ $role->permission_type == 'custom' ? 'selected' : '' }}>{{ __('Custom') }}</option>
|
<option value="custom" {{ $role->permission_type == 'custom' ? 'selected' : '' }}>{{ __('admin::app.users.roles.custom') }}</option>
|
||||||
<option value="all" {{ $role->permission_type == 'all' ? 'selected' : '' }}>{{ __('All') }}</option>
|
<option value="all" {{ $role->permission_type == 'all' ? 'selected' : '' }}>{{ __('admin::app.users.roles.all') }}</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
@extends('admin::layouts.anonymous-master')
|
@extends('admin::layouts.anonymous-master')
|
||||||
|
|
||||||
@section('page_title')
|
@section('page_title')
|
||||||
{{ __('Sign In') }}
|
{{ __('admin::app.users.sessions.title') }}
|
||||||
@stop
|
@stop
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
|
|
@ -12,37 +12,37 @@
|
||||||
|
|
||||||
<div class="form-container" style="text-align: left">
|
<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">
|
<form method="POST" action="login" @submit.prevent="onSubmit">
|
||||||
@csrf
|
@csrf
|
||||||
|
|
||||||
<div class="control-group" :class="[errors.has('email') ? 'has-error' : '']">
|
<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"/>
|
<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>
|
<span class="control-error" v-if="errors.has('email')">@{{ errors.first('email') }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="control-group" :class="[errors.has('password') ? 'has-error' : '']">
|
<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"/>
|
<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>
|
<span class="control-error" v-if="errors.has('password')">@{{ errors.first('password') }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="control-group">
|
<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>
|
||||||
|
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<span class="checkbox">
|
<span class="checkbox">
|
||||||
<input type="checkbox" id="remember" name="remember" value="1">
|
<input type="checkbox" id="remember" name="remember" value="1">
|
||||||
<label class="checkbox-view" for="remember"></label>
|
<label class="checkbox-view" for="remember"></label>
|
||||||
{{ __('Remember me') }}
|
{{ __('admin::app.users.sessions.remember-me') }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="button-group">
|
<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>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,20 @@
|
||||||
@extends('admin::layouts.content')
|
@extends('admin::layouts.content')
|
||||||
|
|
||||||
|
@section('page_title')
|
||||||
|
{{ __('admin::app.users.users.add-user-title') }}
|
||||||
|
@stop
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<form method="POST" action="{{ route('admin.users.store') }}" @submit.prevent="onSubmit">
|
<form method="POST" action="{{ route('admin.users.store') }}" @submit.prevent="onSubmit">
|
||||||
<div class="page-header">
|
<div class="page-header">
|
||||||
<div class="page-title">
|
<div class="page-title">
|
||||||
<h1>{{ __('Add User') }}</h1>
|
<h1>{{ __('admin::app.users.users.add-user-title') }}</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="page-action">
|
<div class="page-action">
|
||||||
<button type="submit" class="btn btn-lg btn-primary">
|
<button type="submit" class="btn btn-lg btn-primary">
|
||||||
{{ __('Save User') }}
|
{{ __('admin::app.users.users.save-btn-title') }}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -19,16 +23,16 @@
|
||||||
<div class="form-container">
|
<div class="form-container">
|
||||||
@csrf()
|
@csrf()
|
||||||
|
|
||||||
<accordian :title="'{{ __('General') }}'" :active="true">
|
<accordian :title="'{{ __('admin::app.users.users.general') }}'" :active="true">
|
||||||
<div class="accordian-content">
|
<div slot="body">
|
||||||
<div class="control-group" :class="[errors.has('name') ? 'has-error' : '']">
|
<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"/>
|
<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>
|
<span class="control-error" v-if="errors.has('name')">@{{ errors.first('name') }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="control-group" :class="[errors.has('email') ? 'has-error' : '']">
|
<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"/>
|
<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>
|
<span class="control-error" v-if="errors.has('email')">@{{ errors.first('email') }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -36,25 +40,25 @@
|
||||||
</accordian>
|
</accordian>
|
||||||
|
|
||||||
<accordian :title="'{{ __('Password') }}'" :active="true">
|
<accordian :title="'{{ __('Password') }}'" :active="true">
|
||||||
<div class="accordian-content">
|
<div slot="body">
|
||||||
<div class="control-group" :class="[errors.has('password') ? 'has-error' : '']">
|
<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"/>
|
<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>
|
<span class="control-error" v-if="errors.has('password')">@{{ errors.first('password') }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="control-group" :class="[errors.has('password_confirmation') ? 'has-error' : '']">
|
<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"/>
|
<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>
|
<span class="control-error" v-if="errors.has('password_confirmation')">@{{ errors.first('password_confirmation') }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</accordian>
|
</accordian>
|
||||||
|
|
||||||
<accordian :title="'{{ __('Status and Role') }}'" :active="true">
|
<accordian :title="'{{ __('admin::app.users.users.status-and-role') }}'" :active="true">
|
||||||
<div class="accordian-content">
|
<div slot="body">
|
||||||
<div class="control-group" :class="[errors.has('role_id') ? 'has-error' : '']">
|
<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">
|
<select v-validate="'required'" class="control" name="role_id">
|
||||||
@foreach($roles as $role)
|
@foreach($roles as $role)
|
||||||
<option value="{{ $role->id }}">{{ $role->name }}</option>
|
<option value="{{ $role->id }}">{{ $role->name }}</option>
|
||||||
|
|
@ -64,11 +68,11 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label for="status">{{ __('Status') }}</label>
|
<label for="status">{{ __('admin::app.users.users.status') }}</label>
|
||||||
<span class="checkbox">
|
<span class="checkbox">
|
||||||
<input type="checkbox" id="status" name="status" value="1">
|
<input type="checkbox" id="status" name="status" value="1">
|
||||||
<label class="checkbox-view" for="status"></label>
|
<label class="checkbox-view" for="status"></label>
|
||||||
{{ __('Account is Active') }}
|
{{ __('admin::app.users.users.account-is-active') }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,21 @@
|
||||||
@extends('admin::layouts.content')
|
@extends('admin::layouts.content')
|
||||||
|
|
||||||
|
@section('page_title')
|
||||||
|
{{ __('admin::app.users.users.edit-user-title') }}
|
||||||
|
@stop
|
||||||
|
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<form method="POST" action="{{ route('admin.users.update', $user->id) }}" @submit.prevent="onSubmit">
|
<form method="POST" action="{{ route('admin.users.update', $user->id) }}" @submit.prevent="onSubmit">
|
||||||
<div class="page-header">
|
<div class="page-header">
|
||||||
<div class="page-title">
|
<div class="page-title">
|
||||||
<h1>{{ __('Edit User') }}</h1>
|
<h1>{{ __('admin::app.users.users.edit-user-title') }}</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="page-action">
|
<div class="page-action">
|
||||||
<button type="submit" class="btn btn-lg btn-primary">
|
<button type="submit" class="btn btn-lg btn-primary">
|
||||||
{{ __('Save User') }}
|
{{ __('admin::app.users.users.save-btn-title') }}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -20,42 +25,42 @@
|
||||||
@csrf()
|
@csrf()
|
||||||
<input name="_method" type="hidden" value="PUT">
|
<input name="_method" type="hidden" value="PUT">
|
||||||
|
|
||||||
<accordian :title="'{{ __('General') }}'" :active="true">
|
<accordian :title="'{{ __('admin::app.users.users.general') }}'" :active="true">
|
||||||
<div class="accordian-content">
|
<div slot="body">
|
||||||
<div class="control-group" :class="[errors.has('name') ? 'has-error' : '']">
|
<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 }}"/>
|
<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>
|
<span class="control-error" v-if="errors.has('name')">@{{ errors.first('name') }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="control-group" :class="[errors.has('email') ? 'has-error' : '']">
|
<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 }}"/>
|
<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>
|
<span class="control-error" v-if="errors.has('email')">@{{ errors.first('email') }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</accordian>
|
</accordian>
|
||||||
|
|
||||||
<accordian :title="'{{ __('Password') }}'" :active="true">
|
<accordian :title="'{{ __('admin::app.users.users.password') }}'" :active="true">
|
||||||
<div class="accordian-content">
|
<div slot="body">
|
||||||
<div class="control-group" :class="[errors.has('password') ? 'has-error' : '']">
|
<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"/>
|
<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>
|
<span class="control-error" v-if="errors.has('password')">@{{ errors.first('password') }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="control-group" :class="[errors.has('password_confirmation') ? 'has-error' : '']">
|
<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"/>
|
<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>
|
<span class="control-error" v-if="errors.has('password_confirmation')">@{{ errors.first('password_confirmation') }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</accordian>
|
</accordian>
|
||||||
|
|
||||||
<accordian :title="'{{ __('Status and Role') }}'" :active="true">
|
<accordian :title="'{{ __('admin::app.users.users.status-and-role') }}'" :active="true">
|
||||||
<div class="accordian-content">
|
<div slot="body">
|
||||||
<div class="control-group" :class="[errors.has('role_id') ? 'has-error' : '']">
|
<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">
|
<select v-validate="'required'" class="control" name="role_id">
|
||||||
@foreach($roles as $role)
|
@foreach($roles as $role)
|
||||||
<option value="{{ $role->id }}" {{ $user->role_id == $role->id ? 'selected' : '' }}>{{ $role->name }}</option>
|
<option value="{{ $role->id }}" {{ $user->role_id == $role->id ? 'selected' : '' }}>{{ $role->name }}</option>
|
||||||
|
|
@ -65,11 +70,11 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label for="status">{{ __('Status') }}</label>
|
<label for="status">{{ __('admin::app.users.users.status') }}</label>
|
||||||
<span class="checkbox">
|
<span class="checkbox">
|
||||||
<input type="checkbox" id="status" name="status" value="{{ $user->status }}" {{ $user->status ? 'checked' : '' }}>
|
<input type="checkbox" id="status" name="status" value="{{ $user->status }}" {{ $user->status ? 'checked' : '' }}>
|
||||||
<label class="checkbox-view" for="status"></label>
|
<label class="checkbox-view" for="status"></label>
|
||||||
{{ __('Account is Active') }}
|
{{ __('admin::app.users.users.account-is-active') }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,8 @@
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
"nwidart/laravel-modules": "^3.2"
|
"nwidart/laravel-modules": "^3.2",
|
||||||
|
"webkul/laravel-core": "dev-master"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
|
|
|
||||||
|
|
@ -16,16 +16,16 @@ class CreateAttributesTable extends Migration
|
||||||
Schema::create('attributes', function (Blueprint $table) {
|
Schema::create('attributes', function (Blueprint $table) {
|
||||||
$table->increments('id');
|
$table->increments('id');
|
||||||
$table->string('code')->unique();
|
$table->string('code')->unique();
|
||||||
$table->string('name');
|
$table->string('admin_name');
|
||||||
$table->string('type');
|
$table->string('type');
|
||||||
$table->string('validation')->nullable();
|
$table->string('validation')->nullable();
|
||||||
$table->integer('position')->nullable();
|
$table->integer('position')->nullable();
|
||||||
$table->boolean('is_required');
|
$table->boolean('is_required')->default(0);
|
||||||
$table->boolean('is_unique');
|
$table->boolean('is_unique')->default(0);
|
||||||
$table->boolean('value_per_locale');
|
$table->boolean('value_per_locale')->default(0);
|
||||||
$table->boolean('value_per_channel');
|
$table->boolean('value_per_channel')->default(0);
|
||||||
$table->boolean('is_filterable');
|
$table->boolean('is_filterable')->default(0);
|
||||||
$table->boolean('is_configurable');
|
$table->boolean('is_configurable')->default(0);
|
||||||
$table->boolean('is_user_defined')->default(1);
|
$table->boolean('is_user_defined')->default(1);
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -15,12 +15,10 @@ class CreateAttributeFamiliesTable extends Migration
|
||||||
{
|
{
|
||||||
Schema::create('attribute_families', function (Blueprint $table) {
|
Schema::create('attribute_families', function (Blueprint $table) {
|
||||||
$table->increments('id');
|
$table->increments('id');
|
||||||
|
$table->string('code');
|
||||||
$table->string('name');
|
$table->string('name');
|
||||||
$table->boolean('status')->default(0);
|
$table->boolean('status')->default(0);
|
||||||
});
|
$table->boolean('is_user_defined')->default(1);
|
||||||
|
|
||||||
Schema::table('attribute_groups', function($table) {
|
|
||||||
$table->foreign('attribute_family_id')->references('id')->on('attribute_families')->onDelete('cascade');
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -16,10 +16,20 @@ class CreateAttributeGroupsTable extends Migration
|
||||||
Schema::create('attribute_groups', function (Blueprint $table) {
|
Schema::create('attribute_groups', function (Blueprint $table) {
|
||||||
$table->increments('id');
|
$table->increments('id');
|
||||||
$table->string('name');
|
$table->string('name');
|
||||||
$table->timestamps();
|
$table->integer('position');
|
||||||
$table->integer('sort_order');
|
$table->boolean('is_user_defined')->default(1);
|
||||||
$table->integer('attribute_family_id')->unsigned();
|
$table->integer('attribute_family_id')->unsigned();
|
||||||
$table->unique(['attribute_family_id', 'name']);
|
$table->unique(['attribute_family_id', 'name']);
|
||||||
|
$table->foreign('attribute_family_id')->references('id')->on('attribute_families')->onDelete('cascade');
|
||||||
|
});
|
||||||
|
|
||||||
|
Schema::create('attribute_group_mappings', function (Blueprint $table) {
|
||||||
|
$table->integer('attribute_id')->unsigned();
|
||||||
|
$table->integer('attribute_group_id')->unsigned();
|
||||||
|
$table->integer('position')->nullable();
|
||||||
|
$table->primary(['attribute_id', 'attribute_group_id']);
|
||||||
|
$table->foreign('attribute_id')->references('id')->on('attributes')->onDelete('cascade');
|
||||||
|
$table->foreign('attribute_group_id')->references('id')->on('attribute_groups')->onDelete('cascade');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -31,5 +41,7 @@ class CreateAttributeGroupsTable extends Migration
|
||||||
public function down()
|
public function down()
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('attribute_groups');
|
Schema::dropIfExists('attribute_groups');
|
||||||
|
|
||||||
|
Schema::dropIfExists('attribute_group_mappings');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,10 +15,8 @@ class CreateAttributeOptionsTable extends Migration
|
||||||
{
|
{
|
||||||
Schema::create('attribute_options', function (Blueprint $table) {
|
Schema::create('attribute_options', function (Blueprint $table) {
|
||||||
$table->increments('id');
|
$table->increments('id');
|
||||||
$table->string('code');
|
$table->integer('sort_order')->nullable();
|
||||||
$table->integer('sort_order');
|
|
||||||
$table->integer('attribute_id')->unsigned();
|
$table->integer('attribute_id')->unsigned();
|
||||||
$table->unique(['attribute_id', 'code']);
|
|
||||||
$table->foreign('attribute_id')->references('id')->on('attributes')->onDelete('cascade');
|
$table->foreign('attribute_id')->references('id')->on('attributes')->onDelete('cascade');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,140 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Webkul\Attribute\Database\Seeders;
|
||||||
|
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
use Webkul\Attribute\Repositories\AttributeFamilyRepository;
|
||||||
|
|
||||||
|
class AttributeFamilyTableSeeder extends Seeder
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $rawData = [
|
||||||
|
[
|
||||||
|
"code" => "default",
|
||||||
|
"name" => "Default",
|
||||||
|
"is_user_defined" => 0,
|
||||||
|
'attribute_groups' => [
|
||||||
|
[
|
||||||
|
"name" => "General",
|
||||||
|
"is_user_defined" => 0,
|
||||||
|
"position" => 1,
|
||||||
|
"attributes" => [
|
||||||
|
[
|
||||||
|
'code' => 'name',
|
||||||
|
'position' => 1
|
||||||
|
], [
|
||||||
|
'code' => 'url_key',
|
||||||
|
'position' => 2
|
||||||
|
], [
|
||||||
|
'code' => 'new_from',
|
||||||
|
'position' => 3
|
||||||
|
], [
|
||||||
|
'code' => 'new_to',
|
||||||
|
'position' => 4
|
||||||
|
], [
|
||||||
|
'code' => 'status',
|
||||||
|
'position' => 5
|
||||||
|
]
|
||||||
|
]
|
||||||
|
], [
|
||||||
|
"name" => "Description",
|
||||||
|
"is_user_defined" => 0,
|
||||||
|
"position" => 2,
|
||||||
|
"attributes" => [
|
||||||
|
[
|
||||||
|
'code' => 'short_description',
|
||||||
|
'position' => 1
|
||||||
|
], [
|
||||||
|
'code' => 'description',
|
||||||
|
'position' => 2
|
||||||
|
]
|
||||||
|
]
|
||||||
|
], [
|
||||||
|
"name" => "Meta Description",
|
||||||
|
"is_user_defined" => 0,
|
||||||
|
"position" => 3,
|
||||||
|
"attributes" => [
|
||||||
|
[
|
||||||
|
'code' => 'meta_title',
|
||||||
|
'position' => 1
|
||||||
|
], [
|
||||||
|
'code' => 'meta_keywords',
|
||||||
|
'position' => 2
|
||||||
|
], [
|
||||||
|
'code' => 'meta_description',
|
||||||
|
'position' => 3
|
||||||
|
]
|
||||||
|
]
|
||||||
|
], [
|
||||||
|
"name" => "Price",
|
||||||
|
"is_user_defined" => 0,
|
||||||
|
"position" => 4,
|
||||||
|
"attributes" => [
|
||||||
|
[
|
||||||
|
'code' => 'price',
|
||||||
|
'position' => 1
|
||||||
|
], [
|
||||||
|
'code' => 'cost',
|
||||||
|
'position' => 2
|
||||||
|
], [
|
||||||
|
'code' => 'special_price',
|
||||||
|
'position' => 3
|
||||||
|
], [
|
||||||
|
'code' => 'special_price_from',
|
||||||
|
'position' => 4
|
||||||
|
], [
|
||||||
|
'code' => 'special_price_to',
|
||||||
|
'position' => 5
|
||||||
|
]
|
||||||
|
]
|
||||||
|
], [
|
||||||
|
"name" => "Shipping",
|
||||||
|
"is_user_defined" => 0,
|
||||||
|
"position" => 5,
|
||||||
|
"attributes" => [
|
||||||
|
[
|
||||||
|
'code' => 'width',
|
||||||
|
'position' => 1
|
||||||
|
], [
|
||||||
|
'code' => 'height',
|
||||||
|
'position' => 2
|
||||||
|
], [
|
||||||
|
'code' => 'depth',
|
||||||
|
'position' => 3
|
||||||
|
], [
|
||||||
|
'code' => 'weight',
|
||||||
|
'position' => 4
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AttributeFamilyRepository object
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $attributeFamily;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new controller instance.
|
||||||
|
*
|
||||||
|
* @param Webkul\Attribute\Repositories\AttributeFamilyRepository $attributeFamily
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct(AttributeFamilyRepository $attributeFamily)
|
||||||
|
{
|
||||||
|
$this->attributeFamily = $attributeFamily;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function run()
|
||||||
|
{
|
||||||
|
foreach($this->rawData as $row) {
|
||||||
|
$this->attributeFamily->create($row);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,391 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Webkul\Attribute\Database\Seeders;
|
||||||
|
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
use Webkul\Attribute\Repositories\AttributeRepository;
|
||||||
|
|
||||||
|
class AttributeTableSeeder extends Seeder
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $rawData = [
|
||||||
|
[
|
||||||
|
'code' => 'name',
|
||||||
|
'admin_name' => 'Name',
|
||||||
|
'en' => [
|
||||||
|
'name' => 'Name'
|
||||||
|
],
|
||||||
|
'type' => 'text',
|
||||||
|
'position' => 1,
|
||||||
|
'is_required' => 1,
|
||||||
|
'value_per_locale' => 1,
|
||||||
|
'value_per_channel' => 1,
|
||||||
|
'is_filterable' => 1,
|
||||||
|
'is_configurable' => 0,
|
||||||
|
'is_user_defined' => 0
|
||||||
|
], [
|
||||||
|
'code' => 'url_key',
|
||||||
|
'admin_name' => 'URL Key',
|
||||||
|
'en' => [
|
||||||
|
'name' => 'URL Key'
|
||||||
|
],
|
||||||
|
'type' => 'text',
|
||||||
|
'position' => 2,
|
||||||
|
'is_unique' => 1,
|
||||||
|
'is_required' => 1,
|
||||||
|
'value_per_locale' => 0,
|
||||||
|
'value_per_channel' => 0,
|
||||||
|
'is_filterable' => 0,
|
||||||
|
'is_configurable' => 0,
|
||||||
|
'is_user_defined' => 0
|
||||||
|
], [
|
||||||
|
'code' => 'new_from',
|
||||||
|
'admin_name' => 'New From',
|
||||||
|
'en' => [
|
||||||
|
'name' => 'New From'
|
||||||
|
],
|
||||||
|
'type' => 'datetime',
|
||||||
|
'position' => 3,
|
||||||
|
'is_required' => 0,
|
||||||
|
'value_per_locale' => 0,
|
||||||
|
'value_per_channel' => 0,
|
||||||
|
'is_filterable' => 0,
|
||||||
|
'is_configurable' => 0,
|
||||||
|
'is_user_defined' => 0
|
||||||
|
], [
|
||||||
|
'code' => 'new_to',
|
||||||
|
'admin_name' => 'New To',
|
||||||
|
'en' => [
|
||||||
|
'name' => 'New To'
|
||||||
|
],
|
||||||
|
'type' => 'datetime',
|
||||||
|
'position' => 4,
|
||||||
|
'is_required' => 0,
|
||||||
|
'value_per_locale' => 0,
|
||||||
|
'value_per_channel' => 0,
|
||||||
|
'is_filterable' => 0,
|
||||||
|
'is_configurable' => 0,
|
||||||
|
'is_user_defined' => 0
|
||||||
|
], [
|
||||||
|
'code' => 'status',
|
||||||
|
'admin_name' => 'Status',
|
||||||
|
'en' => [
|
||||||
|
'name' => 'Status'
|
||||||
|
],
|
||||||
|
'type' => 'boolean',
|
||||||
|
'position' => 5,
|
||||||
|
'is_required' => 1,
|
||||||
|
'value_per_locale' => 0,
|
||||||
|
'value_per_channel' => 0,
|
||||||
|
'is_filterable' => 0,
|
||||||
|
'is_configurable' => 0,
|
||||||
|
'is_user_defined' => 0
|
||||||
|
], [
|
||||||
|
'code' => 'short_description',
|
||||||
|
'admin_name' => 'Short Description',
|
||||||
|
'en' => [
|
||||||
|
'name' => 'Short Description'
|
||||||
|
],
|
||||||
|
'type' => 'textarea',
|
||||||
|
'position' => 6,
|
||||||
|
'is_required' => 1,
|
||||||
|
'value_per_locale' => 1,
|
||||||
|
'value_per_channel' => 1,
|
||||||
|
'is_filterable' => 0,
|
||||||
|
'is_configurable' => 0,
|
||||||
|
'is_user_defined' => 0
|
||||||
|
], [
|
||||||
|
'code' => 'description',
|
||||||
|
'admin_name' => 'Description',
|
||||||
|
'en' => [
|
||||||
|
'name' => 'Description'
|
||||||
|
],
|
||||||
|
'type' => 'textarea',
|
||||||
|
'position' => 7,
|
||||||
|
'is_required' => 1,
|
||||||
|
'value_per_locale' => 1,
|
||||||
|
'value_per_channel' => 1,
|
||||||
|
'is_filterable' => 0,
|
||||||
|
'is_configurable' => 0,
|
||||||
|
'is_user_defined' => 0
|
||||||
|
], [
|
||||||
|
'code' => 'price',
|
||||||
|
'admin_name' => 'Price',
|
||||||
|
'en' => [
|
||||||
|
'name' => 'Price'
|
||||||
|
],
|
||||||
|
'type' => 'price',
|
||||||
|
'position' => 8,
|
||||||
|
'is_required' => 1,
|
||||||
|
'value_per_locale' => 0,
|
||||||
|
'value_per_channel' => 0,
|
||||||
|
'is_filterable' => 1,
|
||||||
|
'is_configurable' => 0,
|
||||||
|
'is_user_defined' => 0
|
||||||
|
], [
|
||||||
|
'code' => 'cost',
|
||||||
|
'admin_name' => 'Cost',
|
||||||
|
'en' => [
|
||||||
|
'name' => 'Cost'
|
||||||
|
],
|
||||||
|
'type' => 'price',
|
||||||
|
'position' => 9,
|
||||||
|
'is_required' => 0,
|
||||||
|
'value_per_locale' => 0,
|
||||||
|
'value_per_channel' => 0,
|
||||||
|
'is_filterable' => 0,
|
||||||
|
'is_configurable' => 0,
|
||||||
|
'is_user_defined' => 1
|
||||||
|
], [
|
||||||
|
'code' => 'special_price',
|
||||||
|
'admin_name' => 'Special Price',
|
||||||
|
'en' => [
|
||||||
|
'name' => 'Special Price'
|
||||||
|
],
|
||||||
|
'type' => 'price',
|
||||||
|
'position' => 10,
|
||||||
|
'is_required' => 0,
|
||||||
|
'value_per_locale' => 0,
|
||||||
|
'value_per_channel' => 0,
|
||||||
|
'is_filterable' => 0,
|
||||||
|
'is_configurable' => 0,
|
||||||
|
'is_user_defined' => 0
|
||||||
|
], [
|
||||||
|
'code' => 'special_price_from',
|
||||||
|
'admin_name' => 'Special Price From',
|
||||||
|
'en' => [
|
||||||
|
'name' => 'Special Price From'
|
||||||
|
],
|
||||||
|
'type' => 'datetime',
|
||||||
|
'position' => 11,
|
||||||
|
'is_required' => 0,
|
||||||
|
'value_per_locale' => 0,
|
||||||
|
'value_per_channel' => 0,
|
||||||
|
'is_filterable' => 0,
|
||||||
|
'is_configurable' => 0,
|
||||||
|
'is_user_defined' => 0
|
||||||
|
], [
|
||||||
|
'code' => 'special_price_to',
|
||||||
|
'admin_name' => 'Special Price To',
|
||||||
|
'en' => [
|
||||||
|
'name' => 'Special Price To'
|
||||||
|
],
|
||||||
|
'type' => 'datetime',
|
||||||
|
'position' => 12,
|
||||||
|
'is_required' => 0,
|
||||||
|
'value_per_locale' => 0,
|
||||||
|
'value_per_channel' => 0,
|
||||||
|
'is_filterable' => 0,
|
||||||
|
'is_configurable' => 0,
|
||||||
|
'is_user_defined' => 0
|
||||||
|
], [
|
||||||
|
'code' => 'meta_title',
|
||||||
|
'admin_name' => 'Meta Title',
|
||||||
|
'en' => [
|
||||||
|
'name' => 'Meta Description'
|
||||||
|
],
|
||||||
|
'type' => 'textarea',
|
||||||
|
'position' => 13,
|
||||||
|
'is_required' => 0,
|
||||||
|
'value_per_locale' => 1,
|
||||||
|
'value_per_channel' => 1,
|
||||||
|
'is_filterable' => 0,
|
||||||
|
'is_configurable' => 0,
|
||||||
|
'is_user_defined' => 0
|
||||||
|
], [
|
||||||
|
'code' => 'meta_keywords',
|
||||||
|
'admin_name' => 'Meta Keywords',
|
||||||
|
'en' => [
|
||||||
|
'name' => 'Meta Keywords'
|
||||||
|
],
|
||||||
|
'type' => 'textarea',
|
||||||
|
'position' => 14,
|
||||||
|
'is_required' => 0,
|
||||||
|
'value_per_locale' => 1,
|
||||||
|
'value_per_channel' => 1,
|
||||||
|
'is_filterable' => 0,
|
||||||
|
'is_configurable' => 0,
|
||||||
|
'is_user_defined' => 0
|
||||||
|
], [
|
||||||
|
'code' => 'meta_description',
|
||||||
|
'admin_name' => 'Meta Description',
|
||||||
|
'en' => [
|
||||||
|
'name' => 'Meta Description'
|
||||||
|
],
|
||||||
|
'type' => 'textarea',
|
||||||
|
'position' => 15,
|
||||||
|
'is_required' => 0,
|
||||||
|
'value_per_locale' => 1,
|
||||||
|
'value_per_channel' => 1,
|
||||||
|
'is_filterable' => 0,
|
||||||
|
'is_configurable' => 0,
|
||||||
|
'is_user_defined' => 1
|
||||||
|
], [
|
||||||
|
'code' => 'width',
|
||||||
|
'admin_name' => 'Width',
|
||||||
|
'en' => [
|
||||||
|
'name' => 'Width'
|
||||||
|
],
|
||||||
|
'type' => 'text',
|
||||||
|
'validation' => 'number',
|
||||||
|
'position' => 16,
|
||||||
|
'is_required' => 0,
|
||||||
|
'value_per_locale' => 0,
|
||||||
|
'value_per_channel' => 0,
|
||||||
|
'is_filterable' => 0,
|
||||||
|
'is_configurable' => 0,
|
||||||
|
'is_user_defined' => 1
|
||||||
|
], [
|
||||||
|
'code' => 'height',
|
||||||
|
'admin_name' => 'Height',
|
||||||
|
'en' => [
|
||||||
|
'name' => 'Height'
|
||||||
|
],
|
||||||
|
'type' => 'text',
|
||||||
|
'validation' => 'number',
|
||||||
|
'position' => 17,
|
||||||
|
'is_required' => 0,
|
||||||
|
'value_per_locale' => 0,
|
||||||
|
'value_per_channel' => 0,
|
||||||
|
'is_filterable' => 0,
|
||||||
|
'is_configurable' => 0,
|
||||||
|
'is_user_defined' => 1
|
||||||
|
], [
|
||||||
|
'code' => 'depth',
|
||||||
|
'admin_name' => 'Depth',
|
||||||
|
'en' => [
|
||||||
|
'name' => 'Depth'
|
||||||
|
],
|
||||||
|
'type' => 'text',
|
||||||
|
'validation' => 'number',
|
||||||
|
'position' => 18,
|
||||||
|
'is_required' => 0,
|
||||||
|
'value_per_locale' => 0,
|
||||||
|
'value_per_channel' => 0,
|
||||||
|
'is_filterable' => 0,
|
||||||
|
'is_configurable' => 0,
|
||||||
|
'is_user_defined' => 1
|
||||||
|
], [
|
||||||
|
'code' => 'weight',
|
||||||
|
'admin_name' => 'Weight',
|
||||||
|
'en' => [
|
||||||
|
'name' => 'Weight'
|
||||||
|
],
|
||||||
|
'type' => 'text',
|
||||||
|
'validation' => 'number',
|
||||||
|
'position' => 19,
|
||||||
|
'is_required' => 1,
|
||||||
|
'value_per_locale' => 0,
|
||||||
|
'value_per_channel' => 0,
|
||||||
|
'is_filterable' => 0,
|
||||||
|
'is_configurable' => 0,
|
||||||
|
'is_user_defined' => 0
|
||||||
|
], [
|
||||||
|
'code' => 'color',
|
||||||
|
'admin_name' => 'Color',
|
||||||
|
'en' => [
|
||||||
|
'name' => 'Color'
|
||||||
|
],
|
||||||
|
'type' => 'select',
|
||||||
|
'position' => 20,
|
||||||
|
'is_required' => 0,
|
||||||
|
'value_per_locale' => 0,
|
||||||
|
'value_per_channel' => 0,
|
||||||
|
'is_filterable' => 1,
|
||||||
|
'is_configurable' => 1,
|
||||||
|
'is_user_defined' => 1,
|
||||||
|
'options' => [
|
||||||
|
[
|
||||||
|
'en' => [
|
||||||
|
'label' => 'Red'
|
||||||
|
],
|
||||||
|
'sort_order' => 1
|
||||||
|
], [
|
||||||
|
'en' => [
|
||||||
|
'label' => 'Green'
|
||||||
|
],
|
||||||
|
'sort_order' => 2
|
||||||
|
], [
|
||||||
|
'en' => [
|
||||||
|
'label' => 'Yellow'
|
||||||
|
],
|
||||||
|
'sort_order' => 3
|
||||||
|
], [
|
||||||
|
'en' => [
|
||||||
|
'label' => 'Black'
|
||||||
|
],
|
||||||
|
'sort_order' => 4
|
||||||
|
], [
|
||||||
|
'en' => [
|
||||||
|
'label' => 'White'
|
||||||
|
],
|
||||||
|
'sort_order' => 5
|
||||||
|
]
|
||||||
|
]
|
||||||
|
], [
|
||||||
|
'code' => 'size',
|
||||||
|
'admin_name' => 'Size',
|
||||||
|
'en' => [
|
||||||
|
'name' => 'Size'
|
||||||
|
],
|
||||||
|
'type' => 'select',
|
||||||
|
'position' => 21,
|
||||||
|
'is_required' => 0,
|
||||||
|
'value_per_locale' => 0,
|
||||||
|
'value_per_channel' => 0,
|
||||||
|
'is_filterable' => 1,
|
||||||
|
'is_configurable' => 1,
|
||||||
|
'is_user_defined' => 1,
|
||||||
|
'options' => [
|
||||||
|
[
|
||||||
|
'en' => [
|
||||||
|
'label' => 'S'
|
||||||
|
],
|
||||||
|
'sort_order' => 1
|
||||||
|
], [
|
||||||
|
'en' => [
|
||||||
|
'label' => 'M'
|
||||||
|
],
|
||||||
|
'sort_order' => 2
|
||||||
|
], [
|
||||||
|
'en' => [
|
||||||
|
'label' => 'L'
|
||||||
|
],
|
||||||
|
'sort_order' => 3
|
||||||
|
], [
|
||||||
|
'en' => [
|
||||||
|
'label' => 'XL'
|
||||||
|
],
|
||||||
|
'sort_order' => 4
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AttributeRepository object
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $attribute;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new controller instance.
|
||||||
|
*
|
||||||
|
* @param Webkul\Attribute\Repositories\AttributeRepository $attribute
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct(AttributeRepository $attribute)
|
||||||
|
{
|
||||||
|
$this->attribute = $attribute;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function run()
|
||||||
|
{
|
||||||
|
foreach($this->rawData as $row) {
|
||||||
|
$this->attribute->create($row);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Webkul\Attribute\Database\Seeders;
|
||||||
|
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
|
||||||
|
class DatabaseSeeder extends Seeder
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Seed the application's database.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function run()
|
||||||
|
{
|
||||||
|
$this->call(AttributeTableSeeder::class);
|
||||||
|
$this->call(AttributeFamilyTableSeeder::class);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -4,7 +4,9 @@ namespace Webkul\Attribute\Http\Controllers;
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Http\Response;
|
use Illuminate\Http\Response;
|
||||||
use Webkul\Attribute\Models\Attribute;
|
use Webkul\Attribute\Repositories\AttributeRepository as Attribute;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Catalog attribute controller
|
* Catalog attribute controller
|
||||||
*
|
*
|
||||||
|
|
@ -19,14 +21,24 @@ class AttributeController extends Controller
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $_config;
|
protected $_config;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AttributeRepository object
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $attribute;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new controller instance.
|
* Create a new controller instance.
|
||||||
*
|
*
|
||||||
|
* @param Webkul\Attribute\Repositories\AttributeRepository $attribute
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct(Attribute $attribute)
|
||||||
{
|
{
|
||||||
|
$this->attribute = $attribute;
|
||||||
|
|
||||||
$this->_config = request('_config');
|
$this->_config = request('_config');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -47,7 +59,7 @@ class AttributeController extends Controller
|
||||||
*/
|
*/
|
||||||
public function create()
|
public function create()
|
||||||
{
|
{
|
||||||
return view($this->_config['view'], compact('roleItems'));
|
return view($this->_config['view']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -59,11 +71,11 @@ class AttributeController extends Controller
|
||||||
{
|
{
|
||||||
$this->validate(request(), [
|
$this->validate(request(), [
|
||||||
'code' => ['required', 'unique:attributes,code', new \Webkul\Core\Contracts\Validations\Slug],
|
'code' => ['required', 'unique:attributes,code', new \Webkul\Core\Contracts\Validations\Slug],
|
||||||
'name' => 'required',
|
'admin_name' => 'required',
|
||||||
'type' => 'required'
|
'type' => 'required'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
Attribute::create(request()->all());
|
$this->attribute->create(request()->all());
|
||||||
|
|
||||||
session()->flash('success', 'Attribute created successfully.');
|
session()->flash('success', 'Attribute created successfully.');
|
||||||
|
|
||||||
|
|
@ -78,9 +90,9 @@ class AttributeController extends Controller
|
||||||
*/
|
*/
|
||||||
public function edit($id)
|
public function edit($id)
|
||||||
{
|
{
|
||||||
$role = Role::findOrFail($id);
|
$attribute = $this->attribute->findOrFail($id);
|
||||||
|
|
||||||
return view($this->_config['view'], compact('role'));
|
return view($this->_config['view'], compact('attribute'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -93,15 +105,14 @@ class AttributeController extends Controller
|
||||||
public function update(Request $request, $id)
|
public function update(Request $request, $id)
|
||||||
{
|
{
|
||||||
$this->validate(request(), [
|
$this->validate(request(), [
|
||||||
'name' => 'required',
|
'code' => ['required', 'unique:attributes,code,' . $id, new \Webkul\Core\Contracts\Validations\Slug],
|
||||||
'permission_type' => 'required',
|
'admin_name' => 'required',
|
||||||
|
'type' => 'required'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$role = Role::findOrFail($id);
|
$this->attribute->update(request()->all(), $id);
|
||||||
|
|
||||||
$role->update(request()->all());
|
session()->flash('success', 'Attribute updated successfully.');
|
||||||
|
|
||||||
session()->flash('success', 'Role updated successfully.');
|
|
||||||
|
|
||||||
return redirect()->route($this->_config['redirect']);
|
return redirect()->route($this->_config['redirect']);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,138 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Webkul\Attribute\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Http\Response;
|
||||||
|
use Webkul\Attribute\Repositories\AttributeFamilyRepository as AttributeFamily;
|
||||||
|
use Webkul\Attribute\Repositories\AttributeRepository as Attribute;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Catalog family controller
|
||||||
|
*
|
||||||
|
* @author Jitendra Singh <jitendra@webkul.com>
|
||||||
|
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||||
|
*/
|
||||||
|
class AttributeFamilyController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Contains route related configuration
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $_config;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AttributeFamilyRepository object
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $attributeFamily;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new controller instance.
|
||||||
|
*
|
||||||
|
* @param Webkul\Attribute\Repositories\AttributeFamilyRepository $attributeFamily
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct(AttributeFamily $attributeFamily)
|
||||||
|
{
|
||||||
|
$this->attributeFamily = $attributeFamily;
|
||||||
|
|
||||||
|
$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.
|
||||||
|
*
|
||||||
|
* @param Webkul\Attribute\Repositories\AttributeRepository $attribute
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function create(Attribute $attribute)
|
||||||
|
{
|
||||||
|
$attributeFamily = $this->attributeFamily->findBy('code', 'default', ['*'], ['attribute_groups.attributes']);
|
||||||
|
|
||||||
|
$attributes = $attribute->all(['id', 'code', 'admin_name', 'type']);
|
||||||
|
|
||||||
|
return view($this->_config['view'], compact('attributes', 'attributeFamily'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function store()
|
||||||
|
{
|
||||||
|
$this->validate(request(), [
|
||||||
|
'code' => ['required', 'unique:attribute_families,code', new \Webkul\Core\Contracts\Validations\Slug],
|
||||||
|
'name' => 'required'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->attributeFamily->create(request()->all());
|
||||||
|
|
||||||
|
session()->flash('success', 'Family created successfully.');
|
||||||
|
|
||||||
|
return redirect()->route($this->_config['redirect']);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
*
|
||||||
|
* @param Webkul\Attribute\Repositories\AttributeRepository $attribute
|
||||||
|
* @param int $id
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function edit(Attribute $attribute, $id)
|
||||||
|
{
|
||||||
|
$attributeFamily = $this->attributeFamily->findOrFail($id, ['*'], ['attribute_groups.attributes']);
|
||||||
|
|
||||||
|
$attributes = $attribute->all(['id', 'code', 'admin_name', 'type']);
|
||||||
|
|
||||||
|
return view($this->_config['view'], compact('attributeFamily', 'attributes'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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:attribute_families,code,' . $id, new \Webkul\Core\Contracts\Validations\Slug],
|
||||||
|
'name' => 'required'
|
||||||
|
]);
|
||||||
|
|
||||||
|
|
||||||
|
$this->attributeFamily->update(request()->all(), $id);
|
||||||
|
|
||||||
|
session()->flash('success', 'Family 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)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -2,12 +2,20 @@
|
||||||
|
|
||||||
namespace Webkul\Attribute\Models;
|
namespace Webkul\Attribute\Models;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Webkul\Core\Eloquent\TranslatableModel;
|
||||||
use Dimsav\Translatable\Translatable;
|
use Webkul\Attribute\Models\AttributeOption;
|
||||||
|
|
||||||
class Attribute extends Model
|
class Attribute extends TranslatableModel
|
||||||
{
|
{
|
||||||
use Translatable;
|
|
||||||
|
|
||||||
public $translatedAttributes = ['name'];
|
public $translatedAttributes = ['name'];
|
||||||
|
|
||||||
|
protected $fillable = ['code', 'admin_name', 'type', 'position', 'is_required', 'is_unique', 'value_per_locale', 'value_per_channel', 'is_filterable', 'is_configurable'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the options.
|
||||||
|
*/
|
||||||
|
public function options()
|
||||||
|
{
|
||||||
|
return $this->hasMany(AttributeOption::class);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3,7 +3,28 @@
|
||||||
namespace Webkul\Attribute\Models;
|
namespace Webkul\Attribute\Models;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Webkul\Attribute\Models\Attribute;
|
||||||
|
use Webkul\Attribute\Models\AttributeGroup;
|
||||||
|
|
||||||
class AttributeFamily extends Model
|
class AttributeFamily extends Model
|
||||||
{
|
{
|
||||||
|
public $timestamps = false;
|
||||||
|
|
||||||
|
protected $fillable = ['code', 'name'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get all of the attributes for the attribute groups.
|
||||||
|
*/
|
||||||
|
public function attributes()
|
||||||
|
{
|
||||||
|
return $this->hasManyThrough(Attribute::class, AttributeGroup::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get all of the attribute groups.
|
||||||
|
*/
|
||||||
|
public function attribute_groups()
|
||||||
|
{
|
||||||
|
return $this->hasMany(AttributeGroup::class)->orderBy('position');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3,7 +3,21 @@
|
||||||
namespace Webkul\Attribute\Models;
|
namespace Webkul\Attribute\Models;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Webkul\Attribute\Models\Attribute;
|
||||||
|
|
||||||
class AttributeGroup extends Model
|
class AttributeGroup extends Model
|
||||||
{
|
{
|
||||||
|
public $timestamps = false;
|
||||||
|
|
||||||
|
protected $fillable = ['name', 'position', 'is_user_defined'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the attributes that owns the attribute group.
|
||||||
|
*/
|
||||||
|
public function attributes()
|
||||||
|
{
|
||||||
|
return $this->belongsToMany(Attribute::class, 'attribute_group_mappings')
|
||||||
|
->withPivot('position')
|
||||||
|
->orderBy('pivot_position', 'asc');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2,12 +2,23 @@
|
||||||
|
|
||||||
namespace Webkul\Attribute\Models;
|
namespace Webkul\Attribute\Models;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Webkul\Core\Eloquent\TranslatableModel;
|
||||||
use Dimsav\Translatable\Translatable;
|
use Dimsav\Translatable\Translatable;
|
||||||
|
use Webkul\Attribute\Models\Attribute;
|
||||||
|
|
||||||
class AttributeOption extends Model
|
class AttributeOption extends TranslatableModel
|
||||||
{
|
{
|
||||||
use Translatable;
|
public $timestamps = false;
|
||||||
|
|
||||||
public $translatedAttributes = ['label'];
|
public $translatedAttributes = ['label'];
|
||||||
|
|
||||||
|
protected $fillable = ['sort_order'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the attribute that owns the attribute option.
|
||||||
|
*/
|
||||||
|
public function attribute()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Attribute::class);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3,7 +3,6 @@
|
||||||
namespace Webkul\Attribute\Providers;
|
namespace Webkul\Attribute\Providers;
|
||||||
|
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
use Illuminate\Foundation\AliasLoader;
|
|
||||||
use Illuminate\Routing\Router;
|
use Illuminate\Routing\Router;
|
||||||
|
|
||||||
class AttributeServiceProvider extends ServiceProvider
|
class AttributeServiceProvider extends ServiceProvider
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,143 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Webkul\Attribute\Repositories;
|
||||||
|
|
||||||
|
use Webkul\Core\Eloquent\Repository;
|
||||||
|
use Webkul\Attribute\Repositories\AttributeRepository;
|
||||||
|
use Webkul\Attribute\Repositories\AttributeGroupRepository;
|
||||||
|
use Illuminate\Container\Container as App;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attribute Reposotory
|
||||||
|
*
|
||||||
|
* @author Jitendra Singh <jitendra@webkul.com>
|
||||||
|
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||||
|
*/
|
||||||
|
class AttributeFamilyRepository extends Repository
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* AttributeRepository object
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $attribute;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AttributeGroupRepository object
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $attributeGroup;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new controller instance.
|
||||||
|
*
|
||||||
|
* @param Webkul\Attribute\Repositories\AttributeRepository $attribute
|
||||||
|
* @param Webkul\Attribute\Repositories\AttributeGroupRepository $attributeGroup
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct(AttributeRepository $attribute, AttributeGroupRepository $attributeGroup, App $app)
|
||||||
|
{
|
||||||
|
$this->attribute = $attribute;
|
||||||
|
|
||||||
|
$this->attributeGroup = $attributeGroup;
|
||||||
|
|
||||||
|
parent::__construct($app);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specify Model class name
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
function model()
|
||||||
|
{
|
||||||
|
return 'Webkul\Attribute\Models\AttributeFamily';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array $data
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function create(array $data)
|
||||||
|
{
|
||||||
|
$attributeGroups = isset($data['attribute_groups']) ? $data['attribute_groups'] : [];
|
||||||
|
unset($data['attribute_groups']);
|
||||||
|
$family = $this->model->create($data);
|
||||||
|
|
||||||
|
foreach ($attributeGroups as $group) {
|
||||||
|
$attributes = isset($group['attributes']) ? $group['attributes'] : [];
|
||||||
|
unset($group['attributes']);
|
||||||
|
$attributeGroup = $family->attribute_groups()->create($group);
|
||||||
|
|
||||||
|
foreach ($attributes as $attribute) {
|
||||||
|
if(isset($attribute['id'])) {
|
||||||
|
$attributeGroup->attributes()->attach($attribute['id']);
|
||||||
|
} else {
|
||||||
|
$attributeModel = $this->attribute->findBy('code', $attribute['code']);
|
||||||
|
$attributeGroup->attributes()->save($attributeModel, ['position' => $attribute['position']]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $family;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array $data
|
||||||
|
* @param $id
|
||||||
|
* @param string $attribute
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function update(array $data, $id, $attribute = "id")
|
||||||
|
{
|
||||||
|
$family = $this->findOrFail($id);
|
||||||
|
|
||||||
|
$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 $attribute) {
|
||||||
|
$attributeGroup->attributes()->attach($attribute['id']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if(is_numeric($index = $previousAttributeGroupIds->search($attributeGroupId))) {
|
||||||
|
$previousAttributeGroupIds->forget($index);
|
||||||
|
}
|
||||||
|
|
||||||
|
$attributeGroup = $this->attributeGroup->findOrFail($attributeGroupId);
|
||||||
|
$attributeGroup->update($attributeGroupInputs);
|
||||||
|
|
||||||
|
$attributeIds = $attributeGroup->attributes()->get()->pluck('id');
|
||||||
|
|
||||||
|
if(isset($attributeGroupInputs['attributes'])) {
|
||||||
|
foreach ($attributeGroupInputs['attributes'] as $attribute) {
|
||||||
|
if(is_numeric($index = $attributeIds->search($attribute['id']))) {
|
||||||
|
$attributeIds->forget($index);
|
||||||
|
} else {
|
||||||
|
$attributeGroup->attributes()->attach($attribute['id']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($attributeIds->count()) {
|
||||||
|
$attributeGroup->detach($attributeIds);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($previousAttributeGroupIds as $attributeGroupId) {
|
||||||
|
$this->attributeGroup->delete($attributeGroupId);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $family;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Webkul\Attribute\Repositories;
|
||||||
|
|
||||||
|
use Webkul\Core\Eloquent\Repository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attribute Group Reposotory
|
||||||
|
*
|
||||||
|
* @author Jitendra Singh <jitendra@webkul.com>
|
||||||
|
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||||
|
*/
|
||||||
|
class AttributeGroupRepository extends Repository
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specify Model class name
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
function model()
|
||||||
|
{
|
||||||
|
return 'Webkul\Attribute\Models\AttributeGroup';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Webkul\Attribute\Repositories;
|
||||||
|
|
||||||
|
use Webkul\Core\Eloquent\Repository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attribute Option Reposotory
|
||||||
|
*
|
||||||
|
* @author Jitendra Singh <jitendra@webkul.com>
|
||||||
|
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||||
|
*/
|
||||||
|
class AttributeOptionRepository extends Repository
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specify Model class name
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
function model()
|
||||||
|
{
|
||||||
|
return 'Webkul\Attribute\Models\AttributeOption';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,102 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Webkul\Attribute\Repositories;
|
||||||
|
|
||||||
|
use Webkul\Core\Eloquent\Repository;
|
||||||
|
use Webkul\Attribute\Repositories\AttributeOptionRepository;
|
||||||
|
use Illuminate\Container\Container as App;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attribute Reposotory
|
||||||
|
*
|
||||||
|
* @author Jitendra Singh <jitendra@webkul.com>
|
||||||
|
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||||
|
*/
|
||||||
|
class AttributeRepository extends Repository
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* AttributeOptionRepository object
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $attributeOption;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new controller instance.
|
||||||
|
*
|
||||||
|
* @param Webkul\Attribute\Repositories\AttributeOptionRepository $attributeOption
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct(AttributeOptionRepository $attributeOption, App $app)
|
||||||
|
{
|
||||||
|
$this->attributeOption = $attributeOption;
|
||||||
|
|
||||||
|
parent::__construct($app);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specify Model class name
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
function model()
|
||||||
|
{
|
||||||
|
return 'Webkul\Attribute\Models\Attribute';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array $data
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function create(array $data)
|
||||||
|
{
|
||||||
|
$options = isset($data['options']) ? $data['options'] : [];
|
||||||
|
unset($data['options']);
|
||||||
|
$attribute = $this->model->create($data);
|
||||||
|
|
||||||
|
if(in_array($attribute->type, ['select', 'multiselect', 'checkbox']) && count($options)) {
|
||||||
|
foreach ($options as $option) {
|
||||||
|
$attribute->options()->create($option);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $attribute;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array $data
|
||||||
|
* @param $id
|
||||||
|
* @param string $attribute
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function update(array $data, $id, $attribute = "id")
|
||||||
|
{
|
||||||
|
$attribute = $this->findOrFail($id);
|
||||||
|
|
||||||
|
$attribute->update($data);
|
||||||
|
|
||||||
|
$previousOptionIds = $attribute->options()->pluck('id');
|
||||||
|
|
||||||
|
if(in_array($attribute->code, ['select', 'multiselect', 'checkbox'])) {
|
||||||
|
if(isset($data['options'])) {
|
||||||
|
foreach ($data['options'] as $optionId => $optionInputs) {
|
||||||
|
if (str_contains($optionId, 'option_')) {
|
||||||
|
$attribute->options()->create($optionInputs);
|
||||||
|
} else {
|
||||||
|
if(is_numeric($index = $previousOptionIds->search($optionId))) {
|
||||||
|
$previousOptionIds->forget($index);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->attributeOption->update($optionInputs, $optionId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($previousOptionIds as $optionId) {
|
||||||
|
$this->attributeOption->delete($optionId);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $attribute;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -7,16 +7,18 @@
|
||||||
"email": "jitendra@webkul.com"
|
"email": "jitendra@webkul.com"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"require": {},
|
"require": {
|
||||||
|
"baum/baum": "~1.1"
|
||||||
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"Webkul\\Attribute\\": "src/"
|
"Webkul\\Category\\": "src/"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"extra": {
|
"extra": {
|
||||||
"laravel": {
|
"laravel": {
|
||||||
"providers": [
|
"providers": [
|
||||||
"Webkul\\Attribute\\Providers\\AttributeServiceProvider"
|
"Webkul\\Category\\Providers\\CategoryServiceProvider"
|
||||||
],
|
],
|
||||||
"aliases": { }
|
"aliases": { }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Kalnoy\Nestedset\NestedSet;
|
||||||
|
|
||||||
class CreateCategoriesTable extends Migration
|
class CreateCategoriesTable extends Migration
|
||||||
{
|
{
|
||||||
|
|
@ -15,10 +16,10 @@ class CreateCategoriesTable extends Migration
|
||||||
{
|
{
|
||||||
Schema::create('categories', function (Blueprint $table) {
|
Schema::create('categories', function (Blueprint $table) {
|
||||||
$table->increments('id');
|
$table->increments('id');
|
||||||
$table->string('code')->unique();
|
$table->integer('position')->default(0);
|
||||||
$table->integer('position');
|
$table->string('image')->nullable();
|
||||||
$table->integer('parent_id')->unsigned()->nullable();
|
$table->boolean('status')->default(0);
|
||||||
$table->foreign('parent_id')->references('id')->on('categories')->onDelete('cascade');
|
NestedSet::columns($table);
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,40 @@
|
||||||
|
<?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->string('locale');
|
||||||
|
$table->unique(['category_id', 'slug', 'locale']);
|
||||||
|
$table->foreign('category_id')->references('id')->on('categories')->onDelete('cascade');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('category_translations');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,136 @@
|
||||||
|
<?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(null, ['id']);
|
||||||
|
|
||||||
|
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()->getDefaultChannelLocaleCode();
|
||||||
|
$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 boolean
|
||||||
|
*/
|
||||||
|
protected function isChannelBased()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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,82 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Webkul\Category\Repositories;
|
||||||
|
|
||||||
|
use Webkul\Core\Eloquent\Repository;
|
||||||
|
use Webkul\Category\Models\Category;
|
||||||
|
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
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Create a new controller instance.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct(App $app)
|
||||||
|
{
|
||||||
|
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());
|
||||||
|
|
||||||
|
$channels = channel()->getChannelWithLocales();
|
||||||
|
|
||||||
|
foreach($channels as $channel) {
|
||||||
|
foreach($channel->locales as $locale) {
|
||||||
|
foreach ($model->translatedAttributes as $attribute) {
|
||||||
|
if(isset($data[$attribute])) {
|
||||||
|
$data[$channel->code . '.' . $locale->code][$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,27 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Webkul\Channel;
|
||||||
|
|
||||||
|
use Webkul\Channel\Models\Channel as ChannelModel;
|
||||||
|
|
||||||
|
class Channel
|
||||||
|
{
|
||||||
|
public function getDefaultChannelLocaleCode() {
|
||||||
|
$channel = ChannelModel::first();
|
||||||
|
|
||||||
|
if(!$channel || !$channel->locales()->count())
|
||||||
|
return;
|
||||||
|
|
||||||
|
return $channel->code . '-' . $channel->locales()->first()->code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDefaultChannelLocale() {
|
||||||
|
$channel = ChannelModel::first();
|
||||||
|
|
||||||
|
return $channel->locales()->first();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getChannelWithLocales() {
|
||||||
|
return ChannelModel::with('locales')->get();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,56 @@
|
||||||
|
<?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_locales', function (Blueprint $table) {
|
||||||
|
$table->integer('channel_id')->unsigned();
|
||||||
|
$table->integer('locale_id')->unsigned();
|
||||||
|
$table->primary(['channel_id', 'locale_id']);
|
||||||
|
$table->foreign('channel_id')->references('id')->on('channels')->onDelete('cascade');
|
||||||
|
$table->foreign('locale_id')->references('id')->on('locales')->onDelete('cascade');
|
||||||
|
});
|
||||||
|
|
||||||
|
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,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, ['*'], ['locales', 'currencies']);
|
||||||
|
|
||||||
|
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,44 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Webkul\Channel\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
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 locales()
|
||||||
|
{
|
||||||
|
return $this->belongsToMany(Locale::class, 'channel_locales');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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,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,85 @@
|
||||||
|
<?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 $locale) {
|
||||||
|
$channel->locales()->attach($locale);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($data['currencies'] as $currency) {
|
||||||
|
$channel->currencies()->attach($currency);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $channel;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array $data
|
||||||
|
* @param $id
|
||||||
|
* @param string $attribute
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function update(array $data, $id, $attribute = "id")
|
||||||
|
{
|
||||||
|
$channel = $this->findOrFail($id);
|
||||||
|
|
||||||
|
$channel->update($data);
|
||||||
|
|
||||||
|
$previousLocaleIds = $channel->locales()->pluck('id');
|
||||||
|
|
||||||
|
foreach ($data['locales'] as $locale) {
|
||||||
|
if(is_numeric($index = $previousLocaleIds->search($locale))) {
|
||||||
|
$previousLocaleIds->forget($index);
|
||||||
|
} else {
|
||||||
|
$channel->locales()->attach($locale);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($previousLocaleIds->count()) {
|
||||||
|
$channel->locales()->detach($previousLocaleIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
$previousCurrencyIds = $channel->currencies()->pluck('id');
|
||||||
|
foreach ($data['currencies'] as $currency) {
|
||||||
|
if(is_numeric($index = $previousCurrencyIds->search($currency))) {
|
||||||
|
$previousCurrencyIds->forget($index);
|
||||||
|
} else {
|
||||||
|
$channel->currencies()->attach($currency);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($previousCurrencyIds->count()) {
|
||||||
|
$channel->currencies()->detach($previousCurrencyIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $channel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -21,6 +21,8 @@ interface RepositoryInterface {
|
||||||
public function delete($id);
|
public function delete($id);
|
||||||
|
|
||||||
public function find($id, $columns = ['*']);
|
public function find($id, $columns = ['*']);
|
||||||
|
|
||||||
|
public function findOrFail($id, $columns = ['*']);
|
||||||
|
|
||||||
public function findBy($field, $value, $columns = ['*']);
|
public function findBy($field, $value, $columns = ['*']);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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\Schema\Blueprint;
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
|
||||||
class CreateCategoryNameTranslationTable extends Migration
|
class CreateCountriesTable extends Migration
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
|
|
@ -13,8 +13,11 @@ class CreateCategoryNameTranslationTable extends Migration
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::create('category_name_translation', function (Blueprint $table) {
|
Schema::create('countries', function (Blueprint $table) {
|
||||||
$table->increments('id');
|
$table->increments('id');
|
||||||
|
$table->string('code');
|
||||||
|
$table->string('name');
|
||||||
|
$table->boolean('status')->default(0);
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -26,6 +29,6 @@ class CreateCategoryNameTranslationTable extends Migration
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down()
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('category_name_translation');
|
Schema::dropIfExists('countries');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -4,7 +4,7 @@ use Illuminate\Support\Facades\Schema;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
|
||||||
class CreateCategoryDescriptionTranslationsTable extends Migration
|
class CreateCurrenciesTable extends Migration
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
|
|
@ -13,8 +13,11 @@ class CreateCategoryDescriptionTranslationsTable extends Migration
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::create('category_description_translations', function (Blueprint $table) {
|
Schema::create('currencies', function (Blueprint $table) {
|
||||||
$table->increments('id');
|
$table->increments('id');
|
||||||
|
$table->string('code');
|
||||||
|
$table->string('symbol');
|
||||||
|
$table->string('name');
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -26,6 +29,6 @@ class CreateCategoryDescriptionTranslationsTable extends Migration
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down()
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('category_description_translations');
|
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->code = 'en';
|
||||||
$locale->name = 'English';
|
$locale->name = 'English';
|
||||||
$locale->save();
|
$locale->save();
|
||||||
|
|
||||||
|
$locale = new Locale();
|
||||||
|
$locale->code = 'fr';
|
||||||
|
$locale->name = 'French';
|
||||||
|
$locale->save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -30,7 +30,8 @@ abstract class Repository implements RepositoryInterface {
|
||||||
* @param App $app
|
* @param App $app
|
||||||
* @throws \Webkul\Core\Exceptions\RepositoryException
|
* @throws \Webkul\Core\Exceptions\RepositoryException
|
||||||
*/
|
*/
|
||||||
public function __construct(App $app) {
|
public function __construct(App $app)
|
||||||
|
{
|
||||||
$this->app = $app;
|
$this->app = $app;
|
||||||
|
|
||||||
$this->makeModel();
|
$this->makeModel();
|
||||||
|
|
@ -47,25 +48,28 @@ abstract class Repository implements RepositoryInterface {
|
||||||
* @param array $columns
|
* @param array $columns
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function all($columns = ['*']) {
|
public function all($columns = ['*'], $with = [])
|
||||||
return $this->model->get($columns);
|
{
|
||||||
|
return $this->resetScope()->model->with($with)->get($columns);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param int $perPage
|
* @param int $perPage
|
||||||
* @param array $columns
|
* @param array $columns
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function paginate($perPage = 1, $columns = ['*']) {
|
public function paginate($perPage = 1, $columns = ['*'])
|
||||||
return $this->model->paginate($perPage, $columns);
|
{
|
||||||
|
return $this->resetScope()->model->paginate($perPage, $columns);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $data
|
* @param array $data
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function create(array $data) {
|
public function create(array $data)
|
||||||
return $this->model->create($data);
|
{
|
||||||
|
return $this->resetScope()->model->create($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -74,16 +78,28 @@ abstract class Repository implements RepositoryInterface {
|
||||||
* @param string $attribute
|
* @param string $attribute
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function update(array $data, $id, $attribute="id") {
|
public function update(array $data, $id, $attribute = "id")
|
||||||
return $this->model->where($attribute, '=', $id)->update($data);
|
{
|
||||||
|
return $this->resetScope()->model->where($attribute, '=', $id)->first()->update($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $id
|
* @param $id
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function delete($id) {
|
public function delete($id)
|
||||||
return $this->model->destroy($id);
|
{
|
||||||
|
return $this->resetScope()->find($id)->delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $id
|
||||||
|
* @param array $columns->with($with)
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function find($id, $columns = ['*'], $with = [])
|
||||||
|
{
|
||||||
|
return $this->resetScope()->model->with($with)->find($id, $columns);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -91,8 +107,9 @@ abstract class Repository implements RepositoryInterface {
|
||||||
* @param array $columns
|
* @param array $columns
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function find($id, $columns = ['*']) {
|
public function findOrFail($id, $columns = ['*'], $with = [])
|
||||||
return $this->model->find($id, $columns);
|
{
|
||||||
|
return $this->resetScope()->model->with($with)->findOrFail($id, $columns);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -101,15 +118,17 @@ abstract class Repository implements RepositoryInterface {
|
||||||
* @param array $columns
|
* @param array $columns
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function findBy($attribute, $value, $columns = ['*']) {
|
public function findBy($attribute, $value, $columns = ['*'], $with = [])
|
||||||
return $this->model->where($attribute, '=', $value)->first($columns);
|
{
|
||||||
|
return $this->resetScope()->model->with($with)->where($attribute, '=', $value)->first($columns);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return \Illuminate\Database\Eloquent\Builder
|
* @return \Illuminate\Database\Eloquent\Builder
|
||||||
* @throws RepositoryException
|
* @throws RepositoryException
|
||||||
*/
|
*/
|
||||||
public function makeModel() {
|
public function makeModel()
|
||||||
|
{
|
||||||
$model = $this->app->make($this->model());
|
$model = $this->app->make($this->model());
|
||||||
|
|
||||||
if (!$model instanceof Model)
|
if (!$model instanceof Model)
|
||||||
|
|
@ -117,4 +136,13 @@ abstract class Repository implements RepositoryInterface {
|
||||||
|
|
||||||
return $this->model = $model->newQuery();
|
return $this->model = $model->newQuery();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function resetScope() {
|
||||||
|
$this->makeModel();
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,63 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Webkul\Core\Eloquent;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Dimsav\Translatable\Translatable;
|
||||||
|
use Webkul\Core\Models\Locale;
|
||||||
|
|
||||||
|
class TranslatableModel extends Model
|
||||||
|
{
|
||||||
|
use Translatable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $key
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
protected function isKeyALocale($key)
|
||||||
|
{
|
||||||
|
$chunks = explode('-', $key);
|
||||||
|
if(count($chunks) > 1) {
|
||||||
|
if(Locale::where('code', '=', end($chunks))->first())
|
||||||
|
return true;
|
||||||
|
} elseif(Locale::where('code', '=', $key)->first()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function locale()
|
||||||
|
{
|
||||||
|
if($this->isChannelBased()) {
|
||||||
|
return channel()->getDefaultChannelLocaleCode();
|
||||||
|
} else {
|
||||||
|
if ($this->defaultLocale) {
|
||||||
|
return $this->defaultLocale;
|
||||||
|
}
|
||||||
|
|
||||||
|
return config('translatable.locale')
|
||||||
|
?: app()->make('translator')->getLocale();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
protected function isChannelBased()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function getLocaleSeparator()
|
||||||
|
{
|
||||||
|
return config('translatable.locale_separator', '%');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue