Lines 106-118
Link Here
|
106 |
[% MACRO jsinclude BLOCK %] |
106 |
[% MACRO jsinclude BLOCK %] |
107 |
[% Asset.js("js/admin-menu.js") | $raw %] |
107 |
[% Asset.js("js/admin-menu.js") | $raw %] |
108 |
<script> |
108 |
<script> |
109 |
function check_transport_cost(e) { |
|
|
110 |
var val = e.value; |
111 |
if (val && val != "" && !isNaN(parseFloat(val)) && val >= 0.0) { |
112 |
return; |
113 |
} |
114 |
alert(_("Cost must be expressed as a decimal number >= 0")); |
115 |
} |
116 |
function disable_transport_cost_chg(e) { |
109 |
function disable_transport_cost_chg(e) { |
117 |
var input_name = e.name; |
110 |
var input_name = e.name; |
118 |
var cost_id = input_name.replace(/disable_/, ""); // Parse the code_id out of the input name |
111 |
var cost_id = input_name.replace(/disable_/, ""); // Parse the code_id out of the input name |
Lines 138-148
Link Here
|
138 |
$(cell).removeClass("disabled-transfer"); |
131 |
$(cell).removeClass("disabled-transfer"); |
139 |
|
132 |
|
140 |
$("#celldiv_" + cost_id).html( |
133 |
$("#celldiv_" + cost_id).html( |
141 |
'<input type="text" name="cost_' + |
134 |
'<input type="text" inputmode="numeric" pattern="^((0|[1-9]\\d*)(\\.\\d{1,2})?|\\.\\d{1,2})$" name="cost_' + |
142 |
cost_id + |
135 |
cost_id + |
143 |
'" class="cost_input" size="4" value="' + |
136 |
'" class="cost_input" size="4" value="' + |
144 |
$.trim(cost) + |
137 |
$.trim(cost) + |
145 |
'" />' + |
138 |
'" required/>' + |
146 |
"<br/>" + |
139 |
"<br/>" + |
147 |
_("Disable ") + |
140 |
_("Disable ") + |
148 |
'<input name="disable_' + |
141 |
'<input name="disable_' + |
Lines 163-171
Link Here
|
163 |
var cost_id = $(this).data("cost-id"); |
156 |
var cost_id = $(this).data("cost-id"); |
164 |
enable_cost_input(cost_id); |
157 |
enable_cost_input(cost_id); |
165 |
}); |
158 |
}); |
166 |
$("body").on("blur", ".cost_input", function () { |
|
|
167 |
check_transport_cost(this); |
168 |
}); |
169 |
$("body").on("change", ".disable_transport_cost", function () { |
159 |
$("body").on("change", ".disable_transport_cost", function () { |
170 |
disable_transport_cost_chg(this); |
160 |
disable_transport_cost_chg(this); |
171 |
}); |
161 |
}); |
172 |
- |
|
|