
<?php $__env->startSection('title'); ?>
    Edit Profile
<?php $__env->stopSection(); ?>
<?php $__env->startSection('content'); ?>
    <div class="row">
        <div class="col-12">
            <h4 class="card-title">Update your Profile</h4>
            <p class="card-title-desc">Fill all information below</p>
            <form action="<?php echo e(route('profile.update')); ?>" method="POST" role="form" id="form1"
                  enctype="multipart/form-data">
                <?php echo csrf_field(); ?>
                <div class="row">
                    <div class="col-md-6">
                        <div class="form-group">
                            <label class="form-label" for="name"><?php echo e(__('messages.name')); ?> <span class="text-danger">*</span></label>
                            <input 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"
                                   placeholder="Enter your name" id="name"
                                   value="<?php echo e((auth()->user()->name) ?? ''); ?>"/>
                        </div>
                    </div>
                    <div class="col-md-6">
                        <div class="form-group">
                            <label class="form-label" for="address">Address</label>
                            <input type="text" class="form-control" name="address" id="address" placeholder="Enter address"
                                   value="<?php echo e((auth()->user()->address) ?? ''); ?>"/>
                        </div>
                    </div>
                </div>
                <div class="row mt-3">
                    <div class="col-md-6">
                        <div class="form-group">
                            <label class="form-label" for="phone">Phone</label>
                            <input type="text" class="form-control" name="phone" id="phone" placeholder="ex: 017XXXXXXXX"
                                   value="<?php echo e((auth()->user()->phone) ?? ''); ?>"/>
                        </div>
                    </div>
                    <div class="col-md-6">
                        <div class="form-group">
                            <label class="form-label" for="gender">Gender</label>
                            <select class="form-select" name="gender" id="gender" required>
                                <option value="">Select Gender</option>
                                <option
                                    value="male" <?php echo e((auth()->user()->gender && (auth()->user()->gender  === 'male')) ? 'selected' : ''); ?>>Male</option>
                                <option
                                    value="female" <?php echo e((auth()->user()->gender && (auth()->user()->gender  === 'female')) ? 'selected' : ''); ?>>Female</option>
                                <option
                                    value="other" <?php echo e((auth()->user()->gender && (auth()->user()->gender  === 'other')) ? 'selected' : ''); ?>>Other</option>
                            </select>
                        </div>
                    </div>
                </div>
                <div class="row mt-3">
                    <div class="col-md-6">
                        <div class="form-group">
                            <label class="form-label">Profile Photo</label>
                            <div class="fileinput fileinput-new" data-provides="fileinput">
                                <input type="file" class="form-control mb-3" onchange="imagePreView(this)" name="profile_photo" accept="image/*">
                                <?php if(isset(auth()->user()->profile_photo)): ?>
                                    <img src="<?php echo e(asset('storage/'.auth()->user()->profile_photo)); ?>" class="rounded-circle imagePreView"
                                         alt="<?php echo e(auth()->user()->name); ?>" width="200" height="200"/>
                                <?php else: ?>
                                    <img src="http://placehold.it/200x150" class="rounded-circle imagePreView" alt="..." width="200" height="200">
                                <?php endif; ?>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="mt-4 d-flex justify-content-end">
                    <div>
                        <button type="submit" class="btn btn-primary" >Update Profile</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
<?php $__env->stopSection(); ?>
<?php $__env->startPush('scripts'); ?>
    <script>
        function imagePreView(file) {
            let reader = new FileReader();
            reader.readAsDataURL(file.files[0]);
            reader.onload = function (event) {
                let source = event.target.result;
                $('.imagePreView').attr('src', source);
            }
        }
    </script>
<?php $__env->stopPush(); ?>


<?php echo $__env->make('backend.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH D:\laragon\www\practice\ml_firm\resources\views/backend/user/profile/edit.blade.php ENDPATH**/ ?>