diff --git a/family-calendar.php b/family-calendar.php index b05f54c..f837c58 100644 --- a/family-calendar.php +++ b/family-calendar.php @@ -35,8 +35,11 @@ require __DIR__ . '/header.php';
-

- +

+ + +

+
diff --git a/header.php b/header.php index 09fd301..421a7eb 100644 --- a/header.php +++ b/header.php @@ -134,7 +134,8 @@ $currentLang = $_SESSION['app_lang'] ?? 'fr'; window.CONFIG = { ID_ALEX: , ID_LAIA: , - CURRENCY: '' + CURRENCY: '', + ZONE_SCOLAIRE: '' }; function tr(key) { diff --git a/includes/lang/ca.php b/includes/lang/ca.php index f2deb67..170097b 100644 --- a/includes/lang/ca.php +++ b/includes/lang/ca.php @@ -163,7 +163,7 @@ return [ 'fc_main_header' => 'Calendari Familiar', 'fc_btn_correct_balances' => 'Corregir els saldos', 'fc_btn_school_holidays' => 'Vacances escolars', - 'fc_modal_holidays_title' => 'Vacances Escolars (Zona C)', + 'fc_modal_holidays_title' => 'Vacances Escolars', 'fc_modal_snap_title' => 'Ajustar un saldo', 'fc_col_period' => 'Període', 'fc_col_from' => 'Des del', diff --git a/includes/lang/en.php b/includes/lang/en.php index e26ae98..092f725 100644 --- a/includes/lang/en.php +++ b/includes/lang/en.php @@ -164,7 +164,7 @@ return [ 'fc_main_header' => 'Family Calendar', 'fc_btn_correct_balances' => 'Adjust balances', 'fc_btn_school_holidays' => 'School holidays', - 'fc_modal_holidays_title' => 'School Holidays (Zone C)', + 'fc_modal_holidays_title' => 'School Holidays', 'fc_modal_snap_title' => 'Adjust a balance', 'fc_col_period' => 'Period', 'fc_col_from' => 'From', diff --git a/includes/lang/fr.php b/includes/lang/fr.php index f57802e..63cf574 100644 --- a/includes/lang/fr.php +++ b/includes/lang/fr.php @@ -163,7 +163,7 @@ return [ 'fc_main_header' => 'Calendrier Familial', 'fc_btn_correct_balances' => 'Corriger les soldes', 'fc_btn_school_holidays' => 'Vacances scolaires', - 'fc_modal_holidays_title' => 'Vacances Scolaires (Zone C)', + 'fc_modal_holidays_title' => 'Vacances Scolaires', 'fc_modal_snap_title' => 'Ajuster un solde', 'fc_col_period' => 'Période', 'fc_col_from' => 'Du', diff --git a/modules/budget/views/budget_prev.php b/modules/budget/views/budget_prev.php index f5a1c1a..bc6d5e8 100644 --- a/modules/budget/views/budget_prev.php +++ b/modules/budget/views/budget_prev.php @@ -666,18 +666,18 @@ function updateSummaryTable() { const laiaSum = dataByTarget[targetName] ? dataByTarget[targetName].laia : 0; const globalSum = alexSum + laiaSum; - row.cells[1].innerText = Math.round(alexSum).toLocaleString(window.appLang) + ' €'; - row.cells[2].innerText = Math.round(laiaSum).toLocaleString(window.appLang) + ' €'; - row.cells[3].innerText = Math.round(globalSum).toLocaleString(window.appLang) + ' €'; + row.cells[1].innerText = Math.round(alexSum).toLocaleString(window.appLang) + ' ' + window.CONFIG.CURRENCY; + row.cells[2].innerText = Math.round(laiaSum).toLocaleString(window.appLang) + ' ' + window.CONFIG.CURRENCY; + row.cells[3].innerText = Math.round(globalSum).toLocaleString(window.appLang) + ' ' + window.CONFIG.CURRENCY; grandTotalAlex += alexSum; grandTotalLaia += laiaSum; }); } - document.getElementById('grand_total_alex').innerText = Math.round(grandTotalAlex).toLocaleString(window.appLang) + ' €'; - document.getElementById('grand_total_laia').innerText = Math.round(grandTotalLaia).toLocaleString(window.appLang) + ' €'; - document.getElementById('grand_total_global').innerText = Math.round(grandTotalAlex + grandTotalLaia).toLocaleString(window.appLang) + ' €'; + document.getElementById('grand_total_alex').innerText = Math.round(grandTotalAlex).toLocaleString(window.appLang) + ' ' + window.CONFIG.CURRENCY; + document.getElementById('grand_total_laia').innerText = Math.round(grandTotalLaia).toLocaleString(window.appLang) + ' ' + window.CONFIG.CURRENCY; + document.getElementById('grand_total_global').innerText = Math.round(grandTotalAlex + grandTotalLaia).toLocaleString(window.appLang) + ' ' + window.CONFIG.CURRENCY; } function saveData(action, data) { @@ -788,7 +788,7 @@ function updateSumResult() { total += val; }); - document.getElementById('sumResultValue').innerText = new Intl.NumberFormat(window.appLang, { style: 'currency', currency: 'EUR', maximumFractionDigits: 0 }).format(total); + document.getElementById('sumResultValue').innerText = Math.round(total).toLocaleString(window.appLang) + ' ' + window.CONFIG.CURRENCY; } async function deleteCategory(id) { diff --git a/modules/budget/views/epargne.php b/modules/budget/views/epargne.php index 55ee6a8..087de7d 100644 --- a/modules/budget/views/epargne.php +++ b/modules/budget/views/epargne.php @@ -528,7 +528,7 @@ function updateSumResult() { total += val; }); - document.getElementById('sumResultValue').innerText = new Intl.NumberFormat(window.appLang, { style: 'currency', currency: 'EUR', maximumFractionDigits: 0 }).format(total); + document.getElementById('sumResultValue').innerText = Math.round(total).toLocaleString(window.appLang) + ' ' + window.CONFIG.CURRENCY; } document.addEventListener('click', function(e) { diff --git a/modules/family-calendar/family-calendar.js b/modules/family-calendar/family-calendar.js index 3f8db42..48e0c66 100644 --- a/modules/family-calendar/family-calendar.js +++ b/modules/family-calendar/family-calendar.js @@ -119,7 +119,16 @@ document.addEventListener("DOMContentLoaded", () => { options += ``; } - headerTitle.innerHTML = `🏖️ ${tr("fc_modal_holidays_title")} + // --- NOUVEAU : Récupération de la zone dynamique --- + const zoneText = + window.CONFIG && + window.CONFIG.ZONE_SCOLAIRE && + window.CONFIG.ZONE_SCOLAIRE !== "Autre" + ? `(Zone ${window.CONFIG.ZONE_SCOLAIRE})` + : ""; + + // Injection du texte de la zone dans le header + headerTitle.innerHTML = `🏖️ ${window.I18N["fc_modal_holidays_title"]} ${zoneText} `; @@ -332,8 +341,21 @@ document.addEventListener("DOMContentLoaded", () => { async fetchAndSaveGovHolidays(yearStart) { try { const yearStr = `${yearStart}-${yearStart + 1}`; - const url = `https://data.education.gouv.fr/api/explore/v2.1/catalog/datasets/fr-en-calendrier-scolaire/records?where=annee_scolaire='${yearStr}' AND zones LIKE '%Zone C%'&limit=100`; + const zone = window.CONFIG?.ZONE_SCOLAIRE || "C"; + if (zone === "Autre") { + alert( + "L'importation automatique n'est disponible que pour les zones A, B ou C (France).", + ); + const btn = document.getElementById("btnFetchGovHolidays"); + if (btn) { + btn.innerText = "Non disponible"; + btn.disabled = true; + } + return; + } + + const url = `https://data.education.gouv.fr/api/explore/v2.1/catalog/datasets/fr-en-calendrier-scolaire/records?where=annee_scolaire='${yearStr}' AND zones LIKE '%Zone ${zone}%'&limit=100`; const res = await fetch(url); const data = await res.json(); const rawRecords = data.results || []; diff --git a/settings.php b/settings.php index 4626013..3071e9c 100644 --- a/settings.php +++ b/settings.php @@ -37,9 +37,10 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { if ($action === 'update_family_info') { require_once __DIR__ . '/includes/db.php'; - $currency = trim($_POST['currency'] ?? '€'); - $zone = trim($_POST['zone_scolaire'] ?? 'C'); - + + $foyer = $pdo->query("SELECT currency, zone_scolaire FROM pf_foyer_settings WHERE id = 1")->fetch(); + $currency = isset($_POST['currency']) ? trim($_POST['currency']) : ($foyer['currency'] ?? '€'); + $zone = isset($_POST['zone_scolaire']) ? trim($_POST['zone_scolaire']) : ($foyer['zone_scolaire'] ?? 'C'); $stmtSave = $pdo->prepare("UPDATE pf_foyer_settings SET currency = ?, zone_scolaire = ? WHERE id = 1"); $stmtSave->execute([$currency, $zone]); $success = "Paramètres du foyer mis à jour avec succès."; @@ -453,23 +454,36 @@ require __DIR__ . '/header.php'; 0; + $showZone = in_array('calendar', $enabledMods); + + // Si au moins un des champs doit être affiché, on rend la section visible + if ($family_id && ($showCurrency || $showZone)): + $currentCurrency = defined('CURRENCY') ? CURRENCY : '€'; + $currentZone = defined('ZONE_SCOLAIRE') ? ZONE_SCOLAIRE : 'C'; ?>

👪 Configuration du foyer

-

Configurez les informations partagées par l'ensemble de votre foyer.

+

Configurez les indicateurs partagés par votre foyer.

-
+ + +
-
+ + + +
+ +
- +
+