<?php $__env->startSection('content'); ?>
    <div class="pageHeaderRow">
        <h2>Edit Karyawan</h2>
        <a class="btnOutline" href="<?php echo e(route('admin.karyawan.index')); ?>">
            Kembali
        </a>
    </div>

    <?php if($errors->any()): ?>
        <div class="errorList">
            <div style="font-weight:1000;margin-bottom:6px;">Periksa input berikut:</div>
            <ul style="padding-left:18px;margin:0;">
                <?php $__currentLoopData = $errors->all(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $error): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <li><?php echo e($error); ?></li>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </ul>
        </div>
    <?php endif; ?>

    <div class="formCard">
        <form method="POST" action="<?php echo e(route('admin.karyawan.update', $karyawan->id)); ?>" enctype="multipart/form-data">
            <?php echo csrf_field(); ?>
            <?php echo method_field('PUT'); ?>

            <div class="formRow">
                <div class="fieldLabel">Nama Lengkap</div>
                <input class="input" type="text" name="nama_lengkap" value="<?php echo e(old('nama_lengkap', $karyawan->nama_lengkap)); ?>" required />
            </div>

            <div class="formRow">
                <div class="fieldLabel">NIK</div>
                <input class="input" type="text" name="nik" value="<?php echo e(old('nik', $karyawan->nik)); ?>" required />
            </div>

            <div class="formRow">
                <div class="fieldLabel">Role</div>
                <select class="input" name="role">
                    <option value="">-- Pilih Role --</option>
                    <option value="admin" <?php echo e(old('role', $karyawan->role) == 'admin' ? 'selected' : ''); ?>>Admin</option>
                    <option value="tutor" <?php echo e(old('role', $karyawan->role) == 'tutor' ? 'selected' : ''); ?>>Tutor</option>
                    <option value="kepala_sekolah" <?php echo e(old('role', $karyawan->role) == 'kepala_sekolah' ? 'selected' : ''); ?>>Kepala Sekolah</option>
                </select>
            </div>

            <div class="formRow">
                <div class="fieldLabel">No HP</div>
                <input class="input" type="text" name="no_hp" value="<?php echo e(old('no_hp', $karyawan->no_hp)); ?>" required />
            </div>

            <div class="formRow">
                <div class="fieldLabel">Foto</div>
                <?php if($karyawan->foto): ?>
                    <?php
                        $fotoEditUrl = str_starts_with($karyawan->foto, 'uploads/')
                            ? asset($karyawan->foto)
                            : asset('storage/' . $karyawan->foto);
                    ?>
                    <img src="<?php echo e($fotoEditUrl); ?>" alt="Foto <?php echo e($karyawan->nama_lengkap); ?>"
                        style="width:80px;height:80px;object-fit:cover;border-radius:8px;margin-bottom:8px;display:block;" />
                <?php endif; ?>
                <input class="input" type="file" name="foto" />
                <small style="color: var(--muted);">Kosongkan jika tidak ingin mengubah foto.</small>
            </div>

            <div class="formRow">
                <div class="fieldLabel">Password Baru</div>
                <input class="input" type="password" name="password" />
                <small style="color: var(--muted);">Kosongkan jika tidak ingin mengubah password.</small>
            </div>

            <div class="formRow">
                <div class="fieldLabel">Konfirmasi Password Baru</div>
                <input class="input" type="password" name="password_confirmation" />
            </div>

            <button type="submit" class="btnPrimary" style="width:100%;justify-content:center;">
                <ion-icon name="save-outline"></ion-icon>
                Simpan Perubahan
            </button>
        </form>
    </div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layout.admin', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\xampp1\htdocs\presensi-tutor\resources\views/admin/karyawan/edit.blade.php ENDPATH**/ ?>