Bug 15758: Koha::Libraries - Remove GetBranchName
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / transport-cost-matrix.tt
1 [% INCLUDE 'doc-head-open.inc' %]
2 <title>Koha &rsaquo; Administration &rsaquo; Transport cost matrix</title>
3 [% INCLUDE 'doc-head-close.inc' %]
4
5 <script type="text/javascript">
6 //<![CDATA[
7 function check_transport_cost(e) {
8     var val = e.value;
9     if (val && val != '' && !isNaN(parseFloat(val)) && val >= 0.0) {
10         return;
11     }
12     alert(_("Cost must be expressed as a decimal number >= 0"));
13 }
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);
18 }
19 function disable_transport_cost(cost_id, disable) {
20     if (disable) {
21         $('#celldiv_'+cost_id).find('input[type=text]').prop('disabled', true).addClass('disabled-transfer');
22     } else {
23         $('#celldiv_'+cost_id).find('input:disabled').prop('disabled', false).removeClass('disabled-transfer');
24     }
25 }
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');
31
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' : '')+' />'
35     );
36     disable_transport_cost(cost_id, disabled);
37 }
38
39 function form_submit (f) {
40     $(f).find('input:disabled').prop('disabled', false);
41     return true;
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 })
55 //]]>
56 </script>
57 <style type="text/css">
58 .disabled-transfer {
59     background-color: #FF8888;
60 }
61 </style>
62
63 </head>
64 <body id="admin_transport_cost_matrix" class="admin">
65 [% INCLUDE 'header.inc' %]
66 [% INCLUDE 'cat-search.inc' %]
67
68 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> &rsaquo; Transport cost matrix</div>
69
70 <div id="doc3" class="yui-t1">
71
72 <div id="bd">
73     <div id="yui-main">
74     <div class="yui-b">
75     <h1 class="parameters">
76             Defining transport costs between libraries
77     </h1>
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&amp;searchfield=UseTransportCostMatrix">here</a> if you wish to enable this feature.</div>
80 [% END %]
81
82     [% IF ( errors ) %]<div class="dialog alert">
83         <h4>There were problems with your submission</h4>
84         <ul>
85             [% FOR e IN errors %]
86                 <li>Invalid value for [% e %]</li>
87             [% END %]
88         </ul>
89     </div>[% END %]
90
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">
94                 <div class="help">
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>
98                 </div>
99
100                 <table>
101                     <tr>
102                         <th>From \ To</th>
103                         [% FOR b IN branchloop %]
104                         <th>[% b.name %]</th>
105                         [% END %]
106                     </tr>
107                 [% FOR bf IN branchfromloop %]
108                     <tr>
109                         <th>[% bf.name %]</th>
110                     [% FOR bt IN bf.branchtoloop %]
111                         <td>
112                         [% IF bt.skip %]
113                             &nbsp;
114                         [% ELSE %]
115                             [% IF bt.disabled %]
116                             <div id="celldiv_[% bt.id %]" class="disabled-transfer">
117                             [% ELSE %]
118                             <div id="celldiv_[% bt.id %]">
119                             [% END %]
120                             <div class="enable_cost_input" data-cost-id="[% bt.id %]">[% bt.disabled ? '&nbsp;' : bt.value %]</div>
121                             <input type="hidden" name="cost_[% bt.id %]" value="[% bt.value %]" />
122                             [% IF bt.disabled %]
123                             <input type="hidden" name="disable_[% bt.id %]" value="1" />
124                             [% END %]
125                             </div>
126                         [% END %]
127                         </td>
128                     [% END %]
129                     </tr>
130                 [% END %]
131                 </table>
132             </fieldset>
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>
135             </fieldset>
136         </form>
137     </div>
138     </div>
139 <div class="yui-b">
140 [% INCLUDE 'admin-menu.inc' %]
141 </div>
142 </div>
143 [% INCLUDE 'intranet-bottom.inc' %]