Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

87 lignes
3.9KB

  1. <% Flash().ShowErrorsIfPresent : Flash().ShowSuccessIfPresent %>
  2. <div class="d-flex justify-content-between align-items-center mb-3">
  3. <h1 class="h3 mb-0">Industries</h1>
  4. <span class="text-muted small"><%= list.Count %> industries</span>
  5. </div>
  6. <form method="post" action="/industries/create" class="card shadow-sm mb-3">
  7. <div class="card-body">
  8. <div class="row g-2 align-items-end">
  9. <div class="col-md-6">
  10. <label for="newName" class="form-label small mb-1">Add an industry</label>
  11. <input type="text" class="form-control form-control-sm" id="newName" name="name" maxlength="100" required />
  12. </div>
  13. <div class="col-md-3">
  14. <input type="hidden" name="csrf" value="<%= H(csrf) %>" />
  15. <button type="submit" class="btn btn-primary btn-sm">Add</button>
  16. </div>
  17. </div>
  18. </div>
  19. </form>
  20. <div class="card shadow-sm mb-3">
  21. <div class="table-responsive">
  22. <table class="table table-sm align-middle mb-0">
  23. <thead class="table-light">
  24. <tr><th style="width:34%">Name</th><th class="text-end" style="width:8%">Businesses</th><th>Rename</th><th>Merge into&hellip;</th><th></th></tr>
  25. </thead>
  26. <tbody>
  27. <% Dim ii, row, oi
  28. For ii = 0 To list.Count - 1
  29. Set row = list(ii)
  30. %>
  31. <tr>
  32. <td class="fw-semibold"><%= H(row("name")) %></td>
  33. <td class="text-end"><a href="/businesses?industry=<%= row("id") %>&amp;status=all" class="text-decoration-none"><%= FormatNumber(row("n"), 0) %></a></td>
  34. <td>
  35. <form method="post" action="/industries/<%= row("id") %>/rename" class="d-flex gap-1">
  36. <input type="hidden" name="csrf" value="<%= H(csrf) %>" />
  37. <input type="text" class="form-control form-control-sm" name="name" value="<%= H(row("name")) %>" maxlength="100" aria-label="New name for <%= H(row("name")) %>" />
  38. <button type="submit" class="btn btn-outline-secondary btn-sm">Save</button>
  39. </form>
  40. </td>
  41. <td>
  42. <form method="post" action="/industries/<%= row("id") %>/merge" class="d-flex gap-1 js-confirm" data-confirm="Merge &quot;<%= H(row("name")) %>&quot; into the selected industry? This can't be undone.">
  43. <input type="hidden" name="csrf" value="<%= H(csrf) %>" />
  44. <select class="form-select form-select-sm" name="target_id" required aria-label="Merge <%= H(row("name")) %> into">
  45. <option value="">Choose&hellip;</option>
  46. <% For oi = 0 To list.Count - 1
  47. If list(oi)("id") <> row("id") Then %>
  48. <option value="<%= list(oi)("id") %>"><%= H(list(oi)("name")) %></option>
  49. <% End If
  50. Next %>
  51. </select>
  52. <button type="submit" class="btn btn-outline-warning btn-sm">Merge</button>
  53. </form>
  54. </td>
  55. <td class="text-end">
  56. <% If row("n") = 0 Then %>
  57. <form method="post" action="/industries/<%= row("id") %>/delete" class="d-inline js-confirm" data-confirm="Delete &quot;<%= H(row("name")) %>&quot;?">
  58. <input type="hidden" name="csrf" value="<%= H(csrf) %>" />
  59. <button type="submit" class="btn btn-outline-danger btn-sm">Delete</button>
  60. </form>
  61. <% End If %>
  62. </td>
  63. </tr>
  64. <% Next %>
  65. <% If uncategorized > 0 Then %>
  66. <tr class="table-light">
  67. <td class="fst-italic text-muted">(No industry)</td>
  68. <td class="text-end"><a href="/businesses?industry=0&amp;status=all" class="text-decoration-none"><%= FormatNumber(uncategorized, 0) %></a></td>
  69. <td colspan="3"></td>
  70. </tr>
  71. <% End If %>
  72. </tbody>
  73. </table>
  74. </div>
  75. </div>
  76. <script>
  77. document.querySelectorAll('form.js-confirm').forEach(function (f) {
  78. f.addEventListener('submit', function (e) {
  79. if (!window.confirm(f.getAttribute('data-confirm'))) e.preventDefault();
  80. });
  81. });
  82. </script>

Powered by TurnKey Linux.