<% content_for :title, "Create a new organisation" %> <% content_for :before_content do %> <%= govuk_back_link(href: :back) %> <% end %> <%= form_for(@organisation, as: :organisation, html: { method: :post }) do |f| %>
<%= f.govuk_error_summary %>

<%= content_for(:title) %>

<%= f.govuk_text_field :name, label: { size: "m" }, autocomplete: "name" %> <%= f.govuk_text_field :address_line1, label: { text: "Address line 1", size: "m" }, autocomplete: "address-line1" %> <%= f.govuk_text_field :address_line2, label: { text: "Address line 2", size: "m" }, autocomplete: "address-line2" %> <%= f.govuk_text_field :postcode, label: { size: "m" }, autocomplete: "postal-code", width: 10 %> <%= f.govuk_phone_field :phone, label: { text: "Telephone number", size: "m" }, autocomplete: "tel", width: 20 %> <%= f.govuk_text_field :housing_registration_no, label: { text: "Regulator of Social Housing registration number", size: "m" }, width: 10 %> <% null_option = [OpenStruct.new(id: "", name: "Select an option")] %> <% types = Organisation::PROVIDER_TYPE.map { |key, _val| OpenStruct.new(id: key, name: Organisation::DISPLAY_PROVIDER_TYPE[key]) } %> <% type_answer_options = null_option + types %> <%= f.govuk_collection_select :provider_type, type_answer_options, :id, :name, label: { text: "Organisation type", size: "m" }, options: { disabled: [""], selected: @organisation.provider_type || "" } %> <%= f.govuk_collection_radio_buttons :holds_own_stock, [OpenStruct.new(id: true, name: "Yes"), OpenStruct.new(id: false, name: "No")], :id, :name, legend: { text: "Does the organisation hold its own stock?", size: "m" } %> <%= f.govuk_check_boxes_fieldset :rent_periods, legend: { text: "What are the rent periods for the organisation?" } do %> <% @rent_periods.map do |key, period| %> <%= f.govuk_check_box :rent_periods, key, label: { text: period["value"] }, checked: period[:checked] %> <% end %> <% end %> <%= f.govuk_submit "Create organisation" %>
<% end %>