<div class="my-account">
	<div class="heading" style="margin-bottom:0;">
        <dl class="acctip">
            <dt>My Coupons</dt>
        </dl>
    </div>
<div class="right_big_con">
	<table cellspacing="0" cellpadding="0" border="0" width="100%" class="hisorder">
		<tbody><tr>
			<th width="50">No.</th>
			<th>Coupon Code</th>
			<th>Amount(<font color="Red">USD</font>)</th>
			<th>Create Time</th>
			<th>Description</th>
			<th>Status</th>
		</tr>
		<?php if (is_array($coupons)){?>
		<?php foreach ($coupons as $key=>$c){?>
		<tr>				
			<td><?php echo $key+1?></td>
			<td><?php echo $c['code']?></td>
			<td><?php echo $c['discount']?></td>
			<td><?php echo date("Y-m-d",strtotime($c['date_added']));?></td>
			<td><?php echo $c['description']?></td>
			<td>
				<?php if($c['status'] == 1){?>
					<font color="Blue">Usable</font>
				<?php }else {?>
					<?php echo $c['usable_times'] ==0?'<font color="black">Used</font>':'<font color="blue">'.$c['usable_times'].' times available</font>';?>				
				<?php }?>
			</td>
		</tr>		
		<?php }?>
		<?php }?>
		</tbody>
	</table>
	<br />
  <div class="toolbar clearfix">
          <div class="sorter_bottom">
               <div class="col-sm-8 left"><?php echo $text_results;?></div>
               <div class="col-sm-16 right">                   
                    <a href="<?php echo $action . '&page=' . (($page>1)?($page-1):$page); ?>"><?php echo 'Previous'?></a>                     
                    <?php foreach ($pages as $f_page) { ?>        
                    <?php if ( $f_page['value'] < ($page - 2) ) {continue; } ?>
                    <?php if ( $f_page['value'] > ($page + 4) ) {continue; } ?>                                               
                    <?php if ($f_page['value'] == $page) { ?>
                    <b class="selected"><?php $x = explode(" ",$f_page['text']);echo $x[0]; ?></b>
                    <?php } else { ?>
                      <a class="page_btn" href="<?php echo $action . '&page=' . $f_page['value']; ?>"><?php $x = explode(" ",$f_page['text']);echo $x[0]; ?></a></td>
                    <?php } ?>   
                    <?php } ?>                       
                    <a class="page_btn" href="<?php echo $action . '&page=' . (($page<count($pages))?($page+1):$page); ?>"><?php echo 'Next'?></a>                     
                    <label>Go to Page</label>
                    <select onchange="return SelectPage(this.value)" style="width:50px;">
                        <?php foreach ($pages as $f_page){?>
                        <option value="<?php echo $f_page['value']?>" <?php if ($f_page['value'] == $page){echo 'selected';}?>><?php echo $f_page['value']?></option>
                        <?php };?>
                    </select>
                    <script type="text/javascript">
						function SelectPage(page) {
							window.location.href="<?php echo $action; ?>&page=" + page;
						}
					</script>
             </div>
          </div>
     </div>
	<div class="buttons" style="text-align:right; margin-top:20px;">
      <a style="margin-right:0;" href="/index.php?controller=account" class="btn_button btn_gray"><i class="icon-back"></i>Back to Account</a>
    </div>
  </div>
 </div>