Initial commit

This commit is contained in:
Abdulaziz Axmadaliyev
2026-02-17 19:05:54 +05:00
parent 493cb58222
commit 3691e2d068
56 changed files with 3546 additions and 893 deletions

View File

@@ -1,6 +1,6 @@
{% extends "base.html" %}
{% block title %}Create Expense{% endblock %}
{% block title %}Edit Expense{% endblock %}
{% block content %}
<style>
@@ -19,6 +19,29 @@
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; }
.field {
margin-bottom: 16px;
}
@@ -31,13 +54,25 @@
font-weight: 500;
}
select, input {
select, input, textarea {
width: 100%;
padding: 14px;
font-size: 16px;
border-radius: 12px;
border: 1px solid #d1d5db;
background: #f9fafb;
font-family: inherit;
}
textarea {
resize: vertical;
min-height: 80px;
}
select:focus, input:focus, textarea:focus {
outline: none;
border-color: #4f46e5;
box-shadow: 0 0 0 2px rgba(79,70,229,0.2);
}
button {
@@ -66,44 +101,74 @@
margin-bottom: 14px;
font-size: 14px;
}
.field-error {
color: #ef4444;
font-size: 12px;
margin-top: 4px;
}
</style>
<div class="card">
<h1>Create Expense</h1>
<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>
<h1>{% if title %}{{ title }}{% else %}Edit Expense{% endif %}</h1>
{% if form.non_field_errors %}
<div class="error">{{ form.non_field_errors.0 }}</div>
{% endif %}
<form method="POST">
<form method="POST" novalidate>
{% csrf_token %}
<div class="field" id="field-expense_type">
{{ form.expense_type.label_tag }}
{{ form.expense_type }}
{{ form.expense_type.errors }}
{% for error in form.expense_type.errors %}
<div class="field-error">{{ error }}</div>
{% endfor %}
</div>
<div class="field" id="field-amount">
{{ form.amount.label_tag }}
{{ form.amount }}
{{ form.amount.errors }}
{% for error in form.amount.errors %}
<div class="field-error">{{ error }}</div>
{% endfor %}
</div>
<div class="field" id="field-employee" style="display:none;">
{{ form.employee.label_tag }}
{{ form.employee }}
{{ form.employee.errors }}
{% for error in form.employee.errors %}
<div class="field-error">{{ error }}</div>
{% endfor %}
</div>
<div class="field" id="field-device" style="display:none;">
{{ form.device.label_tag }}
{{ form.device }}
{{ form.device.errors }}
{% for error in form.device.errors %}
<div class="field-error">{{ error }}</div>
{% endfor %}
</div>
<div class="field" id="field-comment" style="display:none;">
{{ form.comment.label_tag }}
{{ form.comment }}
{% for error in form.comment.errors %}
<div class="field-error">{{ error }}</div>
{% endfor %}
</div>
<button type="submit">
{% if title %}{{ title }}{% else %}Create{% endif %}
{% if title %}{{ title }}{% else %}Saqlash{% endif %}
</button>
</form>
</div>
@@ -113,27 +178,38 @@
const typeSelect = document.getElementById("id_expense_type");
const employeeField = document.getElementById("field-employee");
const deviceField = document.getElementById("field-device");
const commentField = document.getElementById("field-comment");
function hideAllConditional() {
if (employeeField) employeeField.style.display = "none";
if (deviceField) deviceField.style.display = "none";
if (commentField) commentField.style.display = "none";
}
function toggleFields() {
if (!typeSelect) return;
const value = typeSelect.value;
// Reset both
employeeField.style.display = "none";
deviceField.style.display = "none";
// Hide all conditional fields first
hideAllConditional();
// Show relevant fields based on expense type
if (value === "salary") {
employeeField.style.display = "block";
if (employeeField) employeeField.style.display = "block";
} else if (value === "rent" || value === "maintenance") {
deviceField.style.display = "block";
if (deviceField) deviceField.style.display = "block";
} else if (value === "other") {
if (commentField) commentField.style.display = "block";
}
}
if (typeSelect) {
// Initialize on page load
toggleFields();
// Listen for changes
typeSelect.addEventListener("change", toggleFields);
}
});
</script>
{% endblock %}
{% endblock %}

View File

@@ -1,6 +1,6 @@
{% extends "base.html" %}
{% block title %}Create Income{% endblock %}
{% block title %}Edit Income{% endblock %}
{% block content %}
<style>
@@ -40,7 +40,7 @@
background: #f9fafb;
}
button {
.submit-btn{
width: 100%;
margin-top: 12px;
padding: 15px;
@@ -69,7 +69,7 @@
</style>
<div class="card">
<h1>Create Income</h1>
<h1>Edit Income</h1>
{% if form.non_field_errors %}
<div class="error">{{ form.non_field_errors.0 }}</div>
@@ -90,7 +90,7 @@
{{ form.amount.errors }}
</div>
<button type="submit">
<button type="submit" class="submit-btn">
{% if title %}{{ title }}{% else %}Create{% endif %}
</button>
</form>

View File

@@ -1,10 +1,153 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
{% extends "base.html" %}
</body>
</html>
{% block title %}{{ title }}{% endblock %}
{% block content %}
<div class="form-container">
<h2>{{ title }}</h2>
<a href="{% url 'businessman_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 %}
<div class="form-group">
<label for="{{ form.name.id_for_label }}">Nomi</label>
{{ form.name }}
{% for error in form.name.errors %}
<div class="error">{{ error }}</div>
{% endfor %}
</div>
<div class="form-group">
<label for="{{ form.region.id_for_label }}">Hududi</label>
{{ form.region }}
{% for error in form.region.errors %}
<div class="error">{{ error }}</div>
{% endfor %}
</div>
<div class="form-group">
<label for="{{ form.toys_count.id_for_label }}">O'yinchoqlar Soni</label>
{{ form.toys_count }}
{% for error in form.toys_count.errors %}
<div class="error">{{ error }}</div>
{% endfor %}
</div>
<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);
}
.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 %}