const apiDomain = "https://api.tuttory.net" // "https://api.tuttory.net"; const applicationUrl = "https://m.tuttory.net"; const extensionApiUrl = "https://extension.tuttory.net" function search(word) { document.location.href = applicationUrl + '/default/search/' + encodeURIComponent(word); } function SearchKeyUp(e) { console.log(e); var el = document.getElementById("searchValidationMsg"); el.innerText = ''; if (e.key === "Enter" && e.target.value.length <= 2) { el.innerText = 'minimum 3 characters required'; } if (e.key === "Enter" && e.target.value.length > 2) { // console.log(e.target.value); search(e.target.value); } } function SearchByGrade(grade) { console.log(grade); document.location.href = applicationUrl + "/default/search/*?grade=" + grade; } function SearchByBoard(board) { console.log(board); document.location.href = applicationUrl + "/default/search/*?board=" + board; } function SearchBySubject(subject) { console.log(subject); document.location.href = applicationUrl + "/default/search/" + encodeURIComponent(subject); } function getCounts() { fetch(apiDomain + '/tms-webapi-sessionservice/api/home/session/count', { method: 'GET', headers: { 'Content-Type': 'application/json' } }).then(response => { return response.json() }).then(courseCount => { console.log(courseCount); if (document.getElementById('courseCount') != null) { document.getElementById('courseCount').innerHTML = courseCount; } }); fetch(apiDomain + '/tms-webapi-userservice/api/home/teacher-student/count', { method: 'GET', headers: { 'Content-Type': 'application/json' } }).then(response => { return response.json() }).then(teacherstudentCount => { console.log(teacherstudentCount); if (document.getElementById('studentCount') != null) { document.getElementById('studentCount').innerHTML = teacherstudentCount.studentCount; } if (document.getElementById('teacherCount') != null) { document.getElementById('teacherCount').innerHTML = teacherstudentCount.teacherCount; } }); } function getPlans() { fetch(apiDomain + '/tms-webapi-planservice/api/Plan/active-plans/' + 2, { method: 'GET', headers: { 'Content-Type': 'application/json' } }).then(response => { return response.json() }).then(plans => { try { console.log(plans); goldIndex = plans.findIndex(plan => plan.planName.toLowerCase() == 'gold'); PlatinumIndex = plans.findIndex(plan => plan.planName.toLowerCase() == 'platinum'); document.getElementById("goldPrice").innerHTML = "₹" + plans[goldIndex].yearlyPrice; document.getElementById("platinumPlanPrice").innerHTML = "₹" + plans[PlatinumIndex].yearlyPrice; if (plans[goldIndex].yearlyDiscount == 0) { var ele = document.getElementById("goldDiscountedValue"); ele.style.display = 'none'; } else { document.getElementById("goldDiscountedValue").innerHTML = "Special Offer: ₹" + plans[goldIndex].yearlyDiscountedPrice; } if (plans[PlatinumIndex].yearlyDiscount == 0) { document.getElementById("platinumPlanOfferPrice").style('display', 'none'); } else { document.getElementById("platinumPlanOfferPrice").innerHTML = "Special Offer: ₹" + plans[PlatinumIndex].yearlyDiscountedPrice; } } catch (e) { console.log("error ", e) } }); } function doOnOrientationChange() { switch (window.orientation) { case -90: case 90: console.log('landscape'); location.reload(); break; default: console.log('portrait'); location.reload(); break; } } function onPurchase(plan) { console.log('inside purchase function', plan); window.location.href = applicationUrl + '/signup?plan=' + plan; } function GotoSignup() { window.location.href = applicationUrl + '/signup'; } function GotoLogin() { window.location.href = applicationUrl + '/login'; } window.addEventListener('orientationchange', doOnOrientationChange); function onInstituteMobileKeyUp1(e) { e.preventDefault(); var mobile = document.getElementById('institutePhone').value; countryCode = country_codes.filter(elem => mobile.match('^' + RegExp.escape(elem.id)))[0]; if (countryCode != undefined && countryCode != null) { document.getElementById('institutePhone').setAttribute('pattern', countryCode.patternWithCountryCode); } else { document.getElementById('institutePhone').setAttribute('pattern', mobileRegex); } } function ContactSales(e) { if (e.target.checkValidity() === false) { console.log('validation failed'); return false; } e.preventDefault(); var instituteNameInput = document.getElementById("instituteName"); var instituteCityInput = document.getElementById("instituteCity"); var instituteEmailInput = document.getElementById("instituteEmail"); var institutePhoneInput = document.getElementById("institutePhone"); console.log(instituteNameInput.value, instituteCityInput.value, instituteEmailInput.value, institutePhoneInput.value); const dto = { "instituteName": instituteNameInput.value, "city": instituteCityInput.value, "email": instituteEmailInput.value, "mobile": institutePhoneInput.value } fetch(apiDomain + '/tms-webapi-notificationservice/api/tuttorydemo/contact-sales', { // fetch('http://localhost:5300/api/TuttoryDemo/contact-sales', { method: 'POST', body: JSON.stringify(dto), // string or object headers: { 'Content-Type': 'application/json' } }).then(response => { return response.json() }).then(isSaved => { console.log(isSaved); if (isSaved === true) { $('#contactsales').modal('hide'); alert('Thanks for taking time to request. Our team will contact you soon in next 24 hours'); } }); } function GetFreeSessionByTeacherId() { const urlParams = new URLSearchParams(window.location.search); const teacherId = urlParams.get('teacherId'); if (teacherId == null) { return; } fetch(apiDomain + `/tms-webapi-sessionservice/api/Session/free-sessions-by-teacher/${teacherId}/0/20`, { method: 'GET', headers: { 'Content-Type': 'application/json' } }).then(response => { return response.json(); }).then(classes => { console.log(classes); //loading Image const imgElement = document.createElement("img"); const urlParams = new URLSearchParams(window.location.search); const imageSrc = urlParams.get('img'); imgElement.src = "https://tms-images-s3.s3.ap-south-1.amazonaws.com/" + imageSrc; document.getElementById("bannerImage").appendChild(imgElement); //Loading const cardList = document.getElementById("card-list"); let cardInner = ''; classes.forEach(session => { cardInner = cardInner + GetSessionCard(session); cardList.innerHTML = cardInner; }); }); } function GetSessionCard(session) { const time = moment(session.startDateTimeUtc); return `
${session.sessionName}
${session.category == 1 ? `${session.board}>${session.grade}>${session.subject}
` : `${session.subject}>${session.branch}
`}${time.format("hh:mm a, Do MMM,YY")}
${time.format("hh:mm a")}
${session.tutionMode == 1 ? 'Online' : 'Offline'}