From 02398c8ade0854bf88c9a3246f142c8a9fc44a33 Mon Sep 17 00:00:00 2001 From: Anthony Talarico Date: Mon, 16 Nov 2015 11:25:38 -0500 Subject: [PATCH] changed off canvas res form from html5 date to datepicker --- js/app.js | 27 +++++++++++++++++++++++---- js/custom/pageSetup.js | 27 +++++++++++++++++++++++---- parts/off-canvas-menu.php | 4 ++-- 3 files changed, 48 insertions(+), 10 deletions(-) diff --git a/js/app.js b/js/app.js index f9f3f47..0cf1c58 100644 --- a/js/app.js +++ b/js/app.js @@ -66,10 +66,16 @@ $(document).ready(function () { $("#cal2").click(function () { $("#date2").datepicker("show"); }); + $("#offCal1").click(function () { + $("#dateOff1").datepicker("show"); + }); + $("#offCal2").click(function () { + $("#dateOff2").datepicker("show"); + }); $("#dateOff1").val("Arrive"); $("#dateOff2").val("Depart"); // restrict arrival date ////////////////////////////////////////////// - $(document).on('change', '#dateOff1', function () { + /* $(document).on('change', '#dateOff1', function () { currentDate = $("#dateOff1").val(); currentDate = new Date(currentDate); currentDate = new Date(currentDate.getUTCFullYear(), currentDate.getUTCMonth(), currentDate.getUTCDate()); @@ -103,9 +109,9 @@ $(document).ready(function () { $("#dateOff2").val(requiredDate); } - }); + });*/ // restrict departure date /////////////////////////////// - $(document).on('change', '#dateOff2', function () { + /* $(document).on('change', '#dateOff2', function () { currentDate = $("#dateOff1").val(); currentDate = new Date(currentDate); currentDate = new Date(currentDate.getUTCFullYear(), currentDate.getUTCMonth(), currentDate.getUTCDate()); @@ -123,7 +129,7 @@ $(document).ready(function () { if ($("#dateOff2").val() < $('#dateOff2').attr("min")) { // $("#dateOff2").val(requiredDate); } - }); + });*/ $("#date1").datepicker({ minDate: 2, onSelect: function (date) { @@ -134,10 +140,23 @@ $(document).ready(function () { arrival = $("#date1").val(); } }); + $("#dateOff1").datepicker({ + minDate: 2, + onSelect: function (date) { + $("#dateOff1").datepicker({dateFormat: 'yy-mm-dd'}).val(); + nights = $("#dateOff1").datepicker('getDate'); + nights.setDate(nights.getDate() + 2); + $("#dateOff2").datepicker("option", {minDate: new Date(nights)}); + arrival = $("#dateOff1").val(); + } + }); //$("#date2").val(requiredDate); $("#date2").datepicker({ onSelect: function (date) { } + }); + $("#dateOff2").datepicker({ + }); // off canvas menu values ///////////////////////// $('#offGuests').blur(function () { diff --git a/js/custom/pageSetup.js b/js/custom/pageSetup.js index 59365c7..99820e0 100644 --- a/js/custom/pageSetup.js +++ b/js/custom/pageSetup.js @@ -57,10 +57,16 @@ $(document).ready(function () { $("#cal2").click(function () { $("#date2").datepicker("show"); }); + $("#offCal1").click(function () { + $("#dateOff1").datepicker("show"); + }); + $("#offCal2").click(function () { + $("#dateOff2").datepicker("show"); + }); $("#dateOff1").val("Arrive"); $("#dateOff2").val("Depart"); // restrict arrival date ////////////////////////////////////////////// - $(document).on('change', '#dateOff1', function () { + /* $(document).on('change', '#dateOff1', function () { currentDate = $("#dateOff1").val(); currentDate = new Date(currentDate); currentDate = new Date(currentDate.getUTCFullYear(), currentDate.getUTCMonth(), currentDate.getUTCDate()); @@ -94,9 +100,9 @@ $(document).ready(function () { $("#dateOff2").val(requiredDate); } - }); + });*/ // restrict departure date /////////////////////////////// - $(document).on('change', '#dateOff2', function () { + /* $(document).on('change', '#dateOff2', function () { currentDate = $("#dateOff1").val(); currentDate = new Date(currentDate); currentDate = new Date(currentDate.getUTCFullYear(), currentDate.getUTCMonth(), currentDate.getUTCDate()); @@ -114,7 +120,7 @@ $(document).ready(function () { if ($("#dateOff2").val() < $('#dateOff2').attr("min")) { // $("#dateOff2").val(requiredDate); } - }); + });*/ $("#date1").datepicker({ minDate: 2, onSelect: function (date) { @@ -125,10 +131,23 @@ $(document).ready(function () { arrival = $("#date1").val(); } }); + $("#dateOff1").datepicker({ + minDate: 2, + onSelect: function (date) { + $("#dateOff1").datepicker({dateFormat: 'yy-mm-dd'}).val(); + nights = $("#dateOff1").datepicker('getDate'); + nights.setDate(nights.getDate() + 2); + $("#dateOff2").datepicker("option", {minDate: new Date(nights)}); + arrival = $("#dateOff1").val(); + } + }); //$("#date2").val(requiredDate); $("#date2").datepicker({ onSelect: function (date) { } + }); + $("#dateOff2").datepicker({ + }); // off canvas menu values ///////////////////////// $('#offGuests').blur(function () { diff --git a/parts/off-canvas-menu.php b/parts/off-canvas-menu.php index 975dbcd..dc410c2 100644 --- a/parts/off-canvas-menu.php +++ b/parts/off-canvas-menu.php @@ -24,11 +24,11 @@
- +
- +
-- 2.17.1