A free open source IT asset/license management system
Bulk user edit converted to blade component
snipe96ab0caf5d7f
diff --git a/resources/views/blade/input/department-select.blade.php b/resources/views/blade/input/department-select.blade.phpnew file mode 100644index 0000000000..5bcf6ba756--- /dev/null+++ b/resources/views/blade/input/department-select.blade.php@@ -0,0 +1,43 @@+@use('App\Models\Department', 'Department')+@use('Illuminate\Support\Arr', 'Arr')++@props([+ 'label',+ 'name',+ 'selected' => null,+ 'required' => false,+ 'multiple' => false,+])++<div+ @class([+ 'form-group',+ 'has-error' => $errors->has($name),+ ])+>+ <label for="{{ $name }}_select" class="col-md-3 control-label">{{ $label }}</label>+ <div class="col-md-6">+ <select+ class="js-data-ajax"+ data-endpoint="departments"+ data-placeholder="{{ trans('general.select_department') }}"+ name="{{ $name }}{{ $multiple ? '[]' : '' }}"+ id="{{ $name }}_select"+ style="width: 100%"+ aria-label="{{ $label }}"+ @required($required)+ @if ($multiple) multiple @endif+ >+ <option value="" role="option">{{ trans('general.select_department') }}</option>+ @if ($selected)+ @foreach (Arr::wrap($selected) as $value)+ <option value="{{ $value }}" selected="selected" role="option" aria-selected="true">+ {{ Department::find($value)?->name }}+ </option>+ @endforeach+ @endif+ </select>+ </div>++ <div class="col-md-8 col-md-offset-3"><x-form.error :name="$name" /></div>+</div>diff --git a/resources/views/users/bulk-edit.blade.php b/resources/views/users/bulk-edit.blade.phpindex 736a01a10b..81f502e5e0 100644--- a/resources/views/users/bulk-edit.blade.php+++ b/resources/views/users/bulk-edit.blade.php@@ -28,15 +28,21 @@<x-demo-callout />- {{-- Department --}}- @include ('partials.forms.edit.department-select', ['translated_name' => trans('general.department'), 'fieldname' => 'department_id'])+ <x-input.department-select+ :label="trans('general.department')"+ name="department_id"+ :selected="old('department_id')"+ /><x-form.checkbox-rowname="null_department_id":label="trans_choice('general.set_users_field_to_null', count($users), ['field' => trans('general.department'), 'user_count' => count($users)])"/>- {{-- Location --}}- @include ('partials.forms.edit.location-select', ['translated_name' => trans('general.location'), 'fieldname' => 'location_id'])+ <x-input.location-select+ :label="trans('general.location')"+ name="location_id"+ :selected="old('location_id')"+ /><x-form.checkbox-rowname="null_location_id":label="trans_choice('general.set_users_field_to_null', count($users), ['field' => trans('general.location'), 'user_count' => count($users)])"@@ -44,7 +50,12 @@{{-- Company (gated on the FMCS + acting user check) --}}@if (\App\Models\Company::canManageUsersCompanies())- @include ('partials.forms.edit.company-select', ['translated_name' => trans('general.select_company'), 'fieldname' => 'company_ids', 'multiple' => 'true'])+ <x-input.company-select+ :label="trans('general.select_company')"+ name="company_ids"+ :multiple="true"+ :selected="old('company_ids')"+ /><x-form.checkbox-rowname="null_company_ids":label="trans_choice('general.set_users_field_to_null', count($users), ['field' => trans('general.companies'), 'user_count' => count($users)])"