.header>
Listing Tasks
<:actions>
<.link patch={~p"/tasks/new"}>
<.button>New Task
<.table
id="tasks"
rows={@streams.tasks}
row_click={fn {_id, task} -> JS.navigate(~p"/tasks/#{task}") end}
>
<:col :let={{_id, task}} label="Description"><%= task.description %>
<:col :let={{_id, task}} label="Emoji"><%= task.emoji %>
<:col :let={{_id, task}} label="Completed at"><%= task.completed_at %>
<:col :let={{_id, task}} label="Phase"><%= task.phase %>
<:action :let={{_id, task}}>
<.link navigate={~p"/tasks/#{task}"}>Show
<.link patch={~p"/tasks/#{task}/edit"}>Edit
<:action :let={{id, task}}>
<.link
phx-click={JS.push("delete", value: %{id: task.id}) |> hide("##{id}")}
data-confirm="Are you sure?"
>
Delete
<.modal :if={@live_action in [:new, :edit]} id="task-modal" show on_cancel={JS.patch(~p"/tasks")}>
<.live_component
module={HomemanWeb.TaskLive.FormComponent}
id={@task.id || :new}
title={@page_title}
action={@live_action}
task={@task}
patch={~p"/tasks"}
/>