@extends('backend.header')
@section('index-content')
				<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="{{url('index')}}">
											<i class="fa fa-home"></i>
										</a>
									</li>
									<li><a href="{{url('gramuser/create')}}"><span>Gram Users</span></a></li>
									<li><span class="active"> {{$regi->name}}</span></li>
								</ol>
                </div>
                <div class="col-lg-2">
                	<div class="back-btn-div">
											<button class="btn btn-primary back-btn" onclick="window.history.back()" style="margin-right:25px;">Back</button>
										</div>
                </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="{{url('index')}}">
											<i class="fa fa-home"></i>
										</a>
									</li>
									<li><a href="{{url('gramuser/create')}}"><span>Gram Users</span></a></li>
									<li><span class="active"> {{$regi->name}}</span></li>
								</ol>
							</div>
						</div>
					</div>
 -->

					<!-- start: page -->
					<div class="row">
						<div class="col-md-12">
							<form id="form" action="{{route('gramuser.update',$regi->id)}}" class="form-horizontal" method="post">
							@csrf
							@method('PATCH')
								<section class="panel">
									<!-- <header class="panel-heading">
										<h4 class="my-0">User Form Edit</h4>
										<div class="back-btn-div">
											<button class="btn btn-primary back-btn" onclick="window.history.back()">Back</button>
										</div>

										
									</header> -->
									<div class="panel-body">
										<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" value="{{$regi->name}}" required>
												@error('user_name')
												<font size="3" color="red">{{$message}}</font>
												@enderror	
											</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" value="{{$regi->mobile}}" required>
												@error('mobile_number')
												<font size="3" color="red">{{$message}}</font>
												@enderror	
											</div>
										</div>

											<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="form-control" >


															 @foreach($roleslist as $role)
														<option value="{{$role->id}}"@if($regi->role==$role->id) Selected @endif>{{$role->name}}</option>
														 @endforeach
														</select>
															
													</div>
												</div> 

												


										<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" value="{{$regi->password}}" required>
												@error('password')
												<font size="3" color="red">{{$message}}</font>
												@enderror	
												<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-primary" type="submit">Update</button>
											</div>
										</div>
										</div>
									</div>
									</div>
									<!-- <footer class="panel-footer">
										<div class="row">
											<div class="col-sm-9 col-sm-offset-3">
												<button class="btn btn-primary" type="submit">Update</button>
											</div>
										</div>
									</footer> -->
								</section>
							</form>
						</div>
						
					</div>
					<!-- end: page -->
				</section>
				<script>
function myFunction() {
  var x = document.getElementById("myInput");
  if (x.type === "password") {
    x.type = "text";
  } else {
    x.type = "password";
  }
}
</script>
			@stop