mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-08-03 17:55:03 +02:00
Added a tab "Build" to project info page, where you can see how often you can build this project.
This commit is contained in:
parent
6423e52092
commit
76ec63e760
10 changed files with 386 additions and 2 deletions
28
templates/Projects/info/_builds.html.twig
Normal file
28
templates/Projects/info/_builds.html.twig
Normal file
|
@ -0,0 +1,28 @@
|
|||
{% set can_build = buildHelper.projectBuildable(project) %}
|
||||
|
||||
{% import "components/projects.macro.html.twig" as project_macros %}
|
||||
|
||||
<div class="alert mt-2 {% if can_build %}alert-success{% else %}alert-danger{% endif %}" role="alert">
|
||||
{% if not can_build %}
|
||||
<h5><i class="fa-solid fa-circle-exclamation fa-fw"></i> {% trans %}project.builds.build_not_possible{% endtrans %}</h5>
|
||||
<b>{% trans %}project.builds.following_bom_entries_miss_instock{% endtrans %}</b>
|
||||
<ul>
|
||||
{% for bom_entry in buildHelper.nonBuildableProjectBomEntries(project) %}
|
||||
<li>{{ project_macros.project_bom_entry_with_missing_instock(bom_entry) }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% else %}
|
||||
<h5><i class="fa-solid fa-circle-check fa-fw"></i> {% trans %}project.builds.build_possible{% endtrans %}</h5>
|
||||
<span>{% trans with {"%max_builds%": buildHelper.maximumBuildableCount(project)} %}project.builds.number_of_builds_possible{% endtrans %}</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row mt-2">
|
||||
<div class="col-4">
|
||||
<div class="input-group mb-3">
|
||||
<input type="number" min="1" class="form-control" placeholder="Number" aria-describedby="button-addon2" required>
|
||||
<button class="btn btn-outline-secondary" type="button" id="button-addon2">Build</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -47,6 +47,13 @@
|
|||
<span class="badge bg-secondary">{{ project.bomEntries | length }}</span>
|
||||
</button>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link" id="builds-tab" data-bs-toggle="tab" data-bs-target="#builds-tab-pane"
|
||||
type="button" role="tab" aria-controls="builds-tab-pane" aria-selected="false">
|
||||
<i class="fa-solid fa-bolt fa-fw"></i>
|
||||
{% trans %}project.info.builds.label{% endtrans %}
|
||||
</button>
|
||||
</li>
|
||||
{% if project.attachments is not empty %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" id="attachments-tab" data-bs-toggle="tab"
|
||||
|
@ -81,6 +88,9 @@
|
|||
<div class="tab-pane fade" id="bom-tab-pane" role="tabpanel" aria-labelledby="bom-tab" tabindex="0">
|
||||
{% include "Projects/info/_bom.html.twig" %}
|
||||
</div>
|
||||
<div class="tab-pane fade" id="builds-tab-pane" role="tabpanel" aria-labelledby="builds-tab" tabindex="0">
|
||||
{% include "Projects/info/_builds.html.twig" %}
|
||||
</div>
|
||||
<div class="tab-pane fade" id="attachments-tab-pane" role="tabpanel" aria-labelledby="attachments-tab" tabindex="0">
|
||||
{% include "Parts/info/_attachments_info.html.twig" with {"part": project} %}
|
||||
</div>
|
||||
|
|
8
templates/components/projects.macro.html.twig
Normal file
8
templates/components/projects.macro.html.twig
Normal file
|
@ -0,0 +1,8 @@
|
|||
{% macro project_bom_entry_with_missing_instock(project_bom_entry, number_of_builds = 1) %}
|
||||
{# @var \App\Entity\ProjectSystem\ProjectBOMEntry project_bom_entry #}
|
||||
<b><a href="{{ entity_url(project_bom_entry.part) }}">{{ project_bom_entry.part.name }}</a></b>
|
||||
{% if project_bom_entry.name %} ({{ project_bom_entry.name }}){% endif %}:
|
||||
<b>{{ project_bom_entry.part.amountSum | format_amount(project_bom_entry.part.partUnit) }}</b> {% trans %}project.builds.stocked{% endtrans %}
|
||||
/
|
||||
<b>{{ (project_bom_entry.quantity * number_of_builds) | format_amount(project_bom_entry.part.partUnit) }}</b> {% trans %}project.builds.needed{% endtrans %}
|
||||
{% endmacro %}
|
Loading…
Add table
Add a link
Reference in a new issue