Merge pull request 'refacto : var currency and zone applied' (#2) from param_foyer into main
Deploy HouseHub / deploy (push) Successful in 1s
Deploy HouseHub / deploy (push) Successful in 1s
Reviewed-on: #2
This commit was merged in pull request #2.
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -119,7 +119,16 @@ document.addEventListener("DOMContentLoaded", () => {
|
||||
options += `<option value="${y}" ${selected}>${y} - ${y + 1}</option>`;
|
||||
}
|
||||
|
||||
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}
|
||||
<select id="holidayYearSelect" class="pf-input" style="width:auto; display:inline-block; margin-left:10px; padding:4px 10px; height:auto;">
|
||||
${options}
|
||||
</select>`;
|
||||
@@ -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 || [];
|
||||
|
||||
Reference in New Issue
Block a user