<?php if(!empty($account['fcuIndicatorTransactions'])): ?>
    <?php
        $fcuData = $account['fcuIndicatorTransactions'];
        $sectionTitles = [
            'fraudIndicators' => 'Fraud Indicators',
            'behaviouralIndicators' => 'Behavioural Indicators',
            'riskIndicators' => 'Risk Indicators'
        ];
    ?>

    <?php $__currentLoopData = $sectionTitles; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $sectionKey => $sectionTitle): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
        <?php if(isset($fcuData[$sectionKey]) && !empty($fcuData[$sectionKey])): ?>
            <h5 class="mt-4 border-bottom pb-2"><strong class="text-secondary"><?php echo e($sectionTitle); ?></strong></h5>
            <div class="panel-group" id="accordion-<?php echo e($accountId); ?>-<?php echo e($sectionKey); ?>">
                <?php $__currentLoopData = $fcuData[$sectionKey]; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $indicatorKey => $indicator): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <?php if(isset($indicator['transactions']) && count($indicator['transactions']) > 0): ?>
                        <div class="card mt-2">
                            <div class="card-header p-2" style="cursor: pointer;" data-toggle="collapse" data-parent="#accordion-<?php echo e($accountId); ?>-<?php echo e($sectionKey); ?>" href="#collapse-<?php echo e($accountId); ?>-<?php echo e($sectionKey); ?>-<?php echo e($loop->index); ?>">
                                <h6 class="panel-title mb-0">
                                    <?php echo e(ucwords(preg_replace('/([a-z])([A-Z])/', '$1 $2', str_replace('_', ' ', $indicatorKey)))); ?>

                                    <span class="badge badge-info float-right"><?php echo e(count($indicator['transactions'])); ?></span>
                                </h6>
                            </div>
                            <div id="collapse-<?php echo e($accountId); ?>-<?php echo e($sectionKey); ?>-<?php echo e($loop->index); ?>" class="panel-collapse collapse">
                                <div class="card-body" style="max-height: 400px; overflow-y: auto; padding: 10px;">
                                    <table class="table table-bordered table-hover table-sm">
                                        <thead class="thead-light">
                                            <tr>
                                                <?php $__currentLoopData = array_keys($indicator['transactions'][0]); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $header): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                    <th><?php echo e(ucwords(str_replace('_', ' ', $header))); ?></th>
                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <?php $__currentLoopData = $indicator['transactions']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $txn): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                <tr>
                                                    <?php $__currentLoopData = $txn; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                        <td><?php echo e($value); ?></td>
                                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                </tr>
                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                    <?php endif; ?>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </div>
        <?php endif; ?>
    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
<?php else: ?>
     <p class="text-muted">No risk events found for this account.</p>
<?php endif; ?>