diff --git a/src/Controller/ProjectController.php b/src/Controller/ProjectController.php index 9b93c8ec..916f32e6 100644 --- a/src/Controller/ProjectController.php +++ b/src/Controller/ProjectController.php @@ -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, ]); diff --git a/templates/Projects/info.html.twig b/templates/Projects/info.html.twig deleted file mode 100644 index 861183af..00000000 --- a/templates/Projects/info.html.twig +++ /dev/null @@ -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 %} \ No newline at end of file diff --git a/templates/Projects/info/_bom.html.twig b/templates/Projects/info/_bom.html.twig new file mode 100644 index 00000000..ac19c530 --- /dev/null +++ b/templates/Projects/info/_bom.html.twig @@ -0,0 +1,11 @@ +{% import "components/datatables.macro.html.twig" as datatables %} + +
+ +{{ datatables.datatable(datatable, 'elements/datatables/datatables', 'projects') }} + + + + {% trans %}project.info.bom_add_parts{% endtrans %} + \ No newline at end of file diff --git a/templates/Projects/info/_info.html.twig b/templates/Projects/info/_info.html.twig new file mode 100644 index 00000000..fb8c70be --- /dev/null +++ b/templates/Projects/info/_info.html.twig @@ -0,0 +1,71 @@ +{% import "helper.twig" as helper %} + +
+
+
+
+ Part main image +
+
+

{{ project.name }} + {# You need edit permission to use the edit button #} + {% if is_granted('edit', project) %} + + {% endif %} +

+
{{ project.description|format_markdown(true) }}
+ {% if project.buildPart %} +
{% trans %}project.edit.associated_build_part{% endtrans %}:
+ {{ project.buildPart.name }} + {% endif %} + +
+
+
+ + +
{# Sidebar panel with infos about last creation date, etc. #} +
+ + {{ helper.date_user_combination(project, true) }} + +
+ + {{ helper.date_user_combination(project, false) }} + +
+ +
+
+ {{ helper.project_status_to_badge(project.status) }} +
+
+
+
+ + + {{ project.bomEntries | length }} + {% trans %}project.info.bom_entries_count{% endtrans %} + +
+
+ {% if project.children is not empty %} +
+
+ + + {{ project.children | length }} + {% trans %}project.info.sub_projects_count{% endtrans %} + +
+
+ {% endif %} +
+ + {% if project.comment is not empty %} +

+

{% trans %}comment.label{% endtrans %}:
+ {{ project.comment|format_markdown }} +

+ {% endif %} +
\ No newline at end of file diff --git a/templates/Projects/_info_card.html.twig b/templates/Projects/info/_info_card.html.twig similarity index 100% rename from templates/Projects/_info_card.html.twig rename to templates/Projects/info/_info_card.html.twig diff --git a/templates/Projects/info/info.html.twig b/templates/Projects/info/info.html.twig new file mode 100644 index 00000000..4b494acb --- /dev/null +++ b/templates/Projects/info/info.html.twig @@ -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) %} + + {% else %} + {{ helper.entity_icon(project, "me-1") }} + {% endif %} + {% trans %}project.info.title{% endtrans %}: {{ project.name }} +{% endblock %} + +{% block card_content %} + + +
+
+ {% include "Projects/info/_info.html.twig" %} +
+
+ {% include "Projects/info/_bom.html.twig" %} +
+
+ Attachments +
+
+ +{% endblock %} \ No newline at end of file diff --git a/templates/helper.twig b/templates/helper.twig index 4cfe1a11..25ebb110 100644 --- a/templates/helper.twig +++ b/templates/helper.twig @@ -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 %} + + + + {{ ("project.status." ~ status) | trans }} + + {% endif %} +{% endmacro %} + {% macro structural_entity_link(entity, link_type = "list_parts") %} {# @var entity \App\Entity\Base\StructuralDBElement #} {% if entity %} diff --git a/translations/messages.en.xlf b/translations/messages.en.xlf index b3fbae4e..cb6d7a19 100644 --- a/translations/messages.en.xlf +++ b/translations/messages.en.xlf @@ -10091,5 +10091,35 @@ Element 3 Is project builds part + + + project.info.title + Project info + + + + + project.info.bom_entries_count + BOM entries + + + + + project.info.sub_projects_count + Subprojects + + + + + project.info.bom_add_parts + Add BOM entries + + + + + project.info.info.label + Info + +