Widget:VisitSchedulerRedux: Difference between revisions
Jump to navigation
Jump to search
Matt Pijoan (talk | contribs) Created page with "<includeonly> <link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jq..." |
Matt Pijoan (talk | contribs) No edit summary |
||
Line 6: | Line 6: | ||
$(document).ready(function(){ | $(document).ready(function(){ | ||
$( "#indexEvent" ).datepicker(); | $( "#indexEvent" ).datepicker(); | ||
$( "#indexEvent" ).change(function(){ | |||
var schedule = visitSchedule($("patientID").val(),$("#assigned").val(),new Date($( "#indexEvent" ).val())); | |||
}); | |||
function visitSchedule(patient, assigned, index){ | function visitSchedule(patient, assigned, index){ | ||
var timeConstraints = { | var timeConstraints = { | ||
// VisitNum : [Days from Infusion 1, Window + Days, Window - Days, Window + Hours, Window - Hours, Visit, Visit Description, Short Visit Description] | // VisitNum : [Days from Infusion 1, Window + Days, Window - Days, Window + Hours, Window - Hours, Visit, Visit Description, Short Visit Description] | ||
1: [0, 5, 0, | 1 : [0, 5, 0, 12, 0, "Visit 2", "Infusion 1 of investigational product should occur no earlier than 12 h after IV contrast and be dosed within 5 days of First Medical Contact. Subjects who are to undergo angiography and, therefore, receive IV contrast agent must have stable renal function.", "Infusion 1"], | ||
2: [1, | 2 : [7, 1, 2, 0, 0, "Visit 3", "Infusion 2 should occur approximately 7 (-2/+1) days after the 1st infusion (Visit 2) with a minimum window between infusions of at least 5 days.", "Infusion 2"], | ||
3: [ | 3 : [14, 1, 2, 0, 0, "Visit 4", "Infusion 3 should occur approximately 7 (-2/+1) days after the 2nd infusion (Visit 3) with a minimum window between infusions of at least 5 days.", "Infusion 3"], | ||
4: [ | 4 : [21, 1, 2, 0, 0, "Visit 5", "Infusion 4 should occur approximately 7 (-2/+1) days after the 3rd infusion (Visit 4) with a minimum window between infusions of at least 5 days. This infusion must be given within 30 days of the 1st infusion.", "Infusion 4"], | ||
5: [ | 5 : [28, 2, 2, 0, 0, "Visit 6", "This follow-up visit should occur approximately on day 29 (ą2) after the 1st infusion (Visit 5).", "1st Follow-Up After Infusion 4"], | ||
6 : [59, 10, 10, 0, 0, "Visit 7", "This follow-up visit should occur approximately on day 60 (ą10) after the 1st infusion (Visit 2).", "2nd Follow-Up After Infusion 4"], | |||
7 : [89, 10, 10, 0, 0, "Visit 8", "This follow-up visit should occur approximately on day 90 (ą10) after the 1st infusion (Visit 2).", "3rd Follow-Up After Infusion 4"], | |||
8 : [179, 10, 10, 0, 0, "Visit 9", "This follow-up visit should occur approximately on day 180 (ą10) after the 1st infusion (Visit 2).", "4th Follow-Up After Infusion 4"], | |||
9 : [269, 10, 10, 0, 0, "Visit 10", "This follow-up visit should occur approximately on day 270 (ą10) after the 1st infusion (Visit 2).", "5th Follow-Up After Infusion 4"], | |||
10 : [364, 14, 14, 0, 0, "Visit 11", "This follow-up visit should occur approximately on day 365 (ą14) after the 1st infusion (Visit 2).", "End Of Study Visit"], | |||
}; | }; | ||
this.patientID = patient; | this.patientID = patient; | ||
Line 24: | Line 29: | ||
$.each(timeConstraints, function(key, value){ | $.each(timeConstraints, function(key, value){ | ||
currentAppointment = new Date(currentAppointment.getFullYear(), currentAppointment.getMonth(), currentAppointment.getDate()+value[0]); | currentAppointment = new Date(currentAppointment.getFullYear(), currentAppointment.getMonth(), currentAppointment.getDate()+value[0]); | ||
$("#appointments").append("<tr><td>"+value[5]+"</td><td><input type='text' class='appointment' id='visit-"+key+"' value='"+currentAppointment+"' /></td><td><input type='checkbox' class='delayedInfusion' value='"+key+"' /></td><td>"+value[6]+"</td></tr>"); | $("#appointments").append("<tr><td>"+value[5]+"</td><td><input type='text' class='appointment' id='visit-"+key+"' value='"+currentAppointment.toDateString()+"' /></td><td><input type='checkbox' class='delayedInfusion' value='"+key+"' /></td><td>"+value[6]+"</td></tr>"); | ||
$("#visit-"+key).datepicker({minDate: currentAppointment, maxDate:new Date(currentAppointment.getFullYear(), currentAppointment.getMonth(), currentAppointment.getDate()+value[1])}); | $("#visit-"+key).datepicker({minDate: currentAppointment, maxDate:new Date(currentAppointment.getFullYear(), currentAppointment.getMonth(), currentAppointment.getDate()+value[1])}); | ||
}); | }); | ||
Line 49: | Line 54: | ||
}; | }; | ||
}); | }); | ||
</script> | </script> | ||
Line 60: | Line 65: | ||
<label for="indexEvent">Index Event</label> | <label for="indexEvent">Index Event</label> | ||
<input type="text" id="indexEvent" name="indexEvent" /><br /> | <input type="text" id="indexEvent" name="indexEvent" /><br /> | ||
<table id="appointments"> | <table id="appointments"> | ||
<tr><th>Visit Number</th><th>Visit Date</th><th>Delayed Infusion?</th><th>Visit Description</th></tr> | <tr><th>Visit Number</th><th>Visit Date</th><th>Delayed Infusion?</th><th>Visit Description</th></tr> |