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


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

const CallUpdateCollDet = () => {
  $("#page_main_div").load("html_modules/UpdateCollDet.html", function() {
    document.getElementById("display_module_name").innerHTML =
      "College Details Update";
    document.getElementById("module_name_for_save").value =
      "College Details Update";
    getDefaultHeadFooterLinks("College Details Update");
    getcollDet();
  });
};

const getcollDet = () => {
  $.ajax({
    type: "GET",
    url: $host_url + "getCollDet",
    success: response => {
      var { error_code, data, status } = JSON.parse(response);
      // console.log(error_code, data);
      var html = ``;
      if (error_code == -1) alert("No data found, please try after sometime.");

      if (error_code == 0) {
        Object.keys(data).forEach(() => {
          html = `
          <table class="TableBorder" cellpadding="10" cellspacing="2" width="100%" id="mainTable>

          <tr class="tblRow">
            <td  valign="top" class="web_text_gray_bold">College Code : </td>
            <td  valign="top" >
              <input name="fcollcode" id="fcollcode" placeholder=" College Code " 
                value="${
                  data["fcollcode"]
                }"  type="text" class="textfild_2" size="10" disabled />
            </td>
          </tr>
          <tr class="tblRow">
            <td  valign="top" class="web_text_gray_bold">College Name : </td>
            <td  valign="top">
              <input name="fcollname" id="fcollname" placeholder=" College Name " value="${
                data["fcollname"]
              }"  type="text" class="textfild_2" size="38" disabled />
            </td>
            <td  valign="top">
              <input name="ftown" id="fplace" placeholder=" Town" value="${
                data["ftown"]
              }"  type="text" class="textfild_2" size="20" />
            </td>
          </tr>
          <tr class="tblRow">
            <td valign="top" class="web_text_gray_bold">Address : </td>
            <td valign="top">
              <input name="fcolladdr1" size=38  id="colladdr1" placeholder=" Address  " value="${
                data["fcolladd1"]
              }" maxlength=50 type="text"  class="textfild_2"   /><br>
              <input name="fcolladdr2" size=38  id="colladdr2" maxlength=50 type="text"  class="textfild_2"  value="${
                data["fcolladd2"]
              }" /><br>
              <input name="fcolladdr3" size=38  id="colladdr3" maxlength=50 type="text"  class="textfild_2"  value="${
                data["fcolladd3"]
              }" /><br>
              <input name="fcolladdr4" size=38  id="colladdr4" maxlength=50 type="text"  class="textfild_2"  value="${
                data["fcolladd4"]
              }" />
            </td>
          </tr>
          <tr class="tblRow">
              <td valign="top" class="web_text_gray_bold">Get Current Location : </td>
              <td>
                <button style="background-color: #008CBA; border: none; color: white; padding: 4px; text-align: center;
                 text-decoration: none; display: inline-block; font-size: 12px; cursor: pointer; width:42%; margin-top: 5px;"
                 onClick="getLocation();return false;" type="button" name="flocation">Get Location</button>
                <input type="text" value="" id="fcoordinates"  name="fcoordinates"/>
                <input type="hidden" value="" id="lat" name="flat"/>
                <input type="hidden" value="" id="long"  name="flong"/>
              </td>
          </tr>
          <tr class="tblRow">
          <td  valign="top" class="web_text_gray_bold">Land Line Number : </td>
          <td  valign="top"><input name="fphone" id="fphone" placeholder=" Land Line Number " value="${
            data["fphone"]
          }"  type="text" class="textfild_2" size="15" />
          </td>
          </tr>
          <tr class="tblRow">
          <td  valign="top" class="web_text_gray_bold">Fax Number : </td>
          <td  valign="top"><input name="ffax" id="ffax" placeholder=" Fax Number " value="${
            data["ffax"]
          }"  type="text" class="textfild_2" size="38" />
          </td>
          </tr>
          <tr class="tblRow">
          <td  valign="top" class="web_text_gray_bold">Principal Name : </td>
          <td  valign="top"><input name="fprincipalname" id="fprincipalname" placeholder=" Principal Name " value="${
            data["fprincipalname"]
          }"  type="text" class="textfild_2" size="38" />
          </td>
          </tr>
          <tr class="tblRow">
            <td  valign="top" class="web_text_gray_bold">Mobile Number ( for sending communication SMS ): </td>
            <td  valign="top"><input name="fmobile" maxlength="10" id="fmobile" placeholder=" Mobile Number " value="${
              data["fmobile"]
            }"  type="text" class="textfild_2" size="15" />
            </td>
          </tr>
          <tr class="tblRow">
            <td  valign="top" class="web_text_gray_bold">Email ( for official communication ) : </td>
            <td  valign="top"><input name="femailid" id="femailid" placeholder=" Email " value="${
              data["femail"]
            }"  type="text" class="textfild_2" size="38" />
            </td>
          </tr>
          <tr class="tblRow">
            <td  valign="top" class="web_text_gray_bold">Alternate Mobile Number : </td>
            <td  valign="top"><input name="faltmobile" maxlength="10" id="faltmobile" placeholder=" Alternate Mobile " value="${
              data["faltmobile"]
            }"  type="text" class="textfild_2" size="15" />
            </td>
          </tr>
          </table>
          <br>

          `;
        });
        $("#CollForm").html(html);
      }
    }
  });
};

function getLocation() {
  if (navigator.geolocation) {
    navigator.geolocation.getCurrentPosition(function(position) {
      getAddress(position);
    });
  } else {
    console.log("navigator.geolocation not working");
  }
}

function getAddress(position) {
  console.log(
    "The location in lat lon format is: [",
    position.coords.latitude,
    ",",
    position.coords.longitude,
    "]"
  );
  var lat = position.coords.latitude;
  var long = position.coords.longitude;
  var fcoordinates = position.coords;
  console.log("fcoordinates", fcoordinates);
  document.getElementById("fcoordinates").setAttribute("value", fcoordinates);
  document.getElementById("lat").setAttribute("value", lat);
  document.getElementById("long").setAttribute("value", long);
}

const getUpdatedDet = () => {
  var values = {};
  var finalData = [];
  $("tr.tblRow td input").each(function() {
    values[$(this).attr("name")] = $(this).val();
  });

  finalData.push(values);
  // console.log(finalData);
  //  <span class="remodal-cancel" onclick='getUpdatedDet()'>Update</span>

  $.ajax({
    type: "POST",
    url: $host_url + "updateCollProfile",
    data: "&data=" + JSON.stringify(finalData),
    success: response => {
      var { error_code, data, status } = JSON.parse(response);
      if (error_code == 0) {
        setTimeout(function() {
          alert(data["msg"]);
          window.location.reload();
        }, 1000);
      } else alert(data["msg"]);
    }
  });
};