mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-08-03 17:55:03 +02:00
Improved project info page
This commit is contained in:
parent
ef6d30e04b
commit
742b2d3d48
8 changed files with 195 additions and 20 deletions
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>
|
133
templates/Projects/info/_info_card.html.twig
Normal file
133
templates/Projects/info/_info_card.html.twig
Normal file
|
@ -0,0 +1,133 @@
|
|||
{% import "helper.twig" as helper %}
|
||||
{% import "LabelSystem/dropdown_macro.html.twig" as dropdown %}
|
||||
|
||||
{{ helper.breadcrumb_entity_link(project) }}
|
||||
|
||||
<div class="accordion mb-4" id="listAccordion">
|
||||
<div class="accordion-item">
|
||||
<div class="accordion-header">
|
||||
<button class="accordion-button collapsed py-2" data-bs-toggle="collapse" data-bs-target="#entityInfo" aria-expanded="true">
|
||||
{% 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 %}device.label{% endtrans %}: <b>{{ project.name }}</b>
|
||||
</button>
|
||||
</div>
|
||||
<div id="entityInfo" class="accordion-collapse collapse show" data-bs-parent="#listAccordion">
|
||||
<div class="accordion-body">
|
||||
{% if project.description is not empty %}
|
||||
{{ project.description|format_markdown }}
|
||||
{% endif %}
|
||||
<div class="row">
|
||||
<div class="col-sm-2">
|
||||
<div class="nav flex-column nav-pills" id="v-pills-tab" role="tablist" aria-orientation="vertical">
|
||||
<a class="nav-link active" id="v-pills-home-tab" data-bs-toggle="pill" href="#v-pills-home" role="tab" aria-controls="v-pills-home" aria-selected="true">
|
||||
<i class="fas fa-info-circle fa-fw"></i>
|
||||
{% trans %}entity.info.common.tab{% endtrans %}
|
||||
</a>
|
||||
<a class="nav-link" id="v-pills-statistics-tab" data-bs-toggle="pill" href="#v-pills-statistics" role="tab" aria-controls="v-pills-profile" aria-selected="false">
|
||||
<i class="fas fa-chart-pie fa-fw"></i>
|
||||
{% trans %}entity.info.statistics.tab{% endtrans %}
|
||||
</a>
|
||||
{% if project.attachments is not empty %}
|
||||
<a class="nav-link" id="v-pills-attachments-tab" data-bs-toggle="pill" href="#v-pills-attachments" role="tab" aria-controls="v-pills-attachments" aria-selected="false">
|
||||
<i class="fas fa-paperclip fa-fw"></i>
|
||||
{% trans %}entity.info.attachments.tab{% endtrans %}
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if project.parameters is not empty %}
|
||||
<a class="nav-link" id="v-pills-parameters-tab" data-bs-toggle="pill" href="#v-pills-parameters" role="tab" aria-controls="v-pills-parameters" aria-selected="false">
|
||||
<i class="fas fa-atlas fa-fw"></i>
|
||||
{% trans %}entity.info.parameters.tab{% endtrans %}
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if project.comment is not empty %}
|
||||
<a class="nav-link" id="v-pills-comment-tab" data-bs-toggle="pill" href="#v-pills-comment" role="tab">
|
||||
<i class="fas fa-comment-alt fa-fw"></i>
|
||||
{% trans %}comment.label{% endtrans %}
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-10">
|
||||
<div class="tab-content" id="v-pills-tabContent">
|
||||
<div class="tab-pane fade show active" id="v-pills-home" role="tabpanel" aria-labelledby="v-pills-home-tab">
|
||||
<div class="row">
|
||||
<div class="col-sm-9 form-horizontal">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4">{% trans %}entity.info.name{% endtrans %}:</label>
|
||||
<span class="col-sm form-control-static">{{ project.name }}</span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4">{% trans %}entity.info.parent{% endtrans %}:</label>
|
||||
<span class="col-sm form-control-static">
|
||||
{% if project.parent %}
|
||||
{{ project.parent.fullPath }}
|
||||
{% else %}
|
||||
-
|
||||
{% endif %}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-3">
|
||||
{% block quick_links %}{% endblock %}
|
||||
|
||||
<a class="btn btn-secondary w-100 mb-2" href="{{ entity_url(project, 'edit') }}">
|
||||
<i class="fas fa-edit"></i> {% trans %}entity.edit.btn{% endtrans %}
|
||||
</a>
|
||||
<div class="">
|
||||
<span class="text-muted" title="{% trans %}lastModified{% endtrans %}">
|
||||
<i class="fas fa-history fa-fw"></i> {{ project.lastModified | format_datetime("short") }}
|
||||
</span>
|
||||
<br>
|
||||
<span class="text-muted mt-1" title="{% trans %}createdAt{% endtrans %}">
|
||||
<i class="fas fa-calendar-plus fa-fw"></i> {{ project.addedDate | format_datetime("short") }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="v-pills-statistics" role="tabpanel" aria-labelledby="v-pills-statistics-tab">
|
||||
<div class="form-horizontal">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4">{% trans %}entity.info.children_count{% endtrans %}:</label>
|
||||
<span class="col-sm form-control-static">{{ project.children | length }}</span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4">{% trans %}entity.info.parts_count{% endtrans %}:</label>
|
||||
<span class="col-sm form-control-static">{{ project.bomEntries | length }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if project.attachments is not empty %}
|
||||
<div class="tab-pane fade" id="v-pills-attachments" role="tabpanel" aria-labelledby="v-pills-attachments-tab">
|
||||
{% include "Parts/info/_attachments_info.html.twig" with {"part": project} %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if project.parameters is not empty %}
|
||||
<div class="tab-pane fade" id="v-pills-parameters" role="tabpanel" aria-labelledby="v-pills-parameters-tab">
|
||||
{% for name, parameters in project.groupedParameters %}
|
||||
{% if name is not empty %}<h5 class="mt-1">{{ name }}</h5>{% endif %}
|
||||
{{ helper.parameters_table(project) }}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if project.comment is not empty %}
|
||||
<div class="tab-pane fade" id="v-pills-comment" role="tabpanel" aria-labelledby="home-tab">
|
||||
<div class="container-fluid mt-2 latex" data-controller="common--latex">
|
||||
{{ project.comment|format_markdown }}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</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 %}
|
Loading…
Add table
Add a link
Reference in a new issue