cable_trace.html 5.2 KB

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