<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>
		RASIO - POS
	</title>
	<link rel="stylesheet" type="text/css" media="screen" href="<?php echo $this->baseUrl ?>/assets/thema/posr/css/pos.css?ver=<?php echo date("ymdHis") ?>">
	<link rel="stylesheet" type="text/css" media="screen" href="<?php echo $this->baseUrl ?>/assets/thema/posr/css/pos_theme_black.css">
	<link rel="stylesheet" type="text/css" media="screen" href="<?php echo $this->baseUrl ?>/assets/css/flexigrid/flexigrid.css">
	<link rel="stylesheet" type="text/css" media="screen" href="<?php echo $this->baseUrl ?>/assets/css/jquery.apank.popUp.css">
	<script type="text/javascript" src="<?php echo $this->baseUrl ?>assets/js/jquery-1.7.2.min.js" ></script>
	<script type="text/javascript" src="<?php echo $this->baseUrl ?>assets/js/jquery-ui-1.8.19.custom.min.js" ></script>
	<script type="text/javascript" src="<?php echo $this->baseUrl ?>assets/js/jquery.shortcuts.min.js" ></script>
	<script type="text/javascript" src="<?php echo $this->baseUrl ?>assets/js/apank.js"></script>
	<script type="text/javascript" src="<?php echo $this->baseUrl ?>assets/js/jquery.meio.mask.js"></script>
	<script type="text/javascript" src="<?php echo $this->baseUrl ?>assets/js/accounting.js"></script>
	<script type="text/javascript" src="<?php echo $this->baseUrl ?>assets/js/md5.js"></script>
	<script type="text/javascript" src="<?php echo $this->baseUrl ?>assets/thema/posr/js/pos.js"></script>
	<script type="text/javascript" src="<?php echo $this->baseUrl ?>assets/js/flexigrid.js"></script>
	<script type="text/javascript" src="<?php echo $this->baseUrl ?>assets/js/md5.js"></script>
	<style>
		#content{
    		width: 100%;
    		vertical-align: top;
    		height: 97.5vh;
    		overflow-y: auto;
			overflow-x: hidden;
		}
	</style>
</head>
<body>
<div id="apankForm"></div>
	<div id="content">
		<table id="_tabContent" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td id="_tabContentT">
					<div class="_hedAtas">
						<input class="_menu _back" type="button" value="B A C K" onclick="location.href='<?php echo $this->baseUrl ?>application/index/MIS';">
						M E J A
					</div>
					<div class="_dataKat">
						<?php
						$lt = $this->em->getFindBy("kat", "*", array('jenis = 2'), "kd_kat");
						$def_lt = $lt[0];
						foreach($lt as $r){
						?>
						<input type="button" class="_iconLantai _menu" kode="<?php echo str_ireplace(' ','_',$r->kd_kat) ?>" value="<?php echo $r->nm_kat ?>">
						<?php } ?>
					</div>
					<div>
						<?php foreach($lt as $r){ ?>
							<table class="_dataMejaDet" id="_dataMejaDet_<?php echo str_ireplace(' ','_',$r->kd_kat) ?>" style="display: none">
								<tr>
									<td class="_dataMejaDetHed" style="padding-left:5px; padding-top:5px; padding-bottom:5px;">
										Daftar Meja <?php echo $r->nm_kat ?>
									</td>
								</tr>
								<tr>
									<td>
										<?php
										$meja = $this->em->getFindBy("merek", "*", array("kd_kat = '".$r->kd_kat."'"), "kd_merek");
										if(empty($def_meja)) $def_meja = $meja[0];
                                                 
                                        foreach($meja as $r){
										?>
										<input type="button" class="_iconMeja _menu" id="_iconMeja_<?php echo $r->kd_merek ?>" kode="<?php echo $r->kd_merek ?>" value="<?php echo $r->nm_merek ?>">
										<?php } ?>
									</td>
								</tr>
							</table>
						<?php } ?>
					</div>
				</td>
			</tr>
			<tr>
                <td id="_tabContentB">
					&nbsp;
				</td>        
			</tr>
            <tr>
            	<td id="_tabContentB">
					<div class="_hedAtas">
						Order
					</div>
					<div class="_dataBill" id="_dataBill">
					</div>
				</td>
            </tr>
		</table>
	</div>
</body>
</html>
<?php
$kategori = $kat[0];
?>
<div id="errorDisplay"></div>
<input type="hidden" id="baseUrl" value="<?php echo $this->baseUrl ?>">
<script type="text/javascript">
$(document).ready(function(){
	setDec();
	$('.meioMask').setMask();
	
	// Load Meja
	_makeLoadMeja = false;
	makeLoadMeja = function(_kode){
		if(_makeLoadMeja != false){
			_makeLoadMeja.abort();
		}
		$('#_dataBill').html('Loading...');
		$('._btnTambah').attr('disabled', true);
		_makeLoadMeja = $.ajax({
			url: $('#baseUrl').val()+'posrmobile/itemmenu/&kode='+_kode,
			type : 'POST',
			data : $('form').serialize(),
			success: function(data){
				$('#_dataBill').html(data);
			}
		});
	}
	$('._iconLantai').click(function(){
		_kode = $(this).attr('kode');
		$('._dataMejaDet').removeAttr('style');
		$('._dataMejaDet').css('display', 'none');
		$('#_dataMejaDet_'+_kode).removeAttr('style');
	})
	$("#_dataMejaDet_<?php echo $def_lt->kd_kat ?>").removeAttr('style');
	makeLoadMeja("<?php echo $def_meja->kd_merek ?>");
	$('._iconMeja').click(function(){
		_kode = $(this).attr('kode');
		makeLoadMeja(_kode);
	})
	$('._iconMeja').removeClass('_mejaAktif');
	<?php foreach($this->data->aktif as $meja){ ?>
		$('#_iconMeja_<?php echo $meja ?>').addClass("_mejaAktif");
	<?php } ?>
	
	// Refresh Timeout
	_idleTimeout = false;
    idleTimeout = function() {
        clearTimeout(_idleTimeout);
        _idleTimeout = setTimeout(idleFunction, 10000);
    }
    idleFunction = function(){
        console.log("User is idle for 10 seconds.");
        _meja = $('#kodemeja').val();
		if(_meja === ''){
			makeLoadMeja('01');
			idleTimeout();
			return;
		}
		makeLoadMeja(_meja);
		idleTimeout();
    }
    $(document).on('mousemove keypress click', idleTimeout);
    idleTimeout();
	_refreshTime = false;
	refreshTime = function(){
		if(_refreshTime != false){
			_refreshTime.abort();
		}
		_refreshTime = $.ajax({
			url: $('#baseUrl').val()+'posr/refreshTime/',
			type : 'POST',
			data : $('form').serialize(),
			success: function(data){
				$("#_time").text(data);
			}
		});
	}
    setInterval(refreshTime, 60000);
})
</script>

