


<?php $__env->startSection('title'); ?>
<?php echo e(__('Create user')); ?>

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

<?php $__env->startSection('breadcrumb'); ?>
<div class="row page-title">
    <div class="col-md-12">
        
        <h3 class="mb-1 mt-0"><?php echo e(__('Add User')); ?></h3>
        <nav aria-label="breadcrumb" class="float-left mt-1">
            <ol class="breadcrumb">
                <li class="breadcrumb-item"><a href="<?php echo e(route('dashboard')); ?>"><?php echo e(__('Home')); ?></a></li>
                <li class="breadcrumb-item"><a href="<?php echo e(route('user-list')); ?>"><?php echo e(__('Users list')); ?></a></li>
                <li class="breadcrumb-item active" aria-current="page"><?php echo e(__('Add user')); ?></li>
            </ol>
        </nav>
    </div>
</div>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>
<!-- select -->
<div class="row">
    <div class="col-12">
        <div class="card">
            <div class="card-body">
                <h4 class="header-title mt-0 mb-1"><?php echo e(__('Create user')); ?></h4>
                <p class="sub-header">
                    <?php echo e(__('Please fill all given fields')); ?>.
                </p>
                <form action="" method="get">
                    <div class="row">

                        <div class="col-lg-6 col-sm-4">
                            <label class="col-form-label" for=""><?php echo e(__('First Name')); ?> <span class="text-danger">*</span></label>
                            <input type="text" class="form-control" required id="first_name" name="first_name"
                                placeholder="<?php echo e(__('Enter first name')); ?>">

                        </div>

                        <div class="col-lg-6 col-sm-4">
                            <label class="col-form-label" for=""><?php echo e(__('Last Name')); ?> <span class="text-danger">*</span></label>
                            <input type="text" class="form-control" required id="last_name" name="last_name"
                                placeholder="<?php echo e(__('Enter last name')); ?>">

                        </div>

                        <div class="col-lg-4 col-sm-4">
                            <label class="col-form-label" for=""><?php echo e(__('Email')); ?> <span class="text-danger">*</span></label>
                            <input type="text" class="form-control" required id="email" name="email"
                                placeholder="<?php echo e(__('Enter email')); ?>">

                        </div>
                        <div class="col-lg-4 col-sm-4">
                            <div class="form-group mt-3 mt-sm-0">
                                <label class="col-form-label"><?php echo e(__('Role')); ?> <span class="text-danger">*</span></label>
                                <select class="custom-select" required>
                                    <option selected disabled><?php echo e(__('Select role')); ?></option>
                                    <option value="0">Admin</option>
                                    <option value="2">Customer</option>
                                    <option value="1">Contractor</option>
                                    <option value="2">Sub contractor</option>
                                </select>
                            </div>
                        </div>
                        <div class="col-lg-4 col-sm-4">
                            <label class="col-form-label" for=""><?php echo e(__('Phone')); ?></label>
                            <input type="text" class="form-control" required id="phone_number" name="phone_number"
                                placeholder="+1 (234) 12345">
                        </div>
                        <div class="col-lg-12 col-sm-4">
                            <label class="col-form-label" for=""><?php echo e(__('Address')); ?></label>
                            <textarea name="" id="" cols="30" rows="2" class="form-control"
                                placeholder="<?php echo e(__('Enter address')); ?>"></textarea>
                        </div>
                        <div class="col-lg-4 col-sm-4">
                            <label class="col-form-label" for=""><?php echo e(__('City')); ?></label>
                            <input type="text" class="form-control" required id="city" name="city"
                                placeholder="<?php echo e(__('Enter city name')); ?>">
                        </div>
                        <div class="col-lg-4 col-sm-4">
                            <label class="col-form-label" for=""><?php echo e(__('State')); ?></label>
                            <input type="text" class="form-control" required id="state" name="state"
                                placeholder="<?php echo e(__('Enter state')); ?>">
                        </div>
                        <div class="col-lg-4 col-sm-4">
                            <label class="col-form-label" for=""><?php echo e(__('Zip code')); ?></label>
                            <input type="text" class="form-control" required id="zip" name="zip"
                                placeholder="<?php echo e(__('Enter zip code')); ?>">
                        </div>
                        <div class="col-lg-4 col-sm-4">
                            <label class="col-form-label" for=""><?php echo e(__('Country')); ?></label>
                            <input type="text" class="form-control" required id="country" name="country"
                                placeholder="<?php echo e(__('Enter country')); ?>">
                        </div>
                        <div class="col-lg-4 col-sm-4">
                            <div class="form-group mt-3 mt-sm-0">
                                <label class="col-form-label"><?php echo e(__('Status')); ?> <span class="text-danger">*</span></label>
                                <select class="custom-select" required>
                                    <option selected disabled><?php echo e(__('Select status')); ?></option>
                                    <option value="0">Pending</option>
                                    <option value="2">Inprogress</option>
                                    <option value="1">Completed</option>
                                </select>
                            </div>
                        </div>
                        <div class="col-lg-6 col-form-label">
                            <div class="col-12 text-center">
                                <img id="user_photo_selected" src="<?php echo e(asset('assets/images/users/avatar-121.png')); ?>"
                                     class="img-fluid rounded-circle mx-auto"
                                    style="width:140px;height:130px;object-fit:cover; " alt="user image">

                            </div>
                            <div id="photo-error" class="text-muted small mt-1 text-center">
                                <?php echo e(__('Allowed JPG, GIF or PNG. Max size of 2MB')); ?>

                            </div>

                            <div class="col-12"> 
                                <label class="col-form-label" for=""><?php echo e(__('Image')); ?></label>
                                <input type="file" class="form-control imageChange" accept="image/*" required
                                    id="imageChange" name="image">

                            </div>
                        </div>
                        <div class="col-lg-12 col-sm-4 pt-2">

                            <input type="submit" class="btn custom-button d-flex btnSubmit mr-0" value="<?php echo e(__('Add user')); ?>" id="btnSubmit">
                        </div>
                    </div>
                </form>

            </div> <!-- end card-body -->
        </div> <!-- end card-->
    </div> <!-- end col -->
</div>
<!-- end row -->

<!-- end row -->
<?php $__env->stopSection(); ?>
<?php $__env->startSection('script-bottom'); ?>
<script>
    $(document).ready(function (e) {
        $(document).on('change', '.imageChange', function (e) {
            photoError = 0;
            if (e.target.files && e.target.files[0]) {
                // console.log(e.target.files[0].name.strtolower())
                if (e.target.files[0].name.match(/\.(jpg|jpeg|JPG|png|gif|PNG)$/)) {
                    $("#photo-error").empty();
                    photoError = 0;
                    var reader = new FileReader();

                    reader.onload = function (e) {
                        $('#user_photo_selected').attr('src', e.target.result);
                    }
                    reader.readAsDataURL(e.target.files[0]);

                } else {
                    photoError = 1;
                    $("#photo-error").empty();
                    $(".btnSubmit").prop('disabled', true);

                    $("#photo-error").append(
                        '<p class="text-danger">Please upload only jpg, png format!</p>');
                }
            } else {
                $('#user_photo_selected').attr('src', '');
            }

            if (photoError == 0) {
                $(".btn-change-photo").prop('disabled', false);
                $("#btnSubmit").attr('disabled', false);
            } else {
                $(".btn-change-photo").prop('disabled', true); 
            }
        });
    });

</script>

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

<?php echo $__env->make('layouts.master', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH G:\php\www\laravel\baramdat\hvg\hvg\resources\views/general/user/user-add.blade.php ENDPATH**/ ?>