Bug 29459: Replace some missed datetimepickers in circulation templates with Flatpickr
This patch updates a few more instances of jQueryUI datepickers which were missed initially, replacing them with Flatpickr widgets. Also changed: A few datetime input fields are updated to have a size of 20, consistent with other datetime input fields. To test, apply the patch and go to Circulation. Check in: - With the 'SpecifyReturnDate' system preference enabled, go to Check in. - Click the "Checkin settings" link. - Test the "Specify return date" field. Clicking it should trigger a Flatpickr widget with a time picker. It should limit your selection to dates in the past. - Check the "Remember return date" checkbox and confirm that the date is preserved over page reloads. - Check and uncheck the "Box drop mode" checkbox to confirm that the return date field is disabled and enabled correctly. Check out: - With the 'AllowRenewalOnHoldOverride' preference enabled, check out to a patron who has a checkout which is on hold for another patron. - At the bottom of the table of checkouts, click the "Override renewal restrictions" checkbox. - The on-hold checkouts should now have a checkbox in the "Renew" column. Check one or more of these checkboxes. - In the table footer you should now see two date inputs, "Renewal due date" and "On hold due date." These should both trigger Flatpickr widgets with time pickers. - Confirm that your date selections are submitted correctly when you renew items. ILL checkout: - Create a new ILL request with the type "book," filling in at least title, patron, and destination library. - On the "Manage ILL request" page, click "Confirm request" and "Confirm request" on the next confirmation page. - There should now be a "Check out" button in the "Manage ILL request" toolbar. Click it. - Test the "Due date" field. It should trigger a Flatpickr widget with a time picker. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
0d06aa52c6
commit
5b5b443d6c
4 changed files with 21 additions and 59 deletions
|
@ -10,8 +10,8 @@
|
|||
<td colspan="3">
|
||||
[% END %]
|
||||
<div class="date-select">
|
||||
<p><label for="newduedate">Renewal due date:</label> <input type="text" size="12" id="newduedate" name="newduedate" value="" /></p>
|
||||
<p id="newonholdduedate"><label for="newonholdduedate">On hold due date:</label> <input type="text" size="12" name="newonholdduedate" value="" /></p>
|
||||
<p><label for="newduedate">Renewal due date:</label> <input type="text" size="20" id="newduedate" name="newduedate" value="" /></p>
|
||||
<p id="newonholdduedate"><label for="newonholdduedate">On hold due date:</label> <input type="text" size="20" name="newonholdduedate" value="" /></p>
|
||||
<p><label for="exemptfine">Forgive fines on return:</label> <input type="checkbox" id="exemptfine" name="exemptfine" value="1" /></p>
|
||||
</div>
|
||||
</td>
|
||||
|
|
|
@ -808,11 +808,8 @@
|
|||
<div class="date-select" id="return_date_override_fields">
|
||||
<div class="hint">Specify return date [% INCLUDE 'date-format.inc' %]: </div>
|
||||
|
||||
<input type="text" size="13" id="return_date_override" name="return_date_override" value="[% return_date_override | html %]" />
|
||||
<input type="text" size="20" class="pastdate" id="return_date_override" name="return_date_override" value="[% return_date_override | html %]" />
|
||||
|
||||
|
||||
|
||||
<button type="button" class="action btn btn-default btn-xs" id="cleardate" name="cleardate">Clear</button>
|
||||
<div class="circ-setting">
|
||||
[% IF ( return_date_override_remember ) %]
|
||||
<input type="checkbox" id="return_date_override_remember" name="return_date_override_remember" checked="checked" />
|
||||
|
@ -1041,44 +1038,15 @@
|
|||
"dom": 'B<"clearfix">t',
|
||||
}, columns_settings);
|
||||
|
||||
$("#return_date_override").datetimepicker({
|
||||
onClose: function(dateText, inst) {
|
||||
if (validate_date(dateText, inst) ) {
|
||||
$("#barcode").focus();
|
||||
}
|
||||
},
|
||||
defaultDate: -1,
|
||||
hour: 23,
|
||||
minute: 59,
|
||||
maxDate: 0
|
||||
}).on("change", function(e, value) {
|
||||
if ( ! is_valid_date( $(this).val() ) ) {$(this).val("");}
|
||||
});
|
||||
$("#return_date_override").on("blur", function() {
|
||||
check_valid_return_date();
|
||||
});
|
||||
$("#checkin-form").submit(function( event ) {
|
||||
if ( !check_valid_return_date() ) {
|
||||
event.preventDefault();
|
||||
$("#return_date_override").flatpickr({
|
||||
enableTime: true,
|
||||
dateFormat: flatpickr_dateformat_string + " " + flatpickr_timeformat_string,
|
||||
maxDate: "today",
|
||||
onClose: function() {
|
||||
$("#barcode").focus();
|
||||
}
|
||||
});
|
||||
|
||||
function check_valid_return_date() {
|
||||
if ( $("#return_date_override").val() ) {
|
||||
var datetime = DateTime_from_syspref( $("#return_date_override").val() );
|
||||
var now = new Date();
|
||||
if ( !datetime || datetime > now ) {
|
||||
alert("Invalid return date/time!");
|
||||
$("#return_date_override").val("")
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// Add saved date information to onscreen message, which
|
||||
// may or may not be hidden
|
||||
$("#saved_return_date").text( $("#return_date_override").val() );
|
||||
return true;
|
||||
}
|
||||
|
||||
$("#exemptcheck").change(function () {
|
||||
if (this.checked == true) {
|
||||
$("#barcode").addClass("input-warning");
|
||||
|
@ -1089,22 +1057,22 @@
|
|||
}
|
||||
$("#barcode").focus();
|
||||
});
|
||||
|
||||
$("#dropboxcheck").change(function () {
|
||||
if (this.checked == true) {
|
||||
$("#barcode").addClass("input-warning");
|
||||
$("#dropboxmode").show();
|
||||
|
||||
$("#return_date_override_fields :input").prop('disabled', true);
|
||||
$("#return_date_override").datetimepicker("disable");
|
||||
} else {
|
||||
$("#barcode").removeClass("input-warning");
|
||||
$("#dropboxmode").hide();
|
||||
|
||||
$("#return_date_override_fields :input").prop('disabled', false);
|
||||
$("#return_date_override").datetimepicker("enable");
|
||||
}
|
||||
$("#barcode").focus();
|
||||
});
|
||||
|
||||
$("#forgivemanualholdsexpire").change(function () {
|
||||
if (this.checked == true) {
|
||||
$("#barcode").addClass("input-warning");
|
||||
|
|
|
@ -839,12 +839,12 @@
|
|||
var prefilters = '[% prefilters | $raw %]';
|
||||
// Set column settings
|
||||
var columns_settings = [% TablesSettings.GetColumns( 'illrequests', 'ill-requests', 'ill-requests', 'json' ) %];
|
||||
$("#ill_checkout_duedate_input").datetimepicker({
|
||||
hour: 23,
|
||||
minute: 59
|
||||
}).on("change", function(e, value) {
|
||||
if ( ! is_valid_date( $(this).val() ) ) {$(this).val("");}
|
||||
|
||||
$("#ill_checkout_duedate_input").flatpickr({
|
||||
enableTime: true,
|
||||
dateFormat: flatpickr_dateformat_string + " " + flatpickr_timeformat_string,
|
||||
});
|
||||
|
||||
[% IF services_json.length > 0 %]
|
||||
var services = [% services_json | $raw %];
|
||||
[% ELSE %]
|
||||
|
|
|
@ -29,17 +29,6 @@ $(document).ready(function() {
|
|||
radioCheckBox($(this));
|
||||
});
|
||||
|
||||
$("#newduedate, #newonholdduedate input").datetimepicker({
|
||||
onClose: function(dateText, inst) {
|
||||
validate_date(dateText, inst);
|
||||
},
|
||||
minDate: 1, // require that renewal date is after today
|
||||
hour: 23,
|
||||
minute: 59
|
||||
}).on("change", function(e) {
|
||||
if ( ! is_valid_date( $(this).val() ) ) {$(this).val("");}
|
||||
});
|
||||
|
||||
$("#duedatespec").flatpickr({
|
||||
enableTime: true,
|
||||
dateFormat: flatpickr_dateformat_string + " " + flatpickr_timeformat_string,
|
||||
|
@ -48,6 +37,11 @@ $(document).ready(function() {
|
|||
}
|
||||
});
|
||||
|
||||
$("#newduedate, #newonholdduedate input").flatpickr({
|
||||
enableTime: true,
|
||||
dateFormat: flatpickr_dateformat_string + " " + flatpickr_timeformat_string,
|
||||
});
|
||||
|
||||
$(".clear_date").on("click", function(){
|
||||
$("#stickyduedate").prop( "checked", false );
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue