Fixed location being automatically populated on asset checkin screen #16486
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 fixes a bug when checking in an asset where the asset's current location is pre-populated in the Location select:
Users then have to click the
xso the location is not explicitly set.The issue stems from
$itembeing passed from the controller and the variable being brought into scope within thelocation-selectpartial (@\include brings parent variables into scope within it).Instead of writing additional logic in the existing partial to ignore
$itemin this specific context (the partial is already noisy with conditionals), I created a location-select blade component to bypass the scoping issue completely. (The component is mostly copy/paste/modify from the location-select partial).This component is mainly focused on handling this specific screen but can probably replace the partial uses without much modification if the need arises down the line. I fought the desire to create a agnostic
ajax-selectcomponent that thelocation-selectextended but I can see that appearing in the future.Also, I included the radio options "Update Asset Location" and "Update default location AND actual location" in the parent
checkin.blade.phpsince, I believe, that is the only place it is used so it doesn't need to be in the location-select component.