newdesigngestionnaire/Vue/Usersgcassureur/index.php
2026-03-15 18:39:50 +00:00

145 lines
8.5 KiB
PHP
Executable File

<?php
$codeGcAssureur = $this->nettoyer($gc['codeGcAssureur']);
$nomGcAssureur = $this->nettoyer($gc['libelle']);
?>
<div class="page-content animate__animated animate__fadeIn">
<div class="header-section mb-4">
<div class="d-flex align-items-center justify-content-between bg-white p-3 shadow-sm border-start border-primary border-4" style="border-radius: var(--radius-md);">
<div class="d-flex align-items-center">
<div class="icon-shape bg-primary-ghost text-primary rounded-circle me-3" style="width: 48px; height: 48px; display: flex; align-items: center; justify-content: center;">
<i class="fas fa-user-shield fs-4"></i>
</div>
<div>
<h4 class="mb-0 fw-bold text-uppercase"><?= _("Gestion Accès Garant") ?></h4>
<p class="text-muted small mb-0"><?= $nomGcAssureur ?> — <?= _("Contrôle de la confidentialité et des utilisateurs") ?></p>
</div>
</div>
<button class="btn btn-primary rounded-pill px-4 fw-bold shadow-sm btn-sm" onclick="ajouter_utilisateur_gc();">
<i class="fas fa-user-plus me-1"></i> <?= _("Nouvel Utilisateur") ?>
</button>
</div>
</div>
<input type="hidden" id="codeGcAssureur" value="<?= $codeGcAssureur ?>">
<input type="hidden" id="idGc" value="<?= $this->nettoyer($gc['id']) ?>">
<div class="card border-0 shadow-sm">
<div class="card-body p-0">
<div class="table-responsive">
<table class="table table-hover align-middle mb-0 datatable-users" style="width:100%; font-size: 9.5pt;">
<thead class="bg-light">
<tr>
<th class="py-3 ps-3">Login</th>
<th class="py-3"><?= _("Utilisateur") ?></th>
<th class="py-3 text-center"><?= _("Langue") ?></th>
<th class="py-3 text-center"><?= _("Voir Actes") ?></th>
<th class="py-3 text-center"><?= _("Voir Affections") ?></th>
<th class="py-3 text-center"><?= _("État Compte") ?></th>
<th class="py-3 text-center"><?= _("Actions") ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($users as $user_gc):
$id = $user_gc['idUtilisateur'];
$code = $user_gc['codeUtilisateur'];
$isActVisible = ($user_gc['actVisible'] == 1);
$isAffectionVisible = ($user_gc['AffectionVisible'] == 1);
$isActif = ($user_gc['actif'] == 1);
// Logique des drapeaux
$flag = ($user_gc['codeLangue'] == "en_US") ? "england.png" : "france.png";
$alt = ($user_gc['codeLangue'] == "en_US") ? 'English' : 'Français';
?>
<tr>
<td class="ps-3 fw-bold text-primary"><?= $this->nettoyer($code) ?></td>
<td>
<div class="fw-bold"><?= $this->nettoyer($user_gc['utilisateur']) ?></div>
<small class="text-muted">ID: #<?= $id ?></small>
</td>
<td class="text-center">
<img src="Bootstrap_new/images/<?= $flag ?>"
alt="<?= $alt ?>"
title="<?= $user_gc['codeLangue'] ?>"
class="shadow-xs border"
style="width: 22px; border-radius: 2px;">
</td>
<td class="text-center">
<div class="form-check form-switch d-inline-block">
<input class="form-check-input cursor-pointer" type="checkbox"
<?= ($isActVisible) ? 'checked' : '' ?>
onchange="gerer_acces_actes_gc('<?= $code ?>', '<?= $user_gc['actVisible'] ?>');">
<i class="fas <?= ($isActVisible) ? 'fa-eye text-success' : 'fa-eye-slash text-muted' ?> ms-1"></i>
</div>
</td>
<td class="text-center">
<div class="form-check form-switch d-inline-block">
<input class="form-check-input cursor-pointer" type="checkbox"
<?= ($isAffectionVisible) ? 'checked' : '' ?>
onchange="gerer_acces_affection_gc('<?= $code ?>', '<?= $user_gc['AffectionVisible'] ?>');">
<i class="fas <?= ($isAffectionVisible) ? 'fa-eye text-success' : 'fa-eye-slash text-muted' ?> ms-1"></i>
</div>
</td>
<td class="text-center">
<?php if($isActif): ?>
<span class="badge rounded-pill bg-success-light text-success px-3 py-2">
<i class="fas fa-lock-open me-1"></i> <?= _("Ouvert") ?>
</span>
<?php else: ?>
<span class="badge rounded-pill bg-danger-light text-danger px-3 py-2">
<i class="fas fa-lock me-1"></i> <?= _("Bloqué") ?>
</span>
<?php endif; ?>
</td>
<td class="text-center">
<div class="btn-group shadow-xs rounded-pill bg-white border p-1">
<button class="btn btn-link btn-sm text-primary p-1 mx-1 action-icon" title="<?= _("Éditer") ?>" onclick="afficher_users_gc_id(<?= $id ?>);">
<i class="fas fa-user-edit"></i>
</button>
<button class="btn btn-link btn-sm text-info p-1 mx-1 action-icon" title="<?= _("Réinitialiser le mot de passe") ?>" onclick="reinitpaswd_gc('<?= $code ?>');">
<i class="fas fa-key"></i>
</button>
<button class="btn btn-link btn-sm <?= $isActif ? 'text-danger' : 'text-success' ?> p-1 mx-1 action-icon"
title="<?= $isActif ? _("Désactiver l'utilisateur") : _("Activer l'utilisateur") ?>"
onclick="<?= $isActif ? "desactiver_user_gc('$code')" : "activer_user_gc('$code')" ?>;">
<i class="fas <?= $isActif ? 'fa-user-slash' : 'fa-user-check' ?>"></i>
</button>
</div>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<style>
.bg-primary-ghost { background-color: rgba(33, 46, 83, 0.08); }
.bg-success-light { background-color: rgba(25, 135, 84, 0.1); }
.bg-danger-light { background-color: rgba(220, 53, 69, 0.1); }
.cursor-pointer { cursor: pointer; }
.form-switch .form-check-input { width: 2.2em; height: 1.1em; cursor: pointer; border-color: #dee2e6; }
.btn-link { text-decoration: none; border: none; background: transparent; transition: all 0.2s ease-in-out; }
.action-icon:hover { transform: scale(1.25); }
.datatable-users thead th { vertical-align: middle; border-bottom: 2px solid #eee; }
.table-hover tbody tr:hover { background-color: rgba(33, 46, 83, 0.02); }
</style>
<script>
var checkDTUsers = setInterval(function() {
if (typeof initSmartTable === 'function') {
initSmartTable('.datatable-users', 'Utilisateurs_Portail_Garant', false);
clearInterval(checkDTUsers);
}
}, 100);
</script>