@extends('backend.header')
@section('index-content')
<div class="row px-3">



  <section role="main" class="content-body">
    <header class="page-header">
      <h2>Approved Report</h2>
    </header>
    <div class="row">
      <div class="col-xs-12">
        <div class="">
          <ol class="breadcrumbs">
            <li>
              <a href="{{url('index')}}">
                <i class="fa fa-home"></i>
              </a>
            </li>
            <li><span class="active">Approved Report</span></li>
          </ol>
        </div>
      </div>
    </div>


    <!-- start: page -->
    <section class="panel pt-2">
      <header class="panel-heading mb-5">
        <h4 class="my-0">Approved Report</h4> 
      </header>
      <div class="col-12">
      
      <div class="col-md-6">
          <input type="text" class="form-control selected_date" name="selected_date" id="selected_date" value="{{Request::get('date')}}" placeholder="Select From Date">
      </div>
      <div class="col-md-6">
          <input type="text" class="form-control selected_date" name="to_date" id="to_date"  value="{{Request::get('to_date')}}" placeholder="Select To Date">
      </div>
    </div>
    <br>
    <br>
      <div class="col-12">

        

      <table class="table table-bordered table-striped mb-none mt-0" id="datatable-default">
       <thead>
         <tr>
           <th>S.No</th>
           <th>District Name</th>
           <th>Mandal Name</th>
           <th>Gram Name</th>
           <th>Date</th>
           <th>Status</th>
           <th>Action</th>
         </tr>
       </thead>
       <tbody>
        <?php $i=1; ?>
        @foreach($list as $data)
        <tr>
          <td>{{$i}}</td>
          <td>{{$data['jilla_details']?$data['jilla_details']['area_name']:""}}</td>
          <td>{{$data['taluka_details']?$data['taluka_details']['area_name']:""}}</td>

          <td>
            {{$data['gram_details']?$data['gram_details']['area_name']:""}}</a>
             
          </td>
          <td>{{date('Y-m-d',strtotime($data['created_at']))}}</td> 
          
          <td>@if($data['approve_status']=='1')
           {{"Approved"}}
           @elseif($data['approve_status']=='2')
           {{"Rejected"}}
           @else
           {{'Pending'}}
         @endif </td>
         <td>
          @if(!empty($data['jilla_details']) && !empty($data['taluka_details']) && !empty($data['gram_details']))
          <a  target="_blank" href="{{url('displayallsearch')}}?jillase={{$data['jilla_details']['id']}}&talukase={{$data['taluka_details']['id']}}&gramse={{$data['gram_details']['id']}}" class="btn btn-primary">View Report</a>
          @endif

        </td>
      </tr>
      <?php $i++; ?>
      @endforeach


    </tbody>
  </table>
</div>
</section>
</section>



 <link rel="stylesheet" href="//code.jquery.com/ui/1.13.2/themes/base/jquery-ui.css">
  <script src="https://code.jquery.com/jquery-3.6.0.js"></script>
  <script src="https://code.jquery.com/ui/1.13.2/jquery-ui.js"></script>
<script type="text/javascript">
  var enableDays = JSON.parse('<?php echo json_encode($edates); ?>');
$('.selected_date').datepicker({
    beforeShowDay: function(dt) {
      var datestring = dt.getDate() + "-" + (dt.getMonth() + 1) + "-" + dt.getFullYear();
       //var datestring = $.datepicker.formatDate('dd-mm-yy', dt);
       if($.inArray(datestring, enableDays) != -1) {
         return [true];
     }
     else{
         return false;
     }


 }});

 </script>
<script type="text/javascript">
  $('#status_filter,#selected_date,#to_date').change(function(){
    var status = $('#status_filter').val(); var dates=$('#selected_date').val();
    var to_date=$('#to_date').val();
      window.location.href="{{url('approved_report')}}?date="+dates+"&to_date="+to_date;
  })
</script>

@stop


