View | Details | Raw Unified | Return to bug 16305
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/transport-cost-matrix.tt (-5 / +18 lines)
Lines 11-17 function check_transport_cost(e) { Link Here
11
    }
11
    }
12
    alert(_("Cost must be expressed as a decimal number >= 0"));
12
    alert(_("Cost must be expressed as a decimal number >= 0"));
13
}
13
}
14
function disable_transport_cost_chg(e, cost_id) {
14
function disable_transport_cost_chg(e) {
15
    var input_name = e.name;
16
    var cost_id = input_name.replace(/disable_/,''); // Parse the code_id out of the input name
15
    disable_transport_cost(cost_id, e.checked);
17
    disable_transport_cost(cost_id, e.checked);
16
}
18
}
17
function disable_transport_cost(cost_id, disable) {
19
function disable_transport_cost(cost_id, disable) {
Lines 28-35 function enable_cost_input(cost_id) { Link Here
28
    $(cell).removeClass('disabled-transfer');
30
    $(cell).removeClass('disabled-transfer');
29
31
30
    $('#celldiv_'+cost_id).html(
32
    $('#celldiv_'+cost_id).html(
31
        '<input type="text" name="cost_'+cost_id+'" onblur="check_transport_cost(this);" size="4" value="'+$.trim(cost)+'" />'+
33
        '<input type="text" name="cost_'+cost_id+'" class="cost_input" size="4" value="'+$.trim(cost)+'" />'+
32
        '<br/>Disable <input name="disable_'+cost_id+'" value="1" onchange="disable_transport_cost_chg(this, \''+cost_id+'\');" type="checkbox" '+(disabled ? 'checked' : '')+' />'
34
        '<br/>Disable <input name="disable_'+cost_id+'" value="1" class="disable_transport_cost" type="checkbox" '+(disabled ? 'checked' : '')+' />'
33
    );
35
    );
34
    disable_transport_cost(cost_id, disabled);
36
    disable_transport_cost(cost_id, disabled);
35
}
37
}
Lines 38-43 function form_submit (f) { Link Here
38
    $(f).find('input:disabled').removeAttr("disabled");
40
    $(f).find('input:disabled').removeAttr("disabled");
39
    return true;
41
    return true;
40
}
42
}
43
$(document).ready(function(){
44
    $(".enable_cost_input").on("click",function(){
45
        var cost_id = $(this).data("cost-id");
46
        enable_cost_input( cost_id );
47
    });
48
    $("body").on("blur",".cost_input",function(){
49
        check_transport_cost(this);
50
    });
51
    $("body").on("change",".disable_transport_cost",function(){
52
        disable_transport_cost_chg(this);
53
    });
54
})
41
//]]>
55
//]]>
42
</script>
56
</script>
43
<style type="text/css">
57
<style type="text/css">
Lines 103-109 function form_submit (f) { Link Here
103
                            [% ELSE %]
117
                            [% ELSE %]
104
                            <div id="celldiv_[% bt.id %]">
118
                            <div id="celldiv_[% bt.id %]">
105
                            [% END %]
119
                            [% END %]
106
                            <div onclick="enable_cost_input('[% bt.id %]');">[% bt.disabled ? '&nbsp;' : bt.value %]</div>
120
                            <div class="enable_cost_input" data-cost-id="[% bt.id %]">[% bt.disabled ? '&nbsp;' : bt.value %]</div>
107
                            <input type="hidden" name="cost_[% bt.id %]" value="[% bt.value %]" />
121
                            <input type="hidden" name="cost_[% bt.id %]" value="[% bt.value %]" />
108
                            [% IF bt.disabled %]
122
                            [% IF bt.disabled %]
109
                            <input type="hidden" name="disable_[% bt.id %]" value="1" />
123
                            <input type="hidden" name="disable_[% bt.id %]" value="1" />
110
- 

Return to bug 16305