{{ header }}
<div id="root">
  <div class="page-loader" v-show="isLoading"></div>
  <validation-observer ref="validationObserver" tag="div" v-slot="{ handleSubmit }">
    <form
      ref="form"
      @submit.prevent="handleSubmit(onSubmit)"
      action="{{ data.action }}"
      method="post">

      <the-header
        title="{{ heading_title }}"
        help="http://manual.futurasistemas.com.br/manual-do-sistema/como-configurar-o-modulo-jamef/"
        :breadcrumbs='{{ breadcrumbs|json_encode() }}'>

        <base-button
          href="{{ data.back }}"
          apperance="outline">
          {{ button_cancel }}
        </base-button>
        <base-button
          type="submit"
          :disabled="disableForm"
          :loading="btnSubmitLoading">
          {{ button_save }}
        </base-button>

        <template #notification>
          <base-alert
            v-show="alert.type"
            :apperance="alert.type"
            @close="alert = {}">
            <span v-text="alert.message"></span>
          </base-alert>
        </template>
      </the-header>

      <div class="container-fluid">
        <div class="row">
          <div class="col-xs-12 col-sm-8 col-md-6">
            <base-card class="padding-large">

              <validation-provider
                tag="div"
                name="jamef_nome"
                rules="required|min:1|max:32"
                v-slot="{ errors, valid }">
                <base-input
                  label="{{ entry_modulo }}"
                  name="jamef_nome"
                  v-model="configurations.jamef_nome"
                  :error="errors[0]"
                  :valid="valid"
                  :disabled="disableForm"
                  required>
                </base-input>
              </validation-provider>

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

              <base-select
                class="top-margin-large"
                label="{{ entry_filial }}"
                name="jamef_filial"
                v-model="configurations.jamef_filial"
                :disabled="disableForm">
                {% for  key, value in Type_CodFilialJamef %}
                  <option value="{{ key }}">{{ value }}</option>
                {% endfor %}
              </base-select>


              <validation-provider
                tag="div"
                name="jamef_ufOrigem"
                class="top-margin-large"
                rules="required"
                v-slot="{ errors, valid }">
                <base-select
                  class="top-margin-large"
                  label="{{ entry_uf }}"
                  name="jamef_ufOrigem"
                  v-model="configurations.jamef_ufOrigem"
                  @input="changeUf"
                  ref="jamef_ufOrigem"
                  :error="errors[0]"
                  :valid="valid"
                  :disabled="disableForm">
                    <option
                      v-for="(zone, index) in zones"
                      :key="zone.code"
                      :value="zone.code"
                      v-text="zone.name"
                    >
                    </option>
                </base-select>
              </validation-provider>

              <validation-provider
                tag="div"
                name="jamef_municipioOrigem"
                class="top-margin-large"
                rules="required"
                v-slot="{ errors, valid }">
                <base-select
                  class="top-margin-large"
                  label="{{ entry_municipio }}"
                  name="jamef_municipioOrigem"
                  v-model="configurations.jamef_municipioOrigem"
                  :error="errors[0]"
                  :valid="valid"
                  :disabled="disableForm">
                    <option
                      v-for="(city, index) in cities"
                      :key="city.municipio"
                      :value="city.municipio"
                      v-text="city.municipio"
                    >
                    </option>
                </base-select>
              </validation-provider>

              <base-select
                class="top-margin-large"
                class="top-margin-large"
                label="{{ entry_tipoproduto }}"
                name="jamef_tipoProduto"
                v-model="configurations.jamef_tipoProduto"
                :disabled="disableForm">
                {% for  key, value in Type_ProdutoJameF %}
                  <option value="{{ key }}">{{ value }}</option>
                {% endfor %}
              </base-select>

              <base-select
                class="top-margin-large"
                label="{{ entry_previsao }}"
                name="jamef_exibeprevisao"
                v-model="configurations.jamef_exibeprevisao"
                :disabled="disableForm">
                <option value="1">{{ text_enabled }}</option>
                <option value="0">{{ text_disabled }}</option>
              </base-select>


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

              <base-select
                class="top-margin-large"
                label="{{ entry_geo_zone }}"
                name="jamef_geo_zone_id"
                v-model="configurations.jamef_geo_zone_id"
                :disabled="disableForm">
                <option value="0">{{ text_all_zones }}</option>
                {% for geo_zone in geo_zones %}
                  <option value="{{ geo_zone.geo_zone_id }}">{{ geo_zone.name }}</option>
                {% endfor %}
              </base-select>

            </base-card>
          </div>
          <div class="col-xs-12 col-sm-4">
            <base-card class="padding-large">

              <base-select
                label="{{ entry_status }}"
                name="jamef_status"
                v-model="configurations.jamef_status"
                :disabled="disableForm">
                <option value="1">{{ text_enabled }}</option>
                <option value="0">{{ text_disabled }}</option>
              </base-select>

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

    </form>
  <validation-observer>
</div>

<script>
  const DATA = {{ data|json_encode() }};
</script>

{{ footer }}
