cable_trace.html 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. {% extends 'base/layout.html' %}
  2. {% load helpers %}
  3. {% block title %}Cable Trace for {{ object|meta:"verbose_name"|bettertitle }} {{ object }}{% endblock %}
  4. {% block content %}
  5. <div class="row">
  6. {# Cable trace SVG & options #}
  7. <div class="col col-md-5">
  8. {% if path %}
  9. <div class="text-center my-3">
  10. <object data="{{ svg_url }}" class="rack_elevation"></object>
  11. <div>
  12. <a class="btn btn-outline-primary btn-sm my-3" href="{{ svg_url }}">
  13. <i class="mdi mdi-file-download"></i> Download SVG
  14. </a>
  15. </div>
  16. </div>
  17. <div class="trace-end">
  18. {% if path.is_split %}
  19. <h3 class="text-danger">Path split!</h3>
  20. <p>Select a node below to continue:</p>
  21. <ul class="text-start">
  22. {% for next_node in path.get_split_nodes %}
  23. {% if next_node.cable %}
  24. {% with viewname=next_node|viewname:"trace" %}
  25. <li>
  26. <a href="{% url viewname pk=next_node.pk %}">{{ next_node|meta:"verbose_name"|bettertitle }} {{ next_node }}</a>
  27. (Cable {{ next_node.cable|linkify }})
  28. </li>
  29. {% endwith %}
  30. {% else %}
  31. <li class="text-muted">{{ next_node }}</li>
  32. {% endif %}
  33. {% endfor %}
  34. </ul>
  35. {% else %}
  36. <h3 class="text-center text-success">Trace Completed</h3>
  37. <table class="table">
  38. <tr>
  39. <th scope="row">Total segments</th>
  40. <td>{{ path.segment_count }}</td>
  41. </tr>
  42. <tr>
  43. <th scope="row">Total length</th>
  44. <td>
  45. {% if total_length %}
  46. {{ total_length|floatformat:"-2" }}{% if not is_definitive %}+{% endif %} Meters /
  47. {{ total_length|meters_to_feet|floatformat:"-2" }} Feet
  48. {% else %}
  49. <span class="text-muted">N/A</span>
  50. {% endif %}
  51. </td>
  52. </tr>
  53. </table>
  54. {% endif %}
  55. </div>
  56. {% else %}
  57. <h3 class="text-center text-muted my-3">
  58. No paths found
  59. </h3>
  60. {% endif %}
  61. </div>
  62. {# Related paths #}
  63. <div class="col col-md-7">
  64. <div class="card">
  65. <h5 class="card-header">
  66. Related Paths
  67. </h5>
  68. <div class="card-body">
  69. <table class="table table-hover">
  70. <thead>
  71. <tr>
  72. <th>Origin</th>
  73. <th>Destination</th>
  74. <th>Segments</th>
  75. </tr>
  76. </thead>
  77. <tbody>
  78. {% for cablepath in related_paths %}
  79. <tr{% if cablepath.pk == path.pk %} class="info"{% endif %}>
  80. <td>
  81. <a href="?cablepath_id={{ cablepath.pk }}">{{ cablepath.origins|join:", " }}</a>
  82. </td>
  83. <td>
  84. {% if cablepath.destinations %}
  85. {{ cablepath.destinations|join:", " }}
  86. {% else %}
  87. <span class="text-muted">Incomplete</span>
  88. {% endif %}
  89. </td>
  90. <td>
  91. {{ cablepath.segment_count }}
  92. </td>
  93. </tr>
  94. {% empty %}
  95. <td colspan="3" class="text-muted">
  96. None found
  97. </td>
  98. {% endfor %}
  99. </tbody>
  100. </table>
  101. </div>
  102. </div>
  103. </div>
  104. </div>
  105. {% endblock %}