<?php $__env->startSection('content'); ?> 
<style>
	.body
	{
		background-color:white;
	}
</style>

<script>

  function loadTehsil()
  {
      DistrictId=$("#District").val();
      $.ajax({
          type: "GET",
          url: "getTehsilNames",
          data:"districtid="+DistrictId,
          dataType: "json",
          success: function(result){
               $('#Tehsil').children().remove();         
               $('#Tehsil').append($('<option>').text("Tehsil").attr('value', ""));
               $.each(result, function(id, value) {
                  $('#Tehsil').append($('<option>').text(value.TehsilName).attr('value', value.TehsilID));
               });
            }
       });
  }


  function getCityOrVillages()
  {
      var IsCity=-1;
      if(document.getElementById("City").checked==true)
      {
        IsCity=1;
      }
      else if(document.getElementById("Village").checked==true)
      {
        IsCity=0;
      }
      var CityId=$('#CorV').val();
      var TehsilId=$('#Tehsil').val();
      // Load Cities or villages from 
       $.ajax({
            type: "GET",
            url: "loadAvailableCitiesOrVillages",
            data:"IsCity="+IsCity+"&Tehsil="+TehsilId,
            dataType: "json",
            success: function(result){
              if(IsCity==1)
              {
                $('#CorV').children().remove();         
                $('#CorV').append($('<option>').text(" Cities ").attr('value', ""));
                $.each(result, function(id, value) {
                    $('#CorV').append($('<option>').text(value.CityName).attr('value', value.CityID));
                });
              }
              else if(IsCity==0)
              {
                $('#CorV').children().remove();         
                $('#CorV').append($('<option>').text(" Villages ").attr('value', ""));
                $.each(result, function(id, value) {
                    $('#CorV').append($('<option>').text(value.VillageName).attr('value', value.VillageID));
                });
              }
            }
          });
  }

  function loadPrabhag()
  {
    //alert("In Prabhag : ");
      var IsCity=-1;
      if(document.getElementById("City").checked==true)
      {
        IsCity=1;
      }
      else if(document.getElementById("Village").checked==true)
      {
        IsCity=0;
      }
      var CityId=$('#CorV').val();
      // Load Cities or villages from 
       $.ajax({
            type: "GET",
            url: "loadPrabhag",
            data:"IsCity="+IsCity+"&City_Village_Id="+CityId,
            dataType: "json",
            success: function(result){
                $('#PrabhagOrWard').children().remove();
                $('#PrabhagOrWard').append($('<option>').text(" Prabhag ").attr('value', ""));
                $.each(result, function(id, value) {
                    $('#PrabhagOrWard').append($('<option>').text(value.PrabhagName).attr('value', value.PrabhagName));
                });
            }
          });
  }

  function loadBooth()
  {
      //alert("In Prabhag : ");
      var IsCity=-1;
      if(document.getElementById("City").checked==true)
      {
        IsCity=1;
      }
      else if(document.getElementById("Village").checked==true)
      {
        IsCity=0;
      }
      var CityId=$('#CorV').val();
      // Load Cities or villages from 
      $.ajax({
            type: "GET",
            url: "getBoothsNumbersById",
            data:"Village_Or_City_Id="+CityId,
            dataType: "json",
            success: function(result){
                $('#Booth').children().remove();         
                $('#Booth').append($('<option>').text("Booth ").attr('value', ""));
                $.each(result, function(id, value) {
                    $('#Booth').append($('<option>').text(value.BoothNumber).attr('value', value.BoothID));
              });
            }
       }); 
  }


  function loadVoters()
  {
      var CorV_ID=$("#CorV").val();
      var PrabhagOrWard=$("#PrabhagOrWard").val();
      var Booth=$("#Booth").val();
      var IsCity=-1;
      var IsVoted=$("#IsVoted").val();

      if(document.getElementById("City").checked==true)
      {
        IsCity=1;
      }
      else if(document.getElementById("Village").checked==true)
      {
        IsCity=0;
      }
      if(IsCity==1 && (PrabhagOrWard=="" && Booth=="" ))
      {
        alert("Please Select Prabhag Or Booth to Continue");
      }
      else
      {
        var table = $('#SurnameTable').DataTable();
        table.destroy();

        $('#SurnameTable').DataTable({
             "bProcessing": true,
             "responsive": true,
             "dataType": "json",
             dom: 'Bfrtip',
                className:'cg fm',
                buttons: [
                  'csvHtml5'
                ],
             "lengthMenu": [[10, 25, 50,100, -1], [10, 25, 50,100, "All"]],
             "sAjaxSource": "getVotersByIsVotingStatus?CorV_ID="+CorV_ID+"&IsCity="+IsCity+"&PrabhagId="+PrabhagOrWard+"&BoothId="+Booth+"&IsVoted="+IsVoted,
             "aoColumns": [
                { "mData": "VotingAnalysis" },
                { "mData": "SrNo" },
                { "mData": "Name" },
                { "mData": "MobileNumber"},
                { "mData": "WhatsAppNumber"},
                { "mData": "Email"},
                { "mData": "EPICNumber" },
                { "mData": "VotingCenter"},
                { "mData": "Address" },
                { "mData": "NewAddress" },
                { "mData": "View"}
               ]
            });
      }
  }

</script>
  <div class="qv rc sm sp" style="margin-top:3%;">
        <div class="qw">
            <?php if(Session::has('Name')): ?>   
              <span style="margin-left:70px;"> <strong> Voter Report By Voted Voters </strong> </span>
              <span style="margin-top:-7px;margin-left:55%;">Welcome, <?php echo e(Session::get('Name')); ?>

              <a href='dashboard' class='cg ts fx green' style="margin-left:80px;"> Go To Dashboard </a>
          <?php endif; ?>
        </div>
    </div>

  <div class="by amt" style="margin-top:-30px;">
    <div class="gc">
      <div class="gz">
        <div class="ca qo anx ">
          <div class="qf b aml" style="width:223%;margin-left:-60px;">
            <div class="col-lg-12" style="margin-left:-10px;">
              <div class="col-lg-2">
                  <select id="District" name="District" onchange="loadTehsil()" class="form-control">
                    <option value=""> District </option>
                    <?php foreach($Districts as $District): ?>
                      <option value="<?php echo e($District->DistrictID); ?>"><?php echo e($District->DistrictName); ?></option>
                    <?php endforeach; ?>
                  </select>
              </div>
              <div class="col-lg-2">
                  <select id="Tehsil" name="Tehsil" class="form-control">
                    <option value="">  Tehsil </option>
                  </select>
              </div>

              <div class="col-lg-2">
                 <div class="bv" data-example-id="" style="margin-top:5px;">
                    <div class="ew ug ul">
                      <label>
                        <input type="radio" id="City" name="CityOrVillage" value="City" onclick="getCityOrVillages()">  
                        <span class="uh"></span>
                         City
                      </label>
                    </div>
                    <div class="ew ug ul">
                       <label>
                         <input type="radio" name="CityOrVillage" id="Village" value="Village" onclick="getCityOrVillages()"> 
                          <span class="uh"></span>
                            Village
                         </label>
                    </div>
                  </div>
              </div>

              <div class="col-lg-2">
                  <select id="CorV" name="CorV" onchange="loadPrabhag();loadBooth();" class="form-control">
                    <option value=""> Select City / Village </option>
                  </select>
              </div>
              <div class="col-lg-2">
                  <select id="PrabhagOrWard" name="PrabhagOrWard"  class="form-control">
                    <option value=""> Prabhag Or Ward </option>
                  </select>
              </div>

              <div class="col-lg-2">
                <strong>Or</strong>
                  <select id="Booth" name="Booth" style="width:80%" class="form-control" >
                    <option value=""> Select Booth </option>
                  </select>
              </div>
          </div>
          <p/><p/>
          <div class="col-lg-12" style="margin-top:2%;">
            <div class="col-lg-4">
                <select id="IsVoted" name="IsVoted" class="form-control">
                  <option value="" > Is Voted </option>
                  <option value="1"> होय </option>
                  <option value="0"> नाही </option>
                </select>
            </div>

            <div class="col-lg-2">
              <button type="submit" onclick="loadVoters()" class="cg fm">
                <span >Search</span> 
              </button>
            </div>
          </div>
          <p/><br/>&nbsp;
            <p/>
            <h5> Report Heading </h5>
          <hr/>

            <div class="row">
                <!-- Datatable  -->
                <table id="SurnameTable" class="table table-hover" ><!-- table-hover -->
                  <thead>
                    <tr>
                      <th> </th>
                      <th> Sr.No.</th>
                      <th> Name</th>
                      <th> Mobile Number </th>
                      <th> WhatsApp Number </th>
                      <th> Email </th>
                      <th> EPIC Number </th> 
                      <th> Voting Center </th>
                      <th> Address </th>
                      <th> New Address </th>
                      <th> View </th>
                    </tr>
                  </thead>
                  <tbody>
                  </tbody>
                </table>
                <p/>

            </div>
          </div>
        </div>
      </div>
    </div>      
  </div>    

</div>
</div>

<script>
   //$("#surnames").select2();
   $("#CorV").select2();
   $("#PrabhagOrWard").select2();
   $("#District").select2();
   $("#Tehsil").select2();
   $("#Booth").select2();

</script>
<style>
.pagination {
  display: inline-block;
  padding-left: 0;
  margin-top: 1rem;
  margin-bottom: 1rem;
  border-radius: .25rem;
}

.page-item {
  display: inline;
}

.page-item:first-child .page-link {
  margin-left: 0;
  border-top-left-radius: .25rem;
  border-bottom-left-radius: .25rem;
}

.page-item:last-child .page-link {
  border-top-right-radius: .25rem;
  border-bottom-right-radius: .25rem;
}

.page-item.active .page-link, .page-item.active .page-link:focus, .page-item.active .page-link:hover {
  z-index: 2;
  color: #fff;
  cursor: default;
  background-color: #0275d8;
  border-color: #0275d8;
}

.page-item.disabled .page-link, .page-item.disabled .page-link:focus, .page-item.disabled .page-link:hover {
  color: #818a91;
  cursor: not-allowed;
  background-color: #fff;
  border-color: #ddd;
}

.page-link {
  position: relative;
  float: left;
  padding: .5rem .75rem;
  margin-left: -1px;
  line-height: 1.5;
  color: #0275d8;
  text-decoration: none;
  background-color: #fff;
  border: 1px solid #ddd;
}

.page-link:focus, .page-link:hover {
  color: #014c8c;
  background-color: #eceeef;
  border-color: #ddd;
}

.pagination-lg .page-link {
  padding: .75rem 1.5rem;
  font-size: 1.25rem;
  line-height: 1.333333;
}

.pagination-lg .page-item:first-child .page-link {
  border-top-left-radius: .3rem;
  border-bottom-left-radius: .3rem;
}

.pagination-lg .page-item:last-child .page-link {
  border-top-right-radius: .3rem;
  border-bottom-right-radius: .3rem;
}

.pagination-sm .page-link {
  padding: .275rem .75rem;
  font-size: .875rem;
  line-height: 1.5;
}

.pagination-sm .page-item:first-child .page-link {
  border-top-left-radius: .2rem;
  border-bottom-left-radius: .2rem;
}

.pagination-sm .page-item:last-child .page-link {
  border-top-right-radius: .2rem;
  border-bottom-right-radius: .2rem;
}

 .pagination{display:inline-block;padding-left:0;margin:20px 0;border-radius:4px}
 .pagination>li{display:inline}
 .pagination>li>a,.pagination>li>span{position:relative;float:left;padding:6px 12px;margin-left:-1px;line-height:1.42857143;color:#337ab7;text-decoration:none;background-color:#fff;border:1px solid #ddd}
 .pagination>li:first-child>a,.pagination>li:first-child>span{margin-left:0;border-top-left-radius:4px;border-bottom-left-radius:4px}
 .pagination>li:last-child>a,.pagination>li:last-child>span{border-top-right-radius:4px;border-bottom-right-radius:4px}
 .pagination>li>a:focus,.pagination>li>a:hover,.pagination>li>span:focus,.pagination>li>span:hover{color:#23527c;background-color:#eee;border-color:#ddd}
 .pagination>.active>a,.pagination>.active>a:focus,.pagination>.active>a:hover,.pagination>.active>span,.pagination>.active>span:focus,.pagination>.active>span:hover{z-index:2;color:#fff;cursor:default;background-color:#337ab7;border-color:#337ab7}.pagination>.disabled>a,.pagination>.disabled>a:focus,.pagination>.disabled>a:hover,.pagination>.disabled>span,.pagination>.disabled>span:focus,.pagination>.disabled>span:hover{color:#777;cursor:not-allowed;background-color:#fff;border-color:#ddd}.pagination-lg>li>a,.pagination-lg>li>span{padding:10px 16px;font-size:18px}.pagination-lg>li:first-child>a,.pagination-lg>li:first-child>span{border-top-left-radius:6px;border-bottom-left-radius:6px}.pagination-lg>li:last-child>a,.pagination-lg>li:last-child>span{border-top-right-radius:6px;border-bottom-right-radius:6px}.pagination-sm>li>a,.pagination-sm>li>span{padding:5px 10px;font-size:12px}.pagination-sm>li:first-child>a,.pagination-sm>li:first-child>span{border-top-left-radius:3px;border-bottom-left-radius:3px}
 .pagination-sm>li:last-child>a,.pagination-sm>li:last-child>span{border-top-right-radius:3px;border-bottom-right-radius:3px}


</style>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('admin.layouts.votermainview', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>