diff --git a/modules/budget/budget.css b/modules/budget/budget.css index 1761df2..473a681 100644 --- a/modules/budget/budget.css +++ b/modules/budget/budget.css @@ -1016,3 +1016,98 @@ th.col-laia { align-items: center; } } + +/* ============================================================================ + 13. STYLES SPÉCIFIQUES AU SUIVI MENSUEL (suivi.php) + ============================================================================ */ + +.cat-card { + background: var(--bg-card); + border-radius: var(--radius-l); + border: 1px solid #e2e8f0; + display: flex; + flex-direction: column; + overflow: hidden; + position: relative; +} + +.btn-add-item { + background: rgba(255, 255, 255, 0.6); + color: inherit; + border: 1px solid rgba(0, 0, 0, 0.1); + width: 28px; + height: 28px; + border-radius: 50%; + font-size: 18px; + line-height: 1; + cursor: pointer; + display: flex; + align-items: center; + justify-content: center; + transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); +} + +.btn-add-item:hover { + background: var(--bg-card); + transform: rotate(90deg) scale(1.1); + box-shadow: var(--shadow-sm); + border-color: currentColor; +} + +.progress-grid { + display: grid; + grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); + gap: 20px; + margin-top: 20px; +} + +/* Animation "Charges à venir" */ +.fade-pulse { + animation: pulseText 2s infinite; +} +@keyframes pulseText { + 0% { + opacity: 0.8; + } + 50% { + opacity: 1; + } + 100% { + opacity: 0.8; + } +} + +/* Navigation par mois (Si elle n'est pas déjà gérée par .nav-group au-dessus) */ +.suivi-nav-group { + display: flex; + background: #e2e8f0; + border-radius: var(--radius-s); + overflow: hidden; +} +.suivi-btn-nav { + padding: 6px 12px; + color: var(--text-muted); + text-decoration: none; + font-size: 0.85rem; + font-weight: bold; + border-right: 1px solid #cbd5e1; + transition: + background 0.2s, + color 0.2s; +} +.suivi-btn-nav:last-child { + border-right: none; +} +.suivi-btn-nav:hover { + background: var(--bg-card); + color: var(--primary); +} + +/* Sélecteur dynamique de mois (dans l'import CSV) */ +input[type="month"].pf-input { + font-family: inherit; + color: var(--text-main); + background: white; + border: 1px solid #cbd5e1; + border-radius: var(--radius-s); +} diff --git a/modules/budget/includes/api/save-budget.php b/modules/budget/includes/api/save-budget.php index 05b2a4f..8975785 100644 --- a/modules/budget/includes/api/save-budget.php +++ b/modules/budget/includes/api/save-budget.php @@ -8,6 +8,38 @@ require_login(); $action = $_POST['action'] ?? ''; +// ================================================================= +// 7. SAUVEGARDE D'UNE NOTE GÉNÉRIQUE (pf_notes) +// ================================================================= +if ($action === 'save_note') { + // On affiche les erreurs s'il y a un souci SQL pour pouvoir déboguer + ini_set('display_errors', 1); + error_reporting(E_ALL); + header('Content-Type: application/json'); + + try { + $noteType = $_POST['note_type'] ?? ''; + $refId = $_POST['reference_id'] ?? ''; + $content = $_POST['content'] ?? ''; + + if (empty($noteType) || empty($refId)) { + throw new Exception("Le type et la référence de la note sont requis."); + } + + // Insère ou met à jour la note si elle existe déjà + $stmt = $pdo->prepare("INSERT INTO pf_notes (note_type, reference_id, content) + VALUES (?, ?, ?) + ON DUPLICATE KEY UPDATE content = VALUES(content)"); + $stmt->execute([$noteType, $refId, $content]); + + echo json_encode(['success' => true]); + } catch (\Throwable $e) { + echo json_encode(['success' => false, 'error' => 'Erreur SQL: ' . $e->getMessage()]); + } + exit; +} +// ================================================================= + // 1. MISE A JOUR TABLEAU SALAIRES (AJAX) if ($action === 'update_salary_config') { header('Content-Type: application/json'); // On précise JSON ici @@ -207,4 +239,6 @@ if ($action === 'validate_transfers') { echo json_encode(['success' => false, 'error' => $e->getMessage()]); } exit; + + } \ No newline at end of file diff --git a/modules/budget/views/budget_prev.php b/modules/budget/views/budget_prev.php index 2e551f5..3ff2a5e 100644 --- a/modules/budget/views/budget_prev.php +++ b/modules/budget/views/budget_prev.php @@ -69,6 +69,10 @@ if ($sysCatId && isset($allocs[$focusDate][$sysCatId])) { $isValidatedLaia = ($row['amount_laia'] == 1); } +$stmtNote = $pdo->prepare("SELECT content FROM pf_notes WHERE note_type = 'budget_prev' AND reference_id = ?"); +$stmtNote->execute([$focusDate]); +$currentNote = $stmtNote->fetchColumn(); + // 7. Récupération des vacances actives pour les lier au budget $activeHolidays = $pdo->query("SELECT id, title FROM pf_holidays WHERE status IN ('draft', 'planned', 'booked') ORDER BY start_date ASC")->fetchAll(PDO::FETCH_ASSOC); ?> @@ -249,13 +253,42 @@ $activeHolidays = $pdo->query("SELECT id, title FROM pf_holidays WHERE status IN + +