<script>
function add_item(i,action){
	query = {pm_autoid:i,pos_autoid:$('#autoid').val(),act:action};
	$.post('add_item',query,function(e){
		$('#pos_output').html(e);
		total = $('#gtotal').val();
		$('#order_total').html('<h4>'+formatDecimal(total)+'</h4>')
		})
	}
function change_qty(id){
	$("#qty_modal").modal() 
	item_name = 	$('#item_name'+id).html();
	item_qty = 	$('#item_qty'+id).val();
	$('#item_name').html(item_name);
	$('#item_qty').val(item_qty);
	$('#qty_txt').html(item_qty);

	$('#posd_autoid').val(id);

}

function save_qty(){
	_posd_autoid = $('#posd_autoid').val();
	_qty = $('#item_qty').val();
	
	
		
	query = {pos_autoid:$('#autoid').val(),qty:_qty,posd_autoid:_posd_autoid};
	$.post('add_qty',query,function(e){
		$('#adj_qty').html(e);
		total = $('#adj_gtotal').val();
		_subtotal = $('#adj_subtotal').val();	
		
		$('#gtotal').val(total);	
		$('#span_qty'+_posd_autoid).html(_qty);
		$('#span_subtotal'+_posd_autoid).html(formatDecimal(_subtotal));
		
		
		$('#span_total').html(formatDecimal(total))
		$('#order_total').html('<h4>'+formatDecimal(total)+'</h4>')
		$('#item_qty'+_posd_autoid).val(_qty);
		
		if(_qty==0){
		$('#span_item'+_posd_autoid).remove();			
			}
		
	})
	}
	
	function full_screen() {
	  document.documentElement.webkitRequestFullScreen();
	}
</script>
<style>
	.btn-blue{
		background-color:#069;
		color:white !important
		}
		
    .content_height{
		height:450px;
		overflow-y:scroll;
		}
	.bg-grey{
		background:#333 !important
		}
</style>
<div id="adj_qty"></div>
	<input type="hidden" name="outlet_autoid" value="1">
	<input type="hidden" class="input prevent_key" style="width:100px" name="transno" id="transno" value="<?php echo $transno?>">
	<input type="hidden" class="input prevent_key" style="width:100px" name="transdate" id="transdate" value="<?php echo $transdate?>">            
    
<div class="row pb-3">
	<div class="col-sm-5">
		<div class="px-3 py-2">
			No : <?php echo $transno?> , <?php echo $transdate?>
		</div>
	</div>
    
	<div class="col-sm-7 tr">
		<div class="px-3 py-1">
			Nama <input type="text" name="pos_cust_name" style="width:150px" value="<?php echo $pos_cust_name?>" class="input prevent_key">
			No Meja <select class="input" id="pos_tableno" name="pos_tableno">
		    <?php for($i=1;$i<11;$i++){?>
    			<option <?php if($tableno==$i){echo 'seleceted';}?> value="<?php echo $i?>"><?php echo $i?></option>
		    <?php } ?>
			</select>
			Order type 
			<select class="input" id="pos_order_type" name="pos_order_type">
				<option <?php if($order_type=="DINE-IN"){echo "selected";}?> value="DINE-IN">DINE-IN</option>
				<option <?php if($order_type=="TAKE-AWAY"){echo "selected";}?> value="TAKE-AWAY">TAKE-AWAY</option>
				<option <?php if($order_type=="GOFOOD"){echo "selected";}?> value="GOFOOD">GOFOOD</option> 
			</select>
			</div>
	</div>

<div class="w-100 col-sm-12 my-0" style="border:1px black solid;"></div>

<div class="col-sm-7 pl-3">
	<?php include('item_content.php')?>
</div> <!-- end col -->


<div class="col-sm-5">
	<div>
    	<div id="pos_output" class="pt-2 pr-2 pl-0"> </div>
    </div>

    <div class="pr-2">    
    <button type="button" class="btn btn-success w-100" data-toggle="modal" data-target="#myModal"> Pembayaran </button>
    <button type="button" class="btn btn-danger w-100 mt-2" onclick="do_suspend('save')">
		Pending &amp; New Order
	</button>
    </div>
    
</div>
</div>
    	            <input type="hidden" name="autoid" id="autoid" value="<?php echo $autoid?>">
                    <input type="hidden" name="act" id="act" value="<?php echo $act?>">
                    
<?php include('paym_modal.php')?>
<?php include('qty_modal.php')?>