<?php $__env->startSection('content'); ?>
    <section class="inner_header">
        <img src="<?php echo e(asset('assets/web/images/icons/inner.svg')); ?>" alt="" class="inner_shap">
        <div class="container">
            <ul class="links">
                <li>
                    <a href="<?php echo e(LaravelLocalization::getLocalizedURL($lang, route('home'), [], true)); ?>"><?php echo e(__('main.home')); ?></a>
                </li>
                <li>
                    <a href="#"><?php echo e(__('members.edit_phone')); ?></a>
                </li>
            </ul>
            <h4><?php echo e(__('members.edit_phone')); ?></h4>
        </div>
    </section>
    <section class="profile-pg section_padding">
        <div class="container">
            <div class="inner">
                <form method="post" action="<?php echo e(route('user.updatePhone', $user)); ?>" class="update_phone_form">
                    <div class="row align-items-center">
                        <div class="col-md-6">
                            <div class="form-group mt-4">
                                <p class="label mb-3"><b><?php echo e(__('members.new_phone')); ?></b></p>
                                <div class="row">
                                    <div class="col-8 pe-0">
                                        <input name="phone" type="tel" class="form-control" placeholder="<?php echo e(__('members.phone')); ?>">
                                    </div>
                                    <div class="col-4 ps-0">
                                        <input type="text" class="form-control text-center bg-white" value="+966" readonly>
                                    </div>
                                </div>
                            </div>
                            <button class="submit-butn butn mt-5 update_phone_button"><span><b> <?php echo e(__('members.change_phone_number')); ?> </b></span></button>
                        </div>
                        <div class="col-md-6">
                            <div class="img-box">
                                <img src="<?php echo e(asset('assets/web/images/profile-num-1.png')); ?>" alt="" class="img"/>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </section>

    <div class="modal confirmConsult save_data_modal fade" id="confirmConsult" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
        <div class="modal-dialog modal-dialog-centered modal-lg">
            <div class="modal-content">
                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                <div class="modal-body">
                    <img src="<?php echo e(asset('assets/web/images/icons/confirm.png')); ?>" alt="" class="icon"/>
                    <div class="content text-center mt-4">
                        <h3 class="title text-dark mb-2"><b><?php echo e(__('members.save_successfully')); ?></b></h3>
                    </div>
                </div>
            </div>
        </div>
    </div>

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

<?php $__env->startSection('inner_js'); ?>
    <script>
        $('.update_phone_button').click(async function (e) {
            e.preventDefault();
            $(this).attr('disabled', true);
            let form = $('.update_phone_form'),
                data = new FormData(form[0]),
                url = form.attr('action'),
                method = form.attr('method');

            data.append('update_phone', true);

            const response=await ajax({
                url,
                data,
                dataType: 'json',
                method,
                contentType: false,
                processData: false,
            });

            if (response.errors) {
                $(this).attr('disabled', false);
                toasterError(response.errors);
            }
            if (response.url) {
                window.location.href = response.url
            }
        });

        $('.save_data_modal').on('hide.bs.modal', function () {
            window.location.reload();
        });



        $(function() {
            $("#input-profile").change(function() {
                readURL1(this);
            });
        });

        function readURL1(input) {
            if (input.files && input.files[0]) {
                var reader = new FileReader();
                reader.onload = function(e) {
                    //alert(e.target.result);
                    $('#img-profile').attr('src', e.target.result);
                    $('#saveImage').fadeIn();
                }
                reader.readAsDataURL(input.files[0]);
            }
        }

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

<?php echo $__env->make('web.layouts.container', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\wamp64\www\legal\resources\views/web/users/profile/phone_form.blade.php ENDPATH**/ ?>