<.link navigate={~p"/maintenance"} class="inline-flex items-center gap-1 text-sm text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200" > <.icon name="hero-arrow-left" class="h-4 w-4" /> {t("Back to Maintenance Windows")}

{@page_title}

<.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 --%>
<%= if @scope_type == "site" do %> <.input field={@form[:site_id]} type="select" prompt={t("Select a site...")} options={Enum.map(@sites, &{&1.name, &1.id})} /> <% end %> <%= if @scope_type == "device" do %> <.input field={@form[:device_id]} type="select" prompt={t("Select a device...")} options={Enum.map(@devices, &{&1.name, &1.id})} /> <% end %>
<%!-- 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")}