Corriger les liens et la synchronisation i-CAD
This commit is contained in:
parent
7b89fd5dfa
commit
9ff26ad9be
10 changed files with 83 additions and 23 deletions
|
|
@ -225,7 +225,7 @@ $hasCurrent = ($currentLat !== null && $currentLng !== null);
|
|||
|
||||
<div class="alert alert-success mt-3">
|
||||
<strong><?= h(t('animal.adopted_by')) ?> :</strong><br>
|
||||
<?php if (!empty($adoption['adopter_contact_id'])): ?><a class="fw-bold" href="/directory/show?id=<?= (int)$adoption['adopter_contact_id'] ?>"><?= h($adoption['adopter_name']) ?></a><?php else: ?><span class="fw-bold"><?= h($adoption['adopter_name']) ?></span><?php endif; ?>
|
||||
<?php if (!empty($adoption['adopter_contact_id'])): ?><a class="fw-bold" href="/directory/view?id=<?= (int)$adoption['adopter_contact_id'] ?>"><?= h($adoption['adopter_name']) ?></a><?php else: ?><span class="fw-bold"><?= h($adoption['adopter_name']) ?></span><?php endif; ?>
|
||||
<div class="small mt-1"><?= h(trim(implode(' · ', array_filter([
|
||||
trim((string)($adoption['adopter_address'] ?? '') . ' ' . (string)($adoption['adopter_postal_code'] ?? '') . ' ' . (string)($adoption['adopter_city'] ?? '')),
|
||||
$adoption['adopter_phone'] ?? '', $adoption['adopter_email'] ?? ''
|
||||
|
|
@ -316,10 +316,14 @@ $err = (string)($cache['error'] ?? '');
|
|||
</a>
|
||||
<?php endif; ?>
|
||||
|
||||
<button class="btn btn-sm btn-outline-secondary" type="button" id="btn-icad-refresh"
|
||||
data-animal-id="<?= (int)$animal['id'] ?>">
|
||||
<?= h(t('common.refresh')) ?>
|
||||
</button>
|
||||
<form method="post" action="/animal/icad" id="form-icad-refresh" class="m-0">
|
||||
<input type="hidden" name="csrf" value="<?= h(Auth::csrf()) ?>">
|
||||
<input type="hidden" name="id" value="<?= (int)$animal['id'] ?>">
|
||||
<input type="hidden" name="force" value="1">
|
||||
<button class="btn btn-sm btn-outline-secondary" type="submit" id="btn-icad-refresh">
|
||||
<?= h(t('common.refresh')) ?>
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -443,6 +443,7 @@ ORDER BY created_at ASC
|
|||
<th><?= h(t('animal.batch_traceability')) ?></th>
|
||||
<th><?= h(t('animal.veterinary_clinic')) ?></th>
|
||||
<th><?= h(t('common.notes')) ?></th>
|
||||
<th class="text-end"><?= h(t('common.actions')) ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
|
@ -457,7 +458,7 @@ 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"
|
||||
<td class="text-end"><button type="button" class="btn btn-sm btn-outline-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'] ?? '') ?>"
|
||||
|
|
@ -465,8 +466,7 @@ ORDER BY created_at ASC
|
|||
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>
|
||||
data-notes="<?= h($v['notes'] ?? '') ?>"><?= h(t('common.edit')) ?></button></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
|
|
|
|||
|
|
@ -1160,6 +1160,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||
</script>
|
||||
<script>
|
||||
(function() {
|
||||
const form = document.getElementById('form-icad-refresh');
|
||||
const btn = document.getElementById('btn-icad-refresh');
|
||||
const body = document.getElementById('icad-card-body');
|
||||
const tr = <?= json_encode(['error' => t('animal.icad_error'), 'empty' => t('animal.no_icad'), 'date' =>
|
||||
|
|
@ -1170,7 +1171,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||
'appearance' => t('animal.appearance'), 'history' => t('animal.icad_history'), 'fetching' => t(
|
||||
'animal.icad_fetching'), 'fetchError' => t('animal.icad_fetch_error')
|
||||
], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ?> ;
|
||||
if (!btn || !body) return;
|
||||
if (!form || !btn || !body) return;
|
||||
|
||||
function esc(s) {
|
||||
return (s ?? '').toString()
|
||||
|
|
@ -1240,8 +1241,8 @@ ${ownerHtml}
|
|||
`;
|
||||
}
|
||||
|
||||
async function refresh() {
|
||||
const id = btn.dataset.animalId;
|
||||
async function refresh(event) {
|
||||
event.preventDefault();
|
||||
btn.disabled = true;
|
||||
const oldTxt = btn.innerText;
|
||||
btn.innerText = '…';
|
||||
|
|
@ -1256,12 +1257,12 @@ ${ownerHtml}
|
|||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
},
|
||||
body: new URLSearchParams({
|
||||
id,
|
||||
force: '1',
|
||||
csrf: <?= json_encode(Auth::csrf()) ?>
|
||||
})
|
||||
credentials: 'same-origin',
|
||||
body: new URLSearchParams(new FormData(form))
|
||||
});
|
||||
if (!r.ok) {
|
||||
throw new Error(`HTTP ${r.status}: ${await r.text()}`);
|
||||
}
|
||||
const j = await r.json();
|
||||
body.innerHTML = renderIcad(j);
|
||||
} catch (e) {
|
||||
|
|
@ -1274,7 +1275,7 @@ ${ownerHtml}
|
|||
}
|
||||
}
|
||||
|
||||
btn.addEventListener('click', refresh);
|
||||
form.addEventListener('submit', refresh);
|
||||
})();
|
||||
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -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.30</span>
|
||||
<h3>Données fiabilisées sur le terrain</h3>
|
||||
<p class="text-muted">Décès historiques corrigibles, synchronisation I-CAD réparée, catalogues
|
||||
médicaux administrables et tarifs filtrés par clinique.</p>
|
||||
<span class="badge bg-blue-lt mb-2">1.0.0-rc.31</span>
|
||||
<h3>Parcours de correction plus fiables</h3>
|
||||
<p class="text-muted">Liens d’adoptants corrigés, modification des vaccins plus explicite et
|
||||
synchronisation i-CAD utilisable même sans JavaScript.</p>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in a new issue