<commit_before>{% extends "auth_base.html" %}
{% load filters %}

{% block title %}Request To Borrow{% endblock %}

{% block BrowseNav %} active {% endblock %}
{% load staticfiles %}
{% block javascript %}
    {{ block.super }}
    <script type="text/javascript" src="{% static "scripts/bootstrap-datepicker.js" %}"></script>
    <script type="text/javascript">
        var unavailable_dates = {{ form.unavailable_dates|safe }};

        $(document).ready(function () {
            $('.datepicker').datepicker({autoclose: true, beforeShowDay: onBeforeShowDay, startDate: new Date()});

            $('#{{ form.from_date.auto_id }}').datepicker()
                    .on('changeDate', function (e) {
                        $('#{{ form.to_date.auto_id }}')
                                .datepicker('setStartDate', $('#{{ form.from_date.auto_id }}').val());
                    });
        });

        function onBeforeShowDay(date) {
            for (var index = 0; index < unavailable_dates.length; index++) {
                sd = new Date(unavailable_dates[index].start);
                ed = new Date(unavailable_dates[index].end);
                if (sd <= date && date <= ed) {
                    return {'enabled': false, 'classes': 'unavailable', 'tooltip': 'Tool is not available on this day.'};
                }
            }
            return {'enabled': true, 'classes': '', 'tooltip': ' '};
        }
    </script>
{% endblock %}
{% block stylesheets %}
    {{ block.super }}
    <link href="{% static "styles/datepicker3.css" %}" rel="stylesheet"/>
{% endblock %}
{% block head %}
    <style type="text/css"><commit_msg>Fixed unintended date picker behavior where user could pick the end dates of reservations or blackout dates<commit_after>{% extends "auth_base.html" %}
{% load filters %}

{% block title %}Request To Borrow{% endblock %}

{% block BrowseNav %} active {% endblock %}
{% load staticfiles %}
{% block javascript %}
    {{ block.super }}
    <script type="text/javascript" src="{% static "scripts/bootstrap-datepicker.js" %}"></script>
    <script type="text/javascript">
        var unavailable_dates = {{ form.unavailable_dates|safe }};

        $(document).ready(function () {
            $('.datepicker').datepicker({autoclose: true, beforeShowDay: onBeforeShowDay, startDate: new Date()});

            $('#{{ form.from_date.auto_id }}').datepicker()
                    .on('changeDate', function (e) {
                        $('#{{ form.to_date.auto_id }}')
                                .datepicker('setStartDate', $('#{{ form.from_date.auto_id }}').val());
                    });
        });

        function onBeforeShowDay(date) {
            for (var index = 0; index < unavailable_dates.length; index++) {
                sd = new Date(unavailable_dates[index].start);
                ed = new Date(unavailable_dates[index].end);
                ed.setDate(ed.getDate() + 1);
                if (sd <= date && date <= ed) {
                    return {'enabled': false, 'classes': 'unavailable', 'tooltip': 'Tool is not available on this day.'};
                }
            }
            return {'enabled': true, 'classes': '', 'tooltip': ' '};
        }
    </script>
{% endblock %}
{% block stylesheets %}
    {{ block.super }}
    <link href="{% static "styles/datepicker3.css" %}" rel="stylesheet"/>
{% endblock %}
{% block head %}
    <style type="text/css">
{'fraction_non_alphanumeric': 0.17261556465769456, 'fraction_numerical': 0.001462843768285547, 'mean_word_length': 2.3001930501930503, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '890264', 'n_tokens_mistral': 1010, 'n_tokens_neox': 906, 'n_words': 219}