@extends('layouts.app', ['class' => 'g-sidenav-show bg-gray-100']) {{-- section content --}} @section('content') @include('layouts.navbars.auth.topnav', ['title' => '']) @if (($dmenu ?? '') == 'trdper' || ($url_menu ?? '') == 'daftar-periodic-hrd' || request()->is('daftar-periodic-hrd/show/*')) @php $isPeriodicEditMode = request()->is('daftar-periodic-hrd/edit/*'); @endphp @php $selectedYear = (int) $idencrypt; $headerRow = \Illuminate\Support\Facades\DB::table('tr_periodic_header') ->where('tahun', $selectedYear) ->where('is_active', '1') ->first(); $keterangan = $headerRow->keterangan ?? 'Daftar Periodic HRD'; $headerId = $headerRow->id ?? null; $detailRows = collect(); if ($headerId) { $detailRows = \Illuminate\Support\Facades\DB::table('tr_periodic_detail') ->leftJoin('ms_periodic', 'tr_periodic_detail.periodic_id', '=', 'ms_periodic.id') ->leftJoin('ms_area', 'tr_periodic_detail.area_id', '=', 'ms_area.id') ->leftJoin('users', 'tr_periodic_detail.worker_id', '=', 'users.id') ->select( 'tr_periodic_detail.id', 'tr_periodic_detail.periodic_id', 'tr_periodic_detail.area_id', 'tr_periodic_detail.worker_id', 'tr_periodic_detail.periode', 'tr_periodic_detail.cycle', 'tr_periodic_detail.start_plan_date', 'ms_periodic.job_description', 'ms_area.nama_area as area_name', \Illuminate\Support\Facades\DB::raw("CONCAT(users.firstname, ' ', COALESCE(users.lastname, '')) as worker_name") ) ->where('tr_periodic_detail.header_id', $headerId) ->where('tr_periodic_detail.is_active', '1') ->orderBy('tr_periodic_detail.id') ->get(); } $periodics = \Illuminate\Support\Facades\DB::table('ms_periodic') ->select('ms_periodic.id', 'ms_periodic.job_description') ->where('ms_periodic.is_active', '1') ->orderBy('ms_periodic.job_description') ->get(); $areas = \Illuminate\Support\Facades\DB::table('ms_area') ->orderBy('nama_area') ->get(); // Build workers dropdown from all active roles with ptg prefix $petugasRoles = \Illuminate\Support\Facades\DB::table('sys_roles') ->where('isactive', '1') ->where('idroles', 'like', 'ptg%') ->orderBy('idroles') ->get(['idroles', 'name']); $activeUsers = \Illuminate\Support\Facades\DB::table('users') ->where('isactive', '1') ->select('id', 'idroles') ->orderBy('id') ->get(); $workers = collect([]); foreach ($petugasRoles as $role) { $roleCode = strtolower(trim((string) $role->idroles)); $matchedUser = $activeUsers->first(function ($user) use ($roleCode) { $userRoles = array_map('trim', explode(',', strtolower((string) ($user->idroles ?? '')))); return in_array($roleCode, $userRoles, true); }); if ($matchedUser) { $workers->push((object) [ 'id' => $matchedUser->id, 'label' => !empty($role->name) ? $role->name : strtoupper(substr($roleCode, 3)), ]); } } $dateRows = \Illuminate\Support\Facades\DB::table('tr_periodic_items') ->join('tr_periodic_detail', 'tr_periodic_items.detail_id', '=', 'tr_periodic_detail.id') ->select('tr_periodic_detail.id as detail_id', 'tr_periodic_items.planned_date', 'tr_periodic_items.realization_date') ->where('tr_periodic_detail.header_id', $headerId) ->where('tr_periodic_detail.is_active', '1') ->where('tr_periodic_items.is_active', '1') ->whereYear('tr_periodic_items.planned_date', $selectedYear) ->orderBy('tr_periodic_items.planned_date') ->get(); $dateMap = []; foreach ($dateRows as $row) { $realizationDates = []; if (!empty($row->realization_date)) { $decoded = json_decode($row->realization_date, true); if (is_array($decoded)) { $realizationDates = $decoded; } else { $realizationDates = [$row->realization_date]; } } $dateMap[$row->detail_id][] = [ 'plan_date' => $row->planned_date, 'realization_date' => $realizationDates, ]; } @endphp

Daftar Periodic HRD

@if ($isPeriodicEditMode) Anda dapat mengubah keterangan dan detail jadwal periodic. @else Gunakan tombol Edit Jadwal untuk mengubah keterangan atau detail jadwal. @endif
@forelse ($detailRows as $detail) @empty @endforelse
Action No Area Pekerjaan Periode Cycle Start Rencana Rencana Realisasi Petugas
{{ $loop->iteration }} @php $existingDates = \Illuminate\Support\Facades\DB::table('tr_periodic_items') ->where('detail_id', $detail->id) ->orderBy('planned_date') ->pluck('planned_date') ->toArray(); @endphp
Belum ada jadwal kerja periodic.
@if ($isPeriodicEditMode)
@endif
@push('js') @endpush @else @php $headApprovalStatus = strtolower((string) ($list->request_status ?? $list->status ?? '')); if ($headApprovalStatus === 'reject') { $headApprovalStatus = 'rejected'; } $detailStatusValue = $headApprovalStatus; $isDraftRequest = in_array(($dmenu ?? ''), ['trreq', 'truser'], true) && $headApprovalStatus === 'draft'; $canHeadProcess = ($dmenu ?? '') === 'trreq' && in_array($headApprovalStatus, ['pending', 'review'], true) && empty($list->head_approval_date); $currentPath = request()->path(); $isHrdDetailPage = ($dmenu ?? '') === 'trhrd' || str_contains($currentPath, 'pengajuan-hrd/show') || str_contains($currentPath, 'daftar-pengajuan-hrd/show'); $canHrdProcess = $isHrdDetailPage && in_array($headApprovalStatus, ['pending', 'review'], true) && empty($list->hrd_approval_date); $canHrdUpdate = $isHrdDetailPage && in_array($headApprovalStatus, ['pengadaan', 'pengerjaan', 'revisi'], true); $isUserPengajuanDetail = in_array(($dmenu ?? ''), ['trreq', 'truser'], true) || str_contains($currentPath, 'pengajuan-pekerjaan-pu/show') || str_contains($currentPath, 'daftar-pu/show') || str_contains($currentPath, 'user/show'); $showPuDetailTracking = $isUserPengajuanDetail || $isHrdDetailPage; $formatDetailDateInput = function ($value) { if (empty($value) || $value === '0000-00-00' || $value === '0000-00-00 00:00:00') { return ''; } return \Illuminate\Support\Carbon::parse($value)->format('Y-m-d'); }; $pengadaanEstimatedStartInput = $formatDetailDateInput($list->pengadaan_estimated_started_at ?? null); $pengadaanEstimatedEndInput = $formatDetailDateInput($list->pengadaan_estimated_ended_at ?? null); $pengerjaanEstimatedStartInput = $formatDetailDateInput($list->pengerjaan_estimated_started_at ?? null); $pengerjaanEstimatedEndInput = $formatDetailDateInput($list->pengerjaan_estimated_ended_at ?? null); @endphp @if ($showPuDetailTracking) @endif
@include('components.alert')
@csrf @method('PUT')

View {{ $title_menu }}


{{-- retrieve table header --}} @if (isset($table_header) && count($table_header) > 0) @foreach ($table_header as $header) @continue($isUserPengajuanDetail && in_array($header->field, ['head_note', 'hrd_note'], true)) @php $primary = false; $generateid = false; foreach ($table_primary as $p) { $primary == false ? ($p->field == $header->field ? ($primary = true) : ($primary = false)) : ''; $generateid == false ? ($p->generateid == $header->field ? ($generateid = true) : ($generateid = false)) : ''; } @endphp
@if ($header->type != 'hidden') {{-- display label alias on type field not hidden --}} @if ($header->type == 'image' || $header->field == 'attachment') @else @endif @endif {{-- field type char and string --}} @if ($header->type == 'char' || $header->type == 'string') @if ($header->note != '')

{{ '*) ' . $header->note }}

@endif {{-- field type text --}} @elseif ($header->type == 'text') @if ($header->note != '')

{{ '*) ' . $header->note }}

@endif {{-- field type email --}} @elseif ($header->type == 'email') @if ($header->note != '')

{{ '*) ' . $header->note }}

@endif {{-- field type number --}} @elseif ($header->type == 'number') @if ($header->note != '')

{{ '*) ' . $header->note }}

@endif {{-- field type currency --}} @elseif ($header->type == 'currency') @if ($header->note != '')

{{ '*) ' . $header->note }}

@endif {{-- field type search --}} @elseif ($header->type == 'search')
@if ($header->note != '')

{{ '*) ' . $header->note }}

@endif {{-- field type image --}} @elseif ($header->type == 'image') @php $imageValue = $list ? $list->{$header->field} : null; $imagePaths = []; $isValidImgPath = function ($path) { $path = trim((string) $path); if ($path === '' || $path === '0' || ctype_digit($path)) return false; $hasSlash = str_contains($path, '/') || str_contains($path, '\\'); $hasExt = strlen(pathinfo($path, PATHINFO_EXTENSION)) > 0; return $hasSlash || $hasExt; }; $trimmedImgValue = trim((string) ($imageValue ?? '')); if (is_string($imageValue) && $trimmedImgValue !== '' && $trimmedImgValue !== '0' && $trimmedImgValue !== 'null' && $trimmedImgValue !== '[]') { $decodedImages = json_decode($imageValue, true); if (json_last_error() === JSON_ERROR_NONE && is_array($decodedImages)) { $imagePaths = array_values( array_filter($decodedImages, fn($path) => is_string($path) && $isValidImgPath($path)), ); } elseif (str_contains($imageValue, ',')) { $imagePaths = array_values( array_filter(array_map('trim', explode(',', $imageValue)), fn($path) => $isValidImgPath($path)), ); } elseif ($isValidImgPath($trimmedImgValue)) { $imagePaths = [$trimmedImgValue]; } } @endphp @if (!empty($imagePaths))
@foreach ($imagePaths as $imageIndex => $imagePath) @php $ext = strtolower(pathinfo($imagePath, PATHINFO_EXTENSION)); $isPdf = $ext === 'pdf'; $imageSrc = \Illuminate\Support\Str::startsWith($imagePath, ['http://', 'https://']) ? $imagePath : route('attachment.show', ['path' => ltrim($imagePath, '/')]); @endphp
@if ($isPdf) {{ basename($imagePath) }} @else {{ $header->alias }} {{ $imageIndex + 1 }} @endif
@endforeach

Klik gambar/file untuk membuka ukuran penuh

@else

Belum ada lampiran file / gambar yang terupload

@php $sessionUsername = strtolower(trim((string) (session('username') ?? ''))); $authUsername = auth()->user() ? strtolower(trim((string) (auth()->user()->username ?? ''))) : ''; $currentUsername = $sessionUsername ?: $authUsername; $createdBy = strtolower(trim((string) ($list->user_create ?? ''))); $isCreator = ($currentUsername !== '' && $createdBy !== '' && $currentUsername === $createdBy); @endphp @if (($header->field ?? '') == 'attachment' && $isCreator) @endif
@endif @if (empty($imagePaths)) @if (($header->field ?? '') == 'attachment')

Maksimal Size : 5120 KB (5 MB)

Format File : JPG, PNG, WEBP, HEIC, PDF (Maks. 5MB/file)

@else

Maksimal Size : {{ $header->length }} KB

@if ($header->note != '')

{{ $header->note }}

@else

Format Gambar : JPG, PNG, GIF

@endif @endif @endif {{-- field type password --}} @elseif ($header->type == 'password')
filter == '1' ? ' type=password' : ' type=hidden') }} value="{{ $list ? '' : $header->default }}" name="{{ $header->field }}" max="{{ $header->length }}">

Default Password : {{ $header->default }}

{{-- field type date --}} @elseif ($header->type == 'date') @if ($header->note != '')

{{ '*) ' . $header->note }}

@endif {{-- field type hidden --}} @elseif ($header->type == 'hidden') {{-- field type enum --}} @elseif ($header->type == 'enum') @if ($header->note != '')

{{ '*) ' . $header->note }}

@endif @endif @error($header->field)

{{ $message }}

@enderror
@endforeach @else
Notice: Tidak ada konfigurasi field untuk tampilan ini (sys_table kosong untuk menu ini). @if(isset($list) && $list)
Ringkasan data record:
{{ json_encode($list, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) }}
@endif
@endif {{-- ── Lampiran Catatan Revisi & Dokumentasi Pekerjaan ── --}} @if ($showPuDetailTracking) @php $showDocStatus = strtolower((string) ($list->request_status ?? $list->status ?? '')); $isCompletedForDocs = in_array($showDocStatus, ['completed', 'verifikasi'], true) || $showDocStatus !== 'draft'; $showDocs = isset($show_documentation) ? $show_documentation : collect([]); $isHrdOrAdminForDocs = ($isHrdDetailPage ?? false) || ($isCurrentViewerHrd ?? false) || ($isCurrentViewerAdmin ?? false); $showRevFiles = isset($revision_attachment_files) ? $revision_attachment_files : []; @endphp {{-- Lampiran Catatan Revisi --}}
@if (!empty($showRevFiles))
@foreach ($showRevFiles as $revFile) @php $revExt = strtolower(pathinfo($revFile, PATHINFO_EXTENSION)); $revIsPdf = $revExt === 'pdf'; $revUrl = route('attachment.show', ['path' => $revFile]); @endphp
@if ($revIsPdf) {{ basename($revFile) }} @else Lampiran Revisi @endif
@endforeach
@else
Belum ada lampiran catatan revisi.
@endif
{{-- Dokumentasi Hasil Pekerjaan Petugas --}} @if ($showDocStatus !== 'draft')
@if ($showDocs->count() > 0)
@foreach ($showDocs as $doc) @php $docPath = $doc->file ?? ''; $docExt = strtolower(pathinfo($docPath, PATHINFO_EXTENSION)); $docIsPdf = $docExt === 'pdf'; $docUrl = route('attachment.show', ['path' => $docPath]); $docDate = !empty($doc->created_at) ? \Carbon\Carbon::parse($doc->created_at)->format('d-m-Y H:i') : ''; $hasRevision = !empty($showRevFiles); if ($hasRevision && $showDocs->count() > 1 && $loop->last) { $docLabel = 'Dokumentasi Setelah Revisi'; } else { $docLabel = 'Dokumentasi Awal'; } @endphp
{{ $docLabel }} @if ($docIsPdf) {{ basename($docPath) }} @else {{ $docLabel }} @endif @if ($docDate) {{ $docDate }} @endif
@endforeach
@else
Belum ada dokumentasi pekerjaan.
@endif
@endif @endif

{{-- Modal Upload Lampiran Pengajuan (di luar form utama) --}} {{-- Modal Upload Dokumentasi dari halaman detail --}} @push('js') @endpush @if ($showPuDetailTracking) @php $formatTrackingDate = function ($value) { if (empty($value) || $value === '0000-00-00' || $value === '0000-00-00 00:00:00') { return '-'; } try { return \Illuminate\Support\Carbon::parse($value)->format('d-m-Y'); } catch (\Throwable $e) { return '-'; } }; $formatDetailDateRange = function ($start, $end) use ($formatTrackingDate) { $startDate = $formatTrackingDate($start); if ($startDate === '-') { return '-'; } $endDate = $formatTrackingDate($end); return $startDate . ' s/d ' . $endDate; }; $normalizedStatus = strtolower((string) ($list->request_status ?? $list->status ?? '')); if ($normalizedStatus === 'reject') { $normalizedStatus = 'rejected'; } elseif (in_array($normalizedStatus, ['canceled', 'cancelled'], true)) { $normalizedStatus = 'cancel'; } $headTrackingStatus = '-'; if (in_array($normalizedStatus, ['rejected'], true) && !empty($list->head_note)) { $headTrackingStatus = 'Ditolak'; } elseif (!empty($list->head_approval_date) || !in_array($normalizedStatus, ['draft', 'pending'], true)) { $headTrackingStatus = 'Selesai'; } elseif ($normalizedStatus === 'pending') { $headTrackingStatus = 'Menunggu'; } $hrdTrackingStatus = '-'; if (in_array($normalizedStatus, ['rejected', 'cancel'], true) && !empty($list->hrd_note)) { $hrdTrackingStatus = ucfirst($normalizedStatus); } elseif (!empty($list->hrd_approval_date) || in_array($normalizedStatus, ['pengadaan', 'pengerjaan', 'revisi', 'verifikasi', 'completed'], true)) { $hrdTrackingStatus = 'Selesai'; } elseif (in_array($normalizedStatus, ['review'], true)) { $hrdTrackingStatus = 'Menunggu'; } $trackingNoteRows = [ [ 'tahap' => 'Approval Head', 'status' => $headTrackingStatus, 'tanggal' => $formatTrackingDate($list->head_approval_date ?? null), 'catatan' => $list->head_note ?? '-', ], [ 'tahap' => 'Approval HRD', 'status' => $hrdTrackingStatus, 'tanggal' => $formatTrackingDate($list->hrd_approval_date ?? null), 'catatan' => $list->hrd_note ?? '-', ], ]; $datePending = $formatTrackingDate($list->created_at ?? null); $dateReview = $formatTrackingDate($list->head_approval_date ?? null); $datePengadaan = $formatTrackingDate($list->pengadaan_started_at ?? null); $datePengerjaan = $formatTrackingDate($list->pengerjaan_started_at ?? null); $dateComplete = $formatTrackingDate($list->completed_at ?? $list->updated_at ?? null); $estimatedPengadaan = $formatDetailDateRange($list->pengadaan_estimated_started_at ?? null, $list->pengadaan_estimated_ended_at ?? null); $estimatedPengerjaan = $formatDetailDateRange($list->pengerjaan_estimated_started_at ?? null, $list->pengerjaan_estimated_ended_at ?? null); $isRejected = in_array($normalizedStatus, ['rejected', 'cancel'], true); $isPengadaanDone = in_array($normalizedStatus, ['pengadaan', 'pengerjaan', 'revisi', 'verifikasi', 'completed'], true) || !empty($list->pengadaan_started_at); $isPengerjaanDone = in_array($normalizedStatus, ['pengerjaan', 'revisi', 'verifikasi', 'completed'], true) || !empty($list->pengerjaan_started_at); $isCompleteDone = in_array($normalizedStatus, ['verifikasi', 'completed'], true); $currentStep = 'pending'; if ($isRejected) { $currentStep = 'rejected'; } elseif ($normalizedStatus === 'review' || $normalizedStatus === 'approved') { $currentStep = 'review'; } elseif ($normalizedStatus === 'pengadaan') { $currentStep = 'pengadaan'; } elseif (in_array($normalizedStatus, ['pengerjaan', 'revisi'], true)) { $currentStep = 'pengerjaan'; } elseif (in_array($normalizedStatus, ['verifikasi', 'completed'], true)) { $currentStep = 'complete'; } @endphp

Tracking Status Pekerjaan


@foreach ($trackingNoteRows as $trackingRow) @endforeach
Tahap Status Tanggal Catatan
{{ $trackingRow['tahap'] }} {{ $trackingRow['status'] }} {{ $trackingRow['tanggal'] }} {{ $trackingRow['catatan'] ?: '-' }}

Estimasi HRD


Tahap Estimasi
Pengadaan {{ $estimatedPengadaan }}
Pengerjaan {{ $estimatedPengerjaan }}

@if ($isRejected)
Pending
{{ $datePending }}
{{ $normalizedStatus === 'cancel' ? 'Cancel' : 'Rejected' }}
{{ $formatTrackingDate($list->updated_at ?? null) }}
@else
Pending
{{ $datePending }}
Review
{{ $dateReview }}
Pengadaan
{{ $datePengadaan !== '-' ? $datePengadaan : ($currentStep == 'pengadaan' ? 'Proses...' : '-') }}
Pengerjaan
{{ $datePengerjaan !== '-' ? $datePengerjaan : ($currentStep == 'pengerjaan' ? 'Proses...' : '-') }}
Complete
{{ $currentStep == 'complete' ? $dateComplete : '-' }}
@endif
@endif
@if ($canHrdProcess) @endif @if ($canHrdUpdate) @endif {{-- check flag js on dmenu --}} @if ($jsmenu == '1') @if (view()->exists("js.{$dmenu}")) @push('addjs') {{-- file js in folder (resources/views/js) --}} @include('js.' . $dmenu); @endpush @else @push('addjs') @endpush @endif @endif @push('js') @endpush @endif @endsection