 
<?php $__env->startSection('title', 'Add User'); ?>
<?php $__env->startSection('content'); ?>
    <!-- push external head elements to head -->
    <?php $__env->startPush('head'); ?>
        <link rel="stylesheet" href="<?php echo e(asset('plugins/select2/dist/css/select2.min.css')); ?>">
        <link href='https://fonts.googleapis.com/css?family=Josefin Sans' rel='stylesheet'>
    <?php $__env->stopPush(); ?>

<?php 
    $getstatecodedata = DB::table('state_master')->get();
    $getdistrictcodedata = DB::table('district_master')->get();
?>
    <div class="container-fluid">
    	<div class="page-header">
            <div class="row align-items-end">
                <div class="col-lg-8">
                    <div class="page-header-title">
                        <i class="ik ik-user-plus bg-blue"></i>
                        <div class="d-inline">
                            <h5><?php echo e(__('Add User')); ?></h5>
                            <span><?php echo e(__('Create new user, assign roles & permissions')); ?></span>
                        </div>
                    </div>
                </div>
                <div class="col-lg-4">
                    <nav class="breadcrumb-container" aria-label="breadcrumb">
                        <ol class="breadcrumb">
                            <li class="breadcrumb-item">
                                <a href="<?php echo e(url('dashboard')); ?>"><i class="ik ik-home"></i></a>
                            </li>
                            <li class="breadcrumb-item">
                                <a href="#"><?php echo e(__('Add User')); ?></a>
                            </li>
                        </ol>
                    </nav>
                </div>
            </div>
        </div>
        <div class="row">
            <!-- start message area-->
            <?php echo $__env->make('include.message', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
            <!-- end message area-->
            <div class="col-md-12">
                <div class="card ">
                    <div class="card-header">
                        <h3><?php echo e(__('Add user')); ?></h3>
                    </div>
                    <div class="card-body">
                        <form class="forms-sample" method="POST" action="<?php echo e(route('create-user')); ?>" >
                        <?php echo csrf_field(); ?>
                            <div class="row">
                                <div class="col-sm-6">

                                    <div class="form-group">
                                        <label for="name"><?php echo e(__('Username')); ?><span class="text-red">*</span></label>
                                        <input id="name" type="text" class="form-control <?php $__errorArgs = ['name'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>" name="name" value="" placeholder="Enter user name" required>
                                        <div class="help-block with-errors"></div>

                                        <?php $__errorArgs = ['name'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                            <span class="invalid-feedback" role="alert">
                                                <strong><?php echo e($message); ?></strong>
                                            </span>
                                        <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                                    </div>
                                    <div class="form-group">
                                        <label for="email"><?php echo e(__('Email')); ?><span class="text-red">*</span></label>
                                        <input id="email" type="email" class="form-control <?php $__errorArgs = ['email'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>" name="email" value="<?php echo e(old('email')); ?>" placeholder="Enter email address" required>
                                        <div class="help-block with-errors" ></div>

                                        <?php $__errorArgs = ['email'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                            <span class="invalid-feedback" role="alert">
                                                <strong><?php echo e($message); ?></strong>
                                            </span>
                                        <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                                    </div>
                                   
                                    <div class="form-group">
                                        <label for="password"><?php echo e(__('Password')); ?><span class="text-red">*</span></label>
                                        <input id="password" type="password" class="form-control <?php $__errorArgs = ['password'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>" name="password" placeholder="Enter password" required>
                                        <div class="help-block with-errors"></div>

                                        <?php $__errorArgs = ['password'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                            <span class="invalid-feedback" role="alert">
                                                <strong><?php echo e($message); ?></strong>
                                            </span>
                                        <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                                    </div>
                                    <div class="form-group">
                                        <label for="password-confirm"><?php echo e(__('Confirm Password')); ?><span class="text-red">*</span></label>
                                        <input id="password-confirm" type="password" class="form-control" name="password_confirmation" placeholder="Retype password" required>
                                        <div class="help-block with-errors"></div>
                                    </div>
                                    <div class="form-group">
                                        <label for="emp_code"><?php echo e(__('Employee Code')); ?></label>
                                        <input type="text" class="form-control" id="emp_code" name='emp_code' <?php if(!empty($showdata)){ ?> value='<?php echo e($showdata[0]->emp_code); ?>' <?php } ?> placeholder="Enter Employee Code" required>
                                    </div>
                                </div>
                                <div class="col-md-6">
                                    <!-- Assign role & view role permisions -->
                                    <div class="form-group">
                                        <label for="dist_code"><?php echo e(__('District Code')); ?></label>
                                        <select name='dist_code'  class='form-control' value='Select Option'>
                                            <option>Select District Code</option>
                                            <?php foreach($getdistrictcodedata as $getdistrictcode){ ?>
                                             <option value='<?php echo $getdistrictcode->district_code; ?>' <?php if(!empty($showdata)): ?><?php echo e($showdata[0]->dist_code == $getdistrictcode->district_code ? 'selected' : ''); ?> <?php endif; ?> ><?php echo $getdistrictcode->district_code; ?></option>
                                             <?php } ?>
                                        </select>
                                    </div>
                                    <div class="form-group">
                                        <label for="state_code"><?php echo e(__('State Code')); ?></label>
                                        <select name='state_code'  class='form-control' value='Select Option'>
                                            <option>Select State Code</option>
                                            <?php foreach($getstatecodedata as $getstatecode){ ?>
                                             <option value='<?php echo $getstatecode->state_code; ?>' <?php if(!empty($showdata)): ?> <?php echo e($showdata[0]->state_code == $getstatecode->state_code ? 'selected' : ''); ?> <?php endif; ?> ><?php echo $getstatecode->state_code; ?></option>
                                             <?php } ?>
                                        </select>
                                    </div>
                                    <div class="form-group">
                                        <label for="role"><?php echo e(__('Assign Role')); ?><span class="text-red">*</span></label>
                                        <?php echo Form::select('role', $roles, null,[ 'class'=>'form-control select2', 'placeholder' => 'Select Role','id'=> 'role', 'required'=> 'required']); ?>

                                    </div>
                                    <div class="form-group" >
                                        <label for="role"><?php echo e(__('Permissions')); ?></label>
                                        <div id="permission" class="form-group" style="border-left: 2px solid #d1d1d1;">
                                            <span class="text-red pl-3">Select role first</span>
                                        </div>
                                        <input type="hidden" id="token" name="token" value="<?php echo e(csrf_token()); ?>">
                                    </div>
                                </div>
                                <div class="col-md-12">
                                    <div class="form-group">
                                        <button type="submit" class="btn btn-primary"><?php echo e(__('Submit')); ?></button>
                                    </div>
                                </div>
                            </div>
                        
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- push external js -->
    <?php $__env->startPush('script'); ?> 
        <script src="<?php echo e(asset('plugins/select2/dist/js/select2.min.js')); ?>"></script>
         <!--get role wise permissiom ajax script-->
        <script src="<?php echo e(asset('js/get-role.js')); ?>"></script>
    <?php $__env->stopPush(); ?>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.main', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/viruxyz/public_html/ejaf/resources/views/create-user.blade.php ENDPATH**/ ?>