{% extends 'mobile/mobile_base.html' %} {% load static %} {% load i18n %} {% load stock_custom_filters %} {% load short_name %} {% block title %}{% translate "Bon de Préparation" %} #{{ preparation_order.order_number }}{% endblock title %} {% block upleft %} {% endblock upleft %} {% block extra_head %} {% endblock extra_head %} {% block content %}
#{{ preparation_order.order_number }}
{{ preparation_order.date|date:"d/m/Y H:i" }}
{% if is_reopened %} {% translate "Réouvert" %} {% else %} {{ preparation_order.get_status_display }} {% endif %} {{ preparation_order.get_priority_display }}
{% if is_reopened %} {% endif %} {% if preparation_order.intervention %}
{% translate "Intervention liée" %}
{% translate "Numéro" %} #{{ preparation_order.intervention.id }}
{% if preparation_order.intervention.title or preparation_order.intervention.description %}
{% translate "Titre" %} {{ preparation_order.intervention.title|default:preparation_order.intervention.description|truncatewords:12 }}
{% endif %} {% if preparation_order.intervention.intervention_manager %}
{% translate "Gestionnaire" %} {{ preparation_order.intervention.intervention_manager|short_name|default:preparation_order.intervention.intervention_manager.username }}
{% endif %}
{% endif %} {% if preparation_order.is_loan %}
{% translate "Suivi du prêt de matériel" %}
{% translate "Statut" %} {% if preparation_order.loan_returned %} {% translate "Retourné" %} {% else %} {% if preparation_order.is_overdue %} {% translate "En retard" %} {% else %} {% translate "En cours" %} {% endif %} {% endif %}
{% translate "Retour attendu" %} {{ preparation_order.estimated_return_date|date:"d/m/Y"|default:"-" }}
{% if can_manage %}
{% csrf_token %} {% if preparation_order.loan_returned %} {% else %} {% endif %}
{% endif %}
{% elif can_manage %}
{% translate "Pas un prêt actuellement." %}
{% endif %} {% if exit_batches or return_batches %}
{% translate "Mouvements de stock liés" %}
{% if exit_batches %}
{% translate "Sortie(s)" %}
{% for batch in exit_batches %} Lot #{{ batch.pk }} — {{ batch.date|date:"d/m/Y" }} {% endfor %}
{% endif %} {% if return_batches %}
{% translate "Retour(s)" %}
{% for batch in return_batches %} Lot #{{ batch.pk }} — {{ batch.date|date:"d/m/Y" }} {% endfor %}
{% endif %}
{% endif %} {% if preparation_order.qr_code %}
{% translate "QR Code" %}
QR Code {{ preparation_order.order_number }}

{{ preparation_order.order_number }}

{% endif %} {% if items_with_stock %}
{% translate "Produits demandés" %} {{ items_with_stock|length }}
{% for item_data in items_with_stock %}
{{ item_data.item.product.name }}
{% if item_data.item.quantity > 0 %} {{ item_data.item.quantity }} {{ item_data.item.product.unit }} {% else %} {% translate "Ajouté" %} {% endif %}
{{ item_data.item.product.code }} {% if item_data.item.product.category %}  · {{ item_data.item.product.category.name_fr }} {% endif %}
{% if preparation_order.status == 'to_process' or preparation_order.status == 'pending' %}
{% translate "Réservé" %}: {{ item_data.reserved_stock }} {% translate "Dispo" %}: {{ item_data.available_stock }}
{% if not item_data.is_sufficient %}
{% translate "Stock insuffisant" %}
{% endif %} {% if item_data.locations %}
{% for stock in item_data.locations %}
{{ stock.location.warehouse.name }} — {{ stock.location.name }}
{% endfor %}
{% endif %} {% endif %} {% if has_executed_outputs %}
{% if item_data.executed_qty > 0 %} {% if item_data.delta > 0 %} +{{ item_data.delta }} {{ item_data.item.product.unit }} {% translate "à prélever" %} ({% translate "Sorti" %}: {{ item_data.executed_qty }}) {% elif item_data.delta < 0 %} {{ item_data.delta }} {{ item_data.item.product.unit }} {% translate "à restituer" %} ({% translate "Sorti" %}: {{ item_data.executed_qty }}) {% else %} {% translate "Inchangé" %} ({{ item_data.executed_qty }}) {% endif %} {% else %} {{ item_data.item.quantity }} {{ item_data.item.product.unit }} {% translate "à prélever" %} {% endif %}
{% endif %}
{% translate "Préparé" %}
{% if item_data.production_order %}
{{ item_data.production_order.code }} {{ item_data.production_order.get_status_display }}
{% elif can_manage and preparation_order.status != 'processed' and preparation_order.status != 'cancelled' %}
{% translate "Créer un bon de confection" %}
{% endif %}
{% endfor %} {% endif %} {% if other_items %}
{% translate "Autres produits demandés" %} {{ other_items|length }}
{% for oi_data in other_items %}
{{ oi_data.item.description }}
{{ oi_data.item.quantity }}
{% if oi_data.item.category %} {{ oi_data.item.category.name_fr }} {% endif %} {% if oi_data.item.sign_panel_type %}  {{ oi_data.item.sign_panel_type.code }} {{ oi_data.item.sign_panel_type.name_fr }} {% endif %}
{% if oi_data.production_order %}
{{ oi_data.production_order.code }} {{ oi_data.production_order.get_status_display }}
{% elif can_manage and preparation_order.status != 'processed' and preparation_order.status != 'cancelled' %}
{% translate "Créer un bon de confection" %}
{% endif %}
{% translate "Préparé" %}
{% endfor %} {% endif %} {% if deleted_items_to_return %}
{% translate "Articles supprimés (restitution au stock)" %} {{ deleted_items_to_return|length }}
{% for del in deleted_items_to_return %}
{{ del.product.name }}
+{{ del.executed_qty }} {{ del.product.unit }} {% translate "à restituer" %}
{{ del.product.code }}  ·  {{ del.location_info }}
{% if del.item %}
{% translate "Restitué / Préparé" %}
{% endif %}
{% endfor %} {% endif %} {% if not items_with_stock and not other_items and not deleted_items_to_return %}
{% translate "Aucun article dans ce bon." %}
{% endif %} {% if can_manage %}
{% if preparation_order.status == 'to_process' or preparation_order.status == 'pending' %} {% if can_manage_purchase %} {% translate "Créer un bon de commande" %} {% else %} {% endif %} {% if can_cancel %} {% endif %} {% endif %}
{% endif %} {% if can_cancel and preparation_order.status in 'to_process,pending' %} {% endif %}
{% translate "Documents joints" %} {{ preparation_order.documents.count }}
{% for doc in preparation_order.documents.all %} {% private_file_url doc 'file' as doc_url %}
{% if doc.is_image %} {% else %}{% endif %} {{ doc.filename }} {{ doc.uploaded_at|date:"d/m/Y H:i" }}
{% empty %}

{% translate "Aucun document joint." %}

{% endfor %}
{% csrf_token %}

{% translate "Glissez-déposez ou" %}

{% endblock content %}