mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 09:35:49 +02:00
Improved search page
This commit is contained in:
parent
6862d318f0
commit
97ab1f0492
4 changed files with 117 additions and 26 deletions
|
@ -62,7 +62,7 @@ class RegisterEventHelper {
|
||||||
const handler = () => {
|
const handler = () => {
|
||||||
$(".tooltip").remove();
|
$(".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.)
|
//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
|
//@ts-ignore
|
||||||
.tooltip("hide").tooltip({container: "body", placement: "auto", boundary: 'window'});
|
.tooltip("hide").tooltip({container: "body", placement: "auto", boundary: 'window'});
|
||||||
};
|
};
|
||||||
|
|
|
@ -30,10 +30,18 @@ use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
|
||||||
class PartSearchType extends AbstractType
|
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('keyword', SearchType::class, [
|
||||||
$builder->add('providers', ProviderSelectType::class);
|
'label' => 'info_providers.search.keyword',
|
||||||
$builder->add('submit', SubmitType::class);
|
]);
|
||||||
|
$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'
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -11,36 +11,83 @@
|
||||||
|
|
||||||
{% block card_content %}
|
{% 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 %}
|
{% if results is not null %}
|
||||||
<table class="table table-striped table-hover">
|
<table class="table table-striped table-hover">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th></th>
|
<th></th>
|
||||||
<th>Name</th>
|
<th>{% trans %}name.label{% endtrans %} / {% trans %}part.table.mpn{% endtrans %}</th>
|
||||||
<th>Description</th>
|
<th>{% trans %}description.label{% endtrans %} / {% trans %}category.label{% endtrans %}</th>
|
||||||
<th>Manufactuer</th>
|
<th>{% trans %}manufacturer.label{% endtrans %} / {% trans %}footprint.label{% endtrans %}</th>
|
||||||
<th>MPN</th>
|
<th>{% trans %}part.table.manufacturingStatus{% endtrans %}</th>
|
||||||
<th>Status</th>
|
<th>{% trans %}info_providers.table.provider.label{% endtrans %}</th>
|
||||||
<th>Provider</th>
|
|
||||||
<th></th>
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for result in results %}
|
{% for result in results %}
|
||||||
<tr>
|
<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>
|
<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>
|
<i class="fa-solid fa-plus-square"></i>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
|
|
|
@ -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">
|
<unit id="08SKwoy" name="info_providers.providers_list.title">
|
||||||
<segment>
|
<segment>
|
||||||
<source>info_providers.providers_list.title</source>
|
<source>info_providers.providers_list.title</source>
|
||||||
<target>Info providers</target>
|
<target>Create parts from info provider</target>
|
||||||
</segment>
|
</segment>
|
||||||
</unit>
|
</unit>
|
||||||
<unit id="BnbVOSD" name="info_providers.providers_list.active">
|
<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>
|
<target>Connect OAuth</target>
|
||||||
</segment>
|
</segment>
|
||||||
</unit>
|
</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>
|
</file>
|
||||||
</xliff>
|
</xliff>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue