mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-01-12 05:09:33 +00:00
Überarbeitungen: Subassemblies darstellen sowie Parameters losgelöst von Entität zur Anzeige bringen
This commit is contained in:
parent
9f42e751f5
commit
5ab2cf505e
7 changed files with 64 additions and 22 deletions
|
|
@ -14,8 +14,6 @@ parameters:
|
|||
|
||||
partdb.db.emulate_natural_sort: '%env(bool:DATABASE_EMULATE_NATURAL_SORT)%' # If this is set to true, natural sorting is emulated on platforms that do not support it natively. This can be slow on large datasets.
|
||||
|
||||
partdb.create_assembly_use_ipn_placeholder_in_name: '%env(bool:CREATE_ASSEMBLY_USE_IPN_PLACEHOLDER_IN_NAME)%' # Use an %%ipn%% placeholder in the name of an assembly. Placeholder is replaced with the ipn input while saving.
|
||||
|
||||
######################################################################################################################
|
||||
# Users and Privacy
|
||||
######################################################################################################################
|
||||
|
|
|
|||
|
|
@ -234,13 +234,6 @@ abstract class BaseAdminController extends AbstractController
|
|||
|
||||
$repo = $this->entityManager->getRepository($this->entity_class);
|
||||
|
||||
$showParameters = true;
|
||||
if ($this instanceof AssemblyAdminController) {
|
||||
//currently not needed for assemblies
|
||||
|
||||
$showParameters = false;
|
||||
}
|
||||
|
||||
return $this->render($this->twig_template, [
|
||||
'entity' => $entity,
|
||||
'form' => $form,
|
||||
|
|
@ -250,7 +243,6 @@ abstract class BaseAdminController extends AbstractController
|
|||
'timeTravel' => $timeTravel_timestamp,
|
||||
'repo' => $repo,
|
||||
'partsContainingElement' => $repo instanceof PartsContainingRepositoryInterface,
|
||||
'showParameters' => $showParameters,
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
@ -404,20 +396,12 @@ abstract class BaseAdminController extends AbstractController
|
|||
}
|
||||
}
|
||||
|
||||
$showParameters = true;
|
||||
if ($this instanceof AssemblyAdminController) {
|
||||
//currently not needed for assemblies
|
||||
|
||||
$showParameters = false;
|
||||
}
|
||||
|
||||
return $this->render($this->twig_template, [
|
||||
'entity' => $new_entity,
|
||||
'form' => $form,
|
||||
'import_form' => $import_form,
|
||||
'mass_creation_form' => $mass_creation_form,
|
||||
'route_base' => $this->route_base,
|
||||
'showParameters' => $showParameters,
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -857,7 +857,7 @@ class BOMImporter
|
|||
if (isset($entry['name'])) {
|
||||
$givenName = trim($entry['name']) === '' ? null : trim ($entry['name']);
|
||||
|
||||
if ($givenName !== null && $bomEntry->getPart() !== null && $bomEntry->getPart()->getName() !== $givenName) {
|
||||
if ($givenName !== null && $part !== null && $part->getName() !== $givenName) {
|
||||
//Apply different names for parts list entry
|
||||
$bomEntry->setName(trim($entry['name']) === '' ? null : trim ($entry['name']));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@
|
|||
<li class="nav-item">
|
||||
<a data-bs-toggle="tab" class="nav-link link-anchor" href="#attachments">{% trans %}admin.attachments{% endtrans %}</a>
|
||||
</li>
|
||||
{% if entity.parameters is defined and showParameters == true %}
|
||||
{% if entity.parameters is defined %}
|
||||
<li class="nav-item">
|
||||
<a data-bs-toggle="tab" class="nav-link link-anchor" href="#parameters">{% trans %}admin.parameters{% endtrans %}</a>
|
||||
</li>
|
||||
|
|
@ -201,4 +201,4 @@
|
|||
</turbo-frame>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
|
|
|||
|
|
@ -105,6 +105,8 @@
|
|||
{{ 'assembly.bom_import.template.kicad_pcbnew.exptected_columns.note'|trans|raw }}
|
||||
|
||||
{{ 'assembly.bom_import.template.kicad_pcbnew.table'|trans|raw }}
|
||||
|
||||
{{ 'assembly.bom_import.template.json.table'|trans|raw }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
28
templates/assemblies/info/_subassemblies.html.twig
Normal file
28
templates/assemblies/info/_subassemblies.html.twig
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
<table class="table table-striped table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{% trans %}name.label{% endtrans %}</th>
|
||||
<th>{% trans %}description.label{% endtrans %}</th>
|
||||
<th># {% trans %}assembly.info.bom_entries_count{% endtrans %}</th>
|
||||
<th># {% trans %}assembly.info.sub_assemblies_count{% endtrans %}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for assembly in assembly.children %}
|
||||
<tr>
|
||||
<td> {# Name #}
|
||||
<a href="{{ entity_url(assembly, 'info') }}">{{ assembly.name }}</a>
|
||||
</td>
|
||||
<td> {# Description #}
|
||||
{{ assembly.description | format_markdown }}
|
||||
</td>
|
||||
<td>
|
||||
{{ assembly.bomEntries | length }}
|
||||
</td>
|
||||
<td>
|
||||
{{ assembly.children | length }}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
@ -70,6 +70,16 @@
|
|||
{% trans %}assembly.info.info.label{% endtrans %}
|
||||
</button>
|
||||
</li>
|
||||
{% if assembly.children is not empty %}
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link" id="subassemblies-tab" data-bs-toggle="tab" data-bs-target="#subassemblies-tab-pane"
|
||||
type="button" role="tab" aria-controls="subassemblies-tab-pane" aria-selected="false">
|
||||
<i class="fa-solid fa-folder-tree fa-fw"></i>
|
||||
{% trans %}assembly.info.sub_assemblies.label{% endtrans %}
|
||||
<span class="badge bg-secondary">{{ assembly.children | length }}</span>
|
||||
</button>
|
||||
</li>
|
||||
{% endif %}
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link" id="part-tab" data-bs-toggle="tab" data-bs-target="#part-tab-pane"
|
||||
type="button" role="tab" aria-controls="part-tab-pane" aria-selected="false">
|
||||
|
|
@ -88,18 +98,38 @@
|
|||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if assembly.parameters is not empty %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" id="parameters-tab" data-bs-toggle="tab"
|
||||
data-bs-target="#parameters-tab-pane" role="tab">
|
||||
<i class="fas fa-atlas fa-fw"></i>
|
||||
{% trans %}entity.info.parameters.tab{% endtrans %}
|
||||
<span class="badge bg-secondary">{{ assembly.parameters | length }}</span>
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</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 "assemblies/info/_info.html.twig" %}
|
||||
</div>
|
||||
{% if assembly.children is not empty %}
|
||||
<div class="tab-pane fade" id="subassemblies-tab-pane" role="tabpanel" aria-labelledby="bom-tab" tabindex="0">
|
||||
{% include "assemblies/info/_subassemblies.html.twig" %}
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="tab-pane fade" id="part-tab-pane" role="tabpanel" aria-labelledby="part-tab" tabindex="0">
|
||||
{% include "assemblies/info/_part.html.twig" %}
|
||||
</div>
|
||||
<div class="tab-pane fade" id="attachments-tab-pane" role="tabpanel" aria-labelledby="attachments-tab" tabindex="0">
|
||||
{% include "assemblies/info/_attachments_info.html.twig" with {"assembly": assembly} %}
|
||||
</div>
|
||||
<div class="tab-pane fade" id="parameters-tab-pane" role="tabpanel" aria-labelledby="parameters-tab">
|
||||
{% for name, parameters in assembly.groupedParameters %}
|
||||
{% if name is not empty %}<h5 class="mt-1">{{ name }}</h5>{% endif %}
|
||||
{{ helper.parameters_table(assembly.parameters) }}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue