Revision 88ad13f9
Von Tamino Steinert vor 6 Tagen hinzugefügt
js/kivi.Part.js | ||
---|---|---|
83 | 83 |
$.post("controller.pl", data, kivi.eval_json_result); |
84 | 84 |
}; |
85 | 85 |
|
86 |
ns.redisplay_items = function(data) { |
|
87 |
var old_rows; |
|
88 |
var part_type = $("#part_part_type").val(); |
|
89 |
if (part_type === 'assortment') { |
|
90 |
old_rows = $('.assortment_item_row').detach(); |
|
91 |
} else if ( part_type === 'assembly') { |
|
92 |
old_rows = $('.assembly_item_row').detach(); |
|
93 |
} |
|
94 |
var new_rows = []; |
|
95 |
$(data).each(function(_idx, elt) { |
|
96 |
new_rows.push(old_rows[elt.old_pos - 1]); |
|
97 |
}); |
|
98 |
if (part_type === 'assortment') { |
|
99 |
$(new_rows).appendTo($('#assortment_items')); |
|
100 |
} else if ( part_type === 'assembly') { |
|
101 |
$(new_rows).appendTo($('#assembly_items')); |
|
102 |
} |
|
103 |
ns.renumber_positions(); |
|
104 |
}; |
|
105 |
|
|
106 |
ns.reorder_variants = function(order_by) { |
|
107 |
var dir = $('#variant_' + order_by + '_header_id a img').attr("data-sort-dir"); |
|
108 |
$('#parent_variant_table thead a img').remove(); |
|
109 |
|
|
110 |
var src; |
|
111 |
if (dir == "1") { |
|
112 |
dir = "0"; |
|
113 |
src = "image/up.png"; |
|
114 |
} else { |
|
115 |
dir = "1"; |
|
116 |
src = "image/down.png"; |
|
117 |
} |
|
118 |
|
|
119 |
$('#variant_' + order_by + '_header_id a').append('<img border=0 data-sort-dir=' + dir + ' src=' + src + ' alt="' + kivi.t8('sort items') + '">'); |
|
120 |
|
|
121 |
var data = $('#ic').serializeArray(); |
|
122 |
data.push({ name: 'action', value: 'Part/reorder_variants' }, |
|
123 |
{ name: 'order_by', value: order_by }, |
|
124 |
{ name: 'sort_dir', value: dir }); |
|
125 |
|
|
126 |
$.post("controller.pl", data, kivi.eval_json_result); |
|
127 |
}; |
|
128 |
|
|
129 |
ns.redisplay_variants = function(data) { |
|
130 |
var old_rows = $('.variant_row_entry').detach(); |
|
131 |
var new_rows = []; |
|
132 |
$(data).each(function(idx, elt) { |
|
133 |
let new_row = old_rows[elt.old_pos - 1]; |
|
134 |
$(new_row).find('[name="variants[].position"]').val( idx+1); |
|
135 |
new_rows.push(new_row); |
|
136 |
}); |
|
137 |
$(new_rows).appendTo($('#parent_variant_table')); |
|
138 |
}; |
|
139 |
|
|
86 | 140 |
ns.assortment_recalc = function() { |
87 | 141 |
var data = $('#assortment :input').serializeArray(); |
88 | 142 |
data.push( |
... | ... | |
215 | 269 |
}); |
216 | 270 |
}; |
217 | 271 |
|
218 |
ns.redisplay_items = function(data) { |
|
219 |
var old_rows; |
|
220 |
var part_type = $("#part_part_type").val(); |
|
221 |
if (part_type === 'assortment') { |
|
222 |
old_rows = $('.assortment_item_row').detach(); |
|
223 |
} else if ( part_type === 'assembly') { |
|
224 |
old_rows = $('.assembly_item_row').detach(); |
|
225 |
} |
|
226 |
var new_rows = []; |
|
227 |
$(data).each(function(idx, elt) { |
|
228 |
new_rows.push(old_rows[elt.old_pos - 1]); |
|
229 |
}); |
|
230 |
if (part_type === 'assortment') { |
|
231 |
$(new_rows).appendTo($('#assortment_items')); |
|
232 |
} else if ( part_type === 'assembly') { |
|
233 |
$(new_rows).appendTo($('#assembly_items')); |
|
234 |
} |
|
235 |
ns.renumber_positions(); |
|
236 |
}; |
|
237 |
|
|
238 | 272 |
ns.focus_last_assortment_input = function () { |
239 | 273 |
$("#assortment_items tr:last").find('input[type=text]').filter(':visible:first').focus(); |
240 | 274 |
}; |
Auch abrufbar als: Unified diff
Varianten: Sortieren der Variantentabelle ermöglicht