diff --git a/app/controllers/start_controller.rb b/app/controllers/start_controller.rb index afc6e4a49..f3f793a17 100644 --- a/app/controllers/start_controller.rb +++ b/app/controllers/start_controller.rb @@ -1,6 +1,7 @@ class StartController < ApplicationController def index if current_user + @homepage_presenter = HomepagePresenter.new(current_user) render "home/index" end end diff --git a/app/views/home/index.html.erb b/app/views/home/index.html.erb index 852cbda93..4ad19abc1 100644 --- a/app/views/home/index.html.erb +++ b/app/views/home/index.html.erb @@ -1,46 +1,88 @@
-
+
<%= "Welcome back, #{@current_user.name}" %> -

<%= heading_for_user_role(@current_user) %>

+

<%= @homepage_presenter.title_text_for_user %>

-
-
- <% if @current_user.support? || (@current_user.data_coordinator? && @current_user.sales_logs.present?) %> -
-
- <%= render partial: "home/data_box", locals: { type: "lettings" } %> -
-
- <%= render partial: "home/data_box", locals: { type: "sales" } %> -
-
- <%= render partial: "home/data_box", locals: { type: "schemes" } %> -
-
- <% else %> -
-
- <%= render partial: "home/data_box", locals: { type: "lettings" } %> -
- <% if @current_user.data_coordinator? %> -
- <%= render partial: "home/data_box", locals: { type: "schemes" } %> -
- <% elsif @current_user.sales_logs.present? %> -
- <%= render partial: "home/data_box", locals: { type: "sales" } %> -
+ +
+ + <% if @homepage_presenter.in_crossover_period? %> +
+

<%= @homepage_presenter.subheading_for_last_year %>

+
+ <% if @homepage_presenter.organisation_logs_sales? %> + <%= render partial: "home/data_box_two_by_two", locals: { + top_left_data_box: @homepage_presenter.last_year_in_progress_lettings_data, + bottom_left_data_box: @homepage_presenter.last_year_completed_lettings_data, + top_right_data_box: @homepage_presenter.last_year_in_progress_sales_data, + bottom_right_data_box: @homepage_presenter.last_year_completed_sales_data, + } %> <% else %> -
- <%= render partial: "home/data_box", locals: { type: "misc" } %> -
+ <%= render partial: "home/data_box_row_of_two", locals: { + left_data_box: @homepage_presenter.last_year_in_progress_lettings_data, + right_data_box: @homepage_presenter.last_year_completed_lettings_data, + } %> <% end %>
+
+ <% end %> + +
+

<%= @homepage_presenter.subheading_for_current_year %>

+
+ <% if @homepage_presenter.organisation_logs_sales? %> + <%= render partial: "home/data_box_two_by_two", locals: { + top_left_data_box: @homepage_presenter.current_year_in_progress_lettings_data, + bottom_left_data_box: @homepage_presenter.current_year_completed_lettings_data, + top_right_data_box: @homepage_presenter.current_year_in_progress_sales_data, + bottom_right_data_box: @homepage_presenter.current_year_completed_sales_data, + } %> + <% else %> + <%= render partial: "home/data_box_row_of_two", locals: { + left_data_box: @homepage_presenter.current_year_in_progress_lettings_data, + right_data_box: @homepage_presenter.current_year_completed_lettings_data, + } %> + <% end %> +
+
+ + <% if !@homepage_presenter.in_crossover_period? %> +
+

<%= @homepage_presenter.subheading_for_last_year %>

+
+ <%= render partial: "home/data_box_row_of_two", locals: { + left_data_box: @homepage_presenter.last_year_completed_lettings_data, + right_data_box: @homepage_presenter.last_year_completed_sales_data, + } %> +
+
+ <% end %> + +
+
+ <%= render partial: "home/blue_box_link", locals: { text: "View all lettings", path: clear_filters_path(filter_type: "lettings_logs") } %> +
+ <% if @homepage_presenter.organisation_logs_sales? %> +
+ <%= render partial: "home/blue_box_link", locals: { text: "View all sales", path: clear_filters_path(filter_type: "sales_logs") } %> +
<% end %>
-
+ + <% if @homepage_presenter.display_schemes? %> +
+

Schemes

+
+
+ <%= render partial: "home/data_box", object: @homepage_presenter.incomplete_schemes_data %> + <%= render partial: "home/blue_box_link", locals: { text: "View all schemes", path: clear_filters_path(filter_type: "schemes") } %> +
+
+
+ <% end %> +