BathHacked/energy-sparks

View on GitHub
app/views/schools/advice/gas_costs/_meter_breakdown.html.erb

Summary

Maintainability
Test Coverage
<%= render 'schools/advice/section_title',
           section_id: 'meter-breakdown',
           section_title: advice_t('gas_costs.analysis.meter_breakdown.title') %>

<%= simple_form_for :school,
                    url: meter_costs_school_advice_gas_costs_path(school, format: :js),
                    method: :get, remote: true do |f| %>
  <div class="form-group">
    <label>
      <%= advice_t('gas_costs.analysis.meter_breakdown.select') %>
    </label>
    <%= select_tag :mpan_mprn,
                   options_from_collection_for_select(options_for_meter_select, :mpan_mprn, :display_name, nil),
                   class: 'form-control',
                   onchange: "$('#meter-costs').html('#{t('advice_pages.loading_data')}');$(this.form).submit();" %>
  </div>
<% end %>

<div id="meter-costs">
  <%= render 'meter',
             mpan_mprn: default_meter,
             label: default_meter_label,
             school: school,
             analysis_dates: analysis_dates,
             one_year_breakdown_chart: one_year_breakdown_chart,
             one_year_breakdown_chart_key: one_year_breakdown_chart_key,
             monthly_costs: monthly_costs,
             change_in_costs: change_in_costs %>
</div>