Rend les lignes de tarifs directement modifiables

This commit is contained in:
Alexandre NOEL 2026-09-08 01:04:34 +02:00
commit f41504c852
5 changed files with 34 additions and 22 deletions

View file

@ -2,6 +2,12 @@
Toutes les modifications importantes du projet sont consignées ici. Le format s’inspire de [Keep a Changelog](https://keepachangelog.com/fr/1.1.0/) et le projet suit le [versionnage sémantique](https://semver.org/lang/fr/). Toutes les modifications importantes du projet sont consignées ici. Le format s’inspire de [Keep a Changelog](https://keepachangelog.com/fr/1.1.0/) et le projet suit le [versionnage sémantique](https://semver.org/lang/fr/).
## [1.0.0-rc.15] — 2026-09-08
### Navigation dans le catalogue vétérinaire
- suppression de la colonne d’actions au profit de lignes directement cliquables et accessibles au clavier.
## [1.0.0-rc.14] — 2026-09-08 ## [1.0.0-rc.14] — 2026-09-08
### Présentation du catalogue vétérinaire ### Présentation du catalogue vétérinaire

View file

@ -65,3 +65,7 @@ Ajout de la modification et de la suppression sécurisée des tarifs, sans alté
## `1.0.0-rc.14` — Finition du catalogue vétérinaire ## `1.0.0-rc.14` — Finition du catalogue vétérinaire
Allègement de la colonne d’actions grâce à des commandes compactes et accessibles. Allègement de la colonne d’actions grâce à des commandes compactes et accessibles.
## `1.0.0-rc.15` — Navigation dans les tarifs
Intégration de la modification directement dans les lignes du catalogue pour retrouver les habitudes de navigation de Globinours.

View file

@ -1 +1 @@
1.0.0-rc.14 1.0.0-rc.15

View file

@ -31,9 +31,9 @@
<div class="col-lg-6"> <div class="col-lg-6">
<section class="card h-100"> <section class="card h-100">
<div class="card-body"> <div class="card-body">
<span class="badge bg-blue-lt mb-2">1.0.0-rc.14</span> <span class="badge bg-blue-lt mb-2">1.0.0-rc.15</span>
<h3>Catalogue vétérinaire modifiable</h3> <h3>Catalogue vétérinaire modifiable</h3>
<p class="text-muted">Tarifs modifiables ou supprimables depuis des actions compactes et accessibles, tout en préservant les dépenses historiques.</p> <p class="text-muted">Tarifs modifiables directement depuis leur ligne, tout en préservant les dépenses historiques.</p>
</div> </div>
</section> </section>
</div> </div>

View file

@ -140,7 +140,7 @@
<h3 class="card-title"><?= h(t('pricing.grid')) ?></h3> <h3 class="card-title"><?= h(t('pricing.grid')) ?></h3>
</div> </div>
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-vcenter mb-0"> <table class="table table-vcenter table-hover mb-0">
<thead> <thead>
<tr> <tr>
<th><?= h(t('pricing.structure')) ?></th> <th><?= h(t('pricing.structure')) ?></th>
@ -150,10 +150,15 @@
<th class="text-end"><?= h(t('pricing.catalog')) ?></th> <th class="text-end"><?= h(t('pricing.catalog')) ?></th>
<th class="text-end"><?= h(t('pricing.estimated_cost')) ?></th> <th class="text-end"><?= h(t('pricing.estimated_cost')) ?></th>
<th><?= h(t('pricing.state')) ?></th> <th><?= h(t('pricing.state')) ?></th>
<th class="text-end"><?= h(t('common.actions')) ?></th>
</tr> </tr>
</thead> </thead>
<tbody><?php foreach ($tariffs as $t): ?><tr> <tbody><?php foreach ($tariffs as $t): ?><tr class="tariff-edit cursor-pointer" tabindex="0"
aria-label="<?= h(t('pricing.edit_tariff') . ' : ' . $t['label']) ?>"
data-id="<?= (int)$t['id'] ?>" data-clinic="<?= (int)$t['clinic_contact_id'] ?>"
data-label="<?= h($t['label']) ?>" data-amount="<?= h(number_format($t['amount_cents'] / 100, 2, '.', '')) ?>"
data-category="<?= h($t['category']) ?>" data-group="<?= h($t['discount_group']) ?>"
data-unit="<?= h($t['unit_label']) ?>" data-medication="<?= (int)($t['medication_id'] ?? 0) ?>"
data-active="<?= (int)$t['active'] ?>">
<td><?= h($t['clinic_name']) ?></td> <td><?= h($t['clinic_name']) ?></td>
<td class="fw-semibold"><?= h($t['label']) ?><div class="text-muted small"> <td class="fw-semibold"><?= h($t['label']) ?><div class="text-muted small">
<?= h(t('pricing.per_unit', ['unit' => $t['unit_label']])) ?></div> <?= h(t('pricing.per_unit', ['unit' => $t['unit_label']])) ?></div>
@ -166,28 +171,25 @@
<td><span <td><span
class="badge <?= $t['active'] ? 'bg-green-lt' : 'bg-secondary-lt' ?>"><?= $t['active'] ? t('pricing.active') : t('pricing.inactive') ?></span> class="badge <?= $t['active'] ? 'bg-green-lt' : 'bg-secondary-lt' ?>"><?= $t['active'] ? t('pricing.active') : t('pricing.inactive') ?></span>
</td> </td>
<td class="text-end"><div class="btn-list justify-content-end">
<button class="btn btn-sm btn-icon btn-outline-primary tariff-edit" type="button"
title="<?= h(t('pricing.edit_tariff')) ?>" aria-label="<?= h(t('pricing.edit_tariff')) ?>"
data-id="<?= (int)$t['id'] ?>" data-clinic="<?= (int)$t['clinic_contact_id'] ?>"
data-label="<?= h($t['label']) ?>" data-amount="<?= h(number_format($t['amount_cents'] / 100, 2, '.', '')) ?>"
data-category="<?= h($t['category']) ?>" data-group="<?= h($t['discount_group']) ?>"
data-unit="<?= h($t['unit_label']) ?>" data-medication="<?= (int)($t['medication_id'] ?? 0) ?>"
data-active="<?= (int)$t['active'] ?>"><span aria-hidden="true">✏️</span></button>
<form method="post" action="/settings/pricing/tariff/delete" onsubmit="return confirm(<?= h(json_encode(t('pricing.delete_confirm'), JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)) ?>)">
<input type="hidden" name="id" value="<?= (int)$t['id'] ?>"><button class="btn btn-sm btn-icon btn-outline-danger" type="submit" title="<?= h(t('common.delete')) ?>" aria-label="<?= h(t('common.delete')) ?>"><span aria-hidden="true">🗑️</span></button>
</form>
</div></td>
</tr><?php endforeach; ?></tbody> </tr><?php endforeach; ?></tbody>
</table> </table>
</div> </div>
</div> </div>
<script> <script>
document.querySelectorAll('.tariff-edit').forEach((button) => button.addEventListener('click', () => { const editTariff = (row) => {
const fields = {tariffId:'id',tariffClinic:'clinic',tariffLabel:'label',tariffAmount:'amount',tariffCategory:'category',tariffGroup:'group',tariffUnit:'unit',tariffMedication:'medication'}; const fields = {tariffId:'id',tariffClinic:'clinic',tariffLabel:'label',tariffAmount:'amount',tariffCategory:'category',tariffGroup:'group',tariffUnit:'unit',tariffMedication:'medication'};
Object.entries(fields).forEach(([id, key]) => { document.getElementById(id).value = button.dataset[key] || ''; }); Object.entries(fields).forEach(([id, key]) => { document.getElementById(id).value = row.dataset[key] || ''; });
document.getElementById('tariffActive').checked = button.dataset.active === '1'; document.getElementById('tariffActive').checked = row.dataset.active === '1';
document.getElementById('tariffForm').scrollIntoView({behavior:'smooth', block:'start'}); document.getElementById('tariffForm').scrollIntoView({behavior:'smooth', block:'start'});
document.getElementById('tariffLabel').focus({preventScroll:true}); document.getElementById('tariffLabel').focus({preventScroll:true});
})); };
document.querySelectorAll('.tariff-edit').forEach((row) => {
row.addEventListener('click', () => editTariff(row));
row.addEventListener('keydown', (event) => {
if (event.key === 'Enter' || event.key === ' ') {
event.preventDefault();
editTariff(row);
}
});
});
</script> </script>