diff --git a/api/static/js/index.js b/api/static/js/index.js
index 6615484..c21c8e5 100644
--- a/api/static/js/index.js
+++ b/api/static/js/index.js
@@ -775,6 +775,9 @@ function renderToolboxTab(tabData) {
// Создаем навигацию по складам
+ // Сортируем список складов по названию
+ tabData.sort((a, b) => a.title.localeCompare(b.title, 'ru'));
+
const toolboxNav = `
@@ -924,6 +968,18 @@ async function loadToolboxContent(toolboxId) {
+ ${notEnough > 0 && quantityMonitoring ? `
+
+
+
+ ` : ''}
Количество позиций: ${processedData.length}
@@ -964,14 +1020,8 @@ async function loadToolboxContent(toolboxId) {
`;
- if (accessData.manage_toolboxes) {
- contentContainer.querySelector('#editToolbox').addEventListener('click', () => {
- addToolbox(toolboxInfo);
- });
- } else {
- contentContainer.querySelector('#editToolbox').remove();
- }
-
+ handleEditBtn();
+ handleFillBtn()
// Инициализация таблицы с данными
await initializeToolboxTable(processedData, toolboxOwn, quantityMonitoring);
@@ -997,6 +1047,11 @@ async function loadToolboxContent(toolboxId) {
}
}
+function fillToolbox(toolboxInfo) {
+ console.log(toolboxInfo);
+ showInfo('Функционал еще в разработке', 'warning');
+}
+
async function deleteToolbox(toolboxId) {
// Находим информацию о складе
const toolboxInfo = currentToolboxData.find(t => t.id === toolboxId);
@@ -1476,17 +1531,22 @@ async function initializeToolboxTable(data, toolboxOwn, quantityMonitoring) {
const searchLower = searchText.toLowerCase();
filteredData = data.filter(item =>
item.title.toLowerCase().includes(searchLower) ||
- item.category.toLowerCase().includes(searchLower) ||
- item.placement.toLowerCase().includes(searchLower) ||
- item.totalQuantity.toString().includes(searchLower) ||
- item.totalCost.toString().includes(searchLower) ||
- (item.indicator?.text && item.indicator.text.toLowerCase().includes(searchLower))
+ item.toolkitData.description.toLowerCase().includes(searchLower)
);
}
currentPage = 1;
sortData(currentSort.field, currentSort.direction);
await initializePagination();
}
+ async function filterIndicator() {
+ const searchLower = 'мало';
+ filteredData = data.filter(item =>
+ (item.indicator?.text && item.indicator.text.toLowerCase().includes(searchLower))
+ );
+ currentPage = 1;
+ sortData(currentSort.field, currentSort.direction);
+ await initializePagination();
+ }
// Инициализация сортировки по заголовкам
document.querySelectorAll('#toolboxItemsTable th[data-sort]').forEach(th => {
@@ -1522,9 +1582,26 @@ async function initializeToolboxTable(data, toolboxOwn, quantityMonitoring) {
// Инициализация кнопки сброса фильтра
document.getElementById('resetFilter').addEventListener('click', async () => {
searchInput.value = '';
+ searchInput.placeholder = 'Поиск по всем полям...';
await filterData('');
});
+ // Инициализация кнопки "мало"
+ try {
+ document.getElementById('notEnoughBtn').addEventListener('click', async () => {
+ const showAll = 'Сбросить фильтр -->';
+ if (searchInput.placeholder === showAll) {
+ searchInput.placeholder = 'Поиск по всем полям...';
+ searchInput.value = '';
+ await filterData('');
+ return;
+ }
+ searchInput.value = '';
+ searchInput.placeholder = showAll;
+ await filterIndicator();
+ });
+ } catch (_) { }
+
// Начальная инициализация
sortData(currentSort.field, currentSort.direction);
await initializePagination();
@@ -1727,12 +1804,12 @@ async function showOperationModal(operation, selectedItem) {
${selectedItem.title} (доступно: ${selectedItem.totalQuantity} шт.)
-
-
+
+
-