summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorAlessandro Desantis <desa.alessandro@gmail.com>2020-06-15 18:36:39 +0200
committerAlessandro Desantis <desa.alessandro@gmail.com>2020-06-15 18:36:39 +0200
commitfb85261b91f33f2086140cca108e85265f1c2090 (patch)
tree438c49146bd68f43fe16c3acb0aa91dc93446350 /app
parent72186b9d1d7ebab6d2d9859532b20880a770782d (diff)
Add shipping address to backend subscription form
Diffstat (limited to 'app')
-rw-r--r--app/controllers/spree/admin/subscriptions_controller.rb2
-rw-r--r--app/views/spree/admin/subscriptions/_form.html.erb12
2 files changed, 14 insertions, 0 deletions
diff --git a/app/controllers/spree/admin/subscriptions_controller.rb b/app/controllers/spree/admin/subscriptions_controller.rb
index 6893b14..8462ba1 100644
--- a/app/controllers/spree/admin/subscriptions_controller.rb
+++ b/app/controllers/spree/admin/subscriptions_controller.rb
@@ -16,10 +16,12 @@ module Spree
def new
@subscription.line_items.new
+ @subscription.build_shipping_address unless @subscription.shipping_address
end
def edit
@subscription.line_items.new
+ @subscription.build_shipping_address unless @subscription.shipping_address
end
def cancel
diff --git a/app/views/spree/admin/subscriptions/_form.html.erb b/app/views/spree/admin/subscriptions/_form.html.erb
index 61a6fba..c1a5ef3 100644
--- a/app/views/spree/admin/subscriptions/_form.html.erb
+++ b/app/views/spree/admin/subscriptions/_form.html.erb
@@ -51,6 +51,18 @@
</div>
</div>
+ <div class="js-customer-details">
+ <fieldset class="no-border-bottom">
+ <legend>Shipping Address</legend>
+
+ <div class="js-shipping-address">
+ <%= f.fields_for :shipping_address do |sa_form| %>
+ <%= render partial: 'spree/admin/shared/address_form', locals: { f: sa_form, type: "shipping" } %>
+ <% end %>
+ </div>
+ </fieldset>
+ </div>
+
<fieldset class="no-border-bottom">
<legend><%= t('.subscription_line_items') %></legend>