{% extends 'base/module.twig' %}

{% block content %}

  <div class="container-fluid">
        <div class="row">
            <div class="col-xs-12">
              <div v-show="tabs[0].active">
                <div class="row">
                  <div class="col-xs-12 col-sm-8">
                    <base-card class="padding-large">

                  <div class="bottom-padding-x-small">
                    <div class="content-box bottom-margin-small">
                      <span class="text-small text-dark text-bold">{ text_autentication }:</span>
                      <a class="text-small text-gray text-decoration-none" :href="autentication" target="_blank">{ autentication }</a>
                    </div>
                  </div>

                  <validation-provider
                    tag="div"
                    rules="required|cep"
                    class="top-margin-large"
                    name="melhorenvio_postcode"
                    v-slot="{ errors, valid }">
                    <base-input
                      :label="entry_postcode"
                      name="melhorenvio_postcode"
                      v-model="configurations.melhorenvio_postcode"
                      mask="cep"
                      :error="errors[0]"
                      :valid="valid"
                      required>
                    </base-input>
                  </validation-provider>

                  <validation-provider
                    tag="div"
                    rules="required"
                    class="top-margin-large"
                    name="melhorenvio_phone"
                    v-slot="{ errors, valid }">
                    <base-input
                      :label="entry_phone"
                      name="melhorenvio_phone"
                      v-model="configurations.melhorenvio_phone"
                      mask="telephone"
                      :error="errors[0]"
                      :valid="valid"
                      required>
                    </base-input>
                  </validation-provider>

                  <validation-provider
                    tag="div"
                    rules="required|max:64"
                    class="top-margin-large"
                    name="melhorenvio_address"
                    v-slot="{ errors, valid }">
                    <base-input
                      :label="entry_address"
                      name="melhorenvio_address"
                      v-model="configurations.melhorenvio_address"
                      :error="errors[0]"
                      :valid="valid"
                      maxlength="64"
                      required>
                    </base-input>
                  </validation-provider>

                  <validation-provider
                    tag="div"
                    rules="required|max:64"
                    class="top-margin-large"
                    name="melhorenvio_district"
                    v-slot="{ errors, valid }">
                    <base-input
                      :label="entry_district"
                      name="melhorenvio_district"
                      v-model="configurations.melhorenvio_district"
                      :error="errors[0]"
                      :valid="valid"
                      maxlength="64"
                      required>
                    </base-input>
                  </validation-provider>

                  <validation-provider
                    tag="div"
                    rules="required"
                    class="top-margin-large"
                    name="melhorenvio_number"
                    v-slot="{ errors, valid }">
                    <base-input
                      :label="entry_number"
                      name="melhorenvio_number"
                      v-model="configurations.melhorenvio_number"
                      :error="errors[0]"
                      mask="integer"
                      :valid="valid"
                      required>
                    </base-input>
                  </validation-provider>

                  <validation-provider
                    tag="div"
                    class="top-margin-large"
                    name="melhorenvio_complement"
                    v-slot="{ errors, valid }">
                    <base-input
                      :label="entry_complement"
                      name="melhorenvio_complement"
                      v-model="configurations.melhorenvio_complement"
                      :error="errors[0]"
                      :valid="valid">
                    </base-input>
                  </validation-provider>

                  <validation-provider
                    tag="div"
                    rules="required|max:64"
                    class="top-margin-large"
                    name="melhorenvio_city"
                    v-slot="{ errors, valid }">
                    <base-input
                      :label="entry_city"
                      name="melhorenvio_city"
                      v-model="configurations.melhorenvio_city"
                      :error="errors[0]"
                      :valid="valid"
                      maxlength="64"
                      required>
                    </base-input>
                  </validation-provider>

                  <div class="row no-space-xs bottom-xs top-margin-large">
                    <div class="col-xs-12">
                      <label class="required field-label"> { entry_valor_extra }</label>
                    </div>
                    <div class="col-xs right-padding-small">
                      <base-select
                        name="melhorenvio_tipo_valor_extra"
                        v-model="configurations.melhorenvio_tipo_valor_extra"
                        required>
                        <option
                          v-for="(value, key) in Type_AcrescimoDesconto"
                          :key="key"
                          :value="key">
                          { value }
                        </option>
                      </base-select>
                    </div>

                    <div class="col-xs left-padding-small">
                      <validation-provider
                      rules="required"
                      name="melhorenvio_valor_extra"
                      v-slot="{ errors, valid }">
                        <base-input
                          name="melhorenvio_valor_extra"
                          v-model="configurations.melhorenvio_valor_extra"
                          :error="errors[0]"
                          :valid="valid"
                          :mask="melhorenvioValorExtraMask"
                          required>
                        </base-input>
                      </validation-provider>
                    </div>
                  </div>

                  <validation-provider
                    tag="div"
                    rules="required|numeric"
                    class="top-margin-large"
                    name="melhorenvio_prazo_extra"
                    v-slot="{ errors, valid }">
                    <base-input
                      :label="entry_prazo_extra"
                      name="melhorenvio_prazo_extra"
                      v-model="configurations.melhorenvio_prazo_extra"
                      :error="errors[0]"
                      :valid="valid"
                      mask="integer"
                      required>
                    </base-input>
                  </validation-provider>

                  <validation-provider
                    tag="div"
                    rules="required"
                    class="top-margin-large"
                    name="melhorenvio_geo_zone_id"
                    v-slot="{ errors, valid }">
                    <base-select
                      :label="entry_geo_zone_id"
                      name="melhorenvio_geo_zone_id"
                      v-model="configurations.melhorenvio_geo_zone_id"
                      :error="errors[0]"
                      :valid="valid"
                      required>
                      <option value="0">{ text_all_zones }</option>
                      <option
                        v-for="(geo_zone, key) in geo_zones"
                        :key="geo_zone.geo_zone_id"
                        :value="geo_zone.geo_zone_id">
                        { geo_zone.name }
                      </option>
                    </base-select>
                  </validation-provider>

                  <validation-provider
                    tag="div"
                    rules="numeric"
                    class="top-margin-large"
                    name="melhorenvio_jadlog_agency">
                    <base-input
                      :label="entry_jadlog_agency"
                      name="melhorenvio_jadlog_agency"
                      v-model="configurations.melhorenvio_jadlog_agency"
                      mask="integer">
                    </base-input>
                  </validation-provider>

                  <validation-provider
                    tag="div"
                    rules="required"
                    class="top-margin-large"
                    name="melhorenvio_declaracao_conteudo"
                    v-slot="{ errors, valid }">
                    <base-select
                      :label="entry_declaracao_conteudo"
                      name="melhorenvio_declaracao_conteudo"
                      v-model="configurations.melhorenvio_declaracao_conteudo"
                      :error="errors[0]"
                      :valid="valid">
                      <option
                        v-for="(value, key) in Type_DsimDnao"
                        :key="key"
                        :value="key">
                        { value }
                      </option>
                    </base-select>
                  </validation-provider>

                </base-card>
                  </div>

                  <div class="col-xs-12 col-sm-4">
                    <base-card class="padding-large">
                      <validation-provider
                        tag="div"
                        rules="required"
                        name="melhorenvio_status"
                        v-slot="{ errors, valid }">
                        <base-select
                          :label="entry_situation"
                          name="melhorenvio_status"
                          v-model="configurations.melhorenvio_status"
                          :error="errors[0]"
                          :valid="valid">
                          <option
                            v-for="(value, key) in Type_Status"
                            :key="key"
                            :value="key">
                            { value }
                          </option>
                        </base-select>
                      </validation-provider>

                      <validation-provider
                        tag="div"
                        class="top-margin-large"
                        rules="required"
                        name="melhorenvio_environment"
                        v-slot="{ errors, valid }">
                        <base-select
                          :label="text_environment"
                          name="melhorenvio_environment"
                          v-model="configurations.melhorenvio_environment"
                          @change="handleEnvironment($event)"
                          :error="errors[0]"
                          :valid="valid">
                          <option
                            v-for="(value, key) in Type_Environment"
                            :key="key"
                            :value="key">
                            { value }
                          </option>
                        </base-select>
                      </validation-provider>

                      <validation-provider
                        tag="div"
                        class="top-margin-large"
                        rules="numeric"
                        name="melhorenvio_sort_order"
                        v-slot="{ errors, valid }">
                        <base-input
                          :label="entry_sort_order"
                          name="melhorenvio_sort_order"
                          v-model="configurations.melhorenvio_sort_order"
                          mask="integer"
                          :error="errors[0]"
                          :valid="valid">
                        </base-input>
                      </validation-provider>
                    </base-card>
                  </div>
                </div>
              </div>
              
              <div v-show="tabs[1].active">
                <div class="row">
                  <div class="col-xs-12 col-sm-8">
                    <base-card class="padding-large">
                      <validation-provider
                        tag="div"
                        rules="required"
                        name="melhorenvio_tracking_status"
                        v-slot="{ errors, valid }">
                        <base-select
                          :label="entry_situation"
                          name="melhorenvio_tracking_status"
                          v-model="configurations.melhorenvio_tracking_status"
                          :error="errors[0]"
                          :valid="valid">
                          <option
                            v-for="(value, key) in Type_Status"
                            :key="key"
                            :value="key">
                           
                          </option>
                        </base-select>
                      </validation-provider>

                      <validation-provider
                        tag="div"
                        class="top-margin-large"
                        rules="required"
                        name="melhorenvio_tracking_delivered_status"
                        v-slot="{ errors, valid }">
                        <base-select
                          :label="text_tracking_delivered_status"
                          name="melhorenvio_tracking_delivered_status"
                          v-model="configurations.melhorenvio_tracking_delivered_status"
                          :error="errors[0]"
                          :valid="valid">
                          <option value=""></option>
                          <option
                            v-for="(order_status, key) in order_statuses"
                            :key="order_status.order_status_id"
                            :value="order_status.order_status_id">
                            { order_status.name }
                          </option>
                        </base-select>
                      </validation-provider>

                    </base-card>
                  </div>
                </div>
              </div>
          </div>
        </div>
      </div>

{% endblock %}