mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 01:25:55 +02:00
Improved project info page
This commit is contained in:
parent
ef6d30e04b
commit
742b2d3d48
8 changed files with 195 additions and 20 deletions
|
@ -63,7 +63,7 @@ class ProjectController extends AbstractController
|
|||
return $table->getResponse();
|
||||
}
|
||||
|
||||
return $this->render('Projects/info.html.twig', [
|
||||
return $this->render('Projects/info/info.html.twig', [
|
||||
'datatable' => $table,
|
||||
'project' => $project,
|
||||
]);
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
{% extends "base.html.twig" %}
|
||||
|
||||
{% import "components/datatables.macro.html.twig" as datatables %}
|
||||
|
||||
{% block title %}
|
||||
{% trans %}parts_list.category.title{% endtrans %} {{ project.name }}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
{% include "Projects/_info_card.html.twig" %}
|
||||
|
||||
{{ datatables.datatable(datatable, 'elements/datatables/datatables', 'projects') }}
|
||||
|
||||
{# {% include "Parts/lists/_action_bar.html.twig" with {'url_options': {'category': entity.iD}} %}
|
||||
|
||||
{% include "Parts/lists/_parts_list.html.twig" %} #}
|
||||
|
||||
{% endblock %}
|
11
templates/Projects/info/_bom.html.twig
Normal file
11
templates/Projects/info/_bom.html.twig
Normal file
|
@ -0,0 +1,11 @@
|
|||
{% import "components/datatables.macro.html.twig" as datatables %}
|
||||
|
||||
<div class="mb-2"></div>
|
||||
|
||||
{{ datatables.datatable(datatable, 'elements/datatables/datatables', 'projects') }}
|
||||
|
||||
<a class="btn btn-success" {% if not is_granted('@devices.edit') %}disabled{% endif %}
|
||||
href="{{ path('project_add_parts', {"id": project.id, "_redirect": app.request.requestUri}) }}">
|
||||
<i class="fa-solid fa-square-plus fa-fw"></i>
|
||||
{% trans %}project.info.bom_add_parts{% endtrans %}
|
||||
</a>
|
71
templates/Projects/info/_info.html.twig
Normal file
71
templates/Projects/info/_info.html.twig
Normal file
|
@ -0,0 +1,71 @@
|
|||
{% import "helper.twig" as helper %}
|
||||
|
||||
<div class="row mt-2">
|
||||
<div class="col-md-8">
|
||||
<div class="row">
|
||||
<div class="col-md-3 col-lg-4 col-4 mt-auto mb-auto">
|
||||
<img src="{{ asset('img/part_placeholder.svg') }}" class="img-fluid img-thumbnail bg-light mb-2" alt="Part main image" height="300" width="300">
|
||||
</div>
|
||||
<div class="col-md-9 col-lg-8 col-7">
|
||||
<h3 class="w-fit" title="{% trans %}name.label{% endtrans %}">{{ project.name }}
|
||||
{# You need edit permission to use the edit button #}
|
||||
{% if is_granted('edit', project) %}
|
||||
<a href="{{ entity_url(project, 'edit') }}"><i class="fas fa-fw fa-sm fa-edit"></i></a>
|
||||
{% endif %}
|
||||
</h3>
|
||||
<h6 class="text-muted w-fit" title="{% trans %}description.label{% endtrans %}"><span>{{ project.description|format_markdown(true) }}</span></h6>
|
||||
{% if project.buildPart %}
|
||||
<h6>{% trans %}project.edit.associated_build_part{% endtrans %}:</h6>
|
||||
<a href="{{ entity_url(project.buildPart) }}">{{ project.buildPart.name }}</a>
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-4"> {# Sidebar panel with infos about last creation date, etc. #}
|
||||
<div class="mb-3">
|
||||
<span class="text-muted" title="{% trans %}lastModified{% endtrans %}">
|
||||
<i class="fas fa-history fa-fw"></i> {{ helper.date_user_combination(project, true) }}
|
||||
</span>
|
||||
<br>
|
||||
<span class="text-muted mt-1" title="{% trans %}createdAt{% endtrans %}">
|
||||
<i class="fas fa-calendar-plus fa-fw"></i> {{ helper.date_user_combination(project, false) }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="mt-1">
|
||||
<h6>
|
||||
{{ helper.project_status_to_badge(project.status) }}
|
||||
</h6>
|
||||
</div>
|
||||
<div class="mt-1">
|
||||
<h6>
|
||||
<span class="badge badge-primary bg-primary">
|
||||
<i class="fa-solid fa-list-check fa-fw"></i>
|
||||
{{ project.bomEntries | length }}
|
||||
{% trans %}project.info.bom_entries_count{% endtrans %}
|
||||
</span>
|
||||
</h6>
|
||||
</div>
|
||||
{% if project.children is not empty %}
|
||||
<div class="mt-1">
|
||||
<h6>
|
||||
<span class="badge badge-primary bg-secondary">
|
||||
<i class="fa-solid fa-folder-tree fa-fw"></i>
|
||||
{{ project.children | length }}
|
||||
{% trans %}project.info.sub_projects_count{% endtrans %}
|
||||
</span>
|
||||
</h6>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% if project.comment is not empty %}
|
||||
<p>
|
||||
<h5>{% trans %}comment.label{% endtrans %}:</h5>
|
||||
{{ project.comment|format_markdown }}
|
||||
</p>
|
||||
{% endif %}
|
||||
</div>
|
67
templates/Projects/info/info.html.twig
Normal file
67
templates/Projects/info/info.html.twig
Normal file
|
@ -0,0 +1,67 @@
|
|||
{% extends "main_card.html.twig" %}
|
||||
{% import "helper.twig" as helper %}
|
||||
|
||||
{% block title %}
|
||||
{% trans %}project.info.title{% endtrans %}: {{ project.name }}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
{{ helper.breadcrumb_entity_link(project) }}
|
||||
{{ parent() }}
|
||||
|
||||
{# {% include "Projects/_info_card.html.twig" %} #}
|
||||
|
||||
{# {{ datatables.datatable(datatable, 'elements/datatables/datatables', 'projects') }} #}
|
||||
|
||||
|
||||
{# {% include "Parts/lists/_action_bar.html.twig" with {'url_options': {'category': entity.iD}} %}
|
||||
|
||||
{% include "Parts/lists/_parts_list.html.twig" %} #}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block card_title %}
|
||||
{% if project.masterPictureAttachment is not null and attachment_manager.isFileExisting(project.masterPictureAttachment) %}
|
||||
<img class="hoverpic ms-0 me-1 d-inline" {{ stimulus_controller('elements/hoverpic') }} data-thumbnail="{{ entity_url(project.masterPictureAttachment, 'file_view') }}" src="{{ attachment_thumbnail(project.masterPictureAttachment, 'thumbnail_sm') }}">
|
||||
{% else %}
|
||||
{{ helper.entity_icon(project, "me-1") }}
|
||||
{% endif %}
|
||||
{% trans %}project.info.title{% endtrans %}: <b>{{ project.name }}</b>
|
||||
{% endblock %}
|
||||
|
||||
{% block card_content %}
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link active" id="info-tab" data-bs-toggle="tab" data-bs-target="#info-tab-pane"
|
||||
type="button" role="tab" aria-controls="info-tab-pane" aria-selected="true">
|
||||
<i class="fa-solid fa-circle-info fa-fw"></i>
|
||||
{% trans %}project.info.info.label{% endtrans %}
|
||||
</button>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link" id="bom-tab" data-bs-toggle="tab" data-bs-target="#bom-tab-pane"
|
||||
type="button" role="tab" aria-controls="bom-tab-pane" aria-selected="false">
|
||||
<i class="fa-solid fa-list-check fa-fw"></i>
|
||||
{% trans %}project_bom_entry.label{% endtrans %}
|
||||
<span class="badge bg-secondary">{{ project.bomEntries | length }}</span></button>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link" id="attachments-tab" data-bs-toggle="tab" data-bs-target="#attachments-tab-pane"
|
||||
type="button" role="tab" aria-controls="attachments-tab-pane" aria-selected="false">BOM</button>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane fade show active" id="info-tab-pane" role="tabpanel" aria-labelledby="info-tab" tabindex="0">
|
||||
{% include "Projects/info/_info.html.twig" %}
|
||||
</div>
|
||||
<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="attachments-tab-pane" role="tabpanel" aria-labelledby="attachments-tab" tabindex="0">
|
||||
Attachments
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
|
@ -57,6 +57,21 @@
|
|||
{% endif %}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro project_status_to_badge(status, class="badge") %}
|
||||
{% if status is not empty %}
|
||||
{% set color = " bg-secondary" %}
|
||||
|
||||
{% if status == "in_production" %}
|
||||
{% set color = " bg-success" %}
|
||||
{% endif %}
|
||||
|
||||
<span class="{{ class ~ color}}">
|
||||
<i class="fa-fw fas fa-info-circle"></i>
|
||||
{{ ("project.status." ~ status) | trans }}
|
||||
</span>
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro structural_entity_link(entity, link_type = "list_parts") %}
|
||||
{# @var entity \App\Entity\Base\StructuralDBElement #}
|
||||
{% if entity %}
|
||||
|
|
|
@ -10091,5 +10091,35 @@ Element 3</target>
|
|||
<target>Is project builds part</target>
|
||||
</segment>
|
||||
</unit>
|
||||
<unit id="YiFf2jl" name="project.info.title">
|
||||
<segment>
|
||||
<source>project.info.title</source>
|
||||
<target>Project info</target>
|
||||
</segment>
|
||||
</unit>
|
||||
<unit id="Y7z_Lil" name="project.info.bom_entries_count">
|
||||
<segment>
|
||||
<source>project.info.bom_entries_count</source>
|
||||
<target>BOM entries</target>
|
||||
</segment>
|
||||
</unit>
|
||||
<unit id="jdkve2C" name="project.info.sub_projects_count">
|
||||
<segment>
|
||||
<source>project.info.sub_projects_count</source>
|
||||
<target>Subprojects</target>
|
||||
</segment>
|
||||
</unit>
|
||||
<unit id="keeSexh" name="project.info.bom_add_parts">
|
||||
<segment>
|
||||
<source>project.info.bom_add_parts</source>
|
||||
<target>Add BOM entries</target>
|
||||
</segment>
|
||||
</unit>
|
||||
<unit id="sgaRuly" name="project.info.info.label">
|
||||
<segment>
|
||||
<source>project.info.info.label</source>
|
||||
<target>Info</target>
|
||||
</segment>
|
||||
</unit>
|
||||
</file>
|
||||
</xliff>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue