<?= $this->include('themes/_commonPartialsBs/datatables') ?>
<?= $this->extend('themes/vuexy/main/defaultlayout') ?>
<?= $this->section('content'); ?>
    <div class="row">
        <div class="col-md-12">
            <div class="card card-info">
                <div class="card-header">
                    <h3 class="card-title"><?= lang('RolesPermisos.pageTitle') ?></h3>
                </div><!--//.card-header -->
                <div class="card-body">
                    <div class="container-xxl flex-grow-1 container-p-y">
                        <!-- Role cards -->
                        <div class="row g-4">
                            <div class="col-xl-4 col-lg-6 col-md-6">
                                <div class="card h-100">
                                    <div class="row h-100">
                                        <div class="col-sm-5">
                                            <div class="d-flex align-items-end h-100 justify-content-center mt-sm-0 mt-3">
                                                <img
                                                        src="<?= site_url('themes/vuexy/img/illustrations/add-new-roles.png') ?>"
                                                        class="img-fluid mt-sm-4 mt-md-0"
                                                        alt="add-new-roles"
                                                        width="83"/>
                                            </div>
                                        </div>
                                        <div class="col-sm-7">
                                            <div class="card-body text-sm-end text-center ps-sm-0">
                                                <button
                                                        onclick="window.location='<?= route_to('newGroup') ?>'"
                                                        class="btn btn-primary mb-2 text-nowrap add-new-role"
                                                >
                                                    <?= lang('Basic.global.addNew') ?>
                                                </button>
                                                <p class="mb-0 mt-1"><?= lang("RolesPermisos.addRol") ?></p>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <?php foreach ($userGroupList as $item) : ?>
                                <div class="col-xl-4 col-lg-6 col-md-6">
                                    <div class="card">
                                        <div class="card-body">
                                            <div class="d-flex justify-content-between">
                                                <h6 class="fw-normal mb-2"><?= $model->getUsersWithRol($item->keyword); ?><?= lang("RolesPermisos.totalUsers") ?></h6>
                                            </div>
                                            <div class="d-flex justify-content-between align-items-end mt-1">
                                                <div class="role-heading">
                                                    <h4 class="mb-1"><?= esc($item->title) ?></h4>
                                                    <a href="<?= route_to('editGroup', $item->id) ?>">
                                                        <span><?= lang('Basic.global.edit') ?></span>
                                                    </a>
                                                </div>
                                                <?=
                                                anchor('#confirm2delete', "<i class='ti ti-trash ti-md'></i>",
                                                    [
                                                        'class' => 'text-muted',
                                                        'data-href' => route_to('deleteGroup', $item->id),
                                                        'data-bs-toggle' => 'modal',
                                                        'data-bs-target' => '#confirm2delete'
                                                    ]);
                                                ?>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            <?php endforeach; ?>
                        </div>
                        <!--/ Role cards -->
                    </div>
                    <?= view('themes/_commonPartialsBs/_alertBoxes'); ?>

                </div><!--//.card-body -->
                <div class="card-footer">

                </div><!--//.card-footer -->
            </div><!--//.card -->
        </div><!--//.col -->
    </div><!--//.row -->

<?= $this->endSection() ?>