{*
* 2007-2016 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
*  @author    LD
*  @copyright 2015 LD
*  @version   1.0.0
*  @link      http://www.ld.com.br/
*  @license
*
*  Based on the following version
* 
*  @author    DJTAL
*  @copyright 2017 DJTAL
*  @version   1.0.0
*  @link      http://www.djtal.com.br/
*}


{extends 'customer/page.tpl'}

{block name='page_title'}
  {l s='Brazilian fiscal information' mod='ldbrazilianregister'}
{/block}

{block name='page_content'}
	<div>
		{if isset($confirmation) && $confirmation}
			<p class="alert alert-success">
				{l s='Your Brazilian fiscal information has been successfully updated.' mod='ldbrazilianregister'}
			</p>
		{/if}
		
		<p class="info-title">
			{l s='Please be sure to update your personal information if it has changed.' mod='ldbrazilianregister'}
		</p>
		<form id="fiscalInformationForm" action="{$link->getModuleLink('ldbrazilianregister', 'fiscalinformation')|escape:'html':'UTF-8'}" method="post" class="std">
			<section>
				{if $br_show_cpf}
                    {if $br_document_cpf != '' || $br_document_cnpj == ''}
					<div class="form-group row">
						<label class="col-md-3 form-control-label" for="br_document_cpf">
							{l s='CPF' mod='ldbrazilianregister' }
						</label>
						<div class="col-md-6 ">
						<input {if $customer_permissions == 'none' || ($customer_permissions == 'add' && !empty($br_document_cpf))}disabled="disabled"{/if} class="validate form-control" type="text" id="br_document_cpf" name="br_document_cpf" data-validate="isCPF" {if !empty($br_document_cpf)}value="{LDbrazilianregister::mascaraString('###.###.###-##', $br_document_cpf)|escape:'htmlall':'UTF-8'}"{/if} />
					</div>
					<div class="col-md-3 form-control-comment" >
						{if $customer_permissions == 'none' || ($customer_permissions == 'add' && !empty($br_document_cpf))}{l s='You cannot change your CPF' mod='ldbrazilianregister' }{/if}
					</div>
					</div>
				{/if}
                {/if}
				
				{if $br_show_cnpj}
                    {if $br_document_cnpj != '' || $br_document_cpf == ''}
					<div class="form-group row">
						<label class="col-md-3 form-control-label" for="br_document_cnpj">
							{l s='CNPJ' mod='ldbrazilianregister' }
						</label>
						<div class="col-md-6 ">
						<input {if $customer_permissions == 'none' || ($customer_permissions == 'add' && !empty($br_document_cnpj))}disabled="disabled"{/if} class="validate form-control" type="text" id="br_document_cnpj" name="br_document_cnpj" data-validate="isCNPJ" {if !empty($br_document_cnpj)}value="{LDbrazilianregister::mascaraString('##.###.###/####-##', $br_document_cnpj)|escape:'htmlall':'UTF-8'}"{/if} />
					</div>
					<div class="col-md-3 form-control-comment" >
						{if $customer_permissions == 'none' || ($customer_permissions == 'add' && !empty($br_document_cnpj))}{l s='You cannot change your CNPJ' mod='ldbrazilianregister' }{/if}
					</div>
					</div>
				{/if}
                {/if}
				
				{if $br_show_passport}
                {if $br_document_cpf != ''}
					<div class="form-group row">
						<label class="col-md-3 form-control-label" for="br_document_passport">
							{l s='Passport' mod='ldbrazilianregister' }
						</label>
						<div class="col-md-6 ">
						<input {if $customer_permissions == 'none' || ($customer_permissions == 'add' && !empty($br_document_passport))}disabled="disabled"{/if} class="validate form-control" type="text" id="br_document_passport" name="br_document_passport" data-validate="isPassport" {if !empty($br_document_passport)}value="{$br_document_passport|escape:'htmlall':'UTF-8'}"{/if} />
					</div>
					<div class="col-md-3 form-control-comment" >
						{if $customer_permissions == 'none' || ($customer_permissions == 'add' && !empty($br_document_passport))}{l s='You cannot change your Passport' mod='ldbrazilianregister' }{/if}
					</div>
					</div>
				{/if}
                {/if}
				
				{if $br_show_rg}
                {if $br_document_cpf != '' || $br_document_cnpj == ''}
					<div class="form-group row">
						<label class="col-md-3 form-control-label" for="br_document_rg">
							{l s='RG' mod='ldbrazilianregister' }
						</label>
						<div class="col-md-6 ">
						<input {if $customer_permissions == 'none' || ($customer_permissions == 'add' && !empty($br_document_rg))}disabled="disabled"{/if} class="validate form-control" type="text" id="br_document_rg" name="br_document_rg" data-validate="isRG" {if !empty($br_document_rg)}value="{$br_document_rg|escape:'htmlall':'UTF-8'}"{/if} />
					</div>
					<div class="col-md-3 form-control-comment" >
						{if $customer_permissions == 'none' || ($customer_permissions == 'add' && !empty($br_document_rg))}{l s='You cannot change your RG' mod='ldbrazilianregister' }{/if}
					</div>
					</div>
				{/if}
                {/if}
				
				{if $br_show_ie}
                {if $br_document_cnpj != '' || $br_document_cpf == ''}
					<div class="form-group row">
						<label class="col-md-3 form-control-label" for="br_document_ie">
							{l s='IE' mod='ldbrazilianregister' }
						</label>
						<div class="col-md-6 ">
						<input {if $customer_permissions == 'none' || ($customer_permissions == 'add' && !empty($br_document_ie))}disabled="disabled"{/if} class="validate form-control" type="text" id="br_document_ie" name="br_document_ie" data-validate="isIE" {if !empty($br_document_ie)}value="{$br_document_ie|escape:'htmlall':'UTF-8'}"{/if} />
					</div>
					<div class="col-md-3 form-control-comment" >
						{if $customer_permissions == 'none' || ($customer_permissions == 'add' && !empty($br_document_ie))}{l s='You cannot change your IE' mod='ldbrazilianregister' }{/if}
					</div>
					</div>
				{/if}
                {/if}
				
				{if $br_show_comp}
					<div class="form-group row">
						<label class="col-md-3 form-control-label" for="br_document_comp">
							{l s='Complementary Question' mod='ldbrazilianregister' }
						</label>
						<div class="col-md-6 ">
						<input {if $customer_permissions == 'none' || ($customer_permissions == 'add' && !empty($br_document_comp))}disabled="disabled"{/if} class="validate form-control" type="text" id="br_document_comp" name="br_document_comp" {if !empty($br_document_comp)}value="{$br_document_comp|escape:'htmlall':'UTF-8'}"{/if} />
					</div>
					<div class="col-md-3 form-control-comment" >
						{if $customer_permissions == 'none' || ($customer_permissions == 'add' && !empty($br_document_comp))}disabled="disabled"{/if}
					</div>
					</div>
				{/if}
			</section>
			<footer class="form-footer clearfix">
				<input type="hidden" name="submitFiscalInformation" value="1">

				<button class="btn btn-primary form-control-submit float-xs-right" type="submit">
					{l s='Save' mod='ldbrazilianregister'}
				</button>
			</footer>
		</form> <!-- .std -->
	</div>
{/block}
    
