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,36 @@
@extends('layouts.app')
@section('content')
<div class="max-w-3xl mx-auto px-4 py-8">
<div class="mb-6 flex items-center space-x-3">
<a href="{{ route('admin.departments.index') }}" class="text-slate-400 hover:text-indigo-600 transition-colors">
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 19l-7-7m0 0l7-7m-7 7h18"></path></svg>
</a>
<h2 class="text-2xl font-bold text-slate-800 tracking-tight">Tambah Departemen Baru</h2>
</div>
<div class="bg-white rounded-2xl shadow-sm border border-slate-200 overflow-hidden">
<form action="{{ route('admin.departments.store') }}" method="POST" class="p-6 sm:p-8 space-y-6">
@csrf
<div>
<label for="name" class="block text-sm font-bold text-slate-700 mb-2">Nama Departemen <span class="text-red-500">*</span></label>
<input type="text" name="name" id="name" value="{{ old('name') }}" required placeholder="Contoh: Quality Assurance"
class="w-full px-4 py-3 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">
@error('name') <span class="text-xs text-red-500 mt-1 block">{{ $message }}</span> @enderror
</div>
<div>
<label for="code" class="block text-sm font-bold text-slate-700 mb-2">Kode Departemen</label>
<input type="text" name="code" id="code" value="{{ old('code') }}" placeholder="Contoh: QA"
class="w-full px-4 py-3 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 uppercase">
</div>
<div class="pt-4 flex justify-end space-x-3 border-t border-slate-100">
<a href="{{ route('admin.departments.index') }}" class="px-5 py-2.5 text-sm font-semibold text-slate-600 hover:bg-slate-100 rounded-xl transition-colors">Batal</a>
<button type="submit" class="px-5 py-2.5 text-sm font-semibold text-white bg-indigo-600 hover:bg-indigo-700 rounded-xl shadow-md transition-all">Simpan Departemen</button>
</div>
</form>
</div>
</div>
@endsection
@@ -0,0 +1,37 @@
@extends('layouts.app')
@section('content')
<div class="max-w-3xl mx-auto px-4 py-8">
<div class="mb-6 flex items-center space-x-3">
<a href="{{ route('admin.departments.index') }}" class="text-slate-400 hover:text-indigo-600 transition-colors">
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 19l-7-7m0 0l7-7m-7 7h18"></path></svg>
</a>
<h2 class="text-2xl font-bold text-slate-800 tracking-tight">Edit Departemen Baru</h2>
</div>
<div class="bg-white rounded-2xl shadow-sm border border-slate-200 overflow-hidden">
<form action="{{ route('admin.departments.update', $department->id) }}" method="POST" class="p-6 sm:p-8 space-y-6">
@csrf
@method('PUT')
<div>
<label for="name" class="block text-sm font-bold text-slate-700 mb-2">Nama Departemen <span class="text-red-500">*</span></label>
<input type="text" name="name" id="name" value="{{ old('name', $department->name) }}" required placeholder="Contoh: Quality Assurance"
class="w-full px-4 py-3 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">
@error('name') <span class="text-xs text-red-500 mt-1 block">{{ $message }}</span> @enderror
</div>
<div>
<label for="code" class="block text-sm font-bold text-slate-700 mb-2">Kode Departemen</label>
<input type="text" name="code" id="code" value="{{ old('code', $department->code) }}" placeholder="Contoh: QA"
class="w-full px-4 py-3 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 uppercase">
</div>
<div class="pt-4 flex justify-end space-x-3 border-t border-slate-100">
<a href="{{ route('admin.departments.index') }}" class="px-5 py-2.5 text-sm font-semibold text-slate-600 hover:bg-slate-100 rounded-xl transition-colors">Batal</a>
<button type="submit" class="px-5 py-2.5 text-sm font-semibold text-white bg-indigo-600 hover:bg-indigo-700 rounded-xl shadow-md transition-all">Simpan Departemen</button>
</div>
</form>
</div>
</div>
@endsection
@@ -0,0 +1,48 @@
<!DOCTYPE html>
<html>
<head>
<title>Laporan Data Departemen</title>
<style>
body { font-family: sans-serif; font-size: 12px; color: #333; }
.header { text-align: center; margin-bottom: 20px; border-bottom: 2px solid #222; padding-bottom: 10px; }
.metadata { text-align: right; font-size: 10px; color: #666; margin-bottom: 20px; }
table { width: 100%; border-collapse: collapse; margin-top: 10px; }
th, td { border: 1px solid #ddd; padding: 8px 10px; text-align: left; }
th { background-color: #f4f4f5; color: #111; text-transform: uppercase; font-size: 11px; }
tr:nth-child(even) { background-color: #fafafa; }
</style>
</head>
<body>
<div class="header">
<h2>PT TUNGGAL IDAMAN ABDI (TUNGGAL PHARMA)</h2>
<h3>Laporan Master Data: Departemen</h3>
</div>
<div class="metadata">
Dicetak pada: <strong>{{ $metadata['download_time'] }}</strong><br>
Diunduh oleh: <strong>{{ $metadata['downloaded_by'] }}</strong><br>
Total Rekor: <strong>{{ $metadata['total_data'] }} Departemen</strong>
</div>
<table>
<thead>
<tr>
<th width="10%">ID</th>
<th width="20%">KODE</th>
<th width="70%">NAMA DEPARTEMEN</th>
</tr>
</thead>
<tbody>
@foreach($departments as $dept)
<tr>
<td>{{ $dept->id }}</td>
<td>{{ $dept->code ?? '-' }}</td>
<td>{{ $dept->name }}</td>
</tr>
@endforeach
</tbody>
</table>
</body>
</html>
@@ -0,0 +1,112 @@
@extends('layouts.app')
@section('content')
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8"
x-data="{
showCols: { id: true, code: true, name: true, action: true },
exportOpen: false,
columnOpen: false
}">
<div class="flex flex-col md:flex-row md:items-center justify-between mb-8 gap-4">
<div>
<h2 class="text-2xl font-bold text-slate-800 tracking-tight">Manajemen Departemen</h2>
<p class="text-sm text-slate-500 mt-1">Total <span class="font-bold text-indigo-600">{{ $departments instanceof \Illuminate\Contracts\Pagination\LengthAwarePaginator ? $departments->total() : $departments->count() }}</span> rekor ditemukan.</p>
</div>
<a href="{{ route('admin.departments.create') }}" class="inline-flex items-center justify-center px-4 py-2 bg-indigo-600 text-white rounded-lg text-sm font-semibold hover:bg-indigo-700 shadow-sm transition-all">
<svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"></path></svg>
Tambah Departemen
</a>
</div>
<div class="bg-white p-4 rounded-t-2xl border border-slate-200 border-b-0 flex flex-col md:flex-row gap-4 justify-between items-center relative z-10">
<form action="{{ route('admin.departments.index') }}" method="GET" class="w-full md:w-96 relative">
<input type="text" name="search" value="{{ request('search') }}" placeholder="Cari nama atau kode..."
class="w-full pl-10 pr-4 py-2 bg-slate-50 border border-slate-200 rounded-xl text-sm focus:ring-2 focus:ring-indigo-500/20 focus:border-indigo-600 transition-all">
<svg class="w-4 h-4 text-slate-400 absolute left-3.5 top-3" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path></svg>
@if(request('search'))
<a href="{{ route('admin.departments.index') }}" class="absolute right-3 top-2.5 text-xs text-red-500 hover:underline">Clear</a>
@endif
</form>
<div class="flex items-center space-x-3 w-full md:w-auto">
<div class="relative">
<button @click="columnOpen = !columnOpen" @click.away="columnOpen = false" class="px-4 py-2 bg-white border border-slate-200 text-slate-700 rounded-xl text-sm font-semibold hover:bg-slate-50 flex items-center shadow-sm">
<svg class="w-4 h-4 mr-2 text-slate-400" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 17V7m0 10a2 2 0 01-2 2H5a2 2 0 01-2-2V7a2 2 0 012-2h2a2 2 0 012 2m0 10a2 2 0 002 2h2a2 2 0 002-2M9 7a2 2 0 012-2h2a2 2 0 012 2m0 10V7m0 10a2 2 0 002 2h2a2 2 0 002-2V7a2 2 0 00-2-2h-2a2 2 0 00-2 2"></path></svg>
Kolom
</button>
<div x-show="columnOpen" x-transition class="absolute right-0 mt-2 w-48 bg-white border border-slate-100 rounded-xl shadow-xl py-2 z-50" style="display: none;">
<label class="flex items-center px-4 py-2 hover:bg-slate-50 cursor-pointer text-sm"><input type="checkbox" x-model="showCols.id" class="rounded border-slate-300 text-indigo-600 mr-3"> ID</label>
<label class="flex items-center px-4 py-2 hover:bg-slate-50 cursor-pointer text-sm"><input type="checkbox" x-model="showCols.code" class="rounded border-slate-300 text-indigo-600 mr-3"> Kode</label>
<label class="flex items-center px-4 py-2 hover:bg-slate-50 cursor-pointer text-sm"><input type="checkbox" x-model="showCols.name" class="rounded border-slate-300 text-indigo-600 mr-3"> Nama Departemen</label>
</div>
</div>
<div class="relative">
<button @click="exportOpen = !exportOpen" @click.away="exportOpen = false" class="px-4 py-2 bg-emerald-50 border border-emerald-200 text-emerald-700 rounded-xl text-sm font-semibold hover:bg-emerald-100 flex items-center transition-all">
<svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"></path></svg>
Export Data
</button>
<div x-show="exportOpen" x-transition class="absolute right-0 mt-2 w-48 bg-white border border-slate-100 rounded-xl shadow-xl py-2 z-50" style="display: none;">
<p class="px-4 py-1 text-[10px] font-bold text-slate-400 uppercase tracking-wider">Pilih Format</p>
<a href="{{ url('admin/departments/export/excel?search=' . request('search')) }}" class="flex items-center px-4 py-2 hover:bg-slate-50 text-sm text-slate-700">
<span class="w-2 h-2 rounded-full bg-emerald-500 mr-2"></span> Excel (.xlsx)
</a>
<a href="{{ url('admin/departments/export/pdf?search=' . request('search')) }}" class="flex items-center px-4 py-2 hover:bg-slate-50 text-sm text-slate-700">
<span class="w-2 h-2 rounded-full bg-red-500 mr-2"></span> PDF (.pdf)
</a>
</div>
</div>
</div>
</div>
<div class="bg-white border border-slate-200 rounded-b-2xl overflow-hidden shadow-sm relative z-0">
<div class="overflow-x-auto">
<table class="w-full text-left text-sm whitespace-nowrap">
<thead class="bg-slate-50/80 text-slate-500 text-xs uppercase tracking-wider border-b border-slate-200">
<tr>
<th x-show="showCols.id" class="px-6 py-4 font-semibold">ID</th>
<th x-show="showCols.code" class="px-6 py-4 font-semibold">Kode</th>
<th x-show="showCols.name" class="px-6 py-4 font-semibold">Nama Departemen</th>
<th x-show="showCols.action" class="px-6 py-4 font-semibold text-right">Aksi</th>
</tr>
</thead>
<tbody class="divide-y divide-slate-100 text-slate-700">
@forelse($departments as $dept)
<tr class="hover:bg-slate-50 transition-colors">
<td x-show="showCols.id" class="px-6 py-4 font-medium text-slate-500">#{{ $dept->id }}</td>
<td x-show="showCols.code" class="px-6 py-4">
<span class="bg-slate-100 text-slate-600 px-2.5 py-1 rounded-md text-xs font-bold border border-slate-200">{{ $dept->code ?? 'N/A' }}</span>
</td>
<td x-show="showCols.name" class="px-6 py-4 font-bold text-slate-900">{{ $dept->name }}</td>
<td x-show="showCols.action" class="px-6 py-4 text-right space-x-3">
<a href="{{ route('admin.departments.show', $dept->id) }}" class="text-slate-400 hover:text-indigo-600 font-medium text-sm transition-colors">Detail</a>
<a href="{{ route('admin.departments.edit', $dept->id) }}" class="text-indigo-600 hover:text-indigo-800 font-medium text-sm transition-colors">Edit</a>
<form action="{{ route('admin.departments.destroy', $dept->id) }}" method="POST" class="inline-block" onsubmit="return confirm('Apakah Anda yakin ingin menghapus departemen ini?');">
@csrf @method('DELETE')
<button type="submit" class="text-red-500 hover:text-red-700 font-medium text-sm transition-colors">Hapus</button>
</form>
</td>
</tr>
@empty
<tr>
<td colspan="4" class="px-6 py-12 text-center text-slate-500">
<svg class="w-12 h-12 text-slate-300 mx-auto mb-3" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M20 13V6a2 2 0 00-2-2H6a2 2 0 00-2 2v7m16 0v5a2 2 0 01-2 2H6a2 2 0 01-2-2v-5m16 0h-2.586a1 1 0 00-.707.293l-2.414 2.414a1 1 0 01-.707.293h-3.172a1 1 0 01-.707-.293l-2.414-2.414A1 1 0 006.586 13H4"></path></svg>
Tidak ada data departemen yang ditemukan.
</td>
</tr>
@endforelse
</tbody>
</table>
</div>
@if(method_exists($departments, 'hasPages') && $departments->hasPages())
<div class="p-4 border-t border-slate-100 bg-slate-50/50">
{{ $departments->links() }}
</div>
@endif
</div>
</div>
@endsection
@@ -0,0 +1,141 @@
@extends('layouts.app')
@section('content')
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
<div class="flex items-center justify-between mb-6">
<div>
<h2 class="text-2xl font-bold text-slate-800 tracking-tight">Detail Departemen</h2>
<p class="text-sm text-slate-500 mt-1">Informasi lengkap mengenai departemen.</p>
</div>
<a href="{{ route('admin.departments.index') }}" class="inline-flex items-center px-4 py-2 bg-slate-100 text-slate-700 rounded-lg text-sm font-semibold hover:bg-slate-200 transition-colors">
<svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 19l-7-7m0 0l7-7m-7 7h18"></path></svg>
Kembali
</a>
</div>
<div class="bg-white rounded-2xl shadow-sm border border-slate-200 overflow-hidden">
<div class="p-6 sm:p-10">
<div class="grid grid-cols-1 md:grid-cols-2 gap-8">
<div>
<h3 class="text-lg font-semibold text-slate-800 mb-4 pb-2 border-b border-slate-100">Informasi Utama</h3>
<div class="space-y-4">
<div>
<span class="block text-sm font-medium text-slate-500 mb-1">Kode Departemen</span>
<div class="inline-block bg-slate-100 text-slate-700 px-3 py-1 rounded-md text-sm font-bold border border-slate-200">
{{ $department->code ?? '-' }}
</div>
</div>
<div>
<span class="block text-sm font-medium text-slate-500 mb-1">Nama Departemen</span>
<div class="text-lg font-bold text-slate-900">
{{ $department->name }}
</div>
</div>
</div>
</div>
<div>
<h3 class="text-lg font-semibold text-slate-800 mb-4 pb-2 border-b border-slate-100">Informasi Sistem</h3>
<div class="space-y-4">
<div>
<span class="block text-sm font-medium text-slate-500 mb-1">ID Sistem</span>
<div class="text-sm text-slate-900 font-mono bg-slate-50 inline-block px-2 py-1 rounded border border-slate-100">
#{{ $department->id }}
</div>
</div>
<div>
<span class="block text-sm font-medium text-slate-500 mb-1">Tanggal Dibuat</span>
<div class="text-sm text-slate-900">
{{ $department->created_at ? $department->created_at->format('d F Y, H:i') : '-' }}
</div>
</div>
<div>
<span class="block text-sm font-medium text-slate-500 mb-1">Terakhir Diperbarui</span>
<div class="text-sm text-slate-900">
{{ $department->updated_at ? $department->updated_at->diffForHumans() : '-' }}
</div>
</div>
</div>
</div>
</div>
<div class="mt-10 pt-8 border-t border-slate-100">
<h3 class="text-lg font-semibold text-slate-800 mb-6">Pemetaan & Statistik</h3>
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
<div class="bg-indigo-50 border border-indigo-100 rounded-xl p-6 flex items-center">
<div class="p-3 bg-indigo-100 text-indigo-600 rounded-lg mr-4">
<svg class="w-8 h-8" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z"></path></svg>
</div>
<div>
<p class="text-sm font-medium text-slate-500">Total Karyawan Aktif</p>
<p class="text-2xl font-bold text-slate-900">{{ $department->users()->count() }} Orang</p>
</div>
</div>
<div class="bg-slate-50 border border-slate-100 rounded-xl p-6">
<p class="text-sm font-medium text-slate-500 mb-3">Posisi / Jabatan pada Departemen ini ({{ $department->positions()->count() }})</p>
<div class="flex flex-wrap gap-2">
@forelse($department->positions as $pos)
<span class="inline-flex items-center px-3 py-1 rounded-full text-xs font-semibold bg-white border border-slate-200 text-slate-700 shadow-sm">
{{ $pos->name }}
</span>
@empty
<span class="text-sm text-slate-400 italic">Belum ada posisi yang dipetakan.</span>
@endforelse
</div>
</div>
</div>
</div>
<div class="mt-10 pt-8 border-t border-slate-100">
<h3 class="text-lg font-semibold text-slate-800 mb-4">Daftar Karyawan di Departemen Ini</h3>
<div class="bg-white border border-slate-200 rounded-xl overflow-hidden shadow-sm">
<div class="overflow-x-auto custom-scrollbar">
<table class="w-full text-left text-sm whitespace-nowrap">
<thead class="bg-slate-50 text-slate-500 text-xs uppercase tracking-wider border-b border-slate-200">
<tr>
<th class="px-6 py-3 font-semibold">NIK</th>
<th class="px-6 py-3 font-semibold">Nama Karyawan</th>
<th class="px-6 py-3 font-semibold">Jabatan</th>
<th class="px-6 py-3 font-semibold text-right">Opsi</th>
</tr>
</thead>
<tbody class="divide-y divide-slate-100 text-slate-700">
@forelse($department->users as $user)
<tr class="hover:bg-slate-50">
<td class="px-6 py-3 font-mono text-xs font-bold">{{ $user->nik ?? '-' }}</td>
<td class="px-6 py-3">
<div class="font-bold text-slate-900">{{ $user->first_name }} {{ $user->last_name }}</div>
<div class="text-xs text-slate-500">{{ $user->email }}</div>
</td>
<td class="px-6 py-3 text-sm">{{ $user->position->name ?? '-' }}</td>
<td class="px-6 py-3 text-right">
<a href="{{ route('admin.employees.show', $user->id) }}" class="text-indigo-600 hover:text-indigo-800 font-medium text-xs">Detail</a>
</td>
</tr>
@empty
<tr>
<td colspan="4" class="px-6 py-8 text-center text-slate-500 italic">Belum ada karyawan di departemen ini.</td>
</tr>
@endforelse
</tbody>
</table>
</div>
</div>
</div>
<div class="mt-10 pt-6 border-t border-slate-100 flex items-center justify-end space-x-3">
<a href="{{ route('admin.departments.edit', $department->id) }}" class="inline-flex items-center px-4 py-2 bg-indigo-50 text-indigo-700 rounded-lg text-sm font-semibold hover:bg-indigo-100 transition-colors">
<svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"></path></svg>
Edit Departemen
</a>
</div>
</div>
</div>
</div>
@endsection