added production to fill

This commit is contained in:
2026-09-21 09:17:53 +02:00
parent cc24202937
commit 06092e24aa
2 changed files with 153 additions and 56 deletions
+5
View File
@@ -164,6 +164,11 @@
<i class='bx bx-radio-circle'></i>Line View
</a>
</li>
<li>
<a href="production_da_compilare.php">
<i class='bx bx-radio-circle'></i>Dati Prod
</a>
</li>
<?php endif; ?>
<?php if (userCan('production.stats.view')) : ?>
+148 -56
View File
@@ -120,36 +120,47 @@ if (!empty($_GET['ajax'])) {
$teoKg = number_format((float)($r['kg_sp'] ?? 0), 2, '.', '');
$teoMt = number_format((float)($r['metri'] ?? 0), 2, '.', '');
$descr = trim($r['note_extra'] ?? '');
$descrShow = $descr !== '' ? $descr : '—';
echo '<div class="compile-card" data-id="' . (int)$r['id'] . '"
data-teokg="' . htmlspecialchars($teoKg) . '"
data-teomt="' . htmlspecialchars($teoMt) . '">';
echo '<div class="compile-head">';
echo '<div class="compile-title">' . htmlspecialchars($r['matrice'] ?? '—') . '</div>';
echo '<div class="compile-badge">Da compilare</div>';
// --- RIGA COMPATTA (sempre visibile) ---
echo '<div class="compile-row">';
echo ' <div class="compile-main">';
echo ' <div class="compile-title">' . htmlspecialchars($r['matrice'] ?? '—') . '</div>';
echo ' <div class="compile-descr">' . htmlspecialchars($descrShow) . '</div>';
echo ' <div class="compile-meta">';
echo ' <span><i class="bi bi-person"></i> ' . htmlspecialchars($r['cliente'] ?? '—') . '</span>';
echo ' <span><i class="bi bi-clock-history"></i> ' . $endTime . '</span>';
echo ' </div>';
echo ' </div>';
echo ' <div class="compile-right">';
echo ' <span class="compile-badge">Compila dati</span>';
echo ' <i class="bi bi-chevron-down expand-arrow"></i>';
echo ' </div>';
echo '</div>';
echo '<div class="compile-grid">';
echo '<div><strong>Linea</strong><span>' . htmlspecialchars($r['linea'] ?? '—') . '</span></div>';
echo '<div><strong>Cliente</strong><span>' . htmlspecialchars($r['cliente'] ?? '—') . '</span></div>';
echo '<div><strong>Fine produzione</strong><span>' . $endTime . '</span></div>';
echo '<div><strong>Tempo occupato</strong><span>' . $occupato . '</span></div>';
echo '<div><strong>Tempo pause</strong><span>' . $pause . '</span></div>';
echo '<div><strong>Tempo netto</strong><span>' . $netto . '</span></div>';
echo '</div>';
// --- DETTAGLIO (collassato) ---
echo '<div class="compile-detail">';
echo ' <div class="compile-grid">';
echo ' <div><strong>Linea</strong><span>' . htmlspecialchars($r['linea'] ?? '—') . '</span></div>';
echo ' <div><strong>Tempo occupato</strong><span>' . $occupato . '</span></div>';
echo ' <div><strong>Tempo pause</strong><span>' . $pause . '</span></div>';
echo ' <div><strong>Tempo netto</strong><span>' . $netto . '</span></div>';
echo ' </div>';
if (!empty($r['mescole_list'])) {
echo '<div class="compile-mescole"><strong>Mescole:</strong> '
echo ' <div class="compile-mescole"><strong>Mescole:</strong> '
. htmlspecialchars($r['mescole_list']) . '</div>';
}
if (!empty($r['note_extra'])) {
echo '<div class="compile-mescole"><strong>Descrizione:</strong> '
. htmlspecialchars($r['note_extra']) . '</div>';
}
echo '<div class="compile-actions">';
echo '<button class="compile-btn btn-fill" data-id="' . (int)$r['id'] . '">Compila dati</button>';
echo '</div>';
echo ' <div class="compile-actions">';
echo ' <button class="compile-btn btn-fill" data-id="' . (int)$r['id'] . '">Compila dati</button>';
echo ' </div>';
echo '</div>'; // .compile-detail
echo '</div>'; // .compile-card
}
@@ -209,7 +220,7 @@ if (!empty($_GET['ajax'])) {
}
.card-header {
background: linear-gradient(135deg, #6d28d9, #7c3aed);
background: linear-gradient(135deg, #1d4ed8, #3b82f6);
color: white;
padding: 1.2rem 1.5rem;
flex-shrink: 0;
@@ -242,95 +253,171 @@ if (!empty($_GET['ajax'])) {
#recordsContainer {
flex: 1;
overflow-y: auto;
padding: 1.2rem 1.5rem 5rem 1.5rem;
padding: 1rem 1.5rem 5rem 1.5rem;
background: #f8fafc;
}
/* --- CARD COMPATTA --- */
.compile-card {
background: #fff;
border-radius: 1rem;
border-left: 6px solid #7c3aed;
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
padding: 1.1rem 1.3rem;
margin-bottom: 1rem;
border-radius: 0.7rem;
border: 1px solid #e2e8f0;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
margin-bottom: 0.6rem;
overflow: hidden;
transition: box-shadow 0.2s;
}
.compile-head {
.compile-card:hover {
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
.compile-row {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 0.8rem;
justify-content: space-between;
gap: 1rem;
padding: 0.7rem 1rem;
cursor: pointer;
}
.compile-main {
min-width: 0;
flex: 1;
}
.compile-title {
font-size: 1.3rem;
font-weight: 800;
font-size: 1.05rem;
font-weight: 700;
color: #1e293b;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.compile-descr {
font-size: 0.85rem;
color: #64748b;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
margin-top: 0.1rem;
}
.compile-meta {
display: flex;
gap: 1.2rem;
flex-wrap: wrap;
margin-top: 0.35rem;
font-size: 0.82rem;
color: #475569;
}
.compile-meta span {
display: inline-flex;
align-items: center;
gap: 0.35rem;
}
.compile-meta i {
color: #94a3b8;
}
.compile-right {
display: flex;
align-items: center;
gap: 0.7rem;
flex-shrink: 0;
}
.compile-badge {
background: #ede9fe;
color: #6d28d9;
padding: 0.35rem 0.85rem;
background: #dbeafe;
color: #1e40af;
border: 1px solid #bfdbfe;
padding: 0.3rem 0.8rem;
border-radius: 2rem;
font-size: 0.75rem;
font-size: 0.72rem;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.5px;
letter-spacing: 0.4px;
white-space: nowrap;
}
.expand-arrow {
font-size: 1.1rem;
color: #94a3b8;
transition: transform 0.3s ease;
}
.compile-card.expanded .expand-arrow {
transform: rotate(180deg);
}
/* --- DETTAGLIO COLLASSATO --- */
.compile-detail {
max-height: 0;
overflow: hidden;
transition: max-height 0.35s ease, padding 0.35s ease;
padding: 0 1rem;
border-top: 0 solid #e2e8f0;
}
.compile-card.expanded .compile-detail {
max-height: 500px;
padding: 0.9rem 1rem 1rem 1rem;
border-top: 1px solid #e2e8f0;
}
.compile-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
gap: 0.7rem 1rem;
margin-bottom: 0.6rem;
grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
gap: 0.6rem 1rem;
}
.compile-grid strong {
display: block;
color: #64748b;
font-size: 0.7rem;
font-size: 0.68rem;
text-transform: uppercase;
letter-spacing: 0.5px;
margin-bottom: 0.15rem;
letter-spacing: 0.4px;
margin-bottom: 0.1rem;
}
.compile-grid span {
color: #1e293b;
font-weight: 600;
font-size: 1.05rem;
font-size: 1rem;
}
.compile-mescole {
color: #475569;
font-size: 0.95rem;
margin-top: 0.3rem;
font-size: 0.9rem;
margin-top: 0.7rem;
}
.compile-actions {
margin-top: 1rem;
margin-top: 0.9rem;
display: flex;
justify-content: flex-end;
}
.compile-btn {
padding: 0.9rem 1.6rem;
font-size: 1.05rem;
padding: 0.75rem 1.4rem;
font-size: 1rem;
font-weight: 700;
border: none;
border-radius: 0.8rem;
border-radius: 0.7rem;
cursor: pointer;
color: white;
text-transform: uppercase;
letter-spacing: 0.8px;
letter-spacing: 0.5px;
}
.btn-fill {
background: linear-gradient(135deg, #7c3aed, #6d28d9);
background: linear-gradient(135deg, #10b981, #059669);
}
.btn-fill:hover {
background: linear-gradient(135deg, #6d28d9, #5b21b6);
background: linear-gradient(135deg, #059669, #047857);
}
.no-records {
@@ -342,7 +429,7 @@ if (!empty($_GET['ajax'])) {
.no-records i {
font-size: 3.5rem;
color: #a78bfa;
color: #cbd5e1;
}
/* --- MODALE --- */
@@ -442,7 +529,7 @@ if (!empty($_GET['ajax'])) {
}
.modal-confirm {
background: #7c3aed;
background: #10b981;
color: white;
}
@@ -529,7 +616,7 @@ if (!empty($_GET['ajax'])) {
function loadRecords() {
$('#recordsContainer').html(
'<div class="text-center p-5"><i class="bi bi-hourglass-split" style="font-size:2.5rem;color:#a78bfa;"></i></div>'
'<div class="text-center p-5"><i class="bi bi-hourglass-split" style="font-size:2.5rem;color:#94a3b8;"></i></div>'
);
$.get('', {
ajax: 1
@@ -540,6 +627,11 @@ if (!empty($_GET['ajax'])) {
});
}
// Collasso/espansione riga (clic sulla riga, non sui bottoni)
$(document).on('click', '.compile-row', function() {
$(this).closest('.compile-card').toggleClass('expanded');
});
function recalcScrapPerc() {
const kg = parseFloat($('#kgprod').val()) || 0;
const sc = parseFloat($('#scarto').val()) || 0;