{{ header }}{{ column_left }}
<div id="content">
  <div class="page-header">
    <div class="container-fluid">
      <div class="pull-right">
      <a href="{{ add }}" data-toggle="tooltip" title="{{ button_add }}" class="btn btn-primary"><i class="fa fa-plus"></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_list }}</h3>
      </div>
      <div class="panel-body">
        <form action="{{ delete }}" method="post" enctype="multipart/form-data" id="form-reward">
          <div class="alert alert-info"><i class="fa fa-info-circle"></i> {{ text_tier }}</div>
          <div class="table-responsive">
            <table id="tbl-tier" class="table table-bordered table-hover">
              <thead>
                <tr>
                  <td class="text-left">{{ column_image }}</td>
                  <td class="text-left">{% if sort == 'title' %}
                    <a href="{{ sort_title }}" class="{{ order|lower }}">{{ column_title }}</a>
                    {% else %}
                    <a href="{{ sort_title }}">{{ column_title }}</a>
                    {% endif %}</td>
                  <td class="text-left">{{ column_description }}</td>
                  <td class="text-left">{{ column_tc }}</td>
                  <td class="text-left">{{ column_multiplier_rate }}</td>
                  <td class="text-left">{{ column_details }}</td>
                  <td class="text-left">{% if sort == 'status' %}
                    <a href="{{ sort_status }}" class="{{ order|lower }}">{{ column_status }}</a>
                    {% else %}
                    <a href="{{ sort_status }}">{{ column_status }}</a>
                    {% endif %}</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 tiers %}
                {% for tier in tiers %}
                <tr>
                  <td class="text-center">{% if tier.image %} <img src="{{ tier.image }}" alt="{{ product.name }}" class="img-thumbnail" /> {% else %} <span class="img-thumbnail list"><i class="fa fa-camera fa-2x"></i></span> {% endif %}</td>
                  <td class="text-left">{{ tier.title }}</td>
                  <td class="text-left row-fix-width" >{{ tier.description }}</td>
                  <td class="text-left row-fix-width" >{{ tier.term_and_condition }}</td>
                  <td class="text-left">
                    <b>{{ text_regular_item }}:</b>  {{ tier.multiply_regular_item }} <br> 
                    <b>{{ text_sales_item }}:</b>  {{ tier.multiply_sales_item }} <br> 
                  </td>
                  <td class="text-left">
                       <b>{{ text_achieve_tier_amount }}:</b>  {{ tier.achieve_tier_amount }} <br> 
                       <b>{{ text_maintain_tier_type }}:</b>  {{  tier.maintain_tier_type_id == 1  ? text_cash : text_point}} <br> 
                       <b>{{ text_maintain_tier_amount }}:</b>  {{ tier.maintain_tier_amount }} <br> 
                       <b>{{ text_point_expiry }}:</b>  {{ tier.point_expiry }} <br> 
                       <b>{{ text_tier_expiry }}:</b>  {{ tier.tier_expiry }} <br> 
                  </td>
                  <td class="text-left">{{ tier.status }}</td>
                  <td class="text-left">{{ tier.date_added }}</td>
                  <td class="text-right">
                    <a href="{{ tier.edit }}" data-toggle="tooltip" title="{{ button_edit }}" class="btn btn-primary"><i class="fa fa-pencil"></i></a>
                    {% if (tier.delete) %}
                      <a href="{{ tier.delete }}" data-toggle="tooltip" title="{{ button_delete }}" class="btn btn-danger"><i class="fa fa-trash-o"></i></a>
                     {% endif %}
                  </td>
                </tr>
                {% endfor %}
                {% else %}
                <tr>
                  <td class="text-center" colspan="10">{{ 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>
{{ footer }} 

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

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

