<?php defined('BASEPATH') or exit('No direct script access allowed'); ?>

<div class="box">
    <div class="box-header with-border">
        <div class="left">
            <h3 class="box-title"><?= html_escape($title); ?></h3>
        </div>
    </div>
    <div class="box-body">
        <div class="row">
            <!-- include message block -->
            <div class="col-sm-12">
                <?php $this->load->view('admin/includes/_messages'); ?>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-12">
                <div class="table-responsive">
                    <table class="table table-striped" role="grid">
                        <thead>
                        <tr role="row">
                            <th scope="col"><?= trans("id"); ?></th>
                            <th scope="col"><?= trans("payment_id"); ?></th>
                            <th scope="col"><?= trans("membership_plan"); ?></th>
                            <th scope="col"><?= trans("payment_amount"); ?></th>
                            <th scope="col"><?= trans("payment_status"); ?></th>
                            <th scope="col"><?= trans("date"); ?></th>
                            <th class="max-width-120"><?php echo trans('options'); ?></th>
                        </tr>
                        </thead>
                        <tbody>
                        <?php if (!empty($transactions)): ?>
                            <?php foreach ($transactions as $transaction): ?>
                                <tr>
                                    <td style="width: 5%;"><?php echo $transaction->id; ?></td>
                                    <td><?= html_escape($transaction->payment_id); ?></td>
                                    <td><?= html_escape($transaction->plan_title); ?></td>
                                    <td><?= html_escape($transaction->payment_amount); ?>&nbsp;(<?= html_escape($transaction->currency); ?>)</td>
                                    <td><?= get_payment_status($transaction->payment_status); ?></td>
                                    <td class="white-space-nowrap" style="width: 15%"><?= formatted_date($transaction->created_at); ?></td>
                                    <td><a href="<?php echo lang_base_url(); ?>invoice-membership/<?= $transaction->id; ?>" class="btn btn-sm btn-info" target="_blank"><i class="fa fa-file-text"></i>&nbsp;&nbsp;<?php echo trans("view_invoice"); ?></a></td>
                                </tr>
                            <?php endforeach; ?>
                        <?php endif; ?>
                        </tbody>
                    </table>
                </div>
                <?php if (empty($transactions)): ?>
                    <p class="text-center">
                        <?php echo trans("no_records_found"); ?>
                    </p>
                <?php endif; ?>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-12">
                <?php if (!empty($transactions)): ?>
                    <div class="number-of-entries">
                        <span><?= trans("number_of_entries"); ?>:</span>&nbsp;&nbsp;<strong><?= $num_rows; ?></strong>
                    </div>
                <?php endif; ?>
                <div class="table-pagination">
                    <?php echo $this->pagination->create_links(); ?>
                </div>
            </div>
        </div>
    </div><!-- /.box-body -->
</div>

