Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reset checkout to value when navigating away from type #13597

Merged
merged 2 commits into from
Sep 14, 2023

Conversation

marcusmoore
Copy link
Collaborator

(what a terrible PR name)

Description

Currently when creating or cloning an asset it is possible to submit bad data about the check out via these inputs:

Checkout to inputs

As an example, clicking Location, picking a location, going back to User, then submitting, sends the following to the server (notice that assigned_location is still populated):

"checkout_to_type" => "user"
"assigned_user" => null
"assigned_asset" => null
"assigned_location" => "9"

Example showing the steps to recreate:

CleanShot.2023-09-13.at.14.07.41.mp4

With this PR the assigned_x fields are nulled out:

"checkout_to_type" => "user"
"assigned_user" => null
"assigned_asset" => null
"assigned_location" => null

Be aware that this now means that users clicking "Location", selecting a location, clicking away and then back, will have the selected Location removed:

CleanShot.2023-09-13.at.13.15.41.mp4

I also updated the CheckoutableListener to make sure the model that was checked out to has the routeNotificationFor() method on it (provided by the Notifiable trait). This should ensure we don't have anymore Exception caught during checkout notification: Call to undefined method App\Models\Location::routeNotificationFor() showing up in logs.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

@what-the-diff
Copy link

what-the-diff bot commented Sep 13, 2023

PR Summary

  • Improvement to Notification Management
    A new condition has been added in the CheckoutableListener.php file. This helps ensure that only those models are notified which are capable of handling notifications, leading to smoother operations and more efficient processing.

  • Enhanced User Interaction in Assignment Process
    Changes have been made in the snipeit.js file to make the assignment process more intuitive and less prone to errors:

    • When employees are chosen for assignment (assignto_type = "staff"), previous selections of location and user are automatically cleared.
    • If a location is set for assignment (assignto_type = "location"), details of previously assigned assets and users are automatically cleared.
    • If the assignment is not specifically to a staff or location, the previous selection of assigned asset and location details are automatically cleared. All these actions help in preventing erroneous data entries and make the user experience smoother.

@snipe
Copy link
Owner

snipe commented Sep 14, 2023

This looks great, thanks @marcusmoore!

@snipe snipe merged commit 104219e into snipe:develop Sep 14, 2023
@marcusmoore marcusmoore deleted the bug/sc-23681 branch September 14, 2023 19:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants