<!DOCTYPE html> <html> <head> <meta name="format-detection" content="telephone=no"> <meta name="msapplication-tap-highlight" content="no"> <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width"> <link href="css/ionicons.css" media="all" rel="stylesheet" type="text/css"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.11.2/css/all.css"> <link rel="stylesheet" type="text/css" href="css/materialize.min.css"> <link rel="stylesheet" type="text/css" href="css/style.css"> <script src="https://checkout.razorpay.com/v1/checkout.js"></script> <!--<script async defer src="https://maps.googleapis.com/maps/api/js?key=AIzaSyATNIp43MCc5heun-4dj-u9SpLrlzihyJ4&callback=initMap"></script>--> <!-- <link rel="stylesheet" href="//jonthornton.github.io/jquery-timepicker/jquery.timepicker.css"> --> <!--<script type="text/javascript" src="cordova.js"></script>--> <script type="text/javascript" src="js/jquery.js"></script> <title>Checkout Now</title> <style> .navbar { /*justify-content: end;*/ } .scrollbody{ overflow:auto!important; margin-bottom:250px!important; } .input-field label:not(.label-icon).active{ font-size: 14px!important; } input:not([type]).invalid, input:not([type]):focus.invalid, input[type=text].invalid, input[type=text]:focus.invalid, input[type=password].invalid, input[type=password]:focus.invalid, input[type=email].invalid, input[type=email]:focus.invalid, input[type=url].invalid, input[type=url]:focus.invalid, input[type=time].invalid, input[type=time]:focus.invalid, input[type=date].invalid, input[type=date]:focus.invalid, input[type=datetime].invalid, input[type=datetime]:focus.invalid, input[type=datetime-local].invalid, input[type=datetime-local]:focus.invalid, input[type=tel].invalid, input[type=tel]:focus.invalid, input[type=number].invalid, input[type=number]:focus.invalid, input[type=search].invalid, input[type=search]:focus.invalid, textarea.materialize-textarea.invalid, textarea.materialize-textarea:focus.invalid{ border-bottom: 1px solid #ccc; box-shadow: none } </style> <script type="text/javascript"> $(document).ready(function () { var RazorpayCheckout; // $('#c_add').onchange(); // $("#c_add").trigger("select"); // getCurrentAddress(); var city =''; var city1 =''; let userDetails = JSON.parse(localStorage['userDetails'].toString()); var city1 = userDetails.city; $.ajax({ url: base + '/appcode/fetch_city.php', dataType: 'json', success: function(res){ console.log(res); city +='<option value="" disabled selected>Choose your city</option>'; $.each(res, function(index, item){ if('hyderabad' == item.city_name){ // alert(1); city +=' <option value="'+item.city_name+'" selected>'+item.city_name+'</option>'; }else{ //alert(2); city +=' <option value="'+item.city_name+'">'+item.city_name+'</option>'; } }); //city +='<option value="">Other</option>'; //$('#city').empty().append(city); }, complete: function(){ } }); if (localStorage['shopping-cart-items'] != null) { //alert(0); shopping_cart = JSON.parse(localStorage['shopping-cart-items'].toString()); var a = 0; for(var k=0; k<shopping_cart.length;k++){ if(shopping_cart[k].subscribe == 'yes'){ //$('.ss').hide(); }else{ //$('.ss').show(); a = 1; } } if(a == 1){ $('.ss').show(); }else{ $('.ss').hide(); } } var data = ''; var phone = userDetails.phone; $.ajax({ url: base+'/appcode/fetch_address.php', data: {phone: phone}, dataType: 'JSON', async:false, type: 'POST', success: function(res){ console.log(res); if(res.status == 2){ data +=' <option value="">Choose saved address</option>'; }else{ $('.show_add').show(); data +=' <option value="">Choose saved address</option>'; $.each(res, function(index, item){ if(localStorage.hdrloc==item.id){ data +=' <option value="'+item.id+'" selected>'+item.title+'</option>'; } else{ data +=' <option value="'+item.id+'">'+item.title+'</option>'; } }); } $('#c_add').empty().append(data); } }); var save_add = $('#c_add').val(); $.ajax({ url: base+'/appcode/fetch_address1.php', data: {id: save_add}, async:false, dataType: 'JSON', type: 'POST', success: function(res){ console.log("fetch_address1"); console.log(res) if(res){ if(res.status == 2){ }else{ $('.show_add').show(); $('#name').val(res.name); $('#email').val(res.email); $('#address').val(res.address); $('#pinc').val(res.pincode); $('#cord').val(res.cords); $('#city').val(res.city); $('.check_btn').show(); $('.shw_btn').hide(); } } } }); $('#main-container').on('change', '.show_add', function(){ var save_add = $('#c_add').val(); $.ajax({ url: base+'/appcode/fetch_address1.php', data: {id: save_add}, async:false, dataType: 'JSON', type: 'POST', success: function(res){ console.log(res); if(res.status == 2){ }else{ $('.show_add').show(); $('#name').val(res.name); $('#email').val(res.email); $('#address').val(res.address); $('#pinc').val(res.pincode); $('#cord').val(res.cords); $('#city').val(res.city); $('.check_btn').show(); $('.shw_btn').hide(); } } }); }); }); </script> </head> <body> <div class="web-header" style="display: none;"></div> <header class="header white-text pink-bg z-depth-1"> <div class="navbar"> <button class="navigation button-collapse" onclick="goBack()" style="background: #c9f1e6;"> <i class="ion-android-arrow-back"></i> </button> <h5 style="">Checkout Now</h5> <button class="pink-bg navigation go-to-cart" onclick="window.location.href='#'"> </button> </div> </header> <br><br> <div class="main-container" id="main-container"> <div class="form-container" style="margin-top: 30px!important;"> <h5 class="heading semibold">Please Enter Your Details</h5> <div class="input-field show_add"> <select name="c_add" id="c_add" style="background: #39a3f9; color: #fff;"> </select> </div> <div class="input-field center"> <button class="btn" onclick="window.location.href='add-address.html'">Add Address</button> </div> <form class="row checkout-form scrollbody" style="display: block"> <!-- <input id="name" type="hidden" name="name"> <input id="email" type="hidden" name="email"> <input id="phone" type="hidden" name="phone"> <input id="address" type="hidden" name="address"> <input id="city" type="hidden" name="city"> <input id="pin" type="hidden" name="pin"> --> <div class="input-field" style="margin-bottom: 16px;"> <input id="name" type="text" name="name" autocomplete="true" required class="validate input-text" style="margin-top: -20px;border: 1px solid #ddd!important;"> <label for="name" class="label" style="margin-top:12px;">Full Name <b class="red-text">*</b></label> </div> <div class="input-field" style="margin-bottom: 16px;"> <input id="email" type="email" name="email" autocomplete="true" class="validate input-text" style="margin-top: -20px;border: 1px solid #ddd!important;border-radius: 5px;" > <label for="email" class="label" style="margin-top:12px; ">Email </label> </div> <div class="input-field" style="margin-bottom:25px;"> <input id="phone" type="text" name="phone" autocomplete="true" required class="validate input-text" style="border: 1px solid #ddd!important;"> <label for="phone" class="label" style="margin-top:12px;">Mobile <b class="red-text">*</b></label> </div> <div class="input-field" style="margin-bottom:25px;"> <input id="city" type="text" name="city" autocomplete="true" required class="validate input-text" style="margin-top: -20px;border: 1px solid #ddd!important;"> <label for="phone" class="label" style="margin-top:12px;">City </label> </div> <!-- <div class="input-field" style="margin: 30px 9px;"> <span class="" style="margin-left: 30px;color: #99999c;margin-top: -10px;position: absolute;font-size: 14px;">City<b class="red-text">*</b></span> <select name="city" id="city" class="material-select" disabled style="border: 1px solid #ddd;margin-top:-20px;float: right;width: 70%;border-radius: 5px; margin-left: 0px;margin-right: -23px;display: block;padding: 0;"> <option value="" disabled selected>Choose City</option> </select> </div> --> <div class="input-field" style="margin-bottom: 25px;"> <input id="cur_address" name="cur_address" type="checkbox" value="Y" class="validate input-text" style="margin-top: -20px;border: 1px solid #ddd!important;" > <label for="cur_address" class="" style="margin-top:12px;"> Choose Current Location <b class="red-text">*</b></label> </div><br> <div class="input-field" style="margin-bottom: 25px;"> <textarea id="address" name="address" autocomplete="true" required class="validate input-text" style="margin-top: -20px;border: 1px solid #ddd!important;" ></textarea> <label for="address" class="address" style="margin-top:12px;">Address <b class="red-text">*</b></label> </div> <input name="cord" id="cord" class="form-control" type="hidden" placeholder="Preferred Area"> <div class="input-field" style="margin-bottom: 25px;"> <input id="pinc" type="text" name="pinc" autocomplete="true" class="validate input-text" style="margin-top: -20px;border: 1px solid #ddd!important;border-radius: 5px;" required > <label for="pinc" class="label" style="margin-top:12px; ">Pincode </label> </div> <!-- <div class="clear"></div> <div class="my-input" onclick="getCurrentAddress();"> <button type="button" class="main-color btn fa fa-map-marker" style="background-color: #08c4fd;color: #fff;display: flex;justify-content: center;width: 100%;" id="show_map"> Get Current Address</button> </div> <div class="categories"><p></p><br> <div class="input-field"> <div id="select_area"> <div id="select_address_1"> <input id="search_preffered_address1" type="text" value="" class="" placeholder="search your location" style="margin-bottom: 5px;"> <input id="search_prefered_address1_button" type="button" value="Search" style="margin-bottom:14px;"> </div> <div id="map" style="height: 300px; margin-bottom: 20px"></div> <p>Just drop the markers on your preffered location and that's it.</p> </div> <div class="col-md-6"> <input name="preferred_area1" class="form-control" type="hidden" placeholder="Preferred Area"> </div> <div class="col-md-6"> <input name="preferred_area2" class="form-control" type="hidden" placeholder="Preferred Area"> </div> </div> --> <!--<div class="input-field ss">--> <!--Set Delivery Date<span class="red-text">*</span> --> <!--<input id='txtdate' class="datepicker black-text validate" name='delivery_date' type='date' placeholder="dd-mm-yy" style="color: black !important;">--> <!--</div>--> <!--<p class="dt"></p>--> <!--<div class="input-field ss">--> <!--Select Delivery Time<span class="red-text">*</span> --> <!--<select class="delivery_time1 browser-default" name="delivery_time" style="display: block !important;" > --> <!-- <option value="">Choose Delivery Time</option>--> <!--</select> --> <!-- <input type="text" name="delivery_time" id="delivery_time" class="delivery_time" placeholder="hh-mm" required> --> <!-- <input id='txtdate' class='datepicker black-text' name='dob' type='date' placeholder="dd-mm-yy">--> <!--</div>--> <span class="blue-grey-text" style="margin-left: 19px;">Payment Method <b class="red-text">*</b></span> <ul style="width: 90%;border: 1px solid #ddd;margin: 0 5%;"> <li style="padding: 10px;border-bottom: 1px solid #ddd!important;" class="choose_payment cod_amt" id="cod_amt" data-payment_type="cod"><span style="display: flex;justify-content: space-between"><span style="font-weight: bold;text-transform: uppercase;">Cash on Delivery</span> <span style="font-weight: bold;text-transform: uppercase;color: #6565da;">select</span></span></li> <li style="padding: 10px;border-bottom: 1px solid #ddd!important;" class="choose_payment" data-payment_type="pay_u"><span style="display: flex;justify-content: space-between"><span style="font-weight: bold;text-transform: uppercase;">Online</span> <span style="font-weight: bold;text-transform: uppercase;color: #6565da;">select</span></span></li> <li style="padding: 10px;border-bottom: 1px solid #ddd!important;" class="choose_payment" data-payment_type="wallet"><span style="display: flex;justify-content: space-between"><span style="font-weight: bold;text-transform: uppercase;">Wallet</span> <span style="font-weight: bold;text-transform: uppercase;color: #6565da;">select</span></span></li> </ul> <!-- <div class="my-input"> <p id="gift-wrap-container"> <input type="checkbox" name="gift_wrap" id="gift_wrap" value="true"> <label for="gift_wrap" class="main-color"></label> </p> </div> --> <!-- <div class="my-input"> <p id="guest-checkout-container"> <input type="checkbox" name="guest_checkout" id="guest_checkout" value="true" checked required> <label for="guest_checkout" class="main-color">Guest Checkout</label> </p>font-weight: bold; text-transform: uppercase; color: #6565da; </div> --> <!-- <button type="button" value="cod">SELECT</button> --> <div class="center-align input-field"> <button class="waves-effect waves-orange check darken-2 white-text flat-btn gray" type="submit" disabled style="background-color: green;"> Checkout & Pay </button> </div> </form> </div> </div> <!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/js/materialize.min.js"></script> --> <!-- <script type="text/javascript" src="js/materialize.min.js"></script> <script src="//jonthornton.github.io/jquery-timepicker/jquery.timepicker.js"></script> --> <!-- <script type="text/javascript" src="js/functions.js"></script> --> <script type="text/javascript" src="js/materialize.min.js"></script> <!-- <script type="text/javascript" src="js/myfunctions.js"></script> --> <script type="text/javascript"> function onSuccess(position) { var lat = position.coords.latitude; var lng = position.coords.longitude; localStorage.resLat = lat; localStorage.resLong = lng; // getAddress(lat,lng); console.log(position); // alert(1) } function onError(error) { console.log('code: ' + error.code + '\n' + 'message: ' + error.message + '\n'); } $(function(){ $(".main-container").on("click","#cur_address",function(){ if($("#cur_address").is(":checked")){ navigator.geolocation.getCurrentPosition(onSuccess, onError); }else{ alert("Please Enter Address"); $("#address").val(""); } }) }) $(document).ready(function () { var dpSelectedDate = ''; const convertTime12to24 = (time12h) => { const [fullMatch, time, modifier] = time12h.match(/(\d?\d:\d\d)\s*(\w{2})/i); let [hours, minutes] = time.split(':'); if (hours === '12') { hours = '00'; } if (modifier === 'PM') { hours = parseInt(hours, 10) + 12; } return `${hours}:${minutes}`; } /*console.log(convertTime12to24('01:02 PM'));*/ var ttAmount = localStorage.total; //alert(ttAmount); $.ajax({ url: base +"/appcode/fatch_max_ammont.php", type: "post", dataType:"json", // data: {type: localStorage.shopname}, success: function(response) { console.log("min_value!success"); console.log(response); var min_value = response[0].min_value; localStorage.min_value = min_value; console.log(min_value); console.log (localStorage.total +">="+ localStorage.min_value) if(parseInt(localStorage.total) >= parseInt(localStorage.min_value) ){ console.log (localStorage.total +">="+ localStorage.min_value) console.log("cod h") $('.cod_amt').hide(); }else{ console.log (localStorage.total +">="+ localStorage.min_value) console.log("cod s") $('.cod_amt').show(); } // if(min_value >= ttAmount ){ // console.log(min_value +">="+ ttAmount) // $('#cod_amt').hide(); // }else{ // console.log(min_value +">="+ ttAmount) // $('#cod_amt').show(); // } } }); $.ajax({ url: base+'/appcode/fetch_time.php', type: 'post', dataType: 'json', success: function(res){ var data = ""; console.log(res); /*var del_date = $("input[name='delivery_date']").val(); console.log("total Date "+del_date);*/ var currentdateTime = new Date(); var year = currentdateTime.getFullYear(); var month = currentdateTime.getMonth()+1; var date = currentdateTime.getDate(); var dateTo = date+"-"+month+"-"+year; //console.log(dateTo); var nowCurrentdateTime = currentdateTime.getTime(); //\\console.log(currentdateTime.getTime()); console.log(currentdateTime); //var selectedDate =''; data +=`<option value="">Choose Delivery Time</option>`; $.each(res, function(index, item1){ // console.log(item1.delivery_time); var str = item1.delivery_time; var res = str.split(" - "); var time1 = convertTime12to24(res[1]); var dateTime1 = dateTo+" "+time1; //2020-8-27 12:00 var dateString = dateTime1, dateTimeParts = dateString.split(' '), timeParts = dateTimeParts[1].split(':'), dateParts = dateTimeParts[0].split('-'), date; //var date = new Date(dateParts[2], parseInt(dateParts[1], 10) -1, dateParts[0], timeParts[0], timeParts[1]); var date = new Date(dateParts[2], parseInt(dateParts[1], 10) -1, dateParts[0], timeParts[0], timeParts[1]); var optionCurrntTime = date.getTime(); if(nowCurrentdateTime > optionCurrntTime){ //console.log("if"); var disabled = 'disabled'; }else{ var disabled = ''; //console.log("else"); } data +=`<option value="${item1.delivery_time}" ${disabled}>${item1.delivery_time}</option>`; }); // data +=`</select>`; $('.delivery_time1').empty().append(data); } }); }); $(document).ready(function () { $(".main-container").on("click", ".choose_payment", function () { //alert($(this).attr('data-payment_type')); var checkpay = $(this).attr("data-payment_type"); localStorage.checkpay = checkpay; //alert(checkpay); $(".choose_payment ").removeClass("green"); $(this).addClass("green"); if (checkpay) { //alert(); $(".check").removeClass("gray"); $(".check").addClass("green"); $(".check").attr("disabled", false); } }); }); $(document).ready(function(){ let isLogin = checkLogin(); //alert(isLogin); if(isLogin == true) { //alert(1); // showLoader(); //let guestCheckoutContainer = document.getElementById('guest-checkout-container'); //let giftWrap = document.getElementById('gift-wrap-container'); ////if (isLogin) { //guestCheckoutContainer.remove(); let userDetails = JSON.parse(localStorage['userDetails'].toString()); let form = document.querySelector('.checkout-form'); // form.querySelector('input[name="name"]').value = userDetails.name; // form.querySelector('input[name="email"]').value = userDetails.email; form.querySelector('input[name="phone"]').value = userDetails.phone; // form.querySelector('textarea[name="address"]').value = userDetails.address; // form.querySelector('input[name="city"]').value = userDetails.city; // form.querySelector('input[name="pinc"]').value = userDetails.pincode; let paymentMethod = document.getElementById('payment_method'); $(paymentMethod).material_select(); Materialize.updateTextFields(); //var localStorage.city_name = (userDetails.city); // removeLoader(); //} else { // alert('Please login if you want to use wallet balance for checkout.'); // // $('.material-select').material_select('destroy'); // document.getElementById('phone').removeAttribute('readonly'); // let paymentMethod = document.getElementById('payment_method'); // paymentMethod.querySelector('option[value="wallet"]').remove(); // $(paymentMethod).material_select(); // removeLoader(); //} /*fetchGiftWrapPrice() .then((response) => { console.info(response); if (response.status === 1) { giftWrap.querySelector('[for="gift_wrap"]').textContent = `Gift Wrap for ${response.value.price} Rs.`; sessionStorage.gift_wrap_price = response.value.price; } else if (response.status === 2) { giftWrap.innerHTML = "<p class='main-color'>Gift Wrap not available</p>"; } else if (response.status === 99) { giftWrap.innerHTML = "<p class='main-color'>Gift Wrap not available</p>"; } else { giftWrap.innerHTML = "<p class='main-color'>Gift Wrap not available</p>"; } removeLoader(); });*/ } else { alert('Please login First .'); window.location.href="login.html"; } }); // document.addEventListener('deviceready', ready, false); </script> <script> /*$('.timepicker').timepicker({ onSelect: function(time) { console.log(time) } });*/ $('.datepicker').pickadate({ //dateFormat: 'dd-mm-yy', min: new Date(), closeOnSelect: true, selectMonths: true, // Creates a dropdown to control month selectYears: 150, // Creates a dropdown of 15 years to control year format: 'dd/mm/yyyy', onOpen: function () { this.clear(); }, onSet: function () { var x,y,year,date,month; x = $('.datepicker1').pickadate().val().toString(); y = x.split(/[ ,]+/); date = y[0]; month = y[1]; year = y[2]; console.log(y[0]+" "+ y[1]+ " "+ y[2]); if(date && month && year){ this.close(); } } }); function get_delivery_date_time(dateto){ //alert(dateto); const convertTime12to24 = (time12h) => { const [fullMatch, time, modifier] = time12h.match(/(\d?\d:\d\d)\s*(\w{2})/i); let [hours, minutes] = time.split(':'); if (hours === '12') { hours = '00'; } if (modifier === 'PM') { hours = parseInt(hours, 10) + 12; } return `${hours}:${minutes}`; } $.ajax({ url: base+'/appcode/fetch_time.php', type: 'post', dataType: 'json', success: function(res){ var data = ""; //console.log(res); var currentdateTime = new Date(); var year = currentdateTime.getFullYear(); var month = currentdateTime.getMonth()+1; var date = currentdateTime.getDate(); if(typeof(dateto) == 'undefined' || dateto ==''){ var dateTo = date+"-"+month+"-"+year; }else{ var dateTo = dateto; } var nowCurrentdateTime = currentdateTime.getTime(); //var selectedDate =''; data +=`<option value="">Choose Delivery Time</option>`; $.each(res, function(index, item1){ // console.log(item1.delivery_time); var str = item1.delivery_time; var res = str.split(" - "); var time1 = convertTime12to24(res[1]); var dateTime1 = dateto+" "+time1; //2020-8-27 12:00 var dateString = dateTime1, dateTimeParts = dateString.split(' '), timeParts = dateTimeParts[1].split(':'), dateParts = dateTimeParts[0].split('-'), date; var date = new Date(dateParts[2], parseInt(dateParts[1], 10) -1, dateParts[0], timeParts[0], timeParts[1]); var optionCurrntTime = date.getTime(); if(nowCurrentdateTime > optionCurrntTime){ //console.log("if"); var disabled = 'disabled'; }else{ var disabled = ''; //console.log("else"); } data +=`<option value="${item1.delivery_time}" ${disabled}>${item1.delivery_time}</option>`; }); // data +=`</select>`; $('.delivery_time1').empty().append(data); } }); } $(".datepicker").on("change",function(){ var selected = $('#txtdate').val(); var res = selected.split("/"); var day = res[0]; var month = res[1]; var year = res[2]; var dpSelectedDate = day+"-"+month+"-"+year; //alert(dpSelectedDate); get_delivery_date_time(dpSelectedDate); }); </script> <script type="text/javascript"> var droppedLatLong1; var droppedLatLong2; var map; var clickCord; var tempLocation; var secretMessage = " Select Prefered Location"; // <!-- var latlong = { --> // <!-- lat: 28.4728044, --> // <!-- lng: 77.0196167 --> // <!-- }; --> var marker1, marker2; var prefferedAddress1 = $('input[name="preferred_area1"]'); var prefferedAddress11 = prefferedAddress1.val(); //alert(prefferedAddress1); console.log(prefferedAddress1+"a"); console.log(prefferedAddress11+"b"); var prefferedAddress2 = $('input[name="preferred_area2"]'); function initMap(lat,lng) { var map = new google.maps.Map(document.getElementById('map'), { zoom: 18, center: new google.maps.LatLng(parseInt(lat),parseInt(lng)), mapTypeId: 'roadmap', streetViewControl: false, fullScreenControl: false, zoomControl: true, mapTypeControl: false, }); var infowindow = new google.maps.InfoWindow({ content: secretMessage }); var geocoder = new google.maps.Geocoder(); geocodeAddress123(geocoder, map,lat,lng); document.getElementById('search_prefered_address1_button').addEventListener('click', function () { geocodeAddress1(geocoder, map); }); document.getElementById('search_preffered_address2_button').addEventListener('click', function () { geocodeAddress2(geocoder, map); }); localStorage.c_address= lat,lng; //$('#c_address').attr('value', lat+','+lng); } function geocodeAddress123(geocoder, resultsMap,lat,lng) { var latlng = {lat: lat, lng: lng}; geocoder.geocode({'location': latlng}, function (results, status) { if (status === 'OK') { resultsMap.setCenter(results[0].geometry.location); var marker1 = new google.maps.Marker({ map: resultsMap, position: results[0].geometry.location, draggable: true, clickable: true, title: "Marker 1", }); google.maps.event.addListener(marker1, 'dragend', function (evt) { //alert(1); console.log("drages"); //console.log(marker1); //geocodeAddress123(evt.latLng.lat().toFixed(3) + " , " + evt.latLng.lng().toFixed(3)); var ll = evt.latLng.lat().toFixed(3); var lo = evt.latLng.lng().toFixed(3); getAddress(parseFloat(ll),parseFloat(lo)); console.log(evt.latLng.lat().toFixed(3) + " , " + evt.latLng.lng().toFixed(3)); localStorage.c_address= ll+','+lo; //$('#c_address').attr('value', ll+','+lo); }); } else { alert('Geocode was not successful for the following reason: ' + status); } }); } function geocodeAddress1(geocoder, resultsMap) { var address1 = document.getElementById('search_preffered_address1').value; geocoder.geocode({'address': address1}, function (results, status) { if (status === 'OK') { resultsMap.setCenter(results[0].geometry.location); var marker1 = new google.maps.Marker({ map: resultsMap, position: results[0].geometry.location, draggable: true, clickable: true, title: "Marker 1", }); google.maps.event.addListener(marker1, 'dragend', function (evt) { console.log("drages"); //console.log(marker1); prefferedAddress1.val(evt.latLng.lat().toFixed(3) + " , " + evt.latLng.lng().toFixed(3)); var ll = evt.latLng.lat().toFixed(3); var lo = evt.latLng.lng().toFixed(3); getAddress(parseFloat(ll),parseFloat(lo)); //console.log(prefferedAddress1.val(evt.latLng.lat().toFixed(3) + " , " + evt.latLng.lng().toFixed(3))); localStorage.c_address= ll+','+lo; //$('#c_address').attr('value', ll+','+lo); }); } else { //alert('Geocode was not successful for the following reason: ' + status); } }); } function geocodeAddress2(geocoder, resultsMap) { var address2 = document.getElementById('search_preffered_address2').value; geocoder.geocode({'address': address2}, function (results, status) { if (status === 'OK') { resultsMap.setCenter(results[0].geometry.location); var marker2 = new google.maps.Marker({ map: resultsMap, position: results[0].geometry.location, draggable: true, clickable: true, title: "Marker 2", }); google.maps.event.addListener(marker2, 'dragend', function (evt) { console.log("drages2222"); prefferedAddress2.val(evt.latLng.lat().toFixed(3) + " , " + evt.latLng.lng().toFixed(3)); }); } else { alert('Geocode was not successful for the following reason: ' + status); } }); } $(document).ready(function () { var mymap = "<div id='map' class='map'></div>"; $("#show_map").click(function(){ $("#select_area").slideToggle('slow'); initMap(); }); // $('#select_area').hide(); }); // $('#c_add').val(localStorage.hdrloc); </script> <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyC4IRqhYZmre8ZxQGSGA5zagPnxGA-KIGg&callback=initMap" async defer></script> <!--<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyC4IRqhYZmre8ZxQGSGA5zagPnxGA-KIGg&libraries=places" ></script>--> <script type="text/javascript" src="js/functions.js"></script> <!-- <script type="text/javascript" src="js/materialize.min.js"></script> --> <script type="text/javascript" src="js/myfunctions.js"></script> </body> </html>