Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision e8889e47

Von Bernd Bleßmann vor fast 9 Jahren hinzugefügt

  • ID e8889e47af38072dc6fcbb4d97e2fdcc30d948d7
  • Vorgänger 59da90f6
  • Nachfolger ed04f337

Auftrags-Controller: Sortieren der Positionen

Unterschiede anzeigen:

SL/Controller/Order.pm
$self->js->render();
}
sub action_reorder_items {
my ($self) = @_;
my %sort_keys = (
partnumber => sub { $_[0]->part->partnumber },
description => sub { $_[0]->description },
qty => sub { $_[0]->qty },
sellprice => sub { $_[0]->sellprice },
discount => sub { $_[0]->discount },
);
my $method = $sort_keys{$::form->{order_by}};
my @to_sort = map { { old_pos => $_->position, order_by => $method->($_) } } @{ $self->order->items_sorted };
if ($::form->{sort_dir}) {
@to_sort = sort { $a->{order_by} cmp $b->{order_by} } @to_sort;
} else {
@to_sort = sort { $b->{order_by} cmp $a->{order_by} } @to_sort;
}
$self->js
->run('redisplay_items', \@to_sort)
->render;
}
sub action_price_popup {
my ($self) = @_;
js/locale/de.js
"Version actions":"Aktionen für Versionen",
"Yes":"Ja",
"flat-rate position":"Pauschalposition",
"sort items":"Positionen sortieren",
"time and effort based position":"Aufwandsposition"
});
locale/de/all
'shipped' => 'verschickt',
'singular first char' => 'S',
'soldtotal' => 'Verkaufte Anzahl',
'sort items' => 'Positionen sortieren',
'stock' => 'Einlagerung',
'submit' => 'abschicken',
'succeeded' => 'erfolgreich',
templates/webpages/order/tabs/basic_data.html
<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>

Auch abrufbar als: Unified diff