@php $user = auth()->user(); $merchant_user = $user->merchantId(); $special_role = isset($role) && $role->isSpecial() ? true : false; @endphp
{!! Form::label('name', trans('app.form.name') . '*', ['class' => 'with-help']) !!} {!! Form::text('name', null, ['class' => 'form-control', 'placeholder' => trans('app.placeholder.role_name'), 'required']) !!}
@unless ($merchant_user)
{!! Form::label('public', trans('app.form.role_type') . '*', ['class' => 'with-help']) !!} {{ Form::hidden('public', null) }} {!! Form::select('public', ['0' => trans('app.platform'), '1' => trans('app.merchant')], null, ['id' => $special_role ? '' : 'user-role-status', 'class' => 'form-control select2-normal', 'placeholder' => trans('app.placeholder.status'), $special_role ? 'disabled' : 'required']) !!}
@endunless
{!! Form::label('level', trans('app.form.role_level'), ['class' => 'with-help']) !!} @if ($user->accessLevel())
{{ trans('help.number_between', ['min' => $user->accessLevel(), 'max' => config('system_settings.max_role_level')]) }}
@endif {!! Form::number('level', null, ['class' => 'form-control', 'placeholder' => trans('app.placeholder.role_level'), 'min' => $user->accessLevel(), 'max' => config('system_settings.max_role_level'), $user->accessLevel() ? '' : 'disabled']) !!}
{!! Form::label('description', trans('app.form.description')) !!} {!! Form::textarea('description', null, ['class' => 'form-control summernote-without-toolbar', 'placeholder' => trans('app.placeholder.description')]) !!}
{!! Form::label('modules', trans('app.modules'), ['class' => 'with-help']) !!} {!! Form::label('permissions', trans('app.form.permissions'), ['class' => 'with-help']) !!}
@php $role_permissions = isset($role) ? $role->permissions()->pluck('slug')->toArray() : []; @endphp @foreach ($modules as $module) @php $access_level = Str::snake($module->access); $module_name = Str::snake($module->name); $module_enabled = find_string_in_array($role_permissions, $module_name); @endphp @if (!$merchant_user || ('common' == $access_level || 'merchant' == $access_level)) public == 1 && 'merchant' == $access_level) || ($role->id == \App\Models\Role::MERCHANT && 'merchant' == $access_level) || ($role->shop_id == null && $role->public != 1 && 'platform' == $access_level && $role->id != \App\Models\Role::MERCHANT))) ? 'show' : 'hidden' }}> @foreach ($module->permissions as $permission) @endforeach @endif @endforeach
{{ Form::hidden($module_name, 0) }} {!! Form::checkbox($module_name, null, $module_enabled ? 1 : null, ['id' => $module_name, 'class' => 'icheckbox_line role-module']) !!} {!! Form::label($module_name, strtoupper($module->name)) !!}

* {{ trans('app.form.required_fields') }}