Some changes have been made
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}{{ title|default:"Yaratish" }}{% endblock %}
|
||||
{% block title %}{{ title|default:"Kirim qo‘shish" }}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="form-container">
|
||||
<h2>{{ title|default:"Yaratish" }}</h2>
|
||||
<h2>{{ title|default:"Kirim qo‘shish" }}</h2>
|
||||
|
||||
<a href="{% url 'income_list' %}" class="back-btn">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor"
|
||||
@@ -17,18 +17,32 @@
|
||||
<form method="post" novalidate>
|
||||
{% csrf_token %}
|
||||
|
||||
{% for field in form %}
|
||||
<!-- Warehouse -->
|
||||
<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>
|
||||
<label for="{{ form.warehouse.id_for_label }}">Ombor</label>
|
||||
{{ form.warehouse }}
|
||||
{% for error in form.warehouse.errors %}
|
||||
<div class="error">{{ error }}</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
<!-- Toys Count -->
|
||||
<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>
|
||||
|
||||
<!-- Price Per Toy -->
|
||||
<div class="form-group">
|
||||
<label for="{{ form.price_per_toy.id_for_label }}">Bir dona narxi</label>
|
||||
{{ form.price_per_toy }}
|
||||
{% for error in form.price_per_toy.errors %}
|
||||
<div class="error">{{ error }}</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
<button type="submit" class="submit-btn">
|
||||
{% if title %}{{ title }}{% else %}Saqlash{% endif %}
|
||||
@@ -85,7 +99,6 @@
|
||||
margin-bottom: 16px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
.form-group label {
|
||||
@@ -110,12 +123,6 @@
|
||||
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;
|
||||
@@ -140,11 +147,11 @@
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
/* Mobile adjustments */
|
||||
@media (max-width: 480px) {
|
||||
.form-container {
|
||||
padding: 20px 16px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
@@ -30,14 +30,22 @@
|
||||
<td>{{ device.due_date|date:"d.m.Y" }}</td>
|
||||
<td class="amount-cell">{{ device.amount }}</td>
|
||||
<td>
|
||||
{% if not device.is_paid %}
|
||||
<input type="checkbox"
|
||||
class="payment-checkbox"
|
||||
data-device-id="{{ device.id }}"
|
||||
data-device-name="{{ device.address }}"
|
||||
data-amount="{{ device.amount }}">
|
||||
{% if is_employee %}
|
||||
{% if not device.is_paid %}
|
||||
<input type="checkbox"
|
||||
class="payment-checkbox"
|
||||
data-device-id="{{ device.id }}"
|
||||
data-device-name="{{ device.address }}"
|
||||
data-amount="{{ device.amount }}">
|
||||
{% else %}
|
||||
<span class="paid-badge">✅ To'langan</span>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<span class="paid-badge">✅ To'langan</span>
|
||||
{% if device.is_paid %}
|
||||
<span class="paid-badge">✅ To'landi</span>
|
||||
{% else %}
|
||||
<span class="unpaid-badge">❌ To'lanmadi</span>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
@@ -52,7 +60,8 @@
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<!-- Confirmation Modal -->
|
||||
<!-- Confirmation Modal (only rendered for employees) -->
|
||||
{% if is_employee %}
|
||||
<div id="confirmModal" class="modal hidden">
|
||||
<div class="modal-overlay"></div>
|
||||
<div class="modal-content">
|
||||
@@ -72,6 +81,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<style>
|
||||
.table-container {
|
||||
@@ -170,9 +180,20 @@ input[type="checkbox"]:hover {
|
||||
color: #10b981;
|
||||
font-weight: 600;
|
||||
background: #d1fae5;
|
||||
padding: 4px 8px;
|
||||
padding: 4px 10px;
|
||||
border-radius: 6px;
|
||||
font-size: 13px;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.unpaid-badge {
|
||||
color: #dc2626;
|
||||
font-weight: 600;
|
||||
background: #fee2e2;
|
||||
padding: 4px 10px;
|
||||
border-radius: 6px;
|
||||
font-size: 13px;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
/* Modal Styles */
|
||||
@@ -329,6 +350,7 @@ input[type="checkbox"]:hover {
|
||||
}
|
||||
</style>
|
||||
|
||||
{% if is_employee %}
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const modal = document.getElementById('confirmModal');
|
||||
@@ -360,6 +382,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
document.querySelectorAll('.payment-checkbox').forEach(checkbox => {
|
||||
checkbox.checked = false;
|
||||
});
|
||||
currentDeviceId = null;
|
||||
}
|
||||
|
||||
cancelBtn.addEventListener('click', closeModal);
|
||||
@@ -369,7 +392,6 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
// Confirm payment
|
||||
confirmBtn.addEventListener('click', function() {
|
||||
if (currentDeviceId) {
|
||||
// Get CSRF token from hidden input
|
||||
const csrfToken = document.getElementById('csrfToken').value;
|
||||
|
||||
const form = document.createElement('form');
|
||||
@@ -397,5 +419,6 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
@@ -3,90 +3,67 @@
|
||||
{% block title %}Kirimlar{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h2 style="margin-bottom:20px;">{{ title|default:"Kirimlar" }}</h2>
|
||||
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px;">
|
||||
<h2 style="margin: 0;">{{ title|default:"Kirimlar" }}</h2>
|
||||
|
||||
{% if role == "businessman" %}
|
||||
<a href="{% url 'create_income' %}"
|
||||
class="btn edit"
|
||||
style="padding: 12px 24px; text-decoration: none; background: #4f46e5; color: #fff; font-weight: 600; border-radius: 10px; transition: all 0.2s ease; display: inline-block; font-size: 15px;">
|
||||
+ Yaratish
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<style>
|
||||
a.btn.edit:hover {
|
||||
background: #4338ca;
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
|
||||
}
|
||||
</style>
|
||||
|
||||
<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-row">
|
||||
<strong>Ombor:</strong> {{ income.warehouse }}
|
||||
</div>
|
||||
<div class="card-row">
|
||||
<strong>O‘yinchoqlar soni:</strong> {{ income.toys_count }}
|
||||
</div>
|
||||
|
||||
<div class="card-row">
|
||||
<strong>Bir dona narxi:</strong> {{ income.price_per_toy }}
|
||||
</div>
|
||||
|
||||
<div class="card-row">
|
||||
<strong>Jami summa:</strong>
|
||||
<span style="color: #16a34a; font-weight: 600;">
|
||||
{{ income.total_amount }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="card-row">
|
||||
<strong>Sana:</strong>
|
||||
{{ income.created_at|date:"d.m.Y H:i" }}
|
||||
</div>
|
||||
|
||||
{% if role == "businessman" %}
|
||||
<div class="card-actions">
|
||||
<a href="{% url 'edit_income' income.pk %}" class="btn edit">Tahrirlash</a>
|
||||
<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>
|
||||
<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 %}
|
||||
{% endblock %}
|
||||
|
||||
@@ -0,0 +1,261 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}ToyMovement Statistikasi{% endblock %}
|
||||
{% block content %}
|
||||
|
||||
<div class="stats-container">
|
||||
<div class="stats-header">
|
||||
<h2>ToyMovement Statistikasi</h2>
|
||||
<p class="subtitle">Qurilmalar bo'yicha harakat ro'yxati</p>
|
||||
</div>
|
||||
|
||||
<!-- Filter Form -->
|
||||
<form method="get" class="filter-form">
|
||||
<div class="filter-row">
|
||||
<div class="filter-group">
|
||||
<label for="date_from">Boshlanish sanasi</label>
|
||||
<input type="date" id="date_from" name="date_from" value="{{ date_from }}" class="filter-input">
|
||||
</div>
|
||||
<div class="filter-group">
|
||||
<label for="date_to">Tugash sanasi</label>
|
||||
<input type="date" id="date_to" name="date_to" value="{{ date_to }}" class="filter-input">
|
||||
</div>
|
||||
<div class="filter-group">
|
||||
<label for="device">Qurilma</label>
|
||||
<select id="device" name="device" class="filter-input">
|
||||
<option value="">— Barchasi —</option>
|
||||
{% for device in devices %}
|
||||
<option value="{{ device.id }}" {% if selected_device == device.id|stringformat:"s" %}selected{% endif %}>
|
||||
{{ device.address }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div class="filter-group filter-actions">
|
||||
<button type="submit" class="btn-filter">Filtrlash</button>
|
||||
<a href="{% url 'toy_movement_statistics' %}" class="btn-reset">Tozalash</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<!-- Table -->
|
||||
{% if movements %}
|
||||
<div class="table-wrapper">
|
||||
<table class="stats-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>Qurilma</th>
|
||||
<th>Miqdor</th>
|
||||
<th>Sana</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for movement in movements %}
|
||||
<tr>
|
||||
<td>{{ forloop.counter }}</td>
|
||||
<td>{{ movement.device.address|default:"—" }}</td>
|
||||
<td><span class="quantity-badge">{{ movement.quantity }}</span></td>
|
||||
<td>{{ movement.created_at|date:"d.m.Y H:i" }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<p class="total-count">Jami: <strong>{{ movements.count }}</strong> ta yozuv</p>
|
||||
{% else %}
|
||||
<div class="empty-state">
|
||||
<p>⚠️ Hech qanday ma'lumot topilmadi.</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<a href="{% url 'employee_dashboard' %}" class="back-link">← Orqaga qaytish</a>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.stats-container {
|
||||
max-width: 900px;
|
||||
margin: 40px auto;
|
||||
padding: 32px;
|
||||
background: #fff;
|
||||
border-radius: 14px;
|
||||
box-shadow: 0 6px 20px rgba(0,0,0,0.08);
|
||||
}
|
||||
|
||||
.stats-header {
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
|
||||
.stats-header h2 {
|
||||
font-size: 24px;
|
||||
font-weight: 700;
|
||||
color: #111827;
|
||||
margin: 0 0 6px;
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
color: #6b7280;
|
||||
font-size: 14px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* Filter */
|
||||
.filter-form {
|
||||
background: #f9fafb;
|
||||
border: 1px solid #e5e7eb;
|
||||
border-radius: 10px;
|
||||
padding: 18px 20px;
|
||||
margin-bottom: 28px;
|
||||
}
|
||||
|
||||
.filter-row {
|
||||
display: flex;
|
||||
gap: 16px;
|
||||
flex-wrap: wrap;
|
||||
align-items: flex-end;
|
||||
}
|
||||
|
||||
.filter-group {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
flex: 1;
|
||||
min-width: 160px;
|
||||
}
|
||||
|
||||
.filter-group label {
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: #374151;
|
||||
}
|
||||
|
||||
.filter-input {
|
||||
padding: 9px 12px;
|
||||
border: 1.5px solid #d1d5db;
|
||||
border-radius: 8px;
|
||||
font-size: 14px;
|
||||
font-family: inherit;
|
||||
outline: none;
|
||||
background: #fff;
|
||||
transition: border-color 0.2s;
|
||||
}
|
||||
|
||||
.filter-input:focus {
|
||||
border-color: #4f46e5;
|
||||
box-shadow: 0 0 0 3px rgba(79,70,229,0.12);
|
||||
}
|
||||
|
||||
.filter-actions {
|
||||
flex-direction: row;
|
||||
align-items: flex-end;
|
||||
gap: 8px;
|
||||
min-width: auto;
|
||||
}
|
||||
|
||||
.btn-filter {
|
||||
padding: 9px 20px;
|
||||
background: #4f46e5;
|
||||
color: #fff;
|
||||
border: none;
|
||||
border-radius: 8px;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
transition: background 0.2s;
|
||||
}
|
||||
|
||||
.btn-filter:hover { background: #4338ca; }
|
||||
|
||||
.btn-reset {
|
||||
padding: 9px 16px;
|
||||
background: #f3f4f6;
|
||||
color: #374151;
|
||||
border-radius: 8px;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
text-decoration: none;
|
||||
transition: background 0.2s;
|
||||
}
|
||||
|
||||
.btn-reset:hover { background: #e5e7eb; }
|
||||
|
||||
/* Table */
|
||||
.table-wrapper {
|
||||
overflow-x: auto;
|
||||
border-radius: 10px;
|
||||
border: 1px solid #e5e7eb;
|
||||
}
|
||||
|
||||
.stats-table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.stats-table thead {
|
||||
background: #f3f4f6;
|
||||
}
|
||||
|
||||
.stats-table th {
|
||||
padding: 12px 16px;
|
||||
text-align: left;
|
||||
font-weight: 700;
|
||||
color: #374151;
|
||||
font-size: 13px;
|
||||
border-bottom: 2px solid #e5e7eb;
|
||||
}
|
||||
|
||||
.stats-table td {
|
||||
padding: 12px 16px;
|
||||
border-bottom: 1px solid #f3f4f6;
|
||||
color: #1f2937;
|
||||
}
|
||||
|
||||
.stats-table tbody tr:hover {
|
||||
background: #f9fafb;
|
||||
}
|
||||
|
||||
.stats-table tbody tr:last-child td {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.quantity-badge {
|
||||
background: #dcfce7;
|
||||
color: #16a34a;
|
||||
padding: 3px 10px;
|
||||
border-radius: 20px;
|
||||
font-weight: 600;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.total-count {
|
||||
text-align: right;
|
||||
font-size: 14px;
|
||||
color: #6b7280;
|
||||
margin-top: 12px;
|
||||
}
|
||||
|
||||
.empty-state {
|
||||
text-align: center;
|
||||
padding: 40px;
|
||||
color: #9ca3af;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
.back-link {
|
||||
display: inline-block;
|
||||
margin-top: 20px;
|
||||
color: #4f46e5;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.back-link:hover { text-decoration: underline; }
|
||||
|
||||
@media (max-width: 600px) {
|
||||
.stats-container { padding: 20px 14px; }
|
||||
.filter-row { flex-direction: column; }
|
||||
}
|
||||
</style>
|
||||
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user