123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- <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>
- <h2>Report Problems<h2>
- <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>
- <p>Article ID: <input type="text" name="articleID" id="articleID"></p>
- <p id="afterClick"></p>
- <input type="submit" value="Submit" onclick="test();">
- </form>
- <div id="cont"></div>
- <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);
- var params = doc[1];
- var rolle = params['rolle'];
- var actions = params['actions'];
- actions = JSON.parse(actions);
- console.log(actions);
-
- var mytable = "<table cellpadding=\"0\" cellspacing=\"0\">";
- mytable += "<thead><tr><th>Parameter</th><th>Value</th></tr></thead><tbody><tr>";
- Object.keys(params).forEach(val => {
- if (val != "form" && val != "rolle" && val !="actions"){
- mytable += "<td>" + val + "</td>";
- mytable += "<td>" + params[val] + "</td></tr><tr>";}
- });
- mytable += "</tr></tbody></table>";
- var elem = document.getElementById("cont");
- elem.insertAdjacentHTML( 'beforeend', 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;
- } 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;
- 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>
|