Here’s my events.php code:
if ($scheduler->is_select_mode()){ // ' code for loading data
$SQL = "SELECT event_id,start_date,end_date, CONCAT(contacts.First, ' ' , contacts.Last) AS Patient, text,rec_type,event_pid,event_length,events_rec.office_ID,reason,events_rec.patient_ID,name,howheard_ID,promo_ID,events_rec.company_ID, appt_status,saw_by, previsit_categories.color, previsit_categories.textColor FROM events_rec LEFT JOIN previsit_categories ON previsit_categories.ID = events_rec.reason LEFT JOIN contacts ON contacts.Patient_ID =events_rec.patient_ID WHERE events_rec.office_ID IN ($office_id) AND appt_status IN ($appt_progress) AND saw_by IN ($provider) AND events_rec.company_ID = '" . addslashes($_SESSION['Company_ID']) . "'";
$scheduler->render_sql($SQL,"event_id","start_date,end_date,text,rec_type,event_pid,event_length,office_ID,reason,patient_ID,name,howheard_ID, Patient, promo_ID,company_ID,appt_status,saw_by, previsit_categories.color(color), previsit_categories.textColor(textColor)", "", "");
}
else { // code for other operations - i.e. update/insert/delete
function afterProcessing($action){
$res = mysql_query("SELECT color, textColor FROM previsit_categories WHERE previsit_categories.ID='".$action->get_value("reason")."' AND Company_ID= '" . addslashes($_SESSION['Company_ID']) . "'");
$row_color= mysql_fetch_assoc($res);
$some_value = $row_color['color'];
$some_value2 = $row_color['textColor'];
$action->set_response_attribute("color", $some_value);
$action->set_response_attribute("textColor", $some_value2);
};
$scheduler->event->attach("afterProcessing", afterProcessing);
$scheduler->render_table("events_rec","event_id","start_date,end_date,text,rec_type,event_pid,event_length,office_ID,reason,patient_ID,name,howheard_ID,promo_ID,company_ID,appt_status,saw_by");
}
My event text and tooltip in scheduler.php:
scheduler.templates.tooltip_text = function(start,end,event) {
return "<b>Name:</b> "+event.Patient+"<br/><b>Comments:</b> "+event.text+"<br/><b>Office:</b> "+scheduler.getLabel("office_ID", event.office_ID) + "<br/><b>Reason:</b> " +scheduler.getLabel("reason", event.reason)+ "<br/><b>Status:</b> " +scheduler.getLabel("appt_status", event.appt_status);
}
scheduler.templates.event_text = function(start, end, event) {
var result = "<b>Name:</b> " + "<a href='apptinformation.php?Calendar_Id="+event.id+"' + target='_blank'>"+event.Patient+"</a>" + "<br/><b>Reason:</b> " +scheduler.getLabel("reason", event.reason)+ "<br/><b>Status:</b> " +scheduler.getLabel("appt_status", event.appt_status);
return result;
}
The Name comes from event.Patient -> which is from the loading data part of my events.php
The Name shows properly when the scheduler is loaded, naturally, however when I add an event to the scheduler, the Name doesn’t populate in the tooltip and event. It says undefined.
Upon insert, how can I return the updated event.Patient information to the tooltip and event field without having to manually refresh the page?