<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Homguru - register</title>
    <meta charset="utf-8" />
    <meta
      name="viewport"
      content="width=device-width, initial-scale=1, shrink-to-fit=no"
    />

    <link
      href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap"
      rel="stylesheet"
    />
    <link
      rel="icon"
      type="image/x-icon"
      href="<%- baseUrl %>/images/favicon.png"
    />
    <link
      rel="stylesheet"
      href="<%- baseUrl %>/css/open-iconic-bootstrap.min.css"
    />
    <link rel="stylesheet" href="<%- baseUrl %>/css/animate.css" />

    <link rel="stylesheet" href="<%- baseUrl %>/css/owl.carousel.min.css" />
    <link
      rel="stylesheet"
      href="<%- baseUrl %>/css/owl.theme.default.min.css"
    />
    <link rel="stylesheet" href="<%- baseUrl %>/css/magnific-popup.css" />

    <link rel="stylesheet" href="<%- baseUrl %>/css/aos.css" />

    <link rel="stylesheet" href="<%- baseUrl %>/css/ionicons.min.css" />

    <link rel="stylesheet" href="<%- baseUrl %>/css/bootstrap-datepicker.css" />
    <link rel="stylesheet" href="<%- baseUrl %>/css/jquery.timepicker.css" />

    <link rel="stylesheet" href="<%- baseUrl %>/css/flaticon.css" />
    <link rel="stylesheet" href="<%- baseUrl %>/css/icomoon.css" />
    <link rel="stylesheet" href="<%- baseUrl %>/css/style.css" />
    <link
      rel="stylesheet"
      href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css"
      integrity="sha512-DTOQO9RWCH3ppGqcWaEA1BIZOC6xxalwEsw9c2QQeAIftl+Vegovlnee1c9QX4TctnWMn13TZye+giMm8e2LwA=="
      crossorigin="anonymous"
      referrerpolicy="no-referrer"
    />
    <style>
      @media screen and (max-width: 600px) {
        .contact-form {
          width: 100% !important;
        }
        .login-css {
          text-align: left !important;
        }
        .login-text {
          text-align: left !important;
        }
      }
    </style>
  </head>
  <body style="overflow: hidden">
    <div
      class="hero-wrap"
      style="background-image: url('<%- baseUrl %>/images/bg_2.jpg')"
      data-stellar-background-ratio="0.5"
    >
      <div class="overlay"></div>
      <div class="overlay-2"></div>
      <div class="container">
        <div
          class="row no-gutters slider-text justify-content-center align-items-center"
          style="width: 100% !important"
        >
          <div
            class="row block-9 justify-content-center mb-5"
            style="width: 100%"
          >
            <div
              class="col-md-12 align-items-stretch d-flex"
              style="display: flex !important; justify-content: center"
            >
              <form
                action="/registerProcess"
                method="post"
                class="bg-light p-5 contact-form"
                style="width: 80%"
              >
                <h2 style="display: flex; justify-content: center">Register</h2>
                <% if(successMessage){ %>
                <div class="alert alert-success">
                  <strong>Success!</strong> <%- successMessage %>
                </div>
                <% } %> <% if(errorMessage){ %>
                <div class="alert alert-danger">
                  <strong>Error!</strong> <%- errorMessage %>
                </div>
                <% } %>
                <div class="row">
                  <div class="col-md-12 col-sm-12 mb-2">
                    <ul class="nav nav-pills">
                      <li class="nav-item" style="width: 80px">
                        <a class="nav-link active nav-user-type-user" href="#"
                          >User</a
                        >
                      </li>
                      <li class="nav-item" style="width: 80px">
                        <a class="nav-link nav-user-type-agent" href="#"
                          >Agent</a
                        >
                      </li>
                    </ul>
                  </div>
                  <input type="hidden" name="user" id="userType" />
                  <div class="col-md-6 col-sm-12">
                    <div class="form-group">
                      <input
                        type="text"
                        class="form-control"
                        placeholder="Your First Name"
                        name="firstName"
                        required
                      />
                    </div>
                  </div>
                  <div class="col-md-6 col-sm-12">
                    <div class="form-group">
                      <input
                        type="text"
                        class="form-control"
                        placeholder="Your Last Name"
                        name="lastName"
                        required
                      />
                    </div>
                  </div>
                  <div class="col-md-6 col-sm-12">
                    <div class="form-group">
                      <input
                        type="text"
                        class="form-control"
                        id="username-field"
                        placeholder="Your Username"
                        name="userName"
                        required
                      />
                      <small id="username-checker"></small>
                    </div>
                  </div>
                  <div class="col-md-6 col-sm-12">
                    <div class="form-group">
                      <input
                        type="email"
                        class="form-control"
                        placeholder="Your Email"
                        name="email"
                        required
                      />
                    </div>
                  </div>
                  <div class="col-md-6 col-sm-12">
                    <div class="form-group">
                      <input
                        type="number"
                        class="form-control"
                        placeholder="Your Mobile No"
                        name="mobileNo"
                        required
                      />
                    </div>
                  </div>
                  <div class="col-md-6 col-sm-12">
                    <div class="form-group">
                      <input
                        type="password"
                        class="form-control"
                        placeholder="Your password"
                        name="password"
                        required
                      />
                    </div>
                  </div>
                </div>
                <div class="row">
                  <div class="col-md-6 col-sm-12">
                    <div class="form-group">
                      <input
                        type="submit"
                        value="Register"
                        class="btn btn-primary py-3 px-5"
                      />
                    </div>
                  </div>
                  <div class="col-md-6 col-sm-12 mt-2 login-text" align="right">
                    <span>You have an account? </span><a href="/login">Login</a>
                  </div>
                </div>
              </form>
            </div>
          </div>
        </div>
      </div>
    </div>

    <!-- loader -->
    <div id="ftco-loader" class="show fullscreen">
      <svg class="circular" width="48px" height="48px">
        <circle
          class="path-bg"
          cx="24"
          cy="24"
          r="22"
          fill="none"
          stroke-width="4"
          stroke="#eeeeee"
        />
        <circle
          class="path"
          cx="24"
          cy="24"
          r="22"
          fill="none"
          stroke-width="4"
          stroke-miterlimit="10"
          stroke="#F96D00"
        />
      </svg>
    </div>

    <script src="<%- baseUrl %>/js/jquery.min.js"></script>
    <script src="<%- baseUrl %>/js/jquery-migrate-3.0.1.min.js"></script>
    <script src="<%- baseUrl %>/js/popper.min.js"></script>
    <script src="<%- baseUrl %>/js/bootstrap.min.js"></script>
    <script src="<%- baseUrl %>/js/jquery.easing.1.3.js"></script>
    <script src="<%- baseUrl %>/js/jquery.waypoints.min.js"></script>
    <script src="<%- baseUrl %>/js/jquery.stellar.min.js"></script>
    <script src="<%- baseUrl %>/js/owl.carousel.min.js"></script>
    <script src="<%- baseUrl %>/js/jquery.magnific-popup.min.js"></script>
    <script src="<%- baseUrl %>/js/aos.js"></script>
    <script src="<%- baseUrl %>/js/jquery.animateNumber.min.js"></script>
    <script src="<%- baseUrl %>/js/bootstrap-datepicker.js"></script>
    <script src="<%- baseUrl %>/js/jquery.timepicker.min.js"></script>
    <script src="<%- baseUrl %>/js/scrollax.min.js"></script>
    <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBVWaKrjvy3MaE7SQ74_uJiULgl1JY0H2s&sensor=false"></script>
    <script src="<%- baseUrl %>/js/google-map.js"></script>
    <script src="<%- baseUrl %>/js/main.js"></script>
    <script>
      $(document).ready(() => {
        $("#username-checker").hide();
        setTimeout(() => {
          $(".alert").hide();
        }, 4000);
        function checkUserName(userName) {
          $.post("/checkUserName", { userName }, (data, status) => {
            if (data?.status) {
              $("#username-checker").html(
                `Username <b>${userName}</b> is available`
              );
              $("#username-checker").css("color", "");
              $("#username-checker").css("color", "green");
            } else {
              $("#username-checker").html(
                `Username <b>${userName}</b> is not available`
              );
              $("#username-checker").css("color", "");
              $("#username-checker").css("color", "red");
            }
            $("#username-checker").show();
          });
        }

        $("#username-field").keyup((e) => {
          let userName = $(e.target).val();
          if (userName == "" || !userName) {
            $("#username-checker").hide();
            return false;
          }
          checkUserName(userName);
        });

        $(".nav-user-type-user").click((e) => {
          console.log("in user type");
          $(".nav-user-type-user").removeClass("active");
          $(".nav-user-type-agent").removeClass("active");
          $(".nav-user-type-user").addClass("active");
          $("#userType").val("user");
        });

        $(".nav-user-type-agent").click((e) => {
          console.log("in agent type");
          $(".nav-user-type-agent").removeClass("active");
          $(".nav-user-type-user").removeClass("active");
          $(".nav-user-type-agent").addClass("active");
          $("#userType").val("agent");
        });
      });
    </script>
  </body>
</html>
