diff --git a/app/views/account/calculators/new.html.erb b/app/views/account/calculators/new.html.erb index ec4afee47..4c2b347d7 100644 --- a/app/views/account/calculators/new.html.erb +++ b/app/views/account/calculators/new.html.erb @@ -1,15 +1,3 @@
- <%= simple_form_for @calculator, url: account_calculators_path do |f| %> -
-
- <%= f.input :name, class: 'form-control' %> -
-
-
- <%= f.button :submit, t('.create_calculator_button'), class: 'btn btn-green me-2 height-auto w-auto' %> - <%= link_to account_calculators_path, class: 'btn btn-danger d-flex align-items-center justify-content-center height-auto w-auto' do %> - <%= t('buttons.cancel') %> - <% end %> -
- <% end %> + <%= render "account/calculators/partials/new/form", calculator: @calculator %>
diff --git a/app/views/account/calculators/new.turbo_stream.erb b/app/views/account/calculators/new.turbo_stream.erb new file mode 100644 index 000000000..58a7f7eb3 --- /dev/null +++ b/app/views/account/calculators/new.turbo_stream.erb @@ -0,0 +1,4 @@ +<%= turbo_stream.replace( + dom_id(@calculator, :form), + partial: "account/calculators/partials/new/form", + locals: {calculator: @calculator}) %> diff --git a/app/views/account/calculators/partials/new/_form.html.erb b/app/views/account/calculators/partials/new/_form.html.erb new file mode 100644 index 000000000..b4839a083 --- /dev/null +++ b/app/views/account/calculators/partials/new/_form.html.erb @@ -0,0 +1,13 @@ +<%= simple_form_for calculator, url: account_calculators_path, html: { id: dom_id(calculator, :form) } do |f| %> +
+
+ <%= f.input :name, class: 'form-control' %> +
+
+
+ <%= f.button :submit, t('account.calculators.new.create_calculator_button'), class: 'btn btn-green me-2 height-auto w-auto' %> + <%= link_to account_calculators_path, class: 'btn btn-danger d-flex align-items-center justify-content-center height-auto w-auto' do %> + <%= t('buttons.cancel') %> + <% end %> +
+<% end %> diff --git a/app/views/account/products/partials/new/_form.html.erb b/app/views/account/products/partials/new/_form.html.erb index 1d00064f1..0e19e5521 100644 --- a/app/views/account/products/partials/new/_form.html.erb +++ b/app/views/account/products/partials/new/_form.html.erb @@ -10,7 +10,7 @@ <%= f.simple_fields_for :prices, f.object.find_or_build_price_for_category(category) do |prices_form| %> <%= prices_form.input :sum, label: false, input_html: { placeholder: t(".form.sum"), data: { price_form_target: "priceInput" } } %> <%= prices_form.hidden_field :category_id, value: category.id %> - + <% end %>