{{ header }}
<style type="text/css">
  .wk_canada_post_info {
      background-color: #e7f3fe;
      border-left: 6px solid #2196F3;
      min-height: 50px;
      padding: 15px;
      margin-top: 10px;
      margin-bottom: 10px;
  }
</style>
{{ column_left }}
<div id="content">
  <div class="page-header">
    <div class="container-fluid">
      <div class="pull-right">
        <button type="submit" form="form-canadapost" data-toggle="tooltip" title="{{ button_save }}" class="btn btn-primary"><i class="fa fa-save"></i></button>
        <a href="{{ cancel }}" class="btn btn-danger" data-toggle="tooltip" title="{{ button_cancel }}" ><i class="fa fa-reply"></i></a>
        <a href="https://webkul.com/blog/opencart-canada-post-shipping/" target="_blank" data-toggle="tooltip" title="{{ button_blog }}" class="btn btn-info"><i class="fa fa-info"></i></a>
        <a href="https://webkul.uvdesk.com/en/" target="_blank" data-toggle="tooltip" title="{{ button_ticket }}" class="btn btn-primary"><i class="fa fa-ticket"></i></a>
      </div>
      <h1>{{ heading_title }}</h1>
      <ul class="breadcrumb">
        {% for breadcrumb in breadcrumbs %}
        <li><a href="{{ breadcrumb.href }}">{{ breadcrumb.text }}</a></li>
        {% endfor %}
      </ul>
    </div>
  </div>
  <div class="container-fluid">
    {% if error_warning %}
    <div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i> {{ error_warning }}
      <button type="button" class="close" data-dismiss="alert">&times;</button>
    </div>
    {% endif %}
    <div class="panel panel-default">
      <div class="panel-heading">
        <h3 class="panel-title"><i class="fa fa-pencil"></i> {{ text_edit }}</h3>
      </div>
      <div class="panel-body">
        <div class="wk_canada_post_info ">
          {{ help_api }}
        </div>
        <form action="{{ action }}" method="post" enctype="multipart/form-data" id="form-canadapost" class="form-horizontal">
          <ul class="nav nav-tabs">
            <li class="active"><a href="#tab-general_setting" data-toggle="tab">{{ tab_general_setting }}</a></li>
            <li><a href="#tab-options" data-toggle="tab">{{ tab_advance_option }}</a></li>
          </ul>
          <div class="tab-content">
            <div class="tab-pane active" id="tab-general_setting">

            <div class="form-group required">
                <label class="col-sm-2 control-label" for="input-title"><span data-toggle="tooltip" title="{{ help_name }}">{{ entry_name }}</span></label>
                <div class="col-sm-10">
                {% for language in languages %}
                  <div class="input-group"><span class="input-group-addon"><img src="language/{{ language.code }}/{{ language.code }}.png" title="{{ language.name }}" /></span>
                        <input type="text" name="shipping_canadapost_title[{{ language.language_id }}]" value="{% if shipping_canadapost_title[language.language_id]  is defined %}{{ shipping_canadapost_title[language.language_id] }}{% endif %}" placeholder="{{ entry_name }}" class="form-control" />
                      </div>
                      {% if error_shipping_canadapost_title[language.language_id] is defined and error_shipping_canadapost_title[language.language_id] %}
                      <div class = "text-danger">{{ error_shipping_canadapost_title[language.language_id] }}</div>
                      {% endif %}
                {% endfor %}
                </div>
              </div>

              <div class="form-group required">
                <label class="col-sm-2 control-label" for="input-api-key"><span data-toggle="tooltip" title="{{ help_api_key }}">{{ entry_key }}</span></label>
                <div class="col-sm-10">
                  <input type="text" name="shipping_canadapost_api_key" value="{{ shipping_canadapost_api_key }}"  placeholder="{{ entry_key }}" id="input-api-key" class="form-control" />
                  {% if error_shipping_canadapost_api_key %}
                    <div class="text-danger">{{ error_shipping_canadapost_api_key }}</div>
                  {% endif %}
                </div>
              </div>
              <div class="form-group required">
                <label class="col-sm-2 control-label" for="input-api-password"><span data-toggle="tooltip" title="{{ help_api_pass }}">{{ entry_password }}</span></label>
                <div class="col-sm-10">
                  <input type="text" name="shipping_canadapost_api_password" value="{{ shipping_canadapost_api_password }}" placeholder="{{ entry_password }}" id="input-api-password" class="form-control" />
                  {% if error_shipping_canadapost_api_password %}
                  <div class="text-danger">{{ error_shipping_canadapost_api_password }}</div>
                  {% endif %}
                </div>
              </div>
              <div class="form-group required">
                <label class="col-sm-2 control-label" for="input-customer-number"><span data-toggle="tooltip" title="{{ help_customer_number }}">{{ text_customer }}</span></label>
                <div class="col-sm-10">
                  <input type="text" name="shipping_canadapost_customer_number" value="{{ shipping_canadapost_customer_number }}" placeholder="{{ text_customer }}" id="input-customer-number" class="form-control" />
                   {% if error_shipping_canadapost_customer_number %}
                  <div class="text-danger">{{ error_shipping_canadapost_customer_number }}</div>
                  {% endif %}
                </div>
              </div>

              <div class="form-group">
                <label class="col-sm-2 control-label"><span data-toggle="tooltip" title="{{ help_test }}">{{ entry_test }}</span></label>
                <div class="col-sm-10">
                  <label class="radio-inline">
                    {% if shipping_canadapost_test %}
                      <input type="radio" name="shipping_canadapost_test" value="1" checked="checked" />
                      {{ text_yes }}
                    {% else %}
                      <input type="radio" name="shipping_canadapost_test" value="1" />
                      {{ text_yes }}
                    {% endif %}
                  </label>
                  <label class="radio-inline">
                  {% if not shipping_canadapost_test %}
                      <input type="radio" name="shipping_canadapost_test" value="0" checked="checked" />
                      {{ text_no }}
                    {% else %}
                      <input type="radio" name="shipping_canadapost_test" value="0" />
                      {{ text_no }}
                    {% endif %}
                  </label>
                </div>
              </div>
              <div class="form-group">
                <label class="col-sm-2 control-label" for="input-tax-class"><span data-toggle="tooltip" title="{{ help_tax_class }}">{{ entry_tax_class }}</span></label>
                <div class="col-sm-10">
                  <select name="shipping_canadapost_tax_class_id" id="input-tax-class" class="form-control">
                    <option value="0">{{ text_none }}</option>
                    {% for tax_class in tax_classes %}
                      {% if tax_class.tax_class_id == shipping_canadapost_tax_class_id %}
                        <option value="{{ tax_class.tax_class_id }}" selected="selected">{{ tax_class.title }}</option>
                      {% else %}
                        <option value="{{ tax_class.tax_class_id }}">{{ tax_class.title }}</option>
                      {% endif %}
                    {% endfor %}
                  </select>
                </div>
              </div>
              <div class="form-group">
                <label class="col-sm-2 control-label" for="input-geo-zone"><span data-toggle="tooltip" title="{{ help_geo_zone }}">{{ entry_geo_zone }}</span></label>
                <div class="col-sm-10">
                  <select name="shipping_canadapost_geo_zone_id" id="input-geo-zone" class="form-control">
                    <option value="0">{{ text_all_zones }}</option>
                    {% for geo_zone in geo_zones %}
                      {% if geo_zone.geo_zone_id == shipping_canadapost_geo_zone_id %}
                        <option value="{{ geo_zone.geo_zone_id }}" selected="selected">{{ geo_zone.name }}</option>
                      {% else %}
                        <option value="{{ geo_zone.geo_zone_id }}">{{ geo_zone.name }}</option>
                      {% endif %}
                    {% endfor %}
                  </select>
                </div>
              </div>

              
              <div class="form-group required">
                <label class="col-sm-2 control-label"><span data-toggle="tooltip" title="{{ help_service }}">{{ entry_service }}</span></label>
                <div class="col-sm-10">
                  <div class="well well-sm" style="height: 150px; overflow: auto;">
                    {% for key, service in services %}
                    <div class="checkbox">
                      <label>
                        {% if key in shipping_canadapost_service %}
                        <input type="checkbox" name="shipping_canadapost_service[]" value="{{ key }}" checked="checked" />
                        {{ service }}
                        {% else %}
                        <input type="checkbox" name="shipping_canadapost_service[]" value="{{ key }}" />
                        {{ service }}
                        {% endif %}
                      </label>
                    </div>
                    {% endfor %}
                  </div>
                  <a onclick="$(this).parent().find(':checkbox').prop('checked', true);">{{ text_select_all }}</a> / <a onclick="$(this).parent().find(':checkbox').prop('checked', false);">{{ text_unselect_all }}</a>
                 {% if error_shipping_canadapost_service %}
                  <div class="text-danger">{{ error_shipping_canadapost_service }}</div>
                 {% endif %}
                </div>
              </div>

              <div class="form-group required">
                <label class="col-sm-2 control-label" for="input-error-message"><span data-toggle="tooltip" title="{{ help_error_msg }}">{{ entry_error_msg }}</span></label>
                <div class="col-sm-10">
                {% for language in languages %}
                  <div class="input-group"><span class="input-group-addon"><img src="language/{{ language.code }}/{{ language.code }}.png" title="{{ language.name }}" /></span>
                        <textarea name="shipping_canadapost_custom_error[{{ language.language_id }}]" placeholder="{{ entry_name }}" class="form-control" >{% if shipping_canadapost_custom_error[language.language_id] is defined %}{{ shipping_canadapost_custom_error[language.language_id] }}{% endif %}</textarea>
                      </div>
                      {% if error_shipping_canadapost_custom_error[language.language_id] is defined and error_shipping_canadapost_custom_error[language.language_id] %}
                      <div class = "text-danger">{{ error_shipping_canadapost_custom_error[language.language_id] }}</div>
                      {% endif %}
                {% endfor %}
                </div>
              </div>
              <div class="form-group">
              <label class="col-sm-2 control-label" for="input-origin"><span data-toggle="tooltip" title="{{ help_origin_address }}">{{ entry_origin_address }}</span></label>
              <div class="col-sm-10">
                  <select name="shipping_canadapost_origin_address" value="{{ shipping_canadapost_origin_address }}" id="input-origin" class="form-control">
                    <option value="store" {% if shipping_canadapost_origin_address == 'store' %}selected="selected"{% endif %}>{{ text_store }}</option>
                    <option value="custom" {% if shipping_canadapost_origin_address == 'custom' %}selected="selected"{% endif %}>{{ text_custom }}</option>
                  </select>
                </div>
              </div>
              <div id = "origin-address">
                <div class="form-group required">
                  <label class="col-sm-2 control-label" for="input-address_line1">{{ entry_address_line1 }}</label>
                  <div class="col-sm-10">
                    <input type="text" name="shipping_canadapost_address_line1" value="{{ shipping_canadapost_address_line1 }}" placeholder="{{ entry_address_line1 }}" id="input-address_line1" class="form-control" />
                    {% if error_shipping_canadapost_address_line1 is defined and error_shipping_canadapost_address_line1 %}
                    <div class="text-danger">{{ error_shipping_canadapost_address_line1 }}</div>
                    {% endif %}
                  </div>
                </div>
                <div class="form-group">
                  <label class="col-sm-2 control-label" for="input-address_line2">{{ entry_address_line2 }}</label>
                  <div class="col-sm-10">
                    <input type="text" name="shipping_canadapost_address_line2" value="{{ shipping_canadapost_address_line2 }}" placeholder="{{ entry_address_line2 }}" id="input-address_line2" class="form-control" />
                    {% if error_shipping_canadapost_address_line2 is defined and error_shipping_canadapost_address_line2 %}
                    <div class="text-danger">{{ error_shipping_canadapost_address_line2 }}</div>
                    {% endif %}
                  </div>
                </div>
                <div class="form-group required">
                  <label class="col-sm-2 control-label" for="input-city">{{ entry_city }}</label>
                  <div class="col-sm-10">
                    <input type="text" name="shipping_canadapost_city" value="{{ shipping_canadapost_city }}" placeholder="{{ entry_city }}" id="input-customer-number" class="form-control" />
                    {% if error_shipping_canadapost_city is defined  and error_shipping_canadapost_city %}
                    <div class="text-danger">{{ error_shipping_canadapost_city }}</div>
                    {% endif %}
                  </div>
                </div>
                <div class="form-group">
                  <label class="col-sm-2 control-label" for="input-postcode">{{ entry_postcode }}</label>
                  <div class="col-sm-10">
                    <input type="text" name="shipping_canadapost_postcode" value="{{ shipping_canadapost_postcode }}" placeholder="{{ entry_postcode }}" id="input-customer-number" class="form-control" />
                    {% if error_shipping_canadapost_postcode %}
                    <div class="text-danger">{{ error_shipping_canadapost_postcode }}</div>
                    {% endif %}
                  </div>
                </div>
                <div class="form-group required">
                  <label class="col-sm-2 control-label" for="input-shipping_canadapost_origin_country">{{entry_origin_country}}</label>
                  <div class="col-sm-10">
                    <select name="shipping_canadapost_origin_country" id="shipping_canadapost_origin_country" onchange="country(this, {{ shipping_canadapost_origin_zone }} );" value = "{{ shipping_canadapost_origin_country }}"class="form-control">
                      <option value="">{{ text_select }}</option>
                      {% for country in Countries %}
                        {% if country.country_id == shipping_canadapost_origin_country %}
                          <option value="{{ country.country_id }}" selected="selected">{{ country.name }}</option>
                        {% else %}
                          <option value="{{ country.country_id}}">{{ country.name }}</option>
                        {% endif %}
                      {% endfor %}
                    </select>
                    {% if error_shipping_canadapost_origin_country is defined and error_shipping_canadapost_origin_country %}
                      <div class = "text-danger">{{ error_shipping_canadapost_origin_country }}</div>
                    {% endif %}
                  </div>
                </div>

                <div class="form-group required">
                  <label class="col-sm-2 control-label" for="input-shipping_canadapost_origin_zone">{{entry_region}}</label>
                  <div class="col-sm-10">
                    <select name="shipping_canadapost_origin_zone" id="input-shipping_canadapost_origin_zone" class="form-control">
                    </select>
                    {% if error_shipping_canadapost_origin_zone is defined and error_shipping_canadapost_origin_zone %} 
                      <div class = "text-danger">{{ error_shipping_canadapost_origin_zone }}</div>
                    {% endif %}
                  </div>
                </div>
            
              </div>
              <div class="form-group">
                <label class="col-sm-2 control-label" for="input-status"><span data-toggle="tooltip" title="{{ help_shipping_status }}">{{ text_status }}</span></label>
                <div class="col-sm-10">
                  <select name="shipping_canadapost_status" value="{{ shipping_canadapost_status }}" id="input-status" class="form-control">
                    {% if shipping_canadapost_status %}
                    <option value="1" selected="selected">{{ text_enabled }}</option>
                    <option value="0">{{ text_disabled }}</option>
                    {% else %}
                    <option value="1">{{ text_enabled }}</option>
                    <option value="0" selected="selected">{{ text_disabled }}</option>
                    {% endif %}
                  </select>
                </div>
              </div>
              
              <div class="form-group">
                <label class="col-sm-2 control-label" for="input-sort-order">{{ entry_sort_order }}</span></label>
                <div class="col-sm-10">
                  <input type="text" name="shipping_canadapost_sort_order" value="{{ shipping_canadapost_sort_order }}" placeholder="{{ entry_sort_order }}" id="input-sort-order" class="form-control" />
                </div>
              </div>
            </div>
            <div class="tab-pane" id="tab-options">
              <div class="form-group required">
                <label class="col-sm-2 control-label"><span data-toggle="tooltip" title="{{ help_country }}">{{ entry_country }}</span></label>
                <div class="col-sm-10">
                  <div class="well well-sm" style="height: 200px; overflow: auto;">
                    {% for Country in Countries %}
                    <div class="checkbox">
                      <label>
                        {% if Country.country_id in shipping_canadapost_country %}
                        <input type="checkbox" name="shipping_canadapost_country[]" value="{{ Country.country_id }}" checked="checked" />
                        {{ Country.name }}
                        {% else %}
                        <input type="checkbox" name="shipping_canadapost_country[]" value="{{ Country.country_id }}" />
                         {{ Country.name }}
                        {% endif %}
                      </label>
                    </div>
                    {% endfor %}
                  </div>
                  <a onclick="$(this).parent().find(':checkbox').prop('checked', true);">{{ text_select_all }}</a> / <a onclick="$(this).parent().find(':checkbox').prop('checked', false);">{{ text_unselect_all }}</a>
                   {% if error_shipping_canadapost_country %}
                  <div class="text-danger">{{ error_shipping_canadapost_country }}</div>
                 {% endif %}
                </div>
              </div>
              <div class="form-group">
                <label class="col-sm-2 control-label"><span data-toggle="tooltip" title="{{ help_time_estimate }}">{{ entry_time_estimate }}</span></label>
                <div class="col-sm-10">
                  <label class="radio-inline">
                    {% if shipping_canadapost_time_estimated %}
                      <input type="radio" name="shipping_canadapost_time_estimated" value="1" checked="checked" />
                      {{ text_yes }}
                    {% else %}
                      <input type="radio" name="shipping_canadapost_time_estimated" value="1" />
                      {{ text_yes }}
                    {% endif %}
                  </label>
                  <label class="radio-inline">
                  {% if not shipping_canadapost_time_estimated %}
                      <input type="radio" name="shipping_canadapost_time_estimated" value="0" checked="checked" />
                      {{ text_no }}
                    {% else %}
                      <input type="radio" name="shipping_canadapost_time_estimated" value="0" />
                      {{ text_no }}
                    {% endif %}
                  </label>
                </div>
              </div>
              <div class="form-group">
                <label class="col-sm-2 control-label"><span data-toggle="tooltip" title="{{ help_show_error_to_user }}">{{ entry_show_error_to_user }}</span></label>
                <div class="col-sm-10">
                  <label class="radio-inline">
                    {% if shipping_canadapost_show_error_to_user %}
                      <input type="radio" name="shipping_canadapost_show_error_to_user" value="1" checked="checked" />
                      {{ text_yes }}
                    {% else %}
                      <input type="radio" name="shipping_canadapost_show_error_to_user" value="1" />
                      {{ text_yes }}
                    {% endif %}
                  </label>
                  <label class="radio-inline">
                  {% if not shipping_canadapost_show_error_to_user %}
                      <input type="radio" name="shipping_canadapost_show_error_to_user" value="0" checked="checked" />
                      {{ text_no }}
                    {% else %}
                      <input type="radio" name="shipping_canadapost_show_error_to_user" value="0" />
                      {{ text_no }}
                    {% endif %}
                  </label>
                </div>
              </div>
              <div class="form-group">
                <label class="col-sm-2 control-label" for="input-sort-order"><span data-toggle="tooltip" title="{{ help_delivery_time_offset }}">{{ text_delivery_time_offset }}</span></label>
                <div class="col-sm-10">
                  <input type="text" name="shipping_canadapost_delivery_time_offset" value="{{ shipping_canadapost_delivery_time_offset }}" placeholder="{{ text_delivery_time_offset }}" id="input-sort-order" class="form-control" />
                  {% if error_shipping_canadapost_delivery_time_offset %}
                  <div class="text-danger">{{ error_shipping_canadapost_delivery_time_offset }}</div>
                  {% endif %}
                </div>
              </div>
              <div class="form-group">
                <label class="col-sm-2 control-label" for="input-domestic-free-method"><span data-toggle="tooltip" title="{{ help_domestic_free_method1 }}">
                  {{ text_domestic_free_method }}</span>
                </label>
                <div class="col-sm-10">
                  <select name="shipping_canadapost_domestic_free_method"  id="input-domestic-free-method" class="form-control">
                    <option value="0">{{ text_none }}</option>
                    {% for key,service in servicesDom %}
                      {% if key == shipping_canadapost_domestic_free_method %}
                        <option value="{{ key }}" selected="selected">{{ service }}</option>
                      {% else %}
                        <option value="{{ key }}">{{ service }}</option>
                      {% endif %}
                    {% endfor %}
                  </select>
                  <div class="wk_canada_post_info "><i class="fa fa-info-circle" aria-hidden="true"></i>
                    {{ help_domestic_free_method }}
                  </div>
                </div>
              </div>
              <div class="form-group">
                <label class="col-sm-2 control-label" for="input-usa-free-method"><span data-toggle="tooltip" title="{{ help_usa_free_method1 }}">
                  {{ text_USA_free_method }}</span>
                </label>
                <div class="col-sm-10">
                  <select name="shipping_canadapost_usa_free_method"  id="input-usa-free-method" class="form-control">
                    <option value="0">{{ text_none }}</option>
                    {% for key,service in servicesUsa %}
                      {% if key == shipping_canadapost_usa_free_method %}
                        <option value="{{ key }}" selected="selected">{{ service }}</option>
                      {% else %}
                        <option value="{{ key }}">{{ service }}</option>
                      {% endif %}
                    {% endfor %}
                  </select>
                  <div class="wk_canada_post_info "><i class="fa fa-info-circle" aria-hidden="true"></i>
                    {{ help_USA_free_method }}
                  </div>
                </div>
              </div>
              <div class="form-group">
                <label class="col-sm-2 control-label" for="input-inn-free-method"><span data-toggle="tooltip" title="{{ help_inn_free_method1 }}">
                 {{ text_INN_free_method }}</span>
                </label>
                <div class="col-sm-10">
                  <select name="shipping_canadapost_inn_free_method"  id="input-inn-free-method" class="form-control">
                    <option value="0">{{ text_none }}</option>
                    {% for key,service in servicesInn %}
                      {% if key == shipping_canadapost_inn_free_method %}
                        <option value="{{ key }}" selected="selected">{{ service }}</option>
                      {% else %}
                        <option value="{{ key }}">{{ service }}</option>
                      {% endif %}
                    {% endfor %}
                  </select>
                  <div class="wk_canada_post_info "><i class="fa fa-info-circle" aria-hidden="true"></i>
                    {{ help_INN_free_method }}
                  </div>
                </div>
              </div>
              <div class="form-group">
                <label class="col-sm-2 control-label" for="handling-fees-status"><span data-toggle="tooltip" title="{{ help_handling_fee_status }}">{{ text_handling_fee_status }}</span></label>
                <div class="col-sm-10">
                  <select name="shipping_canadapost_handling_fee_status" value="{{ shipping_canadapost_handling_fee_status }}" id="handling-fees-staus" class="form-control">
                    {% if shipping_canadapost_handling_fee_status %}
                    <option value="1" selected="selected">{{ text_enabled }}</option>
                    <option value="0">{{ text_disabled }}</option>
                    {% else %}
                    <option value="1">{{ text_enabled }}</option>
                    <option value="0" selected="selected">{{ text_disabled }}</option>
                    {% endif %}
                  </select>
                </div>
              </div>
              <div class="form-group">
                <label class="col-sm-2 control-label" for="handling-fees"><span data-toggle="tooltip" title="{{ help_handling_fee }}">{{ text_handling_fee }}</span></label>
                <div class="col-sm-10">
                  <select name="shipping_canadapost_handling_fee" value="{{ shipping_canadapost_handling_fee }}" id="handling-fees" class="form-control">
                    {% if shipping_canadapost_handling_fee %}
                    <option value="1" selected="selected">{{ text_fixed }}</option>
                    <option value="0">{{ text_percent }}</option>
                    {% else %}
                    <option value="1">{{ text_fixed }}</option>
                    <option value="0" selected="selected">{{ text_percent }}</option>
                    {% endif %}
                  </select>
                </div>
              </div>
              <div class="form-group">
                <label class="col-sm-2 control-label" for="input-fee-amount"><span data-toggle="tooltip" title="{{ help_fee_amount }}">{{ text_fee_amount }}</span></label>
                <div class="col-sm-10">
                  <input type="text" name="shipping_canadapost_fee_amount" value="{{ shipping_canadapost_fee_amount }}" placeholder="{{ text_fee_amount }}" id="input-fee-amount" class="form-control" />
                </div>
                {% if error_shipping_canadapost_fee_amount %}
                    <div class="text-danger">{{ error_shipping_canadapost_fee_amount }}</div>
                  {% endif %}
              </div>
              <div class="form-group">
                <label class="col-sm-2 control-label"><span data-toggle="tooltip" title="{{ help_free_shipping_min_amount }}">{{ entry_free_shipping_min_amount }}</span></label>
                <div class="col-sm-10">
                  <label class="radio-inline">
                    {% if shipping_canadapost_free_shipping_min_amount %}
                      <input type="radio" name="shipping_canadapost_free_shipping_min_amount" value="1" checked="checked" />
                      {{ text_yes }}
                    {% else %}
                      <input type="radio" name="shipping_canadapost_free_shipping_min_amount" value="1" />
                      {{ text_yes }}
                    {% endif %}
                  </label>
                  <label class="radio-inline">
                  {% if not shipping_canadapost_free_shipping_min_amount %}
                      <input type="radio" name="shipping_canadapost_free_shipping_min_amount" value="0" checked="checked" />
                      {{ text_no }}
                    {% else %}
                      <input type="radio" name="shipping_canadapost_free_shipping_min_amount" value="0" />
                      {{ text_no }}
                    {% endif %}
                  </label>
                </div>
              </div>
              <div class="form-group">
                <label class="col-sm-2 control-label" for="input-free-shipping-amount"><span data-toggle="tooltip" title="{{ help_free_shipping_amount_value }}">{{ text_free_shipping_amount_value }}</span></label>
                <div class="col-sm-10">
                  <input type="text" name="shipping_canadapost_free_shipping_amount_value" value="{{ shipping_canadapost_free_shipping_amount_value }}" placeholder="{{ text_free_shipping_amount_value }}" id="input-free-shipping-amount" class="form-control" />
                </div>
              </div>


            </div>
          </div>
        </form>
      </div>
    </div>
  </div>
</div>

<script type = "text/javascript">
{% if shipping_canadapost_origin_address is defined and shipping_canadapost_origin_address == "custom" %}
$("#origin-address").removeClass('hide');
{% else %}
$("#origin-address").addClass('hide');
{% endif %}
$('select[name="shipping_canadapost_origin_address"]').on('change', function() {
  var address = $('select[name="shipping_canadapost_origin_address"]').val();
  if (address == "custom") {
    $("#origin-address").removeClass('hide');
  } else {
    $("#origin-address").addClass('hide');
  }
});


</script>

<script type="text/javascript"><!--
function country(element, zone_id) {

	$.ajax({
		url: 'index.php?route=localisation/country/country&user_token={{ user_token }}&country_id=' + element.value,
		dataType: 'json',
		beforeSend: function() {
			$('select[name=\'shipping_canadapost_origin_country\']').after(' <i class="fa fa-circle-o-notch fa-spin"></i>');
		},
		complete: function() {
			$('.fa-spin').remove();
		},
		success: function(json) {

			if (json['postcode_required'] == '1') {
				$('input[name=\'shipping_canadapost_postcode\']').parent().parent().addClass('required');
			} else {
				$('input[name=\'shipping_canadapost_postcode\']').parent().parent().removeClass('required');
			}

			html = '<option value="">{{text_select}}</option>';

			if (json['zone'] && json['zone'] != '') {
				for (i = 0; i < json['zone'].length; i++) {
					html += '<option value="' + json['zone'][i]['zone_id'] + '"';

					if (json['zone'][i]['zone_id'] == zone_id) {
						html += ' selected="selected"';
					}

					html += '>' + json['zone'][i]['name'] + '</option>';
				}
			} else {
				html += '<option value="0">{{text_none}}</option>';
			}

			$('select[name=\'shipping_canadapost_origin_zone\']').html(html);
		},
		error: function(xhr, ajaxOptions, thrownError) {
			alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
		}
	});
}

$('select[name$=\'shipping_canadapost_origin_country\']').trigger('change');
</script>
{{ footer }}