1 [% INCLUDE 'doc-head-open.inc' %]
2 <title>Koha › Administration › Transport cost matrix</title>
3 [% INCLUDE 'doc-head-close.inc' %]
5 <script type="text/javascript">
7 function check_transport_cost(e) {
9 if (val && val != '' && !isNaN(parseFloat(val)) && val >= 0.0) {
12 alert(_("Cost must be expressed as a decimal number >= 0"));
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
17 disable_transport_cost(cost_id, e.checked);
19 function disable_transport_cost(cost_id, disable) {
21 $('#celldiv_'+cost_id).find('input[type=text]').prop('disabled', true).addClass('disabled-transfer');
23 $('#celldiv_'+cost_id).find('input:disabled').prop('disabled', false).removeClass('disabled-transfer');
26 function enable_cost_input(cost_id) {
27 var cell = $('#celldiv_'+cost_id);
28 var cost = $(cell).text();
29 var disabled = $(cell).hasClass('disabled-transfer');
30 $(cell).removeClass('disabled-transfer');
32 $('#celldiv_'+cost_id).html(
33 '<input type="text" name="cost_'+cost_id+'" class="cost_input" size="4" value="'+$.trim(cost)+'" />'+
34 '<br/>Disable <input name="disable_'+cost_id+'" value="1" class="disable_transport_cost" type="checkbox" '+(disabled ? 'checked' : '')+' />'
36 disable_transport_cost(cost_id, disabled);
39 function form_submit (f) {
40 $(f).find('input:disabled').prop('disabled', false);
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 );
48 $("body").on("blur",".cost_input",function(){
49 check_transport_cost(this);
51 $("body").on("change",".disable_transport_cost",function(){
52 disable_transport_cost_chg(this);
57 <style type="text/css">
59 background-color: #FF8888;
64 <body id="admin_transport_cost_matrix" class="admin">
65 [% INCLUDE 'header.inc' %]
66 [% INCLUDE 'cat-search.inc' %]
68 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> › Transport cost matrix</div>
70 <div id="doc3" class="yui-t1">
75 <h1 class="parameters">
76 Defining transport costs between libraries
78 [% IF ( WARNING_transport_cost_matrix_off ) %]
79 <div class="dialog message">Because the "UseTransportCostMatrix" system preference is currently not enabled, the transport cost matrix is not being used. Go <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=UseTransportCostMatrix">here</a> if you wish to enable this feature.</div>
82 [% IF ( errors ) %]<div class="dialog alert">
83 <h4>There were problems with your submission</h4>
86 <li>Invalid value for [% e %]</li>
91 <form method="post" action="?" onsubmit="return form_submit(this);">
92 <input type="hidden" name="op" value="set-cost-matrix" />
93 <fieldset id="transport-cost-matrix">
95 <p>Costs are decimal values between some arbitrary maximum value (e.g. 1 or 100) and 0 which is the minimum (no) cost.</p>
96 <p>Red cells signify no transfer allowed.</p>
97 <p>Click on individual cells to edit.</p>
103 [% FOR b IN branchloop %]
104 <th>[% b.name %]</th>
107 [% FOR bf IN branchfromloop %]
109 <th>[% bf.name %]</th>
110 [% FOR bt IN bf.branchtoloop %]
116 <div id="celldiv_[% bt.id %]" class="disabled-transfer">
118 <div id="celldiv_[% bt.id %]">
120 <div class="enable_cost_input" data-cost-id="[% bt.id %]">[% bt.disabled ? ' ' : bt.value %]</div>
121 <input type="hidden" name="cost_[% bt.id %]" value="[% bt.value %]" />
123 <input type="hidden" name="disable_[% bt.id %]" value="1" />
133 <fieldset class="action">
134 <input type="submit" value="Save" class="submit" /> <a href="/cgi-bin/koha/admin/transport-cost-matrix.pl" class="cancel">Cancel</a>
140 [% INCLUDE 'admin-menu.inc' %]
143 [% INCLUDE 'intranet-bottom.inc' %]