diff --git a/assets/controllers/field_mapping_controller.js b/assets/controllers/field_mapping_controller.js index 9c9c8ac6..50c19a0d 100644 --- a/assets/controllers/field_mapping_controller.js +++ b/assets/controllers/field_mapping_controller.js @@ -70,6 +70,13 @@ export default class extends Controller { newFieldSelect.addEventListener('change', this.updateFieldOptions.bind(this)) } + // Auto-increment priority based on existing mappings + const nextPriority = this.getNextPriority() + const priorityInput = newRow.querySelector('input[name*="[priority]"]') + if (priorityInput) { + priorityInput.value = nextPriority + } + this.updateFieldOptions() this.updateAddButtonState() } @@ -119,6 +126,18 @@ export default class extends Controller { } } + getNextPriority() { + const priorityInputs = this.tbodyTarget.querySelectorAll('input[name*="[priority]"]') + let maxPriority = 0 + priorityInputs.forEach(input => { + const val = parseInt(input.value, 10) + if (!isNaN(val) && val > maxPriority) { + maxPriority = val + } + }) + return Math.min(maxPriority + 1, 10) + } + handleFormSubmit(event) { if (this.hasSubmitButtonTarget) { this.submitButtonTarget.disabled = true diff --git a/templates/info_providers/bulk_import/manage.html.twig b/templates/info_providers/bulk_import/manage.html.twig index fc37c562..e15d6708 100644 --- a/templates/info_providers/bulk_import/manage.html.twig +++ b/templates/info_providers/bulk_import/manage.html.twig @@ -32,7 +32,7 @@ {# Active Jobs #} {% if active_jobs is not empty %}
- {% trans %}info_providers.bulk_import.active_jobs{% endtrans %} + {% trans %}info_providers.bulk_import.active_jobs{% endtrans %} {{ active_jobs|length }}
diff --git a/templates/info_providers/bulk_import/step2.html.twig b/templates/info_providers/bulk_import/step2.html.twig index 9b7a8b5a..350fffdf 100644 --- a/templates/info_providers/bulk_import/step2.html.twig +++ b/templates/info_providers/bulk_import/step2.html.twig @@ -220,8 +220,12 @@ class="hoverpic" style="max-width: 35px;" {{ stimulus_controller('elements/hoverpic') }}> - {% set nameMatch = dto.name is not null and part.name is not null and dto.name|lower == part.name|lower %} - {% set mpnMatch = dto.mpn is not null and part.manufacturerProductNumber is not null and dto.mpn|lower == part.manufacturerProductNumber|lower %} + {# Check for matches against source keyword (what was searched) #} + {% set sourceKw = result.sourceKeyword|default('')|lower %} + {% set nameMatch = sourceKw is not empty and dto.name is not null and dto.name|lower == sourceKw %} + {% set mpnMatch = sourceKw is not empty and dto.mpn is not null and dto.mpn|lower == sourceKw %} + {% set spnMatch = sourceKw is not empty and dto.provider_id is not null and dto.provider_id|lower == sourceKw %} + {% set anyMatch = nameMatch or mpnMatch or spnMatch %} {% if dto.provider_url is not null %} {{ dto.name }} {% else %} @@ -231,7 +235,7 @@ {% endif %} {% if dto.mpn is not null %} -
{{ dto.mpn }} +
{{ dto.mpn }} {% if mpnMatch %} MPN {% endif %} @@ -241,10 +245,17 @@ {{ dto.manufacturer ?? '' }} {{ info_provider_label(dto.provider_key)|default(dto.provider_key) }} -
{{ dto.provider_id }} +
{{ dto.provider_id }} + {% if spnMatch %} + SPN + {% endif %} - {{ result.sourceField ?? 'unknown' }} + {% if anyMatch %} + {% trans %}info_providers.bulk_import.match{% endtrans %} + {% else %} + {{ result.sourceField ?? 'unknown' }} + {% endif %} {% if result.sourceKeyword %}
{{ result.sourceKeyword }} {% endif %} diff --git a/translations/messages.en.xlf b/translations/messages.en.xlf index cfdd5305..c6509018 100644 --- a/translations/messages.en.xlf +++ b/translations/messages.en.xlf @@ -11157,6 +11157,18 @@ Please note, that you can not impersonate a disabled user. If you try you will g History + + + info_providers.bulk_import.spn_match + SPN matches + + + + + info_providers.bulk_import.match + Match + + info_providers.bulk_import.quick_apply