<?= $this->extend('Modules\Admin\Views\index'); ?>
<?= $this->section('content');?>
<div class="container-fluid">
<div class="row mb-md-3">
	<div class="col">
		<h4>Add User</h4>
		<!-- Breadcrumb !-->
		<nav aria-label="breadcrumb"><small>
			<ol class="breadcrumb mb-0">
				<li class="breadcrumb-item"><a href="<?= base_url('administrator') ?> ">Home</a></li>
        <li class="breadcrumb-item"><a href="<?= base_url('administrator/users') ?> ">All Users</a></li>
				<li class="breadcrumb-item active" aria-current="page"><?= esc($bcrumb) ?> </li>
			</ol></small>
		</nav>
		<!-- End Breadcrumb !-->
	</div>
</div>
<!-- print success message !-->
<div class="row">
    <div class="col">
		<!-- print success message !-->
		<?php if(session()->getTempdata('success')): ?>
			<div class="alert alert-success" role="alert"><?= session()->getTempdata('success');?></div>
		<?php endif;?>
		<!-- print failure message !-->
		<?php if(session()->getTempdata('error')): ?>
			<div class="alert alert-danger" role="alert"><?= session()->getTempdata('error');?></div>
		<?php endif;?>
        <?php if(isset($validation)): ?>
			<div class="alert alert-danger">
		<?= $validation->listErrors()?>
		</div>
        <?php endif;?>
        <div id="showMsg"></div>
</div></div>
<!-- END print success message !-->
<div class="row">
	<div class="col-lg-10 col-md-10 col-sm-12">
	<div class="card card-body">
		<div class="mb-3"><h6>.. <a href="<?= base_url('administrator/users');?>" class="btn btn-sm btn-secondary float-md-end">Back to User List</a></span></h6></div>
    <form method="POST" action="<?= base_url('/administrator/users/add') ?>" 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="floatingInputGrid" required >
                  <label for="floatingInput">First Name *</label>
                  </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="floatingInputGrid" required>
                  <label for="floatingInput">Last Name *</label>
                  </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="floatingInput" required>
                    <label for="floatingInput"> &nbsp;Email address *</label>
                  </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="floatingInput" required>
                    <label for="floatingInput"> &nbsp;Mobile Phone *</label>
                  </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="floatingInput">
                    <label for="floatingInput"> &nbsp;Address</label>
                  </div>
                </div><!-- Address !-->
                <div class="col-lg-4 col-md-4 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($countries as $ctry): ?>
                      <option value="<?= $ctry->id; ?>" ><?= $ctry->name; ?> </option> 
                      <?php endforeach; ?>
                    </select>
                  <label for="floatingSelect">Country</label>
                  </div>
                </div><!-- Country !-->
                <div class="col-lg-4 col-md-4 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="floatingInput">State</label>
                  </div>
                </div><!-- State !-->
                <div class="col-lg-4 col-md-4 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="floatingInput">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="floatingInputGrid" >
                  <label for="floatingInput">Password *</label>
                  </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="floatingInputGrid" >
                    <label for="floatingInput">Confirm Password</label>
                  </div>
                </div><!-- Re-Enter Password !-->
            <div class="row mb-3">
              <div class="col">
                <label class="form-label fw-bold"><small>Description</small></label>
                <textarea class="form-control" name="description" row="5" ></textarea>
              </div>
            </div>
            
          </div>
          
          <div class="btn-group w-100 mb-3">
            
            <button type="reset" class="btn btn-secondary" >Close</button>
            <button type="submit" class="btn btn-danger d-block w-75 stbtn" >Add User</button>
          </div>
          
        </div>
      </form>
       
<!---- Modals --->

<!---- JS --->
              
<script src="<?= base_url();?>/assets/js/modules/settings.js"></script>
<script src="<?= base_url();?>/assets/js/countryselection.js"></script>   
<?= $this->endSection();?>