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 App\Entity\Parts\Part;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Traversable;
/** /**
* Represents the complete response from a bulk info provider search operation. * Represents the complete response from a bulk info provider search operation.
* It contains a list of PartSearchResultDTOs, one for each part searched. * 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 * @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.'); throw new \LogicException('BulkSearchResponseDTO is immutable.');
} }
public function getIterator(): Traversable
{
return new \ArrayIterator($this->partResults);
}
} }

View file

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