feat: permettre la correction des soins antiparasitaires
This commit is contained in:
parent
a932db0ace
commit
f20d7cc965
14 changed files with 233 additions and 33 deletions
|
|
@ -218,6 +218,7 @@
|
|||
<th><?= h(t('animal.dose')) ?></th>
|
||||
<th><?= h(t('common.weight')) ?></th>
|
||||
<th><?= h(t('animal.recorded_by')) ?></th>
|
||||
<th><span class="visually-hidden"><?= h(t('common.actions')) ?></span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody><?php foreach ($dewormings as $d): ?><tr>
|
||||
|
|
@ -227,6 +228,16 @@
|
|||
<td><?= $d['weight_kg'] !== null ? h(number_format((float)$d['weight_kg'], 2, ',', ' ')) . ' kg' : '—' ?>
|
||||
</td>
|
||||
<td><?= h($d['actor_name'] ?: '—') ?></td>
|
||||
<td class="text-end"><button type="button" class="btn btn-sm btn-ghost-primary edit-deworming"
|
||||
data-bs-toggle="modal" data-bs-target="#modalDeworming"
|
||||
data-entry-id="<?= (int)$d['id'] ?>"
|
||||
data-dewormer-id="<?= (int)($d['dewormer_id'] ?? 0) ?>"
|
||||
data-administered-on="<?= h($d['administered_on']) ?>"
|
||||
data-dose-text="<?= h($d['dose_text'] ?? '') ?>"
|
||||
data-weight-kg="<?= h($d['weight_kg'] ?? '') ?>"
|
||||
data-next-due-date="<?= h($d['next_due_date'] ?? '') ?>"
|
||||
data-notes="<?= h($d['notes'] ?? '') ?>"
|
||||
aria-label="<?= h(t('common.edit')) ?>">✏️</button></td>
|
||||
</tr><?php endforeach; ?></tbody>
|
||||
</table>
|
||||
</div><?php endif; ?>
|
||||
|
|
@ -362,6 +373,7 @@ ORDER BY created_at ASC
|
|||
<th><?= h(t('animal.start')) ?></th>
|
||||
<th><?= h(t('dashboard.end')) ?></th>
|
||||
<th><?= h(t('common.notes')) ?></th>
|
||||
<th><span class="visually-hidden"><?= h(t('common.actions')) ?></span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
|
@ -426,6 +438,16 @@ ORDER BY created_at ASC
|
|||
</div><?php endif; ?></td>
|
||||
<td><?= !empty($v['clinic_name']) ? h($v['clinic_name']) : '—' ?></td>
|
||||
<td><?= $v['notes'] ? h($v['notes']) : '—' ?></td>
|
||||
<td class="text-end"><button type="button" class="btn btn-sm btn-ghost-primary edit-vaccine"
|
||||
data-bs-toggle="modal" data-bs-target="#modalVaccine"
|
||||
data-entry-id="<?= (int)$v['id'] ?>" data-vaccine-id="<?= (int)$v['vaccine_id'] ?>"
|
||||
data-done-date="<?= h($v['done_date']) ?>" data-due-date="<?= h($v['due_date'] ?? '') ?>"
|
||||
data-clinic-contact-id="<?= (int)($v['clinic_contact_id'] ?? 0) ?>"
|
||||
data-vet-contact-id="<?= (int)($v['vet_contact_id'] ?? 0) ?>"
|
||||
data-lot="<?= h($v['lot'] ?? '') ?>" data-manufacturer="<?= h($v['manufacturer'] ?? '') ?>"
|
||||
data-batch-expires-on="<?= h($v['batch_expires_on'] ?? '') ?>"
|
||||
data-notes="<?= h($v['notes'] ?? '') ?>"
|
||||
aria-label="<?= h(t('common.edit')) ?>">✏️</button></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
|
|
|
|||
|
|
@ -156,6 +156,7 @@ $currentTime = date('H:i');
|
|||
class="btn-close" data-bs-dismiss="modal" aria-label="<?= h(t('common.close')) ?>"></button>
|
||||
</div>
|
||||
<div class="modal-body"><input type="hidden" name="animal_id" value="<?= (int)$animal['id'] ?>">
|
||||
<input type="hidden" name="entry_id" value="">
|
||||
<div class="row g-3">
|
||||
<div class="col-md-6"><label class="form-label"><?= h(t('common.date')) ?></label><input
|
||||
class="form-control" type="date" name="administered_on" value="<?= date('Y-m-d') ?>"
|
||||
|
|
@ -173,7 +174,7 @@ $currentTime = date('H:i');
|
|||
<div class="input-group"><input class="form-control" type="number" min="0" step="0.01"
|
||||
name="weight_kg"><span class="input-group-text">kg</span></div>
|
||||
</div>
|
||||
<div class="col-md-8"><label class="form-label"><?= h(t('inventory.batch')) ?></label><select
|
||||
<div class="col-md-8" data-new-entry-only><label class="form-label"><?= h(t('inventory.batch')) ?></label><select
|
||||
class="form-select" name="inventory_batch_id">
|
||||
<option value="">—</option><?php foreach (($inventoryBatches ?? []) as $b) {
|
||||
if ($b['category'] === 'dewormer'): ?><option value="<?= (int)$b['id'] ?>">
|
||||
|
|
@ -181,13 +182,13 @@ $currentTime = date('H:i');
|
|||
</option><?php endif;
|
||||
} ?>
|
||||
</select></div>
|
||||
<div class="col-md-4"><label class="form-label"><?= h(t('inventory.quantity')) ?></label><input
|
||||
<div class="col-md-4" data-new-entry-only><label class="form-label"><?= h(t('inventory.quantity')) ?></label><input
|
||||
class="form-control" type="number" min="0" step="0.01" name="inventory_quantity"></div>
|
||||
<div class="col-12"><label class="form-label"><?= h(t('animal.next_due')) ?> <span
|
||||
class="text-muted">(<?= h(mb_strtolower(t('common.optional'))) ?>)</span></label><input
|
||||
class="form-control" type="date" name="next_due_date">
|
||||
<div class="form-hint"><?= h(t('animal.next_due_hint')) ?></div>
|
||||
</div><?php if (!empty($litters)): ?><div class="col-12"><label class="form-check"><input
|
||||
</div><?php if (!empty($litters)): ?><div class="col-12" data-new-entry-only><label class="form-check"><input
|
||||
class="form-check-input" type="checkbox" name="apply_litter" value="1"><span
|
||||
class="form-check-label"><?= h(t('animal.apply_litter')) ?></span></label></div>
|
||||
<?php endif; ?><div class="col-12"><label
|
||||
|
|
@ -257,6 +258,7 @@ $currentTime = date('H:i');
|
|||
|
||||
<div class="modal-body">
|
||||
<input type="hidden" name="animal_id" value="<?= (int)$animal['id'] ?>">
|
||||
<input type="hidden" name="entry_id" value="">
|
||||
|
||||
<div class="row g-2">
|
||||
<div class="col-md-6">
|
||||
|
|
@ -284,7 +286,7 @@ $currentTime = date('H:i');
|
|||
|
||||
<?php $directoryFieldId = 'vaccine';
|
||||
require __DIR__ . '/_directory_medical_fields.php'; ?>
|
||||
<?php require __DIR__ . '/_expense_tariff_field.php'; ?>
|
||||
<div data-new-entry-only style="display: contents"><?php require __DIR__ . '/_expense_tariff_field.php'; ?></div>
|
||||
|
||||
<div class="col-md-4">
|
||||
<label class="form-label"><?= h(t('animal.batch')) ?></label>
|
||||
|
|
@ -301,7 +303,7 @@ $currentTime = date('H:i');
|
|||
<input class="form-control" type="date" name="batch_expires_on">
|
||||
</div>
|
||||
|
||||
<div class="col-md-8"><label class="form-label"><?= h(t('inventory.batch')) ?></label><select
|
||||
<div class="col-md-8" data-new-entry-only><label class="form-label"><?= h(t('inventory.batch')) ?></label><select
|
||||
class="form-select" name="inventory_batch_id">
|
||||
<option value="">—</option><?php foreach (($inventoryBatches ?? []) as $b) {
|
||||
if ($b['category'] === 'vaccine'): ?><option value="<?= (int)$b['id'] ?>">
|
||||
|
|
@ -309,7 +311,7 @@ $currentTime = date('H:i');
|
|||
</option><?php endif;
|
||||
} ?>
|
||||
</select></div>
|
||||
<div class="col-md-4"><label class="form-label"><?= h(t('inventory.quantity')) ?></label><input
|
||||
<div class="col-md-4" data-new-entry-only><label class="form-label"><?= h(t('inventory.quantity')) ?></label><input
|
||||
class="form-control" type="number" min="0" step="0.01" name="inventory_quantity"></div>
|
||||
|
||||
<div class="col-md-12">
|
||||
|
|
@ -328,6 +330,47 @@ $currentTime = date('H:i');
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const prepareEditor = (modalId, triggerClass, fields) => {
|
||||
const modal = document.getElementById(modalId);
|
||||
if (!modal) return;
|
||||
modal.addEventListener('show.bs.modal', event => {
|
||||
const form = modal.querySelector('form');
|
||||
const trigger = event.relatedTarget;
|
||||
if (!form) return;
|
||||
form.reset();
|
||||
const editing = trigger?.classList.contains(triggerClass) ?? false;
|
||||
form.elements.entry_id.value = editing ? (trigger.dataset.entryId || '') : '';
|
||||
fields.forEach(([name, dataName]) => {
|
||||
if (editing && form.elements[name]) form.elements[name].value = trigger.dataset[dataName] || '';
|
||||
});
|
||||
modal.querySelectorAll('[data-new-entry-only]').forEach(element => {
|
||||
element.classList.toggle('d-none', editing);
|
||||
element.querySelectorAll('input,select,textarea').forEach(input => input.disabled = editing);
|
||||
});
|
||||
if (editing) {
|
||||
modal.querySelectorAll('.directory-contact-select').forEach(select => {
|
||||
select.dispatchEvent(new Event('change', {bubbles: true}));
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
prepareEditor('modalDeworming', 'edit-deworming', [
|
||||
['dewormer_id', 'dewormerId'], ['administered_on', 'administeredOn'],
|
||||
['dose_text', 'doseText'], ['weight_kg', 'weightKg'],
|
||||
['next_due_date', 'nextDueDate'], ['notes', 'notes'],
|
||||
]);
|
||||
prepareEditor('modalVaccine', 'edit-vaccine', [
|
||||
['vaccine_id', 'vaccineId'], ['done_date', 'doneDate'], ['due_date', 'dueDate'],
|
||||
['clinic_contact_id', 'clinicContactId'], ['vet_contact_id', 'vetContactId'],
|
||||
['lot', 'lot'], ['manufacturer', 'manufacturer'],
|
||||
['batch_expires_on', 'batchExpiresOn'], ['notes', 'notes'],
|
||||
]);
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="modal modal-blur fade" id="modalPrescription" tabindex="-1" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg modal-dialog-centered">
|
||||
<form class="modal-content" method="post" action="/animal/prescription/save" enctype="multipart/form-data">
|
||||
|
|
|
|||
|
|
@ -31,10 +31,10 @@
|
|||
<div class="col-lg-6">
|
||||
<section class="card h-100">
|
||||
<div class="card-body">
|
||||
<span class="badge bg-blue-lt mb-2">1.0.0-rc.27</span>
|
||||
<h3>Recherche tolérante</h3>
|
||||
<p class="text-muted">Les fiches sont retrouvées par nom, code ou identification sans que les
|
||||
accents ni les différences de casse empêchent le résultat.</p>
|
||||
<span class="badge bg-blue-lt mb-2">1.0.0-rc.28</span>
|
||||
<h3>Saisies médicales corrigibles</h3>
|
||||
<p class="text-muted">Vaccinations et traitements antiparasitaires peuvent être rectifiés sans
|
||||
déclencher une seconde sortie de stock ou une nouvelle dépense.</p>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in a new issue