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] Construct base components for order creation in admin interface #5434

Merged

Conversation

rainerdema
Copy link
Contributor

@rainerdema rainerdema commented Oct 12, 2023

Summary

This PR lays the foundation for the orders/new component and integrates basic UI elements within solidus_admin.

  • Used the component generator to create the orders/new component
  • Incorporated an action to render the new component
  • Header and UI buttons:
    • Added a header with Save and Discard buttons
    • The buttons are currently non-functional, serving as UI placeholders for upcoming feature integrations
Screenshot 2023-10-12 at 16 57 03

Checklist

Check out our PR guidelines for more details.

The following are mandatory for all PRs:

The following are not always needed:

  • πŸ“– I have updated the README to account for my changes.
  • πŸ“‘ I have documented new code with YARD.
  • πŸ›£οΈ I have opened a PR to update the guides.
  • βœ… I have added automated tests to cover my changes.
  • πŸ“Έ I have attached screenshots to demo visual changes.

@rainerdema rainerdema self-assigned this Oct 12, 2023
@rainerdema rainerdema force-pushed the rainerd/base-order-creation-components branch 3 times, most recently from 4b4579d to 1ede2a5 Compare October 12, 2023 16:00
@rainerdema rainerdema marked this pull request as ready for review October 12, 2023 16:10
@rainerdema rainerdema requested a review from a team as a code owner October 12, 2023 16:10
@rainerdema rainerdema added the hold On hold for a reason different from a breaking change label Oct 12, 2023
@rainerdema rainerdema requested a review from elia October 12, 2023 16:13
Copy link
Member

@elia elia left a comment

Choose a reason for hiding this comment

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

I think you can squash the first commit into the last one, after all the newly created component is not very interesting by itself.

def new
@order = Spree::Order.new(
{
created_by_id: spree_current_user.try(:id),
Copy link
Member

Choose a reason for hiding this comment

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

spree_current_user comes from one of many possible authentication methods, here it's better to use the internal method for getting the admin user. Also no nil checks are needed as from we no longer support not having an authenticated user in the admin.

created_by: current_solidus_admin_user

@rainerdema rainerdema force-pushed the rainerd/base-order-creation-components branch from 1ede2a5 to 2b8360a Compare October 13, 2023 14:33
@rainerdema rainerdema requested a review from elia October 13, 2023 14:35
Comment on lines 23 to 27
{
created_by: current_solidus_admin_user,
frontend_viewable: false,
store_id: current_store.try(:id)
}
Copy link
Member

@elia elia Oct 13, 2023

Choose a reason for hiding this comment

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

nit: don't need to wrap in curly braces, I would even expected rubocop to complain about this πŸ€·β€β™‚οΈ

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch! You're right, it's a copy-paste leftover from the old backend orders controller πŸ˜… Will clean that up, thanks!

Copy link
Member

@elia elia left a comment

Choose a reason for hiding this comment

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

I left a final nit, but otherwise LGTM πŸ‘πŸ‘πŸ‘

This commit introduces a new `orders/new` component that includes a
header, providing users with 'Save' and 'Discard' button options.
Although the UI elements have been integrated, the functionalities for these
buttons will be implemented in subsequent iterations.
@rainerdema rainerdema force-pushed the rainerd/base-order-creation-components branch from 2b8360a to b8f3a4d Compare October 13, 2023 15:00
@rainerdema rainerdema merged commit 33e539d into solidusio:main Oct 13, 2023
9 checks passed
@rainerdema rainerdema deleted the rainerd/base-order-creation-components branch October 13, 2023 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog:solidus_admin hold On hold for a reason different from a breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants