<?php $__env->startSection('content'); ?> 
<script>
  function loadTehsil()
  {
      var DistrictId=$("#District").val();
      $.ajax({
          type: "GET",
          url: "getTehsilNames",
          data:"districtid="+DistrictId,
          dataType: "json", 
          success: function(result){
               $('#Tehsil').children().remove();         
               $('#Tehsil').append($('<option>').text("तालुका").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 x=document.getElementsByName("CityOrVillage");
      for (i = 0; i < x.length; i++) {
          if (x[i].type == "radio") {
              if(x[i].checked==true)
              {
                var Val=x[i].value;
                if(Val=="City")
                {
                  IsCity=1;
                }
                else if(Val=="Village")
                {
                 IsCity=0; 
                }
              }
          }
      }
     // alert(IsCity);
      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(" शहर ").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(" गाव ").attr('value', ""));
                $.each(result, function(id, value) {
                    $('#CorV').append($('<option>').text(value.VillageName).attr('value', value.VillageID));
                });
              }
            }
          });
  }
</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> कार्यकर्ता रिपोर्ट्स  </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="col-lg-12" style="margin-top:15px;">
        <div class="col-lg-3"></div>
          <div class="col-lg-4">
             <?php if(Session::has('success')): ?>
               <div class="alert pv alert-dismissible alert-success" role="alert">
                 <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                 <font style="color:#f5f5f5"><li> <?php echo e(Session::get('success')); ?>  </li></font>
              </div>
             <p/>
             <?php endif; ?>

             <?php if(Session::has('error')): ?>
                 <div class="alert pv alert-dismissible alert-danger" style="background-color:#ff5050" role="alert">
                    <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <font style="color:#f5f5f5"><li> <?php echo e(Session::get('error')); ?></li></font>
                  </div>
              <p/>
             <?php endif; ?>
           </div>
         </div>
      <form action="ChangeDefaultValues" method="get">
            <div class="col-lg-12" style="margin-top:15px;">
              <div class="col-lg-3"></div>
              <div class="col-lg-4">
                 <div class="bv" data-example-id="" style="margin-top:5px;">
                  <?php if($DefaultValue=="District"): ?>
                      <div class="ew ug ul">
                        <label>
                          <input type="radio" id="DistrictR" name="DefaultValue" value="District" checked>  
                          <span class="uh"></span>
                           जिल्हा
                        </label>
                      </div>
                      <div class="ew ug ul">
                         <label>
                           <input type="radio" name="DefaultValue" id="TehsilR" value="Tehsil">
                            <span class="uh"></span>
                              तालुका
                           </label>
                      </div>
                      <div class="ew ug ul">
                         <label>
                           <input type="radio" name="DefaultValue" id="CityR" value="City">
                            <span class="uh"></span>
                              शहर
                           </label>
                      </div>
                      <div class="ew ug ul">
                         <label>
                           <input type="radio" name="DefaultValue" id="VillageR" value="Village">
                            <span class="uh"></span>
                              गाव
                           </label>
                      </div>
                   <?php elseif($DefaultValue=="Tehsil"): ?>
                    <div class="ew ug ul">
                        <label>
                          <input type="radio" id="DistrictR" name="DefaultValue" value="District" >  
                          <span class="uh"></span>
                           जिल्हा
                        </label>
                      </div>
                      <div class="ew ug ul">
                         <label>
                           <input type="radio" name="DefaultValue" id="TehsilR" value="Tehsil" checked>
                            <span class="uh"></span>
                              तालुका
                           </label>
                      </div>
                      <div class="ew ug ul">
                         <label>
                           <input type="radio" name="DefaultValue" id="CityR" value="City">
                            <span class="uh"></span>
                              शहर
                           </label>
                      </div>
                      <div class="ew ug ul">
                         <label>
                           <input type="radio" name="DefaultValue" id="VillageR" value="Village">
                            <span class="uh"></span>
                              गाव
                           </label>
                      </div>

                  <?php elseif($DefaultValue=="City"): ?>                  
                      <div class="ew ug ul">
                        <label>
                          <input type="radio" id="DistrictR" name="DefaultValue" value="District" >  
                          <span class="uh"></span>
                           जिल्हा
                        </label>
                      </div>
                      <div class="ew ug ul">
                         <label>
                           <input type="radio" name="DefaultValue" id="TehsilR" value="Tehsil">
                            <span class="uh"></span>
                              तालुका
                           </label>
                      </div>
                      <div class="ew ug ul">
                         <label>
                           <input type="radio" name="DefaultValue" id="City" value="City" checked>
                            <span class="uh"></span>
                              शहर
                           </label>
                      </div>
                      <div class="ew ug ul">
                         <label>
                           <input type="radio" name="DefaultValue" id="VillageR" value="Village">
                            <span class="uh"></span>
                              गाव
                           </label>
                      </div>
                  <?php elseif($DefaultValue=="Village"): ?>                  
                     <div class="ew ug ul">
                        <label>
                          <input type="radio" id="DistrictR" name="DefaultValue" value="District" >  
                          <span class="uh"></span>
                           जिल्हा
                        </label>
                      </div>
                      <div class="ew ug ul">
                         <label>
                           <input type="radio" name="DefaultValue" id="TehsilR" value="Tehsil">
                            <span class="uh"></span>
                              तालुका
                           </label>
                      </div>
                      <div class="ew ug ul">
                         <label>
                           <input type="radio" name="DefaultValue" id="CityR" value="City">
                            <span class="uh"></span>
                              शहर
                           </label>
                      </div>
                      <div class="ew ug ul">
                         <label>
                           <input type="radio" name="DefaultValue" id="VillageR" value="Village" checked>
                            <span class="uh"></span>
                              गाव
                           </label>
                      </div>
                  <?php else: ?>
                    <div class="ew ug ul">
                        <label>
                          <input type="radio" id="DistrictR" name="DefaultValue" value="District" >  
                          <span class="uh"></span>
                           जिल्हा
                        </label>
                      </div>
                      <div class="ew ug ul">
                         <label>
                           <input type="radio" name="DefaultValue" id="TehsilR" value="Tehsil">
                            <span class="uh"></span>
                              तालुका
                           </label>
                      </div>
                      <div class="ew ug ul">
                         <label>
                           <input type="radio" name="DefaultValue" id="CityR" value="City">
                            <span class="uh"></span>
                              शहर
                           </label>
                      </div>
                      <div class="ew ug ul">
                         <label>
                           <input type="radio" name="DefaultValue" id="VillageR" value="Village">
                            <span class="uh"></span>
                              गाव
                           </label>
                      </div>
                  <?php endif; ?>
              </div>

            </div>
            <div class="col-lg-12" style="margin-top:15px;">
              <div class="col-lg-3"></div>
              <div class="col-lg-4">
                  <select id="District" name="District" onchange="loadTehsil()" class="form-control">
                    <option value="-1"> जिल्हा </option>
                    <?php foreach($Districts as $District): ?>
                       <?php if($SelectDistrict==$District->DistrictID ): ?>
                          <option value="<?php echo e($District->DistrictID); ?>" selected><?php echo e($District->DistrictName); ?></option>
                        <?php else: ?>
                         <option value="<?php echo e($District->DistrictID); ?>"><?php echo e($District->DistrictName); ?></option>
                         <?php endif; ?>
                    <?php endforeach; ?>
                  </select>
              </div>
              <div class="col-lg-3"></div>
            </div>
            <div class="col-lg-12" style="margin-top:15px;">
              <div class="col-lg-3"></div>
              <div class="col-lg-4">
                  <select id="Tehsil" name="Tehsil" class="form-control">
                    <option value="-1">  तालुका </option>
                       <?php foreach($Tehsils as $Tehsil): ?>
                         <?php if($SelectedTehsil==$Tehsil->TehsilID ): ?>
                            <option value="<?php echo e($Tehsil->TehsilID); ?>" selected><?php echo e($Tehsil->TehsilName); ?></option>
                          <?php else: ?>
                            <option value="<?php echo e($Tehsil->TehsilID); ?>"><?php echo e($Tehsil->TehsilName); ?></option>
                          <?php endif; ?>
                       <?php endforeach; ?>
                  </select>
              </div>
              <div class="col-lg-3"></div>
            </div>
            <div class="col-lg-12" style="margin-top:15px;">   
              <div class="col-lg-3"></div>         
              <div class="col-lg-4">
                 <div class="bv" data-example-id="" style="margin-top:5px;">
                    <?php if($IsCity==-1): ?>
                      <div class="ew ug ul">
                        <label>
                          <input type="radio" id="City" name="CityOrVillage" value="City" onclick="getCityOrVillages()">  
                          <span class="uh"></span>
                           शहर
                        </label>
                      </div>
                      <div class="ew ug ul">
                         <label>
                           <input type="radio" name="CityOrVillage" id="Village" value="Village" onclick="getCityOrVillages()"> 
                            <span class="uh"></span>
                              गाव
                           </label>
                      </div>
                    <?php elseif($IsCity==1): ?>
                      <div class="ew ug ul">
                        <label>
                          <input type="radio" id="City" name="CityOrVillage" value="City" onclick="getCityOrVillages()" checked>  
                          <span class="uh"></span>
                           शहर
                        </label>
                      </div>
                      <div class="ew ug ul">
                           <label>
                             <input type="radio" name="CityOrVillage" id="Village" value="Village" onclick="getCityOrVillages()"> 
                              <span class="uh"></span>
                                गाव
                             </label>
                      </div>
                    <?php elseif($IsCity==0): ?>
                      <div class="ew ug ul">
                        <label>
                          <input type="radio" id="City" name="CityOrVillage" value="City" onclick="getCityOrVillages()" >  
                          <span class="uh"></span>
                           शहर
                        </label>
                      </div>
                      <div class="ew ug ul">
                         <label>
                           <input type="radio" name="CityOrVillage" id="Village" value="Village" onclick="getCityOrVillages()" checked> 
                            <span class="uh"></span>
                              गाव
                           </label>
                      </div>
                    <?php endif; ?>
                  </div>
              </div>
              <div class="col-lg-3"></div>
            </div>
            <div class="col-lg-12" style="margin-top:15px;">
               <div class="col-lg-3"></div>
                <div class="col-lg-4">
                    <select id="CorV" name="CorV" class="form-control">
                      <option value="-1"> शहर / गाव </option>
                        <?php if($IsCity==1): ?>
                           <?php foreach($Cities_Villages as $City_Village): ?>
                             <?php if($SelectedCityOrVillage==$City_Village->CityID ): ?>
                                <option value="<?php echo e($City_Village->CityID); ?>" selected><?php echo e($City_Village->CityName); ?></option>
                              <?php else: ?>
                                <option value="<?php echo e($City_Village->CityID); ?>"><?php echo e($City_Village->CityName); ?></option>
                              <?php endif; ?>
                           <?php endforeach; ?>
                        <?php elseif($IsCity==0): ?>
                          <?php foreach($Cities_Villages as $City_Village): ?>
                             <?php if($SelectedCityOrVillage==$City_Village->VillageID ): ?>
                                <option value="<?php echo e($City_Village->VillageID); ?>" selected><?php echo e($City_Village->VillageName); ?></option>
                              <?php else: ?>
                                <option value="<?php echo e($City_Village->VillageID); ?>"><?php echo e($City_Village->VillageName); ?></option>
                              <?php endif; ?>
                           <?php endforeach; ?>
                        <?php endif; ?>
                    </select>
                </div>
                <div class="col-lg-3"></div>
            </div>
            <div class="col-lg-12" style="margin-top:15px;">
                <div class="col-lg-3"></div>
                <div class="col-lg-3">
                    <input type="submit" value="सेट करा " class="cg fm"></input>
                </div>
                <div class="col-lg-3"></div>
            </div>
          </form> 
<script>
   $("#CorV").select2();
   $("#District").select2();
   $("#Tehsil").select2();
 
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('admin.layouts.votermainview', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>