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:"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>