Files
specs/app/templates/resources/list.html
2026-10-10 11:30:27 +00:00

90 lines
3.2 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{% extends "base.html" %}
{% block title %}Ресурсы - Pool{% endblock %}
{% block content %}
<div class="page-header">
<h1>Общий пул ресурсов</h1>
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="{{ url_for('home') }}">Главная</a></li>
<li class="breadcrumb-item active">Ресурсы</li>
</ol>
</nav>
</div>
{% if project_id %}
<div class="alert alert-info">
Фильтр: Проект #{{ project_id }}
<a href="{{ url_for('resources_list') }}" class="btn btn-sm btn-link">Показать все</a>
</div>
{% endif %}
<div class="section-title">Сводка ресурсов</div>
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>ID</th>
<th>Module</th>
<th>Получено</th>
<th>Распределено</th>
<th>Свободно</th>
<th>Invoice</th>
<th>Specification</th>
<th>Действие</th>
</tr>
</thead>
<tbody>
{% for resource in resources %}
<tr>
<td><a href="{{ url_for('resource_detail', resource_id=resource.id) }}">{{ resource.id }}</a></td>
<td>{{ resource.module.name if resource.module else 'N/A' }}</td>
<td>{{ resource.quantity }}</td>
<td>
{% set allocated = 0 %}
{% for allocation in resource.resource_allocations %}
{% set allocated = allocated + allocation.quantity %}
{% endfor %}
{{ allocated }}
</td>
<td>
{% set allocated = 0 %}
{% for allocation in resource.resource_allocations %}
{% set allocated = allocated + allocation.quantity %}
{% endfor %}
{% set remaining = resource.quantity - allocated %}
<span class="badge {% if remaining <= 0 %}bg-danger{% elif remaining < 100 %}bg-warning{% else %}bg-success{% endif %}">
{{ remaining }}
</span>
</td>
<td>{{ resource.invoice_number if resource.invoice_number else 'N/A' }}</td>
<td>{{ resource.specification_number if resource.specification_number else 'N/A' }}</td>
<td>
<a href="{{ url_for('resource_detail', resource_id=resource.id) }}" class="btn btn-sm btn-primary">
Открыть
</a>
</td>
</tr>
{% else %}
<tr>
<td colspan="8" class="text-center">Нет ресурсов</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<div class="mt-4">
<a href="{{ url_for('projects_list') }}" class="btn btn-secondary">
К проектам
</a>
{% if not project_id %}
<a href="{{ url_for('seed_demo_data') }}" class="btn btn-success">
Seed demo data
</a>
{% endif %}
</div>
{% endblock %}