<?php
 use App\Models\AgeGroup; $agegroups = array();
 $agegroups = AgeGroup::all();
 $key = 1;
?>
<div class="card">
    <div class="card-header">
        <h5>Incident Vs Age Groups</h5>
    </div>
    <div class="card-block table-border-style">
        <div class="table-responsive">
            <form id="indexform" class="form-horizontal" method="GET" action="">
                @csrf
                <div class="row">
                    <div class="col-sm-5">
                        <label class="col-md-4 col-form-label text-md-left">From <span style="color: red">*</span></label>
                        <div class="col-md-8">
                            <input type="text" class="form-control" id="from" name="from" required="required" autocomplete="off" placeholder="Start Date">
                        </div>
                    </div>
                    <div class="col-sm-5">
                        <label class="col-md-4 col-form-label text-md-left">To <span style="color: red">*</span></label>
                        <div class="col-md-8">
                            <input type="text" class="form-control" id="to" name="to" required="required" autocomplete="off" placeholder="End Date">
                        </div>
                    </div>
                    <div class="col-sm-2">
                        <label class="col-md-4 col-form-label text-md-left"></label><br><br>
                        <button class="btn btn-default"> Review</button>
                    </div>
                </div>
            </form>
            <?php $ages = collect( $agegroups) ?>
            <table class="table table-hover">
                <thead>
                    <tr>
                        <th>Incident</th>
                        <?php foreach ($ages as $age) { ?>
                            <th><?= $age->name ?></th>
                        <?php } ?>
                    </tr>
                </thead>
                <tbody>
                    @foreach($incidents as $incident)
                    <tr>
                        <td>{{$incident->name}}</td>
                        <?php foreach ($ages as $age) { ?>
                            <td></td>
                        <?php } ?>
                        <?php  ?>
                    </tr>
                    <?php $key++;?>
                    @endforeach
                </tbody>
            </table>

        </div>
    </div>
</div>