{include file="_partials/head.tpl"}

<div class="page-head">
  <div>
    <h1>{page.title}</h1>
    <p class="muted"><a href="/admin/users">← К списку</a></p>
  </div>
</div>

<form method="post" action="{form_action}" class="form">
  {csrf}

  <div class="form-row">
    <div class="form-group">
      <label>Имя</label>
      <input type="text" name="name" value="{user_row.name}" required>
    </div>
    <div class="form-group">
      <label>Email</label>
      <input type="email" name="email" value="{user_row.email}" required>
    </div>
  </div>

  <div class="form-row">
    <div class="form-group">
      <label>Роль</label>
      <select name="role">
        [foreach var="roles" as="r"]
          <option value="{r}" [if {user_row.role}={r}]selected[/if]>{r}</option>
        [/foreach]
      </select>
    </div>
    <div class="form-group">
      <label>Статус</label>
      <label class="checkbox"><input type="checkbox" name="is_active" value="1" [if {user_row.is_active}]checked[/if]> Активен</label>
    </div>
  </div>

  <div class="form-group">
    <label>Пароль [if {is_edit}](оставьте пустым чтобы не менять)[/if]</label>
    <input type="password" name="password" minlength="8">
    <small class="help">Минимум 8 символов.</small>
  </div>

  <div class="form-actions">
    <button class="btn btn-primary" type="submit">Сохранить</button>
    <a class="btn btn-secondary" href="/admin/users">Отмена</a>
  </div>
</form>

{include file="_partials/foot.tpl"}
