<?php $__env->startSection('content_header'); ?>
    <h1>User</h1>
<?php $__env->stopSection(); ?>


<script src="//code.jquery.com/jquery.js"></script>

<?php $__env->startSection('content'); ?>
@notifyCss
 @notifyJs
 
        <?php if($errors->any()): ?>
            <div class="alert alert-danger">
                <ul>
                    <?php $__currentLoopData = $errors->all(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $error): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <li><?php echo e($error); ?></li>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </ul>
            </div>
        <?php endif; ?>

              <?php if(session('status')): ?>
            <div class="alert alert-success">
                <?php echo e(session('status')); ?>

            </div>
            <?php endif; ?>

 <?php echo $__env->make('notify::messages', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
            <div class="row">
            <!--row starts-->

            <div class="col-md-12">
               
                <div class="panel panel-primary">
                    <div class="panel-heading">
                        <h3 class="panel-title">
                           Create User
                        </h3>
                </div>

                <div class="panel-body">
                        <form class="form-horizontal" action="<?php echo e(url('userpost')); ?>" method="post" id="user" onsubmit="return validation();">

                            <!-- CSRF Token -->
                             <input type="hidden" name="_token" value="<?php echo e(csrf_token()); ?>">
                                <!-- Name input-->


                                <div class="form-group">
                                    <label class="col-md-3 control-label" for="name">Full Name<span style="color: red;">*</span></label>
                                    <div class="col-md-9" >
                                        <input id="name" name="name" type="text" maxlength="100" placeholder="Enter the full name" class="form-control">
                                    </div>
                                </div>
                              
                                <div class="form-group">
                                    <label class="col-md-3 control-label" for="name">Email<span style="color: red;">*</span></label>
                                    <div class="col-md-9">
                                        <input id="email" name="email" type="text" placeholder="Enter the email" class="form-control" maxlength="30"></div>
                                </div>


                                <div class="form-group">
                                    <label class="col-md-3 control-label" for="name">Password<span style="color: red;">*</span></label>
                                    <div class="col-md-9">
                                        <input id="password" name="password" type="password" maxlength="100" placeholder="Enter the password" class="form-control"></div>
                                </div>


                                <div class="form-group">
                                    <label class="col-md-3 control-label" for="name">Retype Password<span style="color: red;">*</span></label>
                                    <div class="col-md-9">
                                        <input id="password_confirmation" name="password_confirmation" type="password" maxlength="100" placeholder="Retype password" class="form-control"></div>
                                </div>

                                <div class="form-position">
                                    <div class="col-md-12 text-right">
                                        <button type="submit" class="btn btn-responsive btn-primary btn-sm" id="btn" >Submit</button>
                                    </div>
                                </div>
                        </form>
                    </div>
                </div>
            
            </div>
            <!--md-12 ends-->
        </div> 

        <table class="table table-bordered" id="users_table">
        <thead>
            <tr>
                <th>Id</th>
                <th>Name</th>
                <th>Email</th>
                <th>Seat</th>
                <th>Role</th>
                <th>Actions</th>
            </tr>
        </thead>
    </table>



<script>
$(function() {

    $('#users_table').DataTable({
        processing: true,
        serverSide: true,
        ajax: '<?php echo url('userpostdata'); ?>',
        columns: [
            { data: 'id', name: 'id' },
            { data: 'name', name: 'name' },
            { data: 'email', name: 'email' },
            { data: 'seat_name', name: 'seat_name' },
            { data: 'role_name', name: 'role_name' },
            { data: 'action', name: 'action' }
        ]
    });
});

</script>



<script>

function validation()
    {
        
        if(document.getElementById('email').value=="")
        {
            alert(" Please Enter the Email");
            document.getElementById('email').focus();
            return false;
        }

        if(document.getElementById('name').value=="")
        {
            alert(" Please Enter the Full Name");
            document.getElementById('name').focus();
            return false;
        }

        if(document.getElementById('password').value=="")
        {
            alert(" Please Enter the Password");
            document.getElementById('password').focus();
            return false;
        }

        if(document.getElementById('password_confirmation').value=="")
        {
            alert(" Please Retype the Password");
            document.getElementById('password_confirmation').focus();
            return false;
        }

        document.getElementById("btn").disabled='true';

         
                    
        return true;
    }
</script>

<?php $__env->stopSection(); ?>

<?php echo $__env->make('adminlte::page', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>