Show grouped reciprocal QSOs on main listing, not just search
This commit is contained in:
parent
341a04190a
commit
b9aac6f688
1 changed files with 63 additions and 84 deletions
|
|
@ -95,93 +95,72 @@ defmodule MicrowavepropWeb.QsoLive.Index do
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<%= if @search != "" do %>
|
<table class="table table-sm w-full">
|
||||||
<table class="table table-sm w-full">
|
<thead>
|
||||||
<thead>
|
<tr>
|
||||||
<tr>
|
<th class="w-8"></th>
|
||||||
<th class="w-8"></th>
|
<th>Station 1</th>
|
||||||
<th>Station 1</th>
|
<th>Grid 1</th>
|
||||||
<th>Grid 1</th>
|
<th>Station 2</th>
|
||||||
<th>Station 2</th>
|
<th>Grid 2</th>
|
||||||
<th>Grid 2</th>
|
<th>Band</th>
|
||||||
<th>Band</th>
|
<th>Mode</th>
|
||||||
<th>Mode</th>
|
<th>Distance (km)</th>
|
||||||
<th>Distance (km)</th>
|
<th>Submitted</th>
|
||||||
<th>Timestamp</th>
|
<th>Timestamp</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<%= for {primary, reciprocals} <- @grouped_qsos do %>
|
||||||
|
<tr class="h-1">
|
||||||
|
<td colspan="10"></td>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
<tr
|
||||||
<tbody>
|
class={[
|
||||||
<%= for {primary, reciprocals} <- @grouped_qsos do %>
|
"hover:bg-base-200 cursor-pointer",
|
||||||
<%!-- Spacer row between groups --%>
|
reciprocals != [] && "bg-primary/5"
|
||||||
<tr class="h-2">
|
]}
|
||||||
<td colspan="9"></td>
|
phx-click={JS.navigate(~p"/qsos/#{primary.id}")}
|
||||||
</tr>
|
>
|
||||||
<tr
|
<td class="w-8 text-center">
|
||||||
class={[
|
<span
|
||||||
"hover:bg-base-200 cursor-pointer",
|
:if={reciprocals != []}
|
||||||
reciprocals != [] && "bg-primary/5"
|
class="badge badge-primary badge-xs"
|
||||||
]}
|
title="Has reciprocal QSO"
|
||||||
phx-click={JS.navigate(~p"/qsos/#{primary.id}")}
|
|
||||||
>
|
|
||||||
<td class="w-8 text-center">
|
|
||||||
<span
|
|
||||||
:if={reciprocals != []}
|
|
||||||
class="badge badge-primary badge-xs"
|
|
||||||
title="Has reciprocal QSO"
|
|
||||||
>
|
|
||||||
{length(reciprocals) + 1}
|
|
||||||
</span>
|
|
||||||
</td>
|
|
||||||
<td class="font-mono font-semibold">{primary.station1}</td>
|
|
||||||
<td>{primary.grid1 || "—"}</td>
|
|
||||||
<td class="font-mono font-semibold">{primary.station2}</td>
|
|
||||||
<td>{primary.grid2 || "—"}</td>
|
|
||||||
<td>{primary.band}</td>
|
|
||||||
<td>{primary.mode}</td>
|
|
||||||
<td>{primary.distance_km}</td>
|
|
||||||
<td>{Calendar.strftime(primary.qso_timestamp, "%Y-%m-%d %H:%M")}</td>
|
|
||||||
</tr>
|
|
||||||
<%= for recip <- reciprocals do %>
|
|
||||||
<tr
|
|
||||||
class="hover:bg-base-200 cursor-pointer bg-primary/5 opacity-70 border-t-0"
|
|
||||||
phx-click={JS.navigate(~p"/qsos/#{recip.id}")}
|
|
||||||
>
|
>
|
||||||
<td class="w-8 text-center text-primary">↳</td>
|
{length(reciprocals) + 1}
|
||||||
<td class="font-mono">{recip.station1}</td>
|
</span>
|
||||||
<td>{recip.grid1 || "—"}</td>
|
</td>
|
||||||
<td class="font-mono">{recip.station2}</td>
|
<td class="font-mono font-semibold">{primary.station1}</td>
|
||||||
<td>{recip.grid2 || "—"}</td>
|
<td>{primary.grid1 || "—"}</td>
|
||||||
<td>{recip.band}</td>
|
<td class="font-mono font-semibold">{primary.station2}</td>
|
||||||
<td>{recip.mode}</td>
|
<td>{primary.grid2 || "—"}</td>
|
||||||
<td>{recip.distance_km}</td>
|
<td>{primary.band}</td>
|
||||||
<td>{Calendar.strftime(recip.qso_timestamp, "%Y-%m-%d %H:%M")}</td>
|
<td>{primary.mode}</td>
|
||||||
</tr>
|
<td>{primary.distance_km}</td>
|
||||||
<% end %>
|
<td>{if primary.user_submitted, do: "Yes", else: "—"}</td>
|
||||||
|
<td>{Calendar.strftime(primary.qso_timestamp, "%Y-%m-%d %H:%M")}</td>
|
||||||
|
</tr>
|
||||||
|
<%= for recip <- reciprocals do %>
|
||||||
|
<tr
|
||||||
|
class="hover:bg-base-200 cursor-pointer bg-primary/5 opacity-70 border-t-0"
|
||||||
|
phx-click={JS.navigate(~p"/qsos/#{recip.id}")}
|
||||||
|
>
|
||||||
|
<td class="w-8 text-center text-primary">↳</td>
|
||||||
|
<td class="font-mono">{recip.station1}</td>
|
||||||
|
<td>{recip.grid1 || "—"}</td>
|
||||||
|
<td class="font-mono">{recip.station2}</td>
|
||||||
|
<td>{recip.grid2 || "—"}</td>
|
||||||
|
<td>{recip.band}</td>
|
||||||
|
<td>{recip.mode}</td>
|
||||||
|
<td>{recip.distance_km}</td>
|
||||||
|
<td>{if recip.user_submitted, do: "Yes", else: "—"}</td>
|
||||||
|
<td>{Calendar.strftime(recip.qso_timestamp, "%Y-%m-%d %H:%M")}</td>
|
||||||
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
</tbody>
|
<% end %>
|
||||||
</table>
|
</tbody>
|
||||||
<% else %>
|
</table>
|
||||||
<.table
|
|
||||||
id="qsos"
|
|
||||||
rows={@qsos}
|
|
||||||
row_id={fn qso -> "qso-#{qso.id}" end}
|
|
||||||
row_click={fn qso -> JS.navigate(~p"/qsos/#{qso.id}") end}
|
|
||||||
sort_by={@sort_by}
|
|
||||||
sort_order={@sort_order}
|
|
||||||
>
|
|
||||||
<:col :let={qso} label="Station 1" sort_field="station1">{qso.station1}</:col>
|
|
||||||
<:col :let={qso} label="Grid 1">{qso.grid1 || "—"}</:col>
|
|
||||||
<:col :let={qso} label="Station 2" sort_field="station2">{qso.station2}</:col>
|
|
||||||
<:col :let={qso} label="Grid 2">{qso.grid2 || "—"}</:col>
|
|
||||||
<:col :let={qso} label="Band" sort_field="band">{qso.band}</:col>
|
|
||||||
<:col :let={qso} label="Mode" sort_field="mode">{qso.mode}</:col>
|
|
||||||
<:col :let={qso} label="Distance (km)" sort_field="distance_km">{qso.distance_km}</:col>
|
|
||||||
<:col :let={qso} label="Submitted">{if qso.user_submitted, do: "Yes", else: "—"}</:col>
|
|
||||||
<:col :let={qso} label="Timestamp" sort_field="qso_timestamp">
|
|
||||||
{Calendar.strftime(qso.qso_timestamp, "%Y-%m-%d %H:%M")}
|
|
||||||
</:col>
|
|
||||||
</.table>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<div class="flex items-center justify-between pt-4">
|
<div class="flex items-center justify-between pt-4">
|
||||||
<.link
|
<.link
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue