<?php

$title = 'Sign up';
require_once('head-auth.php') ?>

<body class="uk-dark
    uk-background-cover uk-background-norepeat" style="background-image: url(assets/images/New/girl-hacker.jpeg);">

  <div class="uk-grid-collapse uk-flex" style="height: 100vh;" data-uk-grid>
    <div class="uk-padding-large uk-flex uk-flex-middle uk-flex-center  row mx-auto" data-uk-height-viewport>
      <div class="uk-width-3-4@s">
        <div class="uk-text-center uk-margin-bottom">
          <a class="uk-logo uk-text-primary uk-text-bold" href="../index.html"></a>
          <img src="logo-dark.png" alt="">
        </div>
        <div class="row flex-column card text-13">
          <div class="uk-text-center text-theme pt-40">
          </div>

          <div class="pdd-horizon-30 pdd-vertical-30">
            <div class="uk-text-center uk-margin">
              <p class="uk-margin-remove">Enter your details to get started:</p>
            </div>
            <form class="register_form">
              <!-- $user->create($_POST['user_full_name'],$_POST['user_email'],$_POST['user_referrer'],$_POST['user_password'],$_POST['user_confirm_pass']); -->
              <div class="uk-width-1-1 uk-margin">
                <!-- <label class="uk-form-label" for="name">Full name</label> -->
                <input name="user_full_name" class="uk-input uk-form-large  form-control text-13" type="text" placeholder="Full name">
              </div>
              <input type="hidden" name="user_referrer" placeholder="Referrer Username*" value="<?php if (isset($_GET['ref'])) {
                                                                                                  print $_GET['ref'];
                                                                                                } ?>" type="text">
              <div class="uk-width-1-1 uk-margin">
                <!-- <label class="uk-form-label" for="email">Email </label> -->
                <input name="user_email" class="uk-input uk-form-large  form-control text-13" type="email" placeholder="Email address">
              </div>
              <!-- <div class="uk-width-1-1 uk-margin">
            <input name="btc_address" class="uk-input uk-form-large" type="email" placeholder="Btc address">
          </div> -->
              <div class="uk-width-1-1 uk-margin">
                <!-- <label class="uk-form-label" for="password">Password </label> -->
                <input name="user_password" class="uk-input uk-form-large  form-control text-13" type="password" placeholder="Password">
              </div>
              <div class="uk-width-1-1 uk-margin">
                <!-- <label class="uk-form-label" for="password">Confirm Password </label> -->
                <input name="user_confirm_pass" class="uk-input uk-form-large  form-control text-13" type="password" placeholder="Confirm password">
              </div>
              <div class="uk-width-1-1 uk-margin uk-text-right flex justify-between text-13">
                <p class=" uk-margin-remove"><a class="" href="./">Already registered before? Login</a></p>
              </div>
              <div class="uk-width-1-1 uk-text-center">
                <button class="uk-button btn-secondary uk-button-large register_user_btn btn font-poppins">
                  Sign Up</button>
              </div>
            </form>
          </div>
        </div>
      </div>
    </div>


    <!-- customs scripts starts -->
    <?php require_once('scripts-auth.php') ?>
    <!-- dashboard js ends -->

    <script>
      $(document).ready(function() {

        let referrer = $('.referrer').text();
        if (referrer.length !== 0) {
          $('.registerModal').modal('show');
        }


        $('.sign_in_btn').click(async function(e) {
          e.preventDefault();
          let sign_in_form = $('.sign_in_form').serializeArray();
          // console.log(sign_in_form);
          // return;
          let form_data = set_form_data(sign_in_form);
          let returned = await ajaxRequest('ajax.php', form_data);

          if (returned.error == 1) {
            Swal.fire("Sorry", returned.msg, "error");
          } else if (returned.error == 0) {
            Swal.fire("Congratulations!", returned.msg + returned.first_name, "success");
            // swal('Congratulations', returned.msg + returned.first_name, 'success');
            setTimeout(() => {
              window.location.href = '../user/overview';
            }, 2000);
          }
        });

        $('.register_user_btn').click(async function(e) {
          e.preventDefault();
          let register_form = $('.register_form').serializeArray();
          // console.log(register_form);
          // return;
          let form_data = set_form_data(register_form);
          let returned = await ajaxRequest('ajax.php', form_data);
          // console.log(returned);return;
          throwSweetalert(returned, './', 1);
        });

      });
    </script>

</body>

</html>