eyoku_

Untitled

Jun 16th, 2020
13
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.60 KB | None | 0 0
  1. <div class="card">
  2. <div class="card-header">
  3. <h4>User List</h4>
  4. </div>
  5. <div class="card-body">
  6. <table class="table">
  7. <thead>
  8. <tr>
  9. <th>#</th>
  10. <th>Name</th>
  11. <th>Email</th>
  12. <th>Role</th>
  13. <th>Status</th>
  14. <th>Action</th>
  15. </tr>
  16. </thead>
  17. <tbody>
  18. <?php
  19. $no = 1;
  20. foreach ($users as $row) {
  21. ?>
  22. <tr>
  23. <td><?= $no++ ?></td>
  24. <td><?= $row->nama_user ?></td>
  25. <td><?= $row->email_user ?></td>
  26. <td><?= $row->role_user ?></td>
  27. <td><?= $row->is_active == "1" ? "Aktif" : "Tidak Aktif" ?></td>
  28.  
  29. <td>
  30. <button data-id="<?= $row->id_user ?>" class="btn btn-info btn-xs btn-reset-password">
  31. <i class="fas fa-key"></i>
  32. </button>
  33. <a href="<?= site_url("user/update/$row->id_user") ?>"
  34. class="btn btn-xs btn-warning">
  35. <i class="fas fa-edit"></i>
  36. </a>
  37. </td>
  38. </tr>
  39. <?php
  40. }
  41. ?>
  42. </tbody>
  43. </table>
  44. </div>
  45. <div class="card-footer">
  46. <a href="<?= site_url("user/tambah") ?>" class="btn btn-primary">
  47. <i class="fas fa-plus"></i> Add user
  48. </a>
  49. </div>
  50. </div>
  51. <script>
  52. $(function () {
  53. $(".btn-reset-password").on("click", function () {
  54. let idUser = $(this).data("id");
  55. $.confirm({
  56. theme: "material",
  57. type: "dark",
  58. title: "Konfirmasi",
  59. content: "Anda yakin akan mereset password user ini?<br> Password akan dikirim ke email user",
  60. buttons: {
  61. buttonOke: {
  62. text: "Reset Password",
  63. btnClass: "btn-dark",
  64. action: function () {
  65. prosesReset(idUser);
  66. }
  67. },
  68. buttonBatal: {
  69. text: "Batal",
  70. btnClass: "btn-info",
  71. action: function () {
  72.  
  73. }
  74. }
  75. }
  76. });
  77. });
  78.  
  79. function prosesReset(idUser) {
  80. $.LoadingOverlay("show");
  81. $.ajax({
  82. url: window.base_url + "user/reset_password",
  83. type: "post",
  84. data: {
  85. id_user: idUser
  86. },
  87. success:function (result) {
  88. $.LoadingOverlay("hide");
  89. if(result == "1"){
  90. $.alert({
  91. title:"Sukses",
  92. content:"Password Berhasil di reset"
  93. });
  94. }
  95.  
  96. }
  97. })
  98. }
  99. });
  100. </script>
Add Comment
Please, Sign In to add comment