<div class="col-lg-10 col-md-10 col-sm-10 col-xs-10 bodyitem">
    <fieldset style="margin-bottom: 0px; padding-bottom: 0px; border-radius: 10px 10px 0px 0px ">
        <div class="row">
            <form action="<?php echo site_url('gkpos/report/onlinefilter') ?>" method="post"  id="reportFilterForm">
                <table class="table table-bg-color table-responsive">
                    <tr>
                        <th>Date Range From</th>
                        <th>To </th>
                        <th>Name</th>
                        <th>Phone</th>
                        <th>Order Type</th>
                        <th>#Ref</th>
                        <th>&nbsp;</th>
                    </tr>
                    <tr>
                        <td><?php echo form_input(array('name' => 'start_date', 'value' => $start_date, 'class' => 'date_filter form-control input-sm','id'=>'onlineFilterStartDate')); ?></td>
                        <td><?php echo form_input(array('name' => 'end_date', 'value' => $end_date, 'class' => 'date_filter form-control input-sm','id'=>'onlineFilterEndDate')); ?></td>
                        <td><?php echo form_input(array('name' => 'name', 'value' => '', 'class' => 'form-control input-sm', 'id' => 'onlineFilterName')); ?></td>
                        <td><?php echo form_input(array('name' => 'phone', 'value' => '', 'class' => 'form-control input-sm', 'id' => 'onlineFilterPhone')); ?></td>
                        <td>
                            <select class="form-control input-sm" id="onlineFilterOrderType" name="order_type">
                                <option value="">Select Order Type</option>
                                <?php foreach ($ordertype_options as $key => $value): ?>
                                    <option value="<?php echo $key ?>"><?php echo $value ?></option>
                                <?php endforeach; ?>
                            </select>
                        </td>
                        <td><?php echo form_input(array('name' => 'id', 'value' => '', 'class' => 'form-control input-sm', 'id' => 'onlineFilterId')); ?></td>
                        <td class="text-center"><button class="btn btn-primary btn-sm" type="submit" onclick="filterReport()"><?php echo "Submit" ?></button></td>
                    </tr>
                </table>
            </form>
        </div>
    </fieldset>
    <div id="filterContent2">
        <?php echo $this->load->view('gkpos/report/onlinefiltered'); ?>
    </div>
    <div id="payOpener"></div>
</div>
<script>

    function payOpener(id) {
        $.ajax({
            url: '<?php echo site_url('gkpos/report/payopen') ?>',
            type: 'POST',
            data: {
                id: id
            },
            success: function (output) {
                $('#payOpener').html(output);
                if ($('.payAndClose').length > 0) {
                    jQuery(".payAndClose").colorbox({inline: true, slideshow: false, scrolling: false, height: "auto", open: true, width: '76%', left: "12%", right: "12%"});
                    return false;
                }
            }
        });
    }
    function printGuestBill(order_id, status) {
        $.ajax({
            url: "<?php echo site_url('gkpos/orders/print_guest_bill'); ?>",
            data: {
                order_id: order_id,
                status: status
            },
            type: "POST",
            dataType: "json",
            success: function (output) {
                if (output.success) {
                    ALERT_TITLE = "Success!";
                    alert(output.message);
                    getSettingPage('<?php echo site_url('gkpos/report/online') ?>', 'Online Report');
                    jQuery.colorbox.close();
                } else {
                    alert(output.message);
                }
            }
        });

    }
    function printGuestBillServer(order_id, status) {
        $.ajax({
            url: "<?php echo site_url('gkpos/report/get_browser_bill_copy'); ?>",
            data: {
                id: order_id,
                status: status
            },
            type: "POST",
            success: function (output) {
                jQuery.colorbox.close();
                $('#payOpener').html(output);
                $("#guestBill_" + order_id).printThis();
            }
        });
        getSettingPage('<?php echo site_url('gkpos/report/online') ?>', 'Online Report');
    }
    function sleep(milliseconds) {
        var start = new Date().getTime();
        for (var i = 0; i < 1e7; i++) {
            if ((new Date().getTime() - start) > milliseconds) {
                break;
            }
        }
    }
</script>
