123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- <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;
- }
- #umbau {
- float:left;
- margin-right:40%;
- width:140px;
- }
- #reinigung {
- background-color: white;
- overflow:hidden;
- margin:10px;
- border:2px dashed #ccc;
- min-height:170px;
- }
- </style>
- </head>
- <body>
- <h3>The Tool History of <span id="toolID" style="color:red"></span>. Current configuration is <span id="article" style="color:red"></span></h3>
- <div id="table"></div>
- <div>
- <div id="umbau">
- <button id="1" onClick="do_after(this.id)">Umbau</button>
- </div>
- <div id="reinugung">
- <button id="2" onClick="do_after(this.id)">Reinigung</button>
- </div>
- </div>
- <form method="GET" action="../services/return_cpee.php">
- <input type="text" name="id" id="cbid" required>
- <input type="text" name="workerID" id="workerID" required>
- <input type="text" name="action" id="action" required>
- <p id="afterClick"></p>
- <input type="submit" value="Submit" onclick="reloaded(rolle);">
- </form>
- <script type="text/javascript" src="form.js"></script>
- <script type="text/javascript">
- var doc = "";
- $.ajax({
- url: '../callbacks/'+ cbid + '.txt',
- async: false,
- success: function (data){
- doc = data;
- }
- });
- doc = JSON.parse(doc);
- eventList = doc[1]["eventList"];
- lastArticle = doc[1]["lastArticle"];
- toolPart = doc[1]["toolPart"];
- var rolle = doc[1]["rolle"];
- toolPart = JSON.parse(toolPart);
- eventList = JSON.parse(eventList);
- count = eventList["ACTION_ID"].length;
- var mytable = "<table cellpadding=\"0\" cellspacing=\"0\">";
- mytable += "<thead><tr><th>Time</th><th>Article</th><th>Action</th><th>Toolpart</th><th>Request</th><th>Issue/Result</th></tr></thead><tbody><tr>";
- for (var i = 0; i < count; i++) {
- mytable += "<td>" + eventList["DATE_TIME"][i] + "</td>";
- mytable += "<td>" + eventList["ARTICLE_ID"][i] + "</td>";
- mytable += "<td>" + eventList["ACTION_ID"][i] + "</td>";
- mytable += "<td>" + eventList["TOOLPART_ID"][i] + "</td>";
- mytable += "<td>" + eventList["REQUEST"][i] + "</td>";
- mytable += "<td>" + eventList["ISSUE_OR_RESULT_ID"][i] + "</td>";
- mytable += "</tr><tr>";
- }
- mytable += "</tr></tbody></table>";
- //document.write(mytable);
- var forminput = "";
- document.getElementById("table").innerHTML = mytable;
- document.getElementById("toolID").innerHTML = eventList["TOOL_ID"][0];
- document.getElementById("article").innerHTML = lastArticle;
- function singleSelectChangeText() {
- var selObj = document.getElementById("selectNumber");
- var selValue = selObj.options[selObj.selectedIndex].text;
- document.getElementById("dropdown").value = selValue;
- }
- function do_after(id){
- if (id ==1) {
- forminput = "Article ID: ";
- forminput += "<input type=\"text\" name=\"articleID\" id=\"articleID\" required>";
- document.getElementById("afterClick").innerHTML = forminput;
- document.getElementById("action").value = 1;
- } else {
- forminput = "<select id=\"selectNumber\" onchange=\"singleSelectChangeText()\"><option>Choose tool part</option></select>";
- forminput += "<input type=\"text\" id=\"dropdown\" name=\"toolPart\">";
- document.getElementById("afterClick").innerHTML = forminput;
- document.getElementById("action").value = 4;
- var select = document.getElementById("selectNumber");
- for(var i = 0; i < toolPart.length; i++) {
- var opt = toolPart[i];
- var el = document.createElement("option");
- el.textContent = opt;
- el.value = opt;
- select.appendChild(el);
- }
- }
- };
- </script>
- </body>
- </html>
|