admin add user, password

This commit is contained in:
Saufi
2026-05-26 12:02:16 +08:00
parent 6ca0bd82fd
commit 5fbededf8f
12 changed files with 531 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
@extends('layouts.app')
@section('content')
<main class="page">
<h1>Tambah User</h1>
<p class="subtitle">User baru akan menjadi user biasa secara default. Pilih role admin jika perlu.</p>
@if ($errors->any())
<div class="error">{{ $errors->first() }}</div>
@endif
<form method="POST" action="{{ route('admin.users.store') }}">
@csrf
<label for="name">Nama</label>
<input id="name" type="text" name="name" value="{{ old('name') }}" required autofocus>
<label for="username">Username</label>
<input id="username" type="text" name="username" value="{{ old('username') }}" required>
<label for="email">Emel</label>
<input id="email" type="email" name="email" value="{{ old('email') }}" required>
<label for="password">Password</label>
<input id="password" type="password" name="password" required>
<label for="password_confirmation">Sahkan Password</label>
<input id="password_confirmation" type="password" name="password_confirmation" required>
<label for="role">Role</label>
<select id="role" name="role">
<option value="user" @selected(old('role', 'user') === 'user')>User biasa</option>
<option value="admin" @selected(old('role') === 'admin')>Admin</option>
</select>
<div class="actions">
<button type="submit">Tambah User</button>
<a class="button secondary" href="{{ route('admin.users.index') }}">Kembali</a>
</div>
</form>
</main>
@endsection

View File

@@ -0,0 +1,39 @@
@extends('layouts.app')
@section('content')
<main class="page">
<h1>Users</h1>
<p class="subtitle">Senarai akaun pengguna sistem.</p>
@if (session('status'))
<div class="notice">{{ session('status') }}</div>
@endif
<div class="actions" style="margin-bottom: 18px;">
<a class="button" href="{{ route('admin.users.create') }}">Tambah User</a>
</div>
<div style="overflow-x: auto;">
<table class="data-table">
<thead>
<tr>
<th>Nama</th>
<th>Username</th>
<th>Emel</th>
<th>Role</th>
</tr>
</thead>
<tbody>
@foreach ($users as $user)
<tr>
<td>{{ $user->name }}</td>
<td>{{ $user->username }}</td>
<td>{{ $user->email }}</td>
<td>{{ $user->role }}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</main>
@endsection

View File

@@ -0,0 +1,28 @@
@extends('layouts.app')
@section('content')
<main class="page">
<h1>Lupa Kata Laluan</h1>
<p class="subtitle">Masukkan emel akaun untuk menerima pautan reset kata laluan.</p>
@if (session('status'))
<div class="notice">{{ session('status') }}</div>
@endif
@if ($errors->any())
<div class="error">{{ $errors->first() }}</div>
@endif
<form method="POST" action="{{ route('password.email') }}">
@csrf
<label for="email">Emel</label>
<input id="email" type="email" name="email" value="{{ old('email') }}" required autofocus>
<div class="actions">
<button type="submit">Hantar Link Reset</button>
<a class="button secondary" href="{{ route('login') }}">Kembali Login</a>
</div>
</form>
</main>
@endsection

View File

@@ -4,6 +4,10 @@
<main class="page">
<h2>LOGIN</h2>
@if (session('status'))
<div class="notice">{{ session('status') }}</div>
@endif
@error('username')
<div class="error">{{ $message }}</div>
@enderror
@@ -16,5 +20,9 @@
<button type="submit">LOGIN</button>
</form>
<p class="subtitle" style="margin-top: 18px;">
<a href="{{ route('password.request') }}">Lupa kata laluan?</a>
</p>
</main>
@endsection

View File

@@ -0,0 +1,31 @@
@extends('layouts.app')
@section('content')
<main class="page">
<h1>Reset Kata Laluan</h1>
<p class="subtitle">Masukkan password baru untuk akaun anda.</p>
@if ($errors->any())
<div class="error">{{ $errors->first() }}</div>
@endif
<form method="POST" action="{{ route('password.update') }}">
@csrf
<input type="hidden" name="token" value="{{ $token }}">
<label for="email">Emel</label>
<input id="email" type="email" name="email" value="{{ old('email', $email) }}" required autofocus>
<label for="password">Password Baru</label>
<input id="password" type="password" name="password" required>
<label for="password_confirmation">Sahkan Password Baru</label>
<input id="password_confirmation" type="password" name="password_confirmation" required>
<div class="actions">
<button type="submit">Reset Password</button>
</div>
</form>
</main>
@endsection

View File

@@ -27,6 +27,9 @@
.checkbox-row { display: flex; gap: 8px; align-items: center; margin-bottom: 16px; }
.checkbox-row input { width: auto; margin: 0; }
.checkbox-row label { margin: 0; font-weight: 400; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th, .data-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid #d8dde3; }
.data-table th { background: #eef2f6; font-size: 13px; }
.error { color: #b00020; margin-bottom: 12px; font-size: 14px; }
.logout-form { margin: 0; }
.logout-form button { background: transparent; padding: 8px 0; font-weight: 700; }
@@ -45,7 +48,9 @@
@auth
<div class="topbar-actions">
<a class="topbar-link" href="{{ route('tables.index') }}">Carian</a>
<a class="topbar-link" href="{{ route('profile.edit') }}">Profile</a>
@if (auth()->user()->isAdmin())
<a class="topbar-link" href="{{ route('admin.users.index') }}">Users</a>
<a class="topbar-link" href="{{ route('admin.ratemas-upload.create') }}">Upload RateMas</a>
@endif
<form class="logout-form" method="POST" action="{{ route('logout') }}">

View File

@@ -0,0 +1,49 @@
@extends('layouts.app')
@section('content')
<main class="page">
<h1>Profile</h1>
<p class="subtitle">Kemaskini emel dan password akaun.</p>
@if (session('status'))
<div class="notice">{{ session('status') }}</div>
@endif
@if ($errors->any())
<div class="error">{{ $errors->first() }}</div>
@endif
<form method="POST" action="{{ route('profile.email.update') }}">
@csrf
@method('PUT')
<label for="email">Emel</label>
<input id="email" type="email" name="email" value="{{ old('email', $user->email) }}" required>
<div class="actions">
<button type="submit">Kemaskini Emel</button>
</div>
</form>
<hr style="border: 0; border-top: 1px solid #d8dde3; margin: 28px 0;">
<form method="POST" action="{{ route('profile.password.update') }}">
@csrf
@method('PUT')
<label for="current_password">Password Semasa</label>
<input id="current_password" type="password" name="current_password" required>
<label for="password">Password Baru</label>
<input id="password" type="password" name="password" required>
<label for="password_confirmation">Sahkan Password Baru</label>
<input id="password_confirmation" type="password" name="password_confirmation" required>
<div class="actions">
<button type="submit">Tukar Password</button>
<a class="button secondary" href="{{ route('tables.index') }}">Kembali</a>
</div>
</form>
</main>
@endsection