'); swal({ title: 'This enquiry has been expired. Please browse latest enquiries.', // text: 'Test Text', content: latestEnquiryData }); }else{ openModal($(this).attr('data-id')); } }); function openModal(enquiryID){ $('#enquiry_contact #enquiry_id').val(""); $('#enquiry_contact #name').val(""); $('#enquiry_contact #email').val(""); $('#enquiry_contact #enquiry_id').val(enquiryID); $('#enquiry_contact').modal('show'); } function initRatings(){ $(".ratings:visible").each(function(a,e){ console.log("rating"); var t=$(e).attr("data-rating-per"); $(e).rateYo({rating:t,readOnly:!0,ratedFill:"#ffa700",starWidth:"15px",normalFill:"#80808061"}) }); } var a = { startAngle: -1.55, size: 55 }; function initProgressbar() { $(".progress").each(function(b, c) { var d = $(c).attr("data-percentage"), e = $(c).attr("data-color-percentage"); $fillColor = "#ffa500", e <= 30 ? $fillColor = "#ff0000" : e <= 50 ? $fillColor = "#ff7f25" : e <= 70 ? $fillColor = "#90ee90" : e <= 99 ? $fillColor = "#008000" : 100 == e && ($fillColor = "#006400"), a.value = d, a.fill = { color: $fillColor }, $(c).circleProgress(a).on("circle-animation-progress", function(a, b, c) { $(d).find(".progress-value").text(d + "%"); }); }); } var xhr = false; var start = 0; var perpage= 5; var end = start + perpage; function loadContactedProfiles(){ //#contacted-data var enquiryID = $('.enquiry-id').text(); xhr = $.ajax({ url: "database_ajax/getEnquiryContactedPeople.php", type: "POST", dataType: 'json', data: { start: start, end: end, enquiryID:enquiryID }, success: function(data) { console.log('ajax success 2'); console.log(data); var contactedHTML = ''; var contactedTemplate = document.getElementById("contacted-data-template").innerHTML; var people = data.contactedArray; console.log(people.length); $.each(people, function(key, value) { contactedHTML += contactedTemplate.replace(/{{ proscore }}/g, value.proscore) .replace(/{{ proscore_percent }}/g,value.proscore_percent) .replace(/{{ name }}/g,value.name) .replace(/{{ city }}/g,value.city) .replace(/{{ ratings }}/g,value.ratings) .replace(/{{ profile_image }}/g,value.profile_image) .replace(/{{ profile_image_text }}/g,value.profile_image_text) .replace(/{{ ratings_percent }}/g,value.ratings_percent) .replace(/{{ ratings }}/g,value.ratings) .replace(/{{ subCategory }}/g,value.subCategory) .replace(/{{ profile_type }}/g,value.profile_type) .replace(/{{ created_at }}/g,value.created_at) .replace(/{{ profile_url }}/g,value.profile_url) .replace(/{{ userid }}/g,value.userid); }); if(people.length <= 0){ $('#load-more-btn').attr('disabled','disabled'); } $(".enquiry-contacted-block").append(contactedHTML); initRatings(); initProgressbar(); start = end; end = start + perpage; $(".loading").hide(); xhr = false; } }); } $(function(){ // initRatings(); initProgressbar(); setTimeout(function(){ loadContactedProfiles(); },500); $(document).on('click', '.load-more',function(e){ e.preventDefault(); loadContactedProfiles(); }); $(document).on("click",".profile-redirect", function() { var a = $(this).attr("data-url"); window.location.href = a; }); });