<?php 
$this->validation =  \Config\Services::validation();
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
?>

<!DOCtype html>
<html class="no-js" lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="x-ua-compatible" content="ie=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name=”robots” content=”noindex,nofollow”>
    
    <title>CREATE ACCOUNT | AgroMarket Online Marketplace</title>
    <link rel="shortcut icon" type="image/png"  href="<?= base_url('assets/');?>/images/favicon.png">
    
    <!-- Thanks to Google Fonts -->
    <link rel="preconnect" href="https://fonts.googleapis.com">
	<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
	<link href="https://fonts.googleapis.com/css2?family=Manrope:wght@200;300;400;500;600;700;800&family=Roboto:wght@100;300;400;500;700&display=swap" rel="stylesheet">

      <!-- jquery
		============================================ -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>

    <!-- Bootstrap CSS
		============================================ -->
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.2/font/bootstrap-icons.css">
    <link rel="stylesheet" href="<?= base_url('assets/vendor');?>/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="<?= base_url('assets/');?>/css/style.css">
    <script src="<?= base_url('assets/');?>/js/modernizr-2.8.3.min.js"></script>
    
</head>

<body class="login" style="background: #F5F7FA;">
  <div class="container mx-auto  shadow-sm mt-md-5 mt-2 p-3 rounded" style="width: 500px; background: #fff;">
    <div class="row">
      <div class="col-lg-12 col-md-12">
        <div class="d-flex bd-highlight mb-4">
          <div class="bd-highlight p-2">
            <a href=""> <img src="<?= base_url();?>/assets/images/logo-mobile.png" alt="AgriMarket - Register" style="height: 70px"> </a>
          </div>
          <div class="bd-highlight">
            <h3>Register on <strong>LT CMS</strong></h3>
            <p class="mb-4 text-muted"><small>A fully customized to ease your website management. Your online content management experience, simplified</small></p>
          </div>
        </div><!-- Title area !-->
        <div>
          <?php if(session()->getTempdata('success')): ?>
          <div class="alert alert-success" role="alert">
            <?= session()->getTempdata('success');?>
          </div>
        <?php endif;?>
        <?php if(session()->getTempdata('error')): ?>
          <div class="alert alert-danger" role="alert">
          <?= session()->getTempdata('error');?>
        </div>
          <?php endif ?>
        </div><!-- Error Notifications !-->
        <form method="POST" action="<?= base_url('create/account')?>" enctype="multipart/form-data">
        <?= csrf_field() ?>
          <div class="row">
            <div class="col-lg-6 col-md-6 col-sm-6 mb-3">
              <div class="form-floating">
              <input type="text" name="first_name" class="form-control" id="floatingName" >
              <label for="floatingName">First Name</label>
              <div class="text-danger"><small><?=  $this->validation->getError('first_name');  ?></small></div>
              </div>
            </div><!-- First Name !-->
            <div class="col-lg-6 col-md-6 col-sm-6 mb-3">
              <div class="form-floating">
              <input type="text" name="last_name" class="form-control" id="floatingLName" >
              <label for="floatingLName">Last Name</label>
              <div class="text-danger"><small><?=  $this->validation->getError('last_name');  ?></small></div>
              </div>
            </div> <!-- Last Name !-->
            <div class="col-lg-12 col-md-12 col-sm-12 mb-3">
              <div class="form-floating ">
                <input type="email" name="email" class="form-control" id="floatingEmail">
                <label for="floatingEmail"> &nbsp;Email address</label>
                <div class="text-danger"><small><?=  $this->validation->getError('email');  ?></small></div>
              </div>
            </div><!-- Email Address !-->
            <div class="col-lg-6 col-md-6 col-sm-6 mb-3">
              <div class="form-floating ">
                <input type="text" name="mobile" class="form-control" id="floatingMobile">
                <label for="floatingMobile"> &nbsp;Mobile Phone</label>
                <div class="text-danger"><small><?=  $this->validation->getError('mobile');  ?></small></div>
              </div>
            </div><!-- Phone !-->
            <div class="col-lg-6 col-md-6 col-sm-6 mb-3">
              <div class="form-floating ">
                <input type="text" name="address" class="form-control" id="floatingAddress">
                <label for="floatingAddress"> &nbsp;Address</label>
              </div>
            </div><!-- Address !-->
            <div class="col-lg-12 col-md-12 col-sm-12 mb-3">
              <div class="form-floating">
                <select name="country_id" class="form-select" id="country_id" aria-label="Floating label for Country">
                <option>Select your country</option>
                  <?php foreach($Allcountries as $ctry): ?>
                  <option value="<?= $ctry->id; ?>" ><?= $ctry->name; ?> </option> 
                  <?php endforeach; ?>
                </select>
              <label for="floatingSelect">Country</label>
              </div>
            </div><!-- Country !-->
            <div class="col-lg-6 col-md-6 col-sm-6 mb-3">
              <div class="form-floating">
              <select name="state_id" class="form-select" id="state_id" >
                <option value="">Select State</option>
              </select>
              <label for="state_id">State</label>
              </div>
            </div><!-- State !-->
            <div class="col-lg-6 col-md-6 col-sm-6 mb-3">
              <div class="form-floating">
              <select name="city_id" class="form-select" id="city_id" >
                <option value="">Select City</option>
              </select>
              <label for="state_id">City / Town</label>
              </div>
            </div><!-- City !-->
            <div class="col-lg-6 col-md-6 col-sm-6 mb-3">
              <div class="form-floating">
              <input type="password" name="password" class="form-control example1" id="floatingPwd" >
              <label for="floatingPwd">Password</label>
              <div class="text-danger"><small><?=  $this->validation->getError('password');  ?></small></div>
              </div>
            </div><!-- Password !-->
            <div class="col-lg-6 col-md-6 col-sm-6 mb-3">
              <div class="form-floating">
                <input type="password" name="cpass" class="form-control" id="floatingInputc" >
                <label for="floatingInputc">Confirm Password</label>
                <div class="text-danger"><small><?= $this->validation->getError('cpass') ?></small></div>
              </div>
            </div><!-- Re-Enter Password !-->
            <div class="col-lg-12 col-md-12 col-sm-12 mb-3 d-grid">
              <button type="submit" class="btn btn-login">Submit</button>
            </div>
          </div>
        </form>
      </div>
    </div>
    <div class="row"><div class="col text-center"><small>Already have Account? <a href="<?= base_url('login') ?>">Login here</a></small></div></div>
  </div>
  <p class="mt-md-3 mt-2 text-center"> &copy;<?= date('Y'); ?> AgriMarket. All rights reserved. </p>


    <!-- JS -->
    <script> 
      
      var csrfToken = '<?= csrf_hash() ?>';// Get the CSRF token
      var base_url = "<?= base_url(); ?>"; 
    </script>
    <script src="<?= base_url('assets/');?>/js/countryselection.js"></script>
    <script src="<?= base_url('assets/vendor/bootstrap/');?>/js/bootstrap.min.js"></script>
    <script src="<?= base_url('assets/vendor');?>/bootstrap/js/bootstrap.bundle.min.js"></script>
    
 
</body>
</html>