<div class="table-responsive">
    <table id="dailyExpenseTable" class="table table-bordered table-striped">
        <thead>
            <tr>
                <th>ID</th>
                <th>Date</th>
                <th>Type</th>
                <th>Sub Type</th>
                <th>Amount</th>
                <th>Note</th>
                <th class="text-right">Action</th>
            </tr>
        </thead>
        <tbody>
        <?php foreach($daily_expense as $row): ?>
            <tr>
                <td><?= $row->id ?></td>
                <td><?= $row->date ?></td>
                <td><?= $this->expense->get_expense_type_name($row->expense_type_id); ?></td>
                <td>
                    <?php if ($row->expense_type_id == '0'): ?>
                        <?php
                            if ($row->sub_expense_type_id == 1) {
                                echo 'Advance';
                            } elseif ($row->sub_expense_type_id == 2) {
                                echo 'Loan';
                            } elseif ($row->sub_expense_type_id == 3) {
                                echo 'Salary';
                            } else {
                                echo 'Not Set';
                            }
                        ?>
                    <?php endif; ?>
                </td>
                <td>Rs. <?= number_format($row->amount) ?></td>
                <td><?= $row->note ?></td>
                <td class="text-right">
                    <a href="#" class="btn btn-sm btn-warning edit-expense-btn"
                       data-id="<?= $row->id ?>"
                       data-date="<?= $row->date ?>"
                       data-rate="<?= $row->rate ?>"
                       data-quantity="<?= $row->quantity ?>"
                       data-amount="<?= $row->amount ?>"
                       data-note="<?= $row->note ?>">
                       <i class="fa fa-edit"></i>
                    </a>
                    <a href="javascript:void(0);" class="btn btn-sm delete-confirmation-modal btn-danger " data-url="<?= base_url('admin/DailyExpense/delete/' . $row->id) ?>">
                        <i class="fa fa-trash"></i>
                    </a>
                </td>
            </tr>
        <?php endforeach; ?>
        </tbody>
    </table>
</div>
