239 lines
7.8 KiB
HTML
239 lines
7.8 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="uz">
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<title>{% block title %}Xvatayka{% endblock %}</title>
|
||
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
|
||
|
||
<style>
|
||
* { box-sizing: border-box; }
|
||
|
||
body {
|
||
margin: 0;
|
||
font-family: 'Segoe UI', Roboto, system-ui, -apple-system, sans-serif;
|
||
background: #f4f5f7;
|
||
color: #1f2937;
|
||
min-height: 100vh;
|
||
display: flex;
|
||
flex-direction: column;
|
||
}
|
||
|
||
/* Header */
|
||
header {
|
||
background: #4f46e5;
|
||
color: #fff;
|
||
padding: 16px 24px;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
position: relative;
|
||
box-shadow: 0 2px 8px rgba(0,0,0,0.15);
|
||
}
|
||
header .logo { font-size: 22px; font-weight: 700; letter-spacing: 1px; }
|
||
|
||
#menu-btn {
|
||
position: absolute;
|
||
left: 24px; top: 50%;
|
||
transform: translateY(-50%);
|
||
background: #fff; border: none; padding: 6px 10px;
|
||
border-radius: 8px; cursor: pointer;
|
||
display: flex; align-items: center; justify-content: center;
|
||
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
||
}
|
||
#menu-btn svg { stroke: #4f46e5; }
|
||
|
||
/* Sidebar */
|
||
#sidebar {
|
||
background: #fff;
|
||
border-right: 1px solid #e5e7eb;
|
||
padding: 20px;
|
||
width: 240px;
|
||
position: fixed;
|
||
top: 0;
|
||
left: -260px;
|
||
height: 100vh; /* full viewport height */
|
||
overflow: hidden; /* non-scrollable */
|
||
transition: left 0.3s ease, box-shadow 0.3s ease;
|
||
z-index: 1000;
|
||
display: flex;
|
||
flex-direction: column;
|
||
justify-content: space-between; /* keeps logout at bottom */
|
||
box-shadow: 0 0 20px rgba(0,0,0,0.05);
|
||
}
|
||
#sidebar.active { left: 0; }
|
||
|
||
#sidebar ul {
|
||
list-style: none;
|
||
padding: 0;
|
||
margin: 0;
|
||
}
|
||
#sidebar ul li { margin-bottom: 16px; }
|
||
#sidebar ul li a {
|
||
text-decoration: none;
|
||
color: #1f2937;
|
||
font-weight: 500;
|
||
display: block;
|
||
padding: 12px 16px;
|
||
border-radius: 8px;
|
||
transition: all 0.25s ease;
|
||
background: #f9fafb;
|
||
white-space: nowrap; /* prevent wrapping */
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
}
|
||
#sidebar ul li a:hover {
|
||
background: #4f46e5;
|
||
color: #fff;
|
||
box-shadow: 0 2px 8px rgba(79,70,229,0.3);
|
||
}
|
||
|
||
/* Logout button fixed at bottom */
|
||
.logout-container {
|
||
margin-top: auto;
|
||
flex-shrink: 0;
|
||
}
|
||
.logout-btn {
|
||
width: 100%;
|
||
background: #ef4444;
|
||
color: #fff;
|
||
border: none;
|
||
padding: 10px 14px;
|
||
border-radius: 10px;
|
||
font-weight: 600;
|
||
font-size: 14px;
|
||
cursor: pointer;
|
||
transition: all 0.25s ease;
|
||
box-shadow: 0 2px 6px rgba(0,0,0,0.1);
|
||
}
|
||
.logout-btn:hover {
|
||
background: #dc2626;
|
||
box-shadow: 0 3px 8px rgba(0,0,0,0.15);
|
||
}
|
||
|
||
main {
|
||
flex: 1;
|
||
padding: 10px;
|
||
transition: margin-left 0.3s ease;
|
||
background: #f4f5f7;
|
||
min-height: calc(100vh - 64px);
|
||
}
|
||
main.shifted { margin-left: 240px; }
|
||
|
||
/* Cards */
|
||
.cards-container {
|
||
display: grid;
|
||
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
|
||
gap: 16px;
|
||
}
|
||
.card {
|
||
background: #fff;
|
||
border-radius: 12px;
|
||
padding: 16px 20px;
|
||
box-shadow: 0 4px 12px rgba(0,0,0,0.05);
|
||
transition: transform 0.2s, box-shadow 0.2s;
|
||
}
|
||
.card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,0.08); }
|
||
.card-row { margin-bottom: 8px; font-size: 14px; color: #374151; }
|
||
.card-row strong { color: #111827; }
|
||
.card-actions { margin-top: 12px; }
|
||
.card-actions .btn {
|
||
display: inline-block;
|
||
padding: 6px 10px;
|
||
border-radius: 6px;
|
||
text-decoration: none;
|
||
color: #fff;
|
||
font-weight: bold;
|
||
font-size: 13px;
|
||
margin-right: 6px;
|
||
transition: all 0.2s ease;
|
||
}
|
||
.card-actions .btn.edit { background: #4f46e5; }
|
||
.card-actions .btn.confirm { background: #10b981; }
|
||
.card-actions .btn.decline { background: #ef4444; }
|
||
.card-actions .btn:hover { opacity: 0.85; transform: translateY(-1px); }
|
||
|
||
/* Responsive */
|
||
@media (max-width: 1024px) {
|
||
#sidebar { width: 220px; }
|
||
main.shifted { margin-left: 220px; }
|
||
}
|
||
@media (max-width: 768px) {
|
||
#sidebar { width: 200px; left: -220px; }
|
||
#sidebar.active { left: 0; box-shadow: 2px 0 12px rgba(0,0,0,0.2); }
|
||
main.shifted { margin-left: 0; } /* overlay on small screens */
|
||
}
|
||
@media (max-width: 640px) {
|
||
.cards-container { grid-template-columns: 1fr; }
|
||
.card { padding: 14px 16px; }
|
||
.card-row { font-size: 13px; }
|
||
.card-actions .btn { font-size: 12px; padding: 5px 8px; margin-bottom: 4px; }
|
||
}
|
||
@media (max-width: 480px) {
|
||
header { padding: 12px 16px; }
|
||
#menu-btn { left: 16px; padding: 4px 8px; }
|
||
.logo { font-size: 18px; }
|
||
#sidebar { padding: 16px; }
|
||
.logout-btn { font-size: 13px; padding: 8px 10px; }
|
||
}
|
||
</style>
|
||
</head>
|
||
<body>
|
||
|
||
<header>
|
||
<button id="menu-btn">
|
||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke-width="2"
|
||
stroke-linecap="round" stroke-linejoin="round">
|
||
<path d="M4 5h16"/>
|
||
<path d="M4 12h16"/>
|
||
<path d="M4 19h16"/>
|
||
</svg>
|
||
</button>
|
||
<div class="logo">Xvatayka</div>
|
||
</header>
|
||
|
||
<nav id="sidebar">
|
||
<ul>
|
||
<li><a href="{% url 'dashboard' %}">Dashboard</a></li>
|
||
<li><a href="{% url 'expense_list' %}">Xarajatlar</a></li>
|
||
<li><a href="{% url 'income_list' %}">Kirimlar</a></li>
|
||
<li><a href="{% url 'toy_movement_list' %}">Oʻyinchoq harakatlari</a></li>
|
||
{% if user.role == "manager" or user.role == "businessman" %}
|
||
<li><a href="{% url 'device_list' %}">Aparatlar</a></li>
|
||
<li><a href="{% url 'warehouse_list' %}">Omborlar</a></li>
|
||
<li><a href="{% url 'user_list' %}">Foydalanuvchilar</a></li>
|
||
{% endif %}
|
||
</ul>
|
||
<div class="logout-container">
|
||
{% if user.is_authenticated %}
|
||
<form method="post" action="{% url 'logout' %}">
|
||
{% csrf_token %}
|
||
<button type="submit" class="logout-btn">Chiqish</button>
|
||
</form>
|
||
{% endif %}
|
||
</div>
|
||
</nav>
|
||
|
||
<main id="main-content">
|
||
{% block content %}{% endblock %}
|
||
</main>
|
||
|
||
<script>
|
||
const menuBtn = document.getElementById('menu-btn');
|
||
const sidebar = document.getElementById('sidebar');
|
||
const mainContent = document.getElementById('main-content');
|
||
|
||
menuBtn.addEventListener('click', () => {
|
||
sidebar.classList.toggle('active');
|
||
mainContent.classList.toggle('shifted');
|
||
});
|
||
|
||
// Optional: click outside to close
|
||
document.addEventListener('click', (e) => {
|
||
if (!sidebar.contains(e.target) && !menuBtn.contains(e.target)) {
|
||
sidebar.classList.remove('active');
|
||
mainContent.classList.remove('shifted');
|
||
}
|
||
});
|
||
</script>
|
||
</body>
|
||
</html> |