Sync SOP ke e-doc Plant & Add Subject dan penyempurnaan bagian matrix training karyawan
This commit is contained in:
@@ -115,13 +115,37 @@
|
||||
</div>
|
||||
|
||||
<div class="border-t border-slate-100 pt-6 mt-6">
|
||||
<label class="block text-sm font-bold text-slate-700 mb-2">Modul SOP Training (Marketing)</label>
|
||||
<select name="training_matrix_id" class="select2 w-full text-sm">
|
||||
<option value="">-- Kosongkan jika bukan Plant Dept --</option>
|
||||
@foreach($trainingMatrices as $matrix)
|
||||
<option value="{{ $matrix->id }}" {{ old('training_matrix_id') == $matrix->id ? 'selected' : '' }}>{{ $matrix->title ?? $matrix->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<h3 class="text-sm font-bold text-slate-700 mb-1">Materi SOP / Training Matrix</h3>
|
||||
<p class="text-xs text-slate-500 mb-4">Pilih materi wajib untuk karyawan ini dan tentukan status pelatihannya.</p>
|
||||
|
||||
<div class="bg-slate-50 border border-slate-200 rounded-xl p-4 max-h-[400px] overflow-y-auto">
|
||||
<table class="w-full text-left text-sm text-slate-600">
|
||||
<thead class="border-b border-slate-200 text-slate-500 uppercase text-xs sticky top-0 bg-slate-50">
|
||||
<tr>
|
||||
<th class="py-2 w-12 text-center">Pilih</th>
|
||||
<th class="py-2">Nama Materi / Dokumen SOP</th>
|
||||
<th class="py-2 w-48 text-center">Status Training</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-slate-200">
|
||||
@foreach($subjects as $subject)
|
||||
<tr class="hover:bg-white transition-colors">
|
||||
<td class="py-3 text-center">
|
||||
<input type="checkbox" name="trainings[{{ $subject->id }}][selected]" value="1"
|
||||
class="w-5 h-5 text-blue-600 rounded border-slate-300 focus:ring-blue-500 cursor-pointer">
|
||||
</td>
|
||||
<td class="py-3 font-bold text-slate-700">{{ $subject->name }}</td>
|
||||
<td class="py-3">
|
||||
<select name="trainings[{{ $subject->id }}][status]" class="w-full px-3 py-1.5 bg-white border border-slate-300 rounded-lg text-xs font-bold focus:ring-blue-500">
|
||||
<option value="belum_training" class="text-amber-600">Belum Training</option>
|
||||
<option value="passed" class="text-emerald-600">Lulus (Passed)</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="border-t border-slate-100 pt-6 mt-6" x-data="{ documents: [{ id: 1 }], addDocument() { this.documents.push({ id: Date.now() }); }, removeDocument(id) { this.documents = this.documents.filter(doc => doc.id !== id); } }">
|
||||
|
||||
@@ -20,6 +20,16 @@
|
||||
<h2 class="text-2xl font-bold text-slate-800 tracking-tight">Edit Data Karyawan</h2>
|
||||
</div>
|
||||
|
||||
@if ($errors->any())
|
||||
<div class="mb-6 p-4 bg-red-50 text-red-700 rounded-xl border border-red-100 text-sm font-bold">
|
||||
<ul class="list-disc pl-5">
|
||||
@foreach ($errors->all() as $error)
|
||||
<li>{{ $error }}</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="bg-white rounded-2xl shadow-sm border border-slate-200 overflow-hidden">
|
||||
<form action="{{ route('admin.employees.update', $employee->id) }}" method="POST" enctype="multipart/form-data" class="p-6 sm:p-8 space-y-6">
|
||||
@csrf
|
||||
@@ -85,7 +95,7 @@
|
||||
<label class="block text-sm font-bold text-slate-700 mb-2">Posisi / Jabatan <span class="text-red-500">*</span></label>
|
||||
<select name="position_id" id="posSelect" class="select2 w-full text-sm" required>
|
||||
<option value="">-- Pilih Jabatan --</option>
|
||||
</select>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="bg-slate-50 p-4 border border-slate-200 rounded-xl">
|
||||
@@ -114,13 +124,82 @@
|
||||
</div>
|
||||
|
||||
<div class="border-t border-slate-100 pt-6 mt-6">
|
||||
<label class="block text-sm font-bold text-slate-700 mb-2">Modul SOP Training (Marketing)</label>
|
||||
<select name="training_matrix_id" class="select2 w-full text-sm">
|
||||
<option value="">-- Kosongkan jika bukan marketing --</option>
|
||||
@foreach($trainingMatrices as $matrix)
|
||||
<option value="{{ $matrix->id }}" {{ old('training_matrix_id', $employee->training_matrix_id) == $matrix->id ? 'selected' : '' }}>{{ $matrix->title ?? $matrix->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<h3 class="text-sm font-bold text-slate-700 mb-1">Materi SOP / Training Matrix</h3>
|
||||
<p class="text-xs text-slate-500 mb-4">Perbarui materi dan status pelatihan untuk karyawan ini.</p>
|
||||
|
||||
<div class="bg-slate-50 border border-slate-200 rounded-xl p-4 max-h-[400px] overflow-y-auto">
|
||||
<table class="w-full text-left text-sm text-slate-600">
|
||||
<thead class="border-b border-slate-200 text-slate-500 uppercase text-xs sticky top-0 bg-slate-50">
|
||||
<tr>
|
||||
<th class="py-2 w-12 text-center">Pilih</th>
|
||||
<th class="py-2">Nama Materi / Dokumen SOP</th>
|
||||
<th class="py-2 w-48 text-center">Status Training</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-slate-200">
|
||||
@foreach($subjects as $subject)
|
||||
@php
|
||||
$hasTraining = $employee->trainings->contains('id', $subject->id);
|
||||
$currentStatus = $hasTraining ? $employee->trainings->find($subject->id)->pivot->status : 'belum_training';
|
||||
@endphp
|
||||
<tr class="hover:bg-white transition-colors">
|
||||
<td class="py-3 text-center">
|
||||
<input type="checkbox" name="trainings[{{ $subject->id }}][selected]" value="1"
|
||||
{{ $hasTraining ? 'checked' : '' }}
|
||||
class="w-5 h-5 text-blue-600 rounded border-slate-300 focus:ring-blue-500 cursor-pointer">
|
||||
</td>
|
||||
<td class="py-3 font-bold text-slate-700">{{ $subject->name }}</td>
|
||||
<td class="py-3">
|
||||
<select name="trainings[{{ $subject->id }}][status]" class="w-full px-3 py-1.5 bg-white border border-slate-300 rounded-lg text-xs font-bold focus:ring-blue-500">
|
||||
<option value="belum_training" class="text-amber-600" {{ $currentStatus == 'belum_training' ? 'selected' : '' }}>Belum Training</option>
|
||||
<option value="passed" class="text-emerald-600" {{ $currentStatus == 'passed' ? 'selected' : '' }}>Lulus (Passed)</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mt-8 pt-6 border-t border-slate-200">
|
||||
<h3 class="text-lg font-bold text-slate-800 mb-2">Training Matrix & Kompetensi</h3>
|
||||
<p class="text-sm text-slate-500 mb-4">Pilih materi/SOP wajib untuk karyawan ini dan perbarui status pelatihannya.</p>
|
||||
|
||||
<div class="bg-slate-50 border border-slate-200 rounded-xl p-4 max-h-[400px] overflow-y-auto">
|
||||
<table class="w-full text-left text-sm text-slate-600">
|
||||
<thead class="border-b border-slate-200 text-slate-500 uppercase text-xs sticky top-0 bg-slate-50">
|
||||
<tr>
|
||||
<th class="py-2 w-12 text-center">Pilih</th>
|
||||
<th class="py-2">Nama Materi / Dokumen SOP</th>
|
||||
<th class="py-2 w-48 text-center">Status Training</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-slate-200">
|
||||
@foreach($subjects as $subject)
|
||||
@php
|
||||
// Mengecek apakah relasi dengan pivot sudah ada di database
|
||||
$hasTraining = $employee->trainings->contains('id', $subject->id);
|
||||
$currentStatus = $hasTraining ? $employee->trainings->find($subject->id)->pivot->status : 'belum_training';
|
||||
@endphp
|
||||
<tr class="hover:bg-white transition-colors">
|
||||
<td class="py-3 text-center">
|
||||
<input type="checkbox" name="trainings[{{ $subject->id }}][selected]" value="1"
|
||||
{{ $hasTraining ? 'checked' : '' }}
|
||||
class="w-5 h-5 text-blue-600 rounded border-slate-300 focus:ring-blue-500 cursor-pointer">
|
||||
</td>
|
||||
<td class="py-3 font-bold text-slate-700">{{ $subject->name }}</td>
|
||||
<td class="py-3">
|
||||
<select name="trainings[{{ $subject->id }}][status]" class="w-full px-3 py-1.5 bg-white border border-slate-300 rounded-lg text-xs font-bold focus:ring-blue-500">
|
||||
<option value="belum_training" class="text-amber-600" {{ $currentStatus == 'belum_training' ? 'selected' : '' }}>Belum Training</option>
|
||||
<option value="passed" class="text-emerald-600" {{ $currentStatus == 'passed' ? 'selected' : '' }}>Lulus (Passed)</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="border-t border-slate-100 pt-6 mt-6">
|
||||
@@ -140,7 +219,6 @@
|
||||
$(document).ready(function() {
|
||||
$('.select2').select2({ width: '100%' });
|
||||
|
||||
// Logika Dropdown Bertingkat untuk Edit (Sama dengan Create)
|
||||
const mapping = @json($deptPosMapping ?? []);
|
||||
const posSelect = $('#posSelect');
|
||||
const deptSelect = $('#deptSelect');
|
||||
|
||||
@@ -88,6 +88,52 @@
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
<div class="mt-8 bg-white rounded-2xl shadow-sm border border-slate-200 overflow-hidden">
|
||||
<div class="px-6 py-4 border-b border-slate-100 bg-slate-50 flex items-center justify-between">
|
||||
<h3 class="text-lg font-bold text-slate-800">Riwayat Training & SOP</h3>
|
||||
<span class="px-3 py-1 bg-blue-100 text-blue-700 text-xs font-bold rounded-full">
|
||||
{{ $employee->trainings->count() }} Materi Diikuti
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="p-0 overflow-x-auto">
|
||||
<table class="w-full text-left text-sm text-slate-600">
|
||||
<thead class="bg-white border-b border-slate-100 text-slate-500 uppercase text-xs">
|
||||
<tr>
|
||||
<th class="px-6 py-3 w-16 text-center">No</th>
|
||||
<th class="px-6 py-3">Nama Materi / Dokumen</th>
|
||||
<th class="px-6 py-3 w-48 text-center">Status</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-slate-50">
|
||||
@forelse($employee->trainings as $index => $training)
|
||||
<tr class="hover:bg-slate-50 transition-colors">
|
||||
<td class="px-6 py-4 text-center text-slate-400">{{ $index + 1 }}</td>
|
||||
<td class="px-6 py-4 font-bold text-slate-700">{{ $training->name }}</td>
|
||||
<td class="px-6 py-4 text-center">
|
||||
@if($training->pivot->status == 'passed')
|
||||
<span class="inline-flex items-center px-2.5 py-1 bg-emerald-50 text-emerald-700 rounded-md text-xs font-bold border border-emerald-200">
|
||||
<svg class="w-3.5 h-3.5 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"></path></svg>
|
||||
Lulus
|
||||
</span>
|
||||
@else
|
||||
<span class="inline-flex items-center px-2.5 py-1 bg-amber-50 text-amber-700 rounded-md text-xs font-bold border border-amber-200">
|
||||
<svg class="w-3.5 h-3.5 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg>
|
||||
Belum Training
|
||||
</span>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="3" class="px-6 py-8 text-center text-slate-500">Karyawan ini belum ditugaskan untuk materi/SOP apapun.</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Kolom Kanan: Info Personal -->
|
||||
<div class="bg-white rounded-2xl shadow-sm border border-slate-200 p-6">
|
||||
<h3 class="text-sm font-bold text-slate-800 uppercase tracking-wider mb-4 pb-2 border-b border-slate-100">Informasi Personal & Kontak</h3>
|
||||
|
||||
Reference in New Issue
Block a user