app/views/schools/advice/long_term/_recent_trend.html.erb
<%= render 'schools/advice/section_title',
section_id: 'recent-trend',
section_title: t('advice_pages.electricity_long_term.analysis.recent_trend.title') %>
<% if analysis_dates.one_years_data? %>
<% if annual_usage.kwh < vs_exemplar.kwh %>
<%= component 'notice', status: :positive do %>
<p><%= t("advice_pages.#{fuel_type}_long_term.analysis.comparison.assessment.low.title") %></p>
<p><%= t("advice_pages.#{fuel_type}_long_term.analysis.comparison.assessment.low.percent_html",
percent: format_unit(estimated_savings_vs_exemplar.percent.abs, :percent)) %></p>
<% end %>
<% else %>
<%= component 'notice', status: :negative do %>
<p><%= t("advice_pages.#{fuel_type}_long_term.analysis.comparison.assessment.high.title") %></p>
<p><%= t("advice_pages.#{fuel_type}_long_term.analysis.comparison.assessment.high.percent_html",
percent: format_unit(estimated_savings_vs_exemplar.percent, :percent)) %></p>
<p><%= t("advice_pages.#{fuel_type}_long_term.analysis.comparison.assessment.high.savings_html",
estimated_savings_kwh: format_unit(estimated_savings_vs_exemplar.kwh, :kwh, false),
estimated_savings_gbp: format_unit(estimated_savings_vs_exemplar.£, :£, false)) %></p>
<% end %>
<% end %>
<%= component 'chart', chart_type: :"group_by_week_#{fuel_type}", school: school do |c| %>
<% c.with_title { t("advice_pages.#{fuel_type}_long_term.charts.group_by_week_#{fuel_type}.title") } %>
<% c.with_subtitle do
t("advice_pages.#{fuel_type}_long_term.charts.group_by_week_#{fuel_type}.subtitle_html",
start_date: analysis_dates.last_full_week_start_date.to_fs(:es_short),
end_date: analysis_dates.last_full_week_end_date.to_fs(:es_short))
end %>
<% c.with_footer do %>
<p><%= t("advice_pages.#{fuel_type}_long_term.charts.group_by_week_#{fuel_type}.explanation_html") %></p>
<% end %>
<% end %>
<% else %>
<% chart_type = :"management_dashboard_group_by_week_#{fuel_type}" %>
<%= component 'chart', chart_type: chart_type, school: school,
chart_config: { y_axis_units: select_y_axis(school, chart_type, :£) } do |c| %>
<% c.with_title { t("advice_pages.#{fuel_type}_out_of_hours.analysis.holiday_usage.#{chart_type}.title") } %>
<% c.with_subtitle do
t("advice_pages.#{fuel_type}_long_term.charts.group_by_week_#{fuel_type}.subtitle_html",
start_date: analysis_dates.last_full_week_start_date.to_fs(:es_short),
end_date: analysis_dates.last_full_week_end_date.to_fs(:es_short))
end %>
<% c.with_footer do %>
<p><%= t("advice_pages.#{fuel_type}_long_term.charts.group_by_week_#{fuel_type}.explanation_html") %></p>
<% end %>
<% end %>
<% end %>
<%= component 'chart', chart_type: :"#{fuel_type}_by_month_year_0_1", school: school do |c| %>
<% key_prefix = 'advice_pages.electricity_long_term.charts.electricity_by_month_year' %>
<% key_suffix = analysis_dates.one_years_data? ? '_two_years' : '' %>
<%# i18n-tasks-use t('advice_pages.electricity_long_term.charts.electricity_by_month_year.title_two_years') %>
<%# i18n-tasks-use t('advice_pages.electricity_long_term.charts.electricity_by_month_year.title') %>
<% c.with_title { t("#{key_prefix}.title#{key_suffix}", fuel_type: fuel_type) } %>
<%# i18n-tasks-use t('advice_pages.electricity_long_term.charts.electricity_by_month_year.subtitle_two_years_html') %>
<%# i18n-tasks-use t('advice_pages.electricity_long_term.charts.electricity_by_month_year.subtitle_html') %>
<% c.with_subtitle do
t("#{key_prefix}.subtitle#{key_suffix}_html", end_date: analysis_dates.end_date.to_fs(:es_short),
start_date: analysis_dates.start_date.to_fs(:es_short),
fuel_type: fuel_type)
end %>
<% c.with_footer do %>
<p><%= t("advice_pages.#{fuel_type}_long_term.charts.#{fuel_type}_by_month_year.explanation") %></p>
<% end %>
<% end %>