177279e08230025e4cda4ada847ae1109169ba05624b2ad3c80934af51e44996

Source Code:

//function create_map(lat, lang) {
//    if (lat != '' && lat != 0 && lang != '' && lang != 0) {
//        check_pat_lat = check_pat_lat;
//        check_pat_lang = check_pat_lang;
//        if (check_pat_lat != '' && check_pat_lat != 0 && check_pat_lang != '' && check_pat_lang != 0) {
//            initialize(check_pat_lat, check_pat_lang, lat, lang);
//        } else {
//            alert("Sorry , Map can not generate due to yours address not available ! ");
//        }
//    } else {
//        alert("Sorry , Map can not generate due to doctor`s address not available ! ");
//    }
//}
//function initialize(check_pat_lat1, check_pat_lang1, lat, lang) {
//    var directionDisplay;
//    var directionsService = new google.maps.DirectionsService();
//    var map;
//    directionsDisplay = new google.maps.DirectionsRenderer();
//    var myOptions = {
//        zoom: 13,
//        center: new google.maps.LatLng(check_pat_lat1, check_pat_lang1),
//        mapTypeId: google.maps.MapTypeId.ROADMAP,
//    }
//    map = new google.maps.Map(document.getElementById("map-canvas"), myOptions);
//    directionsDisplay.setMap(map);
//
//    var request = {
//        origin: new google.maps.LatLng(lat, lang),
//        destination: new google.maps.LatLng(check_pat_lat1, check_pat_lang1),
//        travelMode: google.maps.DirectionsTravelMode.DRIVING
//    };
//    directionsService.route(request, function (response, status) {
//        if (status == google.maps.DirectionsStatus.OK) {
//            directionsDisplay.setDirections(response);
//        }
//    });
//    $('#myModal').modal('show');
//} 
$('body').on('click','#closeIcon',function(){
    window.location.reload();
});

function create_map(lat , lang){
        if(lat != '' && lat != 0 && lang != '' && lang != 0){
//            var check_pat_lat = <?php if(isset($UserDetail['latitude'])) { echo $UserDetail['latitude'] ; }else{ echo '';} ?> ;
//            var check_pat_lang = <?php if(isset($UserDetail['longitude'])) { echo $UserDetail['longitude'] ; }else{ echo '';} ?> ;
            check_pat_lat = check_pat_lat;
            check_pat_lang = check_pat_lang;
            if(check_pat_lat != '' && check_pat_lat != 0 && check_pat_lang != '' && check_pat_lang != 0){
                setTimeout(function(){ $('#myModal').modal('show'); }, 300);
                initialize(lat , lang);
            }else{
                alert("Sorry , Map can not generate due to yours address not available ! ");
            }
        }else{
            alert("Sorry , Map can not generate due to doctor`s address not available ! ");
        }
    }
    function initialize(lat , lang) {
        var pat_lat = check_pat_lat;
        var pat_lang = check_pat_lang;
        var mapOptions = {
            zoom: 13,
            center: new google.maps.LatLng(pat_lat, pat_lang),
            mapTypeId: google.maps.MapTypeId.TERRAIN
        };

        var map = new google.maps.Map(document.getElementById('map-canvas'),
            mapOptions);

        var flightPlanCoordinates = [
            new google.maps.LatLng(pat_lat, pat_lang),
            new google.maps.LatLng(lat, lang)
        ];
        var flightPath = new google.maps.Polyline({
            path: flightPlanCoordinates,
            geodesic: true,
            strokeColor: '#FF0000',
            strokeOpacity: 1.0,
            strokeWeight: 2
        });

        flightPath.setMap(map);
    }