Browse Source
* Add needstype to lettings bulk upload model * Add needstype question for 2022/23 bulk uploads * New line * Add more info to prepare your filepull/1096/head
kosiakkatrina
2 years ago
committed by
GitHub
13 changed files with 127 additions and 7 deletions
@ -0,0 +1,38 @@ |
|||||||
|
module Forms |
||||||
|
module BulkUploadLettings |
||||||
|
class Needstype |
||||||
|
include ActiveModel::Model |
||||||
|
include ActiveModel::Attributes |
||||||
|
include Rails.application.routes.url_helpers |
||||||
|
|
||||||
|
attribute :needstype, :integer |
||||||
|
attribute :year, :integer |
||||||
|
|
||||||
|
validates :needstype, presence: true |
||||||
|
|
||||||
|
def view_path |
||||||
|
"bulk_upload_lettings_logs/forms/needstype" |
||||||
|
end |
||||||
|
|
||||||
|
def options |
||||||
|
[OpenStruct.new(id: 1, name: "General needs"), OpenStruct.new(id: 2, name: "Supported housing")] |
||||||
|
end |
||||||
|
|
||||||
|
def back_path |
||||||
|
bulk_upload_lettings_log_path(id: "prepare-your-file", form: { year:, needstype: }) |
||||||
|
end |
||||||
|
|
||||||
|
def next_path |
||||||
|
bulk_upload_lettings_log_path(id: "upload-your-file", form: { year:, needstype: }) |
||||||
|
end |
||||||
|
|
||||||
|
def year_combo |
||||||
|
"#{year}/#{year + 1 - 2000}" |
||||||
|
end |
||||||
|
|
||||||
|
def save! |
||||||
|
true |
||||||
|
end |
||||||
|
end |
||||||
|
end |
||||||
|
end |
@ -0,0 +1,21 @@ |
|||||||
|
<% content_for :before_content do %> |
||||||
|
<%= govuk_back_link href: @form.back_path %> |
||||||
|
<% end %> |
||||||
|
<div class="govuk-grid-row"> |
||||||
|
<div class="govuk-grid-column-two-thirds-from-desktop"> |
||||||
|
<%= form_with model: @form, scope: :form, url: bulk_upload_lettings_log_path(id: "needstype"), method: :patch do |f| %> |
||||||
|
<%= f.govuk_error_summary %> |
||||||
|
<%= f.hidden_field :year %> |
||||||
|
|
||||||
|
<%= f.govuk_collection_radio_buttons :needstype, |
||||||
|
@form.options, |
||||||
|
:id, |
||||||
|
:name, |
||||||
|
hint: { text: I18n.t("hints.bulk_upload.needstype") }, |
||||||
|
legend: { text: "What is the needs type?", size: "l" }, |
||||||
|
caption: { text: "Upload lettings logs in bulk (#{@form.year_combo})", size: "l" } %> |
||||||
|
|
||||||
|
<%= f.govuk_submit %> |
||||||
|
<% end %> |
||||||
|
</div> |
||||||
|
</div> |
@ -0,0 +1,7 @@ |
|||||||
|
class AddNeedstypeToBulkUpload < ActiveRecord::Migration[7.0] |
||||||
|
def change |
||||||
|
change_table :bulk_uploads, bulk: true do |t| |
||||||
|
t.column :needstype, :integer |
||||||
|
end |
||||||
|
end |
||||||
|
end |
Loading…
Reference in new issue