333 lines
12 KiB
HTML
333 lines
12 KiB
HTML
{% load static django_bootstrap5 %}
|
|
|
|
<!DOCTYPE html>
|
|
<html lang="ru">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<title>{% block title %}EUSRR{% endblock %}</title>
|
|
|
|
{% bootstrap_css %}
|
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.0/font/bootstrap-icons.css">
|
|
<link href="https://cdn.jsdelivr.net/npm/fullcalendar@6.1.8/index.global.min.css" rel="stylesheet">
|
|
|
|
{% block extra_css %}{% endblock %}
|
|
<style>
|
|
:root {
|
|
--main-bg: #f8fafc;
|
|
--main-text: #222;
|
|
--sidebar-bg: #f8fafc;
|
|
--sidebar-text: #34405a;
|
|
--sidebar-border: #e5eaf3;
|
|
--sidebar-active-bg: #e8ecf2;
|
|
--sidebar-active-text: #12306a;
|
|
--sidebar-icon: #8090b1;
|
|
--sidebar-active-icon: #12306a;
|
|
--navbar-bg: #296299;
|
|
--navbar-text: #fff;
|
|
--navbar-border: #204c77;
|
|
}
|
|
@media (prefers-color-scheme: dark) {
|
|
:root {
|
|
--main-bg: #161b22;
|
|
--main-text: #e6e6e6;
|
|
--sidebar-bg: #161b22;
|
|
--sidebar-text: #e6e6e6;
|
|
--sidebar-border: #222c3c;
|
|
--sidebar-active-bg: #232c3c;
|
|
--sidebar-active-text: #7ac7ff;
|
|
--sidebar-icon: #8fa5c1;
|
|
--sidebar-active-icon: #7ac7ff;
|
|
--navbar-bg: #22335a;
|
|
--navbar-text: #fff;
|
|
--navbar-border: #1b263b;
|
|
}
|
|
}
|
|
body {
|
|
min-height: 100vh;
|
|
background: var(--main-bg);
|
|
color: var(--main-text);
|
|
}
|
|
.app-navbar {
|
|
height: 60px;
|
|
background: var(--navbar-bg);
|
|
color: var(--navbar-text);
|
|
border-bottom: 1px solid var(--navbar-border);
|
|
z-index: 1020;
|
|
}
|
|
.sidebar {
|
|
width: 220px;
|
|
min-height: 100vh;
|
|
background: var(--sidebar-bg);
|
|
color: var(--sidebar-text);
|
|
position: fixed;
|
|
top: 0; left: 0;
|
|
border-right: 1px solid var(--sidebar-border);
|
|
z-index: 1010;
|
|
padding-top: 60px;
|
|
}
|
|
.sidebar .nav-link {
|
|
color: var(--sidebar-text);
|
|
font-weight: 500;
|
|
padding: 10px 20px;
|
|
border-radius: 6px;
|
|
margin-bottom: 2px;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 10px;
|
|
transition: background 0.12s, color 0.12s;
|
|
}
|
|
.sidebar .nav-link.active,
|
|
.sidebar .nav-link:hover {
|
|
background: var(--sidebar-active-bg);
|
|
color: var(--sidebar-active-text);
|
|
font-weight: 600;
|
|
}
|
|
.sidebar .nav-link.disabled {
|
|
opacity: 0.5;
|
|
cursor: not-allowed;
|
|
pointer-events: none;
|
|
}
|
|
.sidebar .nav-link i {
|
|
font-size: 1.2rem;
|
|
color: var(--sidebar-icon);
|
|
}
|
|
.sidebar .nav-link.active i,
|
|
.sidebar .nav-link:hover i {
|
|
color: var(--sidebar-active-icon);
|
|
}
|
|
.main-content {
|
|
margin-left: 220px;
|
|
padding: 30px 24px 24px 24px;
|
|
min-height: 100vh;
|
|
padding-top: 90px;
|
|
background: var(--main-bg);
|
|
color: var(--main-text);
|
|
transition: margin-left .2s;
|
|
}
|
|
@media (max-width: 991.98px) {
|
|
.sidebar {
|
|
left: -230px;
|
|
transition: left .2s;
|
|
padding-top: 60px;
|
|
}
|
|
.sidebar.show {
|
|
left: 0;
|
|
}
|
|
.main-content {
|
|
margin-left: 0;
|
|
padding-top: 90px;
|
|
}
|
|
.app-navbar {
|
|
left: 0;
|
|
width: 100vw;
|
|
}
|
|
}
|
|
/* Calendar styles */
|
|
#calendarContainer {
|
|
position: absolute;
|
|
top: -9999px;
|
|
right: 1rem;
|
|
z-index: 1050;
|
|
width: 350px; max-width: 100%; height: 400px; max-height: 90vh;
|
|
overflow: hidden;
|
|
transition: top 0.2s;
|
|
}
|
|
#calendarContainer.visible { top: 100%; }
|
|
#mini-calendar { width: 100%; height: 100%; }
|
|
.fc .fc-toolbar-title { font-size: 1.1rem; font-weight: 500; }
|
|
.fc .fc-daygrid-day-number { font-size: 1rem; }
|
|
.fc .fc-daygrid-day-frame { padding: 0.4rem; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
{% if user.is_authenticated %}
|
|
<nav class="navbar app-navbar navbar-dark position-fixed w-100 shadow-sm">
|
|
<div class="container-fluid d-flex justify-content-between align-items-center px-3">
|
|
<div class="d-flex align-items-center">
|
|
<button class="btn btn-outline-light d-lg-none me-2" type="button" id="sidebarToggle">
|
|
<i class="bi-list"></i>
|
|
</button>
|
|
<a href="/" class="navbar-brand mb-0 text-white fs-5 d-none d-lg-inline" style="letter-spacing:1px;">EUSRR</a>
|
|
</div>
|
|
<div class="d-flex align-items-center gap-3">
|
|
<!-- Кнопка календаря -->
|
|
<button id="toggleCalendarBtn" class="btn btn-outline-light" type="button" title="Календарь">
|
|
<i class="bi-calendar3"></i>
|
|
</button>
|
|
|
|
<!-- Виджет уведомлений -->
|
|
<div class="dropdown">
|
|
<button class="btn btn-outline-light position-relative" data-bs-toggle="dropdown" aria-expanded="false" id="notificationDropdown" title="Уведомления">
|
|
<i class="bi-bell"></i>
|
|
{% if not user.telegram or not user.whatsapp or not user.wechat %}
|
|
<span class="position-absolute top-0 start-100 translate-middle badge rounded-pill bg-danger">!</span>
|
|
{% endif %}
|
|
</button>
|
|
<ul class="dropdown-menu dropdown-menu-end shadow" style="min-width: 260px;">
|
|
<li class="small text-muted px-3 py-2">Мессенджеры</li>
|
|
<li class="px-3">
|
|
{% if user.telegram %}
|
|
<span class="text-success"><i class="bi-telegram"></i> Telegram привязан</span>
|
|
{% else %}
|
|
<a href="{{ tg_link|default:'#' }}" class="text-danger d-block"><i class="bi-telegram"></i> Привязать Telegram</a>
|
|
{% endif %}
|
|
</li>
|
|
<li class="px-3">
|
|
{% if user.whatsapp %}
|
|
<span class="text-success"><i class="bi-whatsapp"></i> WhatsApp привязан</span>
|
|
{% else %}
|
|
<a href="https://wa.me/?text=Привязка+WhatsApp" class="text-danger d-block"><i class="bi-whatsapp"></i> Привязать WhatsApp</a>
|
|
{% endif %}
|
|
</li>
|
|
<li class="px-3">
|
|
{% if user.wechat %}
|
|
<span class="text-success"><i class="bi-wechat"></i> WeChat привязан</span>
|
|
{% else %}
|
|
<span class="text-danger d-block"><i class="bi-wechat"></i> Привязать WeChat (вручную)</span>
|
|
{% endif %}
|
|
</li>
|
|
<li><hr class="dropdown-divider"></li>
|
|
<li class="small text-muted px-3 py-2">Уведомления (скоро)</li>
|
|
</ul>
|
|
</div>
|
|
<!-- /Виджет уведомлений -->
|
|
|
|
<!-- Дропдаун пользователя -->
|
|
<div class="dropdown">
|
|
<a href="#" class="d-flex align-items-center text-white text-decoration-none dropdown-toggle"
|
|
id="userDropdown" data-bs-toggle="dropdown" aria-expanded="false" style="min-width:40px;">
|
|
{% if user.avatar %}
|
|
<img src="{{ user.avatar.url }}"
|
|
alt="Аватар" width="36" height="36"
|
|
class="rounded-circle shadow-sm" style="object-fit: cover;">
|
|
{% else %}
|
|
<span class="avatar-placeholder bg-secondary text-white rounded-circle d-flex align-items-center justify-content-center"
|
|
style="width:36px;height:36px;font-size:1.2rem;">
|
|
{{ user.get_short_name|slice:":1"|upper }}
|
|
</span>
|
|
{% endif %}
|
|
</a>
|
|
<ul class="dropdown-menu dropdown-menu-end shadow" aria-labelledby="userDropdown">
|
|
<li class="px-3 py-2 text-muted small">
|
|
{{ user.get_short_name }}<br>
|
|
<span class="text-secondary">{{ user.email }}</span>
|
|
</li>
|
|
<li><hr class="dropdown-divider"></li>
|
|
<li>
|
|
<a class="dropdown-item" href="{% url 'employees:profile' %}">
|
|
<i class="bi-person me-2"></i>Профиль
|
|
</a>
|
|
</li>
|
|
<li>
|
|
<form action="{% url 'logout' %}" method="post" class="m-0 p-0">
|
|
{% csrf_token %}
|
|
<button type="submit" class="dropdown-item">
|
|
<i class="bi-box-arrow-right me-2"></i>Выйти
|
|
</button>
|
|
</form>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
|
|
<div class="sidebar d-flex flex-column">
|
|
<div class="mb-4 text-center d-lg-none pt-3">
|
|
<a href="/" class="navbar-brand text-dark fs-4 py-2 d-block mb-2" style="letter-spacing:1px;">EUSRR</a>
|
|
</div>
|
|
<ul class="nav flex-column">
|
|
<li><a href="{% url 'feed:feed_list' %}" class="nav-link {% if request.resolver_match.url_name == 'feed_list' %}active{% endif %}">
|
|
<i class="bi-megaphone"></i> Новости
|
|
</a></li>
|
|
<li><a href="{% url 'employees:employees_list' %}" class="nav-link {% if request.resolver_match.url_name == 'employees_list' %}active{% endif %}">
|
|
<i class="bi-people"></i> Сотрудники
|
|
</a></li>
|
|
<li><a href="{% url 'employees:department_list' %}" class="nav-link {% if request.resolver_match.url_name == 'department_list' %}active{% endif %}">
|
|
<i class="bi-diagram-3"></i> Отделы
|
|
</a></li>
|
|
<li><a href="{% url 'requests_app:my_requests' %}" class="nav-link {% if request.resolver_match.url_name == 'my_requests' %}active{% endif %}">
|
|
<i class="bi-journal-text"></i> Мои заявления
|
|
</a></li>
|
|
<li><a href="#" class="nav-link disabled">
|
|
<i class="bi-chat-dots"></i> Чат
|
|
</a></li>
|
|
<li><a href="#" class="nav-link disabled">
|
|
<i class="bi-calendar-event"></i> Календарь
|
|
</a></li>
|
|
<li><a href="{% url 'documents:document_list' %}" class="nav-link {% if request.resolver_match.url_name == 'document_list' %}active{% endif %}">
|
|
<i class="bi-file-earmark-text"></i> Документы
|
|
</a></li>
|
|
</ul>
|
|
</div>
|
|
{% else %}
|
|
<nav class="navbar app-navbar navbar-dark position-fixed w-100 shadow-sm">
|
|
<div class="container-fluid d-flex justify-content-between align-items-center px-3">
|
|
<span class="navbar-brand">EUSRR</span>
|
|
<div>
|
|
<a class="btn btn-outline-light me-2" href="{% url 'login' %}">Войти</a>
|
|
<a class="btn btn-light" href="{% url 'register' %}">Регистрация</a>
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
{% endif %}
|
|
|
|
<div class="main-content">
|
|
{% block content %}{% endblock %}
|
|
</div>
|
|
|
|
{% bootstrap_javascript %}
|
|
<script src="https://cdn.jsdelivr.net/npm/fullcalendar@6.1.8/index.global.min.js"></script>
|
|
|
|
{% if user.is_authenticated %}
|
|
<script>
|
|
// Sidebar toggle (for mobile)
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
const sidebar = document.querySelector('.sidebar');
|
|
const sidebarToggle = document.getElementById('sidebarToggle');
|
|
if (sidebarToggle) {
|
|
sidebarToggle.addEventListener('click', function() {
|
|
sidebar.classList.toggle('show');
|
|
});
|
|
}
|
|
// Calendar logic
|
|
const container = document.getElementById('calendarContainer');
|
|
const toggleBtn = document.getElementById('toggleCalendarBtn');
|
|
const calendar = new FullCalendar.Calendar(
|
|
document.getElementById('mini-calendar'),
|
|
{
|
|
initialView: 'dayGridMonth',
|
|
headerToolbar: { left: 'prev,next today', center: 'title', right: '' },
|
|
height: 400,
|
|
events: '/calendar/api/events/',
|
|
eventDidMount: info => {
|
|
if (info.event.extendedProps.recurrence === 'annual') {
|
|
info.el.style.borderColor = '#28a745';
|
|
}
|
|
}
|
|
}
|
|
);
|
|
calendar.render();
|
|
toggleBtn.addEventListener('click', () => {
|
|
container.classList.toggle('visible');
|
|
if (container.classList.contains('visible')) {
|
|
calendar.updateSize();
|
|
}
|
|
});
|
|
document.addEventListener('click', (e) => {
|
|
if (container.classList.contains('visible')
|
|
&& !container.contains(e.target)
|
|
&& e.target !== toggleBtn) {
|
|
container.classList.remove('visible');
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
{% endif %}
|
|
|
|
{% block extra_js %}{% endblock %}
|
|
</body>
|
|
</html>
|