fix vari - doc - viste
This commit is contained in:
@@ -1303,7 +1303,7 @@ function showMoveModal(id, nome) {
|
||||
$('#moveModal').modal('show');
|
||||
}
|
||||
|
||||
document.getElementById('massMoveModal')?.addEventListener('show.bs.modal', function() {
|
||||
$('#massMoveModal').on('show.bs.modal', function() {
|
||||
const ids = getSelectedIds();
|
||||
document.getElementById('massMoveIds').value = ids.join(',');
|
||||
document.getElementById('massMoveCount').textContent = ids.length;
|
||||
|
||||
@@ -196,9 +196,11 @@ function syncColumnListToTable() {
|
||||
}
|
||||
|
||||
let editingVistaId = null;
|
||||
let currentVistaOriginalNome = '';
|
||||
|
||||
function editVista(id, nome, isDefault, colonneVisibili) {
|
||||
editingVistaId = id;
|
||||
currentVistaOriginalNome = nome;
|
||||
document.getElementById('vista-nome').value = nome;
|
||||
document.getElementById('vista-default').checked = isDefault;
|
||||
document.querySelectorAll('.column-toggle').forEach(cb => {
|
||||
@@ -210,6 +212,19 @@ function editVista(id, nome, isDefault, colonneVisibili) {
|
||||
}
|
||||
|
||||
function initTableSettings() {
|
||||
const currentVistaEl = document.getElementById('vista-data');
|
||||
if (currentVistaEl && currentVistaEl.textContent && currentVistaEl.textContent !== 'null') {
|
||||
try {
|
||||
const cv = JSON.parse(currentVistaEl.textContent);
|
||||
if (cv && cv.id) {
|
||||
editingVistaId = cv.id;
|
||||
currentVistaOriginalNome = cv.nome || '';
|
||||
document.getElementById('vista-nome').value = cv.nome || '';
|
||||
document.getElementById('save-vista-btn').innerHTML = '<i class="fas fa-save mr-1"></i> Aggiorna';
|
||||
}
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
const columnList = document.getElementById('column-list');
|
||||
if (!columnList) return;
|
||||
|
||||
@@ -310,7 +325,8 @@ function initTableSettings() {
|
||||
const isDefault = document.getElementById('vista-default')?.checked || false;
|
||||
const entityType = '{{ $entityType ?? 'individui' }}';
|
||||
|
||||
const isEditing = editingVistaId !== null;
|
||||
const isRename = editingVistaId !== null && nome !== currentVistaOriginalNome;
|
||||
const isEditing = editingVistaId !== null && !isRename;
|
||||
const url = isEditing ? '/viste/' + editingVistaId : '/viste';
|
||||
const method = isEditing ? 'PUT' : 'POST';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user