trainings changed details

This commit is contained in:
2026-05-26 16:55:04 +02:00
parent fdc3af01f3
commit 70b712ff3b
4 changed files with 913 additions and 183 deletions
+250 -48
View File
@@ -33,36 +33,193 @@ $topics = $pdo->query($sql)->fetchAll(PDO::FETCH_ASSOC);
<script src="https://cdn.datatables.net/1.13.6/js/dataTables.bootstrap5.min.js"></script>
<style>
body { font-size: 1.05rem; background: #f8fafc; }
.card { border-radius: 16px; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08); }
body {
font-size: 1.05rem;
background: #f8fafc;
}
.card {
border-radius: 16px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
.back-dashboard {
background-color: #cfe3ff !important; color: #1f2d3d !important;
border: 1px solid #bcd4f4 !important; border-radius: 10px;
font-weight: 600; padding: 10px 18px;
background-color: #cfe3ff !important;
color: #1f2d3d !important;
border: 1px solid #bcd4f4 !important;
border-radius: 10px;
font-weight: 600;
padding: 10px 18px;
box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
transition: all 0.2s ease-in-out;
}
.back-dashboard:hover { background-color: #b9d3ff !important; transform: translateY(-2px); }
.btn-add { background-color: #0d6efd; color: #fff; border-radius: 8px; padding: 10px 20px; font-weight: 500; }
.btn-add:hover { background-color: #0b5ed7; transform: scale(1.02); }
.table thead { background-color: #cfe3ff; color: #1f2d3d; }
.modal-content { border-radius: 16px; }
#tabellaTopics thead th { text-align: center; vertical-align: middle; }
.badge-status { padding: 0.25rem 0.6rem; border-radius: 999px; font-size: 0.8rem; font-weight: 600; }
.badge-status.active { background-color: #d1fae5; color: #065f46; }
.badge-status.inactive { background-color: #e5e7eb; color: #374151; }
.description-cell {
max-width: 280px; white-space: nowrap; overflow: hidden;
text-overflow: ellipsis; text-align: left;
.back-dashboard:hover {
background-color: #b9d3ff !important;
transform: translateY(-2px);
}
.num-pill {
display: inline-block; padding: 2px 10px; border-radius: 999px;
background: #eef2ff; color: #3730a3; font-weight: 600; font-size: 0.85rem;
.training-header-actions {
display: flex;
align-items: center;
gap: 8px;
flex-wrap: wrap;
}
.btn-training-action {
border-radius: 10px;
font-weight: 500;
padding: 10px 16px;
box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
transition: all 0.2s ease-in-out;
color: #fff !important;
}
.btn-training-action:hover {
transform: translateY(-2px);
color: #fff !important;
}
.btn-training-history {
background-color: #0d6efd !important;
border: 1px solid #0b5ed7 !important;
}
.btn-training-history:hover {
background-color: #0b5ed7 !important;
}
.btn-training-calendar {
background-color: #2563eb !important;
border: 1px solid #1d4ed8 !important;
}
.btn-training-calendar:hover {
background-color: #1d4ed8 !important;
}
@media (max-width: 767.98px) {
.card-header { flex-direction: column; align-items: flex-start !important; gap: .5rem; }
.back-dashboard { width: 100%; }
.btn-add { width: 100%; }
.training-header-actions {
width: 100%;
flex-direction: column;
}
.training-header-actions .btn {
width: 100%;
}
}
.btn-add {
background-color: #0d6efd;
color: #fff;
border-radius: 8px;
padding: 10px 20px;
font-weight: 500;
}
.btn-add:hover {
background-color: #0b5ed7;
transform: scale(1.02);
}
.training-shortcuts {
display: flex;
flex-wrap: wrap;
gap: 10px;
margin-bottom: 18px;
}
.training-shortcut-btn {
display: inline-flex;
align-items: center;
gap: 8px;
border-radius: 10px;
padding: 10px 16px;
font-weight: 600;
text-decoration: none;
border: 1px solid #bcd4f4;
background: #cfe3ff;
color: #1f2d3d;
box-shadow: 0 3px 8px rgba(0, 0, 0, .08);
transition: all .2s ease-in-out;
}
.training-shortcut-btn:hover {
background: #b9d3ff;
color: #1f2d3d;
transform: translateY(-2px);
}
@media (max-width: 767.98px) {
.training-shortcut-btn {
width: 100%;
justify-content: center;
}
}
.table thead {
background-color: #cfe3ff;
color: #1f2d3d;
}
.modal-content {
border-radius: 16px;
}
#tabellaTopics thead th {
text-align: center;
vertical-align: middle;
}
.badge-status {
padding: 0.25rem 0.6rem;
border-radius: 999px;
font-size: 0.8rem;
font-weight: 600;
}
.badge-status.active {
background-color: #d1fae5;
color: #065f46;
}
.badge-status.inactive {
background-color: #e5e7eb;
color: #374151;
}
.description-cell {
max-width: 280px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
text-align: left;
}
.num-pill {
display: inline-block;
padding: 2px 10px;
border-radius: 999px;
background: #eef2ff;
color: #3730a3;
font-weight: 600;
font-size: 0.85rem;
}
@media (max-width: 767.98px) {
.card-header {
flex-direction: column;
align-items: flex-start !important;
gap: .5rem;
}
.back-dashboard {
width: 100%;
}
.btn-add {
width: 100%;
}
}
.tt-card {
@@ -73,6 +230,7 @@ $topics = $pdo->query($sql)->fetchAll(PDO::FETCH_ASSOC);
background: #fff;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}
.tt-card-title {
font-size: 1.1rem;
font-weight: 600;
@@ -80,12 +238,14 @@ $topics = $pdo->query($sql)->fetchAll(PDO::FETCH_ASSOC);
margin: 0 0 4px 0;
word-break: break-word;
}
.tt-card-desc {
color: #475569;
font-size: 0.95rem;
margin: 0 0 10px 0;
word-break: break-word;
}
.tt-card-meta {
display: flex;
flex-wrap: wrap;
@@ -94,12 +254,21 @@ $topics = $pdo->query($sql)->fetchAll(PDO::FETCH_ASSOC);
color: #64748b;
margin-bottom: 12px;
}
.tt-card-meta b { color: #1f2937; font-weight: 600; }
.tt-card-meta b {
color: #1f2937;
font-weight: 600;
}
.tt-card-actions {
display: flex;
gap: 8px;
}
.tt-card-actions .btn { flex: 1; }
.tt-card-actions .btn {
flex: 1;
}
.tt-empty {
text-align: center;
color: #94a3b8;
@@ -117,13 +286,28 @@ $topics = $pdo->query($sql)->fetchAll(PDO::FETCH_ASSOC);
<div class="page-content">
<div class="card p-3">
<div class="card-header d-flex justify-content-between align-items-center flex-wrap gap-2">
<h5 class="mb-0">Gestione Corsi di Formazione</h5>
<button type="button" class="btn back-dashboard" onclick="location.href='production_dashboard.php'">
↩️ Torna alla Dashboard
</button>
<h5 class="mb-0">Corsi Formazione</h5>
<div class="training-header-actions">
<?php if (userCan('hr.trainings.view')): ?>
<a href="trainings.php" class="btn btn-training-action btn-training-history">
🎓 Gestione Formazione
</a>
<a href="training_calendar.php" class="btn btn-training-action btn-training-calendar">
📅 Calendario Formazione
</a>
<?php endif; ?>
<button type="button" class="btn back-dashboard" onclick="location.href='production_dashboard.php'">
↩️ Torna alla Dashboard
</button>
</div>
</div>
<div class="card-body">
<div class="d-flex justify-content-between align-items-center mb-3 flex-wrap gap-2">
<h6 class="fw-semibold mb-0">Elenco Corsi / Training Topics</h6>
<button class="btn btn-add" data-bs-toggle="modal" data-bs-target="#addTopicModal">
@@ -420,7 +604,10 @@ $topics = $pdo->query($sql)->fetchAll(PDO::FETCH_ASSOC);
<script>
$(document).ready(function() {
$('#tabellaTopics').DataTable({
order: [[5, 'asc'], [1, 'asc']],
order: [
[5, 'asc'],
[1, 'asc']
],
pageLength: 25,
language: {
url: 'https://cdn.datatables.net/plug-ins/1.13.6/i18n/it-IT.json',
@@ -430,23 +617,37 @@ $topics = $pdo->query($sql)->fetchAll(PDO::FETCH_ASSOC);
function ajaxPost(url, payload, successTitle, errorFallback) {
return fetch(url, {
method: "POST",
headers: { "Content-Type": "application/x-www-form-urlencoded" },
body: payload.toString()
})
.then(r => r.json())
.then(data => {
if (data.success) {
Swal.fire({ icon: "success", title: successTitle, confirmButtonColor: "#3085d6" })
.then(() => location.reload());
} else {
Swal.fire({ icon: "error", title: "Errore", text: data.message || errorFallback });
}
})
.catch(err => {
Swal.fire({ icon: "error", title: "Errore", text: "Errore di comunicazione." });
console.error(err);
});
method: "POST",
headers: {
"Content-Type": "application/x-www-form-urlencoded"
},
body: payload.toString()
})
.then(r => r.json())
.then(data => {
if (data.success) {
Swal.fire({
icon: "success",
title: successTitle,
confirmButtonColor: "#3085d6"
})
.then(() => location.reload());
} else {
Swal.fire({
icon: "error",
title: "Errore",
text: data.message || errorFallback
});
}
})
.catch(err => {
Swal.fire({
icon: "error",
title: "Errore",
text: "Errore di comunicazione."
});
console.error(err);
});
}
$("#addTopicForm").on("submit", function(e) {
@@ -527,4 +728,5 @@ $topics = $pdo->query($sql)->fetchAll(PDO::FETCH_ASSOC);
});
</script>
</body>
</html>
</html>