0xV3NOMx
Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64



Your IP : 3.137.200.56


Current Path : /var/www/html/college/js/
Upload File :
Current File : /var/www/html/college/js/convo.js

function callConvocationDetails() {
  $g_entered_batch = "";
  $("#page_main_div").load(
    "../html_modules/convo.html?v=25052016",
    function () {
      document.getElementById("display_module_name").innerHTML =
        "Convocation Details";
      document.getElementById("module_name_for_save").value =
        "Convocation Details";
      document.getElementById("is_add_edit").value = "Edit";
      getDefaultHeadFooterLinks("Convocation Details");
      getDegree();
      getCategory();
      $("#regno").focus();
    }
  );
}

function getDegree() {
  $.ajax({
    type: "GET",
    url: $host_url + "getcolldegree",
    success: function (res) {
      var response = JSON.parse(res);
      if (response.error_code === 0) {
        var deg_opt = `<option>---select---</option>`;
        var deg_op = `<option value='All'>All</option>`;
        for (var i = 0; i < response.data.length; i++) {
          deg_opt += `<option value=${response.data[i].FDEGREE}>${response.data[i].FDEGREE} - ${response.data[i].FDESCPN}</option>`;
          deg_op += `<option value=${response.data[i].FDEGREE}>${response.data[i].FDEGREE} - ${response.data[i].FDESCPN}</option>`;
        }
        $("#degree").html(deg_opt);
        $("#degree_view").html(deg_op);
      }
    },
  });
}

function getCategory() {
  $.ajax({
    type: "GET",
    url: $host_url + "getcategoryall",
    success: function (res) {
      var response = JSON.parse(res);
      if (response.error_code === 0) {
        var cat = `<option>---select---</option>`;
        for (var i = 0; i < response.data.length; i++) {
          cat += `<option value=${response.data[i].FCATEGORY}>${response.data[i].FCATEGORY}</option>`;
        }
        $("#category").html(cat);
      }
    },
  });
}

function viewConvocationDetails() {
  var degree = $("#degree_view").val();

  $("#viewtabledata").show();
  $("#add_data").hide();
  $.ajax({
    type: "GET",
    url: $host_url + "getConvocationDetails",
    data: "degree=" + degree,
    success: function (res) {
      let response = JSON.parse(res);
      console.log(response);
      var table = "";
      if (response.error_code === 0) {
        $photopath =
          "https://university-cnv-student-photos.s3.ap-south-1.amazonaws.com/";

        table += `<table align="center" width="100%" cellspacing="0" cellpadding="1" border="1" style="border-radius:5px">
                    <tr class="ui-state-default ui-jqgrid-hdiv">
                    <th align="center" style="width:50px; font-size:12px; 
                    border-left:1px solid #C5DBEC;border-right:1px solid #C5DBEC; 
                    border-bottom:1px solid #C5DBEC;">Sl. No.</th>

                    <th align="center" style="width:80px; font-size:12px; padding:5px 5px; 
                    border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">Reg. No.</th>

                    <th align="center" style="width:120px; font-size:12px; padding:5px 5px; 
                    border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">Name</th>

                    <th align="center" style="width:70px; font-size:12px; padding:5px 5px; 
                    border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">Degree</th>
                    
                    <th align="center" style="width:60px; font-size:12px; padding:5px 5px; 
                    border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">Percentage</th>

                    <th align="center" style="width:50; font-size:12px; padding:5px 5px; 
                    border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">CGPA</th>

                    <th align="center" style="width:50px; font-size:12px; padding:5px 5px; 
                    border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">Grade</th>

                    <th align="center" style="width:50px; font-size:12px; padding:5px 5px; 
                    border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">Exam Date</th>

                    <th align="center" style="width:50px; font-size:12px; padding:5px 5px; 
                    border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">Amount</th>

                    <th align="center" style="width:50px; font-size:12px; padding:5px 5px; 
                    border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">Photo</th>

                    <th align="center" style="width:50px; font-size:12px; padding:5px 5px; 
                    border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;">Action</th>

                    </tr>`;

        for (var i = 0; i < response.data.length; i++) {
          var photo = $photopath + response.data[i].fphotopath;
          table += `<tr>
                        <td class="tbl_row_new" style="text-align:center !important; text-align:initial; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;">
                        ${i + 1}</td>
                        <td class="tbl_row_new" style="text-align:center !important; text-align:initial; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;">
                        ${response.data[i].fregno}</td>
                        <td class="tbl_row_new" style="text-align:initial; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;">
                        ${response.data[i].fname}</td>
                        <td class="tbl_row_new" style="text-align:center !important; text-align:initial; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;">
                        ${response.data[i].fdegree}</td>
                        <td class="tbl_row_new" style="text-align:center !important; text-align:initial; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;">
                        ${response.data[i].fpercent}</td>
                        <td class="tbl_row_new" style="text-align:center !important; text-align:initial; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;">
                        ${response.data[i].fcgpa}</td>
                        <td class="tbl_row_new" style="text-align:center !important; text-align:initial; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;">
                        ${response.data[i].fgrade}</td>
                        <td class="tbl_row_new" style="text-align:center !important; text-align:initial; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;">
                        ${response.data[i].fexamdate}</td>
                        <td class="tbl_row_new" style="text-align:center !important; text-align:initial; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;">
                        ${response.data[i].famount}</td>
                        <td class="tbl_row_new" style="text-align:center !important; text-align:initial; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;">
                        <img height="30px" width="30px" src='${photo}'/></td>
                        <td class="tbl_row_new" style="text-align:center !important; text-align:initial; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;">
                        <span
                        style="
                        background-color: #008cba;
                        border: none;
                        color: white;
                        padding: 7px 20px;
                        text-align: center;
                        text-decoration: none;
                        display: inline-block;
                        font-size: 13px;
                        cursor: pointer;
                        border-radius:4px;
                        "
                        onclick="editConvoDetails(
                        '${response.data[i].fregno}', 
                        '${response.data[i].fname}',
                        '${response.data[i].fdegree}',
                        '${response.data[i].fcaste}',
                        '${response.data[i].fgender}',
                        '${response.data[i].fgrade}',
                        '${response.data[i].fexamdate}',
                        '${response.data[i].famount}',
                        '${response.data[i].fphotopath}',
                        '${response.data[i].fpayid}',
                        '${response.data[i].fpaydate}',
                        '${response.data[i].ffatname}',
                        '${response.data[i].fmotname}',
                        '${response.data[i].fpercent}',
                        '${response.data[i].fcgpa}')"
                        >Edit</span></td>
                    </tr>`;
        }
        table += `</table>`;

        $("#viewdata").html(table);
      } else {
        $("#viewdata").html("No data Found");
      }
    },
  });
}

function addConvocationDetails() {
  $("#add_data").show();
  callConvocationDetails();
  $("#viewtabledata").hide();
}

function editConvoDetails(
  regno,
  name,
  degree,
  caste,
  gender,
  grade,
  examdate,
  amount,
  photo,
  payid,
  paydate,
  fatname,
  motname,
  percent,
  cgpa
) {
  var $photopath =
    "https://university-cnv-student-photos.s3.ap-south-1.amazonaws.com/";
  $("#add_data").show();
  $("#viewtabledata").hide();
  $("#degree").val(degree);
  $("#degree").prop("disabled", "disabled");
  $("#regno").val(regno);
  $("#regno").prop("disabled", "disabled");
  $("#name").val(name);
  $("#grade").val(grade);
  $("#gender").val(gender);
  $("#category").val(caste);
  $("#exam").val(examdate);
  $("#fees").val(amount);
  $("#feereceipt").val(payid);
  $("#date").val(paydate);
  $("#fatname").val(fatname);
  $("#motname").val(motname);
  $("#percent").val(percent);
  $("#cgpa").val(cgpa);

  document.getElementById("studphoto_img").src = $photopath + photo;
  $("#photo").prop($photopath + photo);
}

function convocationReport() {
  var degree = $("#degree_view").val();
  window.open($host_url + "convocationreport" + "&degree=" + degree);
}

function uploadPhoto() {
  let regno = $("#regno").val();
  let degree = $("#degree").val();
  var photo = $("#photo").prop("files")[0];

  if (regno == "") {
    alert("Enter Regno");
    return;
  }
  if ($("#photo").val() == "") {
    alert("select file please");
    return;
  }
  if (degree == "---select---") {
    alert("select Degree");
    return;
  }

  var form_data = new FormData();
  form_data.append("image", photo);
  form_data.append("regno", regno);
  form_data.append("degree", degree);
  $.ajax({
    url: $host_url + "uploadconvophoto",
    dataType: "text",
    cache: false,
    contentType: false,
    processData: false,
    data: form_data,
    type: "post",
    success: function (res) {
      var response = JSON.parse(res);
      if (response.error_code === 0) {
        alert(response.data.msg);
      } else {
        alert(response.data.msg);
        return;
      }
    },
  });
}

function saveConvoDetails() {
  var degree = $("#degree").val();
  var regno = $("#regno").val();
  var name = $("#name").val();
  var fatname = $("#fatname").val();
  var motname = $("#motname").val();
  var gender = $("#gender").val();
  var category = $("#category").val();
  var percent = $("#percent").val();
  var cgpa = $("#cgpa").val();
  var grade = $("#grade").val();
  var examdate = $("#exam").val();
  var fees = $("#fees").val();
  var feereceipt = $("#feereceipt").val();
  var paydate = $("#date").val();

  if (regno == "") {
    alert("Enter Regno");
    $("#regno").focus();
    return;
  }
  if (degree == "" || degree == "---select---") {
    alert("select degree");
    $("#degree").focus();
    return;
  }
  if (name == "") {
    alert("Enter name");
    $("#name").focus();
    return;
  }
  if (fatname == "") {
    alert("Enter father name");
    $("#fatname").focus();
    return;
  }
  if (motname == "") {
    alert("Enter Mother Name");
    $("#motname").focus();
    return;
  }
  if (gender == "" || gender == "---select---") {
    alert("select gender");
    $("#gender").focus();
    return;
  }
  if (category == "" || category == "---select---") {
    alert("select category");
    $("#category").focus();
    return;
  }
  if (percent == "") {
    alert("Enter Percentage");
    $("#percent").focus();
    return;
  }
  if (cgpa == "") {
    alert("Enter CGPA");
    $("#cgpa").focus();
    return;
  }
  if (grade == "") {
    alert("Enter grade");
    $("#grade").focus();
    return;
  }
  if (examdate == "") {
    alert("Enter Exam Date");
    $("#exam").focus();
    return;
  }
  if (fees == "") {
    alert("Enter Amount");
    $("#fees").focus();
    return;
  }
  if (feereceipt == "") {
    alert("Enter Reciept Number");
    $("#feereceipt").focus();
    return;
  }
  if (paydate == "") {
    alert("Enter Reciept date");
    $("#date").focus();
    return;
  }

  var form_data = new FormData();
  form_data.append("degree", degree);
  form_data.append("regno", regno);
  form_data.append("name", name);
  form_data.append("grade", grade);
  form_data.append("gender", gender);
  form_data.append("category", category);
  form_data.append("examdate", examdate.toUpperCase());
  form_data.append("fees", fees);
  form_data.append("feereceipt", feereceipt);
  form_data.append("paydate", paydate);
  form_data.append("fatname", fatname);
  form_data.append("motname", motname);
  form_data.append("percent", percent);
  form_data.append("cgpa", cgpa);

  $.ajax({
    url: $host_url + "saveconvocationdet",
    dataType: "text",
    cache: false,
    contentType: false,
    processData: false,
    data: form_data,
    type: "post",
    success: function (res) {
      let response = JSON.parse(res);
      console.log(response);
      if (response.error_code === 0) {
        alert(response.data.msg);
        callConvocationDetails();
        return;
      } else {
        alert(response.data.msg);
        return;
      }
    },
  });
}