<script type="text/javascript">
    $(".modal-title").text("Add new User");
    $(".modal-dialog").css({'width':'60%'});
</script>
    <?php echo Form::open(['url'=>'user','id'=>'registerFormValidation','novalidate'=>'']); ?>

    <div class="content">
        <div class="row">
            <div class="col-md-6">
                <div class="row">
                    <div class="col-md-12">
                        <div class="col-md-5">
                            <div class="row">
                                <div class="form-group">
                                    <label class="control-label">First Name <star>*</star></label>
                                    <input class="form-control" name="first_name" type="text" required="true"  placeholder="Start typing here"/>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-5 pull-right">
                            <div class="row">
                                <div class="form-group">
                                    <label class="control-label">Last Name <star>*</star></label>
                                    <input class="form-control" name="last_name" type="text" required="true"  placeholder="Start typing here"/>
                                </div>
                            </div>
                        </div>

                    </div>
                </div>

                <div class="row">
                    <div class="col-md-12">
                        <div class="col-md-5">
                            <div class="row">
                                <div class="form-group">
                                    <label class="control-label">IN time <star>*</star></label>
                                    <input class="form-control timepicker" name="in_time" type="text" required="true"  placeholder="24 hours format: 09:00"/>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-5 pull-right">
                            <div class="row">
                                <div class="form-group">
                                    <label class="control-label">OUT time <star>*</star></label>
                                    <input class="form-control timepicker" name="out_time" type="text" required="true"  placeholder="24 hours format: 18:00"/>
                                </div>
                            </div>
                        </div>

                    </div>
                </div>
                <div class="row">
                    <div class="col-md-12">
                        <div class="col-md-5">
                            <div class="row">
                                <div class="form-group">
                                    <label class="control-label">IN time reduction</label>
                                    <input class="form-control" name="in_time_reduce" type="number"  placeholder="i.e: 5, Reduce IN time"/>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-5 pull-right">
                            <div class="row">
                                <div class="form-group">
                                    <label class="control-label">Break (in minutes)</label>
                                    <input class="form-control" name="break" type="number"  placeholder="i.e: 60"/>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-md-12">
                        <div class="col-md-5">
                            <div class="row">
                                <div class="form-group">
                                    <label class="control-label">Auto Exit(mid night)</label>
                                    <div class="form-control-static">
                                        <input type="radio"  value="0" name="auto_exit" id='autoExit0' checked>
                                        <label for='autoExit0' style='font-weight:200'>No</label>
                                        <input type="radio"  value="1" name="auto_exit" id='autoExit1'>
                                        <label for='autoExit1' style='font-weight:200'>Yes</label>
                                    </div>

                                </div>
                            </div>
                        </div>
                        <div class="col-md-5 pull-right">
                            <div class="row">
                                <div class="form-group">
                                    <label class="control-label">Annual Holiday</label>
                                    <input class="form-control" name="annual_holiday"  type="text" placeholder="28" />
                                </div>
                            </div>
                        </div>

                    </div>
                </div>
                <div class="row">
                    <div class="col-md-12">
                        <div class="col-md-5">
                            <div class="row">
                                <div class="form-group">
                                    <label class="control-label">Designation <star>*</star></label>
                                    <select class="form-control" name="client_designation_id">
                                        <option value="">Select Designation</option>
                                        <?php $__currentLoopData = $designation; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $degi): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                            <option value="<?php echo e($degi->id); ?>"><?php echo e($degi->title); ?></option>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-5 pull-right">
                            <div class="row">
                                <div class="form-group">
                                    <label class="control-label">Attendance Evaluation</label>
                                    <?php echo Form::select('attendance_type',['0'=>'Event Basis','1'=>'Rota Basis'],0 , ['class'=>'form-control']); ?>

                                </div>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="form-group">
                    <label class="control-label">User Group <star>*</star></label>
                    <select class="form-control" required="true" name="user_group_id">
                        <option value="">Select User Group</option>
                        <?php $__currentLoopData = $userGroup; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <option value="<?php echo e($value->id); ?>"><?php echo e($value->title); ?></option>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </select>
                </div>
                <div class="form-group">
                    <label class="control-label">Join Date</label>
                    <input class="form-control todatepicker" name="join_date" type="text" />
                </div>

                <div class="form-group">
                    <label class="control-label">Mobile No</label>
                    <input class="form-control" name="mobile_no" type="text"  placeholder="01814000000"/>
                </div>
       </div>
       <div class="col-md-6">
               <div class="form-group">
                   <label class="control-label">IP address</label>
                   <input class="form-control" name="assign_ip"  type="text" />
               </div>

               <div class="form-group">
                   <label class="control-label">Time Zone <star>*</star></label>
                   <?php echo $timezone; ?>

               </div>
                <div class="form-group">
                    <label class="control-label">Present Address</label>
                    <textarea class="form-control" name="present_address" rows="5" placeholder="Start typing here"></textarea>
                </div>
                <div class="form-group">
                    <label class="control-label">Permanent Address</label>
                    <textarea class="form-control" name="permanent_address" rows="5" placeholder="Start typing here"></textarea>
                </div>
                <div class="form-group">
                    <label class="control-label">Email Address <star>*</star></label>
                    <input class="form-control" name="email" type="text" required="true" email="true"  placeholder="email@domain.com"
                    />
                </div>

                <div class="form-group">
                    <label class="control-label">Password <star>*</star></label>
                    <input class="form-control" name="password" id="registerPassword" type="password" required="true" placeholder="******"/>
                </div>

           <div class="form-group">
               <label class="control-label">Role <star>*</star></label>
               <?php $__currentLoopData = $roles; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $role): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                   <input type="checkbox" data-toggle="checkbox" value="<?php echo e($role->id); ?>" name="role_id[]" id='r-<?php echo e($role->id); ?>'><label for='r-<?php echo e($role->id); ?>' style='font-weight:200'><?php echo e($role->title); ?></label>
                   <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
           </div>
       </div>
     </div>
    </div>

    <div class="footer">
        <button type="submit" class="btn btn-info btn-fill pull-right">Register</button>
        <button type="button" class="btn btn-default btn-simple pull-right" data-dismiss="modal">Close</button>
        <div class="clearfix"></div>
    </div>
<?php echo Form::close(); ?>

<script type="text/javascript">
    $().ready(function() {
        $('.timepicker').datetimepicker({
            format: 'H:mm',
            icons: {
                time: "fa fa-clock-o",
                date: "fa fa-calendar",
                up: "fa fa-chevron-up",
                down: "fa fa-chevron-down",
                previous: 'fa fa-chevron-left',
                next: 'fa fa-chevron-right',
                today: 'fa fa-screenshot',
                clear: 'fa fa-trash',
                close: 'fa fa-remove'
            }
        });
        $('.todatepicker').datetimepicker({
            format: 'YYYY-MM-DD',
            viewMode: "months",
            icons: {
                time: "fa fa-clock-o",
                date: "fa fa-calendar",
                up: "fa fa-chevron-up",
                down: "fa fa-chevron-down",
                previous: 'fa fa-chevron-left',
                next: 'fa fa-chevron-right',
                today: 'fa fa-screenshot',
                clear: 'fa fa-trash',
                close: 'fa fa-remove'
            }
        });
        jQuery.validator.addMethod("timeformat", function(value, element) {
            return this.optional(element) || /^([0-1]?[0-9]|2[0-4]):([0-5][0-9])(:[0-5][0-9])?$/.test(value);
        },'Invalid time format: hh:mm i.e: 18:00');
        $().ready(function() {
            $('#registerFormValidation').validate({
                rules: {
                    in_time: {
                        required: true,
                        timeformat:true
                    }
                }
            });
        });
        function ajaxSubmit(url,formId){
            $.ajax({
                url: "<?php echo e(URL::to('user')); ?>",
                data: $("#registerFormValidation").serialize(),
                method: 'POST',
                dataType: 'json',
                success: function(data) {
                    if(data.success){
                        $.notify({
                            icon: 'pe-7s-bell',
                            message: data.success

                        },{
                            type: 'success',
                            timer: 10000
                        });
                    }else{
                        $.notify({
                            icon: 'pe-7s-bell',
                            message: data.error

                        },{
                            type: 'warning',
                            timer: 10000
                        });
                    }
                }
            });
        }
    });
</script>
