Migrated from Redmine #194 | Author: Yaman Al-Nachawati
Status: Feedback | Priority: Immediate, there is BUG! | Created: 2018-07-10
Hi,
Victoria said the place to resolve this would be here as it has been a longstanding issue. On LinkMentalHealth’s website, we pull information through an Ajax function depending on the user’s selection of therapists (as it is already unsustainable to have a predefined one). For example, Dr. Nelson: https://linkmentalhealthmongo.herokuapp.com/details.html?therapist_id=5b021e722a10e400149253c2 . As you can see however, ALL locations in the DB are being pulled. I don’t want that, I just want Dr. Nelson’s and so I explicitly tried to pull the variable simplybook_location for him. Please let me know why this is not working and how to resolve ASAP as there are really big meetings coming up that need this resolved.
The code is found below. The widget code is at the bottom. Please let me know if you need more information (yaman@linkmentalhealth.com)
Thanks.
Yaman
<h6>BOOK APPOINTMENT</h6>
<script src="https://simplybook.me/v2/widget/widget.js"></script>
<script>
var therapist_id = window.location.search.substr(1).split("=")[1];
var simplybook_location;
var simplybook_provider;
// 1. Query using ID
$.get("https://linkmentalhealthmongo.herokuapp.com/api/therapists/" + therapist_id, function(data, status){
simplybook_provider = global_provider = data["simplybook_provider"];
simplybook_location = data["simplybook_location"]
console.log ('before call widget '+global_provider);
$('#profile-image').attr("src", data["photo_link"]);
$('.first-name').html(data["name"]);
$('#bio').html(data["bio"]);
$('#bio1').html(data["bio1"]);
$('#bio2').html(data["bio2"]);
$('#simplybook_location').html(data["simplybook_location"]);
$('#simplybook_provider').html(data["simplybook_provider"]);
$('#title').html(data["title"]);
$('#short-summary').html(data["short_summary"]);
$('#specialty').html(data["specialty"]);
$('#treatment_type').html(data["treatment_type"]);
$('#preference').html(data["booking_preference"]);
$('#certifications').html(data["certifications"]);
if (data["name"]=="Family Services of Peel (Mississauga)" ){
$('#form-div').show();
$('#iframe-div').hide();
$('#walkin-div').hide();
$('#location_info').hide();
$('#toggle_visible_button').show();
}
else if (data["name"]=="Skylark Children, Youth and Families. YouthCan Impact Walk-In Counselling (40 Orchard View Blvd, Toronto)" || data["name"]=="Skylark Children, Youth and Families. YouthCan Impact Walk-In Counselling (65 Wellesley Street E., Toronto)" || data["name"]=="Walk-In: Catholic Family Services of Peel (Mississauga)" || data["name"]=="Walk-In: Catholic Family Services of Peel (Brampton)" ){
$('#form-div').hide();
$('#walkin-div').show();
$('#iframe-div').hide();
$('#location_info').hide();
$('#toggle_visible_button').show();
}
else{
$('#form-div').hide();
$('#walkin-div').hide();
$('#iframe-div').show();
$('#toggle_visible_button').hide();
}
});
var widget = new SimplybookWidget({"widget_type":"iframe","url":"https:\/\/linkmentalhealth.simplybook.me","theme":"classic","theme_settings":{"sb_base_color":"#33bb60","body_bg_color":"#fdfdfd","hide_img_mode":"1","sb_busy":"#dad2ce","sb_available":"#d3e0f1"},"timeline":"modern_week","datepicker":"inline_datepicker","is_rtl":false,"app_config":{"predefined":{"location": simplybook_location,"provider": simplybook_provider, "service":"1"}}});
</script>
</div>