Files
zibo-dashboard/public/userarea/manutenzioni/include/page_head.php
T
2026-08-25 09:04:07 +02:00

682 lines
15 KiB
PHP

<?php
/**
* Shared <head> for the Manutenzioni pages.
*
* Usage (before including):
* $MNT_TITLE = 'Registro attrezzature';
* $MNT_PLUGINS = ['fullcalendar']; // opzionale
* include __DIR__ . '/include/page_head.php';
*
* Works from any depth under /userarea/ — the base href is derived from
* SCRIPT_NAME, so all asset paths stay relative to /userarea/.
*/
$MNT_TITLE = $MNT_TITLE ?? 'Manutenzioni';
$MNT_PLUGINS = $MNT_PLUGINS ?? [];
$mntScriptName = $_SERVER['SCRIPT_NAME'] ?? '';
$mntMarker = '/userarea/';
$mntPos = strpos($mntScriptName, $mntMarker);
$MNT_BASE = $mntPos !== false
? substr($mntScriptName, 0, $mntPos + strlen($mntMarker))
: '/userarea/';
?>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<base href="<?= mnt_h($MNT_BASE) ?>">
<?php include(__DIR__ . '/../../cssinclude.php'); ?>
<script src="assets/js/jquery.min.js"></script>
<title><?= mnt_h($MNT_TITLE) ?> — Manutenzioni</title>
<?php if (in_array('fullcalendar', $MNT_PLUGINS, true)): ?>
<script src="manutenzioni/assets/fullcalendar.min.js"></script>
<script src="manutenzioni/assets/fullcalendar-it.js"></script>
<?php endif; ?>
<script>
document.addEventListener('DOMContentLoaded', function() {
if (typeof window.Swal === 'undefined') {
var local = document.createElement('script');
local.src = 'manutenzioni/assets/sweetalert2.min.js';
document.head.appendChild(local);
}
});
</script>
<style>
:root {
--mnt-primary: #2f7d8f;
--mnt-primary-hover: #256575;
--mnt-heading: #1e3a44;
--mnt-card-bg: linear-gradient(135deg, #eef7f9 0%, #e4f0f3 100%);
--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;
}
.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-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;
}
/* 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;
}
}
.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-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;
}
.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-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%;
}
.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-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;
}
}
</style>