Sync SOP ke e-doc Plant & Add Subject dan penyempurnaan bagian matrix training karyawan

This commit is contained in:
Iwit
2026-06-04 19:01:17 +07:00
parent 91c0a8147f
commit 1089f60a3d
26 changed files with 1241 additions and 155 deletions
@@ -0,0 +1,28 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Membuka Dokumen...</title>
<style>
body { font-family: sans-serif; display: flex; justify-content: center; align-items: center; height: 100vh; background-color: #f8fafc; margin: 0; }
.loader { text-align: center; color: #64748b; }
.spinner { border: 4px solid #e2e8f0; border-top: 4px solid #3b82f6; border-radius: 50%; width: 40px; height: 40px; animation: spin 1s linear infinite; margin: 0 auto 15px auto; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
</style>
</head>
<body onload="document.getElementById('seeddms-login').submit();">
<div class="loader">
<div class="spinner"></div>
<h3>Sedang menghubungkan ke server dokumen...</h3>
<p>Mohon tunggu sebentar.</p>
</div>
<form id="seeddms-login" action="{{ $loginUrl }}" method="POST" style="display: none;">
<input type="hidden" name="guestlogin" value="1">
<input type="hidden" name="referuri" value="{{ $targetUri }}">
</form>
</body>
</html>
@@ -0,0 +1,134 @@
@extends('layouts.app')
@section('content')
<div class="max-w-7xl mx-auto px-4 py-8">
<div class="mb-6">
<h2 class="text-2xl font-bold text-slate-800 tracking-tight">Master Dokumen SOP</h2>
<p class="text-sm text-slate-500 mt-1">Data ditarik secara Real-Time (Read-Only) dari Database Plantdoc Server 192.168.10.11</p>
</div>
<div class="bg-white p-5 rounded-2xl shadow-sm border border-slate-200 mb-6">
<form action="{{ route('admin.sops.index') }}" method="GET" class="flex flex-wrap items-end gap-4">
<div class="flex-1 min-w-[200px]">
<label class="block text-xs font-bold text-slate-500 uppercase mb-2">Pencarian</label>
<input type="text" name="search" value="{{ request('search') }}" placeholder="Cari No / Judul..."
class="w-full px-4 py-2 border border-slate-200 rounded-xl text-sm focus:ring-blue-500 bg-slate-50 focus:bg-white">
</div>
<div class="w-full md:w-48">
<label class="block text-xs font-bold text-slate-500 uppercase mb-2">Folder / Dept</label>
<select name="department" class="w-full px-4 py-2 border border-slate-200 rounded-xl text-sm bg-slate-50 focus:bg-white">
<option value="">Semua Folder</option>
@foreach($departments as $dept)
<option value="{{ $dept->id }}" {{ request('department') == $dept->id ? 'selected' : '' }}>{{ $dept->name }}</option>
@endforeach
</select>
</div>
<div class="w-full md:w-48">
<label class="block text-xs font-bold text-slate-500 uppercase mb-2">Kategori</label>
<select name="category" class="w-full px-4 py-2 border border-slate-200 rounded-xl text-sm bg-slate-50 focus:bg-white">
<option value="">Semua Kategori</option>
@foreach($categories as $cat)
<option value="{{ $cat->id }}" {{ request('category') == $cat->id ? 'selected' : '' }}>{{ $cat->name }}</option>
@endforeach
</select>
</div>
<div class="w-full md:w-28">
<label class="block text-xs font-bold text-slate-500 uppercase mb-2">Versi</label>
<select name="version" class="w-full px-4 py-2 border border-slate-200 rounded-xl text-sm bg-slate-50 focus:bg-white">
<option value="">Semua</option>
@foreach($versions as $ver)
<option value="{{ $ver }}" {{ request('version') == $ver ? 'selected' : '' }}>v.{{ $ver }}</option>
@endforeach
</select>
</div>
<div class="flex gap-2 w-full md:w-auto">
<button type="submit" class="px-6 py-2 bg-blue-600 text-white text-sm font-bold rounded-xl hover:bg-blue-700 shadow-sm transition-colors">Cari</button>
<a href="{{ route('admin.sops.index') }}" class="px-4 py-2 bg-slate-100 text-slate-600 text-sm font-bold rounded-xl hover:bg-slate-200 transition-colors">Reset</a>
</div>
<div class="flex gap-2 ml-auto w-full md:w-auto mt-4 md:mt-0 pt-4 md:pt-0 border-t md:border-t-0 border-slate-100">
<button type="submit" name="export" value="excel" class="flex items-center px-4 py-2 bg-emerald-500 text-white text-sm font-bold rounded-xl hover:bg-emerald-600 shadow-sm 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="M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"></path></svg>
Excel
</button>
<button type="submit" name="export" value="pdf" class="flex items-center px-4 py-2 bg-red-500 text-white text-sm font-bold rounded-xl hover:bg-red-600 shadow-sm 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="M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"></path></svg>
PDF
</button>
</div>
</form>
</div>
<div class="bg-white rounded-2xl shadow-sm border border-slate-200 overflow-hidden">
<div class="overflow-x-auto">
<table class="w-full text-left text-sm text-slate-600">
<thead class="bg-slate-50 border-b border-slate-200 text-slate-500 uppercase text-xs tracking-wider">
<tr>
<th class="px-6 py-4 font-bold">Dept</th>
<th class="px-6 py-4 font-bold">Kategori</th>
<th class="px-6 py-4 font-bold">Nomor Dokumen</th>
<th class="px-6 py-4 font-bold">Judul SOP</th>
<th class="px-6 py-4 font-bold text-center">Versi</th>
<th class="px-6 py-4 font-bold">Tanggal Upload</th>
<th class="px-6 py-4 font-bold text-center">Aksi / File</th>
</tr>
</thead>
<tbody class="divide-y divide-slate-100">
@forelse($sops as $sop)
@php
// Prioritas 1: Baca versi dari Nomor SOP
$versi = substr(trim($sop->nomor_sop), -2);
if (!is_numeric($versi)) {
// Prioritas 2: Baca versi dari Judul SOP jika Nomor SOP tidak ada angka versinya
$versi = substr(trim($sop->judul_sop), -2);
if (!is_numeric($versi)) $versi = '-';
}
@endphp
<tr class="hover:bg-slate-50 transition-colors">
<td class="px-6 py-4 font-bold text-indigo-700">{{ $sop->nama_departemen ?? '-' }}</td>
<td class="px-6 py-4 text-slate-600 text-xs uppercase font-bold">{{ $sop->nama_kategori ?? 'Umum' }}</td>
<td class="px-6 py-4 font-bold text-slate-800 whitespace-nowrap">{{ $sop->nomor_sop }}</td>
<td class="px-6 py-4 font-medium text-slate-700">{{ $sop->judul_sop ?? '-' }}</td>
<td class="px-6 py-4 text-center">
<span class="px-2 py-1 bg-slate-100 text-slate-600 rounded-md text-xs font-bold border border-slate-200">
v.{{ $versi }}
</span>
</td>
<td class="px-6 py-4 text-slate-500 whitespace-nowrap">
{{ \Carbon\Carbon::createFromTimestamp($sop->tanggal_dibuat)->format('d M Y') }}
</td>
<td class="px-6 py-4 text-center">
@if(!empty($sop->file_pdf))
<a href="{{ route('admin.sops.open', $sop->id) }}" target="_blank" class="inline-flex items-center text-xs font-bold text-white bg-blue-500 hover:bg-blue-600 px-4 py-2 rounded-xl transition-colors shadow-sm">
<svg class="w-4 h-4 mr-1.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"></path><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"></path></svg>
Buka File
</a>
@else
<span class="text-xs font-medium text-slate-400">Tidak tersedia</span>
@endif
</td>
</tr>
@empty
<tr>
<td colspan="6" class="px-6 py-12 text-center">
<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="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"></path></svg>
<p class="text-slate-500 font-medium">SOP tidak ditemukan dengan filter tersebut.</p>
</td>
</tr>
@endforelse
</tbody>
</table>
</div>
<div class="p-4 border-t border-slate-100 bg-white">
{{ $sops->appends(request()->query())->links() }}
</div>
</div>
</div>
@endsection
@@ -0,0 +1,75 @@
<!DOCTYPE html>
<html>
<head>
<title>Master Dokumen - Tunggal Pharma</title>
<style>
body { font-family: 'Helvetica', 'Arial', sans-serif; font-size: 11px; color: #333; }
.header-title { text-align: center; font-size: 18px; font-weight: bold; margin-bottom: 5px; text-transform: uppercase; color: #1e3a8a; }
.divider { border-bottom: 2px solid #1e3a8a; margin-bottom: 15px; }
.info-table { width: 100%; margin-bottom: 15px; border: none; font-size: 11px; }
.info-table td { border: none; padding: 4px 0; }
table.data-table { width: 100%; border-collapse: collapse; margin-top: 10px; }
table.data-table th, table.data-table td { border: 1px solid #94a3b8; padding: 6px 8px; text-align: left; vertical-align: top; }
table.data-table th { background-color: #f1f5f9; font-weight: bold; text-transform: uppercase; font-size: 10px; color: #475569; }
table.data-table tr:nth-child(even) { background-color: #f8fafc; }
.text-center { text-align: center; }
.badge { background: #e2e8f0; padding: 2px 5px; border-radius: 3px; font-size: 10px; font-weight: bold; }
</style>
</head>
<body>
<div class="header-title">Data Master Dokumen - Tunggal Pharma</div>
<div class="divider"></div>
<table class="info-table">
<tr>
<td width="15%"><b>Diunduh Oleh</b></td>
<td width="35%">: {{ $downloader }}</td>
<td width="15%"><b>Total Record</b></td>
<td width="35%">: <span style="background: #1e3a8a; color: white; padding: 2px 6px; border-radius: 3px;">{{ $totalRecords }} Dokumen</span></td>
</tr>
<tr>
<td><b>Waktu Unduh</b></td>
<td>: {{ $downloadTime }} WIB</td>
<td></td>
<td></td>
</tr>
</table>
<table class="data-table">
<thead>
<tr>
<th class="text-center" width="5%">No</th>
<th width="15%">Dept / Folder</th>
<th width="15%">Kategori</th>
<th width="20%">Nomor Dokumen</th>
<th width="30%">Judul Dokumen</th>
<th class="text-center" width="6%">Versi</th>
<th width="9%">Tgl Upload</th>
</tr>
</thead>
<tbody>
@foreach($dataExport as $index => $sop)
@php
$versi = substr(trim($sop->nomor_sop), -2);
if (!is_numeric($versi)) {
$versi = substr(trim($sop->judul_sop), -2);
if (!is_numeric($versi)) $versi = '-';
}
@endphp
<tr>
<td class="text-center">{{ $index + 1 }}</td>
<td><b>{{ $sop->nama_departemen ?? '-' }}</b></td>
<td>{{ $sop->nama_kategori ?? '-' }}</td>
<td>{{ $sop->nomor_sop }}</td>
<td>{{ $sop->judul_sop }}</td>
<td class="text-center"><span class="badge">v.{{ $versi }}</span></td>
<td>{{ \Carbon\Carbon::createFromTimestamp($sop->tanggal_dibuat)->format('d/m/Y') }}</td>
</tr>
@endforeach
</tbody>
</table>
</body>
</html>