Skip to content

Commit

Permalink
User edit form assign section control
Browse files Browse the repository at this point in the history
  • Loading branch information
cuneytsenturk committed Nov 1, 2022
1 parent 77338ea commit be044e3
Showing 1 changed file with 26 additions and 24 deletions.
50 changes: 26 additions & 24 deletions resources/views/auth/users/edit.blade.php
Expand Up @@ -38,21 +38,23 @@
</x-slot>
</x-form.section>

<x-form.section>
<x-slot name="head">
<x-form.section.head title="{{ trans('general.assign') }}" description="{!! trans('auth.form_description.assign', ['url' => $roles_url]) !!}" />
</x-slot>

<x-slot name="body">
@can('read-common-companies')
<x-form.group.select multiple remote name="companies" label="{{ trans_choice('general.companies', 2) }}" :options="$companies" selected-key="company_ids" :remote_action="route('companies.index')" form-group-class="sm:col-span-6" />
@endcan

@role('admin|manager')
<x-form.group.select name="roles" label="{{ trans_choice('general.roles', 1) }}" :options="$roles" selected-key="roles.id" />
@endrole
</x-slot>
</x-form.section>
@if (user()->can('read-common-companies') || user()->hasRole(['admin', 'manager']))
<x-form.section>
<x-slot name="head">
<x-form.section.head title="{{ trans('general.assign') }}" description="{!! trans('auth.form_description.assign', ['url' => $roles_url]) !!}" />
</x-slot>

<x-slot name="body">
@can('read-common-companies')
<x-form.group.select multiple remote name="companies" label="{{ trans_choice('general.companies', 2) }}" :options="$companies" selected-key="company_ids" :remote_action="route('companies.index')" form-group-class="sm:col-span-6" />
@endcan

@role('admin|manager')
<x-form.group.select name="roles" label="{{ trans_choice('general.roles', 1) }}" :options="$roles" selected-key="roles.id" />
@endrole
</x-slot>
</x-form.section>
@endif

<x-form.section>
<x-slot name="head">
Expand All @@ -69,15 +71,15 @@
<x-form.group.switch name="enabled" label="{{ trans('general.enabled') }}" />

@canany(['update-auth-users', 'update-auth-profile'])
<x-form.section>
<x-slot name="foot">
@if (user()->can('read-auth-users'))
<x-form.buttons cancel-route="users.index" />
@else
<x-form.buttons cancel-route="dashboard" />
@endif
</x-slot>
</x-form.section>
<x-form.section>
<x-slot name="foot">
@if (user()->can('read-auth-users'))
<x-form.buttons cancel-route="users.index" />
@else
<x-form.buttons cancel-route="dashboard" />
@endif
</x-slot>
</x-form.section>
@endcanany
</x-form>
</x-form.container>
Expand Down

0 comments on commit be044e3

Please sign in to comment.