fix holidays
This commit is contained in:
@@ -599,6 +599,11 @@ input[type="number"] {
|
||||
overflow-x: auto;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.pf-btn {
|
||||
position: relative !important;
|
||||
right: auto !important;
|
||||
top: auto !important;
|
||||
}
|
||||
.form-row {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
@@ -664,6 +669,19 @@ input[type="number"] {
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.prev-section-header,
|
||||
.view-header,
|
||||
.budget-view > div[style*="justify-content: space-between"] {
|
||||
display: flex !important;
|
||||
flex-direction: row !important;
|
||||
justify-content: space-between !important;
|
||||
align-items: center !important;
|
||||
float: none !important; /* On annule tout float résiduel */
|
||||
position: relative !important; /* On s'assure qu'il n'est pas en absolute */
|
||||
width: 100% !important;
|
||||
gap: 15px !important;
|
||||
}
|
||||
|
||||
.prev-salary-table {
|
||||
width: 100%;
|
||||
max-width: 900px;
|
||||
@@ -1009,6 +1027,11 @@ th.col-laia {
|
||||
.budget-view > div[style*="display:grid"] > div {
|
||||
padding: 12px 10px !important;
|
||||
}
|
||||
.budget-view
|
||||
> div[style*="justify-content: space-between"]:not(.view-header) {
|
||||
flex-direction: column !important;
|
||||
align-items: stretch !important;
|
||||
}
|
||||
|
||||
/* 4. EN-TÊTES EPARGNE (Titre isolé, boutons 50/50 en dessous) */
|
||||
.budget-view
|
||||
|
||||
@@ -139,24 +139,24 @@ function getTranslatedMonthName($dateString) {
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div class="prev-section-header">
|
||||
<div style="display:flex; gap:10px; align-items:center;">
|
||||
<h2><?= tr('bud_prev_budget_alloc') ?></h2>
|
||||
<div class="nav-group">
|
||||
<a href="?tab=budget_prev&focus_date=<?= $prevMonthLink ?>" class="btn-nav">◀</a>
|
||||
<a href="?tab=budget_prev&focus_date=<?= date('Y-m-01') ?>" class="btn-nav"><?= tr('bud_prev_today') ?></a>
|
||||
<a href="?tab=budget_prev&focus_date=<?= $nextMonthLink ?>" class="btn-nav">▶</a>
|
||||
</div>
|
||||
</div>
|
||||
<div style="display:flex; gap:10px;">
|
||||
<button class="pf-btn btn-secondary" onclick="duplicateMonth()">
|
||||
🔁 <?= tr('bud_sav_add_one_month') ?>
|
||||
</button>
|
||||
<button class="pf-btn" onclick="document.getElementById('addCatModal').style.display='flex'; document.body.classList.add('no-scroll');">
|
||||
+ <?= tr('bud_prev_new_line') ?>
|
||||
</button>
|
||||
</div>
|
||||
<div class="prev-section-header" style="background: #f8fafc; padding: 15px; border-radius: 12px; border: 1px solid #e2e8f0; margin-bottom: 20px;">
|
||||
<div style="display:flex; gap:10px; align-items:center;">
|
||||
<h2 style="margin:0; font-size:1.3rem;"><?= tr('bud_prev_budget_alloc') ?></h2>
|
||||
<div class="nav-group" style="display:flex; gap:5px;">
|
||||
<a href="?tab=budget_prev&focus_date=<?= $prevMonthLink ?>" class="btn-nav">◀</a>
|
||||
<a href="?tab=budget_prev&focus_date=<?= date('Y-m-01') ?>" class="btn-nav"><?= tr('bud_prev_today') ?></a>
|
||||
<a href="?tab=budget_prev&focus_date=<?= $nextMonthLink ?>" class="btn-nav">▶</a>
|
||||
</div>
|
||||
</div>
|
||||
<div style="display:flex; gap:10px;">
|
||||
<button type="button" class="pf-btn btn-secondary" onclick="duplicateMonth()">
|
||||
🔁 <?= tr('bud_sav_add_one_month') ?>
|
||||
</button>
|
||||
<button type="button" class="pf-btn" onclick="document.getElementById('addCatModal').style.display='flex'; document.body.classList.add('no-scroll');">
|
||||
+ <?= tr('bud_prev_new_line') ?>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="prev-timeline-wrapper">
|
||||
<table class="prev-alloc-table">
|
||||
|
||||
@@ -578,7 +578,7 @@ $monthName = $monthNames[(int)$viewM] . ' ' . $viewY;
|
||||
<div class="form-group" id="blockInputFrais" style="margin-bottom:15px; display:none;">
|
||||
<label class="pf-label"><?= tr('bud_fixed_charge') ?></label>
|
||||
<select name="budget_item_id" id="fraisSelect" class="pf-input" disabled>
|
||||
<option value=""><?= tr('hdl_select_beneficiary') ?></option>
|
||||
<option value=""><?= tr('bud_select_beneficiary') ?></option>
|
||||
<?php foreach ($fixedChargesList as $fc): ?><option value="<?= $fc['id'] ?>"><?= htmlspecialchars($fc['name']) ?></option><?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
@@ -586,7 +586,7 @@ $monthName = $monthNames[(int)$viewM] . ' ' . $viewY;
|
||||
<div class="form-group" id="blockInputIncome" style="margin-bottom:15px; display:none;">
|
||||
<label class="pf-label"><?= tr('bud_expected_income') ?></label>
|
||||
<select name="budget_item_id" id="incomeSelect" class="pf-input" disabled>
|
||||
<option value=""><?= tr('hdl_select_beneficiary') ?> </option>
|
||||
<option value=""><?= tr('bud_select_beneficiary') ?> </option>
|
||||
<?php foreach ($incomeList as $inc): ?><option value="<?= $inc['id'] ?>"><?= htmlspecialchars($inc['name']) ?></option><?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
@@ -622,23 +622,22 @@ $monthName = $monthNames[(int)$viewM] . ' ' . $viewY;
|
||||
<div id="importCsvModal" class="pf-modal" style="display: <?= $showPreview ? 'flex' : 'none' ?>;">
|
||||
<div class="pf-modal-content <?= $showPreview ? 'modal-large' : '' ?>">
|
||||
<div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:20px;">
|
||||
<h3 class="pf-modal-title" style="margin:0; border:none; padding:0;"><?= tr('bud_import_csv') ?? 'Importer un fichier CSV' ?></h3>
|
||||
<button type="button" onclick="<?= $showPreview ? "window.location.href='?tab=suivi&m=$viewM&y=$viewY';" : "closeSuiviModal('importCsvModal');" ?>" class="pf-modal-close" style="font-size:1.8rem; background:none; border:none; cursor:pointer; color:#64748b; padding:0; line-height:1;">×</button>
|
||||
<h3 class="pf-modal-title" style="margin:0; border:none; padding:0;"><?= tr('bud_import_csv') ?></h3>
|
||||
<button type="button" onclick="closeSuiviModal('importCsvModal')" class="pf-modal-close" style="background:none; border:none; font-size:1.5rem; cursor:pointer;">×</button>
|
||||
</div>
|
||||
|
||||
<?php if (!$showPreview): ?>
|
||||
<form method="POST" enctype="multipart/form-data" style="display:flex; flex-direction:column; gap:20px;">
|
||||
<form method="POST" enctype="multipart/form-data">
|
||||
<div class="import-dropzone">
|
||||
<div style="font-size: 2.5rem; margin-bottom: 10px;">📄</div>
|
||||
<label class="pf-label" style="font-size: 1rem; color: #1e293b; margin-bottom: 10px;"><?= tr('bud_csv_file') ?? 'Sélectionnez le fichier de votre banque' ?></label>
|
||||
<input type="file" name="csv_file" accept=".csv" class="pf-input" style="max-width: 300px; margin: 0 auto; display: block;" required>
|
||||
<label class="pf-label"><?= tr('bud_csv_file') ?></label>
|
||||
<input type="file" name="csv_file" accept=".csv" class="pf-input" style="max-width: 300px; margin: 10px auto; display: block;" required>
|
||||
</div>
|
||||
<div class="modal-footer" style="margin-top:0; border-top:none;">
|
||||
<div class="modal-footer">
|
||||
<button type="button" onclick="closeSuiviModal('importCsvModal')" class="pf-btn btn-secondary"><?= tr('btn_cancel') ?></button>
|
||||
<button type="submit" class="pf-btn"><?= tr('bud_preview') ?? 'Prévisualiser' ?></button>
|
||||
<button type="submit" class="pf-btn"><?= tr('bud_preview') ?></button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<?php else: ?>
|
||||
<form method="POST" id="formMapping">
|
||||
<input type="hidden" name="action" value="save_import">
|
||||
@@ -828,10 +827,10 @@ async function deleteExpense(id) {
|
||||
|
||||
try {
|
||||
await pachaFetch("budget.php?tab=suivi", { method: "POST", body: formData });
|
||||
showToast("Dépense supprimée !"); //
|
||||
showToast(tr('bud_toast_deleted')); //
|
||||
setTimeout(() => window.location.reload(), 800);
|
||||
} catch (err) {
|
||||
showToast("Erreur lors de la suppression", "error");
|
||||
showToast(tr('error_occured'), "error");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,8 +22,9 @@ if ($selectedYear !== 'all') {
|
||||
$sql = "
|
||||
SELECT h.*,
|
||||
(COALESCE(h.budget_food, 0) + COALESCE(h.budget_extra, 0) + COALESCE(SUM(hi.amount), 0)) as total_cost,
|
||||
(SELECT COALESCE(SUM(ABS(amount)), 0) FROM pf_expenses WHERE holiday_id = h.id) as real_expenses_sum,
|
||||
SUM(CASE WHEN hi.is_paid = 1 THEN hi.amount ELSE 0 END) as items_paid_sum
|
||||
((SELECT COALESCE(SUM(ABS(amount)), 0) FROM pf_expenses WHERE holiday_id = h.id) +
|
||||
(SELECT COALESCE(SUM(amount), 0) FROM pf_holidays_items WHERE holiday_id = h.id AND is_paid = 1)) as total_paid,
|
||||
(SELECT COALESCE(SUM(amount), 0) FROM pf_savings WHERE holiday_id = h.id) as total_saved
|
||||
FROM pf_holidays h
|
||||
LEFT JOIN pf_holidays_items hi ON h.id = hi.holiday_id
|
||||
$whereSQL
|
||||
|
||||
Reference in New Issue
Block a user