<?php

include( "client_func.php" );


$hddnClientId = $_SESSION[ 'caller' ][ 'args' ][ 1 ];

if ( $_SESSION[ 'user' ][ 'access_level' ] < SABLE_ACCESS_MANAGER )

{

  SableGeneralFunctions::divertFromPage();

}


?>
<script src="<?php SableGeneralFunctions::printModuleJS('client'); ?>"></script>
<?php include(SABLE_INCLUDES_PATH.'googleMaps.php'); ?>


<?php include(SABLE_INCLUDES_PATH.'ideal_postcodes.php'); ?>


<>

<!--// Client -->
<form id="frmClient" name="frmClient" autocomplete="on">
  <div class="forms">
    <div class="container forms-grids">
      <div class="row forms-grid">
        <div class="col-md-12">
          <h3 class="title"><i class="fa fa-plus" aria-hidden="true"></i>&nbsp;Add Client</h3>
          <p></p>
        </div>
      </div>
      
      <!--// edtClientName -->
      
      <div class="row forms-grid">
        <div class="col-md-4 forms-grid">
          <input name="edtClientName" type="text" id="edtClientName" onfocus="showHint('edtClientName'); validate_edtClientName();" onblur="hideHint('edtClientName');" placeholder="Name" onkeypress="handleEnter(this, event);" >
          <label for="edtClientName" class="fieldHint hintUnder" id="hint_edtClientName">Name</label>
        </div>
        <div class="col-md-4 forms-grid">
          <input name="edtClientSurname" type="text" id="edtClientSurname" onfocus="showHint('edtClientSurname'); validate_edtClientSurname();" onblur="hideHint('edtClientSurname');" placeholder="Surname" onkeypress="handleEnter(this, event);" >
          <label for="edtClientSurname" class="fieldHint hintUnder" id="hint_edtClientSurname">Surname</label>
        </div>
      </div>
      <div class="row forms-grid">
        <div class="col-md-4 forms-grid">
          <input name="edtClientPhone" type="text" id="edtClientPhone" onfocus="showHint('edtClientPhone'); validate_edtClientPhone();" onblur="hideHint('edtClientPhone');" placeholder="Phone No." onkeypress="handleEnter(this, event);" >
          <label for="edtClientPhone" class="fieldHint hintUnder" id="hint_edtClientPhone">Phone Number</label>
        </div>
        
        <!--// edtClientPhoneAlt -->
        <div class="col-md-4 forms-grid">
          <input name="edtClientPhoneAlt" type="text" id="edtClientPhoneAlt" onfocus="showHint('edtClientPhoneAlt');" onchange="validate_edtClientPhoneAlt();" onblur="hideHint('edtClientPhoneAlt'); validate_edtClientPhoneAlt();" placeholder="Alternative Phone No." onkeypress="handleEnter(this, event);" >
          <label for="edtClientPhoneAlt" class="fieldHint hintUnder" id="hint_edtClientPhoneAlt">Alternative Phone Number</label>
        </div>
      </div>
      <div class="row">
        <div class="col-md-4 forms-grid" style="padding:0;">
          <div class="col-md-12">
            <input name="edtClientEmail" type="email" id="edtClientEmail" onfocus="showHint('edtClientEmail'); validate_edtClientEmail();" onblur="hideHint('edtClientEmail');" placeholder="Email" onkeypress="handleEnter(this, event);" >
            <label for="edtClientEmail" class="fieldHint hintUnder" id="hint_edtClientEmail">Email</label>
          </div>
          
          <!-- edtClientPhoneAlt //-->
          <div class="col-md-12">
            <input name="edtClientIdNo" type="number" id="edtClientIdNo" class="mod"  onfocus="showHint('edtClientIdNo');" onchange="validate_edtClientIdNo();" onblur="hideHint('edtClientIdNo'); validate_edtClientIdNo();" placeholder="Client Id No." onkeypress="handleEnter(this, event);" >
            <label for="txtClientNote" class="fieldHint hintUnder" id="hint_edtClientIdNo">Client Identification Number</label>
          </div>
        </div>
        <div class="col-md-4 forms-grid">
          <textarea name="txtClientNote" type="date" id="txtClientNote" onfocus="showHint('txtClientNote'); validate_txtClientNote();" onblur="hideHint('txtClientNote');" placeholder="Client Note" onkeypress="handleEnter(this, event);" ></textarea>
          <label for="txtClientNote" class="fieldHint hintUnder" id="hint_txtClientNote">Client Note</label>
        </div>
      </div>
      <div class="row">
        <div class="col-md-4 forms-grid" style="padding:0;">
          <div class="col-md-12">
            <input type="text" id="edtClientTypeNatureName" name="edtClientTypeNatureName" placeholder="SEARCH..." onKeyUp="doClientTypeNatureRefinement(this)" style="border-bottom: none;" autocomplete="off"/>
          </div>
          <div class="col-md-12">
            <div class="dropdown">
              <select name="selClientTypeNatureId" type="select" id="selClientTypeNatureId" onfocus="showHint('selClientTypeNatureId');" onblur="hideHint('selClientTypeNatureId'); validate_selClientTypeNatureId()" onkeypress="handleEnter(this, event)" placeholder="ClientTypeNature" size="3" class="noArrow"  onClick="setClientTypeNatureName()">
                <?php echo(SableDBFunctions::getOptions("client_type_nature", "client_type_nature_id", "client_type_nature_name", -1)); ?>
              </select>
              <div class="fieldHint" id="hint_selClientTypeNatureId">Area</div>
            </div>
          </div>
        </div>
      </div>
              <div class="row">
        <div class="col-md-4 forms-grid" style="padding:0;">
          <div class="col-md-12">
            <input type="text" id="edtRewardLevelName" name="edtRewardLevelName" placeholder="SEARCH..." onKeyUp="doRewardLevelRefinement(this)" style="border-bottom: none;" autocomplete="off"/>
          </div>
          <div class="col-md-12">
            <div class="dropdown">
              <select name="selRewardLevelId" type="select" id="selRewardLevelId" onfocus="showHint('selRewardLevelId');" onblur="hideHint('selRewardLevelId'); validate_selRewardLevelId()" onkeypress="handleEnter(this, event)" placeholder="RewardLevel" size="3" class="noArrow"  onClick="setRewardLevelName()">
                <?php echo(SableDBFunctions::getOptions("reward_level", "reward_level_id", "reward_level_name", -1)); ?>
              </select>
              <div class="fieldHint" id="hint_selRewardLevelId">Area</div>
            </div>
          </div>
        </div>
      </div>
      <p></p>
      
      <!--// edtClientBusinessName -->
      <div class="row forms-grid">
        <div class="col-md-4 forms-grid">
          <input name="edtClientBusinessName" type="text" id="edtClientBusinessName" onfocus="showHint('edtClientBusinessName');" onchange="validate_edtClientBusinessName();" onblur="hideHint('edtClientBusinessName'); validate_edtClientBusinessName();" placeholder="Client Business Name" onkeypress="handleEnter(this, event);" >
          <div class="fieldHint" id="hint_edtClientBusinessName">Client Business Name</div>
        </div>
        <div class="col-md-4 forms-grid">
          <div class="switch">
            <input name="cbClientContract" type="checkbox" id="cbClientContract" class="form-toggle form-toggle-yes-no" onfocus="showHint('cbClientContract');" onblur="hideHint('cbClientContract');" checked placeholder="Client Contract" onkeypress="handleEnter(this, event)"/>
            <label for="cbClientContract" data-on="Yes" data-off="No"></label>
            <div class="fieldHint" id="hint_cbClientContract">Client Contract</div>
          </div>
        </div>
      </div>
      <p></p>
      <div class="row forms-grid">
        <div class="col-md-4 forms-grid">
          <input name="edtClientVatNo" type="number" id="edtClientVatNo" class="mod"  onfocus="showHint('edtClientVatNo');" onchange="validate_edtClientVatNo();" onblur="hideHint('edtClientVatNo'); validate_edtClientVatNo();" placeholder="Client Vat No" onkeypress="handleEnter(this, event);" >
          <div class="fieldHint" id="hint_edtClientVatNo">Client Vat No</div>
        </div>
        <div class="col-md-4 forms-grid">
          <input name="edtClientRegNo" type="number" id="edtClientRegNo" class="mod"  onfocus="showHint('edtClientRegNo');" onchange="validate_edtClientRegNo();" onblur="hideHint('edtClientRegNo'); validate_edtClientRegNo();" placeholder="Client Reg No" onkeypress="handleEnter(this, event);" >
          <div class="fieldHint" id="hint_edtClientRegNo">Client Reg No</div>
        </div>
      </div>
      <p></p>
      <div class="row forms-grid">
        <div class="col-md-12">
          <p></p>
          <h2><i class="fa fa-building" aria-hidden="true"></i>&nbsp;Building Details</h2>
        </div>
      </div>
      <div class="row">
        <div class="col-md-4 forms-grid" style="padding:0;">
          <div class="col-md-12">
            <input name="edtBuildingName" type="text" id="edtBuildingName" onfocus="showHint('edtBuildingName'); validate_edtBuildingName();" onblur="hideHint('edtBuildingName');" placeholder="Building Name" onkeypress="handleEnter(this, event);" >
            <div class="fieldHint" id="hint_edtBuildingName">Building Name</div>
          </div>
        </div>
      </div>
      <p></p>
      <div class="row">
        <div class="col-md-4 forms-grid" style="padding:0;">
          <div class="col-md-12">
            <input type="text" id="edtAreaName" name="edtAreaName" placeholder="SEARCH..." onKeyUp="doAreaRefinement(this)" style="border-bottom: none;" autocomplete="off"/>
          </div>
          <div class="col-md-12">
            <div class="dropdown">
              <select name="selAreaId" type="select" id="selAreaId" onfocus="showHint('selAreaId');" onblur="hideHint('selAreaId'); validate_selAreaId()" onkeypress="handleEnter(this, event)" placeholder="Area" size="3" class="noArrow"  onClick="setAreaName()">
                <?php echo(SableDBFunctions::getOptions("area", "area_id", "area_name", -1)); ?>
              </select>
              <div class="fieldHint" id="hint_selAreaId">Area</div>
            </div>
          </div>
          <div class="col-md-12">
            <input type="text" id="edtAddressTypeName" name="edtAddressTypeName" placeholder="SEARCH..." onKeyUp="doAddressTypeRefinement(this)" style="border-bottom: none;" autocomplete="off"/>
          </div>
          <div class="col-md-12">
            <div class="dropdown">
              <select name="selAddressTypeId" type="select" id="selAddressTypeId" onfocus="showHint('selAddressTypeId');" onblur="hideHint('selAddressTypeId'); validate_selAddressTypeId()" onkeypress="handleEnter(this, event)" placeholder="Address Type" size="3" class="noArrow"  onClick="setAddressTypeName()">
                <?php echo(SableDBFunctions::getOptions("address_type", "address_type_id", "address_type_name", -1)); ?>
              </select>
              <div class="fieldHint" id="hint_selAddressTypeId">Address Type</div>
            </div>
          </div>
        </div>
        <div class="col-md-4 forms-grid">
          <div class="col-md-12">
            <textarea name="txtBuildingNeeds" type="date" id="txtBuildingNeeds" onfocus="showHint('txtBuildingNeeds'); validate_txtBuildingNeeds();" onblur="hideHint('txtBuildingNeeds');" placeholder="Special Requirements" onkeypress="handleEnter(this, event);" ></textarea>
            <div class="fieldHint" id="hint_txtBuildingNeeds">Special Requirements</div>
          </div>
        </div>
      </div>
      <p></p>
      <div class="row">
        <div class="col-md-4 forms-grid" style="padding:0;">
          <div class="col-md-12">
            <input type="text" id="edtCountryName" name="edtCountryName" placeholder="SEARCH..." onKeyUp="doCountryRefinement(this)" style="border-bottom: none;" autocomplete="off"/>
          </div>
          <div class="col-md-12">
            <div class="dropdown">
              <select name="selCountryId" type="select" id="selCountryId" onfocus="showHint('selCountryId');" onblur="hideHint('selCountryId'); validate_selCountryId()" onkeypress="handleEnter(this, event)" placeholder="Country Name" size="6" class="noArrow"  onClick="setCountryName()">
                <?php echo(SableDBFunctions::getOptions("country", "country_id", "country_name", -1)); ?>
              </select>
              <div class="fieldHint" id="hint_selCountryId">Address Country Code</div>
            </div>
          </div>
        </div>
        <div class="col-md-4 forms-grid" style="padding:0;">
          <div class="col-md-12">
            <input type="text" id="edtSuburbName" name="edtSuburbName" placeholder="SEARCH..." onKeyUp="doSuburbRefinement(this)" style="border-bottom: none;" autocomplete="off"/>
          </div>
          <div class="col-md-12">
            <div class="dropdown">
              <select name="selPostId" type="select" id="selPostId" onfocus="showHint('selPostId');" onblur="hideHint('selPostId'); validate_selPostId()" onkeypress="handleEnter(this, event)" placeholder="Postal Code" size="6" class="noArrow"  onClick="setSuburbName()">
                <?php echo(SableDBFunctions::getOptions("postal_data", "post_id", "suburb_name", -1)); ?>
              </select>
              <div class="fieldHint" id="hint_selPostId">Address Postal Code</div>
            </div>
          </div>
        </div>
      </div>
      <p></p>
      <div class="col-md-4 forms-grid" style="padding:0;">
        <div class="col-md-12">
          <input name="edtAddressStreet" type="text" id="edtAddressStreet" onfocus="showHint('edtAddressStreet'); validate_edtAddressStreet();" onblur="hideHint('edtAddressStreet');" placeholder="Address Street" onkeypress="handleEnter(this, event);" >
          <label for="edtAddressStreet" class="fieldHint hintUnder" id="hint_edtAddressStreet">Address Street</label>
        </div>
        <p></p>
        <div class="col-md-12">
          <input name="edtAddressSuburb" type="text" id="edtAddressSuburb" onfocus="showHint('edtAddressSuburb'); validate_edtAddressSuburb();" onblur="hideHint('edtClientName');" placeholder="Address Suburb" onkeypress="handleEnter(this, event);" >
          <label for="edtedtAddressSuburb" class="fieldHint hintUnder" id="hint_edtAddressSuburb">Address Suburb</label>
        </div>
        <p></p>
        <div class="col-md-12">
          <input name="edtAddressCounty" type="text" id="edtAddressCounty" onfocus="showHint('edtAddressCounty'); validate_edtAddressCounty();" onblur="hideHint('edtAddressCounty');" placeholder="Address County" onkeypress="handleEnter(this, event);" >
          <label for="edtAddressCounty" class="fieldHint hintUnder" id="hint_edtAddressCounty">Address County</label>
        </div>
        <p></p>
        <div class="col-md-12">
          <input name="edtAddressCity" type="text" id="edtAddressCity" onfocus="showHint('edtAddressCity'); validate_edtAddressCity();" onblur="hideHint('edtAddressCity');" placeholder="Address City" onkeypress="handleEnter(this, event);" >
          <label for="edtAddressCity" class="fieldHint hintUnder" id="hint_edtAddressCity">Address City</label>
        </div>
        <p></p>
        <div class="col-md-12">
          <input name="edtAddressPostalCode" type="text" id="edtAddressPostalCode" onfocus="showHint('edtAddressPostalCode'); validate_edtAddressPostalCode();" onblur="hideHint('edtAddressPostalCode');" placeholder="Address Postal Code" onkeypress="handleEnter(this, event);" >
          <label for="edtAddressPostalCode" class="fieldHint hintUnder" id="hint_edtAddressPostalCode">Address Postal Code</label>
        </div>
      </div>
      <div class="col-md-4 forms-grid">
        <div class="switch">
          <input name="cbClientAddrBill" type="checkbox" id="cbClientAddrBill" class="form-toggle form-toggle-yes-no" onfocus="showHint('cbClientAddrBill');" onblur="hideHint('cbClientAddrBill');" checked placeholder="Same as billing address" onkeypress="handleEnter(this, event)"/>
          <label for="cbClientAddrBill" data-on="Yes" data-off="No"></label>
          <div class="fieldHint" id="hint_cbClientAddrBill">Same as billing address</div>
        </div>
      </div>
    </div>
    <p></p>
    <div class="row forms-grids">
      <div class="col-md-12 forms-grid">
        <div id="searchResults"></div>
      </div>
    </div>
    <p></p>
      
      <!-- container -->
<form>
    <h1>Address Form</h1>
    <label for="line_1">Address First Line</label><label>Search your Address</label>
    <div id="addressLookup"></div>
    <input type="text" id="line_1" />
    <label for="line_2">Address Second Line</label>
    <input type="text" id="line_2" />
    <label for="line_3">Address Third Line</label>
    <input type="text" id="line_3" />
    <label for="post_town">Town or City</label>
    <input type="text" id="post_town" />
    <label for="postcode">Postcode</label>
    <input type="text" id="postcode" />
</form>
      
          <p></p>

    <!--// buttons -->
    
    <div class="row forms-grid">
      <div class="col-md-2">
        <input type="button" id="btnCancel" value="Cancel"

					class="submit" onclick="window.location = '<?php SableSystem::printCallPageLink('/client/'); ?>'"/>
      </div>
      <div class="col-md-2 forms-grid">
        <input id="btnOk" type="button" onclick="insertClient();" value="Add Client" class="submit"/>
      </div>
    </div>
    
    <!-- buttons //-->
    
    <?php include(SABLE_INCLUDES_PATH.'googleMapsDisplay.php'); ?>
  </div>
  </div>
</form>



<!-- Client //--> 

