<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Dashboard</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimal-ui">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">

<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>

<!-- Latest compiled JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.2.0/socket.io.js"></script>
<link href="https://fonts.googleapis.com/css?family=Nanum+Gothic&display=swap" rel="stylesheet">
<script>
var socket=io.connect("http://eassetdeals.in:4003");
$(document).ready(function(){
	socket.on("tr_emit",function(data){
		console.log(data.trid);
		$("tr#"+data.trid).html(data.trdata);
		$("tr#"+data.trid+" td:nth-child(2)").css("background-color",data.color);
		setTimeout(function(){ $("tr#"+data.trid+" td:nth-child(2)").css("background","none"); }, 2000);
	});
	socket.on("tr_emit_user",function(data){
		console.log(data.trid);
		$("tr#"+data.trid).html(data.tr);
//		$("tr#"+data.trid+" td:nth-child(2)").css("background-color",data.color);
//		setTimeout(function(){ $("tr#"+data.trid+" td:nth-child(2)").css("background","none"); }, 2000);
	});
	setInterval(function(){
				var cur_rate_class=$("#cur_rate").attr("class");
				//console.log(cur_rate_class);
				//$(".GOLD_ticker").text($("tr#GOLD td:nth-child(2)").text());
				if(cur_rate_class!=""){
				var v=$("tr#"+cur_rate_class+" td:nth-child(2)").text();
				}
				$("#cur_rate").val(v);
				}, 1000);
	$("#metal_select").change(function(){
				var vall=$(this).val();
				var t=vall.split("-");
				$("#cur_rate").attr("class",t[0]);
			//	$("#limit").attr("class",t[0]+"_ticker form-control");
			});
			$("#marketprice").click(function(){
				if ($('input[type="checkbox"]').is(':checked')){
					$("#limit").attr('disabled',true);
				}else{
					$("#limit").removeAttr('disabled');
				}
				//
			});
});
</script>
</head>

<body style="font-family: 'Nanum Gothic';">
    <table id="fullMcxPriceTable" class="table table-condensed table-bordered table-responsive" >
    <tr><th colspan="8" class="text-danger" bgcolor="#CCCCCC">Live MCX Price List</th>
                    <tr bgcolor="black" style="color:#FFF;"><th>Commodity</th><th>Price</th><th>Chg</th><th>%Chg</th><th>Open</th><th>High</th><th>Low</th><th>Lot</th></tr>
				<?php $metals=$this->db->get("metals")->result();
					foreach($metals as $d){?>
                <tr bgcolor="black" style="color:#FFF;" id="<?php echo $d->metal;?>" class="metals_tr">
                	<td><?php echo $d->metal;?></td>
                    <td></td>
               		<td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td></tr>
                <?php }?>
                    </table>
</body>
</html>

