@extends('layouts.app')

@section('content')
    @include('layouts.headers.cards')

   
    
   

    <div class="container-fluid mt--7">
        <div class="row">
            <div class="col-xl-8 mb-5 mb-xl-0">
                <div class="card bg-gradient-default shadow">
                    <div class="card-header bg-transparent">
                        <div class="row align-items-center">
                            <div class="col">
                                <h6 class="text-uppercase text-light ls-1 mb-1">Overview</h6>
                                <h2 class="text-white mb-0">Cancer Result</h2>
                            </div>
                            <div class="col">
                                <ul class="nav nav-pills justify-content-end">
                                    <!-- <li class="nav-item mr-2 mr-md-0" data-toggle="chart" data-target="#chart-sales" data-update='{"data":{"datasets":[{"data":[0, 20, 10, 30, 15, 40, 20, 60, 60]}]}}' data-prefix="$" data-suffix="k">
                                        <a href="#" class="nav-link py-2 px-3 active" data-toggle="tab">
                                            <span class="d-none d-md-block">Month</span>
                                            <span class="d-md-none">M</span>
                                        </a>
                                    </li>
                                    <li class="nav-item" data-toggle="chart" data-target="#chart-sales" data-update='{"data":{"datasets":[{"data":[0, 20, 5, 25, 10, 30, 15, 40, 40]}]}}' data-prefix="$" data-suffix="k">
                                        <a href="#" class="nav-link py-2 px-3" data-toggle="tab">
                                            <span class="d-none d-md-block">Week</span>
                                            <span class="d-md-none">W</span>
                                        </a>
                                    </li> -->
                                </ul>
                            </div>
                        </div>
                    </div>
                    <div class="card-body">
                        <!-- Chart -->
                        <div class="chart">
                            <!-- Chart wrapper -->
                            <canvas id="pieChart" class="chart-canvas"></canvas>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-xl-4">
                <div class="card shadow">
                    <div class="card-header bg-transparent">
                        <div class="row align-items-center">
                            <div class="col">
                                <h6 class="text-uppercase text-muted ls-1 mb-1">Performance</h6>
                                <h2 class="mb-0">Age Graph</h2>
                            </div>
                        </div>
                    </div>
                    <div class="card-body">
                        <!-- Chart -->
                        <div class="chart">
                            <canvas id="myChart" class="chart-canvas"></canvas>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="row mt-5" style="margin-bottom:100px">
            <div class="col-xl-12 mb-5 mb-xl-0">
                    <div id="map" class="col-md-12" style="height: 500px;">
                </div>
            </div>
        </div>
        <!-- <div class="row mt-5">
            <div class="col-xl-8 mb-5 mb-xl-0">
                <div class="card shadow">
                    <div class="card-header border-0">
                        <div class="row align-items-center">
                            <div class="col">
                                <h3 class="mb-0">Page visits</h3>
                            </div>
                            <div class="col text-right">
                                <a href="#!" class="btn btn-sm btn-primary">See all</a>
                            </div>
                        </div>
                    </div>
                   
                    <div class="table-responsive"> -->
                        <!-- Projects table -->
                        <!-- <table class="table align-items-center table-flush">
                            <thead class="thead-light">
                                <tr>
                                    <th scope="col">Page name</th>
                                    <th scope="col">Visitors</th>
                                    <th scope="col">Unique users</th>
                                    <th scope="col">Bounce rate</th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr>
                                    <th scope="row">
                                        /argon/
                                    </th>
                                    <td>
                                        4,569
                                    </td>
                                    <td>
                                        340
                                    </td>
                                    <td>
                                        <i class="fas fa-arrow-up text-success mr-3"></i> 46,53%
                                    </td>
                                </tr>
                                <tr>
                                    <th scope="row">
                                        /argon/index.html
                                    </th>
                                    <td>
                                        3,985
                                    </td>
                                    <td>
                                        319
                                    </td>
                                    <td>
                                        <i class="fas fa-arrow-down text-warning mr-3"></i> 46,53%
                                    </td>
                                </tr>
                                <tr>
                                    <th scope="row">
                                        /argon/charts.html
                                    </th>
                                    <td>
                                        3,513
                                    </td>
                                    <td>
                                        294
                                    </td>
                                    <td>
                                        <i class="fas fa-arrow-down text-warning mr-3"></i> 36,49%
                                    </td>
                                </tr>
                                <tr>
                                    <th scope="row">
                                        /argon/tables.html
                                    </th>
                                    <td>
                                        2,050
                                    </td>
                                    <td>
                                        147
                                    </td>
                                    <td>
                                        <i class="fas fa-arrow-up text-success mr-3"></i> 50,87%
                                    </td>
                                </tr>
                                <tr>
                                    <th scope="row">
                                        /argon/profile.html
                                    </th>
                                    <td>
                                        1,795
                                    </td>
                                    <td>
                                        190
                                    </td>
                                    <td>
                                        <i class="fas fa-arrow-down text-danger mr-3"></i> 46,53%
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
            <div class="col-xl-4">
                <div class="card shadow">
                    <div class="card-header border-0">
                        <div class="row align-items-center">
                            <div class="col">
                                <h3 class="mb-0">Social traffic</h3>
                            </div>
                            <div class="col text-right">
                                <a href="#!" class="btn btn-sm btn-primary">See all</a>
                            </div>
                        </div>
                    </div>
                    <div class="table-responsive"> -->
                        <!-- Projects table -->
                        <!-- <table class="table align-items-center table-flush">
                            <thead class="thead-light">
                                <tr>
                                    <th scope="col">Referral</th>
                                    <th scope="col">Visitors</th>
                                    <th scope="col"></th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr>
                                    <th scope="row">
                                        Facebook
                                    </th>
                                    <td>
                                        1,480
                                    </td>
                                    <td>
                                        <div class="d-flex align-items-center">
                                            <span class="mr-2">60%</span>
                                            <div>
                                                <div class="progress">
                                                <div class="progress-bar bg-gradient-danger" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: 60%;"></div>
                                                </div>
                                            </div>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <th scope="row">
                                        Facebook
                                    </th>
                                    <td>
                                        5,480
                                    </td>
                                    <td>
                                        <div class="d-flex align-items-center">
                                            <span class="mr-2">70%</span>
                                            <div>
                                                <div class="progress">
                                                <div class="progress-bar bg-gradient-success" role="progressbar" aria-valuenow="70" aria-valuemin="0" aria-valuemax="100" style="width: 70%;"></div>
                                                </div>
                                            </div>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <th scope="row">
                                        Google
                                    </th>
                                    <td>
                                        4,807
                                    </td>
                                    <td>
                                        <div class="d-flex align-items-center">
                                            <span class="mr-2">80%</span>
                                            <div>
                                                <div class="progress">
                                                <div class="progress-bar bg-gradient-primary" role="progressbar" aria-valuenow="80" aria-valuemin="0" aria-valuemax="100" style="width: 80%;"></div>
                                                </div>
                                            </div>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <th scope="row">
                                        Instagram
                                    </th>
                                    <td>
                                        3,678
                                    </td>
                                    <td>
                                        <div class="d-flex align-items-center">
                                            <span class="mr-2">75%</span>
                                            <div>
                                                <div class="progress">
                                                    <div class="progress-bar bg-gradient-info" role="progressbar" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100" style="width: 75%;"></div>
                                                </div>
                                            </div>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <th scope="row">
                                        twitter
                                    </th>
                                    <td>
                                        2,645
                                    </td>
                                    <td>
                                        <div class="d-flex align-items-center">
                                            <span class="mr-2">30%</span>
                                            <div>
                                                <div class="progress">
                                                <div class="progress-bar bg-gradient-warning" role="progressbar" aria-valuenow="30" aria-valuemin="0" aria-valuemax="100" style="width: 30%;"></div>
                                                </div>
                                            </div>
                                        </div>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div> 
                </div>-->
            </div>
        </div>




      {{--  @include('layouts.footers.auth') --}}
    </div>
@endsection

@push('js')
    
    <script src="{{ asset('bctc') }}/vendor/chart.js/dist/Chart.min.js"></script>
    <script src="{{ asset('bctc') }}/vendor/chart.js/dist/Chart.extension.js"></script>
    
    <script>
                $.ajaxSetup({
                    headers: {
                        'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                    }
                });
		
				$.ajax({
					type:'POST',
					url:"{{ route('getChart1') }}",
						success:function(data) { 
							var ctx = document.getElementById('myChart').getContext('2d');
							var options = {

									scales: {
										yAxes: [{
											display: true,
											ticks: {
												beginAtZero:true
											}
										}]
									}
							};

							var chart = new Chart(ctx, {
								// The type of chart we want to create
								type: 'bar',

								// The data for our dataset
								data: {
									labels: Object.keys(data.total),
									datasets: [{
										//label: 'Cancer Result',
										data: Object.values(data.total),
										//fill: false,
										//borderColor:"rgb(75, 192, 192)",
										//"lineTension":0.5,
									}]
								},
								options : options,

								// Configuration options go here
							});
							 //console.log(data);
						}
				});  

				$.ajax({
					type:'POST',
					url:"{{ route('getPieChart') }}",
					success:function(data) {
						var ctx = document.getElementById('pieChart').getContext('2d');
						//console.log(Object.values(data.total));  
						//console.log(Object.keys(data.total));       
						// Configuration options go here
						var config = {
								type: 'pie',
								data: {
									datasets: [{
										 data: data.values,
										 backgroundColor: ["#0074D9", "#FF4136", "#2ECC40", "#FF851B", "#7FDBFF", "#B10DC9", "#FFDC00", "#001f3f", "#39CCCC", "#01FF70", "#85144b", "#F012BE", "#3D9970", "#111111", "#AAAAAA"],
										 label: 'Cancer'
									}],
									labels:data.type,
								},
								options: {
									 responsive: true
								}
						};
                        //window.onload = function() {
                            window.myPie = new Chart(ctx, config);
                        //};
						// window.myPie = new Chart(ctx, config);     
					}
				}); 
               
            </script>
    
	<script>

//	  var map, heatmap;
//
//	  function initMap() {
//
//		map = new google.maps.Map(document.getElementById('map'), {
//		  zoom: 13,
//		  center: {lat: 27.2901177, lng: -80.4329684}, //27.2901177,-80.4329684
//		//   mapTypeId: 'satellite'
//		});
//
//		 $.ajaxSetup({
//			headers: {
//				'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
//			}
//		});
//
//		$.ajax({
//			type:'POST',
//			url:"{{ route('getGeoCode') }}",
//
//
//			success:function(data) {
//				var points = [];
//				// console.log(data.geocode.length);
//
//				for (var i = 0; i < data.geocode.length; i++) {
//
//					var marker = new google.maps.LatLng(data.geocode[i][0],data.geocode[i][1]);
//					points.push(marker);
//				}
//
//				console.log(points);
//				heatmap = new google.maps.visualization.HeatmapLayer({
//				  data: points,
//				  map: map,
//				  icon: 'http://bctc.cordiacetechnologies.com/bctc/css/circle.png',
//				});
//
//			}
//		}); 
//
//	  }

	
	</script>
       
       
    <script>
		function initMap() {
		//  var locations = [
		//   [1.3475008, 103.7310856, 'http://bctc.cordiacetechnologies.com/bctc/css/circle.png'],
		//   [1.3139036, 103.7240052, 'http://bctc.cordiacetechnologies.com/bctc/css/circle.png'],
		//   [1.3139249, 103.7099507, 'http://bctc.cordiacetechnologies.com/bctc/css/circle.png'],
		//   [1.31400071, 103.7002187, 'http://bctc.cordiacetechnologies.com/bctc/css/circle.png'],
		//   [1.3139198, 103.7080302, 'http://bctc.cordiacetechnologies.com/bctc/css/circle.png'],
		//   [1.3125098, 103.7070302, 'http://bctc.cordiacetechnologies.com/bctc/css/circle.png'],
		//   [1.3139198, 103.7055302, 'http://bctc.cordiacetechnologies.com/bctc/css/circle.png']	
		//  ];

		var map = new google.maps.Map(document.getElementById('map'), {
		  zoom: 12,
		  center: new google.maps.LatLng(27.2901177,-80.4329684),
		  mapTypeId: google.maps.MapTypeId.ROADMAP
		});

		var infowindow = new google.maps.InfoWindow();
		var marker, i;
        $.ajax({
			type:'POST',
			url:"{{ route('getGeoCode') }}",
			success:function(locations) {
                for (i = 0; i < locations.geocode.length; i++) { 
                    marker = new google.maps.Marker({
                        position: new google.maps.LatLng(locations.geocode[i][0], locations.geocode[i][1]),
                        map: map,
                        icon: 'http://dashboard.braincancertc.org/bctc/css/circle.png'
                    });
                    google.maps.event.addListener(marker, 'click', (function(marker, i) {
                        return function() {
                        infowindow.setContent(locations.geocode[i][0]);
                        infowindow.open(map, marker);
                        }
                    })(marker, i));
                }
			}
		}); 
			// for (i = 0; i < locations.length; i++) { 
			//   marker = new google.maps.Marker({
			// 	position: new google.maps.LatLng(locations[i][0], locations[i][1]),
			// 	map: map,
			// 	icon: locations[i][2]
			//   });

			//   google.maps.event.addListener(marker, 'click', (function(marker, i) {
			// 	return function() {
			// 	  infowindow.setContent(locations[i][0]);
			// 	  infowindow.open(map, marker);
			// 	}
			//   })(marker, i));
			// }
		}

	</script>   
        
    <script async defer src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBR2LDW5wzMKP1YSeZdb6fRyqRwjwHrJO8&callback=initMap">
    </script>    
   <!--  <script async defer src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBR2LDW5wzMKP1YSeZdb6fRyqRwjwHrJO8&callback=initMap"
    ></script> -->
@endpush