<?php
include("user_func.php");
$hddnUserCode = $_SESSION['caller']['args'][1];
if ($_SESSION['user']['access_level'] < 9)
{
	if ((isset($hddnUserCode)) && ($hddnUserCode != $_SESSION['user']['user_code'])) callPage("user/view.php");
}
$onclick = "fileUpload('edtImage', 'imgUser', '1', false)";
$imgHTML = SableSystem::getClickableImgHTML(SableSystem::getSableImgPath("profile/profile.png"), 225, 'imgUser', $onclick);
?>
<script src="<?php SableGeneralFunctions::printModuleJS('user'); ?>" ></script>
<!--// User -->
<form id="frmUser" name="frmUser" autocomplete="on" style="padding:0; margin:0;">
  <div class="forms">
  	<!--// SPACER -->
    <div class="container">
      <div class="forms-grids">
        <div class="col-md-12 forms-grid">
          <h3>&nbsp;</h3>
          <p></p>
          <div class="clearfix"> </div>
        </div>
      </div>
    </div>
  	<!-- SPACER //-->
  
    <div class="container">
      <div class="forms-grids">
        <div class="col-md-12 forms-grid">
          <h3 class="header"><i class="fa fa-user-circle-o" aria-hidden="true"></i>&nbsp;Member Registration</h3>
          <p></p>
          <div class="clearfix"> </div>
        </div>
      </div>
    </div>
    <p></p>
    <!--// edtImage -->
    <div class="container">
      <div class="forms-grids">
        <div class="col-md-4 forms-grid">
          <input name="edtImage" type="text" id="edtImage" onfocus="showHint('edtImage');" onblur="hideHint('edtImage'); validate_edtImage()"
			 placeholder="Upload a photo" onkeypress="handleEnter(this, event)" readonly />
          <!--// the image -->
          <p></p>
          <div class="container">
            <div class="forms-grids">
              <div class="col-md-4 forms-grid"><?php echo($imgHTML); ?></div>
            </div>
          </div>
          <!-- the image //--> 
        </div>
        <div class="col-md-8">
          <div class="fieldHint" id="hint_edtImage">Please upload a photo of this individual.</div>
        </div>
        <div class="clearfix"> </div>
      </div>
    </div>
    <!-- edtImage //-->
    <p></p>
    <!--// edtName -->
    <div class="container">
      <div class="forms-grids">
        <div class="col-md-4 forms-grid">
          <input name="edtName" type="text" id="edtName" onfocus="showHint('edtName');" onblur="hideHint('edtName'); 
		  validate_edtName()" placeholder="Name" onkeypress="handleEnter(this, event)" />
        </div>
        <div class="col-md-8">
          <div class="fieldHint" id="hint_edtName">First name</div>
        </div>
        <div class="clearfix"> </div>
      </div>
    </div>
    <!-- edtName //-->
    <p></p>
    <!--// edtSurname -->
    <div class="container">
      <div class="forms-grids">
        <div class="col-md-4 forms-grid">
          <input name="edtSurname" type="text" id="edtSurname" onfocus="showHint('edtSurname');" onblur="hideHint('edtSurname');
		  validate_edtSurname()" placeholder="Surname" onkeypress="handleEnter(this, event)" />
        </div>
        <div class="col-md-8">
          <div class="fieldHint" id="hint_edtSurname">Surname</div>
        </div>
        <div class="clearfix"> </div>
      </div>
    </div>
    <!-- edtSurname //-->
    <p></p>
    <!--// edtEmail -->
    <div class="container">
      <div class="forms-grids">
        <div class="col-md-4 forms-grid">
          <input name="edtEmail" type="email" id="edtEmail"
onfocus="showHint('edtEmail');" onblur="hideHint('edtEmail'); validate_edtEmail()"
 placeholder="Email"	
onkeypress="handleEnter(this, event)" 
 />
        </div>
        <div class="col-md-4">
          <div class="fieldHint" id="hint_edtEmail">Email address</div>
        </div>
        <div class="clearfix"> </div>
      </div>
    </div>    
    <!-- edtEmail //-->
    <p></p>
    <!--// edtCell -->
    <div class="container">
      <div class="forms-grids">
        <div class="col-md-4 forms-grid">
          <input name="edtCell" type="tel" id="edtCell"
onfocus="showHint('edtCell');" onblur="hideHint('edtCell'); validate_edtCell()"
 placeholder="Cell number"	
onkeypress="handleEnter(this, event)" 
 />
        </div>
        <div class="col-md-8">
          <div class="fieldHint" id="hint_edtCell">This person's contact number.</div>
        </div>
        <div class="clearfix"> </div>
      </div>
    </div>
    <!-- edtCell //-->
    <p></p>
    <!--// selType -->
    <div class="container">
      <div class="forms-grids">
        <div class="col-md-4 forms-grid">
          <div class="dropdown">
            <select name="selType" type="select" id="selType"
onfocus="showHint('selType');" onblur="hideHint('selType'); validate_selType()"
onkeypress="handleEnter(this, event)" 
>
              <?php echo(SableDBFunctions::getOptions("access", "access_id", "access_name", -1)); ?>
            </select>
          </div>
        </div>
        <div class="col-md-8">
          <div class="fieldHint" id="hint_selType">Please select this user's privilege level.</div>
        </div>
        <div class="clearfix"> </div>
      </div>
    </div>
    <!-- selType //-->
    <p></p>
    <!--// selBranch -->
    <div class="container">
      <div class="forms-grids">
        <div class="col-md-4 forms-grid">
          <div class="dropdown">
            <select name="selBranch" type="select" id="selBranch"
onfocus="showHint('selBranch');" onblur="hideHint('selBranch'); validate_selBranch()"
onkeypress="handleEnter(this, event)" 
>
              <?php echo(SableDBFunctions::getOptions("company", "company_id", "company_name", -1)); ?>
            </select>
          </div>
        </div>
        <div class="col-md-8">
          <div class="fieldHint" id="hint_selBranch">Please select this user's company/branch.</div>
        </div>
        <div class="clearfix"> </div>
      </div>
    </div>
    <!-- selBranch //-->    
    <p></p>
    <!--// edtIDNo -->
    <div class="container">
      <div class="forms-grids">
        <div class="col-md-4 forms-grid">
          <input name="edtIDNo" type="text" id="edtIDNo"
onfocus="showHint('edtIDNo');" onblur="hideHint('edtIDNo'); validate_edtIDNo()"
 placeholder="ID number"	
onkeypress="handleEnter(this, event)" 
 />
        </div>
        <div class="col-md-8">
          <div class="fieldHint" id="hint_edtIDNo">The person's 13 digit RSA ID number.</div>
        </div>
        <div class="clearfix"> </div>
      </div>
    </div>
    <!-- edtIDNo //-->
    <p></p>
    <!--// edtPwd -->
    <div class="container">
      <div class="forms-grids">
        <div class="col-md-4 forms-grid">
          <input name="edtPwd" type="password" id="edtPwd"
onfocus="showHint('edtPwd');" onblur="hideHint('edtPwd'); validate_edtPwd()"
 placeholder="Password"	
onkeypress="handleEnter(this, event)" 
 />
        </div>
        <div class="col-md-8">
          <div class="fieldHint" id="hint_edtPwd">The password used to access the system.</div>
        </div>
        <div class="clearfix"> </div>
      </div>
    </div>
    <!-- edtPwd //-->
    <p></p>
    <!--// edtConfirm -->
    <div class="container">
      <div class="forms-grids">
        <div class="col-md-4 forms-grid">
          <input name="edtConfirm" type="password" id="edtConfirm"
onfocus="showHint('edtConfirm');" onblur="hideHint('edtConfirm'); validate_edtConfirm()"
 placeholder="Confirm password"	
onkeypress="handleEnter(this, event)" 
 />
        </div>
        <div class="col-md-8">
          <div class="fieldHint" id="hint_edtConfirm">The password needs to be confirmed.</div>
        </div>
        <div class="clearfix"> </div>
      </div>
    </div>
    <!-- edtConfirm //-->
    <p></p>
    <!--// buttons -->
    <div class="container">
      <div class="forms-grids">
        <div class="col-md-2 forms-grid">
          <input type="button" id="btnCancel" value="Cancel"
class="submit" onclick="window.location = '<?php echo(SABLE_URL_ROOT); ?>'"/>
        </div>
        <div class="col-md-2 forms-grid">
          <input id="btnOk" type="button" onclick="insertUser()" value="Register" class="submit"/>
        </div>
      </div>
    </div>
    <!-- buttons //-->   
  </div>
</form>
<!-- User //-->