<?php $__env->startSection("content"); ?>
<div class="container">
  <div class="top-content">
    <div class="right-content">
      <div class="title">
        <h2><?php echo e($title); ?></h2>
      </div>
      <div class="tasks">
        <button class="btn btn-primary" onclick="window.location='<?php echo e(URL::asset('/')); ?>users'">All Users</button>
      </div>
    </div>
  </div>
  <div class="main-content">
    <div class="sidebar">
      <nav>
       
      </nav>
    </div>
    <div class="main">
      <div class="row">
        <div class="col-sm-8">
          <form role="form" class="form-horizontal" action="<?php echo e(URL::asset('/')); ?>users/store" method="post">
            <input type="hidden" name="_token" value="<?php echo csrf_token(); ?>">
            <input type="hidden" value="<?php echo e(Auth::user()->company_id); ?>" name="company_id" />
            <input type="hidden" value="<?php echo e(Auth::user()->country); ?>" name="country" />
            <input type="hidden" value="<?php echo e(Auth::user()->state); ?>" name="state" />
            
            <div class="form-group">
              <label for="name" class="col-sm-2 control-label">Name</label>
              <div class="col-sm-10">
                <input type="text" value="<?php echo e(old('name')); ?>" class="form-control" name="name">
              </div>
            </div>
            <div class="form-group">
              <label for="email" class="col-sm-2 control-label">Email</label>
              <div class="col-sm-10">
                <input type="text" value="<?php echo e(old('email')); ?>" class="form-control" name="email">
              </div>
            </div>
            <div class="form-group">
              <label for="password" class="col-sm-2 control-label">Password</label>
              <div class="col-sm-10">
                <input type="password" value="" class="form-control" name="password">
              </div>
            </div>
            <div class="form-group">
              <label for="phone" class="col-sm-2 control-label">Phone</label>
              <div class="col-sm-10">
                <input type="text" value="<?php echo e(old('phone')); ?>" class="form-control" name="phone">
              </div>
            </div>
            <div class="form-group">
              <label for="city" class="col-sm-2 control-label">City</label>
              <div class="col-sm-10">
                <input type="text" value="<?php echo e(old('city')); ?>" class="form-control" name="city">
              </div>
            </div>
            <div class="form-group">
              <label for="address" class="col-sm-2 control-label">Address</label>
              <div class="col-sm-10">
                <input type="text" value="<?php echo e(old('address')); ?>" class="form-control" name="address">
              </div>
            </div>
            <div class="form-group">
              <label for="post_code" class="col-sm-2 control-label">Post Code</label>
              <div class="col-sm-10">
                <input type="text" value="<?php echo e(old('post_code')); ?>" class="form-control" name="post_code">
              </div>
            </div>
            <div class="form-group">
              <label for="role" class="col-sm-2 control-label">Role</label>
              <div class="col-sm-10">
                <select class="form-control required" required="" id="role" name="role" onChange="accessibilities($(this).val())">
                  <option value="">Choose Role</option>
                  <?php if(count($roles)): ?>
                  <?php foreach($roles as $row): ?>
                  <option value="<?php echo e($row->id); ?>"><?php echo e($row->role); ?></option>
                  <?php endforeach; ?>
                  <?php endif; ?>
                </select>
              </div>
            </div>
            <div class="form-group" id="accessibilities" style="display:none;">
              <label for="role" class="col-sm-2 control-label">Accessibilities</label>
              <div class="col-sm-10">
                <?php if(count($companies)): ?>
              	<?php foreach($companies as $row): ?>
              	<label><input type="checkbox" value="<?php echo e($row->id); ?>" name="access[<?php echo e($row->id); ?>]" onClick="departments($(this), <?php echo e($row->id); ?>)"> <?php echo e($row->name); ?></label> <br>
                	<?php if(count(\App\Categories::whereUser($row->id))): ?>
                	<ul style="list-style:none;" id="checkbox_<?php echo e($row->id); ?>">
                    	<?php foreach(\App\Categories::whereUser($row->id) as $department): ?>
                    	<li><label><input type="checkbox" value="<?php echo e($department->id); ?>" name="access[<?php echo e($row->id); ?>][]" class="departments"> <?php echo e($department->name); ?></label></li>
                        <?php endforeach; ?>
                    </ul>
                    <?php endif; ?>
                <?php endforeach; ?>
                <?php endif; ?>
              </div>
            </div>
          
            <div class="form-group">
              <label for="status" class="col-sm-2 control-label">Status</label>
              <div class="col-sm-10">
                <select class="form-control required" required="" id="status" name="status">
                  <option value="on" selected>Active</option>
                  <option value="off">Deactive</option>
                </select>
              </div>
            </div>
            <div class="form-group">
              <div class="col-sm-offset-2 col-sm-10">
                <button type="submit" class="btn btn-info pull-right">Submit</button>
              </div>
            </div>
          </form>
        </div>
      </div>
    </div>
  </div>
</div>
<?php $__env->stopSection(); ?>
<?php $__env->startSection("footer"); ?>
<script>
	function departments(e, id){
		if(e.is(":checked")){
			
		}else{
			
			$("#departments_"+id).hide();
		}
	}
	function accessibilities(role){
		if(role==1){
			$("#accessibilities").hide();
		}
		if(role==2){
			$(".departments").attr("type", "checkbox");
			$("#accessibilities").show();
		}
		if(role==3){
			$(".departments").attr("type", "radio");
			$("#accessibilities").show();
		}
	}
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make("app", array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>