{{ header }}{{ column_left }}
<div id="content">
  <div class="page-header">
    <div class="container-fluid">
      <div class="pull-right">
        <a href="{{ cancel }}" data-toggle="tooltip" title="{{ button_cancel }}" class="btn btn-default"><i class="fa fa-reply"></i></a>
      </div>
      <h1>{{ heading_title }}</h1>
      <ul class="breadcrumb">
        {% for breadcrumb in breadcrumbs %}
        <li><a href="{{ breadcrumb.href }}">{{ breadcrumb.text }}</a></li>
        {% endfor %}
      </ul>
    </div>
  </div>
  <div class="container-fluid">
    {% if error_warning %}
    <div class="alert alert-danger alert-dismissible"><i class="fa fa-exclamation-circle"></i> {{ error_warning }}
      <button type="button" class="close" data-dismiss="alert">&times;</button>
    </div>
    {% endif %}
    {% if success %}
    <div class="alert alert-success alert-dismissible"><i class="fa fa-check-circle"></i> {{ success }}
      <button type="button" class="close" data-dismiss="alert">&times;</button>
    </div>
    {% endif %}
    <div class="panel panel-default">
      <div class="panel-heading">
        <h3 class="panel-title"><i class="fa fa-list"></i> {{ text_order_list }}</h3>
      </div>
      <div class="panel-body">
        <div class="well">
          <div class="row">
            <div class="col-sm-4">
              <div class="form-group">
                <label class="control-label" for="input-start-date">{{ entry_start_date }}</label>
                <div class="input-group date">
                  <input type="text" name="filter_start" value="{{ filter_start }}" placeholder="YYYY-MM-DD" data-date-format="YYYY-MM-DD" id="input-start-date" class="form-control" />
                  <span class="input-group-btn">
                  <button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button>
                  </span>
                </div>
              </div>
            </div>
            <div class="col-sm-4">
              <div class="form-group">
                <label class="control-label" for="input-end-date">{{ entry_end_date }}</label>
                <div class="input-group date">
                  <input type="text" name="filter_end" value="{{ filter_end }}" placeholder="YYYY-MM-DD" data-date-format="YYYY-MM-DD" id="input-end-date" class="form-control" />
                  <span class="input-group-btn">
                  <button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button>
                  </span>
                </div>
              </div>
            </div>
            <div class="col-sm-4">
              <div class="form-group">
                <label class="control-label" for="input-status">{{ entry_status }}</label>
                <select name="filter_status" id="input-status" class="form-control">
                  <option value="" {% if filter_status == null %} selected{% endif %}>{{ text_option_all }}</option>
                  {% for option_key,option in status_options %}
                    <option value="{{ option_key }}"{% if filter_status != null and filter_status == option_key %} selected{% endif %}>{{ option }}</option>
                  {% endfor %}
                </select>
              </div>
              <button type="button" id="button-filter" class="btn btn-primary pull-right"><i class="fa fa-filter"></i> {{ button_filter }}</button>
            </div>
          </div>
        </div>
        <div class="table-responsive">
          <table class="table table-bordered table-hover">
            <thead>
              <tr>
                <th class="text-left">{{ column_order_id }}</th>
                <th class="text-left">{{ column_created }}</th>
                <th class="text-left">{{ column_status }}</th>
                <th class="text-center">{{ column_fba_item_count }}</th>
                <td class="text-right">{{ column_action }}</td>
              </tr>
            </thead>
            <tbody>
              {% if not orders %}
                <tr>
                  <td class="text-center" colspan="6">{{ text_no_results }}</td>
                </tr>
              {% else %}
                {% for order in orders %}
                  <tr>
                    <td class="text-left"><a href="{{ order.order_link }}">{{ order.order_id }}</a></td>
                    <td class="text-left">{{ order.created }}</td>
                    <td class="text-left">{{ status_options[order.status] }}</td>
                    <td class="text-center">{{ order.fba_item_count }}</td>
                    <td class="text-right"><a href="{{ order.view }}" data-toggle="tooltip" title="{{ button_view }}" class="btn btn-primary"><i class="fa fa-pencil"></i></a></td>
                  </tr>
                {% endfor %}
              {% endif %}
            </tbody>
          </table>
        </div>
      </div>
    </div>
  </div>
</div>
<script type="text/javascript"><!--
$('#button-filter').on('click', function() {
  var url = 'index.php?route=extension/openbay/fba/orderlist&user_token={{ user_token }}';

  var filter_start = $('input[name=\'filter_start\']').val();

  if (filter_start) {
    url += '&filter_start=' + encodeURIComponent(filter_start);
  }

  var filter_end = $('input[name=\'filter_end\']').val();

  if (filter_end) {
    url += '&filter_end=' + encodeURIComponent(filter_end);
  }

  var filter_status = $('select[name=\'filter_status\']').val();

  if (filter_status) {
    url += '&filter_status=' + encodeURIComponent(filter_status);
  }

  location = url;
});
//--></script>
<script src="view/javascript/jquery/datetimepicker/bootstrap-datetimepicker.min.js" type="text/javascript"></script>
<link href="view/javascript/jquery/datetimepicker/bootstrap-datetimepicker.min.css" type="text/css" rel="stylesheet" media="screen" />
<script type="text/javascript"><!--
$('.date').datetimepicker({
	language: document.cookie.match(new RegExp('language=([^;]+)'))[1],
	pickTime: false
});
//--></script>
{{ footer }}
