fixed import update
This commit is contained in:
@@ -1622,7 +1622,39 @@ $apiSampleJson = $template['api_sample_json'] ?? '';
|
||||
|
||||
return;
|
||||
}
|
||||
if (event.target.classList.contains('visible-import-checkbox')) {
|
||||
const checkbox = event.target;
|
||||
const mappingId = checkbox.dataset.mappingId;
|
||||
const value = checkbox.checked ? 1 : 0;
|
||||
const prevChecked = checkbox.checked;
|
||||
|
||||
fetch('update_visible_import.php', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
template_id: <?php echo $id; ?>,
|
||||
mapping_id: mappingId,
|
||||
value: value
|
||||
})
|
||||
})
|
||||
.then(r => r.json())
|
||||
.then(data => {
|
||||
if (!data.success) {
|
||||
console.error("❌ Error updating is_visible_import:", data.message);
|
||||
checkbox.checked = !prevChecked;
|
||||
alert(data.message || 'Errore durante il salvataggio del campo Import.');
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error("❌ Fetch error:", error);
|
||||
checkbox.checked = !prevChecked;
|
||||
alert('Errore di comunicazione durante il salvataggio del campo Import.');
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
if (event.target.classList.contains('visible-parts-checkbox')) {
|
||||
const checkbox = event.target;
|
||||
const mappingId = checkbox.dataset.mappingId;
|
||||
|
||||
Reference in New Issue
Block a user