a subsidiary of Yum! Brands, is the world’s most popular chicken restaurant chain specializing in OriginalRecipe (2024)

Set Delivery Location

Or

Device Location is turned off

TURN ON

Show Map

Modal Header

Some text in the modal.

>

Oops!

Hey, the nearest KFC store to your location is temporarily closed for delivery. Do you want to do a takeaway order instead.

'+ ''); //nearest branch 2 $('#nearest_stores').append("" + ''); } } else{ $('#confirm-my-location').css('display', 'none'); $('#takeway-msg').css('display', 'none'); $('.confirm-location-section').css('display','block'); //$('#nearest_stores').empty(); //wAreaStatus.innerText = 'You are NOT in delivery zone'; document.getElementById('kfc_sale_type').value == 'take_away'; $('.location-section').css('display','block'); $('.nearest-store-address').css('display', 'block'); console.log(nearestBranch1); console.log(nearestBranch2); var saleTypeVal = document.getElementById('kfc_sale_type').value; //$('#nearest_stores').empty(); var brlocations = [ [nearestBranch1.title, nearestBranch1.lat, nearestBranch1.lng, nearestBranch1.address, 'https://kfcbd.com/frontend/Content/images/marker.png'], [nearestBranch2.title, nearestBranch2.lat, nearestBranch2.lng, nearestBranch2.address, 'https://kfcbd.com/frontend/Content/images/marker.png'], ]; var locLat = document.getElementById('lat').value; var locLng = document.getElementById('lng').value; var brmap = new google.maps.Map(document.getElementById('map'), { zoom: 10, disableDefaultUI: false, center: new google.maps.LatLng(locLat, locLng), mapTypeId: google.maps.MapTypeId.ROADMAP }); var brinfowindow = new google.maps.InfoWindow(); var brmarker, i; for (i = 0; i < brlocations.length; i++) { brmarker = new google.maps.Marker({ position: new google.maps.LatLng(brlocations[i][1], brlocations[i][2]), icon: brlocations[i][4], title: brlocations[i][0], map: brmap }); google.maps.event.addListener(brmarker, 'click', (function(brmarker, i) { return function() { brinfowindow.setContent(brlocations[i][0]+'
'+brlocations[i][3]+'

'); brinfowindow.open(brmap, brmarker); } })(brmarker, i)); } //nearest branch 1 $('#nearest_stores').html("" + '

'+ '' + nearestBranch1.title + ''+ '' + nearestBranch1.address + ''+ 'Distance: ' + minDist1 + ' KM'+ '

'+ ''); //nearest branch 2 $('#nearest_stores').append("" + ''); } console.log(whichPolygon); }, 1000); } function isDelivery() { var dsale_type = document.getElementById('kfc_sale_type').value; //alert(whichPolygon.length); if (whichPolygon.length > 0) { if(dsale_type == 'delivery') return true; } } //calculates distance between two points in km's function calculateDistance(pointer_1, pointer_2) { var dist = (google.maps.geometry.spherical.computeDistanceBetween(pointer_1, pointer_2) / 1000).toFixed(2); return parseFloat(dist); } function findPolygon(polygon) { return google.maps.geometry.poly.containsLocation(new google.maps.LatLng(wPos.lat, wPos.lng), polygon) } $(document).on("click", ".takeaway-to-active", function () { document.getElementById('kfc_sale_type').value = 'take_away'; $('.location-section').css('display','block'); $('.nearest-store-address').css('display', 'block'); //alert(); //checkPolygon(); //markerUpdate(geocoder, marker, infowindow, triangleCoords, branchDetailsArr, allPoly); }); /* * Find Current Location */ $('#autoDetect').on('click',function() { // If geolocation enabled if (navigator.geolocation) { //Get current position navigator.geolocation.getCurrentPosition(function (position) { var lat, long, address, resultArray, citi; //console.log('Current Location Found'); lat = position.coords.latitude; long = position.coords.longitude; var pos = { lat: position.coords.latitude, lng: position.coords.longitude }; marker.setPosition(pos); //marker.setVisible(true); var geocoder = new google.maps.Geocoder(); geocoder.geocode({latLng: pos}, function (result, status) { if ('OK' === status) { // This line can also be written like if ( status == google.maps.GeocoderStatus.OK ) { address = result[0].formatted_address; resultArray = result[0].address_components; // Get the city and set the city input value to the one selected /*for (var i = 0; i < resultArray.length; i++) { if (resultArray[i].types[0] && 'administrative_area_level_2' === resultArray[i].types[0]) { citi = resultArray[i].long_name; console.log(citi); city.value = citi; } }*/ addressEl.value = address; latEl.value = lat; longEl.value = long; wPos.lat = lat; wPos.lng = long; var distanceArr = []; for (var barea in outlets) { var bareas = outlets[barea]; var location1 = new google.maps.LatLng(lat, long); var location2 = new google.maps.LatLng(bareas.lat, bareas.lng); distanceArr.push(calculateDistance(location1, location2)); } console.log('Origin', distanceArr); var firstMinVal = Math.min(...Object.values(distanceArr)) var firstFromKey = Object.keys(distanceArr).find(key => distanceArr[key] === firstMinVal) console.log('FKey', firstFromKey); console.log('FValue', firstMinVal); minDist1 = firstMinVal; nearestBranch1 = outlets[firstFromKey]; console.log('B1', nearestBranch1); distanceArr.splice(firstFromKey, 1); //console.log('Remain', distanceArr); var secondMinVal = Math.min(...Object.values(distanceArr)) var secondFromKey = Object.keys(distanceArr).find(key => distanceArr[key] === secondMinVal) console.log('SKey', secondFromKey); console.log('SValue', secondMinVal); minDist2 = secondMinVal; nearestBranch2 = outlets[secondFromKey]; console.log('B2', nearestBranch2); checkPolygon() } else { console.log('Geocode was not successful for the following reason: ' + status); } // Closes the previous info window if it already exists if (infoWindow) { infoWindow.close(); } /** * Creates the info Window at the top of the marker */ infoWindow = new google.maps.InfoWindow({ content: address }); infoWindow.open(map, marker); }); }); } }); /* * Search */ autocomplete.addListener('place_changed', function() { var lat, long, address, resultArray, citi; //console.log( 'i am searched' ); lat = marker.getPosition().lat(); long = marker.getPosition().lng(); var geocoder = new google.maps.Geocoder(); var place = autocomplete.getPlace(); console.log(place); // If the place has a geometry, then present it on a map. if (place.geometry.viewport) { // map.fitBounds(place.geometry.viewport); var latitude = place.geometry.location.lat(); var longitude = place.geometry.location.lng(); } else { map.setCenter(place.geometry.location); map.setZoom(17); // Why 17? Because it looks good. } //marker.setPosition(place.geometry.location); //marker.setVisible(true); var pos = { lat: latitude, lng: longitude }; console.log(pos); wPos.lat = latitude; wPos.lng = longitude; //console.log(latitude); //console.log(longitude); var distanceArr = []; for (var barea in outlets) { var bareas = outlets[barea]; var location1 = new google.maps.LatLng(latitude, longitude); var location2 = new google.maps.LatLng(bareas.lat, bareas.lng); distanceArr.push(calculateDistance(location1, location2)); } console.log('Origin', distanceArr); var firstMinVal = Math.min(...Object.values(distanceArr)) var firstFromKey = Object.keys(distanceArr).find(key => distanceArr[key] === firstMinVal) console.log('FKey', firstFromKey); console.log('FValue', firstMinVal); minDist1 = firstMinVal; nearestBranch1 = outlets[firstFromKey]; console.log('B1', nearestBranch1); distanceArr.splice(firstFromKey, 1); //console.log('Remain', distanceArr); var secondMinVal = Math.min(...Object.values(distanceArr)) var secondFromKey = Object.keys(distanceArr).find(key => distanceArr[key] === secondMinVal) console.log('SKey', secondFromKey); console.log('SValue', secondMinVal); minDist2 = secondMinVal; nearestBranch2 = outlets[secondFromKey]; console.log('B2', nearestBranch2); geocoder.geocode( { latLng: pos }, function ( result, status ) { if ( 'OK' === status ) { // This line can also be written like if ( status == google.maps.GeocoderStatus.OK ) { address = result[0].formatted_address; resultArray = result[0].address_components; // Get the city and set the city input value to the one selected /*for( var i = 0; i < resultArray.length; i++ ) { if ( resultArray[ i ].types[0] && 'administrative_area_level_2' === resultArray[ i ].types[0] ) { citi = resultArray[ i ].long_name; console.log( citi ); city.value = citi; } }*/ addressEl.value = address; latEl.value = lat; longEl.value = long; checkPolygon () } else { console.log( 'Geocode was not successful for the following reason: ' + status ); } // Closes the previous info window if it already exists if ( infoWindow ) { infoWindow.close(); } /** * Creates the info Window at the top of the marker */ infoWindow = new google.maps.InfoWindow({ content: address }); infoWindow.open( map, marker ); } ); }); /* * Finds the new position of the marker when the marker is dragged. */ google.maps.event.addListener( marker, "dragend", function ( event ) { var lat, long, address, resultArray, citi; //console.log( 'i am dragged' ); lat = marker.getPosition().lat(); long = marker.getPosition().lng(); var geocoder = new google.maps.Geocoder(); geocoder.geocode( { latLng: marker.getPosition() }, function ( result, status ) { if ( 'OK' === status ) { // This line can also be written like if ( status == google.maps.GeocoderStatus.OK ) { address = result[0].formatted_address; resultArray = result[0].address_components; // Get the city and set the city input value to the one selected for( var i = 0; i < resultArray.length; i++ ) { if ( resultArray[ i ].types[0] && 'administrative_area_level_2' === resultArray[ i ].types[0] ) { citi = resultArray[ i ].long_name; console.log( citi ); city.value = citi; } } addressEl.value = address; latEl.value = lat; longEl.value = long; wPos.lat = lat; wPos.lng = long; checkPolygon () } else { console.log( 'Geocode was not successful for the following reason: ' + status ); } // Closes the previous info window if it already exists if ( infoWindow ) { infoWindow.close(); } /** * Creates the info Window at the top of the marker */ infoWindow = new google.maps.InfoWindow({ content: address }); infoWindow.open( map, marker ); } ); }); }); function emptyAll() { //alert(); $('.input-group p').empty(); $('.nearest-store-address.location-section').css('display', 'none'); document.getElementById('searchInput').value = ''; $('#confirm-my-location').css('display', 'none'); $('#confirm-location-section').css('display', 'none'); $('#takeway-msg').css('display', 'none'); $('#your-location-show').css('display', 'none'); $('#map_pointer').css('display', 'none'); } function proceedMenu(branch){ document.getElementById('selectedBranch').value = branch; document.getElementById('proceedMenuBar').style.display = "block"; } function sessionSet(slug, branch) { //var branch = ''; if (branch == '') branch = jQuery('#selectedBranch').val(); var lat = jQuery('#lat').val(); var lng = jQuery('#lng').val(); var sale_type = jQuery('#kfc_sale_type').val(); var location = jQuery('#location').val(); var previous_url = jQuery('#previous_url').val(); var url = "https://kfcbd.com/menu/locationset"; //alert(branch); if (branch == '') alert('Please select branch'); else { //alert('ASI'); jQuery('#btn_submit').html('a subsidiary of Yum! Brands, is the world’s most popular chicken restaurant chain specializing in OriginalRecipe (1)'); jQuery('.nearest-store-address.location-section').css('display', 'none'); jQuery.ajaxSetup({ headers: { 'X-CSRF-TOKEN': jQuery('meta[name="csrf-token"]').attr('content') } }); jQuery.ajax({ url: url, method: 'post', data: { branch: branch, location: location, sale_type: sale_type, lat: lat, lng: lng }, success: function(result){ window.location.href = "https://kfcbd.com"; //console.log(result); } }); } }

a subsidiary of Yum! Brands, is the world’s most popular chicken restaurant chain specializing in OriginalRecipe (2024)

References

Top Articles
Latest Posts
Article information

Author: Nathanael Baumbach

Last Updated:

Views: 6019

Rating: 4.4 / 5 (75 voted)

Reviews: 90% of readers found this page helpful

Author information

Name: Nathanael Baumbach

Birthday: 1998-12-02

Address: Apt. 829 751 Glover View, West Orlando, IN 22436

Phone: +901025288581

Job: Internal IT Coordinator

Hobby: Gunsmithing, Motor sports, Flying, Skiing, Hooping, Lego building, Ice skating

Introduction: My name is Nathanael Baumbach, I am a fantastic, nice, victorious, brave, healthy, cute, glorious person who loves writing and wants to share my knowledge and understanding with you.