<!-- Begin Page Content -->
<div class="container-fluid">
    <div class="row column_title">
        <div class="col-md-12">
            <div class="page_title">
                <h2>Inviation Codes</h2>
            </div>
        </div>
    </div>

    <div class="card shadow mb-4">
        <div class="card-header py-3">
            <button class="btn btn-primary" onclick="window.location.href='<?php echo base_url();?>dashboard/generateCode'">Generate New Code</button>
        </div>
        <div class=" card-body">
            <div class="table-responsive">
                <table class="table table-bordered" id="songTable" width="100%" cellspacing="0">
                    <thead class="thead-dark">
                        <tr>
                            <th>Serial Number</th>
                            <th>Code</th>
                            <th>Used</th>

                        </tr>
                    </thead>
                    <tbody>

                        <?php
                        if (!empty($codes)) {



                            $count = 1;
                            foreach ($codes as $id => $code) {
                                $used = $code['used'] ? "Used" : "Not Used";

                        ?>
                        <tr>

                            <td><?php echo $count; ?></td>
                            <td><?php echo output($code['code']); ?></td>
                            <td> <?php echo output($used); ?></td>


                        </tr>
                        <?php $count++; }
                        }

                         ?>
                    </tbody>
                </table>
            </div>
        </div>
    </div>

</div>
<!-- /.container-fluid -->
<div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
    <form method="post" action="<?=base_url('customer/sendWarning')?>">
        <input id="user-id" type="hidden" name="userid" value="" />
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title" id="exampleModalLabel">Send Warning to "<spna id="user-name"></spna>"
                    </h5>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <div class="modal-body">
                    <form>

                        <div class="form-group">
                            <label for="message-text" class="col-form-label">Warning Message:</label>
                            <textarea class="form-control" id="message-text" rows="5" name="message" required></textarea>
                        </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
                    <button type="submit" class="btn btn-primary">Send Warning</button>
                </div>
            </div>
        </div>
    </form>
</div>