Personal blog written from scratch using Node.js, Bootstrap, and MySQL. https://jrtechs.net
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.

94 lines
3.5 KiB

  1. {if edit_user}
  2. <div class="row">
  3. <div class="col-12">
  4. <div class='blogPost'>
  5. <h1 class="text-center">Edit User</h1>
  6. <form action="/admin/users/" method ="post" >
  7. <div class="form-group">
  8. <input class="form-control" type="text" name="edit_user_name" value='{user_name}' required>
  9. <label class="w3-label w3-validate">User Name</label>
  10. </div>
  11. <div class="form-group">
  12. <input class="form-control" type="password" name="edit_user_password" value='' required>
  13. <label class="w3-label w3-validate">Password</label>
  14. </div>
  15. <div>
  16. <input type="submit" name="submit" value="Edit" class="btn btn-lg btn-secondary"/>
  17. </div>
  18. <input type='hidden' name='edit_user_2' value='{edit_user}'/>
  19. </form>
  20. </div>
  21. <br>
  22. </div>
  23. </div>
  24. {/if}
  25. <div class="row">
  26. <!-- Current Users -->
  27. <div class="col-md-6">
  28. <div class='blogPost'>
  29. <h1 class="text-center">Users</h1>
  30. <div class="">
  31. <table class="table table-striped">
  32. <thead class="thead-dark">
  33. <tr>
  34. <td>User ID</td>
  35. <td>User Name</td>
  36. <td>Edit</td>
  37. <td>Delete</td>
  38. </tr>
  39. </thead>
  40. <tbody>
  41. {for user in users}
  42. <tr>
  43. <td>
  44. {user.user_id}
  45. </td>
  46. <td>
  47. {user.user_name}
  48. </td>
  49. <td>
  50. <form action="/admin/users/" method ="post" >
  51. <input type="submit" name="submit" value="Edit" class="btn btn-secondary"/>
  52. <input type='hidden' name='edit_user' value='{user.user_id}' />
  53. </form>
  54. </td>
  55. <td>
  56. <form action="/admin/users/" method ="post" >
  57. <input type="submit" name="submit" value="Delete" class="btn btn-secondary"/>
  58. <input type='hidden' name='delete_user' value='{user.user_id}' />
  59. </form>
  60. </td>
  61. </tr>
  62. {/for}
  63. </tbody>
  64. </table>
  65. </div>
  66. </div>
  67. </div>
  68. <!-- Add User -->
  69. <div class="col-md-6">
  70. <div class="blogPost">
  71. <h1 class="text-center">Add New User</h1>
  72. <form action="/admin/users/" method ="post" class="p-2">
  73. <div class="form-group">
  74. <input class="form-control" type="text" name="add_user_name" required>
  75. <label>User Name</label>
  76. </div>
  77. <div class="form-group">
  78. <input class="form-control" type="password" name="add_user_password" required>
  79. <label>Password</label>
  80. </div>
  81. <div class="text-center">
  82. <input type="submit" name="add_user" value="Create User"
  83. class="btn btn-lg btn-secondary"/>
  84. </div>
  85. </form>
  86. </div>
  87. <br>
  88. </div>
  89. </div>