<script>
    var rfid = "";
    $(document).on('keypress', function(e) {
        if (event.key=="Enter" || event.enterKey){
            console.log(rfid);
            $.post('{{ url('trackstation') }}', {
                event       : 'rfid_capture',
                rfid        : rfid,
                caseuniq    : '{{@$case->caseuniq}}',
                room        : $('#room').val(),
            }, function(data, status) {
                showdata(data);
            });
            rfid="";
        }else{
            var text = event.key;

            //Keyboard ENG
            if(event.keyCode==48)   {text="0";}
            if(event.keyCode==49)   {text="1";}
            if(event.keyCode==50)   {text="2";}
            if(event.keyCode==51)   {text="3";}
            if(event.keyCode==52)   {text="4";}
            if(event.keyCode==53)   {text="5";}
            if(event.keyCode==54)   {text="6";}
            if(event.keyCode==55)   {text="7";}
            if(event.keyCode==56)   {text="8";}
            if(event.keyCode==57)   {text="9";}

            //Keyboard THAI
            if(event.keyCode==3592) {text="0";}
            if(event.keyCode==3653) {text="1";}
            if(event.keyCode==47)   {text="2";}
            if(event.keyCode==45)   {text="3";}
            if(event.keyCode==3616) {text="4";}
            if(event.keyCode==3606) {text="5";}
            if(event.keyCode==3640) {text="6";}
            if(event.keyCode==3638) {text="7";}
            if(event.keyCode==3588) {text="8";}
            if(event.keyCode==3605) {text="9";}
            rfid = rfid+text;
        }
    });
</script>
