covid-formity/templates/faceshieldrequest_list.html

53 lines
2.1 KiB
HTML

{% extends 'admin/model/list.html' %}
{% block list_row_actions %}
{{ super() }}
<a href="{{ url_for('map.index_view', id=row.id) }}" class="icon" title="Show on map"><span class="glyphicon glyphicon-map-marker"></span></a>
<a href="{{ url_for('faceshieldrequest.label', id=row.id) }}" class="icon" title="Render package label"><span class="glyphicon glyphicon-print"></span></a>
<a class="icon" role="button" data-toggle="popover" data-html="true" data-content="<b>Extras:</b><br />{{ row.extra or '' }}<hr><b>Remarks:</b><br />{{ row.remarks or '' }}"><span class="glyphicon glyphicon-comment"></span></a>
{% if row.shipping_id %}
{% set color = {
'new': '#337ab7',
'booked': '#820990',
'collected': 'orange',
'inDelivery': 'orange',
'delivered': 'green',
'returned': 'red',
}.get(row.shipment_status.name, 'black') %}
<a class="icon" data-target="#fa_modal_window" title="View tracking ({{ row.shipment_status.name }})" href="{{ url_for('faceshieldrequest.tracking', id=row.id) }}" data-toggle="modal">
<span class="fa fa-eye glyphicon glyphicon-plane" style="color:{{color}}"></span>
</a>
{% endif %}
{% endblock %}
{% block head_css %}{{ super() }}
<style>
.popover { max-width: 400px; }
table > tbody > tr > td.list-buttons-column { padding: 0 6px; }
td.list-buttons-column .icon { display: inline-block; padding: 8px 3px; width: 1.5em; }
.model-list a.icon:first-child { margin-left: 3px; }
</style>
{% endblock %}
{% block tail_js %}{{ super() }}
<script>
$(function () {
$('[data-toggle="popover"]').popover({ trigger: "hover click" })
})
</script>
{% endblock %}
{% macro render_items(model, column) %}
<table class="table" style="margin: 0">
{% for item in model.items %}
{% set color = {
'faceshield_full': 'primary',
'faceshield_front': 'info',
}.get(item.type, 'warning') %}
<tr>
<td><span class="label label-{{ color }}">{{ item.type }}</span></td>
<td class="text-primary">{{ item.required }}</td>
<td class="text-success">{{ item.delivered }}</td>
</tr>
{% endfor %}
</table>
{% endmacro %}