rezamalik15

user_list.blade.php

Jul 16th, 2023
1,487
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 3.66 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4.     <meta charset="UTF-8">
  5.     <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6.     <meta http-equiv="X-UA-Compatible" content="ie=edge">
  7.     <title>User List</title>
  8.     <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-9ndCyUaIbzAi2FUVXJi0CjmCapSmO7SnpJef0486qhLnuZ2cdeRhO02iuK6FUUVM" crossorigin="anonymous">
  9. </head>
  10. <body>
  11.  
  12.     <div class="container mt-3">
  13.        
  14.         <h2>Tambah User Baru</h2>
  15.         <form action="/user/add" method="POST">
  16.             @csrf
  17.             <div class="mb-3 col-6">
  18.                 <label for="name">Nama</label>
  19.                 <input class="form-control" type="text" id="name" placeholder="Nama Lengkap" name="name" required>
  20.             </div>
  21.             <div class="mb-3 col-6">
  22.                 <label for="email">Email</label>
  23.                 <input class="form-control" type="email" id="email" placeholder="Alamat Email" name="email" required>
  24.             </div>
  25.             <div class="mb-3 col-6">
  26.                 <label for="password">Password</label>
  27.                 <input class="form-control" type="password" id="password" placeholder="Masukkan Password" name="password" onkeyup=validatePassword() required>
  28.             </div>
  29.             <div class="mb-3 col-6">
  30.                 <label for="password2">Konfirmasi Password</label>
  31.                 <input class="form-control" type="password" id="password2" placeholder="Masukkan Password Kembali" name="password2" onkeyup=validatePassword() required>
  32.             </div>
  33.             <div class="mb-3 col-6">
  34.                 <input class="btn btn-primary" type="submit" id="submitform" value="Tambahkan" name="submit">
  35.             </div>
  36.            
  37.         </form>
  38.  
  39.         <hr>
  40.  
  41.         <h2>Daftar User</h2>
  42.         <table class="table table-striped">
  43.             <thead>
  44.                 <tr>
  45.                     <th>Nama</th>
  46.                     <th>Email</th>
  47.                     <th>Password</th>
  48.                     <th></th>
  49.                 </tr>
  50.             </thead>
  51.  
  52.             <tbody>
  53.            
  54.             @foreach ($users as $user)
  55.  
  56.                 <tr>
  57.                     <td>{{ $user->name }}</td>
  58.                     <td>{{ $user->email }}</td>
  59.                     <td>{{ $user->password }}</td>
  60.                     <td>
  61.                         <a href="/user/edit/form/{{$user->id}}"
  62.                             class="btn btn-warning">
  63.                             Edit
  64.                         </a>
  65.                         <a href="/user/delete/{{$user->id}}"
  66.                             class="btn btn-danger"
  67.                             onclick="confirm('Anda yakin ingin menghapus user {{$user->name}}?')">
  68.                             Delete
  69.                         </a>
  70.                     </td>
  71.                 </tr>
  72.                
  73.             @endforeach
  74.  
  75.             </tbody>
  76.         </table>
  77.  
  78.     </div>
  79.  
  80.     <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-geWF76RCwLtnZ8qwWowPQNguL3RmwHVBC9FhGdlKrxdiJJigb/j/68SIy3Te4Bkz" crossorigin="anonymous"></script>  
  81.     <script>
  82.         const password1 = document.getElementById('password')
  83.         const password2 = document.getElementById('password2')
  84.         const submitButton = document.getElementById('submitform')
  85.  
  86.         function validatePassword(){
  87.             if(password1.value !== password2.value){
  88.                 submitButton.disabled = true
  89.             } else {
  90.                 submitButton.disabled = false
  91.             }
  92.         }
  93.        
  94.     </script>
  95. </body>
  96. </html>
Advertisement
Add Comment
Please, Sign In to add comment