This commit is contained in:
KONE SOREL 2026-03-06 16:13:31 +00:00
parent 644668f39c
commit db7dab347c
3 changed files with 154 additions and 82 deletions

View File

@ -48254,36 +48254,60 @@ function cocherDecocherUn(fichier_lister,id){
}
function filtreTableReference(numeroTable){
function filtreTableReference(numeroTable) {
const racineWeb = $("#racineWeb").val();
const codeLangue = $("#codeLangue").val();
const div_liste_tables = $("#div_listetables");
donnees = "numeroTable="+numeroTable;
$("#div_lister_table").html("");
$('#div_fichiers_table').html("");
$('#div_entete_table').html("");
//alert(donnees);
//return;
$.ajax({
url: $("#racineWeb").val()+"Ajaxfiltretablesreference/",
type : 'post',
data: donnees,
error: function(errorData) {
// alert("Erreur : "+errorData);
},
success: function(data) {
// alert("Success : "+data);
$("#div_listetables").html(data);
$("#listetables").selectpicker();
},
complete: function() {
}
});
// 1. Réinitialisation complète des zones de travail
// On vide tout pour que l'utilisateur sache qu'il change de contexte
$("#div_lister_table").html("");
$('#div_fichiers_table').html("");
$('#div_entete_table').html("");
$('#div_maj_table').html(""); // On vide aussi la zone de saisie/modification
// 2. Préparation des données (Format Objet)
const donnees = { numeroTable: numeroTable };
// 3. Effet de chargement sur le menu déroulant
div_liste_tables.css('opacity', '0.5');
// 4. Appel AJAX
$.ajax({
url: racineWeb + "Ajaxfiltretablesreference/",
type: 'post',
data: donnees,
success: function(data) {
// Mise à jour du sélecteur de tables
div_liste_tables.html(data);
// Ré-initialisation du SelectPicker (Bootstrap-select)
// setTimeout permet de s'assurer que le DOM est prêt
setTimeout(function() {
const $select = $("#listetables");
$select.selectpicker('refresh');
$select.selectpicker('focus');
}, 50);
// Notification discrète (Optionnel)
if (typeof toastr !== 'undefined') {
let msg = (codeLangue === "en_US") ? "Tables updated" : "Tables mises à jour";
toastr.info(msg);
}
},
error: function(xhr) {
console.error("Erreur de filtrage :", xhr.statusText);
let errorMsg = (codeLangue === "en_US") ? "Error loading tables" : "Erreur lors du chargement des tables";
alert_ebene(errorMsg, errorMsg);
},
complete: function() {
// Rétablir l'opacité
div_liste_tables.css('opacity', '1');
}
});
}
function supprimer_choix(){
var fichier_lister = $('#fichier_lister').val();

View File

@ -1,3 +1,23 @@
<select style="font-size:15pt;" name="listetables" id="listetables" class="form-control selectpicker" data-live-search="true" onchange="JAVASCRIPT:chargerFichiersTable();" autofocus>
<?= liste_options($autrestables,'',false) ?>
</select>
<div class="input-group input-group-lg shadow-sm">
<span class="input-group-text bg-white border-primary-subtle text-primary">
<i class="fas fa-search-plus"></i>
</div>
<select name="listetables"
id="listetables"
class="form-select selectpicker show-tick"
data-live-search="true"
data-size="10"
data-style="btn-white border-primary-subtle fw-bold"
onchange="chargerFichiersTable();"
autofocus>
<option value="" data-icon="fas fa-hand-pointer"><?= _("--- Choisir une table à gérer ---") ?></option>
<?= liste_options($autrestables, '', false) ?>
</select>
</div>
<div class="mt-2">
<small class="text-muted italic ps-2">
<i class="fas fa-info-circle me-1"></i>
<?= _("Tapez le nom d'une table pour filtrer rapidement la liste.") ?>
</small>
</div>

View File

@ -1,58 +1,86 @@
<?php $this->titre = "INTER SANTE - Tables de Référence"; ?>
<div class="page-content">
<div class="header-section mb-4">
<div class="d-flex align-items-center bg-white p-3 shadow-sm border-start border-primary border-4" style="border-radius: var(--radius-md);">
<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-database fs-4"></i>
</div>
<div>
<h4 id="titre-page" class="mb-0 fw-bold text-uppercase"><?= _("Tables de Référence") ?></h4>
<p class="text-muted small mb-0"><?= _("Configuration des listes de données du système") ?></p>
</div>
</div>
</div>
<div class="card border-0 shadow-sm mb-4" style="border-radius: var(--radius-md);">
<div class="card-body p-4">
<div class="row align-items-center">
<div class="col-lg-3">
<h6 class="fw-bold text-muted mb-lg-0 mb-3 small text-uppercase">
<i class="fas fa-filter me-2"></i><?= _("Filtrer par Module") ?>
</h6>
</div>
<div class="col-lg-9 text-lg-end">
<div class="btn-group w-100 shadow-xs" role="group" aria-label="Filtre table">
<?php
$modules = est_anglophone() ?
[1 => 'General', 2 => 'Production', 3 => 'Medical and Claims', 5 => 'Accounting'] :
[1 => 'Générale', 2 => 'Production', 3 => 'Médical et Sinistre', 5 => 'Comptabilité'];
foreach($modules as $val => $libelle): ?>
<input type="radio" class="btn-check" name="numeroTable" id="btnTable<?= $val ?>" value="<?= $val ?>" <?= $val == 1 ? 'checked' : '' ?> autocomplete="off" onClick="filtreTableReference(this.value);">
<label class="btn btn-outline-primary py-2 fw-medium" for="btnTable<?= $val ?>"><?= $libelle ?></label>
<?php endforeach; ?>
</div>
</div>
</div>
</div>
</div>
<legend> <?= _("Tables de référence") ?> </legend>
<table width= "100%" class="table-responsive" id="tabfiltre">
<tbody>
<tr>
<td style="font-size:15pt;" width="20%" class="text-center"><?= _("Sélectionner une option") ?></td>
<td class="text-center" style="font-size:12pt;">
<?php if (est_anglophone()) : ?>
<INPUT type="radio" id="numeroTable1" name="numeroTable" value="1" checked onClick="filtreTableReference($('#numeroTable1').val());"><label class="inline" for="general">General</label>
<INPUT type="radio" id="numeroTable2" name="numeroTable" value="2" onClick="filtreTableReference($('#numeroTable2').val());"><label class="inline" for="production">Production</label>
<INPUT type="radio" id="numeroTable3" name="numeroTable" value="3" onClick="filtreTableReference($('#numeroTable3').val());"><label class="inline" for="medical">Medical and Claims</label>
<INPUT type="radio" id="numeroTable5" name="numeroTable" value="5" onClick="filtreTableReference($('#numeroTable5').val());"><label class="inline" for="comptabilite">Accounting</label>
<?php else: ?>
<INPUT type="radio" id="numeroTable1" name="numeroTable" value="1" checked onClick="filtreTableReference($('#numeroTable1').val());"><label class="inline" for="general">Générale</label>
<INPUT type="radio" id="numeroTable2" name="numeroTable" value="2" onClick="filtreTableReference($('#numeroTable2').val());"><label class="inline" for="production">Production</label>
<INPUT type="radio" id="numeroTable3" name="numeroTable" value="3" onClick="filtreTableReference($('#numeroTable3').val());"><label class="inline" for="medical">Médical et Sinistre</label>
<INPUT type="radio" id="numeroTable5" name="numeroTable" value="5" onClick="filtreTableReference($('#numeroTable5').val());"><label class="inline" for="comptabilite">Comptabilité</label>
<?php endif; ?>
</td>
</tr>
</tbody>
</table>
<table class="table table-responsive table-condensed">
<tbody>
<tr>
<td class="text-center">
<div id="div_listetables">
<select style="font-size:15pt;" name="listetables" id="listetables" class="form-control selectpicker" data-live-search="true" onchange="JAVASCRIPT:chargerFichiersTable();" autofocus>
<?= liste_options($autrestables,'',false) ?>
</select>
</div>
</td>
</tr>
</tbody>
</table>
<div class="card border-0 shadow-sm mb-4">
<div class="card-body p-3 bg-light-subtle rounded border border-primary-subtle border-dashed">
<div class="row align-items-center">
<div class="col-md-2 text-md-end text-primary fw-bold small">
<?= _("TABLE À CONSULTER") ?> :
</div>
<div class="col-md-10" id="div_listetables">
<select name="listetables" id="listetables" class="form-select selectpicker show-tick" data-live-search="true" data-size="8" onchange="chargerFichiersTable();">
<?= liste_options($autrestables,'',false) ?>
</select>
</div>
</div>
</div>
</div>
<div id="div_fichiers_table">
<div class="row g-4">
<div class="col-lg-4">
<div id="div_maj_table" class="sticky-top" style="top: 20px; z-index: 10;">
</div>
</div>
<div class="col-lg-8">
<div id="div_lister_table">
<div class="text-center p-5 bg-white rounded shadow-xs border">
<div class="icon-shape bg-light text-muted rounded-circle mx-auto mb-3" style="width: 60px; height: 60px; display: flex; align-items: center; justify-content: center;">
<i class="fas fa-table-list fa-2x"></i>
</div>
<h6 class="text-muted fw-bold"><?= _("Veuillez sélectionner une table pour afficher ses données") ?></h6>
</div>
</div>
</div>
</div>
<div id="div_fichiers_table" class="d-none"></div>
<div id="div_entete_table" class="d-none"></div>
</div>
<div id="div_entete_table">
</div>
<div id="div_maj_table">
</div>
<div id="div_lister_table">
</div>
<style>
.btn-check:checked + .btn-outline-primary { background-color: #212e53 !important; border-color: #212e53 !important; color: white; }
.btn-outline-primary { color: #212e53; border-color: #dee2e6; background-color: white; }
.btn-outline-primary:hover { background-color: #f8f9fa; color: #212e53; border-color: #212e53; }
.border-dashed { border-style: dashed !important; }
.bg-primary-ghost { background: rgba(33, 46, 83, 0.08) !important; }
/* Animation pour les listes chargées */
#div_lister_table, #div_maj_table { transition: opacity 0.3s ease; }
</style>