<table id="list" class="table table-bordered table-striped table-highlight">

    <?php $this->load->view('partials/sub_table_header.php'); ?>

    <form action="<?php echo base_url('admin/' . $dir . '/sub_delete/'); ?>" id="delete-form"
          method="POST" class="form-horizontal">
        <tbody>
        <?php foreach ($rows as $row): ?>
            <tr>
                <td style="text-align:center;"><input type="checkbox" name="sub_ele[]"
                                                      id="sub_ele_<?php echo $row->id; ?>"
                                                      class="sub_ele"
                                                      value="<?php echo $row->id; ?>"/></td>
                <?php foreach ($fields as $field_name => $field_display): ?>
                    <?php if ($field_display == 'Imagen') { ?>
                        <td>
                            <a class="sub_edit"
                               href="<?php echo site_url('admin/' . $dir . '/sub_edit/' . $row->id); ?>"><img
                                    class="min-back"
                                    src="<?php echo base_url('assets/archivos/' . $dir . '/original/' . $row->foto); ?>"
                                    alt="" style="opacity: 1; "> </a>
                        </td>
                    <?php } else if ($field_display == 'Principal') { ?>
                        <td>

                            <a class="sub_edit"
                               href="<?php echo site_url('admin/' . $dir . '/sub_edit/' . $row->id); ?>">
                                <?php if ($row->$field_name == 1) echo 'Si'; else echo 'No'; ?>
                            </a>

                        </td>

                    <?php } else if ($field_display == 'Creado' || $field_display == 'Modificado') { ?>
                        <td>

                            <a class="sub_edit"
                               href="<?php echo site_url('admin/' . $dir . '/edit/' . $row->id); ?>">
                                <?php echo date("d-m-Y H:i:s", strtotime($row->$field_name)); ?>
                            </a>

                        </td>
                    <?php } else if ($field_display == 'Habilitado') { ?>
                        <td>

                            <a class="sub_edit"
                               href="<?php echo site_url('admin/' . $dir . '/sub_edit/' . $row->id); ?>">
                                <?php if ($row->$field_name == 1) echo 'Si'; else echo 'No'; ?>
                            </a>

                        </td>
                    <?php } else { ?>
                        <td>
                            <a class="sub_edit"
                               href="<?php echo site_url('admin/' . $dir . '/sub_edit/' . $row->id); ?>"><?php echo character_limiter($row->$field_name, 120); ?></a>
                        </td>
                        <?php
                    }
                endforeach; ?>
            </tr>
        <?php endforeach; ?>
        </tbody>
    </form>
</table>