<?php $__env->startSection('content'); ?> 
	
	<style type="text/css">
		#installationForm .tab-content {
		    /*margin-top: 40px;*/
		}
		body {
		   font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
		   font-size: 14px;
		   line-height: 1.6;
		   color: #1e3948;
		   /*background-color: #f5f8fa; */
		}
	</style>

<script>
  function loadZoneNames()
  {
      var StateId=$('#States').val();
      // Get State Name
      $.ajax({
          type: "GET",
          url: "getZoneNames",
          data:"stateid="+StateId,
          dataType: "json",
          success: function(result){
               $('#Zones').children().remove();         
               $('#Zones').append($('<option>').text("Zone").attr('value', ""));
              $.each(result, function(id, value) {
                $('#Zones').append($('<option>').text(value.ZoneName).attr('value', value.ZoneID));
              });
            }
          });
  }

  function loadDistrictNames()
  {
      var StateId=$('#States').val();
      var ZoneId=$('#Zones').val();
      // Get State Name
      $.ajax({
          type: "GET",
          url: "getDistrictNames",
          data:"zoneid="+ZoneId,
          dataType: "json",
          success: function(result){
               $('#Districts').children().remove();         
               $('#Districts').append($('<option>').text("District").attr('value', ""));
               $.each(result, function(id, value) {
                  $('#Districts').append($('<option>').text(value.DistrictName).attr('value', value.DistrictID));
               });
            }
          });
  }

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

  function loadVillageNames()
  {
      var TehsilId=$('#Tehsils').val();
      // Get State Name
      $.ajax({
          type: "GET",
          url: "getVillageNames",
          data:"tehsilid="+TehsilId,
          dataType: "json",
          success: function(result){
               $('#Villages').children().remove();         
               $('#Villages').append($('<option>').text("Village").attr('value', ""));
               $.each(result, function(id, value) {
                  $('#Villages').append($('<option>').text(value.VillageName).attr('value', value.VillageID));
               });
            }
       });
  }

  function loadVillageName()
  {
      var CityId=$('#Villages').val();
      // Get State Name
      $.ajax({
          type: "GET",
          url: "getVillageNameById",
          data:"villageid="+CityId,
          dataType: "json",
          success: function(result){
              $.each(result, function(id, value) {
                  $("#Village").val(value.VillageName);
                });
              }
       });   
  }

  // Load City or Village if 
  function loadCityOrVillage()
  {
    if(document.getElementById("Ci").checked==true)  // City is Selected then Add 
    {
      // if City is checked
         var TehsilId=$('#Tehsils').val();
              // Get State Name
              $.ajax({
                  type: "GET",
                  url: "getCityNames",
                  data:"tehsilid="+TehsilId,
                  dataType: "json",
                  success: function(result){
                       $('#Citys').children().remove();         
                       $('#Citys').append($('<option>').text("City").attr('value', ""));
                       $.each(result, function(id, value) {
                          $('#Citys').append($('<option>').text(value.CityName).attr('value', value.CityID));
                       });
                    }
               });

    }
    else if(document.getElementById("Vi").checked==true)
    {
      // if Village is checked
        
        var TehsilId=$('#Tehsils').val();
              // Get State Name
        $.ajax({
            type: "GET",
            url: "getVillageNames",
            data:"tehsilid="+TehsilId,
            dataType: "json",
            success: function(result){
                $('#Villages').children().remove();         
                $('#Villages').append($('<option>').text("Village").attr('value', ""));
                $.each(result, function(id, value) {
                    $('#Villages').append($('<option>').text(value.VillageName).attr('value', value.VillageID));
              });
            }
       });
    }
  }

 function showCity()
  {
            $("#VillageId").hide();
            $("#CityId").show();

            // Load Cities from Tehsil
             var TehsilId=$('#Tehsils').val();
              // Get State Name
              $.ajax({
                  type: "GET",
                  url: "getCityNames",
                  data:"tehsilid="+TehsilId,
                  dataType: "json",
                  success: function(result){
                       $('#Citys').children().remove();         
                       $('#Citys').append($('<option>').text("City").attr('value', ""));
                       $.each(result, function(id, value) {
                          $('#Citys').append($('<option>').text(value.CityName).attr('value', value.CityID));
                       });
                    }
               });

  }

  function showVillage()
  {
            $("#CityId").hide();
            $("#VillageId").show();
            var TehsilId=$('#Tehsils').val();
            // Get State Name
            $.ajax({
                type: "GET",
                url: "getVillageNames",
                data:"tehsilid="+TehsilId,
                dataType: "json",
                success: function(result){
                    $('#Villages').children().remove();         
                       $('#Villages').append($('<option>').text("Village").attr('value', ""));
                       $.each(result, function(id, value) {
                          $('#Villages').append($('<option>').text(value.VillageName).attr('value', value.VillageID));
                       });
                    }
             });
  }

 function showCity1()
  {
            $("#Village1").hide();
            $("#City1").show();
            // Load Cities from Tehsil
             var TehsilId=$('#Tehsil').val();
              // Get State Name
              $.ajax({
                  type: "GET",
                  url: "getCityNames",
                  data:"tehsilid="+TehsilId,
                  dataType: "json",
                  success: function(result){
                       $('#City').children().remove();         
                       $('#City').append($('<option>').text("City").attr('value', ""));
                       $.each(result, function(id, value) {
                          $('#City').append($('<option>').text(value.CityName).attr('value', value.CityID));
                       });
                    }
               });
  }

  function showVillage1()
  {
            $("#City1").hide();
            $("#Village1").show();

            var TehsilId=$('#Tehsil').val();
            // Get State Name
            $.ajax({
                type: "GET",
                url: "getVillageNames",
                data:"tehsilid="+TehsilId,
                dataType: "json",
                success: function(result){
                    $('#Village').children().remove();         
                       $('#Village').append($('<option>').text("Village").attr('value', ""));
                       $.each(result, function(id, value) {
                          $('#Village').append($('<option>').text(value.VillageName).attr('value', value.VillageID));
                       });
                    }
             });
  }

  function loadBooths()
  {
      var TehsilId=$('#Tehsil').val();
      // Get State Name
      var Village_Or_City_Id=0;

      //Check if is City or village
      var IsCity=0;
      if(document.getElementById("Ci").checked==true)
      {
        IsCity=1;
        Village_Or_City_Id=$("#Citys").val();
      }
      else if(document.getElementById("Vi").checked==true)
      {
        IsCity=0;
        Village_Or_City_Id=$("#Villages").val();
      }

      $.ajax({
        type: "GET",
        url: "getBoothsNumbersById",
        data:"Village_Or_City_Id="+Village_Or_City_Id,
        dataType: "json",
        success: function(result){

          $.each(result, function(id, value) {
                $('#Booth').append($('<option>').text(value.BoothNumber).attr('value', value.BoothID));   
          });
         }
        });
  }

 function loadAppUsers()
  {
      var BoothId=$('#Booth').val();
      $.ajax({
            type: "GET",
            url: "getAppsOfBooth",
            data:"BoothId="+BoothId,
            dataType: "json",
            success: function(result){
                $('#AppUserId').children().remove();         
                $('#AppUserId').append($('<option>').text("App Users ").attr('value', ""));
                $.each(result, function(id, value) {
                    $('#AppUserId').append($('<option>').text(value.Name +" | "+ value.MobileNumber ).attr('value', value.AppUserID));
              });
            }
       });
  }

  function loadBooth()
  {
      var TehsilId=$('#Tehsil').val();
      // Get State Name
      var Village_Or_City_Id=0;

      //Check if is City or village
      var IsCity=0;
      if(document.getElementById("Cityi").checked==true)
      {
        IsCity=1;
        Village_Or_City_Id=$("#City").val();
      }
      else if(document.getElementById("Villagei").checked==true)
      {
        IsCity=0;
        Village_Or_City_Id=$("#Village").val();
      }

      $.ajax({
        type: "GET",
        url: "getBoothsNumbersById",
        data:"Village_Or_City_Id="+Village_Or_City_Id,
        dataType: "json",
          success: function(result){
            $('#BoothV').children().remove();         
            $('#BoothV').append($('<option>').text("Booth Number").attr('value', ""));
            $.each(result, function(id, value) {
               $('#BoothV').append($('<option>').text(value.BoothNumber).attr('value', value.BoothID));
            });
          }
       });
       $('#BoothV').select2('val','');
  }

  function GetAllInfoOfAppUser()
  {
      var AppUserID=$('#AppUserId').val();

      $.ajax({
            type: "GET",
            url: "GetAllInfoOfAppUser",
            data:"AppUserId="+AppUserID,
            dataType: "json",
            beforeSend: function(){
             $("#loading").show();
           },
           complete: function(){
             $("#loading").hide();
           },
            success: function(result){
              //  Booth , Citys , Villages (Visible VillageId ,CityId ), Vi ,Ci , Tehsils , Districts,Zones,States

                $("#States").val(result.SelectedState);
                $("#Zones").val(result.SelectedZone);
                $("#Districts").val(result.SelectedDistrict);
                $("#Tehsils").val(result.SelectedTehsil);
                
                if(result.IsCity==0) // Load Villages
                {
                  document.getElementById("Vi").checked=true;
                  $("#VillageId").show();
                  $("#CityId").hide(); 
                 
                  $("#Villages").val(result.SelectVillage_City_ID);
                }
                else if(result.IsCity==1) // Load Cities
                {
                  document.getElementById("Ci").checked=true;
                  $("#CityId").show(); 
                  $("#VillageId").hide();

                   $("#Citys").val(result.SelectVillage_City_ID);
                }

                $("#Booth").val(result.SelectBoothNumber);

                document.getElementById("AccessLevel").value=result.AccessLevel;
                document.getElementById("SelectBoothId").value=result.SelectBoothId;
                document.getElementById("IsCity").value=result.IsCity;
                $("#BoothNumber").val(result.SelectBoothNumber);
                document.getElementById("AccessLevel").innerHTML=result.AccessLevelMessage;
              // Get ALl Assigned Voters 
                var tables = $.fn.dataTable.fnTables(true);

                $(tables).each(function () {
                    $('#AssignedVoters').dataTable().fnDestroy();
                });

               $('#AssignedVoters').DataTable({
                    "bProcessing": true,
                    responsive: true,
                    "lengthMenu": [[10, 25, 50,100, -1], [10, 25, 50,100, "All"]],
                    "sAjaxSource": "GetAllContactsByAppUser?AppUserId="+AppUserID+"&AccessLevel="+result.AccessLevel+"&BoothId="+result.SelectBoothId+"&IsCity="+result.IsCity,//result.AssignedVoters,
                    "aoColumns": [
                      { "mData": "MarathiName" },
                      { "mData": "EnglishName"},
                      { "mData": "Address" },
                      { "mData": "NewAddress" },
                      { "mData": "Sex"},
                      { "mData": "Remove"}
                    ]
                  });
               // Contacts Not Assigned to Appusers
                tables = $.fn.dataTable.fnTables(true);
                $(tables).each(function () {
                    $('#UnassignedVoters').dataTable().fnDestroy();
                });

               $('#UnassignedVoters').DataTable({
                    "bProcessing": true,
                    responsive: true,
                    "lengthMenu": [[10, 25, 50,100, -1], [10, 25, 50,100, "All"]],
                    "sAjaxSource": "GetAllContactsNotAssignedToAppUsers?AppUserId="+AppUserID+"&AccessLevel="+result.AccessLevel+"&BoothId="+result.SelectBoothId+"&IsCity="+result.IsCity+"&WithOtherApp=0",//result.AssignedVoters,
                    "aoColumns": [
                      { "mData": "MarathiName" },
                      { "mData": "EnglishName"},
                      { "mData": "Address" },
                      { "mData": "NewAddress" },
                      { "mData": "Sex"},
                      { "mData": "Assign"}
                    ]
                });

                //GetAllContactsByAppUser(AppUserID,result.AccessLevel,result.SelectBoothId,result.IsCity);
              /*
                $('#AppUserId').children().remove();         
                $('#AppUserId').append($('<option>').text("App Users ").attr('value', ""));
                $.each(result, function(id, value) {
                    $('#AppUserId').append($('<option>').text(value.Name +" | "+ value.MobileNumber ).attr('value', value.AppUserID));
              }); */

            // Get Contacts BoothId 
            }
       });
  }

  function loadContactsOfAllAppUsers()
  {
    var IsLoadForAll=$("#ShowAppContact").val();
    var AppUserID=$('#AppUserId').val();

    var AccessLevel=$("#AccessLevel").val();
    var SelectBoothId=$("#SelectBoothId").val();
    var IsCity=$("#IsCity").val();

    if(AppUserID!="")
    {
     if(document.getElementById("ShowAppContact").checked==true)
      {
          tables = $.fn.dataTable.fnTables(true);
          $(tables).each(function () {
              $('#UnassignedVoters').dataTable().fnDestroy();
          });

          $('#UnassignedVoters').DataTable({
          "bProcessing": true,
           responsive: true,
           
           "lengthMenu": [[10, 25, 50,100, -1], [10, 25, 50,100, "All"]],
           "sAjaxSource": "GetAllContactsNotAssignedToAppUsers?AppUserId="+AppUserID+
           "&AccessLevel="+AccessLevel+"&BoothId="+SelectBoothId+"&IsCity="+IsCity+"&WithOtherApp=1",//result.AssignedVoters,
           "aoColumns": [
              { "mData": "MarathiName" },
              { "mData": "EnglishName"},
              { "mData": "Address" },
              { "mData": "NewAddress" },
              { "mData": "Sex"},
              { "mData": "Assign"}
             ]
          });
      }
      else if(document.getElementById("ShowAppContact").checked==false)
      {
       // alert("In App --");
         tables = $.fn.dataTable.fnTables(true);
          $(tables).each(function () {
              $('#UnassignedVoters').dataTable().fnDestroy();
          });

          $('#UnassignedVoters').DataTable({
          "bProcessing": true,
           responsive: true,
           "lengthMenu": [[10, 25, 50,100, -1], [10, 25, 50,100, "All"]],
           "sAjaxSource": "GetAllContactsNotAssignedToAppUsers?AppUserId="+AppUserID+
           "&AccessLevel="+AccessLevel+"&BoothId="+SelectBoothId+"&IsCity="+IsCity+"&WithOtherApp=0",//result.AssignedVoters,
           "aoColumns": [
              { "mData": "MarathiName" },
              { "mData": "EnglishName"},
              { "mData": "Address" },
              { "mData": "NewAddress" },
              { "mData": "Sex"},
              { "mData": "Assign"}
             ]
          });
      }
    }
    else
    {
      // Please Select App User to Continue...
      alert("Please Select App User to Continue...");
    }
  }

  function selectAllVoters()
  {
    var oTable = $('#UnassignedVoters').dataTable();
    // Get the length
    var length=oTable.fnGetData().length;

    //var length=tables.fnGetData().length;
   // alert("Total Length of Table : "+length);

    if(document.getElementById("AssignAllVoter").checked==true) // Select All Voters to Assign
    {
      for (var i = 0; i < length; i++) {
         //alert($("#Assign_"+i).val() );
         if (typeof(document.getElementById("Assign_"+i)) != 'undefined' && document.getElementById("Assign_"+i) != null) 
         {
           document.getElementById("Assign_"+i).checked=true;
         }
      }
    }
    else if(document.getElementById("AssignAllVoter").checked==false) // Select All Voters to Assign
    {
     for (var i = 0; i < length; i++) {
       if (typeof(document.getElementById("Assign_"+i)) != 'undefined' && document.getElementById("Assign_"+i) != null) 
       {
          document.getElementById("Assign_"+i).checked=false;
        }
      }
    }
  }

  // here Unselect All voters from voters to assign table
  function UnselectAllToAssign(id)
  {
     //alert("In unselect Voters table 1 "+id);
      
      if(document.getElementById("Assign_"+id).checked==true)
      {
        document.getElementById("ShowAppContact").checked=false;
      }
  }

  // Unselect All assigned Voters
 function UnselectAllAssigned(id)
  {
  //  alert("id"+id);
     var oTable = $('#AssignedVoters').dataTable();
    // Get the length
    var length=oTable.fnGetData().length;
    if(document.getElementById("Remove_"+id).checked==true)
    {

    }
    else
    {

    }
  }

// TO Remove Voters 
  
  function removeAllVoters() //from Voters to remove table
  {
    var oTable = $('#AssignedVoters').dataTable();
    // Get the length
    var length=oTable.fnGetData().length;

    //var length=tables.fnGetData().length;
    // alert("Total Length of Table : "+length);

    if(document.getElementById("RemoveAllVoter").checked==true) // Select All Voters to Assign
    {
      for (var i = 0; i < length; i++) {
         //alert($("#Assign_"+i).val() );
         if (typeof(document.getElementById("Remove_"+i)) != 'undefined' && document.getElementById("Remove_"+i) != null) 
         {
           document.getElementById("Remove_"+i).checked=true;
         }
      }
    }
    else if(document.getElementById("RemoveAllVoter").checked==false) // Select All Voters to Assign
    {
     for (var i = 0; i < length; i++) {
       if (typeof(document.getElementById("Remove_"+i)) != 'undefined' && document.getElementById("Remove_"+i) != null) 
       {
          document.getElementById("Remove_"+i).checked=false;
        }
      }
    }
  }

  function AssignVoters()
  {
    var AppUserId=$("#AppUserId").val();
    var Voters=[];
    var AccessLevel=$("#AccessLevel").val();

    if(document.getElementById("AssignAllVoter").checked==true)
    {
        // Get All Voters from table and
        var oTable = $('#UnassignedVoters').dataTable();
        // Get the length
        var length=oTable.fnGetData().length;
        //   alert("Length : "+length);
        for (var i = 0; i < length; i++) {
         if (typeof(document.getElementById("Assign_"+i)) != 'undefined' && document.getElementById("Assign_"+i) != null) 
         {
            Voters[i]=$("#Assign_"+i).val();
            //alert($("#Assign_"+i).val());
         }
       }

        $.ajax({
           dataType: "json",
          type: "GET",
          url: "AssignVoters?AppUserId="+AppUserId+"&Voters="+JSON.stringify(Voters),
          success: function(result){
                // add success function here!
                alert(""+result.SuccessfullyAssigned);
                alert(""+result.Cancelled);
                alert(""+result.AlreadyAssigned);

               // Display Al

                document.getElementById("success").innerHTML=result.SuccessfullyAssigned;
                document.getElementById("notsaved").innerHTML=result.Cancelled;
                document.getElementById("AlreadySaved").innerHTML=result.AlreadyAssigned;
              }
        });
    }
    else if(document.getElementById("AssignAllVoter").checked==false){
      // Get Only Checked Voters
     // Get All Voters from table and
        var oTable = $('#UnassignedVoters').dataTable();
        // Get the length
        var length=oTable.fnGetData().length;
      //   alert("Length : "+length);
        var j=0;
        for (var i = 0; i < length; i++) {
         if (typeof(document.getElementById("Assign_"+i)) != 'undefined' && document.getElementById("Assign_"+i) != null) 
         {
            if(document.getElementById("Assign_"+i).checked==true)
            {
              Voters[j]=$("#Assign_"+i).val();              
              j++;
            }
       //     alert($("#Assign_"+i).val());
         }
       }
        $.ajax({
           dataType: "json",
          type: "GET",
          url: "AssignVoters?AppUserId="+AppUserId+"&Voters="+JSON.stringify(Voters),
          success: function(result){

                // add success function here!
                alert(""+result.SuccessfullyAssigned);
                alert(""+result.Cancelled);
                alert(""+result.AlreadyAssigned);

                document.getElementById("success").innerHTML=result.SuccessfullyAssigned;
                document.getElementById("notsaved").innerHTML=result.Cancelled;
                document.getElementById("AlreadySaved").innerHTML=result.AlreadyAssigned;
              }
        });
    }
  }

  function RemoveVoters()
  {
    var AppUserId=$("#AppUserId").val();
    var Voters=[];
    var Confirm=confirm("Would you like to continue?");
    if(Confirm==true)
    {
       if(document.getElementById("RemoveAllVoter").checked==true)
        {
            // Get All Voters from table and
           // alert("Alert : "+AppUserId);
            var oTable = $('#AssignedVoters').dataTable();
            // Get the length
            var length=oTable.fnGetData().length;
            //   alert("Length : "+length);
            for (var i = 0; i < length; i++) {
             if (typeof(document.getElementById("Remove_"+i)) != 'undefined' && document.getElementById("Remove_"+i) != null) 
             {
                Voters[i]=$("#Remove_"+i).val();
                //alert($("#Assign_"+i).val());
             }
           }
           alert(Voters.length);
            $.ajax({
               dataType: "json",
              type: "GET",
              url: "RemoveVoters?AppUserId="+AppUserId+"&Voters="+JSON.stringify(Voters),
              success: function(result){
                    // add success function here!
                    alert(""+result.DeletedCount);
                    alert(""+result.NotDeletedCount);

                    document.getElementById("success").innerHTML=result.DeletedCount;
                    document.getElementById("notsaved").innerHTML=result.NotDeletedCount;
                    document.getElementById("AlreadySaved").innerHTML="";
                  }
            });
        }
        else if(document.getElementById("RemoveAllVoter").checked==false){
          // Get Only Checked Voters
         // Get All Voters from table and
            var oTable = $('#AssignedVoters').dataTable();
            // Get the length
            var length=oTable.fnGetData().length;
          //   alert("Length : "+length);
          var j=0;
            for (var i = 0; i < length; i++) {
             if (typeof(document.getElementById("Remove_"+i)) != 'undefined' && document.getElementById("Remove_"+i) != null) 
             {
                if(document.getElementById("Remove_"+i).checked==true)
                {
                  Voters[j]=$("#Remove_"+i).val();  
                  j++;
                }
           //     alert($("#Assign_"+i).val());
             }
           }
            $.ajax({
               dataType: "json",
              type: "GET",
              url: "RemoveVoters?AppUserId="+AppUserId+"&Voters="+JSON.stringify(Voters),
              success: function(result){
                    // add success function here!
                    alert(""+result.DeletedCount);
                    alert(""+result.NotDeletedCount);

                    document.getElementById("success").innerHTML=result.DeletedCount;
                    document.getElementById("notsaved").innerHTML=result.NotDeletedCount;
                   document.getElementById("AlreadySaved").innerHTML="";
                  }
            });
        }  
    }  
  }

</script>

<div class="qv rc sm sp" style="margin-top:3%;">
        <div class="qw">
           <h4 class="ald"> Assign Voters to App User </h4>

           <h5 style="margin-left:70%;">
              <?php if(Session::has('Name')): ?>
                Welcome, <?php echo e(Session::get('Name')); ?>

              <?php endif; ?>
          </h5>
        </div>
      </div>

  <div class="by amt" style="margin-top:-20px;">
	  <div class="gc">
	    <div class="gz">
	      <div class="ca qo anx ">
	        <div class="qf b aml" style="width:223%;margin-left:-60px;" >
	          <div class="row">
	              <div class="col-lg-3"></div>
	                <div class="col-lg-6">
	                   <!-- Errors And Success Messages -->
  	                  <?php if(count($errors)>0): ?>
  	                    <div class="alert alert-danger">
  	                       <ul>
  	                          <?php foreach($errors->all() as $error): ?>
  	                          <li> <strong><font color="red" > <?php echo e($error); ?> </font> </strong></li>
  	                           <p/>
  	                          <?php endforeach; ?>
  	                       </ul>
  	                   </div>
  	                  <?php endif; ?>
	                   </p>
	                         <?php if(Session::has('success')): ?>
	                              <font color="green" > <?php echo e(Session::get('success')); ?> </font>
	                              <p/>
	                            <?php endif; ?>

	                            <?php if(Session::has('error')): ?>
	                              <font color="red" > <?php echo e(Session::get('error')); ?> </font>
	                              <p/>
	                            <?php endif; ?>
	                   </div>
	                  <div class="col-lg-3"></div>
	              </div>

	            <div class="row">
	                <div class="col-lg-12">
                    <div class="col-lg-6">
                    <!--  Load Apps  -->
                      <select id="AppUserId" name="AppUserId" onchange="GetAllInfoOfAppUser();" class="form-control">
                        <option value=""> Select App User </option>
                         <?php foreach($AppUsers as $AppUser): ?>
                             <option value="<?php echo e($AppUser->AppUserID); ?>"><?php echo e($AppUser->Name); ?> | <?php echo e($AppUser->MobileNumber); ?>  </option>
                          <?php endforeach; ?>
                      </select>
                    </div>
                  </div>
                </div>
                <div class="row" style="margin-top:13px;">
                  <div class="col-lg-12">
	                    <div class="col-lg-2">    
                        <input type="text" id="States" name="States" class="form-control" readonly>
	                    </div>

	                    <div class="col-lg-2">
                        <input type="text" id="Zones" name="Zones" class="form-control" readonly>                        
	                    </div>
	                    <div class="col-lg-2">
                         <input type="text" id="Districts" name="Districts" class="form-control" readonly>  
	                    </div>
	                    <div class="col-lg-2">
                         <input type="text" id="Tehsils" name="Tehsils" class="form-control" readonly>
	                    </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="Ci" name="CityOrVillage"  value="City" />
	                           <span class="uh"></span>
	                             City
	                          </label>
	                       </div>
	                       <div class="ew ug ul">
	                         <label>
	                            <input type="radio" id="Vi" name="CityOrVillage"  value="Village" />
	                            <span class="uh"></span>
	                              Village
	                             </label>
	                        </div>
	                       </div>
	                      </div>
                        <input type="hidden" name="BoothNumber" id="BoothNumber">
	                      <div class="col-lg-2">
	                        <div id="CityId" >
                            <input type="text" id="Citys" name="Citys" class="form-control" readonly>
	                        </div>
	                        <div id="VillageId">
                            <input type="text" id="Villages" name="Villages" class="form-control" readonly>
	                        </div>
	                      </div>
	                </div>
              </div>
              <!--  -->
              <div class="row" style="margin-top:20px;">
                <div class="col-lg-12" >
                  <div class="col-lg-2">
                    <!--  Load Apps  -->
                    <input type="text" id="Booth" name="Booth" class="form-control" readonly>
                  </div>
                  <div class="col-lg-4">
                    <!--  Load Apps  -->
                    <h5>
                    <span id="AccessLevel"></span></h5>
                  </div>
                  <div class="col-lg-4">
                      <font color='green'><span id="success"></span> </font><p/>
                      <font color='red'><span id="notsaved"></span> </font><p/>
                      <span id="AlreadySaved"></span>
                  </div>
                </div>
	            </div>
              <div>

              <div class="col-lg-12" >
                  <div class="col-lg-4"></div>
                  <div class="col-lg-6">
                    <img src="<?php echo asset('theme/assets/images/loader.gif'); ?>" id="loading" name="loading">
                  </div>
                  <div class="col-lg-3"></div>
                </div>
              </div>

             <div class="row">
                <div class="col-lg-12" >
                    <!-- Datatable 1 -->
                    <div class="col-lg-12" > <input id="ShowAppContact" name="ShowAppContact" type="checkbox" onclick="loadContactsOfAllAppUsers()" >&nbsp;<strong> Show Contacts Assigned to All App Users</strong></input></div>

                    <div class="col-lg-6" style="margin-top:12px">
                        <table id="UnassignedVoters" class="table table-striped table-bordered dt-responsive nowrap">
                          <thead>
                            <tr>
                              <th> Marathi Name </th>
                              <th> English Name </th>
                              <th> Old Address</th>
                              <th> New Address </th>
                              <th> Sex </th>
                              <th><input type="checkbox" name="AssignAllVoter" id="AssignAllVoter" onclick="selectAllVoters()" ></th>
                            </tr>
                          </thead>
                          <tbody>
                          </tbody>
                        </table>
                        <p/>
                        <button type="button" class="cg fp" onclick="AssignVoters()">Assign</button>
                    </div>
                    <input type="hidden" id="IsCity">
                    <input type="hidden" id="AccessLevel">
                    <input type="hidden" id="SelectBoothId">
                    <input type="hidden" id="BoothNumber">

                    <!--<div class="col-lg-1" style="margin-top:12px">       </div>-->

                    <div class="col-lg-6" style="margin-top:12px">
                      <div class="datatable">
                        <table id="AssignedVoters" class="table table-striped table-bordered dt-responsive nowrap">
                          <thead>
                            <tr>
                              <th> Marathi Name </th>
                              <th> English Name </th>
                              <th> Old Address</th>
                              <th> New Address </th>
                              <th> Sex </th>
                              <th><input type="checkbox" name="RemoveAllVoter" id="RemoveAllVoter" onclick="removeAllVoters()"></th>
                            </tr>
                          </thead>
                          <tbody>
                          </tbody>
                        </table>
                      </div>
                        <p/>
                        <button type="button" class="cg fp" onclick="RemoveVoters()">Remove</button>
                    </div>
                </div>
              </div>
      		</div>
	      </div>
       </div>
      </div>
    </div>

    <script>

    $(document).ready(function() {
        $("#loading").hide();
        $("#VillageId").hide();
        $("#CityId").hide();

        $("#City1").hide();
        $("#Village1").hide();

 /*     $("#City").select2();
        $("#Village").select2();

        $("#States").select2();
        $("#Zones").select2();
        $("#Districts").select2();
        $("#Tehsils").select2();
        $("#Villages").select2();
        $("#Citys").select2();

        $("#Booth").select2();
        */
        $("#AppUserId").select2();
        //$("#Education").select2();

      /*    $('#UnassignedVoters').DataTable({
            "bProcessing": true,
            "aoColumns": [
              { "mData": "Name" },
              { "mData": "Address"},
              { "mData": "NewAddress" },
              { "mData": "Sex" }
            ]
          });

      $('#AssignedVoters').DataTable({
            "bProcessing": true,
            "aoColumns": [
              { "mData": "Name" },
              { "mData": "Address"},
              { "mData": "NewAddress" },
              { "mData": "Sex" }
            ]
          }); */
     });
</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(); ?>