<?php if (isset($component)) { $__componentOriginalc6e081c8432fe1dd6b4e43af4871c93447ee9b23 = $component; } ?>
<?php $component = $__env->getContainer()->make(App\View\Components\MasterLayout::class, ['assets' => $assets ?? []]); ?>
<?php $component->withName('master-layout'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php $component->withAttributes([]); ?>
    <div>
        <?php $id = $id ?? null;?>
        <?php if(isset($id)): ?>
            <?php echo Form::model($data, ['route' => ['users.update', $id], 'method' => 'patch', 'id' => 'user_form']); ?>

        <?php else: ?>
            <?php echo Form::open(['route' => ['users.store'], 'method' => 'post','id' => 'user_form']); ?>

        <?php endif; ?>
        <div class="row">
            <div class="col-lg-12">
                <div class="card">
                    <div class="card-header d-flex justify-content-between">
                        <div class="header-title">
                            <h4 class="card-title"><?php echo e($pageTitle); ?></h4>
                        </div>
                        <div class="card-action">
                            <a href="<?php echo e(route('users.index')); ?> " class="btn btn-sm btn-primary" role="button"><?php echo e(__('message.back')); ?></a>
                        </div>
                    </div>

                    <div class="card-body">
                        <div class="new-user-info">
                            <div class="row">
                                <div class="form-group col-md-6">
                                    <?php echo e(Form::label('name', __('message.name').' <span class="text-danger">*</span>',[ 'class' => 'form-control-label' ], false )); ?>

                                    <?php echo e(Form::text('name', old('name'),[ 'placeholder' => __('message.name'),'class' =>'form-control','required'])); ?>

                                </div>
                                <?php
                                    $readonly = isset($id) ? 'readonly' : '';
                                ?>
                                <div class="form-group col-md-6">
                                    <?php echo e(Form::label('email',__('message.email').' <span class="text-danger">*</span>',['class'=>'form-control-label'], false )); ?>

                                    <?php echo e(Form::email('email',isset($id) ? optional($data)->email : old('email'), [ 'placeholder' => __('message.email'), 'class' => 'form-control','required', $readonly ])); ?>

                                </div>
                                <div class="form-group col-md-6">
                                    <?php echo e(Form::label('username', __('message.username').' <span class="text-danger">*</span>',['class' => 'form-control-label'], false )); ?>

                                    <?php echo e(Form::text('username',isset($id) ? optional($data)->username : old('username'),[ 'placeholder' => __('message.username'),'class' =>'form-control','required',$readonly])); ?>

                                </div>
                                <?php if(!isset($id)): ?>
                                <div class="form-group col-md-6">
                                    <?php echo e(Form::label('password', __('message.password').' <span class="text-danger">*</span>', ['class' => 'form-control-label'], false)); ?>

                                    <div class="input-group">
                                        <?php echo e(Form::password('password', ['class' => 'form-control', 'placeholder' => __('message.password'), 'id' => 'password'])); ?>

                                        <div class="input-group-append">
                                            <span class="input-group-text hide-show-password" style="cursor: pointer;">
                                                <i class="fas fa-eye-slash"></i>
                                            </span>
                                        </div>
                                    </div>
                                </div>
                                <?php endif; ?>
                                <div class="form-group col-md-6">
                                    <?php echo e(Form::label('contact_number',__('message.contact_number').' <span class="text-danger">*</span>',['class'=>'form-control-label'], false )); ?>

                                    <?php echo e(Form::text('contact_number',isset($id) ? optional($data)->contact_number :  old('contact_number'),[ 'placeholder' => __('message.contact_number'), 'class' => 'form-control', 'id' => 'phone' ,'required',$readonly ])); ?>

                                </div>
                            </div>
                            <hr>
                            <?php echo e(Form::submit( isset($id) ? __('message.update') : __('message.save'), ['class'=>'btn btn-md btn-primary float-right'])); ?>     
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <?php echo Form::close(); ?>

    </div>
    <?php $__env->startSection('bottom_script'); ?>
    <script>
        $(document).ready(function() {
            $('.hide-show-password').on('click', function() {
                var passwordInput = $('#password');
                var eyeIcon = $('.hide-show-password i');

                var passwordFieldType = passwordInput.attr('type');
                if (passwordFieldType === 'password') {
                    passwordInput.attr('type', 'text');
                    eyeIcon.removeClass('fa-eye-slash').addClass('fa-eye');
                } else {
                    passwordInput.attr('type', 'password');
                    eyeIcon.removeClass('fa-eye').addClass('fa-eye-slash');
                }
            });
            formValidation("#user_form", {
                    name: { required: true },
                    email: { required: true },
                    username: { required: true },
                    password: { required: true },
                }, {
                    name: { required: "<?php echo e(__('message.please_enter_name')); ?>"},
                    email: { required: "<?php echo e(__('message.please_enter_email')); ?>" },
                    username: { required: "<?php echo e(__('message.please_enter_username')); ?>" },
                    password: { required: "<?php echo e(__('message.please_enter_password')); ?>" },
                    contact_number: { required: "<?php echo e(__('message.please_enter_contact_number')); ?>" },
                });
        });
    </script>
    <?php $__env->stopSection(); ?>
 <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalc6e081c8432fe1dd6b4e43af4871c93447ee9b23)): ?>
<?php $component = $__componentOriginalc6e081c8432fe1dd6b4e43af4871c93447ee9b23; ?>
<?php unset($__componentOriginalc6e081c8432fe1dd6b4e43af4871c93447ee9b23); ?>
<?php endif; ?>
<?php /**PATH /www/wwwroot/mxunzo.atharvatek.com/resources/views/users/form.blade.php ENDPATH**/ ?>