102 lines
4.0 KiB
HTML
102 lines
4.0 KiB
HTML
{% extends "base.html" %}
|
||
|
||
{% block title %}{{ purchase.purchase_number }} - Закупка{% endblock %}
|
||
|
||
{% block content %}
|
||
<div class="page-header">
|
||
<h1>Закупка: {{ purchase.purchase_number }}</h1>
|
||
<nav aria-label="breadcrumb">
|
||
<ol class="breadcrumb">
|
||
<li class="breadcrumb-item"><a href="{{ url_for('home') }}">Главная</a></li>
|
||
<li class="breadcrumb-item"><a href="{{ url_for('purchases_list') }}">Закупки</a></li>
|
||
<li class="breadcrumb-item active">{{ purchase.purchase_number }}</li>
|
||
</ol>
|
||
</nav>
|
||
</div>
|
||
|
||
<div class="row">
|
||
<div class="col-md-8">
|
||
<div class="card">
|
||
<div class="card-header">Реквизиты закупки</div>
|
||
<div class="card-body">
|
||
<p><strong>ID:</strong> {{ purchase.id }}</p>
|
||
<p><strong>Номер:</strong> {{ purchase.purchase_number }}</p>
|
||
<p><strong>Дата:</strong> {{ purchase.purchase_date.strftime('%Y-%m-%d') if purchase.purchase_date else 'N/A' }}</p>
|
||
<p><strong>Поставщик:</strong> {{ purchase.vendor.name if purchase.vendor else 'N/A' }}</p>
|
||
<p><strong>Проект:</strong> {{ purchase.project.name if purchase.project else 'N/A' }}</p>
|
||
<p><strong>Описание:</strong> {{ purchase.description or 'N/A' }}</p>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="col-md-4">
|
||
<div class="card">
|
||
<div class="card-header">Связанные спецификации</div>
|
||
<div class="card-body">
|
||
{% if specifications %}
|
||
<ul class="list-group">
|
||
{% for spec in specifications %}
|
||
<li class="list-group-item">
|
||
<a href="{{ url_for('specification_detail', specification_id=spec.id) }}">
|
||
{{ spec.specification_number }}
|
||
</a>
|
||
</li>
|
||
{% endfor %}
|
||
</ul>
|
||
{% else %}
|
||
<div class="text-muted">Нет связанных спецификаций</div>
|
||
{% endif %}
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="section-title">Позиции закупки (PurchaseItems)</div>
|
||
<div class="table-responsive">
|
||
<table class="table table-striped">
|
||
<thead>
|
||
<tr>
|
||
<th>ID</th>
|
||
<th>Модуль</th>
|
||
<th>Количество</th>
|
||
<th>Цена</th>
|
||
<th>Invoice</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
{% for item in items %}
|
||
<tr>
|
||
<td>{{ item.id }}</td>
|
||
<td><strong>{{ item.module.name }}</strong></td>
|
||
<td>{{ item.quantity }}</td>
|
||
<td>${{ "%.2f"|format(item.unit_price) if item.unit_price else 'N/A' }}</td>
|
||
<td>
|
||
{% set invoices = item.purchase.invoices | selectattr('invoice_id', 'equalto', item.id) %}
|
||
{% for inv in invoices %}
|
||
{{ inv.invoice_number }}<br>
|
||
{% endfor %}
|
||
<span class="text-muted">N/A</span>
|
||
</td>
|
||
</tr>
|
||
{% else %}
|
||
<tr>
|
||
<td colspan="5" class="text-center">Нет позиций в закупке</td>
|
||
</tr>
|
||
{% endfor %}
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
|
||
<div class="section-title">Информация о закупках</div>
|
||
<p class="text-muted">Закупки связаны со спецификациями через PurchaseSpecification. Invoice относится к Purchase.</p>
|
||
|
||
<div class="mt-4">
|
||
<a href="{{ url_for('purchases_list', project_id=purchase.project_id) }}" class="btn btn-secondary">
|
||
К списку закупок
|
||
</a>
|
||
<a href="{{ url_for('project_detail', project_id=purchase.project_id) }}" class="btn btn-secondary">
|
||
К проекту
|
||
</a>
|
||
</div>
|
||
|
||
{% endblock %}
|