<?php echo $__env->make('admin.layouts.header', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
<?php echo $__env->make('admin.layouts.sidebar', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
<div class="m-grid__item m-grid__item--fluid m-wrapper">
    <div class="m-subheader ">
        <div class="d-flex align-items-center">
            <div class="mr-auto">
                <h3 class="m-subheader__title m-subheader__title--separator">
                    Loan Decision Results
                </h3>
            </div>
        </div>
    </div>
    <div class="m-content">
        <div class="m-portlet m-portlet--mobile">
            <div class="m-portlet__head">
                <div class="m-portlet__head-caption">
                    <div class="m-portlet__head-title">
                        <span class="m-portlet__head-icon">
                            <i class="fa fa-list"></i>
                        </span>
                        <h3 class="m-portlet__head-text">
                            Loan Decisions
                        </h3>
                    </div>
                </div>
            </div>
            <div class="m-portlet__body">
                <div class="" style="overflow-x: auto;">
                    <table class="table table-bordered table-hover" style="font-size: 13px; white-space: nowrap;">
                        <thead>
                            <tr style="background-color: #f4f5f8;">
                                <th>ID</th>
                                <th>App ID</th>
                                <th>Customer Name</th>
                                <th>Gender</th>
                                <th>Status</th>
                                <th>Action</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php $__empty_1 = true; $__currentLoopData = $decisions; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $decision): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                                <?php
                                    $payload = json_decode($decision->bre_payload);
                                ?>
                                <tr>
                                    <td><?php echo e($decision->id); ?></td>
                                    <td><?php echo e(!empty($decision->application_id) ? $decision->application_id : '—'); ?></td>
                                    <td><?php echo e(!empty($decision->customer_name) ? $decision->customer_name : '—'); ?></td>
                                    <td><?php echo e(!empty($decision->gender) ? ucfirst($decision->gender) : '—'); ?></td>
                                    <td>
                                        <?php if($decision->bre_status == 'success'): ?>
                                            <span style="padding: 3px 8px; border-radius: 3px; font-size: 11px; font-weight: 600; background-color: #c9f7f5; color: #1bc5bd;">Success</span>
                                        <?php elseif($decision->bre_status): ?>
                                            <span style="padding: 3px 8px; border-radius: 3px; font-size: 11px; font-weight: 600; background-color: #ffe2e5; color: #f64e60;">Failed</span>
                                        <?php else: ?>
                                            <span class="badge badge-secondary">Pending</span>
                                        <?php endif; ?>
                                    </td>
                                    <td>
                                        <?php if($decision->bre_id): ?>
                                        <a href="/admin/co-lending/decision-results/<?php echo e($decision->bre_id); ?>" class="btn btn-sm btn-primary" style="padding: 4px 10px; font-size: 11px;">
                                            View BRE Result
                                        </a>
                                        <?php else: ?>
                                        —
                                        <?php endif; ?>
                                    </td>
                                </tr>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                                <tr>
                                    <td colspan="12" class="text-center">No records found.</td>
                                </tr>
                            <?php endif; ?>
                        </tbody>
                    </table>
                </div>

                <div class="text-center" style="margin-top: 15px;">
                    <?php echo $decisions->appends(\Request::except('page', '_token'))->render(); ?>

                </div>

            </div>
        </div>
    </div>
</div>
<?php echo $__env->make("admin.layouts.footer", array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
