toolList.html 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <html>
  2. <head>
  3. <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
  4. <style>
  5. table {
  6. font-family: arial, sans-serif;
  7. border-collapse: collapse;
  8. width: 100%;
  9. }
  10. td, th {
  11. border: 1px solid #dddddd;
  12. text-align: left;
  13. padding: 8px;
  14. }
  15. tr:nth-child(even) {
  16. background-color: #dddddd;
  17. }
  18. </style>
  19. </head>
  20. <body>
  21. <h3>Select The Tool</h3>
  22. <form method="GET" action="../services/return_cpee.php">
  23. <p> Selected tool: <input type="text" name="toolID" id="toolid"></p>
  24. <input type="hidden" name="id" id="cbid" required>
  25. <input type="text" name="workerID" id="workerID" required>
  26. <input type="submit" name="toolStatus" value="Production" onclick="reloaded(rolle);">
  27. <input type="submit" name="toolStatus" value="Umbau" onclick="reloaded(rolle);">
  28. </form>
  29. <script type="text/javascript" src="mab.js"></script>
  30. <script type="text/javascript">
  31. var toolList = "";
  32. var doc = "";
  33. $.ajax({
  34. url: '../callbacks/'+ cbid + '.txt',
  35. async: false,
  36. success: function (data){
  37. doc = data;
  38. }
  39. });
  40. doc = JSON.parse(doc);
  41. toolList = doc[1]['toolList'];
  42. var rolle = doc[1]['rolle'];
  43. toolList = JSON.parse(toolList);
  44. events = JSON.parse(doc[1]['events']);
  45. curr_state = events['lastArticles'];
  46. eventList = events['dtc'];
  47. var mytable = "<table cellpadding=\"0\" cellspacing=\"0\">";
  48. mytable += "<thead><tr><th>ToolID</th><th>Last Configuration</th><th>Select</th></tr></thead><tbody><tr>";
  49. for (var i = 0; i < toolList.length; i++) {
  50. mytable += "<td>" + toolList[i] + "</td>";
  51. mytable += "<td>" + curr_state[toolList[i]] + "</td>";
  52. mytable += "<td><input type=\'checkbox\' value = " + toolList[i] + " name=\"myCheckbox\" onclick=\"selectOnlyThis(this)\"></td>";
  53. mytable += "</tr><thead><tr><th>Time</th><th>Article</th><th>Action</th><th>Toolpart</th><th>Request</th><th>Issue/Result</th></tr></thead><tr>";
  54. for ( var a = 0; a <5; a++){
  55. mytable += "<td>" + eventList[toolList[i]]["DATE_TIME"][a] + "</td>";
  56. mytable += "<td>" + eventList[toolList[i]]["ARTICLE_ID"][a] + "</td>";
  57. mytable += "<td>" + eventList[toolList[i]]["ACTION_ID"][a] + "</td>";
  58. mytable += "<td>" + eventList[toolList[i]]["TOOLPART_ID"][a] + "</td>";
  59. mytable += "<td>" + eventList[toolList[i]]["REQUEST"][a] + "</td>";
  60. mytable += "<td>" + eventList[toolList[i]]["ISSUE_OR_RESULT_ID"][a] + "</td>";
  61. mytable += "</tr><tr>";
  62. }
  63. }
  64. mytable += "</tr></tbody></table>";
  65. document.write(mytable);
  66. function selectOnlyThis(id){
  67. var myCheckbox = document.getElementsByName("myCheckbox");
  68. Array.prototype.forEach.call(myCheckbox,function(el){
  69. el.checked = false;
  70. });
  71. id.checked = true;
  72. document.getElementById("toolid").value = id.value;
  73. }
  74. </script>
  75. </body>
  76. </html>