{% extends "base.html" %} {% set active_nav = "shipments" %} {% block title %}Shipment {{ shipment.euid }}{% if revision and revision.tracking_number %} ({{ revision.tracking_number }}){% endif %} - LSMC Hub{% endblock %} {% block content %} {% macro meta_chip(label, value, extra_class='') -%} {% if value %} {{ label }}: {{ value }} {% endif %} {%- endmacro %} {% macro render_collection_tube(tube) -%}
๐Ÿงช
{{ meta_chip('Type', tube.tube_type) }} {{ meta_chip('Status', tube.status) }} {% if tube.collected_at %} {{ meta_chip('Collected', tube.collected_at | format_dt(user_preferences)) }} {% elif tube.created_at %} {{ meta_chip('Created', tube.created_at | format_dt(user_preferences)) }} {% endif %} {{ meta_chip('Collection', tube.collection_type) }} {{ meta_chip('Collector', tube.collected_by) }}
{%- endmacro %} {% macro render_test(test) -%}
๐Ÿงฌ
{{ test.euid }} {% if test.product_code or test.product_name %} {{ test.product_code or test.product_name }} {% if test.product_code and test.product_name %} ยท {{ test.product_name }}{% endif %} {% endif %}
{{ meta_chip('Status', test.status) }} {% if test.created_at %} {{ meta_chip('Created', test.created_at | format_dt(user_preferences)) }} {% endif %} {{ meta_chip('Collections', test.collection_count) }}
{% if test.collection_tubes %}
{% for tube in test.collection_tubes %} {{ render_collection_tube(tube) }} {% endfor %}
{% endif %}
{%- endmacro %} {% macro render_trf(trf) -%}
๐Ÿ“
{{ trf.euid }} {% if trf.order_number and trf.order_number != trf.euid %} Order {{ trf.order_number }} {% endif %}
{{ meta_chip('Status', trf.status) }} {% if trf.created_at %} {{ meta_chip('Created', trf.created_at | format_dt(user_preferences)) }} {% endif %} {{ meta_chip('Collections', trf.collection_count) }}
{% if trf.tests %}
{% for test in trf.tests %} {{ render_test(test) }} {% endfor %}
{% endif %}
{%- endmacro %} {% macro render_kit(kit) -%}
๐Ÿ“ฆ
{{ kit.euid }} {% if kit.display_label and kit.display_label != kit.euid %} {{ kit.display_label }} {% endif %}
{{ meta_chip('Type', kit.kit_type) }} {{ meta_chip('Collections', kit.collection_count) }} {% if kit.created_at %} {{ meta_chip('Created', kit.created_at | format_dt(user_preferences)) }} {% endif %}
{% if revision and revision.status == 'DRAFT' %}
{% endif %}
{% if kit.trfs %}
{% for trf in kit.trfs %} {{ render_trf(trf) }} {% endfor %}
{% else %}
No TRFs linked to this kit yet
{% endif %}
{%- endmacro %}

Contents

{% if revision and revision.status == 'DRAFT' and user.can_write %}
+ Add Bloom Tube
{% endif %}
{% if shipment_contents and (shipment_contents.test_kits or shipment_contents.loose_trfs or shipment_contents.direct_collection_tubes) %}

Test Kits ({{ shipment_contents.test_kits|length }})

{% if shipment_contents.test_kits %} {% for kit in shipment_contents.test_kits %} {{ render_kit(kit) }} {% endfor %} {% else %}
No test kits in this shipment
{% endif %}

TRFs ({{ shipment_contents.loose_trfs|length }})

{% if shipment_contents.loose_trfs %} {% for trf in shipment_contents.loose_trfs %} {{ render_trf(trf) }} {% endfor %} {% else %}
No loose TRFs in this shipment
{% endif %}

Collection Tubes ({{ shipment_contents.direct_collection_tubes|length }})

{% if shipment_contents.direct_collection_tubes %} {% for tube in shipment_contents.direct_collection_tubes %} {{ render_collection_tube(tube) }} {% endfor %} {% else %}
No loose collection tubes in this shipment
{% endif %}
{% else %}

No contents added yet

{% endif %}

Shipment Details

Shipment EUID
{{ shipment.euid }}
Shipment Number
{{ shipment.shipment_number }}
Carrier
{{ (revision.carrier if revision else None) or "Not specified" }}
Origin
{{ origin_site.name if origin_site else "Not specified" }}
Destination
{{ (revision.destination_address.get('name') if revision and revision.destination_address else None) or "LSMC Lab" }}
{% if revision and revision.special_instructions %}
Notes
{{ revision.special_instructions }}
{% endif %}
{% if revision and revision.status == 'DRAFT' %}

Actions

{% endif %}

๐Ÿ“„ Documents

{% if documents and documents|length > 0 %}
{% for doc in documents %}
๐Ÿ“„
{{ doc.filename }}
{{ doc.document_type or 'Document' }} โ€ข {{ doc.size_bytes|filesizeformat if doc.size_bytes else 'Unknown size' }}
{% endfor %}
{% else %}

No documents attached

{% endif %}
{% if tracking or (revision and revision.tracking_number) %}

๐Ÿ“ฆ FedEx Tracking

{% if revision and revision.tracking_number %} {% endif %}
{% if tracking %}
{{ tracking.delivery_status }}
Origin
{{ tracking.origin_city or 'โ€”' }}, {{ tracking.origin_state or 'โ€”' }}
Destination
{{ tracking.destination_city or 'โ€”' }}, {{ tracking.destination_state or 'โ€”' }}
{% if tracking.transit_time_seconds %}
Transit Time
{{ (tracking.transit_time_seconds / 3600)|round(1) }} hours
{% endif %} {% if tracking.service_description %}
Service
{{ tracking.service_description }}
{% endif %}
{% if tracking.events %}

Tracking Events

{% for event in tracking.events[:5] %}
{{ event.timestamp.strftime('%m/%d %H:%M') if event.timestamp else 'โ€”' }}
{{ event.event_description }}
{{ event.city or '' }}{% if event.city and event.state %}, {% endif %}{{ event.state or '' }}
{% endfor %}
{% endif %} {% else %}
Tracking number: {{ revision.tracking_number }}
Click "Refresh" to fetch tracking data
{% endif %}
{% endif %}
{% include "partials/tube_panel.html" %} {% endblock %}