<fieldset style="margin-top:0px; margin-bottom: 0px; padding-bottom: 0px; border-radius: 0px 0px 10px 10px">
    <div class="row report-row">
        <?php if (!empty($logs)): ?>
            <?php if (isset($maxCounter) && $maxCounter > 1): ?>
                <div class="table-bg-color">
                    <div class="main-arrowbg text-center pull-left">
                        <ul class="pagination">
                            <?php if ($active_page != 1): ?>
                                <li><a href="javascript:void(0)" onclick="paginateReport('prevBtn', '<?php !empty($logs) ? print $logs[0]->id : print 0 ?>', '<?php !empty($logs) ? print $logs[count($logs) - 1]->id : print 0 ?>')" ><span><img src="<?php echo ASSETS_GKPOS_PATH ?>images/prevbtnbg.png" width="20" height="18" /></span></a></li>
                            <?php endif; ?>
                            <?php for ($i = 1; $i <= $maxCounter; $i++): ?>
                                <li <?php $active_page == $i ? print'class="active"' : '' ?>><a href="javascript:void(0)" onclick="paginateReport('<?php print $i ?>', '<?php !empty($logs) ? print $logs[0]->id : print 0 ?>', '<?php !empty($logs) ? print $logs[count($logs) - 1]->id : print 0 ?>')"><?php echo $i ?></a></li>
                            <?php endfor; ?>
                            <?php if ($active_page != $maxCounter): ?>
                                <li><a href="javascript:void(0)" onclick="paginateReport('nextBtn', '<?php !empty($logs) ? print $logs[0]->id : print 0 ?>', '<?php !empty($logs) ? print $logs[count($logs) - 1]->id : print 0 ?>')"><span><img src="<?php echo ASSETS_GKPOS_PATH ?>images/nextbtnbg.png" width="20" height="18" /></span></a></li>
                            <?php endif ?>
                        </ul>
                    </div>
                </div>
            <?php endif ?>
            <table class="table table-responsive table-bordered">
                <tr class="table-bg-color">
                    <th>Log Date</th>
                    <th>Task</th>
                    <th>From</th>
                </tr>
                <?php if (!empty($logs)): ?>
                    <?php foreach ($logs as $log): ?>
                        <tr class="table-bg-color-white">
                            <td><?php print date('F j, Y H:i:a', strtotime($log->access_time)) ?></td>
                            <td><?php echo $log->activity ?></td>
                            <td><?php echo $log->login_ip ?></td>
                        </tr>
                    <?php endforeach; ?>
                <?php else: ?>
                    <tr class="table-bg-color-white">
                        <td colspan="3">No Logs Found Yet</td>
                    </tr>
                <?php endif; ?>
            </table>
        <?php endif; ?>
    </div>
</fieldset>
<script>
    $(document).ready(function () {
        $(".date_filter").datepicker({
            dateFormat: "dd/mm/yy"
        });
    });
    function filterReport() {
        $('#reportFilterForm').validate({
            submitHandler: function () {
                var myform = document.getElementById('reportFilterForm');
                var formdata = new FormData(myform);
                $.ajax({
                    url: $('#reportFilterForm').attr('action'),
                    data: formdata,
                    cache: false,
                    processData: false,
                    contentType: false,
                    type: 'POST',
                    success: function (response) {
                        $("#filterContent").html(response);
                        manageWindowHeight();
                    }
                });
            }
        });
    }

    function paginateReport(pageBtn, firstOrderId, lastOrderId, order_id = false, active_page = false) {
        if (pageBtn == 'del') {
            $.confirm({
                'title': 'Order Delete Warning',
                'message': 'Are you sure? You want to delete this order ',
                'buttons': {
                    'YES': {
                        'class': 'btn btn-success',
                        'action': function () {
                            $.ajax({
                                url: "<?php echo site_url('gkpos/userlogs/filter') ?>",
                                data: {
                                    pageBtn: pageBtn,
                                    firstOrderId: firstOrderId,
                                    lastOrderId: lastOrderId,
                                    start_date: $('#filterStartDate').val(),
                                    end_date: $('#filterEndDate').val(),
                                    order_id: order_id,
                                    active_page: active_page
                                },
                                type: "POST",
                                success: function (response) {
                                    if ($("#filterContent").html(response)) {
                                        manageWindowHeight();
                                    }
                                }
                            });
                        }
                    },
                    'NO': {
                        'class': 'btn btn-danger',
                        'action': function () {}
                    }
                }
            });

        } else {
            $.ajax({
                url: "<?php echo site_url('gkpos/userlogs/filter') ?>",
                data: {
                    pageBtn: pageBtn,
                    firstOrderId: firstOrderId,
                    lastOrderId: lastOrderId,
                    start_date: $('#filterStartDate').val(),
                    end_date: $('#filterEndDate').val(),
                    order_id: order_id,
                    active_page: active_page
                },
                type: "POST",
                success: function (response) {
                    if ($("#filterContent").html(response)) {
                        manageWindowHeight();
                    }
                }
            });
        }
  }

</script>