<%= render_slot(@inner_block) %>
diff --git a/core/priv/gettext/en/LC_MESSAGES/eyra-consent.po b/core/priv/gettext/en/LC_MESSAGES/eyra-consent.po
index 09c03fdcc..fd37e1404 100644
--- a/core/priv/gettext/en/LC_MESSAGES/eyra-consent.po
+++ b/core/priv/gettext/en/LC_MESSAGES/eyra-consent.po
@@ -26,3 +26,7 @@ msgstr "Please not that this version of the consent text has already been signed
#, elixir-autogen, elixir-format
msgid "out_of_sync.error.message"
msgstr "The consent text has been changed. Please refresh the page to continue."
+
+#, elixir-autogen, elixir-format
+msgid "signature.view.title"
+msgstr "Consent"
diff --git a/core/priv/gettext/eyra-consent.pot b/core/priv/gettext/eyra-consent.pot
index 50e04738f..25fa3b7ac 100644
--- a/core/priv/gettext/eyra-consent.pot
+++ b/core/priv/gettext/eyra-consent.pot
@@ -26,3 +26,7 @@ msgstr ""
#, elixir-autogen, elixir-format
msgid "out_of_sync.error.message"
msgstr ""
+
+#, elixir-autogen, elixir-format
+msgid "signature.view.title"
+msgstr ""
diff --git a/core/priv/gettext/nl/LC_MESSAGES/eyra-consent.po b/core/priv/gettext/nl/LC_MESSAGES/eyra-consent.po
index 63267338e..ee9a6a991 100644
--- a/core/priv/gettext/nl/LC_MESSAGES/eyra-consent.po
+++ b/core/priv/gettext/nl/LC_MESSAGES/eyra-consent.po
@@ -26,3 +26,7 @@ msgstr "Deze versie van de tekst voor toestemming is al ondertekend door partici
#, elixir-autogen, elixir-format
msgid "out_of_sync.error.message"
msgstr "De toestemmingstekst is aangepast. Ververs de pagina om verder te gaan."
+
+#, elixir-autogen, elixir-format
+msgid "signature.view.title"
+msgstr "Toestemming"
diff --git a/core/systems/admin/config_page.ex b/core/systems/admin/config_page.ex
index d1cf8ac96..d376ab2ad 100644
--- a/core/systems/admin/config_page.ex
+++ b/core/systems/admin/config_page.ex
@@ -99,7 +99,7 @@ defmodule Systems.Admin.ConfigPage do
<.workspace title={dgettext("eyra-admin", "config.title")} menus={@menus}>
<%= if @popup do %>
<.popup>
-
+
<.live_component id={:config_page_popup} module={@popup.module} {@popup} />
diff --git a/core/systems/assignment/crew_page.ex b/core/systems/assignment/crew_page.ex
index a71cdf786..3cd126ab9 100644
--- a/core/systems/assignment/crew_page.ex
+++ b/core/systems/assignment/crew_page.ex
@@ -34,7 +34,8 @@ defmodule Systems.Assignment.CrewPage do
|> assign(
id: id,
model: model,
- image_info: nil
+ image_info: nil,
+ popup: nil
)
|> update_panel_info(session)
|> observe_view_model()
@@ -106,6 +107,17 @@ defmodule Systems.Assignment.CrewPage do
{:noreply, socket |> store(key, data)}
end
+ @impl true
+ def handle_event("show_popup", %{ref: %{id: id, module: module}, params: params}, socket) do
+ popup = %{module: module, params: Map.put(params, :id, id)}
+ {:noreply, socket |> assign(popup: popup)}
+ end
+
+ @impl true
+ def handle_event("hide_popup", _, socket) do
+ {:noreply, socket |> assign(popup: nil)}
+ end
+
def store(
%{assigns: %{panel_info: panel_info, model: assignment, remote_ip: remote_ip}} = socket,
key,
@@ -138,6 +150,15 @@ defmodule Systems.Assignment.CrewPage do
<% end %>
+
+ <%= if @popup do %>
+ <.popup>
+
+ <.live_component id={:page_popup} module={@popup.module} {@popup.params} />
+
+
+ <% end %>
+
<.flow fabric={@fabric} />
diff --git a/core/systems/assignment/crew_page_builder.ex b/core/systems/assignment/crew_page_builder.ex
index d681b6370..be2a5aa10 100644
--- a/core/systems/assignment/crew_page_builder.ex
+++ b/core/systems/assignment/crew_page_builder.ex
@@ -61,14 +61,35 @@ defmodule Systems.Assignment.CrewPageBuilder do
end
end
- defp work_view(assignment, %{fabric: fabric} = assigns, _) do
+ defp work_view(
+ %{consent_agreement: consent_agreement} = assignment,
+ %{fabric: fabric, current_user: user} = assigns,
+ _
+ ) do
work_items = work_items(assignment, assigns)
+ context_menu_items = context_menu_items(assignment, assigns)
Fabric.prepare_child(fabric, :work_view, Assignment.CrewWorkView, %{
- work_items: work_items
+ work_items: work_items,
+ consent_agreement: consent_agreement,
+ context_menu_items: context_menu_items,
+ user: user
})
end
+ defp context_menu_items(%{consent_agreement: consent_agreement}, _assigns) do
+ items = []
+
+ items =
+ if consent_agreement do
+ items ++ [%{id: :consent, label: "Consent"}]
+ else
+ items
+ end
+
+ items
+ end
+
defp work_items(%{status: status, crew: crew} = assignment, %{current_user: user} = assigns) do
if is_tester?(assignment, assigns) or status == :online do
member = Crew.Public.get_member(crew, user)
diff --git a/core/systems/assignment/crew_work_view.ex b/core/systems/assignment/crew_work_view.ex
index 1784d69ec..f05c599c5 100644
--- a/core/systems/assignment/crew_work_view.ex
+++ b/core/systems/assignment/crew_work_view.ex
@@ -8,18 +8,34 @@ defmodule Systems.Assignment.CrewWorkView do
Assignment,
Crew,
Workflow,
- Project
+ Project,
+ Content,
+ Consent
}
- def update(%{work_items: work_items}, socket) do
+ def update(
+ %{
+ work_items: work_items,
+ consent_agreement: consent_agreement,
+ context_menu_items: context_menu_items,
+ user: user
+ },
+ socket
+ ) do
{
:ok,
socket
- |> assign(work_items: work_items)
+ |> assign(
+ work_items: work_items,
+ consent_agreement: consent_agreement,
+ context_menu_items: context_menu_items,
+ user: user
+ )
|> update_selected_item_id()
|> update_selected_item()
|> compose_child(:work_list_view)
|> compose_child(:start_view)
+ |> compose_child(:context_menu)
|> update_child(:tool_ref_view)
}
end
@@ -62,6 +78,8 @@ defmodule Systems.Assignment.CrewWorkView do
socket |> assign(selected_item: selected_item)
end
+ # Compose
+
@impl true
def compose(:start_view, %{selected_item: selected_item}) when not is_nil(selected_item) do
%{module: Assignment.StartView, params: %{work_item: selected_item}}
@@ -95,18 +113,30 @@ defmodule Systems.Assignment.CrewWorkView do
@impl true
def compose(:tool_ref_view, _assigns), do: nil
- defp map_item({%{id: id, title: title, group: group}, task}) do
- %{id: id, title: title, icon: group, status: task_status(task)}
+ def compose(:context_menu, %{context_menu_items: []}) do
+ nil
end
- defp task_status(%{status: status}), do: status
- defp task_status(_), do: :pending
+ def compose(:context_menu, %{context_menu_items: context_menu_items}) do
+ %{
+ module: Content.ContextMenu,
+ params: %{
+ items: context_menu_items
+ }
+ }
+ end
- defp lock_task(socket, task) do
- Crew.Public.lock_task(task)
- socket
+ def compose(:consent_page, %{consent_agreement: consent_agreement, user: user}) do
+ %{
+ module: Consent.SignatureView,
+ params: %{
+ signature: Consent.Public.get_signature(consent_agreement, user)
+ }
+ }
end
+ # Events
+
@impl true
def handle_event(
"complete_task",
@@ -157,6 +187,23 @@ defmodule Systems.Assignment.CrewWorkView do
}
end
+ @impl true
+ def handle_event("show", %{page: :consent}, socket) do
+ {
+ :noreply,
+ socket
+ |> compose_child(:consent_page)
+ |> show_popup(:consent_page)
+ }
+ end
+
+ @impl true
+ def handle_event("close", %{source: %{name: :consent_page}}, socket) do
+ {:noreply, socket |> hide_popup(:consent_page)}
+ end
+
+ # Private
+
defp handle_feldspar_event(%{assigns: %{selected_item: {_, task}}} = socket, %{
"__type__" => "CommandSystemExit",
"code" => code,
@@ -188,6 +235,18 @@ defmodule Systems.Assignment.CrewWorkView do
socket |> Frameworks.Pixel.Flash.put_error("Unsupported event")
end
+ defp map_item({%{id: id, title: title, group: group}, task}) do
+ %{id: id, title: title, icon: group, status: task_status(task)}
+ end
+
+ defp task_status(%{status: status}), do: status
+ defp task_status(_), do: :pending
+
+ defp lock_task(socket, task) do
+ Crew.Public.lock_task(task)
+ socket
+ end
+
@impl true
def render(assigns) do
~H"""
@@ -216,6 +275,8 @@ defmodule Systems.Assignment.CrewWorkView do
<.child name={:start_view} fabric={@fabric} />
<% end %>
+ <%!-- floating button --%>
+ <.child name={:context_menu} fabric={@fabric} />