2022-09-09 00:41:35 +02:00
|
|
|
{% macro datatable(datatable, controller = 'elements/datatables/datatables', state_save_tag = null) %}
|
2024-10-16 23:57:02 +02:00
|
|
|
<div {{ stimulus_controller(controller, {"stateSaveTag": state_save_tag}) }} data-dt-settings='{{ datatable_settings(datatable)|escape('html_attr') }}' data-dt-url="{{ uri_without_host(app.request) }}">
|
2022-08-01 00:31:49 +02:00
|
|
|
<div {{ stimulus_target(controller, 'dt') }}>
|
|
|
|
|
<div class="card-body">
|
|
|
|
|
<div class="card">
|
|
|
|
|
<div class="card-body">
|
|
|
|
|
<h4>{% trans %}part_list.loading.caption{% endtrans %}</h4>
|
|
|
|
|
<h6>{% trans %}part_list.loading.message{% endtrans %}</h6>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
{% endmacro %}
|
|
|
|
|
|
2022-10-09 20:27:31 +02:00
|
|
|
{% macro logDataTable(dt, state_save_tag = null) %}
|
|
|
|
|
{{ _self.datatable(dt, 'elements/datatables/log', state_save_tag) }}
|
2022-08-01 00:31:49 +02:00
|
|
|
{% endmacro %}
|
|
|
|
|
|
2022-09-09 00:41:35 +02:00
|
|
|
{% macro partsDatatableWithForm(datatable, state_save_tag = 'parts') %}
|
2022-08-01 00:31:49 +02:00
|
|
|
<form method="post" action="{{ path("table_action") }}"
|
2023-11-11 23:14:22 +01:00
|
|
|
{# The app.request.baseUrl here is important or it wont work behind a reverse proxy with subfolder #}
|
2024-10-16 23:57:02 +02:00
|
|
|
{{ stimulus_controller('elements/datatables/parts', {"stateSaveTag": state_save_tag}) }} data-dt-settings='{{ datatable_settings(datatable)|escape('html_attr') }}' data-dt-url="{{ uri_without_host(app.request) }}"
|
2022-08-01 00:50:05 +02:00
|
|
|
{{ stimulus_action('elements/datatables/parts', 'confirmDeletionAtSubmit') }} data-delete-title="{% trans %}part_list.action.delete-title{% endtrans %}"
|
|
|
|
|
data-delete-message="{% trans %}part_list.action.delete-message{% endtrans %}">
|
2022-08-01 00:31:49 +02:00
|
|
|
<input type="hidden" name="_token" value="{{ csrf_token('table_action') }}">
|
|
|
|
|
|
2024-10-16 23:57:02 +02:00
|
|
|
<input type="hidden" name="redirect_back" value="{{ uri_without_host(app.request) }}">
|
2022-08-01 00:31:49 +02:00
|
|
|
|
|
|
|
|
<input type="hidden" name="ids" {{ stimulus_target('elements/datatables/parts', 'selectIDs') }} value="">
|
|
|
|
|
|
2025-09-07 21:59:30 +02:00
|
|
|
<div class="d-none mb-2 bg-body-tertiary shadow-sm border border-secondary rounded mx-2 p-2" {{ stimulus_target('elements/datatables/parts', 'selectPanel') }}>
|
2023-02-06 00:33:57 +01:00
|
|
|
<div class="input-group">
|
2023-08-21 22:48:47 +02:00
|
|
|
<button class="btn btn-outline-secondary" type="button" {{ stimulus_action('elements/datatables/parts', 'invertSelection')}}
|
|
|
|
|
title="{% trans %}part_list.action.invert_selection{% endtrans %}" ><i class="fa-solid fa-arrow-right-arrow-left"></i></button>
|
2023-02-06 00:33:57 +01:00
|
|
|
<span class="input-group-text">
|
|
|
|
|
<span class="badge bg-primary">{% trans with {'%count%': '<span ' ~ stimulus_target('elements/datatables/parts', 'selectCount') ~ '></span>'} %}part_list.action.part_count{% endtrans %}</span>
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
<select class="form-select" name="action" data-controller="elements--select" {{ stimulus_action('elements/datatables/parts', 'updateTargetPicker', 'change') }}
|
2023-02-06 00:08:32 +01:00
|
|
|
title="{% trans %}part_list.action.action.title{% endtrans %}" required>
|
2025-09-21 23:43:10 +02:00
|
|
|
<optgroup label="{% trans %}part_list.action.action.group.favorite{% endtrans %} ({% trans %}part_list.action.scrollable_hint{% endtrans %})">
|
2023-02-06 00:08:32 +01:00
|
|
|
<option {% if not is_granted('@parts.change_favorite') %}disabled{% endif %} value="favorite">{% trans %}part_list.action.action.favorite{% endtrans %}</option>
|
|
|
|
|
<option {% if not is_granted('@parts.change_favorite') %}disabled{% endif %} value="unfavorite">{% trans %}part_list.action.action.unfavorite{% endtrans %}</option>
|
|
|
|
|
</optgroup>
|
|
|
|
|
<optgroup label="{% trans %}part_list.action.action.group.needs_review{% endtrans %}">
|
|
|
|
|
<option {% if not is_granted('@parts.edit') %}disabled{% endif %} value="set_needs_review">{% trans %}part_list.action.action.set_needs_review{% endtrans %}</option>
|
|
|
|
|
<option {% if not is_granted('@parts.edit') %}disabled{% endif %} value="unset_needs_review">{% trans %}part_list.action.action.unset_needs_review{% endtrans %}</option>
|
|
|
|
|
</optgroup>
|
|
|
|
|
<optgroup label="{% trans %}part_list.action.action.group.change_field{% endtrans %}">
|
2023-03-18 21:52:29 +01:00
|
|
|
<option {% if not is_granted('@parts.edit') %}disabled{% endif %} value="change_category" data-url="{{ path('select_category') }}">{% trans %}part_list.action.action.change_category{% endtrans %}</option>
|
|
|
|
|
<option {% if not is_granted('@parts.edit') %}disabled{% endif %} value="change_footprint" data-url="{{ path('select_footprint') }}">{% trans %}part_list.action.action.change_footprint{% endtrans %}</option>
|
|
|
|
|
<option {% if not is_granted('@parts.edit') %}disabled{% endif %} value="change_manufacturer" data-url="{{ path('select_manufacturer') }}">{% trans %}part_list.action.action.change_manufacturer{% endtrans %}</option>
|
|
|
|
|
<option {% if not is_granted('@parts.edit') %}disabled{% endif %} value="change_unit" data-url="{{ path('select_measurement_unit') }}">{% trans %}part_list.action.action.change_unit{% endtrans %}</option>
|
2025-03-29 16:21:10 +01:00
|
|
|
<option {% if not is_granted('@parts.edit') %}disabled{% endif %} value="change_location" data-url="{{ path('select_storage_location') }}">{% trans %}part_list.action.action.change_location{% endtrans %}</option>
|
2023-02-06 00:08:32 +01:00
|
|
|
</optgroup>
|
|
|
|
|
<optgroup label="{% trans %}part_list.action.group.labels{% endtrans %}">
|
|
|
|
|
<option {% if not is_granted('@labels.create_labels') %}disabled{% endif %} value="generate_label_lot" data-url="{{ path('select_label_profiles_lot')}}">{% trans %}part_list.action.projects.generate_label_lot{% endtrans %}</option>
|
|
|
|
|
<option {% if not is_granted('@labels.create_labels') %}disabled{% endif %} value="generate_label" data-url="{{ path('select_label_profiles')}}">{% trans %}part_list.action.projects.generate_label{% endtrans %}</option>
|
|
|
|
|
</optgroup>
|
|
|
|
|
<optgroup label="{% trans %}part_list.action.group.projects{% endtrans %}">
|
|
|
|
|
<option {% if not is_granted('@projects.read') %}disabled{% endif %} value="add_to_project" data-url="{{ path('select_project')}}">{% trans %}part_list.action.projects.add_to_project{% endtrans %}</option>
|
|
|
|
|
</optgroup>
|
2022-08-01 00:31:49 +02:00
|
|
|
|
Enhance KiCad integration: API v2, batch EDA editing, field export control (#1241)
* Add stock quantity, datasheet URL, and HTTP caching to KiCad API
- Add Stock field showing total available quantity across all part lots
- Add Storage Location field when parts have stored locations
- Resolve actual datasheet PDF from attachments (by type name, attachment
name, or first PDF) instead of always linking to Part-DB page
- Keep Part-DB page URL as separate "Part-DB URL" field
- Add ETag and Cache-Control headers to all KiCad API endpoints
- Support conditional requests (If-None-Match) returning 304
- Categories/part lists cached 5 min, part details cached 1 min
* Add KiCadHelper unit tests and fix PDF detection for external URLs
- Add comprehensive KiCadHelperTest with 14 test cases covering:
- Stock quantity calculation (zero, single lot, multiple lots)
- Stock exclusion of expired and unknown-quantity lots
- Storage location display (present, absent, multiple)
- Datasheet URL resolution by type name, attachment name, PDF extension
- Datasheet fallback to Part-DB URL when no match
- "Data sheet" (with space) name variant matching
- Fix PDF extension detection for external attachments (getExtension()
returns null for external-only attachments, now also parses URL path)
* Fix 304 response body, parse_url safety, and location/stock consistency
- Use empty Response instead of JsonResponse(null) for 304 Not Modified
to avoid sending "null" as response body
- Guard parse_url() result with is_string() since it can return false
for malformed URLs
- Move storage location tracking inside the availability check so
expired and unknown-quantity lots don't contribute locations
* Fix testPartDetailsPart2 to actually test Part 2
The test was requesting /parts/1.json instead of /parts/2.json and had
Part 1's expected data. Now tests Part 2 which inherits EDA info from
its category and footprint, verifying the inheritance behavior.
* Use Symfony's built-in ETag handling for HTTP caching
Replace manual If-None-Match comparison with Response::setEtag() and
Response::isNotModified(), which properly handles ETag quoting, weak
vs strong comparison, and 304 response cleanup. Fixes PHPStan return
type error and CI test failures.
* Add configurable KiCad field export for part parameters
Add a kicad_export checkbox to parameters, allowing users to control
which specifications appear as fields in the KiCad HTTP library API.
Parameters with kicad_export enabled are included using their formatted
value, without overwriting hardcoded fields like description or Stock.
* Add partdb:kicad:populate command for bulk KiCad path assignment
Console command that populates KiCad footprint/symbol paths on Footprint
and Category entities based on name-to-library mappings. Supports dry-run,
force overwrite, and list modes. Includes 130+ footprint mappings and 30+
category symbol mappings for KiCad 9.x standard libraries.
* Add CSV import support for EDA/KiCad fields
Add user-friendly column aliases (kicad_symbol, kicad_footprint,
kicad_reference, kicad_value, eda_exclude_bom, etc.) to the CSV import
system. Users can now bulk-set KiCad symbols, footprints, and other EDA
metadata via CSV/Excel import without knowing the internal dot notation.
* Add batch EDA field editing from parts table
Users can now select multiple parts in any parts table and batch-edit
their EDA/KiCad fields (symbol, footprint, reference prefix, value,
visibility, exclude from BOM/board/sim). Each field has an "Apply"
checkbox so users control exactly which fields are changed.
* Remove unused counter variable in BatchEdaController
* Fix PHPStan errors in PopulateKicadCommand and BatchEdaController
Add @var type annotations for Doctrine repository findAll() calls so
PHPStan can resolve getEdaInfo() on Footprint/Category entities. Fix
array return type for numeric-string keys and add explicit callback to
array_filter to satisfy strict rules.
* Fix batch EDA edit: required validation and pre-populate shared values
- Add required=false to TriStateCheckboxType fields so HTML5 validation
doesn't force users to check visibility/BOM/board checkboxes
- Pre-populate form fields when all selected parts share the same EDA
value, so users can see current state before editing
* Add KiCad API v2, orderdetail export control, EDA status indicator, BOM improvements
- Add KiCad API v2 endpoints (/kicad-api/v2) with volatile field support
for stock and storage location (shown but not saved to schematic)
- Add kicad_export flag to Orderdetail entity for per-supplier SPN control
(backward compatible: if no flag set, all SPNs exported as before)
- Add EDA completeness indicator column in parts datatable (bolt icon)
- Add ?minimal=true query param for faster category parts loading
- Improve category descriptions (use comment instead of URL when available)
- Improve BOM importer multi-footprint support: merge entries by Part-DB
part ID when linked, tracking footprint variants in comments
- Fix KiCost manf/manf# fields always present (not conditional on orderdetails)
- Fix duplicate getEdaInfo() call in shouldPartBeVisible
- Consolidate supplier SPN and KiCost field generation into single loop
* Fix kicad_export column default for SQLite compatibility
Add options default to ORM column definition so schema:update
works correctly on SQLite test databases.
* Make EDA status bolt icon clickable to open EDA settings tab
* Fix EDA bolt link to correctly open EDA tab via data-turbo=false
* Add configurable datasheet URL mode for KiCad API
New setting "Datasheet field links to PDF" in KiCad EDA settings.
When enabled (default), the datasheet field resolves to the actual
PDF attachment URL. When disabled, it links to the Part-DB page
(old behavior). Configurable via settings UI or EDA_KICAD_DATASHEET_AS_PDF env var.
* Fix settings crash when upgrading: make datasheetAsPdf nullable
The settings bundle stores values in the database. When upgrading from
a version without datasheetAsPdf, the stored JSON lacks this key,
causing a TypeError when assigning null to a non-nullable bool.
Making it nullable with a fallback in KiCadHelper fixes the upgrade path.
* Add functional tests for KiCad API v2 and batch EDA controller
- KiCadApiV2ControllerTest: root, categories, parts, volatile fields,
v1 vs v2 comparison, cache headers, 304 conditional request, auth
- BatchEdaControllerTest: page load, empty redirect, form submission
* Fix test failures: correct ids format and anonymous access assertion
* Improve test coverage for BatchEdaController
Add tests for: applying all EDA fields at once, custom redirect URL,
and verifying unchecked fields are skipped.
* Address PR review: rename to eda_visibility, merge migrations, API versioning
Changes based on jbtronics' review of PR #1241:
- Rename kicad_export -> eda_visibility (entities, forms, templates,
translations, tests) with nullable bool for system default support
- Merge two database migrations into one (Version20260211000000)
- Rename createCachedJsonResponse -> createCacheableJsonResponse
- Change bool $apiV2 -> int $apiVersion with version validation
- EDA visibility field only shown for part parameters, not other entities
- PopulateKicadCommand: check alternative names of footprints/categories
- PopulateKicadCommand: support external JSON mapping file (--mapping-file)
- Ship default mappings JSON at contrib/kicad-populate/default_mappings.json
- Add system-wide defaultEdaVisibility setting in KiCadEDASettings
- Add KiCad HTTP Library v2 spec link in controller docs
* Fix duplicate loadMappingFile method causing PHP fatal error
* Add tests for mapping file and alternative name matching, update populate command docs
Add 5 new tests for PopulateKicadCommand covering:
- Custom mapping file overriding defaults
- Invalid JSON mapping file error handling
- Missing mapping file error handling
- Footprint alternative name matching
- Category alternative name matching
Update contrib README to document --mapping-file option,
alternative name matching, and custom JSON mapping format.
* Split out KiCad API v2 into separate PR as requested by maintainer
Remove v2 controller, tests, and volatile field support from this PR.
The v2 API will be submitted as a separate PR for focused discussion.
* Improve test coverage for KiCadHelper and PopulateKicadCommand
KiCadHelper: Add tests for orderdetail eda_visibility filtering,
backward compatibility when no flags set, manufacturer/KiCost fields,
and parameter with empty name skipping.
PopulateKicadCommand: Add tests for mapping file with both footprints
and categories sections, and mapping file with only categories.
* Load populate Kicad default mappings from json file
* Moved kicad:populate documentation to central docs
* Added introduced column to PartTableColumns to make it configurable in the settings
* Use TristateCheckboxes for parameter and orderdetail types
* Fixed translation keys
* Split up default eda visibility for parameters and purchase infos
---------
Co-authored-by: Jan Böhmer <mail@jan-boehmer.de>
2026-03-01 22:10:13 +01:00
|
|
|
<optgroup label="{% trans %}part_list.action.group.eda{% endtrans %}">
|
|
|
|
|
<option {% if not is_granted('@parts.edit') %}disabled{% endif %} value="batch_edit_eda" data-turbo="false">{% trans %}part_list.action.batch_edit_eda{% endtrans %}</option>
|
|
|
|
|
</optgroup>
|
2023-02-19 21:58:55 +01:00
|
|
|
<optgroup label="{% trans %}part_list.action.action.delete{% endtrans %}">
|
|
|
|
|
<option {% if not is_granted('@parts.delete') %}disabled{% endif %} value="delete">{% trans %}part_list.action.action.delete{% endtrans %}</option>
|
|
|
|
|
</optgroup>
|
2023-03-12 00:27:04 +01:00
|
|
|
<optgroup label="{% trans %}part_list.action.action.export{% endtrans %}">
|
|
|
|
|
<option {% if not is_granted('@parts.read') %}disabled{% endif %} value="export_json" data-url="{{ path('select_export_level')}}" data-turbo="false">{% trans %}part_list.action.export_json{% endtrans %}</option>
|
|
|
|
|
<option {% if not is_granted('@parts.read') %}disabled{% endif %} value="export_csv" data-url="{{ path('select_export_level')}}" data-turbo="false">{% trans %}part_list.action.export_csv{% endtrans %}</option>
|
|
|
|
|
<option {% if not is_granted('@parts.read') %}disabled{% endif %} value="export_yaml" data-url="{{ path('select_export_level')}}" data-turbo="false">{% trans %}part_list.action.export_yaml{% endtrans %}</option>
|
|
|
|
|
<option {% if not is_granted('@parts.read') %}disabled{% endif %} value="export_xml" data-url="{{ path('select_export_level')}}" data-turbo="false">{% trans %}part_list.action.export_xml{% endtrans %}</option>
|
2025-08-01 23:12:08 +02:00
|
|
|
<option {% if not is_granted('@parts.read') %}disabled{% endif %} value="export_xlsx" data-url="{{ path('select_export_level')}}" data-turbo="false">{% trans %}part_list.action.export_xlsx{% endtrans %}</option>
|
2023-03-12 00:27:04 +01:00
|
|
|
</optgroup>
|
2025-08-02 17:56:46 +02:00
|
|
|
<optgroup label="{% trans %}part_list.action.action.info_provider{% endtrans %}">
|
|
|
|
|
<option {% if not is_granted('@info_providers.create_parts') %}disabled{% endif %} value="bulk_info_provider_import" data-url="{{ path('bulk_info_provider_step1')}}" data-turbo="false">{% trans %}part_list.action.bulk_info_provider_import{% endtrans %}</option>
|
2023-03-12 00:27:04 +01:00
|
|
|
</optgroup>
|
2023-02-06 00:08:32 +01:00
|
|
|
</select>
|
2022-08-01 00:31:49 +02:00
|
|
|
|
2023-02-06 00:33:57 +01:00
|
|
|
<select class="form-select d-none" data-controller="elements--structural-entity-select" name="target" {{ stimulus_target('elements/datatables/parts', 'selectTargetPicker') }}>
|
2023-02-06 00:08:32 +01:00
|
|
|
{# This is left empty, as this will be filled by Javascript #}
|
|
|
|
|
</select>
|
2022-08-01 00:31:49 +02:00
|
|
|
|
2023-08-21 22:48:47 +02:00
|
|
|
<button type="submit" class="btn btn-primary">{% trans %}part_list.action.submit{% endtrans %}</button>
|
2023-02-06 00:33:57 +01:00
|
|
|
</div>
|
2022-08-01 00:31:49 +02:00
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div {{ stimulus_target('elements/datatables/parts', 'dt') }}>
|
|
|
|
|
<div class="card-body">
|
|
|
|
|
<div class="card">
|
|
|
|
|
<div class="card-body">
|
|
|
|
|
<h4>{% trans %}part_list.loading.caption{% endtrans %}</h4>
|
|
|
|
|
<h6>{% trans %}part_list.loading.message{% endtrans %}</h6>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</form>
|
|
|
|
|
|
2025-09-07 21:51:58 +02:00
|
|
|
{% endmacro %}
|