<commit_before>{{!
  Partial to generate a form element for a field in the registration form.

  Parameters:

    - id: identifier of the field, same as the key used in the config file's
          registration.fields object
    - field: field information, same as in the config file but with extra
             'value' and 'left' fields also permitted.
}}


{{#ifEqual field.type "string"}}

  <input type="text" id="reg-{{id}}" name="field_{{id}}" value="{{ field.value }}" placeholder="{{ field.placeholder }}">

{{else}}{{#ifEqual field.type "select"}}

  <select name="field_{{id}}" id="reg-{{id}}">
    {{#each field.options}}
      <option
        {{#ifEqual ../value this}}
          selected="selected"
        {{/ifEqual}}
      >{{this}}</option>
    {{/each}}
  </select>

{{else}}{{#ifEqual field.type "purchase"}}

  <table class="purchase-option-list" id="reg-{{id}}">
    <tr><td>
      {{#ifEqual field.required false}}
        <input type="radio" class="purchase-option" name="field_{{id}}" value="None" data-cost="0"
          {{#ifEqual ../value None}}
            checked
          {{/ifEqual}}
          {{#unless can_change}}
            disabled="disabled"
          {{/unless}}
        >
          None
        </option>
      {{/ifEqual}}
    </td></tr>

    {{#each field.options}}
        <td class="purchase-option-name">
          <input type="radio" class="purchase-option" name="field_{{../id}}" value="{{@key}}" data-cost="{{cost}}" data-left="{{left}}" data-payment-state="{{../payment_state}}"
            {{#ifEqual ../value @key}}
              checked
            {{/ifEqual}}
            {{#ifEqual left 0}}
              disabled="disabled"
            {{/ifEqual}}
            {{#unless ../can_change}}
              disabled="disabled"
            {{/unless}}
            >
            {{@key}}
          </input>
        </td>
        <td class="purchase-option-price">
          {{cost_all_currencies}}
        </td>
        <td class="purchase-option-left">
          {{left}} left
        </td>
      </tr>
    {{/each}}
  </table>

  {{#ifEqual field.value "None"}}
  {{else}}
    {{#ifEqual field.payment_state 'unpaid'}}
      <div class="note">You have not yet made payment for this purchase, and can still change it.</div>
    {{/ifEqual}}
    {{#ifEqual field.payment_state 'pending'}}
      <div class="note">You have already paid for this purchase. The payment is pending authorization.</div>
    {{/ifEqual}}
    {{#ifEqual field.payment_state 'paid'}}
      <div class="note">You have already paid for this purchase.</div>
    {{/ifEqual}}
  {{/ifEqual}}

{{else}}{{#ifEqual field.type "documentation"}}

  {{{field.html}}}

{{else}}

  Unknown field type

{{/ifEqual}}{{/ifEqual}}{{/ifEqual}}{{/ifEqual}}<commit_msg>Fix wrong use of 'note' CSS class in purchase fields<commit_after>{{!
  Partial to generate a form element for a field in the registration form.

  Parameters:

    - id: identifier of the field, same as the key used in the config file's
          registration.fields object
    - field: field information, same as in the config file but with extra
             'value' and 'left' fields also permitted.
}}


{{#ifEqual field.type "string"}}

  <input type="text" id="reg-{{id}}" name="field_{{id}}" value="{{ field.value }}" placeholder="{{ field.placeholder }}">

{{else}}{{#ifEqual field.type "select"}}

  <select name="field_{{id}}" id="reg-{{id}}">
    {{#each field.options}}
      <option
        {{#ifEqual ../value this}}
          selected="selected"
        {{/ifEqual}}
      >{{this}}</option>
    {{/each}}
  </select>

{{else}}{{#ifEqual field.type "purchase"}}

  <table class="purchase-option-list" id="reg-{{id}}">
    <tr><td>
      {{#ifEqual field.required false}}
        <input type="radio" class="purchase-option" name="field_{{id}}" value="None" data-cost="0"
          {{#ifEqual ../value None}}
            checked
          {{/ifEqual}}
          {{#unless can_change}}
            disabled="disabled"
          {{/unless}}
        >
          None
        </option>
      {{/ifEqual}}
    </td></tr>

    {{#each field.options}}
        <td class="purchase-option-name">
          <input type="radio" class="purchase-option" name="field_{{../id}}" value="{{@key}}" data-cost="{{cost}}" data-left="{{left}}" data-payment-state="{{../payment_state}}"
            {{#ifEqual ../value @key}}
              checked
            {{/ifEqual}}
            {{#ifEqual left 0}}
              disabled="disabled"
            {{/ifEqual}}
            {{#unless ../can_change}}
              disabled="disabled"
            {{/unless}}
            >
            {{@key}}
          </input>
        </td>
        <td class="purchase-option-price">
          {{cost_all_currencies}}
        </td>
        <td class="purchase-option-left">
          {{left}} left
        </td>
      </tr>
    {{/each}}
  </table>

  {{#ifEqual field.value "None"}}
  {{else}}
    {{#ifEqual field.payment_state 'unpaid'}}
      <p class="note">You have not yet made payment for this purchase, and can still change it.</p>
    {{/ifEqual}}
    {{#ifEqual field.payment_state 'pending'}}
      <p class="note">You have already paid for this purchase. The payment is pending authorization.</p>
    {{/ifEqual}}
    {{#ifEqual field.payment_state 'paid'}}
      <p class="note">You have already paid for this purchase.</p>
    {{/ifEqual}}
  {{/ifEqual}}

{{else}}{{#ifEqual field.type "documentation"}}

  {{{field.html}}}

{{else}}

  Unknown field type

{{/ifEqual}}{{/ifEqual}}{{/ifEqual}}{{/ifEqual}}
{'fraction_non_alphanumeric': 0.1884760366182014, 'fraction_numerical': 0.0007180039490217197, 'mean_word_length': 2.3688029020556227, 'pattern_counts': {'":': 0, '<': 59, '<?xml version=': 0, '>': 59, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '338793', 'n_tokens_mistral': 1724, 'n_tokens_neox': 1661, 'n_words': 426}