Commit graph

17 commits

Author SHA1 Message Date
Sebastian Almberg
ce2b7d11a9
Add Quick Apply and batch update to bulk info provider import (#1316)
* Add Quick Apply and Apply All buttons to bulk info provider import

Adds the ability to apply provider search results to parts directly
from the bulk import step 2 page without navigating to individual
part edit forms. Includes per-result Quick Apply buttons and an
Apply All button for batch operations.

* Add navigation buttons and completion banner to bulk import step2

Adds Back to Jobs / Back to Parts buttons at the top of the page
and a success banner when the job is completed, so users aren't
stuck on the page after applying all parts.

* Highlight top search result and remove skip reason prompt

- Highlight the recommended/top priority result row with table-success class
- Add "Top" badge to the recommended Quick Apply button
- Use outline style for non-top Quick Apply buttons to differentiate
- Remove the annoying "reason for skipping" prompt popup

* Fix 500 error when field mapping has null field or no search results

- Skip field mappings with null/empty field values in convertFieldMappingsToDto
- Return empty DTO instead of throwing when no search results found
- Remove unnecessary try/catch workaround in researchPart

* Fix PHPStan error: remove redundant null check on BulkSearchResponseDTO

* Improve bulk import UI: split active/history jobs, fix text visibility, add match highlighting

- Split manage page into Active Jobs and History sections
- Fix source keyword text color (remove text-muted for better visibility)
- Add exact match indicators: green check badge when name or MPN matches
- Add translation keys for new UI elements

* Fix spinning icon, text visibility, auto-priority, and SPN match highlighting

- Replace spinning icon with static icon on Active Jobs header
- Match highlighting now checks source keyword against name, MPN, AND provider ID (SPN)
- Show green "Match" badge in source field column when any field matches 100%
- Auto-increment priority when adding new field mapping rows
- Fix text-muted visibility issues on table-success background

* Fix broken images and improve match highlighting consistency

- Hide broken external provider images with onerror fallback
- Make source keyword text green when any match is detected
- All matched fields (name, MPN, SPN, or any source keyword) show green text

* Fix TypeError in LCSCProvider when keyword is numeric string

PHP auto-casts numeric string array keys to int. When a search keyword
is a pure number (e.g., a part number like "12345"), the foreach loop
passes an int to processSearchResponse() which expects string. Cast
keyword to string explicitly.

* Clean up stale pending jobs and add job ID to display

- Auto-delete pending jobs with 0 results (from failed searches/500 errors)
- Show job ID (#N) in manage page and step2 to distinguish identical jobs
- Move timestamp to subtitle line on manage page for cleaner layout

* Fix tests to match updated bulk search behavior (no more RuntimeException)

The bulk search service now returns empty response DTOs instead of
throwing RuntimeException when no results are found. Updated tests
to use assertFalse(hasAnyResults()) instead of catching exceptions.

* Add comprehensive test coverage for bulk import controller

Covers Quick Apply, Apply All, delete, stop, mark completed/skipped/pending,
manage page active/history split, stale job cleanup, research endpoints,
and various error paths. Increases patch coverage significantly.

* Fix duplicate test method names in bulk import tests

* Fix last duplicate test method name (testQuickApplyWithNoSearchResults)

* Fixed translation key in translation messages

* Moved table rendering logic into macro

* fixed visual glitch with button success outline

* Use native httpfoundation method to convert json to an array

* Show a more user friendly error message, when

* Allow to automatically create new manufacturers within quick apply

---------

Co-authored-by: Jan Böhmer <mail@jan-boehmer.de>
2026-05-04 21:56:18 +02:00
Jan Böhmer
b21d294cf8 Ran rector and made tests final 2026-02-14 23:32:43 +01:00
Jan Böhmer
4eac63b683 Fixed phpunit deprecations 2025-11-30 14:45:40 +01:00
Jan Böhmer
34d284b1c4 Do not test against real LCSC provider... 2025-09-22 00:05:49 +02:00
Jan Böhmer
1d52b7c464 Fixed tests 2025-09-21 21:35:13 +02:00
Jan Böhmer
0d49632b92 Refactored constraints, to reuse existing mechanisms 2025-09-21 20:45:18 +02:00
Jan Böhmer
710569daaf Fixed phpunit tests 2025-09-21 19:03:29 +02:00
Jan Böhmer
92cd645945 Renamed dto to make their relation to batch searches more clear 2025-09-21 17:49:00 +02:00
barisgit
2c195d9767 Refactor bulk info provider: replace complex arrays with DTOs
- Add BulkSearchResponseDTO, FieldMappingDTO for type safety
- Use composition instead of inheritance in BulkSearchResultDTO
- Remove unnecessary BulkSearchRequestDTO
- Fix N+1 queries and API error handling
- Fix Add Mapping button functionality
2025-09-19 16:28:40 +02:00
Jan Böhmer
b4b758c356 Fixed tests 2025-09-14 23:14:00 +02:00
Jan Böhmer
41a7238ab7 Pass parts object directly to BulkSearchRequestDTO and added some syntax hints 2025-09-14 22:56:12 +02:00
barisgit
c7102bcd8c Update bulk info provider test to work with new services approach 2025-09-09 20:54:27 +02:00
barisgit
71be75b3e7 Improve test coverage 2025-08-31 22:18:25 +02:00
barisgit
cc9d50a8fe Add makefile to help with development setup, change part_ids in bulk import jobs to junction table and implement filtering based on bulk import jobs status and its associated parts' statuses. 2025-08-31 22:17:05 +02:00
barisgit
9b4d5e9c27 Improve test coverage 2025-08-31 22:16:28 +02:00
barisgit
ccb837e4b4 Fix migration error and dto error 2025-08-31 22:16:28 +02:00
barisgit
2bc39e7791 Add tests and fix static errors 2025-08-31 22:16:27 +02:00