Сделал заготовку для кубсатов
This commit is contained in:
@@ -62,6 +62,12 @@
|
||||
<div class="col-12 d-flex justify-content-between align-items-center">
|
||||
<h2>{% if object %}Редактировать объект: {{ object.name }}{% else %}Создать объект{% endif %}</h2>
|
||||
<div>
|
||||
{% if user.customuser.role == 'admin' or user.customuser.role == 'moderator' %}
|
||||
<button type="submit" class="btn btn-primary btn-action">Сохранить</button>
|
||||
{% if object %}
|
||||
<a href="{% url 'mainapp:objitem_delete' object.id %}{% if request.GET.urlencode %}?{{ request.GET.urlencode }}{% endif %}" class="btn btn-danger btn-action">Удалить</a>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<a href="{% url 'mainapp:objitem_list' %}{% if request.GET.urlencode %}?{{ request.GET.urlencode }}{% endif %}" class="btn btn-secondary btn-action">Назад</a>
|
||||
</div>
|
||||
</div>
|
||||
@@ -329,14 +335,6 @@
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if user.customuser.role == 'admin' or user.customuser.role == 'moderator' %}
|
||||
<div class="d-flex justify-content-end mt-4">
|
||||
<button type="submit" class="btn btn-primary btn-action">Сохранить</button>
|
||||
{% if object %}
|
||||
<a href="{% url 'mainapp:objitem_delete' object.id %}{% if request.GET.urlencode %}?{{ request.GET.urlencode }}{% endif %}" class="btn btn-danger btn-action">Удалить</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</form>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
@@ -976,7 +976,7 @@
|
||||
}
|
||||
|
||||
// Function to save selected items to localStorage
|
||||
function saveSelectedItemsToStorage() {
|
||||
window.saveSelectedItemsToStorage = function() {
|
||||
try {
|
||||
localStorage.setItem('selectedItems', JSON.stringify(window.selectedItems));
|
||||
} catch (e) {
|
||||
@@ -984,9 +984,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
// Load selected items from localStorage on page load
|
||||
loadSelectedItemsFromStorage();
|
||||
|
||||
// Function to update the selected items counter
|
||||
window.updateSelectedCounter = function() {
|
||||
const counterElement = document.getElementById('selectedCounter');
|
||||
@@ -1004,6 +1001,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
// Load selected items from localStorage on page load
|
||||
loadSelectedItemsFromStorage();
|
||||
|
||||
// Update counters after loading items from localStorage
|
||||
updateSelectedCounter();
|
||||
|
||||
// Function to add selected items to the list
|
||||
window.addSelectedToList = function() {
|
||||
const checkedCheckboxes = document.querySelectorAll('.item-checkbox:checked');
|
||||
@@ -1037,10 +1040,10 @@
|
||||
geo_coords: row.cells[11].textContent,
|
||||
kupsat_coords: row.cells[12].textContent,
|
||||
valid_coords: row.cells[13].textContent,
|
||||
updated_at: row.cells[14].textContent,
|
||||
updated_by: row.cells[15].textContent,
|
||||
created_at: row.cells[16].textContent,
|
||||
created_by: row.cells[17].textContent
|
||||
updated_at: row.cells[17].textContent,
|
||||
updated_by: row.cells[18].textContent,
|
||||
created_at: row.cells[19].textContent,
|
||||
created_by: row.cells[20].textContent
|
||||
};
|
||||
|
||||
window.selectedItems.push(rowData);
|
||||
@@ -1052,6 +1055,9 @@
|
||||
updateSelectedCounter();
|
||||
}
|
||||
|
||||
// Save selected items to localStorage
|
||||
saveSelectedItemsToStorage();
|
||||
|
||||
// Clear selections in the main table
|
||||
const itemCheckboxes = document.querySelectorAll('.item-checkbox');
|
||||
itemCheckboxes.forEach(checkbox => {
|
||||
@@ -1061,9 +1067,7 @@
|
||||
if (selectAllCheckbox) {
|
||||
selectAllCheckbox.checked = false;
|
||||
}
|
||||
|
||||
// Show success message
|
||||
alert(`Добавлено ${checkedCheckboxes.length} элемент(ов) в список. Всего: ${window.selectedItems.length} элемент(ов).`);
|
||||
//alert(`Добавлено ${checkedCheckboxes.length} элемент(ов) в список. Всего: ${window.selectedItems.length} элемент(ов).`);
|
||||
}
|
||||
|
||||
setTimeout(initColumnVisibility, 100);
|
||||
@@ -1120,6 +1124,9 @@
|
||||
// Remove items from the selectedItems array
|
||||
window.selectedItems = window.selectedItems.filter(item => !idsToRemove.includes(item.id));
|
||||
|
||||
// Save selected items to localStorage
|
||||
saveSelectedItemsToStorage();
|
||||
|
||||
// Update the counter and table
|
||||
if (typeof updateSelectedCounter === 'function') {
|
||||
updateSelectedCounter();
|
||||
|
||||
Reference in New Issue
Block a user