From fbc913088678cde53a3c045f5b3e60159f3e88f0 Mon Sep 17 00:00:00 2001
From: Manny Dinssa <44172848+Dinssa@users.noreply.github.com>
Date: Wed, 5 Mar 2025 17:51:29 +0000
Subject: [PATCH] Add to org edit page for support users

---
 app/views/organisations/edit.html.erb | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/app/views/organisations/edit.html.erb b/app/views/organisations/edit.html.erb
index b0bd05bf6..34bec62e9 100644
--- a/app/views/organisations/edit.html.erb
+++ b/app/views/organisations/edit.html.erb
@@ -33,6 +33,33 @@
         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,
+                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.group || "" },
+                "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 %>