<div class="container">
    <div class="row">
        <div class="col-md-12">
            <h3>Kehadiran Anggota Koperasi (Maya)</h3>
            <div class="table-responsive">
                <table class="table table-striped table-condensed">
                    <thead>
                        <tr>
                            <th>Bil.</th>
                            <th>Nama Anggota</th>
                            <th>No. Kad Pengenalan</th>
                            <th>No. Anggota</th>
                            <th>Unit</th>
                            <th>Kehadiran</th>
                            <th>Tarikh/Masa</th>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach ($virtuals as $virtual)
                            <tr>
                                {{-- <td>{{ $index + 1 }}</td> <!-- Display the serial number --> --}}
                                <td>{{ $loop->iteration }}</td>
                                <td>{{ $virtual['name'] }}</td>
                                <td>{{ $virtual['no_kp'] }}</td>
                                <td>{{ $virtual['no_anggota'] }}</td>
                                <td>{{ $virtual['unit'] }}</td>
                                <td> @php
                                    switch ($virtual['kehadiran']) {
                                        case 1:
                                            echo 'Fizikal';
                                            break;
                                        case 2:
                                            echo 'Maya';
                                            break;
                                        default:
                                            echo '-';
                                    }
                                @endphp</td>
                                <td>{{ $virtual['updated_at'] }}</td>
                            </tr>

                            {{-- @if ($result->position_id == $position->id) --}}

                            {{-- @endif --}}
                        @endforeach
                        <tr>
                            <td colspan="2"><b>Peratus Fizikal</b></td>
                            <td><b>{{ ($total_virtuals / $votes) * 100 }}%</b></td>
                        </tr>
                    </tbody>
                </table>
            </div>
            <hr />

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

<!-- Verified By column -->
<div class="container mt-4">
    <div class="row signature-section">
        <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 */
    .signature-section {
        margin-top: 80px;
    }

    .table-row {
        margin-top: 50px;
    }

    .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>
