{% block main_sections %}
<div class="container border-top-0" style="page-break-after: always;">
  {% set title = "&#8721;&#8709; / " ~ t('reports.pacp.main_sections') ~ " / " ~ t('reports.pacp.inspection') ~ ": " ~ " " ~ (inspection.header.location.pipe_segment_reference if inspection.header.location.pipe_segment_reference else "") %}
  {% include "nassco/pacp/es/page_title.html" %}
  {% include "nassco/pacp/es/table_header_row.html" %}
  <table class="w-full mt-1" style="border-collapse: collapse; width: 100%;">
    <thead>
      <tr>
        <th class="text-center font-extra-small box border-bottom-0 border-left-0" style="width: 5%; padding: 8px; border: 1px solid #000;">{{ t('labels.no') }}</th>
        <th class="text-center font-extra-small box flex-2 border-bottom-0 border-left-0" style="padding: 8px; border: 1px solid #000;">{{ t('labels.upstream_mh') }}</th>
        <th class="text-center font-extra-small box flex-2 border-bottom-0 border-left-0" style="padding: 8px; border: 1px solid #000;">{{ t('labels.downstream_mh') }}</th>
        <th class="text-center font-extra-small box flex-1 border-bottom-0 border-left-0" style="padding: 8px; border: 1px solid #000;">{{ t('labels.date') }}</th>
        <th class="text-center font-extra-small box flex-2 border-bottom-0 border-left-0" style="padding: 8px; border: 1px solid #000;">{{ t('labels.road') }}</th>
        <th class="text-center font-extra-small box flex-1 border-bottom-0 border-left-0" style="padding: 8px; border: 1px solid #000;">{{ t('labels.material') }}</th>
        <th class="text-center font-extra-small box flex-2 border-bottom-0 border-left-0" style="padding: 8px; border: 1px solid #000;">{{ t('labels.sip_length') }}</th>
        <th class="text-center font-extra-small box flex-2 border-bottom-0 border-left-0" style="padding: 8px; border: 1px solid #000;">{{ t('labels.cctv_length') }}</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td class="text-center font-extra-small box h-1 border-left-0" style="width: 5%; padding: 8px; border: 1px solid #000;">1</td>
        <td class="text-center font-extra-small box h-1 flex-2 border-left-0" style="padding: 8px; border: 1px solid #000;">
          {% if inspection.header.measurements.upstream_mh_number %}
          {{ inspection.header.measurements.upstream_mh_number }}
          {% endif %}
        </td>
        <td class="text-center font-extra-small box h-1 flex-2 border-left-0" style="padding: 8px; border: 1px solid #000;">
          {% if inspection.header.measurements.downstream_mh_number %}
          {{ inspection.header.measurements.downstream_mh_number }}
          {% endif %}
        </td>
        <td class="text-center font-extra-small box h-1 flex-1 border-left-0" style="padding: 8px; border: 1px solid #000;">
          {% if inspection.header.survey.survey_date %}
          {{ inspection.header.survey.survey_date.strftime("%Y/%m/%d") }}
          {% endif %}
        </td>
        <td class="text-center font-extra-small box h-1 flex-2 border-left-0" style="padding: 8px; border: 1px solid #000;">
          {% if inspection.header.location.street %}
          {{ inspection.header.location.street }}
          {% endif %}
        </td>
        <td class="text-center font-extra-small box h-1 flex-1 border-left-0" style="padding: 8px; border: 1px solid #000;">
          {% if inspection.header.pipe.material %}
          {{ inspection.header.pipe.material.label }}
          {% endif %}
        </td>
        <td class="text-center font-extra-small box h-1 flex-2 border-left-0" style="padding: 8px; border: 1px solid #000;">
          {% if inspection.header.pipe.length_surveyed %}
          {{ inspection.header.pipe.length_surveyed|string|replace('.', ',') }} {{ measurement_units }}
          {% endif %}
        </td>
        <td class="text-center font-extra-small box h-1 flex-2 border-left-0" style="padding: 8px; border: 1px solid #000;">
          {% if inspection.header.pipe.total_length %}
          {{ inspection.header.pipe.total_length|string|replace('.', ',') }} {{ measurement_units }}
          {% endif %}
        </td>
      </tr>
    </tbody>
  </table>
  
  <div class="row font-small box h-1 w-full border-top-0 border-left-0 border-right-0" style="color: red; font-weight: bold; padding: 8px; border: 1px solid #000;">
    <p class="text-center mx-auto">{{ t('labels.diameter') }} {% if inspection.header.pipe.height %}{{ (inspection.header.pipe.height|int if inspection.header.pipe.height|int == inspection.header.pipe.height else inspection.header.pipe.height)|string|replace('.', ',') }} {{ pipe_size_units }}{% endif %}</p>
  </div>
  <div class="row font-small box h-1 w-full mt-2 border-left-0 border-right-0" style="color: red; font-weight: bold; padding: 8px; border: 1px solid #000;">
    <p class="text-center mx-auto">{{ t('labels.cctv_length') }} {% if inspection.header.pipe.total_length %}{{ inspection.header.pipe.total_length|string|replace('.', ',') }} {{ measurement_units }}{% endif %}</p>
  </div>
</div>
{% endblock %}
