<?php $__env->startSection('content'); ?>
<div class="container-fluid" onload="initAutocomplete()">
    <div class="row justify-content-center d-flex align-item-center login-row">
        <div class="col-md-5 px-0 form-col">
        <div class="card border-0">
                <div class="card-body">
                <h2 style='font-weight:bold;'>Create An Account</h2>
                    <p style='font-size:14px;'>Enter Your Personal Information to create an account.</p>
                    <form method="POST" action="<?php echo e(route('register')); ?>">
                        <?php echo csrf_field(); ?>
                    <div class='row'>
                        <div class='col-md-6'>
                            <div class="form-group mb-3">
                                        <input id="first_name" type="text" class="form-control <?php $__errorArgs = ['first_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="first_name" placeholder='First Name' value="<?php echo e(old('first_name')); ?>" autocomplete="first_name" autofocus>
                                        <?php $__errorArgs = ['first_name'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                            <span class="invalid-feedback" role="alert">
                                                <strong><?php echo e($message); ?></strong>
                                            </span>
                                        <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                            </div>
                        </div>
                        <div class='col-md-6'>
                            <div class="form-group mb-3">
                                    <input id="last_name" type="text" class="form-control <?php $__errorArgs = ['last_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="last_name" placeholder='Last Name' value="<?php echo e(old('last_name')); ?>" autocomplete="last_name" autofocus>
                                    <?php $__errorArgs = ['last_name'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                        <span class="invalid-feedback" role="alert">
                                            <strong><?php echo e($message); ?></strong>
                                        </span>
                                    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                            </div>
                        </div>
                    </div>
                        <div class="form-group mb-3">     
                                <input id="email" type="email" class="form-control <?php $__errorArgs = ['email'];
$__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); ?>" placeholder='Email' name="email" value="<?php echo e(old('email')); ?>" autocomplete="email">
                                <?php $__errorArgs = ['email'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                    <span class="invalid-feedback" role="alert">
                                        <strong><?php echo e($message); ?></strong>
                                    </span>
                                <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                        </div>
                        <div class="form-group mb-3">
                                <!-- <input id="phone" type="tel" class="form-control <?php $__errorArgs = ['phone'];
$__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); ?> w-100" name="phone" placeholder='Phone' value="<?php echo e(old('phone')); ?>" autocomplete="phone" oninput="handleInput()" onkeypress="return validateInput()" autofocus> -->
                                <input id="phone" type="tel" class="form-control <?php $__errorArgs = ['phone'];
$__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); ?> w-100" name="phone" placeholder='Phone' value="<?php echo e(old('phone')); ?>" autocomplete="phone" autofocus>
                             
                                <?php $__errorArgs = ['phone'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                    <span class="invalid-feedback" role="alert">
                                        <strong><?php echo e($message); ?></strong>
                                    </span>
                                <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                        </div>
                        <div class="form-group mb-3">
                                <input id="address" type="text" class="form-control <?php $__errorArgs = ['address'];
$__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="address" placeholder='Address' value="<?php echo e(old('address')); ?>" autocomplete="address" autofocus>
                                <?php $__errorArgs = ['address'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                    <span class="invalid-feedback" role="alert">
                                        <strong><?php echo e($message); ?></strong>
                                    </span>
                                <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                        </div>
                        <div class="form-group mb-3 password-div">
                                <input id="password" type="password" class="form-control <?php $__errorArgs = ['password'];
$__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); ?>" placeholder='Password' name="password" autocomplete="new-password">
                                <i id='showpswd' class="fa fa-eye-slash" onclick="showpwd()" aria-hidden="true"></i>

                                <?php $__errorArgs = ['password'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                    <span class="invalid-feedback" role="alert">
                                        <strong><?php echo e($message); ?></strong>
                                    </span>
                                <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                        </div>
                        <div class="form-group mb-3">
                                <input id="password-confirm" type="password" class="form-control" placeholder='Confirm Password' name="password_confirmation" autocomplete="new-password">
                        </div>
                        <div class="form-group mb-0">
                                <button type="submit" class="btn btn-primary w-100">
                                    <?php echo e(__('Register')); ?>

                                </button>
                                <a class="btn btn-link text-secondary text-end" style='width:100%;' href="<?php echo e(route('login')); ?>">
                                        <?php echo e(__('Back to Login?')); ?>

                                    </a>
                        </div>
                    </form>
                </div>
            </div>
        </div>
        <div class='col-md-7 px-0 login-img-col vh-100'>
              <img src="<?php echo e(url('/dashboardd.png')); ?>">
            </div>
    </div>
</div>

<script>

$('#registerform').one('submit', function() {
    $(this).find('input[type="submit"]').attr('disabled', 'disabled');
});

</script>
<!-- <script>

    // Automatically format the phone number as the user types
    var input = document.getElementById('phone');
    input.addEventListener('input', function() {
      this.value = formatPhoneNumber(this.value);
    });
    
    function formatPhoneNumber(input) {
      // Remove all non-digit characters
      var cleaned = ('' + input).replace(/\D/g, '');

      // Limit the input to 14 characters
      cleaned = cleaned.substring(0, 14);

      // Format the number as (XXX) XXX-XXXX
      var match = cleaned.match(/^(\d{3})(\d{3})(\d{4})$/);
      if (match) {
        return '(' + match[1] + ') ' + match[2] + '-' + match[3];
      }
      return cleaned;
    }

    function handleInput() {
      var input = document.getElementById('phone').value;
    //   var formatted = formatPhoneNumber(input);
    //   document.getElementById('formattedPhone').innerText = formatted;
    }

    function validateInput() {
      var input = document.getElementById('phone').value;
      if (/^\d{0,14}$/.test(input)) {
        return true;
      } else {
        return false;
      }
    }
  
  </script> -->
  <script src="https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/17.0.8/js/intlTelInput.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/17.0.8/js/utils.js"></script>

<script>
function showpwd() {
    var icon = document.getElementById("showpswd");
  var x = document.getElementById("password");

  if (x.type === "password") {
    x.type = "text";
    icon.classList.remove('fa-eye-slash');
    icon.classList.add('fa-eye');
  } else {
    x.type = "password";
    icon.classList.remove('fa-eye');
    icon.classList.add('fa-eye-slash');
  }
}
</script>

<script>
    document.addEventListener('DOMContentLoaded', function() {
        console.log('DOM fully loaded and parsed');
        var input = document.querySelector("#phone");
        if (input) {
            console.log('Phone input found', input);
            try {
                var iti = window.intlTelInput(input, {
                    initialCountry: "auto",
                    geoIpLookup: function(callback) {
                        $.get('https://ipinfo.io', function() {}, "jsonp").always(function(resp) {
                            var countryCode = (resp && resp.country) ? resp.country : "us";
                            callback(countryCode);
                        });
                    },
                    utilsScript: "https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/17.0.8/js/utils.js"
                });

                function validateInput() {
                    if (iti.isValidNumber()) {
                        var countryCode = iti.getSelectedCountryData().dialCode;
                    var currentNumber = iti.getNumber(intlTelInputUtils.numberFormat.E164);
                    $('#phone').val(currentNumber);
                        console.log('Phone number is valid');
                    } else {
                        console.log('Phone number is invalid');
                    }
                }

                function handleInput() {
                    var countryCode = iti.getSelectedCountryData().dialCode;
                    var currentNumber = iti.getNumber(intlTelInputUtils.numberFormat.E164);
                    $('#phone').val(currentNumber);
                    validateInput();
                }

                $(document).ready(function() {
                    $('.iti__flag-container').click(handleInput);
                    $('#phone').on('blur', validateInput);
                });

            } catch (error) {
                console.error('Error initializing intlTelInput', error);
            }
        } else {
            console.error('Phone input element not found');
        }
    });
</script>

<script>
    function initAutocomplete() {
      var input = document.getElementById('address');
      var autocomplete = new google.maps.places.Autocomplete(input);

      autocomplete.addListener('place_changed', function() {
        var place = autocomplete.getPlace();
        // console.log('Selected place:', place);
        // Display the place details
      });
    }
  </script>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /Applications/XAMPP/xamppfiles/htdocs/tprproject/get-myaio-app/resources/views/auth/register.blade.php ENDPATH**/ ?>