{% extends 'layouts/authenticated.html.twig' %} {% block page_title %}{{ product.name }}{% endblock %} {% block content %} {% set stockStatus = product.getStockStatus(settings.lowStockThreshold, settings.criticalStockThreshold) %} {% set stockColors = { 'ok': 'green', 'low': 'orange', 'critical': 'red', 'out': 'gray', 'service': 'purple' } %} {% set stockLabels = { 'ok': 'En stock', 'low': 'Stock bas', 'critical': 'Critique', 'out': 'Rupture', 'service': 'Service' } %}
{# Header #}

{{ product.name }}

{% if product.isFeatured %} Mis en avant {% endif %}

SKU: {{ product.sku }} {% if product.barcode %}| {{ product.barcode }}{% endif %}

{# Informations #}

Informations

Categorie
{% if product.category %} {{ product.category.name }} {% else %} Sans categorie {% endif %}
Type
{{ product.isService ? 'Service' : 'Produit physique' }}
Unite
{{ product.unitLabel }}
{% if product.weight %}
Poids
{{ product.weight }} kg
{% endif %} {% if product.description %}
Description
{{ product.description|nl2br }}
{% endif %}
{# Prix & Marges #}

Prix & Marges

{{ settings.formatPrice(product.price) }}
Prix de vente
{{ product.costPrice ? settings.formatPrice(product.costPrice) : '—' }}
Prix d'achat
{{ product.margin ? settings.formatPrice(product.margin) : '—' }}
Marge
{{ product.marginPercent ? product.marginPercent|number_format(1) ~ '%' : '—' }}
Marge %
{# Stock & Ventes - cote a cote #}
{# Stock #}

Stock

{{ product.isService ? '∞' : product.currentStock }}
{{ stockLabels[stockStatus] }}
{% if not product.isService %}
{% if product.minStock is not null %}
Stock minimum
{{ product.minStock }}
{% endif %} {% if product.maxStock is not null %}
Stock maximum
{{ product.maxStock }}
{% endif %}
Reserve
{{ product.reservedStock }}
Disponible
{{ product.availableStock }}
{% endif %}
{# Ventes #}

Ventes

{{ product.totalSold }}
{{ product.unitLabel|lower }}s vendus
Chiffre d'affaires
{{ settings.formatPrice(product.totalRevenue) }}
Derniere vente
{{ product.lastSoldAt ? product.lastSoldAt|date('d/m/Y') : 'Jamais' }}
Derniere restock
{{ product.lastRestockedAt ? product.lastRestockedAt|date('d/m/Y') : 'Jamais' }}
{# Images produit #} {% include 'manager/pos/products/_media_gallery.html.twig' %} {# Variantes #}

Variantes ({{ product.variants|length }})

Les variantes permettent de decliner un produit selon ses caracteristiques (taille, couleur, poids, dimensions...). Chaque variante a son propre stock, code-barres et ajustement de prix.

{% if product.variants|length > 0 %} {# Table desktop #} {# Cards mobile pour variantes #}
{% for variant in product.variants %}
{{ variant.name }} {{ variant.sku }}
{% include 'components/pos/_confirm_modal.html.twig' with { modal_id: 'del-var-m-' ~ variant.id, title: 'Supprimer la variante', message: 'Supprimer la variante « ' ~ variant.name ~ ' » ?', action_url: path('manager_pos_products_delete_variant', {id: product.id, variantId: variant.id}), csrf_token_name: 'delete_variant_' ~ variant.id, } %}
{% if variant.attributesSummary %}{{ variant.attributesSummary }}{% endif %} {{ variant.priceAdjustment > 0 ? '+' : '' }}{{ variant.priceAdjustment|number_format(0, ',', ' ') }} FCFA Stock: {{ variant.currentStock }}
{% endfor %}
{% endif %} {# Formulaire ajout variante #}
Ajouter une variante

Identification

Prix & Stock

+500 = prix de base + 500

Attributs

Decrivez les caracteristiques de cette variante.

{# Actions #}

Actions

Modifier {% include 'components/pos/_confirm_modal.html.twig' with { modal_id: 'dup-product', title: 'Dupliquer le produit', message: 'Une copie de « ' ~ product.name ~ ' » sera creee avec un nouveau SKU. Confirmer ?', action_url: path('manager_pos_products_duplicate', {id: product.id}), csrf_token_name: 'duplicate_product_' ~ product.id, confirm_label: 'Dupliquer', confirm_color: 'purple', } %} {% include 'components/pos/_confirm_modal.html.twig' with { modal_id: 'del-product', title: 'Supprimer le produit', message: 'Supprimer « ' ~ product.name ~ ' » ? Cette action est irreversible.', action_url: path('manager_pos_products_delete', {id: product.id}), csrf_token_name: 'delete_product_' ~ product.id, } %}
{# Historique / Journal d'audit produit #}

Historique ({{ productHistory|length }})

{% if productHistory|length > 0 %} {% set actionColors = { 'created': 'emerald', 'updated': 'blue', 'deleted': 'red', 'price_changed': 'purple', 'stock_adjusted': 'orange', 'image_added': 'teal', 'image_removed': 'pink', 'image_primary_set': 'cyan', 'sold': 'indigo', 'variant_added': 'violet', 'variant_removed': 'rose', 'duplicated': 'purple', 'imported': 'sky', 'activated': 'green', 'deactivated': 'gray', 'stock_in': 'emerald', 'stock_out': 'orange', 'stock_loss': 'red', 'stock_return': 'blue', 'inventory_adjusted': 'yellow', 'sale_voided': 'pink', 'refunded': 'cyan', 'restocked': 'teal', } %} {% set actionIcons = { 'created': 'fa-plus-circle', 'updated': 'fa-pen', 'deleted': 'fa-trash', 'price_changed': 'fa-tag', 'stock_adjusted': 'fa-sliders', 'image_added': 'fa-image', 'image_removed': 'fa-image', 'image_primary_set': 'fa-star', 'sold': 'fa-shopping-cart', 'variant_added': 'fa-layer-group', 'variant_removed': 'fa-layer-group', 'duplicated': 'fa-copy', 'imported': 'fa-file-import', 'activated': 'fa-toggle-on', 'deactivated': 'fa-toggle-off', 'stock_in': 'fa-arrow-down', 'stock_out': 'fa-arrow-up', 'stock_loss': 'fa-exclamation-triangle', 'stock_return': 'fa-undo', 'inventory_adjusted': 'fa-clipboard-check', 'sale_voided': 'fa-ban', 'refunded': 'fa-hand-holding-dollar', 'restocked': 'fa-truck-loading', } %}
{% for entry in productHistory %} {% set color = actionColors[entry.action]|default('gray') %} {% set icon = actionIcons[entry.action]|default('fa-circle') %}
{{ entry.actionLabel }} {{ entry.createdAt|date('d/m/Y H:i') }}
{% if entry.description %}

{{ entry.description }}

{% endif %} {% if entry.oldValues or entry.newValues %}
{% if entry.oldValues %} {% for key, val in entry.oldValues %} {% if entry.newValues[key] is defined and entry.newValues[key] != val %} {{ key }}: {{ val }} {{ entry.newValues[key] }} {% endif %} {% endfor %} {% endif %}
{% endif %}
{% if entry.user %} {{ entry.user.fullName }} {% else %} Systeme {% endif %} {% if entry.ipAddress %} {{ entry.ipAddress }} {% endif %}
{% endfor %}
{% else %}

Aucun historique pour ce produit

{% endif %}
{# Metadonnees #}
Cree le
{{ product.createdAt|date('d/m/Y H:i') }}
Modifie le
{{ product.updatedAt|date('d/m/Y H:i') }}
{% if product.createdBy %}
Cree par
{{ product.createdBy.fullName }}
{% endif %}
{% endblock %}