<h3>Group Permissions</h3>
                <div class="accordion py-3" id="accordionExample">
                                    <?php foreach ($groups as $group): ?>
                                    <div class="accordion-item">
                                        <h2 class="accordion-header">
                                        <button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#collapse<?= $group->id;?>" aria-expanded="true" aria-controls="collapse<?= $group->id;?>">
                                            <strong><?= $group->name;?></strong>
                                        </button>
                                        </h2>
                                        <div id="collapse<?= $group->id;?>" class="accordion-collapse collapse  " data-bs-parent="#accordionExample">
                                            <div class="accordion-body">
                                                <h5>Current Permissions
                                                <p class="d-inline-flex gap-1">
                                                    <a class="btn btn-warning" data-bs-toggle="collapse" href="#multiCollapseExample1" role="button" aria-expanded="false" aria-controls="multiCollapseExample1">Show</a>
                                                </p>
                                                <div class="row">
                                                    <div class="col-md-12">
                                                        <div class="collapse multi-collapse" id="multiCollapseExample1"><small>
                                                            <div id="currentPermissions<?= $group->id ?>" class="mb-3">
                                                            <!-- Loaded via AJAX -->
                                                            </div></small>
                                                        </div>
                                                    </div>
                                                </div>
                                                </h5>

                                                <hr/>
                                                <h5>Available Permissions</h5>
                                                <div class="permissions-grid">
                                                    <div class="row">
                                                        <?php foreach($sections as $s):?>
                                                        <div class="col-12 mb-1">
                                                            <div class="accordion accordion-flush" id="accordionFlushExample">
                                                                <div class="accordion-item">
                                                                    <h2 class="accordion-header">
                                                                    <button class="accordion-button collapsed alert alert-warning" type="button" data-bs-toggle="collapse" data-bs-target="#flush-collapse<?= $s->id;?>" aria-expanded="false" aria-controls="flush-collapse<?= $s->id;?>">
                                                                        <strong><?= $s->name; ?></strong>
                                                                    </button>
                                                                    </h2>
                                                                    <div id="flush-collapse<?= $s->id;?>" class="accordion-collapse collapse" data-bs-parent="#accordionFlushExample">
                                                                        <div class="accordion-body">
                                                                            <div class="row">
                                                                                <?php foreach ($permissions as $perm): ?>
                                                                                    <?php if($s->id == $perm->module_section_id):?>
                                                                                    <div class="col-md-6" style="font-size:12px;">
                                                                                        <div class="form-check">
                                                                                            <input type="checkbox" 
                                                                                                    class="form-check-input perm-checkbox" 
                                                                                                    data-group="<?= $group->id ?>" 
                                                                                                    data-perm="<?= $perm->id ?>"
                                                                                                    id="perm_<?= $group->id ?>_<?= $perm->id ?>">
                                                                                                <label class="form-check-label" for="perm_<?= $group->id ?>_<?= $perm->id ?>">
                                                                                                    <?= $perm->name ?> <small class="text-muted">(<?= $perm->module ?>)</small>
                                                                                                </label>
                                                                                        </div>
                                                                                    </div>
                                                                                    <?php endif;?>
                                                                                <?php endforeach; ?>
                                                                                
                                                                            </div><!-- row !-->
                                                                        </div>
                                                                    </div>
                                                                </div><!-- Module Sectin Accordion Item !-->
                                                            </div><!-- Accordion !-->
                                                        </div>
                                                        <?php endforeach;?>
                                                    </div>
                                                </div>


                                            </div>
                                        </div>
                                    </div><!-- accordion item !-->
                                    <?php endforeach;?>
                                </div><!-- Accordion Full !-->
            