<.form
for={@form}
phx-change="validate"
phx-submit="save"
id="maintenance-form"
>
<%!-- Name --%>
<.input
field={@form[:name]}
type="text"
label={t("Name") <> " *"}
required
placeholder={t("e.g., Tower firmware upgrade")}
/>
<%!-- Reason --%>
<.input
field={@form[:reason]}
type="textarea"
label={t("Reason")}
rows="3"
placeholder={t("Optional description of the maintenance work")}
/>
<%!-- Scope --%>
<%!-- Time Range --%>
<.input
field={@form[:starts_at]}
type="datetime-local"
label={t("Starts At") <> " *"}
required
value={format_datetime_local(@form[:starts_at].value)}
/>
<.input
field={@form[:ends_at]}
type="datetime-local"
label={t("Ends At") <> " *"}
required
value={format_datetime_local(@form[:ends_at].value)}
/>
<%!-- Suppress Alerts --%>
<.input
field={@form[:suppress_alerts]}
type="checkbox"
label={t("Suppress alerts during this window")}
/>
<%!-- Recurring --%>
<.input
field={@form[:recurring]}
type="checkbox"
label={t("Recurring")}
/>
<%!-- Recurrence Rule --%>
<%= if Phoenix.HTML.Form.input_value(@form, :recurring) == true do %>
<.input
field={@form[:recurrence_rule]}
type="text"
label={t("Recurrence Rule")}
placeholder={t("e.g., FREQ=WEEKLY;BYDAY=SU")}
/>
<% end %>
<%!-- Submit --%>
<.link
navigate={~p"/maintenance"}
class="rounded-lg px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-800 transition-colors"
>
{t("Cancel")}
{t("Save")}