<?php
	include("company_func.php");
	$hddnCompanyId = $_SESSION['caller']['args'][1];
	if ($_SESSION['user']['access_level'] < 9)
	{
		if ((isset($hddnCompanyId)) && ($hddnCompanyId != $_SESSION['user']['user_code'])) SableGeneralFunctions::divertFromPage("company/view.php");
	}
	include(SABLE_INCLUDES_PATH.'googleMaps.php');
?>
<script src="<?php SableGeneralFunctions::printModuleJS('company'); ?>"></script>
<!--// Company -->
<form id="frmCompany" name="frmCompany" autocomplete="on">
	<div class="forms">
		<div class="container forms-grids">
        	<div class="row forms-grids">
                <div class="col-md-12 form-grid">
                    <h3 class="title"><i class="fa fa-user-plus" aria-hidden="true"></i>&nbsp;Register</h3>
                    <p></p>
                    <div class="clearfix"> </div>
                </div>
            </div>
        
        
		<div class="row forms-grids">
			<div class="col-md-12 form-grid">
				<h5 class="sub">Contact Information</h5>
				<p></p>
				<div class="clearfix"> </div>
			</div>
		</div>
        <p></p>
        
        <!--// Name & Surname -->   
        <div class="row forms-grids">
            <div class="col-xs-12 col-sm-10 col-md-8 col-lg-6 forms-grid">
                <input name="edtCompanyContactName" type="text" id="edtCompanyContactName" 
                onfocus="showHint('edtCompanyContactName');" onblur="hideHint('edtCompanyContactName'); 
                validate_edtCompanyContactName()" placeholder="Name" onkeypress="handleEnter(this, event)" />
                <label class="fieldHint hintUnder" id="hint_edtCompanyContactName">*First Name</label>
            </div>                
            <div class="col-xs-12 col-sm-10 col-md-8 col-lg-6 forms-grid">
                <input name="edtCompanyContactSurname" type="text" id="edtCompanyContactSurname" 
                onfocus="showHint('edtCompanyContactSurname');" onblur="hideHint('edtCompanyContactSurname');
                validate_edtCompanyContactSurname()" placeholder="Surname" onkeypress="handleEnter(this, event)" />
                <label class="fieldHint hintUnder" id="hint_edtCompanyContactSurname">*Surname</label>
            </div>                  
        </div>        
    
         <!--// Email & Phone -->   
        <div class="row forms-grids">
            <div class="col-xs-12 col-sm-10 col-md-8 col-lg-6 forms-grid">
                <input name="edtCompanyContactEmail" type="email" id="edtCompanyContactEmail" onfocus="showHint('edtCompanyContactEmail');" 
                        onblur="hideHint('edtCompanyContactEmail'); validate_edtCompanyContactEmail()" placeholder="Email" 
                        onkeypress="handleEnter(this, event)" />
                <label class="fieldHint hintUnder" id="hint_edtCompanyContactEmail">*Contact email address.</label>
            </div>                
            <div class="col-xs-12 col-sm-10 col-md-8 col-lg-6 forms-grid">
                <input name="edtCompanyContactPhone" type="text" id="edtCompanyContactPhone" onfocus="showHint('edtCompanyContactPhone');" 
                            onblur="hideHint('edtCompanyContactPhone'); validate_edtCompanyContactPhone()" placeholder="Phone" 
                            onkeypress="handleEnter(this, event)" />
                <label class="fieldHint hintUnder" id="hint_edtCompanyContactPhone">*Contact phone number.</label>
            </div>                  
        </div>
        <p></p>
        
		<div class="row forms-grids">
			<div class="col-md-12 form-grid">
				<h5 class="sub">Business Information</h5>
				<p></p>
				<div class="clearfix"> </div>
			</div>
		</div>
        <p></p>        
        
         <!--// Company Name & Company URL -->   
        <div class="row forms-grids">
            <div class="col-xs-12 col-sm-10 col-md-8 col-lg-6 forms-grid">
                <input name="edtCompanyName" type="text" id="edtCompanyName" onfocus="showHint('edtCompanyName');" 
                        onblur="hideHint('edtCompanyName'); validate_edtCompanyName()" placeholder="Company" 
                        onkeypress="handleEnter(this, event)" />
                <label class="fieldHint hintUnder" id="hint_edtCompanyName">*Name of the business.</label>
            </div>
            <div class="col-xs-12 col-sm-10 col-md-8 col-lg-6 forms-grid">
                <input name="edtCompanyUrl" type="text" id="edtCompanyUrl" onfocus="showHint('edtCompanyUrl');" 
                        onblur="hideHint('edtCompanyUrl');" placeholder="Website" 
                        onkeypress="handleEnter(this, event)" />
                <label class="fieldHint hintUnder" id="hint_edtCompanyUrl">Business website.</label>
            </div>                 
        </div>
        
         <!--// Email & Phone -->   
        <div class="row forms-grids">
            <div class="col-xs-12 col-sm-10 col-md-8 col-lg-6 forms-grid">
                <input name="edtCompanyEmail" type="email" id="edtCompanyEmail" onfocus="showHint('edtCompanyEmail');" 
                        onblur="hideHint('edtCompanyEmail'); validate_edtCompanyEmail()" placeholder="Email" 
                        onkeypress="handleEnter(this, event)" />
                <label class="fieldHint hintUnder" id="hint_edtCompanyEmail">*Email address.</label>
            </div>                
            <div class="col-xs-12 col-sm-10 col-md-8 col-lg-6 forms-grid">
                <input name="edtCompanyPhone" type="text" id="edtCompanyPhone" onfocus="showHint('edtCompanyPhone');" 
                            onblur="hideHint('edtCompanyPhone'); validate_edtCompanyPhone()" placeholder="Phone" 
                            onkeypress="handleEnter(this, event)" />
                <label class="fieldHint hintUnder" id="hint_edtCompanyPhone">*Phone number.</label>
            </div>                  
        </div>        
        
         <!--// edtCompanyAddress -->   
        <div class="row forms-grids">
            <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 forms-grid">
                <textarea name="edtCompanyAddress" type="textarea" id="edtCompanyAddress" onfocus="showHint('edtCompanyAddress');" 
                onblur="hideHint('edtCompanyAddress'); validate_edtCompanyAddress()" placeholder="Physical address." 
                onChange="updateMapData();" ></textarea>
                <label class="fieldHint hintUnder" id="hint_edtCompanyAddress">*Business address.</label>
            </div>                 
        </div>
        <div class="row forms-grids">
            <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 forms-grid">
            	<div id="searchResults"></div>
            </div>
        </div>
        
        <!--// edtCompanyRegNo & edtCompanyVatNo-->
        <p></p>
        <div class="row forms-grids">
            <div class="col-xs-12 col-sm-10 col-md-8 col-lg-6 forms-grid">
                <input name="edtCompanyRegNoYear" type="number" maxlength="4" max="<?php echo(date('Y')); ?>" min="1900" 
                		id="edtCompanyRegNoYear" onfocus="showHint('edtCompanyRegNo');" onblur="hideHint('edtCompanyRegNo');
                        validate_edtCompanyRegNoYear()" onkeypress="handleEnter(this, event)" style="width:25%;" 
                        placeholder="1900"/>&nbsp;/&nbsp;
                <input name="edtCompanyRegNoMid" type="number" maxlength="6" min="1" id="edtCompanyRegNoMid" 
                		onfocus="showHint('edtCompanyRegNo');" onblur="hideHint('edtCompanyRegNo'); validate_edtCompanyRegNoMid()" 
                        onkeypress="handleEnter(this, event)"  style="width:35%;" 
                        placeholder="123456"/>&nbsp;/&nbsp;
                <input name="edtCompanyRegNoType" type="number" maxlength="2" max="30" min="6" id="edtCompanyRegNoType" 
                		onfocus="showHint('edtCompanyRegNo');" onblur="hideHint('edtCompanyRegNo'); validate_edtCompanyRegNoType()" 
                        onkeypress="handleEnter(this, event)"  style="width:25%;" 
                        placeholder="07"/>
                <label class="fieldHint hintUnder" id="hint_edtCompanyRegNo">*Company Registration No.</label>
            </div>
            <div class="col-xs-12 col-sm-10 col-md-8 col-lg-6 forms-grid">
				<input name="edtCompanyVatNo" type="number" id="edtCompanyVatNo" onfocus="showHint('edtCompanyVatNo');" 
                onblur="hideHint('edtCompanyVatNo'); validate_edtCompanyVatNo()" placeholder="VAT No." 
                onkeypress="handleEnter(this, event)" /> 
                <label class="fieldHint hintUnder" id="hint_edtCompanyVatNo">VAT No.</label>           
            </div>
        </div>
        <!-- edtCompanyRegNo //-->        
        <p></p>
        
         <!--// Password + Confirmation -->   
        <div class="row forms-grids">
            <div class="col-xs-12 col-sm-10 col-md-8 col-lg-6 forms-grid">
                <input name="edtPwd" type="password" id="edtPwd"
                onfocus="showHint('edtPwd');" onblur="hideHint('edtPwd'); validate_edtPwd()"
                placeholder="Password" onkeypress="handleEnter(this, event)" />
                <label class="fieldHint hintUnder" id="hint_edtPwd">Password (optional)</label>
            </div>                
            <div class="col-xs-12 col-sm-10 col-md-8 col-lg-6 forms-grid">
                <input name="edtConfirm" type="password" id="edtConfirm"
                onfocus="showHint('edtConfirm');" onblur="hideHint('edtConfirm'); validate_edtConfirm()"
                placeholder="Confirm password"	onkeypress="handleEnter(this, event)" />
                <label class="fieldHint hintUnder" id="hint_edtConfirm">Confirm Password</label>
            </div>                  
        </div>
        
        <div class="row forms-grids">
            <div class="col-xs-12 col-sm-10 col-md-8 col-lg-6 forms-grid">
                <label class="holder">*I accept the <a class="link_contrast" href="<?php echo($legal); ?>" target="new">Terms &amp; Conditions</a>
                    <input name="cbAgree" type="checkbox" id="cbAgree" onfocus="showHint('cbAgree');" 
                  onblur="hideHint('cbAgree')" />        
                    <span class="checkmark"></span>
                </label>
                <label class="fieldHint hintUnder" id="hint_cbAgree"></label>
            </div>
        </div>        

		<p></p>
    	<!--// buttons -->
        <div class="row 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="submitRegistration()" value="Register" class="submit"/>
            </div>
        </div>
		<!-- buttons //-->
        </div>
	</div>
</form>
<!-- Company //-->
<?php include(SABLE_INCLUDES_PATH.'googleMapsDisplay.php'); ?>