|
|
@@ -54,6 +54,7 @@ defmodule VaccinsWeb.LocationComponent do
|
|
|
<%= cond do %>
|
|
|
<%= @loading -> %>...
|
|
|
<%= not has_slots?(assigns) -> %>Pas de créneau
|
|
|
+ <%= has_early_slots?(assigns) -> %><span class="alert-danger">Des dispos sous 24h !</span>
|
|
|
<%= has_slots?(assigns) -> %>Des dispos !
|
|
|
<% end %>
|
|
|
</dd>
|
|
|
@@ -101,6 +102,9 @@ defmodule VaccinsWeb.LocationComponent do
|
|
|
defp has_slots?(assigns = %{slots_before: before, slots_after: after_}),
|
|
|
do: not (before |> Enum.empty?() and after_ |> Enum.empty?())
|
|
|
|
|
|
+ defp has_early_slots?(assigns = %{slots_before: before}),
|
|
|
+ do: not (before |> Enum.empty?())
|
|
|
+
|
|
|
defp trigger_and_signal_query(location, id) do
|
|
|
ref = Search.async_trigger_query(location)
|
|
|
send(self(), {:query_sent, id, ref})
|
|
|
@@ -115,7 +119,7 @@ defmodule VaccinsWeb.LocationComponent do
|
|
|
defp signal_availabilities(socket = %{assigns: %{loading: false, slots_after: slots_after}}) do
|
|
|
cond do
|
|
|
socket.assigns |> has_slots? ->
|
|
|
- send(self(), {:location_has_slots, socket.assigns.id, not (slots_after |> Enum.empty?())})
|
|
|
+ send(self(), {:location_has_slots, socket.assigns.id, socket.assigns |> has_early_slots?})
|
|
|
|
|
|
true ->
|
|
|
send(self(), {:location_no_more_slots, socket.assigns.id})
|