<?php $__env->startSection('index-content'); ?>
<style>
	.modal {
	    z-index: 99999;
	}
	.modal-body.viewbody table{
		margin-top: 0px;
	}
  .table-responsive {
        width: 100%;
        height: 75vh;
    }
    table tr td{
      vertical-align: middle !important;
    }
    table .tr1 td:first-child {
        position: sticky;
        width: 50px;
        left: 0;
        background: #fff;
        color: #000;
        z-index: 9;
    }
    table .tr1 td:nth-child(2) {
        position: sticky;
        left: 50px;
        background: #fff;
        color: #000;
        z-index: 9;
    }
    table tr th:first-child {
        position: sticky;
        width: 50px;
        left: 0;
        /*   background: #fff;*/
        color: #000;
        z-index: 10;
    }
    table tr th:nth-child(2) {
        position: sticky;
        left: 50px;
        /*   background: #fff !important;*/
        color: #000;
        z-index: 10;
    }
    tr.table-success {
        position: sticky;
        left: 0;
        z-index: 10;
        background: #fff !important;
    }
    tr.table-success {
        top: 0px !important;
        position: sticky !important;
    }
    .table-success,
    .table-success > td,
    .table-success > th {
        background-color: #c3e6cb !important;
    } 
    .modal-header .close {
	    margin-top: -20px;
	}
	a#statuschk{
        width: 75px;
    }
    </style>
<meta name="csrf-token" content="<?php echo e(csrf_token()); ?>" />
<?php
function convertToUnicodeNumber($input) {
    
    $standard_numsets = array("0","1","2","3","4","5","6","7","8","9");
    $devanagari_numsets = array("०","१","२","३","४","५","६","७","८","९");
    
    return str_replace($standard_numsets, $devanagari_numsets, $input);
  }
?>
<style>
.modal-backdrop.in{
	z-index: -1;
}
</style>
				<section role="main" class="content-body">
					<header class="page-header">
		              <div class="row">
		                <div class="col-lg-5">
		                  <h2>User Form</h2>  
		                </div>
		              
		                <div class="col-lg-5">
		                  <ol class="breadcrumbs">
								<li>
									<a href="<?php echo e(url('index')); ?>">
										<i class="fa fa-home"></i>
									</a>
								</li>
								<li><span>Form</span></li>
								<li><span class="active"> User</span></li>
							</ol>
		                </div>
		              </div>
		            </header>
					<!-- <header class="page-header">
						<h2>User Form</h2>
					</header>
					<div class="row">
						<div class="col-xs-12">
							<div class="right-wrapper">
								<ol class="breadcrumbs">
									<li>
										<a href="<?php echo e(url('index')); ?>">
											<i class="fa fa-home"></i>
										</a>
									</li>
									<li><span>Form</span></li>
									<li><span class="active"> User</span></li>
								</ol>
							</div>
						</div>
					</div> -->

					<!-- start: page -->
					<div class="row" id="useraddform">
						<div class="col-md-12">
							<form id="form" action="<?php echo e(route('gramuser.store')); ?>" class="form-horizontal" method="post">
							<?php echo csrf_field(); ?>
								<section class="panel">
									<!-- <header class="panel-heading">
										<h4 class="my-0">User Form</h4>
										<div class="panel-actions">
										</div>
									</header> -->
									
									<div class="panel-body pt-0">
										<div class="row">
										<div class="col-md-10">
										<div class="form-group">
											<label class="col-sm-3 control-label"> User Name <span class="required">*</span></label>
											<div class="col-sm-9">
												<input type="text" name="user_name" class="form-control" required pattern="[A-Za-z ]{0,100}" title="Enter Valid Name">
												<?php $__errorArgs = ['user_name'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
												<font size="3" color="red"><?php echo e($message); ?></font>
												<?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>	
											</div>
										</div>
										<div class="form-group">
											<label class="col-sm-3 control-label">Contact Number<span class="required">*</span></label>
											<div class="col-sm-9">
												<input type="text" name="mobile_number" class="form-control" required pattern="[0-9]{10}" title="Enter 10 Digits Number">
												<?php $__errorArgs = ['mobile_number'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
												<font size="3" color="red"><?php echo e($message); ?></font>
												<?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>	
											</div>
										</div>

                      <?php if(session()->get('role')==0 ): ?>
										<div class="form-group">
											<label class="col-sm-3 control-label">Role name<span class="required">*</span></label>
											<div class="col-sm-9">

											 
											<select name="role" class="h40 w-100" required>
                                             <option value="">Select Role </option>
                                           <?php $__currentLoopData = $roleslist; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $role): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                           <option value="<?php echo e($role->id); ?>" ><?php echo e($role->name); ?></option>
                                             <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                             </select>
										</div>
										</div>
										<?php else: ?>

										<div class="form-group">
											<label class="col-sm-3 control-label">Role name<span class="required">*</span></label>
											<div class="col-sm-9">

											 
											<select name="role" class="h40 w-100" required>
                                             <option value="">Select Role </option>
                                           <?php $__currentLoopData = $roles; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $role): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                           <option value="<?php echo e($role->id); ?>" ><?php echo e($role->name); ?></option>
                                             <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                             </select>
										</div>
										</div>
										<?php endif; ?>






										<div class="form-group">
											<label class="col-sm-3 control-label">Password <span class="required">*</span></label>
											<div class="col-sm-9">
												<input type="password" name="password" id="myInput" class="form-control" required>
												<?php $__errorArgs = ['password'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
												<font size="3" color="red"><?php echo e($message); ?></font>
												<?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
												<div class="mt-2">
													<input type="checkbox" onclick="myFunction()"> Show Password
												</div>	
											</div>
										</div>
										<div class="col-12">
											<div class="text-right">
												<button class="btn btn-success" type="submit">Submit</button>
											</div>
										</div>
										</div>
									</div>
									</div>

									
										
									
									

								</section>
							</form>
						</div>
						
					</div>
					
					<!-- allot user code here -->
					<div class="row" id="userallotform" style="display:none;">
						<div class="col-md-12">
						    <center>Username:-<h4 id="usernameid"></h4></center>
							<form action="<?php echo e(route('allotuser.store')); ?>" method="post" class="form-horizontal">
							   <?php echo csrf_field(); ?>
							<div class="panel-body">
							    <div class="row">
							        <input type="hidden" class="userid" name="userid">
                                    <div class="col-sm-3 px-2">
                                        <h4>District</h4>
                                        <select class="h40 w-100" id="jilla_id">
                                            <option value="">District Name</option>
                                            <?php $__currentLoopData = $jilla; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $j): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                            <option value="<?php echo e($j->id); ?>"><?php echo e($j->area_name); ?></option>
                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                          </select>
                                          
                                    </div>
                                    <div class="col-sm-3 px-2">
                                        <h4>Mandal</h4>
                                        <select class="h40 w-100" id="taluka">
                                         <option value="">Mandal Name</option>   
                                        </select>
                                    </div>
                                    <div class="col-sm-3 px-2">
                                        <h4>Panchayat</h4>
                                        <select class="h40 w-100" id="gram_id">
                                         	<option value="">Panchayat Name</option>
                                         	</select>
                                          
                                    </div>
                                    <div class="col-sm-3 px-2">
                                        <h4>Add</h4>
                                        <button type="button" id="addallot"><i class="fa fa-plus" aria-hidden="true"></i></button>
  
                                    </div>
                                    
                                </div>
                                <table border=1 id="rowallot">
                                    <tr><th>District Name</th><th>Mandal Name</th><th>Panchayat Name</th><th>Delete</th></tr>
                                    
                                </table>
                                <input type="hidden" id="rowcount" name="rowcount">
                                <div class="row">
                                <input type="submit" style="padding:10px;margin-top:20px;width:40%;margin-left:300px;" class="btn btn-success" value="Submit">
                                </div>
                                <br>
                                
							</div>
							</form>
						</div>
						
					</div>
					<!-- allot code end here-->
					<!-- end: page -->
					<!-- start: page -->
					<section class="panel">
							<header class="panel-heading">
								<h4 class="my-0">User Details</h4>
								<div class="panel-actions">
									<!-- <a href="#" class="fa fa-caret-down"></a>
									<a href="#" class="fa fa-times"></a> -->
								</div>
							</header>
							<?php if(session()->get('role')==0 ): ?>
							<div class="panel-body pt-3 px-0">
								<table class="table table-bordered table-striped mb-none mt-0" id="datatable-default">
									<thead>
										<tr class="table-success">
											<th>S.NO</th>
											<th>User Name</th>
											<th>Contact Number</th>
											 <th>Role</th> 
											<th>Status</th>
											<th>Edit</th>
											<th>Delete</th>
											<th>View Allot</th>
											<th>Allot</th>
										</tr>
									</thead>
									<tbody>
										<?php $count=0;?>
									<?php $__currentLoopData = $regi; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $a): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
									<?php $count++;?>
									<tr class="gradeX">
										     <td><?php echo e($count); ?></td>
											<!-- <td><?php echo e($a->id); ?></td> -->
											<td><?php echo e($a->name); ?></td>
											<td><?php echo e($a->mobile); ?></td>
											<td>
											<?php if($a['role']=='1'): ?>
                                             <?php echo e("TSREDCO Consultants"); ?>

                                             <?php elseif($a['role']=='6'): ?>
                                             <?php echo e("VENDOR"); ?>


                                             <?php elseif($a['role']=='7'): ?>

                                             <?php echo e("SUBVENDOR AGENCY"); ?>

                                              <?php elseif($a['role']=='8'): ?>
                                             <?php echo e("SUBVENDOR SURVEY"); ?>

                                            <?php else: ?>

                                           <?php echo e('SURVEY'); ?>

                                                     <?php endif; ?>
                                              </td>
											
											<td>
											<span id="view<?php echo e($a->id); ?>"></span>
											<span id="statu<?php echo e($a->id); ?>">
											<?php
												$s=$a->status;
												if($s == 'active'){
											?>
												<a onclick="change_active('<?php echo e($a->status); ?>','<?php echo e($a->id); ?>')"  class="btn btn-success" id="statuschk<?php echo e($a->id); ?>" value="<?php echo e($a->id); ?>" style="width: 75px;"><?php echo e($a->status); ?></a>
											<?php }else{ ?>
												<a onclick="change_active('<?php echo e($a->status); ?>','<?php echo e($a->id); ?>')"  class="btn btn-warning" id="statuschk" value="<?php echo e($a->id); ?>"><?php echo e($a->status); ?></a>
											<?php } ?>
											</span>
											</td>
											<td>
												<a href="<?php echo e(route('gramuser.edit',$a->id)); ?>" class="on-default edit-row"><button class="btn btn-primary">Edit</button></a></td>
												<td><form action="<?php echo e(route('gramuser.destroy',$a->id)); ?>" method="post">
												<?php echo csrf_field(); ?>
												<?php echo method_field('DELETE'); ?>
												<input type="submit" onclick="return confirm('Are you sure you want to delete this <?php echo e($a->name); ?> ');" class="btn btn-danger" value="Delete">
												</form>
											</td>
											<td>
												<button class="btn btn-primary views<?php echo e($a->id); ?>" onclick="viewmodal('<?php echo e($a->id); ?>')" id="view<?php echo e($a->id); ?>" >View</button>
												<button class="buttonload btn btn-primary" style="display: none;"><i class="fa fa-circle-o-notch fa-spin "></i>Loading</button>
											</td>
											<td>
												
                                               <?php if($a['role']=='6'  or $a['role'] == '1' or $a['role'] == '0'): ?>
												<a href="<?php echo e(url('cluster_form',$a->id)); ?>" class="on-default "><button class="btn btn-primary">vendor allot</button></a>

												<?php elseif($a['role']=='3'): ?>
												<form action="<?php echo e(url('gramuserallotform')); ?>" method="post">
													<?php echo csrf_field(); ?>
													<input type="hidden" value="<?php echo e($a->id); ?>" name="userid">
													<input type="submit" class="allotusergram" class="btn btn-secondary" value="Allot">
												</form>
												<?php elseif($a['role']=='8'): ?>
												<form action="<?php echo e(url('gramuserallotform')); ?>" method="post" target="_blank">
													<?php echo csrf_field(); ?>
													<input type="hidden" value="<?php echo e($a->id); ?>" name="userid">
													<input type="submit" class="" class="btn btn-secondary" value="Allot subvendor Survey">
												</form>
												<?php elseif($a['role']=='7'): ?>
												<form action="<?php echo e(url('subvendorallotform')); ?>" method="post">
													<?php echo csrf_field(); ?>
													<input type="hidden" value="<?php echo e($a->id); ?>" name="userid">
													<input type="submit" class="" class="btn btn-secondary" value="Allot subvendor">
												</form>

												<?php endif; ?>
											</td>
											
									</tr>
									<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
									</tbody>
								</table>
							</div>
                           <?php else: ?>
							<div class="panel-body pt-5">
								<table class="table table-bordered table-striped mb-none mt-0" id="datatable-default">
									<thead>
										<tr>
											<th>S.NO</th>
											<th>User Name</th>
											<th>Contact Number</th>
											 <th>Role</th> 
											<th>Status</th>
											<th>Edit</th>
											<th>Delete</th>
											<th>View Allot</th>
											<th>Allot</th>
										</tr>
									</thead>
									<tbody>
										<?php $count=0;?>
									<?php $__currentLoopData = $regis; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $a): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
									<?php $count++;?>
									<tr class="gradeX">
										     <td><?php echo e($count); ?></td>
											<!-- <td><?php echo e($a->id); ?></td> -->
											<td><?php echo e($a->name); ?></td>
											<td><?php echo e($a->mobile); ?></td>
											<td>
											<?php if($a['role']=='1'): ?>
                                             <?php echo e("TSREDCO Consultants"); ?>

                                             <?php elseif($a['role']=='6'): ?>
                                             <?php echo e("VENDOR"); ?>

                                             <?php elseif($a['role']=='7'): ?>
                                             <?php echo e("SUBVENDOR AGENCY"); ?>

                                              <?php elseif($a['role']=='8'): ?>
                                             <?php echo e("SUBVENDOR SURVEY"); ?>

                                            <?php else: ?>
                                           <?php echo e('SURVEY'); ?>

                                                     <?php endif; ?>
                                              </td>
											
											<td>
											<span id="view<?php echo e($a->id); ?>"></span>
											<span id="statu<?php echo e($a->id); ?>">
											<?php
												$s=$a->status;
												if($s == 'active'){
											?>
												<a onclick="change_active('<?php echo e($a->status); ?>','<?php echo e($a->id); ?>')"  class="btn btn-success" id="statuschk<?php echo e($a->id); ?>" value="<?php echo e($a->id); ?>"><?php echo e($a->status); ?></a>
											<?php }else{ ?>
												<a onclick="change_active('<?php echo e($a->status); ?>','<?php echo e($a->id); ?>')"  class="btn btn-warning" id="statuschk" value="<?php echo e($a->id); ?>"><?php echo e($a->status); ?></a>
											<?php } ?>
											</span>
											</td>
											<td>
												<a href="<?php echo e(route('gramuser.edit',$a->id)); ?>" class="on-default edit-row"><button class="btn btn-primary">Edit</button></a></td>
												<td><form action="<?php echo e(route('gramuser.destroy',$a->id)); ?>" method="post">
												<?php echo csrf_field(); ?>
												<?php echo method_field('DELETE'); ?>
												<input type="submit" onclick="return confirm('Are you sure you want to delete this <?php echo e($a->name); ?> ');" class="btn btn-danger" value="Delete">
												</form>
											</td>
											<td>
												<button class="btn btn-primary views<?php echo e($a->id); ?>" onclick="viewmodal('<?php echo e($a->id); ?>')" id="view<?php echo e($a->id); ?>" >View</button>
												<button class="buttonload btn btn-primary" style="display: none;"><i class="fa fa-circle-o-notch fa-spin "></i>Loading</button>
											</td>
											<td>
												
                                               <?php if($a['role']=='6'  or $a['role'] == '1' or $a['role'] == '0'): ?>
												<a href="<?php echo e(url('cluster_form',$a->id)); ?>" class="on-default "><button class="btn btn-primary">vendor allot</button></a>

												<?php elseif($a['role']=='3'): ?>
												<form action="<?php echo e(url('gramuserallotform')); ?>" method="post">
													<?php echo csrf_field(); ?>
													<input type="hidden" value="<?php echo e($a->id); ?>" name="userid">
													<input type="submit" class="allotusergram" class="btn btn-secondary" value="Allot">
												</form>
												<?php elseif($a['role']=='7'): ?>
												<form action="<?php echo e(url('subvendorallotform')); ?>" method="post" target="_blank">
													<?php echo csrf_field(); ?>
													<input type="hidden" value="<?php echo e($a->id); ?>" name="userid">
													<input type="submit" class="" class="btn btn-secondary" value="Allot subvendor">
												</form>
												<?php elseif($a['role']=='8'): ?>
												<form action="<?php echo e(url('gramuserallotform')); ?>" method="post" target="_blank">
													<?php echo csrf_field(); ?>
													<input type="hidden" value="<?php echo e($a->id); ?>" name="userid">
													<input type="submit" class="" class="btn btn-secondary" value="Allot subvendor Survey">
												</form>

												<?php endif; ?>
											</td>
											
									</tr>
									<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
									</tbody>
								</table>
							</div>
							<?php endif; ?>
						</section>
				</section>
				
				<div class="modal viewModl" id="exampleModalLong" tabindex="-1" role="dialog" aria-hidden="true" >
					<div class="modal-dialog modal-lg" role="document">
						<div class="modal-content">
							<!-- <div class="modal-header">
								<h5 class="modal-title" id="exampleModalLongTitle">USERS LIST</h5>
								<button type="button" class="close" onclick="closes()">
									<span aria-hidden="true">&times;</span>
								</button>
							</div> -->
							 <div class="modal-header">
						        <h5 class="modal-title" id="exampleModalLongTitle">USERS LIST</h5>
						        <button type="button" class="close" onclick="closes()">
						          <span aria-hidden="true">&times;</span>
						        </button>
						      </div>
							<div class="modal-body viewbody">
							</div>
						</div>
					</div>
				</div>

 
<script>
function change_active(ele,id){
	var status;var st;
	if(ele== "inactive"){
		status = 1;
		st = "'active'";
	}else{
		status = 0;
		st = "'inactive'";
	}
	$.ajax({
	        type: "POST",
			headers: {'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')},
	        url: '../gramuserchngestat',
	        dataType : 'json',
	        data: {id:id,status:status},
	        success: function(response) {
	            if(response == 1){
					$('#statu'+id).css('display','none');
					if(st=="'active'"){
						var view = '<a onclick="change_active('+st.trim()+','+id+')" class="btn btn-success" id="statuschk'+id+'" value='+id+'>active</a>';
					}else{
						var view = '<a onclick="change_active('+st.trim()+','+id+')" class="btn btn-warning" id="statuschk'+id+'" value='+id+'>inactive</a>';
					}
					$('#view'+id).html(view);
	            }
	        }
	});
}
</script>
<script>
function myFunction() {
  var x = document.getElementById("myInput");
  if (x.type === "password") {
    x.type = "text";
  } else {
    x.type = "password";
  }
}
$(window).on('popstate', function() {
    $(".modal-backdrop").remove();
});
function viewmodal(evt){
	var id = evt
	$('.viewbody').empty();
	$('.views'.id).css("display","none");
	$.ajax({
		type: "POST",
		headers: {'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')},
		url: '../gramuserlist',
		dataType : 'json',
		data: {id:id},
		success: function(response){
			$('.viewbody').append(response);
			$('.viewModl').show();
			$('.views'.id).css('display', 'block');
		}
	});
}
function closes(){
	$('.viewModl').hide();
	$('.viewbody').append();
}
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('backend.header', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/neefc25/public_html/tgredco.fovea.in/resources/views/backend/gramuser.blade.php ENDPATH**/ ?>