

<!doctype html>
<html class="fixed">
<head>

	<!-- Basic -->
	<meta charset="UTF-8">

	<title>Survey</title>
	<meta name="keywords" content="HTML5 Admin Template" />
	<meta name="description" content="Porto Admin - Responsive HTML5 Template">
	<meta name="author" content="okler.net">
	<meta name="csrf-token" content="{{ csrf_token() }}">
	<!-- Mobile Metas -->
	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />

	<!-- Web Fonts  -->
	<link href="http://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800|Shadows+Into+Light" rel="stylesheet" type="text/css">

	<!-- Vendor CSS -->
	<link rel="stylesheet" href="{{asset('backend/assets/vendor/bootstrap/css/bootstrap.css')}}" />
	<link rel="stylesheet" href="{{asset('backend/assets/vendor/font-awesome/css/font-awesome.css')}}" />
	<link rel="stylesheet" href="{{asset('backend/assets/vendor/magnific-popup/magnific-popup.css')}}" />
	<link rel="stylesheet" href="{{asset('backend/assets/vendor/bootstrap-datepicker/css/datepicker3.css')}}" />

	<!-- Specific Page Vendor CSS -->
	<link rel="stylesheet" href="{{asset('backend/assets/vendor/select2/select2.css')}}" />
	<link rel="stylesheet" href="{{asset('backend/assets/vendor/jquery-datatables-bs3/assets/css/datatables.css')}}" />

	<!-- Theme CSS -->
	<link rel="stylesheet" href="{{asset('backend/assets/stylesheets/theme.css')}}" />

	<!-- Skin CSS -->
	<link rel="stylesheet" href="{{asset('backend/assets/stylesheets/skins/default.css')}}" />

	<!-- Theme Custom CSS -->
	<link rel="stylesheet" href="{{asset('backend/assets/stylesheets/theme-custom.css')}}">

	<!-- Head Libs -->
	<script src="{{asset('backend/assets/vendor/modernizr/modernizr.js')}}"></script>

	<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
	<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
	<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
	<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
	<style>


		table {
			width: 100%;
			margin: 20px auto;
			table-layout: auto;
		}

		.fixed {
			table-layout: fixed;
		}

		table,
		td,
		th {
			border-collapse: collapse;
			color:black;
		}

		th,
		td {
			padding: 10px;
			border: solid 1px;
			text-align: center;
		}

		.w {
			width: 400px;
		}
		table,
		td
		{
			color:black;
		}
		#piechart{
			width: 100%;
			padding: 15px;
		}
		/*#piechart div{
			width: 100%;
		}
		text {
		    color: #000 !important;
		}*/
		table.table{
			margin-bottom: 15px !important;
		}
		@media only screen and (min-width: 768px){
	html.fixed .content-body {
	    margin-left: 300px;
	    margin-left: 300px;
	    position: relative;
	    top: 45px;
	    /* left: 22px; */
	    padding: 20px 25px;
	}
	.bg-white{
		background-color: #fff;
	}
	</style>

</head>
	<body class="bg-white" style="background: #fff;">
			<section class="container-fluid py-5 px-3 px-lg-5">
	<div class="col-xs-12 px-3 px-lg-5 ">
		<div class="row">
			<div class="col-xs-12 col-sm-6 col-md-4 col-lg-4 px-1 px-sm-2">
				<div class="card bg1 mb-3">
					<div class="dash-widget-header">
						<span class="dash-widget-icon text-primary">
							<img src="{{asset('backend/assets/images/icons/districts.png')}}" alt="" class="img-fluid">
						</span>
						<div class="dash-count">
							<h3 class="my-0">{{$count}}/ 7,90,000</h3>
						</div>
					</div>
					<div class="dash-widget-info">
						<h5 class="text-white">No. Of LED'S Installed</h5>
						<div class="progress progress-sm mb-0">
							<div class="progress-bar bg-primary w-50"></div>
						</div>
					</div>
				</div>
			</div>
			<div class="col-xs-12 col-sm-6 col-md-4 col-lg-4 px-1 px-sm-2">
				<div class="card bg2 mb-3">
					<div class="dash-widget-header">
						<span class="dash-widget-icon">
							<img src="{{asset('backend/assets/images/icons/mandals.png')}}" alt="" class="img-fluid">
						</span>
						<div class="dash-count">
							<h3 class="my-0">{{$approved}}/ 12758</h3>
						</div>
					</div>
					<div class="dash-widget-info">
						<h5 class="text-white">No. Of Gram Panchayats Completed</h5>
						<div class="progress progress-sm mb-0">
							<div class="progress-bar bg-primary w-50"></div>
						</div>
					</div>
				</div>
			</div>
			<div class="col-xs-12 col-sm-6 col-md-4 col-lg-4 px-1 px-sm-2">
				<div class="card bg3 mb-3">
					<div class="dash-widget-header">
						<span class="dash-widget-icon">
							<img src="{{asset('backend/assets/images/icons/gramam.png')}}" alt="" class="img-fluid">
						</span>
						<div class="dash-count">
							<h3 class="my-0">{{$on_going}}  / 32</h3>
						</div>
					</div>
					<div class="dash-widget-info">
						<h5 class="text-white">No. Of Districts (On Going)</h5>
						<div class="progress progress-sm mb-0">
							<div class="progress-bar bg-primary w-50"></div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<div class="row pt-5">
			<div class="col-xs-12 col-lg-7 px-2 ">
				<div class="web-card">
		            <div class="web-card-header">
		                <h5 class="my-0">Completed / Ongoing List of Districts, Mandals and GP's</h5>
		            </div>
		            <div class="web-card-block">
		            	<div class="table-responsive ">
		                    <table class="table table-bordered mt-0" style="margin-bottom: 0px !important;">
		                    	<thead>
					                <tr>
					                   <th>District</th>
					                   <th>Mandal</th>
					                   <th>GP</th>
					                   <th>Total&nbsp;Lights&nbsp;Installed</th>
					                   <th>Total&nbsp;CCMS&nbsp;Installed</th>
					               </tr>
					           </thead>
					           <tbody>
					           	<?php $taluka=0;  $gram_count=0; $ccmscounttotal=0; $counttotals=0;?>
					           	
					           	@foreach($districtlist as $report)

		   <?php 
			 $approved_taluka= \App\Models\survey_info::groupby('taluka_id')->where('jilla_id',$report->id)->pluck('taluka_id')->count();
			 $taluka=$taluka+$approved_taluka;
              

             $approved_gram= \App\Models\survey_info::where('jilla_id',$report->id)->groupby('gram_id')->pluck('gram_id')->count();
             $gram_count=$gram_count+$approved_gram;



             $counts= DB::select("SELECT LED_wattage,    
            ROUND (   
             (
              LENGTH(LED_wattage)
              - LENGTH( REPLACE ( LED_wattage, 'W', '') )
             ) / LENGTH('W')        
            ) AS count    
           FROM survey_infos where jilla_id=".$report->id);
            
            $count=0;
            foreach ($counts as $key => $values) {
                $count=(int)$values->count+$count;
            }

         $counttotals=$counttotals+$count;

              $ccmscount = DB::table('ccms_types')->where('district_id',$report->id)->groupby('district_id')->sum('install_qty');

               $ccmscounttotal = $ccmscounttotal+$ccmscount;


					           	 ?>
					       @if($approved_taluka>0 && $approved_gram>0)    	 
					           		<tr>
					           			<td>{{$report->area_name}}</td>
					           			<td>{{$approved_taluka}}</td>
					           			<td>{{$approved_gram}}</td>
					           			<td>{{$count}}</td>
					           			<td>{{$ccmscount}}</td>
					           		</tr>
					           		@endif
					           		@endforeach
					           

					            	<tr>
					           		  <td><b>Total</b></td>
          <td><b>{{$taluka}}</b></td>
          <td><b>{{$gram_count}}</b></td>
          <td><b>{{$counttotals}}</b></td>
          <td><b>{{$ccmscounttotal}}</b></td>
          
          
       </tr> 

					           </tbody>
		                    </table>
		                </div>
		            </div>
		        </div>
			</div>
			<div class="col-xs-12 col-sm-12 col-md-5 col-lg-5 px-2">
				<div class="web-card">
					<div class="web-card-header">
		                <h5 class="my-0">PieChart</h5>
		            </div>
					<div id="piechart"></div>
				</div>	
			</div>
		</div>
	</div>
</section>

		<script type="text/javascript">
			// Load google charts
			google.charts.load('current', {'packages':['corechart']});
			google.charts.setOnLoadCallback(drawChart);

			// Draw the chart and set the chart values
			function drawChart() {
			  var data = google.visualization.arrayToDataTable([
			  ['piechart', 'approved_piechart'],
			    ['GP INPROGRESS',2800 ],
			  ['GP COMPLETED', 200],
			
			  
			]);

			  // Optional; add a title and set the width and height of the chart
			  var options = {};

			  // Display the chart inside the <div> element with id="piechart"
			  var chart = new google.visualization.PieChart(document.getElementById('piechart'));
			  chart.draw(data, options);
			}
		</script>
	</body>
</html>

</section>
<script language="javascript">
setInterval(function(){
   window.location.reload(1);
}, 30000);
</script>
		