mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-08-04 02:05:16 +02:00
Added possibility to search the info providers to update an existing part
This commit is contained in:
parent
73f6d79925
commit
3eeeb01ad1
5 changed files with 56 additions and 7 deletions
|
@ -3,16 +3,25 @@
|
|||
{% import "info_providers/providers.macro.html.twig" as providers_macro %}
|
||||
{% import "helper.twig" as helper %}
|
||||
|
||||
{% block title %}{% trans %}info_providers.search.title{% endtrans %}{% endblock %}
|
||||
{% block title %}
|
||||
{% if update_target %}
|
||||
{% trans %}info_providers.update_part.title{% endtrans %}
|
||||
{% else %}
|
||||
{% trans %}info_providers.search.title{% endtrans %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block card_title %}
|
||||
<i class="fas fa-cloud-arrow-down"></i> {% trans %}info_providers.search.title{% endtrans %}
|
||||
{% if update_target %} {# If update_target is set, we update an existing part #}
|
||||
<i class="fas fa-cloud-arrow-down"></i> {% trans %}info_providers.update_part.title{% endtrans %}:
|
||||
<a href="{{ entity_url(update_target) }}" target="_blank" class="text-bg-primary">{{ update_target.name }}</a>
|
||||
{% else %} {# Create a fresh part #}
|
||||
<i class="fas fa-cloud-arrow-down"></i> {% trans %}info_providers.search.title{% endtrans %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block card_content %}
|
||||
|
||||
|
||||
|
||||
{{ form_start(form) }}
|
||||
|
||||
{{ form_row(form.keyword) }}
|
||||
|
@ -86,7 +95,15 @@
|
|||
<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}) }}"
|
||||
{% 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>
|
||||
|
|
|
@ -30,6 +30,16 @@
|
|||
{# Merge modal #}
|
||||
{% include "parts/info/_merge_modal.html.twig" %}
|
||||
|
||||
{# Update part from info provider button #}
|
||||
{% if is_granted('edit', part) and is_granted('@info_providers.create_parts') %}
|
||||
<br>
|
||||
<a class="btn btn-info mt-2" href="{{ path('info_providers_update_part_search', {'target': part.iD}) }}">
|
||||
<i class="fas fa-cloud-arrow-down"></i>
|
||||
{% trans %}part.update_part_from_info_provider.btn{% endtrans %}
|
||||
</a>
|
||||
{% endif %}
|
||||
|
||||
|
||||
<form method="post" class="mt-2" action="{{ entity_url(part, 'delete') }}"
|
||||
{{ stimulus_controller('elements/delete_btn') }} {{ stimulus_action('elements/delete_btn', "submit", "submit") }}
|
||||
data-delete-title="{% trans with {'%name%': part.name|escape }%}part.delete.confirm_title{% endtrans %}"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue