{* Customer address creation / modification fields, used in the customer-edit.html template *}

{form_hidden_fields}

<input type="hidden" name="customer_id" value="{$customer_id}">
<input type="hidden" name="page" value="{$page}">

{form_field field='success_url'}
    <input type="hidden" name="{$name}" value="{url path='/admin/customer/update'} customer_id=$customer_id page=$page" />
{/form_field}

{render_form_field field='label'}
{render_form_field field='company'}


{custom_render_form_field field='title'}
    <select {form_field_attributes field='title'} >
        {loop type="title" name="title1"}
            <option value="{$ID}"{if $value == $ID} selected{/if}>{$LONG}</option>
        {/loop}
    </select>
{/custom_render_form_field}

<div class="row">
    <div class="col-sm-6">{render_form_field field="firstname"}</div>
    <div class="col-sm-6">{render_form_field field='lastname'}</div>
</div>

{render_form_field field='address1'}
{render_form_field field='address2' show_label=false}
{render_form_field field='address3' show_label=false}

<div class="row">
    <div class="col-md-4">{render_form_field field='zipcode'}</div>
    <div class="col-md-8">{render_form_field field='city'}</div>
</div>

<div class="row">
    <div class="col-sm-6">
        {$countryFieldId="{$dialog_type}-country"}
        {custom_render_form_field field='country' field_id=$countryFieldId}
            <select {form_field_attributes field='country' field_id=$countryFieldId}>
                <option value="">-- {intl l="Select Country"} --</option>
                {loop type="country" name="country.list" visible="*" order="alpha"}
                    <option value="{$ID}"
                        {if $value != ""}
                            {if $value == $ID}selected{/if}
                        {else}
                            {if $IS_DEFAULT}selected{/if}
                        {/if}
                    
                    >{$TITLE}</option>
                {/loop}
            </select>
        {/custom_render_form_field}
    </div>
    
    <div class="col-md-6 group-modal-state">
        {custom_render_form_field field='state' field_id="{$dialog_type}-state"}
            <select {form_field_attributes field='state' field_id="{$dialog_type}-state"}
                data-thelia-state="1" data-thelia-country="#{$countryFieldId}" data-thelia-toggle=".group-modal-state">
                <option value="">-- {intl l="Select State"} --</option>
                {loop type="state" name="state1" visible="*" order="alpha"}
                    <option value="{$ID}" data-country="{$COUNTRY}"
                        {if $value != ""}
                            {if $value == $ID}selected{/if}
                        {/if}
                    >{$TITLE}</option>
                {/loop}
            </select>
        {/custom_render_form_field}
    </div>
</div>

<div class="row">
    <div class="col-md-6">{render_form_field field='phone'}</div>
    <div class="col-md-6">{render_form_field field='cellphone'}</div>
</div>
