

<?php $__env->startSection('content'); ?> 
    <div class="d-flex justify-content-between align-items-center mb-4">
        <h3 class="fw-bold text-dark m-0 fs-4 fs-md-3">Detail Laporan</h3>
        <?php
            $backRoute = match (Auth::user()->role) {
                'atasan' => route('laporan.index'),
                'administrator' => route('laporan.index'),
                'anak_asuh' => route('hasilPenilaian.index'),
                default => route('dashboard'),
            };
        ?>

        <a href="<?php echo e($backRoute); ?>" class="btn btn-outline-secondary rounded-3 px-3 px-md-4 py-2 small fw-medium">
            <i class="bi bi-arrow-left me-1"></i> Kembali
        </a>
    </div>
 
    <div class="row g-4">
 
        <div class="col-lg-8">
            <div class="d-flex flex-column gap-4">
 
                <div class="card border-0 shadow-sm rounded-3">
                    <div class="card-header bg-transparent border-bottom py-3">
                        <h5 class="card-title mb-0 fw-bold text-dark">Data Umum</h5>
                    </div>
                    <div class="card-body p-3 p-md-4">
 
                        <div class="d-block d-md-none">
                            <div class="d-flex flex-column gap-3">
                                <div>
                                    <small class="text-secondary d-block mb-1">Tanggal</small>
                                    <div class="fw-semibold text-dark"><?php echo e($laporan->tanggal->format('d F Y')); ?></div>
                                </div>
                                <hr class="m-0 opacity-25">
                                <div>
                                    <small class="text-secondary d-block mb-1">Nama GL</small>
                                    <div class="fw-semibold text-dark"><?php echo e($laporan->nama_gl); ?></div>
                                </div>
                                <hr class="m-0 opacity-25">
                                <div>
                                    <small class="text-secondary d-block mb-1">Nama Manpower</small>
                                    <div class="fw-semibold text-dark"><?php echo e($laporan->nama_manpower); ?></div>
                                </div>
                                <hr class="m-0 opacity-25">
                                <div>
                                    <small class="text-secondary d-block mb-1">Jabatan</small>
                                    <div class="fw-semibold text-dark"><?php echo e($laporan->jabatan); ?></div>
                                </div>
                                <hr class="m-0 opacity-25">
                                <div>
                                    <small class="text-secondary d-block mb-1">Departemen</small>
                                    <div class="fw-semibold text-dark"><?php echo e($laporan->departemen); ?></div>
                                </div>
                            </div>
                        </div>
 
                        <div class="d-none d-md-block">
                            <div class="table-responsive">
                                <table class="table border-0 mb-0 align-middle">
                                    <tbody>
                                        <tr class="border-bottom">
                                            <th class="text-secondary fw-medium py-3 border-0" width="25%">Tanggal</th>
                                            <td class="text-dark fw-semibold py-3 border-0">:
                                                <?php echo e($laporan->tanggal->format('d F Y')); ?></td>
                                        </tr>
                                        <tr class="border-bottom">
                                            <th class="text-secondary fw-medium py-3 border-0">Nama GL</th>
                                            <td class="text-dark py-3 border-0">: <?php echo e($laporan->nama_gl); ?></td>
                                        </tr>
                                        <tr class="border-bottom">
                                            <th class="text-secondary fw-medium py-3 border-0">Nama Manpower</th>
                                            <td class="text-dark fw-semibold py-3 border-0">: <?php echo e($laporan->nama_manpower); ?>

                                            </td>
                                        </tr>
                                        <tr class="border-bottom">
                                            <th class="text-secondary fw-medium py-3 border-0">Jabatan</th>
                                            <td class="text-dark py-3 border-0">: <?php echo e($laporan->jabatan); ?></td>
                                        </tr>
                                        <tr class="border-bottom">
                                            <th class="text-secondary fw-medium py-3 border-0">Departemen</th>
                                            <td class="text-dark py-3 border-0">: <?php echo e($laporan->departemen); ?></td>
                                        </tr>
                                        <tr>
                                            <th class="text-secondary fw-medium py-3 border-0">ATR</th>
                                            <td class="text-dark py-3 border-0">:
                                                <?php echo e(number_format($laporan->manpower->atr[0]->nilai_atr ?? 0, 0)); ?>%</td>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>

                    </div>
                </div>
 
                <div class="card border-0 shadow-sm rounded-3">
                    <div class="card-header bg-transparent border-bottom py-3">
                        <h5 class="card-title mb-0 fw-bold text-dark">Hasil Penilaian</h5>
                    </div>
 
                    <div class="card-body p-3 d-block d-md-none">
                        <div class="d-flex flex-column gap-3">
                            <?php $__currentLoopData = $laporan->details; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $detail): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <div class="d-flex justify-content-between align-items-start py-1">
                                    <div class="pe-3">
                                        <div class="fw-semibold text-dark mb-1" style="font-size: 0.95rem;">
                                            <?php echo e($detail->kategori); ?>

                                        </div>
                                        <small class="text-secondary d-block" style="font-size: 0.85rem;">
                                            <?php echo e($detail->keterangan ?? 'Tidak ada keterangan'); ?>

                                        </small>
                                    </div>
                                    <div>
                                        <?php if($detail->status): ?>
                                            <span
                                                class="badge bg-success-subtle text-success border border-success-subtle px-2.5 py-1.5 fw-medium small">
                                                Tercapai
                                            </span>
                                        <?php else: ?>
                                            <span
                                                class="badge bg-danger-subtle text-danger border border-danger-subtle px-2.5 py-1.5 fw-medium small">
                                                Tidak
                                            </span>
                                        <?php endif; ?>
                                    </div>
                                </div>
                                <?php if(!$loop->last): ?>
                                    <hr class="m-0 opacity-25">
                                <?php endif; ?>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </div>
                    </div>
 
                    <div class="card-body p-0 d-none d-md-block">
                        <div class="table-responsive">
                            <table class="table table-hover mb-0 align-middle">
                                <thead class="table-light">
                                    <tr>
                                        <th class="ps-4 py-3 text-secondary fw-semibold border-0">Kategori</th>
                                        <th class="text-center text-secondary fw-semibold border-0" style="width: 140px;">
                                            Status</th>
                                        <th class="pe-4 text-secondary fw-semibold border-0">Keterangan</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <?php $__currentLoopData = $laporan->details; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $detail): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <tr class="border-bottom">
                                            <td class="ps-4 py-3 fw-medium text-dark border-0"><?php echo e($detail->kategori); ?></td>
                                            <td class="text-center py-3 border-0">
                                                <?php if($detail->status): ?>
                                                    <span
                                                        class="badge bg-success-subtle text-success border border-success-subtle px-3 py-1.5 fw-medium">
                                                        Tercapai
                                                    </span>
                                                <?php else: ?>
                                                    <span
                                                        class="badge bg-danger-subtle text-danger border border-danger-subtle px-3 py-1.5 fw-medium">
                                                        Tidak
                                                    </span>
                                                <?php endif; ?>
                                            </td>
                                            <td class="pe-4 py-3 text-secondary small border-0">
                                                <?php echo e($detail->keterangan ?? '-'); ?></td>
                                        </tr>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
 
                <div class="card border-0 shadow-sm rounded-3">
                    <div class="card-header bg-transparent border-bottom py-3">
                        <h5 class="card-title mb-0 fw-bold text-dark">Catatan & Feedback</h5>
                    </div>
                    <div class="card-body p-3 p-md-4"> 
                        <div class="mb-4">
                            <div class="text-dark fw-bold small mb-2 text-uppercase tracking-wide">Note</div>
                            <div class="p-3 bg-light rounded-3 text-secondary"
                                style="font-size: 0.925rem; line-height: 1.5;">
                                <?php echo e($laporan->note ?? 'Tidak ada catatan internal.'); ?>

                            </div>
                        </div>

                        <hr class="my-3 opacity-25">
 
                        <div>
                            <div class="text-dark fw-bold small mb-2 text-uppercase tracking-wide">Feedback</div>
                            <div class="p-3 bg-light rounded-3 text-secondary"
                                style="font-size: 0.925rem; line-height: 1.5;">
                                <?php echo e($laporan->feedback ?? 'Belum ada feedback yang ditulis.'); ?>

                            </div>
                        </div>
                    </div>
                </div>

            </div>
        </div>
 
        <div class="col-lg-4">
            <div class="d-flex flex-column gap-4"> 
                <div class="card border-0 shadow-sm rounded-3">
                    <div class="card-header bg-transparent border-bottom py-3">
                        <h5 class="card-title mb-0 fw-bold text-dark">Foto</h5>
                    </div>
                    <div class="card-body p-3">
                        <?php if($laporan->foto): ?>
                            <img src="/storage/<?php echo e($laporan->foto); ?>" class="img-fluid rounded-3 border mb-3"
                                style="width: 100%; height: auto; max-height: 260px; object-fit: cover; display: block;">
                            <a href="/storage/<?php echo e($laporan->foto); ?>" download
                                class="btn btn-primary w-100 rounded-3 py-2 small fw-medium">
                                Download Foto
                            </a>
                        <?php else: ?>
                            <div class="d-flex align-items-center justify-content-center border border-dashed rounded-3 bg-light"
                                style="height: 200px;">
                                <span class="text-secondary small">Tidak ada foto dokumentasi</span>
                            </div>
                        <?php endif; ?>
                    </div>
                </div>
 
                <?php if(Auth::user()->karyawan_id == $laporan->manpower->id): ?>
                    <div class="card border-0 shadow-sm rounded-3">
                        <div class="card-header bg-transparent border-bottom py-3">
                            <h5 class="card-title mb-0 fw-bold text-dark">Konfirmasi Manpower</h5>
                        </div>
                        <div class="card-body p-3 p-md-4">

                            <?php if($laporan->konfirmasi_status == 'pending'): ?> 
                                <form action="<?php echo e(route('laporan.konfirmasi', $laporan->id)); ?>" method="POST">
                                    <?php echo csrf_field(); ?>
                                    <?php echo method_field('PUT'); ?>

                                    <div class="mb-3">
                                        <label class="form-label text-secondary small fw-semibold">Status
                                            Konfirmasi</label>
                                        <select name="konfirmasi_status"
                                            class="form-select rounded-3 py-2 text-dark small" required>
                                            <option value="">-- Pilih Konfirmasi --</option>
                                            <option value="sesuai">Data Sudah Sesuai</option>
                                            <option value="tidak_sesuai">Data Tidak Sesuai</option>
                                        </select>
                                    </div>

                                    <div class="mb-3">
                                        <label class="form-label text-secondary small fw-semibold">Catatan Tambahan</label>
                                        <textarea name="catatan_konfirmasi" class="form-control rounded-3 small" rows="3"
                                            placeholder="Tambahkan catatan jika diperlukan..."></textarea>
                                    </div>

                                    <div class="p-3 bg-light rounded-3 text-secondary mb-3"
                                        style="font-size: 0.825rem; line-height: 1.4;">
                                        Saya menyatakan bahwa konfirmasi yang diberikan sesuai dengan kondisi sebenarnya.
                                    </div>

                                    <button type="submit" class="btn btn-primary w-100 rounded-3 py-2 fw-medium small">
                                        Kirim Konfirmasi
                                    </button>
                                </form>
                            <?php else: ?> 
                                <div class="mb-3">
                                    <span class="text-secondary small d-block mb-2">Status Konfirmasi</span>
                                    <?php if($laporan->konfirmasi_status == 'sesuai'): ?>
                                        <div
                                            class="p-2.5 bg-success-subtle text-success border border-success-subtle rounded-3 text-center fw-semibold small">
                                            Data Sudah Sesuai
                                        </div>
                                    <?php else: ?>
                                        <div
                                            class="p-2.5 bg-danger-subtle text-danger border border-danger-subtle rounded-3 text-center fw-semibold small">
                                            Data Tidak Sesuai
                                        </div>
                                    <?php endif; ?>
                                </div>

                                <div class="mb-3">
                                    <span class="text-secondary small d-block mb-1">Catatan dari Manpower</span>
                                    <div class="p-3 bg-light rounded-3 text-dark small" style="line-height: 1.45;">
                                        <?php echo e($laporan->catatan_konfirmasi ?? 'Tidak ada catatan.'); ?>

                                    </div>
                                </div>

                                <div
                                    class="p-2.5 bg-info-subtle text-info-emphasis border border-info-subtle rounded-3 text-center small mb-0">
                                    Konfirmasi telah dikirim oleh manpower.
                                </div>
                            <?php endif; ?>

                        </div>
                    </div>
                <?php else: ?>
                    <div class="card border-0 shadow-sm rounded-3">
                        <div class="card-header bg-transparent border-bottom py-3">
                            <h5 class="card-title mb-0 fw-bold text-dark">Konfirmasi Manpower</h5>
                        </div>
                        <div class="card-body p-3 p-md-4">
                            <div class="mb-3">
                                <span class="text-secondary small d-block mb-2">Status Konfirmasi</span>

                                <?php if($laporan->konfirmasi_status == 'sesuai'): ?>
                                    <div
                                        class="p-2.5 bg-success-subtle text-success border border-success-subtle rounded-3 text-center fw-semibold small mb-2">
                                        Data Sudah Sesuai
                                    </div>
                                    <div class="mb-3">
                                        <span class="text-secondary small d-block mb-1">Catatan dari Manpower</span>
                                        <div class="p-3 bg-light rounded-3 text-dark small" style="line-height: 1.45;">
                                            <?php echo e($laporan->catatan_konfirmasi ?? 'Tidak ada catatan.'); ?>

                                        </div>
                                    </div>
                                    <p class="text-secondary mb-0" style="font-size: 0.85rem; line-height: 1.4;">
                                        Karyawan menyatakan data penilaian sudah sesuai dan valid.
                                    </p>
                                <?php elseif($laporan->konfirmasi_status == 'tidak_sesuai'): ?>
                                    <div
                                        class="p-2.5 bg-danger-subtle text-danger border border-danger-subtle rounded-3 text-center fw-semibold small mb-2">
                                        Data Belum Sesuai
                                    </div>
                                    <div class="mb-3">
                                        <span class="text-secondary small d-block mb-1">Catatan dari Manpower</span>
                                        <div class="p-3 bg-light rounded-3 text-dark small" style="line-height: 1.45;">
                                            <?php echo e($laporan->catatan_konfirmasi ?? 'Tidak ada catatan.'); ?>

                                        </div>
                                    </div>
                                    <p class="text-secondary mb-0" style="font-size: 0.85rem; line-height: 1.4;">
                                        Karyawan menyatakan terdapat data yang belum sesuai.
                                    </p>
                                <?php else: ?>
                                    <div
                                        class="p-2.5 bg-warning-subtle text-warning-emphasis border border-warning-subtle rounded-3 text-center fw-semibold small mb-2">
                                        Menunggu Konfirmasi
                                    </div>
                                    <p class="text-secondary mb-0" style="font-size: 0.85rem; line-height: 1.4;">
                                        Karyawan belum memberikan konfirmasi data.
                                    </p>
                                <?php endif; ?>
                            </div>


                            <?php if($laporan->konfirmasi_status): ?>
                                <div class="p-3 bg-info-subtle text-info-emphasis rounded-3"
                                    style="font-size: 0.85rem; line-height: 1.45;">
                                    Saya menyatakan bahwa data laporan ini telah sesuai dan saya berkomitmen untuk
                                    menjalankan
                                    improvement yang diperlukan.
                                </div>
                            <?php endif; ?>
                        </div>
                    </div>
                <?php endif; ?>

            </div>
        </div>

    </div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts/app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\laragon\www\monitoring\resources\views/menu/laporan/show.blade.php ENDPATH**/ ?>