diff --git a/packages/Webkul/Admin/composer.json b/packages/Webkul/Admin/composer.json index 060a74a2f..ec85e56fd 100644 --- a/packages/Webkul/Admin/composer.json +++ b/packages/Webkul/Admin/composer.json @@ -8,7 +8,7 @@ } ], "require": { - "webkul/laravel-admin": "dev-master", + "webkul/laravel-user": "dev-master", "webkul/laravel-ui": "dev-master" }, "autoload": { diff --git a/packages/Webkul/Admin/src/Http/routes.php b/packages/Webkul/Admin/src/Http/routes.php index 8bbd88191..faac93e53 100644 --- a/packages/Webkul/Admin/src/Http/routes.php +++ b/packages/Webkul/Admin/src/Http/routes.php @@ -20,19 +20,55 @@ Route::group(['middleware' => ['web']], function () { Route::get('/datagrid', 'Webkul\Admin\Http\Controllers\DataGridController@index')->name('admin.datagrid.index'); + // User Routes Route::get('/users', 'Webkul\User\Http\Controllers\UserController@index')->defaults('_config', [ 'view' => 'admin::users.index' ])->name('admin.users.index'); + Route::get('/users/create', 'Webkul\User\Http\Controllers\UserController@create')->defaults('_config', [ + 'view' => 'admin::users.create' + ])->name('admin.users.create'); + + Route::post('/users/create', 'Webkul\User\Http\Controllers\UserController@store')->defaults('_config', [ + 'redirect' => 'admin.users.index' + ])->name('admin.users.store'); + + Route::get('/users/edit/{id}', 'Webkul\User\Http\Controllers\UserController@edit')->defaults('_config', [ + 'view' => 'admin::users.edit' + ])->name('admin.users.edit'); + + Route::put('/users/edit/{id}', 'Webkul\User\Http\Controllers\UserController@update')->defaults('_config', [ + 'redirect' => 'admin.users.index' + ])->name('admin.users.update'); + + // User Role Routes + Route::get('/roles', 'Webkul\User\Http\Controllers\RoleController@index')->defaults('_config', [ + 'view' => 'admin::roles.index' + ])->name('admin.roles.index'); + + Route::get('/roles/create', 'Webkul\User\Http\Controllers\RoleController@create')->defaults('_config', [ + 'view' => 'admin::roles.create' + ])->name('admin.roles.create'); + + Route::post('/roles/create', 'Webkul\User\Http\Controllers\RoleController@store')->defaults('_config', [ + 'redirect' => 'admin.roles.index' + ])->name('admin.roles.store'); + + Route::get('/roles/edit/{id}', 'Webkul\User\Http\Controllers\RoleController@edit')->defaults('_config', [ + 'view' => 'admin::roles.edit' + ])->name('admin.roles.edit'); + + Route::put('/roles/edit/{id}', 'Webkul\User\Http\Controllers\RoleController@update')->defaults('_config', [ + 'redirect' => 'admin.roles.index' + ])->name('admin.roles.update'); + + + // Admin Profile route Route::get('/account', 'Webkul\User\Http\Controllers\AccountController@edit')->defaults('_config', [ 'view' => 'admin::account.edit' ])->name('admin.account.edit'); Route::put('/account', 'Webkul\User\Http\Controllers\AccountController@update')->name('admin.account.update'); - - Route::get('/permissions', 'Webkul\User\Http\Controllers\PermissionController@index')->defaults('_config', [ - 'view' => 'admin::permissions.index' - ])->name('admin.permissions.index'); }); }); }); \ No newline at end of file diff --git a/packages/Webkul/Admin/src/Providers/AdminServiceProvider.php b/packages/Webkul/Admin/src/Providers/AdminServiceProvider.php index 08e93f427..09a3c200c 100644 --- a/packages/Webkul/Admin/src/Providers/AdminServiceProvider.php +++ b/packages/Webkul/Admin/src/Providers/AdminServiceProvider.php @@ -54,12 +54,13 @@ class AdminServiceProvider extends ServiceProvider $menu->add('configuration.account', 'My Account', route('admin.account.edit'), 1, ''); - $menu->add('settings', 'Settings', '', 6, 'icon-settings'); + $menu->add('settings', 'Settings', route('admin.users.index'), 6, 'icon-settings'); $menu->add('settings.users', 'Users', route('admin.users.index'), 1, ''); - $menu->add('settings.roles', 'Roles', route('admin.permissions.index'), 2, ''); + $menu->add('settings.users.users', 'Users', route('admin.users.index'), 1, ''); + $menu->add('settings.users.roles', 'Roles', route('admin.roles.index'), 1, ''); }); } @@ -70,27 +71,28 @@ class AdminServiceProvider extends ServiceProvider */ protected function composeView() { - view()->composer('admin::layouts.nav-left', function($view) { + view()->composer(['admin::layouts.nav-left', 'admin::layouts.nav-aside', 'admin::layouts.tabs'], function($view) { $menu = current(Event::fire('admin.menu.create')); - $view->with('menu', $menu); - }); - view()->composer('admin::layouts.nav-aside', function($view) { - $parentMenu = current(Event::fire('admin.menu.create')); - $menu = []; - foreach ($parentMenu->items as $item) { - $currentKey = current(explode('.', $parentMenu->currentKey)); - if($item['key'] != $currentKey) - continue; + $keys = explode('.', $menu->currentKey); + $subMenus = $tabs = []; + if(count($keys) > 1) { + $subMenus = [ + 'items' => $menu->sortItems(array_get($menu->items, current($keys) . '.children')), + 'current' => $menu->current, + 'currentKey' => $menu->currentKey + ]; - $menu = [ - 'items' => $parentMenu->sortItems($item['children']), - 'current' => $parentMenu->current, - 'currentKey' => $parentMenu->currentKey - ]; + if(count($keys) > 2) { + $tabs = [ + 'items' => $menu->sortItems(array_get($menu->items, implode('.children.', array_slice($keys, 0, 2)) . '.children')), + 'current' => $menu->current, + 'currentKey' => $menu->currentKey + ]; + } } - - $view->with('menu', $menu); + + $view->with('menu', $menu)->with('subMenus', $subMenus)->with('tabs', $tabs); }); } diff --git a/packages/Webkul/Admin/src/Resources/assets/js/app.js b/packages/Webkul/Admin/src/Resources/assets/js/app.js index 96aedec71..2aac6192d 100644 --- a/packages/Webkul/Admin/src/Resources/assets/js/app.js +++ b/packages/Webkul/Admin/src/Resources/assets/js/app.js @@ -5,19 +5,44 @@ window.VeeValidate = require('vee-validate'); Vue.use(VeeValidate); $(document).ready(function () { - const form = new Vue({ - el: 'form', - + const app = new Vue({ + el: '#app', + mounted: function() { this.addServerErrors() + this.addFlashMessages() }, methods: { + onSubmit: function(e) { + this.$validator.validateAll().then((result) => { + if (result) { + e.target.submit() + } + }); + }, + addServerErrors: function() { - // this.errors.add('email', "Hello") - // for (var key in serverErrors) { - // this.errors.add(key, serverErrors[key][0]) - // } + var scope = null; + for (var key in serverErrors) { + const field = this.$validator.fields.find({ name: key, scope: scope }); + if (field) { + this.$validator.errors.add({ + id: field.id, + field: key, + msg: serverErrors[key][0], + scope: scope, + }); + } + } + }, + + addFlashMessages: function() { + const flashes = this.$refs.flashes + + flashMessages.forEach(function(flash) { + flashes.addFlash(flash) + }, this); } } }); diff --git a/packages/Webkul/Admin/src/Resources/assets/sass/app.scss b/packages/Webkul/Admin/src/Resources/assets/sass/app.scss index f1ff25532..94e9cf175 100644 --- a/packages/Webkul/Admin/src/Resources/assets/sass/app.scss +++ b/packages/Webkul/Admin/src/Resources/assets/sass/app.scss @@ -11,6 +11,8 @@ body { font-family: $font-family; font-size: $font-size-base; font-weight: 500; + position: static; + min-height: 100%; } .navbar-top { @@ -19,6 +21,10 @@ body { font-size: 0; @include box-shadow(0 3px 6px 0 rgba(0,0,0,0.05)); border-bottom: 1px solid $border-color; + position: fixed; + left: 0; + right: 0; + z-index: 5; .navbar-top-left { width: 50%; @@ -107,22 +113,26 @@ body { .content-container { padding-left: 90px; - width: 100%; - display: inline-block; position: absolute; margin-top: 60px; top: 0px; + right: 0; + left: 0; bottom: 0px; z-index: 1; + overflow-x: hidden; + overflow-y: auto; .aside-nav { width: 280px; - position: absolute; - top: 0; + position: fixed; + top: 60px; bottom: 0; border-right: 1px solid $border-color; background: #F8F9FA; padding-top: 10px; + overflow-y: auto; + z-index: 4; a { padding: 15px; @@ -143,10 +153,18 @@ body { } } - .content { - padding: 25px; - padding-left: 305px; + .content-wrapper { + padding: 25px 25px 25px 305px; + overflow-y: auto; + } + .content { + padding: 25px 0; + + &.full-page { + padding: 25px; + } + .page-header { display: block; diff --git a/packages/Webkul/Admin/src/Resources/views/account/edit.blade.php b/packages/Webkul/Admin/src/Resources/views/account/edit.blade.php index b234aa53b..f5bd1e78a 100644 --- a/packages/Webkul/Admin/src/Resources/views/account/edit.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/account/edit.blade.php @@ -1,10 +1,8 @@ -@extends('admin::layouts.master') +@extends('admin::layouts.content') @section('content') - @include ('admin::layouts.nav-aside') -
-
+
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/packages/Webkul/User/src/Database/migrations/2018_06_12_111907_create_admins_table.php b/packages/Webkul/User/src/Database/migrations/2018_06_12_111907_create_admins_table.php index e47382256..14ca9237e 100644 --- a/packages/Webkul/User/src/Database/migrations/2018_06_12_111907_create_admins_table.php +++ b/packages/Webkul/User/src/Database/migrations/2018_06_12_111907_create_admins_table.php @@ -18,8 +18,8 @@ class CreateAdminsTable extends Migration $table->increments('id'); $table->string('name'); $table->string('email')->unique(); - $table->string('password'); - $table->boolean('status'); + $table->string('password')->nullable(); + $table->boolean('status')->default(0); $table->integer('role_id')->unsigned(); $table->rememberToken(); $table->timestamps(); diff --git a/packages/Webkul/User/src/Database/migrations/2018_06_13_055341_create_roles_table.php b/packages/Webkul/User/src/Database/migrations/2018_06_13_055341_create_roles_table.php index 5de36a239..fce035acb 100644 --- a/packages/Webkul/User/src/Database/migrations/2018_06_13_055341_create_roles_table.php +++ b/packages/Webkul/User/src/Database/migrations/2018_06_13_055341_create_roles_table.php @@ -18,7 +18,6 @@ class CreateRolesTable extends Migration $table->string('name'); $table->string('description'); $table->json('permissions')->nullable(); - $table->boolean('status'); $table->timestamps(); }); } diff --git a/packages/Webkul/User/src/Database/migrations/2018_06_28_131304_foo.php b/packages/Webkul/User/src/Database/migrations/2018_06_28_131304_foo.php new file mode 100644 index 000000000..b1efe1f6d --- /dev/null +++ b/packages/Webkul/User/src/Database/migrations/2018_06_28_131304_foo.php @@ -0,0 +1,28 @@ +guard('admin')->user(); + $this->validate(request(), [ 'name' => 'required', - 'email' => 'email', - // 'password' => 'required|confirmed' + 'email' => 'email|unique:admins,email,' . $user->id, + 'password' => 'nullable|confirmed' ]); - $user::update(request('name', 'email', 'password')); + + $user->update(request(['name', 'email', 'password'])); session()->flash('success', 'Account changes saved successfully.'); diff --git a/packages/Webkul/User/src/Http/Controllers/RoleController.php b/packages/Webkul/User/src/Http/Controllers/RoleController.php new file mode 100644 index 000000000..81ff5efaa --- /dev/null +++ b/packages/Webkul/User/src/Http/Controllers/RoleController.php @@ -0,0 +1,101 @@ + + * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) + */ +class RoleController extends Controller +{ + protected $_config; + + 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'], compact('roleItems')); + } + + /** + * Store a newly created resource in storage. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Http\Response + */ + public function store(Request $request) + { + Role::create(request()->all()); + + session()->flash('success', 'Role 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) + { + $role = Role::findOrFail($id); + + return view($this->_config['view'], compact('role')); + } + + /** + * Update the specified resource in storage. + * + * @param \Illuminate\Http\Request $request + * @param int $id + * @return \Illuminate\Http\Response + */ + public function update(Request $request, $id) + { + $role = Role::findOrFail($id); + + $role->update(request(['name', 'description', 'permissions'])); + + session()->flash('success', 'Role 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) + { + // + } +} \ No newline at end of file diff --git a/packages/Webkul/User/src/Http/Controllers/UserController.php b/packages/Webkul/User/src/Http/Controllers/UserController.php index 03b491920..5a31ef3a2 100644 --- a/packages/Webkul/User/src/Http/Controllers/UserController.php +++ b/packages/Webkul/User/src/Http/Controllers/UserController.php @@ -5,6 +5,9 @@ namespace Webkul\User\Http\Controllers; use Illuminate\Http\Request; use Illuminate\Http\Response; use Illuminate\Routing\Controller; +use Webkul\User\Models\Admin; +use Webkul\User\Models\Role; +use Webkul\User\Http\Requests\UserForm; /** * Admin user controller @@ -40,29 +43,24 @@ class UserController extends Controller */ public function create() { - return view($this->_config['view']); + $roles = Role::all(); + + return view($this->_config['view'], compact('roles')); } /** * Store a newly created resource in storage. * - * @param \Illuminate\Http\Request $request + * @param \Webkul\User\Http\Requests\UserForm $request * @return \Illuminate\Http\Response */ - public function store(Request $request) + public function store(UserForm $request) { - // - } + Admin::create(request()->all()); - /** - * Display the specified resource. - * - * @param int $id - * @return \Illuminate\Http\Response - */ - public function show($id) - { - // + session()->flash('success', 'User created successfully.'); + + return redirect()->route($this->_config['redirect']); } /** @@ -73,19 +71,28 @@ class UserController extends Controller */ public function edit($id) { - // + $user = Admin::findOrFail($id); + $roles = Role::all(); + + return view($this->_config['view'], compact('user', 'roles')); } /** * Update the specified resource in storage. * - * @param \Illuminate\Http\Request $request + * @param \Webkul\User\Http\Requests\UserForm $request * @param int $id * @return \Illuminate\Http\Response */ - public function update(Request $request, $id) + public function update(UserForm $request, $id) { - // + $user = Admin::findOrFail($id); + + $user->update(request(['name', 'email', 'password'])); + + session()->flash('success', 'User updated successfully.'); + + return redirect()->route($this->_config['redirect']); } /** diff --git a/packages/Webkul/User/src/Http/Requests/UserForm.php b/packages/Webkul/User/src/Http/Requests/UserForm.php new file mode 100644 index 000000000..e8ca87ec1 --- /dev/null +++ b/packages/Webkul/User/src/Http/Requests/UserForm.php @@ -0,0 +1,41 @@ +rules = [ + 'name' => 'required', + 'email' => 'email|unique:admins,email', + 'password' => 'nullable|confirmed', + 'role_id' => 'required' + ]; + + if($this->method() == 'PUT') { + $this->rules['email'] = 'email|unique:admins,email,' . $this->route('id'); + } + + return $this->rules; + } +} diff --git a/packages/Webkul/User/src/Models/Admin.php b/packages/Webkul/User/src/Models/Admin.php index 099b1198b..369e8abe3 100644 --- a/packages/Webkul/User/src/Models/Admin.php +++ b/packages/Webkul/User/src/Models/Admin.php @@ -16,7 +16,7 @@ class Admin extends Authenticatable * @var array */ protected $fillable = [ - 'name', 'email', 'password', + 'name', 'email', 'password', 'role_id', 'status', ]; /** diff --git a/public/vendor/webkul/admin/assets/css/admin.css b/public/vendor/webkul/admin/assets/css/admin.css index d886aad16..fbafa3817 100644 --- a/public/vendor/webkul/admin/assets/css/admin.css +++ b/public/vendor/webkul/admin/assets/css/admin.css @@ -4,6 +4,8 @@ font-family: "Montserrat", sans-serif; font-size: 14px; font-weight: 500; + position: static; + min-height: 100%; } .navbar-top { @@ -13,6 +15,10 @@ -webkit-box-shadow: 0 3px 6px 0 rgba(0, 0, 0, 0.05); box-shadow: 0 3px 6px 0 rgba(0, 0, 0, 0.05); border-bottom: 1px solid rgba(162, 162, 162, 0.2); + position: fixed; + left: 0; + right: 0; + z-index: 5; } .navbar-top .navbar-top-left { @@ -97,23 +103,27 @@ .content-container { padding-left: 90px; - width: 100%; - display: inline-block; position: absolute; margin-top: 60px; top: 0px; + right: 0; + left: 0; bottom: 0px; z-index: 1; + overflow-x: hidden; + overflow-y: auto; } .content-container .aside-nav { width: 280px; - position: absolute; - top: 0; + position: fixed; + top: 60px; bottom: 0; border-right: 1px solid rgba(162, 162, 162, 0.2); background: #F8F9FA; padding-top: 10px; + overflow-y: auto; + z-index: 4; } .content-container .aside-nav a { @@ -132,9 +142,17 @@ float: right; } +.content-container .content-wrapper { + padding: 25px 25px 25px 305px; + overflow-y: auto; +} + .content-container .content { + padding: 25px 0; +} + +.content-container .content.full-page { padding: 25px; - padding-left: 305px; } .content-container .content .page-header { diff --git a/public/vendor/webkul/admin/assets/js/admin.js b/public/vendor/webkul/admin/assets/js/admin.js index 93517363b..1f77fae2c 100644 --- a/public/vendor/webkul/admin/assets/js/admin.js +++ b/public/vendor/webkul/admin/assets/js/admin.js @@ -95,7 +95,7 @@ module.exports = g; /***/ (function(module, exports, __webpack_require__) { __webpack_require__(2); -module.exports = __webpack_require__(8); +module.exports = __webpack_require__(9); /***/ }), @@ -104,24 +104,49 @@ module.exports = __webpack_require__(8); window.jQuery = window.$ = $ = __webpack_require__(3); window.Vue = __webpack_require__(4); -window.VeeValidate = __webpack_require__(13); +window.VeeValidate = __webpack_require__(8); Vue.use(VeeValidate); $(document).ready(function () { - var form = new Vue({ - el: 'form', + var app = new Vue({ + el: '#app', mounted: function mounted() { this.addServerErrors(); + this.addFlashMessages(); }, methods: { + onSubmit: function onSubmit(e) { + this.$validator.validateAll().then(function (result) { + if (result) { + e.target.submit(); + } + }); + }, + addServerErrors: function addServerErrors() { - // this.errors.add('email', "Hello") - // for (var key in serverErrors) { - // this.errors.add(key, serverErrors[key][0]) - // } + var scope = null; + for (var key in serverErrors) { + var field = this.$validator.fields.find({ name: key, scope: scope }); + if (field) { + this.$validator.errors.add({ + id: field.id, + field: key, + msg: serverErrors[key][0], + scope: scope + }); + } + } + }, + + addFlashMessages: function addFlashMessages() { + var flashes = this.$refs.flashes; + + flashMessages.forEach(function (flash) { + flashes.addFlash(flash); + }, this); } } }); @@ -21919,16 +21944,6 @@ process.umask = function() { return 0; }; /***/ }), /* 8 */ -/***/ (function(module, exports) { - -// removed by extract-text-webpack-plugin - -/***/ }), -/* 9 */, -/* 10 */, -/* 11 */, -/* 12 */, -/* 13 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -21944,7 +21959,7 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ErrorComponent", function() { return ErrorComponent; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "version", function() { return version; }); /** - * vee-validate v2.1.0-beta.3 + * vee-validate v2.1.0-beta.5 * (c) 2018 Abdelrahman Awad * @license MIT */ @@ -22964,6 +22979,7 @@ ErrorBag.prototype._normalizeError = function _normalizeError (error) { } error.scope = !isNullOrUndefined(error.scope) ? error.scope : null; + error.vmId = !isNullOrUndefined(error.vmId) ? error.vmId : (this.vmId || null); return [error]; }; @@ -24242,7 +24258,7 @@ Validator.prototype._validate = function _validate (field, value, ref) { var isExitEarly = false; // use of '.some()' is to break iteration in middle by returning true Object.keys(field.rules).filter(function (rule) { - if (!initial) { return true; } + if (!initial || !RULES[rule]) { return true; } return RULES[rule].options.immediate; }).some(function (rule) { @@ -25059,12 +25075,12 @@ prototypeAccessors$5.flags.get = function () { var this$1 = this; return this._base.fields.items.filter(function (f) { return f.vmId === this$1.id; }).reduce(function (acc, field) { - var obj; - if (field.scope) { - acc[("$" + (field.scope))] = ( obj = {}, obj[field.name] = field.flags, obj ); + if (!acc[("$" + (field.scope))]) { + acc[("$" + (field.scope))] = {}; + } - return acc; + acc[("$" + (field.scope))][field.name] = field.flags; } acc[field.name] = field.flags; @@ -25225,6 +25241,12 @@ var mixin = { return; } + // There is a validator but it isn't injected, mark as reactive. + if (!requested && this.$validator) { + var Vue = this.$options._base; // the vue constructor. + Vue.util.defineReactive(this.$validator, 'errors', this.$validator.errors); + } + if (! this.$options.computed) { this.$options.computed = {}; } @@ -25233,13 +25255,13 @@ var mixin = { return this.$validator.errors; }; this.$options.computed[options.fieldsBagName || 'fields'] = function fieldBagGetter () { - var this$1 = this; - - return this.$validator.fields.items.filter(function (f) { return f.vmId === this$1._uid; }).reduce(function (acc, field) { - var obj; - + return this.$validator.fields.items.reduce(function (acc, field) { if (field.scope) { - acc[("$" + (field.scope))] = ( obj = {}, obj[field.name] = field.flags, obj ); + if (!acc[("$" + (field.scope))]) { + acc[("$" + (field.scope))] = {}; + } + + acc[("$" + (field.scope))][field.name] = field.flags; return acc; } @@ -25251,7 +25273,7 @@ var mixin = { }; }, beforeDestroy: function beforeDestroy () { - if (this._uid === this.$validator.id) { + if (this.$validator && this._uid === this.$validator.id) { this.$validator.errors.clear(); // remove errors generated by this component. } } @@ -29604,7 +29626,7 @@ var ErrorComponent = { } }; -var version = '2.1.0-beta.3'; +var version = '2.1.0-beta.5'; var rulesPlugin = function (ref) { var Validator$$1 = ref.Validator; @@ -29636,5 +29658,11 @@ var index_esm = { +/***/ }), +/* 9 */ +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + /***/ }) /******/ ]); \ No newline at end of file diff --git a/public/vendor/webkul/ui/assets/css/ui.css b/public/vendor/webkul/ui/assets/css/ui.css index c92fdb701..4d61ffdbe 100644 --- a/public/vendor/webkul/ui/assets/css/ui.css +++ b/public/vendor/webkul/ui/assets/css/ui.css @@ -1,4 +1,4 @@ -.icon-dashboard, .icon-configuration, .icon-settings, .active .icon-configuration { +.icon-dashboard, .icon-configuration, .icon-settings, .active .icon-configuration, .active.icon-configuration { width: 48px; height: 48px; margin-bottom: 10px; @@ -23,18 +23,6 @@ background-image: url("../images/Icon-Settings.svg"); } -.active .icon-dashboard { - background-image: url("../images/Icon-Dashboard-Active.svg"); -} - -.active .icon-settings { - background-image: url("../images/Icon-Settings-Active.svg"); -} - -.active .icon-configuration { - background-image: url("../images/Icon-Configure-Active.svg"); -} - .angle-right-icon { background-image: url("../images/Angle-Right.svg"); width: 17px; @@ -53,16 +41,94 @@ height: 8px; } -.arrow-down-icon-active { +.white-cross-sm-icon { + background-image: url("../images/Icon-Sm-Cross-White.svg"); + width: 18px; + height: 18px; +} + +.accordian-up-icon { + background-image: url("../images/Accordion-Arrow-Up.svg"); + width: 24px; + height: 24px; +} + +.accordian-down-icon { + background-image: url("../images/Accordion-Arrow-Down.svg"); + width: 24px; + height: 24px; +} + +.trash-icon { + background-image: url("../images/Icon-Trash.svg"); + width: 24px; + height: 24px; +} + +.remove-icon { + background-image: url("../images/Icon-remove.svg"); + width: 24px; + height: 24px; +} + +.pencil-lg-icon { + background-image: url("../images/Icon-Pencil-Large.svg"); + width: 24px; + height: 24px; +} + +.search-icon { + background-image: url("../images/icon-search.svg"); + width: 24px; + height: 24px; +} + +.sortable-icon { + background-image: url("../images/Icon-Sortable.svg"); + width: 24px; + height: 24px; +} + +.sort-down-icon { + background-image: url("../images/Icon-Sort-Down.svg"); + width: 18px; + height: 18px; +} + +.active .icon-dashboard { + background-image: url("../images/Icon-Dashboard-Active.svg"); +} + +.active .icon-settings { + background-image: url("../images/Icon-Settings-Active.svg"); +} + +.active .icon-configuration { + background-image: url("../images/Icon-Configure-Active.svg"); +} + +.active .arrow-down-icon { background-image: url("../images/Arrow-Down.svg"); width: 14px; height: 8px; } -.white-cross-sm-icon { - background-image: url("../images/Icon-Sm-Cross-White.svg"); - width: 18px; - height: 18px; +.active.icon-dashboard { + background-image: url("../images/Icon-Dashboard-Active.svg"); +} + +.active.icon-settings { + background-image: url("../images/Icon-Settings-Active.svg"); +} + +.active.icon-configuration { + background-image: url("../images/Icon-Configure-Active.svg"); +} + +.active.arrow-down-icon { + background-image: url("../images/Arrow-Down.svg"); + width: 14px; + height: 8px; } @-webkit-keyframes jelly { @@ -142,6 +208,7 @@ box-sizing: border-box; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; + font-weight: 500; } *:focus { @@ -168,6 +235,11 @@ h1 { margin-top: 0; } +h2 { + font-size: 18px; + color: #3A3A3A; +} + .btn { -webkit-box-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.2), 0 0 8px 0 rgba(0, 0, 0, 0.1); box-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.2), 0 0 8px 0 rgba(0, 0, 0, 0.1); @@ -177,6 +249,7 @@ h1 { cursor: pointer; -webkit-transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1); transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1); + font: inherit; } .btn:hover, .btn:active, .btn:focus { @@ -185,19 +258,19 @@ h1 { } .btn.btn-sm { - padding: 6px 10px; + padding: 6px 12px; } .btn.btn-md { - padding: 8px 12px; + padding: 8px 16px; } .btn.btn-lg { - padding: 10px 14px; + padding: 10px 20px; } .btn.btn-xl { - padding: 12px 16px; + padding: 12px 24px; } .btn.btn-primary { @@ -218,8 +291,8 @@ h1 { .dropdown-list { width: 200px; - -webkit-box-shadow: 0px 4px 15.36px 0.64px rgba(0, 0, 0, 0.1), 0px 2px 6px 0px rgba(0, 0, 0, 0.12); - box-shadow: 0px 4px 15.36px 0.64px rgba(0, 0, 0, 0.1), 0px 2px 6px 0px rgba(0, 0, 0, 0.12); + -webkit-box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.16), 0 0 9px 0 rgba(0, 0, 0, 0.16); + box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.16), 0 0 9px 0 rgba(0, 0, 0, 0.16); border-radius: 3px; background-color: #FFFFFF; position: absolute; @@ -387,6 +460,7 @@ h1 { margin: 0; display: inline-block !important; vertical-align: middle; + margin-right: 5px; } .checkbox input:checked + .checkbox-view { @@ -420,6 +494,7 @@ h1 { margin: 0; display: inline-block !important; vertical-align: middle; + margin-right: 5px; } .radio input:checked + .radio-view { @@ -445,6 +520,10 @@ h1 { color: #3A3A3A; } +.form-container .control-group textarea.control { + height: 100px; +} + .form-container .control-group .control { background: #fff; border: 2px solid #C7C7C7; @@ -478,7 +557,7 @@ h1 { } .form-container .control-group .control-error { - display: block; + display: none; color: #FF5656; margin-top: 5px; } @@ -487,12 +566,16 @@ h1 { border-color: #FC6868; } +.form-container .control-group.has-error .control-error { + display: block; +} + .alert-wrapper { width: 300px; top: 10px; right: 10px; position: fixed; - z-index: 3; + z-index: 6; } .alert-wrapper .alert { @@ -536,3 +619,58 @@ h1 { padding: 0px; font-size: 15px; } + +.tabs ul { + border-bottom: solid 1px rgba(162, 162, 162, 0.2); +} + +.tabs ul li { + display: inline-block; +} + +.tabs ul li a { + padding: 15px 20px; + cursor: pointer; + margin: 0px 2px; + text-align: center; + color: #000311; + display: block; +} + +.tabs ul li.active a { + border-bottom: 3px solid #0041FF; +} + +.accordian .accordian-header { + font-size: 18px; + color: #3A3A3A; + border-bottom: solid 1px rgba(162, 162, 162, 0.2); + padding: 20px 15px; + cursor: pointer; +} + +.accordian .accordian-header .icon { + float: right; +} + +.accordian .accordian-content { + padding: 20px 15px; + display: none; + -webkit-transition: 0.3s ease all; + transition: 0.3s ease all; +} + +.accordian.active .accordian-content { + display: inline-block; +} + +.tree-item { + padding-left: 30px; + display: inline-block; + width: 100%; +} + +.tree-item .checkbox { + margin: 0; + margin-bottom: 5px; +} diff --git a/public/vendor/webkul/ui/assets/images/Accordion-Arrow-Down.svg b/public/vendor/webkul/ui/assets/images/Accordion-Arrow-Down.svg new file mode 100644 index 000000000..89a62ef4b --- /dev/null +++ b/public/vendor/webkul/ui/assets/images/Accordion-Arrow-Down.svg @@ -0,0 +1,11 @@ + + + + Accordion-Arrow-Down + Created with Sketch. + + + + + + \ No newline at end of file diff --git a/public/vendor/webkul/ui/assets/images/Accordion-Arrow-Up.svg b/public/vendor/webkul/ui/assets/images/Accordion-Arrow-Up.svg new file mode 100644 index 000000000..e324e7362 --- /dev/null +++ b/public/vendor/webkul/ui/assets/images/Accordion-Arrow-Up.svg @@ -0,0 +1,11 @@ + + + + Accordion-Arrow-Up + Created with Sketch. + + + + + + \ No newline at end of file diff --git a/public/vendor/webkul/ui/assets/images/Icon-Pencil-Large.svg b/public/vendor/webkul/ui/assets/images/Icon-Pencil-Large.svg new file mode 100644 index 000000000..3c9ee9a97 --- /dev/null +++ b/public/vendor/webkul/ui/assets/images/Icon-Pencil-Large.svg @@ -0,0 +1,13 @@ + + + + Icon-Pencil-Large + Created with Sketch. + + + + + + + + \ No newline at end of file diff --git a/public/vendor/webkul/ui/assets/images/Icon-Sort-Down.svg b/public/vendor/webkul/ui/assets/images/Icon-Sort-Down.svg new file mode 100644 index 000000000..614a36b20 --- /dev/null +++ b/public/vendor/webkul/ui/assets/images/Icon-Sort-Down.svg @@ -0,0 +1,13 @@ + + + + Icon-Sort-Down + Created with Sketch. + + + + + + + + \ No newline at end of file diff --git a/public/vendor/webkul/ui/assets/images/Icon-Sortable.svg b/public/vendor/webkul/ui/assets/images/Icon-Sortable.svg new file mode 100644 index 000000000..ba23da4ab --- /dev/null +++ b/public/vendor/webkul/ui/assets/images/Icon-Sortable.svg @@ -0,0 +1,14 @@ + + + + Icon-Sortable + Created with Sketch. + + + + + + + + + \ No newline at end of file diff --git a/public/vendor/webkul/ui/assets/images/Icon-Trash.svg b/public/vendor/webkul/ui/assets/images/Icon-Trash.svg new file mode 100644 index 000000000..0267d04ce --- /dev/null +++ b/public/vendor/webkul/ui/assets/images/Icon-Trash.svg @@ -0,0 +1,14 @@ + + + + Icon-Trash + Created with Sketch. + + + + + + + + + \ No newline at end of file diff --git a/public/vendor/webkul/ui/assets/images/Icon-remove.svg b/public/vendor/webkul/ui/assets/images/Icon-remove.svg new file mode 100644 index 000000000..30faa6d06 --- /dev/null +++ b/public/vendor/webkul/ui/assets/images/Icon-remove.svg @@ -0,0 +1,14 @@ + + + + Icon-remove + Created with Sketch. + + + + + + + + + \ No newline at end of file diff --git a/public/vendor/webkul/ui/assets/images/icon-search.svg b/public/vendor/webkul/ui/assets/images/icon-search.svg new file mode 100644 index 000000000..0129f7120 --- /dev/null +++ b/public/vendor/webkul/ui/assets/images/icon-search.svg @@ -0,0 +1,11 @@ + + + + icon-search + Created with Sketch. + + + + + + \ No newline at end of file diff --git a/public/vendor/webkul/ui/assets/js/ui.js b/public/vendor/webkul/ui/assets/js/ui.js index 2ca985300..c416e1709 100644 --- a/public/vendor/webkul/ui/assets/js/ui.js +++ b/public/vendor/webkul/ui/assets/js/ui.js @@ -64,99 +64,7 @@ /******/ }) /************************************************************************/ /******/ ([ -/* 0 */, -/* 1 */ -/***/ (function(module, exports, __webpack_require__) { - -__webpack_require__(2); -__webpack_require__(11); -module.exports = __webpack_require__(13); - - -/***/ }), -/* 2 */ -/***/ (function(module, exports, __webpack_require__) { - -$(document).ready(function () { - function addFlash(flash) { - flashMessages.push(flash); - } - - Vue.component('flash-wrapper', __webpack_require__(18)); - Vue.component('flash', __webpack_require__(7)); - - var app = new Vue({ - el: '#app', - - mounted: function mounted() { - this.addFlashMessages(); - }, - - methods: { - addFlashMessages: function addFlashMessages() { - var flashes = this.$refs.flashes; - - flashMessages.forEach(function (flash) { - flashes.addFlash(flash); - }, this); - } - } - }); -}); - -/***/ }), -/* 3 */, -/* 4 */, -/* 5 */, -/* 6 */, -/* 7 */ -/***/ (function(module, exports, __webpack_require__) { - -var disposed = false -var normalizeComponent = __webpack_require__(8) -/* script */ -var __vue_script__ = __webpack_require__(9) -/* template */ -var __vue_template__ = __webpack_require__(10) -/* template functional */ -var __vue_template_functional__ = false -/* styles */ -var __vue_styles__ = null -/* scopeId */ -var __vue_scopeId__ = null -/* moduleIdentifier (server only) */ -var __vue_module_identifier__ = null -var Component = normalizeComponent( - __vue_script__, - __vue_template__, - __vue_template_functional__, - __vue_styles__, - __vue_scopeId__, - __vue_module_identifier__ -) -Component.options.__file = "src/Resources/assets/js/components/flash.vue" - -/* hot reload */ -if (false) {(function () { - var hotAPI = require("vue-hot-reload-api") - hotAPI.install(require("vue"), false) - if (!hotAPI.compatible) return - module.hot.accept() - if (!module.hot.data) { - hotAPI.createRecord("data-v-feee1d58", Component.options) - } else { - hotAPI.reload("data-v-feee1d58", Component.options) - } - module.hot.dispose(function (data) { - disposed = true - }) -})()} - -module.exports = Component.exports - - -/***/ }), -/* 8 */ +/* 0 */ /***/ (function(module, exports) { /* globals __VUE_SSR_CONTEXT__ */ @@ -265,7 +173,202 @@ module.exports = function normalizeComponent ( /***/ }), -/* 9 */ +/* 1 */ +/***/ (function(module, exports, __webpack_require__) { + +__webpack_require__(2); +__webpack_require__(17); +module.exports = __webpack_require__(19); + + +/***/ }), +/* 2 */ +/***/ (function(module, exports, __webpack_require__) { + +Vue.component('flash-wrapper', __webpack_require__(3)); +Vue.component('flash', __webpack_require__(6)); +Vue.component('accordian', __webpack_require__(9)); +Vue.component('tree-view', __webpack_require__(12)); +Vue.component('tree-checkbox', __webpack_require__(14)); + +/***/ }), +/* 3 */ +/***/ (function(module, exports, __webpack_require__) { + +var disposed = false +var normalizeComponent = __webpack_require__(0) +/* script */ +var __vue_script__ = __webpack_require__(4) +/* template */ +var __vue_template__ = __webpack_require__(5) +/* template functional */ +var __vue_template_functional__ = false +/* styles */ +var __vue_styles__ = null +/* scopeId */ +var __vue_scopeId__ = null +/* moduleIdentifier (server only) */ +var __vue_module_identifier__ = null +var Component = normalizeComponent( + __vue_script__, + __vue_template__, + __vue_template_functional__, + __vue_styles__, + __vue_scopeId__, + __vue_module_identifier__ +) +Component.options.__file = "src/Resources/assets/js/components/flash-wrapper.vue" + +/* hot reload */ +if (false) {(function () { + var hotAPI = require("vue-hot-reload-api") + hotAPI.install(require("vue"), false) + if (!hotAPI.compatible) return + module.hot.accept() + if (!module.hot.data) { + hotAPI.createRecord("data-v-34b58a1a", Component.options) + } else { + hotAPI.reload("data-v-34b58a1a", Component.options) + } + module.hot.dispose(function (data) { + disposed = true + }) +})()} + +module.exports = Component.exports + + +/***/ }), +/* 4 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// + +/* harmony default export */ __webpack_exports__["default"] = ({ + data: function data() { + return { + uid: 1, + + flashes: [] + }; + }, + + methods: { + addFlash: function addFlash(flash) { + flash.uid = this.uid++; + this.flashes.push(flash); + }, + + removeFlash: function removeFlash(flash) { + var index = this.flashes.indexOf(flash); + + this.flashes.splice(index, 1); + } + } +}); + +/***/ }), +/* 5 */ +/***/ (function(module, exports, __webpack_require__) { + +var render = function() { + var _vm = this + var _h = _vm.$createElement + var _c = _vm._self._c || _h + return _c( + "transition-group", + { + staticClass: "alert-wrapper", + attrs: { tag: "div", name: "flash-wrapper" } + }, + _vm._l(_vm.flashes, function(flash, index) { + return _c("flash", { + key: flash.uid, + attrs: { flash: flash }, + on: { + onRemoveFlash: function($event) { + _vm.removeFlash($event) + } + } + }) + }) + ) +} +var staticRenderFns = [] +render._withStripped = true +module.exports = { render: render, staticRenderFns: staticRenderFns } +if (false) { + module.hot.accept() + if (module.hot.data) { + require("vue-hot-reload-api") .rerender("data-v-34b58a1a", module.exports) + } +} + +/***/ }), +/* 6 */ +/***/ (function(module, exports, __webpack_require__) { + +var disposed = false +var normalizeComponent = __webpack_require__(0) +/* script */ +var __vue_script__ = __webpack_require__(7) +/* template */ +var __vue_template__ = __webpack_require__(8) +/* template functional */ +var __vue_template_functional__ = false +/* styles */ +var __vue_styles__ = null +/* scopeId */ +var __vue_scopeId__ = null +/* moduleIdentifier (server only) */ +var __vue_module_identifier__ = null +var Component = normalizeComponent( + __vue_script__, + __vue_template__, + __vue_template_functional__, + __vue_styles__, + __vue_scopeId__, + __vue_module_identifier__ +) +Component.options.__file = "src/Resources/assets/js/components/flash.vue" + +/* hot reload */ +if (false) {(function () { + var hotAPI = require("vue-hot-reload-api") + hotAPI.install(require("vue"), false) + if (!hotAPI.compatible) return + module.hot.accept() + if (!module.hot.data) { + hotAPI.createRecord("data-v-feee1d58", Component.options) + } else { + hotAPI.reload("data-v-feee1d58", Component.options) + } + module.hot.dispose(function (data) { + disposed = true + }) +})()} + +module.exports = Component.exports + + +/***/ }), +/* 7 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -296,7 +399,7 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); }); /***/ }), -/* 10 */ +/* 8 */ /***/ (function(module, exports, __webpack_require__) { var render = function() { @@ -322,11 +425,519 @@ if (false) { } } +/***/ }), +/* 9 */ +/***/ (function(module, exports, __webpack_require__) { + +var disposed = false +var normalizeComponent = __webpack_require__(0) +/* script */ +var __vue_script__ = __webpack_require__(10) +/* template */ +var __vue_template__ = __webpack_require__(11) +/* template functional */ +var __vue_template_functional__ = false +/* styles */ +var __vue_styles__ = null +/* scopeId */ +var __vue_scopeId__ = null +/* moduleIdentifier (server only) */ +var __vue_module_identifier__ = null +var Component = normalizeComponent( + __vue_script__, + __vue_template__, + __vue_template_functional__, + __vue_styles__, + __vue_scopeId__, + __vue_module_identifier__ +) +Component.options.__file = "src/Resources/assets/js/components/accordian.vue" + +/* hot reload */ +if (false) {(function () { + var hotAPI = require("vue-hot-reload-api") + hotAPI.install(require("vue"), false) + if (!hotAPI.compatible) return + module.hot.accept() + if (!module.hot.data) { + hotAPI.createRecord("data-v-d9e5880c", Component.options) + } else { + hotAPI.reload("data-v-d9e5880c", Component.options) + } + module.hot.dispose(function (data) { + disposed = true + }) +})()} + +module.exports = Component.exports + + +/***/ }), +/* 10 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); +// +// +// +// +// +// +// +// +// + +/* harmony default export */ __webpack_exports__["default"] = ({ + props: { + title: String, + active: Boolean + }, + + data: function data() { + return { + isActive: false + }; + }, + + mounted: function mounted() { + this.isActive = this.active; + }, + + methods: { + toggleAccordion: function toggleAccordion() { + this.isActive = !this.isActive; + } + }, + + computed: { + iconClass: function iconClass() { + return { + 'accordian-down-icon': !this.isActive, + 'accordian-up-icon': this.isActive + }; + } + } +}); + /***/ }), /* 11 */ /***/ (function(module, exports, __webpack_require__) { -window.jQuery = window.$ = $ = __webpack_require__(12); +var render = function() { + var _vm = this + var _h = _vm.$createElement + var _c = _vm._self._c || _h + return _c( + "div", + { staticClass: "accordian", class: { active: _vm.isActive } }, + [ + _c( + "div", + { + staticClass: "accordian-header", + on: { + click: function($event) { + _vm.toggleAccordion() + } + } + }, + [ + _vm._v("\n " + _vm._s(_vm.title) + "\n "), + _c("i", { staticClass: "icon", class: _vm.iconClass }) + ] + ), + _vm._v(" "), + _vm._t("default") + ], + 2 + ) +} +var staticRenderFns = [] +render._withStripped = true +module.exports = { render: render, staticRenderFns: staticRenderFns } +if (false) { + module.hot.accept() + if (module.hot.data) { + require("vue-hot-reload-api") .rerender("data-v-d9e5880c", module.exports) + } +} + +/***/ }), +/* 12 */ +/***/ (function(module, exports, __webpack_require__) { + +var disposed = false +var normalizeComponent = __webpack_require__(0) +/* script */ +var __vue_script__ = __webpack_require__(13) +/* template */ +var __vue_template__ = null +/* template functional */ +var __vue_template_functional__ = false +/* styles */ +var __vue_styles__ = null +/* scopeId */ +var __vue_scopeId__ = null +/* moduleIdentifier (server only) */ +var __vue_module_identifier__ = null +var Component = normalizeComponent( + __vue_script__, + __vue_template__, + __vue_template_functional__, + __vue_styles__, + __vue_scopeId__, + __vue_module_identifier__ +) +Component.options.__file = "src/Resources/assets/js/components/tree-view/tree-view.vue" + +/* hot reload */ +if (false) {(function () { + var hotAPI = require("vue-hot-reload-api") + hotAPI.install(require("vue"), false) + if (!hotAPI.compatible) return + module.hot.accept() + if (!module.hot.data) { + hotAPI.createRecord("data-v-2c07aa7d", Component.options) + } else { + hotAPI.reload("data-v-2c07aa7d", Component.options) + } + module.hot.dispose(function (data) { + disposed = true + }) +})()} + +module.exports = Component.exports + + +/***/ }), +/* 13 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); +function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } + +/* harmony default export */ __webpack_exports__["default"] = ({ + name: 'tree-view', + + inheritAttrs: false, + + props: { + items: { + type: Object, + required: false, + default: function _default() { + return { + "name": "Root", + "value": "1", + "children": [{ + "name": "First Child", + "value": "2" + }, { + "name": "Second Child", + "value": "3", + "children": [{ + "name": "GrandChild 1", + "value": "4" + }, { + "name": "GrandChild 2", + "value": "5" + }, { + "name": "GrandChild 3", + "value": "6" + }] + }] + }; + } + }, + + value: { + type: Array, + required: false, + default: function _default() { + return []; + } + } + }, + + computed: { + allChildren: function allChildren() { + var leafs = []; + var searchTree = function searchTree(items) { + if (!!items['children'] && items['children'].length > 0) { + items['children'].forEach(function (child) { + return searchTree(child); + }); + } else { + leafs.push(items); + } + }; + + searchTree(this.items); + + return leafs; + }, + hasChildren: function hasChildren() { + return !!this.items['children'] && this.items['children'].length > 0; + }, + hasSelection: function hasSelection() { + return !!this.value && this.value.length > 0; + }, + isAllChildrenSelected: function isAllChildrenSelected() { + var _this = this; + + return this.hasChildren && this.hasSelection && this.allChildren.every(function (leaf) { + return _this.value.some(function (sel) { + return sel === leaf; + }); + }); + }, + isSomeChildrenSelected: function isSomeChildrenSelected() { + var _this2 = this; + + return this.hasSelection && this.allChildren.some(function (leaf) { + return _this2.value.some(function (sel) { + return sel === leaf; + }); + }); + } + }, + + methods: { + generateRoot: function generateRoot() { + var _this3 = this; + + return this.$createElement('tree-checkbox', { + props: { + label: this.items['name'], + inputValue: this.hasChildren ? this.isAllChildrenSelected : this.value, + value: this.hasChildren ? this.isAllChildrenSelected : this.items + }, + on: { + change: function change(selection) { + if (_this3.hasChildren) { + if (_this3.isAllChildrenSelected) { + _this3.allChildren.forEach(function (leaf) { + var index = _this3.value.indexOf(leaf); + _this3.value.splice(index, 1); + }); + } else { + _this3.allChildren.forEach(function (leaf) { + var index = _this3.value.indexOf(leaf); + if (index === -1) { + _this3.value.push(leaf); + } + }); + } + + _this3.$emit('input', _this3.value); + } else { + _this3.$emit('input', selection); + } + } + } + }); + }, + generateChild: function generateChild(child) { + var _this4 = this; + + return this.$createElement('tree-view', { + class: 'tree-item', + on: { + input: function input(selection) { + _this4.$emit('input', selection); + } + }, + props: { + items: child, + value: this.value + } + }); + }, + generateChildren: function generateChildren() { + var _this5 = this; + + var childElements = []; + if (this.items['children']) { + this.items['children'].forEach(function (child) { + childElements.push(_this5.generateChild(child)); + }); + } + + return childElements; + } + }, + + render: function render(createElement) { + return createElement('div', {}, [this.generateRoot()].concat(_toConsumableArray(this.generateChildren()))); + } +}); + +/***/ }), +/* 14 */ +/***/ (function(module, exports, __webpack_require__) { + +var disposed = false +var normalizeComponent = __webpack_require__(0) +/* script */ +var __vue_script__ = __webpack_require__(15) +/* template */ +var __vue_template__ = __webpack_require__(16) +/* template functional */ +var __vue_template_functional__ = false +/* styles */ +var __vue_styles__ = null +/* scopeId */ +var __vue_scopeId__ = null +/* moduleIdentifier (server only) */ +var __vue_module_identifier__ = null +var Component = normalizeComponent( + __vue_script__, + __vue_template__, + __vue_template_functional__, + __vue_styles__, + __vue_scopeId__, + __vue_module_identifier__ +) +Component.options.__file = "src/Resources/assets/js/components/tree-view/tree-checkbox.vue" + +/* hot reload */ +if (false) {(function () { + var hotAPI = require("vue-hot-reload-api") + hotAPI.install(require("vue"), false) + if (!hotAPI.compatible) return + module.hot.accept() + if (!module.hot.data) { + hotAPI.createRecord("data-v-0c27ec9b", Component.options) + } else { + hotAPI.reload("data-v-0c27ec9b", Component.options) + } + module.hot.dispose(function (data) { + disposed = true + }) +})()} + +module.exports = Component.exports + + +/***/ }), +/* 15 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); +// +// +// +// +// +// +// +// + +/* harmony default export */ __webpack_exports__["default"] = ({ + name: 'tree-checkbox', + + props: ['label', 'inputValue', 'value'], + + methods: { + inputChanged: function inputChanged(e) { + this.$emit('change', this.inputValue); + }, + valueComparator: function valueComparator(a, b) { + var _this = this; + + if (a === b) return true; + + if (a !== Object(a) || b !== Object(b)) { + return false; + } + + var props = Object.keys(a); + + if (props.length !== Object.keys(b).length) { + return false; + } + + return props.every(function (p) { + return _this.valueComparator(a[p], b[p]); + }); + } + }, + + computed: { + isMultiple: function isMultiple() { + return Array.isArray(this.inputValue); + }, + isActive: function isActive() { + var _this2 = this; + + var value = this.value; + var input = this.inputValue; + + if (this.isMultiple) { + if (!Array.isArray(input)) return false; + + return input.some(function (item) { + return _this2.valueComparator(item, value); + }); + } + + var isChecked = value ? this.valueComparator(value, input) : Boolean(input); + + return isChecked; + } + } +}); + +/***/ }), +/* 16 */ +/***/ (function(module, exports, __webpack_require__) { + +var render = function() { + var _vm = this + var _h = _vm.$createElement + var _c = _vm._self._c || _h + return _c("span", { staticClass: "checkbox" }, [ + _c("input", { + attrs: { type: "checkbox", name: "permissions[]", id: _vm.inputValue }, + domProps: { value: _vm.inputValue.value, checked: _vm.isActive }, + on: { + change: function($event) { + _vm.inputChanged($event) + } + } + }), + _vm._v(" "), + _c("label", { + staticClass: "checkbox-view", + attrs: { for: _vm.inputValue } + }), + _vm._v( + "\n " + + _vm._s(_vm.inputValue) + + " ======== " + + _vm._s(_vm.value) + + "\n" + ) + ]) +} +var staticRenderFns = [] +render._withStripped = true +module.exports = { render: render, staticRenderFns: staticRenderFns } +if (false) { + module.hot.accept() + if (module.hot.data) { + require("vue-hot-reload-api") .rerender("data-v-0c27ec9b", module.exports) + } +} + +/***/ }), +/* 17 */ +/***/ (function(module, exports, __webpack_require__) { + +window.jQuery = window.$ = $ = __webpack_require__(18); $(function () { $(document).click(function (e) { @@ -391,7 +1002,7 @@ $(function () { }); /***/ }), -/* 12 */ +/* 18 */ /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! @@ -10762,143 +11373,10 @@ return jQuery; /***/ }), -/* 13 */ +/* 19 */ /***/ (function(module, exports) { // removed by extract-text-webpack-plugin -/***/ }), -/* 14 */, -/* 15 */, -/* 16 */, -/* 17 */, -/* 18 */ -/***/ (function(module, exports, __webpack_require__) { - -var disposed = false -var normalizeComponent = __webpack_require__(8) -/* script */ -var __vue_script__ = __webpack_require__(19) -/* template */ -var __vue_template__ = __webpack_require__(20) -/* template functional */ -var __vue_template_functional__ = false -/* styles */ -var __vue_styles__ = null -/* scopeId */ -var __vue_scopeId__ = null -/* moduleIdentifier (server only) */ -var __vue_module_identifier__ = null -var Component = normalizeComponent( - __vue_script__, - __vue_template__, - __vue_template_functional__, - __vue_styles__, - __vue_scopeId__, - __vue_module_identifier__ -) -Component.options.__file = "src/Resources/assets/js/components/flash-wrapper.vue" - -/* hot reload */ -if (false) {(function () { - var hotAPI = require("vue-hot-reload-api") - hotAPI.install(require("vue"), false) - if (!hotAPI.compatible) return - module.hot.accept() - if (!module.hot.data) { - hotAPI.createRecord("data-v-34b58a1a", Component.options) - } else { - hotAPI.reload("data-v-34b58a1a", Component.options) - } - module.hot.dispose(function (data) { - disposed = true - }) -})()} - -module.exports = Component.exports - - -/***/ }), -/* 19 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// - -/* harmony default export */ __webpack_exports__["default"] = ({ - data: function data() { - return { - uid: 1, - - flashes: [] - }; - }, - - methods: { - addFlash: function addFlash(flash) { - flash.uid = this.uid++; - this.flashes.push(flash); - }, - - removeFlash: function removeFlash(flash) { - var index = this.flashes.indexOf(flash); - - this.flashes.splice(index, 1); - } - } -}); - -/***/ }), -/* 20 */ -/***/ (function(module, exports, __webpack_require__) { - -var render = function() { - var _vm = this - var _h = _vm.$createElement - var _c = _vm._self._c || _h - return _c( - "transition-group", - { - staticClass: "alert-wrapper", - attrs: { tag: "div", name: "flash-wrapper" } - }, - _vm._l(_vm.flashes, function(flash, index) { - return _c("flash", { - key: flash.uid, - attrs: { flash: flash }, - on: { - onRemoveFlash: function($event) { - _vm.removeFlash($event) - } - } - }) - }) - ) -} -var staticRenderFns = [] -render._withStripped = true -module.exports = { render: render, staticRenderFns: staticRenderFns } -if (false) { - module.hot.accept() - if (module.hot.data) { - require("vue-hot-reload-api") .rerender("data-v-34b58a1a", module.exports) - } -} - /***/ }) /******/ ]); \ No newline at end of file