~ihabunek/triglav

ref: 3a62b8feb3be418cf9f3fb176ac6c84a36e66a2f triglav/lib/triglav_web/templates/zet/routes/match.html.eex -rw-r--r-- 2.0 KiB
3a62b8feIvan Habunek Validate tags on platforms 7 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<main role="main" class="container-wide">
  <ul class="breadcrumbs">
    <li><a href="<%= Routes.zet_routes_path(@conn, :index) %>">Rotues</a></li>
    <li><a href="<%= Routes.zet_routes_path(@conn, :detail, @route_id) %>">#<%= @route_id %></a></li>
    <li>Match relation #<%= @relation.id %></li>
  </ul>

  <h1>Find a matching trip for relation #<%= @relation.id %></h1>

  <p>Compares platforms defined in the OSM relation with ZET GTFS trips.</p>
  <p>The relation is compared to each distinct trip. Diffs with more elements in common are shown on top.</p>

  <%= osm_link(@relation, tags: ["type"], name: true, josm: true) %>

  <hr style="margin: 1rem 0" />

  <%= for {row, index} <- Enum.with_index(@diffs) do %>
    <h3>
      Option #<%= index + 1%>,
      <%= row.trip.trip_count %> departures
    </h3>
    <table>
      <thead>
        <tr>
          <th colspan="2">OSM platforms</th>
          <th colspan="2">GTFS stops</th>
        </tr>
      </thead>
      <tbody>
      <%= for {op, ids} <- row.diffs do %>
        <%= for id <- ids do %>
          <% platform = Map.get(@platforms, id) %>
          <% platform_name = if platform, do: platform.tags["name"], else: "Missing GTFS Stop ID" %>
          <% stop = Map.get(@stops, id) %>
          <tr>
            <%= if op == :eq do %>
              <td><%= id %></td>
              <td><%= platform_name %></td>
              <td><%= id %></td>
              <td><%= stop.name %></td>
            <% end %>

            <%= if op == :ins do %>
              <td></td>
              <td></td>
              <td class="success"><%= id %></td>
              <td class="success"><%= stop.name %></td>
            <% end %>

            <%= if op == :del do %>
              <td class="error"><%= id || "???" %></td>
              <td class="error"><%= platform_name %></td>
              <td></td>
              <td></td>
            <% end %>
          </tr>
        <% end %>
      <% end %>
      </tbody>
    </table>
  <% end %>
</main>