<?php $__env->startSection('content'); ?>
<!-- register_user content -->
<div class="right_col" role="main">
  <div class="row x_panel">
    <div class="col-md-12 col-sm-12 col-xs-12">
    <h1>Register User</h1>
<?php if(isset($data)){ ?>
<form action="<?php echo url('/'); ?>/admin/register_user/edit" id="" class="form-horizontal " method="post" enctype="multipart/form-data">
<?php echo e(csrf_field()); ?>

<input type="hidden" name="id" value="<?php echo $data->id; ?>">


<!-- First_name Start -->
<div class="form-group">
  <label for="first_name" class="col-sm-3 control-label"> First Name </label>
  <div class="col-sm-4">
    <input type="text" class="form-control" id="first_name" name="first_name" 
    
    value="<?php echo e($data->first_name); ?>"
    >
  </div>
  <div class="col-sm-5">
         <div class="label label-danger"><?php echo e($errors->first("first_name")); ?></div>
      </div>
</div> 
<!-- First_name End -->



<!-- Last_name Start -->
<div class="form-group">
  <label for="last_name" class="col-sm-3 control-label"> Last Name </label>
  <div class="col-sm-4">
    <input type="text" class="form-control" id="last_name" name="last_name" 
    
    value="<?php echo e($data->last_name); ?>"
    >
  </div>
  <div class="col-sm-5">
         <div class="label label-danger"><?php echo e($errors->first("last_name")); ?></div>
      </div>
</div> 
<!-- Last_name End -->



<!-- Email Start -->
<div class="form-group">
  <label for="email" class="col-sm-3 control-label"> Email </label>
  <div class="col-sm-4">
    <input type="text" class="form-control" id="email" name="email" 
    
    value="<?php echo e($data->email); ?>"
    >
  </div>
  <div class="col-sm-5">
         <div class="label label-danger"><?php echo e($errors->first("email")); ?></div>
      </div>
</div> 
<!-- Email End -->



<!-- Mobile Start -->
<div class="form-group">
  <label for="mobile" class="col-sm-3 control-label"> Mobile </label>
  <div class="col-sm-4">
    <input type="text" class="form-control" id="mobile" name="mobile" 
    
    value="<?php echo e($data->mobile); ?>"
    >
  </div>
  <div class="col-sm-5">
         <div class="label label-danger"><?php echo e($errors->first("mobile")); ?></div>
      </div>
</div> 
<!-- Mobile End -->


<!-- Address Start -->

<div class="form-group">
  <label for="address" class="col-sm-3 control-label"> Address </label>
  <div class="col-sm-4">
    <textarea class="form-control" id="address" name="address"><?php echo e($data->address); ?></textarea>
  </div>
  <div class="col-sm-5">
         <div class="label label-danger"><?php echo e($errors->first("address")); ?></div>
      </div>
</div> 

<!-- Address End -->


	<!-- State Start -->
    <div class="form-group">
        <label for="user_id" class="control-label col-md-3"> State </label>
          <div class="col-md-4">
          <select id="state" name="state" class="form-control select2" onchange="getCity(this.value)">
            <option value="">Select</option>
            <?php
              foreach ($state as $value) {
                $selected = $data->state==$value->state_code?'selected="selected"':'';
                echo '<option '.$selected.' value="'.$value->state_code.'"> '.$value->state.'</option>';
              }
            ?>
          </select>
        </div>
        <div class="col-sm-5">
         <div class="label label-danger"><?php echo e($errors->first("state")); ?></div>
      </div>
    </div>
      <!-- State End -->



	<!-- City Start -->
    <div class="form-group">
        <label for="user_id" class="control-label col-md-3"> City </label>
          <div class="col-md-4">
          <select id="city" name="city" class="form-control select2">
            <option value="">Select</option>
          </select>
          <input type="hidden" name="city_id" value="<?php echo e($data->city); ?>">
        </div>
        <div class="col-sm-5">
         <div class="label label-danger"><?php echo e($errors->first("city")); ?></div>
      </div>
    </div>
      <!-- City End -->



<!-- Pincode Start -->
<div class="form-group">
  <label for="pincode" class="col-sm-3 control-label"> Pincode </label>
  <div class="col-sm-4">
    <input type="text" class="form-control" id="pincode" name="pincode" 
    
    value="<?php echo e($data->pincode); ?>"
    >
  </div>
  <div class="col-sm-5">
         <div class="label label-danger"><?php echo e($errors->first("pincode")); ?></div>
      </div>
</div> 
<!-- Pincode End -->



    <!-- Photo_id Start -->
    <div class="form-group">
      <label for="photo_id" class="control-label col-md-3"> Photo Id </label>
        <div class="col-md-4">
          <input type="file" id="photo_id" name="photo_id" /><br>
          <?php if($data->photo_id!=''){
            echo '<img src="'.url('/')."/uploads/{$data->photo_id}".'" style="width:100px;">'; 
            } ?>
            <input type="hidden" name="old_photo_id" value="<?php echo $data->photo_id; ?>">
      </div>
      <div class="col-sm-5">
          <div class="label label-danger"><?php echo e($errors->first("photo_id")); ?></div>
      </div>
    </div>
    <!-- Photo_id End -->

    

    <!-- Address_proof Start -->
    <div class="form-group">
      <label for="address_proof" class="control-label col-md-3"> Address Proof </label>
        <div class="col-md-4">
          <input type="file" id="address_proof" name="address_proof" /><br>
          <?php if($data->address_proof!=''){
            echo '<img src="'.url('/')."/uploads/{$data->address_proof}".'" style="width:100px;">'; 
            } ?>
            <input type="hidden" name="old_address_proof" value="<?php echo $data->address_proof; ?>">
      </div>
      <div class="col-sm-5">
          <div class="label label-danger"><?php echo e($errors->first("address_proof")); ?></div>
      </div>
    </div>
    <!-- Address_proof End -->

    

	<!-- Status Start -->
	 <div class="form-group">
        <label class="control-label col-md-3">Status
             
        </label>                    
         <div class=" col-md-4 switch">
                    <div class="onoffswitch">
     <input type="checkbox" class="onoffswitch-checkbox"  data-on-label="Yes" data-off-label="No"  name="status" value="1" id="status" <?php if($data->status == 1){echo "checked=checked";}?> style="width:20px; height:20px;"/>
                    </div>
                </div>
      </div>
      <!-- Status End -->


  <div class="form-group">
  <div class="col-sm-3">
  </div>
   <div class="col-sm-6">
    <button type="reset" class="btn btn-default ">Reset</button>
    <button type="submit" class="btn btn-info ">Update</button>
   </div>
  </div>
</form>
<?php } else{
    echo '<h2 align="center" class="text-danger">No record found!</h2>';
  } ?>
    </div>
  </div>
</div>
<!-- /register_user content -->
<script type="text/javascript">
  $(document).ready(function(){
    var state = $('#state').val();
    if(state)
    {
      getCity(state);
    }
  });

  function getCity(state_id)
  {
    var id = $('input[name="city_id"]').val();
    $.ajax({
      type:'get',
      url:'<?php echo e(url("/")); ?>/getCity/'+state_id,
      success:function(res)
      {
        var city = '';
        if(res.length>0)
        {
          city+='<option value="">Select</option>';
          for(var i=0;i<res.length;i++)
          {
            var selected = (id==res[i].id) ? 'selected' : '';
            city+='<option '+selected+' value="'+res[i].city_id+'">'+res[i].city+'</option>';
          }
          $('#city').html(city);
        }
      }
    });
  }
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('master', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>