Fixed step2 template

This commit is contained in:
Jan Böhmer 2025-09-21 19:30:49 +02:00
parent 710569daaf
commit 1d38c50abc
2 changed files with 29 additions and 20 deletions

View file

@ -24,12 +24,13 @@ namespace App\Services\InfoProviderSystem\DTOs;
use App\Entity\Parts\Part;
use Doctrine\ORM\EntityManagerInterface;
use Traversable;
/**
* Represents the complete response from a bulk info provider search operation.
* It contains a list of PartSearchResultDTOs, one for each part searched.
*/
readonly class BulkSearchResponseDTO implements \ArrayAccess
readonly class BulkSearchResponseDTO implements \ArrayAccess, \IteratorAggregate
{
/**
* @param BulkSearchPartResultsDTO[] $partResults Array of search results for each part
@ -216,4 +217,9 @@ readonly class BulkSearchResponseDTO implements \ArrayAccess
{
throw new \LogicException('BulkSearchResponseDTO is immutable.');
}
public function getIterator(): Traversable
{
return new \ArrayIterator($this->partResults);
}
}

View file

@ -101,6 +101,8 @@
</div>
{% for part_result in search_results %}
{# @var part_result \App\Services\InfoProviderSystem\DTOs\BulkSearchPartResultsDTO #}
{% set part = part_result.part %}
{% set isCompleted = job.isPartCompleted(part.id) %}
{% set isSkipped = job.isPartSkipped(part.id) %}
@ -125,7 +127,7 @@
{% if part_result.errors is not empty %}
<span class="badge bg-danger">{% trans with {'%count%': part_result.errors|length} %}info_providers.bulk_import.errors{% endtrans %}</span>
{% endif %}
<span class="badge bg-info">{% trans with {'%count%': part_result.search_results|length} %}info_providers.bulk_import.results_found{% endtrans %}</span>
<span class="badge bg-info">{% trans with {'%count%': part_result.searchResults|length} %}info_providers.bulk_import.results_found{% endtrans %}</span>
</h5>
</div>
<div class="btn-group" role="group">
@ -164,7 +166,7 @@
{% endfor %}
{% endif %}
{% if part_result.search_results|length > 0 %}
{% if part_result.searchResults|length > 0 %}
<div class="table-responsive">
<table class="table table-sm">
<thead>
@ -179,13 +181,14 @@
</tr>
</thead>
<tbody>
{% for result in part_result.search_results %}
{% set dto = result.dto %}
{% for result in part_result.searchResults %}
{# @var result \App\Services\InfoProviderSystem\DTOs\BulkSearchPartResultDTO #}
{% set dto = result.searchResult %}
{% set localPart = result.localPart %}
<tr>
<td>
<img src="{{ dto.preview_image_url }}" data-thumbnail="{{ dto.preview_image_url }}"
class="hoverpic" style="max-width: 30px;" {{ stimulus_controller('elements/hoverpic') }}>
class="hoverpic" style="max-width: 35px;" {{ stimulus_controller('elements/hoverpic') }}>
</td>
<td>
{% if dto.provider_url is not null %}
@ -204,9 +207,9 @@
<br><small class="text-muted">{{ dto.provider_id }}</small>
</td>
<td>
<span class="badge bg-info">{{ result.source_field ?? 'unknown' }}</span>
{% if result.source_keyword %}
<br><small class="text-muted">{{ result.source_keyword }}</small>
<span class="badge bg-info">{{ result.sourceField ?? 'unknown' }}</span>
{% if result.sourceKeyword %}
<br><small class="text-muted">{{ result.sourceKeyword }}</small>
{% endif %}
</td>
<td>