{if $billingFirstName neq '' && $billingLastName neq '' && $billingAddress neq '' && $billingCountryID neq '' && $billingStateID neq '' && $billingCity neq '' && $billingEmail neq ''&& $billingPhone neq ''}
{assign var="default_billing" value="show"}
{else}
{assign var="default_billing" value=""}
{/if}

{form->start name="formCheckoutBilling" method="post" action="" formType="ajax_form"}

<div class="content">
<h2 class="mb-4">{$language.lblBillinginfo}</h2>

{*    <h3 class="heading"> <span>{$language.lblChange}</span>{$language.lblPersonalInformation}</h3> *}
    <div class="content-block light-bg">
       
        <div class="content-address-block" id="billing_address_block" style="display:{if $default_billing|default:''!=''} block{else}none{/if}">
            <div class="row">
                <div class="col-md-4 col-sm-6 col-xs-6 addr-section mb-3 mb-sm-0 mb-md-0">
                    <div class="address-block">
                        <div class="address-top">
                        {* <div class="select-default">{$language.lblDefaultAddress}</div> *}
                        <div class="name">{$billingFirstName} {$billingLastName}</div>
                        <div class="address">{$billingAddress}<br/>
                            {$billingAddress1}
                            {$billingCity}
                                - {$billingZip}<br/>
                                {$billingStateName}<br>
                                {$billingCountryName}
                        </div>
                        {if $billingPhone}
                        <div class="phone">{$language.lblPhoneNo}: {if $billCountrycode neq ''}{$billCountrycode} - {/if}{$billingPhone}</div>
                        {/if}
                        <div class="update clearfix">
                            <a class="edit float-left bsfc" id="editBilling">{$language.lblEdit} </a>
                            <a class="delete float-right bsfc" id="deleteBilling">{$language.lblDelete}</a>
                        </div>
                        </div> 
                        <div class="address-use">
                            {$language.lblUsethisAddress}
                        </div>
                    </div>
                </div>
                <div class="col-md-4 col-xs-6 addr-section">
                    <div class="address-block">
                        <div class="new-address vh-align" id="addNewAddress">
                            <div class="clearfix">
                            <span class="icon-add"></span>
                            <p>{$language.lblAddNewAddress}</p>
                            </div>
                        </div>
                    </div>
                </div>
                
            </div>
        </div>
      
        <div class="content-top-block" id="billing_address_edit_block" style="display:{if $default_billing|default:''==''} block{else}none{/if}">
  <div class="row">
    <div class="form-group col-sm-6 col-12" id="divPayBillingFName">
      <label>{$language.lblFirstName} <span class="mndty">*</span></label>
      {form->textbox name="billingFirstName" class="form-control form-control-md"  validate="required" error=$language.errFirstName maxlength="200" value=$billingFirstName} </div>
    <div class="form-group col-sm-6 col-12" id="divPayBillingLName">
      <label>{$language.lblLastName} <span class="mndty">*</span></label>
      {form->textbox name="billingLastName" class="form-control form-control-md"  validate="required" error=$language.errLastName maxlength="200" value=$billingLastName} </div>
       </div>
      <div class="row">
    <div class="form-group col-sm-12 col-12" id="divPayBillingAddress">
      <label>{$language.lblAddress1} <span class="mndty">*</span></label>
      {form->textbox name="billingAddress" class="form-control form-control-md"  validate="required" error=$language.errBillingAddress maxlength="200"}
      {form->hidden name="billingErrorMessages" value=$language.errBillingAddress|cat:"||"|cat:$language.errCityName|cat:"||"|cat:$language.errCountry|cat:"||"|cat:$language.errState|cat:"||"|cat:$language.errProvince|cat:"||"|cat:$language.errZipCode|cat:"||"|cat:$language.errAgreement} </div> 
    
{*     <div class="form-group col-sm-12 col-xs-12" id="divPayBillingAddress1">
      <label>{$language.lblAddress2} </label>
      {form->textbox name="billingAddress1" class="form-control" maxlength="200"} </div> *}
 </div>
      <div class="row">
    <div class="form-group  col-sm-6 col-12" id="divPayBillingCountry">
      <label>{$language.lblCountry} <span class="mndty text-secondary">*</span></label>
      {form->select class="form-control form-control form-control-md" name="billingCountry" caption="->{$language.lblselectCountry}" validate="required" error=$language.errCountry options=$resListCountryOptions}{form->hidden name="billingCountryID" value=$billingCountryID} 
    </div>
    <div class="form-group col-sm-6 col-12" id="divPayBillingState">
      <label>{$language.lblStateProvince} <span class="mndty">*</span> </label>
      <span id="stateInput"> {form->select  class="form-control form-control-md" name="billingState" options="->{$language.lblselecttext}" validate="stateSelectedType->isequal->state~*required" error=$language.errState}
      {*form->hidden name="hidStateError" value=$language.errState*} </span> <span id="stateProvinceInput"> {form->textbox  name="billingProvince" maxlength="100" class="form-control form-control-md" validate="stateSelectedType->isequal->province~*required"  error=$language.errProvince}
      {*form->hidden name="hidProvinceError" value=$language.errProvince*} </span><span id="loadProcessImage"></span> {form->hidden id="stateSelectedType"  name="stateSelectedType" value=$stateSelectedType}{form->hidden name="billingStateID" value=$billingState} </div>
  </div>
  <div class="row">
    <div class="form-group col-sm-6 col-12" id="divPayBillingCity">
      <label>{$language.lblCity} <span class="mndty">*</span></label>
      {form->textbox name="billingCity" class="form-control form-control-md" validate="required" error=$language.errCityName maxlength="50"} </div>
    <div class="form-group col-sm-6 col-12" id="divPayBillingZip">
      <label>{$language.lblZipPostalCode} <span class="mndty">*</span> </label>
      {form->textbox name="billingZip" class="form-control form-control-md" validate="required" error=$language.errZipCode maxlength="20"} </div>
  </div>
      <div class="row">
{*     <div class="form-group col-sm-12 col-xs-12" id="divPayBillingPhone">
      <label>{$language.lblContactPhone} </label>
      {form->textbox name="billingPhone" class="form-control form-control-md" maxlength="20"} </div> *}
           <div class="form-group col-sm-6 col-12" id="divPayBillingEmail">
      <label>{$language.lblEmail} <span class="mndty">*</span> </label>
      {form->textbox name="billingEmail" class="form-control form-control-md" validate="required~*email" error=$language.errInvalidEmail maxlength="30"} </div>
      <div class="form-group col-sm-6 col-12" id="divPayBillingPhone">
      <label>{$language.lblContactPhone} <span class="mndty">*</span></label> 
          <div class="row">

            <div class="col-4 pr-0">
              {form->select class="form-control  form-control-md"  name="billCountrycode"   options=$resCountryCode value=$billCountrycode}

              </div>
              <div class="col-8">
       {form->textbox name="billingPhone" class="form-control form-control-md" maxlength="10" validate="required" error=$language.errPhone} </div>
              
              </div>
          </div>
  </div>
   {* <div class="make-default clearfix form-group">
        <input type="checkbox" name="makePrimary" id="makePrimary" />
        <label for="makePrimary">{$language.lblMakeDefault}</label>
    </div>  *}
            </div>
        
          <div class="clearfix">
      {form->button name="submitCheckoutBilling" value=$language.lblContinue class="btn btn-primary btn-arw btn-lg" style="margin-right:20px;"}
  </div>
 
        </div>
   
  <div class="inline-div mt-4" id="divPayCopyAddress"> 
      {form->checkbox name="billingshippingSame" class="chkbx2"}
      <label for="billingshippingSame" class="text-dark font-medium">{$language.lblShipping2Diff}</label>
      </div> 


</div>
       

{form->close}
{form->validate_script form="formCheckoutBilling"}