<?php echo $header; ?>
<div id="content">
  <div class="breadcrumb">
    <?php foreach ($breadcrumbs as $breadcrumb) { ?>
    <?php echo $breadcrumb['separator']; ?><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a>
    <?php } ?>
  </div>
  <div class="box">
    <div class="heading">
      <h1><img src="view/image/report.png" alt="" /> <?php echo $heading_title; ?></h1>
	  
	  <div class="buttons">
	  Enter Product Name : <input name="filter_name" value="" id="product_id"/>
	  <a href="<?php echo $Excel; ?>" class="button" id="report">Print in Excel</a> 
	  <a href="<?php echo $ExcelUpdate; ?>" class="button" id="report">Update / Print in Excel</a> 
	  <a target="_blank" href="http://www.tresorjewellery.com.au/script/update.php" class="button">Update the Products</a> 
    </div>
    </div></div>
  <!--   <div class="content">
      <table class="list">
        <thead>
          <tr>
            <td class="left"><?php echo $column_name; ?></td>
            <td class="left"><?php echo $column_model; ?></td>
			<td class="left"><?php echo 'M1'; ?></td>
			<td class="left"><?php echo 'M2'; ?></td>
			<td class="left"><?php echo 'M3'; ?></td>
			<td class="left"><?php echo 'G1'; ?></td>
			<td class="left"><?php echo 'G2'; ?></td>
			<td class="left"><?php echo 'G3'; ?></td>
			<td class="left"><?php echo 'G4'; ?></td>
			<td class="left"><?php echo 'G5'; ?></td>
          </tr>
        </thead>
        <tbody>
          <?php if ($products) { ?>
          <?php foreach ($products as $product) { ?>
          <tr>
            <td class="left"><?php echo $product['name']; ?></td>
            <td class="left"><?php echo $product['model']; ?></td>
			<td class="left"><?php foreach ($product['metal1'] as $metal) { ?>
            <?php echo $metal['metal_code']; ?>
			<?php } ?></td>
			<td class="left"><?php foreach ($product['metal2'] as $metal) { ?>
            <?php echo $metal['metal_code']; ?>
			<?php } ?></td>
			<td class="left"><?php foreach ($product['metal3'] as $metal) { ?>
            <?php echo $metal['metal_code']; ?>
			<?php } ?></td>
			<td class="left"><?php foreach ($product['gem1'] as $gem) { ?>
            <?php echo $gem['gemname']; ?>
			<?php } ?></td>
			<td class="left"><?php foreach ($product['gem2'] as $gem) { ?>
            <?php echo $gem['gemname']; ?>
			<?php } ?></td>
			<td class="left"><?php foreach ($product['gem3'] as $gem) { ?>
            <?php echo $gem['gemname']; ?>
			<?php } ?></td>
			<td class="left"><?php foreach ($product['gem4'] as $gem) { ?>
            <?php echo $gem['gemname']; ?>
			<?php } ?></td>
			<td class="left"><?php foreach ($product['gem5'] as $gem) { ?>
            <?php echo $gem['gemname']; ?>
			<?php } ?></td>
          </tr>
          <?php } ?>
          <?php } else { ?>
          <tr>
            <td class="center" colspan="4"><?php echo $text_no_results; ?></td>
          </tr>
          <?php } ?>
        </tbody>
      </table>
     <!--  <div class="pagination"><?php echo $pagination; ?></div> 
    </div>
  </div>   
</div>-->

<script type="text/javascript"><!--
$('input[name=\'filter_name\']').autocomplete({
	delay: 0,
	source: function(request, response) {
		$.ajax({
			url: 'index.php?route=catalog/product/autocomplete&token=<?php echo $token; ?>&filter_name=' +  encodeURIComponent(request.term),
			dataType: 'json',
			success: function(json) {		
				response($.map(json, function(item) {
					return {
						label: item.name,
						value: item.product_id
					}
				}));
			}
		});
	}, 
	select: function(event, ui) {
					//alert(ui.item.value);
		//$('input[name=\'filter_name\']').val(ui.item.label);
		//$('#product_id').val('ui.item.label');
		$("#product_id").attr("value",ui.item.value);
		var href = $("#report").attr('href');
		var link = '&product_id=';
		var id = $("#product_id").attr('value');
		$("#report").attr("href",href+link+id);
		return false;
	}
});

$('input[name=\'filter_model\']').autocomplete({
	delay: 0,
	source: function(request, response) {
		$.ajax({
			url: 'index.php?route=catalog/product/autocomplete&token=<?php echo $token; ?>&filter_model=' +  encodeURIComponent(request.term),
			dataType: 'json',
			success: function(json) {		
				response($.map(json, function(item) {
					return {
						label: item.model,
						value: item.product_id
					}
				}));
			}
		});
	}, 
	select: function(event, ui) {
		$('input[name=\'filter_model\']').val(ui.item.label);
						
		return false;
	}
});
//--></script>  
<?php echo $footer; ?>
