export check
This commit is contained in:
+17
-1
@@ -27,6 +27,7 @@
|
||||
#import-file { display: none; }
|
||||
#import-label { cursor: pointer; background: #007bff; color: white; padding: 5px 10px; border-radius: 5px; }
|
||||
#import-label:hover { background: #0056b3; }
|
||||
.folder-select { margin: 5px 0; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
@@ -46,6 +47,9 @@
|
||||
<label for="search-all">Все папки</label>
|
||||
</div>
|
||||
<div style="margin-top: 10px;">
|
||||
<select id="folder-select" class="folder-select">
|
||||
<option value="">Все папки</option>
|
||||
</select>
|
||||
<button onclick="exportCSV()">Экспорт CSV</button>
|
||||
<form id="import-form" enctype="multipart/form-data">
|
||||
<input type="file" id="import-file" accept=".csv" onchange="importCSV(this.files[0])">
|
||||
@@ -108,6 +112,13 @@
|
||||
const unsortedFolder = folders.find(f => f.name === 'Несортированные');
|
||||
const unsortedFolderId = unsortedFolder ? unsortedFolder.id : null;
|
||||
|
||||
// Заполняем выпадающий список папок
|
||||
const $folderSelect = $('#folder-select');
|
||||
$folderSelect.append('<option value="">Все папки</option>');
|
||||
folders.forEach(folder => {
|
||||
$folderSelect.append(`<option value="${folder.id}">${folder.name}</option>`);
|
||||
});
|
||||
|
||||
// Инициализация дерева папок
|
||||
$('#folder-tree').jstree({
|
||||
'core': {
|
||||
@@ -357,14 +368,19 @@
|
||||
}
|
||||
|
||||
function exportCSV() {
|
||||
window.location.href = `${API_URL}/export/csv`;
|
||||
const folderId = $('#folder-select').val() || '';
|
||||
window.location.href = `${API_URL}/export/csv?folder_id=${folderId}`;
|
||||
}
|
||||
|
||||
function importCSV(file) {
|
||||
if (!file) return;
|
||||
|
||||
const folderId = $('#folder-select').val() || '';
|
||||
const formData = new FormData();
|
||||
formData.append('file', file);
|
||||
if (folderId) {
|
||||
formData.append('folder_id', folderId);
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: `${API_URL}/import/csv`,
|
||||
|
||||
Reference in New Issue
Block a user