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);
55 $("#cost_matrix_form").on("submit",function(){
56 return form_submit(this);
61 <style type="text/css">
63 background-color: #FF8888;
68 <body id="admin_transport_cost_matrix" class="admin">
69 [% INCLUDE 'header.inc' %]
70 [% INCLUDE 'prefs-admin-search.inc' %]
72 <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>
74 <div id="doc3" class="yui-t1">
79 <h1 class="parameters">
80 Defining transport costs between libraries
82 [% IF ( WARNING_transport_cost_matrix_off ) %]
83 <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>
86 [% IF ( errors ) %]<div class="dialog alert">
87 <h4>There were problems with your submission</h4>
90 <li>Invalid value for [% e %]</li>
95 <form method="post" action="/cgi-bin/koha/admin/transport-cost-matrix.pl" id="cost_matrix_form">
96 <input type="hidden" name="op" value="set-cost-matrix" />
97 <fieldset id="transport-cost-matrix">
99 <p>Costs are decimal values between some arbitrary maximum value (e.g. 1 or 100) and 0 which is the minimum (no) cost.</p>
100 <p>Red cells signify no transfer allowed.</p>
101 <p>Click on individual cells to edit.</p>
107 [% FOR b IN Branches.all() %]
108 <th>[% b.branchname %]</th>
111 [% FOR bf IN branchfromloop %]
113 <th>[% bf.name %]</th>
114 [% FOR bt IN bf.branchtoloop %]
120 <div id="celldiv_[% bt.id %]" class="disabled-transfer">
122 <div id="celldiv_[% bt.id %]">
124 <div class="enable_cost_input" data-cost-id="[% bt.id %]">[% bt.disabled ? ' ' : bt.value %]</div>
125 <input type="hidden" name="cost_[% bt.id %]" value="[% bt.value %]" />
127 <input type="hidden" name="disable_[% bt.id %]" value="1" />
137 <fieldset class="action">
138 <input type="submit" value="Save" class="submit" /> <a href="/cgi-bin/koha/admin/transport-cost-matrix.pl" class="cancel">Cancel</a>
144 [% INCLUDE 'admin-menu.inc' %]
147 [% INCLUDE 'intranet-bottom.inc' %]