Merge remote-tracking branch 'origin/master' into develop
This commit is contained in:
@@ -211,6 +211,7 @@ $(function () {
|
||||
page: params.page || 1,
|
||||
statusType: link.data("asset-status-type"),
|
||||
companyId: link.data("company-ids") || link.data("company-id"),
|
||||
excludeId: link.data("exclude-id"),
|
||||
};
|
||||
return data;
|
||||
},
|
||||
@@ -468,8 +469,15 @@ $(function () {
|
||||
syncCheckoutToTypeUi(true);
|
||||
});
|
||||
|
||||
// Apply the current radio selection on initial render.
|
||||
syncCheckoutToTypeUi(false);
|
||||
// Apply the current radio selection on initial render, but only when the
|
||||
// selector row itself is already visible. On the asset create page the selector
|
||||
// starts hidden (display:none) and user_add() reveals it after a deployability
|
||||
// AJAX check — running here would prematurely show a panel before the radio
|
||||
// group is visible. On the standalone checkout page the selector is visible
|
||||
// from the start, so the sync runs normally there.
|
||||
if ($('#assignto_selector').is(':visible')) {
|
||||
syncCheckoutToTypeUi(false);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -121,7 +121,7 @@
|
||||
@include ('partials.forms.checkout-selector', ['user_select' => 'true','asset_select' => 'true', 'location_select' => 'true'])
|
||||
@include ('partials.forms.edit.user-select', ['translated_name' => trans('general.user'), 'fieldname' => 'assigned_user', 'company_id' => $asset->company_id, 'style' => (session('checkout_to_type') ?: 'user') == 'user' ? '' : 'display: none;'])
|
||||
<!-- We have to pass unselect here so that we don't default to the asset that's being checked out. We want that asset to be pre-selected everywhere else. -->
|
||||
@include ('partials.forms.edit.asset-select', ['translated_name' => trans('general.select_asset'), 'fieldname' => 'assigned_asset', 'company_id' => $asset->company_id, 'unselect' => 'true', 'style' => session('checkout_to_type') == 'asset' ? '' : 'display: none;'])
|
||||
@include ('partials.forms.edit.asset-select', ['translated_name' => trans('general.select_asset'), 'fieldname' => 'assigned_asset', 'company_id' => $asset->company_id, 'unselect' => 'true', 'exclude_id' => $asset->id, 'style' => session('checkout_to_type') == 'asset' ? '' : 'display: none;'])
|
||||
@include ('partials.forms.edit.location-select', ['translated_name' => trans('general.location'), 'fieldname' => 'assigned_location', 'company_id' => $asset->company_id, 'style' => session('checkout_to_type') == 'location' ? '' : 'display: none;'])
|
||||
|
||||
|
||||
|
||||
@@ -100,9 +100,9 @@
|
||||
@include ('partials.forms.edit.status', [ 'required' => 'true'])
|
||||
@if (!$item->id)
|
||||
@include ('partials.forms.checkout-selector', ['user_select' => 'true','asset_select' => 'true', 'location_select' => 'true', 'style' => 'display:none;'])
|
||||
@include ('partials.forms.edit.user-select', ['translated_name' => trans('admin/hardware/form.checkout_to'), 'fieldname' => 'assigned_user', 'style' => 'display:none;', 'required' => 'false'])
|
||||
@include ('partials.forms.edit.asset-select', ['translated_name' => trans('admin/hardware/form.checkout_to'), 'fieldname' => 'assigned_asset', 'style' => 'display:none;', 'required' => 'false'])
|
||||
@include ('partials.forms.edit.location-select', ['translated_name' => trans('admin/hardware/form.checkout_to'), 'fieldname' => 'assigned_location', 'style' => 'display:none;', 'required' => 'false'])
|
||||
@include ('partials.forms.edit.user-select', ['translated_name' => trans('general.user'), 'fieldname' => 'assigned_user', 'style' => 'display:none;', 'required' => 'false'])
|
||||
@include ('partials.forms.edit.asset-select', ['translated_name' => trans('general.asset'), 'fieldname' => 'assigned_asset', 'style' => 'display:none;', 'required' => 'false'])
|
||||
@include ('partials.forms.edit.location-select', ['translated_name' => trans('general.location'), 'fieldname' => 'assigned_location', 'style' => 'display:none;', 'required' => 'false'])
|
||||
@endif
|
||||
|
||||
@include ('partials.forms.edit.notes')
|
||||
@@ -282,16 +282,21 @@
|
||||
$("#selected_status_status").fadeIn();
|
||||
|
||||
if (data == true) {
|
||||
var checkoutType = $('input[name=checkout_to_type]:checked').val() || 'user';
|
||||
$("#assignto_selector").show();
|
||||
$("#assigned_user").show();
|
||||
$("#assigned_user").toggle(checkoutType === 'user');
|
||||
$("#assigned_asset").toggle(checkoutType === 'asset');
|
||||
$("#assigned_location").toggle(checkoutType === 'location');
|
||||
|
||||
$("#selected_status_status").removeClass('text-danger');
|
||||
$("#selected_status_status").addClass('text-success');
|
||||
$("#selected_status_status").html('<x-icon type="checkmark" /> {{ trans_choice('admin/hardware/form.asset_deployable', 1)}}');
|
||||
|
||||
|
||||
} else {
|
||||
$("#assignto_selector").hide();
|
||||
$("#assigned_user").hide();
|
||||
$("#assigned_asset").hide();
|
||||
$("#assigned_location").hide();
|
||||
$("#selected_status_status").removeClass('text-success');
|
||||
$("#selected_status_status").addClass('text-danger');
|
||||
$("#selected_status_status").html('<x-icon type="warning" /> {{ (($item->assigned_to!='') && ($item->assigned_type!='') && ($item->deleted_at == '')) ? trans_choice('admin/hardware/form.asset_not_deployable_checkin', 1) : trans('admin/hardware/form.asset_not_deployable') }} ');
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
@include ('partials.forms.edit.name', ['translated_name' => trans('admin/locations/table.name')])
|
||||
|
||||
<!-- parent -->
|
||||
@include ('partials.forms.edit.location-select', ['translated_name' => trans('admin/locations/table.parent'), 'fieldname' => 'parent_id'])
|
||||
@include ('partials.forms.edit.location-select', ['translated_name' => trans('admin/locations/table.parent'), 'fieldname' => 'parent_id', 'exclude_id' => isset($item) ? $item->id : null])
|
||||
|
||||
<!-- Manager-->
|
||||
@include ('partials.forms.edit.user-select', ['translated_name' => trans('admin/users/table.manager'), 'fieldname' => 'manager_id'])
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
{{ ((isset($multiple)) && ($multiple === true)) ? ' multiple' : '' }}
|
||||
{!! (!empty($asset_status_type)) ? ' data-asset-status-type="' . $asset_status_type . '"' : '' !!}
|
||||
{!! (!empty($company_id)) ? ' data-company-id="' .$company_id.'"' : '' !!}
|
||||
{!! (!empty($exclude_id)) ? ' data-exclude-id="'.e($exclude_id).'"' : '' !!}
|
||||
{{ ((isset($required) && ($required =='true'))) ? ' required' : '' }}
|
||||
>
|
||||
|
||||
|
||||
@@ -1,47 +1,27 @@
|
||||
<!-- Company -->
|
||||
@if (($snipeSettings->full_multiple_companies_support=='1') && (!Auth::user()->isSuperUser()))
|
||||
<!-- full company support is enabled and this user isn't a superadmin -->
|
||||
<div class="form-group">
|
||||
<label for="{{ $fieldname }}" class="col-md-3 control-label">{{ $translated_name }}</label>
|
||||
<div class="col-md-6">
|
||||
<select class="js-data-ajax" disabled data-endpoint="companies"
|
||||
data-placeholder="{{ trans('general.select_company') }}" name="{{ $fieldname }}{{ (isset($multiple) && ($multiple=='true')) ? '[]' : '' }}" style="width: 100%"
|
||||
aria-label="{{ $fieldname }}"{{ (isset($multiple) && ($multiple=='true')) ? " multiple='multiple'" : '' }}>
|
||||
<!-- When FMCS is enabled the companies selectlist API automatically scopes results to
|
||||
the current user's companies (primary + pivot), so no separate disabled branch is needed. -->
|
||||
<div id="{{ $fieldname }}" class="form-group{{ $errors->has($fieldname) ? ' has-error' : '' }}">
|
||||
<label for="{{ $fieldname }}" class="col-md-3 control-label">{{ $translated_name }}</label>
|
||||
<div class="col-md-6">
|
||||
<select class="js-data-ajax" data-endpoint="companies" data-placeholder="{{ trans('general.select_company') }}" name="{{ $fieldname }}{{ (isset($multiple) && ($multiple=='true')) ? '[]' : '' }}" style="width: 100%"{{ (isset($multiple) && ($multiple=='true')) ? " multiple='multiple'" : '' }}>
|
||||
@isset ($selected)
|
||||
@foreach ($selected as $company_id)
|
||||
<option value="{{ $company_id }}" selected="selected" role="option" aria-selected="true">
|
||||
{{ \App\Models\Company::find($company_id)->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
@endisset
|
||||
@if (!isset($multiple) || $multiple !== 'true')
|
||||
@if ($company_id = old($fieldname, (isset($item)) ? $item->{$fieldname} : ''))
|
||||
<option value="{{ $company_id }}" selected="selected" role="option" aria-selected="true" role="option">
|
||||
<option value="{{ $company_id }}" selected="selected">
|
||||
{{ (\App\Models\Company::find($company_id)) ? \App\Models\Company::find($company_id)->name : '' }}
|
||||
</option>
|
||||
@else
|
||||
{!! (!isset($multiple) || ($multiple=='false')) ? '<option value="" role="option">'.trans('general.select_company').'</option>' : '' !!}
|
||||
<option value="" role="option">{{ trans('general.select_company') }}</option>
|
||||
@endif
|
||||
</select>
|
||||
</div>
|
||||
@endif
|
||||
</select>
|
||||
</div>
|
||||
|
||||
@else
|
||||
<!-- full company support is enabled or this user is a superadmin -->
|
||||
<div id="{{ $fieldname }}" class="form-group{{ $errors->has($fieldname) ? ' has-error' : '' }}">
|
||||
<label for="{{ $fieldname }}" class="col-md-3 control-label">{{ $translated_name }}</label>
|
||||
<div class="col-md-6">
|
||||
<select class="js-data-ajax" data-endpoint="companies" data-placeholder="{{ trans('general.select_company') }}" name="{{ $fieldname }}{{ (isset($multiple) && ($multiple=='true')) ? '[]' : '' }}" style="width: 100%"{{ (isset($multiple) && ($multiple=='true')) ? " multiple='multiple'" : '' }}>
|
||||
@isset ($selected)
|
||||
@foreach ($selected as $company_id)
|
||||
<option value="{{ $company_id }}" selected="selected" role="option" aria-selected="true">
|
||||
{{ \App\Models\Company::find($company_id)->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
@endisset
|
||||
@if (!isset($multiple) || $multiple !== 'true')
|
||||
@if ($company_id = old($fieldname, (isset($item)) ? $item->{$fieldname} : ''))
|
||||
<option value="{{ $company_id }}" selected="selected">
|
||||
{{ (\App\Models\Company::find($company_id)) ? \App\Models\Company::find($company_id)->name : '' }}
|
||||
</option>
|
||||
@else
|
||||
<option value="" role="option">{{ trans('general.select_company') }}</option>
|
||||
@endif
|
||||
@endif
|
||||
</select>
|
||||
</div>
|
||||
{!! $errors->first($fieldname, '<div class="col-md-8 col-md-offset-3"><span class="alert-msg"><i class="fas fa-times" aria-hidden="true"></i> :message</span></div>') !!}
|
||||
</div>
|
||||
@endif
|
||||
{!! $errors->first($fieldname, '<div class="col-md-8 col-md-offset-3"><span class="alert-msg"><i class="fas fa-times" aria-hidden="true"></i> :message</span></div>') !!}
|
||||
</div>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
<label for="{{ $fieldname }}" class="col-md-3 control-label">{{ $translated_name }}</label>
|
||||
<div class="col-md-7">
|
||||
<select class="js-data-ajax" data-endpoint="locations" data-placeholder="{{ trans('general.select_location') }}" name="{{ $fieldname }}" style="width: 100%" id="{{ $fieldname }}_location_select" aria-label="{{ $fieldname }}"{{ (isset($multiple) && ($multiple=='true')) ? " multiple='multiple'" : '' }}{!! ((isset($item)) && (Helper::checkIfRequired($item, $fieldname))) ? ' required ' : '' !!}{!! (!empty($company_id)) ? ' data-company-id="'.e($company_id).'"' : '' !!}>
|
||||
<select class="js-data-ajax" data-endpoint="locations" data-placeholder="{{ trans('general.select_location') }}" name="{{ $fieldname }}" style="width: 100%" id="{{ $fieldname }}_location_select" aria-label="{{ $fieldname }}"{{ (isset($multiple) && ($multiple=='true')) ? " multiple='multiple'" : '' }}{!! ((isset($item)) && (Helper::checkIfRequired($item, $fieldname))) ? ' required ' : '' !!}{!! (!empty($company_id)) ? ' data-company-id="'.e($company_id).'"' : '' !!}{!! (!empty($exclude_id)) ? ' data-exclude-id="'.e($exclude_id).'"' : '' !!}>
|
||||
@isset($selected)
|
||||
@foreach($selected as $location_id)
|
||||
<option value="{{ $location_id }}" selected="selected" role="option" aria-selected="true" role="option">
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<label for="{{ $fieldname }}" class="col-md-3 control-label">{{ $translated_name }}</label>
|
||||
|
||||
<div class="col-md-7">
|
||||
<select class="js-data-ajax" data-endpoint="users" data-placeholder="{{ trans('general.select_user') }}" name="{{ $fieldname }}" style="width: 100%" id="assigned_user_select" aria-label="{{ $fieldname }}"{{ ((isset($required)) && ($required=='true')) ? ' required' : '' }}{!! (!empty($company_id)) ? ' data-company-ids="'.e($company_id).'"' : '' !!}>
|
||||
<select class="js-data-ajax" data-endpoint="users" data-placeholder="{{ trans('general.select_user') }}" name="{{ $fieldname }}" style="width: 100%" id="assigned_user_select" aria-label="{{ $fieldname }}"{{ ((isset($required)) && ($required=='true')) ? ' required' : '' }}{!! (!empty($company_id)) ? ' data-company-ids="'.e($company_id).'"' : '' !!}{!! (!empty($exclude_id)) ? ' data-exclude-id="'.e($exclude_id).'"' : '' !!}>
|
||||
@if ($user_id = old($fieldname, (isset($item)) ? $item->{$fieldname} : ''))
|
||||
<option value="{{ $user_id }}" selected="selected" role="option" aria-selected="true" role="option">
|
||||
{{ (\App\Models\User::find($user_id)) ? \App\Models\User::find($user_id)->present()->fullName : '' }}
|
||||
|
||||
@@ -413,7 +413,7 @@
|
||||
|
||||
|
||||
<!-- Manager -->
|
||||
@include ('partials.forms.edit.user-select', ['translated_name' => trans('admin/users/table.manager'), 'fieldname' => 'manager_id'])
|
||||
@include ('partials.forms.edit.user-select', ['translated_name' => trans('admin/users/table.manager'), 'fieldname' => 'manager_id', 'exclude_id' => isset($item) ? $item->id : null])
|
||||
|
||||
<!-- Department -->
|
||||
@include ('partials.forms.edit.department-select', ['translated_name' => trans('general.department'), 'fieldname' => 'department_id'])
|
||||
|
||||
Reference in New Issue
Block a user