.header>
Listing Exams
<:actions>
<.link patch={~p"/exams/new"}>
<.button>New Exam
<.table
id="exams"
rows={@streams.exams}
row_click={fn {_id, exam} -> JS.navigate(~p"/exams/#{exam}") end}
>
<:col :let={{_id, exam}} label="Subject"><%= exam.subject %>
<:col :let={{_id, exam}} label="Date"><%= exam.date %>
<:action :let={{_id, exam}}>
<.link navigate={~p"/exams/#{exam}"}>Show
<.link patch={~p"/exams/#{exam}/edit"}>Edit
<:action :let={{id, exam}}>
<.link
phx-click={JS.push("delete", value: %{id: exam.id}) |> hide("##{id}")}
data-confirm="Are you sure?"
>
Delete
<.modal :if={@live_action in [:new, :edit]} id="exam-modal" show on_cancel={JS.patch(~p"/exams")}>
<.live_component
module={ExmrWeb.ExamLive.FormComponent}
id={@exam.id || :new}
title={@page_title}
action={@live_action}
exam={@exam}
patch={~p"/exams"}
/>