Repository für MDT5/2 Praktikum
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

HtmlPage.html 3.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <html>
  2. <head>
  3. <meta http-equiv="content-type" content="text/html; charset=utf-8">
  4. <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
  5. <title>WebSockets Einkaufsliste</title>
  6. <!-- Bootstrap -->
  7. <link href="../includes/bootstrap/css/bootstrap.min.css" rel="stylesheet">
  8. <script type="text/javascript" src="../data/kaufort.json"></script>
  9. <script type="text/javascript" src="get.js"></script>
  10. </head>
  11. <body>
  12. <h3>Einkaufsliste</h3>
  13. //TEST FÜR GIT
  14. <form name="auswahl" method="GET" action="einkaufsliste.html">
  15. <a href="../index.html" class="btn btn-primary btn-sm active" role="button">Menü</a>
  16. <a href="import.html" class="btn btn-primary btn-sm active" role="button">Import</a>
  17. <a href="showjson.html" class="btn btn-primary btn-sm active" role="button">showjson</a>
  18. <script type="text/javascript">
  19. var einkaufsliste = JSON.parse(localStorage.getItem("einkaufsliste"));
  20. var AnzDaten = einkaufsliste.daten.length + 1;
  21. document.write('<a href="update.html?id=' + AnzDaten + '" class="btn btn-primary btn-sm active" role="button">Einfügen</a> ');
  22. document.write('<label>Kaufort: </label>');
  23. document.write('<select name="kaufort">');
  24. kaufort.daten.forEach(function (entry) {
  25. sfldbez = entry.fldbez;
  26. lfldbez = liste['kaufort'];
  27. if (sfldbez == lfldbez) {
  28. document.write(' <option selected>' + sfldbez + '</option>');
  29. } else {
  30. document.write(' <option>' + sfldbez + '</option>');
  31. }
  32. });
  33. document.write('</select>');
  34. </script>
  35. <input type="submit" value="Go!">
  36. </form>
  37. <table class="table">
  38. <th>Bezeichnung</th>
  39. <th>Kaufort</th>
  40. <th>Anz</th>
  41. <th>E-Preis</th>
  42. <th>G-Preis</th>
  43. <script type="text/javascript">
  44. //var mydata = JSON.parse(stadtbezirk);
  45. var sumpreis = 0;
  46. var id = 0;
  47. einkaufsliste.daten.forEach(function (entry) {
  48. id = id + 1;
  49. sfldbez = entry.fldBez;
  50. sfldkaufort = entry.fldOrt;
  51. lfldbez = liste['kaufort'];
  52. lweiter = false;
  53. if (sfldkaufort == lfldbez) {
  54. lweiter = true;
  55. }
  56. if (lfldbez == "(ohne)") {
  57. lweiter = true;
  58. }
  59. if (!lfldbez) {
  60. lweiter = true;
  61. }
  62. if (lweiter) {
  63. sAnz = Number(entry.fldAnz);
  64. //sfldpreis=entry.fldPreis;
  65. sfldpreis = Number(entry.fldPreis);
  66. gespreis = sfldpreis * sAnz;
  67. sumpreis = sumpreis + gespreis;
  68. document.write("<tr><td>" + sfldbez + "</td><td>" + sfldkaufort + "</td><td>" + sAnz + "</td><td>" + sfldpreis.toFixed(2) + "</td><td align='right'>" + gespreis.toFixed(2) + "</td>");
  69. document.write("<td><a href='update.html?id=" + id + "' class='btn btn-primary btn-sm active' role='button'>U</a></td>");
  70. document.write("<td><a href='delete.html?id=" + id + "' class='btn btn-primary btn-sm active' role='button'>D</a></td></tr>");
  71. }
  72. });
  73. document.write("<tr><td></td><td></td><td></td><td></td><td align='right'>" + sumpreis.toFixed(2) + "</td></tr>");
  74. // document.write("len="+einkaufsliste.daten.length);
  75. </script>
  76. </table>
  77. </body>
  78. </html>