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
new file mode 100644
index 00000000000..32d156165f1
--- /dev/null
+++ b/admin/app/components/solidus_admin/orders/new/component.html.erb
@@ -0,0 +1,20 @@
+
+
+ <%= 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
new file mode 100644
index 00000000000..6839d36996e
--- /dev/null
+++ b/admin/app/components/solidus_admin/orders/new/component.js
@@ -0,0 +1,5 @@
+import { Controller } from '@hotwired/stimulus'
+
+export default class extends Controller {
+
+}
diff --git a/admin/app/components/solidus_admin/orders/new/component.rb b/admin/app/components/solidus_admin/orders/new/component.rb
new file mode 100644
index 00000000000..0008f6fce94
--- /dev/null
+++ b/admin/app/components/solidus_admin/orders/new/component.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+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
new file mode 100644
index 00000000000..d78429ce878
--- /dev/null
+++ b/admin/app/components/solidus_admin/orders/new/component.yml
@@ -0,0 +1,6 @@
+# Add your component translations here.
+# Use the translation in the example in your template with `t(".hello")`.
+en:
+ create_order: Create Order
+ save: Save
+ discard: Discard
diff --git a/admin/app/controllers/solidus_admin/orders_controller.rb b/admin/app/controllers/solidus_admin/orders_controller.rb
index 1d6c506eae4..dba47850700 100644
--- a/admin/app/controllers/solidus_admin/orders_controller.rb
+++ b/admin/app/controllers/solidus_admin/orders_controller.rb
@@ -19,13 +19,17 @@ def index
end
def new
- Spree::Order.new(
+ @order = Spree::Order.new(
{
created_by: current_solidus_admin_user,
frontend_viewable: false,
store_id: current_store.try(:id)
}
)
+
+ respond_to do |format|
+ format.html { render component('orders/new').new(order: @order) }
+ end
end
end
end
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
new file mode 100644
index 00000000000..f402a1f9838
--- /dev/null
+++ b/admin/spec/components/previews/solidus_admin/orders/new/component_preview.rb
@@ -0,0 +1,10 @@
+# frozen_string_literal: true
+
+# @component "orders/new"
+class SolidusAdmin::Orders::New::ComponentPreview < ViewComponent::Preview
+ include SolidusAdmin::Preview
+
+ def overview
+ 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
new file mode 100644
index 00000000000..e0fcfa4d526
--- /dev/null
+++ b/admin/spec/components/previews/solidus_admin/orders/new/component_preview/overview.html.erb
@@ -0,0 +1,3 @@
+
+ <%= render current_component.new(order: order) %>
+
diff --git a/admin/spec/components/solidus_admin/orders/new/component_spec.rb b/admin/spec/components/solidus_admin/orders/new/component_spec.rb
new file mode 100644
index 00000000000..6f61edbc87e
--- /dev/null
+++ b/admin/spec/components/solidus_admin/orders/new/component_spec.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+require "spec_helper"
+
+RSpec.describe SolidusAdmin::Orders::New::Component, type: :component do
+ it "renders the overview preview" do
+ render_preview(:overview)
+ end
+end