index.html 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. <!DOCTYPE html>
  2. <html lang="de">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>EVVA</title>
  7. <link rel="stylesheet" href="css/evva.css">
  8. <link rel="stylesheet" href="css/button.css">
  9. </head>
  10. <script src="https://code.jquery.com/jquery-3.6.0.js"></script>
  11. <script>
  12. $(function() {
  13. $("#buttonImage").hide();
  14. updateloadfiledropdown();
  15. $.getJSON( "../../server/json/LaserUI.json", function( data ) {
  16. $.each( data["Row1"], createButtons);
  17. $('#ButtonRows').append("<div style='flex-basis: 100%; height: 0;'></div>");
  18. $.each( data["Row2"], createButtons);
  19. $.each( data["SpecialButtons"], createSpecialButtons);
  20. });
  21. });
  22. function createButtons(i, item){
  23. var clone = document.importNode(document.querySelector('#Buttonentry').content,true);
  24. $('[data-class=entryitem]',clone).text(item["Label"]);
  25. $('[data-class=entryitem]',clone).attr('onclick', "buttonclick('" + item["File"] + "','" + item["Image"] + "','" + item["Label"] + "')");
  26. $('#ButtonRows').append(clone);
  27. }
  28. function createSpecialButtons(i, item){
  29. var clone = document.importNode(document.querySelector('#Buttonentryspecial').content,true);
  30. $('[data-class=entryitem]',clone).text(item["Label"]);
  31. $('[data-class=entryitem]',clone).attr('onclick', "buttonclick('" + item["File"] + "','" + item["Image"] + "','" + item["Label"] + "')");
  32. $('[data-class=entrydiv]',clone).css({"left": item["PositionX"], "top": item["PositionY"] });
  33. $('[data-class=entryitem]',clone).css({"width": item["SizeX"], "height": item["SizeY"]});
  34. $('#ButtonRows').append(clone);
  35. }
  36. function buttonclick(imgfile, imgimg, buttontext){
  37. //alert(imgimg);
  38. $("#actualbuttonImage").attr("src","https://centurio.work/customers/evva/universal-storage/storage/Laser/VorschauBilder/" + imgimg)
  39. $("#currentFile").text("Current Selection: " + buttontext);
  40. $("#ButtonRows").hide();
  41. $("#buttonImage").show();
  42. }
  43. function showallbuttons(){
  44. $("#buttonImage").hide();
  45. $("#ButtonRows").show();
  46. }
  47. function updateloadfiledropdown(){
  48. $('#loadfiledropdown')
  49. .find('option')
  50. .remove()
  51. $.ajax({
  52. type: "GET",
  53. url: "/listfiles",
  54. datatype: "json",
  55. success: function(data){
  56. $(data).each(function(item, val){
  57. var $dropdown = $("#loadfiledropdown");
  58. $dropdown.append($("<option />").val(val).text(val));
  59. });
  60. }
  61. });
  62. }
  63. function ListFiles() {
  64. updateloadfiledropdown()
  65. $.ajax({
  66. type: "GET",
  67. url: "/listfiles",
  68. datatype: "json",
  69. success: function(data){
  70. $("#loadedfiles").text(JSON.stringify(data, undefined, 2))
  71. }
  72. });
  73. }
  74. function LoadNewFile() {
  75. $.ajax({
  76. type: "GET",
  77. url: "/setfile?filename=" + $("#loadfiledropdown :selected").text(),
  78. datatype: "json",
  79. success: function(data){
  80. }
  81. });
  82. }
  83. function ShowLoadedFile() {
  84. $.ajax({
  85. type: "GET",
  86. url: "/getfile",
  87. datatype: "json",
  88. success: function(data){
  89. $("#loadedfile").text(JSON.stringify(data, undefined, 2))
  90. }
  91. });
  92. }
  93. function ShowStats() {
  94. $.ajax({
  95. type: "GET",
  96. url: "/statistics",
  97. datatype: "json",
  98. success: function(data){
  99. $("#stats").text(JSON.stringify(data, undefined, 2))
  100. }
  101. });
  102. }
  103. function ShowInputstates() {
  104. $.ajax({
  105. type: "GET",
  106. url: "/getinputstate",
  107. datatype: "json",
  108. success: function(data){
  109. $("#inputstates").text(JSON.stringify(data, undefined, 2))
  110. }
  111. });
  112. }
  113. function SetText() {
  114. $.ajax({
  115. type: "GET",
  116. url: "/settext?t=0&val=" + $("#seriennummber").val(),
  117. datatype: "json",
  118. success: function(data){
  119. $("#inputstates").text(JSON.stringify(data, undefined, 2))
  120. }
  121. });
  122. }
  123. function SetSlot(slot) {
  124. $.ajax({
  125. type: "GET",
  126. url: "/setslot?t=" + slot +"&val=" + $("#slotvalue").val(),
  127. datatype: "json",
  128. success: function(data){
  129. $("#laserwrite").text("Seriennummer: " + $("#slotvalue").val() + " geschrieben.")
  130. }
  131. });
  132. }
  133. function GetSlot(slot) {
  134. $.ajax({
  135. type: "GET",
  136. url: "/getslot?t=" + slot,
  137. datatype: "json",
  138. success: function(data){
  139. $("#getSlot").text(JSON.stringify(data, undefined, 2))
  140. }
  141. });
  142. }
  143. function ShowOutputStates() {
  144. alert("Not yet implemented");
  145. }
  146. function StartLaser() {
  147. $.ajax({
  148. type: "GET",
  149. url: "/startlaser",
  150. datatype: "json",
  151. success: function(data){
  152. $("#startlaser").text("Laser gestartet.")
  153. }
  154. });
  155. }
  156. </script>
  157. <body>
  158. <div id="LogoTop">
  159. </div>
  160. <template id="Buttonentry">
  161. <div class="" style="width: 8em;">
  162. <button data-class='entryitem' onclick="openimg()" class="small blue button" <!--- style="margin-top:3em; height:8em; padding:1.5em; width:7.5em" -->>ButtonText</button>
  163. </div>
  164. </template>
  165. <template id="Buttonentryspecial">
  166. <div data-class='entrydiv' style="position: absolute;" >
  167. <button data-class='entryitem' onclick="openimg()" class="small green button" <!--- style="margin-top:3em; height:8em; padding:1.5em; width:7.5em" -->>ButtonText</button>
  168. </div>
  169. </template>
  170. <div id="Content">
  171. <div class="row paddingleft3" id="ButtonRows" >
  172. </div>
  173. <div id="buttonImage" class="paddingleft3" >
  174. <img id="actualbuttonImage" style="max-height:700px" src="" alt=""><br>
  175. <button onclick="showallbuttons()" style="margin-top:3em; padding:2em;">Zurück zur File auswahl</button>
  176. <span id="currentFile"></span>
  177. <br>
  178. </div>
  179. <div id="Footer">
  180. Footer Content
  181. </div>
  182. </body>
  183. </html>