<%
  form = local_assigns[:form]
  errors = form&.errors
%>

<h2 id="calculator">Estimate how much your pot could grow</h2>

<%= render 'calculators/error_summary', messages: errors&.messages if form&.invalid? %>

<form action="/leave-pot-untouched/estimate#form" method="get">
  <%= render 'calculators/form_input_currency',
             field: :pot,
             value: form&.pot,
             label: 'Amount in your pot',
             error_messages: errors&.get(:pot) %>

  <%= render 'calculators/form_input_currency',
             field: :contribution,
             value: form&.contribution,
             label: 'How much can you pay in each month?',
             error_messages: errors&.get(:contribution) %>

  <%= render 'calculators/form_input_submit' %>
</form>

<% if form %>
  <script>
    window.dataLayer = window.dataLayer || [];
    dataLayer.push({
      'event': 'CalculatorEstimate',
      'valid': <%= form.valid? %>
      <% if form.valid? %>
      , 'pot': <%= form.pot.to_i %>
      , 'contribution': <%= form.contribution.to_i %>
      <% end %>
    });
  </script>
<% end %>

<%
  form = local_assigns[:form]
  errors = form&.errors
%>

<h2 id="calculator">Estimate how much your pot could grow</h2>

<%= render 'calculators/error_summary', messages: errors&.messages if form&.invalid? %>

<form action="/leave-pot-untouched/estimate#form" method="get">
  <%= render 'calculators/form_input_currency',
             field: :pot,
             value: form&.pot,
             label: 'How much is in your pot?',
             error_messages: errors&.get(:pot) %>

  <%= render 'calculators/form_input_currency',
             field: :contribution,
             value: form&.contribution,
             label: 'How much can you pay in each month?',
             error_messages: errors&.get(:contribution) %>

  <%= render 'calculators/form_input_submit' %>
</form>

<% if form %>
  <script>
    window.dataLayer = window.dataLayer || [];
    dataLayer.push({
      'event': 'CalculatorEstimate',
      'valid': <%= form.valid? %>
      <% if form.valid? %>
      , 'pot': <%= form.pot.to_i %>
      , 'contribution': <%= form.contribution.to_i %>
      <% end %>
    });
  </script>
<% end %>

Use question style for leave pot untouched form labels
Use question style for leave pot untouched form labels
