added button to show existing part with same manufacturer and mpn in provider list

This commit is contained in:
jona 2024-12-19 18:56:35 +01:00 committed by Jan Böhmer
parent e9efbff912
commit ab68f4b37f
2 changed files with 69 additions and 21 deletions

View file

@ -52,59 +52,71 @@
<th>{% trans %}part.table.manufacturingStatus{% endtrans %}</th>
<th>{% trans %}info_providers.table.provider.label{% endtrans %}</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
{% for result in results %}
{% set dto = result["dto"] %}
<tr>
<td>
<img src="{{ result.preview_image_url }}" data-thumbnail="{{ result.preview_image_url }}"
<img src="{{ dto.preview_image_url }}" data-thumbnail="{{ dto.preview_image_url }}"
class="hoverpic" style="max-width: 45px;" {{ stimulus_controller('elements/hoverpic') }}>
</td>
<td>
{% if result.provider_url is not null %}
<a href="{{ result.provider_url }}" target="_blank" rel="noopener">{{ result.name }}</a>
{% if dto.provider_url is not null %}
<a href="{{ dto.provider_url }}" target="_blank" rel="noopener">{{ dto.name }}</a>
{% else %}
{{ result.name }}
{{ dto.name }}
{% endif %}
{% if result.mpn is not null %}
{% if dto.mpn is not null %}
<br>
<small class="text-muted" title="{% trans %}part.table.mpn{% endtrans %}">{{ result.mpn }}</small>
<small class="text-muted" title="{% trans %}part.table.mpn{% endtrans %}">{{ dto.mpn }}</small>
{% endif %}
</td>
<td>
{{ result.description }}
{% if result.category is not null %}
{{ dto.description }}
{% if dto.category is not null %}
<br>
<small class="text-muted">{{ result.category }}</small>
<small class="text-muted">{{ dto.category }}</small>
{% endif %}
</td>
<td>
{{ result.manufacturer ?? '' }}
{% if result.footprint is not null %}
{{ dto.manufacturer ?? '' }}
{% if dto.footprint is not null %}
<br>
<small class="text-muted">{{ result.footprint }}</small>
<small class="text-muted">{{ dto.footprint }}</small>
{% endif %}
</td>
<td>{{ helper.m_status_to_badge(result.manufacturing_status) }}</td>
<td>{{ helper.m_status_to_badge(dto.manufacturing_status) }}</td>
<td>
{% if result.provider_url %}
<a href="{{ result.provider_url }}" target="_blank" rel="noopener">
{{ info_provider_label(result.provider_key)|default(result.provider_key) }}
{% if dto.provider_url %}
<a href="{{ dto.provider_url }}" target="_blank" rel="noopener">
{{ info_provider_label(dto.provider_key)|default(dto.provider_key) }}
</a>
{% else %}
{{ info_provider_label(result.provider_key)|default(result.provider_key) }}
{{ info_provider_label(dto.provider_key)|default(dto.provider_key) }}
{% endif %}
<br>
<small class="text-muted">{{ result.provider_id }}</small>
<small class="text-muted">{{ dto.provider_id }}</small>
</td>
<td>
{% if result["localPart"] is not null %}
<a class="btn btn-primary" href="{{ path('part_edit', {'id': result['localPart'].id}) }}"
target="_blank" title="Edit Existing Part"> {# TODO: Needs translation #}
<i class="fa-solid fa-pencil"></i>
</a>
{% endif %}
</td>
<td>
{% if update_target %} {# We update an existing part #}
{% set href = path('info_providers_update_part',
{'providerKey': result.provider_key, 'providerId': result.provider_id, 'id': update_target.iD}) %}
{'providerKey': dto.provider_key, 'providerId': dto.provider_id, 'id': update_target.iD}) %}
{% else %} {# Create a fresh part #}
{% set href = path('info_providers_create_part',
{'providerKey': result.provider_key, 'providerId': result.provider_id}) %}
{'providerKey': dto.provider_key, 'providerId': dto.provider_id}) %}
{% endif %}
<a class="btn btn-primary" href="{{ href }}"