Bug 20141: Untranslatable string in transport cost matrix
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / transport-cost-matrix.tt
1 [% USE Branches %]
2 [% SET footerjs = 1 %]
3 [% INCLUDE 'doc-head-open.inc' %]
4 <title>Koha &rsaquo; Administration &rsaquo; Transport cost matrix</title>
5 [% INCLUDE 'doc-head-close.inc' %]
6 <style type="text/css">
7 .disabled-transfer {
8     background-color: #FF8888;
9 }
10 </style>
11 </head>
12
13 <body id="admin_transport_cost_matrix" class="admin">
14 [% INCLUDE 'header.inc' %]
15 [% INCLUDE 'prefs-admin-search.inc' %]
16
17 <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>
18
19 <div id="doc3" class="yui-t1">
20
21 <div id="bd">
22     <div id="yui-main">
23     <div class="yui-b">
24     <h1 class="parameters">
25             Defining transport costs between libraries
26     </h1>
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&amp;searchfield=UseTransportCostMatrix">here</a> if you wish to enable this feature.</div>
29 [% END %]
30
31     [% IF ( errors ) %]<div class="dialog alert">
32         <h4>There were problems with your submission</h4>
33         <ul>
34             [% FOR e IN errors %]
35                 <li>Invalid value for [% e %]</li>
36             [% END %]
37         </ul>
38     </div>[% END %]
39
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">
43                 <div class="help">
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>
47                 </div>
48
49                 <table>
50                     <tr>
51                         <th>From \ To</th>
52                         [% FOR b IN Branches.all() %]
53                         <th>[% b.branchname %]</th>
54                         [% END %]
55                     </tr>
56                 [% FOR bf IN branchfromloop %]
57                     <tr>
58                         <th>[% bf.name %]</th>
59                     [% FOR bt IN bf.branchtoloop %]
60                         <td>
61                         [% IF bt.skip %]
62                             &nbsp;
63                         [% ELSE %]
64                             [% IF bt.disabled %]
65                             <div id="celldiv_[% bt.id %]" class="disabled-transfer">
66                             [% ELSE %]
67                             <div id="celldiv_[% bt.id %]">
68                             [% END %]
69                             <div class="enable_cost_input" data-cost-id="[% bt.id %]">[% bt.disabled ? '&nbsp;' : bt.value %]</div>
70                             <input type="hidden" name="cost_[% bt.id %]" value="[% bt.value %]" />
71                             [% IF bt.disabled %]
72                             <input type="hidden" name="disable_[% bt.id %]" value="1" />
73                             [% END %]
74                             </div>
75                         [% END %]
76                         </td>
77                     [% END %]
78                     </tr>
79                 [% END %]
80                 </table>
81             </fieldset>
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>
84             </fieldset>
85         </form>
86     </div>
87     </div>
88 <div class="yui-b">
89 [% INCLUDE 'admin-menu.inc' %]
90 </div>
91 </div>
92
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) {
97             var val = e.value;
98             if (val && val != '' && !isNaN(parseFloat(val)) && val >= 0.0) {
99                 return;
100             }
101             alert(_("Cost must be expressed as a decimal number >= 0"));
102         }
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);
107         }
108         function disable_transport_cost(cost_id, disable) {
109             if (disable) {
110                 $('#celldiv_'+cost_id).find('input[type=text]').prop('disabled', true).addClass('disabled-transfer');
111             } else {
112                 $('#celldiv_'+cost_id).find('input:disabled').prop('disabled', false).removeClass('disabled-transfer');
113             }
114         }
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');
120
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' : '')+' />'
124             );
125             disable_transport_cost(cost_id, disabled);
126         }
127
128         function form_submit (f) {
129             $(f).find('input:disabled').prop('disabled', false);
130             return true;
131         }
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 );
136             });
137             $("body").on("blur",".cost_input",function(){
138                 check_transport_cost(this);
139             });
140             $("body").on("change",".disable_transport_cost",function(){
141                 disable_transport_cost_chg(this);
142             });
143             $("#cost_matrix_form").on("submit",function(){
144                 return form_submit(this);
145             });
146         });
147     </script>
148 [% END %]
149 [% INCLUDE 'intranet-bottom.inc' %]