From e0a6a719b1a02fbf9312a151023b462a5dd0057f Mon Sep 17 00:00:00 2001 From: natdeanlewissoftwire <94526761+natdeanlewissoftwire@users.noreply.github.com> Date: Thu, 24 Nov 2022 17:14:07 +0000 Subject: [PATCH] feat: add new design to scheme page (#1003) * feat: add new design to scheme page * feat: add incomplete status * feat: use confirmed behaviour --- app/models/scheme.rb | 2 ++ app/views/schemes/_scheme_list.html.erb | 22 +++++++++++----------- db/schema.rb | 6 +++--- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/app/models/scheme.rb b/app/models/scheme.rb index a56a29602..fce696bb6 100644 --- a/app/models/scheme.rb +++ b/app/models/scheme.rb @@ -214,6 +214,8 @@ class Scheme < ApplicationRecord end def status + return :incomplete unless confirmed + open_deactivation = scheme_deactivation_periods.deactivations_without_reactivation.first recent_deactivation = scheme_deactivation_periods.order("created_at").last diff --git a/app/views/schemes/_scheme_list.html.erb b/app/views/schemes/_scheme_list.html.erb index 976622ce0..5fa712d1e 100644 --- a/app/views/schemes/_scheme_list.html.erb +++ b/app/views/schemes/_scheme_list.html.erb @@ -5,31 +5,31 @@ <% end %> <%= table.head do |head| %> <%= head.row do |row| %> - <% row.cell(header: true, text: "Code", html_attributes: { - scope: "col", - }) %> <% row.cell(header: true, text: "Scheme", html_attributes: { scope: "col", }) %> - <% row.cell(header: true, text: "Locations", html_attributes: { - scope: "col", - }) %> - <% row.cell(header: true, text: "Support provided by", html_attributes: { + <% row.cell(header: true, text: "Code", html_attributes: { scope: "col", }) %> - <% row.cell(header: true, text: "Created", html_attributes: { + <% row.cell(header: true, text: "Locations", html_attributes: { scope: "col", }) %> + <% if FeatureToggle.scheme_toggle_enabled? %> + <% row.cell(header: true, text: "Status", html_attributes: { + scope: "col", + }) %> + <% end %> <% end %> <% end %> <% @schemes.each do |scheme| %> <%= table.body do |body| %> <%= body.row do |row| %> - <% row.cell(text: scheme.id_to_display) %> <% row.cell(text: simple_format(scheme_cell(scheme), { class: "govuk-!-font-weight-bold" }, wrapper_tag: "div")) %> + <% row.cell(text: scheme.id_to_display) %> <% row.cell(text: scheme.locations&.count) %> - <% row.cell(text: scheme.managing_organisation&.name) %> - <% row.cell(text: scheme.confirmed? ? scheme.created_at.to_formatted_s(:govuk_date) : govuk_tag(colour: "grey", text: "Incomplete")) %> + <% if FeatureToggle.scheme_toggle_enabled? %> + <% row.cell(text: status_tag(scheme.status)) %> + <% end %> <% end %> <% end %> <% end %> diff --git a/db/schema.rb b/db/schema.rb index ff2619f43..9df577686 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -374,15 +374,15 @@ ActiveRecord::Schema[7.0].define(version: 2022_11_22_130928) do t.integer "la_known" t.integer "income1" t.integer "income1nk" + t.integer "details_known_2" + t.integer "details_known_3" + t.integer "details_known_4" t.integer "age4" t.integer "age4_known" t.integer "age5" t.integer "age5_known" t.integer "age6" t.integer "age6_known" - t.integer "details_known_2" - t.integer "details_known_3" - t.integer "details_known_4" t.index ["created_by_id"], name: "index_sales_logs_on_created_by_id" t.index ["managing_organisation_id"], name: "index_sales_logs_on_managing_organisation_id" t.index ["owning_organisation_id"], name: "index_sales_logs_on_owning_organisation_id"