$(document).ready(function () { var Speciality = "All"; var IsAligner = false; var IsAlignerHybrid = false; var IsBrackets = false; var consultingType = "All"; var IsAlignerSelected = false; var ConsultingCaseType = "All"; var ExpressBracketTurnaround = 0; var StandardBracketTurnaround = 0; var AcceptFirstCase = false; var ExpressSpeciality = null; var MentoringSpeciality = null; var Type = "All"; var SelectedLanguage = 0; var SelectedCountriesIds = Array(); var SelectedStyleAttribute = Array(); var SelectedCustomerGroups=Array(); $('.backToMainPage').attr('href', '/ConsultingHome'); $(document).on('click', '.jsFilterSlide', function () { $('.naviSlideDiv').toggleClass('open'); $(this).toggleClass('btn-theme btn-danger'); $(this).children('i').toggleClass('fa-filter fa-close'); if (typeof sectionHeightHelper !== 'undefined' && $.isFunction(sectionHeightHelper)) { sectionHeightHelper() } }); //$(document).off('click', '.jsfindConsultantlistbtn'); //$(document).on('click', '.jsfindConsultantlistbtn', function () { // debugger; // var _this = $(this); // var IsAligner = false; // var IsAlignerHybrid = false; // var IsBrackets = false; // var IsAlignerSelected = false; // var consultingType = document.getElementById('consultingType').value; // var caseType = document.getElementById('caseType').value; // if (consultingType == "All") // { // consultingType = "Mentoring"; // } // if (caseType == "Aligners") // { // IsAlignerSelected = true; // IsAligner = true; // } // else if (caseType == "Brackets") // { // IsBrackets = true; // } // else // { // IsAligner = true; // IsAlignerHybrid = true; // IsBrackets = true; // IsAlignerSelected = true; // } // var ConsultantModel = { // 'AcceptAlignerConsulting': IsAligner, // 'AcceptAlignerMentoring': IsAlignerHybrid, // 'IsBracket': IsBrackets, // 'ConsultantType': consultingType, // 'IsAlignerSelected': IsAlignerSelected // }; // $.ajax({ // beforeSend: function () { // $('#loadingWithBG').show(); // }, // url: '@Url.Action("ConsultantList", "TemplateBuilder")', // type: 'get', // data: { consultantmodel: ConsultantModel}, // success: function (data) { // debugger; // $("#loadingWithBG").hide(); // }, // error: function (er) { // var cTextReload = 'Something went wrong. Please try after sometime.'; // commonConfirmPopup(cTNotification, cTextReload, cBOk, cBCancel, cBCTheme, cBCHide, cMCsm, cReloadCallback, cFalseCallback, cFalseCallback); // $("#loadingWithBG").hide(); // } // }) //}); $(document).off('click change', '#FilterDiv .jsFilterRadio, .btnTitleSearch, .btnClear'); $(document).on('click change', '#FilterDiv .jsFilterRadio, .btnTitleSearch, .btnClear', function (event) { event.preventDefault(); //event.stopPropagation(); // debugger; $('#loadingWithBG').show(); var ParentUL = $(this).closest('ul').attr('data-field'); var selectedVal = $(this).attr('value'); var SearchTitletxt = $('#SearchTitletxt').val(); var Cleartxt = $(this).attr('data-id'); var SearchFilter = $(this).attr('data-serach'); var SearchTitle = ""; if (Cleartxt != undefined) { SearchTitletxt = ""; $('#SearchTitletxt').val(""); $('.btnClear').addClass('hide'); } if (SearchFilter != undefined && SearchTitletxt != "") { $('.btnClear').removeClass('hide'); } if (ParentUL == 'Speciality') { if (!$(this).parent().parent('li').hasClass('active')) { $(this).find('input[type="radio"][value="' + selectedVal + '"]').prop('checked', true); $("#FilterDiv").find('ul[data-field="' + ParentUL + '"] li').removeClass('active'); $(this).closest('li').addClass('active'); Speciality = selectedVal; } } else if (ParentUL == 'ConsultingType') { if (!$(this).parent().parent('li').hasClass('active')) { $(this).find('input[type="radio"][value="' + selectedVal + '"]').prop('checked', true); $("#FilterDiv").find('ul[data-field="' + ParentUL + '"] li').removeClass('active'); $(this).closest('li').addClass('active'); consultingType = selectedVal; } } else if (ParentUL == 'CaseType') { if (!$(this).parent().parent('li').hasClass('active')) { $(this).find('input[type="radio"][value="' + selectedVal + '"]').prop('checked', true); $("#FilterDiv").find('ul[data-field="' + ParentUL + '"] li').removeClass('active'); $(this).closest('li').addClass('active'); ConsultingCaseType = selectedVal; } } else if (ParentUL == 'StandardBracketTurnaround') { if (!$(this).parent().parent('li').hasClass('active')) { $(this).find('input[type="radio"][value="' + selectedVal + '"]').prop('checked', true); $("#FilterDiv").find('ul[data-field="' + ParentUL + '"] li').removeClass('active'); $(this).closest('li').addClass('active'); StandardBracketTurnaround =parseInt(selectedVal); } //$(this).prop('checked', true); //StandardBracketTurnaround = parseInt(selectedVal); } else if (ParentUL == 'ExpressBracketTurnaround') { if (!$(this).parent().parent('li').hasClass('active')) { $(this).find('input[type="radio"][value="' + selectedVal + '"]').prop('checked', true); $("#FilterDiv").find('ul[data-field="' + ParentUL + '"] li').removeClass('active'); $(this).closest('li').addClass('active'); ExpressBracketTurnaround = parseInt(selectedVal); } //$(this).prop('checked', true); //ExpressBracketTurnaround = parseInt(selectedVal); } else if (ParentUL == 'LanguageSpoken') { if (!$(this).parent().parent('li').hasClass('active')) { $(this).find('input[type="radio"][value="' + selectedVal + '"]').prop('checked', true); $("#FilterDiv").find('ul[data-field="' + ParentUL + '"] li').removeClass('active'); $(this).closest('li').addClass('active'); SelectedLanguage = selectedVal; } } else if (ParentUL == 'CountryList') { if (selectedVal == 0) { SelectedCountriesIds = Array(); $("#FilterDiv").find('ul[data-field="' + ParentUL + '"] li').removeClass('active'); $("#FilterDiv").find('input[type="checkbox"][name="CountryList"]').prop('checked', false); $("#FilterDiv").find('input[type="checkbox"][name="CountryList"][value="0"]').prop('checked', true); $(this).closest('li').addClass('active'); } else { if ($(this).parent().parent('li').hasClass('active')) { $(this).parent().parent('li').removeClass('active'); $(this).find('input[type="checkbox"][name="CountryList"][value="' + selectedVal + '"]').prop('checked', false); const index = SelectedCountriesIds.indexOf(selectedVal); if (index > -1) { SelectedCountriesIds.splice(index, 1); } if (SelectedCountriesIds.length == 0) { $("#FilterDiv").find('ul[data-field="' + ParentUL + '"]').find('input[type="checkbox"][value="0"]').closest('li').addClass('active'); $("#FilterDiv").find('input[type="checkbox"][name="CountryList"][value="0"]').prop('checked', true); } } else { $(this).find('input[type="checkbox"][name="CountryList"][value="' + selectedVal + '"]').prop('checked', true); $("#FilterDiv").find('input[type="checkbox"][name="CountryList"][value="0"]').prop('checked', false); $("#FilterDiv").find('ul[data-field="' + ParentUL + '"]').find('input[type="checkbox"][value="0"]').closest('li').removeClass('active'); $(this).parent().parent('li').addClass('active'); SelectedCountriesIds.push(selectedVal); } } } else if (ParentUL == 'StyleList') { if (selectedVal == "All") { SelectedStyleAttribute = Array(); $("#FilterDiv").find('ul[data-field="' + ParentUL + '"] li').removeClass('active'); $("#FilterDiv").find('input[type="checkbox"][name="StyleList"]').prop('checked', false); $("#FilterDiv").find('input[type="checkbox"][name="StyleList"][value="All"]').prop('checked', true); $(this).closest('li').addClass('active'); } else { if ($(this).parent().parent('li').hasClass('active')) { $(this).parent().parent('li').removeClass('active'); $(this).find('input[type="checkbox"][name="StyleList"][value="' + selectedVal + '"]').prop('checked', false); const index = SelectedStyleAttribute.indexOf(selectedVal); if (index > -1) { SelectedStyleAttribute.splice(index, 1); } if (SelectedStyleAttribute.length == 0) { $("#FilterDiv").find('ul[data-field="' + ParentUL + '"]').find('input[type="checkbox"][value="All"]').closest('li').addClass('active'); $("#FilterDiv").find('input[type="checkbox"][name="StyleList"][value="All"]').prop('checked', true); } } else { $(this).find('input[type="checkbox"][name="StyleList"][value="' + selectedVal + '"]').prop('checked', true); $("#FilterDiv").find('input[type="checkbox"][name="StyleList"][value="All"]').prop('checked', false); $("#FilterDiv").find('ul[data-field="' + ParentUL + '"]').find('input[type="checkbox"][value="All"]').closest('li').removeClass('active'); $(this).parent().parent('li').addClass('active'); SelectedStyleAttribute.push(selectedVal); } } } else if (ParentUL == 'CustomerGroupList') { if (selectedVal == 0) { SelectedCustomerGroups = Array(); $("#FilterDiv").find('ul[data-field="' + ParentUL + '"] li').removeClass('active'); $("#FilterDiv").find('input[type="checkbox"][name="CustomerGroupList"]').prop('checked', false); $("#FilterDiv").find('input[type="checkbox"][name="CustomerGroupList"][value="0"]').prop('checked', true); $(this).closest('li').addClass('active'); } else { if ($(this).parent().parent('li').hasClass('active')) { $(this).parent().parent('li').removeClass('active'); $(this).find('input[type="checkbox"][name="CustomerGroupList"][value="' + selectedVal + '"]').prop('checked', false); const index = SelectedCustomerGroups.indexOf(selectedVal); if (index > -1) { SelectedCustomerGroups.splice(index, 1); } if (SelectedCustomerGroups.length == 0) { $("#FilterDiv").find('ul[data-field="' + ParentUL + '"]').find('input[type="checkbox"][value="0"]').closest('li').addClass('active'); $("#FilterDiv").find('input[type="checkbox"][name="CustomerGroupList"][value="0"]').prop('checked', true); } } else { $(this).find('input[type="checkbox"][name="CustomerGroupList"][value="' + selectedVal + '"]').prop('checked', true); $("#FilterDiv").find('input[type="checkbox"][name="CustomerGroupList"][value="0"]').prop('checked', false); $("#FilterDiv").find('ul[data-field="' + ParentUL + '"]').find('input[type="checkbox"][value="0"]').closest('li').removeClass('active'); $(this).parent().parent('li').addClass('active'); SelectedCustomerGroups.push(selectedVal); } } } if (Speciality == "All") { Speciality = null; } if (consultingType == "All") { Type = consultingType; consultingType = null; AcceptFirstCase = false; ExpressSpeciality = null; MentoringSpeciality = null; } else if (consultingType == "Free Case Mentoring") { Type = consultingType; consultingType = null; AcceptFirstCase = true; ExpressSpeciality = null; MentoringSpeciality = null; } else if (consultingType == "Express") { Type = consultingType; AcceptFirstCase = false; ExpressSpeciality = Speciality; MentoringSpeciality = null; Speciality = null; } else if (consultingType == "Mentoring") { Type = consultingType; AcceptFirstCase = false; MentoringSpeciality = Speciality; ExpressSpeciality = null; Speciality = null; } else if (consultingType == "Standard") { Type = consultingType; AcceptFirstCase = false; ExpressSpeciality = null; MentoringSpeciality = null; } if (ConsultingCaseType == "Aligners") { IsAlignerHybrid = false; IsAlignerSelected = true; IsAligner = true; if (consultingType == "Mentoring") { IsAlignerHybrid = true; } } else if (ConsultingCaseType == "Brackets") { IsAligner = false; IsAlignerHybrid = false; IsBrackets = true; IsAlignerSelected = false; } else if (ConsultingCaseType == "All") { IsAligner = true; IsAlignerHybrid = true; IsBrackets = true; IsAlignerSelected = true; } var ConsultantModel = { 'AcceptAlignerConsulting': IsAligner, 'AcceptAlignerMentoring': IsAlignerHybrid, 'IsBracket': IsBrackets, 'ConsultantType': consultingType, 'IsAlignerSelected': IsAlignerSelected, 'Speciality': Speciality, 'AcceptsFirstCase': AcceptFirstCase, 'ExpressSpeciality': ExpressSpeciality, 'MentoringSpeciality': MentoringSpeciality }; $.ajax({ url: '/GETConsultantList', type: 'POST', cache: false, datatype: 'json', data: { consultantModel: ConsultantModel, ConsultingCaseType: ConsultingCaseType, StandardBracketTurnaround: StandardBracketTurnaround, ExpressBracketTurnaround: ExpressBracketTurnaround, SelectedCountriesIds: SelectedCountriesIds, SearchTitletxt: SearchTitletxt, SelectedLanguage: SelectedLanguage, SelectedStyleAttribute: SelectedStyleAttribute, SelectedCustomerGroupIds:SelectedCustomerGroups }, success: function (data) { debugger; $('#loadingWithBG').hide(); $('#GridCourseDiv').html(data); //if (Speciality == null) { // Speciality = "All"; //} if (consultingType == null) { consultingType = "All"; } if (Speciality != null) { $('input[type="radio"][name="Speciality"][value="' + Speciality + '"]').prop('checked', true); } else if (ExpressSpeciality != null) { $('input[type="radio"][name="Speciality"][value="' + ExpressSpeciality + '"]').prop('checked', true); Speciality = ExpressSpeciality; } else if (MentoringSpeciality != null) { $('input[type="radio"][name="Speciality"][value="' + MentoringSpeciality + '"]').prop('checked', true); Speciality = MentoringSpeciality; } else { Speciality = "All"; $('input[type="radio"][name="Speciality"][value="' + Speciality + '"]').prop('checked', true); } $('input[type="radio"][name="ConsultingType"][value="' + Type + '"]').prop('checked', true); $('input[type="radio"][name="ExpressBracketTurnaround"][value="' + ExpressBracketTurnaround + '"]').prop('checked', true); $('input[type="radio"][name="StandardBracketTurnaround"][value="' + StandardBracketTurnaround + '"]').prop('checked', true); $('input[type="radio"][name="CaseType"][value="' + ConsultingCaseType + '"]').prop('checked', true); $('input[type="radio"][name="LanguageSpoken"][value="' + SelectedLanguage + '"]').prop('checked', true); $('input[type="checkbox"][name="CountryList"]').prop('checked', false); if (SelectedCountriesIds.length == 0) { $('input[type="checkbox"][name="CountryList"][value="0"]').closest('li').addClass('active'); $('input[type="checkbox"][name="CountryList"][value="0"]').prop('checked', true); } else { for(var j=0; j