Part-DB-server/assets/controllers/pages
Sebastian Almberg d73bc42362 Add a component value calculator & image generator
Adds a "Value calculator" tool (Tools menu) that decodes/encodes the value of
common components and generates a clean SVG picture you can attach to a part —
handy for assortments imported with blank thumbnails and sparse data.

Calculator tabs (bidirectional decode <-> encode), each drawing the part to the
selected package with a collapsible appearance panel and an "attach to part"
action (optionally as the master picture):
- Resistor: 4/5/6-band colour code
- Capacitor: value <-> 3-digit code <-> tolerance
- SMD resistor: value <-> 3-digit / 4-digit / EIA-96 code
- Inductor: colour-band code
- SMD inductor: value <-> uH code

Bulk "Generate component images" parts-table action:
- Classifies each selected part (resistor / capacitor / inductor / diode / LED,
  THT or SMD) with ComponentValueGuesser and detects value, voltage, tolerance,
  power, ppm, pitch, diameter, colour, SMD package and marking from the name,
  description and parameters.
- Renders a preview per part, lets you tweak appearance, and attaches the images
  in one go; can also write matching KiCad symbol/footprint/reference-prefix EDA
  fields.

Backend: ComponentValueGuesser (classification + detection + EDA suggestion),
GeneratedImageAttachmentHelper (stores the SVG through the existing attachment
pipeline, so it is sanitised on save), two POST endpoints on PartController
(generate_image, set_eda) guarded by `edit` + CSRF, a new `@tools.value_calculator`
permission, a Tools-tree entry and docs. All drawing is client-side in a Stimulus
controller; the un-sanitised live preview escapes part-derived text and validates
colours as defence-in-depth.

Tests: unit tests for ComponentValueGuesser and functional tests for the
endpoints, including permission and CSRF enforcement and the persisted side
effects.
2026-07-30 17:49:18 +02:00
..
association_edit_type_select_controller.js Hide the custom type input field if not needed to improve the UX 2023-11-16 22:33:31 +01:00
barcode_scan_controller.js Correctly dispatch the input event of non-printable char controller from the barcode scan controller 2026-03-01 16:51:06 +01:00
bulkGenerate_controller.js Add a component value calculator & image generator 2026-07-30 17:49:18 +02:00
checkbox_multicheck_controller.js Improved frontend of build page 2023-01-22 17:34:10 +01:00
dont_check_quantity_checkbox_controller.js Added possibility to ignore the checks of withdraw amount when building projects 2023-08-20 23:23:18 +02:00
label_download_btn_controller.js Added copyright/license info to files 2022-11-29 21:21:26 +01:00
latex_preview_controller.js Update AbstractParameter.php (#959) 2025-07-06 00:20:29 +02:00
parameters_autocomplete_controller.js Added a "unsaved changed" warning dialog for part, entity edits and system settings 2026-05-25 21:29:10 +02:00
part_merge_modal_controller.js Added an modal form on the part info page, to merge a part into another one 2023-11-22 22:50:25 +01:00
part_stocktake_modal_controller.js Added a modal to stocktake / set part lots amount from info page 2026-02-10 23:17:10 +01:00
part_withdraw_modal_controller.js Autofocus for frequently used input fields 2026-02-11 14:10:05 +01:00
reelCalculator_controller.js Moved alerts and dialogs from unsupported bootbox to Sweetalert2 library 2026-06-21 14:21:01 +02:00
synonyms_collection_controller.js Implemented the ability to set user-defined synonyms/labels for internal element types 2025-11-12 21:35:02 +01:00
valueCalculator_controller.js Add a component value calculator & image generator 2026-07-30 17:49:18 +02:00