adjusted pc booking widget date restriction
authorAnthony Talarico <talarico@gaslightmedia.com>
Mon, 25 Jan 2016 16:29:46 +0000 (11:29 -0500)
committerAnthony Talarico <talarico@gaslightmedia.com>
Mon, 25 Jan 2016 16:29:46 +0000 (11:29 -0500)
js/app.js
js/custom/pageSetup.js

index a0d5be7..e25c74f 100644 (file)
--- a/js/app.js
+++ b/js/app.js
@@ -51,20 +51,9 @@ $(document).ready(function () {
                 this.$currentDate = arrival_module.$arrive.datepicker('getDate');
                 this.$extraDay = arrival_module.$arrive.datepicker('getDate');
                 this.$extraDay.setDate(this.$extraDay.getDate() + 1);
-//                departure_module.$depart.datepicker("option", {minDate: new Date(this.$extraDay)});
-                this.$currentDate = new Date(this.$currentDate);
-                this.$currentDate  = new Date(this.$currentDate.getUTCFullYear(), this.$currentDate.getUTCMonth(), this.$currentDate.getUTCDate());
-                this.$currentDate.setDate(this.$currentDate.getDate());
-                this.d = this.$currentDate.getDate();
-                if (this.d <= 9) {
-                    this.d = '0' + this.d;
-                }
-                this.m = this.$currentDate.getMonth() + 1;
-                if (this.m <= 9) {
-                    this.m = '0' + this.m;
-                }
-                this.y = this.$currentDate.getFullYear();
-                }
+                departure_module.$depart.datepicker("option", {minDate: new Date(this.$extraDay)});
+            }
+               
             });
         }
     };
@@ -80,15 +69,13 @@ $(document).ready(function () {
         },
         bindEvents: function () {
             this.$depart.datepicker({
-                minDate: 1,
                 onSelect: function (date) {
                 this.$departure = departure_module.$depart.datepicker('getDate');
-                this.$nights = Math.ceil(this.$departure - arrival_module.$currentDate) / (1000 * 60 * 60 * 24);
             }
         });
     }
     };
-    
+
     var restab_module = {
         init: function (){
             this.cacheDOM();
@@ -128,7 +115,7 @@ $(document).ready(function () {
             });
             this.$input.blur(function () {
                 search_module.$form.animate({width: 'toggle'}, 1000);
-                    search_module.$search.css("visibility", "visible");
+                search_module.$search.css("visibility", "visible");
             });
         }
     };
@@ -138,7 +125,9 @@ $(document).ready(function () {
     search_module.init();
     $(".search_result_context").children("br").remove();
     
-        var extraDay, end, arrival, currentDate, currentDate2, requiredDate, requiredDate1, minDays, departure, stay, d, dd,  m, y;
+    
+    
+var extraDay, end, arrival, currentDate, currentDate2, requiredDate, requiredDate1, minDays, departure, stay, d, dd,  m, y;
    $(document).on('change', '#arriveOff', function () {
         currentDate = $("#arriveOff").val();
         currentDate = new Date(currentDate);
@@ -196,21 +185,4 @@ $(document).ready(function () {
          }
     });
 
-    
-
-    
-//    $("#block-1, #block-2, #block-3").click(function () {
-//       var $tmp = $(this).find("p");
-//       var $tmp2 = $(this).find("h2");
-//       var $tmp3 = $(this).find("a.blocks-readmore");
-//        
-//        $tmp.css("display", "inline-block");
-//        $tmp.css("padding", "0px 47px");
-//        $tmp.css("color", "white");
-//        $tmp.css("position", "relative");
-//        $tmp.css("top", "15px");
-//        
-//        $tmp2.css("position", "relative");
-//        $tmp2.css("top", "15px");
-//    });
 });
index 5c2a79e..3af7c49 100644 (file)
@@ -42,20 +42,9 @@ $(document).ready(function () {
                 this.$currentDate = arrival_module.$arrive.datepicker('getDate');
                 this.$extraDay = arrival_module.$arrive.datepicker('getDate');
                 this.$extraDay.setDate(this.$extraDay.getDate() + 1);
-//                departure_module.$depart.datepicker("option", {minDate: new Date(this.$extraDay)});
-                this.$currentDate = new Date(this.$currentDate);
-                this.$currentDate  = new Date(this.$currentDate.getUTCFullYear(), this.$currentDate.getUTCMonth(), this.$currentDate.getUTCDate());
-                this.$currentDate.setDate(this.$currentDate.getDate());
-                this.d = this.$currentDate.getDate();
-                if (this.d <= 9) {
-                    this.d = '0' + this.d;
-                }
-                this.m = this.$currentDate.getMonth() + 1;
-                if (this.m <= 9) {
-                    this.m = '0' + this.m;
-                }
-                this.y = this.$currentDate.getFullYear();
-                }
+                departure_module.$depart.datepicker("option", {minDate: new Date(this.$extraDay)});
+            }
+               
             });
         }
     };
@@ -71,15 +60,13 @@ $(document).ready(function () {
         },
         bindEvents: function () {
             this.$depart.datepicker({
-                minDate: 1,
                 onSelect: function (date) {
                 this.$departure = departure_module.$depart.datepicker('getDate');
-                this.$nights = Math.ceil(this.$departure - arrival_module.$currentDate) / (1000 * 60 * 60 * 24);
             }
         });
     }
     };
-    
+
     var restab_module = {
         init: function (){
             this.cacheDOM();
@@ -119,7 +106,7 @@ $(document).ready(function () {
             });
             this.$input.blur(function () {
                 search_module.$form.animate({width: 'toggle'}, 1000);
-                    search_module.$search.css("visibility", "visible");
+                search_module.$search.css("visibility", "visible");
             });
         }
     };
@@ -129,7 +116,9 @@ $(document).ready(function () {
     search_module.init();
     $(".search_result_context").children("br").remove();
     
-        var extraDay, end, arrival, currentDate, currentDate2, requiredDate, requiredDate1, minDays, departure, stay, d, dd,  m, y;
+    
+    
+var extraDay, end, arrival, currentDate, currentDate2, requiredDate, requiredDate1, minDays, departure, stay, d, dd,  m, y;
    $(document).on('change', '#arriveOff', function () {
         currentDate = $("#arriveOff").val();
         currentDate = new Date(currentDate);
@@ -187,21 +176,4 @@ $(document).ready(function () {
          }
     });
 
-    
-
-    
-//    $("#block-1, #block-2, #block-3").click(function () {
-//       var $tmp = $(this).find("p");
-//       var $tmp2 = $(this).find("h2");
-//       var $tmp3 = $(this).find("a.blocks-readmore");
-//        
-//        $tmp.css("display", "inline-block");
-//        $tmp.css("padding", "0px 47px");
-//        $tmp.css("color", "white");
-//        $tmp.css("position", "relative");
-//        $tmp.css("top", "15px");
-//        
-//        $tmp2.css("position", "relative");
-//        $tmp2.css("top", "15px");
-//    });
 });