report_problems.html.save 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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. #umbau {
  19. float:left;
  20. margin-right:40%;
  21. width:140px;
  22. }
  23. #reinigung {
  24. background-color: white;
  25. overflow:hidden;
  26. margin:10px;
  27. border:2px dashed #ccc;
  28. min-height:170px;
  29. }
  30. </style>
  31. </head>
  32. <body>
  33. <h2>Report Problems<h2>
  34. <div>
  35. <div id="umbau">
  36. <button id="1" onClick="do_after(this.id)">Umbau</button>
  37. </div>
  38. <div id="reinugung">
  39. <button id="2" onClick="do_after(this.id)">Reinigung</button>
  40. </div>
  41. </div>
  42. <form method="GET" action="../services/return_cpee.php">
  43. <input type="text" name="id" id="cbid" required>
  44. <p>Article ID: <input type="text" name="articleID" id="articleID"></p>
  45. <p id="afterClick"></p>
  46. <input type="submit" value="Submit" onclick="test();">
  47. </form>
  48. <div id="cont"></div>
  49. <script type="text/javascript" src="form.js"></script>
  50. <script type="text/javascript">
  51. var doc = "";
  52. $.ajax({
  53. url: '../callbacks/'+ cbid + '.txt',
  54. async: false,
  55. success: function (data){
  56. doc = data;
  57. }
  58. });
  59. doc = JSON.parse(doc);
  60. var params = doc[1];
  61. var rolle = params['rolle'];
  62. var actions = params['actions'];
  63. actions = JSON.parse(actions);
  64. console.log(actions);
  65. var mytable = "<table cellpadding=\"0\" cellspacing=\"0\">";
  66. mytable += "<thead><tr><th>Parameter</th><th>Value</th></tr></thead><tbody><tr>";
  67. Object.keys(params).forEach(val => {
  68. if (val != "form" && val != "rolle" && val !="actions"){
  69. mytable += "<td>" + val + "</td>";
  70. mytable += "<td>" + params[val] + "</td></tr><tr>";}
  71. });
  72. mytable += "</tr></tbody></table>";
  73. var elem = document.getElementById("cont");
  74. elem.insertAdjacentHTML( 'beforeend', mytable );
  75. var forminput = "";
  76. // document.getElementById("table").innerHTML = mytable;
  77. // document.getElementById("toolID").innerHTML = eventList["TOOL_ID"][0];
  78. // document.getElementById("article").innerHTML = lastArticle;
  79. function singleSelectChangeText() {
  80. var selObj = document.getElementById("selectNumber");
  81. var selValue = selObj.options[selObj.selectedIndex].text;
  82. document.getElementById("dropdown").value = selValue;
  83. }
  84. function do_after(id){
  85. if (id ==1) {
  86. forminput = "Article ID: ";
  87. forminput += "<input type=\"text\" name=\"articleID\" id=\"articleID\" required>";
  88. document.getElementById("afterClick").innerHTML = forminput;
  89. } else {
  90. forminput = "<select id=\"selectNumber\" onchange=\"singleSelectChangeText()\"><option>Choose tool part</option></select>";
  91. forminput += "<input type=\"text\" id=\"dropdown\" name=\"toolPart\">";
  92. document.getElementById("afterClick").innerHTML = forminput;
  93. var select = document.getElementById("selectNumber");
  94. for(var i = 0; i < toolPart.length; i++) {
  95. var opt = toolPart[i];
  96. var el = document.createElement("option");
  97. el.textContent = opt;
  98. el.value = opt;
  99. select.appendChild(el);
  100. }
  101. }
  102. };
  103. </script>
  104. </body>
  105. </html>