newdesigngestionnaire/Vue/Ajaxprimelienparente/trancheage.php
2026-03-16 12:51:18 +00:00

122 lines
8.1 KiB
PHP
Executable File

<div id="div_trancheage_content" class="animate__animated animate__fadeIn">
<div class="row g-3">
<div id="div_prime_lien" class="col-lg-8">
<div class="table-responsive border rounded shadow-sm bg-white">
<table id="tab_prime_categorie" class="table table-hover align-middle mb-0" style="font-size: 8pt;">
<thead class="bg-primary-ghost text-primary small fw-bold text-uppercase">
<tr>
<th class="py-3 ps-3"><?= _("Lien Parenté") ?></th>
<th class="text-center"><?= _("Plafond") ?></th>
<th class="text-center"><?= _("Max/Fam") ?></th>
<th class="text-center"><?= _("Plus ?") ?></th>
<th class="text-center"><?= _("Surprime") ?></th>
<th class="text-center"><?= _("Âge Min") ?></th>
<th class="text-center"><?= _("Âge Max") ?></th>
</tr>
</thead>
<tbody>
<?php
$i = 0;
foreach ($primeLienParente as $v):
$idPrime = $this->nettoyer($v['id']);
$codeLienParente = $this->nettoyer($v['codeLienParente']);
$lienparente = est_anglophone() ? $this->nettoyer($v['lienparenteEng']) : $this->nettoyer($v['lienparente']);
$i++;
?>
<tr>
<td class="ps-3 fw-bold text-dark"><?= $lienparente ?></td>
<td>
<input class="form-control form-control-sm text-center border-2 input-editable" type="text"
value="<?= format_N($v['plafondBeneficiaire']) ?>"
onfocus="formatNumerique(this);" onkeyup="controle_numerique(this);" onblur="formatMonetaire(this);"
onchange="ajax_maj_plafond_produit_lienparente('<?=$idPrime?>', this.value, this);">
</td>
<?php if($codeLienParente != "A"): ?>
<td>
<input class="form-control form-control-sm text-center border-2 input-editable" type="text"
value="<?= $v['nbreParFamille'] ?>"
onfocus="formatNumerique(this);" onkeyup="controle_numerique(this);" onblur="formatMonetaire(this);"
onchange="ajax_maj_nbrefamille_produit_lienparente('<?=$idPrime?>', this.value, this);">
</td>
<td>
<select class="form-select form-select-sm border-2 input-editable"
onchange="ajax_maj_autoriser_produit_lienparente('<?=$idPrime?>', this.value, this, <?=$i;?>);">
<?php liste_options($ouinonautoriser, $this->nettoyer($v['autoriserSupplement']), true); ?>
</select>
</td>
<td>
<input class="form-control form-control-sm text-center border-2 input-editable fw-bold text-primary" type="text"
value="<?= format_N($v['primeSupplementaire']) ?>"
onfocus="formatNumerique(this);" onkeyup="controle_numerique(this);" onblur="formatMonetaire(this);"
onchange="ajax_maj_supplementaire_produit_lienparente('<?=$idPrime?>', this.value, this);">
</td>
<?php else: ?>
<td><input class="form-control form-control-sm text-center bg-light border-0" value="<?= $v['nbreParFamille'] ?>" disabled></td>
<td><input class="form-control form-control-sm text-center bg-light border-0" value="<?= ($v['autoriserSupplement'] == 1) ? 'OUI' : 'NON' ?>" disabled></td>
<td><input class="form-control form-control-sm text-center bg-light border-0 fw-bold" value="<?= format_N($v['primeSupplementaire']) ?>" disabled></td>
<?php endif; ?>
<td>
<input class="form-control form-control-sm text-center border-2 input-editable" type="text"
value="<?= $this->nettoyer($v['ageMinimum']) ?>"
onkeyup="controle_numerique(this);"
onchange="ajax_maj_Agemin_produit_lienparente('<?=$idPrime?>', this.value, this);">
</td>
<td class="pe-2">
<input class="form-control form-control-sm text-center border-2 input-editable" type="text"
value="<?= $this->nettoyer($v['ageMaximum']) ?>"
onkeyup="controle_numerique(this);"
onchange="ajax_maj_Agemax_produit_lienparente('<?=$idPrime?>', this.value, this);">
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
<div id="div_prime_trancheage" class="col-lg-4">
<div class="table-responsive border rounded shadow-sm bg-white">
<table class="table table-hover align-middle mb-0" style="font-size: 9.5pt;">
<thead class="bg-primary text-white small fw-bold text-uppercase">
<tr>
<th class="py-3 ps-3"><?= _("Tranche d'Âge") ?></th>
<th class="py-3 text-center pe-3"><?= _("Prime de Base") ?></th>
</tr>
</thead>
<tbody>
<?php
$j = 0;
foreach ($primeTrancheage as $v):
$idPrimeBase = $this->nettoyer($v['id']);
$libAge = est_anglophone() ? $this->nettoyer($v['libelleTrancheAgeEng']) : $this->nettoyer($v['libelleTrancheAge']);
$j++;
?>
<tr>
<td class="ps-3 fw-bold text-muted"><?= $libAge ?></td>
<td class="pe-3">
<input class="form-control form-control-sm text-center border-2 input-editable fw-bold text-primary"
style="font-size: 10pt;" type="text"
value="<?= format_N($this->nettoyer($v['prime'])) ?>"
onfocus="formatNumerique(this);" onkeyup="controle_numerique(this);" onblur="formatMonetaire(this);"
onchange="ajax_maj_prime_produit('<?=$idPrimeBase?>', this.value, this);">
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<style>
.input-editable { border-color: #eee; transition: all 0.2s; }
.input-editable:focus { border-color: var(--bs-primary); background-color: #fff !important; }
.bg-primary-ghost { background-color: rgba(33, 46, 83, 0.05) !important; }
/* Animation lors de la modification réussie (à appeler dans vos fonctions AJAX de maj) */
.save-success { border-color: #198754 !important; background-color: rgba(25, 135, 84, 0.1) !important; }
</style>