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 : 18.119.109.60


Current Path : /proc/thread-self/root/var/www/html/college/js/
Upload File :
Current File : //proc/thread-self/root/var/www/html/college/js/Att_Ent_Teacher_Wise.js

var db = window.location.pathname.split("/")[urlarr.length - 2];

function Call_attEntTeacher() {
  $g_mes_valid_reg_no = 0;
  $geditinternalcode = 0;
  $g_mes_save_after_error_flag = 0;
  $g_mes_edit_valid_marks_flag = 0;
  $limit_start = 0;
  $limit = 0;
  window.enable_proper_module = "Attendance Entry Teacher Wise";
  $("#page_main_div").load(
    "../html_modules/att_Ent_Teacher_Wise.html?",
    function () {
      document.getElementById("display_module_name").innerHTML =
        "Attendanace Entry Teacher Wise";
      document.getElementById("module_name_for_save").value =
        "SaveAttendanceEntry";
      getDefaultHeadFooterLinks("Attendance Entry Teacher Wise");
      $("#main_mark_entry_div").hide();
      $("#markentry_teacherwise").focus();
      document.getElementById("markentry_teacherwise").disabled = false;
      document.getElementById("markentry_teacherwise_class").disabled = false;
      document.getElementById("markentry_teacherwise_subcode").disabled = false;
      document.getElementById("attentry_teacherwise_section").disabled = false;
      document.getElementById("month_name").disabled = false;
      if (db === "jssstu") {
        document.getElementById("month_name").disabled = true;
      } else {
        document.getElementById("month_name").disabled = false;
      }
      loaddayteachcode();
    }
  );
}

function clearAttendanceEntryTeachWisetextbox() {
  Call_attEntTeacher();
}

// Svae All Date  From Mark Entry Subjectwise Module
function SaveAttendanceDetails() {
  if ($("#markentry_teacherwise").val() == "") {
    alert("Enter Teacher Name");
    $("#markentry_teacherwise").focus();
    return;
  }
  if ($("#markentry_teacherwise_class").val() == "") {
    alert("Enter Class Name");
    $("#markentry_teacherwise_class").focus();
    return;
  }
  if ($("#markentry_teacherwise_subcode").val() == "") {
    alert("Enter Subject Code");
    $("#markentry_teacherwise_subcode").focus();
    return;
  }
  if ($("#attentry_teacherwise_section").val() == "") {
    alert("Please Enter Section");
    $("#attentry_teacherwise_section").focus();
    return;
  }

  $.blockUI({
    message:
      "<h1 class='h1' style='font-size:12px'><img src='images/ajax-loader.gif' border='0'></h1>",
  });

  // $list_data = "Fdegree=" + $("#markentry_sub_degree_code").val();
  // $list_data += "&FExamno=" + $("#markentry_sub_Examno").val();
  $list_data = "teacher_id=" + $("#markentry_teacherwise").val();
  $list_data += "&class_id=" + $("#markentry_teacherwise_class").val();
  $list_data += "&Fsubcode=" + $("#markentry_teacherwise_subcode").val();
  $list_data += "&month_name=" + $("#month_name").val();
  $list_data += "&stype=AttEntTeachWise";
  $length_of_marks = $("input[id*='hidden_']").length;

  var att_data = new Object();
  var validstatus = false;
  html_objects = $("input[id*='conducted_']");
  jQuery.each(html_objects, function (k, v) {
    var internal_code = v["id"].split("_")[1];
    att_data[internal_code] = new Object();
    att_data[internal_code]["c"] = $("#conducted_" + internal_code).val();
    att_data[internal_code]["a"] = $("#attended_" + internal_code).val();
    att_data[internal_code]["r"] = $("#reg_" + internal_code).val();
    if (
      parseInt(att_data[internal_code]["a"]) >
      parseInt(att_data[internal_code]["c"])
    ) {
      alert("Classes Attended cannot be greater than Classes Conducted");
      $("#attended_" + internal_code).focus();
      validstatus = true;
      return false;
    }
  });

  if (!validstatus) {
    var myJSONText = encodeURIComponent(JSON.stringify(att_data));
    $list_data += "&output_details=" + myJSONText;

    $.ajax({
      type: "POST",
      async: false,
      url: $host_url + "SaveAttendanceDetails",
      data: $list_data,
      success: SaveAttendanceDetailsResponce,
    });
  }
} // END SAVE

function SaveAttendanceDetailsResponce($responce) {
  $responce = eval("(" + $responce + ")");
  if ($responce.error_code == 0) {
    alert($responce.data);
    $("#markentry_teacherwise").focus;
    $.unblockUI();
  } else {
    alert($responce.data);
    $.unblockUI();
  }
}

function loaddayteachcode() {
  $.ajax({
    type: "GET",
    url: $host_url + "loaddayteachcode",
    success: function (response) {
      var response = JSON.parse(response);
      let opt = " ";
      opt += `<option value=''>---Select Teacher---</option>`;
      if (response.error_code === 0) {
        response.data.forEach((element) => {
          opt += `<option value='${element.fteachcode}'>${element.fteachcode} - ${element.fteachname}</option>`;
        });
      }
      document.getElementById("markentry_teacherwise").innerHTML = opt;
    },
  });
}

function changedayteachcode() {
  var teachcode = document.getElementById("markentry_teacherwise").value;
  $.ajax({
    type: "GET",
    url: $host_url + "loadclassnameday",
    data: "&teachcode=" + teachcode,
    success: function (response) {
      var response = JSON.parse(response);
      var opt = " ";
      opt += `<option value=''>---Select Class Name---</option>`;
      if (response.error_code === 0) {
        response.data.forEach((element) => {
          opt += `<option value='${element.fclassid}'>${element.fclassid}-${element.fclassname}</option>`;
        });
      }
      document.getElementById("markentry_teacherwise_class").innerHTML = opt;
    },
  });
}
function changeAttEntClass() {
  var teachcode = document.getElementById("markentry_teacherwise").value;
  var classcode = document.getElementById("markentry_teacherwise_class").value;
  // console.log(sem, degree);
  $.ajax({
    type: "GET",
    url:
      $host_url +
      "getAttEntTeachWiseSubject" +
      "&teachcode=" +
      teachcode +
      "&classcode=" +
      classcode,
    success: function (res) {
      let response = JSON.parse(res);
      let options = "";
      // console.log(response);
      options += `<option value=''>---Select Subject Name---</option>`;
      if (response.error_code === 0) {
        response.data.forEach((elements) => {
          options += `<option value='${elements.fsubcode}'>${elements.fsubcode} - ${elements.fsubname}</option>`;
        });
        document.getElementById("markentry_teacherwise_subcode").innerHTML =
          options;
      }
    },
  });
}

function changeAttEntTeachSub() {
  var teachcode = document.getElementById("markentry_teacherwise").value;
  var classcode = document.getElementById("markentry_teacherwise_class").value;
  var subject = document.getElementById("markentry_teacherwise_subcode").value;

  $.ajax({
    type: "GET",
    url:
      $host_url +
      "getAttEntTeachWiseSection" +
      "&teachcode=" +
      teachcode +
      "&classcode=" +
      classcode +
      "&subject=" +
      subject,
    success: function (res) {
      let response = JSON.parse(res);
      let option = "";
      console.log(response);

      option += `<option value=''>---Select Section---</option>`;
      if (response.error_code === 0) {
        response.data.forEach((elements) => {
          option += `<option value='${elements.fsection}'>${elements.fsection}</option>`;
        });
        document.getElementById("attentry_teacherwise_section").innerHTML =
          option;
      }
    },
  });
}

function GetAttendanceRegisterNumbersTeachWise() {
  //alert('calling');
  $("#mes_default_reg_div").hide();

  if ($("#markentry_teacherwise").val() == "") {
    alert("Enter Teacher Name");
    $("#markentry_teacherwise").focus();
    return;
  }
  if ($("#markentry_teacherwise_class").val() == "") {
    alert("Enter Class Name");
    $("#markentry_teacherwise_class").focus();
    return;
  }
  if ($("#markentry_teacherwise_subcode").val() == "") {
    alert("Enter Subject Code");
    $("#markentry_teacherwise_subcode").focus();
    return;
  }
  if ($("#attentry_teacherwise_section").val() == "") {
    alert("Please Enter Section");
    $("#attentry_teacherwise_section").focus();
    return;
  }
  $list_data = "teacher_id=" + $("#markentry_teacherwise").val();
  $list_data += "&Subcode=" + $("#markentry_teacherwise_subcode").val();
  $list_data += "&class_id=" + $("#markentry_teacherwise_class").val();
  $list_data += "&Section=" + $("#attentry_teacherwise_section").val();
  $list_data += "&month_name=" + $("#month_name").val();
  $list_data += "&stype=AttEntTeachWise";

  $type = $("#is_add_edit").val();

  $.blockUI({
    message:
      "<h1 class='h1' style='font-size:12px'><img src='images/ajax-loader.gif' border='0'></h1>",
  });
  $.ajax({
    type: "POST",
    //async:false,
    url: $host_url + "GetAttendanceRegisterNumbers",
    data: $list_data,
    success: GetAttendanceRegisterNumbersNosResponse,
  });
}

function GetAttendanceRegisterNumbersNosResponse($responce) {
  $responce = eval("(" + $responce + ")");
  if ($responce.error_code == 0) {
    $.unblockUI();
    $("#main_mark_entry_div").hide();
    $("#mes_default_reg_div").show();
    document.getElementById("markentry_teacherwise").disabled = true;
    document.getElementById("markentry_teacherwise_subcode").disabled = true;
    document.getElementById("markentry_teacherwise_class").disabled = true;
    document.getElementById("attentry_teacherwise_section").disabled = true;
    document.getElementById("month_name").disabled = true;
    $("#mes_default_reg_div").load($responce.data.filenme, function () {});
  }
}

function AssignAttendanceNextTdConductedVal(f_int_code) {
  var current_val = $("#conducted_" + f_int_code).val();
  var next_input_id = $("#conducted_" + f_int_code)
    .parent()
    .parent()
    .next("tr")
    .find("input[id*='conducted_']")[0]["id"];
  var next_input_id_val = $("#" + next_input_id).val();
  if (empty(next_input_id_val) || next_input_id_val == "0") {
    $("#" + next_input_id).val(current_val);
  }
}

// function subCategoryDropDown() {
//   $.ajax({
//     type: "POST",
//     data: "type=" + "ME",
//     url: $host_url + "GetSubSubjectCategory.demo",
//     success: subCategoryDropDownresp
//   });
// }

// function subCategoryDropDownresp($responce) {
//   $responce = eval("(" + $responce + ")");
//   document.getElementById("SubCategory").options.length = 0;
//   for ($i = 0; $i < $responce.data.length; $i++) {
//     $op = new Option($responce.data[$i]["Name"], $responce.data[$i]["Code"]);
//     $op.id = $responce.data[$i]["Name"]; //specifying the id  for options
//     document.getElementById("SubCategory").options.add($op);
//   }
// }

function validateAttendedVal(rowid) {
  var condval = document.getElementById("conducted_" + rowid).value;
  var attendval = document.getElementById("attended_" + rowid).value;
  if (parseInt(condval) < parseInt(attendval)) {
    alert("Classes Attended cannot be greater than Classes Conducted");
    document.getElementById("attended_" + rowid).value = 0;
    $("#attended_" + rowid).focus();
    return false;
  } else AssignAttendanceNextTdConductedVal(rowid);
}