2 [% INCLUDE 'doc-head-open.inc' %]
3 <title>Koha › Administration › Transport cost matrix</title>
4 [% INCLUDE 'doc-head-close.inc' %]
6 <script type="text/javascript">
8 function check_transport_cost(e) {
10 if (val && val != '' && !isNaN(parseFloat(val)) && val >= 0.0) {
13 alert(_("Cost must be expressed as a decimal number >= 0"));
15 function disable_transport_cost_chg(e) {
16 var input_name = e.name;
17 var cost_id = input_name.replace(/disable_/,''); // Parse the code_id out of the input name
18 disable_transport_cost(cost_id, e.checked);
20 function disable_transport_cost(cost_id, disable) {
22 $('#celldiv_'+cost_id).find('input[type=text]').prop('disabled', true).addClass('disabled-transfer');
24 $('#celldiv_'+cost_id).find('input:disabled').prop('disabled', false).removeClass('disabled-transfer');
27 function enable_cost_input(cost_id) {
28 var cell = $('#celldiv_'+cost_id);
29 var cost = $(cell).text();
30 var disabled = $(cell).hasClass('disabled-transfer');
31 $(cell).removeClass('disabled-transfer');
33 $('#celldiv_'+cost_id).html(
34 '<input type="text" name="cost_'+cost_id+'" class="cost_input" size="4" value="'+$.trim(cost)+'" />'+
35 '<br/>Disable <input name="disable_'+cost_id+'" value="1" class="disable_transport_cost" type="checkbox" '+(disabled ? 'checked' : '')+' />'
37 disable_transport_cost(cost_id, disabled);
40 function form_submit (f) {
41 $(f).find('input:disabled').prop('disabled', false);
44 $(document).ready(function(){
45 $(".enable_cost_input").on("click",function(){
46 var cost_id = $(this).data("cost-id");
47 enable_cost_input( cost_id );
49 $("body").on("blur",".cost_input",function(){
50 check_transport_cost(this);
52 $("body").on("change",".disable_transport_cost",function(){
53 disable_transport_cost_chg(this);
58 <style type="text/css">
60 background-color: #FF8888;
65 <body id="admin_transport_cost_matrix" class="admin">
66 [% INCLUDE 'header.inc' %]
67 [% INCLUDE 'cat-search.inc' %]
69 <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>
71 <div id="doc3" class="yui-t1">
76 <h1 class="parameters">
77 Defining transport costs between libraries
79 [% IF ( WARNING_transport_cost_matrix_off ) %]
80 <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>
83 [% IF ( errors ) %]<div class="dialog alert">
84 <h4>There were problems with your submission</h4>
87 <li>Invalid value for [% e %]</li>
92 <form method="post" action="?" onsubmit="return form_submit(this);">
93 <input type="hidden" name="op" value="set-cost-matrix" />
94 <fieldset id="transport-cost-matrix">
96 <p>Costs are decimal values between some arbitrary maximum value (e.g. 1 or 100) and 0 which is the minimum (no) cost.</p>
97 <p>Red cells signify no transfer allowed.</p>
98 <p>Click on individual cells to edit.</p>
104 [% FOR b IN Branches.all() %]
105 <th>[% b.branchname %]</th>
108 [% FOR bf IN branchfromloop %]
110 <th>[% bf.name %]</th>
111 [% FOR bt IN bf.branchtoloop %]
117 <div id="celldiv_[% bt.id %]" class="disabled-transfer">
119 <div id="celldiv_[% bt.id %]">
121 <div class="enable_cost_input" data-cost-id="[% bt.id %]">[% bt.disabled ? ' ' : bt.value %]</div>
122 <input type="hidden" name="cost_[% bt.id %]" value="[% bt.value %]" />
124 <input type="hidden" name="disable_[% bt.id %]" value="1" />
134 <fieldset class="action">
135 <input type="submit" value="Save" class="submit" /> <a href="/cgi-bin/koha/admin/transport-cost-matrix.pl" class="cancel">Cancel</a>
141 [% INCLUDE 'admin-menu.inc' %]
144 [% INCLUDE 'intranet-bottom.inc' %]