Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 59103201

Von Bernd Bleßmann vor mehr als 4 Jahren hinzugefügt

  • ID 59103201cf9d7131024c1c3d5bbb136addb79a3f
  • Vorgänger 9fb93e8c
  • Nachfolger ffb7da30

Auftrags-Controller: Einfüge-Position eines neuen Artiklens angeben können

Unterschiede anzeigen:

SL/Controller/Order.pm
775 775
                                     SELF => $self,
776 776
  );
777 777

  
778
  $self->js
779
    ->append('#row_table_id', $row_as_html);
778
  if ($::form->{insert_before_item_id}) {
779
    $self->js
780
      ->before ('.row_entry:has(#item_' . $::form->{insert_before_item_id} . ')', $row_as_html);
781
  } else {
782
    $self->js
783
      ->append('#row_table_id', $row_as_html);
784
  }
780 785

  
781 786
  if ( $item->part->is_assortment ) {
782 787
    $form_attr->{qty_as_number} = 1 unless $form_attr->{qty_as_number};
......
800 805
                                         ID   => $item_id,
801 806
                                         SELF => $self,
802 807
      );
803
      $self->js
804
        ->append('#row_table_id', $row_as_html);
808
      if ($::form->{insert_before_item_id}) {
809
        $self->js
810
          ->before ('.row_entry:has(#item_' . $::form->{insert_before_item_id} . ')', $row_as_html);
811
      } else {
812
        $self->js
813
          ->append('#row_table_id', $row_as_html);
814
      }
805 815
    };
806 816
  };
807 817

  
808 818
  $self->js
809 819
    ->val('.add_item_input', '')
810 820
    ->run('kivi.Order.init_row_handlers')
811
    ->run('kivi.Order.row_table_scroll_down')
812 821
    ->run('kivi.Order.renumber_positions')
813 822
    ->focus('#add_item_parts_id_name');
814 823

  
824
  $self->js->run('kivi.Order.row_table_scroll_down') if !$::form->{insert_before_item_id};
825

  
815 826
  $self->js_redisplay_amounts_and_taxes;
816 827
  $self->js->render();
817 828
}
......
882 893
                                       SELF => $self,
883 894
    );
884 895

  
885
    $self->js->append('#row_table_id', $row_as_html);
896
    if ($::form->{insert_before_item_id}) {
897
      $self->js
898
        ->before ('.row_entry:has(#item_' . $::form->{insert_before_item_id} . ')', $row_as_html);
899
    } else {
900
      $self->js
901
        ->append('#row_table_id', $row_as_html);
902
    }
886 903
  }
887 904

  
888 905
  $self->js
889 906
    ->run('kivi.Order.close_multi_items_dialog')
890 907
    ->run('kivi.Order.init_row_handlers')
891
    ->run('kivi.Order.row_table_scroll_down')
892 908
    ->run('kivi.Order.renumber_positions')
893 909
    ->focus('#add_item_parts_id_name');
894 910

  
911
  $self->js->run('kivi.Order.row_table_scroll_down') if !$::form->{insert_before_item_id};
912

  
895 913
  $self->js_redisplay_amounts_and_taxes;
896 914
  $self->js->render();
897 915
}
js/kivi.Order.js
339 339
    $('.row_entry [name="position"]').each(function(idx, elt) {
340 340
      $(elt).html(idx+1);
341 341
    });
342
    $('.row_entry').each(function(idx, elt) {
343
      $(elt).data("position", idx+1);
344
    });
342 345
  };
343 346

  
344 347
  ns.reorder_items = function(order_by) {
......
374 377
    ns.renumber_positions();
375 378
  };
376 379

  
380
  ns.get_insert_before_item_id = function(wanted_pos) {
381
    if (wanted_pos === '') return;
382

  
383
    var insert_before_item_id;
384
    // selection by data does not seem to work if data is changed at runtime
385
    // var elt = $('.row_entry [data-position="' + wanted_pos + '"]');
386
    $('.row_entry').each(function(idx, elt) {
387
      if ($(elt).data("position") == wanted_pos) {
388
        insert_before_item_id = $(elt).find('[name="orderitem_ids[+]"]').val();
389
        return false;
390
      }
391
    });
392

  
393
    return insert_before_item_id;
394
  };
395

  
377 396
  ns.add_item = function() {
378 397
    if ($('#add_item_parts_id').val() === '') return;
379 398
    if (!ns.check_cv()) return;
380 399

  
381 400
    $('#row_table_id thead a img').remove();
382 401

  
402
    var insert_before_item_id = ns.get_insert_before_item_id($('#add_item_position').val());
403

  
383 404
    var data = $('#order_form').serializeArray();
384
    data.push({ name: 'action', value: 'Order/add_item' });
405
    data.push({ name: 'action', value: 'Order/add_item' },
406
              { name: 'insert_before_item_id', value: insert_before_item_id });
385 407

  
386 408
    $.post("controller.pl", data, kivi.eval_json_result);
387 409
  };
......
439 461
  ns.multi_items_dialog_disable_continue = function() {
440 462
    // disable keydown-event and continue button to prevent
441 463
    // impatient users to add parts multiple times
442
    $('#multi_items_result input').off("keydown");
464
    $('#multi_items_result input, #multi_items_position').off("keydown");
443 465
    $('#multi_items_dialog_continue_button').prop('disabled', true);
444 466
  };
445 467

  
446 468
  ns.multi_items_dialog_enable_continue = function()  {
447
    $('#multi_items_result input').keydown(function(event) {
469
    $('#multi_items_result input, #multi_items_position').keydown(function(event) {
448 470
      if(event.keyCode == 13) {
449 471
        event.preventDefault();
450 472
        ns.add_multi_items();
......
475 497

  
476 498
    ns.multi_items_dialog_disable_continue();
477 499

  
500
    var insert_before_item_id = ns.get_insert_before_item_id($('#multi_items_position').val());
501

  
478 502
    var data = $('#order_form').serializeArray();
479 503
    data = data.concat($('#multi_items_form').serializeArray());
480
    data.push({ name: 'action', value: 'Order/add_multi_items' });
504
    data.push({ name: 'action', value: 'Order/add_multi_items' },
505
              { name: 'insert_before_item_id', value: insert_before_item_id });
481 506
    $.post("controller.pl", data, kivi.eval_json_result);
482 507
  };
483 508

  
locale/de/all
350 350
  'At least one Perl module that kivitendo ERP requires for running is not installed on your system.' => 'Mindestes ein Perl-Modul, das kivitendo ERP zur Ausführung benötigt, ist auf Ihrem System nicht installiert.',
351 351
  'At least one of the columns #1, customer, customernumber, customer_gln, vendor, vendornumber, vendor_gln (depending on the target table) is required for matching the entry to an existing customer or vendor.' => 'Mindestens eine der Spalten #1, customer, customernumber, customer_gln, vendor, vendornumber, vendor_gln (von Zieltabelle abhängig) wird benötigt, um einen Eintrag einem bestehenden Kunden bzw. Lieferanten zuzuordnen.',
352 352
  'At most'                     => 'Höchstens',
353
  'At position'                 => 'An Position',
353 354
  'At the moment the transaction looks like this:' => 'Aktuell sieht die Buchung wie folgt aus:',
354 355
  'Attach PDF:'                 => 'PDF anhängen',
355 356
  'Attached Filename'           => 'Name des Dateianhangs',
locale/en/all
350 350
  'At least one Perl module that kivitendo ERP requires for running is not installed on your system.' => '',
351 351
  'At least one of the columns #1, customer, customernumber, customer_gln, vendor, vendornumber, vendor_gln (depending on the target table) is required for matching the entry to an existing customer or vendor.' => '',
352 352
  'At most'                     => '',
353
  'At position'                 => '',
353 354
  'At the moment the transaction looks like this:' => '',
354 355
  'Attach PDF:'                 => '',
355 356
  'Attached Filename'           => '',
templates/webpages/order/tabs/_item_input.html
4 4
  <table id="input_row_table_id">
5 5
    <thead>
6 6
      <tr class="listheading">
7
        <th class="listheading" nowrap >[%- 'position'     | $T8 %] </th>
7 8
        <th class="listheading" nowrap >[%- 'Part'         | $T8 %] </th>
8 9
        <th class="listheading" nowrap >[%- 'Description'  | $T8 %] </th>
9 10
        <th class="listheading" nowrap width="5" >[%- 'Qty'          | $T8 %] </th>
......
14 15
    </thead>
15 16
    <tbody>
16 17
      <tr valign="top" class="listrow">
18
        <td>[% L.input_tag('add_item.position', '', size = 5, class="add_item_input numeric") %]</td>
17 19
        <td>
18 20
          [%- SET PARAM_KEY = SELF.cv == "customer" ? 'with_customer_partnumber' : 'with_makemodel' -%]
19 21
          [%- SET PARAM_VAL = SELF.search_cvpartnumber -%]
templates/webpages/order/tabs/_multi_items_dialog.html
18 18
<div id='multi_items_result'></div>
19 19
<hr>
20 20

  
21
[% 'At position' | $T8 %]
22
[% L.input_tag('multi_items.position', '', size = 5, class="numeric") %]</td>
21 23
[% L.button_tag('kivi.Order.add_multi_items()', LxERP.t8('Continue'), id='multi_items_dialog_continue_button') %]
22 24
<a href="#" onclick="kivi.Order.close_multi_items_dialog();">[%- LxERP.t8("Cancel") %]</a>
23 25

  
templates/webpages/order/tabs/_row.html
4 4
[%- USE L %]
5 5
[%- USE P %]
6 6

  
7
<tbody class="row_entry listrow"[%- IF MYCONFIG.show_form_details -%] data-expanded="1"[%- END -%]>
7
<tbody class="row_entry listrow" data-position="[%- HTML.escape(ITEM.position) -%]"[%- IF MYCONFIG.show_form_details -%] data-expanded="1"[%- END -%]>
8 8
  <tr>
9 9
    <td align="center">
10 10
      [%- IF MYCONFIG.show_form_details %]

Auch abrufbar als: Unified diff