'+data[i].document+' * (Image & Pdf file only)
');}}
else{}}});$(".count").text("("+coursestorage.length+")");$("#subtotal").html('INR '+totalAmount);var gstval=totalAmount*18/100;$("#gstamt").html('INR '+gstval);$("#totalamt").html('INR '+(totalAmount+gstval));$("#lumsum_total").html($("#totalamt").text());$("#apply_coupon").on('click',function(evt){$("#checkoutitemtable tr").each(function(){if($(this).hasClass('course')){var rowHolder=$(this);var hdninputctl=$(this).find("input");var hdn=$(this).find("input").val().split('^');if($("."+hdn[0]+"_"+$("input[name='coupon_code']").val()).length==0){var amt=parseFloat(hdn[1])*parseFloat(hdn[2]);$.ajax({url:'/home/CouponStatus',type:'GET',data:{cpn:$("input[name='coupon_code']").val(),cid:hdn[0],mobile:$("input[name='mobile_no']").val(),email:$("input[name='email_id']").val(),amount:amt},success:function(data){console.log(data);$(".couponapplied").show();if(data.status==0){$(".couponapplied").html("Invalid Coupon!!!
")}
else{discountValue=data.discount;$(' Coupon: '+$("input[name='coupon_code']").val()+' RemoveINR '+discountValue+' ').insertAfter(rowHolder);$(".couponapplied").html(" Coupon applied successfully!!
")
updateTable();}}});}}});return false;$.ajax({url:'/home/CouponStatus',type:'GET',data:{cpn:$("input[name='coupon_code']").val(),cid:1,mobile:$("input[name='mobile_no']").val(),email:$("input[name='email_id']").val(),amount:$("#subtotal").html().replace('INR ','')},success:function(data){console.log(data);if(data.status==0){$(".couponapplied").show();$("#discountRow").css({display:'none'});}
else{discountValue=data.discount;$("#coupondesc").html(data.coupondesc);$("#headingOne > div").html(" Coupon applied successfully!!
")
$("#discountRow").css({display:'table-row'});$("#collapseOne").hide();$("#discount").html(" (-) INR "+discountValue);if($("#discountRow").css('display')=='none'){$("#discountRow").css({display:'table-row'});}
updateTable();}}});updateTable();});$("#checkoutitemtable").on('click',".removecpn",function(){$(this).closest('tr').remove();updateTable();$(".couponapplied").hide();$("input[name='coupon_code']").val("");});$('#country_id [value="IN"]').attr('selected','true');$("input[name='coupon_code']").on('focus',function(){$(".couponapplied").hide();});$("#firstname,#lastname").keypress(function(event){return(event.charCode>64&&event.charCode<91)||(event.charCode>96&&event.charCode<123)||(event.charCode==32);});$('#email_id').on('change',function(event){ValidateEmail($(this));});$('.installments').on('change','input[type="checkbox"]',function(){if($(this).attr('name')=='chk_0'&&$(this).prop('checked')==false){$(this).prop('checked',true);}
ShowBreakupInstallment();});$('.installments').on('click','#viewdetail_inst',function(evt){evt.preventDefault();$(".viewdetail_inst").toggle();});$('input[type=radio][name=paymode]').change(function(){if(this.value=='1'){$(".installments").css('display','table');}
else{$(".installments").css('display','none');}});$('input[type=radio][name=enquiry_for]').change(function(){if(this.value=='1'){$(".nominate").show();$(".documents input").attr('required',null);$(".documents").hide();$("#team_mode").show();$(".orgmode").show();$("#organisation").attr('required',true);$(".myselfmode").hide();$(".paymentpanel").hide();RenderLearnerTable();}
else{$(".documents").show();$(".documents input").attr('required',true);$("#team_mode").hide();$(".myselfmode").show();$(".orgmode").hide();$("#organisation").attr('required',null);$("#corporate_learner").hide();if($(".instalfinal").length>0){$(".paymentpanel").show();}}
CheckCart();});$("#addmore").on('click',function(){var i=$(".learnerlist tr").length-1;$(".learnerlist").append(' ');var requiredRow=parseInt($("input[name='qty_0']").val());requiredRow++;$("input[name='qty_0']").val(requiredRow);updateTable();});$(".learnerlist").on('click','img',function(){if($(this).closest('table').find('tr').length>2){var row=$(this).closest('tr');$(row).remove();var requiredRow=parseInt($("input[name='qty_0']").val());requiredRow--;$("input[name='qty_0']").val(requiredRow);updateTable();}
else{alert("Atleast one feehead required for installment to create!");}});$("#viewdetail").on('click',function(evt){evt.preventDefault();$(this).text($(this).text()=="(View Detail)"?"(Hide Detail)":"(View Detail)");$(".viewdetail").toggle();});$("#checkoutitemtable").on('click','i',function(evt){evt.stopPropagation();evt.preventDefault();var itemdet=$(this).closest('tr').find("input[type='hidden']").val().split('^');var courseid=itemdet[0];var coursestorage=JSON.parse(localStorage.getItem("coursestorage")||"[]");var new_coursestorage=[];coursestorage.forEach(function(item,index){if(item.id==courseid){}
else{new_coursestorage.push(item);}});localStorage.setItem("coursestorage",JSON.stringify(new_coursestorage));$(this).closest('tr').remove();updateCartSection();updateTable();if($("input[name='qty_0']").length==0){$(".paymentpanel").hide();}});setTimeout(RenderLearnerTable,2000);});function updateCartSection(){$(".my-cart-table tbody").html("");var coursestorage=JSON.parse(localStorage.getItem("coursestorage")||"[]");coursestorage.forEach(function(item,index){var rowAmount=parseFloat(item.price)*parseFloat(item.qty);var rowHTML='';rowHTML+=' ';rowHTML+=' '+item.name+' INR '+item.price+'
';rowHTML+=' ';rowHTML+=' INR '+rowAmount+' ';rowHTML+=' ';rowHTML+=' ';$(".my-cart-table tbody").append(rowHTML);});$(".count").text("("+coursestorage.length+")");$(".cart-icon-product-list").html("");coursestorage.forEach(function(item,index){var rowHTML='';rowHTML+='';rowHTML+=' ';$(".cart-icon-product-list").append(rowHTML);});}
function ShowBreakupInstallment(){var totalAmt=0;for(var i=0;i<12;i++){if($("input[name='chk_"+i+"']").length>0&&$("input[name='chk_"+i+"']").prop('checked')==true){totalAmt+=parseFloat($("#inst_"+i).text().replace("INR ",""));}}
$("#instlfee").text('INR '+totalAmt);var gstval=totalAmt*18/100;$("#instlgst").html('INR '+gstval);$("#instlpay").html('INR '+(totalAmt+gstval));}
var discountValue=0;function updateTable(){var totalAmount=0;var rowAmount=0;$("tr.course").each(function(){var itemdet=$(this).find('input[type="hidden"]').val().split('^');rowAmount=parseFloat(itemdet[1])*parseFloat($(this).find('input[type="text"]').val());totalAmount+=rowAmount;var cell=$(this).find("td:eq(2)");$(cell).text("INR "+rowAmount);});$("tr.coupon").each(function(){var discount=parseFloat($(this).find('td:eq(1)').text().replace("INR ",""));totalAmount=totalAmount-discount;});$("#subtotal").html('INR '+totalAmount);var gstval=totalAmount*18/100;$("#gstamt").html('INR '+gstval);$("#totalamt").html('INR '+(totalAmount+gstval));}
function validate(status){if($("input[name='qty_0']").length==0){alert("No Course found to proceed");$(".paymentpanel").hide();return false;}
$("input[name='pay_status']").val(status);if($("#frm").valid()){if($('input[type=radio][name=enquiry_for]:checked').val()=="0"){for(var d=0;d<5;d++){if($("input[name='doc_"+d+"']").length>0){var ext=$("input[name='doc_"+d+"']").val().split('.').pop().toLowerCase();if($.inArray(ext,['gif','png','jpg','jpeg','pdf'])==-1){alert('Invalid file uploaded!');$("input[name='doc_"+d+"']").focus();return false;}}}}
var courseids='0';for(var i=0;i<10;i++){if($("input[name='item_"+i+"']").length>0){var ids=$("input[name='item_"+i+"']").val().split('^');courseids+=","+ids[0];}}
$("#alertMessage").html("");$.ajax({url:'/home/CheckDuplicate',type:'GET',data:{courseids:courseids,mobile:$("input[name='mobile_no']").val(),email:$("input[name='email_id']").val()},success:function(data){var actionToTake=false;if(data.userid===undefined){}
else{$("input[name='userid']").val(data.userid);}
if(data.status==1){actionToTake=true;}
else{if(data.dupl_course===undefined){actionToTake=true;}
else{var courseNames='';var duplicate_couse=data.dupl_course;for(var c=0;c"+courseNames+" already purchased, please remove from cart and proceed for other course.");actionToTake=false;}}
if(actionToTake){$("#frm").submit();}}});return false;}
else{$("html, body").animate({scrollTop:0},"slow");return false;}}
CheckCart();function CheckCart(){if($('input[type=radio][name=enquiry_for]:checked').val()=="0"){$('.c').val(1).attr('readonly',true);}
else{$('.c').attr('readonly',false);$('.learnerlist tbody').find("tr:not(:nth-child(1)):not(:nth-child(2))").remove();}}