manteinance color

This commit is contained in:
2026-08-25 09:04:07 +02:00
parent fc34f837d4
commit 8425a7d90c
2 changed files with 855 additions and 332 deletions
@@ -33,7 +33,7 @@ $MNT_BASE = $mntPos !== false
<script src="manutenzioni/assets/fullcalendar-it.js"></script>
<?php endif; ?>
<script>
document.addEventListener('DOMContentLoaded', function () {
document.addEventListener('DOMContentLoaded', function() {
if (typeof window.Swal === 'undefined') {
var local = document.createElement('script');
local.src = 'manutenzioni/assets/sweetalert2.min.js';
@@ -50,122 +50,633 @@ $MNT_BASE = $mntPos !== false
--mnt-card-border: #d6e5e9;
}
.mnt-card { border: none; border-radius: 0.75rem; box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06); overflow: hidden; }
.mnt-card .card-header { background: var(--mnt-card-bg); border-bottom: 1px solid var(--mnt-card-border); padding: 1rem 1.25rem; }
.mnt-card .card-header h5 { font-weight: 700; color: var(--mnt-heading); margin: 0; font-size: 1.05rem; letter-spacing: -0.01em; }
.mnt-card .card-body { padding: 1.25rem; }
.mnt-card {
border: none;
border-radius: 0.75rem;
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
overflow: hidden;
}
.btn-mnt-primary { background: var(--mnt-primary); border: none; color: #fff; font-weight: 600; font-size: 0.85rem; padding: 0.5rem 1rem; border-radius: 0.5rem; transition: all 0.2s; }
.btn-mnt-primary:hover { background: var(--mnt-primary-hover); color: #fff; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(47, 125, 143, 0.3); }
.btn-mnt-outline { background: transparent; border: 1.5px solid var(--mnt-primary); color: var(--mnt-primary); font-weight: 600; font-size: 0.85rem; padding: 0.45rem 1rem; border-radius: 0.5rem; transition: all 0.2s; }
.btn-mnt-outline:hover { background: var(--mnt-primary); color: #fff; transform: translateY(-1px); }
.mnt-card .card-header {
background: var(--mnt-card-bg);
border-bottom: 1px solid var(--mnt-card-border);
padding: 1rem 1.25rem;
}
.btn-action { width: 32px; height: 32px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border: none; border-radius: 0.4rem; font-size: 0.85rem; transition: all 0.15s; text-decoration: none; }
.btn-action-view { background: rgba(47, 125, 143, 0.12); color: var(--mnt-primary); }
.btn-action-view:hover { background: var(--mnt-primary); color: #fff; }
.btn-action-edit { background: rgba(13, 110, 253, 0.12); color: #0d6efd; }
.btn-action-edit:hover { background: #0d6efd; color: #fff; }
.btn-action-delete { background: rgba(220, 53, 69, 0.12); color: #dc3545; }
.btn-action-delete:hover { background: #dc3545; color: #fff; }
.btn-action-done { background: rgba(25, 135, 84, 0.12); color: #198754; }
.btn-action-done:hover { background: #198754; color: #fff; }
.mnt-card .card-header h5 {
font-weight: 700;
color: var(--mnt-heading);
margin: 0;
font-size: 1.05rem;
letter-spacing: -0.01em;
}
.mnt-card .card-body {
padding: 1.25rem;
}
.btn-mnt-primary {
background: var(--mnt-primary);
border: none;
color: #fff;
font-weight: 600;
font-size: 0.85rem;
padding: 0.5rem 1rem;
border-radius: 0.5rem;
transition: all 0.2s;
}
.btn-mnt-primary:hover {
background: var(--mnt-primary-hover);
color: #fff;
transform: translateY(-1px);
box-shadow: 0 4px 12px rgba(47, 125, 143, 0.3);
}
.btn-mnt-outline {
background: transparent;
border: 1.5px solid var(--mnt-primary);
color: var(--mnt-primary);
font-weight: 600;
font-size: 0.85rem;
padding: 0.45rem 1rem;
border-radius: 0.5rem;
transition: all 0.2s;
}
.btn-mnt-outline:hover {
background: var(--mnt-primary);
color: #fff;
transform: translateY(-1px);
}
.btn-action {
width: 32px;
height: 32px;
padding: 0;
display: inline-flex;
align-items: center;
justify-content: center;
border: none;
border-radius: 0.4rem;
font-size: 0.85rem;
transition: all 0.15s;
text-decoration: none;
}
.btn-action-view {
background: rgba(47, 125, 143, 0.12);
color: var(--mnt-primary);
}
.btn-action-view:hover {
background: var(--mnt-primary);
color: #fff;
}
.btn-action-edit {
background: rgba(13, 110, 253, 0.12);
color: #0d6efd;
}
.btn-action-edit:hover {
background: #0d6efd;
color: #fff;
}
.btn-action-delete {
background: rgba(220, 53, 69, 0.12);
color: #dc3545;
}
.btn-action-delete:hover {
background: #dc3545;
color: #fff;
}
.btn-action-done {
background: rgba(25, 135, 84, 0.12);
color: #198754;
}
.btn-action-done:hover {
background: #198754;
color: #fff;
}
/* Schedule state badges */
.mnt-badge { display: inline-block; padding: 0.22rem 0.6rem; border-radius: 999px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.01em; white-space: nowrap; }
.mnt-badge-overdue { background: rgba(220, 53, 69, 0.14); color: #b02a37; }
.mnt-badge-soon { background: rgba(255, 193, 7, 0.2); color: #9a7000; }
.mnt-badge-ok { background: rgba(25, 135, 84, 0.14); color: #146c43; }
.mnt-badge-none { background: rgba(108, 117, 125, 0.14); color: #565e64; }
.mnt-badge-critical { background: rgba(220, 53, 69, 0.9); color: #fff; }
.mnt-badge-soft { background: rgba(47, 125, 143, 0.12); color: var(--mnt-primary); }
.mnt-badge-status-active { background: rgba(25, 135, 84, 0.14); color: #146c43; }
.mnt-badge-status-out_of_service { background: rgba(255, 193, 7, 0.2); color: #9a7000; }
.mnt-badge-status-decommissioned { background: rgba(108, 117, 125, 0.16); color: #495057; }
.mnt-cat-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.modal-content > form { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.modal-content > form > .modal-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.mnt-title-cell { max-width: 320px; }
.mnt-equipment-cell { max-width: 240px; }
.mnt-freq-cell { max-width: 190px; }
.mnt-person-cell { max-width: 150px; }
.mnt-name-cell { max-width: 300px; }
.mnt-name-cell .mnt-title-clamp {
display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
.mnt-badge {
display: inline-block;
padding: 0.22rem 0.6rem;
border-radius: 999px;
font-size: 0.72rem;
font-weight: 700;
letter-spacing: 0.01em;
white-space: nowrap;
}
.mnt-badge-overdue {
background: rgba(220, 53, 69, 0.14);
color: #b02a37;
}
.mnt-badge-soon {
background: rgba(255, 193, 7, 0.2);
color: #9a7000;
}
.mnt-badge-ok {
background: rgba(25, 135, 84, 0.14);
color: #146c43;
}
.mnt-badge-none {
background: rgba(108, 117, 125, 0.14);
color: #565e64;
}
.mnt-badge-critical {
background: rgba(220, 53, 69, 0.9);
color: #fff;
}
.mnt-badge-soft {
background: rgba(47, 125, 143, 0.12);
color: var(--mnt-primary);
}
.mnt-badge-status-active {
background: rgba(25, 135, 84, 0.14);
color: #146c43;
}
.mnt-badge-status-out_of_service {
background: rgba(255, 193, 7, 0.2);
color: #9a7000;
}
.mnt-badge-status-decommissioned {
background: rgba(108, 117, 125, 0.16);
color: #495057;
}
.mnt-cat-dot {
width: 10px;
height: 10px;
border-radius: 50%;
display: inline-block;
flex-shrink: 0;
}
.modal-content>form {
display: flex;
flex-direction: column;
flex: 1 1 auto;
min-height: 0;
}
.modal-content>form>.modal-body {
flex: 1 1 auto;
min-height: 0;
overflow-y: auto;
}
.mnt-title-cell {
max-width: 320px;
}
.mnt-equipment-cell {
max-width: 240px;
}
.mnt-freq-cell {
max-width: 190px;
}
.mnt-person-cell {
max-width: 150px;
}
.mnt-name-cell {
max-width: 300px;
}
.mnt-name-cell .mnt-title-clamp {
display: block;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.mnt-title-clamp {
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
word-break: break-word;
min-width: 0;
}
.mnt-equipment-cell .mnt-title-clamp {
flex: 1 1 auto;
}
.mnt-title-clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; min-width: 0; }
.mnt-equipment-cell .mnt-title-clamp { flex: 1 1 auto; }
/* Mobile-first cards; the table appears from xl (1200px) upwards */
.mnt-item-card { background: #fff; border: 1px solid var(--mnt-card-border); border-left: 5px solid var(--row-color, #e9ecef); border-radius: 0.6rem; padding: 0.85rem 0.95rem; margin-bottom: 0.6rem; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04); }
.mnt-item-card .ic-title { font-weight: 700; color: var(--mnt-heading); font-size: 0.95rem; word-break: break-word; }
.mnt-item-card .ic-meta { font-size: 0.8rem; color: #6c757d; margin-top: 0.3rem; }
.mnt-item-card .ic-meta strong { color: var(--mnt-heading); font-weight: 600; }
.mnt-item-card .ic-actions { display: flex; gap: 0.4rem; justify-content: flex-end; margin-top: 0.6rem; }
.mnt-item-card {
background: #fff;
border: 1px solid var(--mnt-card-border);
border-left: 5px solid var(--row-color, #e9ecef);
border-radius: 0.6rem;
padding: 0.85rem 0.95rem;
margin-bottom: 0.6rem;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.mnt-item-card .ic-title {
font-weight: 700;
color: var(--mnt-heading);
font-size: 0.95rem;
word-break: break-word;
}
.mnt-item-card .ic-meta {
font-size: 0.8rem;
color: #6c757d;
margin-top: 0.3rem;
}
.mnt-item-card .ic-meta strong {
color: var(--mnt-heading);
font-weight: 600;
}
.mnt-item-card .ic-actions {
display: flex;
gap: 0.4rem;
justify-content: flex-end;
margin-top: 0.6rem;
}
/* Tile contatori: sfondo pieno tenue, testo scuro coordinato */
.mnt-tile {
border: 1px solid transparent;
border-left: none;
box-shadow: none;
transition: transform .12s ease, box-shadow .12s ease;
}
.mnt-tile:hover {
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.10);
}
.mnt-tile.mnt-tile-active {
box-shadow: 0 0 0 2px currentColor inset;
}
.mnt-tile-overdue {
background: rgba(220, 53, 69, 0.14);
color: #b02a37;
}
.mnt-tile-due_soon {
background: rgba(255, 193, 7, 0.20);
color: #9a7000;
}
.mnt-tile-ok {
background: rgba(25, 135, 84, 0.14);
color: #146c43;
}
.mnt-tile-none {
background: rgba(108, 117, 125, 0.14);
color: #565e64;
}
.mnt-tile .ic-title {
color: inherit;
}
.mnt-tile .ic-meta {
color: inherit;
opacity: 0.85;
}
@media (min-width: 768px) {
.d-xl-none > .mnt-item-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 1rem; }
.d-xl-none > .mnt-item-card > :not(.ic-actions) { grid-column: 1; }
.d-xl-none > .mnt-item-card > .ic-actions { grid-column: 2; grid-row: 1 / -1; margin-top: 0; }
.d-xl-none>.mnt-item-card {
display: grid;
grid-template-columns: minmax(0, 1fr) auto;
align-items: center;
column-gap: 1rem;
}
.d-xl-none>.mnt-item-card> :not(.ic-actions) {
grid-column: 1;
}
.d-xl-none>.mnt-item-card>.ic-actions {
grid-column: 2;
grid-row: 1 / -1;
margin-top: 0;
}
}
.mnt-pager {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 0.75rem 1.25rem;
padding: 0.85rem 0.25rem 0.25rem;
font-size: 0.85rem;
}
.mnt-pager-info {
color: #6c757d;
}
.mnt-pager-info strong {
color: var(--mnt-heading);
}
.mnt-pager-per {
display: flex;
align-items: center;
gap: 0.35rem;
}
.mnt-pager-pages {
display: flex;
align-items: center;
gap: 0.25rem;
margin-left: auto;
}
.mnt-pager-link {
display: inline-flex;
align-items: center;
justify-content: center;
min-width: 2rem;
height: 2rem;
padding: 0 0.5rem;
border: 1px solid var(--mnt-card-border);
border-radius: 0.45rem;
background: #fff;
color: var(--mnt-heading);
text-decoration: none;
}
.mnt-pager-link:hover {
border-color: #2f7d8f;
color: #2f7d8f;
}
.mnt-pager-link.is-current {
background: #2f7d8f;
border-color: #2f7d8f;
color: #fff;
font-weight: 700;
}
.mnt-pager-link.is-disabled {
opacity: 0.4;
pointer-events: none;
}
.mnt-pager-gap {
padding: 0 0.15rem;
color: #adb5bd;
}
.mnt-pager { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.25rem; padding: 0.85rem 0.25rem 0.25rem; font-size: 0.85rem; }
.mnt-pager-info { color: #6c757d; }
.mnt-pager-info strong { color: var(--mnt-heading); }
.mnt-pager-per { display: flex; align-items: center; gap: 0.35rem; }
.mnt-pager-pages { display: flex; align-items: center; gap: 0.25rem; margin-left: auto; }
.mnt-pager-link { display: inline-flex; align-items: center; justify-content: center; min-width: 2rem; height: 2rem; padding: 0 0.5rem; border: 1px solid var(--mnt-card-border); border-radius: 0.45rem; background: #fff; color: var(--mnt-heading); text-decoration: none; }
.mnt-pager-link:hover { border-color: #2f7d8f; color: #2f7d8f; }
.mnt-pager-link.is-current { background: #2f7d8f; border-color: #2f7d8f; color: #fff; font-weight: 700; }
.mnt-pager-link.is-disabled { opacity: 0.4; pointer-events: none; }
.mnt-pager-gap { padding: 0 0.15rem; color: #adb5bd; }
@media (max-width: 575.98px) {
.mnt-pager-pages { margin-left: 0; width: 100%; justify-content: center; }
.mnt-pager-pages {
margin-left: 0;
width: 100%;
justify-content: center;
}
}
.mnt-thumb { width: 46px; height: 46px; border-radius: 0.45rem; object-fit: cover; border: 1px solid var(--mnt-card-border); background: #f6f9fa; }
.mnt-thumb-placeholder { display: inline-flex; align-items: center; justify-content: center; color: #adb5bd; font-size: 1.1rem; }
.mnt-thumb {
width: 46px;
height: 46px;
border-radius: 0.45rem;
object-fit: cover;
border: 1px solid var(--mnt-card-border);
background: #f6f9fa;
}
.empty-state { text-align: center; padding: 3rem 1rem; color: #6c757d; }
.empty-state i { font-size: 3rem; opacity: 0.3; margin-bottom: 1rem; display: block; }
.mnt-thumb-placeholder {
display: inline-flex;
align-items: center;
justify-content: center;
color: #adb5bd;
font-size: 1.1rem;
}
.mnt-filter-bar { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-bottom: 1rem; }
.mnt-filter-bar .form-select, .mnt-filter-bar .form-control { min-width: 150px; flex: 1 1 150px; max-width: 100%; }
.empty-state {
text-align: center;
padding: 3rem 1rem;
color: #6c757d;
}
.mnt-section-title { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: #8a9aa0; margin-bottom: 0.5rem; }
.mnt-kv { display: flex; gap: 0.5rem; padding: 0.35rem 0; border-bottom: 1px dashed #eceff1; font-size: 0.88rem; }
.mnt-kv:last-child { border-bottom: none; }
.mnt-kv dt { flex: 0 0 42%; color: #6c757d; font-weight: 500; margin: 0; }
.mnt-kv dd { flex: 1; margin: 0; color: var(--mnt-heading); font-weight: 600; word-break: break-word; }
.empty-state i {
font-size: 3rem;
opacity: 0.3;
margin-bottom: 1rem;
display: block;
}
.mnt-photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 0.6rem; }
.mnt-photo-item { position: relative; border-radius: 0.5rem; overflow: hidden; border: 1px solid var(--mnt-card-border); aspect-ratio: 1; }
.mnt-photo-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mnt-photo-item .photo-tools { position: absolute; inset: auto 0 0 0; display: flex; gap: 0.25rem; justify-content: center; padding: 0.25rem; background: rgba(0, 0, 0, 0.45); opacity: 0; transition: opacity 0.15s; }
.mnt-photo-item:hover .photo-tools { opacity: 1; }
.mnt-photo-item .photo-tools button { border: none; background: transparent; color: #fff; font-size: 0.8rem; padding: 0.1rem 0.35rem; }
.mnt-photo-item.is-cover { border-color: var(--mnt-primary); box-shadow: 0 0 0 2px rgba(47, 125, 143, 0.25); }
.mnt-filter-bar {
display: flex;
flex-wrap: wrap;
gap: 0.6rem;
margin-bottom: 1rem;
}
.mnt-file-row { display: flex; align-items: center; gap: 0.6rem; padding: 0.5rem 0; border-bottom: 1px solid #f1f4f5; font-size: 0.88rem; }
.mnt-file-row:last-child { border-bottom: none; }
.mnt-file-row .file-name { flex: 1; word-break: break-all; }
.mnt-filter-bar .form-select,
.mnt-filter-bar .form-control {
min-width: 150px;
flex: 1 1 150px;
max-width: 100%;
}
.mnt-section-title {
font-size: 0.78rem;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.06em;
color: #8a9aa0;
margin-bottom: 0.5rem;
}
.mnt-kv {
display: flex;
gap: 0.5rem;
padding: 0.35rem 0;
border-bottom: 1px dashed #eceff1;
font-size: 0.88rem;
}
.mnt-kv:last-child {
border-bottom: none;
}
.mnt-kv dt {
flex: 0 0 42%;
color: #6c757d;
font-weight: 500;
margin: 0;
}
.mnt-kv dd {
flex: 1;
margin: 0;
color: var(--mnt-heading);
font-weight: 600;
word-break: break-word;
}
.mnt-photo-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
gap: 0.6rem;
}
.mnt-photo-item {
position: relative;
border-radius: 0.5rem;
overflow: hidden;
border: 1px solid var(--mnt-card-border);
aspect-ratio: 1;
}
.mnt-photo-item img {
width: 100%;
height: 100%;
object-fit: cover;
display: block;
}
.mnt-photo-item .photo-tools {
position: absolute;
inset: auto 0 0 0;
display: flex;
gap: 0.25rem;
justify-content: center;
padding: 0.25rem;
background: rgba(0, 0, 0, 0.45);
opacity: 0;
transition: opacity 0.15s;
}
.mnt-photo-item:hover .photo-tools {
opacity: 1;
}
.mnt-photo-item .photo-tools button {
border: none;
background: transparent;
color: #fff;
font-size: 0.8rem;
padding: 0.1rem 0.35rem;
}
.mnt-photo-item.is-cover {
border-color: var(--mnt-primary);
box-shadow: 0 0 0 2px rgba(47, 125, 143, 0.25);
}
.mnt-file-row {
display: flex;
align-items: center;
gap: 0.6rem;
padding: 0.5rem 0;
border-bottom: 1px solid #f1f4f5;
font-size: 0.88rem;
}
.mnt-file-row:last-child {
border-bottom: none;
}
.mnt-file-row .file-name {
flex: 1;
word-break: break-all;
}
/* Signature pad (tablet) */
.mnt-signature-wrap { border: 1px dashed var(--mnt-card-border); border-radius: 0.5rem; background: #fcfdfd; position: relative; }
.mnt-signature-wrap canvas { width: 100%; height: 160px; display: block; touch-action: none; border-radius: 0.5rem; }
.mnt-signature-wrap {
border: 1px dashed var(--mnt-card-border);
border-radius: 0.5rem;
background: #fcfdfd;
position: relative;
}
.mnt-timeline { position: relative; padding-left: 1.25rem; }
.mnt-timeline::before { content: ''; position: absolute; left: 6px; top: 4px; bottom: 4px; width: 2px; background: #e6eef0; }
.mnt-timeline-item { position: relative; padding-bottom: 0.9rem; }
.mnt-timeline-item::before { content: ''; position: absolute; left: -1.25rem; top: 0.35rem; width: 10px; height: 10px; border-radius: 50%; background: var(--mnt-primary); box-shadow: 0 0 0 3px #fff; }
.mnt-timeline-item .tl-date { font-size: 0.75rem; color: #8a9aa0; font-weight: 600; }
.mnt-timeline-item .tl-body { font-size: 0.88rem; color: var(--mnt-heading); }
.mnt-signature-wrap canvas {
width: 100%;
height: 160px;
display: block;
touch-action: none;
border-radius: 0.5rem;
}
.mnt-timeline {
position: relative;
padding-left: 1.25rem;
}
.mnt-timeline::before {
content: '';
position: absolute;
left: 6px;
top: 4px;
bottom: 4px;
width: 2px;
background: #e6eef0;
}
.mnt-timeline-item {
position: relative;
padding-bottom: 0.9rem;
}
.mnt-timeline-item::before {
content: '';
position: absolute;
left: -1.25rem;
top: 0.35rem;
width: 10px;
height: 10px;
border-radius: 50%;
background: var(--mnt-primary);
box-shadow: 0 0 0 3px #fff;
}
.mnt-timeline-item .tl-date {
font-size: 0.75rem;
color: #8a9aa0;
font-weight: 600;
}
.mnt-timeline-item .tl-body {
font-size: 0.88rem;
color: var(--mnt-heading);
}
@media (max-width: 575.98px) {
.mnt-card .card-header { flex-direction: column; gap: 0.75rem; align-items: flex-start !important; }
.header-actions { width: 100%; }
.header-actions .btn { width: 100%; justify-content: center; }
.mnt-card .card-header {
flex-direction: column;
gap: 0.75rem;
align-items: flex-start !important;
}
.header-actions {
width: 100%;
}
.header-actions .btn {
width: 100%;
justify-content: center;
}
}
</style>
</style>
+249 -237
View File
@@ -108,235 +108,236 @@ $MNT_TITLE = 'Manutenzioni';
<body>
<?php include __DIR__ . '/include/wrapper_open.php'; ?>
<?php include(__DIR__ . '/../include/navbar.php'); ?>
<?php include(__DIR__ . '/../include/topbar.php'); ?>
<?php include(__DIR__ . '/../include/navbar.php'); ?>
<?php include(__DIR__ . '/../include/topbar.php'); ?>
<div class="page-wrapper">
<div class="page-content">
<div class="page-wrapper">
<div class="page-content">
<div class="card mnt-card">
<div class="card-header d-flex align-items-center justify-content-between flex-wrap gap-2">
<h5><i class="fa-solid fa-screwdriver-wrench me-2"></i>Manutenzioni</h5>
<div class="header-actions d-flex gap-2 flex-wrap">
<a href="manutenzioni/calendar.php" class="btn btn-mnt-outline d-inline-flex align-items-center gap-2">
<i class="fa-solid fa-calendar-days"></i><span>Calendario</span>
</a>
<a href="manutenzioni/index.php" class="btn btn-mnt-outline d-inline-flex align-items-center gap-2">
<i class="fa-solid fa-boxes-stacked"></i><span>Registro</span>
</a>
</div>
</div>
<div class="card-body">
<div class="row g-2 mb-3">
<?php
$tiles = [
['key' => 'overdue', 'label' => 'Scadute', 'class' => 'mnt-badge-overdue'],
['key' => 'due_soon', 'label' => 'In scadenza', 'class' => 'mnt-badge-soon'],
['key' => 'ok', 'label' => 'In regola', 'class' => 'mnt-badge-ok'],
['key' => 'none', 'label' => 'Senza scadenza', 'class' => 'mnt-badge-none'],
];
?>
<?php foreach ($tiles as $tile): ?>
<div class="col-6 col-md-3">
<?php
// Percorso completo, non "?...": con <base href="/userarea/">
// un href di sola query porterebbe alla dashboard del template.
// page is dropped: changing the filter changes the result
// set, and staying on page 3 of the previous one is nonsense.
$tileQuery = $_GET;
unset($tileQuery['page']);
$tileUrl = 'manutenzioni/maintenances.php?' . http_build_query(
array_merge($tileQuery, ['state' => $filterState === $tile['key'] ? '' : $tile['key']])
);
?>
<a class="d-block text-decoration-none" href="<?= mnt_h($tileUrl) ?>">
<div class="mnt-item-card mb-0 <?= $filterState === $tile['key'] ? 'border-2' : '' ?>"
style="--row-color: <?= $tile['key'] === 'overdue' ? '#dc3545' : ($tile['key'] === 'due_soon' ? '#f0a202' : ($tile['key'] === 'ok' ? '#198754' : '#adb5bd')) ?>">
<div class="ic-title" style="font-size:1.4rem"><?= (int)$counters[$tile['key']] ?></div>
<div class="ic-meta"><?= $tile['label'] ?></div>
</div>
</a>
</div>
<?php endforeach; ?>
</div>
<form class="mnt-filter-bar" method="get" id="filterForm">
<input type="hidden" name="state" value="<?= mnt_h($filterState) ?>">
<select class="form-select" name="type">
<option value="">Programmate e straordinarie</option>
<?php foreach ($typeLabels as $value => $label): ?>
<option value="<?= mnt_h($value) ?>" <?= $filterType === $value ? 'selected' : '' ?>>
Solo <?= mnt_h(mb_strtolower($label)) ?>
</option>
<?php endforeach; ?>
</select>
<select class="form-select" name="category">
<option value="">Tutte le categorie</option>
<?php foreach ($formData['categories'] as $category): ?>
<option value="<?= (int)$category['id'] ?>" <?= $filterCategory === (int)$category['id'] ? 'selected' : '' ?>>
<?= mnt_h($category['name']) ?>
</option>
<?php endforeach; ?>
</select>
<div class="form-check d-flex align-items-center gap-2 ms-1">
<input class="form-check-input mt-0" type="checkbox" name="critical" value="1" id="fCritical" <?= $filterCritical ? 'checked' : '' ?>>
<label class="form-check-label" for="fCritical">Solo critiche</label>
</div>
<div class="form-check d-flex align-items-center gap-2 ms-1">
<input class="form-check-input mt-0" type="checkbox" name="mine" value="1" id="fMine" <?= $filterMine ? 'checked' : '' ?>>
<label class="form-check-label" for="fMine">Assegnate a me</label>
</div>
<?php if ($perPage !== 25): ?>
<input type="hidden" name="per_page" value="<?= (int)$perPage ?>">
<?php endif; ?>
<!-- No «Filtra» button: selects and checkboxes all submit on change,
so it never had anything left to do. Kept hidden only as the
no-JavaScript fallback. -->
<button type="submit" class="visually-hidden">Filtra</button>
<a href="manutenzioni/maintenances.php" class="btn btn-mnt-outline btn-reset-filters d-inline-flex align-items-center gap-2">
<i class="fa-solid fa-xmark"></i><span>Azzera filtri</span>
</a>
</form>
<?php if (!$maintenances): ?>
<div class="empty-state">
<i class="fa-solid fa-screwdriver-wrench"></i>
<p>Nessuna manutenzione con questi filtri.</p>
</div>
<?php else: ?>
<div id="maintenanceList">
<!-- CARD -->
<div class="d-xl-none">
<?php foreach ($maintenances as $maintenance): ?>
<?php $badge = mnt_due_badge($maintenance['state'], $maintenance['frequency_unit']); ?>
<div class="mnt-item-card" data-id="<?= (int)$maintenance['id'] ?>"
style="--row-color: <?= $maintenance['is_critical'] ? '#dc3545' : mnt_h($maintenance['category_color'] ?? '#e9ecef') ?>">
<div class="ic-title"><?= mnt_h($maintenance['equipment_name']) ?></div>
<div class="ic-meta">
<?php if ($maintenance['code']): ?><strong><?= mnt_h($maintenance['code']) ?></strong> · <?php endif; ?>
<?= mnt_h($maintenance['title']) ?>
</div>
<div class="ic-meta">
Prossimo: <strong><?= mnt_format_date($maintenance['next_due_date']) ?></strong>
<span class="mnt-badge <?= $badge['class'] ?> ms-1"><?= $badge['label'] ?></span>
</div>
<div class="ic-actions">
<a class="btn-action btn-action-view" href="manutenzioni/equipment.php?id=<?= (int)$maintenance['equipment_id'] ?>">
<i class="fa-solid fa-eye"></i>
</a>
<?php if ($canManage): ?>
<button class="btn-action btn-action-done btn-register" title="Registra intervento">
<i class="fa-solid fa-check"></i>
</button>
<?php endif; ?>
</div>
</div>
<?php endforeach; ?>
</div>
<!-- DESKTOP -->
<!-- Table only from 1200px up: measured, the 6 columns need
~1280px to fit, so on a tablet it only scrolls sideways. -->
<div class="d-none d-xl-block table-responsive">
<table class="table table-hover align-middle mb-0">
<thead>
<tr>
<th class="mnt-equipment-cell">Attrezzatura</th>
<th>Manutenzione</th>
<th class="mnt-freq-cell">Frequenza</th>
<th class="mnt-person-cell">Incaricato</th>
<th class="text-center">Prossima</th>
<th class="text-center" style="width:130px">Azioni</th>
</tr>
</thead>
<tbody>
<?php foreach ($maintenances as $maintenance): ?>
<?php $badge = mnt_due_badge($maintenance['state'], $maintenance['frequency_unit']); ?>
<tr data-id="<?= (int)$maintenance['id'] ?>">
<td class="mnt-equipment-cell">
<span class="d-flex align-items-start gap-2">
<span class="mnt-cat-dot mt-1" style="background: <?= mnt_h($maintenance['category_color'] ?? '#adb5bd') ?>"></span>
<span class="fw-semibold mnt-title-clamp" style="color:var(--mnt-heading)"
title="<?= mnt_h($maintenance['equipment_name']) ?>"><?= mnt_h($maintenance['equipment_name']) ?></span>
</span>
<div class="small text-muted"><?= mnt_h($maintenance['category_name'] ?? '') ?></div>
</td>
<td class="mnt-title-cell">
<?php if ($maintenance['code']): ?>
<span class="mnt-badge mnt-badge-soft me-1"><?= mnt_h($maintenance['code']) ?></span>
<?php endif; ?>
<?php if ($maintenance['is_critical']): ?>
<span class="mnt-badge mnt-badge-critical ms-1">Critica</span>
<?php endif; ?>
<div class="mnt-title-clamp" title="<?= mnt_h($maintenance['title']) ?>">
<?= mnt_h($maintenance['title']) ?>
</div>
<div class="small text-muted">
<?= mnt_h($typeLabels[$maintenance['intervention_type']] ?? '') ?>
· <?= mnt_h($executionLabels[$maintenance['execution_type']] ?? '') ?>
<?php if ($maintenance['supplier_name']): ?>
<?= mnt_h($maintenance['supplier_name']) ?>
<?php endif; ?>
</div>
</td>
<td class="small mnt-freq-cell"><div class="mnt-title-clamp"><?= mnt_h(mnt_format_frequency(
$maintenance['frequency_value'] !== null ? (int)$maintenance['frequency_value'] : null,
$maintenance['frequency_unit'],
$maintenance['frequency_note']
)) ?></div></td>
<td class="small mnt-person-cell">
<?= mnt_h($maintenance['assignee_name'] ?: '—') ?>
<?php if ($maintenance['supervisor_name']): ?>
<div class="text-muted"><?= mnt_h($maintenance['supervisor_name']) ?></div>
<?php endif; ?>
</td>
<td class="text-center">
<div><?= mnt_format_date($maintenance['next_due_date']) ?></div>
<span class="mnt-badge <?= $badge['class'] ?>"><?= $badge['label'] ?></span>
</td>
<td class="text-center">
<div class="d-inline-flex gap-1">
<a class="btn-action btn-action-view" title="Apri scheda"
href="manutenzioni/equipment.php?id=<?= (int)$maintenance['equipment_id'] ?>">
<i class="fa-solid fa-eye"></i>
</a>
<?php if ($canManage): ?>
<button class="btn-action btn-action-done btn-register" title="Registra intervento">
<i class="fa-solid fa-check"></i>
</button>
<?php endif; ?>
</div>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
<?php
$mntPagerUrl = 'manutenzioni/maintenances.php';
$mntPagerPage = $page;
$mntPagerPages = $totalPages;
$mntPagerTotal = $totalMaintenances;
$mntPagerPer = $perPage;
include __DIR__ . '/include/pagination.php';
?>
<?php endif; ?>
<div class="card mnt-card">
<div class="card-header d-flex align-items-center justify-content-between flex-wrap gap-2">
<h5><i class="fa-solid fa-screwdriver-wrench me-2"></i>Manutenzioni</h5>
<div class="header-actions d-flex gap-2 flex-wrap">
<a href="manutenzioni/calendar.php" class="btn btn-mnt-outline d-inline-flex align-items-center gap-2">
<i class="fa-solid fa-calendar-days"></i><span>Calendario</span>
</a>
<a href="manutenzioni/index.php" class="btn btn-mnt-outline d-inline-flex align-items-center gap-2">
<i class="fa-solid fa-boxes-stacked"></i><span>Registro</span>
</a>
</div>
</div>
<div class="card-body">
<div class="row g-2 mb-3">
<?php
$tiles = [
['key' => 'overdue', 'label' => 'Scadute', 'class' => 'mnt-badge-overdue'],
['key' => 'due_soon', 'label' => 'In scadenza', 'class' => 'mnt-badge-soon'],
['key' => 'ok', 'label' => 'In regola', 'class' => 'mnt-badge-ok'],
['key' => 'none', 'label' => 'Senza scadenza', 'class' => 'mnt-badge-none'],
];
?>
<?php foreach ($tiles as $tile): ?>
<div class="col-6 col-md-3">
<?php
// Percorso completo, non "?...": con <base href="/userarea/">
// un href di sola query porterebbe alla dashboard del template.
// page is dropped: changing the filter changes the result
// set, and staying on page 3 of the previous one is nonsense.
$tileQuery = $_GET;
unset($tileQuery['page']);
$tileUrl = 'manutenzioni/maintenances.php?' . http_build_query(
array_merge($tileQuery, ['state' => $filterState === $tile['key'] ? '' : $tile['key']])
);
?>
<a class="d-block text-decoration-none" href="<?= mnt_h($tileUrl) ?>">
<div class="mnt-item-card mnt-tile mnt-tile-<?= $tile['key'] ?> mb-0 <?= $filterState === $tile['key'] ? 'mnt-tile-active' : '' ?>">
<div class="ic-title" style="font-size:1.4rem"><?= (int)$counters[$tile['key']] ?></div>
<div class="ic-meta"><?= $tile['label'] ?></div>
</div>
</a>
</div>
<?php endforeach; ?>
</div>
<form class="mnt-filter-bar" method="get" id="filterForm">
<input type="hidden" name="state" value="<?= mnt_h($filterState) ?>">
<select class="form-select" name="type">
<option value="">Programmate e straordinarie</option>
<?php foreach ($typeLabels as $value => $label): ?>
<option value="<?= mnt_h($value) ?>" <?= $filterType === $value ? 'selected' : '' ?>>
Solo <?= mnt_h(mb_strtolower($label)) ?>
</option>
<?php endforeach; ?>
</select>
<select class="form-select" name="category">
<option value="">Tutte le categorie</option>
<?php foreach ($formData['categories'] as $category): ?>
<option value="<?= (int)$category['id'] ?>" <?= $filterCategory === (int)$category['id'] ? 'selected' : '' ?>>
<?= mnt_h($category['name']) ?>
</option>
<?php endforeach; ?>
</select>
<div class="form-check d-flex align-items-center gap-2 ms-1">
<input class="form-check-input mt-0" type="checkbox" name="critical" value="1" id="fCritical" <?= $filterCritical ? 'checked' : '' ?>>
<label class="form-check-label" for="fCritical">Solo critiche</label>
</div>
<div class="form-check d-flex align-items-center gap-2 ms-1">
<input class="form-check-input mt-0" type="checkbox" name="mine" value="1" id="fMine" <?= $filterMine ? 'checked' : '' ?>>
<label class="form-check-label" for="fMine">Assegnate a me</label>
</div>
<?php if ($perPage !== 25): ?>
<input type="hidden" name="per_page" value="<?= (int)$perPage ?>">
<?php endif; ?>
<!-- No «Filtra» button: selects and checkboxes all submit on change,
so it never had anything left to do. Kept hidden only as the
no-JavaScript fallback. -->
<button type="submit" class="visually-hidden">Filtra</button>
<a href="manutenzioni/maintenances.php" class="btn btn-mnt-outline btn-reset-filters d-inline-flex align-items-center gap-2">
<i class="fa-solid fa-xmark"></i><span>Azzera filtri</span>
</a>
</form>
<?php if (!$maintenances): ?>
<div class="empty-state">
<i class="fa-solid fa-screwdriver-wrench"></i>
<p>Nessuna manutenzione con questi filtri.</p>
</div>
<?php else: ?>
<div id="maintenanceList">
<!-- CARD -->
<div class="d-xl-none">
<?php foreach ($maintenances as $maintenance): ?>
<?php $badge = mnt_due_badge($maintenance['state'], $maintenance['frequency_unit']); ?>
<div class="mnt-item-card" data-id="<?= (int)$maintenance['id'] ?>"
style="--row-color: <?= $maintenance['is_critical'] ? '#dc3545' : mnt_h($maintenance['category_color'] ?? '#e9ecef') ?>">
<div class="ic-title"><?= mnt_h($maintenance['equipment_name']) ?></div>
<div class="ic-meta">
<?php if ($maintenance['code']): ?><strong><?= mnt_h($maintenance['code']) ?></strong> · <?php endif; ?>
<?= mnt_h($maintenance['title']) ?>
</div>
<div class="ic-meta">
Prossimo: <strong><?= mnt_format_date($maintenance['next_due_date']) ?></strong>
<span class="mnt-badge <?= $badge['class'] ?> ms-1"><?= $badge['label'] ?></span>
</div>
<div class="ic-actions">
<a class="btn-action btn-action-view" href="manutenzioni/equipment.php?id=<?= (int)$maintenance['equipment_id'] ?>">
<i class="fa-solid fa-eye"></i>
</a>
<?php if ($canManage): ?>
<button class="btn-action btn-action-done btn-register" title="Registra intervento">
<i class="fa-solid fa-check"></i>
</button>
<?php endif; ?>
</div>
</div>
<?php endforeach; ?>
</div>
<!-- DESKTOP -->
<!-- Table only from 1200px up: measured, the 6 columns need
~1280px to fit, so on a tablet it only scrolls sideways. -->
<div class="d-none d-xl-block table-responsive">
<table class="table table-hover align-middle mb-0">
<thead>
<tr>
<th class="mnt-equipment-cell">Attrezzatura</th>
<th>Manutenzione</th>
<th class="mnt-freq-cell">Frequenza</th>
<th class="mnt-person-cell">Incaricato</th>
<th class="text-center">Prossima</th>
<th class="text-center" style="width:130px">Azioni</th>
</tr>
</thead>
<tbody>
<?php foreach ($maintenances as $maintenance): ?>
<?php $badge = mnt_due_badge($maintenance['state'], $maintenance['frequency_unit']); ?>
<tr data-id="<?= (int)$maintenance['id'] ?>">
<td class="mnt-equipment-cell">
<span class="d-flex align-items-start gap-2">
<span class="mnt-cat-dot mt-1" style="background: <?= mnt_h($maintenance['category_color'] ?? '#adb5bd') ?>"></span>
<span class="fw-semibold mnt-title-clamp" style="color:var(--mnt-heading)"
title="<?= mnt_h($maintenance['equipment_name']) ?>"><?= mnt_h($maintenance['equipment_name']) ?></span>
</span>
<div class="small text-muted"><?= mnt_h($maintenance['category_name'] ?? '') ?></div>
</td>
<td class="mnt-title-cell">
<?php if ($maintenance['code']): ?>
<span class="mnt-badge mnt-badge-soft me-1"><?= mnt_h($maintenance['code']) ?></span>
<?php endif; ?>
<?php if ($maintenance['is_critical']): ?>
<span class="mnt-badge mnt-badge-critical ms-1">Critica</span>
<?php endif; ?>
<div class="mnt-title-clamp" title="<?= mnt_h($maintenance['title']) ?>">
<?= mnt_h($maintenance['title']) ?>
</div>
<div class="small text-muted">
<?= mnt_h($typeLabels[$maintenance['intervention_type']] ?? '') ?>
· <?= mnt_h($executionLabels[$maintenance['execution_type']] ?? '') ?>
<?php if ($maintenance['supplier_name']): ?>
<?= mnt_h($maintenance['supplier_name']) ?>
<?php endif; ?>
</div>
</td>
<td class="small mnt-freq-cell">
<div class="mnt-title-clamp"><?= mnt_h(mnt_format_frequency(
$maintenance['frequency_value'] !== null ? (int)$maintenance['frequency_value'] : null,
$maintenance['frequency_unit'],
$maintenance['frequency_note']
)) ?></div>
</td>
<td class="small mnt-person-cell">
<?= mnt_h($maintenance['assignee_name'] ?: '—') ?>
<?php if ($maintenance['supervisor_name']): ?>
<div class="text-muted"><?= mnt_h($maintenance['supervisor_name']) ?></div>
<?php endif; ?>
</td>
<td class="text-center">
<div><?= mnt_format_date($maintenance['next_due_date']) ?></div>
<span class="mnt-badge <?= $badge['class'] ?>"><?= $badge['label'] ?></span>
</td>
<td class="text-center">
<div class="d-inline-flex gap-1">
<a class="btn-action btn-action-view" title="Apri scheda"
href="manutenzioni/equipment.php?id=<?= (int)$maintenance['equipment_id'] ?>">
<i class="fa-solid fa-eye"></i>
</a>
<?php if ($canManage): ?>
<button class="btn-action btn-action-done btn-register" title="Registra intervento">
<i class="fa-solid fa-check"></i>
</button>
<?php endif; ?>
</div>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
<?php
$mntPagerUrl = 'manutenzioni/maintenances.php';
$mntPagerPage = $page;
$mntPagerPages = $totalPages;
$mntPagerTotal = $totalMaintenances;
$mntPagerPer = $perPage;
include __DIR__ . '/include/pagination.php';
?>
<?php endif; ?>
</div>
</div>
</div>
<?php include(__DIR__ . '/../include/footer.php'); ?>
</div>
<?php include(__DIR__ . '/../include/footer.php'); ?>
</div>
<?php if ($canManage): ?>
@@ -345,26 +346,37 @@ $MNT_TITLE = 'Manutenzioni';
<?php include(__DIR__ . '/../jsinclude.php'); ?>
<script>
$(function () {
$('#filterForm select, #filterForm input[type=checkbox]').on('change', function () { $('#filterForm').submit(); });
$(function() {
$('#filterForm select, #filterForm input[type=checkbox]').on('change', function() {
$('#filterForm').submit();
});
<?php if ($canManage): ?>
$('#maintenanceList').on('click', '.btn-register', function () {
const id = $(this).closest('[data-id]').data('id');
$.getJSON('manutenzioni/ajax/get_maintenance.php', { id: id })
.done(res => {
if (!res.success) { Swal.fire({ icon: 'error', title: 'Errore', text: res.message }); return; }
mntOpenInterventionModal(null, {
id: res.maintenance.id,
title: res.maintenance.title,
equipment_name: res.maintenance.equipment_name,
supplier_id: res.maintenance.supplier_id
$('#maintenanceList').on('click', '.btn-register', function() {
const id = $(this).closest('[data-id]').data('id');
$.getJSON('manutenzioni/ajax/get_maintenance.php', {
id: id
})
.done(res => {
if (!res.success) {
Swal.fire({
icon: 'error',
title: 'Errore',
text: res.message
});
return;
}
mntOpenInterventionModal(null, {
id: res.maintenance.id,
title: res.maintenance.title,
equipment_name: res.maintenance.equipment_name,
supplier_id: res.maintenance.supplier_id
});
});
});
});
});
<?php endif; ?>
});
</script>
</body>
</html>
</html>