Part-DB-server/templates/components/tree_macros.html.twig
Marcel Diegelmann f7ec130010 Merge remote-tracking branch 'origin/feature/create-assemblies' into feature/all-features
# Conflicts:
#	.env
#	config/parameters.yaml
#	docs/configuration.md
#	migrations/Version20250304081039.php
#	migrations/Version20250304154507.php
#	src/Controller/AdminPages/BaseAdminController.php
#	src/Controller/ProjectController.php
#	src/Controller/TypeaheadController.php
#	src/DataTables/AssemblyBomEntriesDataTable.php
#	src/DataTables/PartsDataTable.php
#	src/Entity/AssemblySystem/AssemblyBOMEntry.php
#	src/Entity/Attachments/Attachment.php
#	src/Entity/Base/AbstractDBElement.php
#	src/Entity/LogSystem/CollectionElementDeleted.php
#	src/Entity/Parameters/AbstractParameter.php
#	src/Form/AssemblySystem/AssemblyBOMEntryType.php
#	src/Helpers/Assemblies/AssemblyPartAggregator.php
#	src/Security/Voter/AttachmentVoter.php
#	src/Services/AssemblySystem/AssemblyBuildHelper.php
#	src/Services/ImportExportSystem/BOMImporter.php
#	src/Services/ImportExportSystem/EntityExporter.php
#	src/Services/Trees/ToolsTreeBuilder.php
#	src/Services/Trees/TreeViewGenerator.php
#	src/Settings/BehaviorSettings/AssemblyBomTableColumns.php
#	src/Settings/BehaviorSettings/TableSettings.php
#	src/Validator/Constraints/AssemblySystem/AssemblyCycleValidator.php
#	templates/admin/assembly_admin.html.twig
#	templates/assemblies/build/_form.html.twig
#	templates/assemblies/import_bom.html.twig
#	templates/assemblies/info/_info_card.html.twig
#	templates/assemblies/info/info.html.twig
#	templates/components/tree_macros.html.twig
#	templates/form/collection_types_layout_assembly.html.twig
#	translations/messages.cs.xlf
#	translations/messages.da.xlf
#	translations/messages.de.xlf
#	translations/messages.el.xlf
#	translations/messages.en.xlf
#	translations/messages.es.xlf
#	translations/messages.fr.xlf
#	translations/messages.it.xlf
#	translations/messages.ja.xlf
#	translations/messages.nl.xlf
#	translations/messages.pl.xlf
#	translations/messages.ru.xlf
#	translations/messages.zh.xlf
#	translations/validators.cs.xlf
#	translations/validators.en.xlf
2025-10-01 06:56:59 +02:00

65 lines
4.1 KiB
Twig

{% macro sidebar_dropdown() %}
{# Format is [mode, route, label, show_condition] #}
{% set data_sources = [
['categories', path('tree_category_root'), 'category.labelp', is_granted('@categories.read') and is_granted('@parts.read')],
['locations', path('tree_location_root'), 'storelocation.labelp', is_granted('@storelocations.read') and is_granted('@parts.read')],
['footprints', path('tree_footprint_root'), 'footprint.labelp', is_granted('@footprints.read') and is_granted('@parts.read')],
['manufacturers', path('tree_manufacturer_root'), 'manufacturer.labelp', is_granted('@manufacturers.read') and is_granted('@parts.read')],
['suppliers', path('tree_supplier_root'), 'supplier.labelp', is_granted('@suppliers.read') and is_granted('@parts.read')],
['projects', path('tree_device_root'), 'project.labelp', is_granted('@projects.read')],
['assembly', path('tree_assembly_root'), 'assembly.labelp', is_granted('@assemblies.read')],
['tools', path('tree_tools'), 'tools.label', true],
] %}
<li class="dropdown-header">{% trans %}actions{% endtrans %}</li>
<li><button class="tree-btns dropdown-item" {{ stimulus_action('elements/sidebar_tree', 'expandAll') }}">{% trans %}expandAll{% endtrans %}</a></li>
<li><button class="tree-btns dropdown-item" {{ stimulus_action('elements/sidebar_tree', 'collapseAll') }}">{% trans %}reduceAll{% endtrans %}</a></li>
<li role="separator" class="dropdown-divider"></li>
<li class="dropdown-header">{% trans %}datasource{% endtrans %}</li>
{% for source in data_sources %}
{% if source[3] %} {# show_condition #}
<li><button class="tree-btns dropdown-item" data-mode="{{ source[0] }}" data-url="{{ source[1] }}" data-text="{{ source[2] | trans }}"
{{ stimulus_action('elements/sidebar_tree', 'changeDataSource') }}
>{{ source[2] | trans }}</button></li>
{% endif %}
{% endfor %}
{% endmacro %}
{% macro treeview_sidebar(id, default_mode) %}
<div {{ stimulus_controller('elements/sidebar_tree') }} data-default-mode="{{ default_mode }}" id="{{ id }}">
<div class="input-group input-group-sm mb-2 mt-1">
<button class="btn bg-body-tertiary dropdown-toggle" type="button"
data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false"
><span class="sidebar-title" {{ stimulus_target('elements/sidebar_tree', 'sourceText') }}>Loading... / Access Denied</span></button>
<ul class="dropdown-menu" aria-labelledby="dropdownCat">
{{ _self.sidebar_dropdown('tree-categories') }}
</ul>
<input type="search" class="form-control bg-body-tertiary border-0" placeholder="{% trans %}search.placeholder{% endtrans %}" {{ stimulus_action('elements/sidebar_tree', 'searchInput') }}>
</div>
<div id="{{ id }}Tree" {{ stimulus_target('elements/sidebar_tree', 'tree') }}></div>
</div>
{% endmacro %}
{% macro treeview(entity) %}
<div {{ stimulus_controller('elements/tree') }} data-tree-data="{{ tree_data(entity) }}" data-tree-show-tags="true">
<div class="row" >
<div class="col-8">
<input type="search" class="form-control" placeholder="{% trans %}search.placeholder{% endtrans %}" {{ stimulus_action('elements/tree', 'searchInput') }}>
</div>
<div class="btn-group btn-group-sm col-4" role="group">
<button type="button" class="btn btn-outline-secondary" {{ stimulus_action('elements/tree', 'expandAll') }}
title="{% trans %}expandAll{% endtrans %}">
<i class="fas fa-plus fa-fw"></i>
</button>
<button type="button" class="btn btn-outline-secondary" {{ stimulus_action('elements/tree', 'collapseAll') }}
title="{% trans %}reduceAll{% endtrans %}">
<i class="fas fa-minus fa-fw"></i>
</button>
</div>
</div>
<div class="treeview-sm mt-2" {{ stimulus_target('elements/tree', 'tree') }}></div>
</div>
{% endmacro %}