<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: 			*/
// +----------------------------------------------------------------------+
// | PHP version 4/5                                                      |
// +----------------------------------------------------------------------+
// | Copyright (c) 2004-2010 ARMIA INC                                    |
// +----------------------------------------------------------------------+
// | This source file is a part of iScripts VistaCart                     |
// +----------------------------------------------------------------------+
// | Authors: Jipson<jipson.thomas@armiasystems.com>             		  |
// +----------------------------------------------------------------------+
?>
<?php echo $javascript->link('jquery.js'); ?>
<?php echo $javascript->link('hint.js'); ?>
<script language="JavaScript" type="text/JavaScript">
function clickSearch()
{
	document.frmUsers.submit();
}
</script>
<div >
<div align="center" class="subheading">
              <div align="left">Gift Card Users</div>
            </div>
            <br />			
			<div align="left" id="item_details_admin">
				<!--items display area start -->
					<!--
					<form action="" method="get" name="frmUsers">
    				<div style="padding-left:35px;">
  		 			 <select name="cmbSearchType" class="box2_admin">
					<option value="oid"  <? if($cmbSearchType == "oid" || $cmbSearchType == ""){ echo("selected"); } ?>>Order Number</option>
					<option value="orderstatus"  <? if($cmbSearchType == "orderstatus"){ echo("selected"); } ?>>Order Status</option>
					<option value="username"  <? if($cmbSearchType == "username"){ echo("selected"); } ?>>User Name</option>
					<option value="dateoforder"  <? if($cmbSearchType == "dateoforder"){ echo("selected"); } ?>>Date of Order (yyyy-mm-dd)</option>
				</select> &nbsp;
				<input type="text" name="txtSearch" maxlength="50" value="<? echo(htmlentities($txtSearch)); ?>" class="box2_admin" >
				<a style="cursor:pointer" onClick="javascript:clickSearch();"><?php echo $html->image('/img/search_bttn.gif');?></a>
	             </div>		
	             <br />							
               </form>	
                 <br />		
				 -->
              <div align="left" id="item_details_admin">
				<!--items display area start -->
				
				
<form name="customlist" method="post" action="/vistacart/customfieldvalues/edit">
				  <div align="center" id="items_display_area_admin">
						
									
									
                       <div id="list_admin_top">
					   					<div class="list9"><strong>#</strong></div>
										
										
										
										<div class="list14"><strong>
										<?php		
										echo $html->link(__('Card Name', true), array(
											'controller' => 'giftcardusers',
											'action' => 'index',
											'page' => (empty($this->passedArgs['page']) || $this->passedArgs['page'] == '')?'1' :  $this->passedArgs['page'],
											'limit' => $pagelimit,
											'sort' => 'GCRD.gift_code',
											'direction' => (empty($this->passedArgs['direction']) || $this->passedArgs['direction'] == 'asc')?'desc' : 'asc'											
										));?>
										
										</strong></div>
										<div class="listp6"><strong>
										<?php		
										echo $html->link(__('User Card Code', true), array(
											'controller' => 'giftcardusers',
											'action' => 'index',
											'page' => (empty($this->passedArgs['page']) || $this->passedArgs['page'] == '')?'1' :  $this->passedArgs['page'],
											'limit' => $pagelimit,
											'sort' => 'GDET.card_code',
											'direction' => (empty($this->passedArgs['direction']) || $this->passedArgs['direction'] == 'asc')?'desc' : 'asc'											
										));?>										
										</strong></div>
										
										<div class="listp6"><strong>
										<?php		
										echo $html->link(__('User Name', true), array(
											'controller' => 'giftcardusers',
											'action' => 'index',
											'page' => (empty($this->passedArgs['page']) || $this->passedArgs['page'] == '')?'1' :  $this->passedArgs['page'],
											'limit' => $pagelimit,
											'sort' => 'ADDR.fname',
											'direction' => (empty($this->passedArgs['direction']) || $this->passedArgs['direction'] == 'asc')?'desc' : 'asc'											
										));?>
										
										</strong></div>
										<div class="list14"><strong><?php echo $paginator->sort('Date', 'date'); ?></strong></div>	
										<div class="listp6"><strong>
										<?php		
										echo $html->link(__('Amount used', true), array(
											'controller' => 'giftcardusers',
											'action' => 'index',
											'page' => (empty($this->passedArgs['page']) || $this->passedArgs['page'] == '')?'1' :  $this->passedArgs['page'],
											'limit' => $pagelimit,
											'sort' => 'amnt_used',
											'direction' => (empty($this->passedArgs['direction']) || $this->passedArgs['direction'] == 'asc')?'desc' : 'asc'											
										));?>
										</strong>
										</div>	
										<div align="left" class="float_clear"><?php echo $html->image('/img/clear.gif', array('width' => 1, 'height' => 1));?></div>
						</div>




				<?php
				$cnt=1;
	         if(!empty($giftdet)){
	foreach ($giftdet as $gdet){?>   
						<div id="list_admin">
										<div class="list9"><?php echo $cnt++;?></div>										
										
										<div class="list14">
										<?php echo $gdet["GCRD"]['gift_code']; ?>
										</div>
										
										<div class="listp6">
										<?php echo $gdet["GDET"]['card_code']; ?>
										</div>									
										 
										
										<div class="listp6">
										<?php echo $gdet["ADDR"]['fname'].' '.$gdet["ADDR"]['lname']; ?>
                                        </div> 
										
										<div class="list14">										
										<?php
											$gdt	= strtotime($gdet["Giftcarduser"]['date']);											
											echo date("m-d-Y",$gdt );
										?>
                                        </div>
										
										<div class="listp6">
										<?php echo $gdet["Giftcarduser"]['amnt_used']; ?>
                                        </div>                                      
										
										<div align="left" class="float_clear"><?php echo $html->image('/img/clear.gif', array('width' => 1, 'height' => 1));?></div>
						</div>
			 <?php 		
			 } ?>
			   <div id="list_admin">									
										
										<div>&nbsp;</div>
										<div><?php echo $this->renderElement('pagination'); // Render the pagination element ?> </div>
										<div>&nbsp;</div>	
																	
										<div align="left" class="float_clear"><?php echo $html->image('/img/clear.gif', array('width' => 1, 'height' => 1));?></div>
						          </div>			
								   <div id="list_admin">									
										
										<div>&nbsp;</div>
										<div><input type="button" value="Back"  onClick="javascript:history.go(-1);" class="buttn_admin"></div>
										<div>&nbsp;</div>	
																	
										<div align="left" class="float_clear"><?php echo $html->image('/img/clear.gif', array('width' => 1, 'height' => 1));?></div>
						          </div>			
			 <?php } else { ?>
			          <div id="list_admin">									
										
										<div>&nbsp;</div>
										<div><strong>Sorry no gift card users found !</strong></div>
										<div>&nbsp;</div>	
										<div>&nbsp;</div>										
										<div align="left" class="float_clear"><?php echo $html->image('/img/clear.gif', array('width' => 1, 'height' => 1));?></div>
						</div>			     
			 <?php } ?>
						           
				  </div>
				  </div>  </div>