Merge branch 'main' into feature/user_profile

# Conflicts:
#	public/userarea/include/topbar.php
#	public/userarea/scadenzario/include/my_deadlines_widget.php
This commit is contained in:
2026-05-21 22:44:42 +03:00
6 changed files with 1003 additions and 64 deletions
@@ -1,4 +1,5 @@
<?php
/**
* Renders two status banners for the current user:
* - red -> overdue deadlines (scaduta)
@@ -44,63 +45,90 @@ if (!$_emp || ($_overdue === 0 && $_approaching === 0)) {
?>
<style>
.my-deadlines-widgets {
display: flex; flex-wrap: wrap; gap: 0.75rem;
margin-bottom: 1rem; width: 100%;
}
.my-deadlines-widgets:empty { display: none; }
/* When two widget containers are nested inside an outer .my-deadlines-widgets
(e.g. on the production dashboard), let their children flow into the outer flex. */
.my-deadlines-widgets .my-deadlines-widgets {
display: contents;
display: flex;
gap: 0.75rem;
margin-bottom: 1rem;
flex-wrap: wrap;
}
.my-deadlines-widgets .mdw {
flex: 1 1 0; min-width: 0;
display: flex; align-items: center; gap: 0.75rem;
padding: 0.8rem 0.9rem; border-radius: 0.6rem;
text-decoration: none; color: #fff;
box-shadow: 0 2px 6px rgba(0,0,0,0.08);
flex: 1 1 260px;
display: flex;
align-items: center;
gap: 0.9rem;
padding: 0.85rem 1rem;
border-radius: 0.6rem;
text-decoration: none;
color: #fff;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
transition: transform 0.15s, box-shadow 0.15s;
}
.my-deadlines-widgets .mdw:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.15); color: #fff; }
.my-deadlines-widgets .mdw-red { background: linear-gradient(135deg, #dc3545 0%, #b02a37 100%); }
.my-deadlines-widgets .mdw-orange { background: linear-gradient(135deg, #e8930c 0%, #c77a00 100%); }
.my-deadlines-widgets .mdw-gray { background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%); }
.my-deadlines-widgets .mdw:hover {
transform: translateY(-1px);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
color: #fff;
}
.my-deadlines-widgets .mdw-red {
background: linear-gradient(135deg, #dc3545 0%, #b02a37 100%);
}
.my-deadlines-widgets .mdw-orange {
background: linear-gradient(135deg, #e8930c 0%, #c77a00 100%);
}
.my-deadlines-widgets .mdw-icon {
width: 38px; height: 38px; border-radius: 50%;
display: flex; align-items: center; justify-content: center;
background: rgba(255,255,255,0.22); font-size: 1.05rem; flex-shrink: 0;
width: 42px;
height: 42px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
background: rgba(255, 255, 255, 0.22);
font-size: 1.2rem;
flex-shrink: 0;
}
.my-deadlines-widgets .mdw-body { flex: 1; line-height: 1.2; min-width: 0; }
.my-deadlines-widgets .mdw-count { font-size: 1.5rem; font-weight: 700; }
.my-deadlines-widgets .mdw-label { font-size: 0.78rem; opacity: 0.95;
overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.my-deadlines-widgets .mdw-arrow { opacity: 0.7; font-size: 0.85rem; flex-shrink: 0; }
@media (max-width: 991.98px) {
.my-deadlines-widgets .mdw { flex: 1 1 calc(50% - 0.375rem); }
.my-deadlines-widgets .mdw-body {
flex: 1;
line-height: 1.2;
}
@media (max-width: 575.98px) {
.my-deadlines-widgets .mdw { flex: 1 1 100%; }
.my-deadlines-widgets .mdw-count {
font-size: 1.6rem;
font-weight: 700;
}
.my-deadlines-widgets .mdw-label {
font-size: 0.8rem;
opacity: 0.95;
}
.my-deadlines-widgets .mdw-arrow {
opacity: 0.7;
font-size: 0.9rem;
}
</style>
<div class="my-deadlines-widgets">
<?php if ($_overdue > 0): ?>
<a class="mdw mdw-red" href="scadenzario/index.php?filter_my=1&filter_status=scaduta">
<span class="mdw-icon"><i class="fa-solid fa-triangle-exclamation"></i></span>
<span class="mdw-body">
<span class="mdw-count"><?= $_overdue ?></span>
<span class="mdw-label d-block">Scadenz<?= $_overdue === 1 ? 'a' : 'e' ?> scadut<?= $_overdue === 1 ? 'a' : 'e' ?> — <?= $_dept !== '' ? htmlspecialchars($_dept, ENT_QUOTES, 'UTF-8') : 'personali' ?></span>
</span>
<span class="mdw-arrow"><i class="fa-solid fa-arrow-right"></i></span>
</a>
<?php endif; ?>
<?php if ($_approaching > 0): ?>
<a class="mdw mdw-orange" href="scadenzario/index.php?filter_my=1&filter_status=in-scadenza">
<span class="mdw-icon"><i class="fa-solid fa-clock"></i></span>
<span class="mdw-body">
<span class="mdw-count"><?= $_approaching ?></span>
<span class="mdw-label d-block">In scadenza a breve <?= $_dept !== '' ? htmlspecialchars($_dept, ENT_QUOTES, 'UTF-8') : 'personali' ?></span>
</span>
<span class="mdw-arrow"><i class="fa-solid fa-arrow-right"></i></span>
</a>
<?php endif; ?>
<?php if ($_overdue > 0): ?>
<a class="mdw mdw-red" href="scadenzario/index.php?filter_my=1&filter_status=scaduta">
<span class="mdw-icon"><i class="fa-solid fa-triangle-exclamation"></i></span>
<span class="mdw-body">
<span class="mdw-count"><?= $_overdue ?></span>
<span class="mdw-label d-block">Task<?= $_overdue === 1 ? '' : 's' ?> scadut<?= $_overdue === 1 ? 'o' : 'i' ?> — <?= $_dept !== '' ? htmlspecialchars($_dept, ENT_QUOTES, 'UTF-8') : 'personali' ?></span>
</span>
<span class="mdw-arrow"><i class="fa-solid fa-arrow-right"></i></span>
</a>
<?php endif; ?>
<?php if ($_approaching > 0): ?>
<a class="mdw mdw-orange" href="scadenzario/index.php?filter_my=1&filter_status=in-scadenza">
<span class="mdw-icon"><i class="fa-solid fa-clock"></i></span>
<span class="mdw-body">
<span class="mdw-count"><?= $_approaching ?></span>
<span class="mdw-label d-block">In scadenza a breve <?= $_dept !== '' ? htmlspecialchars($_dept, ENT_QUOTES, 'UTF-8') : 'personali' ?></span>
</span>
<span class="mdw-arrow"><i class="fa-solid fa-arrow-right"></i></span>
</a>
<?php endif; ?>
</div>
+45 -10
View File
@@ -1115,15 +1115,15 @@ function getContrastTextColor($hexColor)
</div>
<div class="col-12 col-md-4">
<label for="dlDocDate" class="form-label fw-semibold">Data documento</label>
<input type="date" class="form-control" id="dlDocDate" name="document_date">
<input type="text" class="form-control js-date-it" id="dlDocDate" name="document_date" placeholder="gg/mm/aaaa" autocomplete="off">
</div>
<div class="col-12 col-md-4">
<label for="dlDueDate" class="form-label fw-semibold">Data scadenza <span class="text-danger">*</span></label>
<input type="date" class="form-control" id="dlDueDate" name="due_date" required>
<input type="text" class="form-control js-date-it" id="dlDueDate" name="due_date" placeholder="gg/mm/aaaa" autocomplete="off" required>
</div>
<div class="col-12 col-md-4">
<label for="dlCheckDate" class="form-label fw-semibold">Data ultimo controllo</label>
<input type="date" class="form-control" id="dlCheckDate" name="check_date">
<input type="text" class="form-control js-date-it" id="dlCheckDate" name="check_date" placeholder="gg/mm/aaaa" autocomplete="off">
</div>
</div>
@@ -1221,6 +1221,33 @@ function getContrastTextColor($hexColor)
var fpDue = flatpickr('#filterDueRange', fpOpts);
var fpCheck = flatpickr('#filterCheckRange', fpOpts);
// --- Flatpickr Italian date fields in deadline modal ---
// Visible format: dd/mm/yyyy
// Submitted format: yyyy-mm-dd, compatible with MySQL DATE
var fpDocDate = flatpickr('#dlDocDate', {
dateFormat: 'Y-m-d',
altInput: true,
altFormat: 'd/m/Y',
locale: 'it',
allowInput: true
});
var fpDueDate = flatpickr('#dlDueDate', {
dateFormat: 'Y-m-d',
altInput: true,
altFormat: 'd/m/Y',
locale: 'it',
allowInput: true
});
var fpCheckDate = flatpickr('#dlCheckDate', {
dateFormat: 'Y-m-d',
altInput: true,
altFormat: 'd/m/Y',
locale: 'it',
allowInput: true
});
// --- Select2 ---
$('#dlSubject').select2({
theme: 'bootstrap-5',
@@ -1295,7 +1322,7 @@ function getContrastTextColor($hexColor)
var iso = d.getFullYear() + '-' +
String(d.getMonth() + 1).padStart(2, '0') + '-' +
String(d.getDate()).padStart(2, '0');
document.getElementById('dlDueDate').value = iso;
fpDueDate.setDate(iso, true, 'Y-m-d');
}
$('#dlDocDate, #dlRecurrence').on('change', computeDueDate);
@@ -1464,16 +1491,24 @@ function getContrastTextColor($hexColor)
var modal = new bootstrap.Modal(document.getElementById('deadlineModal'));
var form = document.getElementById('deadlineForm');
// Add
// Add
document.getElementById('btnAddDeadline').addEventListener('click', function() {
form.reset();
document.getElementById('dlId').value = '';
document.getElementById('dlNotifDays').value = '7';
document.getElementById('modalTitle').textContent = 'Nuova Scadenza';
document.getElementById('dlFiles').value = '';
fpDocDate.clear();
fpDueDate.clear();
fpCheckDate.clear();
$('#dlSubject').val('').trigger('change');
$('#dlDepartments').val(null).trigger('change');
$('#dlEmployees').val(null).trigger('change');
renderAttachments([]);
modal.show();
});
@@ -1639,9 +1674,9 @@ function getContrastTextColor($hexColor)
document.getElementById('dlTopic').value = d.topic || '';
document.getElementById('dlLaw').value = d.law_regulation || '';
document.getElementById('dlRecurrence').value = d.recurrence_type || 'once';
document.getElementById('dlDocDate').value = d.document_date || '';
document.getElementById('dlDueDate').value = d.due_date || '';
document.getElementById('dlCheckDate').value = d.check_date || '';
fpDocDate.setDate(d.document_date || null, false, 'Y-m-d');
fpDueDate.setDate(d.due_date || null, false, 'Y-m-d');
fpCheckDate.setDate(d.check_date || null, false, 'Y-m-d');
document.getElementById('dlNotifDays').value = d.notification_days || 7;
document.getElementById('dlStorage').value = d.storage_location || '';
document.getElementById('dlNotes').value = d.notes || '';
@@ -1765,9 +1800,9 @@ function getContrastTextColor($hexColor)
document.getElementById('dlTopic').value = d.topic || '';
document.getElementById('dlLaw').value = d.law_regulation || '';
document.getElementById('dlRecurrence').value = d.recurrence_type || 'once';
document.getElementById('dlDocDate').value = d.document_date || '';
document.getElementById('dlDueDate').value = d.due_date || '';
document.getElementById('dlCheckDate').value = d.check_date || '';
fpDocDate.setDate(d.document_date || null, false, 'Y-m-d');
fpDueDate.setDate(d.due_date || null, false, 'Y-m-d');
fpCheckDate.setDate(d.check_date || null, false, 'Y-m-d');
document.getElementById('dlNotifDays').value = d.notification_days || 7;
document.getElementById('dlStorage').value = d.storage_location || '';
document.getElementById('dlNotes').value = d.notes || '';