edit.eta 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <% layout("/en/layout", { title: `edit station` }) %>
  2. <%~ include("/en/panel/partials/navbar") %>
  3. <% const backIcon = `
  4. <svg class="icon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
  5. <path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m12 19l-7-7l7-7m7 7H5" />
  6. </svg>
  7. ` %>
  8. <% const editIcon = `
  9. <svg class="icon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
  10. <g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2">
  11. <path d="M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" />
  12. <path d="M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z" />
  13. </g>
  14. </svg>
  15. ` %>
  16. <% const errorIcon = `
  17. <svg class="icon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
  18. <path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m21.73 18l-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3M12 9v4m0 4h.01" />
  19. </svg>
  20. ` %>
  21. <% const saveIcon = `
  22. <svg class="icon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
  23. <g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2">
  24. <path d="M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z" />
  25. <path d="M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7M7 3v4a1 1 0 0 0 1 1h7" />
  26. </g>
  27. </svg>
  28. ` %>
  29. <div class="container-row">
  30. <a role="button" href="/en/panel/stations/<%= it.meteostanica.id %>"><%~ backIcon %></a>
  31. <h2><%~ editIcon %> edit <%= it.meteostanica.name %></h2>
  32. </div>
  33. <% const errorValue = it.error?.split('.').reduce((a, b) => a[b], it.lang.stations?.errors)?.(it?.errorDetails) %>
  34. <% if (typeof errorValue === "string") { %>
  35. <div class="message error">
  36. <p class="messageText"><%~ errorIcon %> <%= errorValue %></p>
  37. </div>
  38. <% } %>
  39. <form action="/en/panel/stations/<%= it.meteostanica.id %>/edit" method="post">
  40. <div>
  41. <label for="name">name</label>
  42. <input type="text" id="name" name="name" placeholder="cool station" value="<%= it.meteostanica.name %>">
  43. </div>
  44. <div>
  45. <label for="description">description</label>
  46. <textarea id="description" name="description" placeholder="the coolest one"><%= it.meteostanica.description %></textarea>
  47. </div>
  48. <div>
  49. <label for="owner">owner</label>
  50. <input type="text" id="owner" name="owner" placeholder="your@email.com" value="<%= it.meteostanica.owner %>">
  51. </div>
  52. <div class="cf-turnstile" data-sitekey="<%= it.siteKey %>"></div>
  53. <button type="submit" class="primary"><%~ saveIcon %> save</button>
  54. </form>
  55. <script
  56. src="https://challenges.cloudflare.com/turnstile/v0/api.js"
  57. async
  58. defer
  59. ></script>