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
449 449
  $self->js->render();
450 450
}
451 451

  
452
sub action_reorder_items {
453
  my ($self) = @_;
454

  
455
  my %sort_keys = (
456
    partnumber  => sub { $_[0]->part->partnumber },
457
    description => sub { $_[0]->description },
458
    qty         => sub { $_[0]->qty },
459
    sellprice   => sub { $_[0]->sellprice },
460
    discount    => sub { $_[0]->discount },
461
  );
462

  
463
  my $method = $sort_keys{$::form->{order_by}};
464
  my @to_sort = map { { old_pos => $_->position, order_by => $method->($_) } } @{ $self->order->items_sorted };
465
  if ($::form->{sort_dir}) {
466
    @to_sort = sort { $a->{order_by} cmp $b->{order_by} } @to_sort;
467
  } else {
468
    @to_sort = sort { $b->{order_by} cmp $a->{order_by} } @to_sort;
469
  }
470
  $self->js
471
    ->run('redisplay_items', \@to_sort)
472
    ->render;
473
}
474

  
452 475
sub action_price_popup {
453 476
  my ($self) = @_;
454 477

  
js/locale/de.js
91 91
"Version actions":"Aktionen für Versionen",
92 92
"Yes":"Ja",
93 93
"flat-rate position":"Pauschalposition",
94
"sort items":"Positionen sortieren",
94 95
"time and effort based position":"Aufwandsposition"
95 96
});
locale/de/all
3548 3548
  'shipped'                     => 'verschickt',
3549 3549
  'singular first char'         => 'S',
3550 3550
  'soldtotal'                   => 'Verkaufte Anzahl',
3551
  'sort items'                  => 'Positionen sortieren',
3551 3552
  'stock'                       => 'Einlagerung',
3552 3553
  'submit'                      => 'abschicken',
3553 3554
  'succeeded'                   => 'erfolgreich',
templates/webpages/order/tabs/basic_data.html
157 157
                <th class="listheading" nowrap width="3" >[%- 'position'     | $T8 %] </th>
158 158
                <th class="listheading" style='text-align:center' nowrap width="1"><img src="image/updown.png" alt="[%- LxERP.t8('reorder item') %]"></th>
159 159
                <th class="listheading" style='text-align:center' nowrap width="1"><img src="image/close.png" alt="[%- LxERP.t8('delete item') %]"></th>
160
                <th class="listheading" nowrap width="15">[%- 'Partnumber'   | $T8 %] </th>
161
                <th class="listheading" nowrap           >[%- 'Description'  | $T8 %] </th>
162
                <th class="listheading" nowrap width="5" >[%- 'Qty'          | $T8 %] </th>
160
                <th id="partnumber_header_id"  class="listheading" nowrap width="15"><a href='#' onClick='javascript:reorder_items("partnumber")'> [%- 'Partnumber'  | $T8 %]</a></th>
161
                <th id="description_header_id" class="listheading" nowrap           ><a href='#' onClick='javascript:reorder_items("description")'>[%- 'Description' | $T8 %]</a></th>
162
                <th id="qty_header_id"         class="listheading" nowrap width="5" ><a href='#' onClick='javascript:reorder_items("qty")'>        [%- 'Qty'         | $T8 %]</a></th>
163 163
                <th class="listheading" nowrap width="5" >[%- 'Price Factor' | $T8 %] </th>
164 164
                <th class="listheading" nowrap width="5" >[%- 'Unit'         | $T8 %] </th>
165 165
                <th class="listheading" nowrap width="5" >[%- 'Price Source' | $T8 %] </th>
166
                <th class="listheading" nowrap width="15">[%- 'Price'        | $T8 %] </th>
167
                <th class="listheading" nowrap width="5" >[%- 'Discount'     | $T8 %] </th>
166
                <th id="sellprice_header_id"   class="listheading" nowrap width="15" ><a href='#' onClick='javascript:reorder_items("sellprice")'> [%- 'Price'       | $T8 %]</a></th>
167
                <th id="discount_header_id"    class="listheading" nowrap width="15" ><a href='#' onClick='javascript:reorder_items("discount")'>  [%- 'Discount'    | $T8 %]</a></th>
168 168
                <th class="listheading" nowrap width="10">[%- 'Extended'     | $T8 %] </th>
169 169
              </tr>
170 170
            </thead>
......
303 303
  if ($('#add_item_parts_id').val() == '') return;
304 304
  if (!check_cv()) return;
305 305

  
306
  $('#row_table_id thead a img').remove();
307

  
306 308
  var data = $('#order_form').serialize();
307 309
  data += '&action=Order/add_item';
308 310

  
......
312 314
function show_multi_items_dialog() {
313 315
  if (!check_cv()) return;
314 316

  
317
  $('#row_table_id thead a img').remove();
318

  
315 319
  kivi.popup_dialog({
316 320
    url: 'controller.pl?action=Order/show_multi_items_dialog',
317 321
    data: { type: $('#type').val(),
......
523 527
  });
524 528
}
525 529

  
530
function reorder_items(order_by) {
531
  var dir = $('#' + order_by + '_header_id a img').attr("data-sort-dir");
532
  $('#row_table_id thead a img').remove();
533

  
534
  var src;
535
  if (dir == "1") {
536
    dir = "0";
537
    src = "image/up.png";
538
  } else {
539
    dir = "1";
540
    src = "image/down.png";
541
  };
542

  
543
  $('#' + order_by + '_header_id a').append('<img border=0 data-sort-dir=' + dir + ' src=' + src + ' alt="[%- LxERP.t8('sort items') %]">');
544

  
545
  var data = $('#order_form').serialize();
546
  data += '&action=Order/reorder_items';
547
  data += '&order_by=' + order_by;
548
  data += '&sort_dir=' + dir;
549

  
550
  $.post("controller.pl", data, kivi.eval_json_result);
551
}
552

  
553
function redisplay_items(data) {
554
  var old_rows = $('.row_entry').detach();
555
  var new_rows = [];
556
  $(data).each(function(idx, elt) {
557
    new_rows.push(old_rows[elt.old_pos - 1]);
558
  });
559
  $(new_rows).appendTo($('#row_table_id'));
560
  renumber_positions();
561
}
526 562

  
527 563
$(function(){
528 564
  $('#order_[%- cv_id %]').change(reload_cv_dependend_selections);
......
548 584
});
549 585

  
550 586
$('#row_table_id').on('sortstop', function(event, ui) {
587
  $('#row_table_id thead a img').remove();
551 588
  renumber_positions();
552 589
});
553 590
</script>

Auch abrufbar als: Unified diff