mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 01:25:55 +02:00
Show number of results for info provider search and show a notice, if no results were found
This commit is contained in:
parent
87a518703f
commit
8554be9abd
2 changed files with 126 additions and 105 deletions
|
@ -38,81 +38,90 @@
|
|||
{{ form_end(form) }}
|
||||
|
||||
{% if results is not null %}
|
||||
<table class="table table-striped table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>{% trans %}name.label{% endtrans %} / {% trans %}part.table.mpn{% endtrans %}</th>
|
||||
<th>{% trans %}description.label{% endtrans %} / {% trans %}category.label{% endtrans %}</th>
|
||||
<th>{% trans %}manufacturer.label{% endtrans %} / {% trans %}footprint.label{% endtrans %}</th>
|
||||
<th>{% trans %}part.table.manufacturingStatus{% endtrans %}</th>
|
||||
<th>{% trans %}info_providers.table.provider.label{% endtrans %}</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for result in results %}
|
||||
|
||||
{% if results|length > 0 %}
|
||||
<b>{% trans with {'%number%': results|length} %}info_providers.search.number_of_results{% endtrans %}</b>:
|
||||
|
||||
<table class="table table-striped table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<td>
|
||||
<img src="{{ result.preview_image_url }}" data-thumbnail="{{ result.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>
|
||||
{% else %}
|
||||
{{ result.name }}
|
||||
{% endif %}
|
||||
|
||||
{% if result.mpn is not null %}
|
||||
<br>
|
||||
<small class="text-muted" title="{% trans %}part.table.mpn{% endtrans %}">{{ result.mpn }}</small>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
{{ result.description }}
|
||||
{% if result.category is not null %}
|
||||
<br>
|
||||
<small class="text-muted">{{ result.category }}</small>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
{{ result.manufacturer ?? '' }}
|
||||
{% if result.footprint is not null %}
|
||||
<br>
|
||||
<small class="text-muted">{{ result.footprint }}</small>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>{{ helper.m_status_to_badge(result.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) }}
|
||||
</a>
|
||||
{% else %}
|
||||
{{ info_provider_label(result.provider_key)|default(result.provider_key) }}
|
||||
{% endif %}
|
||||
<br>
|
||||
<small class="text-muted">{{ result.provider_id }}</small>
|
||||
<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}) %}
|
||||
{% else %} {# Create a fresh part #}
|
||||
{% set href = path('info_providers_create_part',
|
||||
{'providerKey': result.provider_key, 'providerId': result.provider_id}) %}
|
||||
{% endif %}
|
||||
|
||||
<a class="btn btn-primary" href="{{ href }}"
|
||||
target="_blank" title="{% trans %}part.create.btn{% endtrans %}">
|
||||
<i class="fa-solid fa-plus-square"></i>
|
||||
</a>
|
||||
</td>
|
||||
<th></th>
|
||||
<th>{% trans %}name.label{% endtrans %} / {% trans %}part.table.mpn{% endtrans %}</th>
|
||||
<th>{% trans %}description.label{% endtrans %} / {% trans %}category.label{% endtrans %}</th>
|
||||
<th>{% trans %}manufacturer.label{% endtrans %} / {% trans %}footprint.label{% endtrans %}</th>
|
||||
<th>{% trans %}part.table.manufacturingStatus{% endtrans %}</th>
|
||||
<th>{% trans %}info_providers.table.provider.label{% endtrans %}</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for result in results %}
|
||||
<tr>
|
||||
<td>
|
||||
<img src="{{ result.preview_image_url }}" data-thumbnail="{{ result.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>
|
||||
{% else %}
|
||||
{{ result.name }}
|
||||
{% endif %}
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
{% if result.mpn is not null %}
|
||||
<br>
|
||||
<small class="text-muted" title="{% trans %}part.table.mpn{% endtrans %}">{{ result.mpn }}</small>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
{{ result.description }}
|
||||
{% if result.category is not null %}
|
||||
<br>
|
||||
<small class="text-muted">{{ result.category }}</small>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
{{ result.manufacturer ?? '' }}
|
||||
{% if result.footprint is not null %}
|
||||
<br>
|
||||
<small class="text-muted">{{ result.footprint }}</small>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>{{ helper.m_status_to_badge(result.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) }}
|
||||
</a>
|
||||
{% else %}
|
||||
{{ info_provider_label(result.provider_key)|default(result.provider_key) }}
|
||||
{% endif %}
|
||||
<br>
|
||||
<small class="text-muted">{{ result.provider_id }}</small>
|
||||
<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}) %}
|
||||
{% else %} {# Create a fresh part #}
|
||||
{% set href = path('info_providers_create_part',
|
||||
{'providerKey': result.provider_key, 'providerId': result.provider_id}) %}
|
||||
{% endif %}
|
||||
|
||||
<a class="btn btn-primary" href="{{ href }}"
|
||||
target="_blank" title="{% trans %}part.create.btn{% endtrans %}">
|
||||
<i class="fa-solid fa-plus-square"></i>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
{% else %}
|
||||
<div class="alert alert-info" role="alert">
|
||||
{% trans %}info_providers.search.no_results{% endtrans %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue