@extends('layouts.app', ['class' => 'g-sidenav-show bg-gray-100']) {{-- section content --}} @section('content') @include('layouts.navbars.auth.topnav', ['title' => '']) {{-- --}}

DETAIL PERMIT

Tanggal Pengajuan: {{ optional($list->tgl_mengajukan ? \Carbon\Carbon::parse($list->tgl_mengajukan) : null)->format('d-m-Y') ?? '-' }}

{{-- === STATUS APPROVAL (PENGAJUAN) === --}} @php if (!function_exists('splitNotes')) { function splitNotes($raw) { $arr = array_filter(array_map('trim', explode(';', (string) $raw))); return array_values($arr); } } if (!function_exists('fmtDT')) { function fmtDT($v) { return $v ? \Carbon\Carbon::parse($v)->format('d-m-Y H:i') : null; } } $statusMap = [ 'T' => ['label' => 'Tolak', 'class' => 'bg-danger'], 'TR' => ['label' => 'Terima', 'class' => 'bg-success'], 'P' => ['label' => 'Pending', 'class' => 'bg-primary'], ]; $cardsPengajuan = [ [ 'icon' => 'fas fa-user-cog', 'title' => 'PIC Kerja', 'status' => $list->approval_pic_kerja ?? 'P', 'notes' => splitNotes($list->catatan_picker ?? ''), 'appr' => fmtDT($list->approve_picker ?? null), 'rej' => fmtDT($list->reject_picker ?? null), ], [ 'icon' => 'fas fa-map-marker-alt', 'title' => 'PIC Area', 'status' => $list->approval_pic_area ?? 'P', 'notes' => splitNotes($list->catatan_picare ?? ''), 'appr' => fmtDT($list->approve_picare ?? null), 'rej' => fmtDT($list->reject_picare ?? null), ], [ 'icon' => 'fas fa-shield-alt', 'title' => 'K3', 'status' => $list->approval_k3 ?? 'P', 'notes' => splitNotes($list->catatan_k3 ?? ''), 'appr' => fmtDT($list->approve_k3 ?? null), 'rej' => fmtDT($list->reject_k3 ?? null), ], ]; @endphp
Status Approval (Pengajuan Baru)
@foreach ($cardsPengajuan as $c) @php $sm = $statusMap[$c['status']] ?? ['label'=>'—','class'=>'bg-secondary']; @endphp
@php // Cek apakah ini card K3 dan ada revisi langsung dari K3 $isK3Card = $c['title'] === 'K3'; $showK3Highlight = $isK3Card && ($hasK3Revision ?? false); @endphp
{{ $c['title'] }} @if($showK3Highlight) Revisi JSA Langsung dari K3 @endif
@if($showK3Highlight)
JSA telah direvisi langsung oleh K3
@endif

Status: {{ $sm['label'] }}

@if ($c['status'] === 'TR' && $c['appr'])

Tgl Approve: {{ $c['appr'] }}

@endif @if ($c['rej'])

Tgl Reject: {{ $c['rej'] }}

@endif @if (!empty($c['notes']))

Catatan Revisi:

    @foreach ($c['notes'] as $note)
  • {{ $note }} @if ($loop->last) Revisi Terakhir @endif
  • @endforeach
@endif
@endforeach
@if (!empty($list))
Status Approval (Permohonan Selesai)
@php $statusMap = [ 'T' => ['label' => 'Tolak', 'class' => 'bg-danger'], 'TR' => ['label' => 'Terima', 'class' => 'bg-success'], 'P' => ['label' => 'Pending', 'class' => 'bg-primary'], ]; @endphp {{-- === PIC Kerja === --}} @php $statusPicker = $statusMap[$list->picker_setuju_selesai ?? 'P'] ?? [ 'label' => '-', 'class' => 'bg-secondary', ]; $notesPicker = array_filter( array_map( 'trim', explode(';', $list->note_selesai_reject_picker ?? ''), ), ); @endphp
PIC Kerja

Status: {{ $statusPicker['label'] }}

@if (!empty($notesPicker))

Catatan Revisi:

    @foreach ($notesPicker as $i => $note)
  • {{ $note }} @if ($loop->last) Revisi Terakhir @endif
  • @endforeach
@endif
{{-- === PIC Area === --}} @php $statusPicare = $statusMap[$list->picare_setuju_selesai ?? 'P'] ?? [ 'label' => '-', 'class' => 'bg-secondary', ]; $notesPicare = array_filter( array_map( 'trim', explode(';', $list->note_selesai_reject_picare ?? ''), ), ); @endphp
PIC Area

Status: {{ $statusPicare['label'] }}

@if (!empty($notesPicare))

Catatan:

    @foreach ($notesPicare as $i => $note)
  • {{ $note }} @if ($loop->last) Revisi Terakhir @endif
  • @endforeach
@endif
{{-- === K3 === --}} @php $statusK3 = $statusMap[$list->k3_setuju_selesai ?? 'P'] ?? [ 'label' => '-', 'class' => 'bg-secondary', ]; $notesK3 = array_filter( array_map('trim', explode(';', $list->note_selesai_reject_k3 ?? '')), ); @endphp
K3

Status: {{ $statusK3['label'] }}

@if (!empty($notesK3))

Catatan:

    @foreach ($notesK3 as $i => $note)
  • {{ $note }} @if ($loop->last) Revisi Terakhir @endif
  • @endforeach
@endif
@endif

1. Data Administrasi

Ket: E = Entri, P = Pending, B = Berlaku, S = Selesai
@if ($list->iddepart === 'DP008') @elseif($list->idvendor === 'VND0001') @endif
@if ($role_label === 'veneks')
@php $roleArray = is_string($user_login->idroles ?? '') ? array_map('trim', explode(',', strtolower($user_login->idroles))) : []; $isAdminOrK3 = count(array_intersect($roleArray, ['admins', 'admmis', 'admnk3'])) > 0; $isPoEmpty = empty(trim((string)$list->no_po)); $hasStatusPO = strtolower((string) $list->no_po) != 'menyusul'; $canEditPO = $isAdminOrK3 && $isPoEmpty && $hasStatusPO && $list->status === 'B'; @endphp
@if($canEditPO)
@else @endif
@else
@endif

2. Surat Izin Kerja K3




@foreach ($kategori as $item)
id, $existingKategoriIds) ? 'checked' : '' }} disabled>
@endforeach
@foreach ($alat as $item)
id, $existingApdIds) ? 'checked' : '' }} disabled>
@endforeach

{{-- Script untuk Modal --}}

3. Job Safety Analysis

@if (!empty($hasK3EditedJsa) && $hasK3EditedJsa)

Informasi: Baris dengan K3 dan highlight hijau menandakan JSA yang telah diedit/ditambahkan oleh tim K3.

@endif
@foreach ($analisis as $index =>$item) @php $isK3Edited = isset($item->sts_k3) && $item->sts_k3 === '1'; @endphp @endforeach
No Urutan Langkah Tugas Potensi Bahaya Akibat/Kerugian Rekomendasi Pencegahan
{{ $index + 1 }} @if($isK3Edited)
K3 @endif
@if($showK3Highlight) Highlight hijau JSA : Update dari K3. @endif

4. Keterangan Pemakaian Workshop Kontraktor

@if(isset($is_edit_workshop) && $is_edit_workshop)
@csrf
@if(isset($mst_workshops) && $mst_workshops->count() > 0) @foreach ($mst_workshops->sortBy(function($ws) { return strtolower((string) $ws->id) === 'wrk0001' ? 1 : 0; }) as $ws)
workshop_kontraktor_opsi ?? '') == strtolower($ws->id) ? 'checked' : '' }} onchange="toggleWsOther()">
@endforeach @endif
@if (!empty($list->tgl_awal_workshop))
@endif @if (!empty($list->tgl_selesai_workshop))
@endif
@if (!empty($list->tgl_selesai_workshop)) Workshop sudah diselesaikan pada {{ \Carbon\Carbon::parse($list->tgl_selesai_workshop)->format('d-m-Y H:i') }}. @endif
@else

@if (($list->workshop_kontraktor ?? null) === 'Ya') Ya @elseif (($list->workshop_kontraktor ?? null) === 'Tidak') Tidak @else — @endif

@if (($list->workshop_kontraktor ?? null) === 'Ya')

@php $opsiDisplay = $list->workshop_kontraktor_opsi ?? '—'; if ($opsiDisplay !== 'Other' && $opsiDisplay !== '—' && isset($mst_workshops)) { $matchedWs = $mst_workshops->firstWhere('id', $opsiDisplay); if ($matchedWs) { $opsiDisplay = $matchedWs->nama; } } @endphp {{ $opsiDisplay }}

@if (strtolower($list->workshop_kontraktor_opsi ?? null) === 'wrk0001')

{{ $list->workshop_kontraktor_other ?? '—' }}

@endif
{{ !empty($list->tgl_awal_workshop) ? \Carbon\Carbon::parse($list->tgl_awal_workshop)->format('d-m-Y H:i') : '—' }}
{{ !empty($list->tgl_selesai_workshop) ? \Carbon\Carbon::parse($list->tgl_selesai_workshop)->format('d-m-Y H:i') : '—' }}
@endif @endif

5. Bukti Pendukung


Foto APD

Foto Alat Kerja



6. Persetujuan

{{-- 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 @endsection @push('js') @endpush