CVar->render_inputs('variables' => $form->{CUSTOM_VARIABLES}, show_disabled_message => 1, partsgroup_id => $partsgroup_id)
if (scalar @{ $form->{CUSTOM_VARIABLES} });
- $::request->layout->use_javascript("${_}.js") for qw(ckeditor/ckeditor ckeditor/adapters/jquery);
+ $::request->layout->use_javascript("${_}.js") for qw(ckeditor/ckeditor ckeditor/adapters/jquery kivi.PriceRule);
+ $::request->layout->add_javascripts_inline("\$(function(){kivi.PriceRule.load_price_rules_for_part(@{[ $::form->{id} * 1 ]})})") if $::form->{id};
$form->header;
#print $form->parse_html_template('ic/form_header', { ALL_PRICE_FACTORS => $form->{ALL_PRICE_FACTORS},
# ALL_UNITS => $form->{ALL_UNITS},
}
}
+ ns.inline_report = function(target, source, data){
+ $.ajax({
+ url: source,
+ success: function (rsp) {
+ $(target).html(rsp);
+ $(target).find('.paginate').find('a').click(function(event){ ns.redirect_event(event, target) });
+ $(target).find('a.report-generator-header-link').click(function(event){ ns.redirect_event(event, target) });
+ },
+ data: data,
+ });
+ };
+ ns.redirect_event = function(event, target){
+ event.preventDefault();
+ ns.inline_report(target, event.target + '', {});
+ };
+
+ ns.load_price_rules_for_part = function(id) {
+ window.setTimeout(function(){
+ ns.inline_report('#price_rules_customer_report', 'controller.pl', { action: 'PriceRule/list', 'filter.item_type_matches[].part': id, 'filter.type': 'customer', inline: 1 });
+ ns.inline_report('#price_rules_vendor_report', 'controller.pl', { action: 'PriceRule/list', 'filter.item_type_matches[].part': id, 'filter.type': 'vendor', inline: 1 });
+ }, 200);
+ }
+
$(function() {
$('#price_rule_item_add').click(function() {
ns.add_new_row($('#price_rules_empty_item_select').val());
$('#price_rule_price_type_help').click(ns.open_price_type_help_popup);
$('#price_rule_filter_type').change(ns.on_change_filter_type);
});
+
});
</form>
<script type="text/javascript" src="js/wz_tooltip.js"></script>
-[%- IF id %]
-<script type='text/javascript'>
- var inline_report = function(target, source, data){
- $.ajax({
- url: source,
- success: function (rsp) {
- $(target).html(rsp);
- $(target).find('.paginate').find('a').click(function(event){ ns.redirect_event(event, target) });
- $(target).find('a.report-generator-header-link').click(function(event){ ns.redirect_event(event, target) });
- },
- data: data,
- });
- };
- var redirect_event = function(event, target){
- event.preventDefault();
- ns.inline_report(target, event.target + '', {});
- };
- $(function() {
- window.setTimeout(function(){
- inline_report('#price_rules_customer_report', 'controller.pl', { action: 'PriceRule/list', 'filter.item_type_matches[].part': [% id %], 'filter.type': 'customer', inline: 1 });
- inline_report('#price_rules_vendor_report', 'controller.pl', { action: 'PriceRule/list', 'filter.item_type_matches[].part': [% id %], 'filter.type': 'vendor', inline: 1 });
- }, 200);
- });
-</script>
-[%- END %]