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.116.37.200


Current Path : /var/www/oasis/js_old/
Upload File :
Current File : /var/www/oasis/js_old/Dispatch_answer_script_qp.js

$g_dispatch_ans_script_count = 1;
$g_dispatch_ans_script_data = "";
$g_dispatch_popup = "";
$g_dispatch_degree_code = "";
$g_Dispatch_ans_script_header = "";
function LoadEnableDispatchanswerscriptQp() {
  $g_dispatch_ans_script_count = 1;
  $g_dispatch_ans_script_data = "";
  $g_dispatch_popup = "";
  $g_dispatch_degree_code = "";
  $g_Dispatch_ans_script_header = "";
  $("#page_main_div").load(
    "../html_modules/dispatch_answer_scripts_qp.html",
    function() {
      $geditinternalcode = 0;
      window.enable_proper_module = "enableDispatchanswerscriptQp";

      document.getElementById("display_module_name").innerHTML =
        "Dispatch Answers Script QP";
      document.getElementById("module_name_for_save").value =
        "saveDispatchAnswersScriptQp";
      document.getElementById("is_add_edit").value = "Edit";
      getDefaultHeadFooterLinks("Dispatch Answers Script QP Code");
      $("#print_row").hide();
      retainDispatchAnsScripts();
    }
  );
}
function GetDefaultDispatchAnsScriptQp() {
  if ($("#date_of_exam").val() == "") {
    alert("Please Enter Date of Exam");
    $("#date_of_exam").focus();
    return;
  } else if ($("#session_state").val() == "") {
    alert("Please Enter session");
    $("#session_state").focus();
    return;
  }
  $.ajax({
    type: "POST",
    //async:false,
    url: $host_url + "getDefaultDispatchAnswersScriptQp.demo",
    data:
      "date=" +
      encodeURIComponent(date_format($("#date_of_exam").val())) +
      "&session=" +
      trim($("#session_state").val()),
    success: getDefaultDispatchAnswersScriptQpResponse
  });
}
function getDefaultDispatchAnswersScriptQpResponse($responce) {
  $responce = eval("(" + $responce + ")");
  if ($responce.error_code == 0) {
    $("#Dispatch_default_ans_script_div").html($responce.data.html);
    $("#Dispatch_default_ans_script_div").show();
    $("#dispatch_list_div").hide();
    $g_dispatch_ans_script_data = $responce.data.table_data;
    //$('#add_row').focus();
  }
}
function showDispatchAnswerScriptQP() {
  document.getElementById("is_add_edit").value = "Add";
  $("#date_of_exam").attr("disabled", "true");
  $("#session_state").attr("disabled", "true");
  $("#header_add").hide();
  $("#footer_add").hide();
  $("#dispatch_list_div").show();
  $("#Dispatch_default_ans_script_div").html("");
  $("#Dispatch_default_ans_script_div").hide();
}

function getDASExamName($deg_value, $id) {
  if ($deg_value != "") getExamName($deg_value, $id);
  else {
    $deg_id = $id.substring($id.lastIndexOf("_") + 1);
    alert("Please Enter Degree");
    $("#dispatch_degree_" + $deg_id).focus();
  }
}
function CreateNextRowDispatchEntry($id) {
  $Textbox = document.getElementsByName("dispatch_ans_degree");
  $NumTextBox = $Textbox.length;
  // alert($NumTextBox);

  $previous_NumTextBox = $Textbox.length;
  $sub = $id.substring($id.lastIndexOf("_") + 1);

  $NumTextBox += 1;
  $g_dispatch_ans_script_count = $NumTextBox;
  if (parseInt($NumTextBox % 2) == 0) {
    $input_class = "tbl_row_input";
    $class = "tbl_row";
  } else {
    $class = "tbl_row1";
    $input_class = "tbl_row1_input";
  }

  //document.getElementById("dispatch_degree_"+$previous_NumTextBox).readOnly=true;
  $tbody = document.getElementById("Dispatch_ans_script_header");
  $rowcount = $tbody.rows.length;
  //alert($rowcount);
  $tr = $tbody.insertRow($rowcount);
  $tr.id = $NumTextBox;
  $tr.className = $class;

  $td_one = $tr.insertCell(0);
  $degree = document.createElement("input");
  $degree.type = "text";
  $degree.className = $input_class;
  $degree.id = "dispatch_degree_" + $NumTextBox;
  $degree.name = "dispatch_ans_degree";
  $degree.onClick = "$g_dispatch_degree_code=" + $degree.id;
  // alert($g_dispatch_degree_code);
  $degree.align = "center";
  $td_one.style.borderLeft = "solid #C5DBEC 1px";
  $td_one.style.borderRight = "solid #C5DBEC 1px";
  $td_one.style.borderBottom = "solid #C5DBEC 1px";
  $td_one.style.padding = "2px";
  $degree.onkeydown = DispatchDegreeEntryPopupQp;
  $degree.onblur = function() {
    GetQpSubjectCodeDetails(this.value);
  };
  $degree.onfocus = function() {
    assignGolbalDispatchScriptIDSQp(this.id);
  };
  $td_one.appendChild($degree);
  // $td_one.style.width = "30px";
  $td_one.align = "center";

  $td_three = $tr.insertCell(1);
  $name = document.createElement("input");
  $name.type = "text";
  $name.className = $input_class;
  $name.id = "dispatch_name_" + $NumTextBox;
  $name.name = "dispatch_ans_name";
  $name.align = "center";
  $name.readonly = "readonly";
  $name.tabindex = "-1";
  $td_three.style.borderRight = "solid #C5DBEC 1px";
  $td_three.style.borderBottom = "solid #C5DBEC 1px";
  $td_three.style.padding = "2px";
  //$name.onkeydown=DispatchSubjectCodeEntryPopupQp;
  $td_three.appendChild($name);
  //$td_three.style.width = "140px";
  $td_three.align = "center";

  $td_four = $tr.insertCell(2);
  $bundles = document.createElement("input");
  $bundles.type = "text";
  $bundles.className = $input_class;
  $bundles.id = "dispatch_buddles_" + $NumTextBox;
  $bundles.name = "dispatch_ans_buddles";
  $bundles.align = "center";
  $bundles.setAttribute(
    "onkeypress",
    "return acceptNumbersOnlyForModule(event)"
  );
  $td_four.style.borderRight = "solid #C5DBEC 1px";
  $td_four.style.borderBottom = "solid #C5DBEC 1px";
  $td_four.style.padding = "2px";
  $td_four.appendChild($bundles);
  // $td_four.style.width = "50px";
  $td_four.align = "center";

  $td_five = $tr.insertCell(3);
  $script = document.createElement("input");
  $script.type = "text";
  $script.className = $input_class;
  $script.id = "dispatch_script_" + $NumTextBox;
  $script.name = "dispatch_ans_script";
  $script.align = "center";
  $td_five.style.borderRight = "solid #C5DBEC 1px";
  $td_five.style.borderBottom = "solid #C5DBEC 1px";
  $td_five.style.padding = "2px";
  $script.onblur = function() {
    CheckForEmptyToCreatNextRow(this.id);
  };
  $td_five.appendChild($script);
  // $td_five.style.width = "50px";
  $td_five.align = "center";

  document.getElementById("dispatch_degree_" + $NumTextBox).style.width =
    "60px";
  document.getElementById("dispatch_degree_" + $NumTextBox).align = "center";
  //document.getElementById("dispatch_degree_"+$NumTextBox).style.border="0px";

  document.getElementById("dispatch_name_" + $NumTextBox).style.width = "200px";
  document.getElementById("dispatch_name_" + $NumTextBox).align = "center";
  //document.getElementById("dispatch_name_"+$NumTextBox).style.border="0px";

  document.getElementById("dispatch_buddles_" + $NumTextBox).style.width =
    "70px";
  document.getElementById("dispatch_buddles_" + $NumTextBox).align = "center";
  //document.getElementById("dispatch_buddles_"+$NumTextBox).style.border="0px";

  document.getElementById("dispatch_script_" + $NumTextBox).style.width =
    "70px";
  document.getElementById("dispatch_script_" + $NumTextBox).align = "center";
  //document.getElementById("dispatch_script_"+$NumTextBox).style.border="0px";
  $("#dispatch_degree_" + $NumTextBox).focus();
}
function CheckForEmptyToCreatNextRow($cur_id) {
  $id = $cur_id.substring($cur_id.lastIndexOf("_") + 1);

  if (
    document.getElementById($cur_id).value != "" &&
    $id == $g_dispatch_ans_script_count
  ) {
    CreateNextRowDispatchEntry($cur_id);
    document.getElementById("dispatch_degree_" + $id).focus();
  }
  /* else
	{
		//alert('Enter Subject Code / Total Scripts');
		$("#dispatch_subcode_"+$id).focus();
	} */
}
function DispatchDegreeEntryPopupQp(evt) {
  var kC = evt.which ? evt.which : evt.keyCode;
  if (kC == 112) {
    $degree_code = "";
    $g_dispatch_popup = 1;
    OpenQpSubjectPopup();
    return false;

    /*  var url = "../ui/DegreeDetailsPopup.html?height=200&width=400&search_field="+$degree_code;
					tb_show("College Details", url);  		 	
	return false; */
  }
}

function DispatchExamEntryPopup(evt) {
  var kC = evt.which ? evt.which : evt.keyCode;
  if (kC == 112) {
    $Textbox = document.getElementsByName("dispatch_ans_degree");
    $NumTextBox = $Textbox.length;
    $g_dispatch_popup = 2;
    $degree_code = document.getElementById("dispatch_degree_" + $NumTextBox)
      .value;
    $Examno = "";
    PopupMarkEntrySubGetExamNO($degree_code, $Examno);
  }
}
function assignGolbalDispatchScriptIDSQp($textbox_id) {
  $g_dispatch_degree_code = $textbox_id;
  $id = $textbox_id.substring($textbox_id.lastIndexOf("_") + 1);
  //alert($id);
  window.location.g_popup_degree_code = $("#dispatch_degree_" + $id).val();
  window.location.g_popup_exam_no = $("#dispatch_exam_" + $id).val();
  window.location.g_dispatch_row_count_id = $id;
  //alert(window.location.g_popup_degree_code+'-'+window.location.g_popup_exam_no);
}
/* function keyboardSubjectNamesPopupForAnswerScript(evt,$thsid)
{	
		// alert($thsid);
		// $Disdegcode = $("#dispatch_degree_"+$thsid).val();	
		// $Disexamno = $("#dispatch_exam_"+$thsid).val(); 
		 //alert($Disdegcode+'-'+$Disexamno);
		/* if($Disdegcode=="")
		{
			alert("Please Enter Degree Code");
			document.getElementById("dispatch_degree_"+window.location.g_popup_degree_code).focus();
			return false;
		}
		if($Disexamno == "")
		{
			alert("Please Enter ExamNo");
			document.getElementById("dispatch_exam_").focus();
			return false;
		}
		var charCode = (evt.which) ? evt.which : evt.keyCode;
	if(charCode==112)// f1 KEY
	{
		var url = "../ui/SubjectAppearingPopupForAnswerScript.html?height=200&width=400";
				tb_show("Dispatch Details", url);
				//window.location.g_popup_degree_code = $Disdegcode;
				//window.location.g_popup_exam_no = $Disexamno;
				//window.location.g_dispatch_row_count_id = $g_dispatch_ans_script_count; // this row id 
	}
						
} */
function DispatchSubjectCodeEntryPopupQp(evt) {
  var kC = evt.which ? evt.which : evt.keyCode;
  if (kC == 112) {
    //$Textbox = document.getElementsByName("dispatch_ans_degree");
    //$NumTextBox = $Textbox.length;
    $g_dispatch_popup = 3;
    // $degree_code=document.getElementById('dispatch_degree_'+$NumTextBox).value;
    // $Examno=document.getElementById('dispatch_exam_'+$NumTextBox).value;
    //PopupMarkEntrySubGetSubjectDetails( $degree,$Examno);
    PopupMarkEntrySubGetSubjectDetails();
  }
}
function saveDispatchAnswerScriptsQp() {
  $total_count_degree_dispatch = window.location.g_dispatch_row_count_id;
  $lstr_data = "&doe=" + date_format($("#date_of_exam").val());
  $lstr_data += "&session=" + encodeURIComponent($("#session_state").val());

  $disp_arr = new Object();
  //alert(g_dispatch_ans_script_data);

  if (document.getElementById("is_add_edit").value == "Edit") {
    $lstr_data += "&Type=" + "Edit";
    $Textbox = document.getElementsByName("dispatch_answer_scripts");
    $NumRow = $Textbox.length;
    $n = 0;
    for ($k = 1; $k <= $NumRow; $k++) {
      $disp_arr[$n] = new Object();
      // $mes_all_sub_code+="'"+$g_mark_entry_student_default_data[$i]['FCsubcode']+"',";
      // alert($("#d_degree_"+$k).val());
      $disp_arr[$n]["qp_code"] = $("#dispatch_degree_" + $k).val();

      $disp_arr[$n]["degree_bundle"] = $("#dispatch_buddles_" + $k).val();
      $disp_arr[$n]["degree_script"] = $("#dispatch_script_" + $k).val();
      $n++;
    }
  } else {
    $lstr_data += "&Type=" + "Add";
    $n = 0;
    var obj = $("input[id*='degree_']");
    jQuery.each(obj, function(k, v) {
      var id = v["id"].split("_")[2];
      $disp_arr[$n] = new Object();
      $disp_arr[$n]["qp_code"] = trim($("#dispatch_degree_" + id).val());

      $disp_arr[$n]["degree_bundle"] = trim($("#dispatch_buddles_" + id).val());
      $disp_arr[$n]["degree_script"] = trim($("#dispatch_script_" + id).val());
      $n++;
    });
  }
  var myJSONText = encodeURIComponent(JSON.stringify($disp_arr));
  $.ajax({
    type: "POST",
    //async:false,
    url: $host_url + "saveDispatchAnswerScriptsQp.demo",
    data: $lstr_data + "&disp_arr=" + myJSONText,
    success: saveDispatchAnswerScriptsQpResponse
  });
}
function saveDispatchAnswerScriptsQpResponse($responce) {
  $responce = eval("(" + $responce + ")");
  alert($responce.data);
  if ($responce.error_code == 0) {
    LoadEnableDispatchanswerscriptQp();
  }
  // clearDispatchAnswerScriptsFields();
  $("#date_of_exam").focus();
}
function clearDispatchAnswerScriptsFields() {
  $("#dispatch_list_div").html($g_Dispatch_ans_script_header);
  $("#Dispatch_default_ans_script_div").html("");
  $("#date_of_exam").val("");
  $("#session_state").val("");
  $("#dispatch_degree_1").val("");

  $("#dispatch_name_1").val("");
  $("#dispatch_buddles_1").val("");
  $("#dispatch_script_1").val("");

  $id = 0;
  window.location.g_popup_degree_code = "";
  window.location.g_popup_exam_no = "";
  window.location.g_dispatch_row_count_id = "";
  $("#dispatch_list_div").hide();
}
function retainDispatchAnsScripts() {
  $g_Dispatch_ans_script_header =
    "<table width='98%' id='Dispatch_ans_script_header' align='center' border='0' cellpadding='' cellspacing=''>";
  $g_Dispatch_ans_script_header +=
    "<tr><td class='act_txtclr' colspan='7' style='background-color:#3D83CC; color:#fff; font-weight:700; width:222px; padding:3px 6px; letter-spacing:0.5pt;'>Dispatch Answers Script</td></tr>";
  $g_Dispatch_ans_script_header +=
    "<tr style='background-image:url(../jqGrid3/themes/tarka/images/grid-blue-hd.gif);border-bottom:1px solid #CBC7B8; color:#000; font-weight:700; padding:3px 6px; letter-spacing:0.5pt;'>";
  $g_Dispatch_ans_script_header +=
    "<td  id='td_dispatch_degree' style='padding:2px; width:70px; border-left:1px solid #ccc; border-right:1px solid #ccc;'><center>Degree</center></td>";
  $g_Dispatch_ans_script_header +=
    "<td id='td_dispatch_exam' style='padding:2px; width:30px;   border-right:1px solid #ccc;'><center> Exam</center></td>";
  $g_Dispatch_ans_script_header +=
    "<td id='td_dispatch_subcode' style='padding:2px; width:85px;   border-right:1px solid #ccc;'><center> CODE </center></td>";
  $g_Dispatch_ans_script_header +=
    "<td id='td_dispatch_name' style='padding:2px; width:210px;   border-right:1px solid #ccc;'><center>Name</center></td>";
  $g_Dispatch_ans_script_header +=
    "<td id='td_dispatch_bundle' style='padding:2px; width:80px;   border-right:1px solid #ccc;'><center>Bundle</center></td>";
  $g_Dispatch_ans_script_header +=
    "<td id='td_dispatch_script' style='padding:2px; width:80px;   border-right:1px solid #ccc;'><center>Script</center></td>";
  $g_Dispatch_ans_script_header += "</tr>";
  $g_Dispatch_ans_script_header += "<tr class=tbl_row>";
  $g_Dispatch_ans_script_header +=
    "<td align=center style='width:70px;border-top:1px solid #ccc;border-left:1px solid #ccc; padding:2px;'>";
  $g_Dispatch_ans_script_header +=
    "<input id='dispatch_degree_1' type='text' name='dispatch_ans_degree'";
  $g_Dispatch_ans_script_header += "   style='width:60px;'";
  $g_Dispatch_ans_script_header += "onblur='getDASDegreeCode(this.id);'";
  $g_Dispatch_ans_script_header +=
    " onkeydown='return keyboardDegreePopup(event,this.id,$(\"#dispatch_degree_1\").val());'  />";
  $g_Dispatch_ans_script_header += "</td>";

  $g_Dispatch_ans_script_header += "<td align='center' style='width:30px;'> ";
  $g_Dispatch_ans_script_header +=
    "<input name=dispatch_ans_exam id=dispatch_exam_1 type=text ";
  $g_Dispatch_ans_script_header +=
    "onblur='getDASExamName($(\"#dispatch_degree_1\").val(), this.id);' ";
  $g_Dispatch_ans_script_header +=
    "onkeydown='return keyboardExamNoPopup(event,this.id,$(\"#dispatch_exam_1\").val())'";
  $g_Dispatch_ans_script_header += " style='width:25px;' >";
  $g_Dispatch_ans_script_header += "</td>";

  $g_Dispatch_ans_script_header += "<td align='center' style='width:85px;'>";
  $g_Dispatch_ans_script_header +=
    "<input name='dispatch_ans_subcode' id='dispatch_subcode_1' type='text' style='width:75px;'";
  $g_Dispatch_ans_script_header +=
    "onblur='getSubjectNameForDispatchScriptBlur(this.id);'";
  $g_Dispatch_ans_script_header += "onclick='$g_dispatch_ans_code=this.id'";
  $g_Dispatch_ans_script_header +=
    "onkeydown='return keyboardSubjectNamesPopupForAnswerScript(event,1);'";
  $g_Dispatch_ans_script_header +=
    "onfocus='assignGolbalDispatchScriptIDSQp(this.id)'/>";
  $g_Dispatch_ans_script_header += "</td>";
  $g_Dispatch_ans_script_header += "<td align='center' style='width:210px;' >";
  $g_Dispatch_ans_script_header +=
    "<input name='dispatch_ans_name' id='dispatch_name_1' readonly";
  $g_Dispatch_ans_script_header += "onclick='$g_dispatch_ans_name=this.id'";
  $g_Dispatch_ans_script_header += " type='text' style='width:200px;' />";
  $g_Dispatch_ans_script_header += "</td>";
  $g_Dispatch_ans_script_header += "<td align='center' style='width:80px;'>";
  $g_Dispatch_ans_script_header +=
    "<input name='dispatch_ans_buddles' id='dispatch_buddles_1' type='text' style='width:70px;'/>";
  $g_Dispatch_ans_script_header += "</td>";
  $g_Dispatch_ans_script_header += "<td align='center' style='width:80px;'>";
  $g_Dispatch_ans_script_header +=
    "<input type=text  id=dispatch_script_1 name=dispatch_ans_script  style='width:70px;' onblur='CheckForEmptyToCreatNextRow(this.id);' /></td>";
  $g_Dispatch_ans_script_header += "</tr>";
  $g_Dispatch_ans_script_header += "</table>";
}