<?php echo $this->render('admin/header.phtml'); ?>


<script type="text/javascript" language="javascript">

	$(document).ready(function () {

		<?php if( isset( $this->removeSuccess ) ){ ?>
			alertify.success("<i class='fa fa-check'></i> <?php echo @Lib_Lang::translate(admin_product_remove_success); ?>");
		<?php } ?>
		
		$(".removeCategory").click(function(){
		
			var link = $(this).attr('link');
			var name = $(this).attr('name');
			alertify.set({ buttonFocus: "none", labels: {ok: "<?php echo @Lib_Lang::translate(admin_confirm_accept); ?>", cancel: "<?php echo @Lib_Lang::translate(admin_confirm_cancel); ?>"}});
			alertify.confirm("<?php echo @Lib_Lang::translate(admin_confirm_remove_product); ?> "+name+"?", function (e) {
				if (e) {
					window.location.href = link;
				} else {
					return false;
				}
			});
		
		});
		
	});

</script>

<div class="container">		

<?php echo $this->render('admin/menu.phtml'); ?>

	
	<div class="row">
		<div class="col-xs-3 col-sm-3 col-md-3">
			<h3><?php echo @Lib_Lang::translate(admin_product_list_top); ?></h3>
		</div>
		<div class="col-xs-9 col-sm-9 col-md-9 text-right">
			<a href="<?php echo @$this->url(array('controller' => 'admin', 'action' => 'shopadd'), 'default', true); ?>" class="btn btn-default btn-sm"><i class='fa fa-plus'></i> <?php echo @Lib_Lang::translate(admin_product_menu_add); ?></a>
		</div>
	</div>

	
<div class="col-xs-12 col-sm-12 col-md-12">		
<?php echo $this->render('admin/module_page.phtml'); ?>
<table class="table table-striped table-bordered table-hover">
	<thead>
		<tr>
			<th><?php echo @Lib_Lang::translate(admin_product_list_lp); ?></th>
			<th><?php echo @Lib_Lang::translate(admin_product_list_name); ?></th>
			<th><?php echo @Lib_Lang::translate(admin_product_list_category); ?></th>
			<th></th>
		</tr>
	</thead>
	<tbody>
	<?php $i=$this->escape($this->page); foreach ($this->dataTable as $key => $val): $i=$i+1;?>
		<tr>
			<td><?php echo $i.'.'; ?></td>
			<td><?php echo $this->escape($val['product_name']); ?></td>
			<td>
			<?php 
				if( $val['category_id'] > 0 ){
					$Lib_Category = new Lib_Category();
					$dataCategoryParent = $Lib_Category->parentListO($val['category_id'],3); 
					foreach($dataCategoryParent as $k => $v):
						echo $v['category_name'].' &rarr; ';
					endforeach;
				}
			?>
			</td>
			<td class="text-center">
				<div class="btn-group">
					<a href="<?php echo @$this->url(array('controller' => 'admin', 'action' => 'shopedit', 'id' => $val['product_id']), 'default', true); ?>" class="btn btn-primary btn-xs"><i class='fa fa-edit'></i> <?php echo @Lib_Lang::translate(admin_product_list_editbutton); ?></a>
					<a name="<?php echo $this->escape($val['product_name']) ?>" link="<?php echo @$this->url(array('controller' => 'admin', 'action' => 'shopremove', 'id' => $val['product_id']), 'default', true); ?>" class="btn btn-danger btn-xs removeCategory"><i class='fa fa-remove'></i> <?php echo @Lib_Lang::translate(admin_product_list_delbutton); ?></a>
				</div>
			</td>
		</tr>
	<?php endforeach; ?>
	</tbody>
</table>	
<?php echo $this->render('admin/module_page.phtml'); ?>
</div>		
	
		
	<div class="row"><hr /></div>
	
</div>

<?php echo $this->render('admin/footer.phtml'); ?>