Фиксация файлов в репозитории

This commit is contained in:
2025-06-29 16:14:32 +03:00
parent 55cf693978
commit 1552ef2fbb
7 changed files with 711 additions and 0 deletions

60
templates/add.html Normal file
View File

@@ -0,0 +1,60 @@
<!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 form-container">
<header>
<h1><i class="fas fa-plus-circle"></i> Добавить операцию</h1>
<a href="{{ url_for('index') }}" class="btn back-btn">
<i class="fas fa-arrow-left"></i> Назад
</a>
</header>
<form method="POST">
<div class="form-group">
<label for="type">Тип операции:</label>
<div class="radio-group">
<label class="radio-label">
<input type="radio" name="type" value="income" checked>
<span class="radio-custom income">Доход</span>
</label>
<label class="radio-label">
<input type="radio" name="type" value="expense">
<span class="radio-custom expense">Расход</span>
</label>
</div>
</div>
<div class="form-group">
<label for="amount">Сумма (₽):</label>
<input type="number" step="0.01" min="0.01" name="amount" required>
</div>
<div class="form-group">
<label for="category">Категория:</label>
<input type="text" name="category" required>
</div>
<div class="form-group">
<label for="date">Дата:</label>
<input type="date" name="date" value="{{ current_date }}" required>
</div>
<div class="form-group">
<label for="description">Описание:</label>
<textarea name="description" rows="3"></textarea>
</div>
<button type="submit" class="btn save-btn">
<i class="fas fa-save"></i> Сохранить
</button>
</form>
</div>
</body>
</html>

60
templates/edit.html Normal file
View File

@@ -0,0 +1,60 @@
<!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 form-container">
<header>
<h1><i class="fas fa-edit"></i> Редактировать операцию</h1>
<a href="{{ url_for('index') }}" class="btn back-btn">
<i class="fas fa-arrow-left"></i> Назад
</a>
</header>
<form method="POST">
<div class="form-group">
<label for="type">Тип операции:</label>
<div class="radio-group">
<label class="radio-label">
<input type="radio" name="type" value="income" {% if transaction.type == 'income' %}checked{% endif %}>
<span class="radio-custom income">Доход</span>
</label>
<label class="radio-label">
<input type="radio" name="type" value="expense" {% if transaction.type == 'expense' %}checked{% endif %}>
<span class="radio-custom expense">Расход</span>
</label>
</div>
</div>
<div class="form-group">
<label for="amount">Сумма (₽):</label>
<input type="number" step="0.01" min="0.01" name="amount" value="{{ transaction.amount }}" required>
</div>
<div class="form-group">
<label for="category">Категория:</label>
<input type="text" name="category" value="{{ transaction.category }}" required>
</div>
<div class="form-group">
<label for="date">Дата:</label>
<input type="date" name="date" value="{{ transaction.date }}" required>
</div>
<div class="form-group">
<label for="description">Описание:</label>
<textarea name="description" rows="3">{{ transaction.description }}</textarea>
</div>
<button type="submit" class="btn save-btn">
<i class="fas fa-save"></i> Сохранить изменения
</button>
</form>
</div>
</body>
</html>

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>