<h5 class="p-2">All Permissions <span class="float-sm-end">
    <?php if(has_permission('systempermissions.managepermission')):?>
    <button type="button" class="btn btn-sm btn-primary" data-bs-toggle="modal" data-bs-target="#permissionModal">Add</button>
    <?php endif;?>
</span></h5>
<div class="table-responsive">
    <table class="table table-sm table-striped" id="permissionTable">
        <thead class="bg-dark text-white" style="font-size:12px;width:100%">
            <tr>
                <th width="5%">#ID</th>
                <th width="55%">Name</th>
                <th width="10%">Section</th>
                <th width="10%">Parent</th>
                <th width="15%">Module</th>
                <th width="5%"></th>
            </tr>
        </thead>
        <tbody style="font-size:12px;">
            <?php foreach($perms as $p):?>
            <tr>
                <td><?= $p->id;?></td>
                <td>
                    <strong><?= $p->name; ?></strong><br/><small><?= $p->description ?></small>
                </td>
                <td><?= $p->section_name;?></td>
                <td><small class="text-primary"><?= $p->parent_name; ?></small></td>
                <td><?= $p->module; ?></td>
                <td>
                    <div class="btn-group">
                        <?php if(has_permission('systempermissions.managepermission')):?>
                            <button  class="btn btn-sm btn-outline-info rounded-circle me-2 edit-permission" data-id="<?= $p->id; ?>"><small><i class="bi bi-pencil"></i></small>
                            </button>
                        <?php endif;?>
                        <?php if(has_permission('systempermissions.deletepermission')):?>
                            <button  class="btn btn-sm btn-outline-danger rounded-circle delete-permission" onclick="delete_permission(<?= $p->id; ?>, '<?= $p->name; ?>')"><small><i class="bi bi-trash"></i></small>
                            </button>
                        <?php endif;?>
                    </div>
                </td>
            </tr>
            <?php endforeach;?>
        </tbody>
    </table>
</div><!-- All permissions !-->