<commit_before>{# List of all orders for an account. #}

{% extends "base.html" %}

{% block head_title %}Orders {{ account['email'] }}{% end %}
{% block body_title %}
{% module Icon('order') %}
Orders
{% module Entity(account) %}
{% end %}

{% block content %}
<form action="{{ reverse_url('account_orders', account['email']) }}"
      id="refresh"
      role="form"
      class="form-inline"
      method="GET">
  <div class="row">
    <div class="col-md-10 col-md-offset-1">
      <table width="100%">
	<tr>
	  <td>
	    <label class="glyphicon glyphicon-filter"></label>
	    <div class="form-group">
	      <label for="status">Filter by</label>
	      <select name="status" id="status" class="form-control refresh">
		<option value="">[any status]</option>
		{% for status in settings['ORDER_STATUSES'] %}
		{% set sid = status['identifier'] %}
		{% set sel = sid == params.get('status') and 'selected' or '' %}
		<option {{ sel }} value="{{ sid }}">{{ sid.capitalize() }}</option>
		{% end %}
	      </select>
	    </div>
	  </td>
	  <td>
	    {% if is_staff or account['email'] == current_user['email'] %}
	    <a href="{{ reverse_url('account_groups_orders', account['email']) }}">
	      {% module Icon('group') %}
	      All orders in account's groups
	    </a>
	    {% end %}
	  </td>
	</tr>
      </table>
    </div>
    <div class="col-md-1">
    </div>
  </div>
</form>
<br>

<div class="row">
  <div class="col-md-10 col-md-offset-1">
    {% set url_func = functools.partial(reverse_url, 'account_orders', account['email'], **params) %}
    {% include 'paging.html' %}
  </div>
  <div class="col-md-1">
  </div>
</div>

<div class="row">
  <div class="col-md-10 col-md-offset-1">
    <table class="table table-striped">
      <tr>
	<th width="65">Order</th>
	<th width="15%">Status</th>
	<th width="20%">Modified</th>
      </tr>
      {% for order in orders %}
      <tr>
	<td>
	  <a href="{{ reverse_url('order', order['_id']) }}">{{ order.get('title', order['_id']) }}</a>
	</td>
	<td>{% module Icon(order['status'], label=True) %}</td>
	<td class="localtime">{{ order['modified'] }}</td>
      </tr>
      {% end %}
    </table>
  </div>
  <div class="col-md-1">
  </div>
</div>
{% end %}

{% block javascript_code %}
<script>
$(document).ready(function() {
    $('.refresh').change(function () {
	$('#refresh').submit();
    });
});
</script>
{% end %}<commit_msg>Fixed accounts orders page for milestones.<commit_after>{# List of all orders for an account. #}

{% extends "base.html" %}

{% block head_title %}Orders {{ account['email'] }}{% end %}
{% block body_title %}
{% module Icon('order') %}
Orders
{% module Entity(account) %}
{% end %}

{% block content %}
<form action="{{ reverse_url('account_orders', account['email']) }}"
      id="refresh"
      role="form"
      class="form-inline"
      method="GET">
  <div class="row">
    <div class="col-md-10 col-md-offset-1">
      <table width="100%">
	<tr>
	  <td>
	    <label class="glyphicon glyphicon-filter"></label>
	    <div class="form-group">
	      <label for="status">Filter by</label>
	      <select name="status" id="status" class="form-control refresh">
		<option value="">[any status]</option>
		{% for status in settings['ORDER_STATUSES'] %}
		{% set sid = status['identifier'] %}
		{% set sel = sid == params.get('status') and 'selected' or '' %}
		<option {{ sel }} value="{{ sid }}">{{ sid.capitalize() }}</option>
		{% end %}
	      </select>
	    </div>
	  </td>
	  <td>
	    {% if is_staff or account['email'] == current_user['email'] %}
	    <a href="{{ reverse_url('account_groups_orders', account['email']) }}">
	      {% module Icon('group') %}
	      All orders in account's groups
	    </a>
	    {% end %}
	  </td>
	</tr>
      </table>
    </div>
    <div class="col-md-1">
    </div>
  </div>
</form>
<br>

<div class="row">
  <div class="col-md-10 col-md-offset-1">
    {% set url_func = functools.partial(reverse_url, 'account_orders', account['email'], **params) %}
    {% include 'paging.html' %}
  </div>
  <div class="col-md-1">
  </div>
</div>

<div class="row">
  <div class="col-md-12">
    <table width="100%" class="table table-striped">
      <tr>
	<th width="30%">Order</th>
	<th width="15%">Status</th>
	{% for st in settings['ORDER_LIST_MILESTONES'] %}
	<th>{% module Icon(st, label=True) %}</th>
	{% end %}
	<th width="10%">Modified</th>
      </tr>
      {% for order in orders %}
      <tr>
	<td>
	  <a href="{{ reverse_url('order', order['_id']) }}">{{ order.get('title', order['_id']) }}</a>
	</td>
	<td>{% module Icon(order['status'], label=True) %}</td>
	{% for st in settings['ORDER_LIST_MILESTONES'] %}
	<td>{{ order['milestones'].get(st) or '-' }}</td>
	{% end %}
	<td class="localtime">{{ order['modified'] }}</td>
      </tr>
      {% end %}
    </table>
  </div>
</div>
{% end %}

{% block javascript_code %}
<script>
$(document).ready(function() {
    $('.refresh').change(function () {
	$('#refresh').submit();
    });
});
</script>
{% end %}
{'fraction_non_alphanumeric': 0.2399598393574297, 'fraction_numerical': 0.008634538152610442, 'mean_word_length': 3.3237847222222223, 'pattern_counts': {'":': 0, '<': 135, '<?xml version=': 0, '>': 135, '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': '1440160', 'n_tokens_mistral': 1922, 'n_tokens_neox': 1745, 'n_words': 391}