|
-
- jQuery(document).ready(function() {
- custom_switch_merchants() ;
- setSortableList();
- }) ;
-
- function custom_switch_merchants() {
- $('#switch-merchant select').change(function() {
- $('#switch-merchant form').submit() ;
- }) ;
- }
-
- function setSortableList() {
-
- $('.lc-sortable tbody').sortable({
- placeholder: "ui-state-highlight"
- });
-
- $('.lc-sortable tbody').on("sortupdate", function (event, ui) {
-
- prototype = $('#form_entities').data('prototype');
-
- $('.lc-sortable tr.lc-draggable').each(function (index, li) {
- // Replace '__name__' in the prototype's HTML to
- // instead be a number based on how many items we have
- var newForm = prototype.replace(/__name__/g, index);
-
- $(li).append(newForm);
-
- $(li).find('div:last-child').remove();
- $(li).find('#form_entities_' + index + '_id').val($(li).data('id'));
- log($('.lc-sortable').data('parent-position')+'_'+index);
- $(li).find('#form_entities_' + index + '_position').val($('.lc-sortable').data('parent-position')+'_'+index);
- });
-
- });
-
- }
|