first commit

This commit is contained in:
NORBOYEVSAMARIDDIN
2026-02-07 11:18:38 +05:00
commit 493cb58222
228 changed files with 10859 additions and 0 deletions

View File

@@ -0,0 +1,147 @@
{% extends "base.html" %}
{% block title %}{{ title|default:"Yaratish" }}{% endblock %}
{% block content %}
<div class="form-container">
<h2>{{ title|default:"Yaratish" }}</h2>
<a href="{% url 'dashboard' %}" class="back-btn">
<svg xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="2">
<path stroke-linecap="round" stroke-linejoin="round" d="M15 18l-6-6 6-6"/>
</svg>
Orqaga
</a>
<form method="post" novalidate>
{% csrf_token %}
{% for field in form %}
<div class="form-group">
<label for="{{ field.id_for_label }}">{{ field.label }}</label>
{{ field }}
{% if field.help_text %}
<small class="help-text">{{ field.help_text }}</small>
{% endif %}
{% for error in field.errors %}
<div class="error">{{ error }}</div>
{% endfor %}
</div>
{% endfor %}
<button type="submit" class="submit-btn">Saqlash</button>
</form>
</div>
<style>
.form-container {
max-width: 480px;
margin: 0 auto;
background: #fff;
padding: 24px 28px;
border-radius: 12px;
box-shadow: 0 6px 18px rgba(0,0,0,0.06);
}
.form-container h2 {
margin-bottom: 16px;
font-size: 22px;
color: #111827;
text-align: center;
}
.back-btn {
display: inline-flex;
align-items: center;
gap: 6px;
margin-bottom: 20px;
padding: 8px 16px;
background: #f3f4f6;
color: #4f46e5;
text-decoration: none;
font-weight: 500;
font-size: 14px;
border-radius: 9999px;
box-shadow: 0 2px 6px rgba(0,0,0,0.08);
transition: all 0.2s ease;
}
.back-btn:hover {
background: #4f46e5;
color: #fff;
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.back-btn .icon {
width: 16px;
height: 16px;
}
.form-group {
margin-bottom: 16px;
display: flex;
flex-direction: column;
transition: all 0.2s ease;
}
.form-group label {
margin-bottom: 6px;
font-weight: 600;
color: #374151;
}
.form-group input,
.form-group select {
padding: 10px 14px;
border: 1px solid #d1d5db;
border-radius: 8px;
font-size: 14px;
outline: none;
transition: border-color 0.2s, box-shadow 0.2s;
}
.form-group input:focus,
.form-group select:focus {
border-color: #4f46e5;
box-shadow: 0 0 0 2px rgba(79,70,229,0.2);
}
.help-text {
font-size: 12px;
color: #6b7280;
margin-top: 4px;
}
.error {
font-size: 12px;
color: #ef4444;
margin-top: 4px;
}
.submit-btn {
width: 100%;
padding: 10px 0;
background: #4f46e5;
color: #fff;
font-weight: 600;
font-size: 15px;
border: none;
border-radius: 10px;
cursor: pointer;
transition: background 0.2s, transform 0.2s;
}
.submit-btn:hover {
background: #4338ca;
transform: translateY(-1px);
}
/* Mobile adjustments */
@media (max-width: 480px) {
.form-container {
padding: 20px 16px;
}
}
</style>
{% endblock %}

View File

@@ -0,0 +1,165 @@
{% extends "base.html" %}
{% block title %}{{ title|default:"Yaratish" }}{% endblock %}
{% block content %}
<div class="form-container">
<h2>{{ title|default:"Yaratish" }}</h2>
<a href="{% url 'dashboard' %}" class="back-btn">
<svg xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="2">
<path stroke-linecap="round" stroke-linejoin="round" d="M15 18l-6-6 6-6"/>
</svg>
Orqaga
</a>
<form method="post" novalidate>
{% csrf_token %}
{% for field in form %}
<div class="form-group" id="group-{{ field.name }}">
<label for="{{ field.id_for_label }}">{{ field.label }}</label>
{{ field }}
{% if field.help_text %}
<small class="help-text">{{ field.help_text }}</small>
{% endif %}
{% for error in field.errors %}
<div class="error">{{ error }}</div>
{% endfor %}
</div>
{% endfor %}
<button type="submit" class="submit-btn">
{% if title %}{{ title }}{% else %}Saqlash{% endif %}
</button>
</form>
</div>
<script>
document.addEventListener("DOMContentLoaded", function() {
const typeSelect = document.getElementById("id_expense_type");
const employeeGroup = document.getElementById("group-employee");
const deviceGroup = document.getElementById("group-device");
function toggleFields() {
if (!typeSelect) return;
const value = typeSelect.value;
// Hide both initially
if (employeeGroup) employeeGroup.style.display = "none";
if (deviceGroup) deviceGroup.style.display = "none";
if (value === "salary") {
if (employeeGroup) employeeGroup.style.display = "flex";
} else if (value === "rent" || value === "maintenance") {
if (deviceGroup) deviceGroup.style.display = "flex";
}
}
toggleFields();
if (typeSelect) typeSelect.addEventListener("change", toggleFields);
});
</script>
<style>
.form-container {
max-width: 480px;
margin: 40px auto;
background: #fff;
padding: 24px 28px;
border-radius: 12px;
box-shadow: 0 6px 18px rgba(0,0,0,0.06);
}
.form-container h2 {
margin-bottom: 16px;
font-size: 22px;
color: #111827;
text-align: center;
}
.back-btn {
display: inline-flex;
align-items: center;
gap: 6px;
margin-bottom: 20px;
padding: 8px 16px;
background: #f3f4f6;
color: #4f46e5;
text-decoration: none;
font-weight: 500;
font-size: 14px;
border-radius: 9999px;
box-shadow: 0 2px 6px rgba(0,0,0,0.08);
transition: all 0.2s ease;
}
.back-btn:hover {
background: #4f46e5;
color: #fff;
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.back-btn .icon { width: 16px; height: 16px; }
.form-group {
margin-bottom: 16px;
display: flex;
flex-direction: column;
}
.form-group label {
margin-bottom: 6px;
font-weight: 600;
color: #374151;
}
.form-group input,
.form-group select {
padding: 10px 14px;
border: 1px solid #d1d5db;
border-radius: 8px;
font-size: 14px;
outline: none;
transition: border-color 0.2s, box-shadow 0.2s;
}
.form-group input:focus,
.form-group select:focus {
border-color: #4f46e5;
box-shadow: 0 0 0 2px rgba(79,70,229,0.2);
}
.help-text {
font-size: 12px;
color: #6b7280;
margin-top: 4px;
}
.error {
font-size: 12px;
color: #ef4444;
margin-top: 4px;
}
.submit-btn {
width: 100%;
padding: 10px 0;
background: #4f46e5;
color: #fff;
font-weight: 600;
font-size: 15px;
border: none;
border-radius: 10px;
cursor: pointer;
transition: background 0.2s, transform 0.2s;
}
.submit-btn:hover {
background: #4338ca;
transform: translateY(-1px);
}
/* Mobile adjustments */
@media (max-width: 480px) {
.form-container { padding: 20px 16px; }
}
</style>
{% endblock %}

View File

@@ -0,0 +1,150 @@
{% extends "base.html" %}
{% block title %}{{ title|default:"Yaratish" }}{% endblock %}
{% block content %}
<div class="form-container">
<h2>{{ title|default:"Yaratish" }}</h2>
<a href="{% url 'dashboard' %}" class="back-btn">
<svg xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="2">
<path stroke-linecap="round" stroke-linejoin="round" d="M15 18l-6-6 6-6"/>
</svg>
Orqaga
</a>
<form method="post" novalidate>
{% csrf_token %}
{% for field in form %}
<div class="form-group">
<label for="{{ field.id_for_label }}">{{ field.label }}</label>
{{ field }}
{% if field.help_text %}
<small class="help-text">{{ field.help_text }}</small>
{% endif %}
{% for error in field.errors %}
<div class="error">{{ error }}</div>
{% endfor %}
</div>
{% endfor %}
<button type="submit" class="submit-btn">
{% if title %}{{ title }}{% else %}Saqlash{% endif %}
</button>
</form>
</div>
<style>
.form-container {
max-width: 480px;
margin: 0 auto;
background: #fff;
padding: 24px 28px;
border-radius: 12px;
box-shadow: 0 6px 18px rgba(0,0,0,0.06);
}
.form-container h2 {
margin-bottom: 16px;
font-size: 22px;
color: #111827;
text-align: center;
}
.back-btn {
display: inline-flex;
align-items: center;
gap: 6px;
margin-bottom: 20px;
padding: 8px 16px;
background: #f3f4f6;
color: #4f46e5;
text-decoration: none;
font-weight: 500;
font-size: 14px;
border-radius: 9999px;
box-shadow: 0 2px 6px rgba(0,0,0,0.08);
transition: all 0.2s ease;
}
.back-btn:hover {
background: #4f46e5;
color: #fff;
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.back-btn .icon {
width: 16px;
height: 16px;
}
.form-group {
margin-bottom: 16px;
display: flex;
flex-direction: column;
transition: all 0.2s ease;
}
.form-group label {
margin-bottom: 6px;
font-weight: 600;
color: #374151;
}
.form-group input,
.form-group select {
padding: 10px 14px;
border: 1px solid #d1d5db;
border-radius: 8px;
font-size: 14px;
outline: none;
transition: border-color 0.2s, box-shadow 0.2s;
}
.form-group input:focus,
.form-group select:focus {
border-color: #4f46e5;
box-shadow: 0 0 0 2px rgba(79,70,229,0.2);
}
.help-text {
font-size: 12px;
color: #6b7280;
margin-top: 4px;
}
.error {
font-size: 12px;
color: #ef4444;
margin-top: 4px;
}
.submit-btn {
width: 100%;
padding: 10px 0;
background: #4f46e5;
color: #fff;
font-weight: 600;
font-size: 15px;
border: none;
border-radius: 10px;
cursor: pointer;
transition: background 0.2s, transform 0.2s;
}
.submit-btn:hover {
background: #4338ca;
transform: translateY(-1px);
}
/* Mobile adjustments */
@media (max-width: 480px) {
.form-container {
padding: 20px 16px;
}
}
</style>
{% endblock %}

View File

@@ -0,0 +1,196 @@
{% extends "base.html" %}
{% block title %}{{ title|default:"Yaratish" }}{% endblock %}
{% block content %}
<div class="form-container">
<h2>{{ title|default:"Yaratish" }}</h2>
<a href="{% url 'dashboard' %}" class="back-btn">
<svg xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="2">
<path stroke-linecap="round" stroke-linejoin="round" d="M15 18l-6-6 6-6"/>
</svg>
Orqaga
</a>
<form method="post" novalidate>
{% csrf_token %}
{% for field in form %}
<div class="form-group">
<label for="{{ field.id_for_label }}">{{ field.label }}</label>
{{ field }}
{% if field.help_text %}
<small class="help-text">{{ field.help_text }}</small>
{% endif %}
{% for error in field.errors %}
<div class="error">{{ error }}</div>
{% endfor %}
</div>
{% endfor %}
<button type="submit" class="submit-btn">Saqlash</button>
</form>
</div>
<style>
.form-container {
max-width: 480px;
margin: 40px auto;
background: #fff;
padding: 24px 28px;
border-radius: 12px;
box-shadow: 0 6px 18px rgba(0,0,0,0.06);
}
.form-container h2 {
margin-bottom: 16px;
font-size: 22px;
color: #111827;
text-align: center;
}
.back-btn {
display: inline-flex;
align-items: center;
gap: 6px;
margin-bottom: 20px;
padding: 8px 16px;
background: #f3f4f6;
color: #4f46e5;
text-decoration: none;
font-weight: 500;
font-size: 14px;
border-radius: 9999px;
box-shadow: 0 2px 6px rgba(0,0,0,0.08);
transition: all 0.2s ease;
}
.back-btn:hover {
background: #4f46e5;
color: #fff;
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.back-btn .icon {
width: 16px;
height: 16px;
}
.form-group {
margin-bottom: 16px;
display: flex;
flex-direction: column;
}
.form-group label {
margin-bottom: 6px;
font-weight: 600;
color: #374151;
}
.form-group input,
.form-group select {
padding: 10px 14px;
border: 1px solid #d1d5db;
border-radius: 8px;
font-size: 14px;
outline: none;
transition: border-color 0.2s, box-shadow 0.2s;
}
.form-group input:focus,
.form-group select:focus {
border-color: #4f46e5;
box-shadow: 0 0 0 2px rgba(79,70,229,0.2);
}
.help-text {
font-size: 12px;
color: #6b7280;
margin-top: 4px;
}
.error {
font-size: 12px;
color: #ef4444;
margin-top: 4px;
}
.submit-btn {
width: 100%;
padding: 12px 0;
background: #4f46e5;
color: #fff;
font-weight: 600;
font-size: 15px;
border: none;
border-radius: 10px;
cursor: pointer;
transition: background 0.2s, transform 0.2s;
}
.submit-btn:hover {
background: #4338ca;
transform: translateY(-1px);
}
@media (max-width: 480px) {
.form-container {
padding: 20px 16px;
}
}
</style>
<script>
document.addEventListener("DOMContentLoaded", function() {
const movementType = document.getElementById("id_movement_type");
const toWarehouse = document.getElementById("id_to_warehouse");
const device = document.getElementById("id_device");
function toggleFields() {
const value = movementType.value;
if (value === "from_warehouse") { // Ombordan -> Aparatga
toWarehouse.parentElement.style.display = "none";
device.parentElement.style.display = "";
} else if (value === "between_warehouses") { // Ombordan -> Omborga
device.parentElement.style.display = "none";
toWarehouse.parentElement.style.display = "";
} else {
toWarehouse.parentElement.style.display = "";
device.parentElement.style.display = "";
}
}
// Update movement_type when to_warehouse is selected
if (toWarehouse) {
toWarehouse.addEventListener("change", function() {
if (toWarehouse.value) {
movementType.value = "between_warehouses";
toggleFields();
}
});
}
// Update movement_type when device is selected
if (device) {
device.addEventListener("change", function() {
if (device.value) {
movementType.value = "from_warehouse";
toggleFields();
}
});
}
// Run on page load
if (movementType) {
toggleFields();
movementType.addEventListener("change", toggleFields);
}
});
</script>
{% endblock %}

View File

@@ -0,0 +1,184 @@
{% extends "base.html" %}
{% block title %}{{ title|default:"Yaratish" }}{% endblock %}
{% block content %}
<div class="form-container">
<h2>{{ title|default:"Yaratish" }}</h2>
<a href="{% url 'dashboard' %}" class="back-btn">
<svg xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="2">
<path stroke-linecap="round" stroke-linejoin="round" d="M15 18l-6-6 6-6"/>
</svg>
Orqaga
</a>
<form method="post" novalidate>
{% csrf_token %}
{% for field in form %}
<div class="form-group">
<label for="{{ field.id_for_label }}">{{ field.label }}</label>
{{ field }}
{% if field.help_text %}
<small class="help-text">{{ field.help_text }}</small>
{% endif %}
{% for error in field.errors %}
<div class="error">{{ error }}</div>
{% endfor %}
</div>
{% endfor %}
<button type="submit" class="submit-btn">Saqlash</button>
</form>
</div>
<style>
.form-container {
max-width: 480px;
margin: 0 auto;
background: #fff;
padding: 24px 28px;
border-radius: 12px;
box-shadow: 0 6px 18px rgba(0,0,0,0.06);
}
.form-container h2 {
margin-bottom: 16px;
font-size: 22px;
color: #111827;
text-align: center;
}
.back-btn {
display: inline-flex;
align-items: center;
gap: 6px;
margin-bottom: 20px;
padding: 8px 16px;
background: #f3f4f6;
color: #4f46e5;
text-decoration: none;
font-weight: 500;
font-size: 14px;
border-radius: 9999px; /* pill shape */
box-shadow: 0 2px 6px rgba(0,0,0,0.08);
transition: all 0.2s ease;
}
.back-btn:hover {
background: #4f46e5;
color: #fff;
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.back-btn .icon {
width: 16px;
height: 16px;
}
.form-group {
margin-bottom: 16px;
display: flex;
flex-direction: column;
transition:all 0.2s ease;
}
.form-group label {
margin-bottom: 6px;
font-weight: 600;
color: #374151;
}
.form-group input,
.form-group select {
padding: 10px 14px;
border: 1px solid #d1d5db;
border-radius: 8px;
font-size: 14px;
outline: none;
transition: border-color 0.2s, box-shadow 0.2s;
}
.form-group input:focus,
.form-group select:focus {
border-color: #4f46e5;
box-shadow: 0 0 0 2px rgba(79,70,229,0.2);
}
.help-text {
font-size: 12px;
color: #6b7280;
margin-top: 4px;
}
.error {
font-size: 12px;
color: #ef4444;
margin-top: 4px;
}
.submit-btn {
width: 100%;
padding: 10px 0;
background: #4f46e5;
color: #fff;
font-weight: 600;
font-size: 15px;
border: none;
border-radius: 10px;
cursor: pointer;
transition: background 0.2s, transform 0.2s;
}
.submit-btn:hover {
background: #4338ca;
transform: translateY(-1px);
}
/* Responsive adjustments */
@media (max-width: 480px) {
.form-container {
padding: 20px 16px;
}
}
</style>
<script>
document.addEventListener("DOMContentLoaded", function () {
const roleField = document.getElementById("id_role");
const regionGroup = document.getElementById("id_region")?.closest(".form-group");
const warehouseGroup = document.getElementById("id_warehouse")?.closest(".form-group");
function toggleFields() {
if (!roleField) return;
const role = roleField.value;
// Manager
if (role === "manager") {
if (regionGroup) regionGroup.style.display = "block";
if (warehouseGroup) warehouseGroup.style.display = "none";
}
// Employee
if (role === "employee") {
if (regionGroup) regionGroup.style.display = "none";
if (warehouseGroup) warehouseGroup.style.display = "block";
}
}
toggleFields();
if (roleField) {
roleField.addEventListener("change", toggleFields);
}
});
</script>
{% endblock %}

View File

@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
</body>
</html>

View File

@@ -0,0 +1,147 @@
{% extends "base.html" %}
{% block title %}{{ title|default:"Tahrirlash" }}{% endblock %}
{% block content %}
<div class="form-container">
<h2>{{ title|default:"Tahrirlash" }}</h2>
<a href="{% url 'device_list' %}" class="back-btn">
<svg xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="2">
<path stroke-linecap="round" stroke-linejoin="round" d="M15 18l-6-6 6-6"/>
</svg>
Orqaga
</a>
<form method="post" novalidate>
{% csrf_token %}
{% for field in form %}
<div class="form-group">
<label for="{{ field.id_for_label }}">{{ field.label }}</label>
{{ field }}
{% if field.help_text %}
<small class="help-text">{{ field.help_text }}</small>
{% endif %}
{% for error in field.errors %}
<div class="error">{{ error }}</div>
{% endfor %}
</div>
{% endfor %}
<button type="submit" class="submit-btn">Saqlash</button>
</form>
</div>
<style>
.form-container {
max-width: 480px;
margin: 0 auto;
background: #fff;
padding: 24px 28px;
border-radius: 12px;
box-shadow: 0 6px 18px rgba(0,0,0,0.06);
}
.form-container h2 {
margin-bottom: 16px;
font-size: 22px;
color: #111827;
text-align: center;
}
.back-btn {
display: inline-flex;
align-items: center;
gap: 6px;
margin-bottom: 20px;
padding: 8px 16px;
background: #f3f4f6;
color: #4f46e5;
text-decoration: none;
font-weight: 500;
font-size: 14px;
border-radius: 9999px;
box-shadow: 0 2px 6px rgba(0,0,0,0.08);
transition: all 0.2s ease;
}
.back-btn:hover {
background: #4f46e5;
color: #fff;
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.back-btn .icon {
width: 16px;
height: 16px;
}
.form-group {
margin-bottom: 16px;
display: flex;
flex-direction: column;
transition:all 0.2s ease;
}
.form-group label {
margin-bottom: 6px;
font-weight: 600;
color: #374151;
}
.form-group input,
.form-group select {
padding: 10px 14px;
border: 1px solid #d1d5db;
border-radius: 8px;
font-size: 14px;
outline: none;
transition: border-color 0.2s, box-shadow 0.2s;
}
.form-group input:focus,
.form-group select:focus {
border-color: #4f46e5;
box-shadow: 0 0 0 2px rgba(79,70,229,0.2);
}
.help-text {
font-size: 12px;
color: #6b7280;
margin-top: 4px;
}
.error {
font-size: 12px;
color: #ef4444;
margin-top: 4px;
}
.submit-btn {
width: 100%;
padding: 10px 0;
background: #4f46e5;
color: #fff;
font-weight: 600;
font-size: 15px;
border: none;
border-radius: 10px;
cursor: pointer;
transition: background 0.2s, transform 0.2s;
}
.submit-btn:hover {
background: #4338ca;
transform: translateY(-1px);
}
/* Mobile adjustments */
@media (max-width: 480px) {
.form-container {
padding: 20px 16px;
}
}
</style>
{% endblock %}

View File

@@ -0,0 +1,139 @@
{% extends "base.html" %}
{% block title %}Create Expense{% endblock %}
{% block content %}
<style>
.card {
max-width: 520px;
margin: 40px auto;
background: #fff;
border-radius: 16px;
padding: 24px;
box-shadow: 0 12px 40px rgba(0,0,0,.08);
}
h1 {
margin: 0 0 20px;
font-size: 22px;
text-align: center;
}
.field {
margin-bottom: 16px;
}
label {
display: block;
font-size: 13px;
margin-bottom: 6px;
color: #6b7280;
font-weight: 500;
}
select, input {
width: 100%;
padding: 14px;
font-size: 16px;
border-radius: 12px;
border: 1px solid #d1d5db;
background: #f9fafb;
}
button {
width: 100%;
margin-top: 12px;
padding: 15px;
border: none;
border-radius: 14px;
background: #4f46e5;
color: #fff;
font-size: 16px;
font-weight: 600;
cursor: pointer;
transition: all 0.2s ease;
}
button:hover {
background: #4338ca;
}
.error {
background: #fee2e2;
color: #991b1b;
padding: 12px;
border-radius: 12px;
margin-bottom: 14px;
font-size: 14px;
}
</style>
<div class="card">
<h1>Create Expense</h1>
{% if form.non_field_errors %}
<div class="error">{{ form.non_field_errors.0 }}</div>
{% endif %}
<form method="POST">
{% csrf_token %}
<div class="field" id="field-expense_type">
{{ form.expense_type.label_tag }}
{{ form.expense_type }}
{{ form.expense_type.errors }}
</div>
<div class="field" id="field-amount">
{{ form.amount.label_tag }}
{{ form.amount }}
{{ form.amount.errors }}
</div>
<div class="field" id="field-employee" style="display:none;">
{{ form.employee.label_tag }}
{{ form.employee }}
{{ form.employee.errors }}
</div>
<div class="field" id="field-device" style="display:none;">
{{ form.device.label_tag }}
{{ form.device }}
{{ form.device.errors }}
</div>
<button type="submit">
{% if title %}{{ title }}{% else %}Create{% endif %}
</button>
</form>
</div>
<script>
document.addEventListener("DOMContentLoaded", function() {
const typeSelect = document.getElementById("id_expense_type");
const employeeField = document.getElementById("field-employee");
const deviceField = document.getElementById("field-device");
function toggleFields() {
if (!typeSelect) return;
const value = typeSelect.value;
// Reset both
employeeField.style.display = "none";
deviceField.style.display = "none";
if (value === "salary") {
employeeField.style.display = "block";
} else if (value === "rent" || value === "maintenance") {
deviceField.style.display = "block";
}
}
if (typeSelect) {
toggleFields();
typeSelect.addEventListener("change", toggleFields);
}
});
</script>
{% endblock %}

View File

@@ -0,0 +1,98 @@
{% extends "base.html" %}
{% block title %}Create Income{% endblock %}
{% block content %}
<style>
.card {
max-width: 520px;
margin: 40px auto;
background: #fff;
border-radius: 16px;
padding: 24px;
box-shadow: 0 12px 40px rgba(0,0,0,.08);
}
h1 {
margin: 0 0 20px;
font-size: 22px;
text-align: center;
}
.field {
margin-bottom: 16px;
}
label {
display: block;
font-size: 13px;
margin-bottom: 6px;
color: #6b7280;
font-weight: 500;
}
select, input {
width: 100%;
padding: 14px;
font-size: 16px;
border-radius: 12px;
border: 1px solid #d1d5db;
background: #f9fafb;
}
button {
width: 100%;
margin-top: 12px;
padding: 15px;
border: none;
border-radius: 14px;
background: #4f46e5;
color: #fff;
font-size: 16px;
font-weight: 600;
cursor: pointer;
transition: all 0.2s ease;
}
button:hover {
background: #4338ca;
}
.error {
background: #fee2e2;
color: #991b1b;
padding: 12px;
border-radius: 12px;
margin-bottom: 14px;
font-size: 14px;
}
</style>
<div class="card">
<h1>Create Income</h1>
{% if form.non_field_errors %}
<div class="error">{{ form.non_field_errors.0 }}</div>
{% endif %}
<form method="POST">
{% csrf_token %}
<div class="field" id="field-device">
{{ form.device.label_tag }}
{{ form.device }}
{{ form.device.errors }}
</div>
<div class="field" id="field-amount">
{{ form.amount.label_tag }}
{{ form.amount }}
{{ form.amount.errors }}
</div>
<button type="submit">
{% if title %}{{ title }}{% else %}Create{% endif %}
</button>
</form>
</div>
{% endblock %}

View File

@@ -0,0 +1,142 @@
{% extends "base.html" %}
{% block title %}Create Toy Movement{% endblock %}
{% block content %}
<style>
.card {
max-width: 520px;
margin: 40px auto;
background: #fff;
border-radius: 16px;
padding: 24px;
box-shadow: 0 12px 40px rgba(0,0,0,.08);
}
h1 {
margin: 0 0 20px;
font-size: 22px;
text-align: center;
}
.field {
margin-bottom: 16px;
}
label {
display: block;
font-size: 13px;
margin-bottom: 6px;
color: #6b7280;
font-weight: 500;
}
select, input {
width: 100%;
padding: 14px;
font-size: 16px;
border-radius: 12px;
border: 1px solid #d1d5db;
background: #f9fafb;
}
button {
width: 100%;
margin-top: 12px;
padding: 15px;
border: none;
border-radius: 14px;
background: #4f46e5;
color: #fff;
font-size: 16px;
font-weight: 600;
cursor: pointer;
transition: all 0.2s ease;
}
button:hover {
background: #4338ca;
}
.error {
background: #fee2e2;
color: #991b1b;
padding: 12px;
border-radius: 12px;
margin-bottom: 14px;
font-size: 14px;
}
</style>
<div class="card">
<h1>Create Toy Movement</h1>
{% if form.non_field_errors %}
<div class="error">{{ form.non_field_errors.0 }}</div>
{% endif %}
<form method="POST">
{% csrf_token %}
{% if user_role != "employee" %}
<div class="field" id="field-movement_type">
{{ form.movement_type.label_tag }}
{{ form.movement_type }}
{{ form.movement_type.errors }}
</div>
{% endif %}
<div class="field" id="field-from_warehouse">
{{ form.from_warehouse.label_tag }}
{{ form.from_warehouse }}
{{ form.from_warehouse.errors }}
</div>
<div class="field" id="field-to_warehouse">
{{ form.to_warehouse.label_tag }}
{{ form.to_warehouse }}
{{ form.to_warehouse.errors }}
</div>
<div class="field" id="field-device">
{{ form.device.label_tag }}
{{ form.device }}
{{ form.device.errors }}
</div>
<div class="field">
{{ form.quantity.label_tag }}
{{ form.quantity }}
{{ form.quantity.errors }}
</div>
<button type="submit">Create</button>
</form>
</div>
<script>
document.addEventListener("DOMContentLoaded", function() {
const typeSelect = document.getElementById("id_movement_type");
const toWarehouse = document.getElementById("field-to_warehouse");
const device = document.getElementById("field-device");
function toggleFields() {
if (!typeSelect) return;
const value = typeSelect.value;
if (value === "from_warehouse") {
toWarehouse.style.display = "none";
device.style.display = "block";
} else if (value === "between_warehouses") {
toWarehouse.style.display = "block";
device.style.display = "none";
}
}
if (typeSelect) {
toggleFields();
typeSelect.addEventListener("change", toggleFields);
}
});
</script>
{% endblock %}

View File

@@ -0,0 +1,183 @@
{% extends "base.html" %}
{% block title %}{{ title|default:"Yaratish" }}{% endblock %}
{% block content %}
<div class="form-container">
<h2>{{ title|default:"Yaratish" }}</h2>
<a href="{% url 'user_list' %}" class="back-btn">
<svg xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="2">
<path stroke-linecap="round" stroke-linejoin="round" d="M15 18l-6-6 6-6"/>
</svg>
Orqaga
</a>
<form method="post" novalidate>
{% csrf_token %}
{% for field in form %}
<div class="form-group">
<label for="{{ field.id_for_label }}">{{ field.label }}</label>
{{ field }}
{% if field.help_text %}
<small class="help-text">{{ field.help_text }}</small>
{% endif %}
{% for error in field.errors %}
<div class="error">{{ error }}</div>
{% endfor %}
</div>
{% endfor %}
<button type="submit" class="submit-btn">Saqlash</button>
</form>
</div>
<style>
.form-container {
max-width: 480px;
margin: 0 auto;
background: #fff;
padding: 24px 28px;
border-radius: 12px;
box-shadow: 0 6px 18px rgba(0,0,0,0.06);
}
.form-container h2 {
margin-bottom: 16px;
font-size: 22px;
color: #111827;
text-align: center;
}
.back-btn {
display: inline-flex;
align-items: center;
gap: 6px;
margin-bottom: 20px;
padding: 8px 16px;
background: #f3f4f6;
color: #4f46e5;
text-decoration: none;
font-weight: 500;
font-size: 14px;
border-radius: 9999px; /* pill shape */
box-shadow: 0 2px 6px rgba(0,0,0,0.08);
transition: all 0.2s ease;
}
.back-btn:hover {
background: #4f46e5;
color: #fff;
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.back-btn .icon {
width: 16px;
height: 16px;
}
.form-group {
margin-bottom: 16px;
display: flex;
flex-direction: column;
transition:all 0.2s ease;
}
.form-group label {
margin-bottom: 6px;
font-weight: 600;
color: #374151;
}
.form-group input,
.form-group select {
padding: 10px 14px;
border: 1px solid #d1d5db;
border-radius: 8px;
font-size: 14px;
outline: none;
transition: border-color 0.2s, box-shadow 0.2s;
}
.form-group input:focus,
.form-group select:focus {
border-color: #4f46e5;
box-shadow: 0 0 0 2px rgba(79,70,229,0.2);
}
.help-text {
font-size: 12px;
color: #6b7280;
margin-top: 4px;
}
.error {
font-size: 12px;
color: #ef4444;
margin-top: 4px;
}
.submit-btn {
width: 100%;
padding: 10px 0;
background: #4f46e5;
color: #fff;
font-weight: 600;
font-size: 15px;
border: none;
border-radius: 10px;
cursor: pointer;
transition: background 0.2s, transform 0.2s;
}
.submit-btn:hover {
background: #4338ca;
transform: translateY(-1px);
}
/* Responsive adjustments */
@media (max-width: 480px) {
.form-container {
padding: 20px 16px;
}
}
</style>
<script>
document.addEventListener("DOMContentLoaded", function () {
const roleField = document.getElementById("id_role");
const regionGroup = document.getElementById("id_region")?.closest(".form-group");
const warehouseGroup = document.getElementById("id_warehouse")?.closest(".form-group");
function toggleFields() {
if (!roleField) return;
const role = roleField.value;
// Manager
if (role === "manager") {
if (regionGroup) regionGroup.style.display = "block";
if (warehouseGroup) warehouseGroup.style.display = "none";
}
// Employee
if (role === "employee") {
if (regionGroup) regionGroup.style.display = "none";
if (warehouseGroup) warehouseGroup.style.display = "block";
}
}
toggleFields();
if (roleField) {
roleField.addEventListener("change", toggleFields);
}
});
</script>
{% endblock %}

View File

@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
</body>
</html>

View File

@@ -0,0 +1,33 @@
{% load custom_filters %}
<h2>{{ title }}</h2>
<table class="table">
<thead>
<tr>
{% for field in fields %}
<th>{{ field_translations|get_item:field|default:field|capfirst }}</th>
{% endfor %}
{% if model_name != "toy_movement" %}
<th>Amallar</th>
{% endif %}
</tr>
</thead>
<tbody>
{% for obj in objects %}
<tr>
{% for field in fields %}
<td>{{ obj|attr:field }}</td>
{% endfor %}
{% if model_name != "toy_movement" %}
<td>
<a href="{% url 'edit_'|add:model_name obj.pk %}" class="edit-btn">Tahrirlash</a>
</td>
{% endif %}
</tr>
{% empty %}
<tr>
<td colspan="{{ fields|length|add:'1' }}">Hech narsa topilmadi</td>
</tr>
{% endfor %}
</tbody>
</table>

View File

@@ -0,0 +1,24 @@
{% extends "base.html" %}
{% block title %}Aparatlar{% endblock %}
{% block content %}
<h2 style="margin-bottom:20px;">{{ title|default:"Aparatlar" }}</h2>
<div class="cards-container">
{% for device in devices %}
<div class="card">
<div class="card-row"><strong>Address:</strong> {{ device.address }}</div>
<div class="card-row"><strong>Hudud:</strong> {{ device.district.name }}</div>
{% if role == "manager" or role == "businessman" %}
<div class="card-actions">
<a href="{% url 'edit_device' device.pk %}" class="btn edit">Tahrirlash</a>
</div>
{% endif %}
</div>
{% empty %}
<p style="text-align:center; font-style:italic;">Hech narsa topilmadi</p>
{% endfor %}
</div>
{% endblock %}

View File

@@ -0,0 +1,36 @@
{% extends "base.html" %}
{% load custom_filters %}
{% block title %}Xarajatlar{% endblock %}
{% block content %}
<h2 style="margin-bottom:20px;">{{ title|default:"Xarajatlar" }}</h2>
<div class="cards-container">
{% for obj in expenses %}
<div class="card">
<div class="card-row"><strong>Miqdor:</strong> {{ obj.amount }}</div>
<div class="card-row"><strong>Tur:</strong> {{ obj|attr:"expense_type" }}</div>
{% if obj.device %}<div class="card-row"><strong>Aparat:</strong> {{ obj.device.name }}</div>{% else %}{% endif %}
{% if obj.employee %}<div class="card-row"><strong>Hodim:</strong> {{ obj.employee.get_full_name }}</div>{% else %}{% endif %}
<div class="card-row"><strong>Yaratgan:</strong> {{ obj.created_by.get_full_name }}</div>
<div class="card-row"><strong>Tasdiqlanganmi:</strong> {% if obj.confirmed_by %}{{ obj.confirmed_by.get_full_name }}{% else %}Yo'q{% endif %}</div>
<div class="card-row"><strong>Yaratilgan sana:</strong> {{ obj.created_at|date:"d.m.Y H:i" }}</div>
{% if role == "manager" or role == "businessman" %}
<div class="card-actions">
{% if not obj.is_confirmed %}
<a href="{% url 'confirm_expense' obj.pk %}" class="btn confirm"></a>
<a href="{% url 'decline_expense' obj.pk %}" class="btn decline"></a>
{% endif %}
{% if role == "businessman" %}
<a href="{% url 'edit_expense' obj.pk %}" class="btn edit">Tahrirlash</a>
{% endif %}
</div>
{% endif %}
</div>
{% empty %}
<p style="text-align:center; font-style:italic;">Hech narsa topilmadi</p>
{% endfor %}
</div>
{% endblock %}

View File

@@ -0,0 +1,92 @@
{% extends "base.html" %}
{% block title %}Kirimlar{% endblock %}
{% block content %}
<h2 style="margin-bottom:20px;">{{ title|default:"Kirimlar" }}</h2>
<div class="cards-container">
{% for income in incomes %}
<div class="card">
<div class="card-row"><strong>Miqdor:</strong> {{ income.amount|default:"-" }}</div>
<div class="card-row"><strong>Aparat:</strong> {% if income.device %}{{ income.device.address }}{% else %}-{% endif %}</div>
<div class="card-row"><strong>Yaratgan:</strong> {{ income.created_by.get_full_name }}</div>
<div class="card-row"><strong>Yaratilgan sana:</strong> {{ income.created_at|date:"d.m.Y H:i" }}</div>
{% if role == "manager" or role == "businessman" %}
<div class="card-actions">
<a href="{% url 'edit_income' income.pk %}" class="btn edit">Tahrirlash</a>
</div>
{% endif %}
</div>
{% empty %}
<p style="text-align:center; font-style:italic;">Hech narsa topilmadi</p>
{% endfor %}
</div>
<style>
.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);
}
@media (max-width: 640px) {
.card-row { font-size: 13px; }
.card-actions .btn { font-size: 12px; padding: 5px 8px; }
}
@media (max-width: 480px) {
.cards-container { grid-template-columns: 1fr; }
.card { padding: 14px 16px; }
}
</style>
{% endblock %}

View File

@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
</body>
</html>

View File

@@ -0,0 +1,34 @@
{% extends "base.html" %}
{% block title %}O'yinchoq harakatlari{% endblock %}
{% block content %}
<h2 style="margin-bottom:20px;">{{ title|default:"O'yinchoq harakatlari" }}</h2>
{% if role == "manager" or role == "businessman" %}
<div class="card-actions">
<a href="{% url 'create_toy_movement_auto' %}" class="btn edit">Yaratish</a>
</div>
<br>
{% endif %}
<div class="cards-container">
{% for tm in toy_movements %}
<div class="card">
<div class="card-row"><strong>Tur:</strong> {{ tm.get_movement_type_display }}</div>
<div class="card-row"><strong>From:</strong> {{ tm.from_warehouse.name }}</div>
{% if tm.to_warehouse %}
<div class="card-row"><strong>To:</strong> {{ tm.to_warehouse.name }}</div>
{% endif %}
{% if tm.device %}
<div class="card-row"><strong>Aparat:</strong> {{ tm.device.name }}</div>
{% endif %}
<div class="card-row"><strong>Miqdor:</strong> {{ tm.quantity }}</div>
<div class="card-row"><strong>Yaratgan:</strong> {{ tm.created_by.get_full_name }}</div>
<div class="card-row"><strong>Sana:</strong> {{ tm.created_at|date:"d.m.Y H:i" }}</div>
</div>
{% empty %}
<p style="text-align:center; font-style:italic;">Hech narsa topilmadi</p>
{% endfor %}
</div>
{% endblock %}

View File

@@ -0,0 +1,28 @@
{% extends "base.html" %}
{% block title %}Foydalanuvchilar{% endblock %}
{% block content %}
<h2 style="margin-bottom:20px;">{{ title|default:"Foydalanuvchilar" }}</h2>
<div class="cards-container">
{% for user in users %}
<div class="card">
<div class="card-row"><strong>Ism:</strong> {{ user.get_full_name }}</div>
<div class="card-row"><strong>Telefon:</strong> {{ user.phone }}</div>
<div class="card-row"><strong>Rol:</strong> {{ user.role }}</div>
{% if user.region %}
<div class="card-row"><strong>Hudud:</strong> {{ user.region.name }}</div>
{% endif %}
{% if role != "manager" or user.role != "manager" %}
<div class="card-actions">
<a href="{% url 'edit_user' user.pk %}" class="btn edit">Tahrirlash</a>
</div>
{% endif %}
</div>
{% empty %}
<p style="text-align:center; font-style:italic;">Hech narsa topilmadi</p>
{% endfor %}
</div>
{% endblock %}

View File

@@ -0,0 +1,25 @@
{% extends "base.html" %}
{% block title %}Omborlar{% endblock %}
{% block content %}
<h2 style="margin-bottom:20px;">{{ title|default:"Omborlar" }}</h2>
<div class="cards-container">
{% for wh in warehouses %}
<div class="card">
<div class="card-row"><strong>Nomi:</strong> {{ wh.name }}</div>
<div class="card-row"><strong>Hudud:</strong> {{ wh.region.name }}</div>
<div class="card-row"><strong>O'yinchoqlar:</strong> {{ wh.toys_count }}</div>
{% if role == "businessman" %}
<div class="card-actions">
<a href="{% url 'edit_warehouse' wh.pk %}" class="btn edit">Tahrirlash</a>
</div>
{% endif %}
</div>
{% empty %}
<p style="text-align:center; font-style:italic;">Hech narsa topilmadi</p>
{% endfor %}
</div>
{% endblock %}