This commit is contained in:
2026-03-18 16:35:48 +07:00
parent 7f77da822f
commit 1a672f0908

View File

@@ -652,13 +652,14 @@ SELECT * FROM users LIMIT 10;"></textarea>
} }
async generateRecordForm() { async generateRecordForm() {
if (response.status === 401) {
this.logout();
return [];
}
const columns = await this.getTableStructure(this.currentTable); const columns = await this.getTableStructure(this.currentTable);
const container = document.getElementById('recordForm'); const container = document.getElementById('recordForm');
if (!columns || columns.length === 0) {
container.innerHTML = `<p class="text-red-500">Не удалось загрузить структуру таблицы</p>`;
return;
}
container.innerHTML = columns.map(col => ` container.innerHTML = columns.map(col => `
<div> <div>
<label class="block text-sm font-medium text-slate-700 mb-1"> <label class="block text-sm font-medium text-slate-700 mb-1">
@@ -706,7 +707,11 @@ SELECT * FROM users LIMIT 10;"></textarea>
const inputs = form.querySelectorAll('input'); const inputs = form.querySelectorAll('input');
const data = {}; const data = {};
inputs.forEach(input => { inputs.forEach(input => {
if (input.type === 'number') { if (input.name === 'id') return;
if (input.type === 'checkbox') {
data[input.name] = input.checked;
} else if (input.type === 'number') {
data[input.name] = parseFloat(input.value); data[input.name] = parseFloat(input.value);
} else { } else {
data[input.name] = input.value; data[input.name] = input.value;