diff --git a/admin/app/components/solidus_admin/orders/index/component.html.erb b/admin/app/components/solidus_admin/orders/index/component.html.erb index e423137d3e3..4b90757ceb7 100644 --- a/admin/app/components/solidus_admin/orders/index/component.html.erb +++ b/admin/app/components/solidus_admin/orders/index/component.html.erb @@ -9,7 +9,7 @@ <%= render component("ui/button").new( tag: :a, text: t('.create_order'), - href: spree.new_admin_order_path, + href: solidus_admin.new_order_path, icon: "add-line", ) %> diff --git a/admin/app/components/solidus_admin/orders/new/component.html.erb b/admin/app/components/solidus_admin/orders/new/component.html.erb index a721fabe782..32d156165f1 100644 --- a/admin/app/components/solidus_admin/orders/new/component.html.erb +++ b/admin/app/components/solidus_admin/orders/new/component.html.erb @@ -1,8 +1,20 @@ -
-

Add Orders::New HTML here

-

<%= @order %>

- - -

Hello

- <%= t '.hello' %> +
+
+ <%= render component("ui/button").new( + tag: :a, + title: t(".back"), + icon: "arrow-left-line", + scheme: :secondary, + href: solidus_admin.orders_path + ) %> +

+ <%= t(".create_order") %> +

+ +
+ <%= render component("feedback").new %> + <%= render component("ui/button").new(tag: :button, scheme: :secondary, text: t(".discard"), form: form_id) %> + <%= render component("ui/button").new(tag: :button, text: t(".save"), form: form_id) %> +
+
diff --git a/admin/app/components/solidus_admin/orders/new/component.js b/admin/app/components/solidus_admin/orders/new/component.js index b6e2b996c67..6839d36996e 100644 --- a/admin/app/components/solidus_admin/orders/new/component.js +++ b/admin/app/components/solidus_admin/orders/new/component.js @@ -1,14 +1,5 @@ import { Controller } from '@hotwired/stimulus' export default class extends Controller { - static targets = ['output'] - typed(event) { - this.text = event.currentTarget.value - this.render() - } - - render() { - this.outputTarget.innerText = this.text - } } diff --git a/admin/app/components/solidus_admin/orders/new/component.rb b/admin/app/components/solidus_admin/orders/new/component.rb index eaec68f9dd2..0008f6fce94 100644 --- a/admin/app/components/solidus_admin/orders/new/component.rb +++ b/admin/app/components/solidus_admin/orders/new/component.rb @@ -4,4 +4,8 @@ class SolidusAdmin::Orders::New::Component < SolidusAdmin::BaseComponent def initialize(order:) @order = order end + + def form_id + @form_id ||= "#{stimulus_id}--form-#{@order.id}" + end end diff --git a/admin/app/components/solidus_admin/orders/new/component.yml b/admin/app/components/solidus_admin/orders/new/component.yml index 6fcfbdd6df7..d78429ce878 100644 --- a/admin/app/components/solidus_admin/orders/new/component.yml +++ b/admin/app/components/solidus_admin/orders/new/component.yml @@ -1,4 +1,6 @@ # Add your component translations here. # Use the translation in the example in your template with `t(".hello")`. en: - hello: "Hello world!" + create_order: Create Order + save: Save + discard: Discard diff --git a/admin/spec/components/previews/solidus_admin/orders/new/component_preview.rb b/admin/spec/components/previews/solidus_admin/orders/new/component_preview.rb index dda31b9d528..f402a1f9838 100644 --- a/admin/spec/components/previews/solidus_admin/orders/new/component_preview.rb +++ b/admin/spec/components/previews/solidus_admin/orders/new/component_preview.rb @@ -5,11 +5,6 @@ class SolidusAdmin::Orders::New::ComponentPreview < ViewComponent::Preview include SolidusAdmin::Preview def overview - render_with_template - end - - # @param order text - def playground(order: "order") - render component("orders/new").new(order: order) + render_with_template(locals: { order: Spree::Order.new }) end end diff --git a/admin/spec/components/previews/solidus_admin/orders/new/component_preview/overview.html.erb b/admin/spec/components/previews/solidus_admin/orders/new/component_preview/overview.html.erb index 73329e36e33..e0fcfa4d526 100644 --- a/admin/spec/components/previews/solidus_admin/orders/new/component_preview/overview.html.erb +++ b/admin/spec/components/previews/solidus_admin/orders/new/component_preview/overview.html.erb @@ -1,7 +1,3 @@
-
- Scenario 1 -
- - <%= render current_component.new(order: "order") %> + <%= render current_component.new(order: order) %>