<?php
	$grup = array();
	$total = 0;
	foreach($this->data->item as $r){
		$grup[$r->nm_app][] = $r;
		$total = $total + $r->total;
	}
	foreach($grup as $row){
		echo "<div class='_divItem0'>";
		foreach($row as $r){
			$cLr = '';
			if(empty($r->status2)){
				$cLr = '_notApp';
			}
			else if($r->status2 == "T"){
				$cLr = '_orderFinish';
			}
	?>
	<div class="_divItem <?php echo $cLr ?>">
		<div class="_divItem1">
			<?php 
			echo $r->nm_inv;
			if(!empty($r->ket_det)){
				echo "<br>Note : <i>".$r->ket_det.'</i>';
			}
        	echo "<br>".$r->qty.' x Rp '.number_format($r->harga)
			?>
		</div>
		<div class="_divItem3">
			<?php if($cLr != ""){?>
				<input type="button" kode="<?php echo $r->no_item ?>" class="_btnCheck" status="T" value="Selesaikan Order">
			<?php }else{ ?>
				<input type="button" kode="<?php echo $r->no_item ?>" class="_btnCheck" status="F" value="Batal Order Selesai">
			<?php } ?>
		</div>
	</div>
	<?php 
		}
		echo "</div>";
	} ?> 
	<div class='_divItem0'>
    	<div class="_divItem">
			<div class="_divItem1">
				Total
			</div>
			<div class="_divItem3">
				 Rp <?php echo number_format($total) ?>
			</div>
		</div>
    </div>
<script>
$(document).ready(function(){
	<?php foreach($this->data->aktif as $meja){ ?>
		$('#_iconMeja_<?php echo $meja ?>').css("background-color", 'yellow');
	<?php } ?>
	
	$('._btnCheck').click(function(){
		_kode = $(this).attr('kode');
		_status = $(this).attr('status');
		makeCheckItem(_kode, _status);
	});
})
</script>