Login Page
' document.getElementById('errmsg').append(uninsrted)} }else{ document.getElementById('errmsgfrspradmn').remove(); $('#loading_id').addClass("fa fa-spinner fa-spin"); var displayName = document.getElementById("display-name-id").value; var mail = document.getElementById("friend_email").value; $('#invfr_form #company_name_display_val').val(displayName); $('#invfr_form #user_email').val(mail); $('#invfr_form #friend_email').val(mail); }} function generateData(){ if(document.getElementById('friend_email').value =="" ){ if(!document.getElementById('errmsgfrspradmn')){ let uninsrted = document.createElement('div') uninsrted.innerHTML= '
Please fill in all the fields above.
' document.getElementById('errmsg').append(uninsrted)} }else{ if(selectedName != "" && selectedId != "") { // document.getElementById("generate_div").visibility = "hidden"; // $('#loading_id_for_generate').addClass("fa fa-spinner fa-spin"); $('#w-form-fail-id').css("display", "none"); $('#w-form-done-id').css("display", "none"); var displayName = document.getElementById("display-name-id").value ?? ""; var mail = document.getElementById("friend_email").value ?? ""; //var url = "//" + "/addnewuser?cn=" + displayName + "&cid=" + selectedId + "&cdn=" + selectedName + "&ml=" + mail; $.ajax({ type: 'POST', url: url, data: { action: "generate-url", cn: displayName, cid: selectedId, cdn: selectedName, ml: mail } , success: function (msg) { var url = "https://zeustra.com"+msg document.getElementById('link_id').href = url; document.getElementById('link_id').innerText = url; $("#link_id").css("display", "block"); $("#copy_btn").css("display", "block"); } // $('#loading_id_for_generate').removeClass("fa fa-spinner fa-spin"); }) ; }} } function copyText(){ $('#w-form-fail-id').css("display", "none"); $('#w-form-done-id').css("display", "none"); var copyText = document.getElementById('link_id').innerText; navigator.clipboard.writeText(copyText); } var win = window, doc = document, docElem = doc.documentElement, body = doc.getElementsByTagName('body')[0]; function onInput() { try { clearTimeout(typingTimer); $('#friend_name-0').removeClass("ui-loading"); document.getElementById("friend_name-0").blur(); $('#invfr_form #company_name_val').val(selectedName); $('#invfr_form #company_id_val').val(selectedId); } catch (e) { $('#friend_name-0').remove("ui-loading"); } } function closeAllLists(elmnt) { /*close all autocomplete lists in the document, except the one passed as an argument:*/ var x = document.getElementsByClassName("companies"); for (var i = 0; i < x.length; i++) { if (elmnt != x[i] && elmnt != inp) { x[i].parentNode.removeChild(x[i]); } } } //user is "finished typing," do something function doneTyping() { var name = document.getElementById("friend_name-0").value; if (companies != null && !isFound) { companies.some(function (entry) { if (entry["Name"] == name) { let id = entry["Id"]; isFound = true; selectedName = name; selectedId = id; onInput(); return true; } }); } if (selectedName != name && name != "") { $('#friend_name-0').addClass("ui-loading"); getAccountNamesRequest(false); isFound = false; } } function doneTypingAccount(){ var name = document.getElementById("CompanyName2").value; if (companies != null && !isFound) { companies.some(function (entry) { if (entry["Name"] == name) { let id = entry["Id"]; isFound = true; selectedName = name; selectedId = id; onInput(); return true; } }); } if (selectedName != name && name != "") { $('#CompanyName2').addClass("ui-loading"); isFound = false; } } function showTable(){ var text = document.getElementById("tableTitle").innerText; var view = document.getElementById("tabledata"); if(text == "High priority accounts +"){ document.getElementById("tableTitle").innerText = "High priority accounts -"; view.style.display = "block"; }else{ document.getElementById("tableTitle").innerText = "High priority accounts +"; view.style.display = "none"; } } function propertiesPage(){ document.getElementById("invfr_form").style.display = "none"; document.getElementById("account_form").style.display = "none"; document.getElementById("properties_form").style.display = "block"; $('#invitePageId').removeClass("active"); $('#accountsPageId').removeClass("active"); $('#propertiesPageId').addClass("active"); } function accountsPage(){ $('#CompanyName2').removeClass("ui-loading"); document.getElementById("invfr_form").style.display = "none"; document.getElementById("account_form").style.display = "block"; document.getElementById("properties_form").style.display = "none"; $('#invitePageId').removeClass("active"); $('#accountsPageId').addClass("active"); $('#propertiesPageId').removeClass("active"); } function invitePage(){ $('#friend_name-0').removeClass("ui-loading"); document.getElementById("invfr_form").style.display = "block"; document.getElementById("account_form").style.display = "none"; document.getElementById("properties_form").style.display = "none"; $('#invitePageId').addClass("active"); $('#accountsPageId').removeClass("active"); $('#propertiesPageId').removeClass("active"); } function myFunction() { var input, filter, table, tr, td, i, txtValue; input = document.getElementById("myInput"); filter = input.value.toUpperCase(); table = document.getElementById("myTable"); tr = table.getElementsByTagName("tr"); for (i = 0; i < tr.length; i++) { td = tr[i].getElementsByTagName("td")[0]; if (td) { txtValue = td.textContent || td.innerText; if (txtValue.toUpperCase().indexOf(filter) > -1) { tr[i].style.visibility = ""; } else { tr[i].style.visibility = "collapse"; } } } } function infoWindow(address,infowindow,marker,latitude,longitude,map,address_components,newAddress){ searching_address = newAddress; var data = JSON.stringify(address_components).replace(/"/g, '"'); let img = "https://maps.googleapis.com/maps/api/streetview?size=400x150&location="+latitude+","+longitude+"&heading: 34&pitch=10&key=AIzaSyDjO8Ud-xcHlMlyyMPrpbJzbo2g79nbvyo"; var contentString = '
' + 'Card image cap' + '' + '' + '
'; infowindow.setContent(contentString); infowindow.open(map, marker); } function viewPropertyButtonAction(address){ if(address) { myWorker.postMessage(["request-address-properties", address, url]); myWorker.onmessage = function (e) { let return_data = e.data; if (return_data['PropertiesPage'] && return_data['NumOfAllProperties'] > 0) { assignPreLoaders(); let details_data = document.querySelector(".deatils_data"); details_data.style.cssText = 'display:contents;'; let main_login_section = document.querySelector(".main-login-section"); main_login_section.style.cssText = 'display:none;'; if (return_data['PropertiesPage'][0]) { let property = return_data['PropertiesPage'][0]; myWorker.postMessage(["request-property-details", property['Id'], url]); myWorker.onmessage = function (e) { getpropertydetails(e['data']); } } } else { $("#noPropertiesAlert").show().delay(3500).fadeOut(); } } }else { $("#noPropertiesAlert").show().delay(3500).fadeOut(); } } function initMapOne() { const componentForm = [ 'location', 'locality', 'administrative_area_level_1', 'country', 'postal_code', ]; const map = new google.maps.Map(document.getElementById("mapOne"), { zoom: 12, center: {lat: 37.4221, lng: -122.0841}, mapTypeControl: true, fullscreenControl: true, zoomControl: true, streetViewControl: true, styles: [ {elementType: "geometry", stylers: [{color: "#242f3e"}]}, {elementType: "labels.text.stroke", stylers: [{color: "#242f3e"}]}, {elementType: "labels.text.fill", stylers: [{color: "#746855"}]}, { featureType: "administrative.locality", elementType: "labels.text.fill", stylers: [{color: "#d59563"}], }, { featureType: "poi", elementType: "labels.text.fill", stylers: [{color: "#d59563"}], }, { featureType: "poi.park", elementType: "geometry", stylers: [{color: "#263c3f"}], }, { featureType: "poi.park", elementType: "labels.text.fill", stylers: [{color: "#6b9a76"}], }, { featureType: "road", elementType: "geometry", stylers: [{color: "#38414e"}], }, { featureType: "road", elementType: "geometry.stroke", stylers: [{color: "#212a37"}], }, { featureType: "road", elementType: "labels.text.fill", stylers: [{color: "#9ca5b3"}], }, { featureType: "road.highway", elementType: "geometry", stylers: [{color: "#746855"}], }, { featureType: "road.highway", elementType: "geometry.stroke", stylers: [{color: "#1f2835"}], }, { featureType: "road.highway", elementType: "labels.text.fill", stylers: [{color: "#f3d19c"}], }, { featureType: "transit", elementType: "geometry", stylers: [{color: "#2f3948"}], }, { featureType: "transit.station", elementType: "labels.text.fill", stylers: [{color: "#d59563"}], }, { featureType: "water", elementType: "geometry", stylers: [{color: "#17263c"}], }, { featureType: "water", elementType: "labels.text.fill", stylers: [{color: "#515c6d"}], }, { featureType: "water", elementType: "labels.text.stroke", stylers: [{color: "#17263c"}], } ] }); const image = { url: "https://zeustra.com/wp-content/plugins/Account/includes/assets/images/Group-224.svg", // url scaledSize: new google.maps.Size(35, 50), // scaled size origin: new google.maps.Point(0,0), // origin anchor: new google.maps.Point(0, 0) // anchor }; const marker = new google.maps.Marker({map: map,icon:image,draggable: true}); var position = null; const autocompleteInput = document.getElementById('propertiesName'); const autocomplete = new google.maps.places.Autocomplete(autocompleteInput, { fields: ["address_components", "geometry", "name", "formatted_address"], types: ["address"], }); autocomplete.addListener('place_changed', function () { marker.setVisible(false); const place = autocomplete.getPlace(); if (!place.geometry) { geocoder.geocode({ 'address' : autocompleteInput.value }, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { if (results[0]) { if(infowindow){ infowindow.close(); } autocompleteInput.value = results[0].formatted_address; // position = marker.getPosition(); var address_components = results[0]; var data = JSON.stringify(address_components); var dataFormatted = JSON.parse(data); var lat = dataFormatted['geometry']['location']['lat']; var lng = dataFormatted['geometry']['location']['lng']; var newAddress = addressConcatenate(address_components); var location = new google.maps.LatLng(lat, lng); map.setCenter(location); marker.setPosition(location); position = marker.getPosition(); marker.setVisible(true); infoWindow(results[0].formatted_address,infowindow,marker,lat,lng,map,address_components,newAddress); } } }); } else { renderAddress(place); fillInAddress(place); } if(infowindow){ infowindow.close(); } renderAddress(place); fillInAddress(place); }); var geocoder = new google.maps.Geocoder(); var infowindow = new google.maps.InfoWindow({ maxWidth: 400, maxheight: 150, }); google.maps.event.addListener(autocompleteInput, 'keydown', function(event) { if (event.keyCode === 13) { event.preventDefault(); } }); google.maps.event.addListener(marker, 'dragend', function(event) { geocoder.geocode({ 'latLng': event.latLng }, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { if (results[0]) { if(infowindow){ infowindow.close(); } autocompleteInput.value = results[0].formatted_address; // position = marker.getPosition(); var address_components = results[0]; var data = JSON.stringify(address_components); var dataFormatted = JSON.parse(data); var newAddress = addressConcatenate(address_components); position = marker.getPosition(); infoWindow(results[0].formatted_address,infowindow,marker,position.lat(),position.lng(),map,address_components,newAddress); } } }); }); marker.addListener("click", (event) => { geocoder.geocode({ 'latLng': event.latLng }, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { if (results[0]) { if(infowindow){ infowindow.close(); } autocompleteInput.value = results[0].formatted_address; position = marker.getPosition(); var address_components = results[0]; var data = JSON.stringify(address_components); var dataFormatted = JSON.parse(data); var newAddress = addressConcatenate(address_components); position = marker.getPosition(); infoWindow(results[0].formatted_address,infowindow,marker,position.lat(),position.lng(),map,address_components,newAddress); } } }); }); google.maps.event.addListener(map, 'click', function(event) { marker.setVisible(true); marker.setPosition(event.latLng); geocoder.geocode({ 'latLng': event.latLng }, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { if (results[0]) { if(infowindow){ infowindow.close(); } autocompleteInput.value = results[0].formatted_address; var address_components = results[0]; var data = JSON.stringify(address_components); var dataFormatted = JSON.parse(data); var newAddress = addressConcatenate(address_components); position = marker.getPosition(); infoWindow(results[0].formatted_address,infowindow,marker,position.lat(),position.lng(),map,address_components,newAddress); } } }); }); function fillInAddress(place) { // optional parameter const addressNameFormat = { 'street_number': 'short_name', 'route': 'long_name', 'locality': 'long_name', 'administrative_area_level_1': 'short_name', 'country': 'long_name', 'postal_code': 'short_name', }; const getAddressComp = function (type) { for (const component of place.address_components) { if (component.types[0] === type) { return component[addressNameFormat[type]]; } } return ''; }; for (const component of componentForm) { // Location field is handled separately above as it has different logic. if (component !== 'location') { } } } function renderAddress(place) { map.setCenter(place.geometry.location); marker.setPosition(place.geometry.location); marker.setVisible(true); if(infowindow){ infowindow.close(); } //TODO let address_components = place; var newAddress = addressConcatenate(address_components); position = marker.getPosition(); infoWindow(autocompleteInput.value,infowindow,marker,position.lat(),position.lng(),map,address_components,newAddress); } } function getpropertydetails(d) { window.scrollTo(0, 0); if (d) { let data = d; let imageUrl = 'https://zeustra.com/wp-content/plugins/Account/includes/salesforce-request.php'; hide_map_links_popup_details(); getChosenPropertyDetails(data,imageUrl); sharpLaunch( data['Latitude__c'],data['Longitude__c'],data['Name'],data['Display_Address__c'],data['Id'],map_styles); if(is.safari()){ document.getElementById("prevWrapper").style.cssText="margin-left:-45% !important;display: block;cursor: not-allowed;"; document.getElementById("nextWrapper").style.cssText="margin-left:45% !important;display: block;cursor: not-allowed;"; }else if(is.chrome()){ document.getElementById("prevWrapper").style.cssText="margin-left: -93%!important;display: flex;cursor: not-allowed;"; document.getElementById("nextWrapper").style.cssText="margin-left: 93%!important;display: flex;cursor: not-allowed;"; } } else { console.log(data['Error']); } } function addressConcatenate(address){ let route = ''; let street_number = ''; let administrative_area_level_1 = ''; let postal_code = ''; let address_components = address['address_components']; for (const component in address_components) { if(address_components[component]['types'][0] == 'route'){ route = address_components[component]['long_name']; }else if(address_components[component]['types'][0] == 'street_number'){ street_number = address_components[component]['long_name']; }else if(address_components[component]['types'][0] == 'administrative_area_level_1'){ administrative_area_level_1 = address_components[component]['short_name']; }else if(address_components[component]['types'][0] == 'postal_code'){ postal_code = address_components[component]['long_name']; } } let newAddress = route + ' ' + street_number + ' ' + administrative_area_level_1 + ' ' + postal_code; return newAddress; } function senddateMap(id) { try { getpropertydetails_details(id.item(0).id); } catch (e) { getpropertydetails_details(id.id); } } function getpropertydetails_details(d) { assignPreLoaders(); let details_data = document.querySelector(".deatils_data"); details_data.style.cssText = 'display:contents;'; let main_login_section = document.querySelector(".main-login-section"); main_login_section.style.cssText = 'display:none;'; window.scrollTo(0, 0); myWorker.postMessage(["request-property-details", d, url]); myWorker.onmessage = function (e) { if (e.data['Error'] == null) { let imageUrl = 'https://zeustra.com/wp-content/plugins/Account/includes/salesforce-request.php'; let popupPropertyDetailsMap = document.getElementById('map_links_popup'); if($(popupPropertyDetailsMap).is(":hidden")){ getChosenPropertyDetails(e.data,imageUrl); sharpLaunch( e.data['Latitude__c'],e.data['Longitude__c'],e.data['Name'],e.data['Display_Address__c'],e.data['Id'],e.map_styles); }else{ hide_map_links_popup_details(); getChosenPropertyDetails(e.data,imageUrl); sharpLaunch( e.data['Latitude__c'],e.data['Longitude__c'],e.data['Name'],e.data['Display_Address__c'],e.data['Id'],e.map_styles); } } else { console.log(e.data['Error']); } } } document.addEventListener('fullscreenchange', exitFullScreenHandler); function openFullScreenSLMap() { document.querySelector(".mapWithBar").requestFullscreen(); document.querySelector("#mapSideBarID").style.height= "100vh"; document.querySelector("#properties-page-map-section").style.height= "100vh"; document.querySelector("#fullScreenSLbtn").style.display= "none"; } function exitFullScreenHandler() { if (!document.fullscreenElement) { document.querySelector("#fullScreenSLbtn").style.display= "flex"; document.querySelector("#mapSideBarID").style.height= "50vh"; document.querySelector("#properties-page-map-section").style.height= "50vh"; } }