<?php $apps = !empty($settings['extra_config']) ? json_decode($settings['extra_config']) : '' ?>

<div class="order-actions-modern">
    <!-- Quick View -->
    <a href="javascript:;" data-id="<?= $row['uid']; ?>" class="btn btn-icon-modern quick_view" title="<?= lang('quick_view'); ?>" data-toggle="tooltip">
        <i class="fa fa-eye"></i>
    </a>

    <!-- Edit Order -->
    <?php if (isset($apps->edit_order_type) && $apps->edit_order_type == 1) : ?>
        <?php if (file_exists(APPPATH . 'controllers/admin/Pos.php')) : ?>
            <a href="<?= base_url("admin/restaurant/edit_order/{$row['uid']}"); ?>" class="btn btn-icon-modern edit-btn" data-toggle="tooltip" title="<?= lang('edit_order'); ?>">
                <i class="fa fa-pencil"></i>
            </a>
        <?php endif; ?>
    <?php else : ?>
        <a href="<?= base_url("admin/order-details/{$row['uid']}?action=Edit"); ?>" class="btn btn-icon-modern edit-btn" data-toggle="tooltip" title="<?= lang('edit_order'); ?>">
            <i class="fa fa-pencil"></i>
        </a>
    <?php endif; ?>

    <!-- Action Dropdown -->
    <div class="dropdown dropdown-modern">
        <button class="btn btn-icon-modern dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
            <i class="fa fa-cog"></i>
        </button>
        <ul class="dropdown-menu dropdown-menu-right">
            <li class="dropdown-header"><?= lang('manage_order'); ?></li>
            <?php if ($row['order_type'] == 7 && !empty($row['table_no'])) : ?>
            <?php else : ?>
                <li><a href="<?= base_url('admin/order-details/' . $row['uid']); ?>"><i class="fa fa-info-circle"></i> <?= lang('order_details'); ?></a></li>
            <?php endif; ?>

            <?php if ($row['status'] == 0) : ?>
                <li class="divider"></li>
                <li>
                    <?php if (restaurant()->es_time == 0) : ?>
                        <a href="<?= base_url('admin/restaurant/order_status/' . $row['uid'] . '/1'); ?>" class="orderStatus text-info" data-shop="<?= $row['shop_id']; ?>"><i class="fa fa-check"></i> <?= lang('accept'); ?></a>
                    <?php else : ?>
                        <a href="javascript:;" class="showTimeModal text-info" data-shop="<?= $row['shop_id']; ?>" data-id="<?= $row['uid']; ?>"><i class="fa fa-check-circle"></i> <?= lang('accept'); ?></a>
                    <?php endif ?>
                </li>
            <?php endif; ?>

            <?php if ($row['status'] == 0 || $row['status'] == 1) : ?>
                <li><a href="<?= base_url('admin/restaurant/order_status/' . $row['uid'] . '/2'); ?>" class="orderStatus text-success" data-shop="<?= $row['shop_id']; ?>"><i class="fa fa-check-square-o"></i> <?= lang('completed'); ?></a></li>
            <?php endif; ?>

            <?php if ($row['is_payment'] == 0) : ?>
                <li><a href="<?= base_url('admin/restaurant/order_payment_status/' . $row['id'] . '/1'); ?>" class="text-success"><i class="fa fa-money"></i> <?= lang('completed_paid'); ?></a></li>
            <?php endif; ?>

            <?php if ($row['status'] == 0) : ?>
                <?php if (is_access('order-cancel') == 1) : ?>
                    <li><a href="javascript:;" data-shop="<?= $row['shop_id']; ?>" class="rejectModal text-warning" data-url="<?= base_url('admin/restaurant/order_status/' . $row['uid'] . '/3'); ?>"><i class="fa fa-times-circle-o"></i> <?= lang('cancel'); ?></a></li>
                <?php endif; ?>
            <?php endif; ?>

            <li class="divider"></li>
            
            <li>
                <a target="blank" href="<?= base_url('invoice/' . auth('username') . '/' . $row['uid']); ?>">
                    <i class="fa fa-file-text-o"></i> <?= lang('invoice'); ?>
                </a>
            </li>

            <?php if ($row['status'] != 2) : ?>
                <?php if (is_access('delete') == 1) : ?>
                    <li><a href="<?= base_url('admin/menu/delete/' . $row['id']); ?>" class="action_btn text-danger" data-msg="<?= lang('want_to_delete'); ?>"><i class="fa fa-trash"></i> <?= lang('delete'); ?></a></li>
                <?php endif; ?>
            <?php endif; ?>
        </ul>
    </div>
</div>