<script type="text/javascript">
    $(function() {
        loading();
        if (localStorage.getItem("tab_master_lembur") != null) {
            const thisTab = document.getElementById(localStorage.getItem("tab_master_lembur"));
            thisTab.closest('li').click();
            thisTab.classList.add("active");
        } else {
            const thisTab = document.getElementById('tab_pengaturan');
            thisTab.closest('li').click();
            thisTab.classList.add("active");
        }

        $('.tab_menu li a').click(function() {
            $('.tab_menu li a').removeClass("active");
            $(this).addClass("active");
        });
    });

    function select_tab_menu(e) {
        loading();
        if (e.attr('id') == 'tab_pengaturan') {
            $("#myTabContent").load("<?= route('payroll.master.lembur.pengaturan') ?>");
            localStorage.setItem("tab_master_lembur", "tab_pengaturan");
        } else {
            $("#myTabContent").load("<?= route('payroll.master.lembur.karyawan') ?>");
            localStorage.setItem("tab_master_lembur", "tab_lembur_karyawan");
        }
    }

    function loading() {
        $('#myTabContent').html('<div class="modal-body"><div class="text-center"><div class="custom-lds-ring"><div></div><div></div><div></div></div></div></div>');
    }
</script>
<div class="content-header mt-4">
    <div class="row align-items-center">
        <div class="content-header-left col-md-6 col-12 mb-md-0 mb-1">
            <h3 class="content-header-title"><?= $judul ?></h3>
            <div class="row breadcrumbs-top">
                <div class="breadcrumb-wrapper col-12">
                    <ol class="breadcrumb">
                        <li class="breadcrumb-item"><a href="#">Payroll</a></li>
                        <li class="breadcrumb-item active"><?= $judul ?></li>
                    </ol>
                </div>
            </div>
        </div>
    </div>
</div>

<div class="row match-height">
    <div class="col-xl-12 col-lg-12">
        <div class="card card-rounded card-detail-karyawan">
            <div class="card-content">
                <div class="card-body p-custom">
                    <div class="nav-vertical row">
                        <div class="col-md-2 border-kanan">
                            <ul class="tab_menu nav nav-tabs nav-left flex-column">
                                <li class="nav-item" onclick="select_tab_menu($(this).find('a'))">
                                    <a id="tab_pengaturan" class="nav-link" aria-expanded="false">
                                        Master Pengaturan Lembur
                                    </a>
                                </li>
                                <li class="nav-item" onclick="select_tab_menu($(this).find('a'))">
                                    <a id="tab_lembur_karyawan" class="nav-link" aria-expanded="false">
                                        Master Lembur Karyawan
                                    </a>
                                </li>
                            </ul>
                        </div>
                        <div class="col-md-10" style="padding: 20px;">
                            <div id="myTabContent" class="tab-content">
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
