Arreglando grupos de usuarios

This commit is contained in:
imnavajas
2024-05-03 16:36:02 +02:00
parent 9858616b6e
commit c152cf699d
12 changed files with 186 additions and 198 deletions

View File

@ -11,32 +11,21 @@
<?= formAlert() ?>
<form id="groupForm" method="post" class="card-body" action="<?= $formAction ?>">
<?= csrf_field() ?>
<input type="hidden"
name="id_group"
value="<?= (isset($obj)) ? $obj['id_group'] : set_value('id_group') ?>"
>
<input type="hidden"
name="token"
value="<?= (isset($obj)) ? $obj['token'] : set_value('token') ?>"
>
<div class="row g-3">
<input type="hidden"
name="id_group"
value="<?= old('id', $group->id) ?>"
>
<div class="col-md-6">
<label for="title" class="form-label text-dark">
<?= lang("App.group_field_title") ?>
</label>
<input type="text" name="title" id="title" class="form-control"
value="<?= old('title', $group->title) ?>">
</div>
<div class="col-md-6">
<label for="dashboard" class="form-label text-dark">
<?= lang("App.group_field_dashboard") ?>
</label>
<?php $id_select = (isset($group)) ? $group->dashboard : set_value('dashboard'); ?>
<select name="dashboard" id="dashboard" class="select2 form-control">
<option value="user" <?= $id_select == "user" ? 'selected' : '' ?>><?= lang("App.group_label_user") ?></option>
<option value="admin" <?= $id_select == "admin" ? 'selected' : '' ?>><?= lang("App.group_label_admin") ?></option>
</select>
<input type="text" name="name" id="name" class="form-control"
value="<?= old('name', $group->name) ?>">
</div>
</div>
<div class="row g-3 mt-3">
<div class="col-md-6">
<button type="button" name="select_all"
id="select_all"
@ -120,15 +109,15 @@
<?= $this->section('additionalInlineJs') ?>
$('#select_all').on('click', function () {
$('#select_all').on('click', function () {
$(':checkbox').each(function() {
this.checked = true;
this.checked = true;
});
});
$('#remove_all').on('click', function () {
});
$('#remove_all').on('click', function () {
$(':checkbox').each(function() {
this.checked = false;
});
this.checked = false;
});
});
<?= $this->endSection() ?>

View File

@ -43,12 +43,12 @@
<div class="card">
<div class="card-body">
<div class="d-flex justify-content-between">
<h6 class="fw-normal mb-2"><?= $model->getUsersWithRol($item->token); ?> usuarios en total</h6>
<h6 class="fw-normal mb-2"><?= $model->getUsersWithRol($item->keyword); ?> usuarios en total</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_group) ?>">
<h4 class="mb-1"><?= esc($item->name) ?></h4>
<a href="<?= route_to('editGroup', $item->id) ?>">
<span><?= lang('Basic.global.edit') ?></span>
</a>
</div>
@ -56,7 +56,7 @@
anchor('#confirm2delete', "<i class='ti ti-trash ti-md'></i>",
[
'class' => 'text-muted',
'data-href' => route_to('deleteGroup', $item->id_group),
'data-href' => route_to('deleteGroup', $item->id),
'data-bs-toggle' => 'modal',
'data-bs-target' => '#confirm2delete'
]);