Merge remote-tracking branch 'origin/develop'

This commit is contained in:
snipe
2025-06-02 15:07:15 +01:00
2 changed files with 29 additions and 3 deletions

View File

@@ -562,7 +562,10 @@ class BulkAssetsController extends Controller
public function showCheckout() : View
{
$this->authorize('checkout', Asset::class);
return view('hardware/bulk-checkout');
$do_not_change = ['' => trans('general.do_not_change')];
$status_label_list = $do_not_change + Helper::deployableStatusLabelList();
return view('hardware/bulk-checkout')->with('statusLabel_list', $status_label_list);
}
/**
@@ -594,13 +597,13 @@ class BulkAssetsController extends Controller
}
$checkout_at = date('Y-m-d H:i:s');
if (($request->filled('checkout_at')) && ($request->get('checkout_at') != date('Y-m-d'))) {
$checkout_at = e($request->get('checkout_at'));
$checkout_at = $request->get('checkout_at');
}
$expected_checkin = '';
if ($request->filled('expected_checkin')) {
$expected_checkin = e($request->get('expected_checkin'));
$expected_checkin = $request->get('expected_checkin');
}
$errors = [];
@@ -608,6 +611,12 @@ class BulkAssetsController extends Controller
foreach ($assets as $asset) {
$this->authorize('checkout', $asset);
// See if there is a status label passed
if ($request->filled('status_id')) {
\Log::error('status id: ' . $request->get('status_id'));
$asset->status_id = $request->get('status_id');
}
$checkout_success = $asset->checkOut($target, $admin, $checkout_at, $expected_checkin, e($request->get('note')), $asset->name, null);
//TODO - I think this logic is duplicated in the checkOut method?

View File

@@ -39,6 +39,23 @@
])
<!-- Status -->
<div class="form-group {{ $errors->has('status_id') ? 'error' : '' }}">
<label for="status_id" class="col-md-3 control-label">
{{ trans('admin/hardware/form.status') }}
</label>
<div class="col-md-7 required">
<x-input.select
name="status_id"
:options="$statusLabel_list"
:selected="old('status_id', $status_id ?? null)"
style="width: 100%;"
aria-label="status_id"
/>
{!! $errors->first('status_id', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
</div>
</div>
<!-- Checkout selector -->
@include ('partials.forms.checkout-selector', ['user_select' => 'true','asset_select' => 'true', 'location_select' => 'true'])