{{ header }}
<header class="background-white bottom-margin-large">
  <div class="container-fluid">
    <div class="row no-space-xs">
      <div class="col-xs-12">
        <div class="content-box vertical-padding-large flex between-xs middle-xs">
          <div>
            <span class="text-x-large text-dark">{{ heading_title }}</span>
            <div class="adm-breadcrumb">
              {% for breadcrumb in breadcrumbs %}
                <i class="fas fa-angle-right text-x-small text-gray horizontal-padding-small"></i>
                <a href="{{ breadcrumb.href }}" class="text-x-small text-gray text-decoration-none">{{ breadcrumb.text }}</a>
              {% endfor %}
            </div>
          </div>
          <div class="flex flex-row middle-xs">
            <a
              href="http://manual.futurasistemas.com.br/manual-do-sistema/como-configurar-modulo-de-pagamento-do-mercado-pago-2-0/"
              class="text-info visible-inline-block cursor-pointer text-decoration-none vertical-padding-small right-margin-large"
              target="_blank"
            >
              <span>{{ button_help }}</span>
            </a>
            <a href="{{ cancel }}" class="btn-default btn-medium btn-outline right-margin-small">
              <span>{{ button_cancel }}</span>
            </a>
            <button class="btn-default btn-medium btn-primary js-submit-main-form">
              <span>{{ button_save }}</span>
            </button>
          </div>
        </div>
        {% if error_warning %}
          <div class="warning full-width">{{ error_warning }}</div>
        {% endif %}
      </div>
    </div>
  </div>
</header>
<div class="container-fluid">
  <form action="{{ action }}" method="post" class="js-main-form">
    <div class="row">

      <div class="col-xs-12 col-md-8">
        <div class="background-white padding-large bottom-margin-medium shadow-small">
          <a class="text-info cursor-pointer text-decoration-none visible-block" href="https://www.mercadopago.com/mlb/ferramentas/notificacoes" target="_blank">{{ text_ipn }}</a>
          <span class="text-x-small text-gray">{{ text_ipn_obs }}</span>
          <span class="text-x-small text-gray visible-block">{{ ipn_obs_link }}</span>
          <label class="field field-medium vertical-padding-large">
            <span class="field-label">{{ entry_title }}</span>
            <input class="field-entry" type="text" name="mercadopago2_title" value="{{ mercadopago2_title }}"/>
          </label>
          <label class="field field-medium bottom-padding-large">
            <span class="field-label required">{{ entry_email }}</span>
            <span class="text-x-small text-gray">{{ email_obs }}</span>
            <input class="field-entry" type="text" name="mercadopago2_email" value="{{ mercadopago2_email }}" />
            {% if error_mercadopago2_email is defined %}
              <span class="text-error text-x-small">{{ error_mercadopago2_email }}</span>
            {% endif %}
          </label>
          <label class="field field-medium bottom-padding-large">
            <span class="field-label required">{{ entry_client_id }}</span>
            <a class="text-info cursor-pointer text-decoration-none" href="https://www.mercadopago.com/mlb/account/credentials" target="_blank">
              <span class="text-x-small">{{ link_obs }}</span>
            </a>
            <input class="field-entry" type="text" name="mercadopago2_client_id" value="{{ mercadopago2_client_id }}" />
            {% if error_client_id is defined %}
              <span class="text-error text-x-small">{{ error_client_id }}</span>
            {% endif %}
          </label>
          <label class="field field-medium bottom-padding-large">
            <span class="field-label required">{{ entry_client_secret }}</span>
            <a class="text-info cursor-pointer text-decoration-none" href="https://www.mercadopago.com/mlb/account/credentials" target="_blank">
              <span class="text-x-small">{{ link_obs }}</span>
            </a>
            <input class="field-entry" type="text" name="mercadopago2_client_secret" value="{{ mercadopago2_client_secret }}" />
            {% if error_client_secret is defined %}
              <span class="text-error text-x-small">{{ error_client_secret }}</span>
            {% endif %}
          </label>
          <button type="button" class="btn-default btn-medium btn-primary bottom-margin-large js-validate-credentials" data-url="{{ url_validate_credentials }}">
            <span>{{ text_validate_credentials }}</span>
          </button>
          <label class="field field-medium bottom-padding-large">
            <span class="field-label required">{{ entry_category }}</span>
            <span class="text-x-small text-gray">{{ category_obs }}</span>
            <select class="field-entry" name="mercadopago2_category_id">
              {% for category in category_list %}
                <option value="{{ category.id }}" {{ category.id == mercadopago2_category_id ? 'selected="selected"' : '' }} id="{{ category.description }}">
                  {{ category.description }}
                </option>
              {% endfor %}
            </select>
          </label>
          <label class="field field-medium bottom-padding-large">
            <span class="field-label required">{{ entry_url }}</span>
            <span class="text-x-small text-gray">{{ url_obs }}</span>
            <input class="field-entry" type="text" name="mercadopago2_url" value="{{ mercadopago2_url }}" />
            {% if error_mercadopago2_url is defined %}
              <span class="text-error text-x-small">{{ error_mercadopago2_url }}</span>
            {% endif %}
          </label>
          <label class="field field-medium bottom-padding-large">
            <span class="field-label">{{ entry_order_status }}</span>
            <span class="text-x-small text-gray">{{ order_status_obs }}</span>
            <select class="field-entry" name="mercadopago2_order_status_id">
              {% for order_status in order_statuses %}
                <option value="{{ order_status.order_status_id }}" {{ order_status.order_status_id == mercadopago2_order_status_id ? 'selected="selected"' : '' }}>
                  {{ order_status.name }}
                </option>
              {% endfor %}
            </select>
          </label>
          <label class="field field-medium bottom-padding-large">
            <span class="field-label">{{ entry_valor_minimo }}</span>
            <span class="text-x-small text-gray">{{ valor_minimo_obs }}</span>
            <input class="field-entry mask-money" placeholder="Valor Mínimo" maxlength="8" class="mask-money" type="text" name="mercadopago2_valor_minimo" value="{{ mercadopago2_valor_minimo }}" />
          </label>
          <label class="field field-medium bottom-padding-large">
            <span class="field-label">{{ entry_parcela_minima }}</span>
            <span class="text-x-small text-gray">{{ parcela_minima_obs }}</span>
            <input class="field-entry mask-money" placeholder="Parcela Miníma" maxlength="8" class="mask-money-point" type="text" name="mercadopago2_parcela_minima" value="{{ mercadopago2_parcela_minima }}" />
          </label>
          <label class="field field-medium bottom-padding-large">
            <span class="field-label">{{ entry_installments }}</span>
            <select class="field-entry" name="mercadopago2_installments" id="country">
              {% for installment in installments %}
                <option value="{{ installment.id }}" {{ installment.id == mercadopago2_installments ? 'selected="selected"' : '' }} id="{{ installment.id }}">
                  {{ installment.value }}
                </option>
              {% endfor %}
            </select>
          </label>
          {% if methods is defined %}
            <div class="bottom-padding-large">
              <span class="field-label">{{ entry_payments_not_accept }}</span>
              <span class="text-x-small text-gray">{{ payments_not_accept_obs }}</span>
                {% for method in methods %}
                  <div class="flex between-xs js-verify-checked">
                    {% if method.id != 'account_money' %}
                    <div class="vertical-padding-x-small">
                      <label class="checkbox checkbox-medium">
                        <input
                          class="checkbox-entry js-method"
                          name="mercadopago2_methods[]"
                          type="checkbox"
                          {{ (mercadopago2_methods is not empty and (method.id in mercadopago2_methods)) ? 'checked' : '' }}
                          value="{{ method.id }}"
                        >
                        <span class="checkbox-text">{{ method.name }}</span>
                      </label>
                    </div>
                    <div class="vertical-padding-x-small">
                      <label class="field field-medium">
                        <input
                          name="mercadopago2_methods_value[{{ method.id }}]"
                          type="text"
                          value="{{ (mercadopago2_methods is not empty and (method.id in mercadopago2_methods)) ? '' : mercadopago2_methods_value[method.id] }}"
                          class="field-entry mask-money js-disabled"
                          {{ (mercadopago2_methods is not empty and (method.id in mercadopago2_methods)) ? 'disabled' : '' }}
                          placeholder="Valor Minímo" maxlength="8"
                        >
                      </label>
                    </div>
                    {% endif %}
                  </div>
                {% endfor %}
            </div>
          {% endif %}
          <label class="field field-medium bottom-padding-large">
            <span class="field-label">{{ entry_order_status_completed }}</span>
            <span class="text-x-small text-gray">{{ order_status_completed_obs }}</span>
            <select class="field-entry" name="mercadopago2_order_status_id_completed">
              {% for order_status in order_statuses %}
                <option value="{{ order_status.order_status_id }}" {{ order_status.order_status_id == mercadopago2_order_status_id_completed ? 'selected="selected"' : '' }}>
                  {{ order_status.name }}
                </option>
              {% endfor %}
            </select>
          </label>
          <label class="field field-medium bottom-padding-large">
            <span class="field-label">{{ entry_order_status_pending }}</span>
            <span class="text-x-small text-gray">{{ order_status_pending_obs}}</span>
            <select class="field-entry" name="mercadopago2_order_status_id_pending">
              {% for order_status in order_statuses %}
                <option value="{{ order_status.order_status_id }}" {{ order_status.order_status_id == mercadopago2_order_status_id_pending ? 'selected="selected"' : '' }}>
                  {{ order_status.name }}
                </option>
              {% endfor %}
            </select>
          </label>
          <label class="field field-medium bottom-padding-large">
            <span class="field-label">{{ entry_order_status_canceled }}</span>
            <select class="field-entry" name="mercadopago2_order_status_id_canceled">
              {% for order_status in order_statuses %}
                <option value="{{ order_status.order_status_id }}" {{ order_status.order_status_id == mercadopago2_order_status_id_canceled ? 'selected="selected"' : '' }}>
                  {{ order_status.name }}
                </option>
              {% endfor %}
            </select>
          </label>
          <label class="field field-medium bottom-padding-large">
            <span class="field-label">{{ entry_order_status_in_process }}</span>
            <span class="text-x-small text-gray">{{ order_status_in_process_obs}}</span>
            <select class="field-entry" name="mercadopago2_order_status_id_in_process">
              {% for order_status in order_statuses %}
                <option value="{{ order_status.order_status_id }}" {{ order_status.order_status_id == mercadopago2_order_status_id_in_process ? 'selected="selected"' : '' }}>
                  {{ order_status.name }}
                </option>
              {% endfor %}
            </select>
          </label>
          <label class="field field-medium bottom-padding-large">
            <span class="field-label">{{ entry_order_status_rejected }}</span>
            <span class="text-x-small text-gray">{{ order_status_rejected_obs }}</span>
            <select class="field-entry" name="mercadopago2_order_status_id_rejected">
              {% for order_status in order_statuses %}
                <option value="{{ order_status.order_status_id }}" {{ order_status.order_status_id == mercadopago2_order_status_id_rejected ? 'selected="selected"' : '' }}>
                  {{ order_status.name }}
                </option>
              {% endfor %}
            </select>
          </label>
          <label class="field field-medium bottom-padding-large">
            <span class="field-label">{{ entry_order_status_refunded }}</span>
            <span class="text-x-small text-gray">{{ order_status_refunded_obs }}</span>
            <select class="field-entry" name="mercadopago2_order_status_id_refunded">
              {% for order_status in order_statuses %}
                <option value="{{ order_status.order_status_id }}" {{ order_status.order_status_id == mercadopago2_order_status_id_refunded ? 'selected="selected"' : '' }}>
                  {{ order_status.name }}
                </option>
              {% endfor %}
            </select>
          </label>
          <label class="field field-medium">
            <span class="field-label">{{ entry_order_status_in_mediation }}</span>
            <span class="text-x-small text-gray">{{ order_status_in_mediation_obs }}</span>
            <select class="field-entry" name="mercadopago2_order_status_id_in_mediation">
              {% for order_status in order_statuses %}
                <option value="{{ order_status.order_status_id }}" {{ order_status.order_status_id == mercadopago2_order_status_id_in_mediation ? 'selected="selected"' : '' }}>
                  {{ order_status.name }}
                </option>
              {% endfor %}
            </select>
          </label>
        </div>
      </div>

      <div class="col-xs-12 col-md-4">
        <div class="background-white padding-large bottom-margin-medium shadow-small">
          <label class="field field-medium bottom-padding-large">
            <span class="field-label">{{ entry_status }}</span>
            <select class="field-entry" name="mercadopago2_status">
              <option value="1" {{ mercadopago2_status ? 'selected="selected"' : '' }}>
                {{ text_enabled }}
              </option>
              <option value="0" {{ mercadopago2_status ? '' : 'selected="selected"' }}>
                {{ text_disabled }}
              </option>
            </select>
          </label>
          <label class="field field-medium bottom-padding-large">
            <span class="field-label">{{ entry_display }}</span>
            <select class="field-entry" name="mercadopago2_display" >
              {% for key, value in Type_DisplayModuleOption.getEnumList() %}
                <option value="{{ key }}" {{ ftr_geral.isSelected(key, mercadopago2_display, Type_DisplayModuleOption.Tp_Todos) }}>{{ value }}</option>
              {% endfor %}
            </select>
          </label>
          <label class="field field-medium bottom-padding-large">
            <span class="field-label">{{ entry_debug }}</span>
            <span class="text-x-small text-gray">{{ debug_obs }}</span>
            <select class="field-entry" name="mercadopago2_debug">
              <option value="1" {{ mercadopago2_debug ? 'selected="selected"' : '' }}>
                {{ text_enabled }}
              </option>
              <option value="0" {{ mercadopago2_debug ? '' : 'selected="selected"' }}>
                {{ text_disabled }}
              </option>
            </select>
          </label>
          <label class="field field-medium bottom-padding-large">
            <span class="field-label">{{ entry_sandbox }}</span>
            <span class="text-x-small text-gray">{{ sandbox_obs }}</span>
            <select class="field-entry" name="mercadopago2_sandbox">
              <option value="1" {{ mercadopago2_sandbox ? 'selected="selected"' : '' }}>
                {{ text_enabled }}
              </option>
                <option value="0" {{ mercadopago2_sandbox ? '' : 'selected="selected"' }}>
                {{ text_disabled }}
              </option>
            </select>
          </label>
          <label class="field field-medium bottom-padding-large">
            <span class="field-label">{{ entry_email_user_teste }}</span>
            <span class="text-x-small text-gray">{{ email_user_teste_obs }}</span>
            <input class="field-entry" type="text" name="mercadopago2_user_email" value="{{ mercadopago2_user_email }}" />
            {% if error_mercadopago2_user_email is defined %}
              <span class="text-error text-x-small">{{ error_mercadopago2_user_email }}</span>
            {% endif %}
          </label>
          <label class="field field-medium">
            <span class="field-label">{{ entry_sort_order }}</span>
            <input class="field-entry mask-number" type="text" name="mercadopago2_sort_order" value="{{ mercadopago2_sort_order }}" size="1" />
          </label>
        </div>
      </div>
    </div>
  </form>
</div>
{{ footer }}
