<script type="text/javascript">
    $(document).ready(function() {
        $('#form_input #id_atasan').select2({
            placeholder: 'Pilih Approver',
            allowClear: true,
            ajax: {
                // type: 'POST',
                url: '<?= route("dropdown.karyawan.aktif.skor") ?>',
                dataType: 'json',
                delay: 250,
                processResults: function(data) {
                    return {
                        results: data
                    };
                },
                cache: true
            },
            minLength: 3,
        });
    });
</script>

<div class="card-header">
    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
    <h3 class="title modal-title"></h3>
</div>
<div id="form_input" class="card-body" disabled>
    <!-- <input type="hidden" id="id_karyawan" class="form-control" value="<?= ((isset($data)) ? md5($data->id_karyawan) : '') ?>"> -->
    <input type="hidden" id="id_karyawan" class="form-control" value="<?= ((isset($data)) ? $data->id_karyawan : '') ?>">
    <input type="hidden" id="action" class="form-control" value="<?= ((isset($data)) ? $data->action : '') ?>">

    <div class="form-group">
        <h5>Karyawan</h5>
        <label><?= $data->nama_lengkap ?></label>
    </div>
    <div class="form-group">
        <h5>Departemen</h5>
        <label><?= $data->nama_departemen ?></label>
    </div>
    <div class="form-group">
        <h5>Jabatan</h5>
        <label><?= $data->nama_jabatan ?></label>
    </div>

    <div class="form-group">
        <label>Approver <i class="text-danger">*</i></label>
        <select id="id_atasan" class="form-control select2" style="width:100%">
            <option value="0">Pilih Approver</option>
                <?php
                    if (isset($data)) {
                        echo '<option value="' . $data->id_atasan . '" selected>' . $data->nik_atasan . ' - ' . $data->nama_atasan . '</option>';
                    }
                ?>
        </select>
    </div>
</div>
<div class="card-footer">
    <div class="row">
        <div class="col-md-6 text-left">
            <div id="message"></div>
        </div>
        <div class="col-md-6 text-right">
            <button id="btn_new_input" class="btn" style="display:none" onclick="new_input(this)">TAMBAH BARU</button>
            <button class="btn_update ladda-button" data-style="expand-left"></button>
        </div>
    </div>
</div>
