<th class="listheading" nowrap width="3" >[%- 'position' | $T8 %] </th>
<th class="listheading" style='text-align:center' nowrap width="1"><img src="image/updown.png" alt="[%- LxERP.t8('reorder item') %]"></th>
<th class="listheading" style='text-align:center' nowrap width="1"><img src="image/close.png" alt="[%- LxERP.t8('delete item') %]"></th>
- <th class="listheading" nowrap width="15">[%- 'Partnumber' | $T8 %] </th>
- <th class="listheading" nowrap >[%- 'Description' | $T8 %] </th>
- <th class="listheading" nowrap width="5" >[%- 'Qty' | $T8 %] </th>
+ <th id="partnumber_header_id" class="listheading" nowrap width="15"><a href='#' onClick='javascript:reorder_items("partnumber")'> [%- 'Partnumber' | $T8 %]</a></th>
+ <th id="description_header_id" class="listheading" nowrap ><a href='#' onClick='javascript:reorder_items("description")'>[%- 'Description' | $T8 %]</a></th>
+ <th id="qty_header_id" class="listheading" nowrap width="5" ><a href='#' onClick='javascript:reorder_items("qty")'> [%- 'Qty' | $T8 %]</a></th>
<th class="listheading" nowrap width="5" >[%- 'Price Factor' | $T8 %] </th>
<th class="listheading" nowrap width="5" >[%- 'Unit' | $T8 %] </th>
<th class="listheading" nowrap width="5" >[%- 'Price Source' | $T8 %] </th>
- <th class="listheading" nowrap width="15">[%- 'Price' | $T8 %] </th>
- <th class="listheading" nowrap width="5" >[%- 'Discount' | $T8 %] </th>
+ <th id="sellprice_header_id" class="listheading" nowrap width="15" ><a href='#' onClick='javascript:reorder_items("sellprice")'> [%- 'Price' | $T8 %]</a></th>
+ <th id="discount_header_id" class="listheading" nowrap width="15" ><a href='#' onClick='javascript:reorder_items("discount")'> [%- 'Discount' | $T8 %]</a></th>
<th class="listheading" nowrap width="10">[%- 'Extended' | $T8 %] </th>
</tr>
</thead>
if ($('#add_item_parts_id').val() == '') return;
if (!check_cv()) return;
+ $('#row_table_id thead a img').remove();
+
var data = $('#order_form').serialize();
data += '&action=Order/add_item';
function show_multi_items_dialog() {
if (!check_cv()) return;
+ $('#row_table_id thead a img').remove();
+
kivi.popup_dialog({
url: 'controller.pl?action=Order/show_multi_items_dialog',
data: { type: $('#type').val(),
});
}
+function reorder_items(order_by) {
+ var dir = $('#' + order_by + '_header_id a img').attr("data-sort-dir");
+ $('#row_table_id thead a img').remove();
+
+ var src;
+ if (dir == "1") {
+ dir = "0";
+ src = "image/up.png";
+ } else {
+ dir = "1";
+ src = "image/down.png";
+ };
+
+ $('#' + order_by + '_header_id a').append('<img border=0 data-sort-dir=' + dir + ' src=' + src + ' alt="[%- LxERP.t8('sort items') %]">');
+
+ var data = $('#order_form').serialize();
+ data += '&action=Order/reorder_items';
+ data += '&order_by=' + order_by;
+ data += '&sort_dir=' + dir;
+
+ $.post("controller.pl", data, kivi.eval_json_result);
+}
+
+function redisplay_items(data) {
+ var old_rows = $('.row_entry').detach();
+ var new_rows = [];
+ $(data).each(function(idx, elt) {
+ new_rows.push(old_rows[elt.old_pos - 1]);
+ });
+ $(new_rows).appendTo($('#row_table_id'));
+ renumber_positions();
+}
$(function(){
$('#order_[%- cv_id %]').change(reload_cv_dependend_selections);
});
$('#row_table_id').on('sortstop', function(event, ui) {
+ $('#row_table_id thead a img').remove();
renumber_positions();
});
</script>