Merge pull request #18162 from Godmartinz/status_bulk_select_fix

Adds #17685 better warning for bulk status change to undeployable type
This commit is contained in:
snipe
2026-03-06 09:58:41 +01:00
committed by GitHub
2 changed files with 38 additions and 2 deletions

View File

@@ -57,8 +57,8 @@ return [
'asset_location_update_default' => 'Update only default location',
'asset_location_update_actual' => 'Update only actual location',
'asset_not_deployable' => 'That asset status is not deployable. This asset cannot be checked out.',
'asset_not_deployable_checkin' => 'That asset status is not deployable. Using this status label will checkin the asset.',
'asset_deployable' => 'This asset can be checked out.',
'asset_not_deployable_checkin' => '{1} That asset status is not deployable. Using this status label will check in the asset.|[2,*] That asset status in not deployable. Using this status label will result in no change.',
'asset_deployable' => '{1} This asset can be checked out.|[2,*] These assets can be checked out.',
'processing_spinner' => 'Processing... (This might take a bit of time on large files)',
'processing' => 'Processing... ',
'optional_infos' => 'Optional Information',

View File

@@ -133,6 +133,7 @@
aria-label="status_id"
/>
<p class="help-block">{{ trans('general.status_compatibility') }}</p>
<p id="selected_status_status" style="display:none;"></p>
{!! $errors->first('status_id', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
</div>
</div>
@@ -288,5 +289,40 @@
});
});
});
function status_check() {
var status_id = $('select[name="status_id"]').val();
if (status_id != '') {
$(".status_spinner").css("display", "inline");
$.ajax({
url: "{{config('app.url') }}/api/v1/statuslabels/" + status_id + "/deployable",
headers: {
"X-Requested-With": 'XMLHttpRequest',
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr('content')
},
success: function (data) {
$(".status_spinner").css("display", "none");
$("#selected_status_status").fadeIn();
if (data == true) {
$("#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', 2)}}');
} else {
$("#assignto_selector").hide();
$("#selected_status_status").removeClass('text-success');
$("#selected_status_status").addClass('text-danger');
$("#selected_status_status").html("<x-icon type=\"warning\" /> {{ trans_choice('admin/hardware/form.asset_not_deployable_checkin', 2) }} ");
}
}
});
}
}
$(function () {
$('select[name="status_id"]').on('change', status_check);
});
</script>
@endsection