index.html 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  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.evva.com/departments/emontage/universal-storage/storage/Laser/VorschauBilder/" + imgimg)
  39. $("#currentFile").text("Current Selection: " + buttontext);
  40. $("#ButtonRows").hide();
  41. $("#buttonImage").show();
  42. breakmarking();
  43. LoadNewFile(imgfile)
  44. }
  45. function showallbuttons(){
  46. $("#buttonImage").hide();
  47. $("#ButtonRows").show();
  48. }
  49. function updateloadfiledropdown(){
  50. $('#loadfiledropdown')
  51. .find('option')
  52. .remove()
  53. $.ajax({
  54. type: "GET",
  55. url: "http://172.16.14.236:9337/listfiles",
  56. datatype: "json",
  57. success: function(data){
  58. $(data).each(function(item, val){
  59. var $dropdown = $("#loadfiledropdown");
  60. $dropdown.append($("<option />").val(val).text(val));
  61. });
  62. }
  63. });
  64. }
  65. function ListFiles() {
  66. updateloadfiledropdown()
  67. $.ajax({
  68. type: "GET",
  69. url: "http://172.16.14.236:9337/listfiles",
  70. datatype: "json",
  71. async: false,
  72. success: function(data){
  73. $("#loadedfiles").text(JSON.stringify(data, undefined, 2))
  74. }
  75. });
  76. }
  77. function LoadNewFile(filename) {
  78. $.ajax({
  79. type: "GET",
  80. url: "http://172.16.14.236:9337/setfile?filename=" + filename,
  81. datatype: "json",
  82. async: false,
  83. success: function(data){
  84. }
  85. });
  86. }
  87. function ShowLoadedFile() {
  88. $.ajax({
  89. type: "GET",
  90. url: "http://172.16.14.236:9337/getfile",
  91. datatype: "json",
  92. async: false,
  93. success: function(data){
  94. $("#loadedfile").text(JSON.stringify(data, undefined, 2))
  95. }
  96. });
  97. }
  98. function ShowStats() {
  99. $.ajax({
  100. type: "GET",
  101. url: "http://172.16.14.236:9337/statistics",
  102. datatype: "json",
  103. async: false,
  104. success: function(data){
  105. $("#stats").text(JSON.stringify(data, undefined, 2))
  106. }
  107. });
  108. }
  109. function ShowInputstates() {
  110. $.ajax({
  111. type: "GET",
  112. url: "http://172.16.14.236:9337/getinputstate",
  113. datatype: "json",
  114. async: false,
  115. success: function(data){
  116. $("#inputstates").text(JSON.stringify(data, undefined, 2))
  117. }
  118. });
  119. }
  120. function SetText() {
  121. $.ajax({
  122. type: "GET",
  123. url: "http://172.16.14.236:9337/settext?t=0&val=" + $("#seriennummber").val(),
  124. datatype: "json",
  125. async: false,
  126. success: function(data){
  127. $("#inputstates").text(JSON.stringify(data, undefined, 2))
  128. }
  129. });
  130. }
  131. function SetSlot(slot) {
  132. $.ajax({
  133. type: "GET",
  134. url: "http://172.16.14.236:9337/setslot?t=" + slot +"&val=" + $("#slotvalue").val(),
  135. datatype: "json",
  136. async: false,
  137. success: function(data){
  138. $("#laserwrite").text("Seriennummer: " + $("#slotvalue").val() + " geschrieben.")
  139. }
  140. });
  141. }
  142. function GetSlot(slot) {
  143. $.ajax({
  144. type: "GET",
  145. url: "http://172.16.14.236:9337/getslot?t=" + slot,
  146. datatype: "json",
  147. async: false,
  148. success: function(data){
  149. $("#getSlot").text(JSON.stringify(data, undefined, 2))
  150. }
  151. });
  152. }
  153. function breakmarking() {
  154. $.ajax({
  155. type: "GET",
  156. url: "http://172.16.14.236:9337/breakmarking",
  157. datatype: "json",
  158. async: false,
  159. success: function(data){
  160. }
  161. });
  162. }
  163. function resumemarking() {
  164. $.ajax({
  165. type: "GET",
  166. url: "http://172.16.14.236:9337/resumemarking",
  167. datatype: "json",
  168. async: false,
  169. success: function(data){
  170. }
  171. });
  172. }
  173. function ShowOutputStates() {
  174. alert("Not yet implemented");
  175. }
  176. function StartLaser() {
  177. $.ajax({
  178. type: "GET",
  179. url: "http://172.16.14.236:9337/startlaser",
  180. datatype: "json",
  181. success: function(data){
  182. $("#startlaser").text("Laser gestartet.")
  183. }
  184. });
  185. }
  186. function GetSerialFromServer() {
  187. $.ajax({
  188. type: "GET",
  189. url: "http://172.16.14.236:9337/getSerialnumber",
  190. datatype: "json",
  191. success: function(data){
  192. $("#slotvalue").val(data["sn"])
  193. }
  194. });
  195. }
  196. </script>
  197. <body>
  198. <div id="LogoTop">
  199. </div>
  200. <template id="Buttonentry">
  201. <div class="" style="width: 8em;">
  202. <button data-class='entryitem' onclick="openimg()" class="small blue button" <!--- style="margin-top:3em; height:8em; padding:1.5em; width:7.5em" -->>ButtonText</button>
  203. </div>
  204. </template>
  205. <template id="Buttonentryspecial">
  206. <div data-class='entrydiv' style="position: absolute;" >
  207. <button data-class='entryitem' onclick="openimg()" class="small green button" <!--- style="margin-top:3em; height:8em; padding:1.5em; width:7.5em" -->>ButtonText</button>
  208. </div>
  209. </template>
  210. <div id="Content">
  211. <div class="row paddingleft3" id="ButtonRows" >
  212. </div>
  213. <div id="buttonImage" class="paddingleft3" >
  214. <img id="actualbuttonImage" style="max-height:700px" src="" alt=""><br>
  215. <button onclick="showallbuttons()" style="margin-top:3em; padding:2em;">Zurück zur File auswahl</button>
  216. <span id="currentFile"></span><br>
  217. <div class="paddingtop3">
  218. Seriennummer: <input id="slotvalue"></input>
  219. </div>
  220. <button onclick="GetSerialFromServer()" style="margin-top:3em; padding:2em;">GetSerialNumber</button><br>
  221. <br>
  222. </div>
  223. <div id="Footer">
  224. Footer Content
  225. </div>
  226. </body>
  227. </html>