123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- <html>
- <head>
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
- <style>
- table {
- font-family: arial, sans-serif;
- border-collapse: collapse;
- width: 100%;
- }
- td, th {
- border: 1px solid #dddddd;
- text-align: left;
- padding: 8px;
- }
- tr:nth-child(even) {
- background-color: #dddddd;
- }
- </style>
- </head>
- <body>
- <h3>Select The Tool</h3>
- <form method="GET" action="../services/return_cpee.php">
- <p> Selected tool: <input type="text" name="toolID" id="toolid"></p>
- <input type="hidden" name="id" id="cbid" required>
- <input type="text" name="workerID" id="workerID" required>
- <input type="submit" name="toolStatus" value="Production" onclick="reloaded(rolle);">
- <input type="submit" name="toolStatus" value="Umbau" onclick="reloaded(rolle);">
- </form>
- <script type="text/javascript" src="mab.js"></script>
- <script type="text/javascript">
- var toolList = "";
- var doc = "";
- $.ajax({
- url: '../callbacks/'+ cbid + '.txt',
- async: false,
- success: function (data){
- doc = data;
- }
- });
- doc = JSON.parse(doc);
- toolList = doc[1]['toolList'];
- var rolle = doc[1]['rolle'];
- toolList = JSON.parse(toolList);
- events = JSON.parse(doc[1]['events']);
- curr_state = events['lastArticles'];
- eventList = events['dtc'];
- var mytable = "<table cellpadding=\"0\" cellspacing=\"0\">";
- mytable += "<thead><tr><th>ToolID</th><th>Last Configuration</th><th>Select</th></tr></thead><tbody><tr>";
- for (var i = 0; i < toolList.length; i++) {
- mytable += "<td>" + toolList[i] + "</td>";
- mytable += "<td>" + curr_state[toolList[i]] + "</td>";
- mytable += "<td><input type=\'checkbox\' value = " + toolList[i] + " name=\"myCheckbox\" onclick=\"selectOnlyThis(this)\"></td>";
- 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>";
- for ( var a = 0; a <5; a++){
- mytable += "<td>" + eventList[toolList[i]]["DATE_TIME"][a] + "</td>";
- mytable += "<td>" + eventList[toolList[i]]["ARTICLE_ID"][a] + "</td>";
- mytable += "<td>" + eventList[toolList[i]]["ACTION_ID"][a] + "</td>";
- mytable += "<td>" + eventList[toolList[i]]["TOOLPART_ID"][a] + "</td>";
- mytable += "<td>" + eventList[toolList[i]]["REQUEST"][a] + "</td>";
- mytable += "<td>" + eventList[toolList[i]]["ISSUE_OR_RESULT_ID"][a] + "</td>";
- mytable += "</tr><tr>";
- }
- }
- mytable += "</tr></tbody></table>";
- document.write(mytable);
- function selectOnlyThis(id){
- var myCheckbox = document.getElementsByName("myCheckbox");
- Array.prototype.forEach.call(myCheckbox,function(el){
- el.checked = false;
- });
- id.checked = true;
- document.getElementById("toolid").value = id.value;
- }
- </script>
- </body>
- </html>
|