{% extends "base-titled.html" %}
{% load i18n %}

{% block reward__menu %}cur{% endblock %}

{% block page_header %}
<h2>{% trans 'Создать выплату' %}</h2>
{% endblock page_header %}

{% block page_content %}

<form action="" method="post" class="form_reward_edit">
  {% if form.errors %}
  <div class="error-forms">
    {% for label, message in form.errors.items %}
    <p> {{ label }}: {{ message }}
    {% endfor %}
  </div>
  {% endif %}
  {% csrf_token %}
  <input type="hidden" name="{{ form.staff_uid.html_name }}" value="{{ yauser.uid }}">
  <input type="hidden" name="{{ form.staff_login.html_name }}" value="{{ yauser.login }}">
<table class="g g_nobr g_gap_L g_middle g_max g_padding-t_XL">
  <tr>
    <td class="c" colspan="2">
      <table class="b-t b-t_half b-t_bdtop w420">
        <tr>
          <td>
            <label class="label label_forms">{% trans "Получатель" %}</label>
          <td>
            <span class="input input_size_L input_type_normal">
              {% blocktrans with name=form.reporter.html_name value=form.reporter.value|default_if_none:'' %}
              <input name="{{ name }}" value="{{ value }}" autocomplete="off" placeholder="логин" class="input__input">
              {% endblocktrans %}
            </span>
        <tr>
          <td>
            <label class="label label_forms">
              {% trans "Номер тикета в Стартреке" %}
            </label>
          <td>
            <span class="input input_size_L input_type_normal">
              {% blocktrans with name=form.startrek_ticket_code.html_name value=form.startrek_ticket_code.value|default_if_none:'' %}
              <input name="{{ name }}" value="{{ value }}" autocomplete="off" class="input__input">
              {% endblocktrans %}
        <tr>
          <td>
            <label class="label label_forms">
              {% trans "Дата поступления репорта" %}
            </label>
          <td>
            <span class="input input_size_L input_type_normal">
              {% blocktrans with name=form.ticket_created.html_name value=form.ticket_created.value|default_if_none:'' %}
              <input name="{{ name }}" value="{{ value }}" autocomplete="off" placeholder="ГГГГ-ММ-ДД" class="input__input">
              {% endblocktrans %}
        </table>
    <td class="c c_max" colspan="2">
  <tr>
    <td class="c">
      <label class="label label_forms">{% trans "Тип уязвимости" %}</label>
    </td>
    <td class="c">
      <span class="js-select js-select_size_L w200">
        <select name="vulnerability_type">
          {% for code, v in form.vulnerability_type.field.choices %}
          {% if form.vulnerability_type.value == code %}
          <option value={{ code }} selected>{{ v }}</option>
          {% else %}
          <option value={{ code }}>{{ v }}</option>
          {% endif %}
          {% endfor %}
        </select>
      </span>
    <td class="c">
      <div class="b b_gap-x_M b_middle">
        <div class="c">
          <p class="fz15">{{ form.vulnerability_type.points }}</p>
        </div>
        <div class="c">
          <p class="fz15">{% trans "Кол-во баллов" %}</p>
        </div>
        <div class="c">
          <span class="input input_size_L w260">
            <input name="points" size="1" autocomplete="off" placeholder="{% trans "Дополнительные баллы" %}" value="{{ form.points.value }}" class="input__input">
          </span>
        </div>
      </div>
    <td class="c c_max"></td>
  <tr>
    <td class="c"><label class="label label_forms">{% trans "Продукт" %}</label>
    <td class="c">
      <span class="js-select js-select_size_L w200">
        <select name="{{ form.product.html_name }}">
          {% for code, product in form.product.field.choices %}
          {% if form.product.value == code %}
          <option value="{{ code }}" selected>{{ product }}</option>
          {% else %}
          <option value="{{ code }}">{{ product }}</option>
          {% endif %}
          {% endfor %}
        </select>
      </span>
    <td class="c c_max" colspan="2">
  <tr>
    <td class="c">
      <label class="label label_forms">{% trans "Сумма в рублях" %}</label>
    </td>
    <td class="c">
      <span class="input input_size_L w260">
        <input name="payment_amount_rur" size="1" autocomplete="off" placeholder="₽" value="{{ form.payment_amount_rur.value }}" class="input__input">
      </span>
    <td class="c">
      <label class="label label_forms">{% trans "Сумма в долларах" %}</label>
    </td>
    <td class="c">
      <span class="input input_size_L w260">
        <input name="payment_amount_usd" size="1" autocomplete="off" placeholder="$" value="{{ form.payment_amount_usd.value }}" class="input__input">
      </span>
    <td class="c c_max"></td>
  <tr>
    <td class="c c_top"><label class="label label_forms">{% trans "Комментарий к выплате" %}</label>
    <td class="c c_top" colspan="2">
      <span class="textarea textarea_size_M w571">
        <textarea placeholder="" rows="10" class="textarea__textarea" name="comment">{{form.comment.value|default_if_none:''}}</textarea>
      </span>
    <td class="c c_max">
  <tr>
    <td class="c">
    <td class="c" colspan="2">
      <div class="b b_gap-x_XS b_middle">
        <div class="c">
          <button class="button button_size_L button_type_action">
            <span class="button__label">{% trans "Сохранить" %}</span>
          </button>
        </div>
        <div class="c">
          <a href="{% url "reward:list" %}" class="button button_size_L button_type_normal">
            <span class="button__label">{% trans "Отмена" %}</span>
          </a>
        </div>
      </div>
</table>
</form>
{% endblock %}
