dg
This commit is contained in:
parent
86c7e8dd1f
commit
aa2f3bf1eb
|
|
@ -1,192 +1,112 @@
|
|||
<?php $this->titre = "INTER SANTE - " . _("Liens de Parenté"); ?>
|
||||
|
||||
<div class="header-section mb-4">
|
||||
<div class="card border-0 shadow-sm border-start border-4 border-info">
|
||||
<div class="card-body p-3 d-flex align-items-center justify-content-between flex-wrap gap-2">
|
||||
|
||||
<!-- Titre + sous-titre -->
|
||||
<div>
|
||||
<h4 id="titre-page" class="mb-0 fw-bold text-uppercase">
|
||||
<i class="fa fa-sitemap me-2 text-info"></i>
|
||||
<?= _("Liens de Parenté") ?>
|
||||
</h4>
|
||||
<p class="text-muted small mb-0 mt-1">
|
||||
<i class="fa fa-cog me-1"></i>
|
||||
<?= _("Paramétrage des liens de parenté utilisés dans les dossiers patients") ?>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- Badge de contexte -->
|
||||
<span class="badge bg-info bg-opacity-10 text-info fw-bold px-3 py-2 rounded-pill">
|
||||
<i class="fa fa-sliders-h me-1"></i>
|
||||
<?= _("CONFIGURATION") ?>
|
||||
</span>
|
||||
<div class="page-content">
|
||||
<div class="header-section mb-4">
|
||||
<div class="d-flex flex-column flex-md-row align-items-md-center justify-content-between bg-white p-3 shadow-sm border-start border-info border-4" style="border-radius: var(--radius-md);">
|
||||
<div class="d-flex align-items-center">
|
||||
<div class="icon-shape bg-info-ghost text-info rounded-circle me-3" style="width: 48px; height: 48px; display: flex; align-items: center; justify-content: center;">
|
||||
<i class="fas fa-users fs-4"></i>
|
||||
</div>
|
||||
<div>
|
||||
<h4 id="titre-page" class="mb-0 fw-bold text-uppercase"><?= _("Liens de Parenté") ?></h4>
|
||||
<p class="text-muted small mb-0"><?= _("Configuration des degrés de parenté et règles d'activation") ?></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="position-relative mt-3 mt-md-0" style="min-width: 300px;">
|
||||
<i class="fas fa-search position-absolute top-50 start-0 translate-middle-y ms-3 text-muted"></i>
|
||||
<input type="text" id="globalSearch" class="form-control ps-5 border-2 rounded-pill shadow-none" style="font-size: 0.85rem;" placeholder="<?= _('Rechercher un lien...') ?>">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card border-0 shadow-sm overflow-hidden" style="border-radius: var(--radius-md);">
|
||||
<div class="card-body p-0">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover align-middle mb-0">
|
||||
<thead class="bg-light text-muted small text-uppercase">
|
||||
<tr>
|
||||
<th width="15%" class="ps-4 border-0 text-center"><?= _("Code") ?></th>
|
||||
<th class="border-0"><?= _("Désignation") ?></th>
|
||||
<th width="20%" class="border-0 text-center"><?= _("Statut Actif") ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($liensparente as $v):
|
||||
$idLien = $this->nettoyer($v['id']);
|
||||
$codeLienParente = $this->nettoyer($v['codeLienParente']);
|
||||
$enVigueur = $this->nettoyer($v['enVigueur']);
|
||||
$btnVisible = ($codeLienParente=="A" || $codeLienParente=="C" || $codeLienParente=="E") ? "1" : "0";
|
||||
|
||||
$libelle = est_anglophone() ? $this->nettoyer($v['libelleEng']) : $this->nettoyer($v['libelle']);
|
||||
$actifTxt = est_anglophone() ? ($enVigueur == "1" ? "Yes" : "No") : ($enVigueur == "1" ? "Oui" : "Non");
|
||||
?>
|
||||
<tr class="searchable-row">
|
||||
<td class="text-center">
|
||||
<span class="badge bg-primary-ghost text-primary fw-bold px-3 py-2" style="min-width: 45px;">
|
||||
<?= $codeLienParente ?>
|
||||
</span>
|
||||
</td>
|
||||
<td class="fw-bold text-dark"><?= $libelle ?></td>
|
||||
<td class="text-center">
|
||||
<?php if($enVigueur == "1"): ?>
|
||||
<?php if($btnVisible == "1"): ?>
|
||||
<span class="badge bg-success-ghost text-success rounded-pill px-3 py-2 fw-bold text-uppercase">
|
||||
<i class="fas fa-check-circle me-1"></i><?= $actifTxt ?>
|
||||
</span>
|
||||
<?php else: ?>
|
||||
<button class="btn btn-sm btn-primary rounded-pill px-4 fw-bold shadow-sm"
|
||||
onclick="javascript:modifier_lien_parente(<?= $idLien ?>)">
|
||||
<i class="fas fa-sync-alt me-1"></i><?= $actifTxt ?>
|
||||
</button>
|
||||
<?php endif; ?>
|
||||
<?php else: ?>
|
||||
<button class="btn btn-sm btn-danger rounded-pill px-4 fw-bold shadow-sm text-uppercase"
|
||||
onclick="javascript:modifier_lien_parente(<?= $idLien ?>)">
|
||||
<i class="fas fa-times-circle me-1"></i><?= $actifTxt ?>
|
||||
</button>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="div_maj_lien" tabindex="-1" aria-hidden="true">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ============================================================
|
||||
CARTE PRINCIPALE — Tableau des liens de parenté
|
||||
============================================================ -->
|
||||
<div class="card border-0 shadow-sm rounded-3">
|
||||
|
||||
<!-- En-tête de carte -->
|
||||
<div class="card-header card-header-neutral d-flex align-items-center justify-content-between flex-wrap gap-2 py-3 px-4">
|
||||
|
||||
<div class="d-flex align-items-center gap-2">
|
||||
<i class="fa fa-list-alt text-info"></i>
|
||||
<span class="fw-bold text-primary"><?= _("Liste des liens de parenté") ?></span>
|
||||
<!-- Compteur dynamique -->
|
||||
<span class="badge bg-primary-ghost fw-bold rounded-pill" id="counter-badge">
|
||||
<?= count($liensparente) ?> <?= _("entrées") ?>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<!-- Barre de recherche live -->
|
||||
<div class="input-group" style="max-width:260px;">
|
||||
<span class="input-group-text bg-light border-end-0">
|
||||
<i class="fa fa-search text-muted" style="font-size:.8rem;"></i>
|
||||
</span>
|
||||
<input
|
||||
type="text"
|
||||
id="searchInput"
|
||||
class="form-control form-control-sm border-start-0 bg-light"
|
||||
placeholder="<?= _("Filtrer les liens…") ?>"
|
||||
onkeyup="filterTable()"
|
||||
>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Corps de carte -->
|
||||
<div class="card-body p-0">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover align-middle mb-0" id="tableParente">
|
||||
|
||||
<!-- En-têtes -->
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th class="text-center text-uppercase small fw-bold text-muted ps-4" style="width:10%;">
|
||||
<?= _("Code") ?>
|
||||
</th>
|
||||
<th class="text-uppercase small fw-bold text-muted">
|
||||
<?= _("Désignation") ?>
|
||||
</th>
|
||||
<th class="text-center text-uppercase small fw-bold text-muted pe-4" style="width:14%;">
|
||||
<?= _("Statut") ?>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<!-- Corps dynamique -->
|
||||
<tbody>
|
||||
<?php foreach ($liensparente as $v):
|
||||
$idLien = $this->nettoyer($v['id']);
|
||||
$codeLienParente = $this->nettoyer($v['codeLienParente']);
|
||||
$libelle = $this->nettoyer($v['libelle']);
|
||||
$enVigueur = $this->nettoyer($v['enVigueur']);
|
||||
|
||||
$actif = ($enVigueur == "1") ? _("Oui") : _("Non");
|
||||
|
||||
/* Liens système non modifiables (A, C, E) */
|
||||
$btnVisible = ($codeLienParente == "A"
|
||||
|| $codeLienParente == "C"
|
||||
|| $codeLienParente == "E") ? "1" : "0";
|
||||
|
||||
if (est_anglophone()) {
|
||||
$libelle = $this->nettoyer($v['libelleEng']);
|
||||
$actif = ($enVigueur == "1") ? "Yes" : "No";
|
||||
}
|
||||
|
||||
/* Classes badge selon statut */
|
||||
$badgeClass = ($enVigueur == "1") ? "bg-success-ghost" : "bg-danger-ghost";
|
||||
$badgeIcon = ($enVigueur == "1") ? "fa-check-circle" : "fa-times-circle";
|
||||
?>
|
||||
<tr class="searchable-row" valign="top">
|
||||
|
||||
<!-- Code — badge neutre -->
|
||||
<td class="text-center ps-4">
|
||||
<span class="badge bg-primary-ghost fw-bold rounded-pill px-2">
|
||||
<?= $codeLienParente ?>
|
||||
</span>
|
||||
</td>
|
||||
|
||||
<!-- Désignation -->
|
||||
<td class="text-dark fw-bold">
|
||||
<?= $libelle ?>
|
||||
</td>
|
||||
|
||||
<!-- Statut + bouton conditionnel -->
|
||||
<td class="text-center pe-4">
|
||||
<?php if ($btnVisible == "0"): ?>
|
||||
<!-- Lien modifiable → bouton interactif -->
|
||||
<button
|
||||
class="btn-toggle-status <?= ($enVigueur == '1') ? 'active' : 'inactive' ?>"
|
||||
onclick="modifier_lien_parente(<?= $idLien ?>)"
|
||||
title="<?= _("Cliquer pour modifier le statut") ?>"
|
||||
>
|
||||
<i class="fa <?= $badgeIcon ?> me-1"></i>
|
||||
<?= strtoupper($actif) ?>
|
||||
</button>
|
||||
<?php else: ?>
|
||||
<!-- Lien système → badge statique non cliquable -->
|
||||
<span class="badge <?= $badgeClass ?> badge-pill px-3 py-1 fw-bold text-uppercase">
|
||||
<i class="fa <?= $badgeIcon ?> me-1"></i>
|
||||
<?= $actif ?>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
</div><!-- /table-responsive -->
|
||||
</div><!-- /card-body -->
|
||||
|
||||
<!-- Pied de carte -->
|
||||
<div class="card-footer bg-white border-top-0 px-4 py-2 d-flex justify-content-between align-items-center">
|
||||
<span class="text-muted small">
|
||||
<i class="fa fa-info-circle me-1 text-info"></i>
|
||||
<?= _("Les liens marqués en bleu sont des liens système non modifiables.") ?>
|
||||
</span>
|
||||
<span class="text-muted small" id="footer-count"></span>
|
||||
</div>
|
||||
|
||||
</div><!-- /card -->
|
||||
|
||||
<!-- ============================================================
|
||||
ZONE DE MISE À JOUR (inchangée — reçoit le formulaire AJAX)
|
||||
============================================================ -->
|
||||
<div id="div_maj_lien" class="mt-3"></div>
|
||||
|
||||
|
||||
<!-- ============================================================
|
||||
JS — Filtrage live du tableau
|
||||
============================================================ -->
|
||||
<script>
|
||||
function filterTable() {
|
||||
const input = document.getElementById('searchInput').value.toLowerCase();
|
||||
const rows = document.querySelectorAll('#tableParente .searchable-row');
|
||||
let visible = 0;
|
||||
|
||||
rows.forEach(row => {
|
||||
const text = row.textContent.toLowerCase();
|
||||
const show = text.includes(input);
|
||||
row.style.display = show ? '' : 'none';
|
||||
if (show) visible++;
|
||||
});
|
||||
|
||||
/* Mise à jour du compteur */
|
||||
document.getElementById('footer-count').textContent =
|
||||
visible + ' / ' + rows.length + ' <?= _("résultats") ?>';
|
||||
}
|
||||
|
||||
/* Initialisation du pied de tableau */
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const total = document.querySelectorAll('#tableParente .searchable-row').length;
|
||||
document.getElementById('footer-count').textContent =
|
||||
total + ' <?= _("entrées au total") ?>';
|
||||
});
|
||||
// RECHERCHE RAPIDE VANILLA JS
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
const searchInput = document.getElementById('globalSearch');
|
||||
if (searchInput) {
|
||||
searchInput.addEventListener('keyup', function() {
|
||||
const filter = this.value.toLowerCase();
|
||||
document.querySelectorAll('.searchable-row').forEach(row => {
|
||||
row.style.display = row.textContent.toLowerCase().includes(filter) ? "" : "none";
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
.table td {
|
||||
padding-top: 0.85rem;
|
||||
padding-bottom: 0.85rem;
|
||||
border-bottom: 1px solid #f1f4f6;
|
||||
}
|
||||
|
||||
.bg-info-ghost { background: rgba(0, 184, 212, 0.08) !important; color: #00b8d4 !important; }
|
||||
.bg-primary-ghost { background: rgba(33, 46, 83, 0.08) !important; color: #212e53 !important; }
|
||||
.bg-success-ghost { background: rgba(39, 174, 96, 0.12) !important; color: #27ae60 !important; }
|
||||
|
||||
/* Animation des boutons */
|
||||
.btn-sm { transition: all 0.2s ease; }
|
||||
.btn-sm:hover { transform: translateY(-1px); box-shadow: 0 4px 8px rgba(0,0,0,0.1) !important; }
|
||||
</style>
|
||||
Loading…
Reference in New Issue
Block a user