Добавил первые файлы приложения

This commit is contained in:
2025-06-29 16:27:10 +03:00
parent 1e9cc84c8a
commit e5b217c5b7
7 changed files with 711 additions and 0 deletions

108
templates/index.html Normal file
View File

@@ -0,0 +1,108 @@
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Финансовый учет</title>
<link rel="stylesheet" href="{{ url_for('static', filename='styles.css') }}">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
</head>
<body>
<div class="container">
<header>
<h1><i class="fas fa-coins"></i> Финансовый учет</h1>
<div class="summary">
<div class="summary-item income">
<span>Доходы</span>
<strong>{{ total_income|int }} ₽</strong>
</div>
<div class="summary-item expense">
<span>Расходы</span>
<strong>{{ total_expense|int }} ₽</strong>
</div>
<div class="summary-item balance">
<span>Баланс</span>
<strong>{{ balance|int }} ₽</strong>
</div>
</div>
</header>
<div class="controls">
<a href="{{ url_for('add_transaction') }}" class="btn add-btn">
<i class="fas fa-plus"></i> Добавить операцию
</a>
</div>
<section class="categories">
<h2>Расходы по категориям</h2>
<div class="category-list">
{% for category, amounts in categories.items() %}
{% if amounts['expense'] > 0 %}
<div class="category-item">
<span>{{ category }}</span>
<span class="amount expense">{{ amounts['expense']|int }} ₽</span>
</div>
{% endif %}
{% endfor %}
</div>
</section>
<section class="transactions">
<h2>История операций</h2>
<table>
<thead>
<tr>
<th>Дата</th>
<th>Категория</th>
<th>Описание</th>
<th>Сумма</th>
<th>Действия</th>
</tr>
</thead>
<tbody>
{% for t in transactions %}
<tr>
<td>{{ t.date.strftime('%d.%m.%Y') }}</td>
<td>{{ t.category }}</td>
<td>{{ t.description }}</td>
<td class="{{ 'income' if t.type == 'income' else 'expense' }}">
{{ t.amount|int }} ₽
</td>
<td class="actions">
<a href="{{ url_for('edit_transaction', id=t.id) }}" class="btn edit-btn">
<i class="fas fa-edit"></i>
</a>
<a href="{{ url_for('delete_transaction', id=t.id) }}" class="btn delete-btn">
<i class="fas fa-trash"></i>
</a>
</td>
</tr>
{% else %}
<tr>
<td colspan="5" class="empty">Нет операций</td>
</tr>
{% endfor %}
</tbody>
</table>
</section>
<footer>
<p>Сегодня: {{ current_date.strftime('%d.%m.%Y') }}</p>
<p class="tip">"Учет финансов - первый шаг к финансовой свободе!"</p>
</footer>
</div>
<!-- Обработка сообщений flash -->
<script>
document.addEventListener('DOMContentLoaded', function() {
setTimeout(function() {
const messages = document.querySelectorAll('.flash-message');
messages.forEach(msg => {
msg.style.opacity = '0';
setTimeout(() => msg.remove(), 500);
});
}, 3000);
});
</script>
</body>
</html>