bywatersolutions / koha-plugin-room-reservations

This repository is dedicated to the Koha Room Reservation plugin for use with Koha ILS.
GNU General Public License v3.0
4 stars 12 forks source link

Limiting time selections for rooms by day of the week #16

Open TLamanna opened 6 years ago

TLamanna commented 6 years ago

I can bulk remove time slots w/ jquery, but is there an option to allow time slot selections by the date they picked? We have different hours depending on the day of the week and want to make sure our room reservations reflect this.

ldjamison commented 6 years ago

Hi! So you are referring to almost like a "recurring blackout"? (see the wiki for more on what I mean by blackouts).

TLamanna commented 6 years ago

Exactly, I know I can use the blackouts to cover days we're closed, but for regular variable hours it would be nice to be able to limit slots by date selected. For some reason to jquery change() function is working, but I know I can .remove() a bunch of them (but can't make it selection dependent. I'm going to keep going on my workaround and I'll send you what I've done if you like.

Here's what I have for my jQuery for bulk removal:

($(document).ready(function(){

var pathname = window.location.href;
console.log(pathname)
if (pathname == "https://catalog.chplnj.org/booking#"){

$("option[value='00:00:00']").remove();
$("option[value='00:30:00']").remove();
$("option[value='01:00:00']").remove();
$("option[value='01:30:00']").remove();
$("option[value='02:00:00']").remove();
$("option[value='02:30:00']").remove();
$("option[value='03:00:00']").remove();
$("option[value='03:30:00']").remove();
$("option[value='04:00:00']").remove();
$("option[value='04:30:00']").remove();
$("option[value='05:00:00']").remove();
$("option[value='05:30:00']").remove();
$("option[value='06:00:00']").remove();
$("option[value='06:30:00']").remove();
$("option[value='07:00:00']").remove();
$("option[value='07:30:00']").remove();
$("option[value='08:00:00']").remove();
$("option[value='08:30:00']").remove();
$("option[value='09:00:00']").remove();
$("option[value='21:00:00']").remove();
$("option[value='21:30:00']").remove();
$("option[value='22:00:00']").remove();
$("option[value='22:30:00']").remove();
$("option[value='23:00:00']").remove();
$("option[value='23:30:00']").remove();    }
});)

Here's my attempt for an onchange by id, right now it's just an alert to get things to trigger, but my jsfiddle works when I copy/paste the code, but I'm not sure why it won't work via Koha (I don't see any errors in my console logs:

$(function() {
if (pathname == "https://catalog.chplnj.org/booking#"){
$("input[name='availability-search-start-date']").attr("readonly", false);
}
  $('#availability-search-start-date').datepicker({
    changeMonth: true,
    changeYear: true,
    showButtonPanel: true,
    dateFormat: 'MM yy',
    defaultDate: new Date(),
    onClose: function() {
      alert('test');
    }
  }).datepicker('setDate', new Date());
});

http://jsfiddle.net/FdfPY/487/

ldjamison commented 6 years ago

I think that certainly makes sense. I'll work on adding this in since it seems to be just a slight modification to the blackout feature. What version of the plugin are you using?

TLamanna commented 6 years ago

1.1.12

TLamanna commented 6 years ago

The blackout function works, but I think it would be more user friendly to have the blackout times/days be restricted on the drop down rather than just not showing an available room. Sorry for being such a pest.

ldjamison commented 6 years ago

Not a pest at all! I've been busy so I'm just getting back to enhancement work. I think this issue pairs in with Issue #11 as I think it functionally makes the most sense. I need to do a bit of prerequisite investigation into how the Koha calendar saves/populates but I feel that would be the best direction to take this. Let me know what you think