diff --git a/loko/interventions/static/interventions/detail/intervention_posts_editor.js b/loko/interventions/static/interventions/detail/intervention_posts_editor.js
index 007a008..c63b852 100644
--- a/loko/interventions/static/interventions/detail/intervention_posts_editor.js
+++ b/loko/interventions/static/interventions/detail/intervention_posts_editor.js
@@ -2654,6 +2654,8 @@
if (!orderSelect) return;
+ const initialVal = orderSelect.getAttribute('data-initial-order-id') || $(orderSelect).val() || orderSelect.value || '';
+
// Initialiser Select2 avec recherche
$(orderSelect).select2({
placeholder: gettext('-- Sélectionnez une commande --'),
@@ -2670,6 +2672,10 @@
dropdownParent: $(CONFIG.selectors.modal)
});
+ if (initialVal) {
+ $(orderSelect).val(initialVal).trigger('change.select2');
+ }
+
// Gérer le changement de commande
$(orderSelect).on('change', async function() {
const orderId = $(this).val();
@@ -2933,6 +2939,7 @@
fixTableColumnWidths(CONFIG.selectors.table);
const orderSelect = document.getElementById('orderSelect');
if (orderSelect && $.fn.select2) {
+ const currentVal = $(orderSelect).val() || orderSelect.getAttribute('data-initial-order-id') || orderSelect.value || '';
$(orderSelect).select2('destroy');
$(orderSelect).select2({
placeholder: gettext('-- Sélectionnez une commande --'),
@@ -2950,7 +2957,11 @@
});
// S'assurer que la valeur sélectionnée est correcte
- $(orderSelect).trigger('change.select2');
+ if (currentVal) {
+ $(orderSelect).val(currentVal).trigger('change.select2');
+ } else {
+ $(orderSelect).trigger('change.select2');
+ }
}
// Initialiser la visibilité du bouton d'ajout du devis
diff --git a/loko/interventions/templates/interventions/detail/card_posts.html b/loko/interventions/templates/interventions/detail/card_posts.html
index 0dd4819..6c0b0d3 100644
--- a/loko/interventions/templates/interventions/detail/card_posts.html
+++ b/loko/interventions/templates/interventions/detail/card_posts.html
@@ -355,7 +355,7 @@
-