<div class="container">
    <div class="row">
        <div class="col-md-12">
            @foreach ($positions as $position)
                <h5>{{ $position->name }}</h5>
                <div class="table-responsive">
                    <table class="table table-striped table-condensed">
                        <thead>
                            <tr>
                                <th width="20%">No. Anggota</th>
                                <th width="30%">Nama</th>
                                <th width="15%">Unit</th>
                                <th width="10%">Undian</th>
                                <th width="15%">Peratus (%)</th>
                            </tr>
                        </thead>
                        <tbody>
                            @foreach ($results as $result)
                                @if ($result->position_id == $position->id)
                                    <tr>
                                        <td>{{ $result->nominee->no_anggota }}</td>
                                        <td>{{ $result->nominee->name }}</td>
                                        <td>{{ $result->nominee->unit }}</td>
                                        {{-- <td>{{ $result->votes}}</td> --}}
                                        <td>{{ $result->votes($result->nominee->id) }}</td>
                                        <td>{{ ($result->votes($result->nominee->id) / $total_votes) * 100 }} %</td>
                                    </tr>
                                @endif
                            @endforeach
                            @foreach ($no_votes as $no_vote)
                                @if ($no_vote->position_id == $position->id)
                                    <tr>
                                        <td>{{ $no_vote->no_anggota }}</td>
                                        <td>{{ $no_vote->name }}</td>
                                        <td>{{ $no_vote->unit }}</td>
                                        <td>0</td>
                                        <td>0</td>
                                    </tr>
                                @endif
                            @endforeach
                            <tr>
                                <td colspan="3"><b>Jumlah Undian</b></td>
                                <td><b>{{ $total_votes }}</b></td>
                            </tr>
                        </tbody>
                    </table>
                </div>
                <hr />
            @endforeach
        </div>
    </div>
</div>

<!-- Verified By column -->
<div class="container mt-4">
    <div class="row">
        <div class="col-md-12">
            <div class="table-responsive">
                <table>
                    <tbody>
                        <tr>
                            <td colspan="4"><b>Disahkan Oleh :</b></td>
                           
                        </tr>
                        <tr>
                            <td><b>...................................</b></td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>

<style>
    /* Style for table body */
    .table tbody td {
        border-bottom: 1px solid #ddd;
        padding: 8px;
    }

    /* Add space between specific columns */
    .table tbody td:nth-child(3),
    /* Unit column */
    .table tbody td:nth-child(4),
    /* Undian column */
    .table tbody td:nth-child(5) {
        /* Peratus (%) column */
        padding-right: 20px;
        /* Adjust this value as needed */
    }
</style>
