{{ header }}{{ column_left }}
<div id="content">
  <div class="page-header">
    <div class="container-fluid">
      <div class="pull-right">
        <button type="button" data-toggle="tooltip" title="{{ button_filter }}" onclick="$('#filter-member-point').toggleClass('hidden-lg');" class="btn btn-default"><i class="fa fa-filter"></i></button>
        <button type="button" id="button-export" data-toggle="tooltip" title="{{ button_export }}" class="btn btn-info" style="background-color: darkgreen;"><i class="fa fa-file-excel-o"></i></button>
      </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="row">
      <div id="filter-member-point" class="col-sm-12 hidden-lg">
        <div class="panel panel-default">
          <div class="panel-heading">
            <h3 class="panel-title"><i class="fa fa-filter"></i> {{ text_filter }}</h3>
          </div>
          <div class="panel-body">
            <div class="form-group">
              <label class="control-label" for="input-email">{{ entry_email }}</label>
              <input type="text" name="filter_email" value="{{ filter_email }}" placeholder="{{ entry_email }}" id="input-email" class="form-control" />
            </div>
             <div class="form-group">
              <label class="control-label" for="input-phone_no">{{ entry_phone_no }}</label>
              <input type="text" name="filter_phone_no" value="{{ filter_phone_no }}" placeholder="{{ entry_phone_no }}" id="input-phone_no" class="form-control" />
            </div>
            <div class="form-group text-right">
              <button type="button" id="button-filter" class="btn btn-default"><i class="fa fa-filter"></i> {{ button_filter }}</button>
            </div>
          </div>
        </div>
      </div>
    <div class="col-sm-12">
      <div class="panel panel-default">
        <div class="panel-heading">
          <h3 class="panel-title"><i class="fa fa-list"></i> {{ text_list }}</h3>
        </div>
        <div class="panel-body">
          <form action="{{ delete }}" method="post" enctype="multipart/form-data" id="form-member-reward">
            <div class="table-responsive">
              <table id="tbl-tier" class="table table-bordered table-hover">
                <thead>
                  <tr>
                    <td class="text-left">{{ column_email }}</td>
                    <td class="text-left">{{ column_phone_no }}</td>
                    <td class="text-left">{{ column_order_no }}</td>
                    <td class="text-left">{{ column_regular_price_amount }}</td>
                    <td class="text-left">{{ column_sales_price_amount }}</td>
                    <td class="text-left">{% if sort == 'point' %}
                      <a href="{{ sort_point }}" class="{{ order|lower }}">{{ column_point }}</a>
                      {% else %}
                      <a href="{{ sort_point }}">{{ column_point }}</a>
                      {% endif %}</td>
                    <td class="text-left">{% if sort == 'expiry_date' %}
                      <a href="{{ sort_expiry_date }}" class="{{ order|lower }}">{{ column_expiry_date }}</a>
                      {% else %}
                      <a href="{{ sort_expiry_date }}">{{ column_expiry_date }}</a>
                      {% endif %}</td>
                    <td class="text-left">{% if sort == 'available_point' %}
                    <a href="{{ sort_available_point }}" class="{{ order|lower }}">{{ column_available_point }}</a>
                      {% else %}
                      <a href="{{ sort_available_point }}">{{ column_available_point }}</a>
                      {% endif %}</td>
                    <td class="text-left">{{ column_used_point }}</td>
                    <td class="text-left">{{ column_expired_point }}</td>
                    <td class="text-left">{{ column_is_cancelled }}</td>
                    <td class="text-left">{% if sort == 'date_added' %}
                      <a href="{{ sort_date_added }}" class="{{ order|lower }}">{{ column_date_added }}</a>
                      {% else %}
                      <a href="{{ sort_date_added }}">{{ column_date_added }}</a>
                      {% endif %}</td>
                    <td class="text-right">{{ column_action }}</td>
                  </tr>
                </thead>
                <tbody>
                  {% if member_points %}
                  {% for member_point in member_points %}
                  <tr>
                    <td class="text-left" >{{ member_point.email }}</td>
                    <td class="text-left" >{{ member_point.phone_no }}</td>
                    <td class="text-left" >{{ member_point.order_no  }}</td>
                    <td class="text-left" >{{ member_point.regular_price_amount  }}</td>
                    <td class="text-left" >{{ member_point.sales_price_amount   }}</td>
                    <td class="text-left">{{ member_point.point }}</td>
                    <td class="text-left">{{ member_point.expiry_date }}</td>
                    <td class="text-left">{{ member_point.available_point}}</td>
                    <td class="text-left">{{ member_point.used_point}}</td>
                    <td class="text-left">{{ member_point.expired_point}}</td>
                    <td class="text-left">{{ member_point.is_cancelled ? text_yes : text_no }}</td>
                    <td class="text-left">{{ member_point.date_added }}</td>
                    <td class="text-right"><a href="{{ member_point.edit }}" data-toggle="tooltip" title="{{ button_edit }}" class="btn btn-primary"><i class="fa fa-pencil"></i></a></td>
                  </tr>
                  {% endfor %}
                  {% else %}
                  <tr>
                    <td class="text-center" colspan="13">{{ text_no_results }}</td>
                  </tr>
                  {% endif %}
                </tbody>
              </table>
            </div>
          </form>
          <div class="row">
            <div class="col-sm-6 text-left">{{ pagination }}</div>
            <div class="col-sm-6 text-right">{{ results }}</div>
          </div>
        </div>
      </div>
  </div>
  </div>
</div>
{{ footer }} 

<style>
#tbl-tier > tbody > tr > td {
    white-space: normal;
    word-wrap: break-word;
}

.row-fix-width
{
  max-width:100px;
}
</style>

<script type="text/javascript"><!--
  $('#button-filter').on('click', function() {
    url = 'index.php?route=member/point&user_token={{ user_token }}';
    var filter_email = $('input[name=\'filter_email\']').val();
    if (filter_email) {
      url += '&filter_email=' + encodeURIComponent(filter_email);
    }
    var filter_phone_no = $('input[name=\'filter_phone_no\']').val();
    if (filter_phone_no) {
      url += '&filter_phone_no=' + encodeURIComponent(filter_phone_no);
    }
    location = url;
  });

 $('#button-export').on('click', function() {
    url = 'index.php?route=member/point/export&user_token={{ user_token }}';
    var filter_email = $('input[name=\'filter_email\']').val();
    if (filter_email) {
      url += '&filter_email=' + encodeURIComponent(filter_email);
    }
    var filter_phone_no = $('input[name=\'filter_phone_no\']').val();
    if (filter_phone_no) {
      url += '&filter_phone_no=' + encodeURIComponent(filter_phone_no);
    }
    location = url;
  });
  //--></script>
  <script type="text/javascript"><!--
  $('.date').datetimepicker({
    language: '{{ datepicker }}',
    pickTime: false
  });
  //--></script>