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


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

function callpostnotification() {
  $("#page_main_div").load(
    "../html_modules/postnotificationRead.html",
    function () {
      document.getElementById("display_module_name").innerHTML =
        "Post Notification";
      document.getElementById("module_name_for_save").value =
        "Post Notification";
      getDefaultHeadFooterLinks("Post Notification");
      getPostnotificationDetails();
    }
  );
}

function getPostnotificationDetails() {
  $.ajax({
    type: "POST",
    url: $host_url + "getPostnotificationDetails",
    success: bulidPostNotificationTable,
  });
}

function bulidPostNotificationTable(response) {
  response = eval("(" + response + ")");
  // console.log("resresresponsesese",response);

  var result = response.data;
  html = "";
  console.log("resultresultresult", result);
  html += `<table class='table table-bordered table-striped table-upd' style="border-spacing: 0px !important" cellpading="2">
        <thead>
        <tr class='ui-state-default ui-jqgrid-hdiv'>
            <th style='padding:2px; width:20px; 
            border-top:1px solid #C5DBEC; 
            border-left:1px solid #C5DBEC; 
            border-right:1px solid #C5DBEC; 
            border-bottom:1px solid #C5DBEC;'>Sl No.</th>

            <th style='padding:2px; width:175px;
            border-top:1px solid #C5DBEC;  
            border-right:1px solid #C5DBEC; 
            border-bottom:1px solid #C5DBEC;'>Label</th>

            <th style='padding:2px; width:40px; border-right:1px solid #C5DBEC; border-top:1px solid #C5DBEC; 
            border-bottom:1px solid #C5DBEC;'>File Name</th>

            <th style='padding:2px; width:75px; 
            border-top:1px solid #C5DBEC; 
            border-right:1px solid #C5DBEC; 
            border-bottom:1px solid #C5DBEC;'>From Date</th>

            <th style='padding:2px; width:75px;
            border-top:1px solid #C5DBEC;  
            border-right:1px solid #C5DBEC; 
            border-bottom:1px solid #C5DBEC;'>From To</th>

            <th style='padding:2px; width:20px; 
            border-right:1px solid #C5DBEC;
            border-top:1px solid #C5DBEC;  
            border-bottom:1px solid #C5DBEC; '>Order</th>	

            <th style='padding:2px; width:75px; 
            border-right:1px solid #C5DBEC;
            border-top:1px solid #C5DBEC;  
            border-bottom:1px solid #C5DBEC;'>Action</th>
        <tr>
        </thead>
    <tbody>`;
  for (var i = 0; i < result.length; i++) {
    // console.log("asaasasa",result['i']);
    let row = result[i];
    html += `
            <tr class='ui-widget-content jqgrow'>
                <td class='tbl_row_new' align='center' 
                style='border-left:1px solid #C5DBEC; 
                border-right:1px solid #C5DBEC; padding:2px;'>${i + 1}</td>
                <td class='tbl_row_new' align='left' style='border-right:1px solid #C5DBEC; padding:5px;'>${
                  row["flabel"]
                }</td>
                <td class='tbl_row_new' align='center' style='border-right:1px solid #C5DBEC; padding:5px;'><a target="blank" href='${
                  row["ffilepath"]
                }'>link</a></td>
                <td class='tbl_row_new' align='center' style='border-right:1px solid #C5DBEC; padding:5px;'>${
                  row["ffromdate"]
                }</td>
                <td class='tbl_row_new' align='center' style='border-right:1px solid #C5DBEC; padding:5px;'>${
                  row["ftodate"]
                }</td>
                <td class='tbl_row_new' align='center' style='border-right:1px solid #C5DBEC; padding:5px;'>${
                  row["forder"]
                }</td>		
                <td class='tbl_row_new' align='center' style='border-right:1px solid #C5DBEC; padding:5px;'><a href="#" onclick="callpostnotificationEdit(${
                  row["fpostno"]
                })">Edit</a> | <a href="#" onclick="callpostnotificationDelete(${
      row["fpostno"]
    })">Delete</a></td>
            </tr>`;
  }
  html += `</tbody>
    </table>`;

  $("#getpostnotfTable").html(html);
}

function callpostnotificationAdd() {
  $("#page_main_div").load(
    "../html_modules/postnotification.html",
    function () {
      document.getElementById("display_module_name").innerHTML =
        "Post Notification";
      document.getElementById("module_name_for_save").value =
        "Add Post Notification";
      getDefaultHeadFooterLinks("Post Notification");
    }
  );
}

function callpostnotificationEdit(postno) {
  html = "";
  $.ajax({
    type: "POST",
    url: $host_url + "getPostnotificationEdit&postno=" + postno,
    success: function (response) {
      response = eval("(" + response + ")");
      var result = response.data;
      $("#page_main_div").load(
        "../html_modules/postnotification.html",
        function () {
          document.getElementById("display_module_name").innerHTML =
            "Post Notification";
          document.getElementById("module_name_for_save").value =
            "Edit Post Notification";
          getDefaultHeadFooterLinks("Post Notification");

          document.getElementById("label_type").value = result["flabel"];
          html += `File Uploded before:  <a target="blank" href="${result["ffilepath"]}">File</a></br>
                <a href="#" onclick="document.getElementById('hfilepath').value = 'T'">Use same</a>`;
          $("#editfile").html(html);
          document.getElementById("postno").value = result["fpostno"];
          document.getElementById("post_date_from").value = result["ffromdate"];
          document.getElementById("post_date_to").value = result["ftodate"];
          document.getElementById("order_no").value = result["forder"];
          document.getElementById("colour").value = result["fcolour"];
        }
      );
    },
  });
}

function callpostnotificationDelete(postno) {
  confirm("Sure to delete");
  $.ajax({
    type: "POST",
    url: $host_url + "getPostnotificationDelete&postno=" + postno,
    success: function (response) {
      console.log("deldeldel", response);
      getPostnotificationDetails();
    },
  });
}
function savepostnotification() {
  if (trim(document.getElementById("label_type").value) == "") {
    alert("Please enter the Label");
    document.getElementById("label_type").focus();
    return;
  }

  // if (
  //   document.getElementById("module_name_for_save").value ==
  //     "Edit Post Notification" &&
  //   document.getElementById("hfilepath").value == "F"
  // ) {
  //   if (trim(document.getElementById("filepath").value) == "") {
  //     alert("Please choose filepath");
  //     document.getElementById("filepath").focus();
  //     return;
  //   }
  // }
  if (trim(document.getElementById("post_date_from").value) == "") {
    alert("Please enter From Date");
    document.getElementById("post_date_from").focus();
    return;
  }

  if (trim(document.getElementById("post_date_to").value) == "") {
    alert("Please enter To Date");
    document.getElementById("post_date_to").focus();
    return;
  }

  if (trim(document.getElementById("order_no").value) == "") {
    alert("Please enter Order number of Notification");
    document.getElementById("order_no").focus();
    return;
  }

  if (trim(document.getElementById("colour").value) == "") {
    alert("Please select Colour for Notification");
    document.getElementById("colour").focus();
    return;
  }

  if (trim(document.getElementById("select_value").value) == "") {
    alert("Please select College or Student Portal");
    document.getElementById("select_value").focus();
    return;
  }

  if (document.getElementById("radio_yes").checked) {
    rate_value = document.getElementById("radio_yes").value;
  } else {
    rate_value = "No";
  }
  var type =
    document.getElementById("module_name_for_save").value ==
    "Edit Post Notification"
      ? "edit"
      : "add";
  if (
    document.getElementById("module_name_for_save").value ==
      "Edit Post Notification" &&
    document.getElementById("hfilepath").value == "F"
  ) {
    var file_file = "filepath";
    var file_name = $("#" + file_file).val();
    var file_size = $("#" + file_file)[0].files[0].size;
    var file_extn = file_name.split(".").pop();
    var file_extn = file_extn.toLowerCase();
    if (
      file_extn == "xls" ||
      file_extn == "xlsx" ||
      file_extn == "pdf" ||
      file_extn == "jpg" ||
      file_extn == "jpeg"
    ) {
    } else {
      alert("xls, xlsx, PDF files are allowed!");
      return false;
    }

    if (file_size >= 1000000) {
      alert("Upload files with size less then 1MB!");
      return false;
    }
  }

  var select = document.getElementById("select_value");
  var text = select.options[select.selectedIndex].value;
  // console.log(text);
  // return;
  var file_name = "";
  var postno = document.getElementById("postno").value;
  var list_data = "";
  list_data = $host_url + "savepostnotification";
  list_data += "&postno=" + postno;
  list_data += "&filepath=" + file_name;
  list_data += "&type=" + type;
  list_data +=
    "&label_type=" + trim(document.getElementById("label_type").value);

  list_data +=
    "&post_date_from=" + trim(document.getElementById("post_date_from").value);
  list_data +=
    "&post_date_to=" + trim(document.getElementById("post_date_to").value);
  list_data += "&order_no=" + trim(document.getElementById("order_no").value);
  list_data += "&colour=" + trim(document.getElementById("colour").value);
  list_data += "&select_value=" + text;

  list_data += "&rate_value=" + rate_value;
  list_data += "&samefile=" + trim(document.getElementById("hfilepath").value);

  document
    .getElementById("form_module_image_upload")
    .setAttribute("action", list_data);
  return AIM.submit(
    document.getElementById("form_module_image_upload"),
    "report_display",
    { onComplete: savepostnotificationResponce }
  );
}

function savepostnotificationResponce($responce) {
  $responce = eval("(" + $responce + ")");
  alert($responce.data);
}

function Clearpostnotification() {
  document.getElementById("label_type").value = "";
  document.getElementById("filepath").value = "";
  document.getElementById("post_date_from").value = "";
  document.getElementById("post_date_to").value = "";
  document.getElementById("order_no").value = "";
  document.getElementById("colour").value = "";
  document.getElementById("select_value").value = "";
  document.getElementById("rate_value").value = "";
}