Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision cb0ae4e4

Von Sven Schöling vor mehr als 9 Jahren hinzugefügt

  • ID cb0ae4e41048ffba9a7e3c6f52c21ea11728f42d
  • Vorgänger f8ec31c6
  • Nachfolger 4ec753d2

PriceRule: Inline Report JS ausgelagert

Hatte sich mit dem SalesPriceInformation Javascript verheddert, welches
auch mal ausgelagert werden solle.

Unterschiede anzeigen:

bin/mozilla/ic.pl
1633 1633
  CVar->render_inputs('variables' => $form->{CUSTOM_VARIABLES}, show_disabled_message => 1, partsgroup_id => $partsgroup_id)
1634 1634
    if (scalar @{ $form->{CUSTOM_VARIABLES} });
1635 1635

  
1636
  $::request->layout->use_javascript("${_}.js") for qw(ckeditor/ckeditor ckeditor/adapters/jquery);
1636
  $::request->layout->use_javascript("${_}.js") for qw(ckeditor/ckeditor ckeditor/adapters/jquery kivi.PriceRule);
1637
  $::request->layout->add_javascripts_inline("\$(function(){kivi.PriceRule.load_price_rules_for_part(@{[ $::form->{id} * 1 ]})})") if $::form->{id};
1637 1638
  $form->header;
1638 1639
  #print $form->parse_html_template('ic/form_header', { ALL_PRICE_FACTORS => $form->{ALL_PRICE_FACTORS},
1639 1640
  #                                                     ALL_UNITS         => $form->{ALL_UNITS},
js/kivi.PriceRule.js
33 33
    }
34 34
  }
35 35

  
36
  ns.inline_report = function(target, source, data){
37
    $.ajax({
38
      url:        source,
39
      success:    function (rsp) {
40
        $(target).html(rsp);
41
        $(target).find('.paginate').find('a').click(function(event){ ns.redirect_event(event, target) });
42
        $(target).find('a.report-generator-header-link').click(function(event){ ns.redirect_event(event, target) });
43
      },
44
      data:       data,
45
    });
46
  };
47
  ns.redirect_event = function(event, target){
48
    event.preventDefault();
49
    ns.inline_report(target, event.target + '', {});
50
  };
51

  
52
  ns.load_price_rules_for_part = function(id) {
53
    window.setTimeout(function(){
54
      ns.inline_report('#price_rules_customer_report', 'controller.pl', { action: 'PriceRule/list', 'filter.item_type_matches[].part': id, 'filter.type': 'customer', inline: 1 });
55
      ns.inline_report('#price_rules_vendor_report', 'controller.pl', { action: 'PriceRule/list', 'filter.item_type_matches[].part': id, 'filter.type': 'vendor', inline: 1 });
56
    }, 200);
57
  }
58

  
36 59
  $(function() {
37 60
    $('#price_rule_item_add').click(function() {
38 61
      ns.add_new_row($('#price_rules_empty_item_select').val());
......
43 66
    $('#price_rule_price_type_help').click(ns.open_price_type_help_popup);
44 67
    $('#price_rule_filter_type').change(ns.on_change_filter_type);
45 68
  });
69

  
46 70
});
templates/webpages/ic/form_footer.html
99 99
</form>
100 100

  
101 101
<script type="text/javascript" src="js/wz_tooltip.js"></script>
102
[%- IF id %]
103
<script type='text/javascript'>
104
  var inline_report = function(target, source, data){
105
    $.ajax({
106
      url:        source,
107
      success:    function (rsp) {
108
        $(target).html(rsp);
109
        $(target).find('.paginate').find('a').click(function(event){ ns.redirect_event(event, target) });
110
        $(target).find('a.report-generator-header-link').click(function(event){ ns.redirect_event(event, target) });
111
      },
112
      data:       data,
113
    });
114
  };
115
  var redirect_event = function(event, target){
116
    event.preventDefault();
117
    ns.inline_report(target, event.target + '', {});
118
  };
119
  $(function() {
120
    window.setTimeout(function(){
121
      inline_report('#price_rules_customer_report', 'controller.pl', { action: 'PriceRule/list', 'filter.item_type_matches[].part': [% id %], 'filter.type': 'customer', inline: 1 });
122
      inline_report('#price_rules_vendor_report', 'controller.pl', { action: 'PriceRule/list', 'filter.item_type_matches[].part': [% id %], 'filter.type': 'vendor', inline: 1 });
123
    }, 200);
124
  });
125
</script>
126
[%- END %]

Auch abrufbar als: Unified diff