🎥 Bulk Checkout / Checkin: Rejection Warning Side Panel + Related Cleanup - #19322
Merged
Conversation
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR moves the "these assets were removed from your selection" warning on bulk checkin and bulk checkout out of the inline form body and into a reusable side-panel component that lives in the right-hand column. Cleans up the surrounding checkout-target-panel width handling so both side panels line up visually. It also migrates the last two inline
<script>blocks on the bulk pages intosnipeit.jsas data-attribute driven handlers, which is part of the broader plan to eventually clean out all of those inline<script>tags to make way for us being able to transition to vite (see PR #19317).It also fixes a "Do not change" validation regression on bulk checkout status and applies a small N+1 quick fix to the shared
asset-selectpartial that any checkout or checkin page pays for.All changes are presentation, validation-rule, and query adjustments, nothing on the backend controllers.
New reusable side-panel component
Before
After
Screen.Recording.2026-07-20.at.11.12.31.AM.mov
Note: This seems slow because in recording this, that's when I noticed the N+1 - and also because the recently-modified blade components hadn't been cached yet. I also might move some stuff around, as
info-panelandside-panelseem confusingly similar, even though they serve two different purposes here.resources/views/blade/side-panel/removed-assets.blade.php(new) is a<x-side-panel.removed-assets>component that renders a warning box listing assets that were pulled from the operator's selection because they can't participate in the current bulk action (already assigned on checkout, already unassigned on checkin). We were already doing this via the alert box, but I think this way looks a lot cleaner and is more consistent with the newer side-panel stuff we've been adding.The table layout mirrors the existing checkout-target-panel so the two side panels read consistently when stacked. The component intentionally sets no
col-md-*on its root, so the blade controls the width via the surrounding<x-page-column>.hardware/bulk-checkin.blade.phprenders the warning in its own right-handcol-md-5column.hardware/bulk-checkout.blade.phpstacks the warning above the<livewire:checkout-target-panel>in the sharedcol-md-5right column. The warning stays visible for the whole session so the operator always knows which assets got rejected. Target panel below reacts to the checkout target selection as before.Checkout target panel no longer uses its own column wrapper
Previously
<livewire:checkout-target-panel>rendered a root<div class="col-md-5">and blades relied on that to act as the second column of a two-column layout. On bulk-checkout the panel now needs to sit inside a blade-controlled column (alongside the removed-assets warning) which caused nestedcol-md-*padding accumulation and a visibly indented panel. The<livewire:checkout-target-panel>was only recently added though, so don't worry about it if it's news to you. 😂Fix:
app/Livewire/CheckoutTargetPanel.phpno longer accepts or stores a$rootClass.resources/views/livewire/checkout-target-panel.blade.phproot element dropped to a plain<div>with no column class.accessories,components,consumables,hardware,kits,licensescheckout.blade.php) now wraps the panel in<x-page-column class="col-md-5">. Its behavior is visually identical to before for those pages, since the blade-provided wrapper replaces the panel's previous self-emitted wrapper.Inline script migration on bulk pages
Two inline
<script>blocks removed from the bulk pages. Behavior moved intosnipeit.jsas data-attribute driven handlers (again, in an ongoing effort to get us more able to potentially switch to vite):[data-disable-empty-on-submit]on a form disables empty required inputs on submit so browser HTML5 validation does not block the request before Laravel form-request validation gets a chance to return a nicer error. Non-required empty selects (like "Do not change") pass through with their intentional empty value. This is the reason the "Do not change" bug below existed and was masked.[data-autofocus-select2-search]on a form focuses the first.select2-search__fieldon load and hides the results dropdown until the operator starts typing, so bulk checkout lands directly in the assets picker. This was previously done in jQuery, and was primarily a benefit for folks using barcode scanners.Supporting change:
resources/views/blade/form/index.blade.phpnow forwards{{ $attributes }}to the rendered<form>element. Without this, blades could not attachdata-*attributes to a form via<x-form>."Do not change" for status on bulk checkout
Two contradictions that combined to reject the "Do not change" option even though the controller prepends it as a valid choice:
resources/views/hardware/bulk-checkout.blade.phpmarked the status selectrequired. That is wrong because the controller (BulkAssetsController::edit) prepends'' => trans('general.do_not_change')as the first option. Therequiredattribute was dropped from the select.app/Http/Requests/AssetCheckoutRequest.phphad'status_id' => 'exists:status_labels,id,deployable,1'with nonullable. An empty string still triggered theexistscheck, which fails since no status_label hasid="". Addednullableso empty status_id (the "Do not change" intent) skips the rule. The controller's existingif ($request->filled('status_id'))guard already handles the empty case as "do not change the status," so no controller change was needed.Asset-select partial N+1 quick fix
resources/views/partials/forms/edit/asset-select.blade.phpwas hitting three queries per asset in its@foreach($asset_ids)loop:Asset::find($asset_id)for the truthy check.Asset::find($asset_id)again for the presenter call.AssetPresenter::fullName()triggered amodelstable query.I rewrote both to use
@if ($asset = Asset::with('model')->find($asset_id)). One query per iteration instead of three. Still N+1, but the per-asset cost drops to a third and the model relation comes back on the same query. That select is at least paginated, so the change should speed things up and limit the N+1 messiness. (Should still revisit that later, but that seemed too big for this PR because the partial has eight blades that use it across checkout, checkin, edit, and maintenance flows. Messing with the checkout controls was just too spooky for this PR.)The full fix I think I want to do (whereIn+get, single query for the whole set) can go in a class-backed
<x-input.asset-select>component.Manual Testing
$removed_assetspopulated shows the warning panel in the top of the right column. Warning stays visible after picking a checkout target.$removed_assetshas entries. Warning shows when it does.hardware/checkout) still renders the checkout-target-panel at the correct width when the operator picks a target.accessories,components,consumables,kits,licensesall render the target panel at the correct width. No visual regression on any of the six pages.Can't find variable: $or similar errors./hardware/bulkcheckoutentry in the debugbar, NOT the last ajax/livewire that gets loaded.)