Compare commits
5 Commits
e55772986b
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 85a858d3b8 | |||
| 39e5ae87ff | |||
| 3a5e8a70e2 | |||
| 4df8cf495a | |||
| 18102d1627 |
+201
-20
@@ -156,26 +156,6 @@
|
||||
background-color: #283593;
|
||||
}
|
||||
|
||||
.ordregf-modal {
|
||||
border: none;
|
||||
border-radius: 8px;
|
||||
padding: 20px;
|
||||
background: #1c2030;
|
||||
color: #fff;
|
||||
}
|
||||
.ordregf-modal input {
|
||||
background: #13161f;
|
||||
border: 1px solid #333;
|
||||
color: white;
|
||||
padding: 5px;
|
||||
margin: 5px 0;
|
||||
}
|
||||
.modal-actions {
|
||||
margin-top: 15px;
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.ordregf-master-row {
|
||||
background: linear-gradient(90deg, #001f3f, #004cff) !important;
|
||||
color: #ffffff;
|
||||
@@ -227,3 +207,204 @@ body {
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.ordregf-btn-petit {
|
||||
width: 90px;
|
||||
height: 30px;
|
||||
padding: 0 10px;
|
||||
font-size: 0.8em;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-sizing: border-box;
|
||||
transition: background 0.2s ease;
|
||||
}
|
||||
|
||||
/* ===========================
|
||||
MODALES
|
||||
=========================== */
|
||||
|
||||
.ordregf-modal {
|
||||
width: 520px;
|
||||
max-width: 92vw;
|
||||
|
||||
border: none;
|
||||
border-radius: 18px;
|
||||
|
||||
background: #20263a;
|
||||
color: white;
|
||||
|
||||
padding: 30px;
|
||||
|
||||
box-shadow: 0 25px 60px rgba(0, 0, 0, 0.45);
|
||||
|
||||
animation: popup 0.18s ease-out;
|
||||
}
|
||||
|
||||
.ordregf-modal::backdrop {
|
||||
background: rgba(0, 0, 0, 0.65);
|
||||
backdrop-filter: blur(5px);
|
||||
}
|
||||
|
||||
@keyframes popup {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(-20px) scale(0.95);
|
||||
}
|
||||
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0) scale(1);
|
||||
}
|
||||
}
|
||||
|
||||
.ordregf-modal h2 {
|
||||
margin-top: 0;
|
||||
margin-bottom: 25px;
|
||||
text-align: center;
|
||||
font-size: 24px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.form-group {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
margin-bottom: 18px;
|
||||
}
|
||||
|
||||
.form-group label {
|
||||
font-weight: 600;
|
||||
color: #cfd8ff;
|
||||
}
|
||||
|
||||
.ordregf-modal input,
|
||||
.ordregf-modal select {
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
|
||||
padding: 12px 14px;
|
||||
|
||||
border-radius: 10px;
|
||||
border: 1px solid #3b4668;
|
||||
|
||||
background: #151b2d;
|
||||
color: white;
|
||||
|
||||
font-size: 15px;
|
||||
|
||||
outline: none;
|
||||
|
||||
transition: 0.25s;
|
||||
}
|
||||
|
||||
.ordregf-modal input:focus,
|
||||
.ordregf-modal select:focus {
|
||||
border-color: #4d84ff;
|
||||
box-shadow: 0 0 0 3px rgba(77, 132, 255, 0.25);
|
||||
}
|
||||
|
||||
.modal-actions {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: 12px;
|
||||
|
||||
margin-top: 28px;
|
||||
}
|
||||
|
||||
.modal-actions button {
|
||||
border: none;
|
||||
|
||||
padding: 11px 22px;
|
||||
|
||||
border-radius: 10px;
|
||||
|
||||
font-weight: 600;
|
||||
|
||||
cursor: pointer;
|
||||
|
||||
transition: 0.2s;
|
||||
}
|
||||
|
||||
.modal-actions button:first-child {
|
||||
background: #444b63;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.modal-actions button:first-child:hover {
|
||||
background: #59617c;
|
||||
}
|
||||
|
||||
.modal-actions button:last-child {
|
||||
background: #2dbf5a;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.modal-actions button:last-child:hover {
|
||||
background: #27a84f;
|
||||
}
|
||||
|
||||
.form-group .triple {
|
||||
display: grid;
|
||||
|
||||
grid-template-columns: 1fr 1fr 1fr;
|
||||
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
#btnRechercher {
|
||||
margin-top: 10px;
|
||||
|
||||
width: 100%;
|
||||
|
||||
padding: 12px;
|
||||
|
||||
border: none;
|
||||
|
||||
border-radius: 10px;
|
||||
|
||||
background: #2962ff;
|
||||
|
||||
color: white;
|
||||
|
||||
font-weight: 600;
|
||||
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#btnRechercher:hover {
|
||||
background: #1d4ed8;
|
||||
}
|
||||
|
||||
dialog.ordregf-modal {
|
||||
position: fixed;
|
||||
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
|
||||
transform: translate(-50%, -50%);
|
||||
|
||||
margin: 0;
|
||||
|
||||
width: 520px;
|
||||
max-width: 90vw;
|
||||
|
||||
border: none;
|
||||
border-radius: 18px;
|
||||
|
||||
padding: 30px;
|
||||
|
||||
background: #20263a;
|
||||
color: white;
|
||||
|
||||
box-shadow: 0 25px 60px rgba(0, 0, 0, 0.45);
|
||||
}
|
||||
|
||||
dialog.ordregf-modal::backdrop {
|
||||
background: rgba(0, 0, 0, 0.65);
|
||||
backdrop-filter: blur(5px);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,358 @@
|
||||
:root {
|
||||
--ordrejfg-bg: #13161f;
|
||||
--ordrejfg-card: #1c2030;
|
||||
--ordrejfg-border: rgba(255, 255, 255, 0.08);
|
||||
--ordrejfg-text: #f0f2fc;
|
||||
}
|
||||
|
||||
/* Force le plein écran */
|
||||
.ordrejfg-page {
|
||||
background-color: var(--ordrejfg-bg);
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.ordrejfg-shell {
|
||||
width: 100%;
|
||||
max-width: none;
|
||||
margin: 0;
|
||||
padding: 20px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.ordrejfg-card {
|
||||
background: var(--ordrejfg-card);
|
||||
border-radius: 12px;
|
||||
padding: 20px;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* Tables en pleine largeur */
|
||||
.ordrejfg-table,
|
||||
.ordrejfg-detail-table {
|
||||
width: 100% !important;
|
||||
border-collapse: collapse;
|
||||
table-layout: auto;
|
||||
}
|
||||
|
||||
/* Alignements entêtes */
|
||||
.ordrejfg-table th,
|
||||
.ordrejfg-detail-table th {
|
||||
background: rgba(255, 255, 255, 0.05);
|
||||
padding: 12px;
|
||||
text-align: left;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.ordrejfg-detail-table th {
|
||||
text-align: center !important;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.ordrejfg-detail-table td {
|
||||
padding: 8px;
|
||||
border-bottom: 1px solid var(--ordrejfg-border);
|
||||
}
|
||||
|
||||
/* Styles boutons */
|
||||
.ordrejfg-edit-button {
|
||||
padding: 4px 12px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* Boutons principaux (Créer et Retour) */
|
||||
.ordrejfg-btn-menu,
|
||||
.ordrejfg-btn-creer {
|
||||
padding: 10px 24px !important;
|
||||
border-radius: 50px !important;
|
||||
border: none !important;
|
||||
cursor: pointer !important;
|
||||
font-size: 14px !important;
|
||||
font-weight: 600 !important;
|
||||
text-decoration: none !important;
|
||||
display: inline-flex !important;
|
||||
align-items: center !important;
|
||||
justify-content: center !important;
|
||||
transition: background 0.3s ease !important;
|
||||
color: #ffffff !important;
|
||||
}
|
||||
|
||||
/* Bouton Menu (Bleu) */
|
||||
.ordrejfg-btn-menu {
|
||||
background-color: #1a237e !important;
|
||||
}
|
||||
.ordrejfg-btn-menu:hover {
|
||||
background-color: #283593 !important;
|
||||
}
|
||||
|
||||
/* Bouton Créer (Vert) */
|
||||
.ordrejfg-btn-creer {
|
||||
background-color: #28a745 !important;
|
||||
}
|
||||
.ordrejfg-btn-creer:hover {
|
||||
background-color: #218838 !important;
|
||||
}
|
||||
|
||||
/* Styles lignes */
|
||||
.ordrejfg-header-style {
|
||||
background: rgba(255, 255, 255, 0.05) !important;
|
||||
}
|
||||
|
||||
.ordrejfg-header-style td {
|
||||
color: #fff !important;
|
||||
font-weight: 600 !important;
|
||||
padding: 12px !important;
|
||||
border-bottom: 2px solid rgba(255, 255, 255, 0.1) !important;
|
||||
}
|
||||
|
||||
.ordrejfg-detail-row td {
|
||||
padding: 10px 5px !important;
|
||||
border-bottom: 1px solid var(--ordrejfg-border);
|
||||
color: #e0e0e0;
|
||||
font-family: monospace;
|
||||
}
|
||||
|
||||
.ordrejfg-detail-row:hover {
|
||||
background-color: rgba(255, 255, 255, 0.03);
|
||||
}
|
||||
|
||||
/* Alignement colonnes numériques */
|
||||
.ordrejfg-detail-table .text-right {
|
||||
text-align: right !important;
|
||||
padding-right: 15px !important;
|
||||
}
|
||||
|
||||
/* Classe commune : force la taille et l'alignement */
|
||||
.ordrejfg-btn-petit {
|
||||
width: 90px;
|
||||
height: 30px;
|
||||
padding: 0 10px;
|
||||
font-size: 0.8em;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-sizing: border-box;
|
||||
transition: background 0.2s ease;
|
||||
}
|
||||
|
||||
/* Couleurs spécifiques */
|
||||
.ordrejfg-btn-creer-petit {
|
||||
background-color: #28a745;
|
||||
color: white;
|
||||
}
|
||||
.ordrejfg-btn-creer-petit:hover {
|
||||
background-color: #218838;
|
||||
}
|
||||
|
||||
.ordrejfg-btn-modifier-petit {
|
||||
background-color: #1a237e;
|
||||
color: white;
|
||||
}
|
||||
.ordrejfg-btn-modifier-petit:hover {
|
||||
background-color: #283593;
|
||||
}
|
||||
|
||||
.ordrejfg-master-row {
|
||||
background: linear-gradient(90deg, #001f3f, #004cff) !important;
|
||||
color: #ffffff;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.3px;
|
||||
border-bottom: 1px solid rgba(255, 255, 255, 0.15);
|
||||
box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.08);
|
||||
}
|
||||
|
||||
/**********************************************************/
|
||||
|
||||
/* 1. On nettoie le body */
|
||||
html,
|
||||
body {
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* 2. On positionne le shell en absolu pour qu'il s'insère entre le header et le footer */
|
||||
.ordrejfg-shell {
|
||||
position: absolute;
|
||||
top: 80px;
|
||||
bottom: 50px;
|
||||
left: 0;
|
||||
right: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 10px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* 3. La carte occupe l'espace restant */
|
||||
.ordrejfg-card {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* 4. C'est ici que le scroll se passe */
|
||||
.ordrejfg-table-wrapper {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.ordrejfg-table {
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* ===========================
|
||||
MODALES
|
||||
=========================== */
|
||||
|
||||
.ordrejfg-modal {
|
||||
width: 520px;
|
||||
max-width: 92vw;
|
||||
border: none;
|
||||
border-radius: 18px;
|
||||
background: #20263a;
|
||||
color: white;
|
||||
padding: 30px;
|
||||
box-shadow: 0 25px 60px rgba(0, 0, 0, 0.45);
|
||||
animation: popup 0.18s ease-out;
|
||||
}
|
||||
|
||||
.ordrejfg-modal::backdrop {
|
||||
background: rgba(0, 0, 0, 0.65);
|
||||
backdrop-filter: blur(5px);
|
||||
}
|
||||
|
||||
@keyframes popup {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(-20px) scale(0.95);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0) scale(1);
|
||||
}
|
||||
}
|
||||
|
||||
.ordrejfg-modal h2 {
|
||||
margin-top: 0;
|
||||
margin-bottom: 25px;
|
||||
text-align: center;
|
||||
font-size: 24px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.form-group {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
margin-bottom: 18px;
|
||||
}
|
||||
|
||||
.form-group label {
|
||||
font-weight: 600;
|
||||
color: #cfd8ff;
|
||||
}
|
||||
|
||||
.ordrejfg-modal input,
|
||||
.ordrejfg-modal select {
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
padding: 12px 14px;
|
||||
border-radius: 10px;
|
||||
border: 1px solid #3b4668;
|
||||
background: #151b2d;
|
||||
color: white;
|
||||
font-size: 15px;
|
||||
outline: none;
|
||||
transition: 0.25s;
|
||||
}
|
||||
|
||||
.ordrejfg-modal input:focus,
|
||||
.ordrejfg-modal select:focus {
|
||||
border-color: #4d84ff;
|
||||
box-shadow: 0 0 0 3px rgba(77, 132, 255, 0.25);
|
||||
}
|
||||
|
||||
.modal-actions {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: 12px;
|
||||
margin-top: 28px;
|
||||
}
|
||||
|
||||
.modal-actions button {
|
||||
border: none;
|
||||
padding: 11px 22px;
|
||||
border-radius: 10px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
transition: 0.2s;
|
||||
}
|
||||
|
||||
.modal-actions button:first-child {
|
||||
background: #444b63;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.modal-actions button:first-child:hover {
|
||||
background: #59617c;
|
||||
}
|
||||
|
||||
.modal-actions button:last-child {
|
||||
background: #2dbf5a;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.modal-actions button:last-child:hover {
|
||||
background: #27a84f;
|
||||
}
|
||||
|
||||
.form-group .triple {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr 1fr;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
#btnRechercher {
|
||||
margin-top: 10px;
|
||||
width: 100%;
|
||||
padding: 12px;
|
||||
border: none;
|
||||
border-radius: 10px;
|
||||
background: #2962ff;
|
||||
color: white;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#btnRechercher:hover {
|
||||
background: #1d4ed8;
|
||||
}
|
||||
|
||||
dialog.ordrejfg-modal {
|
||||
position: fixed;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
margin: 0;
|
||||
width: 520px;
|
||||
max-width: 90vw;
|
||||
border: none;
|
||||
border-radius: 18px;
|
||||
padding: 30px;
|
||||
background: #20263a;
|
||||
color: white;
|
||||
box-shadow: 0 25px 60px rgba(0, 0, 0, 0.45);
|
||||
}
|
||||
|
||||
dialog.ordrejfg-modal::backdrop {
|
||||
background: rgba(0, 0, 0, 0.65);
|
||||
backdrop-filter: blur(5px);
|
||||
}
|
||||
+30
-27
@@ -33,7 +33,9 @@ html {
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
||||
font-family:
|
||||
-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
|
||||
Arial, sans-serif;
|
||||
background-color: var(--bg-primary);
|
||||
color: var(--text-primary);
|
||||
line-height: 1.6;
|
||||
@@ -156,28 +158,6 @@ main {
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.footer {
|
||||
position: relative;
|
||||
padding: 8px 20px;
|
||||
text-align: center;
|
||||
font-size: 0.85rem;
|
||||
line-height: 1.3;
|
||||
min-height: 38px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: rgba(18, 24, 42, 0.98);
|
||||
border-top: 1px solid rgba(255, 255, 255, 0.06);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.footer-logout {
|
||||
position: absolute;
|
||||
right: 20px;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
|
||||
.logo-img {
|
||||
height: 50px;
|
||||
width: auto;
|
||||
@@ -415,13 +395,36 @@ main {
|
||||
============================================ */
|
||||
|
||||
.footer {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 10px 20px;
|
||||
background-color: var(--bg-secondary);
|
||||
border-top: 1px solid var(--border-color);
|
||||
padding: 20px;
|
||||
text-align: center;
|
||||
color: var(--text-secondary);
|
||||
font-size: 13px;
|
||||
margin-top: auto;
|
||||
font-size: 0.85rem;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* On donne une largeur fixe aux conteneurs latéraux pour forcer le centrage */
|
||||
#market-clocks,
|
||||
.logout-container {
|
||||
flex: 0 0 200px; /* Largeur fixe de 200px pour les deux côtés */
|
||||
}
|
||||
|
||||
#market-clocks {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.footer p {
|
||||
flex: 1; /* Le texte prend tout l'espace restant */
|
||||
text-align: center; /* Centre le texte dans cet espace */
|
||||
}
|
||||
|
||||
.footer-logout {
|
||||
display: block;
|
||||
text-align: right; /* Aligne le bouton à droite dans son bloc */
|
||||
}
|
||||
|
||||
/* ============================================
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
function updateClocks() {
|
||||
const now = new Date();
|
||||
const formatTime = (date) => date.toLocaleTimeString("fr-FR");
|
||||
|
||||
// --- PARIS ---
|
||||
const parisTime = new Date(
|
||||
now.toLocaleString("en-US", { timeZone: "Europe/Paris" }),
|
||||
);
|
||||
const pDay = parisTime.getDay();
|
||||
const pHour = parisTime.getHours();
|
||||
const pMin = parisTime.getMinutes();
|
||||
const isParisOpen =
|
||||
pDay >= 1 &&
|
||||
pDay <= 5 &&
|
||||
pHour >= 9 &&
|
||||
(pHour < 17 || (pHour === 17 && pMin < 30));
|
||||
|
||||
const pEl = document.getElementById("paris-clock");
|
||||
if (pEl) {
|
||||
pEl.innerText = "Paris : " + formatTime(parisTime);
|
||||
pEl.style.color = isParisOpen ? "#28a745" : "#dc3545";
|
||||
}
|
||||
|
||||
// --- NEW-YORK ---
|
||||
const nyTime = new Date(
|
||||
now.toLocaleString("en-US", { timeZone: "America/New_York" }),
|
||||
);
|
||||
const nyDay = nyTime.getDay();
|
||||
const nyHour = nyTime.getHours();
|
||||
const nyMin = nyTime.getMinutes();
|
||||
const isNyOpen =
|
||||
nyDay >= 1 &&
|
||||
nyDay <= 5 &&
|
||||
nyHour >= 9 &&
|
||||
(nyHour < 16 || (nyHour === 9 && nyMin >= 30));
|
||||
|
||||
const nyEl = document.getElementById("ny-clock");
|
||||
if (nyEl) {
|
||||
nyEl.innerText = "New-York : " + formatTime(nyTime);
|
||||
nyEl.style.color = isNyOpen ? "#28a745" : "#dc3545";
|
||||
}
|
||||
}
|
||||
|
||||
setInterval(updateClocks, 1000);
|
||||
updateClocks();
|
||||
});
|
||||
+144
-27
@@ -1,47 +1,108 @@
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
// --- 1. GESTION DES MODALS ET FORMULAIRES ---
|
||||
// =====================================================
|
||||
// OUTILS MODALES
|
||||
// =====================================================
|
||||
|
||||
function openModal(modal) {
|
||||
if (!modal) return;
|
||||
|
||||
modal.showModal();
|
||||
|
||||
// Force le centrage avec le CSS dialog
|
||||
modal.style.transform = "translate(-50%, -50%)";
|
||||
}
|
||||
|
||||
function closeModal(modal) {
|
||||
if (!modal) return;
|
||||
modal.close();
|
||||
modal.style.transform = "";
|
||||
}
|
||||
|
||||
// Fermeture par clic en dehors de la fenêtre
|
||||
document.querySelectorAll("dialog").forEach((dialog) => {
|
||||
dialog.addEventListener("click", (e) => {
|
||||
const rect = dialog.getBoundingClientRect();
|
||||
|
||||
const inside =
|
||||
e.clientX >= rect.left &&
|
||||
e.clientX <= rect.right &&
|
||||
e.clientY >= rect.top &&
|
||||
e.clientY <= rect.bottom;
|
||||
|
||||
if (!inside) {
|
||||
closeModal(dialog);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// =====================================================
|
||||
// MODAL CREATION ORDRE
|
||||
// =====================================================
|
||||
|
||||
// Modal Créer Ordre
|
||||
const modalCreerOrdre = document.getElementById("modalCreerOrdre");
|
||||
|
||||
const btnCreer = document.querySelector(".ordregf-btn-creer");
|
||||
|
||||
if (modalCreerOrdre && btnCreer) {
|
||||
btnCreer.addEventListener("click", () => modalCreerOrdre.showModal());
|
||||
btnCreer.addEventListener("click", () => {
|
||||
openModal(modalCreerOrdre);
|
||||
});
|
||||
|
||||
document.getElementById("btnAnnuler")?.addEventListener("click", () => {
|
||||
document.getElementById("formCreerOrdre").reset();
|
||||
modalCreerOrdre.close();
|
||||
document.getElementById("btnValider").disabled = true;
|
||||
document.getElementById("formCreerOrdre")?.reset();
|
||||
|
||||
closeModal(modalCreerOrdre);
|
||||
|
||||
const btnValider = document.getElementById("btnValider");
|
||||
|
||||
if (btnValider) {
|
||||
btnValider.disabled = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Recherche Action
|
||||
// =====================================================
|
||||
// RECHERCHE ACTION
|
||||
// =====================================================
|
||||
|
||||
const btnRechercher = document.getElementById("btnRechercher");
|
||||
|
||||
btnRechercher?.addEventListener("click", async () => {
|
||||
const isin = document.getElementById("isinRecherche").value;
|
||||
if (!isin) return alert("Veuillez entrer un code ISIN");
|
||||
|
||||
if (!isin) {
|
||||
alert("Veuillez entrer un code ISIN");
|
||||
return;
|
||||
}
|
||||
|
||||
const response = await fetch(
|
||||
`/php/api_rechercher_action.php?isin=${encodeURIComponent(isin)}`,
|
||||
);
|
||||
|
||||
const data = await response.json();
|
||||
|
||||
if (data.success) {
|
||||
document.getElementById("Nom").value = data.company_name;
|
||||
|
||||
document.getElementById("ticker").value = data.ticker;
|
||||
|
||||
document.getElementById("code_yahoo").value = data.yahoo_code;
|
||||
|
||||
document.getElementById("btnValider").disabled = false;
|
||||
} else {
|
||||
alert("Action non trouvée");
|
||||
}
|
||||
});
|
||||
|
||||
// Enregistrement Ordre
|
||||
// =====================================================
|
||||
// ENREGISTREMENT ORDRE
|
||||
// =====================================================
|
||||
|
||||
document
|
||||
.getElementById("formCreerOrdre")
|
||||
?.addEventListener("submit", async (e) => {
|
||||
e.preventDefault();
|
||||
// FormData récupère automatiquement tous les champs ayant un attribut "name"
|
||||
|
||||
const formData = new FormData(e.target);
|
||||
|
||||
const response = await fetch("/php/api_enregistrer_ordre.php", {
|
||||
@@ -50,6 +111,7 @@ document.addEventListener("DOMContentLoaded", () => {
|
||||
});
|
||||
|
||||
const result = await response.json();
|
||||
|
||||
if (result.success) {
|
||||
location.reload();
|
||||
} else {
|
||||
@@ -60,62 +122,117 @@ document.addEventListener("DOMContentLoaded", () => {
|
||||
}
|
||||
});
|
||||
|
||||
// Enregistrement Detail
|
||||
// =====================================================
|
||||
// ENREGISTREMENT DETAIL
|
||||
// =====================================================
|
||||
|
||||
document
|
||||
.getElementById("formCreerDetail")
|
||||
?.addEventListener("submit", async (e) => {
|
||||
e.preventDefault();
|
||||
|
||||
const response = await fetch("/php/api_enregistrer_detail.php", {
|
||||
method: "POST",
|
||||
body: new FormData(e.target),
|
||||
});
|
||||
|
||||
const result = await response.json();
|
||||
if (result.success) location.reload();
|
||||
else
|
||||
|
||||
if (result.success) {
|
||||
location.reload();
|
||||
} else {
|
||||
alert(
|
||||
"Erreur lors de l'enregistrement du détail : " +
|
||||
(result.message || ""),
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
// --- 2. GESTION MODIFICATION (DÉLÉGATION D'ÉVÉNEMENT) ---
|
||||
// =====================================================
|
||||
// MODIFICATION DETAIL
|
||||
// =====================================================
|
||||
|
||||
document.addEventListener("click", (e) => {
|
||||
const button = e.target.closest(".ordregf-btn-modifier-petit");
|
||||
if (button) {
|
||||
|
||||
if (!button) return;
|
||||
|
||||
const detail = JSON.parse(button.getAttribute("data-detail"));
|
||||
|
||||
const modal = document.getElementById("modalModifierDetail");
|
||||
if (modal) {
|
||||
|
||||
if (!modal) return;
|
||||
|
||||
document.getElementById("edit_id").value = detail.Id;
|
||||
|
||||
document.getElementById("edit_Id_entete").value = detail.Id_entete;
|
||||
|
||||
document.getElementById("edit_date").value = detail.Date_op;
|
||||
|
||||
document.getElementById("edit_quantite").value = detail.Quantite;
|
||||
|
||||
document.getElementById("edit_prix").value = detail.Prix_brut;
|
||||
|
||||
document.getElementById("edit_frais_broker").value =
|
||||
detail.Frais_brocker || 0;
|
||||
document.getElementById("edit_frais_etat").value =
|
||||
detail.Frais_etat || 0;
|
||||
document.getElementById("edit_frais_autre").value =
|
||||
detail.Frais_autre || 0;
|
||||
document.getElementById("edit_ordre").value = detail.Ordre;
|
||||
modal.showModal();
|
||||
}
|
||||
}
|
||||
|
||||
document.getElementById("edit_frais_etat").value = detail.Frais_etat || 0;
|
||||
|
||||
document.getElementById("edit_frais_autre").value = detail.Frais_autre || 0;
|
||||
|
||||
document.getElementById("edit_type").value = (
|
||||
detail.Type || ""
|
||||
).toLowerCase();
|
||||
|
||||
document.getElementById("edit_etat").value = (
|
||||
detail.Etat || ""
|
||||
).toLowerCase();
|
||||
|
||||
document.getElementById("edit_ordre").value = (
|
||||
detail.Ordre || ""
|
||||
).toLowerCase();
|
||||
|
||||
openModal(modal);
|
||||
});
|
||||
|
||||
// Soumission Modification
|
||||
const formModif = document.getElementById("formModifierDetail");
|
||||
formModif?.addEventListener("submit", async (e) => {
|
||||
// =====================================================
|
||||
// ENREGISTREMENT MODIFICATION
|
||||
// =====================================================
|
||||
|
||||
document
|
||||
.getElementById("formModifierDetail")
|
||||
?.addEventListener("submit", async (e) => {
|
||||
e.preventDefault();
|
||||
|
||||
const response = await fetch("/php/api_modifier_detail.php", {
|
||||
method: "POST",
|
||||
|
||||
body: new FormData(e.target),
|
||||
});
|
||||
|
||||
const result = await response.json();
|
||||
|
||||
if (result.success) {
|
||||
location.reload();
|
||||
} else {
|
||||
alert("Erreur : " + result.message);
|
||||
}
|
||||
});
|
||||
|
||||
//fermer la popup en cliquant à côté
|
||||
document.querySelectorAll("dialog").forEach((dialog) => {
|
||||
dialog.addEventListener("click", (e) => {
|
||||
const rect = dialog.getBoundingClientRect();
|
||||
|
||||
const inside =
|
||||
e.clientX >= rect.left &&
|
||||
e.clientX <= rect.right &&
|
||||
e.clientY >= rect.top &&
|
||||
e.clientY <= rect.bottom;
|
||||
|
||||
if (!inside) {
|
||||
dialog.close();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
+220
@@ -0,0 +1,220 @@
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
// =====================================================
|
||||
// OUTILS MODALES
|
||||
// =====================================================
|
||||
|
||||
function openModal(modal) {
|
||||
if (!modal) return;
|
||||
|
||||
modal.showModal();
|
||||
|
||||
// Force le centrage avec le CSS dialog
|
||||
modal.style.transform = "translate(-50%, -50%)";
|
||||
}
|
||||
|
||||
function closeModal(modal) {
|
||||
if (!modal) return;
|
||||
modal.close();
|
||||
modal.style.transform = "";
|
||||
}
|
||||
|
||||
// Fermeture par clic en dehors de la fenêtre
|
||||
document.querySelectorAll("dialog").forEach((dialog) => {
|
||||
dialog.addEventListener("click", (e) => {
|
||||
const rect = dialog.getBoundingClientRect();
|
||||
|
||||
const inside =
|
||||
e.clientX >= rect.left &&
|
||||
e.clientX <= rect.right &&
|
||||
e.clientY >= rect.top &&
|
||||
e.clientY <= rect.bottom;
|
||||
|
||||
if (!inside) {
|
||||
closeModal(dialog);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// =====================================================
|
||||
// MODAL CREATION ORDRE
|
||||
// =====================================================
|
||||
|
||||
const modalCreerOrdre = document.getElementById("modalCreerOrdre");
|
||||
|
||||
const btnCreer = document.querySelector(".ordrejfg-btn-creer");
|
||||
|
||||
if (modalCreerOrdre && btnCreer) {
|
||||
btnCreer.addEventListener("click", () => {
|
||||
openModal(modalCreerOrdre);
|
||||
});
|
||||
|
||||
document.getElementById("btnAnnuler")?.addEventListener("click", () => {
|
||||
document.getElementById("formCreerOrdre")?.reset();
|
||||
|
||||
closeModal(modalCreerOrdre);
|
||||
|
||||
const btnValider = document.getElementById("btnValider");
|
||||
|
||||
if (btnValider) {
|
||||
btnValider.disabled = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// =====================================================
|
||||
// RECHERCHE ACTION
|
||||
// =====================================================
|
||||
|
||||
const btnRechercher = document.getElementById("btnRechercher");
|
||||
|
||||
btnRechercher?.addEventListener("click", async () => {
|
||||
const isin = document.getElementById("isinRecherche").value;
|
||||
|
||||
if (!isin) {
|
||||
alert("Veuillez entrer un code ISIN");
|
||||
return;
|
||||
}
|
||||
|
||||
const response = await fetch(
|
||||
`/php/api_rechercher_action_jfg.php?isin=${encodeURIComponent(isin)}`,
|
||||
);
|
||||
|
||||
const data = await response.json();
|
||||
|
||||
if (data.success) {
|
||||
document.getElementById("Nom").value = data.company_name;
|
||||
|
||||
document.getElementById("ticker").value = data.ticker;
|
||||
|
||||
document.getElementById("code_yahoo").value = data.yahoo_code;
|
||||
|
||||
document.getElementById("btnValider").disabled = false;
|
||||
} else {
|
||||
alert("Action non trouvée");
|
||||
}
|
||||
});
|
||||
|
||||
// =====================================================
|
||||
// ENREGISTREMENT ORDRE
|
||||
// =====================================================
|
||||
|
||||
document
|
||||
.getElementById("formCreerOrdre")
|
||||
?.addEventListener("submit", async (e) => {
|
||||
e.preventDefault();
|
||||
|
||||
const formData = new FormData(e.target);
|
||||
|
||||
const response = await fetch("/php/api_enregistrer_ordre_jfg.php", {
|
||||
method: "POST",
|
||||
body: formData,
|
||||
});
|
||||
|
||||
const result = await response.json();
|
||||
|
||||
if (result.success) {
|
||||
location.reload();
|
||||
} else {
|
||||
alert(
|
||||
"Erreur lors de l'enregistrement : " +
|
||||
(result.message || "Erreur inconnue"),
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
// =====================================================
|
||||
// ENREGISTREMENT DETAIL
|
||||
// =====================================================
|
||||
|
||||
document
|
||||
.getElementById("formCreerDetail")
|
||||
?.addEventListener("submit", async (e) => {
|
||||
e.preventDefault();
|
||||
|
||||
const response = await fetch("/php/api_enregistrer_detail_jfg.php", {
|
||||
method: "POST",
|
||||
body: new FormData(e.target),
|
||||
});
|
||||
|
||||
const result = await response.json();
|
||||
|
||||
if (result.success) {
|
||||
location.reload();
|
||||
} else {
|
||||
alert(
|
||||
"Erreur lors de l'enregistrement du détail : " +
|
||||
(result.message || ""),
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
// =====================================================
|
||||
// MODIFICATION DETAIL
|
||||
// =====================================================
|
||||
|
||||
document.addEventListener("click", (e) => {
|
||||
const button = e.target.closest(".ordrejfg-btn-modifier-petit");
|
||||
|
||||
if (!button) return;
|
||||
|
||||
const detail = JSON.parse(button.getAttribute("data-detail"));
|
||||
|
||||
const modal = document.getElementById("modalModifierDetail");
|
||||
|
||||
if (!modal) return;
|
||||
|
||||
document.getElementById("edit_id").value = detail.Id;
|
||||
|
||||
document.getElementById("edit_Id_entete").value = detail.Id_entete;
|
||||
|
||||
document.getElementById("edit_date").value = detail.Date_op;
|
||||
|
||||
document.getElementById("edit_quantite").value = detail.Quantite;
|
||||
|
||||
document.getElementById("edit_prix").value = detail.Prix_brut;
|
||||
|
||||
document.getElementById("edit_frais_broker").value =
|
||||
detail.Frais_brocker || 0;
|
||||
|
||||
document.getElementById("edit_frais_etat").value = detail.Frais_etat || 0;
|
||||
|
||||
document.getElementById("edit_frais_autre").value = detail.Frais_autre || 0;
|
||||
|
||||
document.getElementById("edit_type").value = (
|
||||
detail.Type || ""
|
||||
).toLowerCase();
|
||||
|
||||
document.getElementById("edit_etat").value = (
|
||||
detail.Etat || ""
|
||||
).toLowerCase();
|
||||
|
||||
document.getElementById("edit_ordre").value = (
|
||||
detail.Ordre || ""
|
||||
).toLowerCase();
|
||||
|
||||
openModal(modal);
|
||||
});
|
||||
|
||||
// =====================================================
|
||||
// ENREGISTREMENT MODIFICATION
|
||||
// =====================================================
|
||||
|
||||
document
|
||||
.getElementById("formModifierDetail")
|
||||
?.addEventListener("submit", async (e) => {
|
||||
e.preventDefault();
|
||||
|
||||
const response = await fetch("/php/api_modifier_detail_jfg.php", {
|
||||
method: "POST",
|
||||
body: new FormData(e.target),
|
||||
});
|
||||
|
||||
const result = await response.json();
|
||||
|
||||
if (result.success) {
|
||||
location.reload();
|
||||
} else {
|
||||
alert("Erreur : " + result.message);
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
ini_set('display_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
|
||||
require_once __DIR__ . '/db.php';
|
||||
$db = (new App\Database\Database())->getConnection();
|
||||
|
||||
// Insertion dans la table ordreJFG_pied
|
||||
$sql = "INSERT INTO ordreJFG_pied (Id_entete, Date_op, Quantite, Prix_brut, Frais_brocker, Frais_etat, Frais_autre, Ordre, Type, Etat)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
|
||||
|
||||
$stmt = $db->prepare($sql);
|
||||
|
||||
$success = $stmt->execute([
|
||||
$_POST['Id_entete'],
|
||||
$_POST['Date_op'],
|
||||
$_POST['Quantite'],
|
||||
$_POST['Prix_brut'],
|
||||
$_POST['Frais_brocker'],
|
||||
$_POST['Frais_etat'],
|
||||
$_POST['Frais_autre'],
|
||||
$_POST['Ordre'],
|
||||
$_POST['Type'],
|
||||
$_POST['Etat']
|
||||
]);
|
||||
|
||||
echo json_encode(['success' => $success]);
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
ini_set('display_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
|
||||
require_once __DIR__ . '/db.php';
|
||||
$db = (new App\Database\Database())->getConnection();
|
||||
|
||||
// Insertion dans la table ordreJFG
|
||||
$stmt = $db->prepare("INSERT INTO ordreJFG (isin, Nom, ticker, code_yahoo) VALUES (?, ?, ?, ?)");
|
||||
$success = $stmt->execute([$_POST['isin'], $_POST['Nom'], $_POST['ticker'], $_POST['code_yahoo']]);
|
||||
|
||||
echo json_encode(['success' => $success]);
|
||||
@@ -16,10 +16,13 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
Frais_brocker = :f_b,
|
||||
Frais_etat = :f_e,
|
||||
Frais_autre = :f_a,
|
||||
Ordre = :ordre
|
||||
Ordre = :ordre,
|
||||
Type = :type,
|
||||
Etat = :etat
|
||||
WHERE Id = :id";
|
||||
|
||||
$stmt = $db->prepare($sql);
|
||||
|
||||
$stmt->execute([
|
||||
':date' => $_POST['Date_op'],
|
||||
':qte' => $_POST['Quantite'],
|
||||
@@ -28,11 +31,16 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
':f_e' => $_POST['Frais_etat'],
|
||||
':f_a' => $_POST['Frais_autre'],
|
||||
':ordre' => $_POST['Ordre'],
|
||||
':type' => $_POST['Type'],
|
||||
':etat' => $_POST['Etat'],
|
||||
':id' => $_POST['id']
|
||||
]);
|
||||
|
||||
echo json_encode(['success' => true]);
|
||||
} catch (Exception $e) {
|
||||
echo json_encode(['success' => false, 'message' => $e->getMessage()]);
|
||||
echo json_encode([
|
||||
'success' => false,
|
||||
'message' => $e->getMessage()
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
require_once __DIR__ . '/db.php';
|
||||
|
||||
header('Content-Type: application/json');
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
try {
|
||||
$db = (new App\Database\Database())->getConnection();
|
||||
|
||||
// Mise à jour de la table ordreJFG_pied
|
||||
$sql = "UPDATE ordreJFG_pied SET
|
||||
Date_op = :date,
|
||||
Quantite = :qte,
|
||||
Prix_brut = :prix,
|
||||
Frais_brocker = :f_b,
|
||||
Frais_etat = :f_e,
|
||||
Frais_autre = :f_a,
|
||||
Ordre = :ordre,
|
||||
Type = :type,
|
||||
Etat = :etat
|
||||
WHERE Id = :id";
|
||||
|
||||
$stmt = $db->prepare($sql);
|
||||
|
||||
$stmt->execute([
|
||||
':date' => $_POST['Date_op'],
|
||||
':qte' => $_POST['Quantite'],
|
||||
':prix' => $_POST['Prix_brut'],
|
||||
':f_b' => $_POST['Frais_brocker'],
|
||||
':f_e' => $_POST['Frais_etat'],
|
||||
':f_a' => $_POST['Frais_autre'],
|
||||
':ordre' => $_POST['Ordre'],
|
||||
':type' => $_POST['Type'],
|
||||
':etat' => $_POST['Etat'],
|
||||
':id' => $_POST['id']
|
||||
]);
|
||||
|
||||
echo json_encode(['success' => true]);
|
||||
} catch (Exception $e) {
|
||||
echo json_encode([
|
||||
'success' => false,
|
||||
'message' => $e->getMessage()
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,7 @@ $nom = $_POST['nom'];
|
||||
$ticker = $_POST['ticker'];
|
||||
|
||||
try {
|
||||
$stmt = $db->prepare("UPDATE ordres SET nom = ?, ticker = ? WHERE id = ?");
|
||||
$stmt = $db->prepare("UPDATE ordreGF SET nom = ?, ticker = ? WHERE id = ?");
|
||||
$stmt->execute([$nom, $ticker, $id]);
|
||||
|
||||
echo json_encode(['success' => true]);
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/db.php';
|
||||
header('Content-Type: application/json');
|
||||
|
||||
$db = (new App\Database\Database())->getConnection();
|
||||
|
||||
// Récupération des données POST
|
||||
$id = $_POST['id'];
|
||||
$nom = $_POST['nom'];
|
||||
$ticker = $_POST['ticker'];
|
||||
|
||||
try {
|
||||
// Mise à jour de la table ordreJFG
|
||||
$stmt = $db->prepare("UPDATE ordreJFG SET Nom = ?, ticker = ? WHERE ID = ?");
|
||||
$stmt->execute([$nom, $ticker, $id]);
|
||||
|
||||
echo json_encode(['success' => true]);
|
||||
} catch (Exception $e) {
|
||||
echo json_encode(['success' => false, 'message' => $e->getMessage()]);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/db.php';
|
||||
|
||||
$isin = $_GET['isin'] ?? '';
|
||||
$db = (new App\Database\Database())->getConnection();
|
||||
|
||||
// Si vous avez aussi une table actions_jfg spécifique, remplacez 'actions' par 'actions_jfg'
|
||||
$stmt = $db->prepare("SELECT * FROM actions WHERE isin = ?");
|
||||
$stmt->execute([$isin]);
|
||||
$action = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
echo json_encode($action ? ['success' => true, ...$action] : ['success' => false]);
|
||||
+14
-1
@@ -1,9 +1,22 @@
|
||||
</main>
|
||||
<footer class="footer">
|
||||
<!-- 1. Les horloges en premier (elles seront à gauche) -->
|
||||
<div id="market-clocks">
|
||||
<div id="paris-clock">Paris : --:--:--</div>
|
||||
<div id="ny-clock">New-York : --:--:--</div>
|
||||
</div>
|
||||
|
||||
<!-- 2. Le texte au milieu -->
|
||||
<p>© 2026 - Jean-François GIRAUD - Positions en bourse - Tous droits réservés</p>
|
||||
|
||||
<!-- 3. Le bouton tout à droite (grâce à la classe footer-logout) -->
|
||||
<?php if (isset($_SESSION['user_id'])): ?>
|
||||
<a class="logout-button footer-logout" href="/php/logout.php">Se déconnecter</a>
|
||||
<?php endif; ?>
|
||||
<p>© 2026 - Jean-François GIRAUD - Positions en bourse - Tous droits réservés</p>
|
||||
|
||||
<!-- Appel du script JS (placé à la fin) -->
|
||||
<script src="/js/footer.js"></script>
|
||||
</footer>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
+1
-2
@@ -36,7 +36,7 @@ require_once __DIR__ . '/header.php';
|
||||
<span class="menu-button__icon">⇄</span>
|
||||
</button>
|
||||
|
||||
<button type="button" class="menu-button" data-target="/php/order_jfg.php">
|
||||
<button type="button" class="menu-button" data-target="/php/ordreJFG.php">
|
||||
<div class="menu-button__content">
|
||||
<span class="menu-button__title">Ordre JFG</span>
|
||||
<span class="menu-button__text">Voir et modifier les ordres JFG</span>
|
||||
@@ -84,4 +84,3 @@ require_once __DIR__ . '/header.php';
|
||||
<script src="/js/menu.js" defer></script>
|
||||
|
||||
<?php require_once __DIR__ . '/footer.php'; ?>
|
||||
|
||||
|
||||
+147
-116
@@ -9,9 +9,12 @@ if (empty($_SESSION['user_id'])) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/*A supprimer quand la page fonctionnera correctement*/
|
||||
ini_set('display_errors', 1);
|
||||
ini_set('display_startup_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
/**************************************************** */
|
||||
|
||||
|
||||
|
||||
$pageStylesheets = ['/css/ordreGF.css'];
|
||||
$bodyClass = 'ordregf-page';
|
||||
@@ -19,11 +22,9 @@ $bodyClass = 'ordregf-page';
|
||||
$database = new App\Database\Database();
|
||||
$connection = $database->getConnection();
|
||||
|
||||
// --- Fonctions ---
|
||||
function fetchOrdreGF(PDO $connection): array
|
||||
{
|
||||
$query = 'SELECT * FROM `ordreGF` ORDER BY `ID` DESC';
|
||||
$stmt = $connection->query($query);
|
||||
$stmt = $connection->query('SELECT * FROM `ordreGF` ORDER BY `ID` DESC');
|
||||
return $stmt->fetchAll(PDO::FETCH_ASSOC) ?: [];
|
||||
}
|
||||
|
||||
@@ -38,18 +39,14 @@ $ordres = fetchOrdreGF($connection);
|
||||
|
||||
require_once __DIR__ . '/header.php';
|
||||
?>
|
||||
|
||||
<section class="ordregf-shell">
|
||||
<div class="ordregf-card">
|
||||
<header class="ordregf-card-header" style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 28px;">
|
||||
<h1 class="ordregf-title">Gestion des ordres GF</h1>
|
||||
|
||||
<div style="display: flex; gap: 10px;">
|
||||
<button type="button" class="ordregf-btn-creer" onclick="document.getElementById('modalCreerOrdre').showModal();">
|
||||
Créer un ordre
|
||||
</button>
|
||||
<button type="button" class="ordregf-btn-menu" onclick="window.location.href='/php/menu.php';">
|
||||
Retour au menu
|
||||
</button>
|
||||
<button type="button" class="ordregf-btn-creer" onclick="document.getElementById('modalCreerOrdre').showModal();">Créer un ordre</button>
|
||||
<button type="button" class="ordregf-btn-menu" onclick="window.location.href='/php/menu.php';">Retour au menu</button>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
@@ -58,21 +55,89 @@ require_once __DIR__ . '/header.php';
|
||||
<tbody>
|
||||
<?php foreach ($ordres as $ordre): ?>
|
||||
<?php
|
||||
// Pré-calcul pour les boutons
|
||||
$details = fetchOrdreGFPied($connection, (string)$ordre['ID']);
|
||||
$totalQ = 0;
|
||||
|
||||
// Détection d'un ordre annulé
|
||||
$isCanceled = false;
|
||||
|
||||
foreach ($details as $d) {
|
||||
if (strtolower($d['Etat'] ?? '') === 'annulé') {
|
||||
$isCanceled = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 1. Calcul du total des quantités actives
|
||||
foreach ($details as $d) {
|
||||
if (strtolower($d['Etat'] ?? '') === 'actif') {
|
||||
$q = (int)($d['Quantite'] ?? 0);
|
||||
$oType = strtolower($d['Ordre'] ?? '');
|
||||
$tOp = strtolower($d['Type'] ?? '');
|
||||
if (strtolower($d['Etat'] ?? '') === 'actif') {
|
||||
$totalQ += ($tOp === 'long' ? ($oType === 'achat' ? $q : -$q) : ($oType === 'achat' ? -$q : $q));
|
||||
$signe = ($tOp === 'long') ? ($oType === 'achat' ? 1 : -1) : ($oType === 'achat' ? -1 : 1);
|
||||
$totalQ += ($q * $signe);
|
||||
}
|
||||
}
|
||||
$isSold = ($totalQ === 0 && count($details) > 0);
|
||||
// Désactiver si vendu OU si une plus-value existe déjà
|
||||
$isDisabled = $isSold || (isset($ordre['PlusValue']) && (float)$ordre['PlusValue'] !== 0.0);
|
||||
$disabledAttr = $isDisabled ? 'disabled style="opacity:0.5; cursor:not-allowed;"' : '';
|
||||
|
||||
|
||||
// 2. Calcul Plus-Value et Mise à jour statut
|
||||
$plusvalue = 0.0000;
|
||||
|
||||
if ($isCanceled) {
|
||||
$plusvalue = 0;
|
||||
|
||||
if ((float)$ordre['PlusValue'] != 0) {
|
||||
$connection->prepare(
|
||||
"UPDATE ordreGF SET PlusValue = 0 WHERE ID = ?"
|
||||
)->execute([$ordre['ID']]);
|
||||
|
||||
$ordre['PlusValue'] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$isSold = (!$isCanceled && $totalQ === 0 && count($details) > 0);
|
||||
|
||||
if ($isSold) {
|
||||
foreach ($details as $detail) {
|
||||
$qte = (int)$detail['Quantite'];
|
||||
$fraisDetail = (float)$detail['Frais_brocker'] + (float)$detail['Frais_etat'] + (float)$detail['Frais_autre'];
|
||||
$oType = strtolower($detail['Ordre']);
|
||||
$prixNet = ($oType === 'vente') ? (float)$detail['Prix_brut'] - $fraisDetail : (float)$detail['Prix_brut'] + $fraisDetail;
|
||||
$tOp = strtolower($detail['Type']);
|
||||
$signePV = ($oType === 'vente') ? 1 : -1;
|
||||
$plusvalue += ($qte * $prixNet * $signePV);
|
||||
}
|
||||
$plusvalue = round($plusvalue, 4);
|
||||
|
||||
// Mise à jour de la plus-value uniquement si nécessaire
|
||||
if (abs((float)$ordre['PlusValue'] - $plusvalue) > 0.0001) {
|
||||
$connection->prepare(
|
||||
"UPDATE ordreGF SET PlusValue = ? WHERE ID = ?"
|
||||
)->execute([$plusvalue, $ordre['ID']]);
|
||||
|
||||
$ordre['PlusValue'] = $plusvalue;
|
||||
}
|
||||
|
||||
// Si la quantité totale est à zéro, toutes les lignes actives passent en soldé
|
||||
$connection->prepare(
|
||||
"UPDATE ordreGF_pied
|
||||
SET Etat = 'soldé'
|
||||
WHERE Id_entete = ?
|
||||
AND Etat = 'actif'"
|
||||
)->execute([$ordre['ID']]);
|
||||
|
||||
// Recharge les données après modification
|
||||
$details = fetchOrdreGFPied($connection, (string)$ordre['ID']);
|
||||
}
|
||||
|
||||
// Désactivation si ordre soldé ou annulé
|
||||
$isDisabled = $isCanceled || abs((float)$ordre['PlusValue']) > 0.0001;
|
||||
|
||||
$disabledAttr = $isDisabled
|
||||
? 'disabled style="opacity:0.5; cursor:not-allowed;"'
|
||||
: '';
|
||||
?>
|
||||
|
||||
<tr class="ordregf-master-row ordregf-header-style">
|
||||
@@ -91,103 +156,50 @@ require_once __DIR__ . '/header.php';
|
||||
<th>Prix Brut</th>
|
||||
<th>Frais</th>
|
||||
<th>Prix Net</th>
|
||||
<th>Engagement Brut</th>
|
||||
<th>Engagement Net</th>
|
||||
<th>Eng. Brut</th>
|
||||
<th>Eng. Net</th>
|
||||
<th>Ordre</th>
|
||||
<th>Type</th>
|
||||
<th>Etat</th>
|
||||
<th style="text-align: right;">
|
||||
<button type="button" class="ordregf-btn-petit ordregf-btn-creer-petit"
|
||||
<?= $disabledAttr ?>
|
||||
onclick="document.getElementById('Id_entete_detail').value='<?= $ordre['ID'] ?>'; document.getElementById('modalCreerDetail').showModal();">
|
||||
Créer
|
||||
</button>
|
||||
</th>
|
||||
<th style="text-align: right;"><button type="button" class="ordregf-btn-creer-petit ordregf-btn-petit" <?= $disabledAttr ?> onclick="document.getElementById('Id_entete_detail').value='<?= $ordre['ID'] ?>'; document.getElementById('modalCreerDetail').showModal();">Créer</button></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$engaBrut = 0;
|
||||
$engaNet = 0;
|
||||
|
||||
foreach ($details as $detail):
|
||||
$qte = (int)($detail['Quantite'] ?? 0);
|
||||
$prix = (float)($detail['Prix_brut'] ?? 0);
|
||||
$frais = (float)($detail['Frais_brocker'] ?? 0) + (float)($detail['Frais_etat'] ?? 0) + (float)($detail['Frais_autre'] ?? 0);
|
||||
$prixNet = $prix + $frais;
|
||||
$ordreType = strtolower($detail['Ordre'] ?? '');
|
||||
$prixNet = ($ordreType === 'vente') ? $prix - $frais : $prix + $frais;
|
||||
$date = !empty($detail['Date_op']) ? date('d/m/Y', strtotime($detail['Date_op'])) : '--/--/----';
|
||||
|
||||
$ordre_type = strtolower($detail['Ordre'] ?? '');
|
||||
$type_op = strtolower($detail['Type'] ?? '');
|
||||
$etat = strtolower($detail['Etat'] ?? '');
|
||||
|
||||
if ($etat === 'actif') {
|
||||
if ($type_op === 'long') {
|
||||
if ($ordre_type === 'achat') {
|
||||
$engaBrut += $qte * $prix;
|
||||
$engaNet += $qte * $prixNet;
|
||||
} else {
|
||||
$engaBrut -= $qte * $prix;
|
||||
$engaNet -= $qte * $prixNet;
|
||||
}
|
||||
} elseif ($type_op === 'short') {
|
||||
if ($ordre_type === 'achat') {
|
||||
$engaBrut -= $qte * $prix;
|
||||
$engaNet -= $qte * $prixNet;
|
||||
} else {
|
||||
$engaBrut += $qte * $prix;
|
||||
$engaNet += $qte * $prixNet;
|
||||
}
|
||||
}
|
||||
if (strtolower($detail['Etat'] ?? '') === 'actif') {
|
||||
$mult = (strtolower($detail['Type'] ?? '') === 'long' ? 1 : -1) * (strtolower($detail['Ordre'] ?? '') === 'achat' ? 1 : -1);
|
||||
$engaBrut += ($qte * $prix) * $mult;
|
||||
$engaNet += ($qte * $prixNet) * $mult;
|
||||
}
|
||||
?>
|
||||
<tr class="ordregf-detail-row">
|
||||
<tr>
|
||||
<td><?= htmlspecialchars($date) ?></td>
|
||||
<td class="text-right"><?= number_format($qte, 0, ',', ' ') ?></td>
|
||||
<td class="text-right"><?= $qte ?></td>
|
||||
<td class="text-right"><?= number_format($prix, 3, ',', ' ') ?></td>
|
||||
<td class="text-right"><?= number_format($frais, 3, ',', ' ') ?></td>
|
||||
<td class="text-right"><?= number_format($prixNet, 3, ',', ' ') ?></td>
|
||||
<td class="text-right"><?= number_format($qte * $prix, 3, ',', ' ') ?></td>
|
||||
<td class="text-right"><?= number_format($qte * $prixNet, 3, ',', ' ') ?></td>
|
||||
<td><?= htmlspecialchars($detail['Ordre'] ?? '') ?></td>
|
||||
<td><?= htmlspecialchars($detail['Type'] ?? '') ?></td>
|
||||
<td><?= htmlspecialchars($detail['Etat'] ?? '') ?></td>
|
||||
<td style="text-align: right;">
|
||||
<button type="button" class="ordregf-btn-petit ordregf-btn-modifier-petit"
|
||||
<?= $disabledAttr ?>
|
||||
data-detail='<?= htmlspecialchars(json_encode($detail), ENT_QUOTES, 'UTF-8') ?>'>
|
||||
Modifier
|
||||
</button>
|
||||
</td>
|
||||
<td style="text-align: center"><?= htmlspecialchars($detail['Ordre'] ?? '') ?></td>
|
||||
<td style="text-align: center"><?= htmlspecialchars($detail['Type'] ?? '') ?></td>
|
||||
<td style="text-align: center"><?= htmlspecialchars($detail['Etat'] ?? '') ?></td>
|
||||
<td style="text-align: center"><button type=" button" class="ordregf-btn-petit ordregf-btn-modifier-petit" <?= $disabledAttr ?> data-detail='<?= htmlspecialchars(json_encode($detail), ENT_QUOTES, 'UTF-8') ?>'>Modifier</button></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
|
||||
<?php
|
||||
$plusvalue = 0.0000;
|
||||
if ($isSold) {
|
||||
foreach ($details as $detail) {
|
||||
$qte = (int)$detail['Quantite'];
|
||||
$prixNet = (float)$detail['Prix_brut'] + (float)$detail['Frais_brocker'] + (float)$detail['Frais_etat'] + (float)$detail['Frais_autre'];
|
||||
$eNet = round($qte * $prixNet, 4);
|
||||
$oType = strtolower($detail['Ordre']);
|
||||
$tOp = strtolower($detail['Type']);
|
||||
$signe = ($tOp === 'long') ? (($oType === 'vente') ? 1 : -1) : (($oType === 'achat') ? 1 : -1);
|
||||
$plusvalue += ($eNet * $signe);
|
||||
}
|
||||
$plusvalue = round($plusvalue, 4);
|
||||
if (abs((float)$ordre['PlusValue'] - $plusvalue) > 0.0001) {
|
||||
$connection->prepare("UPDATE ordreGF SET PlusValue = ? WHERE ID = ?")->execute([$plusvalue, $ordre['ID']]);
|
||||
$connection->prepare("UPDATE ordreGF_pied SET Etat = 'soldé' WHERE Id_entete = ? AND Etat != 'soldé'")->execute([$ordre['ID']]);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<?php if ($isSold): ?>
|
||||
<?php if ($isDisabled): ?>
|
||||
<tr style="background-color: rgba(255, 255, 255, 0.08); font-weight: bold;">
|
||||
<td colspan="6" style="text-align: right;">Plus value :</td>
|
||||
<td class="text-right" style="color: <?= $plusvalue < 0 ? 'red' : 'green' ?>;">
|
||||
<?= number_format((float)($ordre['PlusValue'] ?: $plusvalue), 3, ',', ' ') ?>
|
||||
</td>
|
||||
<td style="color: <?= (float)$ordre['PlusValue'] < 0 ? 'red' : 'green' ?>;"><?= number_format((float)$ordre['PlusValue'], 3, ',', ' ') ?></td>
|
||||
<td colspan="4"></td>
|
||||
</tr>
|
||||
<?php else: ?>
|
||||
@@ -224,20 +236,20 @@ require_once __DIR__ . '/header.php';
|
||||
<form id="formCreerOrdre">
|
||||
<h2>Créer un nouvel ordre</h2>
|
||||
<div class="form-group">
|
||||
<label>ISIN :</label><br>
|
||||
<label>ISIN</label>
|
||||
<input type="text" id="isinRecherche" name="isin" required>
|
||||
<button type="button" id="btnRechercher">Rechercher</button>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Nom :</label><br>
|
||||
<label>Nom :</label>
|
||||
<input type="text" name="Nom" id="Nom" readonly>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Ticker :</label><br>
|
||||
<label>Ticker :</label>
|
||||
<input type="text" name="ticker" id="ticker" readonly>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Code Yahoo :</label><br>
|
||||
<label>Code Yahoo :</label>
|
||||
<input type="text" name="code_yahoo" id="code_yahoo" readonly>
|
||||
</div>
|
||||
<div class="modal-actions" style="margin-top: 20px;">
|
||||
@@ -252,42 +264,44 @@ require_once __DIR__ . '/header.php';
|
||||
<input type="hidden" name="Id_entete" id="Id_entete_detail">
|
||||
<h2>Ajouter un mouvement</h2>
|
||||
<div class="form-group">
|
||||
<label>Date :</label><br>
|
||||
<label>Date :</label>
|
||||
<input type="date" name="Date_op" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Quantité :</label><br>
|
||||
<label>Quantité :</label>
|
||||
<input type="number" name="Quantite" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Prix Brut :</label><br>
|
||||
<input type="number" step="0.001" name="Prix_brut" required>
|
||||
<label>Prix Brut :</label>
|
||||
<input type="number" step="0.0001" name="Prix_brut" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Frais (Broker / Etat / Autre) :</label><br>
|
||||
<input type="number" step="0.01" name="Frais_brocker" placeholder="Broker">
|
||||
<input type="number" step="0.01" name="Frais_etat" placeholder="Etat">
|
||||
<input type="number" step="0.01" name="Frais_autre" placeholder="Autre">
|
||||
<label>Frais</label>
|
||||
<div class="triple">
|
||||
<input type="number" step="0.0001" name="Frais_brocker" placeholder="Broker">
|
||||
<input type="number" step="0.0001" name="Frais_etat" placeholder="État">
|
||||
<input type="number" step="0.0001" name="Frais_autre" placeholder="Autre">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Ordre (Achat/Vente) :</label>
|
||||
<select name="Ordre">
|
||||
<option value="Achat">Achat</option>
|
||||
<option value="Vente">Vente</option>
|
||||
<option value="achat">achat</option>
|
||||
<option value="vente">vente</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Type (Long/Short) :</label>
|
||||
<select name="Type">
|
||||
<option value="Long">Long</option>
|
||||
<option value="Short">Short</option>
|
||||
<option value="long">long</option>
|
||||
<option value="short">short</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Etat :</label>
|
||||
<select name="Etat">
|
||||
<option value="Actif">Actif</option>
|
||||
<option value="Cloture">Cloture</option>
|
||||
<option value="actif">actif</option>
|
||||
<option value="annulé">annulé</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="modal-actions" style="margin-top: 20px;">
|
||||
@@ -303,28 +317,45 @@ require_once __DIR__ . '/header.php';
|
||||
<input type="hidden" name="Id_entete" id="edit_Id_entete">
|
||||
<h2>Modifier le mouvement</h2>
|
||||
<div class="form-group">
|
||||
<label>Date :</label><br>
|
||||
<label>Date :</label>
|
||||
<input type="date" name="Date_op" id="edit_date" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Quantité :</label><br>
|
||||
<label>Quantité :</label>
|
||||
<input type="number" name="Quantite" id="edit_quantite" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Prix Brut :</label><br>
|
||||
<input type="number" step="0.001" name="Prix_brut" id="edit_prix" required>
|
||||
<label>Prix Brut :</label>
|
||||
<input type="number" step="0.0001" name="Prix_brut" id="edit_prix" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Frais :</label><br>
|
||||
<input type="number" step="0.01" name="Frais_brocker" id="edit_frais_broker" placeholder="Broker">
|
||||
<input type="number" step="0.01" name="Frais_etat" id="edit_frais_etat" placeholder="Etat">
|
||||
<input type="number" step="0.01" name="Frais_autre" id="edit_frais_autre" placeholder="Autre">
|
||||
<label>Frais</label>
|
||||
<div class="triple">
|
||||
<input type="number" step="0.0001" name="Frais_brocker" id="edit_frais_broker" placeholder="Broker">
|
||||
<input type="number" step="0.0001" name="Frais_etat" id="edit_frais_etat" placeholder="État">
|
||||
<input type="number" step="0.0001" name="Frais_autre" id="edit_frais_autre" placeholder="Autre">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Ordre :</label>
|
||||
<select name="Ordre" id="edit_ordre">
|
||||
<option value="Achat">Achat</option>
|
||||
<option value="Vente">Vente</option>
|
||||
<option value="achat">achat</option>
|
||||
<option value="vente">vente</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Type :</label>
|
||||
<select name="Type" id="edit_type">
|
||||
<option value="long">long</option>
|
||||
<option value="short">short</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Etat :</label>
|
||||
<select name="Etat" id="edit_etat">
|
||||
<option value="actif">actif</option>
|
||||
<option value="annulé">annulé</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="modal-actions" style="margin-top: 20px;">
|
||||
|
||||
@@ -0,0 +1,337 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
require_once __DIR__ . '/session.php';
|
||||
require_once __DIR__ . '/db.php';
|
||||
|
||||
if (empty($_SESSION['user_id'])) {
|
||||
header('Location: ../index.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
/*A supprimer quand la page fonctionnera correctement*/
|
||||
ini_set('display_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
/**************************************************** */
|
||||
|
||||
$pageStylesheets = ['/css/ordreJFG.css'];
|
||||
$bodyClass = 'ordrejfg-page';
|
||||
|
||||
$database = new App\Database\Database();
|
||||
$connection = $database->getConnection();
|
||||
|
||||
function fetchOrdreJFG(PDO $connection): array
|
||||
{
|
||||
$stmt = $connection->query('SELECT * FROM `ordreJFG` ORDER BY `ID` DESC');
|
||||
return $stmt->fetchAll(PDO::FETCH_ASSOC) ?: [];
|
||||
}
|
||||
|
||||
function fetchOrdreJFGPied(PDO $connection, string $masterId): array
|
||||
{
|
||||
$stmt = $connection->prepare('SELECT * FROM `ordreJFG_pied` WHERE `Id_entete` = :masterId ORDER BY `Id` ASC');
|
||||
$stmt->execute([':masterId' => $masterId]);
|
||||
return $stmt->fetchAll(PDO::FETCH_ASSOC) ?: [];
|
||||
}
|
||||
|
||||
$ordres = fetchOrdreJFG($connection);
|
||||
|
||||
require_once __DIR__ . '/header.php';
|
||||
?>
|
||||
|
||||
<section class="ordrejfg-shell">
|
||||
<div class="ordrejfg-card">
|
||||
<header class="ordrejfg-card-header" style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 28px;">
|
||||
<h1 class="ordrejfg-title">Gestion des ordres JFG</h1>
|
||||
<div style="display: flex; gap: 10px;">
|
||||
<button type="button" class="ordrejfg-btn-creer" onclick="document.getElementById('modalCreerOrdre').showModal();">Créer un ordre</button>
|
||||
<button type="button" class="ordrejfg-btn-menu" onclick="window.location.href='/php/menu.php';">Retour au menu</button>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div class="ordrejfg-table-wrapper">
|
||||
<table class="ordrejfg-table">
|
||||
<tbody>
|
||||
<?php foreach ($ordres as $ordre): ?>
|
||||
<?php
|
||||
$details = fetchOrdreJFGPied($connection, (string)$ordre['ID']);
|
||||
$totalQ = 0;
|
||||
|
||||
// Détection d'un ordre annulé
|
||||
$isCanceled = false;
|
||||
foreach ($details as $d) {
|
||||
if (strtolower($d['Etat'] ?? '') === 'annulé') {
|
||||
$isCanceled = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 1. Calcul du total des quantités actives
|
||||
foreach ($details as $d) {
|
||||
if (strtolower($d['Etat'] ?? '') === 'actif') {
|
||||
$q = (int)($d['Quantite'] ?? 0);
|
||||
$oType = strtolower($d['Ordre'] ?? '');
|
||||
$tOp = strtolower($d['Type'] ?? '');
|
||||
$signe = ($tOp === 'long') ? ($oType === 'achat' ? 1 : -1) : ($oType === 'achat' ? -1 : 1);
|
||||
$totalQ += ($q * $signe);
|
||||
}
|
||||
}
|
||||
|
||||
// 2. Calcul Plus-Value et Mise à jour statut
|
||||
$plusvalue = 0.0000;
|
||||
if ($isCanceled) {
|
||||
$plusvalue = 0;
|
||||
if ((float)$ordre['PlusValue'] != 0) {
|
||||
$connection->prepare("UPDATE ordreJFG SET PlusValue = 0 WHERE ID = ?")->execute([$ordre['ID']]);
|
||||
$ordre['PlusValue'] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
$isSold = (!$isCanceled && $totalQ === 0 && count($details) > 0);
|
||||
if ($isSold) {
|
||||
foreach ($details as $detail) {
|
||||
$qte = (int)$detail['Quantite'];
|
||||
$fraisDetail = (float)$detail['Frais_brocker'] + (float)$detail['Frais_etat'] + (float)$detail['Frais_autre'];
|
||||
$oType = strtolower($detail['Ordre']);
|
||||
$prixNet = ($oType === 'vente') ? (float)$detail['Prix_brut'] - $fraisDetail : (float)$detail['Prix_brut'] + $fraisDetail;
|
||||
$tOp = strtolower($detail['Type']);
|
||||
$signePV = ($oType === 'vente') ? 1 : -1;
|
||||
$plusvalue += ($qte * $prixNet * $signePV);
|
||||
}
|
||||
$plusvalue = round($plusvalue, 4);
|
||||
|
||||
if (abs((float)$ordre['PlusValue'] - $plusvalue) > 0.0001) {
|
||||
$connection->prepare("UPDATE ordreJFG SET PlusValue = ? WHERE ID = ?")->execute([$plusvalue, $ordre['ID']]);
|
||||
$ordre['PlusValue'] = $plusvalue;
|
||||
}
|
||||
|
||||
$connection->prepare("UPDATE ordreJFG_pied SET Etat = 'soldé' WHERE Id_entete = ? AND Etat = 'actif'")->execute([$ordre['ID']]);
|
||||
$details = fetchOrdreJFGPied($connection, (string)$ordre['ID']);
|
||||
}
|
||||
|
||||
$isDisabled = $isCanceled || abs((float)$ordre['PlusValue']) > 0.0001;
|
||||
$disabledAttr = $isDisabled ? 'disabled style="opacity:0.5; cursor:not-allowed;"' : '';
|
||||
?>
|
||||
|
||||
<tr class="ordrejfg-master-row ordrejfg-header-style">
|
||||
<td colspan="11" style="font-weight: bold; font-size: 1.1em; color: #fff;">
|
||||
<?php echo htmlspecialchars((string)$ordre['isin']) . ' --- ' . htmlspecialchars((string)$ordre['Nom']) . ' ( ' . htmlspecialchars((string)$ordre['ticker']) . ' )'; ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr class="ordrejfg-detail-block">
|
||||
<td colspan="11">
|
||||
<table class="ordrejfg-detail-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Qté</th>
|
||||
<th>Prix Brut</th>
|
||||
<th>Frais</th>
|
||||
<th>Prix Net</th>
|
||||
<th>Eng. Brut</th>
|
||||
<th>Eng. Net</th>
|
||||
<th>Ordre</th>
|
||||
<th>Type</th>
|
||||
<th>Etat</th>
|
||||
<th style="text-align: right;"><button type="button" class="ordrejfg-btn-creer-petit ordrejfg-btn-petit" <?= $disabledAttr ?> onclick="document.getElementById('Id_entete_detail').value='<?= $ordre['ID'] ?>'; document.getElementById('modalCreerDetail').showModal();">Créer</button></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$engaBrut = 0;
|
||||
$engaNet = 0;
|
||||
foreach ($details as $detail):
|
||||
$qte = (int)($detail['Quantite'] ?? 0);
|
||||
$prix = (float)($detail['Prix_brut'] ?? 0);
|
||||
$frais = (float)($detail['Frais_brocker'] ?? 0) + (float)($detail['Frais_etat'] ?? 0) + (float)($detail['Frais_autre'] ?? 0);
|
||||
$ordreType = strtolower($detail['Ordre'] ?? '');
|
||||
$prixNet = ($ordreType === 'vente') ? $prix - $frais : $prix + $frais;
|
||||
$date = !empty($detail['Date_op']) ? date('d/m/Y', strtotime($detail['Date_op'])) : '--/--/----';
|
||||
if (strtolower($detail['Etat'] ?? '') === 'actif') {
|
||||
$mult = (strtolower($detail['Type'] ?? '') === 'long' ? 1 : -1) * (strtolower($detail['Ordre'] ?? '') === 'achat' ? 1 : -1);
|
||||
$engaBrut += ($qte * $prix) * $mult;
|
||||
$engaNet += ($qte * $prixNet) * $mult;
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td><?= htmlspecialchars($date) ?></td>
|
||||
<td class="text-right"><?= $qte ?></td>
|
||||
<td class="text-right"><?= number_format($prix, 3, ',', ' ') ?></td>
|
||||
<td class="text-right"><?= number_format($frais, 3, ',', ' ') ?></td>
|
||||
<td class="text-right"><?= number_format($prixNet, 3, ',', ' ') ?></td>
|
||||
<td class="text-right"><?= number_format($qte * $prix, 3, ',', ' ') ?></td>
|
||||
<td class="text-right"><?= number_format($qte * $prixNet, 3, ',', ' ') ?></td>
|
||||
<td style="text-align: center"><?= htmlspecialchars($detail['Ordre'] ?? '') ?></td>
|
||||
<td style="text-align: center"><?= htmlspecialchars($detail['Type'] ?? '') ?></td>
|
||||
<td style="text-align: center"><?= htmlspecialchars($detail['Etat'] ?? '') ?></td>
|
||||
<td style="text-align: center"><button type="button" class="ordrejfg-btn-petit ordrejfg-btn-modifier-petit" <?= $disabledAttr ?> data-detail='<?= htmlspecialchars(json_encode($detail), ENT_QUOTES, 'UTF-8') ?>'>Modifier</button></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
|
||||
<tr style="background-color: rgba(255, 255, 255, 0.08); font-weight: bold;">
|
||||
<?php if ($isDisabled): ?>
|
||||
<td colspan="6" style="text-align: right;">Plus value :</td>
|
||||
<td style="color: <?= (float)$ordre['PlusValue'] < 0 ? 'red' : 'green' ?>;"><?= number_format((float)$ordre['PlusValue'], 3, ',', ' ') ?></td>
|
||||
<td colspan="4"></td>
|
||||
<?php else: ?>
|
||||
<td style="text-align: right;">TOTAL :</td>
|
||||
<td class="text-right"><?= number_format($totalQ, 0, ',', ' ') ?></td>
|
||||
<?php if ($totalQ == 0): ?>
|
||||
<td colspan="3" class="text-right">0</td>
|
||||
<?php else: ?>
|
||||
<td class="text-right"><?= number_format($engaBrut / $totalQ, 3, ',', ' ') ?></td>
|
||||
<td class="text-right"><?= number_format($engaNet / $totalQ - $engaBrut / $totalQ, 3, ',', ' ') ?></td>
|
||||
<td class="text-right"><?= number_format($engaNet / $totalQ, 3, ',', ' ') ?></td>
|
||||
<?php endif; ?>
|
||||
<td class="text-right"><?= number_format($engaBrut, 3, ',', ' ') ?></td>
|
||||
<td class="text-right"><?= number_format($engaNet, 3, ',', ' ') ?></td>
|
||||
<td colspan="4"></td>
|
||||
<?php endif; ?>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
<dialog id="modalCreerOrdre" class="ordrejfg-modal">
|
||||
<form id="formCreerOrdre">
|
||||
<h2>Créer un nouvel ordre</h2>
|
||||
<div class="form-group">
|
||||
<label>ISIN</label>
|
||||
<input type="text" id="isinRecherche" name="isin" required>
|
||||
<button type="button" id="btnRechercher">Rechercher</button>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Nom :</label>
|
||||
<input type="text" name="Nom" id="Nom" readonly>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Ticker :</label>
|
||||
<input type="text" name="ticker" id="ticker" readonly>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Code Yahoo :</label>
|
||||
<input type="text" name="code_yahoo" id="code_yahoo" readonly>
|
||||
</div>
|
||||
<div class="modal-actions" style="margin-top: 20px;">
|
||||
<button type="button" id="btnAnnuler">Annuler</button>
|
||||
<button type="submit" id="btnValider" disabled>Valider</button>
|
||||
</div>
|
||||
</form>
|
||||
</dialog>
|
||||
|
||||
<dialog id="modalCreerDetail" class="ordrejfg-modal">
|
||||
<form id="formCreerDetail">
|
||||
<input type="hidden" name="Id_entete" id="Id_entete_detail">
|
||||
<h2>Ajouter un mouvement</h2>
|
||||
<div class="form-group">
|
||||
<label>Date :</label>
|
||||
<input type="date" name="Date_op" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Quantité :</label>
|
||||
<input type="number" name="Quantite" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Prix Brut :</label>
|
||||
<input type="number" step="0.0001" name="Prix_brut" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Frais</label>
|
||||
<div class="triple">
|
||||
<input type="number" step="0.0001" name="Frais_brocker" placeholder="Broker">
|
||||
<input type="number" step="0.0001" name="Frais_etat" placeholder="État">
|
||||
<input type="number" step="0.0001" name="Frais_autre" placeholder="Autre">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Ordre (Achat/Vente) :</label>
|
||||
<select name="Ordre">
|
||||
<option value="achat">achat</option>
|
||||
<option value="vente">vente</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Type (Long/Short) :</label>
|
||||
<select name="Type">
|
||||
<option value="long">long</option>
|
||||
<option value="short">short</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Etat :</label>
|
||||
<select name="Etat">
|
||||
<option value="actif">actif</option>
|
||||
<option value="annulé">annulé</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="modal-actions" style="margin-top: 20px;">
|
||||
<button type="button" onclick="document.getElementById('modalCreerDetail').close()">Annuler</button>
|
||||
<button type="submit">Valider</button>
|
||||
</div>
|
||||
</form>
|
||||
</dialog>
|
||||
|
||||
<dialog id="modalModifierDetail" class="ordrejfg-modal">
|
||||
<form id="formModifierDetail">
|
||||
<input type="hidden" name="id" id="edit_id">
|
||||
<input type="hidden" name="Id_entete" id="edit_Id_entete">
|
||||
<h2>Modifier le mouvement</h2>
|
||||
<div class="form-group">
|
||||
<label>Date :</label>
|
||||
<input type="date" name="Date_op" id="edit_date" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Quantité :</label>
|
||||
<input type="number" name="Quantite" id="edit_quantite" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Prix Brut :</label>
|
||||
<input type="number" step="0.0001" name="Prix_brut" id="edit_prix" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Frais</label>
|
||||
<div class="triple">
|
||||
<input type="number" step="0.0001" name="Frais_brocker" id="edit_frais_broker" placeholder="Broker">
|
||||
<input type="number" step="0.0001" name="Frais_etat" id="edit_frais_etat" placeholder="État">
|
||||
<input type="number" step="0.0001" name="Frais_autre" id="edit_frais_autre" placeholder="Autre">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Ordre :</label>
|
||||
<select name="Ordre" id="edit_ordre">
|
||||
<option value="achat">achat</option>
|
||||
<option value="vente">vente</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Type :</label>
|
||||
<select name="Type" id="edit_type">
|
||||
<option value="long">long</option>
|
||||
<option value="short">short</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Etat :</label>
|
||||
<select name="Etat" id="edit_etat">
|
||||
<option value="actif">actif</option>
|
||||
<option value="annulé">annulé</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="modal-actions" style="margin-top: 20px;">
|
||||
<button type="button" onclick="document.getElementById('modalModifierDetail').close()">Annuler</button>
|
||||
<button type="submit">Enregistrer</button>
|
||||
</div>
|
||||
</form>
|
||||
</dialog>
|
||||
|
||||
<script src="/js/ordreJFG.js" defer></script>
|
||||
|
||||
<?php require_once __DIR__ . '/footer.php'; ?>
|
||||
Reference in New Issue
Block a user