Docs: начальная структура проекта

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-02-25 14:59:46 +00:00
commit 1669c12182
56 changed files with 2085 additions and 0 deletions

71
app/templates/base.html Normal file
View File

@@ -0,0 +1,71 @@
{% load static %}
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{% block title %}ERP WaterSurf{% endblock %}</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
{% block extra_css %}{% endblock %}
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
<div class="container-fluid">
<a class="navbar-brand" href="{% url 'users:home' %}">ERP WaterSurf</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav me-auto">
{% if user.is_authenticated %}
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" data-bs-toggle="dropdown">Справочники</a>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="{% url 'references:currency_list' %}">Валюты</a></li>
<li><a class="dropdown-item" href="{% url 'references:orderkind_list' %}">Виды заказов</a></li>
<li><a class="dropdown-item" href="{% url 'references:client_list' %}">Клиенты</a></li>
<li><a class="dropdown-item" href="{% url 'references:organization_list' %}">Организации</a></li>
<li><a class="dropdown-item" href="{% url 'references:supplier_list' %}">Поставщики</a></li>
<li><a class="dropdown-item" href="{% url 'references:employee_list' %}">Сотрудники</a></li>
<li><a class="dropdown-item" href="{% url 'references:cashaccount_list' %}">Счета денежных средств</a></li>
<li><a class="dropdown-item" href="{% url 'references:product_list' %}">Товары</a></li>
</ul>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" data-bs-toggle="dropdown">Документы</a>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="{% url 'documents:customer_order_list' %}">Заказы клиентов</a></li>
<li><a class="dropdown-item" href="{% url 'documents:supplier_order_list' %}">Заказы поставщику</a></li>
<li><a class="dropdown-item" href="{% url 'documents:cash_inflow_list' %}">Поступление денежных средств</a></li>
<li><a class="dropdown-item" href="{% url 'documents:cash_transfer_list' %}">Перемещение денежных средств</a></li>
<li><a class="dropdown-item" href="{% url 'documents:cash_expense_list' %}">Расход денежных средств</a></li>
</ul>
</li>
{% endif %}
</ul>
<ul class="navbar-nav">
{% if user.is_authenticated %}
<li class="nav-item"><span class="navbar-text me-2">{{ user.username }}</span></li>
<li class="nav-item"><a class="nav-link" href="{% url 'users:logout' %}">Выход</a></li>
{% else %}
<li class="nav-item"><a class="nav-link" href="{% url 'users:login' %}">Вход</a></li>
{% endif %}
</ul>
</div>
</div>
</nav>
<main class="container my-4">
{% if messages %}
{% for message in messages %}
<div class="alert alert-{{ message.tags }} alert-dismissible fade show" role="alert">
{{ message }}
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
</div>
{% endfor %}
{% endif %}
{% block content %}{% endblock %}
</main>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
{% block extra_js %}{% endblock %}
</body>
</html>

View File

@@ -0,0 +1,11 @@
{% extends "base.html" %}
{% block title %}{{ title }} — ERP WaterSurf{% endblock %}
{% block content %}
<h2>{% if object %}Редактировать{% else %}Создать{% endif %} {{ title }}</h2>
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<button type="submit" class="btn btn-primary">Сохранить</button>
<a href="{{ cancel_url|default:'#' }}" class="btn btn-secondary">Отмена</a>
</form>
{% endblock %}

View File

@@ -0,0 +1,35 @@
{% extends "base.html" %}
{% block title %}Расходы денежных средств — ERP WaterSurf{% endblock %}
{% block content %}
<h2>Расходы денежных средств</h2>
<p><a href="{% url 'documents:cash_expense_create' %}" class="btn btn-primary">Создать</a></p>
<table class="table table-striped">
<thead>
<tr>
<th>Дата</th>
<th>Номер</th>
<th>Отправитель</th>
<th>Сумма</th>
<th>Заказ поставщику</th>
<th></th>
</tr>
</thead>
<tbody>
{% for obj in object_list %}
<tr>
<td>{{ obj.date }}</td>
<td>{{ obj.number }}</td>
<td>{{ obj.sender }}</td>
<td>{{ obj.amount }}</td>
<td>{{ obj.supplier_order|default:"—" }}</td>
<td>
<a href="{% url 'documents:cash_expense_edit' obj.pk %}">Изменить</a>
| <a href="{% url 'documents:cash_expense_delete' obj.pk %}" class="text-danger">Удалить</a>
</td>
</tr>
{% empty %}
<tr><td colspan="6">Нет расходов.</td></tr>
{% endfor %}
</tbody>
</table>
{% endblock %}

View File

@@ -0,0 +1,35 @@
{% extends "base.html" %}
{% block title %}Поступления денежных средств — ERP WaterSurf{% endblock %}
{% block content %}
<h2>Поступления денежных средств</h2>
<p><a href="{% url 'documents:cash_inflow_create' %}" class="btn btn-primary">Создать</a></p>
<table class="table table-striped">
<thead>
<tr>
<th>Дата</th>
<th>Номер</th>
<th>Получатель</th>
<th>Сумма</th>
<th>Заказ клиента</th>
<th></th>
</tr>
</thead>
<tbody>
{% for obj in object_list %}
<tr>
<td>{{ obj.date }}</td>
<td>{{ obj.number }}</td>
<td>{{ obj.recipient }}</td>
<td>{{ obj.amount }}</td>
<td>{{ obj.customer_order|default:"—" }}</td>
<td>
<a href="{% url 'documents:cash_inflow_edit' obj.pk %}">Изменить</a>
| <a href="{% url 'documents:cash_inflow_delete' obj.pk %}" class="text-danger">Удалить</a>
</td>
</tr>
{% empty %}
<tr><td colspan="6">Нет поступлений.</td></tr>
{% endfor %}
</tbody>
</table>
{% endblock %}

View File

@@ -0,0 +1,35 @@
{% extends "base.html" %}
{% block title %}Перемещения денежных средств — ERP WaterSurf{% endblock %}
{% block content %}
<h2>Перемещения денежных средств</h2>
<p><a href="{% url 'documents:cash_transfer_create' %}" class="btn btn-primary">Создать</a></p>
<table class="table table-striped">
<thead>
<tr>
<th>Дата</th>
<th>Номер</th>
<th>Отправитель</th>
<th>Получатель</th>
<th>Сумма</th>
<th></th>
</tr>
</thead>
<tbody>
{% for obj in object_list %}
<tr>
<td>{{ obj.date }}</td>
<td>{{ obj.number }}</td>
<td>{{ obj.sender }}</td>
<td>{{ obj.recipient }}</td>
<td>{{ obj.amount }}</td>
<td>
<a href="{% url 'documents:cash_transfer_edit' obj.pk %}">Изменить</a>
| <a href="{% url 'documents:cash_transfer_delete' obj.pk %}" class="text-danger">Удалить</a>
</td>
</tr>
{% empty %}
<tr><td colspan="6">Нет перемещений.</td></tr>
{% endfor %}
</tbody>
</table>
{% endblock %}

View File

@@ -0,0 +1,11 @@
{% extends "base.html" %}
{% block title %}Удалить — ERP WaterSurf{% endblock %}
{% block content %}
<h2>Удалить запись?</h2>
<p>{{ object }}</p>
<form method="post">
{% csrf_token %}
<button type="submit" class="btn btn-danger">Удалить</button>
<a href="{{ request.META.HTTP_REFERER|default:'/' }}" class="btn btn-secondary">Отмена</a>
</form>
{% endblock %}

View File

@@ -0,0 +1,37 @@
{% extends "base.html" %}
{% block title %}Заказы клиентов — ERP WaterSurf{% endblock %}
{% block content %}
<h2>Заказы клиентов</h2>
<p><a href="{% url 'documents:customer_order_create' %}" class="btn btn-primary">Создать заказ</a></p>
<table class="table table-striped">
<thead>
<tr>
<th>Дата</th>
<th>Номер</th>
<th>Вид заказа</th>
<th>Организация</th>
<th>Клиент</th>
<th>Стоимость заказа</th>
<th></th>
</tr>
</thead>
<tbody>
{% for obj in object_list %}
<tr>
<td>{{ obj.date }}</td>
<td>{{ obj.number }}</td>
<td>{{ obj.order_kind }}</td>
<td>{{ obj.organization }}</td>
<td>{{ obj.client }}</td>
<td>{{ obj.total_amount }}</td>
<td>
<a href="{% url 'documents:customer_order_edit' obj.pk %}">Изменить</a>
| <a href="{% url 'documents:customer_order_delete' obj.pk %}" class="text-danger">Удалить</a>
</td>
</tr>
{% empty %}
<tr><td colspan="7">Нет заказов.</td></tr>
{% endfor %}
</tbody>
</table>
{% endblock %}

View File

@@ -0,0 +1,48 @@
{% extends "base.html" %}
{% block title %}{{ title }} — ERP WaterSurf{% endblock %}
{% block content %}
<h2>{% if object %}Редактировать{% else %}Создать{% endif %} {{ title }}</h2>
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<h3>Товары</h3>
{{ formset.management_form }}
<table class="table" id="order-items">
<thead>
<tr>
<th>Товар</th>
<th>Цена</th>
<th>Валюта</th>
<th>Количество</th>
<th>Стоимость</th>
<th>Удалить</th>
</tr>
</thead>
<tbody>
{% for f in formset %}
<tr class="item-row">
<td>{{ f.id }}{{ f.product }}</td>
<td>{{ f.price }}</td>
<td>{{ f.currency }}</td>
<td>{{ f.quantity }}</td>
<td class="row-amount"></td>
<td>{% if f.DELETE %}{{ f.DELETE }}{% endif %}</td>
</tr>
{% endfor %}
</tbody>
</table>
<button type="submit" class="btn btn-primary">Сохранить</button>
<a href="{% url 'documents:customer_order_list' %}" class="btn btn-secondary">Отмена</a>
</form>
{% block extra_js %}
<script>
document.querySelector('form').addEventListener('input', function() {
document.querySelectorAll('#order-items .item-row').forEach(function(row) {
var price = parseFloat(row.querySelector('input[name$="-price"]')?.value) || 0;
var qty = parseFloat(row.querySelector('input[name$="-quantity"]')?.value) || 0;
row.querySelector('.row-amount').textContent = (price * qty).toFixed(2);
});
});
</script>
{% endblock %}
{% endblock %}

View File

@@ -0,0 +1,46 @@
{% extends "base.html" %}
{% block title %}{{ title }} — ERP WaterSurf{% endblock %}
{% block content %}
<h2>{% if object %}Редактировать{% else %}Создать{% endif %} {{ title }}</h2>
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<h3>Товары</h3>
{{ formset.management_form }}
<table class="table" id="supplier-order-items">
<thead>
<tr>
<th>Товар</th>
<th>Цена</th>
<th>Валюта</th>
<th>Количество</th>
<th>Стоимость</th>
<th>Удалить</th>
</tr>
</thead>
<tbody>
{% for f in formset %}
<tr class="item-row">
<td>{{ f.id }}{{ f.product }}</td>
<td>{{ f.price }}</td>
<td>{{ f.currency }}</td>
<td>{{ f.quantity }}</td>
<td class="row-amount"></td>
<td>{% if f.DELETE %}{{ f.DELETE }}{% endif %}</td>
</tr>
{% endfor %}
</tbody>
</table>
<button type="submit" class="btn btn-primary">Сохранить</button>
<a href="{% url 'documents:supplier_order_list' %}" class="btn btn-secondary">Отмена</a>
</form>
<script>
document.querySelector('form').addEventListener('input', function() {
document.querySelectorAll('#supplier-order-items .item-row').forEach(function(row) {
var price = parseFloat(row.querySelector('input[name$=\"-price\"]')?.value) || 0;
var qty = parseFloat(row.querySelector('input[name$=\"-quantity\"]')?.value) || 0;
row.querySelector('.row-amount').textContent = (price * qty).toFixed(2);
});
});
</script>
{% endblock %}

View File

@@ -0,0 +1,37 @@
{% extends "base.html" %}
{% block title %}Заказы поставщику — ERP WaterSurf{% endblock %}
{% block content %}
<h2>Заказы поставщику</h2>
<p><a href="{% url 'documents:supplier_order_create' %}" class="btn btn-primary">Создать заказ</a></p>
<table class="table table-striped">
<thead>
<tr>
<th>Дата</th>
<th>Номер</th>
<th>Организация</th>
<th>Поставщик</th>
<th>Стоимость в валюте</th>
<th>Стоимость заказа</th>
<th></th>
</tr>
</thead>
<tbody>
{% for obj in object_list %}
<tr>
<td>{{ obj.date }}</td>
<td>{{ obj.number }}</td>
<td>{{ obj.organization }}</td>
<td>{{ obj.supplier }}</td>
<td>{{ obj.total_in_currency }}</td>
<td>{{ obj.total_amount }}</td>
<td>
<a href="{% url 'documents:supplier_order_edit' obj.pk %}">Изменить</a>
| <a href="{% url 'documents:supplier_order_delete' obj.pk %}" class="text-danger">Удалить</a>
</td>
</tr>
{% empty %}
<tr><td colspan="7">Нет заказов.</td></tr>
{% endfor %}
</tbody>
</table>
{% endblock %}

6
app/templates/home.html Normal file
View File

@@ -0,0 +1,6 @@
{% extends "base.html" %}
{% block title %}Главная — ERP WaterSurf{% endblock %}
{% block content %}
<h1>WaterSurf ERP</h1>
<p class="lead">Выберите раздел в меню: Справочники или Документы.</p>
{% endblock %}

View File

@@ -0,0 +1,11 @@
{% extends "base.html" %}
{% block title %}Удалить {{ object }} — ERP WaterSurf{% endblock %}
{% block content %}
<h2>Удалить запись?</h2>
<p>{{ object }}</p>
<form method="post">
{% csrf_token %}
<button type="submit" class="btn btn-danger">Удалить</button>
<a href="{{ cancel_url }}" class="btn btn-secondary">Отмена</a>
</form>
{% endblock %}

View File

@@ -0,0 +1,11 @@
{% extends "base.html" %}
{% block title %}{{ title }} — ERP WaterSurf{% endblock %}
{% block content %}
<h2>{% if object %}Редактировать{% else %}Создать{% endif %} {{ title }}</h2>
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<button type="submit" class="btn btn-primary">Сохранить</button>
<a href="{{ cancel_url }}" class="btn btn-secondary">Отмена</a>
</form>
{% endblock %}

View File

@@ -0,0 +1,30 @@
{% extends "base.html" %}
{% block title %}{{ title }} — ERP WaterSurf{% endblock %}
{% block content %}
<h2>{{ title }}</h2>
<p><a href="{% url create_url_name %}" class="btn btn-primary">Добавить</a></p>
<table class="table table-striped">
<thead>
<tr>
<th>#</th>
{% block table_headers %}<th>Название</th>{% endblock %}
<th></th>
</tr>
</thead>
<tbody>
{% for item in items %}
<tr>
<td>{{ item.pk }}</td>
{% block table_cells %}<td>{{ item }}</td>{% endblock %}
<td>
<a href="{% block edit_url %}{% url update_url_name item.pk %}{% endblock %}">Изменить</a>
|
<a href="{% block delete_url %}{% url delete_url_name item.pk %}{% endblock %}" class="text-danger">Удалить</a>
</td>
</tr>
{% empty %}
<tr><td colspan="3">Нет записей.</td></tr>
{% endfor %}
</tbody>
</table>
{% endblock %}

View File

@@ -0,0 +1,14 @@
{% extends "base.html" %}
{% block title %}Вход — ERP WaterSurf{% endblock %}
{% block content %}
<div class="row justify-content-center">
<div class="col-md-4">
<h2>Вход</h2>
<form method="post" action="{% url 'users:login' %}">
{% csrf_token %}
{{ form.as_p }}
<button type="submit" class="btn btn-primary">Войти</button>
</form>
</div>
</div>
{% endblock %}