|
|
@@ -14,6 +14,7 @@ function initLcSortableList() { |
|
|
|
prototype = $('#form_entities').data('prototype'); |
|
|
|
|
|
|
|
$('.lc-sortable tr.lc-draggable').each(function (index, li) { |
|
|
|
|
|
|
|
// instead be a number based on how many items we have |
|
|
|
var newForm = prototype.replace(/__name__/g, index); |
|
|
|
|
|
|
@@ -22,9 +23,13 @@ function initLcSortableList() { |
|
|
|
|
|
|
|
$(li).append(newForm); |
|
|
|
$(li).find('#form_entities_' + index + '_id').val($(li).data('id')); |
|
|
|
if ($('.lc-sortable').data('parent-position') !== '') val = $('.lc-sortable').data('parent-position') + '.' + index |
|
|
|
else val = index; |
|
|
|
|
|
|
|
if ($('.lc-sortable').data('parent-position') !== '') { |
|
|
|
//Ajout d'un 0 initial pour les nuémros <10 |
|
|
|
indexAsString = index.toString().padStart(2, '0'); |
|
|
|
val = $('.lc-sortable').data('parent-position') + '.' + indexAsString |
|
|
|
} else { |
|
|
|
val = index; |
|
|
|
} |
|
|
|
$(li).find('#form_entities_' + index + '_position').val(val); |
|
|
|
}); |
|
|
|
|