%= form_with model: [:agent_portal, @property, @reservation],
url: preview_before_commit_agent_portal_property_reservations_path(@property),
method: :post,
local: true do |f| %>
Reserve Property
Select a customer, property term, add notes, and optionally choose a bank.
<%= f.label :customer_id, "Select Customer", class: "form-label fw-semibold" %>
<%= f.select :customer_id,
options_for_select(
@customers.map do |customer|
display_name =
customer.customer_name.presence ||
customer.firstname.presence ||
"unnamed customer"
[
"#{display_name}#{customer.verified? ? '' : ' (not verified)'}",
customer.id,
{ disabled: !customer.verified? }
]
end,
f.object.customer_id
),
{ prompt: "choose customer" },
class: "form-select apple-input-lg",
data: { controller: "slim-select", "slim-select-target": "select" } %>
<%= f.label :property_term_id, "Select Property Term & View Conditions", class: "form-label fw-semibold" %>
<%= f.collection_select :property_term_id, @property_terms, :id, :tenure,
{ prompt: "Choose tenure" },
class: "form-select apple-input-lg",
data: { reservation_term_target: "term", action: "change->reservation-term#update" } %>
Deposit: -
Tenure: - months
Sale Type: -
<%= f.label :notes, "Notes (Optional)", class: "form-label fw-semibold" %>
<%= f.text_area :notes, class: "form-control apple-input-lg", rows: 4, placeholder: "Add any notes..." %>
<%= f.label :bank_id, "Select Bank (Optional)", class: "form-label fw-semibold small text-muted" %>
<%= f.collection_select :bank_id, current_onboard_client.banks, :id, :name,
{ prompt: "Choose Bank" },
class: "form-select apple-input-sm", data: { "slim-select-target": "select" } %>
<%= f.submit "Next", data: { turbo: false }, class: "btn btn-primary w-100 fw-bold apple-btn-lg" %>
<% if @reservation.persisted? %>
<%= link_to "Preview Agreement", preview_agent_portal_reservation_path(@reservation),
class: "btn btn-outline-primary fw-semibold" %>
<% end %>
<% end %>