fixed dashboard

This commit is contained in:
2025-11-17 17:50:42 +01:00
parent 85c8ddc985
commit 711d3d5f73
8 changed files with 1410 additions and 74 deletions
+21 -6
View File
@@ -344,8 +344,13 @@
const linee = $('#lineeSelect').val();
fetch('save_matrice_linee.php', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ id, linee })
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
id,
linee
})
}).then(r => r.json()).then(d => {
Swal.fire({
icon: d.success ? 'success' : 'error',
@@ -360,33 +365,43 @@
const id = $(this).data('id');
const nome = $(this).data('nome');
$('#idMatriceMescole').val(id);
$('.modal-title').text('Associa Mescole a ' + nome);
$('#associaMescoleModal .modal-title').text('Associa Mescole a ' + nome);
fetch('get_mescole_matrice.php?id=' + id)
.then(r => r.json())
.then(data => {
const sel = $('#mescoleSelect');
sel.empty();
data.tutte.forEach(m => {
const selected = data.associate.includes(m.id.toString()) ? 'selected' : '';
sel.append(`<option value="${m.id}" ${selected}>${m.nome}</option>`);
});
sel.select2({
theme: 'bootstrap-5',
width: '100%'
});
$('#associaMescoleModal').modal('show');
});
});
$('#associaMescoleForm').on('submit', e => {
e.preventDefault();
const id = $('#idMatriceMescole').val();
const mescole = $('#mescoleSelect').val();
fetch('save_matrice_mescole.php', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ id, mescole })
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
id,
mescole
})
}).then(r => r.json()).then(d => {
Swal.fire({
icon: d.success ? 'success' : 'error',
@@ -399,4 +414,4 @@
</script>
</body>
</html>
</html>