<script>
    $(function() {
        $("#<?= $column ?> .btn-save").on("click", function(e) {
            e.preventDefault();
            var loading = Ladda.create(this);
            const column = $(this).data("for");
            const old = $(this).data("old");

            var params = {};
            params.column = column;
            params.value = informasi_gaji_get_value_form(column);
            params.value_old = old;
            params.id_karyawan = "<?= $id_karyawan ?>";

            $.ajax({
                type: "POST",
                url: "<?= route('master.karyawan.payroll.informasi_gaji.save') ?>",
                data: params,
                dataType: "JSON",
                beforeSend: function() {
                    loading.start();
                    informasi_gaji_disable_form(column, true);
                },
                success: function(result) {
                    loading.stop();
                    if (result.success == true) {
                        load_informasi_gaji();
                    } else {
                        informasi_gaji_disable_form(column, false);
                        showMsg(result.message, false);
                    }
                },
                error: function() {
                    loading.stop();
                    informasi_gaji_disable_form(column, false);
                    showMsg("error", false);
                }
            });

        });
    })
</script>
<div class="input-group">
    <input type="text" class="form-control" oninput="format_amount($(this))" name="value" value="<?= dec_to_num($default) ?>">
    <div class="input-group-append">
        <button class="btn btn-primary btn-save ladda-button" data-for="<?= $column ?>" data-old="<?= $default ?>" type="button" data-style="zoom-in"><i class="fa fa-check"></i></button>
    </div>
</div>
