var db = window.location.pathname.split("/")[2]; // var db = window.location.pathname.split("/")[2]; // var $host_url = // "http://" + // window.location.host + // "/" + // window.location.pathname.split("/")[1] + // "/app.php?db=" + // db + // "&a="; var gstudInfo = []; function loadApplyAddCourse() { console.log($host_url); $.ajax({ type: "GET", async: false, url: $host_url + "getAddCourseStatus", success: (response) => { response = JSON.parse(response); if (response.error_code == 0) { $("#loadTab").load("add-course.html", function () { var html = ""; var row = response.data.info; gstudInfo = response.data.info; console.log(row); html += ` Name :${row["fname"]} Mobile No :${row["fmobileno"]} Application Number :${row["fappno"]} Category :${row["fcategory"]} Qualifying Degree :${row["fdescpn"]} Qualifying Degree Combination :${row["fcombdesc"]} `; html += ``; $("#AppStat").html(html); var optdeg = response.data.optdeg; var optdegtable = ``; var i = 1; optdeg.forEach((element) => { let disabled = ""; if (element.sddeg == "checked") { disabled = "disabled"; } optdegtable += ``; optdegtable += ``; i++; }); optdegtable += `
Sl. No. Degree Name Select
${i} ${element.fdescpn}
`; $("#adddeg").html(optdegtable); }); } else { swal({ title: `${response.data.msg}`, html: true, showCancelButton: false, warning: true, confirmButtonColor: "#5495ff", confirmButtonText: "OK", closeOnConfirm: false, }); } }, }); } function getAddFeestr(cat) { var arrlength = $('[name="optdeg"]:enabled:checked').length; $.ajax({ type: "POST", url: $host_url + "getFees", data: "&fcatcode=" + cat, success: (response) => { var { error_code, data, status } = JSON.parse(response); var table = ``; // console.log(data); var feeData = data.feestr; if (error_code == 0) { totalFee = 0; table = ` `; feeData.map((el, i) => { let addsubfee = 0; let appfee = data.feestr[0].fmaxfee * arrlength; data.feestr[0].fmaxfee = appfee; var db = window.location.pathname.split("/")[2]; if (db == "dud") { if (arrlength > 1) { if (el.fheadcode == "02 Application Fee") { addsubfee = Number(data.feestr[1].fmaxfee) + Number(data.feestr[1].frepfee) * (Number(arrlength) - 1); data.feestr[1].fmaxfee = addsubfee; } } } table += ``; // getFeestr(); arrlengthofdeg = arrlength; totalFee += Number(el.fmaxfee); // totalFee = totalFee * arrlength; }); table += `
SL. No. Head Code Fee
${i + 1} ${el.fheadcode} ${ el.fmaxfee }
Total ${totalFee}
`; } if (error_code == -1) { table = `

No Fee Sturcture found for the above selected Category and Preference 1.

`; } $("#addfee").html(table); }, }); } function applyForAdditionalCourse() { var arrlength = $('[name="optdeg"]:enabled:checked').length; if(arrlength == 0) { swal({ title: `Select Degree to apply`, html: true, showCancelButton: false, warning: true, confirmButtonColor: "#5495ff", confirmButtonText: "OK", closeOnConfirm: false, }); } finaloptdeg = Array(); for (let i = 1; i <= $('[name="optdeg"]').length; i++) { if ($('#deg_' + i).is(":checked:enabled")) { item = {}; item["optdeg"] = $(`#h_optdeg_${i}`).val(); finaloptdeg.push(item); } } var totalfee = parseInt($(`#ttlAmt`).html()); console.log(totalfee); if(totalfee <= 0) { swal({ title: `Fees cannot be zero`, html: true, showCancelButton: false, warning: true }); } $.ajax({ type: "POST", url: $host_url + "applyForAddCourse", data: "degrees=" + JSON.stringify(finaloptdeg)+ "&totalfee="+ totalfee + "&gstudInfo="+ JSON.stringify(gstudInfo), success: (response) => { response = JSON.parse(response); if(response.error_code == -1) { swal({ title: response.data.msg, html: true, showCancelButton: false, warning: true, confirmButtonColor: "#5495ff", confirmButtonText: "OK", closeOnConfirm: false, }); }else { console.log(response.data.faddappno); var appno = response.data.faddappno; makepaymentforAddCourse(appno, "026"); } } }); } function makepaymentforAddCourse(appno, funivcode) { $.ajax({ type: "POST", url: $host_url + "addCourseGetPayDet", data: "appno="+appno, success: responce => { var { error_code, data, status } = JSON.parse(responce); if (error_code == -1) { swal({ title: data.msg, html: true, showCancelButton: false, confirmButtonColor: "#5495ff", confirmButtonText: "OK", closeOnConfirm: false }); } else if (error_code == 0) { $("#loadTab").load("add-course-payment.html", function() { var html = ""; html += ` Ref. Number :${data.appno} Fee to be paid :${data.totalfee} `; html += ``; $("#studInfo").html(html); var optdegtable = `

Degrees opted

`; let j = 1; for(let deg of data.fdegree) { optdegtable += ``; j++; } optdegtable += `
Sl. No. Degree Name
${j} ${deg.fdescpn}
`; $("#adddeg").html(optdegtable); var table = ``; var masbank = data["masbank"]; for (var i = 0; i < masbank.length; i++) { if ( masbank[i]["fbank"].toLowerCase() == "razorpay" || masbank[i]["fbank"].toLowerCase() == "paytm" ) { var appno = data.appno; var button = ""; var db = window.location.pathname.split("/")[2]; var funivcode = ""; if (db == "vskub") funivcode = "026"; else if (db == "rcub") funivcode = "027"; else if (db == "dud") funivcode = "023"; table += ``; console.log(masbank[i]["fbank"].toLowerCase()); if (masbank[i]["fbank"].toLowerCase() == "razorpay") { $.ajax({ type: "POST", async: false, data: "appno=" + appno + "&funivcode=" + funivcode, url: "../razorpay/pay.php", success: function(responce) { button = responce; } }); table += ``; } else { table += ``; } } } table += `
Logo Bank Charges Action
${masbank[i]["fbankcharge"]}
${button}
`; // console.log(table); $("#makepayment").html(table); return; }); } } }); }