diff --git a/lib/shift73k_web/live/shift_live/form_component.ex b/lib/shift73k_web/live/shift_live/form_component.ex
deleted file mode 100644
index 7fdd917c..00000000
--- a/lib/shift73k_web/live/shift_live/form_component.ex
+++ /dev/null
@@ -1,55 +0,0 @@
-defmodule Shift73kWeb.ShiftLive.FormComponent do
- use Shift73kWeb, :live_component
-
- alias Shift73k.Shifts
-
- @impl true
- def update(%{shift: shift} = assigns, socket) do
- changeset = Shifts.change_shift(shift)
-
- {:ok,
- socket
- |> assign(assigns)
- |> assign(:changeset, changeset)}
- end
-
- @impl true
- def handle_event("validate", %{"shift" => shift_params}, socket) do
- changeset =
- socket.assigns.shift
- |> Shifts.change_shift(shift_params)
- |> Map.put(:action, :validate)
-
- {:noreply, assign(socket, :changeset, changeset)}
- end
-
- def handle_event("save", %{"shift" => shift_params}, socket) do
- save_shift(socket, socket.assigns.action, shift_params)
- end
-
- defp save_shift(socket, :edit, shift_params) do
- case Shifts.update_shift(socket.assigns.shift, shift_params) do
- {:ok, _shift} ->
- {:noreply,
- socket
- |> put_flash(:info, "Shift updated successfully")
- |> push_redirect(to: socket.assigns.return_to)}
-
- {:error, %Ecto.Changeset{} = changeset} ->
- {:noreply, assign(socket, :changeset, changeset)}
- end
- end
-
- defp save_shift(socket, :new, shift_params) do
- case Shifts.create_shift(shift_params) do
- {:ok, _shift} ->
- {:noreply,
- socket
- |> put_flash(:info, "Shift created successfully")
- |> push_redirect(to: socket.assigns.return_to)}
-
- {:error, %Ecto.Changeset{} = changeset} ->
- {:noreply, assign(socket, changeset: changeset)}
- end
- end
-end
diff --git a/lib/shift73k_web/live/shift_live/form_component.html.leex b/lib/shift73k_web/live/shift_live/form_component.html.leex
deleted file mode 100644
index 756d9abc..00000000
--- a/lib/shift73k_web/live/shift_live/form_component.html.leex
+++ /dev/null
@@ -1,42 +0,0 @@
-
<%= @title %>
-
-<%= f = form_for @changeset, "#",
- id: "shift-form",
- phx_target: @myself,
- phx_change: "validate",
- phx_submit: "save" %>
-
- <%= label f, :subject %>
- <%= text_input f, :subject %>
- <%= error_tag f, :subject %>
-
- <%= label f, :location %>
- <%= text_input f, :location %>
- <%= error_tag f, :location %>
-
- <%= label f, :description %>
- <%= textarea f, :description %>
- <%= error_tag f, :description %>
-
- <%= label f, :time_zone %>
- <%= text_input f, :time_zone %>
- <%= error_tag f, :time_zone %>
-
- <%= label f, :date %>
- <%= date_select f, :date %>
- <%= error_tag f, :date %>
-
- <%= label f, :time_zone %>
- <%= text_input f, :time_zone %>
- <%= error_tag f, :time_zone %>
-
- <%= label f, :time_start %>
- <%= time_select f, :time_start %>
- <%= error_tag f, :time_start %>
-
- <%= label f, :time_end %>
- <%= time_select f, :time_end %>
- <%= error_tag f, :time_end %>
-
- <%= submit "Save", phx_disable_with: "Saving..." %>
-
diff --git a/lib/shift73k_web/live/shift_live/index.ex b/lib/shift73k_web/live/shift_live/index.ex
index 7a03e55b..7e7c6513 100644
--- a/lib/shift73k_web/live/shift_live/index.ex
+++ b/lib/shift73k_web/live/shift_live/index.ex
@@ -11,8 +11,6 @@ defmodule Shift73kWeb.ShiftLive.Index do
socket
|> assign_defaults(session)
|> live_okreply()
-
- # {:ok, assign(socket, :shifts, list_shifts())}
end
@impl true
@@ -23,8 +21,6 @@ defmodule Shift73kWeb.ShiftLive.Index do
if Roles.can?(current_user, shift, live_action) do
socket
- # |> assign_shift_templates()
- # |> assign_modal_close_handlers()
|> init_today(Timex.today())
|> assign_date_range()
|> assign_known_shifts()
@@ -37,20 +33,6 @@ defmodule Shift73kWeb.ShiftLive.Index do
|> redirect(to: "/")
|> live_noreply()
end
-
- # {:noreply, apply_action(socket, socket.assigns.live_action, params)}
- end
-
- defp apply_action(socket, :edit, %{"id" => id}) do
- socket
- |> assign(:page_title, "Edit Shift")
- |> assign(:shift, Shifts.get_shift!(id))
- end
-
- defp apply_action(socket, :new, _params) do
- socket
- |> assign(:page_title, "New Shift")
- |> assign(:shift, %Shift{})
end
defp apply_action(socket, :index, _params) do
diff --git a/lib/shift73k_web/live/shift_live/index.html.leex b/lib/shift73k_web/live/shift_live/index.html.leex
index 6e427687..afb3a992 100644
--- a/lib/shift73k_web/live/shift_live/index.html.leex
+++ b/lib/shift73k_web/live/shift_live/index.html.leex
@@ -1,18 +1,8 @@
-<%= if @live_action in [:new, :edit] do %>
- <%= live_modal @socket, Shift73kWeb.ShiftLive.FormComponent,
- id: @shift.id || :new,
- title: @page_title,
- action: @live_action,
- shift: @shift,
- return_to: Routes.shift_index_path(@socket, :index) %>
-<% end %>
-
-
- <%= icon_div @socket, "bi-calendar2-date", [class: "icon baseline"] %>
+ <%= icon_div @socket, "bi-card-list", [class: "icon baseline"] %>
My Shifts
@@ -40,7 +30,6 @@
<%= for day <- Enum.to_list(@date_range) do %>
- <% Date.day_of_week(day, @current_user.week_start_at) |> IO.inspect(label: "day in date_range") %>
<%= if Date.day_of_week(day, @current_user.week_start_at) == 1 do %>
<% end %>
@@ -69,8 +58,6 @@
<%= shift.description %>
- <%= live_redirect "Show", to: Routes.shift_show_path(@socket, :show, shift) %>
- <%= live_patch "Edit", to: Routes.shift_index_path(@socket, :edit, shift) %>
<%= link "Delete", to: "#", phx_click: "delete", phx_value_id: shift.id, data: [confirm: "Are you sure?"] %>
@@ -80,14 +67,11 @@
<% else %>
- No shift scheduled
+ Nothing scheduled
<% end %>
<% end %>
-<%= live_patch "New Shift", to: Routes.shift_index_path(@socket, :new) %>
-
-
diff --git a/lib/shift73k_web/live/shift_live/show.ex b/lib/shift73k_web/live/shift_live/show.ex
deleted file mode 100644
index 40b3424b..00000000
--- a/lib/shift73k_web/live/shift_live/show.ex
+++ /dev/null
@@ -1,21 +0,0 @@
-defmodule Shift73kWeb.ShiftLive.Show do
- use Shift73kWeb, :live_view
-
- alias Shift73k.Shifts
-
- @impl true
- def mount(_params, _session, socket) do
- {:ok, socket}
- end
-
- @impl true
- def handle_params(%{"id" => id}, _, socket) do
- {:noreply,
- socket
- |> assign(:page_title, page_title(socket.assigns.live_action))
- |> assign(:shift, Shifts.get_shift!(id))}
- end
-
- defp page_title(:show), do: "Show Shift"
- defp page_title(:edit), do: "Edit Shift"
-end
diff --git a/lib/shift73k_web/live/shift_live/show.html.leex b/lib/shift73k_web/live/shift_live/show.html.leex
deleted file mode 100644
index c30c705f..00000000
--- a/lib/shift73k_web/live/shift_live/show.html.leex
+++ /dev/null
@@ -1,52 +0,0 @@
-Show Shift
-
-<%= if @live_action in [:edit] do %>
- <%= live_modal @socket, Shift73kWeb.ShiftLive.FormComponent,
- id: @shift.id,
- title: @page_title,
- action: @live_action,
- shift: @shift,
- return_to: Routes.shift_show_path(@socket, :show, @shift) %>
-<% end %>
-
-
-
- -
- Subject:
- <%= @shift.subject %>
-
-
- -
- Location:
- <%= @shift.location %>
-
-
- -
- Description:
- <%= @shift.description %>
-
-
- -
- Date:
- <%= @shift.date %>
-
-
- -
- Time zone:
- <%= @shift.time_zone %>
-
-
- -
- Time start:
- <%= @shift.time_start %>
-
-
- -
- Time end:
- <%= @shift.time_end %>
-
-
-
-
-<%= live_patch "Edit", to: Routes.shift_show_path(@socket, :edit, @shift), class: "button" %>
-<%= live_redirect "Back", to: Routes.shift_index_path(@socket, :index) %>
diff --git a/lib/shift73k_web/router.ex b/lib/shift73k_web/router.ex
index 13ede71b..115b8a3b 100644
--- a/lib/shift73k_web/router.ex
+++ b/lib/shift73k_web/router.ex
@@ -98,11 +98,6 @@ defmodule Shift73kWeb.Router do
live "/assign", ShiftAssignLive.Index, :index
live "/shifts", ShiftLive.Index, :index
- live "/shifts/new", ShiftLive.Index, :new
- live "/shifts/:id/edit", ShiftLive.Index, :edit
-
- live "/shifts/:id", ShiftLive.Show, :show
- live "/shifts/:id/show/edit", ShiftLive.Show, :edit
end
# scope "/", Shift73kWeb do