<style>
    .form-section-left {
        border-right: 1px solid #ddd;
        padding: 0px 20px;
    }

    .form-section-right {
        max-height: 400px;
        overflow-y: auto;
        padding: 0px 20px;
    }
</style>
<script src="<?= base_url('assets/js') ?>/autoNumeric.js"></script>
<script>
    $('#ttl_tunj_bpjs_tk').html('<?= ($data_bpjs_tk_m->tunj_jht_perus_rp ?: 0) + ($data_bpjs_tk_m->tunj_jkk_rp ?: 0) + ($data_bpjs_tk_m->tunj_jkm_rp ?: 0) + ($data_bpjs_tk_m->tunj_jp_perus_rp ?: 0) ?>');
    $('#ttl_pot_bpjs_tk').html('<?= ($data_bpjs_tk_m->pot_jht_kry_rp ?: 0) + ($data_bpjs_tk_m->pot_jp_kry_rp ?: 0) ?>');
</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 class="card-body">
    <form id="form_input">
        <input type="hidden" id="bpjs_kes_tunj_perus" name="bpjs_kes_tunj_perus" value="<?= $data_bpjs_kes->tunj_perus ?>">
        <input type="hidden" id="bpjs_kes_pot_kry" name="bpjs_kes_pot_kry" value="<?= $data_bpjs_kes->pot_kry ?>">
        <input type="hidden" id="bpjs_kes_flag" name="bpjs_kes_flag" value="<?= $data_bpjs_kes->flag ?>">
        <input type="hidden" id="bpjs_tk_tunj_jht_perus" name="bpjs_tk_tunj_jht_perus" value="<?= $data_bpjs_tk->tunj_jht_perus ?>">
        <input type="hidden" id="bpjs_tk_pot_jht_kry" name="bpjs_tk_pot_jht_kry" value="<?= $data_bpjs_tk->pot_jht_kry ?>">
        <input type="hidden" id="bpjs_tk_flag_jht" name="bpjs_tk_flag_jht" value="<?= $data_bpjs_tk->flag_jht ?>">
        <input type="hidden" id="bpjs_tk_tunj_jkk" name="bpjs_tk_tunj_jkk" value="<?= $data_bpjs_tk->tunj_jkk ?>">
        <input type="hidden" id="bpjs_tk_flag_jkk" name="bpjs_tk_flag_jkk" value="<?= $data_bpjs_tk->flag_jkk ?>">
        <input type="hidden" id="bpjs_tk_tunj_jkm" name="bpjs_tk_tunj_jkm" value="<?= $data_bpjs_tk->tunj_jkm ?>">
        <input type="hidden" id="bpjs_tk_flag_jkm" name="bpjs_tk_flag_jkm" value="<?= $data_bpjs_tk->flag_jkm ?>">
        <input type="hidden" id="bpjs_tk_tunj_jp_perus" name="bpjs_tk_tunj_jp_perus" value="<?= $data_bpjs_tk->tunj_jp_perus ?>">
        <input type="hidden" id="bpjs_tk_pot_jp_kry" name="bpjs_tk_pot_jp_kry" value="<?= $data_bpjs_tk->pot_jp_kry ?>">
        <input type="hidden" id="bpjs_tk_flag_jp" name="bpjs_tk_flag_jp" value="<?= $data_bpjs_tk->flag_jp ?>">

        <!-- gapok -->
        <input class="d-none nominal_normal" id="gapok" name="gapok" value="<?= isset($data_gapok) ? $data_gapok : 0 ?>">
        <input class="d-none nominal_normal" id="tunj_daftar" name="tunj_daftar" value="<?= isset($data_tunj_tetap) ? $data_tunj_tetap : 0 ?>">
        <!-- bpjs kesehatan -->
        <input class="d-none nominal" id="bpjs_kes_tunj_perus_rp" name="bpjs_kes_tunj_perus_rp" value="<?= isset($data_bpjs_kes_m) ? $data_bpjs_kes_m->tunj_perus_rp : 0 ?>" <?= $data_bpjs_kes->flag == '0' ? 'disabled' : '' ?>>
        <input class="d-none nominal" id="bpjs_kes_pot_kry_rp" name="bpjs_kes_pot_kry_rp" value="<?= isset($data_bpjs_kes_m) ? $data_bpjs_kes_m->pot_kry_rp : 0 ?>" <?= $data_bpjs_kes->flag == '0' ? 'disabled' : '' ?>>
        <!-- bpjs ketenagakerjaan -->
        <input class="d-none nominal" id="bpjs_tk_tunj_jht_perus_rp" name="bpjs_tk_tunj_jht_perus_rp" value="<?= isset($data_bpjs_tk_m) ? $data_bpjs_tk_m->tunj_jht_perus_rp : 0 ?>" <?= $data_bpjs_tk->flag_jht == '0' ? 'disabled' : '' ?>>
        <input class="d-none nominal" id="bpjs_tk_pot_jht_kry_rp" name="bpjs_tk_pot_jht_kry_rp" value="<?= isset($data_bpjs_tk_m) ? $data_bpjs_tk_m->pot_jht_kry_rp : 0 ?>" <?= $data_bpjs_tk->flag_jht == '0' ? 'disabled' : '' ?>>
        <input class="d-none nominal" id="bpjs_tk_tunj_jkk_rp" name="bpjs_tk_tunj_jkk_rp" value="<?= isset($data_bpjs_tk_m) ? $data_bpjs_tk_m->tunj_jkk_rp : 0 ?>" <?= $data_bpjs_tk->flag_jkk == '0' ? 'disabled' : '' ?>>
        <input class="d-none nominal" id="bpjs_tk_tunj_jkm_rp" name="bpjs_tk_tunj_jkm_rp" value="<?= isset($data_bpjs_tk_m) ? $data_bpjs_tk_m->tunj_jkm_rp : 0 ?>" <?= $data_bpjs_tk->flag_jkm == '0' ? 'disabled' : '' ?>>
        <input class="d-none nominal" id="bpjs_tk_tunj_jp_perus_rp" name="bpjs_tk_tunj_jp_perus_rp" value="<?= isset($data_bpjs_tk_m) ? $data_bpjs_tk_m->tunj_jp_perus_rp : 0 ?>" <?= $data_bpjs_tk->flag_jp == '0' ? 'disabled' : '' ?>>
        <input class="d-none nominal" id="bpjs_tk_pot_jp_kry_rp" name="bpjs_tk_pot_jp_kry_rp" value="<?= isset($data_bpjs_tk_m) ? $data_bpjs_tk_m->pot_jp_kry_rp : 0 ?>" <?= $data_bpjs_tk->flag_jp == '0' ? 'disabled' : '' ?>>
        <!-- total -->
        <input class="d-none nominal" id="ttl_pot_kry" name="ttl_pot_kry" value="<?= isset($data_bpjs_tk_m) ? $data_bpjs_tk_m->ttl_pot_karyawan : 0 ?>">
        <input class="d-none nominal" id="ttl_tunj_dibiayai_perus" name="ttl_tunj_dibiayai_perus" value="<?= isset($data_bpjs_tk_m) ? $data_bpjs_tk_m->ttl_tunj_dibiayai_perus : 0 ?>">

        <div class="row">
            <div class="col-md-6 form-section-left">
                <div class="align-items-center">
                    <h5 class="content-header-title pb-1">Gaji Karyawan</h5>
                    <?= $form_nama_karyawan ?>
                    <div class="form-group">
                        <div class="row">
                            <div class="col-md-6">
                                <label>Gaji Pokok</label>
                                <p class="nominal_normal_rp font-weight-bold mb-0" id="gapok_text"><?= isset($data_gapok) ? $data_gapok : 0 ?></p>
                            </div>
                            <div class="col-md-6">
                                <label>Tunj. yang didaftarkan</label>
                                <p class="nominal_normal_rp font-weight-bold mb-0" id="tunj_daftar_text"><?= isset($data_tunj_tetap) ? $data_tunj_tetap : 0 ?></p>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="gaji_daftar">Gaji yang didaftarkan<i class="text-danger">*</i></label>
                        <div class="input-group">
                            <div class="input-group-prepend">
                                <span class="input-group-text font-weight-bold">Rp</span>
                            </div>
                            <input type="text" class="form-control nominal_normal" id="gaji_daftar" name="gaji_daftar" value="<?= isset($data_bpjs_tk_m) ? $data_bpjs_tk_m->ttl_gaji_terdaftar : 0 ?>">
                        </div>
                    </div>
                </div>
                <div class="align-items-center pt-2">
                    <h5 class="content-header-title pb-1">Total</h5>
                    <div class="form-group">
                        <div class="row">
                            <div class="col-sm-6">
                                <label for="ttl_tunj_dibiayai_perus_text">Total Tunj. Dibiayai Perusahaan</label>
                                <p id="ttl_tunj_dibiayai_perus_text" class="nominal_text font-weight-bold"><?= isset($data_bpjs_tk_m) ? $data_bpjs_tk_m->ttl_tunj_dibiayai_perus : 0 ?></p>
                            </div>
                            <div class="col-sm-6">
                                <label for="ttl_pot_kry_text">Total Potongan Karyawan</label>
                                <p id="ttl_pot_kry_text" class="nominal_text font-weight-bold"><?= isset($data_bpjs_tk_m) ? $data_bpjs_tk_m->ttl_pot_karyawan : 0 ?></p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-md-6 form-section-right">
                <div class="align-items-center">
                    <h5 class="content-header-title pb-1">BPJS Kesehatan <?= ($data_bpjs_kes->flag == '0') ? '<span class="badge badge-light">Nonaktif</span>' : '<span class="badge badge-success">Aktif</span>' ?></h5>
                    <?php if ($data_bpjs_kes->flag != '0') : ?>
                        <div class="form-group">
                            <label for="no_bpjs_kes">Nomor BPJS Kesehatan</label>
                            <p class="font-weight-bold" id="no_bpjs_kes">-</p>
                        </div>
                        <div class="form-group">
                            <label for="jml_anak">Jumlah Anak</label>
                            <input type="number" class="form-control font-weight-bold" id="jml_anak" name="jml_anak" min="0" value="<?= isset($data_bpjs_kes_m) ? $data_bpjs_kes_m->jml_anak : 0 ?>" <?= $data_bpjs_kes->flag == '0' ? 'disabled' : '' ?>>
                        </div>
                        <div class="form-group">
                            <div class="row">
                                <div class="col-md-6">
                                    <label>Tunj. Perusahaan (<?= $data_bpjs_kes->tunj_perus ?> %)</label>
                                    <p id="bpjs_kes_tunj_perus_rp_text" class="nominal_text font-weight-bold"><?= isset($data_bpjs_kes_m) ? $data_bpjs_kes_m->tunj_perus_rp : 0 ?></p>
                                </div>
                                <div class="col-md-6">
                                    <label>Pot. Karyawan (<?= $data_bpjs_kes->pot_kry ?> %)</label>
                                    <p id="bpjs_kes_pot_kry_rp_text" class="nominal_text font-weight-bold"><?= isset($data_bpjs_kes_m) ? $data_bpjs_kes_m->pot_kry_rp : 0 ?></p>
                                </div>
                            </div>
                        </div>
                    <?php endif; ?>
                </div>
                <div class="align-items-center pt-2">
                    <h3 class="content-header-title">BPJS ketenagakerjaan <?= ($data_bpjs_tk->flag_jht == '0' and $data_bpjs_tk->flag_jkk == '0' and $data_bpjs_tk->flag_jkm == '0' and $data_bpjs_tk->flag_jp == '0') ? '<span class="badge badge-light">Nonaktif</span>' : '<span class="badge badge-success">Aktif</span>' ?></h3>
                    <?php if ($data_bpjs_tk->flag_jht != '0' || $data_bpjs_tk->flag_jkk != '0' || $data_bpjs_tk->flag_jkm != '0' || $data_bpjs_tk->flag_jp != '0') : ?>
                        <div class="form-group">
                            <label for="no_bpjs_tk">Nomor BPJS Ketenagakerjaan</label>
                            <p class="font-weight-bold" id="no_bpjs_tk">-</p>
                        </div>
                        <?php if ($data_bpjs_tk->flag_jht != '0') : ?>
                            <div class="form-group">
                                <div class="row">
                                    <div class="col-md-6">
                                        <label for="bpjs_tk_tunj_jht_perus_rp_text">Tunj. JHT Perusahaan (<?= $data_bpjs_tk->tunj_jht_perus ?> %)</label>
                                        <p id="bpjs_tk_tunj_jht_perus_rp_text" class="nominal_text font-weight-bold"><?= isset($data_bpjs_tk_m) ? $data_bpjs_tk_m->tunj_jht_perus_rp : 0 ?></p>
                                    </div>
                                    <div class="col-md-6">
                                        <label for="bpjs_tk_pot_jht_kry_rp_text">Pot. JHT Karyawan (<?= $data_bpjs_tk->pot_jht_kry ?> %)</label>
                                        <p id="bpjs_tk_pot_jht_kry_rp_text" class="nominal_text font-weight-bold"><?= isset($data_bpjs_tk_m) ? $data_bpjs_tk_m->pot_jht_kry_rp : 0 ?></p>
                                    </div>
                                </div>
                            </div>
                        <?php endif; ?>
                        <?php if ($data_bpjs_tk->flag_jkk != '0') : ?>
                            <div class="form-group">
                                <?php if ($data_bpjs_tk->flag_jkk != '0') : ?>
                                    <label for="bpjs_tk_tunj_jkk_rp_text">Tunj. JKK (<?= $data_bpjs_tk->tunj_jkk ?> %)</label>
                                    <p id="bpjs_tk_tunj_jkk_rp_text" class="nominal_text font-weight-bold"><?= isset($data_bpjs_tk_m) ? $data_bpjs_tk_m->tunj_jkk_rp : 0 ?></p>
                                <?php else : ?>
                                    <label for="bpjs_tk_tunj_jkk_rp_text">Tunj. JKK <span class="badge badge-light">Nonaktif</span></label>
                                    <p id="bpjs_tk_tunj_jkk_rp_text" class="nominal_text font-weight-bold">-</p>
                                <?php endif; ?>
                            </div>
                        <?php endif; ?>
                        <?php if ($data_bpjs_tk->flag_jkm != '0') : ?>
                            <div class="form-group">
                                <?php if ($data_bpjs_tk->flag_jkm != '0') : ?>
                                    <label for="bpjs_tk_tunj_jkm_rp_text">Tunj. JKM (<?= $data_bpjs_tk->tunj_jkm ?> %)</label>
                                    <p id="bpjs_tk_tunj_jkm_rp_text" class="nominal_text font-weight-bold"><?= isset($data_bpjs_tk_m) ? $data_bpjs_tk_m->tunj_jkm_rp : 0 ?></p>
                                <?php else : ?>
                                    <label for="bpjs_tk_tunj_jkm_rp_text">Tunj. JKM <span class="badge badge-light">Nonaktif</span></label>
                                    <p id="bpjs_tk_tunj_jkm_rp_text" class="nominal_text font-weight-bold">-</p>
                                <?php endif; ?>
                            </div>
                        <?php endif; ?>
                        <?php if ($data_bpjs_tk->flag_jp != '0') : ?>
                            <div class="form-group">
                                <div class="row">
                                    <div class="col-md-6">
                                        <label for="bpjs_tk_tunj_jp_perus_rp_text">Tunj. JP Perusahaan (<?= $data_bpjs_tk->tunj_jp_perus ?> %)</label>
                                        <p id="bpjs_tk_tunj_jp_perus_rp_text" class="nominal_text font-weight-bold"><?= isset($data_bpjs_tk_m) ? $data_bpjs_tk_m->tunj_jp_perus_rp : 0 ?></p>
                                    </div>
                                    <div class="col-md-6">
                                        <label for="bpjs_tk_pot_jp_kry_rp_text">Pot. JP Karyawan (<?= $data_bpjs_tk->pot_jp_kry ?> %)</label>
                                        <p id="bpjs_tk_pot_jp_kry_rp_text" class="nominal_text font-weight-bold"><?= isset($data_bpjs_tk_m) ? $data_bpjs_tk_m->pot_jp_kry_rp : 0 ?></p>
                                    </div>
                                </div>
                            </div>
                        <?php endif; ?>
                        <hr>
                        <div class="form-group pt-1">
                            <div class="row">
                                <div class="col-md-6">
                                    <label for="ttl_tunj_bpjs_tk">Total Tunjangan</label>
                                    <p id="ttl_tunj_bpjs_tk" class="nominal_text font-weight-bold"></p>
                                </div>
                                <div class="col-md-6">
                                    <label for="ttl_pot_bpjs_tk">Total Potongan</label>
                                    <p id="ttl_pot_bpjs_tk" class="nominal_text font-weight-bold"></p>
                                </div>
                            </div>
                        </div>
                    <?php endif; ?>
                </div>
            </div>
        </div>
    </form>
</div>
<div class="card-footer">
    <div class="row">
        <div class="col-md-7 text-left">
            <div id="message"></div>
        </div>
        <div class="col-md-5 text-right">
            <button id="btn_new_input" class="btn" style="display:none">TAMBAH BARU</button>
            <button class="btn_save ladda-button" data-style="expand-left"></button>
        </div>
    </div><!-- ./row -->
</div>
