This commit is contained in:
2023-09-24 13:16:11 +03:00
parent df5279e3f6
commit 0a4329ea67
9 changed files with 111 additions and 86 deletions

View File

@@ -410,7 +410,9 @@
}, remove: function () {
this.container.remove(), this.element.off(".daterangepicker"), this.element.removeData()
}
}, e.fn.daterangepicker = function (t, i) {
},
e.fn.daterangepicker = function (t, i) {
var s = e.extend(!0, {}, e.fn.daterangepicker.defaultOptions, t);
return this.each(function () {
var t = e(this);

4
static/js/jquery_3_2_1.js vendored Normal file

File diff suppressed because one or more lines are too long

7
static/js/moment_js.js Normal file

File diff suppressed because one or more lines are too long

View File

@@ -43,23 +43,23 @@
// });
// }
// });
function init_arrival_DT (){
$(function () {
let onl_param = ""
if (window.location.href === "http://localhost:8016/ru/profile/page/create_route_for_mover/" || window.location.href === "http://localhost:8016/ru/profile/page/create_route_for_customer/"){
onl_param = "singleDatePicker: true"
onl_param = "singleDatePicker"
}
let place_1 = document.querySelector("#id_arrival_DT")
if (place_1) {
$(place_1).daterangepicker({
"autoapply": true,
"linkedCalendars": false,
"singleDatePicker":true
},
function (start, end, label) {
// $('#displayRegervation').text('Registration date is: ' + start.format('YYYY-MM-DD') + ' to ' + end.format('YYYY-MM-DD'));
$('#id_arrival_DT').val(start.format('DD.MM.YYYY') + " - " + end.format('DD.MM.YYYY'))
$('#id_arrival_DT').val(start.format('DD.MM.YYYY'))
});
$(`${place_1.id} .drp-calendar.right`).hide();
@@ -74,7 +74,76 @@ $(function () {
el.append('<span></span>');
});
}
});
}
function init_departure_DT (){
let place_1 = document.querySelector("#id_departure_DT")
let onl_param = ""
if (window.location.href === "http://localhost:8016/ru/profile/page/create_route_for_mover/" || window.location.href === "http://localhost:8016/ru/profile/page/create_route_for_customer/"){
onl_param = "singleDatePicker"
}
if (place_1) {
$(place_1).daterangepicker({
"autoapply": true,
"linkedCalendars": false,
"singleDatePicker":true
},
function(start, end, label) {
// $('#displayRegervation').text('Registration date is: ' + start.format('YYYY-MM-DD') + ' to ' + end.format('YYYY-MM-DD'));
// $('#regervation')[0].dataset['departure_DT'] = start.format('YYYY-MM-DD');
// $('#regervation')[0].dataset['arrival_DT'] = end.format('YYYY-MM-DD');
$('#id_departure_DT').val(start.format('DD.MM.YYYY'))
});
$(`${place_1.id} .drp-calendar.right`).hide();
$(`${place_1.id} .drp-calendar.left`).addClass('single');
$(`${place_1.id} .calendar-table`).on('DOMSubtreeModified', function() {
var el = $(`${place_1.id} .prev.available`).parent().children().last();
if (el.hasClass('next available')) {
return;
}
el.addClass('next available');
el.append('<span></span>');
});
}
}
$(function () {
let onl_param = ""
if (window.location.href === "http://localhost:8016/ru/profile/page/create_route_for_mover/" || window.location.href === "http://localhost:8016/ru/profile/page/create_route_for_customer/"){
onl_param = "singleDatePicker: true"
}
let place_1 = document.querySelector("#id_arrival_DT")
if (place_1) {
$(place_1).daterangepicker({
"autoapply": true,
"linkedCalendars": false,
},
function (start, end, label) {
// $('#displayRegervation').text('Registration date is: ' + start.format('YYYY-MM-DD') + ' to ' + end.format('YYYY-MM-DD'));
$('#id_arrival_DT').val(start.format('DD.MM.YYYY') + " - " + end.format('DD.MM.YYYY'))
});
$(`${place_1.id} .drp-calendar.right`).hide();
$(`${place_1.id} .drp-calendar.left`).addClass('single');
$(`${place_1.id} .calendar-table`).on('DOMSubtreeModified', function () {
var el = $(`${place_1.id} .prev.available`).parent().children().last();
if (el.hasClass('next available')) {
return;
}
el.addClass('next available');
el.append('<span></span>');
});
}
});
$(function() {
let place_1 = document.querySelector("#id_departure_DT")

View File

@@ -571,76 +571,17 @@ function OnSelectionChange(el) {
// if(checkbox_width.childElementCount === 4){
// checkbox_width.classList.add('width')
// }
sliderInit();
$(function () {
let onl_param = ""
if (window.location.href === "http://localhost:8016/ru/profile/page/create_route_for_mover/" || window.location.href === "http://localhost:8016/ru/profile/page/create_route_for_customer/"){
onl_param = "singleDatePicker: true"
}
let place_1 = document.querySelector("#id_arrival_DT")
if (place_1) {
$(place_1).daterangepicker({
"autoapply": true,
"linkedCalendars": false,
sliderInit();
},
function (start, end, label) {
init_arrival_DT()
init_departure_DT()
// $('#displayRegervation').text('Registration date is: ' + start.format('YYYY-MM-DD') + ' to ' + end.format('YYYY-MM-DD'));
$('#id_arrival_DT').val(start.format('DD.MM.YYYY') + " - " + end.format('DD.MM.YYYY'))
});
$(`${place_1.id} .drp-calendar.right`).hide();
$(`${place_1.id} .drp-calendar.left`).addClass('single');
$(`${place_1.id} .calendar-table`).on('DOMSubtreeModified', function () {
var el = $(`${place_1.id} .prev.available`).parent().children().last();
if (el.hasClass('next available')) {
return;
}
el.addClass('next available');
el.append('<span></span>');
});
}
});
$(function() {
let place_1 = document.querySelector("#id_departure_DT")
let onl_param = ""
if (window.location.href === "http://localhost:8016/ru/profile/page/create_route_for_mover/" || window.location.href === "http://localhost:8016/ru/profile/page/create_route_for_customer/"){
onl_param = "singleDatePicker: true"
}
if (place_1) {
$(place_1).daterangepicker({
"autoapply": true,
"linkedCalendars": false,
onl_param
},
function(start, end, label) {
// $('#displayRegervation').text('Registration date is: ' + start.format('YYYY-MM-DD') + ' to ' + end.format('YYYY-MM-DD'));
// $('#regervation')[0].dataset['departure_DT'] = start.format('YYYY-MM-DD');
// $('#regervation')[0].dataset['arrival_DT'] = end.format('YYYY-MM-DD');
$('#id_departure_DT').val(start.format('DD.MM.YYYY') + " - " + end.format('DD.MM.YYYY'))
});
$(`${place_1.id} .drp-calendar.right`).hide();
$(`${place_1.id} .drp-calendar.left`).addClass('single');
$(`${place_1.id} .calendar-table`).on('DOMSubtreeModified', function() {
var el = $(`${place_1.id} .prev.available`).parent().children().last();
if (el.hasClass('next available')) {
return;
}
el.addClass('next available');
el.append('<span></span>');
});
}
});
}
});
};
}

View File

@@ -60,17 +60,17 @@
<label for="id_departure_DT">{{ form.fields.departure_DT.label }}</label>
<input
type="datetime-local"
min= {% now "Y-m-d" %}T{% now "H:i" %}
name="departure_DT"
onchange="checkDate()"
{% if form.fields.departure_DT.required %} required{% endif %}
id="id_departure_DT"
class="el_form_b_new_route"
placeholder="Выберите дату и время"
{% if form.initial.departure_DT %}value="{{ form.initial.departure_DT.date|date:"Y-m-d" }}T{{ form.initial.departure_DT.time|date:"H:i" }}"{% endif %}
/>
{# <input#}
{# type="datetime-local"#}
{# min= {% now "Y-m-d" %}T{% now "H:i" %}#}
{# name="departure_DT"#}
{# onchange="checkDate()"#}
{# {% if form.fields.departure_DT.required %} required{% endif %}#}
{# id="id_departure_DT"#}
{# class="el_form_b_new_route"#}
{# placeholder="Выберите дату и время"#}
{# {% if form.initial.departure_DT %}value="{{ form.initial.departure_DT.date|date:"Y-m-d" }}T{{ form.initial.departure_DT.time|date:"H:i" }}"{% endif %}#}
{# />#}
{# boris change input #}
<input class="el_form_find_route" type="text" id="id_departure_DT" name="departure_DT" placeholder="" {% if route_form.initial.departure_DT %} value="{{ route_form.initial.departure_DT }}"{% endif %}/>
<div id="displayRegervation"></div>

View File

@@ -13,6 +13,7 @@
{% include "connect_ws_js.html" %}
<script src="{% static "js/filters_functions_find_route.js" %}"></script>
<script src="{% static "js/dynamic_loading_routes.js" %}"></script>
{# <script src="{% static "js/range_calendar.js" %}"></script>#}
{% endblock %}

View File

@@ -3,7 +3,7 @@
{% block meta %}
<script src='{% static "js/jquery_v3_6_4.js" %}'> </script>
{# <script src='{% static "js/jquery_v3_6_4.js" %}'> </script>#}
<script src='{% static "js/ion.rangeSlider.min.js" %}'> </script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.css" rel="stylesheet">
<script src='{% static "js/user_profile.js" %}'> </script>

View File

@@ -8,12 +8,12 @@
<title>Title</title>
<script src='{% static "js/jquery_v3_6_4.js" %}'> </script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/jquery/latest/jquery.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/momentjs/latest/moment.min.js"></script>
{# <script src='{% static "js/jquery_v3_6_4.js" %}'> </script>#}
<script type="text/javascript" src="{% static "js/jquery_3_2_1.js" %}"></script>
<script type="text/javascript" src="{% static "js/moment_js.js" %}"></script>
<script type="text/javascript" src="{% static "js/datarangepicker.js" %}"></script>
<script src="{% static "js/rangecalendartech.js" %}"></script>
<script src="{% static "js/range_calendar.js" %}"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.css" />
@@ -45,7 +45,8 @@
{# <script src="{% static "js/range_calendar.js" %}"></script>#}
<script src="{% static "js/range_calendar.js" %}"></script>
{% block meta %}
{% endblock %}