<?php if ($this->common_m->validDineinToken()): ?>
    <?php $shop_id = $shop_id ?? 0; ?>
    <?php $check = $this->common_m->check_order($shop_id, $this->session->userdata('uid') ?? '') ?>
    <?php $order_details = $check['result'] ?? []; ?>
    <?php if (!empty($order_details)) : ?>
        <div class="dininOrderInfo text-center">
            <div class="container">
                <div class="historyIcon">
                    <i class="icofont-history"></i>
                </div>
                <div class="row justify-content-center">
                    <div class="col-md-6">
                        <div class="">
                            <div class="infoBody">
                                <h4><?= order_status_badge($order_details) ?></h4>
                                <h5><?= __('order_id') ?> #<?= $order_details['uid'] ?> </h5>
                                <p><?= __('order_type'); ?> : <b><?= __('dine_in'); ?></b></p>
                                <p><?= __('table'); ?> : <b><?= __table($order_details['table_no'])->name ?? ''; ?></b></p>

                            </div>
                            <?php if (!empty($order_details['request_payment_type']) && $order_details['is_bill_request'] == 1): ?>
                                <div class="requestData mt-5 mb-5">
                                    <p class="badge badge-info"><i class="fa fa-check"></i> <?= __('request_sent'); ?></p>

                                    <p><?= __('payment_type'); ?>: <b> <?= __($order_details['request_payment_type']) ?? ''; ?></b></p>

                                    <?php if (!empty($order_details['billing_comments'])): ?>
                                        <p><?= __('comments'); ?>: <b> <?= $order_details['billing_comments'] ?? ''; ?></b></p>
                                    <?php endif; ?>
                                </div>
                            <?php endif; ?>
                            <div class="infoFooter mt-10 gap-10">
                                <?php if ($order_details['is_new_order_request'] == 0) : ?>
                                    <a href="<?= base_url('profile/order_request/' . $order_details['uid']) ?>" class="btn btn-primary" data-toggle="tooltip" title="<?= __('request_new_order'); ?>"> <i class="fa fa-cart-plus"></i></a>
                                <?php else: ?>
                                    <button class="btn btn-primary" disabled> <i class="fa fa-cart-plus"></i> <?= __('pending'); ?></button>
                                <?php endif; ?>

                                <?php if ($order_details['is_bill_request'] == 1): ?>
                                    <button class="btn btn-primary" disabled> <i class="fa fa-file-pdf"></i> <?= __('sent'); ?></button>
                                <?php else: ?>
                                    <a href="javascript:;" class="btn btn-secondary requestBillBtn" data-toggle="tooltip" title="<?= __('request_bill'); ?>"> <i class="fa fa-file-pdf"></i></a>
                                <?php endif; ?>
                              
                            </div>

                            <div class="requestForm text-left mt-10 dis_none">
                                <form action="<?= base_url("profile/request_bill"); ?>" id="requestForm" class="requestBillForm" method="post">
                                    <?= csrf(); ?>
                                    <span class="reg_msg"></span>
                                    <div class="form-group">
                                        <label><?= __('payment_type') ?></label>
                                        <select name="payment_type" class="form-control" id="payment_type">
                                            <option value="cash"><?= __('cash'); ?></option>
                                            <option value="card"><?= __('card'); ?></option>
                                            <option value="online"><?= __('online'); ?></option>
                                        </select>
                                    </div>
                                    <div class="form-group">
                                        <label><?= __('comments') ?></label>
                                        <textarea name="billing_comments" id="note" class="form-control" rows="3"></textarea>
                                    </div>
                                    <div class="text-center">
                                        <input type="hidden" name="order_id" value="<?= $order_details['uid'] ?>">
                                        <input type="hidden" name="shop_id" value="<?= $order_details['shop_id'] ?? $shop_id ?? 0; ?>">
                                        <button type="submit" class="btn btn-secondary" id="requestBtn"> <?= __('submit'); ?></button>
                                    </div>
                                </form>
                            </div>
                        </div>

                    </div>
                </div>
            </div>
        </div>

    <?php endif; ?>
<?php endif; ?>