3 [% INCLUDE 'doc-head-open.inc' %]
4 <title>Koha › Administration › Transport cost matrix</title>
5 [% INCLUDE 'doc-head-close.inc' %]
6 <style type="text/css">
8 background-color: #FF8888;
13 <body id="admin_transport_cost_matrix" class="admin">
14 [% INCLUDE 'header.inc' %]
15 [% INCLUDE 'prefs-admin-search.inc' %]
17 <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>
19 <div id="doc3" class="yui-t1">
24 <h1 class="parameters">
25 Defining transport costs between libraries
27 [% IF ( WARNING_transport_cost_matrix_off ) %]
28 <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>
31 [% IF ( errors ) %]<div class="dialog alert">
32 <h4>There were problems with your submission</h4>
35 <li>Invalid value for [% e %]</li>
40 <form method="post" action="/cgi-bin/koha/admin/transport-cost-matrix.pl" id="cost_matrix_form">
41 <input type="hidden" name="op" value="set-cost-matrix" />
42 <fieldset id="transport-cost-matrix">
44 <p>Costs are decimal values between some arbitrary maximum value (e.g. 1 or 100) and 0 which is the minimum (no) cost.</p>
45 <p>Red cells signify no transfer allowed.</p>
46 <p>Click on individual cells to edit.</p>
52 [% FOR b IN Branches.all() %]
53 <th>[% b.branchname %]</th>
56 [% FOR bf IN branchfromloop %]
58 <th>[% bf.name %]</th>
59 [% FOR bt IN bf.branchtoloop %]
65 <div id="celldiv_[% bt.id %]" class="disabled-transfer">
67 <div id="celldiv_[% bt.id %]">
69 <div class="enable_cost_input" data-cost-id="[% bt.id %]">[% bt.disabled ? ' ' : bt.value %]</div>
70 <input type="hidden" name="cost_[% bt.id %]" value="[% bt.value %]" />
72 <input type="hidden" name="disable_[% bt.id %]" value="1" />
82 <fieldset class="action">
83 <input type="submit" value="Save" class="submit" /> <a href="/cgi-bin/koha/admin/transport-cost-matrix.pl" class="cancel">Cancel</a>
89 [% INCLUDE 'admin-menu.inc' %]
93 [% MACRO jsinclude BLOCK %]
94 <script type="text/javascript" src="[% interface %]/[% theme %]/js/admin-menu_[% KOHA_VERSION %].js"></script>
95 <script type="text/javascript">
96 function check_transport_cost(e) {
98 if (val && val != '' && !isNaN(parseFloat(val)) && val >= 0.0) {
101 alert(_("Cost must be expressed as a decimal number >= 0"));
103 function disable_transport_cost_chg(e) {
104 var input_name = e.name;
105 var cost_id = input_name.replace(/disable_/,''); // Parse the code_id out of the input name
106 disable_transport_cost(cost_id, e.checked);
108 function disable_transport_cost(cost_id, disable) {
110 $('#celldiv_'+cost_id).find('input[type=text]').prop('disabled', true).addClass('disabled-transfer');
112 $('#celldiv_'+cost_id).find('input:disabled').prop('disabled', false).removeClass('disabled-transfer');
115 function enable_cost_input(cost_id) {
116 var cell = $('#celldiv_'+cost_id);
117 var cost = $(cell).text();
118 var disabled = $(cell).hasClass('disabled-transfer');
119 $(cell).removeClass('disabled-transfer');
121 $('#celldiv_'+cost_id).html(
122 '<input type="text" name="cost_'+cost_id+'" class="cost_input" size="4" value="'+$.trim(cost)+'" />'+
123 '<br/>' + _("Disable ") + '<input name="disable_'+cost_id+'" value="1" class="disable_transport_cost" type="checkbox" '+(disabled ? 'checked' : '')+' />'
125 disable_transport_cost(cost_id, disabled);
128 function form_submit (f) {
129 $(f).find('input:disabled').prop('disabled', false);
132 $(document).ready(function(){
133 $(".enable_cost_input").on("click",function(){
134 var cost_id = $(this).data("cost-id");
135 enable_cost_input( cost_id );
137 $("body").on("blur",".cost_input",function(){
138 check_transport_cost(this);
140 $("body").on("change",".disable_transport_cost",function(){
141 disable_transport_cost_chg(this);
143 $("#cost_matrix_form").on("submit",function(){
144 return form_submit(this);
149 [% INCLUDE 'intranet-bottom.inc' %]