Koha/koha-tmpl/intranet-tmpl/prog/js/pages/circulation.js
Owen Leonard f748443822
Bug 20959: Style checkin form more like the checkout form, with collapsed settings panel
This patch modifies the structure of the checkin form so that settings
(Specify return date, book drop mode, forgive overdue charges) are in a
collapsed panel when inactive. The style of the barcode field and the
mode notification messages has been changed to reduce the vertical
motion of the form when selecting options.

Some class names have been changed in circulation.tt and circulation.js
to make them appropriate for use on both forms.

To test, apply the patch and rebuild the staff client CSS
(https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and_staff_client).
Clear your browser cache if necessary.

 - View the checkin page. The "checkin settings" panel should be
   collapsed by default.
 - Confirm that the settings panel collapses and expands as it should.
 - Confirm that selecting "Forgive overdue charges" or "Book drop mode"
   trigger the display of the correct message and that the style of the
   barcode field is changed.
 - Confirm that after submitting a barcode for check-in, the
   settings panel stays open and your selected settings are still
   selected.
 - Confirm that specifying a due date and selecting "remember" shows
   a new message with the selected date.
   - Confirm that unchecking "remember" hides the message.
   - Confirm that date settings are remembered and the correct message
     displayed (or not) during check-in.
 - Test with CircSidebar enabled and disabled.

Signed-off-by: Arthur Bousquet <arthur.bousquet@inlibro.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-07-02 09:17:36 +01:00

147 lines
4.3 KiB
JavaScript

$(document).ready(function() {
$("#CheckAllExports").on("click",function(){
$(".export:visible").prop("checked", true);
return false;
});
$("#UncheckAllExports").on("click",function(){
$(".export:visible").prop("checked", false);
return false;
});
$('#patronlists').tabs({
activate: function( event, ui ) {
$('#'+ui.newTab.context.id).click();
}
});
$("#borrower_messages .cancel").on("click",function(){
$("#add_message_form").hide();
$("#addmessage").show();
});
$("#addmessage").on("click",function(){
$(this).hide();
$("#add_message_form").show();
});
$("input.radio").on("click",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").datetimepicker({
onClose: function(dateText, inst) {
if ( validate_date(dateText, inst) ) {
$("#barcode").focus();
}
},
hour: 23,
minute: 59
}).on("change", function(e, value) {
if ( ! is_valid_date( $(this).val() ) ) {$(this).val("");}
});
$("#export_submit").on("click",function(){
export_checkouts($("#issues-table-output-format").val());
return false;
});
var circ_settings = $(".circ-settings");
var circ_settings_icon = $(".circ-settings-icon");
// If any checkboxes in the circ settings are selected, show the settings by default
if ( $(".circ-settings input:checked,#duedatespec[value!='']").length ) {
circ_settings.show();
circ_settings_icon.removeClass("fa-caret-right").addClass("fa-caret-down");
} else {
circ_settings.hide();
circ_settings_icon.removeClass("fa-caret-down").addClass("fa-caret-right");
}
$("#show-circ-settings a").on("click",function(){
if( circ_settings.is(":hidden")){
circ_settings.show();
circ_settings_icon.removeClass("fa-caret-right").addClass("fa-caret-down");
} else {
$("#barcode").focus();
circ_settings.hide();
circ_settings_icon.removeClass("fa-caret-down").addClass("fa-caret-right");
}
});
$(".circ_setting").on("click",function(){
$("#barcode").focus();
});
$("#itemSearchFallback").ready(function(){
$("#itemSearchFallback").modal("show");
});
// Debarments
$("div#reldebarments .remove_restriction").on("click",function(){
return confirm(_("Remove restriction?"));
});
var mrform = $("#manual_restriction_form");
var mrlink = $("#add_manual_restriction");
mrform.hide();
mrlink.on("click",function(e){
$(this).hide();
mrform.show();
e.preventDefault();
});
$("#cancel_manual_restriction").on("click",function(e){
mrlink.show();
mrform.hide();
e.preventDefault();
});
$(".clear-date").on("click",function(e){
e.preventDefault();
var fieldID = this.id.replace("clear-date-","");
$("#" + fieldID).val("");
});
});
function export_checkouts(format) {
if ($("input:checkbox[name='biblionumbers']:checked").length < 1){
alert(MSG_EXPORT_SELECT_CHECKOUTS);
return;
}
$("input:checkbox[name='biblionumbers']").each( function(){
var input_item = $(this).siblings("input:checkbox");
if ( $(this).is(":checked") ) {
$(input_item).prop("checked", true);
} else {
$(input_item).prop("checked", false);
}
} );
if (format == 'iso2709_995') {
format = 'iso2709';
$("#dont_export_item").val(0);
} else if (format == 'iso2709') {
$("#dont_export_item").val(1);
}
document.getElementById("output_format").value = format;
document.issues.submit();
}
function validate1(date) {
var today = new Date();
if ( date < today ) {
return true;
} else {
return false;
}
}