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

Admin, create new order: distributor and order cycle are now mandatory on step 1 (aka the set_distribution step) #10712

Conversation

jibees
Copy link
Contributor

@jibees jibees commented Apr 17, 2023

What? Why?

Context: Admin section, creating a new order

This PR make the distribution step (ie. the one that set both distributor and order_cycle for an order) mandatory when creating a new order in the admin backoffice.

  • creates a new step, via a new URL: /distribution
  • validates order_cycle and distributor presence for an order in a set_distribution_step context
  • remove links to others steps on /distribution when no distributor or order_cycle are set

Can't access next step-s (via Next button, or links on the side) until distributor and order cycle are set

Capture d’écran 2023-04-18 à 14 47 20

Can access next steps when distributor and order cycle are set

Capture d’écran 2023-04-18 à 14 50 11

What should we test?

As an admin, check that when creating a new order, we can't go to next steps until distributor and order_cycle are set for this new order

Release notes

Changelog Category: User facing changes

The title of the pull request will be included in the release notes.

Dependencies

Documentation updates

@jibees jibees self-assigned this Apr 17, 2023
@jibees jibees changed the title Admin, create new order: distributor and order cycle should be mandatory on step 1 Admin, create new order: distributor and order cycle are now mandatory on step 1 Apr 17, 2023
@jibees jibees force-pushed the 6133-backoffice-orders-endless-spinner-and-error-500-after-skipping-oc-selector branch 3 times, most recently from 0e40e1e to 347cbba Compare April 18, 2023 09:56
That handles the step when distributor and order_cycle must be selected
@jibees jibees force-pushed the 6133-backoffice-orders-endless-spinner-and-error-500-after-skipping-oc-selector branch from 347cbba to abe77ac Compare April 18, 2023 12:21
@jibees jibees force-pushed the 6133-backoffice-orders-endless-spinner-and-error-500-after-skipping-oc-selector branch from abe77ac to 722c660 Compare April 18, 2023 12:37
@jibees jibees marked this pull request as ready for review April 18, 2023 12:51
@jibees jibees changed the title Admin, create new order: distributor and order cycle are now mandatory on step 1 Admin, create new order: distributor and order cycle are now mandatory on step 1 (aka the set_distribution step) Apr 18, 2023
Copy link
Member

@mkllnk mkllnk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work. There's just one suggestion below.

config/routes/spree.rb Outdated Show resolved Hide resolved
app/controllers/spree/admin/orders_controller.rb Outdated Show resolved Hide resolved
app/controllers/spree/admin/orders_controller.rb Outdated Show resolved Hide resolved
Copy link
Collaborator

@rioug rioug left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👍

@drummer83 drummer83 assigned drummer83 and unassigned drummer83 Apr 22, 2023
@drummer83 drummer83 added the pr-staged-au staging.openfoodnetwork.org.au label Apr 22, 2023
@drummer83
Copy link
Contributor

Hi @jibees,
Thanks for this one!

I have reproduced the issue before staging first. The situation is a bit different now, because when the issue was created, we still had the product selection first and then the customer selection afterwards. This is the other way round now. Additionally the customer selection doesn't return any results if no distributor is selected on the very first step.
The good thing is: Both issues are solved by your PR because there is no way to access the next pages without selecting distributor AND order cycle.

If information is missing, one of the following errors will be shown:
image

image

I didn't manage to see any endless spinners of error 500. Excellent!
Merging! 🥳
Thanks!

@drummer83 drummer83 merged commit 75b5d1f into openfoodfoundation:master Apr 22, 2023
51 checks passed
@drummer83 drummer83 removed the pr-staged-au staging.openfoodnetwork.org.au label Apr 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Backoffice orders: Endless spinner and error 500 after skipping OC selector
4 participants