<?= $this->extend('layout/admin') ?>
<?= $this->section('content') ?>

<style>
.profile-card{
    border-radius:12px;
}
.profile-photo{
    width:160px;
    height:160px;
    border-radius:12px;
    border:4px solid #e3e3e3;
    object-fit:cover;
}
.info-title{
    font-weight:700;
}
.table-profile th{
    width:180px;
    background:#f4f6ff;
}
.badge-status{
    font-size:14px;
    padding:8px 14px;
}
</style>

<div class="card shadow profile-card">

    <div class="card-header bg-primary text-white d-flex justify-content-between">
        <b><i class="fas fa-user me-1"></i> Detail Karyawan</b>

        <div>
            <a href="<?= site_url('master/employees') ?>" class="btn btn-light btn-sm">
                <i class="fas fa-arrow-left me-1"></i> Kembali
            </a>
        </div>
    </div>

    <div class="card-body">

        <div class="row">

            <!-- LEFT -->
            <div class="col-md-8">

                <div class="alert alert-primary py-2 px-3 mb-3">
                    <b><i class="fas fa-id-card me-1"></i> Identitas Karyawan</b>
                </div>

                <table class="table table-bordered table-profile">
                    <tr>
                        <th>NIK</th>
                        <td><?= $item['employee_no'] ?></td>
                    </tr>

                    <tr>
                        <th>Nama</th>
                        <td>
                            <span class="fw-bold"><?= $item['employee_name'] ?></span>
                        </td>
                    </tr>

                    <tr>
                        <th>Jabatan</th>
                        <td><?= $item['position'] ?></td>
                    </tr>

                    <tr>
                        <th>Departemen</th>
                        <td><?= $item['department'] ?></td>
                    </tr>

                    <tr>
                        <th>Perusahaan</th>
                        <td><?= $item['company'] ?: '-' ?></td>
                    </tr>

                    <tr>
                        <th>Status</th>
                        <td>
                            <?php if($item['status']==1): ?>
                                <span class="badge bg-success badge-status">
                                    <i class="fas fa-check-circle me-1"></i> Aktif
                                </span>
                            <?php else: ?>
                                <span class="badge bg-danger badge-status">
                                    <i class="fas fa-times-circle me-1"></i> Nonaktif
                                </span>
                            <?php endif ?>
                        </td>
                    </tr>
                </table>

            </div>

            <!-- RIGHT -->
            <div class="col-md-4 text-center">

                <div class="alert alert-info py-2 px-3 mb-3">
                    <b><i class="fas fa-image me-1"></i> Foto Karyawan</b>
                </div>

                <img class="profile-photo mb-2"
                     src="<?= !empty($item['photo'])
                        ? base_url('uploads/employees/'.$item['photo'])
                        : 'https://ui-avatars.com/api/?name='.urlencode($item['employee_name']).'&background=0D6EFD&color=fff&size=200' ?>">

                <div class="text-muted">
                    Foto digunakan untuk identitas sistem & laporan.
                </div>

            </div>

        </div>

    </div>
</div>

<?= $this->endSection() ?>
