diff --git a/.docker/symfony.conf b/.docker/symfony.conf index 0629d12c..a6b8d7a9 100644 --- a/.docker/symfony.conf +++ b/.docker/symfony.conf @@ -36,6 +36,10 @@ PassEnv SAML_ENABLED SAML_ROLE_MAPPING SAML_UPDATE_GROUP_ON_LOGIN SAML_IDP_ENTITY_ID SAML_IDP_SINGLE_SIGN_ON_SERVICE SAML_IDP_SINGLE_LOGOUT_SERVICE SAML_IDP_X509_CERT SAML_SP_ENTITY_ID SAML_SP_X509_CERT SAMLP_SP_PRIVATE_KEY PassEnv TABLE_DEFAULT_PAGE_SIZE + PassEnv PROVIDER_DIGIKEY_CLIENT_ID PROVIDER_DIGIKEY_SECRET PROVIDER_DIGIKEY_CURRENCY PROVIDER_DIGIKEY_LANGUAGE PROVIDER_DIGIKEY_COUNTRY + PassEnv PROVIDER_ELEMENT14_KEY PROVIDER_ELEMENT14_STORE_ID + PassEnv PROVIDER_TME_KEY PROVIDER_TME_SECRET PROVIDER_TME_CURRENCY PROVIDER_TME_LANGUAGE PROVIDER_TME_COUNTRY PROVIDER_TME_GET_GROSS_PRICES + # For most configuration files from conf-available/, which are # enabled or disabled at a global level, it is possible to # include a line for only one particular virtual host. For example the diff --git a/.env b/.env index ede0dd4b..d1a42993 100644 --- a/.env +++ b/.env @@ -91,6 +91,41 @@ ERROR_PAGE_SHOW_HELP=1 # The default page size for the part table (set to -1 to show all parts on one page) TABLE_DEFAULT_PAGE_SIZE=50 +################################################################################## +# Info provider settings +################################################################################## + +# Digikey Provider: +# You can get your client id and secret from https://developer.digikey.com/ +PROVIDER_DIGIKEY_CLIENT_ID= +PROVIDER_DIGIKEY_SECRET= +# The currency to get prices in +PROVIDER_DIGIKEY_CURRENCY=EUR +# The language to get results in (en, de, fr, it, es, zh, ja, ko) +PROVIDER_DIGIKEY_LANGUAGE=en +# The country to get results for +PROVIDER_DIGIKEY_COUNTRY=DE + +# Farnell Provider: +# You can get your API key from https://partner.element14.com/ +PROVIDER_ELEMENT14_KEY= +# Configure the store domain you want to use. This decides the language and currency of results. You can get a list of available stores from https://partner.element14.com/docs/Product_Search_API_REST__Description +PROVIDER_ELEMENT14_STORE_ID=de.farnell.com + +# TME Provider: +# You can get your API key from https://developers.tme.eu/en/ +PROVIDER_TME_KEY= +PROVIDER_TME_SECRET= +# The currency to get prices in +PROVIDER_TME_CURRENCY=EUR +# The language to get results in (en, de, pl) +PROVIDER_TME_LANGUAGE=en +# The country to get results for +PROVIDER_TME_COUNTRY=DE +# Set this to 1 to get gross prices (including VAT) instead of net prices +PROVIDER_TME_GET_GROSS_PRICES=1 + + ################################################################################### # SAML Single sign on-settings ################################################################################### diff --git a/assets/controllers/elements/structural_entity_select_controller.js b/assets/controllers/elements/structural_entity_select_controller.js index 93d26d01..e775af8a 100644 --- a/assets/controllers/elements/structural_entity_select_controller.js +++ b/assets/controllers/elements/structural_entity_select_controller.js @@ -22,6 +22,8 @@ import '../../css/components/tom-select_extensions.css'; import TomSelect from "tom-select"; import {Controller} from "@hotwired/stimulus"; +import {trans, ENTITY_SELECT_GROUP_NEW_NOT_ADDED_TO_DB} from '../../translator.js' + export default class extends Controller { _tomSelect; @@ -40,7 +42,7 @@ export default class extends Controller { allowEmptyOption: true, selectOnTab: true, maxOptions: null, - create: allowAdd, + create: allowAdd ? this.createItem.bind(this) : false, createFilter: /\D/, //Must contain a non-digit character, otherwise they would be recognized as DB ID searchField: [ @@ -68,6 +70,14 @@ export default class extends Controller { this._tomSelect.sync(); } + createItem(input, callback) { + callback({ + value: input, + text: input, + not_in_db_yet: true, + }); + } + updateValidity() { //Mark this input as invalid, if the selected option is disabled @@ -97,14 +107,27 @@ export default class extends Controller { } if (data.short) { - return '
+
+
+ {% if provider.active == false %}
+
+
+ + {% if provider.providerInfo.url is defined and provider.providerInfo.url is not empty %} + {{ provider.providerInfo.name }} + {% else %} + {{ provider.providerInfo.name | trans }} + {% endif %} + ++
+ {% if provider.providerInfo.description is defined and provider.providerInfo.description is not null %}
+ {{ provider.providerInfo.description | trans }}
+ {% endif %}
+
+
+
+ {% for capability in provider.capabilities %}
+ {# @var capability \App\Services\InfoProviderSystem\Providers\ProviderCapabilities #}
+
+
+ {{ capability.translationKey|trans }}
+
+ {% endfor %}
+ {% if provider.providerInfo.oauth_app_name is defined and provider.providerInfo.oauth_app_name is not empty %}
+
+ + {% trans %}oauth_client.connect.btn{% endtrans %} + {% endif %} +
+
+ {% endif %}
+
+ {% trans %}info_providers.providers_list.disabled{% endtrans %}
+ {% if provider.providerInfo.disabled_help is defined and provider.providerInfo.disabled_help is not empty %}
+
+ + {{ provider.providerInfo.disabled_help|trans }} + {% endif %} + |
+
+ | {% 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 result.provider_url is not null %}
+ {{ result.name }}
+ {% else %}
+ {{ result.name }}
+ {% endif %}
+
+ {% if result.mpn is not null %}
+ + {{ result.mpn }} + {% endif %} + |
+
+ {{ result.description }}
+ {% if result.category is not null %}
+ + {{ result.category }} + {% endif %} + |
+
+ {{ result.manufacturer ?? '' }}
+ {% if result.footprint is not null %}
+ + {{ result.footprint }} + {% endif %} + |
+ {{ helper.m_status_to_badge(result.manufacturing_status) }} | +
+ {% if result.provider_url %}
+
+ {{ info_provider_label(result.provider_key)|default(result.provider_key) }}
+
+ {% else %}
+ {{ info_provider_label(result.provider_key)|default(result.provider_key) }}
+ {% endif %}
+ + {{ result.provider_id }} + | + + + + | +