<div class="box-body table-responsive index-table-section">
    <table class="table table-bordered table-hover" style="margin:0;padding:0;" id="index-table">
        <thead>
            <tr>
                <th class="text-center">Id</th>
                <th class="text-center">
                    Name
                </th>
                <th class="text-center">
                    Link
                </th>
                <th class="text-center">
                    Downloaded
                </th>
                <th class="text-center">
                    Downloaded at
                </th>
                <th class="text-center">
                    Updated at
                </th>

                <th class="text-center">Action</th>
            </tr>
        </thead>
        <tbody>
            <?php
            foreach ($memberCertificates as $memberCertificate) {
                ?>
                <tr>
                    <td class="text-center"><?php echo $memberCertificate->certificate->id; ?></td>
                    <td class="text-center"><?php echo $memberCertificate->certificate->name; ?></td>
                    <td class="text-center">
                        <a href="<?php echo APP_SERVER_HOST_URL."certificate/".$memberCertificate->certificate->code."/".$memberCertificate->certificate->unique_string; ?>">
                        <?php echo APP_SERVER_HOST_URL."certificate/".$memberCertificate->certificate->code."/".$memberCertificate->certificate->unique_string; ?>
                        </a>
                    </td>
                    <td class="text-center"><?php echo $memberCertificate->downloaded == 1 ? "Already downloaded":"Not download yet"; ?></td>
                    <td class="text-center"><?php echo $memberCertificate->downloaded_at; ?></td>
                    <td class="text-center"><?php echo $memberCertificate->updated_at; ?></td>
                    <td class="text-center">
                        <?php if($memberCertificate->downloaded == 1){ ?>
                            <a href="#" title="Re-download" class="btn btn-primary" onclick="openRedownloadCertificate('<?php echo $memberCertificate->id ?>','<?php echo $memberCertificate->member_id ?>',0)">
                                <i class="fa fa-undo"></i>
                            </a>
                        <?php }else{ ?>
                            <a title="Revoke" href="#" class="btn btn-primary" onclick="openRedownloadCertificate('<?php echo $memberCertificate->id ?>','<?php echo $memberCertificate->member_id ?>',1)">
                                <i class="fa fa-repeat"></i>
                            </a>
                        <?php }?>
                    </td>
                </tr>
                <?php
            }
            ?>
            
        </tbody>
    </table>
</div>