menu 1 2 3 4 5 7 operationnels
This commit is contained in:
+162
-139
@@ -1,7 +1,7 @@
|
||||
{% extends "base.html" %} {% block title %}Gestion des Ordres - Bolsa{% endblock
|
||||
%} {% block header_title %}Gestion des ordres{% endblock %} {% block content %}
|
||||
<div
|
||||
class="flex flex-col items-center justify-center py-2 px-2 relative w-full"
|
||||
class="flex flex-col items-center justify-center w-full h-full overflow-hidden px-2"
|
||||
>
|
||||
<!-- Système de Toasts -->
|
||||
<div
|
||||
@@ -18,12 +18,13 @@
|
||||
{% endfor %} {% endif %}
|
||||
</div>
|
||||
|
||||
<!-- Box principale -->
|
||||
<!-- Box principale : Hauteur 100% du conteneur parent (qui occupe tout l'espace libre) -->
|
||||
<div
|
||||
class="bg-gray-900 border border-gray-800 p-4 sm:p-6 rounded-2xl shadow-2xl w-full max-w-[98%]"
|
||||
class="bg-gray-900 border border-gray-800 rounded-2xl shadow-2xl w-full max-w-[98%] h-full flex flex-col overflow-hidden"
|
||||
>
|
||||
<!-- Header fixe de la box -->
|
||||
<div
|
||||
class="flex justify-between items-center mb-4 border-b border-gray-800 pb-3"
|
||||
class="p-4 sm:p-6 pb-3 border-b border-gray-800 flex justify-between items-center shrink-0"
|
||||
>
|
||||
<div>
|
||||
<h2 class="text-2xl font-extrabold text-white flex items-center gap-2">
|
||||
@@ -43,6 +44,7 @@
|
||||
action="{{ url_for('main.gestion_ordres') }}"
|
||||
class="flex items-center gap-2 m-0"
|
||||
>
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
|
||||
<!-- Conserver la société active lors du changement d'année -->
|
||||
<input
|
||||
type="hidden"
|
||||
@@ -71,7 +73,7 @@
|
||||
<span
|
||||
class="font-bold {% if total_plus_value_globale >= 0 %}text-emerald-400{% else %}text-rose-400{% endif %}"
|
||||
>
|
||||
{{ "{:,.2f}".format(total_plus_value_globale or 0) }} €
|
||||
{{ "{:,.2f}".format(total_plus_value_globale | abs) }} €
|
||||
</span>
|
||||
</div>
|
||||
</form>
|
||||
@@ -81,6 +83,7 @@
|
||||
action="{{ url_for('main.gestion_ordres') }}"
|
||||
class="m-0"
|
||||
>
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
|
||||
<!-- Conserver l'année active lors du changement de société -->
|
||||
<input
|
||||
type="hidden"
|
||||
@@ -93,9 +96,9 @@
|
||||
onchange="this.form.submit()"
|
||||
>
|
||||
{% for soc in societes %} {% if soc.id == selected_societe_id %}
|
||||
<option value="{{ soc.id }}" selected>{{ soc.Nom }}</option>
|
||||
<option value="{{ soc.id }}" selected>{{ soc.nom }}</option>
|
||||
{% else %}
|
||||
<option value="{{ soc.id }}">{{ soc.Nom }}</option>
|
||||
<option value="{{ soc.id }}">{{ soc.nom }}</option>
|
||||
{% endif %} {% endfor %}
|
||||
</select>
|
||||
</form>
|
||||
@@ -117,144 +120,163 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Tableau -->
|
||||
<div
|
||||
class="bg-gray-950 border border-gray-800 rounded-xl p-2 overflow-x-auto"
|
||||
>
|
||||
<table class="w-full text-left border-collapse text-sm">
|
||||
<tbody class="divide-y divide-gray-800 text-gray-300">
|
||||
{% if groupes_ordres %} {% for groupe in groupes_ordres %}
|
||||
<tr class="bg-blue-950 text-white font-semibold">
|
||||
<td colspan="12" class="py-2.5 px-3 text-base">
|
||||
{{ groupe.isin }} --- {{ groupe.company_name }} ( {{ groupe.ticker
|
||||
}} )
|
||||
</td>
|
||||
</tr>
|
||||
<!-- Corps scrollable de la box (flex-1 et overflow-y-auto pour isoler le défilement) -->
|
||||
<div class="p-4 sm:p-6 overflow-y-auto flex-1">
|
||||
<!-- Tableau -->
|
||||
<div
|
||||
class="bg-gray-950 border border-gray-800 rounded-xl p-2 overflow-x-auto"
|
||||
>
|
||||
<table class="w-full text-left border-collapse text-sm">
|
||||
<tbody class="divide-y divide-gray-800 text-gray-300">
|
||||
{% if groupes_ordres %} {% for groupe in groupes_ordres %}
|
||||
<tr class="bg-blue-950 text-white font-semibold">
|
||||
<td colspan="12" class="py-2.5 px-3 text-base">
|
||||
{{ groupe.isin }} --- {{ groupe.company_name }} ( {{
|
||||
groupe.ticker }} )
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr
|
||||
class="bg-blue-950/60 text-gray-400 uppercase tracking-wider text-xs border-t border-b border-gray-800"
|
||||
>
|
||||
<th class="py-2 px-3">Date</th>
|
||||
<th class="py-2 px-3">Qté</th>
|
||||
<th class="py-2 px-3">Prix Brut</th>
|
||||
<th class="py-2 px-3">Frais</th>
|
||||
<th class="py-2 px-3">Prix Net</th>
|
||||
<th class="py-2 px-3">Eng. Brut</th>
|
||||
<th class="py-2 px-3">Eng. Net</th>
|
||||
<th class="py-2 px-3">Ordre</th>
|
||||
<th class="py-2 px-3">Type</th>
|
||||
<th class="py-2 px-3">État</th>
|
||||
<th class="py-2 px-3 text-end">
|
||||
<button
|
||||
type="button"
|
||||
onclick="ouvrirModalLigneOrdre('{{ groupe.id }}', '{{ groupe.isin }}', '{{ groupe.company_name }}', '{{ groupe.ticker }}')"
|
||||
class="px-3.5 py-1.5 bg-emerald-600 hover:bg-emerald-500 text-white text-xs font-semibold rounded shadow transition cursor-pointer"
|
||||
>
|
||||
Créer
|
||||
</button>
|
||||
</th>
|
||||
</tr>
|
||||
<tr
|
||||
class="bg-blue-950/60 text-gray-400 uppercase tracking-wider text-xs border-t border-b border-gray-800"
|
||||
>
|
||||
<th class="py-2 px-3">Date</th>
|
||||
<th class="py-2 px-3">Qté</th>
|
||||
<th class="py-2 px-3">Prix Brut</th>
|
||||
<th class="py-2 px-3">Frais</th>
|
||||
<th class="py-2 px-3">Prix Net</th>
|
||||
<th class="py-2 px-3">Eng. Brut</th>
|
||||
<th class="py-2 px-3">Eng. Net</th>
|
||||
<th class="py-2 px-3">Ordre</th>
|
||||
<th class="py-2 px-3">Type</th>
|
||||
<th class="py-2 px-3">État</th>
|
||||
<th class="py-2 px-3 text-end">
|
||||
<button
|
||||
type="button"
|
||||
onclick="ouvrirModalLigneOrdre('{{ groupe.id }}', '{{ groupe.isin }}', '{{ groupe.company_name }}', '{{ groupe.ticker }}')"
|
||||
class="px-3.5 py-1.5 bg-emerald-600 hover:bg-emerald-500 text-white text-xs font-semibold rounded shadow transition cursor-pointer"
|
||||
>
|
||||
Créer
|
||||
</button>
|
||||
</th>
|
||||
</tr>
|
||||
|
||||
{% for p in groupe.pieds %}
|
||||
<tr class="hover:bg-gray-900/50 transition">
|
||||
<td class="py-2 px-3 whitespace-nowrap">{{ p.date_op }}</td>
|
||||
<td class="py-2 px-3">
|
||||
{{ "{:,.0f}".format(p.quantite).replace(",", " ") }}
|
||||
</td>
|
||||
<td class="py-2 px-3">{{ "{:,.3f}".format(p.prix_brut) }}</td>
|
||||
<td class="py-2 px-3">{{ "{:,.3f}".format(p.frais) }}</td>
|
||||
<td class="py-2 px-3">{{ "{:,.3f}".format(p.prix_net) }}</td>
|
||||
<td class="py-2 px-3">{{ "{:,.3f}".format(p.eng_brut) }}</td>
|
||||
<td class="py-2 px-3">{{ "{:,.3f}".format(p.eng_net) }}</td>
|
||||
<td class="py-2 px-3">
|
||||
<span
|
||||
class="px-2 py-0.5 rounded text-xs font-semibold {% if p.ordre == 'achat' %}bg-blue-900 text-blue-200{% else %}bg-rose-900 text-rose-200{% endif %}"
|
||||
>
|
||||
{{ p.ordre | upper }}
|
||||
</span>
|
||||
</td>
|
||||
<td class="py-2 px-3">{{ p.type_ordre }}</td>
|
||||
<td class="py-2 px-3">
|
||||
<span
|
||||
class="px-2 py-0.5 rounded text-xs font-medium {% if p.etat == 'actif' %}bg-emerald-900 text-emerald-200 {% elif p.etat == 'soldé' %}bg-gray-800 text-gray-300 {% else %}bg-amber-900 text-amber-200{% endif %}"
|
||||
>
|
||||
{{ p.etat }}
|
||||
</span>
|
||||
</td>
|
||||
<td class="py-2 px-3 text-end">
|
||||
<button
|
||||
type="button"
|
||||
onclick="ouvrirModalModifierLigne('{{ p.id }}', '{{ groupe.isin }}', '{{ groupe.company_name }}', '{{ groupe.ticker }}', '{{ p.date_op }}', '{{ p.quantite }}', '{{ p.prix_brut }}', '{{ p.frais_brocker }}', '{{ p.frais_etat }}', '{{ p.frais_autre }}', '{{ p.ordre }}', '{{ p.type_ordre }}', '{{ p.etat }}')"
|
||||
class="px-3.5 py-1.5 bg-blue-600 hover:bg-blue-500 text-white text-xs font-semibold rounded shadow transition inline-flex items-center justify-center cursor-pointer"
|
||||
title="Modifier"
|
||||
>
|
||||
Modifier
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% for p in groupe.pieds %}
|
||||
<tr class="hover:bg-gray-900/50 transition">
|
||||
<td class="py-2 px-3 whitespace-nowrap">{{ p.date_op }}</td>
|
||||
<td class="py-2 px-3">
|
||||
{{ "{:,.0f}".format(p.quantite).replace(",", " ") }}
|
||||
</td>
|
||||
<td class="py-2 px-3">
|
||||
{{ "{:,.3f}".format(p.prix_brut | abs) }}
|
||||
</td>
|
||||
<td class="py-2 px-3">{{ "{:,.3f}".format(p.frais | abs) }}</td>
|
||||
<td class="py-2 px-3">
|
||||
{{ "{:,.3f}".format(p.prix_net | abs) }}
|
||||
</td>
|
||||
<td class="py-2 px-3">{{ "{:,.3f}".format(p.eng_brut) }}</td>
|
||||
<td class="py-2 px-3">{{ "{:,.3f}".format(p.eng_net) }}</td>
|
||||
<td class="py-2 px-3">
|
||||
<span
|
||||
class="px-2 py-0.5 rounded text-xs font-semibold {% if p.ordre == 'achat' %}bg-blue-900 text-blue-200{% else %}bg-rose-900 text-rose-200{% endif %}"
|
||||
>
|
||||
{{ p.ordre | upper }}
|
||||
</span>
|
||||
</td>
|
||||
<td class="py-2 px-3">{{ p.type_ordre }}</td>
|
||||
<td class="py-2 px-3">
|
||||
<span
|
||||
class="px-2 py-0.5 rounded text-xs font-medium {% if p.etat == 'actif' %}bg-emerald-900 text-emerald-200 {% elif p.etat == 'soldé' %}bg-gray-800 text-gray-300 {% else %}bg-amber-900 text-amber-200{% endif %}"
|
||||
>
|
||||
{{ p.etat }}
|
||||
</span>
|
||||
</td>
|
||||
<td class="py-2 px-3 text-end">
|
||||
<button
|
||||
type="button"
|
||||
onclick="ouvrirModalModifierLigne('{{ p.id }}', '{{ groupe.isin }}', '{{ groupe.company_name }}', '{{ groupe.ticker }}', '{{ p.date_op }}', '{{ p.quantite }}', '{{ p.prix_brut }}', '{{ p.frais_broker }}', '{{ p.frais_etat }}', '{{ p.frais_autre }}', '{{ p.ordre }}', '{{ p.type_ordre }}', '{{ p.etat }}')"
|
||||
class="px-3.5 py-1.5 bg-blue-600 hover:bg-blue-500 text-white text-xs font-semibold rounded shadow transition inline-flex items-center justify-center cursor-pointer"
|
||||
title="Modifier"
|
||||
>
|
||||
Modifier
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
||||
<!-- LIGNE TOTAL -->
|
||||
<tr
|
||||
class="bg-blue-950/60 text-white uppercase tracking-wider text-xs border-t border-b border-gray-800 font-bold"
|
||||
>
|
||||
<td class="py-2.5 px-3">TOTAL :</td>
|
||||
<td class="py-2.5 px-3">
|
||||
{{ "{:,.0f}".format(groupe.total_quantite).replace(",", " ") }}
|
||||
</td>
|
||||
<!-- LIGNE TOTAL -->
|
||||
<tr
|
||||
class="bg-blue-950/60 text-white uppercase tracking-wider text-xs border-t border-b border-gray-800 font-bold"
|
||||
>
|
||||
<td class="py-2.5 px-3">TOTAL :</td>
|
||||
<td class="py-2.5 px-3">
|
||||
{{ "{:,.0f}".format(groupe.total_quantite).replace(",", " ") }}
|
||||
</td>
|
||||
|
||||
{% if groupe.total_quantite != 0 %} {% set total_prix_net_moyen =
|
||||
(groupe.total_eng_net / groupe.total_quantite) | abs %} {% set
|
||||
total_prix_brut_moyen = (groupe.total_eng_brut /
|
||||
groupe.total_quantite) | abs %} {% set total_frais_moyen =
|
||||
(total_prix_net_moyen - total_prix_brut_moyen) | abs %}
|
||||
{% if groupe.total_quantite != 0 %} {% set total_prix_net_moyen =
|
||||
(groupe.total_eng_net / groupe.total_quantite) %} {% set
|
||||
total_prix_brut_moyen = (groupe.total_eng_brut /
|
||||
groupe.total_quantite) %} {% set total_frais_moyen =
|
||||
(total_prix_net_moyen - total_prix_brut_moyen) %}
|
||||
|
||||
<td class="py-2.5 px-3">
|
||||
{{ "{:,.3f}".format(total_prix_brut_moyen) }}
|
||||
</td>
|
||||
<td class="py-2.5 px-3">
|
||||
{{ "{:,.3f}".format(total_frais_moyen) }}
|
||||
</td>
|
||||
<td class="py-2.5 px-3">
|
||||
{{ "{:,.3f}".format(total_prix_net_moyen) }}
|
||||
</td>
|
||||
<td class="py-2.5 px-3">
|
||||
{{ "{:,.3f}".format(groupe.total_eng_brut | abs) }}
|
||||
</td>
|
||||
<td class="py-2.5 px-3">
|
||||
{{ "{:,.3f}".format(groupe.total_eng_net | abs) }}
|
||||
</td>
|
||||
{% else %}
|
||||
<td class="py-2.5 px-3">-</td>
|
||||
<td class="py-2.5 px-3">-</td>
|
||||
<td class="py-2.5 px-3">-</td>
|
||||
<td class="py-2.5 px-3">
|
||||
{{ "{:,.3f}".format(groupe.total_eng_brut | abs) }}
|
||||
</td>
|
||||
<td class="py-2.5 px-3">
|
||||
<span
|
||||
class="{% if groupe.total_eng_net >= 0 %}text-emerald-400{% else %}text-rose-400{% endif %}"
|
||||
>
|
||||
{{ "{:,.3f}".format(groupe.total_eng_net | abs) }}
|
||||
</span>
|
||||
</td>
|
||||
<td class="py-2.5 px-3">
|
||||
{{ "{:,.3f}".format(total_prix_brut_moyen | abs) }}
|
||||
</td>
|
||||
<td class="py-2.5 px-3">
|
||||
{{ "{:,.3f}".format(total_frais_moyen | abs) }}
|
||||
</td>
|
||||
<td class="py-2.5 px-3">
|
||||
{{ "{:,.3f}".format(total_prix_net_moyen | abs) }}
|
||||
</td>
|
||||
<td class="py-2.5 px-3">
|
||||
{{ "{:,.3f}".format(groupe.total_eng_brut) }}
|
||||
</td>
|
||||
<td class="py-2.5 px-3">
|
||||
<span
|
||||
class="{% if groupe.total_eng_net >= 0 %}text-emerald-400{% else %}text-rose-400{% endif %}"
|
||||
>
|
||||
{{ "{:,.3f}".format(groupe.total_eng_net) }}
|
||||
</span>
|
||||
</td>
|
||||
{% else %}
|
||||
<td class="py-2.5 px-3">-</td>
|
||||
<td class="py-2.5 px-3">-</td>
|
||||
<td class="py-2.5 px-3">-</td>
|
||||
<td class="py-2.5 px-3">
|
||||
{{ "{:,.3f}".format(groupe.total_eng_brut) }}
|
||||
</td>
|
||||
<td class="py-2.5 px-3">
|
||||
<span
|
||||
class="{% if groupe.total_eng_net >= 0 %}text-emerald-400{% else %}text-rose-400{% endif %}"
|
||||
>
|
||||
{{ "{:,.3f}".format(groupe.total_eng_net) }}
|
||||
</span>
|
||||
</td>
|
||||
{% endif %}
|
||||
|
||||
<td class="py-2.5 px-3" colspan="4"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="11" class="h-3 bg-transparent border-0"></td>
|
||||
</tr>
|
||||
{% endfor %} {% else %}
|
||||
<tr>
|
||||
<td colspan="11" class="text-center text-gray-500 py-8">
|
||||
Aucun ordre trouvé pour cette société.
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<td class="py-2.5 px-3" colspan="4"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="11" class="h-3 bg-transparent border-0"></td>
|
||||
</tr>
|
||||
{% endfor %} {% else %}
|
||||
<tr>
|
||||
<td colspan="11" class="text-center text-gray-500 py-8">
|
||||
Aucun ordre trouvé pour cette société.
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
</tbody>
|
||||
</table>
|
||||
<!-- Footer fixe de la box -->
|
||||
<div
|
||||
class="px-6 py-3 border-t border-gray-800 text-xs text-gray-400 text-center shrink-0 bg-gray-900"
|
||||
>
|
||||
Positions en bourse : Accès sécurisé. Veillez à fermer votre session après
|
||||
chaque utilisation.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -285,6 +307,7 @@
|
||||
action="{{ url_for('main.creer_ordre_traitement') }}"
|
||||
class="space-y-4"
|
||||
>
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
|
||||
<!-- Transmettre dynamiquement l'année active dans le formulaire de la modale -->
|
||||
<input
|
||||
type="hidden"
|
||||
@@ -385,7 +408,7 @@
|
||||
type="number"
|
||||
step="0.0001"
|
||||
id="input-frais-brocker"
|
||||
name="frais_brocker"
|
||||
name="frais_broker"
|
||||
value="0.0000"
|
||||
oninput="calculerTotauxModal()"
|
||||
class="w-full bg-gray-800 border border-gray-700 rounded-lg px-3 py-2 text-sm text-white focus:outline-none focus:border-blue-500"
|
||||
|
||||
Reference in New Issue
Block a user