Widget:VisitSchedulerRedux: Difference between revisions
Jump to navigation
Jump to search
Matt Pijoan (talk | contribs) No edit summary |
Matt Pijoan (talk | contribs) No edit summary |
||
Line 6: | Line 6: | ||
$.noConflict(); | $.noConflict(); | ||
jQuery( document ).ready(function( $ ) { | jQuery( document ).ready(function( $ ) { | ||
$( "#indexEvent" ).val(""); | |||
$( "#visit-1" ).val(""); | |||
$( "#indexEvent" ).datepicker({minDate: new Date()}); | $( "#indexEvent" ).datepicker({minDate: new Date()}); | ||
$( "#visit-1" ).datepicker({minDate: new Date()}); | $( "#visit-1" ).datepicker({minDate: new Date()}); | ||
Line 81: | Line 83: | ||
$.each(timeConstraints, function(key, value){ | $.each(timeConstraints, function(key, value){ | ||
var updatedAppointment = new Date($("#visit-"+(key-1)).val()); | var updatedAppointment = new Date($("#visit-"+(key-1)).val()); | ||
$("#visit-"+key).css("border", " | $("#visit-"+key).css("border", "1px solid black"); | ||
if(key > 1 && key <= 4){ | if(key > 1 && key <= 4){ | ||
updatedAppointment = new Date(updatedAppointment.getFullYear(), updatedAppointment.getMonth(), updatedAppointment.getDate()+value[0]); | updatedAppointment = new Date(updatedAppointment.getFullYear(), updatedAppointment.getMonth(), updatedAppointment.getDate()+value[0]); | ||
Line 101: | Line 103: | ||
if(((new Date($("#visit-1").val()).getTime()+visit1hours+visit1minutes) - (new Date($("#indexEvent").val()).getTime()+hours+minutes)) < (12*60*60*1000)){ | if(((new Date($("#visit-1").val()).getTime()+visit1hours+visit1minutes) - (new Date($("#indexEvent").val()).getTime()+hours+minutes)) < (12*60*60*1000)){ | ||
errorFlag = true; | errorFlag = true; | ||
$("#visit-1").css("border", " | $("#visit-1").css("border", "1px solid red"); | ||
$("#visit-1").addClass("invalid"); | $("#visit-1").addClass("invalid"); | ||
} | } | ||
if((new Date($("#visit-2").val()).getTime() - new Date($("#visit-1").val()).getTime()) > (24*60*60*1000*30)){ | if((new Date($("#visit-2").val()).getTime() - new Date($("#visit-1").val()).getTime()) > (24*60*60*1000*30)){ | ||
errorFlag = true; | errorFlag = true; | ||
$("#visit-2").css("border", " | $("#visit-2").css("border", "1px solid red"); | ||
$("#visit-2").addClass("invalid"); | $("#visit-2").addClass("invalid"); | ||
} | } | ||
if((new Date($("#visit-3").val()).getTime() - new Date($("#visit-1").val()).getTime()) > (24*60*60*1000*30)){ | if((new Date($("#visit-3").val()).getTime() - new Date($("#visit-1").val()).getTime()) > (24*60*60*1000*30)){ | ||
errorFlag = true; | errorFlag = true; | ||
$("#visit-3").css("border", " | $("#visit-3").css("border", "1px solid red"); | ||
$("#visit-3").addClass("invalid"); | $("#visit-3").addClass("invalid"); | ||
} | } | ||
if((new Date($("#visit-4").val()).getTime() - new Date($("#visit-1").val()).getTime()) > (24*60*60*1000*30)){ | if((new Date($("#visit-4").val()).getTime() - new Date($("#visit-1").val()).getTime()) > (24*60*60*1000*30)){ | ||
errorFlag = true; | errorFlag = true; | ||
$("#visit-4").css("border", " | $("#visit-4").css("border", "1px solid red"); | ||
$("#visit-4").addClass("invalid"); | $("#visit-4").addClass("invalid"); | ||
} | } |