

<DOCTYPE html>
<html lang="en">
<head>

<link href="<?php echo SITEURL?>/css/styles.css" rel="stylesheet" />
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding">


<style>
body {
  margin: 0;
  font-family: "Roboto Slab", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
  color: #212529;
  text-align: left;
  background-color: #fff;
}

.container,
.container-fluid,
.container-xl,
.container-lg,
.container-md,
.container-sm {
  width: 100%;
  padding-right: 0.75rem;
  padding-left: 0.75rem;
  margin-right: auto;
  margin-left: auto;
}
.dropdown {
  position: relative;
  display: inline-block;
  float:left;
  margin:5px;
}
.dropdown span{
	background-color:rgba(153,102,255,1);
	padding:5px 10px;
	border-radius:6px;
}
.dropdown-content {
  display: none;
  position: absolute;
  background-color: #f9f9f9;
  min-width: 100px;
  box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
  padding: 12px 15px;
  z-index: 1;
  margin-left:-35px;
}

.dropdown:hover .dropdown-content {
  display: block;
}
.dropdown-content ul li{
	text-align:left;
	list-style-type:none;
	line-height:30px;
}
.dropdown-content ul li a{
	color:black;
	text-decoration:none;
}
.dropdown-content ul{
	padding-left:5px
}
td{
	padding:1px 2px;
}
table input{
  border: 1px solid black;
}
.right-panel input{
	width:70%;
	height:25px;
	margin:8px 0px;
}
table{
	margin-top:0px !important;
}
</style>
</head>

<body id="page-top" style="background-color:rgba(204,204,204,.2);">
<input type="hidden" id="hideDrawtime" value="<?php echo trim(drawTime())?>" name="hideDrawtime">
<!-- Navigation--> <input type="hidden" name="hideLotteryTime" id="hideLotteryTime">
<b id="time"  style="display:none;"></b>
<b id="curDraw" style="display: none;"></b>
<input id="hideUserID" name="hideUserID" type="hidden" value="<?php echo $_REQUEST['userID']?>">       
<div class="container-fluid" style="background-color: gold;padding: 10px 5px;">
    <table width="100%" style="text-align:center;font-size:16px;line-height:15px;" cellpadding="5">
        <tr>
        	<div style="width:100%;">
            <?php
            	$timeArr = array('10:00','10:15','10:30','10:45','11:00','11:15','11:30','11:45','12:00','12:15','12:30','12:45','01:00','01:15','01:30','01:45','02:00','02:15','02:30','02:45','03:00','03:15','03:30','03:45','04:00','04:15','04:30','04:45','05:00','05:15','05:30','05:45','06:00','06:15','06:30','06:45','07:00','07:15','07:30','07:45','08:00','08:15','08:30','08:45','09:00','09:15','09:30','09:45');
					//echo $timeArr[47];
					for($i=0;$i<count($timeArr);$i++){
						$key = array_search(drawTime(),$timeArr);
				?>
                <div style="width:5%;display:inline-block;"><input type="checkbox"  id="c<?php echo $i?>" name="c<?php echo $i?>"  value="<?php echo $timeArr[$i]?>" <?php echo (($key < $i)?'':"disabled='disabled'")?>>&nbsp;<?php echo $timeArr[$i]?></div> 
                <?php
					}
			?>
            
                <div style="width:7%;display:inline-block;border:1px solid black;background-color:rgba(153,204,51,1);color:#FFF;"><input type="checkbox" id="chkSelAll" name="" onClick="selTime(this)">&nbsp;Select All</div>
                <div style="width:13%;display:inline-block;border:1px solid black;background-color:rgba(153,204,51,1);color:#FFF;"><input type="text" id="txtLotNum" name="txtLotNum" style="width:20%;" onKeyUp="selAdvDrawTime(this)" />&nbsp;Enter Lot Numbers</div>
            </div>
        </tr>
    </table>
</div>
<!--nav class="navbar navbar-expand-lg navbar-dark fixed-top" id="mainNav"-->


<div class="container-fluid">
	<div class="row">
    	<table width="100%;" style="text-align:center;">
        	<tr>
            	<td style="width:15%;">
                	<div style="width:95%;height:70px;margin:0px 5px;border:1px solid black;padding:2px;background-color:rgba(255,204,153,1);line-height:20px;"><input type="checkbox" style="float:left;" /> Point <input type="checkbox" style="float:right;" /><br>
                    `	&nbsp;
                        <input type="radio" id="rdoUserPoint2" name="rdoUserPoint" value="1" style="margin-left:15px;" checked="checked" /> 1
                        <input type="radio" id="rdoUserPoint3" name="rdoUserPoint" value="2" style="margin-left:15px;"/> 2<br>
                        <input type="radio" id="rdoUserPoint4" name="rdoUserPoint" value="3" style="margin-left:0px;"/> 3
                        <input type="radio" id="rdoUserPoint5" name="rdoUserPoint" value="4" style="margin-left:15px;"/> 4
                        <input type="radio" id="rdoUserPoint6" name="rdoUserPoint" value="5" style="margin-left:15px;"/> 5
                    </div>
                </td>
                <td><a id="srs0000" onClick="showSeries('00')"><div style="width:100%;line-height:15px;padding: 5px 0px;background-color:#f9a98e;"><label style="width:100%;">0000-0999</label><input type="checkbox" /></div></a></td>
                <td><a id="srs1000" onClick="showSeries('10')"><div style="width:100%;line-height:15px;padding: 5px 0px;background-color:#71f4c3;"><label style="width:100%;">1000-1999</label><input type="checkbox" /></div></a></td>
                <td><a id="srs2000" onClick="showSeries('20')"><div style="width:100%;line-height:15px;padding: 5px 0px;background-color:#ffda6c;"><label style="width:100%;">2000-2999</label><input type="checkbox" /></div></a></td>
                <td><a id="srs3000" onClick="showSeries('30')"><div style="width:100%;line-height:15px;padding: 5px 0px;background-color:#a7daf9;"><label style="width:100%;">3000-3999</label><input type="checkbox" /></div></a></td>
                <td><a id="srs4000" onClick="showSeries('40')"><div style="width:100%;line-height:15px;padding: 5px 0px;background-color:#9afb8d;"><label style="width:100%;">4000-4999</label><input type="checkbox" /></div></a></td>
                <td><a id="srs5000" onClick="showSeries('50')"><div style="width:100%;line-height:15px;padding: 5px 0px;background-color:#eeb3ff;"><label style="width:100%;">5000-5999</label><input type="checkbox" /></div></a></td>
                <td><a id="srs6000" onClick="showSeries('60')"><div style="width:100%;line-height:15px;padding: 5px 0px;background-color:#dddbdd;"><label style="width:100%;">6000-6999</label><input type="checkbox" /></div></a></td>
                <td><a id="srs7000" onClick="showSeries('70')"><div style="width:100%;line-height:15px;padding: 5px 0px;background-color:#7bbed9;"><label style="width:100%;">7000-7999</label><input type="checkbox" /></div></a></td>
                <td><a id="srs8000" onClick="showSeries('80')"><div style="width:100%;line-height:15px;padding: 5px 0px;background-color:#f7de5d;"><label style="width:100%;">8000-8999</label><input type="checkbox" /></div></a></td>
                <td><a id="srs9000" onClick="showSeries('90')"><div style="width:100%;line-height:15px;padding: 5px 0px;background-color:#fba769;"><label style="width:100%;">9000-9999</label><input type="checkbox" /></div></a></td>        
                <td style="padding:6px 10px;color:red;width:15%;" colspan="2">
                	<input type="checkbox" /> F11 Family
                </td>
            </tr>
        </table>
        <table width="100%">
        	<tr>
            	<td style="width:15%;">
                	<div class="sr0" id="showSideSeries">
                                <div style="display:flex;margin-top:2px;">
                                <input type="checkbox" /><div onClick="showSeriesCaptionColor('00')"  style="width:100px;height:40px;margin:0px 5px;line-height:40px;" id="sr0"><input type="button" value="0000-0099" onClick="showSeriesCaptionValue('0')" class="side-btn" style="background-color:#f9a98e;"></div><input type="text" style="width:50%;height:22px;text-align:center;background-color:#9533f7;margin-top:18px;">
                                </div>
                                <div style="display:flex;margin-top:2px;">
                                <input type="checkbox" /><div onClick="showSeriesCaptionColor('01')" style="width:100px;height:40px;margin:0px 5px;line-height:40px;" id="sr1"><input type="button" value="0100-0199" onClick="showSeriesCaptionValue('1')" class="side-btn" style="background-color:#71f4c3;"></div><input type="text" style="width:50%;height:22px;text-align:center;background-color:#9533f7;margin-top:18px;" readonly>
                                </div>
                                <div style="display:flex;margin-top:2px;">
                                <input type="checkbox" /><div onClick="showSeriesCaptionColor('02')" style="width:100px;height:40px;margin:0px 5px;line-height:40px;" id="sr2"><input type="button" value="0200-0299" onClick="showSeriesCaptionValue('2')" class="side-btn" style="background-color:#ffda6c;"></div><input type="text" style="width:50%;height:22px;text-align:center;background-color:#9533f7;margin-top:18px;" readonly>
                                </div>
                                <div style="display:flex;margin-top:2px;">
                                <input type="checkbox" /><div onClick="showSeriesCaptionColor('03')" style="width:100px;height:40px;margin:0px 5px;line-height:40px;" id="sr3"><input type="button" value="0300-0399" onClick="showSeriesCaptionValue('3')" class="side-btn" style="background-color:#a7daf9;"></div><input type="text" style="width:50%;height:22px;text-align:center;background-color:#9533f7;margin-top:18px;" readonly>
                                </div>
                                <div style="display:flex;margin-top:2px;">
                                <input type="checkbox" /><div onClick="showSeriesCaptionColor('04')" style="width:100px;height:40px;margin:0px 5px;line-height:40px;" id="sr4"><input type="button" value="0400-0499" onClick="showSeriesCaptionValue('4')" class="side-btn" style="background-color:#9afb8d;"></div><input type="text" style="width:50%;height:22px;text-align:center;background-color:#9533f7;margin-top:18px;" readonly>
                                </div>
                                <div style="display:flex;margin-top:2px;">
                                <input type="checkbox" /><div onClick="showSeriesCaptionColor('05')" style="width:100px;height:40px;margin:0px 5px;line-height:40px;" id="sr5"><input type="button" value="0500-0599" onClick="showSeriesCaptionValue('5')" class="side-btn" style="background-color:#eeb3ff;"></div><input type="text" style="width:50%;height:22px;text-align:center;background-color:#9533f7;margin-top:18px;" readonly>
                                </div>
                                <div style="display:flex;margin-top:2px;">
                                <input type="checkbox" /><div onClick="showSeriesCaptionColor('06')" style="width:100px;height:40px;margin:0px 5px;line-height:40px;" id="sr6"><input type="button" value="0600-0699" onClick="showSeriesCaptionValue('6')" class="side-btn" style="background-color:#dddbdd;"></div><input type="text" style="width:50%;height:22px;text-align:center;background-color:#9533f7;margin-top:18px;" readonly>
                                </div>
                                <div style="display:flex;margin-top:2px;">
                                <input type="checkbox" /><div onClick="showSeriesCaptionColor('07')" style="width:100px;height:40px;margin:0px 5px;line-height:40px;" id="sr7"><input type="button" value="0700-0799" onClick="showSeriesCaptionValue('7')" class="side-btn" style="background-color:#7bbed9;"></div><input type="text" style="width:50%;height:22px;text-align:center;background-color:#9533f7;margin-top:18px;" readonly>
                                </div>
                                <div style="display:flex;margin-top:2px;">
                                <input type="checkbox" /><div onClick="showSeriesCaptionColor('08')" style="width:100px;height:40px;margin:0px 5px;line-height:40px;" id="sr8"><input type="button" value="0800-0899" onClick="showSeriesCaptionValue('8')" class="side-btn" style="background-color:#f7de5d;"></div><input type="text" style="width:50%;height:22px;text-align:center;background-color:#9533f7;margin-top:18px;" readonly>
                                </div>
                                <div style="display:flex;margin-top:2px;">
                                <input type="checkbox" /><div onClick="showSeriesCaptionColor('09')" style="width:100px;height:40px;margin:0px 5px;line-height:40px;" id="sr9"><input type="button" value="0900-0999" onClick="showSeriesCaptionValue('9')" class="side-btn" style="background-color:#fba769;"></div><input type="text" style="width:50%;height:22px;text-align:center;background-color:#9533f7;margin-top:18px;" readonly>
                                </div>
                            
                    </div>
                </td>
            	<td>
                	<!-- Zero Series 1000 Box Start From Here  -->
                	<div class="sr0">
                    <form id="frmLottery" name="frmLottery" method="GET" action="#" onSubmit="return false">
                        <table width="100%" style="text-align:center;margin-top:-15px;" id="sr001">
                            
                                <input type="text" style="width:10%;height: 22px;text-align:center;background-color: #9533f7" readonly>
                                <input type="text" style="width:10%;height: 22px;text-align:center;background-color: #9533f7" readonly>
                                <input type="text" style="width:10%;height: 22px;text-align:center;background-color: #9533f7" readonly>
                                <input type="text" style="width:10%;height: 22px;text-align:center;background-color: #9533f7" readonly>
                                <input type="text" style="width:10%;height: 22px;text-align:center;background-color: #9533f7" readonly>
                                <input type="text" style="width:10%;height: 22px;text-align:center;background-color: #9533f7" readonly>
                                <input type="text" style="width:10%;height: 22px;text-align:center;background-color: #9533f7" readonly>
                                <input type="text" style="width:10%;height: 22px;text-align:center;background-color: #9533f7" readonly>
                                <input type="text" style="width:10%;height: 22px;text-align:center;background-color: #9533f7" readonly>
                                <input type="text" style="width:10%;height: 22px;text-align:center;background-color: #9533f7" readonly>
                            <?php
                                for($i = 0;$i<=99;$i++){
                            
                             ?>
                                
                                <div class="tab-div">
                                    <p style="margin-bottom:0px;" id="p<?php echo ($i)?>"><?php 
                                    
                                    if(strlen($i) == 1){
                                        echo '000'.$i;
                                        
                                    }else if(strlen($i) == 2){
                                        echo '00'.$i;
                                    }else if(strlen($i) == 3){
                                        echo '0'.$i;
                                    }else{
                                        echo $i;
                                    }
                                    
                                    ?></p>
                                    <input  type="text"  onKeyUp="setValue(this)"   id="<?php echo $i?>" name="<?php echo $i?>" class="tab-input" tabIndex='<?php echo $i?>' maxlength="3"  />
                                </div>
                            <?php } ?>
                                
                            
                            
                        </table>
                    </form>
                    </div>
                </td>
                <td>
        			<table width="100%" class="right-panel" cellpadding="5" style="text-align:center;border:1px solid black;margin:0px 3px;margin-top:-15px;">
                        <tr>
                            <td><div style="background-color:rgba(204,102,0,1);">Qty</div></td>
                            <td><div style="background-color:rgba(204,102,0,1);">Point</div></td>
                        </tr>
                        <tr>
                            <td><input type="text" id="qty1" name="qty1" readonly /></td>
                            <td><input type="text" name="point1" id="point1" value="" readonly /></td>
                        </tr>
                        <tr>
                            <td><input type="text" id="qty2" name="qty2" readonly /></td>
                            <td><input type="text" name="point2" id="point2" value="" readonly /></td>
                        </tr>
                        <tr>
                            <td><input type="text" id="qty3" name="qty3" readonly /></td>
                            <td><input type="text" name="point3" id="point3" value="" readonly /></td>
                        </tr>
                        <tr>
                            <td><input type="text" id="qty4" name="qty4" readonly /></td>
                            <td><input type="text" name="point4" id="point4" value="" readonly /></td>
                        </tr>
                        <tr>
                            <td><input type="text" id="qty5" name="qty5" readonly /></td>
                            <td><input type="text" name="point5" id="point5" value="" readonly /></td>
                        </tr>
                        <tr>
                            <td><input type="text" id="qty6" name="qty6" readonly /></td>
                            <td><input type="text" name="point6" id="point6" value="" readonly /></td>
                        </tr>
                        <tr>
                            <td><input type="text" id="qty7" name="qty7" readonly /></td>
                            <td><input type="text" name="point7" id="point7" value="" readonly /></td>
                        </tr>
                        <tr>
                            <td><input type="text" id="qty8" name="qty8" readonly /></td>
                            <td><input type="text" name="point8" id="point8" value="" readonly /></td>
                        </tr>
                        <tr>
                            <td><input type="text" id="qty9" name="qty9" readonly /></td>
                            <td><input type="text" name="point9" id="point9" value="" readonly /></td>
                        </tr>
                        <tr>
                            <td><input type="text" id="qty10" name="qty10" readonly /></td>
                            <td><input type="text" name="point10" id="point10" value="" readonly /></td>
                        </tr>
                    </table>
       			</td>
        	</tr>
        </table>
        <table style="width:98%;">
        	<tr>
            	<td><div style="width:150px;background-color:rgba(204,255,153,1);text-align:center;" onClick="saveAdvTicket()">F6 Print</div></td>
                <td><div style="width:150px;background-color:rgba(204,255,153,1);text-align:center;" id="btnClear">F7 Clear</div></td>
                <td><div style="width:150px;background-color:rgba(204,255,153,1);text-align:center;">F8 Reset</div></td>
                <td><div style="width:150px;background-color:rgba(204,255,153,1);text-align:center;"><a href="<?php echo SITEURL?>/lottery/lottery/?u=<?php echo $_REQUEST['u']?>&userID=<?php echo $_REQUEST['userID']?>">Back</a></div></td>
                <td><div style="width:150px;background-color:rgba(204,255,153,1);text-align:center;">Barcode</div></td>
                <td><div style="width:150px;background-color:rgba(204,255,153,1);text-align:center;">Total</div></td>
	<td><div style="width:40px;"></div></td>
                <td><input style="width:50px;" value="" id="qtyTot" name="qtyTot"></td>
	<td><input style="width:50px;" value="" id="pointTot" name="pointTot"></td>
            </tr>
        </table>
    </div>
</div>

<script type="text/javascript" src="<?php echo SITEURL?>/mod/lottery/x-lottery.inc.js"></script>
<script type="text/javascript">
var advTimeArr = '';
function selTime(chkCntr){
	advTimeArr = '';
	if(chkCntr.checked == true){
		for(var i=0;i<=47;i++){
			var attr = document.getElementById('c'+i).getAttribute('disabled');
			if(attr != 'disabled'){
				document.getElementById('c'+i).checked = true;
				advTimeArr += document.getElementById('c'+i).value+",";
			}
		}	
	
	}else{
		for(var i=0;i<=47;i++){
			var attr = document.getElementById('c'+i).getAttribute('disabled');
			if(attr != 'disabled'){
				document.getElementById('c'+i).checked = false;
			}
		}
		advTimeArr = '';
	}
	//alert(advTimeArr);
}
function selAdvDrawTime(cntr){

	for(var j=0;j<=47;j++){
				var attr = document.getElementById('c'+j).getAttribute('disabled');
				if(attr != 'disabled'){
					document.getElementById('c'+j).checked = false;
					
				}
			}
	advTimeArr = '';
	if(cntr.value != '' && !isNaN(cntr.value)){
		var flag = 0;
		for(var k=0;k<47;k++){
			var attr = document.getElementById('c'+k).getAttribute('disabled');
			if(attr != 'disabled' && flag < cntr.value){
				document.getElementById('c'+k).checked = true;
				advTimeArr += document.getElementById('c'+k).value+",";
				flag++;
			}
		}
	}else{
		for(var j=0;j<=47;j++){
				var attr = document.getElementById('c'+j).getAttribute('disabled');
				if(attr != 'disabled'){
					document.getElementById('c'+j).checked = false;
					
				}
			}
			advTimeArr = '';
	}
}
function saveAdvTicket(){
	var userID = document.getElementById('hideUserID').value;
	var qty = document.getElementById('qtyTot').value;
	var pointTot = document.getElementById('pointTot').value;
	var lotTime = advTimeArr;
	var point = document.querySelector('input[name="rdoUserPoint"]:checked').value;
	aUrl = SITEURL+"/mod/lottery/x-lottery.inc.php?xAction=saveAdv&data="+JSON.stringify(seriesArr)+"&point="+point+"&uID="+userID+"&lotTime="+lotTime+"&pointTot="+pointTot+"&qtyTot="+qty;
	//alert(aUrl);
	var ht = new XMLHttpRequest();
	ht.open("POST",aUrl,false);
	ht.send();
	  var data = JSON.parse(ht.responseText);
	  if(data.str == 'OK'){
	  	window.open(SITEURL+'/lottery/ticket/?userID='+userID+'&lotTime='+lotTime+"&tran="+data.tran,'Print Ticket','width="283px" height="900px"');
		location.reload();
	  }
}
</script>
</body>
</html>
