From 67dc72327d8cc4ef6612ed66cecdf76b73a1e47e Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 11 Jan 2024 11:14:27 +0000 Subject: [PATCH] Bug 35248: Whitespace clean Jonathan highlighted some trailing whitespace.. I only see a few cases where a line only contains whitespace and I didn't see these caught by the QA script at the time of submission. Anyway, this removes the spaces --- .../prog/js/place_booking_modal.js | 74 +++++++++---------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/place_booking_modal.js b/koha-tmpl/intranet-tmpl/prog/js/place_booking_modal.js index b4f13bf2d99..946be01e3cd 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/place_booking_modal.js +++ b/koha-tmpl/intranet-tmpl/prog/js/place_booking_modal.js @@ -121,7 +121,7 @@ $('#placeBookingModal').on('show.bs.modal', function(e) { dataType: 'json', type: 'GET' }); - + // Fetch list of existing bookings let bookingsFetch = $.ajax({ url: '/api/v1/bookings?biblio_id=' + biblionumber, @@ -135,7 +135,7 @@ $('#placeBookingModal').on('show.bs.modal', function(e) { dataType: 'json', type: 'GET' }); - + // Update item select2 and period flatpickr $.when(itemsFetch, bookingsFetch, checkoutsFetch).then( function(itemsFetch,bookingsFetch, checkoutsFetch){ @@ -157,7 +157,7 @@ $('#placeBookingModal').on('show.bs.modal', function(e) { }; bookings.unshift(booking); } - + // Item select2 $("#booking_item_id").select2({ dropdownParent: $(".modal-content", "#placeBookingModal"), @@ -166,13 +166,13 @@ $('#placeBookingModal').on('show.bs.modal', function(e) { minimumResultsForSearch: 20, placeholder: __("Select item") }); - + // Update flatpickr mode periodPicker.set('mode', 'range'); - + // Total bookable items let bookable = 0; - + for (item of bookable_items) { bookable++; // Populate item select (NOTE: Do we still need this check for pre-existing select option here?) @@ -183,29 +183,29 @@ $('#placeBookingModal').on('show.bs.modal', function(e) { $('#booking_item_id').append(newOption); } } - + // Set disable function for periodPicker let disableExists = periodPicker.config.disable.filter(f => f.name === 'dateDisable'); if ( disableExists.length === 0 ) { periodPicker.config.disable.push(function dateDisable(date){ - + // set local copy of selectedDates let selectedDates = periodPicker.selectedDates; - + // set booked counter let booked = 0; - + // reset the unavailable items array let unavailable_items = []; - + // reset the biblio level bookings array let biblio_bookings = []; - + // disable dates before selected date if (!selectedDates[1] && (selectedDates[0] && selectedDates[0] > date)) { return true; } - + // iterate existing bookings for (booking of bookings) { @@ -216,10 +216,10 @@ $('#placeBookingModal').on('show.bs.modal', function(e) { let start_date = flatpickr.parseDate(booking.start_date); let end_date = flatpickr.parseDate(booking.end_date); - + // patron has selected a start date (end date checks) if (selectedDates[0]) { - + // new booking start date is between existing booking start and end dates if (selectedDates[0] >= start_date && selectedDates[0] <= end_date) { if (booking.item_id) { @@ -232,7 +232,7 @@ $('#placeBookingModal').on('show.bs.modal', function(e) { } } } - + // new booking end date would be between existing booking start and end dates else if (date >= start_date && date <= end_date) { if (booking.item_id) { @@ -245,7 +245,7 @@ $('#placeBookingModal').on('show.bs.modal', function(e) { } } } - + // new booking would span existing booking else if (selectedDates[0] <= start_date && date >= end_date) { if (booking.item_id) { @@ -258,12 +258,12 @@ $('#placeBookingModal').on('show.bs.modal', function(e) { } } } - + // new booking would not conflict else { continue; } - + // check that there are available items // available = all bookable items - booked items - booked biblios let total_available = bookable_items.length - unavailable_items.length - biblio_bookings.length; @@ -271,21 +271,21 @@ $('#placeBookingModal').on('show.bs.modal', function(e) { return true; } } - + // patron has not yet selected a start date (start date checks) else if (date <= end_date && date >= start_date) { - + // same item, disable date if (booking.item_id && booking.item_id == booking_item_id) { return true; } - + // count all clashes, both item and biblio level booked++; if (booked == bookable) { return true; } - + // FIXME: The above is not intelligent enough to spot // cases where an item must be used for a biblio level booking // due to all other items being booking within the biblio level @@ -301,15 +301,15 @@ $('#placeBookingModal').on('show.bs.modal', function(e) { } }); }; - + // Setup listener for item select2 $('#booking_item_id').on('select2:select', function(e) { booking_item_id = e.params.data.id ? e.params.data.id : null; - + // redraw pariodPicker taking selected item into account periodPicker.redraw(); }); - + // Set onChange for flatpickr let changeExists = periodPicker.config.onChange.filter(f => f.name ==='periodChange'); if(changeExists.length === 0) { @@ -321,7 +321,7 @@ $('#placeBookingModal').on('show.bs.modal', function(e) { let picker_end = dayjs(selectedDates[1]).endOf('day'); $('#booking_start_date').val(picker_start.toISOString()); $('#booking_end_date').val(picker_end.toISOString()); - + // set available items in select2 let booked_items = bookings.filter(function(booking) { let start_date = flatpickr.parseDate(booking.start_date); @@ -360,18 +360,18 @@ $('#placeBookingModal').on('show.bs.modal', function(e) { } }); }; - + // Enable flatpickr now we have date function populated periodPicker.redraw(); $("#period_fields :input").prop('disabled', false); - + // Redraw select with new options and enable $('#booking_item_id').trigger('change'); $("#booking_item_id").prop("disabled", false); // Set the flag to indicate that data has been fetched dataFetched = true; - + // Set form values setFormValues(patron_id,booking_item_id,start_date,end_date,periodPicker); }, @@ -459,7 +459,7 @@ $("#placeBookingForm").on('submit', function(e) { "patron_id": $('#booking_patron_id').find(':selected').val() }) ); - + posting.done(function(data) { // Update bookings store for subsequent bookings bookings.push(data); @@ -485,14 +485,14 @@ $("#placeBookingForm").on('submit', function(e) { }); timeline.focus(data.booking_id); } - + // Update bookings counts $('.bookings_count').html(parseInt($('.bookings_count').html(), 10)+1); - + // Close modal $('#placeBookingModal').modal('hide'); }); - + posting.fail(function(data) { $('#booking_result').replaceWith('
'+_("Failure")+'
'); }); @@ -510,7 +510,7 @@ $("#placeBookingForm").on('submit', function(e) { "patron_id": $('#booking_patron_id').find(':selected').val() }) }); - + putting.done(function(data) { update_success = 1; @@ -539,11 +539,11 @@ $("#placeBookingForm").on('submit', function(e) { }); timeline.focus(data.booking_id); } - + // Close modal $('#placeBookingModal').modal('hide'); }); - + putting.fail(function(data) { $('#booking_result').replaceWith('
'+__("Failure")+'
'); }); -- 2.43.0