@extends('layouts.app')

@section('content') 
    <div class="d-flex flex-column flex-md-row justify-content-between align-items-md-center mb-4 gap-2">
        <div>
            <h2 class="fw-bold mb-1 text-dark">Detail Karyawan</h2>
            <p class="text-muted mb-0">
                Informasi lengkap data karyawan perusahaan
            </p>
        </div>

        <a href="{{ route('karyawan.index') }}" class="btn btn-outline-secondary rounded-3 px-4">
            <i class="bi bi-arrow-left me-1"></i> Kembali
        </a>
    </div>
 
    <div class="card border-0 shadow-sm rounded-4 overflow-hidden">
 
        <div style="height: 5px; background: linear-gradient(90deg, #c58b00, #f0b90b);"></div>

        <div class="card-body p-4 p-md-5">

            <div class="row align-items-center">
 
                <div class="col-lg-4 text-center mb-4 mb-lg-0">

                    @if ($karyawan->foto)
                        <img src="{{ asset('storage/' . $karyawan->foto) }}" alt="Foto Karyawan"
                            class="img-fluid rounded-4 shadow-sm border"
                            style="width: 260px; height: 320px; object-fit: cover;">
                    @else
                        <div class="border rounded-4 bg-light d-flex align-items-center justify-content-center mx-auto shadow-sm"
                            style="width: 260px; height: 320px;">
                            <div class="text-center text-muted">
                                <i class="bi bi-person fs-1 d-block mb-2"></i>
                                Tidak Ada Foto
                            </div>
                        </div>
                    @endif

                </div>
 
                <div class="col-lg-8">
 
                    <div class="mb-4 border-bottom pb-3">
                        <h3 class="fw-bold text-dark mb-1">
                            {{ $karyawan->nama }}
                        </h3>

                        <div class="d-flex flex-wrap gap-2">
                            <span class="badge bg-warning text-dark px-3 py-2 rounded-pill">

                                NRP: {{ $karyawan->nrp }}
                            </span>
                        </div>
                    </div>
 
                    <div class="row g-4">

                        <div class="col-md-6">
                            <div class="border rounded-4 p-3 h-100 bg-light-subtle">
                                <small class="text-muted d-block mb-1">
                                    Jabatan
                                </small>

                                <div class="fw-semibold text-dark">
                                    {{ $karyawan->jabatan?->jabatan }}
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="border rounded-4 p-3 h-100 bg-light-subtle">
                                <small class="text-muted d-block mb-1">
                                    Departemen
                                </small>

                                <div class="fw-semibold text-dark">
                                    {{ $karyawan->departemen?->departemen }}
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="border rounded-4 p-3 h-100 bg-light-subtle">
                                <small class="text-muted d-block mb-1">
                                    No HP
                                </small>

                                <div class="fw-semibold text-dark">
                                    {{ $karyawan->no_hp }}
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="border rounded-4 p-3 h-100 bg-light-subtle">
                                <small class="text-muted d-block mb-1">
                                    Atasan
                                </small>

                                <div class="fw-semibold text-dark">
                                    {{ $karyawan->atasan->nama ?? '-' }}
                                </div>
                            </div>
                        </div>

                    </div>


                </div>

            </div>

        </div>
    </div>
@endsection
