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

{% block content %}
  <div class="container-fluid">
    <div v-show="tabs[0].active">
      <span class="visible-block text-x-large text-dark bottom-margin-medium">{tab_general}</span>
      <div class="row">
        <div class="col-xs-12 col-md-8">
          <base-card class="padding-large">
            <validation-provider
              tag="div"
              class="bottom-margin-large"
              name="config_name"
              rules="required"
              v-slot="{ errors, valid }">
              <base-input
                :label="entry_name"
                :description="entry_name_obs"
                name="config_name"
                v-model="configurations.config_name"
                :error="errors[0]"
                :valid="valid"
                :disabled="disableForm"
                required>
              </base-input>
            </validation-provider>

            <validation-provider
              tag="div"
              class="bottom-margin-large"
              name="config_owner"
              rules="required"
              v-slot="{ errors, valid }">
              <base-input
                :label="entry_owner"
                :description="entry_owner_obs"
                name="config_owner"
                v-model="configurations.config_owner"
                :error="errors[0]"
                :valid="valid"
                :disabled="disableForm"
                required>
              </base-input>
            </validation-provider>

            <validation-provider
              tag="div"
              class="bottom-margin-large"
              name="config_ramo_atividade"
              rules=""
              v-slot="{ errors, valid }">
              <base-select
                name="config_ramo_atividade"
                :label="entry_ramo_atividade"
                :description="entry_ramo_atividade_obs"
                v-model="configurations.config_ramo_atividade"
                :valid="valid"
                :disabled="disableForm">
                  <option v-for="(value, key) in Type_RamoAtividade" :value="key">{ value }</option>
              </base-select>
            </validation-provider>

            <validation-provider
              tag="div"
              name="config_ie"
              rules=""
              v-slot="{ errors, valid }">
              <base-input
                :label="entry_ie"
                name="config_ie"
                v-model="configurations.config_ie"
                :error="errors[0]"
                :valid="valid"
                :disabled="disableForm || exemptConfigIe">
              </base-input>
            </validation-provider>

            <base-checkbox
              name="isento"
              class="bottom-margin-large"
              :label="text_isento"
              v-model="exemptConfigIe"
              @change="onExemptConfigIe"
            >
            </base-checkbox>

            <validation-provider
              tag="div"
              name="config_cnpj"
              rules="required|cnpj"
              v-slot="{ errors, valid }">
              <base-input
                :label="entry_cnpj"
                name="config_cnpj"
                v-model="configurations.config_cnpj"
                :error="errors[0]"
                :valid="valid"
                mask="cnpj"
                :disabled="disableForm"
                required>
              </base-input>
            </validation-provider>
          </base-card>
        </div>
      </div>
    </div>

    <div v-show="tabs[1].active">
      <span class="visible-block text-x-large text-dark bottom-margin-medium">{tab_contact}</span>
      <div class="row">
        <div class="col-xs-12 col-md-8">
          <base-card class="padding-large">
            <validation-provider
              tag="div"
              class="bottom-margin-large"
              name="config_email"
              rules="required|email"
              v-slot="{ errors, valid }">
              <base-input
                :label="entry_email"
                :description="entry_email_obs"
                name="config_email"
                v-model="configurations.config_email"
                :error="errors[0]"
                :valid="valid"
                :disabled="disableForm"
                required>
              </base-input>
            </validation-provider>

            <validation-provider
              tag="div"
              class="bottom-margin-large"
              name="config_address"
              rules="required"
              v-slot="{ errors, valid }">
              <base-textarea
                :label="entry_address"
                :description="entry_address_obs"
                name="config_address"
                v-model="configurations.config_address"
                :error="errors[0]"
                :valid="valid"
                rows="2"
                :disabled="disableForm"
                required>
              </base-textarea>
            </validation-provider>

            <validation-provider
              tag="div"
              class="bottom-margin-large"
              name="config_exibe_map"
              rules=""
              v-slot="{ errors, valid }">
              <base-checkbox
                :label="entry_config_exibe_map"
                :description="entry_config_exibe_map_obs"
                name="config_exibe_map"
                v-model="configurations.config_exibe_map"
                value="1"
                unchecked-value="0"
                :disabled="disableForm"
              >
              </base-checkbox>
            </validation-provider>

            <label class="field" v-show="configurations.config_exibe_map == 1">
              <span class="field-label">{entry_contact_googlemaps}</span>
              <span class="field-description" v-html="entry_contact_googlemaps_obs"></span>
              <highlight-editor
                v-model="configurations.config_contact_googlemaps"
                language="javascript"
              ></highlight-editor>
            </label>
          </base-card>

          <span class="visible-block text-x-large text-dark bottom-margin-medium top-margin-x-large">{entry_contact}</span>
          <base-card class="padding-large bottom-margin-medium" v-for="(item, index) in configurations.config_telephone">
            <div class="row small-space-xs bottom-margin-medium">
              <validation-provider
                tag="div"
                class="col-xs"
                :name=`config_telephone[${index}][type]`
                rules=""
                v-slot="{ errors, valid }">
                <base-select
                  label="Tipo"
                  :name=`config_telephone[${index}][type]`
                  v-model="item.type"
                  :error="errors[0]"
                  :valid="valid"
                  :disabled="disableForm">
                    <option v-for="(value, key) in Type_Phone" :value="key">{ value }</option>
                </base-select>
              </validation-provider>
              <validation-provider
                tag="div"
                class="col-xs"
                :name=`config_telephone[${index}][numero]`
                :rules="item.type == 1 || item.type == 4 ? 'required|cellphone' : 'required|telephone'"
                v-slot="{ errors, valid }">
                <base-input
                  label="Número"
                  :name=`config_telephone[${index}][numero]`
                  v-model="item.numero"
                  :mask="item.type == 1 || item.type == 4 ? 'cellphone' : 'telephone'"
                  :error="errors[0]"
                  :valid="valid"
                  :disabled="disableForm">
                </base-input>
              </validation-provider>
            </div>

            <div class="bottom-margin-medium">
              <base-checkbox
                :name=`config_telephone[${index}][display]`
                label="Mostrar no rodapé"
                v-model="item.display"
                value="1"
                unchecked-value="0"
                :disabled="disableForm"
                inline
              >
              </base-checkbox>
              <base-checkbox
                :name=`config_telephone[${index}][display_header]`
                label="Mostrar no topo"
                v-model="item.display_header"
                value="1"
                unchecked-value="0"
                :disabled="disableForm"
                inline
              >
              </base-checkbox>
            </div>

            <base-button
              apperance="outline"
              @click.native="onDeletePhone(index)"
            >
              Excluir
            </base-button>
          </base-card>
          <base-button @click.native="onAddPhone">
            { entry_contact }
          </base-button>
        </div>
      </div>
    </div>

    <div v-show="tabs[2].active">
      <span class="visible-block text-x-large text-dark bottom-margin-medium">{tab_store}</span>
      <div class="row">
        <div class="col-xs-12 col-md-8">
          <base-card class="padding-large">
            <validation-provider
              tag="div"
              class="bottom-margin-large"
              name="config_title"
              rules="required"
              v-slot="{ errors, valid }">
              <base-input
                :label="entry_title"
                :description="entry_title_obs"
                name="config_title"
                v-model="configurations.config_title"
                :error="errors[0]"
                :valid="valid"
                :disabled="disableForm"
                required>
              </base-input>
            </validation-provider>

            <validation-provider
              tag="div"
              class="bottom-margin-large"
              name="config_meta_description"
              v-slot="{ errors, valid }">
              <base-textarea
                :label="entry_meta_description"
                :description="entry_meta_description_obs"
                name="config_meta_description"
                v-model="configurations.config_meta_description"
                :error="errors[0]"
                :valid="valid"
                rows="2"
                :disabled="disableForm">
              </base-textarea>
            </validation-provider>

            <validation-provider
              v-if="nameuserlogado == 'futura'"
              tag="div"
              name="config_layout_id"
              rules=""
              v-slot="{ errors, valid }">
              <base-select
                name="config_layout_id"
                :label="entry_layout"
                v-model="configurations.config_layout_id"
                :error="errors[0]"
                :valid="valid"
                :disabled="disableForm">
                  <option v-for="(value, key) in layouts" :value="value.layout_id">{ value.name }</option>
              </base-select>
            </validation-provider>

            <input
              type="hidden"
              v-model="configurations.config_template"
              name="config_template"
            >
          </base-card>
        </div>
      </div>
    </div>

    <div v-show="tabs[3].active">
      <span class="visible-block text-x-large text-dark bottom-margin-medium">{tab_local}</span>
      <div class="row">
        <div class="col-xs-12 col-md-8">
          <base-card class="padding-large">
            <validation-provider
              tag="div"
              class="bottom-margin-large"
              name="config_zone_id"
              rules=""
              v-slot="{ errors, valid }">
              <base-select
                name="config_zone_id"
                :label="entry_zone"
                :description="entry_zone_obs"
                v-model="configurations.config_zone_id"
                :valid="valid"
                :disabled="disableForm">
                  <option v-for="(value, key) in zones" :value="value.zone_id">{ value.name }</option>
              </base-select>
            </validation-provider>

            <validation-provider
              tag="div"
              class="bottom-margin-large"
              name="config_time_zone"
              rules=""
              v-slot="{ errors, valid }">
              <base-select
                name="config_time_zone"
                :label="entry_timezone"
                :description="entry_timezone_obs"
                v-model="configurations.config_time_zone"
                :valid="valid"
                :disabled="disableForm">
                  <option v-for="(value, key) in time_zones" :value="value">{ value }</option>
              </base-select>
            </validation-provider>

            <validation-provider
              tag="div"
              class="bottom-margin-small"
              name="config_language"
              rules=""
              v-slot="{ errors, valid }">
              <base-select
                name="config_language"
                :label="entry_language"
                :description="entry_language_obs"
                v-model="configurations.config_language"
                :valid="valid"
                :disabled="disableForm">
                  <option v-for="(value, key) in languages" :value="value.code">{ value.name }</option>
              </base-select>
            </validation-provider>

            <base-checkbox
              name="config_use_orcamento_language"
              class="bottom-margin-large"
              :label="entry_language_orcamento"
              v-model="configurations.config_use_orcamento_language"
              value="1"
              unchecked-value="0">
            </base-checkbox>


            <validation-provider
              tag="div"
              class="bottom-margin-large"
              name="config_data_language"
              rules=""
              v-slot="{ errors, valid }">
              <base-select
                name="config_data_language"
                :label="entry_data_language"
                :description="entry_data_language_obs_2 + '<br>' + entry_data_language_obs"
                v-model="configurations.config_data_language"
                :valid="valid"
                :disabled="disableForm">
                  <option v-for="(value, key) in Type_DataLanguage" :value="key">{ value }</option>
              </base-select>
            </validation-provider>

            <validation-provider
              tag="div"
              class="bottom-margin-large"
              name="config_currency"
              rules=""
              v-slot="{ errors, valid }">
              <base-select
                name="config_currency"
                :label="entry_currency"
                v-model="configurations.config_currency"
                :valid="valid"
                :disabled="disableForm">
                  <option v-for="(value, key) in currencies" :value="value.code">{ value.title }</option>
              </base-select>
            </validation-provider>
          </base-card>
        </div>
      </div>
    </div>

    <div v-show="tabs[4].active">
      <span class="visible-block text-x-large text-dark bottom-margin-medium">{tab_option}</span>
      <aside-content :title="titleTabsOptions" size-height="medium">
        <template #aside>
          <div class="vertical-padding-large">
            <base-tabs :options="tabsOptions" vertical></base-tabs>
          </div>
        </template>

        <div v-show="tabsOptions[0].active">
          <validation-provider
            tag="div"
            class="bottom-margin-large"
            name="config_pagination_type"
            rules=""
            v-slot="{ errors, valid }">
            <base-select
              name="config_pagination_type"
              :label="entry_pagination"
              v-model="configurations.config_pagination_type"
              :valid="valid"
              :disabled="disableForm">
                <option v-for="(value, key) in Type_Pagination" :value="key">{ value }</option>
            </base-select>
          </validation-provider>

          <validation-provider
            tag="div"
            class="bottom-margin-large"
            name="config_catalog_limit"
            rules=""
            v-slot="{ errors, valid }">
            <base-select
              name="config_catalog_limit"
              :label="entry_catalog_limit"
              :description="entry_catalog_limit_obs"
              v-model="configurations.config_catalog_limit"
              :valid="valid"
              :disabled="disableForm">
                <option v-for="(value, key) in Type_ItemPerPage" :value="key">{ value }</option>
            </base-select>
          </validation-provider>

          <validation-provider
            tag="div"
            name="config_admin_limit"
            rules=""
            v-slot="{ errors, valid }">
            <base-select
              name="config_admin_limit"
              :label="entry_admin_limit"
              :description="entry_admin_limit_obs"
              v-model="configurations.config_admin_limit"
              :valid="valid"
              :disabled="disableForm">
                <option v-for="(value, key) in Type_ItemPerPage" :value="key">{ value }</option>
            </base-select>
          </validation-provider>
        </div>

        <div v-show="tabsOptions[1].active">
          <validation-provider
            tag="div"
            name="config_review_status"
            rules=""
            v-slot="{ errors, valid }">
            <base-checkbox
              :label="entry_review"
              :description="entry_review_obs"
              name="config_review_status"
              v-model="configurations.config_review_status"
              value="1"
              unchecked-value="0"
              :disabled="disableForm"
            >
            </base-checkbox>
          </validation-provider>

          <validation-provider
            tag="div"
            name="config_rating_status"
            rules=""
            v-slot="{ errors, valid }">
            <base-checkbox
              :label="entry_rating"
              :description="entry_rating_obs"
              name="config_rating_status"
              v-model="configurations.config_rating_status"
              value="1"
              unchecked-value="0"
              @change="() => {if (configurations.config_rating_status == 0) {configurations.config_product_list_rating_status = 0}}"
              :disabled="disableForm"
            >
            </base-checkbox>
          </validation-provider>

          <validation-provider
            tag="div"
            class="bottom-margin-medium"
            name="config_product_list_rating_status"
            rules=""
            v-slot="{ errors, valid }">
            <base-checkbox
              :label="entry_product_list_rating"
              :description="entry_product_list_rating_obs"
              name="config_product_list_rating_status"
              v-model="configurations.config_product_list_rating_status"
              value="1"
              unchecked-value="0"
              :disabled="disableForm || configurations.config_rating_status == 0"
            >
            </base-checkbox>
          </validation-provider>

          <validation-provider
            tag="div"
            class="bottom-margin-large"
            name="config_product_code"
            rules=""
            v-slot="{ errors, valid }">
            <base-select
              name="config_product_code"
              :label="entry_display_code"
              :description="entry_display_code_obs"
              v-model="configurations.config_product_code"
              :valid="valid"
              :disabled="disableForm">
                <option v-for="(value, key) in Type_ListCodProduct" :value="key">{ value }</option>
            </base-select>
          </validation-provider>

          <validation-provider
            tag="div"
            class="bottom-margin-large"
            name="config_code_list_product"
            rules=""
            v-slot="{ errors, valid }">
            <base-checkbox
              :label="entry_display_code_list_product"
              :description="entry_display_code_list_product_obs"
              name="config_code_list_product"
              v-model="configurations.config_code_list_product"
              value="1"
              unchecked-value="0"
              :disabled="disableForm"
            >
            </base-checkbox>
          </validation-provider>

          <validation-provider
            tag="div"
            class="bottom-margin-large"
            name="config_produto_ordenacao_padrao"
            rules=""
            v-slot="{ errors, valid }">
            <base-select
              name="config_produto_ordenacao_padrao"
              :label="entry_produto_ordem"
              :description="entry_produto_ordem_obs"
              v-model="configurations.config_produto_ordenacao_padrao"
              :valid="valid"
              :disabled="disableForm">
                <option v-for="(value, key) in Type_OrdemProdutos" :value="key">{ value }</option>
            </base-select>
          </validation-provider>


          <validation-provider
            tag="div"
            name="config_fator_multiplicador"
            rules=""
            v-slot="{ errors, valid }">
            <base-checkbox
              :label="entry_fator_multiplicador"
              :description="entry_fator_multiplicador_obs"
              name="config_fator_multiplicador"
              v-model="configurations.config_fator_multiplicador"
              value="1"
              unchecked-value="0"
              :disabled="disableForm"
            >
            </base-checkbox>
          </validation-provider>

          <validation-provider
            tag="div"
            name="config_exibe_frete"
            rules=""
            v-slot="{ errors, valid }">
            <base-checkbox
              :label="entry_frete"
              :description="entry_frete_obs"
              name="config_exibe_frete"
              v-model="configurations.config_exibe_frete"
              value="1"
              unchecked-value="0"
              :disabled="disableForm"
            >
            </base-checkbox>
          </validation-provider>

          <validation-provider
            tag="div"
            name="config_show_cronometer"
            rules=""
            v-slot="{ errors, valid }">
            <base-checkbox
              :label="entry_cronometer"
              :description="entry_cronometer_obs"
              name="config_show_cronometer"
              v-model="configurations.config_show_cronometer"
              value="1"
              unchecked-value="0"
              :disabled="disableForm"
            >
            </base-checkbox>
          </validation-provider>
        </div>

        <div v-show="tabsOptions[2].active">
          <span class="visible-block text-small text-dark text-bold bottom-margin-x-small">{ entry_search_option }</span>
          <div v-for="(value, key) in Type_SearchOption">
            <validation-provider
              tag="div"
              :name=`config_setting_search][${key}`
              rules=""
              v-slot="{ errors, valid }">
              <base-checkbox
                :label="value"
                :name=`config_setting_search][${key}`
                v-model="configurations.config_setting_search"
                :value="key"
                :disabled="disableForm || key === 3"
              >
              </base-checkbox>
            </validation-provider>
            <div
              v-if="key === 3"
              v-for="(filterValue, filterKey) in Type_FilterContent"
              class="left-padding-x-large">
              <validation-provider
                tag="div"
                :name=`config_setting_search_name`
                rules="required"
                v-slot="{ errors, valid }">
                <base-radio
                  :label="filterValue"
                  :name=`config_setting_search_name`
                  v-model="configurations.config_setting_search_name"
                  :value="filterKey"
                  :disabled="disableForm"
                >
                </base-radio>
              </validation-provider>
            </div>
          </div>
        </div>

        <div v-show="tabsOptions[3].active">
          <validation-provider
            tag="div"
            class="bottom-margin-large"
            name="config_customer_group_id"
            rules=""
            v-slot="{ errors, valid }">
            <base-select
              name="config_customer_group_id"
              :label="entry_customer_group"
              :description="entry_customer_group_obs"
              v-model="configurations.config_customer_group_id"
              :valid="valid"
              :disabled="disableForm">
                <option v-for="(value, key) in customer_groups" :value="value.customer_group_id">{ value.name }</option>
            </base-select>
          </validation-provider>

          <validation-provider
            tag="div"
            class="bottom-margin-large"
            name="config_customer_group_id_cpf"
            rules=""
            v-slot="{ errors, valid }">
            <base-select
              name="config_customer_group_id_cpf"
              :label="entry_customer_group_cpf"
              :description="entry_customer_group_cpf_obs"
              v-model="configurations.config_customer_group_id_cpf"
              :valid="valid"
              :disabled="disableForm">
                <option :value="Type_DefaultValues.Tp_Nenhum">{ Type_DefaultValues.Tp_Nenhum }</option>
                <option v-for="(value, key) in customer_groups" :value="value.customer_group_id">{ value.name }</option>
            </base-select>
          </validation-provider>

          <validation-provider
            tag="div"
            class="bottom-margin-large"
            name="config_customer_group_id_cnpj"
            rules=""
            v-slot="{ errors, valid }">
            <base-select
              name="config_customer_group_id_cnpj"
              :label="entry_customer_group_cnpj"
              :description="entry_customer_group_cnpj_obs"
              v-model="configurations.config_customer_group_id_cnpj"
              :valid="valid"
              :disabled="disableForm">
                <option :value="Type_DefaultValues.Tp_Nenhum">{ Type_DefaultValues.Tp_Nenhum }</option>
                <option v-for="(value, key) in customer_groups" :value="value.customer_group_id">{ value.name }</option>
            </base-select>
          </validation-provider>

          <validation-provider
            tag="div"
            class="bottom-margin-large"
            name="config_customer_price"
            rules=""
            v-slot="{ errors, valid }">
            <base-checkbox
              :label="entry_customer_price"
              :description="entry_customer_price_obs"
              name="config_customer_price"
              v-model="configurations.config_customer_price"
              value="1"
              unchecked-value="0"
              :disabled="disableForm"
            >
            </base-checkbox>
          </validation-provider>

          <validation-provider
            tag="div"
            name="config_account_id"
            rules=""
            v-slot="{ errors, valid }">
            <base-select
              name="config_account_id"
              :label="entry_account"
              :description="entry_account_obs"
              v-model="configurations.config_account_id"
              :valid="valid"
              :disabled="disableForm">
                <option value="0">{{ text_none }}</option>
                <option v-for="(value, key) in informations" :value="value.information_id">{ value.title }</option>
            </base-select>
          </validation-provider>
        </div>

        <div v-show="tabsOptions[4].active">
          <validation-provider
            tag="div"
            class="bottom-margin-large"
            name="config_cart_weight"
            rules=""
            v-slot="{ errors, valid }">
            <base-checkbox
              :label="entry_cart_weight"
              :description="entry_cart_weight_obs"
              name="config_cart_weight"
              v-model="configurations.config_cart_weight"
              value="1"
              unchecked-value="0"
              :disabled="disableForm"
            >
            </base-checkbox>
          </validation-provider>

          <validation-provider
            tag="div"
            class="bottom-margin-large"
            name="config_checkout_id"
            rules=""
            v-slot="{ errors, valid }">
            <base-select
              name="config_checkout_id"
              :label="entry_checkout"
              :description="entry_checkout_obs"
              v-model="configurations.config_checkout_id"
              :valid="valid"
              :disabled="disableForm">
                <option value="0">{{ text_none }}</option>
                <option v-for="(value, key) in informations" :value="value.information_id">{ value.title }</option>
            </base-select>
          </validation-provider>

          <validation-provider
            tag="div"
            class="bottom-margin-large"
            name="config_order_edit"
            rules="required"
            v-slot="{ errors, valid }">
            <base-input
              :label="entry_order_edit"
              :description="entry_order_edit_obs"
              name="config_order_edit"
              mask="positiveInteger"
              v-model="configurations.config_order_edit"
              :error="errors[0]"
              :valid="valid"
              :disabled="disableForm"
              required>
            </base-input>
          </validation-provider>

          <validation-provider
            tag="div"
            class="bottom-margin-large"
            name="config_order_status_id"
            rules=""
            v-slot="{ errors, valid }">
            <base-select
              name="config_order_status_id"
              :label="entry_order_status"
              :description="entry_order_status_obs"
              v-model="configurations.config_order_status_id"
              :valid="valid"
              :disabled="disableForm">
                <option v-for="(value, key) in order_statuses" :value="value.order_status_id">{ value.name }</option>
            </base-select>
          </validation-provider>

          <validation-provider
            tag="div"
            class="bottom-margin-large"
            name="config_complete_status_id"
            rules=""
            v-slot="{ errors, valid }">
            <base-select
              name="config_complete_status_id"
              :label="entry_complete_status"
              :description="entry_complete_status_obs"
              v-model="configurations.config_complete_status_id"
              :valid="valid"
              :disabled="disableForm">
                <option v-for="(value, key) in order_statuses" :value="value.order_status_id">{ value.name }</option>
            </base-select>
          </validation-provider>
        </div>

        <div v-show="tabsOptions[5].active">
          <validation-provider
            tag="div"
            class="bottom-margin-large"
            name="config_stock_display"
            rules=""
            v-slot="{ errors, valid }">
            <base-checkbox
              :label="entry_stock_display"
              :description="entry_stock_display_obs"
              name="config_stock_display"
              v-model="configurations.config_stock_display"
              value="1"
              unchecked-value="0"
              :disabled="disableForm"
            >
            </base-checkbox>
          </validation-provider>

          <validation-provider
            tag="div"
            class="bottom-margin-large"
            name="config_stock_warning"
            rules=""
            v-slot="{ errors, valid }">
            <base-checkbox
              :label="entry_stock_warning"
              :description="entry_stock_warning_obs"
              name="config_stock_warning"
              v-model="configurations.config_stock_warning"
              value="1"
              unchecked-value="0"
              :disabled="disableForm"
            >
            </base-checkbox>
          </validation-provider>

          <validation-provider
            tag="div"
            class="bottom-margin-large"
            name="config_stock_checkout"
            rules=""
            v-slot="{ errors, valid }">
            <base-checkbox
              :label="entry_stock_checkout"
              :description="entry_stock_checkout_obs"
              name="config_stock_checkout"
              v-model="configurations.config_stock_checkout"
              value="1"
              unchecked-value="0"
              :disabled="disableForm"
            >
            </base-checkbox>
          </validation-provider>

          <validation-provider
            tag="div"
            class="bottom-margin-large"
            name="config_stock_status_id"
            rules=""
            v-slot="{ errors, valid }">
            <base-select
              name="config_stock_status_id"
              :label="entry_stock_status"
              :description="entry_stock_status_obs"
              v-model="configurations.config_stock_status_id"
              :valid="valid"
              :disabled="disableForm">
                <option v-for="(value, key) in stock_statuses" :value="value.stock_status_id">{ value.name }</option>
            </base-select>
          </validation-provider>

          <validation-provider
            tag="div"
            class="bottom-margin-large"
            name="config_stock_disp_status_id"
            rules=""
            v-slot="{ errors, valid }">
            <base-select
              name="config_stock_disp_status_id"
              :label="entry_stock_disp_status"
              :description="entry_stock_disp_status_obs"
              v-model="configurations.config_stock_disp_status_id"
              :valid="valid"
              :disabled="disableForm">
                <option value="0">{ text_selected }</option>
                <option v-for="(value, key) in stock_statuses" :value="value.stock_status_id">{ value.name }</option>
            </base-select>
          </validation-provider>
        </div>

        <div v-show="tabsOptions[6].active">
          <validation-provider
            tag="div"
            class="bottom-margin-large"
            name="config_return_id"
            rules=""
            v-slot="{ errors, valid }">
            <base-select
              name="config_return_id"
              :label="entry_return"
              :description="entry_return_obs"
              v-model="configurations.config_return_id"
              :valid="valid"
              :disabled="disableForm">
                <option value="0">{{ text_none }}</option>
                <option v-for="(value, key) in informations" :value="value.information_id">{ value.title }</option>
            </base-select>
          </validation-provider>

          <validation-provider
            tag="div"
            class="bottom-margin-large"
            name="config_return_status_id"
            rules=""
            v-slot="{ errors, valid }">
            <base-select
              name="config_return_status_id"
              :label="entry_return_status"
              :description="entry_return_status_obs"
              v-model="configurations.config_return_status_id"
              :valid="valid"
              :disabled="disableForm">
                <option v-for="(value, key) in return_statuses" :value="value.return_status_id">{ value.name }</option>
            </base-select>
          </validation-provider>
        </div>

        <div v-show="tabsOptions[7].active">
          <validation-provider
            tag="div"
            name="config_cookies_id"
            rules=""
            v-slot="{ errors, valid }">
            <base-select
              name="config_cookies_id"
              :label="text_page_cookies"
              :description="text_page_cookies_description"
              v-model="configurations.config_cookies_id"
              :valid="valid"
              :disabled="disableForm">
                <option v-for="(value, key) in informations" :value="value.information_id">{ value.title }</option>
                <option value="0">Desabilitar</option>
            </base-select>
          </validation-provider>
        </div>
      </aside-content>
    </div>

    <div v-show="tabs[5].active">
      <span class="visible-block text-x-large text-dark bottom-margin-medium">{tab_image}</span>
      <div class="row">
        <div class="col-xs-12 col-md-8">
          <base-card class="padding-large">
            <base-input-file
              class="bottom-margin-large"
              name="config_logo"
              min-width="32"
              min-height="32"
              max-width="400"
              max-height="150"
              :value="configurations.config_logo"
              :label="entry_logo"
              :description="entry_logo_obs"
              :thumbnail="configurations.config_logo ? logo : ''"
              @change="({ value }) => {configurations.config_logo = value ? value : ''}"
            >
            </base-input-file>

            <base-input-file
              class="bottom-margin-large"
              name="config_logo_responsivo"
              min-width="32"
              min-height="32"
              max-width="300"
              max-height="120"
              :value="configurations.config_logo_responsivo"
              :label="entry_logo_responsivo"
              :description="entry_logo_responsivo_obs"
              :thumbnail="configurations.config_logo_responsivo ? logo_responsivo : ''"
              @change="({ value }) => {configurations.config_logo_responsivo = value ? value : ''}"
            >
            </base-input-file>

            <base-input-file
              class="bottom-margin-large"
              name="config_logo_floating"
              min-width="32"
              min-height="32"
              max-width="200"
              max-height="40"
              :value="configurations.config_logo_floating"
              :label="entry_logo_floating"
              :description="entry_logo_floating_obs"
              :thumbnail="configurations.config_logo_floating ? logo_floating : ''"
              @change="({ value }) => {configurations.config_logo_floating = value ? value : ''}"
            >
            </base-input-file>

            <base-input-file
              class="bottom-margin-large"
              name="config_icon"
              min-width="16"
              min-height="16"
              max-width="48"
              max-height="48"
              square
              :value="configurations.config_icon"
              :label="entry_icon"
              :description="entry_icon_obs"
              :thumbnail="configurations.config_icon ? icon : ''"
              @change="({ value }) => {configurations.config_icon = value ? value : ''}"
            >
            </base-input-file>

            <base-input-file
              class="bottom-margin-large"
              name="config_danfe"
              max-width="250"
              max-height="250"
              square
              :value="configurations.config_danfe"
              :label="entry_danfe"
              :description="entry_danfe_obs"
              :thumbnail="configurations.config_danfe ? danfe : ''"
              :max-width="250"
              :max-height="250"
              square
              @change="({ value }) => {configurations.config_danfe = value ? value : ''}"
            >
            </base-input-file>

            <base-input-file
              class="bottom-margin-large"
              name="config_watermark"
              :value="configurations.config_watermark"
              :option-value="configurations.config_watermark_position"
              :options="Type_WatermarkPosition"
              :label="entry_watermark"
              :description="entry_description_watermark"
              :thumbnail="configurations.config_watermark ? watermark : ''"
              @change="({ value }) => {configurations.config_watermark = value ? value : ''}"
              @change_select="changeSelect"
            >
            </base-input-file>

          </base-card>
        </div>
        <div class="col-xs-12 col-md-4">
          <base-card class="padding-large">
          <base-aspect-ratio
              name-width="config_image_category_width"
              name-height="config_image_category_height"
              :label="entry_image_category"
              :description="entry_image_category_description"
              min-range="200"
              max-range="540"
              required
              fixed-width="300"
              :inital-height="configurations.config_image_category_height"
              @height="(height) => {configurations.config_image_category_height = height}"
            >
            </base-aspect-ratio>

            <base-aspect-ratio
              name-width="config_image_thumb_width"
              name-height="config_image_thumb_height"
              :label="entry_image_thumb"
              :description="entry_image_thumb_description"
              min-range="400"
              max-range="1080"
              required
              fixed-width="580"
              :inital-height="configurations.config_image_thumb_height"
              @height="(height) => {configurations.config_image_thumb_height = height}"
            >
            </base-aspect-ratio>

            <base-slider
              :label="entry_watermark_opacity"
              :description="entry_watermark_opacity_obs"
              name="config_watermark_opacity"
              min="0"
              max="100"
              v-model="configurations.config_watermark_opacity"
            >
            </base-slider>
          </base-card>
        </div>
      </div>
    </div>

    <div v-show="tabs[6].active">
      <span class="visible-block text-x-large text-dark bottom-margin-medium">{tab_mail}
      <a href="http://manual.futurasistemas.com.br/manual-do-sistema/configuracao-para-envio-de-e-mails-na-loja-virtual-fec41/" target="_blank" class="text-medium text-primary padding-x-small"><i class="fas fa-question-circle"></i></a>
      </span>
      <div class="row">
        <div class="col-xs-12 col-md-8">
          <base-card class="padding-large">
            <validation-provider
              tag="div"
              class="bottom-margin-large"
              name="config_mail_protocol"
              rules=""
              v-slot="{ errors, valid }">
              <base-select
                name="config_mail_protocol"
                :label="entry_mail_protocol"
                :description="entry_mail_protocol_obs"
                v-model="configurations.config_mail_protocol"
                :valid="valid"
                :disabled="disableForm">
                  <option v-for="(value, key) in Type_EmailProtocol" :value="key">{ value }</option>
              </base-select>
            </validation-provider>

            <validation-provider
              tag="div"
              class="bottom-margin-large"
              name="config_mail_parameter"
              rules=""
              v-slot="{ errors, valid }">
              <base-input
                :label="entry_mail_parameter"
                :description="entry_mail_parameter_obs"
                name="config_mail_parameter"
                v-model="configurations.config_mail_parameter"
                :error="errors[0]"
                :valid="valid"
                :disabled="disableForm">
              </base-input>
            </validation-provider>

            <validation-provider
              tag="div"
              class="bottom-margin-large"
              name="config_smtp_host"
              rules="required"
              v-slot="{ errors, valid }">
              <base-input
                :label="entry_smtp_host"
                name="config_smtp_host"
                v-model="configurations.config_smtp_host"
                :error="errors[0]"
                :valid="valid"
                :disabled="disableForm"
                required>
              </base-input>
            </validation-provider>

            <validation-provider
              tag="div"
              class="bottom-margin-large"
              name="config_smtp_username"
              rules="required"
              v-slot="{ errors, valid }">
              <base-input
                :label="entry_smtp_username"
                name="config_smtp_username"
                v-model="configurations.config_smtp_username"
                :error="errors[0]"
                :valid="valid"
                :disabled="disableForm"
                required>
              </base-input>
            </validation-provider>

            <validation-provider
              tag="div"
              class="bottom-margin-medium"
              name="config_smtp_password"
              rules="required"
              v-slot="{ errors, valid }">
              <base-input
                :type="showPassword ? 'text' : 'password'"
                :label="entry_smtp_password"
                name="config_smtp_password"
                v-model="configurations.config_smtp_password"
                :error="errors[0]"
                :valid="valid"
                :disabled="disableForm"
                required>
              </base-input>
            </validation-provider>
            <span
              class="visible-block cursor-pointer text-small text-dark bottom-margin-large"
              @click="showPassword = !showPassword"
              v-text="showPassword ? 'Ocultar senha' : 'Mostrar senha'">
            </span>

            <validation-provider
              tag="div"
              class="bottom-margin-large"
              name="config_smtp_port"
              rules="required"
              v-slot="{ errors, valid }">
              <base-input
                :label="entry_smtp_port"
                name="config_smtp_port"
                v-model="configurations.config_smtp_port"
                :error="errors[0]"
                :valid="valid"
                :disabled="disableForm"
                required>
              </base-input>
            </validation-provider>

            <validation-provider
              class="bottom-margin-large"
              tag="div"
              name="config_smtp_timeout"
              rules="required"
              v-slot="{ errors, valid }">
              <base-input
                :label="entry_smtp_timeout"
                name="config_smtp_timeout"
                v-model="configurations.config_smtp_timeout"
                :error="errors[0]"
                :valid="valid"
                :disabled="disableForm"
                required>
              </base-input>
            </validation-provider>

            <validation-provider
              tag="div"
              name="config_alert_mail"
              rules=""
              v-slot="{ errors, valid }">
              <base-checkbox
                :label="entry_alert_mail"
                :description="entry_alert_mail_obs"
                name="config_alert_mail"
                v-model="configurations.config_alert_mail"
                value="1"
                unchecked-value="0"
                :disabled="disableForm"
              >
              </base-checkbox>
            </validation-provider>
            <input type="hidden" name="config_product_count]" v-model="configurations.config_product_count" value="0" >

            <validation-provider
              tag="div"
              name="config_account_mail"
              rules=""
              v-slot="{ errors, valid }">
              <base-checkbox
                :label="entry_account_mail"
                :description="entry_account_mail_obs"
                name="config_account_mail"
                v-model="configurations.config_account_mail"
                value="1"
                unchecked-value="0"
                :disabled="disableForm"
              >
              </base-checkbox>
            </validation-provider>

            <validation-provider
              tag="div"
              class="bottom-margin-large"
              name="config_return_mail"
              rules=""
              v-slot="{ errors, valid }">
              <base-checkbox
                label="Alerta de devolução de produto"
                description="Enviar e-mail quando ter uma nova devolução"
                name="config_return_mail"
                v-model="configurations.config_return_mail"
                value="1"
                unchecked-value="0"
                :disabled="disableForm"
              >
              </base-checkbox>
            </validation-provider>

            <validation-provider
              tag="div"
              class="bottom-margin-large"
              name="config_alert_emails"
              v-slot="{ errors, valid }">
              <base-textarea
                :label="entry_alert_emails"
                name="config_alert_emails"
                v-model="configurations.config_alert_emails"
                :error="errors[0]"
                :valid="valid"
                rows="2"
                :disabled="disableForm">
              </base-textarea>
            </validation-provider>
          </base-card>
        </div>
        <div class="col-xs-12 col-md-4">
          <base-card class="padding-large">
            <validation-provider
              tag="div"
              class="bottom-margin-medium"
              name="config_email_test"
              v-slot="{ errors, valid }">
              <base-input
                :label="entry_mail_test"
                :description="entry_mail_test_obs"
                name="config_email_test"
                v-model="emailTest"
                :error="errors[0]"
                :valid="valid"
                :disabled="disableForm">
              </base-input>
            </validation-provider>

            <base-button
              @click.native="onConnectTest"
              :loading="buttonTestEmailLoading"
              :disabled="buttonTestEmailLoading">
              {entry_smtp_connect}
            </base-button>
          </base-card>
        </div>
      </div>
    </div>

    <div v-show="tabs[7].active">
      <span class="visible-block text-x-large text-dark bottom-margin-medium">{tab_server}</span>
      <div class="row">
        <div class="col-xs-12 col-md-8">
          <base-card class="padding-large">
            <validation-provider
              tag="div"
              name="config_maintenance"
              rules=""
              v-slot="{ errors, valid }">
              <base-checkbox
                :label="entry_maintenance"
                :description="entry_maintenance_obs"
                name="config_maintenance"
                v-model="configurations.config_maintenance"
                value="1"
                unchecked-value="0"
                :disabled="disableForm"
              >
              </base-checkbox>
            </validation-provider>

            <validation-provider
              tag="div"
              name="config_dominio"
              rules=""
              v-slot="{ errors, valid }">
              <base-checkbox
                :label="entry_dominio"
                :description="entry_dominio_obs"
                name="config_dominio"
                v-model="configurations.config_dominio"
                value="1"
                unchecked-value="0"
                :disabled="disableForm"
              >
              </base-checkbox>
            </validation-provider>

            <validation-provider
              tag="div"
              class="bottom-margin-large"
              name="config_path"
              rules=""
              v-slot="{ errors, valid }">
              <base-checkbox
                :label="entry_path_link_text"
                name="config_path"
                v-model="configurations.config_path"
                value="1"
                unchecked-value="0"
                :disabled="disableForm"
              >
              </base-checkbox>
            </validation-provider>

            <validation-provider
              tag="div"
              class="bottom-margin-large"
              name="config_pathlink"
              rules=""
              v-slot="{ errors, valid }">
              <base-input
                :label="entry_path_link"
                :description="entry_path_link_obs"
                name="config_pathlink"
                v-model="configurations.config_pathlink"
                :error="errors[0]"
                :valid="valid"
                :disabled="disableForm || configurations.config_path == 0 || !configurations.config_path">
              </base-input>
            </validation-provider>

            <validation-provider
              tag="div"
              name="config_error_display"
              rules=""
              v-slot="{ errors, valid }">
              <base-checkbox
                :label="entry_error_display"
                :description="entry_error_display_obs"
                name="config_error_display"
                v-model="configurations.config_error_display"
                value="1"
                unchecked-value="0"
                :disabled="disableForm"
              >
              </base-checkbox>
            </validation-provider>

            <validation-provider
              tag="div"
              class="bottom-margin-large"
              name="config_error_log"
              rules=""
              v-slot="{ errors, valid }">
              <base-checkbox
                :label="entry_error_log"
                :description="entry_error_log_obs"
                name="config_error_log"
                v-model="configurations.config_error_log"
                value="1"
                unchecked-value="0"
                :disabled="disableForm"
              >
              </base-checkbox>
            </validation-provider>

            <validation-provider
              tag="div"
              class="bottom-margin-large"
              name="config_error_filename"
              rules="required"
              v-slot="{ errors, valid }">
              <base-input
                :label="entry_error_filename"
                :description="entry_error_filename_obs"
                name="config_error_filename"
                v-model="configurations.config_error_filename"
                :error="errors[0]"
                :valid="valid"
                :disabled="disableForm"
                required>
              </base-input>
            </validation-provider>

            <validation-provider
              tag="div"
              class="bottom-margin-large"
              name="config_compression"
              rules=""
              v-slot="{ errors, valid }">
              <base-input
                :label="entry_compression"
                :description="entry_compression_obs"
                name="config_compression"
                v-model="configurations.config_compression"
                :error="errors[0]"
                :valid="valid"
                :disabled="disableForm">
              </base-input>
            </validation-provider>

            <validation-provider
              tag="div"
              class="bottom-margin-large"
              name="config_robots_disallow_pages"
              v-slot="{ errors, valid }">
              <base-textarea
                :label="entry_robots_disallow_pages"
                name="config_robots_disallow_pages"
                v-model="configurations.config_robots_disallow_pages"
                :error="errors[0]"
                :valid="valid"
                rows="5"
                :disabled="disableForm">
              </base-textarea>
            </validation-provider>

            <validation-provider
              tag="div"
              class="bottom-margin-large"
              name="config_file_extension_allowed"
              v-slot="{ errors, valid }">
              <base-textarea
                :label="entry_file_extension_allowed"
                name="config_file_extension_allowed"
                v-model="configurations.config_file_extension_allowed"
                :error="errors[0]"
                :valid="valid"
                rows="5"
                :disabled="disableForm">
              </base-textarea>
            </validation-provider>

            <validation-provider
              tag="div"
              class="bottom-margin-large"
              name="config_file_mime_allowed"
              v-slot="{ errors, valid }">
              <base-textarea
                :label="entry_file_mime_allowed"
                name="config_file_mime_allowed"
                v-model="configurations.config_file_mime_allowed"
                :error="errors[0]"
                :valid="valid"
                rows="5"
                :disabled="disableForm">
              </base-textarea>
            </validation-provider>
          </base-card>
        </div>
        <div class="col-xs-12 col-md-4">
          <base-card class="padding-large">
            <validation-provider
              tag="div"
              class="bottom-margin-large"
              name="config_habilita_linkproducao"
              rules=""
              v-slot="{ errors, valid }">
              <base-checkbox
                :label="entry_tipo_link"
                {% if text_dataproducao is defined %}:description="text_dataproducao"{% endif %}
                name="config_habilita_linkproducao"
                v-model="configurations.config_habilita_linkproducao"
                value="1"
                unchecked-value="0"
                :disabled="disableForm"
              >
              </base-checkbox>
            </validation-provider>

            <div class="bottom-margin-large">
               <validation-provider
                 tag="div"
                 name="config_linktemporario_ssl"
                 rules="required"
                 v-slot="{ errors, valid }">
                  <base-input
                    :label="entry_link_temporario_ssl"
                    name="config_linktemporario_ssl"
                    v-model="configurations.config_linktemporario_ssl"
                    :error="errors[0]"
                    :valid="valid"
                    required>
                  </base-input>
               </validation-provider>
                <base-button
                  size="small"
                  apperance="outline"
                  @click.native="handleCopy('config_linktemporario_ssl', 'buttonTextCopyLinkTemp')">
                  {buttonTextCopyLinkTemp}
                </base-button>
            </div>


              <validation-provider
                tag="div"
                class="bottom-margin-large"
                name="config_linkproducao_ssl"
                :rules="isSistemaMercadoLivre? '':'required'"
                v-slot="{ errors, valid }">
                <base-input
                  :label="entry_link_producao_ssl"
                  name="config_linkproducao_ssl"
                  v-model="configurations.config_linkproducao_ssl"
                  :error="errors[0]"
                  :valid="valid"
                  :disabled="disableForm"
                  required>
                </base-input>
              </validation-provider>

              <validation-provider
                tag="div"
                class="bottom-margin-large"
                name="config_encryption"
                rules="required"
                v-slot="{ errors, valid }">
                <base-input
                  :label="entry_encryption"
                  :description="entry_encryption_obs"
                  name="config_encryption"
                  v-model="configurations.config_encryption"
                  :error="errors[0]"
                  :valid="valid"
                  :disabled="disableForm"
                  required>
                </base-input>
              </validation-provider>

              <div class="bottom-margin-large">
                <span class="visible-block text-small text-dark text-bold bottom-margin-x-small">{ entry_config_keyapi }</span>
                <span class="visible-block text-small text-gray bottom-margin-x-small">{ entry_config_keyapi_obs }</span>
                <span class="visible-block text-medium text-dark vertical-margin-medium">{configurations.config_keyapi}</span>
                <base-button
                  size="small"
                  apperance="outline"
                  @click.native="handleCopy('config_keyapi', 'buttonTextCopyKeyApi')"
                >
                  {buttonTextCopyKeyApi}
                </base-button>
              </div>

              <div>
                <span class="visible-block text-small text-dark text-bold bottom-margin-x-small">{ text_ceo_user }</span>
                <span class="visible-block text-medium text-gray">{{ ceo_user }}</span>
                 <base-button
                  size="small"
                  class="top-margin-medium"
                  :apperance="buttonCeoApperance"
                  @click.native="validateCeo"
                  :loading="buttonCeoLoading"
                  :disabled="buttonCeoLoading"
                >
                  { buttonCeoText }
                </base-button>
                <div v-if="ceoValidationInfo.error" class="padding-medium background-error rounded-x-small top-margin-medium">
                  <span class="text-error text-small">{ ceoValidationInfo.error.message }</span>
                </div>
              </div>
          </base-card>
        </div>
      </div>
    </div>
  </div>

{% endblock %}