Initial commit - lms-v2 + CLAUDE.md

This commit is contained in:
Iwit
2026-05-30 22:15:16 +07:00
commit 5811409e2d
183 changed files with 23225 additions and 0 deletions
@@ -0,0 +1,62 @@
<?php
use Illuminate\Support\Facades\Auth;
use Illuminate\Validation\ValidationException;
use Livewire\Attributes\Layout;
use Livewire\Volt\Component;
new #[Layout('layouts.guest')] class extends Component
{
public string $password = '';
/**
* Confirm the current user's password.
*/
public function confirmPassword(): void
{
$this->validate([
'password' => ['required', 'string'],
]);
if (! Auth::guard('web')->validate([
'email' => Auth::user()->email,
'password' => $this->password,
])) {
throw ValidationException::withMessages([
'password' => __('auth.password'),
]);
}
session(['auth.password_confirmed_at' => time()]);
$this->redirectIntended(default: route('dashboard', absolute: false), navigate: true);
}
}; ?>
<div>
<div class="mb-4 text-sm text-gray-600">
{{ __('This is a secure area of the application. Please confirm your password before continuing.') }}
</div>
<form wire:submit="confirmPassword">
<!-- Password -->
<div>
<x-input-label for="password" :value="__('Password')" />
<x-text-input wire:model="password"
id="password"
class="block mt-1 w-full"
type="password"
name="password"
required autocomplete="current-password" />
<x-input-error :messages="$errors->get('password')" class="mt-2" />
</div>
<div class="flex justify-end mt-4">
<x-primary-button>
{{ __('Confirm') }}
</x-primary-button>
</div>
</form>
</div>
@@ -0,0 +1,84 @@
<x-guest-layout>
<div class="mb-6 text-center">
<h2 class="text-2xl font-bold text-gray-900 dark:text-white">Pembaruan Keamanan</h2>
<p class="mt-2 text-sm text-gray-600 dark:text-gray-400">
Demi keamanan data pelatihan, Anda diwajibkan untuk mengganti password default (12345678) dengan password baru yang lebih aman sebelum melanjutkan.
</p>
</div>
@if ($errors->any())
<div class="mb-4 p-4 rounded-md bg-red-50 border border-red-200">
<div class="flex">
<div class="flex-shrink-0">
<svg class="h-5 w-5 text-red-400" viewBox="0 0 20 20" fill="currentColor">
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z" clip-rule="evenodd" />
</svg>
</div>
<div class="ml-3">
<h3 class="text-sm font-medium text-red-800 dark:text-red-200">
Pembaruan Gagal
</h3>
<div class="mt-2 text-sm text-red-700 dark:text-red-300">
<ul class="list-disc pl-5 space-y-1">
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
</div>
</div>
</div>
@endif
<form method="POST" action="{{ route('password.force-update') }}" class="space-y-6">
@csrf
<div>
<label for="password" class="block text-sm font-medium text-gray-700 dark:text-gray-300">
Password Baru
</label>
<div class="mt-1 relative rounded-md shadow-sm">
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
<svg class="h-5 w-5 text-gray-400" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z" />
</svg>
</div>
<input id="password" name="password" type="password" required autocomplete="new-password"
class="focus:ring-indigo-500 focus:border-indigo-500 block w-full pl-10 sm:text-sm border-gray-300 rounded-md dark:bg-gray-800 dark:border-gray-700 dark:text-white"
placeholder="Minimal 8 karakter">
</div>
</div>
<div>
<label for="password_confirmation" class="block text-sm font-medium text-gray-700 dark:text-gray-300">
Ulangi Password Baru
</label>
<div class="mt-1 relative rounded-md shadow-sm">
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
<svg class="h-5 w-5 text-gray-400" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z" />
</svg>
</div>
<input id="password_confirmation" name="password_confirmation" type="password" required autocomplete="new-password"
class="focus:ring-indigo-500 focus:border-indigo-500 block w-full pl-10 sm:text-sm border-gray-300 rounded-md dark:bg-gray-800 dark:border-gray-700 dark:text-white"
placeholder="Ulangi password di atas">
</div>
</div>
<div class="flex items-center justify-between pt-2">
<button type="button" onclick="event.preventDefault(); document.getElementById('logout-form').submit();"
class="text-sm font-medium text-gray-600 hover:text-gray-900 dark:text-gray-400 dark:hover:text-white transition duration-150 ease-in-out">
Keluar (Batal)
</button>
<button type="submit"
class="w-full sm:w-auto flex justify-center py-2 px-6 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 transition duration-150 ease-in-out">
Simpan & Masuk
</button>
</div>
</form>
<form id="logout-form" action="{{ route('logout') }}" method="POST" class="hidden">
@csrf
</form>
</x-guest-layout>
@@ -0,0 +1,61 @@
<?php
use Illuminate\Support\Facades\Password;
use Livewire\Attributes\Layout;
use Livewire\Volt\Component;
new #[Layout('layouts.guest')] class extends Component
{
public string $email = '';
/**
* Send a password reset link to the provided email address.
*/
public function sendPasswordResetLink(): void
{
$this->validate([
'email' => ['required', 'string', 'email'],
]);
// We will send the password reset link to this user. Once we have attempted
// to send the link, we will examine the response then see the message we
// need to show to the user. Finally, we'll send out a proper response.
$status = Password::sendResetLink(
$this->only('email')
);
if ($status != Password::RESET_LINK_SENT) {
$this->addError('email', __($status));
return;
}
$this->reset('email');
session()->flash('status', __($status));
}
}; ?>
<div>
<div class="mb-4 text-sm text-gray-600">
{{ __('Forgot your password? No problem. Just let us know your email address and we will email you a password reset link that will allow you to choose a new one.') }}
</div>
<!-- Session Status -->
<x-auth-session-status class="mb-4" :status="session('status')" />
<form wire:submit="sendPasswordResetLink">
<!-- Email Address -->
<div>
<x-input-label for="email" :value="__('Email')" />
<x-text-input wire:model="email" id="email" class="block mt-1 w-full" type="email" name="email" required autofocus />
<x-input-error :messages="$errors->get('email')" class="mt-2" />
</div>
<div class="flex items-center justify-end mt-4">
<x-primary-button>
{{ __('Email Password Reset Link') }}
</x-primary-button>
</div>
</form>
</div>
@@ -0,0 +1,120 @@
<?php
use App\Livewire\Forms\LoginForm;
use Illuminate\Support\Facades\Session;
use function Livewire\Volt\{form, layout};
// 1. Definisikan Layout
layout('layouts.guest');
// 2. Hubungkan dengan LoginForm class yang sudah kita sempurnakan
form(LoginForm::class);
// 3. Definisikan aksi "login" yang dipanggil oleh form
$login = function () {
$this->validate();
// Jalankan autentikasi dari LoginForm
$this->form->authenticate();
// Regenerasi session untuk keamanan
Session::regenerate();
// Ambil data user beserta relasi roles-nya
$user = auth()->user();
// Redirect otomatis berdasarkan Role (RBAC)
if ($user->hasRole('admin') || $user->hasRole('trainer')) {
$this->redirectIntended(default: route('admin.dashboard', absolute: false), navigate: true);
} else {
$this->redirectIntended(default: route('cbt.dashboard', absolute: false), navigate: true);
}
};
?>
<div class="min-h-screen w-full flex flex-col lg:flex-row bg-slate-50">
<div class="hidden lg:flex lg:w-1/2 bg-gradient-to-br from-slate-900 via-indigo-950 to-slate-900 justify-center items-center p-12 relative overflow-hidden">
<div class="absolute inset-0 opacity-10 bg-[radial-gradient(#3b82f6_1px,transparent_1px)] [background-size:16px_16px]"></div>
<div class="max-w-md w-full relative z-10 text-white">
<div class="w-16 h-16 bg-indigo-600 rounded-2xl flex items-center justify-center mb-8 shadow-xl border border-indigo-500/30">
<span class="text-3xl font-extrabold tracking-wider">T</span>
</div>
<h1 class="text-4xl font-extrabold tracking-tight leading-tight mb-4">
Learning Management System <span class="text-indigo-400 block mt-2 text-3xl">Version 2.0</span>
</h1>
<p class="text-slate-400 text-sm leading-relaxed mb-8">
Portal pelatihan digital resmi PT Tunggal Idaman Abdi. Tingkatkan kompetensi standarisasi CPOB, SOP, dan validasi industri farmasi secara mandiri dan terukur.
</p>
<div class="grid grid-cols-2 gap-4 border-t border-slate-800 pt-8">
<div>
<p class="text-2xl font-bold text-indigo-400">100%</p>
<p class="text-xs text-slate-400 uppercase tracking-wider font-semibold mt-1">Standar CPOB</p>
</div>
<div>
<p class="text-2xl font-bold text-indigo-400">Realtime</p>
<p class="text-xs text-slate-400 uppercase tracking-wider font-semibold mt-1">Sertifikasi & Evaluasi</p>
</div>
</div>
</div>
</div>
<div class="w-full lg:w-1/2 flex items-center justify-center p-6 sm:p-12 md:p-16 bg-white">
<div class="max-w-md w-full space-y-6">
<div class="lg:hidden text-center mb-6">
<div class="w-12 h-12 bg-indigo-600 rounded-xl flex items-center justify-center mx-auto mb-3 text-white font-bold text-xl shadow-md">T</div>
</div>
<div>
<h2 class="text-2xl sm:text-3xl font-bold text-slate-900 tracking-tight">Selamat Datang Kembali</h2>
<p class="mt-2 text-sm text-slate-500">Silakan masuk menggunakan akun karyawan Anda untuk memulai pelatihan.</p>
</div>
@if ($errors->has('form.email'))
<div class="bg-red-50 border-l-4 border-red-500 p-4 rounded-xl flex items-start space-x-3 transition-all">
<svg class="w-5 h-5 text-red-500 shrink-0 mt-0.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"></path>
</svg>
<div class="text-sm text-red-700 font-medium">
{{ $errors->first('form.email') }}
</div>
</div>
@endif
<form wire:submit="login" class="space-y-4">
<div>
<label for="email" class="block text-xs font-semibold uppercase tracking-wider text-slate-600 mb-1.5">Email Perusahaan</label>
<input wire:model="form.email" id="email" type="email" required autofocus placeholder="nama@tia-pharma.com"
class="w-full px-4 py-2.5 bg-slate-50 border @error('form.email') border-red-300 bg-red-50/30 focus:border-red-500 focus:ring-red-500/20 @else border-slate-200 focus:border-indigo-600 focus:ring-indigo-500/20 @enderror rounded-xl focus:bg-white transition-all text-sm">
</div>
<div>
<div class="flex justify-between items-center mb-1.5">
<label for="password" class="block text-xs font-semibold uppercase tracking-wider text-slate-600">Password</label>
@if (Route::has('password.request'))
<a href="{{ route('password.request') }}" class="text-xs font-medium text-indigo-600 hover:text-indigo-700 transition-colors">Lupa Password?</a>
@endif
</div>
<input wire:model="form.password" id="password" type="password" required placeholder="••••••••"
class="w-full px-4 py-2.5 bg-slate-50 border border-slate-200 rounded-xl focus:bg-white focus:ring-2 focus:ring-indigo-500/20 focus:border-indigo-600 transition-all text-sm">
@error('form.password') <span class="text-xs text-red-500 mt-1 block font-medium">{{ $message }}</span> @enderror
</div>
<div class="flex items-center pt-1">
<input wire:model="form.remember" id="remember" type="checkbox" class="h-4 w-4 text-indigo-600 focus:ring-indigo-500/20 border-slate-300 rounded-md">
<label for="remember" class="ml-2 block text-sm text-slate-600 font-medium">Ingat perangkat ini</label>
</div>
<button type="submit" class="w-full mt-2 bg-indigo-600 text-white py-2.5 px-4 rounded-xl font-semibold text-sm hover:bg-indigo-700 active:scale-[0.99] transition-all shadow-md shadow-indigo-600/10 hover:shadow-indigo-600/20 flex justify-center items-center">
<span>Masuk ke Dashboard</span>
<svg class="w-4 h-4 ml-2" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14 5l7 7m0 0l-7 7m7-7H3"></path></svg>
</button>
</form>
<p class="text-center text-sm text-slate-500 pt-4 border-t border-slate-100">
Karyawan baru? <a href="{{ route('register') }}" class="text-indigo-600 font-bold hover:underline">Registrasi Akun Mandiri</a>
</p>
</div>
</div>
</div>
@@ -0,0 +1,83 @@
<div class="min-h-screen flex bg-slate-50">
<div class="hidden lg:flex lg:w-1/3 bg-gradient-to-br from-indigo-950 via-slate-900 to-indigo-950 justify-center items-center p-12 relative overflow-hidden">
<div class="absolute inset-0 opacity-5 bg-[radial-gradient(#fff_1px,transparent_1px)] [background-size:24px_24px]"></div>
<div class="max-w-xs w-full relative z-10 text-white">
<h3 class="text-2xl font-bold mb-4 tracking-tight">Pendaftaran Mandiri Karyawan</h3>
<p class="text-slate-400 text-sm leading-relaxed mb-6">
Pastikan Anda menginput **NIK (Nomor Induk Karyawan)** yang valid sesuai dengan data HRD agar proses sinkronisasi matriks pelatihan otomatis berjalan dengan benar.
</p>
<div class="space-y-4">
<div class="flex items-start text-xs text-slate-300">
<div class="w-5 h-5 rounded-full bg-indigo-500/20 text-indigo-400 flex items-center justify-center shrink-0 mr-3 font-bold">1</div>
<p>Input NIK & Data Diri lengkap sesuai KTP/ID Card.</p>
</div>
<div class="flex items-start text-xs text-slate-300">
<div class="w-5 h-5 rounded-full bg-indigo-500/20 text-indigo-400 flex items-center justify-center shrink-0 mr-3 font-bold">2</div>
<p>Gunakan email internal korporat yang aktif.</p>
</div>
</div>
</div>
</div>
<div class="w-full lg:w-2/3 flex items-center justify-center p-8 sm:p-12 bg-white overflow-y-auto">
<div class="max-w-xl w-full space-y-6">
<div>
<h2 class="text-3xl font-bold text-slate-900 tracking-tight">Buat Akun LMS Baru</h2>
<p class="mt-1 text-sm text-slate-500">Lengkapi formulir di bawah ini untuk mendaftarkan hak akses Anda ke dalam sistem.</p>
</div>
<form wire:submit="register" class="space-y-5">
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
<div>
<label class="block text-xs font-semibold uppercase tracking-wider text-slate-600 mb-1">NIK (No. Induk Karyawan)</label>
<input wire:model="nik" type="text" required placeholder="Contoh: 20260124" class="w-full px-3 py-2.5 bg-slate-50 border border-slate-200 rounded-xl text-sm focus:bg-white focus:ring-2 focus:ring-indigo-500/20 focus:border-indigo-600 transition-all">
@error('nik') <span class="text-xs text-red-500 mt-1 block">{{ $message }}</span> @enderror
</div>
<div>
<label class="block text-xs font-semibold uppercase tracking-wider text-slate-600 mb-1">Inisial Nama (3 Huruf)</label>
<input wire:model="initial" type="text" placeholder="Contoh: TIA" class="w-full px-3 py-2.5 bg-slate-50 border border-slate-200 rounded-xl text-sm focus:bg-white focus:ring-2 focus:ring-indigo-500/20 focus:border-indigo-600 transition-all uppercase">
</div>
<div>
<label class="block text-xs font-semibold uppercase tracking-wider text-slate-600 mb-1">Nama Depan</label>
<input wire:model="first_name" type="text" required class="w-full px-3 py-2.5 bg-slate-50 border border-slate-200 rounded-xl text-sm focus:bg-white">
</div>
<div>
<label class="block text-xs font-semibold uppercase tracking-wider text-slate-600 mb-1">Nama Belakang</label>
<input wire:model="last_name" type="text" required class="w-full px-3 py-2.5 bg-slate-50 border border-slate-200 rounded-xl text-sm focus:bg-white">
</div>
</div>
<div>
<label class="block text-xs font-semibold uppercase tracking-wider text-slate-600 mb-1">Email Resmi</label>
<input wire:model="email" type="email" required placeholder="username@tunggal-pharma.com" class="w-full px-3 py-2.5 bg-slate-50 border border-slate-200 rounded-xl text-sm focus:bg-white focus:ring-2 focus:ring-indigo-500/20 focus:border-indigo-600 transition-all">
@error('email') <span class="text-xs text-red-500 mt-1 block">{{ $message }}</span> @enderror
</div>
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
<div>
<label class="block text-xs font-semibold uppercase tracking-wider text-slate-600 mb-1">Password Baru</label>
<input wire:model="password" type="password" required placeholder="Minimal 8 Karakter" class="w-full px-3 py-2.5 bg-slate-50 border border-slate-200 rounded-xl text-sm focus:bg-white">
@error('password') <span class="text-xs text-red-500 mt-1 block">{{ $message }}</span> @enderror
</div>
<div>
<label class="block text-xs font-semibold uppercase tracking-wider text-slate-600 mb-1">Konfirmasi Password</label>
<input wire:model="password_confirmation" type="password" required placeholder="Ulangi Password" class="w-full px-3 py-2.5 bg-slate-50 border border-slate-200 rounded-xl text-sm focus:bg-white">
</div>
</div>
<button type="submit" class="w-full bg-slate-900 text-white py-3 rounded-xl font-semibold text-sm hover:bg-slate-800 transition-all shadow-md mt-2">
Daftarkan Akun Karyawan
</button>
</form>
<div class="text-center text-sm text-slate-500 pt-4 border-t border-slate-100">
Sudah memiliki akses akun? <a href="{{ route('login') }}" class="text-indigo-600 font-bold hover:underline">Masuk di sini</a>
</div>
</div>
</div>
</div>
@@ -0,0 +1,105 @@
<?php
use Illuminate\Auth\Events\PasswordReset;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Password;
use Illuminate\Support\Facades\Session;
use Illuminate\Support\Str;
use Illuminate\Validation\Rules;
use Livewire\Attributes\Layout;
use Livewire\Attributes\Locked;
use Livewire\Volt\Component;
new #[Layout('layouts.guest')] class extends Component
{
#[Locked]
public string $token = '';
public string $email = '';
public string $password = '';
public string $password_confirmation = '';
/**
* Mount the component.
*/
public function mount(string $token): void
{
$this->token = $token;
$this->email = request()->string('email');
}
/**
* Reset the password for the given user.
*/
public function resetPassword(): void
{
$this->validate([
'token' => ['required'],
'email' => ['required', 'string', 'email'],
'password' => ['required', 'string', 'confirmed', Rules\Password::defaults()],
]);
// Here we will attempt to reset the user's password. If it is successful we
// will update the password on an actual user model and persist it to the
// database. Otherwise we will parse the error and return the response.
$status = Password::reset(
$this->only('email', 'password', 'password_confirmation', 'token'),
function ($user) {
$user->forceFill([
'password' => Hash::make($this->password),
'remember_token' => Str::random(60),
])->save();
event(new PasswordReset($user));
}
);
// If the password was successfully reset, we will redirect the user back to
// the application's home authenticated view. If there is an error we can
// redirect them back to where they came from with their error message.
if ($status != Password::PASSWORD_RESET) {
$this->addError('email', __($status));
return;
}
Session::flash('status', __($status));
$this->redirectRoute('login', navigate: true);
}
}; ?>
<div>
<form wire:submit="resetPassword">
<!-- Email Address -->
<div>
<x-input-label for="email" :value="__('Email')" />
<x-text-input wire:model="email" id="email" class="block mt-1 w-full" type="email" name="email" required autofocus autocomplete="username" />
<x-input-error :messages="$errors->get('email')" class="mt-2" />
</div>
<!-- Password -->
<div class="mt-4">
<x-input-label for="password" :value="__('Password')" />
<x-text-input wire:model="password" id="password" class="block mt-1 w-full" type="password" name="password" required autocomplete="new-password" />
<x-input-error :messages="$errors->get('password')" class="mt-2" />
</div>
<!-- Confirm Password -->
<div class="mt-4">
<x-input-label for="password_confirmation" :value="__('Confirm Password')" />
<x-text-input wire:model="password_confirmation" id="password_confirmation" class="block mt-1 w-full"
type="password"
name="password_confirmation" required autocomplete="new-password" />
<x-input-error :messages="$errors->get('password_confirmation')" class="mt-2" />
</div>
<div class="flex items-center justify-end mt-4">
<x-primary-button>
{{ __('Reset Password') }}
</x-primary-button>
</div>
</form>
</div>
@@ -0,0 +1,58 @@
<?php
use App\Livewire\Actions\Logout;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Session;
use Livewire\Attributes\Layout;
use Livewire\Volt\Component;
new #[Layout('layouts.guest')] class extends Component
{
/**
* Send an email verification notification to the user.
*/
public function sendVerification(): void
{
if (Auth::user()->hasVerifiedEmail()) {
$this->redirectIntended(default: route('dashboard', absolute: false), navigate: true);
return;
}
Auth::user()->sendEmailVerificationNotification();
Session::flash('status', 'verification-link-sent');
}
/**
* Log the current user out of the application.
*/
public function logout(Logout $logout): void
{
$logout();
$this->redirect('/', navigate: true);
}
}; ?>
<div>
<div class="mb-4 text-sm text-gray-600">
{{ __('Thanks for signing up! Before getting started, could you verify your email address by clicking on the link we just emailed to you? If you didn\'t receive the email, we will gladly send you another.') }}
</div>
@if (session('status') == 'verification-link-sent')
<div class="mb-4 font-medium text-sm text-green-600">
{{ __('A new verification link has been sent to the email address you provided during registration.') }}
</div>
@endif
<div class="mt-4 flex items-center justify-between">
<x-primary-button wire:click="sendVerification">
{{ __('Resend Verification Email') }}
</x-primary-button>
<button wire:click="logout" type="submit" class="underline text-sm text-gray-600 hover:text-gray-900 rounded-md focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">
{{ __('Log Out') }}
</button>
</div>
</div>