Improved search page

This commit is contained in:
Jan Böhmer 2023-07-16 20:05:11 +02:00
parent 6862d318f0
commit 97ab1f0492
4 changed files with 117 additions and 26 deletions

View file

@ -62,7 +62,7 @@ class RegisterEventHelper {
const handler = () => {
$(".tooltip").remove();
//Exclude dropdown buttons from tooltips, otherwise we run into endless errors from bootstrap (bootstrap.esm.js:614 Bootstrap doesn't allow more than one instance per element. Bound instance: bs.dropdown.)
$('a[title], label[title], button[title]:not([data-bs-toggle="dropdown"]), p[title], span[title], h6[title], h3[title], i[title]')
$('a[title], label[title], button[title]:not([data-bs-toggle="dropdown"]), p[title], span[title], h6[title], h3[title], i[title], small[title]')
//@ts-ignore
.tooltip("hide").tooltip({container: "body", placement: "auto", boundary: 'window'});
};

View file

@ -30,10 +30,18 @@ use Symfony\Component\Form\FormBuilderInterface;
class PartSearchType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder->add('keyword', SearchType::class);
$builder->add('providers', ProviderSelectType::class);
$builder->add('submit', SubmitType::class);
$builder->add('keyword', SearchType::class, [
'label' => 'info_providers.search.keyword',
]);
$builder->add('providers', ProviderSelectType::class, [
'label' => 'info_providers.search.providers',
'help' => 'info_providers.search.providers.help',
]);
$builder->add('submit', SubmitType::class, [
'label' => 'info_providers.search.submit'
]);
}
}

View file

@ -11,36 +11,83 @@
{% block card_content %}
<a href="{{ path('info_providers_list') }}">All info providers</a>
{{ form(form) }}
{{ form_start(form) }}
{{ form_row(form.keyword) }}
{{ form_row(form.providers) }}
<div class="row mb-2">
<div class="col-sm-9 offset-sm-3">
<a href="{{ path('info_providers_list') }}">{% trans %}info_providers.search.info_providers_list{% endtrans %}</a>
</div>
</div>
{{ form_row(form.submit) }}
{{ form_end(form) }}
{% if results is not null %}
<table class="table table-striped table-hover">
<thead>
<tr>
<th></th>
<th>Name</th>
<th>Description</th>
<th>Manufactuer</th>
<th>MPN</th>
<th>Status</th>
<th>Provider</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 %}
<tr>
<td><img style="width: 40px;" src="{{ result.preview_image_url }}"></td>
<td>{{ result.name }}</td>
<td>{{ result.description }}</td>
<td>{{ result.manufacturer ?? '' }}</td>
<td>{{ result.mpn ?? '' }}</td>
<td>{{ helper.m_status_to_badge(result.manufacturing_status) }}</td>
<td><a href="{{ result.provider_url ?? '#' }}">{{ result.provider_key }}: {{ result.provider_id }}</a></td>
<td>
<a class="btn btn-primary" href="{{ path('info_providers_create_part', {'providerKey': result.provider_key, 'providerId': result.provider_id}) }}" target="_blank">
<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>
<a class="btn btn-primary" href="{{ path('info_providers_create_part', {'providerKey': result.provider_key, 'providerId': result.provider_id}) }}"
target="_blank" title="{% trans %}part.create.btn{% endtrans %}">
<i class="fa-solid fa-plus-square"></i>
</a>
</td>

View file

@ -11438,7 +11438,7 @@ Please note, that you can not impersonate a disabled user. If you try you will g
<unit id="08SKwoy" name="info_providers.providers_list.title">
<segment>
<source>info_providers.providers_list.title</source>
<target>Info providers</target>
<target>Create parts from info provider</target>
</segment>
</unit>
<unit id="BnbVOSD" name="info_providers.providers_list.active">
@ -11501,5 +11501,41 @@ Please note, that you can not impersonate a disabled user. If you try you will g
<target>Connect OAuth</target>
</segment>
</unit>
<unit id="5_Z_m9s" name="info_providers.table.provider.label">
<segment>
<source>info_providers.table.provider.label</source>
<target>Provider</target>
</segment>
</unit>
<unit id="Cj5csML" name="info_providers.search.keyword">
<segment>
<source>info_providers.search.keyword</source>
<target>Keyword</target>
</segment>
</unit>
<unit id="rvTOWHb" name="info_providers.search.submit">
<segment>
<source>info_providers.search.submit</source>
<target>Search</target>
</segment>
</unit>
<unit id="Mwq891Y" name="info_providers.search.providers.help">
<segment>
<source>info_providers.search.providers.help</source>
<target>Select the providers in which should be searched.</target>
</segment>
</unit>
<unit id="nvk25qA" name="info_providers.search.providers">
<segment>
<source>info_providers.search.providers</source>
<target>Providers</target>
</segment>
</unit>
<unit id="5kSES8M" name="info_providers.search.info_providers_list">
<segment>
<source>info_providers.search.info_providers_list</source>
<target>Show all available info providers</target>
</segment>
</unit>
</file>
</xliff>