<table class="window">
  <tr>
    <td>
      <check if="{{!file_exists(@ROOT.'/app/api_config.php')}}">
      <div align="center">
        <div class="logo">
          <svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 400.82 128.7">
              <defs>
                <linearGradient id="linear-gradient" x1="57.86" y1="49.36" x2="102.8" y2="78.95" gradientUnits="userSpaceOnUse">
                    <stop offset="0" stop-color="#e4006e"/>
                    <stop offset="1" stop-color="#474a98"/>
                </linearGradient>
                <linearGradient id="linear-gradient-2" x1="43.8" y1="34.14" x2="88" y2="59.61" gradientTransform="translate(-13.11 54.71) rotate(-45)" xlink:href="#linear-gradient"/>
              </defs>
              <polygon class="cls-1" points="80.73 43.18 80.73 64.42 59.49 64.42 59.49 85.67 80.73 85.67 101.98 85.67 101.98 64.42 101.98 43.18 80.73 43.18"/>
              <rect class="cls-2" x="48.86" y="32.55" width="21.25" height="21.25" transform="translate(47.95 -29.42) rotate(45)"/>
              <path class="cls-3" d="M130.91,43.27,120,85.67h7l2.7-10.94h19.62l2.91,10.94h7.3l-11.26-42.4ZM131.56,68l4.55-18.15h6.73L147.59,68Z"/>
              <path class="cls-3" d="M273,45.63a17.3,17.3,0,0,0-9.17-2.36H246.37v42.4h6.92v-14H264a17.37,17.37,0,0,0,7.21-1.51c5.15-2.33,8.27-6.22,8.6-11.93C280.1,52.74,277.69,48.5,273,45.63ZM263.31,65h-10V49.86h10.43a9.91,9.91,0,0,1,5.47,1.33A6.82,6.82,0,0,1,272.54,57a7.31,7.31,0,0,1-3.16,6.57A10.76,10.76,0,0,1,263.31,65Z"/>
              <path class="cls-3" d="M169.23,85.67h7V49.87l16.82,0V43.27H169.23Z"/>
              <polygon class="cls-3" points="317.12 43.27 282.28 43.27 282.28 49.86 296.2 49.86 296.2 85.67 303.22 85.67 303.22 49.86 317.12 49.86 317.12 43.27"/>
              <path class="cls-3" d="M216,42.9a21.18,21.18,0,0,0-15.36,6.29,20.41,20.41,0,0,0-6.43,15,20.52,20.52,0,0,0,7.05,16.13,21.94,21.94,0,0,0,29.93-.71,20.48,20.48,0,0,0,6.39-15.18A21.68,21.68,0,0,0,216,42.9Zm14.64,21.52a14.75,14.75,0,0,1-4.3,10.68,14.77,14.77,0,0,1-25.18-10.78,14.41,14.41,0,0,1,4.28-10.57,14.84,14.84,0,0,1,20.95,0A14.65,14.65,0,0,1,230.63,64.42Z"/>
              <path class="cls-3" d="M329.16,43.27l-10.93,42.4h7L328,74.73h19.61l2.91,10.94h7.3l-11.25-42.4ZM329.81,68l4.55-18.15h6.74L345.85,68Z"/>
          </svg>
        </div>
      </div>
      </check>
      <div class="frame_center settings_form">
        <h1>{{@page_data.title}}</h1>
        <p align="center">
          <button type="button" id="use_login_pass">
            Использовать аккаунт Агорта
          </button>
          <br>
          <check if="{{mb_strpos(mb_strtolower(@SERVER['SERVER_SOFTWARE']), 'lighttpd')===false && mb_strpos(mb_strtolower(@SERVER['SERVER_SOFTWARE']), 'ksweb')===false}}">
          <small>

            Если у вас еще нет учетной записи в сервисе Агорта, то вы можете зарегистрироваться пройдя по ссылке <a href="{{@agorta_url}}/registration" target="_blank">
            {{@agorta_url}}</a>
          </small>
          </check>
        </p>
        <form name="form_settings_start" action="/settings/start" method="POST" class="{{!@error?'hide':''}} no_ajax">
          <p class="false">{{@error}}</p>
          <table width="100%">
            <tr>
              <td>
                <b>Адрес запроса (без https://)</b>*
              </td>
              <td align="right">
                <input type="text" class="apiset" name="domen" placeholder="Адрес запроса (пример: test.agorta.ru)" value="{{@POST.domen}}" autocomplete="off" required="true">
              </td>
            </tr>
            <tr>
              <td>
                <b>E-mail</b>*
              </td>
              <td align="right">
                <input type="text" name="email" placeholder="Адрес электронной почты" autocomplete="off" required="true" value="{{@POST.email}}">
              </td>
            </tr>
            <tr>
              <td>
                <b>Пароль</b>*
              </td>
              <td align="right">
                <input type="password" name="pass" placeholder="Пароль пользователя" autocomplete="off" required="true" value="{{@POST.pass}}">
              </td>
            </tr>
            <tr>
              <td colspan="2" align="center">
                * обязательное поле
              </td>
            </tr>
            <tr>
              <td colspan="2" align="center">
                <input type="submit" value="Войти">
              </td>
            </tr>
          </table>
        </form>
        <p align="center">
          <a href="/settings/api">
            <button type="button">
              Войти по ключу API
            </button>
          </a>
        </p>
        <p align="center">
          <a href="/settings/autonomous">
            <button type="button">
              Автономный режим
              <br>
              <small>Используйте кассу без подключения к сервису Агорта</small>
            </button>
          </a>
        </p>
      </div>
    </td>
  </tr>
</table>

<link rel="stylesheet" href="/ui/css/jquery-ui.css">
<script type="text/javascript" src="/ui/scripts/jquery-ui.js"></script>
<script type="text/javascript">
$("input[name='domen']").autocomplete({
  source: "/api/searchsubdomain",
  minLength: 2,
  select: function( event, ui ) {
    $("input[name='domen']").val(ui.label);
  },
  focus: function( event, ui ) {
    $("input[name='domen']").val(ui.label);
  }
});
</script>