<div id="shipping_address" class="modal fade">
  <div class="modal-dialog modal-lg">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true"><i class="fa fal fa-close"></i></button>
        <h4 class="modal-title">{{ text_checkout_shipping_address }}</h4>
      </div>
      <div class="modal-body">
        <form class="form-horizontal">
          <div class="form-group required">
            <label class="col-sm-2 control-label" for="input_shipping_firstname">{{ entry_firstname }}</label>
            <div class="col-sm-10">
              <input type="text" name="firstname" value="{{ shipping_address['firstname'] }}" placeholder="{{ entry_firstname }}" id="input_shipping_firstname" class="form-control"/>
            </div>
          </div>
          <div class="form-group required">
            <label class="col-sm-2 control-label" for="input_shipping_lastname">{{ entry_lastname }}</label>
            <div class="col-sm-10">
              <input type="text" name="lastname" value="{{ shipping_address['lastname'] }}" placeholder="{{ entry_lastname }}" id="input_shipping_lastname" class="form-control"/>
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-2 control-label" for="input_shipping_company">{{ entry_company }}</label>
            <div class="col-sm-10">
              <input type="text" name="company" value="{{ shipping_address['company'] }}" placeholder="{{ entry_company }}" id="input_shipping_company" class="form-control"/>
            </div>
          </div>
          <div class="form-group required">
            <label class="col-sm-2 control-label" for="input_shipping_address-1">{{ entry_address_1 }}</label>
            <div class="col-sm-10">
              <input type="text" name="address_1" value="{{ shipping_address['address_1'] }}" placeholder="{{ entry_address_1 }}" id="input_shipping_address-1" class="form-control"/>
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-2 control-label" for="input_shipping_address-2">{{ entry_address_2 }}</label>
            <div class="col-sm-10">
              <input type="text" name="address_2" value="{{ shipping_address['address_2'] }}" placeholder="{{ entry_address_2 }}" id="input_shipping_address-2" class="form-control"/>
            </div>
          </div>
          <div class="form-group required">
            <label class="col-sm-2 control-label" for="input_shipping_city">{{ entry_city }}</label>
            <div class="col-sm-10">
              <input type="text" name="city" value="{{ shipping_address['city'] }}" placeholder="{{ entry_city }}" id="input_shipping_city" class="form-control"/>
            </div>
          </div>
          <div class="form-group required">
            <label class="col-sm-2 control-label" for="input_shipping_postcode">{{ entry_postcode }}</label>
            <div class="col-sm-10">
              <input type="text" name="postcode" value="{{ shipping_address['postcode'] }}" placeholder="{{ entry_postcode }}" id="input_shipping_postcode" class="form-control"/>
            </div>
          </div>
          <div class="form-group required">
            <label class="col-sm-2 control-label" for="input_shipping_country">{{ entry_country }}</label>
            <div class="col-sm-10">
              <select name="country_id" id="input_shipping_country" class="form-control">
                <option value="">{{ text_select }}</option>
                {% for country in countries %}
                	{% if country['country_id'] == shipping_address['country_id'] %}
                		<option value="{{ country['country_id'] }}" selected="selected">{{ country['name'] }}</option>
                	{% else %}
                		<option value="{{ country['country_id'] }}">{{ country['name'] }}</option>
                	{% endif %}
                {% endfor %}
              </select>
            </div>
          </div>
          <div class="form-group required">
            <label class="col-sm-2 control-label" for="input_shipping_zone">{{ entry_zone }}</label>
            <div class="col-sm-10">
              <select name="zone_id" id="input_shipping_zone" class="form-control"></select>
            </div>
          </div>
          {% for custom_field in custom_fields %}
          	{% if custom_field['location'] == 'address' %}
          		{% if custom_field['type'] == 'select' %}
          			<div id="shipping_custom_field{{ custom_field['custom_field_id'] }}" class="form-group custom-field" data-sort="{{ custom_field['sort_order'] }}">
            			<label class="control-label" for="input_shipping_custom_field{{ custom_field['custom_field_id'] }}">{{ custom_field['name'] }}</label>
            			<select name="custom_field[{{ custom_field['location'] }}][{{ custom_field['custom_field_id'] }}]" id="input_shipping_custom_field{{ custom_field['custom_field_id'] }}" class="form-control">
              			<option value="">{{ text_select }}</option>
              			{% for custom_field_value in custom_field['custom_field_value'] %}
              				{% if shipping_address['custom_field'][custom_field['custom_field_id']] and custom_field_value['custom_field_value_id'] == shipping_address['custom_field'][custom_field['custom_field_id']] %}
              				{% else %}
              					<option value="{{ custom_field_value['custom_field_value_id'] }}">{{ custom_field_value['name'] }}</option>
              				{% endif %}
              			{% endfor %}
            			</select>
          			</div>
          		{% endif %}
          		{% if custom_field['type'] == 'radio' %}
          			<div id="shipping_custom_field{{ custom_field['custom_field_id'] }}" class="form-group custom_field" data-sort="{{ custom_field['sort_order'] }}">
            			<label class="control-label">{{ custom_field['name'] }}</label>
            			<div id="input_shipping_custom_field{{ custom_field['custom_field_id'] }}">
              			{% for custom_field_value in custom_field['custom_field_value'] %}
              				<div class="radio">
                				{% if shipping_address['custom_field'][custom_field['custom_field_id']] and custom_field_value['custom_field_value_id'] == shipping_address['custom_field'][custom_field['custom_field_id']] %}
                				<label><input type="radio" name="custom_field[{{ custom_field['location'] }}][{{ custom_field['custom_field_id'] }}]" value="{{ custom_field_value['custom_field_value_id'] }}" checked="checked"/>{{ custom_field_value['name'] }}</label>
                				{% else %}
                					<label><input type="radio" name="custom_field[{{ custom_field['location'] }}][{{ custom_field['custom_field_id'] }}]" value="{{ custom_field_value['custom_field_value_id'] }}"/>{{ custom_field_value['name'] }}</label>
                				{% endif %}
              				</div>
              			{% endfor %}
            			</div>
          			</div>
          		{% endif %}
          		{% if custom_field['type'] == 'checkbox' %}
								<div id="shipping_custom_field{{ custom_field['custom_field_id'] }}" class="form-group custom-field" data-sort="{{ custom_field['sort_order'] }}">
            			<label class="control-label">{{ custom_field['name'] }}</label>
            			<div id="input_shipping_custom_field{{ custom_field['custom_field_id'] }}">
              			{% for custom_field_value in custom_field['custom_field_value'] %}
              				<div class="checkbox">
                				{% if shipping_address['custom_field'][custom_field['custom_field_id']] and custom_field_value['custom_field_value_id'] in shipping_address['custom_field'][custom_field['custom_field_id']] %}
                					<label><input type="checkbox" name="custom_field[{{ custom_field['location'] }}][{{ custom_field['custom_field_id'] }}][]" value="{{ custom_field_value['custom_field_value_id'] }}" checked="checked"/>{{ custom_field_value['name'] }}</label>
                				{% else %}
                					<label><input type="checkbox" name="custom_field[{{ custom_field['location'] }}][{{ custom_field['custom_field_id'] }}][]" value="{{ custom_field_value['custom_field_value_id'] }}"/>{{ custom_field_value['name'] }}</label>
                				{% endif %}
              				</div>
              			{% endfor %}
            			</div>
          			</div>
          		{% endif %}
          		{% if custom_field['type'] == 'text' %}
          			<div id="shipping_custom_field{{ custom_field['custom_field_id'] }}" class="form-group custom-field" data-sort="{{ custom_field['sort_order'] }}">
            			<label class="control-label" for="input_shipping_custom_field{{ custom_field['custom_field_id'] }}">{{ custom_field['name'] }}</label>
            			<input type="text" name="custom_field[{{ custom_field['location'] }}][{{ custom_field['custom_field_id'] }}]" value="{% if shipping_address['custom_field'][custom_field['custom_field_id']] %} {{ shipping_address['custom_field'][custom_field['custom_field_id']] }} {% else %} {{ custom_field['value'] }} {% endif %}" placeholder="{{ custom_field['name'] }}" id="input_shipping_custom_field{{ custom_field['custom_field_id'] }}" class="form-control"/>
          			</div>
          		{% endif %}
          		{% if custom_field['type'] == 'textarea' %}
          			<div id="shipping_custom_field{{ custom_field['custom_field_id'] }}" class="form-group custom-field" data-sort="{{ custom_field['sort_order'] }}">
            			<label class="control-label" for="input_shipping_custom_field{{ custom_field['custom_field_id'] }}">{{ custom_field['name'] }}</label>
            			<textarea name="custom_field[{{ custom_field['location'] }}][{{ custom_field['custom_field_id'] }}]" rows="5" placeholder="{{ custom_field['name'] }}" id="input_shipping_custom_field{{ custom_field['custom_field_id'] }}" class="form-control">{% if shipping_address['custom_field'][custom_field['custom_field_id']] %} {{ shipping_address['custom_field'][custom_field['custom_field_id']] }} {% else %} {{ custom_field['value'] }} {% endif %}</textarea>
          			</div>
          		{% endif %}
          		{% if custom_field['type'] == 'file' %}
          			<div id="shipping_custom_field{{ custom_field['custom_field_id'] }}" class="form-group custom-field" data-sort="{{ custom_field['sort_order'] }}">
            			<label class="control-label">{{ custom_field['name'] }}</label>
            			<br/>
            			<button type="button" id="button_shipping_custom_field{{ custom_field['custom_field_id'] }}" data-loading-text="{{ text_loading }}" class="btn btn-default"><i class="fa fa-upload"></i> {{ button_upload }}</button>
            			<input type="hidden" name="custom_field[{{ custom_field['location'] }}][{{ custom_field['custom_field_id'] }}]" value="{% if shipping_address['custom_field'][custom_field['custom_field_id']] %} {{ shipping_address['custom_field'][custom_field['custom_field_id']] }} {% endif %}" id="input_shipping_custom_field{{ custom_field['custom_field_id'] }}"/>
          			</div>
          		{% endif %}
          		{% if custom_field['type'] == 'date' %}
          			<div id="shipping_custom_field{{ custom_field['custom_field_id'] }}" class="form-group custom-field" data-sort="{{ custom_field['sort_order'] }}">
            			<label class="control-label" for="input_shipping_custom_field{{ custom_field['custom_field_id'] }}">{{ custom_field['name'] }}</label>
            			<div class="input-group date">
              			<input type="text" name="custom_field[{{ custom_field['location'] }}][{{ custom_field['custom_field_id'] }}]" value="{% if shipping_address['custom_field'][custom_field['custom_field_id']] %} {{ shipping_address['custom_field'][custom_field['custom_field_id']] }} {% else %} {{ custom_field['value'] }} {% endif %}" placeholder="{{ custom_field['name'] }}" data-date-format="YYYY-MM-DD" id="input_shipping_custom_field{{ custom_field['custom_field_id'] }}" class="form-control"/>
										<span class="input-group-btn"><button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button></span>
            			</div>
          			</div>
          		{% endif %}
          		{% if custom_field['type'] == 'time' %}
          			<div id="shipping_custom_field{{ custom_field['custom_field_id'] }}" class="form-group custom-field" data-sort="{{ custom_field['sort_order'] }}">
            			<label class="control-label" for="input_shipping_custom_field{{ custom_field['custom_field_id'] }}">{{ custom_field['name'] }}</label>
            			<div class="input-group time">
              			<input type="text" name="custom_field[{{ custom_field['location'] }}][{{ custom_field['custom_field_id'] }}]" value="{% if shipping_address['custom_field'][custom_field['custom_field_id']] %} {{ shipping_address['custom_field'][custom_field['custom_field_id']] }} {% else %} {{ custom_field['value'] }} {% endif %}" placeholder="{{ custom_field['name'] }}" data-date-format="HH:mm" id="input_shipping_custom_field{{ custom_field['custom_field_id'] }}" class="form-control"/>
              			<span class="input-group-btn"><button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button></span>
            			</div>
          			</div>
          		{% endif %}
          		{% if custom_field['type'] == 'datetime' %}
          			<div id="shipping_custom_field{{ custom_field['custom_field_id'] }}" class="form-group custom-field" data-sort="{{ custom_field['sort_order'] }}">
            			<label class="control-label" for="input_shipping_custom_field{{ custom_field['custom_field_id'] }}">{{ custom_field['name'] }}</label>
            			<div class="input-group datetime">
              			<input type="text" name="custom_field[{{ custom_field['location'] }}][{{ custom_field['custom_field_id'] }}]" value="{% if shipping_address['custom_field'][custom_field['custom_field_id']] %} {{ shipping_address['custom_field'][custom_field['custom_field_id']] }} {% else %} {{ custom_field['value'] }} {% endif %}" placeholder="{{ custom_field['name'] }}" data-date-format="YYYY-MM-DD HH:mm" id="input_shipping_custom_field{{ custom_field['custom_field_id'] }}" class="form-control"/>
              			<span class="input-group-btn"><button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button></span>
            			</div>
          			</div>
          		{% endif %}
          	{% endif %}
          {% endfor %}
        </form>
      </div>
      <div class="modal-footer">
        <button class="button-confirm btn btn-primary">{{ button_confirm }}</button>
      </div>
    </div>
  </div>
</div>