Noah Settersten commited on
Commit ·
278333f
1
Parent(s): 3280f20
chore: Allow clearing selected code
Browse files
lib/medical_transcription_web/components/code_select.ex
CHANGED
|
@@ -49,9 +49,14 @@ defmodule MedicalTranscriptionWeb.Components.CodeSelect do
|
|
| 49 |
</div>
|
| 50 |
<% end %>
|
| 51 |
<% else %>
|
| 52 |
-
<
|
| 53 |
-
|
| 54 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
|
| 56 |
<.tag_result
|
| 57 |
code_vector_id={@selected_code.id}
|
|
@@ -79,4 +84,14 @@ defmodule MedicalTranscriptionWeb.Components.CodeSelect do
|
|
| 79 |
|
| 80 |
{:noreply, assign(socket, :selected_code, selected_code)}
|
| 81 |
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
end
|
|
|
|
| 49 |
</div>
|
| 50 |
<% end %>
|
| 51 |
<% else %>
|
| 52 |
+
<div class="flex justify-between">
|
| 53 |
+
<p class="leading-normal font-bold text-type-black-primary uppercase">
|
| 54 |
+
User-selected code
|
| 55 |
+
</p>
|
| 56 |
+
<button type="button" phx-click="clear-code" phx-target={@myself}>
|
| 57 |
+
<.icon name="hero-x-circle" />
|
| 58 |
+
</button>
|
| 59 |
+
</div>
|
| 60 |
|
| 61 |
<.tag_result
|
| 62 |
code_vector_id={@selected_code.id}
|
|
|
|
| 84 |
|
| 85 |
{:noreply, assign(socket, :selected_code, selected_code)}
|
| 86 |
end
|
| 87 |
+
|
| 88 |
+
@impl Phoenix.LiveComponent
|
| 89 |
+
def handle_event("clear-code", _params, socket) do
|
| 90 |
+
socket =
|
| 91 |
+
socket
|
| 92 |
+
|> assign(:codes, [])
|
| 93 |
+
|> assign(:selected_code, nil)
|
| 94 |
+
|
| 95 |
+
{:noreply, socket}
|
| 96 |
+
end
|
| 97 |
end
|