78475b58e9
- acore: Celery-приложение (брокер из env, eager без брокера), настройки CELERY_*, регистрация всех новых приложений в INSTALLED_APPS, маршруты - core/utils: render_page (HTMX-фрагмент/полный layout), is_owner/ is_owner_or_staff; templatetags common_tags (initials, clean_excerpt, is_it_staff); UpdateLastSeenMiddleware - static: people-picker (дерево отделов с аватарками), searchable-select (одиночный выбор с поиском), directory-quick-add, it-manager, pagination; тема Tailwind v4 пересобрана, лого - templates: новый шелл index.html (мобильный сайдбар, темы, фон, user-dropdown) и login с брендингом Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
91 lines
3.5 KiB
JavaScript
91 lines
3.5 KiB
JavaScript
function itTabSwitch(tab) {
|
|
document.querySelectorAll('.it-panel').forEach(function (panel) {
|
|
panel.style.display = panel.id === 'it-panel-' + tab ? '' : 'none';
|
|
});
|
|
document.querySelectorAll('.it-tab-btn').forEach(function (btn) {
|
|
var active = btn.getAttribute('data-tab') === tab;
|
|
btn.classList.toggle('it-tab-active', active);
|
|
btn.style.background = active ? 'var(--color-card)' : 'transparent';
|
|
btn.style.color = active ? 'var(--color-card-foreground)' : 'var(--color-muted-foreground)';
|
|
btn.style.boxShadow = active ? '0 1px 2px rgb(0 0 0/0.08)' : '';
|
|
});
|
|
}
|
|
|
|
function itToggleRow(key) {
|
|
var row = document.getElementById('it-row-' + key);
|
|
var toggle = document.getElementById('it-toggle-' + key);
|
|
if (!row) return;
|
|
var opening = row.style.display === 'none';
|
|
row.style.display = opening ? 'table-row' : 'none';
|
|
if (toggle) toggle.style.transform = opening ? 'rotate(90deg)' : '';
|
|
}
|
|
|
|
function itPanelOpen(id) {
|
|
var panel = document.getElementById(id);
|
|
var overlay = document.getElementById(id + '-overlay');
|
|
if (overlay) overlay.style.display = 'block';
|
|
if (panel) panel.style.transform = 'translateX(0)';
|
|
document.body.style.overflow = 'hidden';
|
|
}
|
|
|
|
function itPanelClose(id) {
|
|
var panel = document.getElementById(id);
|
|
var overlay = document.getElementById(id + '-overlay');
|
|
if (overlay) overlay.style.display = 'none';
|
|
if (panel) panel.style.transform = 'translateX(100%)';
|
|
document.body.style.overflow = '';
|
|
}
|
|
|
|
function itContractServiceToggle(serviceTypeCode) {
|
|
var block = document.getElementById('it-contract-ip-block');
|
|
if (!block) return;
|
|
var show = serviceTypeCode === 'internet';
|
|
block.style.display = show ? '' : 'none';
|
|
if (!show) {
|
|
var checkbox = block.querySelector('input[name=dedicated_ip]');
|
|
var ipField = document.getElementById('it-contract-ip-field');
|
|
if (checkbox) checkbox.checked = false;
|
|
if (ipField) ipField.style.display = 'none';
|
|
}
|
|
}
|
|
|
|
// --- Масовий вибір екземплярів обладнання ---
|
|
function itBulkToggleAll(headerCheckbox) {
|
|
document.querySelectorAll('.it-equip-check').forEach(function (cb) {
|
|
cb.checked = headerCheckbox.checked;
|
|
});
|
|
itBulkUpdate();
|
|
}
|
|
|
|
function itBulkUpdate() {
|
|
var checked = Array.prototype.slice.call(document.querySelectorAll('.it-equip-check:checked'));
|
|
var panel = document.getElementById('it-equipment-bulk-assign');
|
|
var countEl = document.getElementById('it-bulk-assign-count');
|
|
var inputs = document.getElementById('it-bulk-assign-inputs');
|
|
if (!panel) return;
|
|
if (checked.length) {
|
|
panel.style.display = 'block';
|
|
if (countEl) countEl.textContent = checked.length;
|
|
if (inputs) {
|
|
// переносимо id відмічених у hidden-поля всередині форми видачі
|
|
inputs.innerHTML = '';
|
|
checked.forEach(function (cb) {
|
|
var hidden = document.createElement('input');
|
|
hidden.type = 'hidden';
|
|
hidden.name = 'equipment_ids';
|
|
hidden.value = cb.value;
|
|
inputs.appendChild(hidden);
|
|
});
|
|
}
|
|
} else {
|
|
panel.style.display = 'none';
|
|
}
|
|
}
|
|
|
|
function itBulkClearSelection() {
|
|
document.querySelectorAll('.it-equip-check').forEach(function (cb) { cb.checked = false; });
|
|
var headerAll = document.querySelector('th input[onclick^="itBulkToggleAll"]');
|
|
if (headerAll) headerAll.checked = false;
|
|
itBulkUpdate();
|
|
}
|