+
diff --git a/app/views/framework_requests/bill_uploads/_form.html.erb b/app/views/framework_requests/bill_uploads/_form.html.erb
index d643662e1..919a6955b 100644
--- a/app/views/framework_requests/bill_uploads/_form.html.erb
+++ b/app/views/framework_requests/bill_uploads/_form.html.erb
@@ -27,7 +27,10 @@
Upload your energy information
-
Please upload your most recent energy bill. You can upload multiple bills if you have more than one meter. You can also upload your energy information in another format, like a spreadsheet.
+
+
Please upload your most recent energy bill. You can upload multiple bills if you have more than one meter. You can also upload your energy information in another format, like a spreadsheet.
+
Documents can be any type and must be smaller than 30MB. Upload as many documents as you want.
"
+ data-energy-bill-upload-page-one-continue-button-value="Continue to upload"
+ data-energy-bill-upload-page-two-title-value="Your files are uploading"
+ data-energy-bill-upload-page-two-continue-button-value="Continue to upload"
+ data-energy-bill-upload-page-three-title-value="Your files have been uploaded"
+ data-energy-bill-upload-page-three-continue-button-value="Continue">
+
+
+ <% end %>
+
<% if @current_case.case_attachments.present? %>
@@ -136,6 +170,18 @@
<% end %>
+
+ <% if @request&.origin.present? %>
+
+
+ <%= I18n.t("support.case.label.origin") %>
+
+
+ <%= @request.origin %>
+
+
+
+ <% end %>
<% end %>
diff --git a/app/views/support/cases/show/_case_details.html.erb b/app/views/support/cases/show/_case_details.html.erb
index d7bf6074e..c695b06d7 100644
--- a/app/views/support/cases/show/_case_details.html.erb
+++ b/app/views/support/cases/show/_case_details.html.erb
@@ -91,6 +91,18 @@
+
+ <% if @request&.origin.present? %>
+
+
+ <%= I18n.t("support.case.label.origin") %>
+
+
+ <%= @request.origin %>
+
+
+
+ <% end %>
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 457f011c6..4416a21fa 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -344,15 +344,21 @@ en:
email: Your email address
name: Your name
problem: Description of request
+ contract_length: Contract length
+ contract_start_date: Contract start date
+ same_supplier_used: Same supplier used
school: Your school
school_type: School type
schools_buying_for: Schools you're buying for
school_number: "%{selected} of %{total} schools"
single: Single
bills_attached: Bills attached
+ documents_attached: Documents attached
category: Type of goods or service
+ origin: Origin
header: Send your request
response_time: Once you send this request, we will review it and get in touch within 2 working days.
+ not_known: Not known
aria:
change_name: "Change your name"
change_email: "Change your email"
@@ -360,10 +366,15 @@ en:
change_school_type: "Change your school type"
change_school_picker: "Change the schools you're buying for"
change_message: "Change the description of your request"
+ change_contract_length: "Change the length of your contract"
+ change_contract_start_date: "Change the start date of your contract"
+ change_same_supplier_used: "Change whether the same supplier is used for all your schools"
change_procurement_amount: "Change procurement amount"
change_bills_attached: "Change bills attached"
+ change_documents_attached: "Change documents attached"
change_special_requirements: "Change special requirements"
change_category: "Change type of goods or service"
+ change_origin: "Change the origin of your request"
confirm_group_or_trust:
caption: About your school
choice:
@@ -398,6 +409,47 @@ en:
'no': No, I need to change my selection
table:
school_name: School name
+ contract_length:
+ caption: About your procurement
+ title: How long do you want the contract for including any extensions?
+ hint: Tell us how long you want the contract for at this time. We know this can change. We do not recommend contracts that are shorter than one year.
+ options:
+ one_year: 1 year
+ two_years: 2 years
+ three_years: 3 years
+ four_years: 4 years
+ five_years: 5 years
+ not_sure: Not sure
+ contract_start_date:
+ caption: About your procurement
+ title: Do you know when you want the contract to start?
+ options:
+ 'yes': "Yes"
+ 'no': "No"
+ date:
+ label: Enter the date
+ hint: For example, 27 3 2007
+ invalid: Provide a valid date
+ documents:
+ caption: About your request
+ title: Are there any documents that you would like to upload and share with us?
+ hint:
+ - This may help us to answer your query. We can still help if you cannot upload any documents right now.
+ - You'll also be able to share documents with us at a later date.
+ - Select all that apply.
+ options:
+ current_contract: Current contract
+ communications_with_supplier: Communications with your supplier, such as an email
+ floor_plans: Floor plans or site maps
+ quotes: Quotes
+ specifications: Specifications
+ other: Other, please specify
+ none: I do not have anything to upload right now
+ document_upload:
+ caption: About your request
+ title: Upload your documents
+ body: You can upload any type of document smaller than 30MB. Upload as many documents as you want.
+ hint: "Upload the documents you told us about. These were:"
dsi_or_search:
header: Do you have a DfE Sign-in account linked to the school that your request is about?
link:
@@ -433,21 +485,27 @@ en:
body:
- Your recent energy bills give us the information we need to help you. You'll be able to upload more than one bill if you have them.
- We'll review your bills and use the information to suggest a suitable framework for buying energy. We won't share this information without your permission.
- energy_request:
- header: Is your request about energy?
- subtitle: About your request
- body: 'You can read our guidance about %{guidance_link}. It includes:'
- guidance_link: buying energy for your school
- body_bullets:
- - whether you can get a reduced rate VAT
- - how to choose between fixed, flexible or variable price contracts
- - what to think about when choosing contract length
- energy_request_about:
- header: Is your request about an energy contract, for example, a renewal?
- subtitle: About your request
+ origin:
+ caption: About your procurement
+ title: How did you first find out about this service?
+ hint: Select all that apply
options:
- energy_contract: "Yes"
- not_energy_contract: "No"
+ used_before: I've used this service before
+ meeting_or_event: Meeting or event
+ newsletter: Newsletter
+ recommendation: Recommendation
+ search_engine: Search engine, such as Google
+ social_media: Social media, such as Twitter
+ website: Website, such as GOV.UK
+ other: Other
+ please_specify: Please specify
+ same_supplier:
+ caption: About your procurement
+ title: Do all the schools currently use the same supplier?
+ options:
+ 'yes': "Yes"
+ 'no': "No"
+ not_sure: We're not sure
school_picker:
title: Which schools in your academy trust or federation will be involved in this procurement?
caption: About your school
@@ -546,12 +604,11 @@ en:
header: Which school are you buying for?
user_query:
caption: About your request
- hint: Briefly describe how we can help in a few sentences.
+ hint: Describe how we can help in a few sentences.
hint_list_start: "We'd like to know:"
hint_bullets:
- - what you're buying
- the start and end dates of your current contract, if you have one
- - when you need the new goods or services
+ - if you're buying goods, when you need them
- anything else about your procurement you think we should know
hint_list_end: Please provide as much information as you can. This will help us to answer your question.
label: How can we help?
@@ -562,12 +619,10 @@ en:
title: Support Request Confirmed - Get help buying for schools
body:
what_happens_next:
- default:
- - The Get help buying for schools team will review your request. We'll be in touch within %{days} working days.
energy:
- - The Get help buying for schools team will now review your request and energy bills if you've sent them. We'll be in touch within %{days} working days to find a convenient time to discuss your options.
- If you chose to email your bills, there will be instructions in the confirmation email telling you how to do this.
common:
+ - The Get help buying for schools team will review your request. We'll be in touch within %{days} working days.
- Please check to make sure you receive an email confirmation from us within the next 10 minutes. Check your junk folder if you do not see it.
- You'll need to submit your request again if you do not receive an email from us because this is how we'll be contacting you.
header:
@@ -577,22 +632,14 @@ en:
sub_header:
confirmation: 'We have sent a confirmation email to:'
what_you_can_do_next:
- default:
- list_start: 'Read guidance about:'
- how_to_buy_what_you_need_link: how to buy what you need
- what_to_consider_link: what to consider before buying specific goods and services
- agreements_and_faf_link: framework agreements and the find a framework tool
- bullets:
- how_to_buy_what_you_need: "%{how_to_buy_what_you_need_link} to learn more about the buying process"
- what_to_consider: "%{what_to_consider_link}"
- agreements_and_faf: "%{agreements_and_faf_link}"
- energy:
- list_start: 'You can read our guidance about %{guidance_link}. It includes:'
- guidance_link: buying energy for your school
- bullets:
- - whether you can get a reduced rate VAT
- - how to choose between fixed, flexible or variable price contracts
- - what to think about when choosing contract length
+ list_start: 'Read guidance about:'
+ how_to_buy_what_you_need_link: how to buy what you need
+ what_to_consider_link: what to consider before buying specific goods and services
+ agreements_and_faf_link: framework agreements and the find a framework tool
+ bullets:
+ how_to_buy_what_you_need: "%{how_to_buy_what_you_need_link} to learn more about the buying process"
+ what_to_consider: "%{what_to_consider_link}"
+ agreements_and_faf: "%{agreements_and_faf_link}"
feedback:
confirmation_details:
message: Thank you for opting in to take part in user research.
@@ -821,6 +868,8 @@ en:
contact_extension_number: Contact extension
contact_name: Contact name
contact_phone: Contact phone
+ contract_length: Contract length
+ contract_start_date: Contract start date
create: Create a new case
files: Attach files
date_received: Date received
@@ -902,9 +951,11 @@ en:
hint: For example, 12 11 2007
label: Next key date
label_optional: Next key date (optional)
+ not_known: Not known
organisation: Organisation
organisation_name: Organisation name
organisation_type: Organisation type
+ origin: Origin
place_on_hold: Place on hold
problem_description: Description of query
initial_problem_description: Initial description of query
@@ -943,6 +994,7 @@ en:
phase: Phase of education
local_authority: Local authority
uploaded_files: Uploaded files
+ same_supplier_used: Same supplier used
sort_by: Sort by
source:
digital: Specify case
diff --git a/config/locales/validation/en.yml b/config/locales/validation/en.yml
index 381c1838a..555917439 100644
--- a/config/locales/validation/en.yml
+++ b/config/locales/validation/en.yml
@@ -66,6 +66,38 @@ en:
attributes:
school_urns_confirmed:
blank: Select whether these are the schools you're buying for
+ framework_requests/contract_length_form:
+ attributes:
+ contract_length:
+ blank: Select the amount of time you want the contract for including any extensions. Choose 'not sure' if you do not know.
+ framework_requests/contract_start_date_form:
+ attributes:
+ contract_start_date_known:
+ blank: Select if you know when the contract should start
+ contract_start_date:
+ blank: Enter the date you want the contract to start
+ framework_requests/same_supplier_form:
+ attributes:
+ same_supplier_used:
+ blank: Select if all schools are currently using the same supplier
+ framework_requests/documents_form:
+ attributes:
+ document_types:
+ blank: Select the documents that you want to upload or 'I do not have any to upload at this time' if there are none to share right now.
+ document_type_other:
+ blank: Specify the type of documents that you want to upload
+ framework_requests/procurement_amount_form:
+ attributes:
+ procurement_amount:
+ blank: Enter how much the school will be spending. The number must be greater than 0.
+ greater_than: The number must be greater than 0
+ not_a_number: Enter a valid number
+ framework_requests/origin_form:
+ attributes:
+ origin:
+ blank: Select where you heard about the service
+ origin_other:
+ blank: Specify where you heard about the service
request:
rules:
diff --git a/config/request_for_help/categories.yml b/config/request_for_help/categories.yml
index 07960e942..4513686b8 100644
--- a/config/request_for_help/categories.yml
+++ b/config/request_for_help/categories.yml
@@ -6,18 +6,23 @@ categories:
slug: accessibility-audits
description: for building or digital
support_category: Audit Accessibility (buildings and digital)
+ flow: services
- title: Decarbonisation energy audits
slug: decarbonisation-energy-audits
support_category: Decarbonisation
+ flow: services
- title: Financial audit
slug: financial-audit
support_category: Audit Financial
+ flow: services
- title: Safeguarding audit
slug: safeguarding-audit
support_category: Audit Safeguarding
+ flow: services
- title: Other
slug: other
support_category: Other (BS)
+ flow: services
- title: Financial services
slug: financial-services
@@ -25,15 +30,19 @@ categories:
- title: Financial audit
slug: financial-audit
support_category: Audit Financial
+ flow: services
- title: Insurance
slug: insurance
support_category: Insurance
+ flow: services
- title: Spend analysis
slug: spend-analysis
support_category: Spend Analysis
+ flow: services
- title: Other
slug: other
support_category: Other (BS)
+ flow: services
- title: Leasing
slug: leasing
@@ -41,18 +50,23 @@ categories:
- title: Leasing
slug: leasing-sub
support_category: Leasing
+ flow: services
- title: LEDs (light-emitting diode)
slug: leds
support_category: Decarbonisation
+ flow: services
- title: Property leasing agents
slug: property-leasing-agents
support_category: Property leasing agents
+ flow: services
- title: Solar
slug: solar
support_category: Solar
+ flow: services
- title: Other
slug: other
support_category: Other (BS)
+ flow: services
- title: School and education supplies
slug: school-and-education-supplies
@@ -60,19 +74,24 @@ categories:
- title: Books
slug: books
support_category: Books
+ flow: goods
- title: Stationery and office supplies
slug: stationery-and-office-supplies
support_category: Stationery supply & office supplies
+ flow: goods
- title: Uniform
slug: uniform
description: for staff or pupils
support_category: Uniform
+ flow: not_fully_supported
- title: Vending machine
slug: vending-machine
support_category: Vending Machine
+ flow: services
- title: Other
slug: other
support_category: Other (FM)
+ flow: services
- title: Transport
slug: transport
@@ -80,12 +99,15 @@ categories:
- title: Passenger transport
slug: passenger-transport
support_category: Passenger transport
+ flow: services
- title: Vehicle hire or purchase
slug: vehicle-hire-or-purchase
support_category: Vehicle hire & purchase
+ flow: services
- title: Other
slug: other
support_category: Other (BS)
+ flow: services
- title: Food and catering
slug: food-and-catering
@@ -93,22 +115,28 @@ categories:
- title: Breakfast club
slug: breakfast-club
support_category: Breakfast Club
+ flow: services
- title: Catering equipment
slug: catering-equipment
support_category: Catering Equipment
+ flow: goods
- title: Catering services
slug: catering-services
support_category: Catering Services
+ flow: services
- title: Uniform
slug: uniform
description: for staff or pupils
support_category: Uniform
+ flow: not_fully_supported
- title: Vending machine
slug: vending-machine
support_category: Vending Machine
+ flow: services
- title: Other
slug: other
support_category: Other (FM)
+ flow: services
- title: Energy and utilities
slug: energy-and-utilities
@@ -116,30 +144,39 @@ categories:
- title: Decarbonisation and energy efficiency
slug: decarbonisation-and-energy-efficiency
support_category: Decarbonisation
+ flow: energy
- title: Electricity
slug: electricity
support_category: Electricity
+ flow: energy
- title: Gas
slug: gas
support_category: Gas
+ flow: energy
- title: Heat pumps
slug: heat-pumps
support_category: Decarbonisation
+ flow: energy
- title: LEDs (light-emitting diode)
slug: leds
support_category: Decarbonisation
+ flow: energy
- title: Other fuels
slug: other-fuels
support_category: Other fuels
+ flow: energy
- title: Solar
slug: solar
support_category: Solar
+ flow: services
- title: Water
slug: water
support_category: Water
+ flow: energy
- title: Other
slug: other
support_category: Other (Energy)
+ flow: energy
- title: Cleaning
slug: cleaning
@@ -147,15 +184,19 @@ categories:
- title: Cleaning products
slug: cleaning-products
support_category: Cleaning Products
+ flow: goods
- title: Cleaning services
slug: cleaning-services
support_category: Cleaning Services
+ flow: services
- title: Personal protection equipment (PPE)
slug: ppe
support_category: PPE
+ flow: goods
- title: Other
slug: other
support_category: Other (FM)
+ flow: services
- title: Buildings and site maintenance
slug: buildings-and-site-maintenance
@@ -163,44 +204,56 @@ categories:
- title: Boilers and plumbing services
slug: boilers-and-plumbing-services
support_category: Boilers and plumbing services
+ flow: services
- title: Building maintenance and building management system
slug: building-maintenance-and-bms
support_category: Building maintenance & BMS
+ flow: services
- title: Cleaning
slug: cleaning
sub_categories: *cleaning_subcategories
- title: Grounds and winter maintenance
slug: grounds-and-winter-maintenance
support_category: Grounds & Winter Maintenance
+ flow: services
- title: Mechanical and electrical systems
slug: mechanical-and-electrical-systems
support_category: Mechanical & Electrical Systems
+ flow: not_fully_supported
- title: Multi-use games area
slug: mugas
support_category: MUGAs
+ flow: services
- title: Personal protection equipment (PPE)
slug: ppe
support_category: PPE
+ flow: goods
- title: Removal and relocation
slug: removal-and-relocation
description: such as furniture, classroom, moving sites
support_category: Removal & relocation
+ flow: services
- title: Security and CCTV
slug: security-and-cctv
support_category: Security & CCTV
+ flow: services
- title: Water, drains and sewerage
slug: water-drains-and-sewerage
support_category: Water, drains & sewerage
+ flow: energy
- title: Waste management
slug: waste-management
support_category: Waste management
+ flow: services
- title: Other
slug: other
support_category: Other (FM)
+ flow: services
- title: Furniture
slug: furniture
support_category: Furniture
+ flow: goods
- title: Health and safety
slug: health-and-safety
@@ -209,19 +262,24 @@ categories:
slug: fire-safety
description: goods and systems
support_category: Fire Safety (Goods & Systems)
+ flow: goods
- title: Personal protection equipment (PPE)
slug: ppe
description: such as masks, protective clothing and helmets
support_category: PPE
+ flow: goods
- title: Security and CCTV
slug: security-and-cctv
support_category: Security & CCTV
+ flow: services
- title: Statutory testing and facilities management compliance
slug: statutory-testing-and-fm-compliance
support_category: Statutory testing & FM Compliance
+ flow: services
- title: Other
slug: other
support_category: Other (FM)
+ flow: services
- title: ICT
slug: ict
@@ -232,86 +290,111 @@ categories:
- title: Audio visual displays
slug: av-displays
support_category: AV Displays
+ flow: services
- title: Laptops
slug: laptops
support_category: Laptops
+ flow: goods
- title: Multi-functional devices (MFD)
slug: mfds
description: devices that can copy, print, scan or fax
support_category: MFD
+ flow: services
- title: Peripherals
slug: peripherals
description: such as keyboards or hard drives
support_category: Peripherals
+ flow: goods
- title: Server configuration and support
slug: server-configuration-and-support
support_category: Server Configuration & Support
+ flow: services
- title: Switches and routers
slug: switches and routers
support_category: Switches & Routers
+ flow: goods
- title: Other
slug: other
support_category: Other (ICT)
+ flow: services
- title: ICT funding
slug: ict-funding
support_category: Funding - non procurement requests
+ is_archived: true
+ flow: services
- title: Online platforms and services
slug: online-platforms-and-services
sub_categories:
- title: Cloud SaaS (software-as-a-service)
slug: cloud-saas
support_category: Cloud SaaS
+ flow: services
- title: Cyber services
slug: cyber-services
support_category: Cyber services
+ flow: services
- title: Hosting and storage
slug: hosting-and-storage
support_category: Hosting & Storage
+ flow: services
- title: Server configuration and support
slug: server-configuration-and-support
support_category: Server Configuration & Support
+ flow: services
- title: Virtual learning environment platforms
slug: vle-platforms
support_category: Platforms (VLEs)
+ flow: services
- title: Websites
slug: websites
support_category: Websites
+ flow: services
- title: Other
slug: other
support_category: Other (ICT)
+ flow: services
- title: Software
slug: software
sub_categories:
- title: Curriculum content
slug: curriculum-content
support_category: Curriculum Content
+ flow: services
- title: Management information system (MIS)
slug: mis
support_category: MIS
+ flow: services
- title: Operating system software
slug: os-software
support_category: OS Software
+ flow: services
- title: Server configuration and support
slug: server-configuration-and-support
support_category: Server Configuration & Support
+ flow: services
- title: Other
slug: other
support_category: Other (ICT)
+ flow: services
- title: Telecoms and broadband
slug: telecoms-and-broadband
sub_categories:
- title: Broadband infrastructure
slug: broadband-infrastructure
support_category: Broadband Infrastructure
+ flow: services
- title: Broadband service
slug: broadband-service
support_category: Broadband service
+ flow: services
- title: Telecoms
slug: telecoms
support_category: Telecoms & Broadband
+ flow: services
- title: Other
slug: other
support_category: Other (ICT)
+ flow: services
- title: Consultancy
slug: consultancy
@@ -320,13 +403,16 @@ categories:
slug: consultancy-direct
description: direct contract with a consultant
support_category: Consultancy
+ flow: services
- title: Managed consultancy
slug: managed-consultancy
description: consultants managed through a service
support_category: Specialist professional services
+ flow: services
- title: Other
slug: other
support_category: Other (PS)
+ flow: services
- title: Human resources and payroll
slug: human-resources-and-payroll
@@ -334,22 +420,29 @@ categories:
- title: Human resources
slug: hr
support_category: HR
+ flow: services
- title: Payroll
slug: payroll
support_category: Payroll
+ flow: services
- title: Recruitment of other staff
slug: recruitment-of-other-staff
support_category: Recruitment of other staff
+ flow: services
- title: Recruitment screening
slug: recruitment-screening
support_category: Recruitment screening
+ flow: services
- title: Supply teachers and agency workers
slug: supply-teachers-and-agency-workers
support_category: Supply Teachers & Agency workers
+ flow: services
- title: Other
slug: other
support_category: Other (PS)
+ flow: services
- title: Legal Services
slug: legal-services
support_category: Legal Services
+ flow: services
diff --git a/config/routes.rb b/config/routes.rb
index b208acd21..0bcdd31a7 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -95,12 +95,6 @@
collection do
post "/start", to: "start#create"
- get "/energy_request", to: "energy_request#index"
- post "/energy_request", to: "energy_request#create"
-
- get "/energy_request_about", to: "energy_request_about#index"
- post "/energy_request_about", to: "energy_request_about#create"
-
get "/energy_bill", to: "energy_bill#index"
post "/energy_bill", to: "energy_bill#create"
@@ -149,11 +143,32 @@
get "/categories/(*category_path)", to: "categories#index", as: "categories"
post "/categories/(*category_path)", to: "categories#create"
+ get "/contract_length", to: "contract_lengths#index"
+ post "/contract_length", to: "contract_lengths#create"
+
+ get "/contract_start_date", to: "contract_start_dates#index"
+ post "/contract_start_date", to: "contract_start_dates#create"
+
+ get "/same_supplier", to: "same_suppliers#index"
+ post "/same_supplier", to: "same_suppliers#create"
+
get "/procurement_amount", to: "procurement_amounts#index"
post "/procurement_amount", to: "procurement_amounts#create"
+ get "/documents", to: "documents#index"
+ post "/documents", to: "documents#create"
+
+ get "/document_uploads", to: "document_uploads#index"
+ post "/document_uploads", to: "document_uploads#create"
+ get "(:id)/document_uploads/list", to: "document_uploads#list", as: "list_document_uploads"
+ post "(:id)/document_uploads/upload", to: "document_uploads#upload", as: "upload_document_uploads"
+ delete "(:id)/document_uploads/remove", to: "document_uploads#remove", as: "remove_document_uploads"
+
get "/special_requirements", to: "special_requirements#index"
post "/special_requirements", to: "special_requirements#create"
+
+ get "/origin", to: "origins#index"
+ post "/origin", to: "origins#create"
end
member do
resource :select_organisation, only: %i[edit update], as: :framework_request_select_organisation
@@ -170,8 +185,14 @@
get "edit/(*category_path)", to: "categories#edit", as: "edit"
patch "(*category_path)", to: "categories#update", as: ""
end
+ resource :contract_length, only: %i[edit update], as: :framework_request_contract_length
+ resource :contract_start_date, only: %i[edit update], as: :framework_request_contract_start_date
+ resource :same_supplier, only: %i[edit update], as: :framework_request_same_supplier
resource :procurement_amount, only: %i[edit update], as: :framework_request_procurement_amount
+ resource :documents, only: %i[edit update], as: :framework_request_documents
+ resource :document_uploads, only: %i[edit update], as: :framework_request_document_uploads
resource :special_requirements, only: %i[edit update], as: :framework_request_special_requirements
+ resource :origin, only: %i[edit update], as: :framework_request_origin
end
end
end
diff --git a/config/support/categories.yml b/config/support/categories.yml
index 194c96300..d54121c28 100644
--- a/config/support/categories.yml
+++ b/config/support/categories.yml
@@ -30,6 +30,7 @@ categories:
- title: Cyber services
slug: cyber_services
- title: Funding - non procurement requests
+ is_archived: true
- title: Hosting & Storage
slug: hosting_and_storage
- title: Laptops
diff --git a/db/migrate/20230908141955_add_flow_to_request_for_help_categories.rb b/db/migrate/20230908141955_add_flow_to_request_for_help_categories.rb
new file mode 100644
index 000000000..ec8dec895
--- /dev/null
+++ b/db/migrate/20230908141955_add_flow_to_request_for_help_categories.rb
@@ -0,0 +1,5 @@
+class AddFlowToRequestForHelpCategories < ActiveRecord::Migration[7.0]
+ def change
+ add_column :request_for_help_categories, :flow, :int
+ end
+end
diff --git a/db/migrate/20230913105429_add_contract_length_to_framework_requests.rb b/db/migrate/20230913105429_add_contract_length_to_framework_requests.rb
new file mode 100644
index 000000000..71c53f366
--- /dev/null
+++ b/db/migrate/20230913105429_add_contract_length_to_framework_requests.rb
@@ -0,0 +1,5 @@
+class AddContractLengthToFrameworkRequests < ActiveRecord::Migration[7.0]
+ def change
+ add_column :framework_requests, :contract_length, :integer
+ end
+end
diff --git a/db/migrate/20230913125303_add_contract_start_date_to_framework_requests.rb b/db/migrate/20230913125303_add_contract_start_date_to_framework_requests.rb
new file mode 100644
index 000000000..5772719ec
--- /dev/null
+++ b/db/migrate/20230913125303_add_contract_start_date_to_framework_requests.rb
@@ -0,0 +1,8 @@
+class AddContractStartDateToFrameworkRequests < ActiveRecord::Migration[7.0]
+ def change
+ change_table :framework_requests, bulk: true do |t|
+ t.column :contract_start_date_known, :boolean
+ t.column :contract_start_date, :date
+ end
+ end
+end
diff --git a/db/migrate/20230913152536_add_same_supplier_used_to_framework_requests.rb b/db/migrate/20230913152536_add_same_supplier_used_to_framework_requests.rb
new file mode 100644
index 000000000..1859df2b0
--- /dev/null
+++ b/db/migrate/20230913152536_add_same_supplier_used_to_framework_requests.rb
@@ -0,0 +1,5 @@
+class AddSameSupplierUsedToFrameworkRequests < ActiveRecord::Migration[7.0]
+ def change
+ add_column :framework_requests, :same_supplier_used, :integer
+ end
+end
diff --git a/db/migrate/20230915140037_add_document_types_to_framework_requests.rb b/db/migrate/20230915140037_add_document_types_to_framework_requests.rb
new file mode 100644
index 000000000..d51433b64
--- /dev/null
+++ b/db/migrate/20230915140037_add_document_types_to_framework_requests.rb
@@ -0,0 +1,8 @@
+class AddDocumentTypesToFrameworkRequests < ActiveRecord::Migration[7.0]
+ def change
+ change_table :framework_requests, bulk: true do |t|
+ t.column :document_types, :string, array: true, default: []
+ t.column :document_type_other, :text
+ end
+ end
+end
diff --git a/db/migrate/20230915155648_create_documents.rb b/db/migrate/20230915155648_create_documents.rb
new file mode 100644
index 000000000..12ccaf310
--- /dev/null
+++ b/db/migrate/20230915155648_create_documents.rb
@@ -0,0 +1,13 @@
+class CreateDocuments < ActiveRecord::Migration[7.0]
+ def change
+ create_table :documents, id: :uuid do |t|
+ t.integer :submission_status, default: 0
+ t.string :filename
+ t.integer :filesize
+ t.references :support_case, foreign_key: { to_table: :support_cases }, type: :uuid
+ t.references :framework_request, foreign_key: { to_table: :framework_requests }, type: :uuid
+
+ t.timestamps
+ end
+ end
+end
diff --git a/db/migrate/20230918155242_add_origin_to_framework_requests.rb b/db/migrate/20230918155242_add_origin_to_framework_requests.rb
new file mode 100644
index 000000000..341bb201f
--- /dev/null
+++ b/db/migrate/20230918155242_add_origin_to_framework_requests.rb
@@ -0,0 +1,8 @@
+class AddOriginToFrameworkRequests < ActiveRecord::Migration[7.0]
+ def change
+ change_table :framework_requests, bulk: true do |t|
+ t.column :origin, :integer
+ t.column :origin_other, :text
+ end
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index cabebdc09..0a6d39074 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema[7.0].define(version: 2023_09_13_084703) do
+ActiveRecord::Schema[7.0].define(version: 2023_09_18_155242) do
# These are extensions that must be enabled in order to support this database
enable_extension "citext"
enable_extension "pg_trgm"
@@ -119,6 +119,18 @@
t.index ["step_id"], name: "index_currency_answers_on_step_id"
end
+ create_table "documents", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
+ t.integer "submission_status", default: 0
+ t.string "filename"
+ t.integer "filesize"
+ t.uuid "support_case_id"
+ t.uuid "framework_request_id"
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
+ t.index ["framework_request_id"], name: "index_documents_on_framework_request_id"
+ t.index ["support_case_id"], name: "index_documents_on_support_case_id"
+ end
+
create_table "energy_bills", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
t.integer "submission_status", default: 0
t.string "filename"
@@ -202,6 +214,14 @@
t.text "category_other"
t.string "school_urns", default: [], array: true
t.uuid "support_case_id"
+ t.integer "contract_length"
+ t.boolean "contract_start_date_known"
+ t.date "contract_start_date"
+ t.integer "same_supplier_used"
+ t.string "document_types", default: [], array: true
+ t.text "document_type_other"
+ t.integer "origin"
+ t.text "origin_other"
t.index ["category_id"], name: "index_framework_requests_on_category_id"
t.index ["support_case_id"], name: "index_framework_requests_on_support_case_id"
t.index ["user_id"], name: "index_framework_requests_on_user_id"
@@ -322,6 +342,7 @@
t.datetime "archived_at"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
+ t.integer "flow"
t.index ["parent_id"], name: "index_request_for_help_categories_on_parent_id"
t.index ["slug"], name: "index_request_for_help_categories_on_slug"
t.index ["support_category_id"], name: "index_request_for_help_categories_on_support_category_id"
@@ -859,6 +880,8 @@
add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id"
add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id"
add_foreign_key "all_cases_survey_responses", "support_cases", column: "case_id"
+ add_foreign_key "documents", "framework_requests"
+ add_foreign_key "documents", "support_cases"
add_foreign_key "exit_survey_responses", "support_cases", column: "case_id"
add_foreign_key "framework_requests", "request_for_help_categories", column: "category_id"
add_foreign_key "framework_requests", "support_cases"
diff --git a/spec/controllers/framework_requests/categories_controller_spec.rb b/spec/controllers/framework_requests/categories_controller_spec.rb
index 670de7014..227e7de0f 100644
--- a/spec/controllers/framework_requests/categories_controller_spec.rb
+++ b/spec/controllers/framework_requests/categories_controller_spec.rb
@@ -1,11 +1,10 @@
require "./spec/support/shared/framework_request_controllers"
describe FrameworkRequests::CategoriesController, type: :controller do
- let(:framework_request) { create(:framework_request, category:, is_energy_request:, energy_request_about:, have_energy_bill:) }
+ let(:framework_request) { create(:framework_request, category:, group:, org_id:) }
let(:category) { nil }
- let(:is_energy_request) { false }
- let(:energy_request_about) { nil }
- let(:have_energy_bill) { false }
+ let(:group) { nil }
+ let(:org_id) { nil }
let(:a) { create(:request_for_help_category, slug: "a") }
let(:b) { create(:request_for_help_category, slug: "b", parent: a) }
@@ -22,10 +21,53 @@
end
context "when the user is on the main categories page" do
- before { get :index, session: { framework_request_id: framework_request.id } }
+ context "and the user is signed in" do
+ before { user_is_signed_in(user:) }
- it "goes back to the message page" do
- expect(controller.view_assigns["back_url"]).to eq "/procurement-support/message"
+ context "and the user belongs to a MAT or federation with multiple schools" do
+ let(:user) { build(:user, :one_supported_group) }
+ let(:group) { true }
+ let(:org_id) { "2314" }
+
+ before do
+ establishment_group_type = create(:support_establishment_group_type, code: 6)
+ create(:support_establishment_group, name: "Testing Multi Academy Trust", uid: "2314", establishment_group_type:)
+ create_list(:support_organisation, 2, trust_code: "2314")
+ get :index, session: { framework_request_id: framework_request.id }
+ end
+
+ it "goes back to the schools confirmation page" do
+ expect(controller.view_assigns["back_url"]).to eq "/procurement-support/confirm_schools"
+ end
+ end
+
+ context "and the user belongs to a single chosen organisation" do
+ let(:user) { build(:user, :many_supported_schools) }
+
+ before { get :index, session: { framework_request_id: framework_request.id } }
+
+ it "goes back to the select organisation page" do
+ expect(controller.view_assigns["back_url"]).to eq "/procurement-support/select_organisation"
+ end
+ end
+
+ context "and the user belongs to a single inferred organisation" do
+ let(:user) { build(:user, :one_supported_school) }
+
+ before { get :index, session: { framework_request_id: framework_request.id } }
+
+ it "goes back to the confirm sign-in page" do
+ expect(controller.view_assigns["back_url"]).to eq "/procurement-support/confirm_sign_in"
+ end
+ end
+ end
+
+ context "and the user is a guest" do
+ before { get :index, session: { framework_request_id: framework_request.id } }
+
+ it "goes back to the email page" do
+ expect(controller.view_assigns["back_url"]).to eq "/procurement-support/email"
+ end
end
end
@@ -92,22 +134,29 @@
end
context "when the user has chosen a final category" do
- before { post :create, params: { category_path: "a/b", framework_support_form: { category_slug: "c" } }, session: { framework_request_id: framework_request.id } }
+ before do
+ c.update!(flow:)
+ post :create, params: { category_path: "a/b", framework_support_form: { category_slug: "c" } }, session: { framework_request_id: framework_request.id }
+ end
+
+ context "and they are in the services flow" do
+ let(:flow) { :services }
+
+ it "redirects to the contract length page" do
+ expect(response).to redirect_to("/procurement-support/contract_length")
+ end
+ end
- context "and they have chosen to upload a bill" do
- let(:is_energy_request) { true }
- let(:energy_request_about) { "energy_contract" }
- let(:have_energy_bill) { true }
+ context "and they are in the energy flow" do
+ let(:flow) { :energy }
- it "redirects to the accessibility page" do
- expect(response).to redirect_to("/procurement-support/special_requirements")
+ it "redirects to the contract length page" do
+ expect(response).to redirect_to("/procurement-support/contract_length")
end
end
- context "and they have chosen not to upload a bill" do
- let(:is_energy_request) { false }
- let(:energy_request_about) { nil }
- let(:have_energy_bill) { false }
+ context "and they are not in the energy or services flow" do
+ let(:flow) { :goods }
it "redirects to the procurement amount page" do
expect(response).to redirect_to("/procurement-support/procurement_amount")
diff --git a/spec/controllers/framework_requests/confirm_schools_controller_spec.rb b/spec/controllers/framework_requests/confirm_schools_controller_spec.rb
index c25725cf4..62d97427a 100644
--- a/spec/controllers/framework_requests/confirm_schools_controller_spec.rb
+++ b/spec/controllers/framework_requests/confirm_schools_controller_spec.rb
@@ -13,21 +13,12 @@
context "when the schools are confirmed" do
let(:school_urns_confirmed) { true }
- context "and it is an energy request" do
- let(:framework_request) { create(:framework_request, :energy_request) }
-
- it "redirects to the bill upload page" do
- post(:create, params:, session:)
- expect(response).to redirect_to "/procurement-support/bill_uploads"
- end
- end
-
context "and the user is signed in" do
before { user_is_signed_in }
- it "redirects to the message page" do
+ it "redirects to the categories page" do
post(:create, params:, session:)
- expect(response).to redirect_to "/procurement-support/message"
+ expect(response).to redirect_to "/procurement-support/categories"
end
end
diff --git a/spec/controllers/framework_requests/confirm_sign_in_controller_spec.rb b/spec/controllers/framework_requests/confirm_sign_in_controller_spec.rb
index a9e88ee13..11946f555 100644
--- a/spec/controllers/framework_requests/confirm_sign_in_controller_spec.rb
+++ b/spec/controllers/framework_requests/confirm_sign_in_controller_spec.rb
@@ -13,21 +13,23 @@
context "when the user belongs to one organisation" do
let(:user) { build(:user, :one_supported_school) }
- context "when the user has chosen not to upload a bill" do
- let(:framework_request) { create(:framework_request, is_energy_request: false) }
-
- it "redirects to the message page" do
- post :create, session: { framework_request_id: framework_request.id }
- expect(response).to redirect_to "/procurement-support/message"
- end
+ it "redirects to the categories page" do
+ post :create
+ expect(response).to redirect_to "/procurement-support/categories"
end
- context "when the user has chosen to upload a bill" do
- let(:framework_request) { create(:framework_request, is_energy_request: true, energy_request_about: "energy_contract", have_energy_bill: true) }
+ context "and the organisation is a MAT or federation with multiple schools" do
+ let(:user) { build(:user, :one_supported_group) }
+
+ before do
+ establishment_group_type = create(:support_establishment_group_type, code: 6)
+ create(:support_establishment_group, name: "Testing Multi Academy Trust", uid: "2314", establishment_group_type:)
+ create_list(:support_organisation, 2, trust_code: "2314")
+ end
- it "redirects to the bill upload page" do
- post :create, session: { framework_request_id: framework_request.id }
- expect(response).to redirect_to "/procurement-support/bill_uploads"
+ it "redirects to the school picker page" do
+ post :create
+ expect(response).to redirect_to "/procurement-support/school_picker"
end
end
end
diff --git a/spec/controllers/framework_requests/contract_lengths_controller_spec.rb b/spec/controllers/framework_requests/contract_lengths_controller_spec.rb
new file mode 100644
index 000000000..12275836f
--- /dev/null
+++ b/spec/controllers/framework_requests/contract_lengths_controller_spec.rb
@@ -0,0 +1,11 @@
+require "./spec/support/shared/framework_request_controllers"
+
+describe FrameworkRequests::ContractLengthsController, type: :controller do
+ include_examples "back url", "/procurement-support/categories"
+
+ it "redirects to the contract start date page" do
+ params = { framework_support_form: { contract_length: "not_sure" } }
+ post(:create, params:)
+ expect(response).to redirect_to "/procurement-support/contract_start_date"
+ end
+end
diff --git a/spec/controllers/framework_requests/contract_start_dates_controller_spec.rb b/spec/controllers/framework_requests/contract_start_dates_controller_spec.rb
new file mode 100644
index 000000000..4ba5f989d
--- /dev/null
+++ b/spec/controllers/framework_requests/contract_start_dates_controller_spec.rb
@@ -0,0 +1,29 @@
+describe FrameworkRequests::ContractStartDatesController, type: :controller do
+ let(:framework_request) { create(:framework_request) }
+
+ describe "create" do
+ let(:params) { { framework_support_form: { contract_start_date_known: "true", "contract_start_date(3i)": "27", "contract_start_date(2i)": "3", "contract_start_date(1i)": "2023" } } }
+ let(:session) { { framework_request_id: framework_request.id } }
+
+ context "when multiple schools are selected" do
+ before { framework_request.update!(school_urns: %w[1 2]) }
+
+ it "redirects to the all schools same supplier page" do
+ post(:create, params:, session:)
+ expect(response).to redirect_to "/procurement-support/same_supplier"
+ end
+ end
+
+ context "when a single organisation is selected" do
+ it "redirects to the procurement amount page" do
+ post(:create, params:, session:)
+ expect(response).to redirect_to "/procurement-support/procurement_amount"
+ end
+ end
+ end
+
+ it "goes back to the contract length page" do
+ get(:index, params: { framework_support_form: { contract_start_date_known: nil } })
+ expect(controller.view_assigns["back_url"]).to eq "/procurement-support/contract_length"
+ end
+end
diff --git a/spec/controllers/framework_requests/document_uploads_controller_spec.rb b/spec/controllers/framework_requests/document_uploads_controller_spec.rb
new file mode 100644
index 000000000..a41fd8626
--- /dev/null
+++ b/spec/controllers/framework_requests/document_uploads_controller_spec.rb
@@ -0,0 +1,10 @@
+require "./spec/support/shared/framework_request_controllers"
+
+describe FrameworkRequests::DocumentUploadsController, type: :controller do
+ include_examples "back url", "/procurement-support/documents"
+
+ it "redirects to the accessibility needs page" do
+ post(:create)
+ expect(response).to redirect_to "/procurement-support/special_requirements"
+ end
+end
diff --git a/spec/controllers/framework_requests/documents_controller_spec.rb b/spec/controllers/framework_requests/documents_controller_spec.rb
new file mode 100644
index 000000000..04e43bbf7
--- /dev/null
+++ b/spec/controllers/framework_requests/documents_controller_spec.rb
@@ -0,0 +1,23 @@
+require "./spec/support/shared/framework_request_controllers"
+
+describe FrameworkRequests::DocumentsController, type: :controller do
+ include_examples "back url", "/procurement-support/message"
+
+ context "when the document type is none" do
+ let(:params) { { framework_support_form: { document_types: %w[none] } } }
+
+ it "redirects to the accessibility needs page" do
+ post(:create, params:)
+ expect(response).to redirect_to "/procurement-support/special_requirements"
+ end
+ end
+
+ context "when the document types are anything else" do
+ let(:params) { { framework_support_form: { document_types: %w[floor_plans] } } }
+
+ it "redirects to the document upload page" do
+ post(:create, params:)
+ expect(response).to redirect_to "/procurement-support/document_uploads"
+ end
+ end
+end
diff --git a/spec/controllers/framework_requests/emails_controller_spec.rb b/spec/controllers/framework_requests/emails_controller_spec.rb
index f7dfc1913..868edcbc2 100644
--- a/spec/controllers/framework_requests/emails_controller_spec.rb
+++ b/spec/controllers/framework_requests/emails_controller_spec.rb
@@ -3,21 +3,8 @@
describe FrameworkRequests::EmailsController, type: :controller do
include_examples "back url", "/procurement-support/name"
- context "when the user has chosen to upload a bill" do
- let(:framework_request) { create(:framework_request, is_energy_request: true, energy_request_about: "energy_contract", have_energy_bill: true) }
-
- it "redirects to the bill upload page" do
- post :create, session: { framework_request_id: framework_request.id }
- expect(response).to redirect_to "/procurement-support/bill_uploads"
- end
- end
-
- context "when the user has chosen not to upload a bill" do
- let(:framework_request) { create(:framework_request, is_energy_request: false) }
-
- it "redirects to the message page" do
- post :create, session: { framework_request_id: framework_request.id }
- expect(response).to redirect_to "/procurement-support/message"
- end
+ it "redirects to the categories page" do
+ post :create, params: { framework_support_form: { email: "test@example.com" } }
+ expect(response).to redirect_to "/procurement-support/categories"
end
end
diff --git a/spec/controllers/framework_requests/energy_alternative_controller_spec.rb b/spec/controllers/framework_requests/energy_alternative_controller_spec.rb
index 5f44904c7..a84ddef23 100644
--- a/spec/controllers/framework_requests/energy_alternative_controller_spec.rb
+++ b/spec/controllers/framework_requests/energy_alternative_controller_spec.rb
@@ -4,18 +4,34 @@
include_examples "back url", "/procurement-support/energy_bill"
context "when the user has selected different format" do
- include_examples "sign-in redirects", { framework_support_form: { energy_alternative: "different_format" } }
+ before { post :create, params: { framework_support_form: { energy_alternative: "different_format" } } }
+
+ it "redirects to the bill uploads page" do
+ expect(response).to redirect_to "/procurement-support/bill_uploads"
+ end
end
- context "when the user has selected email later" do
- include_examples "sign-in redirects", { framework_support_form: { energy_alternative: "email_later" } }
+ context "when the user has selected to email later" do
+ before { post :create, params: { framework_support_form: { energy_alternative: "email_later" } } }
+
+ it "redirects to the accessibility needs page" do
+ expect(response).to redirect_to "/procurement-support/special_requirements"
+ end
end
context "when the user has selected no bill" do
- include_examples "sign-in redirects", { framework_support_form: { energy_alternative: "no_bill" } }
+ before { post :create, params: { framework_support_form: { energy_alternative: "no_bill" } } }
+
+ it "redirects to the accessibility needs page" do
+ expect(response).to redirect_to "/procurement-support/special_requirements"
+ end
end
context "when the user has selected no thanks" do
- include_examples "sign-in redirects", { framework_support_form: { energy_alternative: "no_thanks" } }
+ before { post :create, params: { framework_support_form: { energy_alternative: "no_thanks" } } }
+
+ it "redirects to the accessibility needs page" do
+ expect(response).to redirect_to "/procurement-support/special_requirements"
+ end
end
end
diff --git a/spec/controllers/framework_requests/energy_bill_controller_spec.rb b/spec/controllers/framework_requests/energy_bill_controller_spec.rb
index 9c848ebb9..ab519e8b9 100644
--- a/spec/controllers/framework_requests/energy_bill_controller_spec.rb
+++ b/spec/controllers/framework_requests/energy_bill_controller_spec.rb
@@ -1,7 +1,7 @@
require "./spec/support/shared/framework_request_controllers"
describe FrameworkRequests::EnergyBillController, type: :controller do
- include_examples "back url", "/procurement-support/energy_request_about"
+ include_examples "back url", "/procurement-support/message"
context "when the user has no bill" do
before { post :create, params: { framework_support_form: { have_energy_bill: "false" } } }
@@ -12,6 +12,10 @@
end
context "when the user has a bill" do
- include_examples "sign-in redirects", { framework_support_form: { have_energy_bill: "true" } }
+ before { post :create, params: { framework_support_form: { have_energy_bill: "true" } } }
+
+ it "redirects to the bill uploads page" do
+ expect(response).to redirect_to "/procurement-support/bill_uploads"
+ end
end
end
diff --git a/spec/controllers/framework_requests/energy_request_about_controller_spec.rb b/spec/controllers/framework_requests/energy_request_about_controller_spec.rb
deleted file mode 100644
index a2d4ed32c..000000000
--- a/spec/controllers/framework_requests/energy_request_about_controller_spec.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-require "./spec/support/shared/framework_request_controllers"
-
-describe FrameworkRequests::EnergyRequestAboutController, type: :controller do
- include_examples "back url", "/procurement-support/energy_request"
-
- context "when it is about an energy contract" do
- before { post :create, params: { framework_support_form: { energy_request_about: "energy_contract" } } }
-
- it "redirects to the energy bill page" do
- expect(response).to redirect_to "/procurement-support/energy_bill"
- end
- end
-
- context "when it is not about an energy contract" do
- include_examples "sign-in redirects", { framework_support_form: { energy_request_about: "not_energy_contract" } }
- end
-end
diff --git a/spec/controllers/framework_requests/energy_request_controller_spec.rb b/spec/controllers/framework_requests/energy_request_controller_spec.rb
deleted file mode 100644
index 062497ca8..000000000
--- a/spec/controllers/framework_requests/energy_request_controller_spec.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-require "./spec/support/shared/framework_request_controllers"
-
-describe FrameworkRequests::EnergyRequestController, type: :controller do
- include_examples "back url", "/procurement-support"
-
- context "when it is an energy request" do
- before { post :create, params: { framework_support_form: { is_energy_request: "true" } } }
-
- it "redirects to the energy request about page" do
- expect(response).to redirect_to "/procurement-support/energy_request_about"
- end
- end
-
- context "when it is not an energy request" do
- include_examples "sign-in redirects", { framework_support_form: { is_energy_request: "false" } }
- end
-end
diff --git a/spec/controllers/framework_requests/messages_controller_spec.rb b/spec/controllers/framework_requests/messages_controller_spec.rb
index eef68f367..4b50d9498 100644
--- a/spec/controllers/framework_requests/messages_controller_spec.rb
+++ b/spec/controllers/framework_requests/messages_controller_spec.rb
@@ -1,71 +1,76 @@
require "./spec/support/shared/framework_request_controllers"
describe FrameworkRequests::MessagesController, type: :controller do
- context "when feature :energy_bill_flow is not enabled" do
- let(:framework_request) { create(:framework_request) }
+ let(:framework_request) { create(:framework_request, category:) }
+ let(:category) { nil }
- before { Flipper.disable(:energy_bill_flow) }
+ include_examples "back url", "/procurement-support/procurement_amount"
- it "redirects to the category page" do
- post :create, session: { framework_request_id: framework_request.id }
- expect(response).to redirect_to "/procurement-support/categories"
- end
- end
+ context "when the request is in the energy flow" do
+ context "and about electricity" do
+ let(:category) { create(:request_for_help_category, slug: "electricity", flow: :energy) }
+ let(:framework_request_flow) { "energy" }
- context "when the user has chosen to upload a bill" do
- let(:framework_request) { create(:framework_request, is_energy_request: true, energy_request_about: "energy_contract", have_energy_bill: true) }
+ before { post :create, session: { framework_request_id: framework_request.id, framework_request_flow: } }
- it "redirects to the category page" do
- post :create, session: { framework_request_id: framework_request.id }
- expect(response).to redirect_to "/procurement-support/categories"
+ it "redirects to the energy bill page" do
+ expect(response).to redirect_to "/procurement-support/energy_bill"
+ end
end
- end
- context "when the user has chosen not to upload a bill" do
- let(:framework_request) { create(:framework_request, is_energy_request: false) }
+ context "and about gas" do
+ let(:category) { create(:request_for_help_category, slug: "gas", flow: :energy) }
+ let(:framework_request_flow) { "energy" }
+
+ before { post :create, session: { framework_request_id: framework_request.id, framework_request_flow: } }
- it "redirects to the category page" do
- post :create, session: { framework_request_id: framework_request.id }
- expect(response).to redirect_to "/procurement-support/categories"
+ it "redirects to the energy bill page" do
+ expect(response).to redirect_to "/procurement-support/energy_bill"
+ end
end
- end
- describe "back url" do
- context "when the user is signed in" do
- before { user_is_signed_in(user:) }
+ context "and about anything else" do
+ let(:category) { create(:request_for_help_category, slug: "water", flow: :energy) }
+ let(:framework_request_flow) { "energy" }
- context "when the user belongs to one organisation" do
- let(:user) { build(:user, :one_supported_school) }
+ before { post :create, session: { framework_request_id: framework_request.id, framework_request_flow: } }
+
+ it "redirects to the documents page" do
+ expect(response).to redirect_to "/procurement-support/documents"
+ end
+ end
+ end
- before { allow(controller).to receive(:last_energy_path).and_return("last_energy_path") }
+ context "when the request is in the services flow" do
+ let(:category) { create(:request_for_help_category, slug: "catering-services", flow: :services) }
+ let(:framework_request_flow) { "services" }
- include_examples "back url", "last_energy_path"
+ before { post :create, session: { framework_request_id: framework_request.id, framework_request_flow: } }
- context "when feature :energy_bill_flow is not enabled" do
- before { Flipper.disable(:energy_bill_flow) }
+ it "redirects to the documents page" do
+ expect(response).to redirect_to "/procurement-support/documents"
+ end
+ end
- include_examples "back url", "/procurement-support/select_organisation"
- end
- end
+ context "when the request is in the goods flow" do
+ let(:category) { create(:request_for_help_category, slug: "books", flow: :goods) }
+ let(:framework_request_flow) { "goods" }
- context "when the user belongs to multiple organisations" do
- let(:user) { build(:user, :many_supported_schools) }
+ before { post :create, session: { framework_request_id: framework_request.id, framework_request_flow: } }
- include_examples "back url", "/procurement-support/select_organisation"
- end
+ it "redirects to the accessibility needs page" do
+ expect(response).to redirect_to "/procurement-support/special_requirements"
end
+ end
- context "when the user is not signed in" do
- include_examples "back url", "/procurement-support/email"
- end
+ context "when the request is in the not-fully-supported flow" do
+ let(:category) { create(:request_for_help_category, slug: "uniform", flow: :not_fully_supported) }
+ let(:framework_request_flow) { "not_fully_supported" }
- context "when the user has chosen to upload a bill" do
- let(:framework_request) { create(:framework_request, is_energy_request: true, energy_request_about: "energy_contract", have_energy_bill: true) }
+ before { post :create, session: { framework_request_id: framework_request.id, framework_request_flow: } }
- it "goes back to the bill upload page" do
- get :index, session: { framework_request_id: framework_request.id }
- expect(controller.view_assigns["back_url"]).to eq "/procurement-support/bill_uploads"
- end
+ it "redirects to the accessibility needs page" do
+ expect(response).to redirect_to "/procurement-support/special_requirements"
end
end
end
diff --git a/spec/controllers/framework_requests/origins_controller_spec.rb b/spec/controllers/framework_requests/origins_controller_spec.rb
new file mode 100644
index 000000000..58ea8e569
--- /dev/null
+++ b/spec/controllers/framework_requests/origins_controller_spec.rb
@@ -0,0 +1,14 @@
+require "./spec/support/shared/framework_request_controllers"
+
+describe FrameworkRequests::OriginsController, type: :controller do
+ let(:framework_request) { create(:framework_request) }
+
+ include_examples "back url", "/procurement-support/special_requirements"
+
+ it "redirects to the framework request page" do
+ params = { framework_support_form: { origin: "website" } }
+ session = { framework_request_id: framework_request.id }
+ post(:create, params:, session:)
+ expect(response).to redirect_to "/procurement-support/#{framework_request.id}"
+ end
+end
diff --git a/spec/controllers/framework_requests/procurement_amounts_controller_spec.rb b/spec/controllers/framework_requests/procurement_amounts_controller_spec.rb
index b94d64a28..c53482f1d 100644
--- a/spec/controllers/framework_requests/procurement_amounts_controller_spec.rb
+++ b/spec/controllers/framework_requests/procurement_amounts_controller_spec.rb
@@ -1,10 +1,68 @@
-require "./spec/support/shared/framework_request_controllers"
-
describe FrameworkRequests::ProcurementAmountsController, type: :controller do
- include_examples "back url", "/procurement-support/categories"
+ let(:framework_request) { create(:framework_request) }
+
+ it "redirects to the message page" do
+ post :create, params: { framework_support_form: { procurement_amount: "205.13" } }
+ expect(response).to redirect_to "/procurement-support/message"
+ end
+
+ describe "back url" do
+ describe "on index" do
+ context "when the user is in the services flow" do
+ let(:framework_request_flow) { "services" }
+
+ context "and it is not a multi-school request" do
+ before { get :index, session: { framework_request_id: framework_request.id, framework_request_flow: } }
+
+ it "goes back to the contract start date page" do
+ expect(controller.view_assigns["back_url"]).to eq "/procurement-support/contract_start_date"
+ end
+ end
+
+ context "and it is a multi-school request" do
+ before do
+ framework_request.update!(school_urns: %w[1 2])
+ get :index, session: { framework_request_id: framework_request.id, framework_request_flow: }
+ end
+
+ it "goes back to the same supplier page" do
+ expect(controller.view_assigns["back_url"]).to eq "/procurement-support/same_supplier"
+ end
+ end
+ end
+
+ context "when the user is in the energy flow" do
+ let(:framework_request_flow) { "energy" }
+
+ context "and it is not a multi-school request" do
+ before { get :index, session: { framework_request_id: framework_request.id, framework_request_flow: } }
+
+ it "goes back to the contract start date page" do
+ expect(controller.view_assigns["back_url"]).to eq "/procurement-support/contract_start_date"
+ end
+ end
+
+ context "and it is a multi-school request" do
+ before do
+ framework_request.update!(school_urns: %w[1 2])
+ get :index, session: { framework_request_id: framework_request.id, framework_request_flow: }
+ end
+
+ it "goes back to the same supplier page" do
+ expect(controller.view_assigns["back_url"]).to eq "/procurement-support/same_supplier"
+ end
+ end
+ end
+
+ context "when the user is in a different flow" do
+ let(:framework_request_flow) { nil }
+
+ before { get :index, session: { framework_request_id: framework_request.id, framework_request_flow: } }
- it "redirects to the special requirements page" do
- post :create
- expect(response).to redirect_to "/procurement-support/special_requirements"
+ it "goes back to the categories page" do
+ expect(controller.view_assigns["back_url"]).to eq "/procurement-support/categories"
+ end
+ end
+ end
end
end
diff --git a/spec/controllers/framework_requests/same_suppliers_controller_spec.rb b/spec/controllers/framework_requests/same_suppliers_controller_spec.rb
new file mode 100644
index 000000000..f987c9c5c
--- /dev/null
+++ b/spec/controllers/framework_requests/same_suppliers_controller_spec.rb
@@ -0,0 +1,11 @@
+require "./spec/support/shared/framework_request_controllers"
+
+describe FrameworkRequests::SameSuppliersController, type: :controller do
+ include_examples "back url", "/procurement-support/contract_start_date"
+
+ it "redirects to the procurement amount page" do
+ params = { framework_support_form: { same_supplier_used: "yes" } }
+ post(:create, params:)
+ expect(response).to redirect_to "/procurement-support/procurement_amount"
+ end
+end
diff --git a/spec/controllers/framework_requests/sign_in_controller_spec.rb b/spec/controllers/framework_requests/sign_in_controller_spec.rb
index 4f48b0410..e3b6b7a25 100644
--- a/spec/controllers/framework_requests/sign_in_controller_spec.rb
+++ b/spec/controllers/framework_requests/sign_in_controller_spec.rb
@@ -18,16 +18,7 @@
end
context "when a back url is not provided" do
- include_examples "back url", "/procurement-support/energy_request"
-
- context "when feature :energy_bill_flow is not enabled" do
- before { Flipper.disable(:energy_bill_flow) }
-
- it "goes back to the start" do
- get :index
- expect(controller.view_assigns["back_url"]).to eq "/procurement-support"
- end
- end
+ include_examples "back url", "/procurement-support"
end
end
end
diff --git a/spec/controllers/framework_requests/special_requirements_controller_spec.rb b/spec/controllers/framework_requests/special_requirements_controller_spec.rb
index 8dd8578f0..0fe96a7e6 100644
--- a/spec/controllers/framework_requests/special_requirements_controller_spec.rb
+++ b/spec/controllers/framework_requests/special_requirements_controller_spec.rb
@@ -1,36 +1,120 @@
describe FrameworkRequests::SpecialRequirementsController, type: :controller do
- let(:framework_request) { create(:framework_request, is_energy_request:, energy_request_about:, have_energy_bill:) }
- let(:is_energy_request) { false }
- let(:energy_request_about) { nil }
- let(:have_energy_bill) { false }
+ let(:framework_request) { create(:framework_request, category:) }
+ let(:category) { create(:request_for_help_category) }
- it "redirects to the framework request page" do
+ it "redirects to the origin page" do
params = { framework_support_form: { special_requirements_choice: "no" } }
session = { framework_request_id: framework_request.id }
post(:create, params:, session:)
- expect(response).to redirect_to "/procurement-support/#{framework_request.id}"
+ expect(response).to redirect_to "/procurement-support/origin?#{params.to_query}"
end
describe "back url" do
- context "when the user has chosen to upload a bill" do
- let(:is_energy_request) { true }
- let(:energy_request_about) { "energy_contract" }
- let(:have_energy_bill) { true }
-
- it "goes back to the categories page" do
- get :index, session: { framework_request_id: framework_request.id }
- expect(controller.view_assigns["back_url"]).to eq "/procurement-support/categories"
+ context "when the request is in the energy flow" do
+ let(:framework_request_flow) { "energy" }
+
+ context "and about electricity" do
+ let(:category) { create(:request_for_help_category, slug: "electricity", flow: :energy) }
+
+ context "and has bills" do
+ before do
+ framework_request.update!(energy_bills: create_list(:energy_bill, 1))
+ get :index, session: { framework_request_id: framework_request.id, framework_request_flow: }
+ end
+
+ it "goes back to the bill uploads page" do
+ expect(controller.view_assigns["back_url"]).to eq "/procurement-support/bill_uploads"
+ end
+ end
+
+ context "and does not have bills" do
+ before { get :index, session: { framework_request_id: framework_request.id, framework_request_flow: } }
+
+ it "goes back to the energy alternative page" do
+ expect(controller.view_assigns["back_url"]).to eq "/procurement-support/energy_alternative"
+ end
+ end
+ end
+
+ context "and about gas" do
+ let(:category) { create(:request_for_help_category, slug: "gas", flow: :energy) }
+
+ context "and has bills" do
+ before do
+ framework_request.update!(energy_bills: create_list(:energy_bill, 1))
+ get :index, session: { framework_request_id: framework_request.id, framework_request_flow: }
+ end
+
+ it "goes back to the bill uploads page" do
+ expect(controller.view_assigns["back_url"]).to eq "/procurement-support/bill_uploads"
+ end
+ end
+
+ context "and does not have bills" do
+ before { get :index, session: { framework_request_id: framework_request.id, framework_request_flow: } }
+
+ it "goes back to the energy alternative page" do
+ expect(controller.view_assigns["back_url"]).to eq "/procurement-support/energy_alternative"
+ end
+ end
+ end
+
+ context "and about anything else" do
+ let(:category) { create(:request_for_help_category, slug: "water", flow: :energy) }
+
+ context "and has documents" do
+ before do
+ framework_request.update!(documents: create_list(:document, 1))
+ get :index, session: { framework_request_id: framework_request.id, framework_request_flow: }
+ end
+
+ it "goes back to the document uploads page" do
+ expect(controller.view_assigns["back_url"]).to eq "/procurement-support/document_uploads"
+ end
+ end
+
+ context "and does not have documents" do
+ before { get :index, session: { framework_request_id: framework_request.id, framework_request_flow: } }
+
+ it "goes back to the documents page" do
+ expect(controller.view_assigns["back_url"]).to eq "/procurement-support/documents"
+ end
+ end
end
end
- context "when the user has chosen not to upload a bill" do
- let(:is_energy_request) { false }
- let(:energy_request_about) { nil }
- let(:have_energy_bill) { false }
+ context "when the request is in the services flow" do
+ let(:framework_request_flow) { "services" }
+ let(:category) { create(:request_for_help_category, slug: "legal_services", flow: :services) }
+
+ context "and has documents" do
+ before do
+ framework_request.update!(documents: create_list(:document, 1))
+ get :index, session: { framework_request_id: framework_request.id, framework_request_flow: }
+ end
+
+ it "goes back to the document uploads page" do
+ expect(controller.view_assigns["back_url"]).to eq "/procurement-support/document_uploads"
+ end
+ end
+
+ context "and does not have documents" do
+ before { get :index, session: { framework_request_id: framework_request.id, framework_request_flow: } }
+
+ it "goes back to the documents page" do
+ expect(controller.view_assigns["back_url"]).to eq "/procurement-support/documents"
+ end
+ end
+ end
+
+ context "when the request is in any other flow" do
+ let(:framework_request_flow) { "goods" }
+ let(:category) { create(:request_for_help_category, slug: "books", flow: :goods) }
+
+ before { get :index, session: { framework_request_id: framework_request.id, framework_request_flow: } }
- it "goes back to procurement amount page" do
- get :index, session: { framework_request_id: framework_request.id }
- expect(controller.view_assigns["back_url"]).to eq "/procurement-support/procurement_amount"
+ it "goes back to the message page" do
+ expect(controller.view_assigns["back_url"]).to eq "/procurement-support/message"
end
end
end
diff --git a/spec/controllers/framework_requests/start_controller_spec.rb b/spec/controllers/framework_requests/start_controller_spec.rb
index 2bec5005a..d3eecbb9c 100644
--- a/spec/controllers/framework_requests/start_controller_spec.rb
+++ b/spec/controllers/framework_requests/start_controller_spec.rb
@@ -1,26 +1,17 @@
describe FrameworkRequests::StartController, type: :controller do
- it "redirects to the energy request page" do
- post :create
- expect(response).to redirect_to "/procurement-support/energy_request"
- end
-
- context "when feature :energy_bill_flow is not enabled" do
- before { Flipper.disable(:energy_bill_flow) }
-
- context "when user is a guest" do
- it "redirects to dfe sign in" do
- post :create
- expect(response).to redirect_to "/procurement-support/sign_in"
- end
+ context "when user is a guest" do
+ it "redirects to dfe sign in" do
+ post :create
+ expect(response).to redirect_to "/procurement-support/sign_in"
end
+ end
- context "when user is signed in" do
- before { user_is_signed_in }
+ context "when user is signed in" do
+ before { user_is_signed_in }
- it "confirms the user sign in" do
- post :create
- expect(response).to redirect_to "/procurement-support/confirm_sign_in"
- end
+ it "confirms the user sign in" do
+ post :create
+ expect(response).to redirect_to "/procurement-support/confirm_sign_in"
end
end
end
diff --git a/spec/factories/document.rb b/spec/factories/document.rb
new file mode 100644
index 000000000..9ef8992bb
--- /dev/null
+++ b/spec/factories/document.rb
@@ -0,0 +1,17 @@
+FactoryBot.define do
+ factory :document do
+ submission_status { :pending }
+ filename { "MyString" }
+ filesize { 1 }
+
+ association :framework_request, factory: :framework_request
+
+ trait :pending do
+ submission_status { :pending }
+ end
+
+ trait :submitted do
+ submission_status { :submitted }
+ end
+ end
+end
diff --git a/spec/features/specify/auth/supported_user_spec.rb b/spec/features/specify/auth/supported_user_spec.rb
index 464603c76..78296bf70 100644
--- a/spec/features/specify/auth/supported_user_spec.rb
+++ b/spec/features/specify/auth/supported_user_spec.rb
@@ -86,8 +86,6 @@
before do
visit "/procurement-support"
click_on "Start now"
- choose "No"
- click_continue
choose "Yes, use my DfE Sign-in"
click_continue
end
diff --git a/spec/features/specify/framework_requests/start_page_spec.rb b/spec/features/specify/framework_requests/start_page_spec.rb
index a0f8e612b..becd9612a 100644
--- a/spec/features/specify/framework_requests/start_page_spec.rb
+++ b/spec/features/specify/framework_requests/start_page_spec.rb
@@ -17,8 +17,6 @@
visit "/procurement-support"
click_on "Start now"
- choose "No"
- click_continue
choose "Yes, use my DfE Sign-in"
click_continue
end
diff --git a/spec/models/specify/framework_request_spec.rb b/spec/models/specify/framework_request_spec.rb
index b784dfd19..d7748e26a 100644
--- a/spec/models/specify/framework_request_spec.rb
+++ b/spec/models/specify/framework_request_spec.rb
@@ -12,66 +12,6 @@
it { is_expected.to belong_to(:user).optional }
it { is_expected.to belong_to(:category).class_name("RequestForHelpCategory").optional }
- describe "#allow_bill_upload?" do
- context "when feature :energy_bill_flow is not enabled" do
- before { Flipper.disable(:energy_bill_flow) }
-
- it "returns false" do
- framework_request = described_class.new
- expect(framework_request.allow_bill_upload?).to be(false)
- end
- end
-
- context "when it's an energy request about a contract and they have a bill to upload" do
- let(:is_energy_request) { true }
- let(:energy_request_about) { :energy_contract }
- let(:have_energy_bill) { true }
-
- it "returns true" do
- expect(framework_request.allow_bill_upload?).to eq true
- end
- end
-
- context "when it's an energy request about a contract and they have a bill in a different format" do
- let(:is_energy_request) { true }
- let(:energy_request_about) { :energy_contract }
- let(:have_energy_bill) { false }
- let(:energy_alternative) { :different_format }
-
- it "returns true" do
- expect(framework_request.allow_bill_upload?).to eq true
- end
- end
-
- context "when it's not an energy request" do
- let(:is_energy_request) { false }
-
- it "returns false" do
- expect(framework_request.allow_bill_upload?).to eq false
- end
- end
-
- context "when it's an energy request not about a contract" do
- let(:is_energy_request) { true }
- let(:energy_request_about) { :not_energy_contract }
-
- it "returns false" do
- expect(framework_request.allow_bill_upload?).to eq false
- end
- end
-
- context "when it's an energy request about a contract but they don't have a bill in a different format" do
- let(:is_energy_request) { true }
- let(:energy_request_about) { :energy_contract }
- let(:have_energy_bill) { false }
- let(:energy_alternative) { :no_bill }
-
- it "returns false" do
- expect(framework_request.allow_bill_upload?).to eq false
- end
- end
- end
-
describe "#has_bills?" do
context "when there are associated energy bills" do
before { create(:energy_bill, framework_request:) }
diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb
index a4dc10dd4..26f9cc6ca 100644
--- a/spec/rails_helper.rb
+++ b/spec/rails_helper.rb
@@ -84,7 +84,6 @@
config.before do
# Configure feature flags for test here
- Flipper.enable(:energy_bill_flow)
Flipper.enable(:email_templates)
Flipper.enable(:cms_triage_view)
Flipper.enable(:cms_panel_view)
diff --git a/spec/services/request_for_help/seed_categories_spec.rb b/spec/services/request_for_help/seed_categories_spec.rb
index 9cac9237f..503dd1f3a 100644
--- a/spec/services/request_for_help/seed_categories_spec.rb
+++ b/spec/services/request_for_help/seed_categories_spec.rb
@@ -36,4 +36,15 @@
expect(passenger_transport.support_category).to eq(support_category)
end
end
+
+ context "when a category is archived" do
+ before { service.call }
+
+ it "persists it as archived with an archive date" do
+ ict_funding = RequestForHelpCategory.find_by(title: "ICT funding")
+
+ expect(ict_funding.archived).to eq(true)
+ expect(ict_funding.archived_at).to be_within(1.second).of(Time.zone.now)
+ end
+ end
end