This commit is contained in:
KONE SOREL 2026-03-16 10:04:59 +00:00
parent 36e4af9ff2
commit a57486a0af
2 changed files with 148 additions and 96 deletions

View File

@ -1,81 +1,107 @@
<?php
$superUser = $_SESSION['superUser'];
$nbreTotal = count($produits);
if($nbreTotal < 10){
$nbreTotal = '0'.$nbreTotal;
}else{
$nbreTotal = format_N($nbreTotal);
}
$superUser = $_SESSION['superUser'];
$nbreTotal = count($produits);
$displayTotal = ($nbreTotal < 10) ? '0'.$nbreTotal : format_N($nbreTotal);
?>
<table style="margin: auto" class="table-responsive">
<tbody>
<td><input class="form-control" style="text-align: center; font-size:10pt;" type="text" id="nbreTotal" name="nbreTotal" value="Total enregistré : <?= $nbreTotal; ?>" readonly> </td>
</tbody>
</table>
<div class="animate__animated animate__fadeIn">
<div class="d-flex justify-content-end mb-3">
<span class="badge bg-white border text-primary rounded-pill px-3 py-2 shadow-xs">
<i class="fas fa-layer-group me-2"></i><?= _("Total enregistré :") ?> <span class="fw-bold"><?= $displayTotal ?></span>
</span>
</div>
<input type="hidden" id="total" value="<?= $nbreTotal; ?>">
<input type="hidden" id="total" value="<?= $displayTotal ?>">
<table class="table table-striped table-bordered table-hover table-condensed table-responsive tabliste compact" style="font-size:10pt;">
<thead>
<tr>
<th style="text-align:center" > <?= _("Code") ?> </th>
<th style="text-align:center" > <?= _("Produit") ?> </th>
<th style="text-align:center" > <?= _("Mode Calcul Prime") ?> </th>
<th style="text-align:center" > <?= _("Action") ?> </th>
<th style="text-align:center" > <?= _("Archivage") ?> </th>
<th style="text-align:center" > <?= _("Garanties") ?> </th>
</tr>
</thead>
<tbody>
<?php foreach ($produits as $produit):
$idProduit = $this->nettoyer($produit['id']);
$codeModecalculPrime = $this->nettoyer($produit['codeModecalculPrime']);
$libelleProduit = $this->nettoyer($produit['libelle']);
$modeprime = $this->nettoyer($produit['modeprime']);
if (est_anglophone()){
$libelleProduit = $this->nettoyer($produit['libelleEng']);
$modeprime = $this->nettoyer($produit['modeprimeEng']);
}
$produitArchive = $this->nettoyer($produit['produitArchive']);
$dansBareme = $this->nettoyer($produit['dansBareme']);
$aGarantie = $this->nettoyer($produit['aGarantie']);
?>
<?php if($codeModecalculPrime=='TA'): ?>
<tr valign="top" style="background-color: #ffefd5;">
<?php else: ?>
<tr valign="top">
<?php endif; ?>
<td align="center" width="10%"> <?= $this->nettoyer($produit['codeProduit']) ?> </td>
<td> <?= $libelleProduit ?> </td>
<td style='text-align:center' width="20%"> <?= $modeprime ?> </td>
<?php if($produitArchive =='1'): ?>
<td width="8%"> <input class = "form-control btn btn-info" style="font-size:10pt;" type="button" value="<?= _("Consulter") ?>" onClick="javascript:consulter_produit(<?= $idProduit ?>);"> </td>
<?php if ($superUser=="1"): ?>
<td width="8%"> <input style="font-size:10pt;" class = "form-control btn btn-danger" type="button" value="<?= _("Désarchiver") ?>" onClick="javascript:de_archiver_produit('<?= $idProduit ?>', '<?= $dansBareme ?>');"></td>
<?php else : ?>
<td width="8%"> </td>
<?php endif; ?>
<?php else: ?>
<td width="8%"> <input class = "form-control btn btn-primary" style="font-size:10pt;" type="button" value="<?= _("Modifier") ?>" onClick="javascript:modifier_produit(<?= $idProduit ?>);"> </td>
<?php if($aGarantie =='1'): ?>
<td width="8%"> <input style="font-size:10pt; color: white; background-color: orange;" class = "form-control btn" type="button" value="<?= _("Archiver") ?>" onClick="javascript:archiver_produit('<?= $idProduit ?>');"></td>
<?php else : ?>
<td width="8%"> </td>
<?php endif; ?>
<?php endif; ?>
<td width="8%" align="center"> <input class = "form-control btn btn-success" style="font-size:10pt;" type="button" value="<?= _("Garanties") ?>" onClick="javascript:garanties_produit(<?= $idProduit ?>);"> </td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<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-produits" style="width:100%; font-size: 9.5pt;">
<thead class="bg-light">
<tr>
<th class="py-3 ps-3" width="10%"><?= _("Code") ?></th>
<th class="py-3"><?= _("Libellé du Produit") ?></th>
<th class="py-3 text-center"><?= _("Mode Calcul Prime") ?></th>
<th class="py-3 text-center" width="200px"><?= _("Actions") ?></th>
<th class="py-3 text-center" width="120px"><?= _("Garanties") ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($produits as $produit):
$idProduit = $this->nettoyer($produit['id']);
$codeModecalculPrime = $this->nettoyer($produit['codeModecalculPrime']);
$libelleProduit = est_anglophone() ? $this->nettoyer($produit['libelleEng']) : $this->nettoyer($produit['libelle']);
$modeprime = est_anglophone() ? $this->nettoyer($produit['modeprimeEng']) : $this->nettoyer($produit['modeprime']);
$isArchive = ($this->nettoyer($produit['produitArchive']) == '1');
$dansBareme = $this->nettoyer($produit['dansBareme']);
$aGarantie = ($this->nettoyer($produit['aGarantie']) == '1');
// Style spécifique pour les types 'TA'
$rowClass = ($codeModecalculPrime == 'TA') ? 'bg-warning-ghost' : '';
?>
<tr class="<?= $rowClass ?>">
<td class="ps-3 fw-bold text-primary"><?= $this->nettoyer($produit['codeProduit']) ?></td>
<td>
<div class="fw-bold"><?= $libelleProduit ?></div>
<?php if($isArchive): ?>
<span class="badge bg-danger-light text-danger" style="font-size: 7pt;"><?= _("ARCHIVÉ") ?></span>
<?php endif; ?>
</td>
<td class="text-center">
<span class="badge bg-light text-dark border fw-normal px-2"><?= $modeprime ?></span>
</td>
<td class="text-center">
<div class="btn-group shadow-xs rounded-pill bg-white border p-1">
<?php if($isArchive): ?>
<button class="btn btn-link btn-sm text-info p-1 mx-1 action-icon" title="<?= _("Consulter") ?>" onclick="consulter_produit(<?= $idProduit ?>);">
<i class="fas fa-search"></i>
</button>
<?php if ($superUser == "1"): ?>
<button class="btn btn-link btn-sm text-success p-1 mx-1 action-icon" title="<?= _("Désarchiver") ?>" onclick="de_archiver_produit('<?= $idProduit ?>', '<?= $dansBareme ?>');">
<i class="fas fa-box-open"></i>
</button>
<?php endif; ?>
<?php else: ?>
<button class="btn btn-link btn-sm text-primary p-1 mx-1 action-icon" title="<?= _("Modifier") ?>" onclick="modifier_produit(<?= $idProduit ?>);">
<i class="fas fa-edit"></i>
</button>
<?php if($aGarantie == '1'): ?>
<button class="btn btn-link btn-sm text-warning p-1 mx-1 action-icon" title="<?= _("Archiver") ?>" onclick="archiver_produit('<?= $idProduit ?>');">
<i class="fas fa-archive"></i>
</button>
<?php endif; ?>
<?php endif; ?>
</div>
</td>
<td class="text-center">
<button class="btn btn-success btn-sm rounded-pill shadow-xs w-100" style="font-size: 8pt;" onclick="garanties_produit(<?= $idProduit ?>);">
<i class="fas fa-list-check me-1"></i> <?= _("Détails") ?>
</button>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<style>
.bg-warning-ghost { background-color: rgba(255, 239, 213, 0.4) !important; }
.bg-danger-light { background-color: rgba(220, 53, 69, 0.1); }
.btn-link { text-decoration: none; border: none; background: transparent; transition: all 0.2s; }
.action-icon:hover { transform: scale(1.2); }
</style>
<script>
var checkDTProd = setInterval(function() {
if (typeof initSmartTable === 'function') {
initSmartTable('.datatable-produits', 'Liste_Produits_Garant', false);
clearInterval(checkDTProd);
}
}, 100);
</script>

View File

@ -1,25 +1,51 @@
<?php $this->titre = "INTER SANTE - Produits";
$superUser = $_SESSION['superUser'];
<?php
$superUser = $_SESSION['superUser'];
?>
<legend><?= _("Liste des Produits par garant") ?></legend>
<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-box-open fs-4"></i>
</div>
<div>
<h4 id="titre-page" class="mb-0 fw-bold text-uppercase"><?= _("Gestion des Produits") ?></h4>
<p class="text-muted small mb-0"><?= _("Catalogue des produits d'assurance par garant") ?></p>
</div>
</div>
<button class="btn btn-primary rounded-pill px-4 fw-bold shadow-sm btn-sm" onclick="nouveau_produit();">
<i class="fas fa-plus me-1"></i> <?= _("Nouveau Produit") ?>
</button>
</div>
</div>
<INPUT class="sr-only" TYPE="text" id="nomForm" NAME="nomForm" value="frmproduit">
<table class="table table-condensed table-responsive" style="font-size:10pt;" >
<tbody>
<tr>
<td width="10%" class="required text-center"> <?= _("Garant") ?> </td>
<td >
<SELECT style="font-size:10pt;" class="form-control selectpicker" data-live-search="true" id="codeGcAssureur" NAME="codeGcAssureur" required AUTOCOMPLETE="OFF" autofocus
onChange="javascript:filtretabproduit();" >
<?php liste_options($garant,$_SESSION['garant']); ?>
</SELECT>
</td>
</tr>
</tbody>
</table>
<div id="div_tab_produit">
<?php
require 'Vue/Ajaxfiltretabproduit/index.php';
?>
<input type="hidden" id="nomForm" name="nomForm" value="frmproduit">
<div class="card border-0 shadow-sm mb-4">
<div class="card-body p-3 bg-primary-ghost-light">
<div class="row align-items-center g-3">
<div class="col-md-2 text-md-end">
<label class="form-label mb-md-0 fw-bold text-uppercase small text-muted"><?= _("Garant") ?> :</label>
</div>
<div class="col-md-6">
<div class="input-group">
<span class="input-group-text bg-white border-end-0"><i class="fas fa-shield-alt text-primary"></i></span>
<select class="form-control selectpicker border-start-0" data-live-search="true" id="codeGcAssureur" name="codeGcAssureur" onchange="filtretabproduit();" autofocus>
<?php liste_options($garant, $_SESSION['garant']); ?>
</select>
</div>
</div>
</div>
</div>
</div>
<div id="div_tab_produit">
<?php require 'Vue/Ajaxfiltretabproduit/index.php'; ?>
</div>
</div>
<style>
.bg-primary-ghost-light { background-color: rgba(33, 46, 83, 0.02) !important; }
</style>