{% extends "main_card.html.twig" %} {% import "info_providers/providers.macro.html.twig" as providers_macro %} {% import "helper.twig" as helper %} {% block title %} {% if update_target %} {% trans %}info_providers.update_part.title{% endtrans %} {% else %} {% trans %}info_providers.search.title{% endtrans %} {% endif %} {% endblock %} {% block card_title %} {% if update_target %} {# If update_target is set, we update an existing part #} {% trans %}info_providers.update_part.title{% endtrans %}: {{ update_target.name }} {% else %} {# Create a fresh part #} {% trans %}info_providers.search.title{% endtrans %} {% endif %} {% endblock %} {% block card_content %} {{ form_start(form) }} {{ form_row(form.keyword) }} {{ form_row(form.providers) }}
{% trans %}info_providers.search.info_providers_list{% endtrans %}
{{ form_row(form.submit) }} {{ form_end(form) }} {% if results is not null %} {% if results|length > 0 %} {% trans with {'%number%': results|length} %}info_providers.search.number_of_results{% endtrans %}: {% for result in results %} {% set dto = result["dto"] %} {# @var App\Entity\Parts\Part localPart #} {% set localPart = result["localPart"] %} {% endfor %}
{% trans %}name.label{% endtrans %} / {% trans %}part.table.mpn{% endtrans %} {% trans %}description.label{% endtrans %} / {% trans %}category.label{% endtrans %} {% trans %}manufacturer.label{% endtrans %} / {% trans %}footprint.label{% endtrans %} {% trans %}part.table.manufacturingStatus{% endtrans %} {% trans %}info_providers.table.provider.label{% endtrans %}
{% if dto.provider_url is not null %} {{ dto.name }} {% else %} {{ dto.name }} {% endif %} {% if dto.mpn is not null %}
{{ dto.mpn }} {% endif %} {% if result["localPart"] is not null %} {% endif %}
{{ dto.description }} {% if dto.category is not null %}
{{ dto.category }} {% endif %}
{{ dto.manufacturer ?? '' }} {% if dto.footprint is not null %}
{{ dto.footprint }} {% endif %}
{{ helper.m_status_to_badge(dto.manufacturing_status) }} {% if dto.provider_url %} {{ info_provider_label(dto.provider_key)|default(dto.provider_key) }} {% else %} {{ info_provider_label(dto.provider_key)|default(dto.provider_key) }} {% endif %}
{{ dto.provider_id }}
{# TODO: would like to have a sort of "part exists!" text here, but don't know how to style it also it would be nice to have these two buttons closer together, but when I put them in one cell they sometimes stack#} {% if localPart is not null %} {% endif %} {% if localPart is not null %} {% endif %} {% if update_target %} {# We update an existing part #} {% set href = path('info_providers_update_part', {'providerKey': dto.provider_key, 'providerId': dto.provider_id, 'id': update_target.iD}) %} {% else %} {# Create a fresh part #} {% set href = path('info_providers_create_part', {'providerKey': dto.provider_key, 'providerId': dto.provider_id}) %} {% endif %}
{% else %} {% endif %} {% endif %} {% endblock %}