diff --git a/lib/putzplan_web/live/task_live/index.ex b/lib/putzplan_web/live/task_live/index.ex index 6ea1d09..418a1f1 100644 --- a/lib/putzplan_web/live/task_live/index.ex +++ b/lib/putzplan_web/live/task_live/index.ex @@ -13,77 +13,92 @@ defmodule PutzplanWeb.TaskLive.Index do - <.table - id="tasks" - rows={@streams.tasks} - row_click={fn {_id, task} -> JS.navigate(~p"/tasks/#{task}") end} - > - <:col :let={{id, task}}> - <.link phx-click={JS.push("complete", value: %{id: task.id})}> - - - - - +
+ <%= for {id, task} <- @streams.tasks do %> +
+
+
{task.description}
+
+ <.link + phx-click={JS.push("complete", value: %{id: task.id})} + class="text-green-600 hover:text-green-800 p-1 rounded-full hover:bg-green-100" + > + + + + +
+
- <:col :let={{_id, task}} label="Description">{task.description} +
+
Due
+
{format_date(task.due)}
+
- <:col :let={{_id, task}} label="Due">{format_date(task.due)} +
+
+ <.link navigate={~p"/tasks/#{task}"}>Show +
- <:action :let={{_id, task}}> -
- <.link navigate={~p"/tasks/#{task}"}>Show +
+ <.link + patch={~p"/tasks/#{task}/edit"} + class="text-blue-600 hover:text-blue-800 p-1 rounded-full hover:bg-blue-100" + phx-click-stop-propagation="true" + > + + + + + + <.link + phx-click={JS.push("delete", value: %{id: task.id}) |> hide("#task-#{id}")} + data-confirm="Are you sure?" + class="text-red-600 hover:text-red-800 p-1 rounded-full hover:bg-red-100" + phx-click-stop-propagation="true" + > + + + + +
+
- - - <:col :let={{id, task}}> - <.link patch={~p"/tasks/#{task}/edit"}> - - - - - - - <:col :let={{id, task}}> - <.link - phx-click={JS.push("delete", value: %{id: task.id}) |> hide("##{id}")} - data-confirm="Are you sure?" - > - - - - - - + <% end %> +
<.modal :if={@live_action in [:new, :edit]} id="task-modal" show on_cancel={JS.patch(~p"/tasks")}> <.live_component