|
38 | 38 | {{ form_end(form) }}
|
39 | 39 |
|
40 | 40 | {% if results is not null %}
|
41 |
| - <table class="table table-striped table-hover"> |
42 |
| - <thead> |
43 |
| - <tr> |
44 |
| - <th></th> |
45 |
| - <th>{% trans %}name.label{% endtrans %} / {% trans %}part.table.mpn{% endtrans %}</th> |
46 |
| - <th>{% trans %}description.label{% endtrans %} / {% trans %}category.label{% endtrans %}</th> |
47 |
| - <th>{% trans %}manufacturer.label{% endtrans %} / {% trans %}footprint.label{% endtrans %}</th> |
48 |
| - <th>{% trans %}part.table.manufacturingStatus{% endtrans %}</th> |
49 |
| - <th>{% trans %}info_providers.table.provider.label{% endtrans %}</th> |
50 |
| - <th></th> |
51 |
| - </tr> |
52 |
| - </thead> |
53 |
| - <tbody> |
54 |
| - {% for result in results %} |
| 41 | + |
| 42 | + {% if results|length > 0 %} |
| 43 | + <b>{% trans with {'%number%': results|length} %}info_providers.search.number_of_results{% endtrans %}</b>: |
| 44 | + |
| 45 | + <table class="table table-striped table-hover"> |
| 46 | + <thead> |
55 | 47 | <tr>
|
56 |
| - <td> |
57 |
| - <img src="{{ result.preview_image_url }}" data-thumbnail="{{ result.preview_image_url }}" |
58 |
| - class="hoverpic" style="max-width: 45px;" {{ stimulus_controller('elements/hoverpic') }}> |
59 |
| - </td> |
60 |
| - <td> |
61 |
| - {% if result.provider_url is not null %} |
62 |
| - <a href="{{ result.provider_url }}" target="_blank" rel="noopener">{{ result.name }}</a> |
63 |
| - {% else %} |
64 |
| - {{ result.name }} |
65 |
| - {% endif %} |
66 |
| - |
67 |
| - {% if result.mpn is not null %} |
68 |
| - <br> |
69 |
| - <small class="text-muted" title="{% trans %}part.table.mpn{% endtrans %}">{{ result.mpn }}</small> |
70 |
| - {% endif %} |
71 |
| - </td> |
72 |
| - <td> |
73 |
| - {{ result.description }} |
74 |
| - {% if result.category is not null %} |
75 |
| - <br> |
76 |
| - <small class="text-muted">{{ result.category }}</small> |
77 |
| - {% endif %} |
78 |
| - </td> |
79 |
| - <td> |
80 |
| - {{ result.manufacturer ?? '' }} |
81 |
| - {% if result.footprint is not null %} |
82 |
| - <br> |
83 |
| - <small class="text-muted">{{ result.footprint }}</small> |
84 |
| - {% endif %} |
85 |
| - </td> |
86 |
| - <td>{{ helper.m_status_to_badge(result.manufacturing_status) }}</td> |
87 |
| - <td> |
88 |
| - {% if result.provider_url %} |
89 |
| - <a href="{{ result.provider_url }}" target="_blank" rel="noopener"> |
| 48 | + <th></th> |
| 49 | + <th>{% trans %}name.label{% endtrans %} / {% trans %}part.table.mpn{% endtrans %}</th> |
| 50 | + <th>{% trans %}description.label{% endtrans %} / {% trans %}category.label{% endtrans %}</th> |
| 51 | + <th>{% trans %}manufacturer.label{% endtrans %} / {% trans %}footprint.label{% endtrans %}</th> |
| 52 | + <th>{% trans %}part.table.manufacturingStatus{% endtrans %}</th> |
| 53 | + <th>{% trans %}info_providers.table.provider.label{% endtrans %}</th> |
| 54 | + <th></th> |
| 55 | + </tr> |
| 56 | + </thead> |
| 57 | + <tbody> |
| 58 | + {% for result in results %} |
| 59 | + <tr> |
| 60 | + <td> |
| 61 | + <img src="{{ result.preview_image_url }}" data-thumbnail="{{ result.preview_image_url }}" |
| 62 | + class="hoverpic" style="max-width: 45px;" {{ stimulus_controller('elements/hoverpic') }}> |
| 63 | + </td> |
| 64 | + <td> |
| 65 | + {% if result.provider_url is not null %} |
| 66 | + <a href="{{ result.provider_url }}" target="_blank" rel="noopener">{{ result.name }}</a> |
| 67 | + {% else %} |
| 68 | + {{ result.name }} |
| 69 | + {% endif %} |
| 70 | + |
| 71 | + {% if result.mpn is not null %} |
| 72 | + <br> |
| 73 | + <small class="text-muted" title="{% trans %}part.table.mpn{% endtrans %}">{{ result.mpn }}</small> |
| 74 | + {% endif %} |
| 75 | + </td> |
| 76 | + <td> |
| 77 | + {{ result.description }} |
| 78 | + {% if result.category is not null %} |
| 79 | + <br> |
| 80 | + <small class="text-muted">{{ result.category }}</small> |
| 81 | + {% endif %} |
| 82 | + </td> |
| 83 | + <td> |
| 84 | + {{ result.manufacturer ?? '' }} |
| 85 | + {% if result.footprint is not null %} |
| 86 | + <br> |
| 87 | + <small class="text-muted">{{ result.footprint }}</small> |
| 88 | + {% endif %} |
| 89 | + </td> |
| 90 | + <td>{{ helper.m_status_to_badge(result.manufacturing_status) }}</td> |
| 91 | + <td> |
| 92 | + {% if result.provider_url %} |
| 93 | + <a href="{{ result.provider_url }}" target="_blank" rel="noopener"> |
| 94 | + {{ info_provider_label(result.provider_key)|default(result.provider_key) }} |
| 95 | + </a> |
| 96 | + {% else %} |
90 | 97 | {{ info_provider_label(result.provider_key)|default(result.provider_key) }}
|
| 98 | + {% endif %} |
| 99 | + <br> |
| 100 | + <small class="text-muted">{{ result.provider_id }}</small> |
| 101 | + <td> |
| 102 | + {% if update_target %} {# We update an existing part #} |
| 103 | + {% set href = path('info_providers_update_part', |
| 104 | + {'providerKey': result.provider_key, 'providerId': result.provider_id, 'id': update_target.iD}) %} |
| 105 | + {% else %} {# Create a fresh part #} |
| 106 | + {% set href = path('info_providers_create_part', |
| 107 | + {'providerKey': result.provider_key, 'providerId': result.provider_id}) %} |
| 108 | + {% endif %} |
| 109 | + |
| 110 | + <a class="btn btn-primary" href="{{ href }}" |
| 111 | + target="_blank" title="{% trans %}part.create.btn{% endtrans %}"> |
| 112 | + <i class="fa-solid fa-plus-square"></i> |
91 | 113 | </a>
|
92 |
| - {% else %} |
93 |
| - {{ info_provider_label(result.provider_key)|default(result.provider_key) }} |
94 |
| - {% endif %} |
95 |
| - <br> |
96 |
| - <small class="text-muted">{{ result.provider_id }}</small> |
97 |
| - <td> |
98 |
| - {% if update_target %} {# We update an existing part #} |
99 |
| - {% set href = path('info_providers_update_part', |
100 |
| - {'providerKey': result.provider_key, 'providerId': result.provider_id, 'id': update_target.iD}) %} |
101 |
| - {% else %} {# Create a fresh part #} |
102 |
| - {% set href = path('info_providers_create_part', |
103 |
| - {'providerKey': result.provider_key, 'providerId': result.provider_id}) %} |
104 |
| - {% endif %} |
105 |
| - |
106 |
| - <a class="btn btn-primary" href="{{ href }}" |
107 |
| - target="_blank" title="{% trans %}part.create.btn{% endtrans %}"> |
108 |
| - <i class="fa-solid fa-plus-square"></i> |
109 |
| - </a> |
110 |
| - </td> |
111 |
| - </tr> |
112 |
| - {% endfor %} |
| 114 | + </td> |
| 115 | + </tr> |
| 116 | + {% endfor %} |
113 | 117 |
|
114 |
| - </tbody> |
115 |
| - </table> |
| 118 | + </tbody> |
| 119 | + </table> |
| 120 | + {% else %} |
| 121 | + <div class="alert alert-info" role="alert"> |
| 122 | + {% trans %}info_providers.search.no_results{% endtrans %} |
| 123 | + </div> |
| 124 | + {% endif %} |
116 | 125 | {% endif %}
|
117 | 126 |
|
118 | 127 | {% endblock %}
|
0 commit comments