
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>

<div class="row">
    <div class="col-sm-4"></div>
    <div class="col-sm-4" style="text-align: center;">
        <button type="button" class="btn btn-primary generate-att">Generate</button>
    </div>
    <div class="col-sm-4"></div>
</div>
<br/>

<div class="row">
    <div class="col-sm-12 show-data">

    </div>
</div>

<style>
    .Table_List {
        font-size: 12px;
        text-align: center;
    }

    .top_row {
        font-family: khmeros, Verdana, Arial, Helvetica, sans-serif;
        font-size: 12px;
        font-weight: bold;
        text-align: center;
        color: #212121;
    }

    tbody, thead {
        display: table-row-group;
        vertical-align: middle;
        border-color: inherit;
    }
</style>

<script>
    $(function () {
        $('.generate-att').on('click',function () {
            getAtt();
        });

        checkAll('ch-em-id-all','ch-em-id');
        
    });

    function getAtt() {

        
        var emp_id = $('[name="emp_id[]"]').val();
        var month_year = $('[name="month_year"]').val();
        var from_date = $('[name="from_date"]').val();
        var to_date = $('[name="to_date"]').val();

        if(month_year != "" && from_date != "" && to_date !=""){
            $.ajax({
                url: '{{route('hr.generate-payroll')}}',
                type: 'GET',
                async: false,
                dataType: 'html',
                data: {
                    emp_id: emp_id,
                    month_year: month_year,
                    from_date: from_date,
                    to_date: to_date
                },
                success: function (d) {
                    $('.show-data').html(d);
                },
                error: function (d) {
                    alert('error');
                    $('.my-modal').hide();
                }
            });
        }
        else{
            alert('Please select month, from date, to date!');
        }
    }
</script>

