PriceRule: Preisregeln können jetzt auch Rabatte
[kivitendo-erp.git] / js / kivi.PriceRule.js
1 namespace('kivi.PriceRule', function(ns) {
2
3   ns.add_new_row = function (type) {
4     var data = {
5       action: 'PriceRule/add_item_row',
6       type: type
7     };
8     $.post('controller.pl', data, kivi.eval_json_result);
9   }
10
11   ns.open_price_type_help_popup = function() {
12     kivi.popup_dialog({
13       url:    'controller.pl?action=PriceRule/price_type_help',
14       dialog: { title: kivi.t8('Price Types') },
15     });
16   }
17
18   $(function() {
19     $('#price_rule_item_add').click(function() {
20       ns.add_new_row($('#price_rules_empty_item_select').val());
21     });
22     $('#price_rule_items').on('click', 'a.price_rule_remove_line', function(){
23       $(this).closest('div').remove();
24     })
25     $('#price_rule_price_type_help').click(ns.open_price_type_help_popup);
26   });
27 });