78 lines
3.3 KiB
HTML
78 lines
3.3 KiB
HTML
{% extends 'base.html' %}
|
||
{% block title %}Commandes{% endblock %}
|
||
|
||
{% block content %}
|
||
<div class="page-header d-flex justify-content-between align-items-center">
|
||
<h1><i class="bi bi-printer me-2 text-primary"></i>Commandes</h1>
|
||
<div class="d-flex gap-2">
|
||
<a href="{{ url_for('export_csv') }}" class="btn btn-sm btn-outline-secondary">
|
||
<i class="bi bi-download me-1"></i>Export CSV
|
||
</a>
|
||
<a href="{{ url_for('new_job') }}" class="btn btn-sm" style="background:#ff6b35;color:#fff">
|
||
<i class="bi bi-plus-lg me-1"></i>Nouveau
|
||
</a>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="card">
|
||
<div class="card-body p-0">
|
||
{% if jobs %}
|
||
<div class="table-responsive">
|
||
<table class="table table-hover mb-0">
|
||
<thead class="table-light">
|
||
<tr>
|
||
<th>Date</th><th>Nom</th><th>Client</th><th>Réf. plateau</th><th>Poids</th>
|
||
<th>Durée</th><th>Design</th><th>Marge brute</th><th>Total marge</th><th>Remise</th>
|
||
<th class="text-end">Prix final</th><th></th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
{% for j in jobs %}
|
||
<tr>
|
||
<td class="text-muted small">{{ j.created_at[:10] }}</td>
|
||
<td><a href="{{ url_for('job_detail', id=j.id) }}" class="text-decoration-none fw-semibold">{{ j.name }}</a></td>
|
||
<td>{{ j.client_name or '—' }}</td>
|
||
<td class="text-muted small">{{ j.plate_name or '—' }}</td>
|
||
<td>{{ j.weight_g }} g</td>
|
||
<td>{{ j.print_time_s | fmt_time }}</td>
|
||
<td><span class="badge bg-light text-dark">×{{ j.design_multiplier }}</span></td>
|
||
<td><span class="badge bg-light text-dark">{{ j.gross_margin_pct }}%</span></td>
|
||
<td class="text-nowrap small">{% if j.total_marge %}{{ '%.2f'|format(j.total_marge) }} €<br><span class="text-muted">{% if j.marge_pct_on_ht %}{{ j.marge_pct_on_ht }}% du HT{% endif %}</span>{% else %}—{% endif %}</td>
|
||
<td>
|
||
{% if j.discount_pct > 0 %}
|
||
<span class="badge bg-danger">-{{ j.discount_pct }}%</span>
|
||
{% else %}—{% endif %}
|
||
</td>
|
||
<td class="text-end fw-bold" style="color:#ff6b35">{{ j.final_price }} €</td>
|
||
<td>
|
||
<div class="d-flex gap-1 align-items-center">
|
||
{% if j.client_token %}
|
||
<a href="/portal/{{ j.client_token }}" target="_blank"
|
||
class="btn btn-sm btn-outline-success py-0"
|
||
title="Portail client actif — ouvrir">
|
||
<i class="bi bi-share-fill"></i>
|
||
</a>
|
||
{% endif %}
|
||
<a href="{{ url_for('job_detail', id=j.id) }}" class="btn btn-sm btn-outline-secondary py-0">→</a>
|
||
<form method="POST" action="{{ url_for('delete_job', id=j.id) }}"
|
||
onsubmit="return confirm('Supprimer ?')">
|
||
<button class="btn btn-sm btn-outline-danger py-0"><i class="bi bi-trash"></i></button>
|
||
</form>
|
||
</div>
|
||
</td>
|
||
</tr>
|
||
{% endfor %}
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
{% else %}
|
||
<div class="text-center text-muted py-5">
|
||
<i class="bi bi-inbox fs-1"></i>
|
||
<p class="mt-2">Aucune commande enregistrée.</p>
|
||
<a href="{{ url_for('new_job') }}" class="btn btn-sm" style="background:#ff6b35;color:#fff">Créer le premier calcul</a>
|
||
</div>
|
||
{% endif %}
|
||
</div>
|
||
</div>
|
||
{% endblock %}
|