<% content_for :title, "Change #{@organisation.name}’s details" %> <% content_for :before_content do %> <%= govuk_back_link(href: :back) %> <% end %> <%= form_for(@organisation, as: :organisation, html: { method: :patch }) do |f| %>

<%= content_for(:title) %>

<% if current_user.support? %> <%= f.govuk_text_field :name, autocomplete: "name", label: { size: "m" } %> <% end %> <%= 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 %> <% if current_user.support? %> <%= f.govuk_radio_buttons_fieldset :group_member, legend: { text: "Is this organisation part of a housing provider group structure?", size: "m" } do %> <%= f.govuk_radio_button :group_member, true, label: { text: "Yes" }, "data-controller": "conditional-question", "data-action": "click->conditional-question#displayConditional", "data-info": { conditional_questions: { group: [true] }, type: "organisation" }.to_json do %> <%= f.govuk_collection_select :group_member_id, group_organisation_options, :id, :name, label: { text: "Search for an organisation that is part of the same group as this organisation", size: "m" }, options: { disabled: [""], selected: @organisation.oldest_group_member&.id || "" }, "data-controller": %w[accessible-autocomplete conditional-filter] %> <% end %> <%= f.govuk_radio_button :group_member, false, label: { text: "No" } %> <% end %> <%= f.govuk_collection_select :profit_status, profit_status_options(@organisation.provider_type), :id, :name, label: { text: "Is the organisation for profit?", size: "m" }, options: { disabled: [""], selected: @organisation.profit_status || "" } %> <% end %> <%= f.govuk_check_boxes_fieldset :rent_periods, legend: { text: "What are the rent periods for the organisation?" }, hint: { text: "It is not possible to deselect rent periods that are used in logs" } do %> <% @rent_periods.map do |key, period| %> <%= f.govuk_check_box :rent_periods, key, label: { text: period["value"] }, checked: period[:checked], disabled: @used_rent_periods.include?(key) %> <% end %> <% end %> <% @rent_periods.keys.each do |period_key| %> <%= f.hidden_field :all_rent_periods, value: period_key, multiple: true %> <% end %> <%= f.govuk_submit "Save changes" %>
<% end %>