Réparer les scripts intégrés aux vues
This commit is contained in:
parent
63224d8b06
commit
64ce1285aa
12 changed files with 112 additions and 97 deletions
|
|
@ -138,9 +138,9 @@ $today = date('Y-m-d');
|
||||||
select.required = !opening;
|
select.required = !opening;
|
||||||
name.required = opening;
|
name.required = opening;
|
||||||
button.setAttribute('aria-expanded', opening ? 'true' : 'false');
|
button.setAttribute('aria-expanded', opening ? 'true' : 'false');
|
||||||
button.textContent = opening ? < ? = json_encode(t('common.choose_from_list'),
|
button.textContent = opening ? <?= json_encode(t('common.choose_from_list'),
|
||||||
JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ? > : '+ ' + < ? = json_encode(t(
|
JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ?> : '+ ' + <?= json_encode(t(
|
||||||
'common.add'), JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ? > ;
|
'common.add'), JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ?> ;
|
||||||
if (opening) name.focus();
|
if (opening) name.focus();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
@ -746,10 +746,10 @@ $today = date('Y-m-d');
|
||||||
const kind = sterilizedCheckbox.form.querySelector('select[name="kind"]');
|
const kind = sterilizedCheckbox.form.querySelector('select[name="kind"]');
|
||||||
const reason = document.getElementById('medicalReason');
|
const reason = document.getElementById('medicalReason');
|
||||||
if (kind) kind.value = 'acte';
|
if (kind) kind.value = 'acte';
|
||||||
if (reason && reason.value.trim() === '') reason.value = < ? = json_encode(t(
|
if (reason && reason.value.trim() === '') reason.value = <?= json_encode(t(
|
||||||
'animal.sterilization_label'), JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ? > ;
|
'animal.sterilization_label'), JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ?> ;
|
||||||
});
|
});
|
||||||
const animalId = < ? = (int) $animal['id'] ? > ;
|
const animalId = <?= (int) $animal['id'] ?> ;
|
||||||
const legacyKey = 'animal_show_active_tab_' + animalId;
|
const legacyKey = 'animal_show_active_tab_' + animalId;
|
||||||
// L'ancien comportement mémorisait le dernier onglet par animal. Une
|
// L'ancien comportement mémorisait le dernier onglet par animal. Une
|
||||||
// ouverture normale doit désormais toujours revenir sur Identité.
|
// ouverture normale doit désormais toujours revenir sur Identité.
|
||||||
|
|
@ -822,8 +822,8 @@ $today = date('Y-m-d');
|
||||||
select = document.getElementById('labTemplate');
|
select = document.getElementById('labTemplate');
|
||||||
if (!body) return;
|
if (!body) return;
|
||||||
const presets = {};
|
const presets = {};
|
||||||
const references = < ? = json_encode($labReferenceSets ?? [], JSON_UNESCAPED_UNICODE |
|
const references = <?= json_encode($labReferenceSets ?? [], JSON_UNESCAPED_UNICODE |
|
||||||
JSON_UNESCAPED_SLASHES) ? > ;
|
JSON_UNESCAPED_SLASHES) ?> ;
|
||||||
Object.entries(references).forEach(([key, set]) => presets['ref:' + key] = (set.parameters || []).map(p => [
|
Object.entries(references).forEach(([key, set]) => presets['ref:' + key] = (set.parameters || []).map(p => [
|
||||||
p.code + ' — ' + p.name, p.unit, p.min, p.max
|
p.code + ' — ' + p.name, p.unit, p.min, p.max
|
||||||
]));
|
]));
|
||||||
|
|
@ -882,16 +882,16 @@ $today = date('Y-m-d');
|
||||||
pointRadius: 4,
|
pointRadius: 4,
|
||||||
tension: .2
|
tension: .2
|
||||||
}, {
|
}, {
|
||||||
label: < ? = json_encode(t('medical_document.reference_min'),
|
label: <?= json_encode(t('medical_document.reference_min'),
|
||||||
JSON_UNESCAPED_UNICODE) ? > ,
|
JSON_UNESCAPED_UNICODE) ?> ,
|
||||||
data: points.map(p => p.min),
|
data: points.map(p => p.min),
|
||||||
borderColor: '#74c0fc',
|
borderColor: '#74c0fc',
|
||||||
borderDash: [5, 5],
|
borderDash: [5, 5],
|
||||||
pointRadius: 0,
|
pointRadius: 0,
|
||||||
spanGaps: true
|
spanGaps: true
|
||||||
}, {
|
}, {
|
||||||
label: < ? = json_encode(t('medical_document.reference_max'),
|
label: <?= json_encode(t('medical_document.reference_max'),
|
||||||
JSON_UNESCAPED_UNICODE) ? > ,
|
JSON_UNESCAPED_UNICODE) ?> ,
|
||||||
data: points.map(p => p.max),
|
data: points.map(p => p.max),
|
||||||
borderColor: '#ffa8a8',
|
borderColor: '#ffa8a8',
|
||||||
borderDash: [5, 5],
|
borderDash: [5, 5],
|
||||||
|
|
@ -921,7 +921,7 @@ $today = date('Y-m-d');
|
||||||
x: {
|
x: {
|
||||||
title: {
|
title: {
|
||||||
display: true,
|
display: true,
|
||||||
text: < ? = json_encode(t('chart.date'), JSON_UNESCAPED_UNICODE) ? >
|
text: <?= json_encode(t('chart.date'), JSON_UNESCAPED_UNICODE) ?>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -936,7 +936,7 @@ $today = date('Y-m-d');
|
||||||
const el = document.getElementById('weightChart');
|
const el = document.getElementById('weightChart');
|
||||||
if (!el) return;
|
if (!el) return;
|
||||||
|
|
||||||
const rows = < ? = json_encode($weights ?? [], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) ? > ;
|
const rows = <?= json_encode($weights ?? [], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) ?> ;
|
||||||
|
|
||||||
// labels = dates, data = poids
|
// labels = dates, data = poids
|
||||||
const labels = rows.map(r => (r.measured_at || '').slice(0, 10)); // YYYY-MM-DD
|
const labels = rows.map(r => (r.measured_at || '').slice(0, 10)); // YYYY-MM-DD
|
||||||
|
|
@ -948,7 +948,7 @@ $today = date('Y-m-d');
|
||||||
data: {
|
data: {
|
||||||
labels,
|
labels,
|
||||||
datasets: [{
|
datasets: [{
|
||||||
label: < ? = json_encode(t('chart.weight'), JSON_UNESCAPED_UNICODE) ? > ,
|
label: <?= json_encode(t('chart.weight'), JSON_UNESCAPED_UNICODE) ?> ,
|
||||||
data,
|
data,
|
||||||
tension: 0.25,
|
tension: 0.25,
|
||||||
pointRadius: 2
|
pointRadius: 2
|
||||||
|
|
@ -972,7 +972,7 @@ $today = date('Y-m-d');
|
||||||
x: {
|
x: {
|
||||||
title: {
|
title: {
|
||||||
display: true,
|
display: true,
|
||||||
text: < ? = json_encode(t('chart.date'), JSON_UNESCAPED_UNICODE) ? >
|
text: <?= json_encode(t('chart.date'), JSON_UNESCAPED_UNICODE) ?>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -985,14 +985,14 @@ $today = date('Y-m-d');
|
||||||
(function() {
|
(function() {
|
||||||
const btn = document.getElementById('btn-icad-refresh');
|
const btn = document.getElementById('btn-icad-refresh');
|
||||||
const body = document.getElementById('icad-card-body');
|
const body = document.getElementById('icad-card-body');
|
||||||
const tr = < ? = json_encode(['error' => t('animal.icad_error'), 'empty' => t('animal.no_icad'), 'date' =>
|
const tr = <?= json_encode(['error' => t('animal.icad_error'), 'empty' => t('animal.no_icad'), 'date' =>
|
||||||
t('common.date'), 'recorded' => t('animal.recorded'), 'noEvent' => t('animal.no_event'),
|
t('common.date'), 'recorded' => t('animal.recorded'), 'noEvent' => t('animal.no_event'),
|
||||||
'holder' => t('animal.holder_internal'), 'name' => t('common.name'), 'phone' => t(
|
'holder' => t('animal.holder_internal'), 'name' => t('common.name'), 'phone' => t(
|
||||||
'common.phone'), 'email' => t('common.email'), 'icadName' => t('animal.icad_name'),
|
'common.phone'), 'email' => t('common.email'), 'icadName' => t('animal.icad_name'),
|
||||||
'microchip' => t('animal.microchip'), 'sex' => t('animal.sex'), 'birth' => t('animal.birth'),
|
'microchip' => t('animal.microchip'), 'sex' => t('animal.sex'), 'birth' => t('animal.birth'),
|
||||||
'appearance' => t('animal.appearance'), 'history' => t('animal.icad_history'), 'fetching' => t(
|
'appearance' => t('animal.appearance'), 'history' => t('animal.icad_history'), 'fetching' => t(
|
||||||
'animal.icad_fetching'), 'fetchError' => t('animal.icad_fetch_error')
|
'animal.icad_fetching'), 'fetchError' => t('animal.icad_fetch_error')
|
||||||
], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ? > ;
|
], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ?> ;
|
||||||
if (!btn || !body) return;
|
if (!btn || !body) return;
|
||||||
|
|
||||||
function esc(s) {
|
function esc(s) {
|
||||||
|
|
@ -1082,7 +1082,7 @@ ${ownerHtml}
|
||||||
body: new URLSearchParams({
|
body: new URLSearchParams({
|
||||||
id,
|
id,
|
||||||
force: '1',
|
force: '1',
|
||||||
csrf: < ? = json_encode(Auth::csrf()) ? >
|
csrf: <?= json_encode(Auth::csrf()) ?>
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
const j = await r.json();
|
const j = await r.json();
|
||||||
|
|
|
||||||
|
|
@ -44,14 +44,14 @@
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
const s = document.getElementById('expenseTariff'),
|
const s = document.getElementById('expenseTariff'),
|
||||||
h = document.getElementById('expenseHint'),
|
h = document.getElementById('expenseHint'),
|
||||||
template = < ? = json_encode(t('expense.unit_estimate'), JSON_UNESCAPED_UNICODE |
|
template = <?= json_encode(t('expense.unit_estimate'), JSON_UNESCAPED_UNICODE |
|
||||||
JSON_UNESCAPED_SLASHES) ? > ,
|
JSON_UNESCAPED_SLASHES) ?> ,
|
||||||
empty = < ? = json_encode(t('expense.price_after_discount'), JSON_UNESCAPED_UNICODE |
|
empty = <?= json_encode(t('expense.price_after_discount'), JSON_UNESCAPED_UNICODE |
|
||||||
JSON_UNESCAPED_SLASHES) ? > ;
|
JSON_UNESCAPED_SLASHES) ?> ;
|
||||||
s?.addEventListener('change', () => {
|
s?.addEventListener('change', () => {
|
||||||
const o = s.selectedOptions[0],
|
const o = s.selectedOptions[0],
|
||||||
price = (Number(o?.dataset.price || 0) / 100).toLocaleString( < ? = json_encode(I18n::
|
price = (Number(o?.dataset.price || 0) / 100).toLocaleString( <?= json_encode(I18n::
|
||||||
locale() === 'fr' ? 'fr-FR' : 'en-GB') ? > , {
|
locale() === 'fr' ? 'fr-FR' : 'en-GB') ?> , {
|
||||||
minimumFractionDigits: 2
|
minimumFractionDigits: 2
|
||||||
});
|
});
|
||||||
h.textContent = o?.value ? template.replace(':price', price).replace(':discount', o.dataset
|
h.textContent = o?.value ? template.replace(':price', price).replace(':discount', o.dataset
|
||||||
|
|
|
||||||
|
|
@ -327,7 +327,7 @@ foreach ($volunteers as $v): ?><option value="<?= (int)$v['id'] ?>"
|
||||||
const params = new URLSearchParams(new FormData(form));
|
const params = new URLSearchParams(new FormData(form));
|
||||||
['view', 'date', 'month'].forEach(key => params.delete(key));
|
['view', 'date', 'month'].forEach(key => params.delete(key));
|
||||||
document.querySelectorAll('a[href^="/agenda?"] , a[href^="/agenda/export.ics?"]').forEach(link => {
|
document.querySelectorAll('a[href^="/agenda?"] , a[href^="/agenda/export.ics?"]').forEach(link => {
|
||||||
if (link.title === < ? = json_encode(t('common.reset')) ? > ) return;
|
if (link.title === <?= json_encode(t('common.reset')) ?> ) return;
|
||||||
const url = new URL(link.href, location.origin);
|
const url = new URL(link.href, location.origin);
|
||||||
params.forEach((value, key) => url.searchParams.set(key, value));
|
params.forEach((value, key) => url.searchParams.set(key, value));
|
||||||
link.href = url.pathname + '?' + url.searchParams.toString();
|
link.href = url.pathname + '?' + url.searchParams.toString();
|
||||||
|
|
@ -335,20 +335,20 @@ foreach ($volunteers as $v): ?><option value="<?= (int)$v['id'] ?>"
|
||||||
}
|
}
|
||||||
const modal = document.getElementById('agendaModal');
|
const modal = document.getElementById('agendaModal');
|
||||||
const addButton = document.getElementById('agendaAddButton');
|
const addButton = document.getElementById('agendaAddButton');
|
||||||
if (modal && addButton && < ? = (!$edit && PermissionService::can('agenda', 'edit')) ? 'true' :
|
if (modal && addButton && <?= (!$edit && PermissionService::can('agenda', 'edit')) ? 'true' :
|
||||||
'false' ? > ) {
|
'false' ?> ) {
|
||||||
const month = < ? = json_encode($cursor - > format('Y-m')) ? > ;
|
const month = <?= json_encode($cursor->format('Y-m')) ?> ;
|
||||||
const weekDates = < ? = json_encode(array_map(static fn($i) => $weekStart - > modify('+'.$i.
|
const weekDates = <?= json_encode(array_map(static fn($i) => $weekStart->modify('+'.$i.
|
||||||
' days') - > format('Y-m-d'), range(0, 6))) ? > ;
|
' days')->format('Y-m-d'), range(0, 6))) ?> ;
|
||||||
document.querySelectorAll('.agenda-calendar .agenda-day:not(.muted)').forEach((cell, index) => {
|
document.querySelectorAll('.agenda-calendar .agenda-day:not(.muted)').forEach((cell, index) => {
|
||||||
const number = cell.querySelector('.agenda-number')?.textContent.trim();
|
const number = cell.querySelector('.agenda-number')?.textContent.trim();
|
||||||
const date = < ? = $viewMode === 'week' ? 'weekDates[index]' :
|
const date = <?= $viewMode === 'week' ? 'weekDates[index]' :
|
||||||
'month+\'-\'+String(parseInt(number,10)).padStart(2,\'0\')' ? > ;
|
'month+\'-\'+String(parseInt(number,10)).padStart(2,\'0\')' ?> ;
|
||||||
if (!date) return;
|
if (!date) return;
|
||||||
cell.classList.add('agenda-day-clickable');
|
cell.classList.add('agenda-day-clickable');
|
||||||
cell.tabIndex = 0;
|
cell.tabIndex = 0;
|
||||||
cell.setAttribute('role', 'button');
|
cell.setAttribute('role', 'button');
|
||||||
cell.setAttribute('aria-label', < ? = json_encode(t('agenda.add_on_date')) ? > +' ' +
|
cell.setAttribute('aria-label', <?= json_encode(t('agenda.add_on_date')) ?> +' ' +
|
||||||
date.split('-').reverse().join('/'));
|
date.split('-').reverse().join('/'));
|
||||||
const open = event => {
|
const open = event => {
|
||||||
if (event.target.closest('.agenda-event,button,a,input,select,textarea,label'))
|
if (event.target.closest('.agenda-event,button,a,input,select,textarea,label'))
|
||||||
|
|
|
||||||
|
|
@ -846,11 +846,11 @@ $mosaicQs['view'] = 'mosaic';
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
const animalListTranslations = < ? = json_encode(['medicalPreview' => t('animals.medical_preview'),
|
const animalListTranslations = <?= json_encode(['medicalPreview' => t('animals.medical_preview'),
|
||||||
'neverProvided' => t('animals.never_provided'), 'lastUpdate' => t('animals.last_update', ['date' =>
|
'neverProvided' => t('animals.never_provided'), 'lastUpdate' => t('animals.last_update', ['date' =>
|
||||||
'__DATE__'
|
'__DATE__'
|
||||||
])
|
])
|
||||||
], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ? > ;
|
], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ?> ;
|
||||||
(() => {
|
(() => {
|
||||||
const zoom = document.getElementById('animalPhotoZoom');
|
const zoom = document.getElementById('animalPhotoZoom');
|
||||||
const image = zoom?.querySelector('img');
|
const image = zoom?.querySelector('img');
|
||||||
|
|
|
||||||
|
|
@ -185,19 +185,19 @@
|
||||||
summary = document.getElementById('formValidationError');
|
summary = document.getElementById('formValidationError');
|
||||||
|
|
||||||
function frenchMessage(field) {
|
function frenchMessage(field) {
|
||||||
if (field.validity.valueMissing) return < ? = json_encode(t('auth.required'), JSON_UNESCAPED_UNICODE) ? > ;
|
if (field.validity.valueMissing) return <?= json_encode(t('auth.required'), JSON_UNESCAPED_UNICODE) ?> ;
|
||||||
if (field.validity.tooShort) return < ? = json_encode(t('auth.password_min', ['count' => '__COUNT__']),
|
if (field.validity.tooShort) return <?= json_encode(t('auth.password_min', ['count' => '__COUNT__']),
|
||||||
JSON_UNESCAPED_UNICODE) ? > .replace('__COUNT__', field.minLength);
|
JSON_UNESCAPED_UNICODE) ?> .replace('__COUNT__', field.minLength);
|
||||||
if (field.validity.patternMismatch) return < ? = json_encode(t('auth.invalid_format'),
|
if (field.validity.patternMismatch) return <?= json_encode(t('auth.invalid_format'),
|
||||||
JSON_UNESCAPED_UNICODE) ? > ;
|
JSON_UNESCAPED_UNICODE) ?> ;
|
||||||
return < ? = json_encode(t('auth.check_field'), JSON_UNESCAPED_UNICODE) ? > ;
|
return <?= json_encode(t('auth.check_field'), JSON_UNESCAPED_UNICODE) ?> ;
|
||||||
}
|
}
|
||||||
form.addEventListener('submit', event => {
|
form.addEventListener('submit', event => {
|
||||||
form.querySelectorAll('.is-invalid').forEach(el => el.classList.remove('is-invalid'));
|
form.querySelectorAll('.is-invalid').forEach(el => el.classList.remove('is-invalid'));
|
||||||
const password = form.elements.password,
|
const password = form.elements.password,
|
||||||
confirmation = form.elements.password_confirm;
|
confirmation = form.elements.password_confirm;
|
||||||
if (confirmation) confirmation.setCustomValidity(password.value !== confirmation.value ? < ? =
|
if (confirmation) confirmation.setCustomValidity(password.value !== confirmation.value ? <?=
|
||||||
json_encode(t('auth.password_mismatch'), JSON_UNESCAPED_UNICODE) ? > : '');
|
json_encode(t('auth.password_mismatch'), JSON_UNESCAPED_UNICODE) ?> : '');
|
||||||
if (!form.checkValidity()) {
|
if (!form.checkValidity()) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
|
|
||||||
|
|
@ -81,15 +81,15 @@ if ($pageDescription === '') {
|
||||||
<script>
|
<script>
|
||||||
(function() {
|
(function() {
|
||||||
const rescue = {
|
const rescue = {
|
||||||
lat: < ? = $hasRescue ? (float) $rescueLat : 'null' ? > ,
|
lat: <?= $hasRescue ? (float) $rescueLat : 'null' ?> ,
|
||||||
lng: < ? = $hasRescue ? (float) $rescueLng : 'null' ? > ,
|
lng: <?= $hasRescue ? (float) $rescueLng : 'null' ?> ,
|
||||||
addr: < ? = json_encode($rescueAddr, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ? >
|
addr: <?= json_encode($rescueAddr, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ?>
|
||||||
};
|
};
|
||||||
|
|
||||||
const cur = {
|
const cur = {
|
||||||
lat: < ? = $hasCurrent ? (float) $currentLat : 'null' ? > ,
|
lat: <?= $hasCurrent ? (float) $currentLat : 'null' ?> ,
|
||||||
lng: < ? = $hasCurrent ? (float) $currentLng : 'null' ? > ,
|
lng: <?= $hasCurrent ? (float) $currentLng : 'null' ?> ,
|
||||||
addr: < ? = json_encode($currentAddr, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ? >
|
addr: <?= json_encode($currentAddr, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ?>
|
||||||
};
|
};
|
||||||
|
|
||||||
const el = document.getElementById('mapJourney');
|
const el = document.getElementById('mapJourney');
|
||||||
|
|
@ -102,16 +102,16 @@ if ($pageDescription === '') {
|
||||||
className: '',
|
className: '',
|
||||||
iconSize: [18, 18],
|
iconSize: [18, 18],
|
||||||
iconAnchor: [9, 9],
|
iconAnchor: [9, 9],
|
||||||
html: '<div class="twix-pin rescue" title="' + < ? = json_encode(t('map.rescue'),
|
html: '<div class="twix-pin rescue" title="' + <?= json_encode(t('map.rescue'),
|
||||||
JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ? > +'"></div>'
|
JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ?> +'"></div>'
|
||||||
});
|
});
|
||||||
|
|
||||||
const iconCurrent = L.divIcon({
|
const iconCurrent = L.divIcon({
|
||||||
className: '',
|
className: '',
|
||||||
iconSize: [18, 18],
|
iconSize: [18, 18],
|
||||||
iconAnchor: [9, 9],
|
iconAnchor: [9, 9],
|
||||||
html: '<div class="twix-pin current" title="' + < ? = json_encode(t('map.current'),
|
html: '<div class="twix-pin current" title="' + <?= json_encode(t('map.current'),
|
||||||
JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ? > +'"></div>'
|
JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ?> +'"></div>'
|
||||||
});
|
});
|
||||||
|
|
||||||
const map = L.map('mapJourney', {
|
const map = L.map('mapJourney', {
|
||||||
|
|
@ -144,8 +144,8 @@ if ($pageDescription === '') {
|
||||||
icon: iconRescue
|
icon: iconRescue
|
||||||
})
|
})
|
||||||
.addTo(map)
|
.addTo(map)
|
||||||
.bindPopup(safePopup( < ? = json_encode(t('map.rescue'), JSON_UNESCAPED_UNICODE |
|
.bindPopup(safePopup( <?= json_encode(t('map.rescue'), JSON_UNESCAPED_UNICODE |
|
||||||
JSON_UNESCAPED_SLASHES) ? > , rescue.addr), {
|
JSON_UNESCAPED_SLASHES) ?> , rescue.addr), {
|
||||||
autoPan: false, // <-- stop le déplacement
|
autoPan: false, // <-- stop le déplacement
|
||||||
closeButton: false
|
closeButton: false
|
||||||
});
|
});
|
||||||
|
|
@ -158,8 +158,8 @@ if ($pageDescription === '') {
|
||||||
icon: iconCurrent
|
icon: iconCurrent
|
||||||
})
|
})
|
||||||
.addTo(map)
|
.addTo(map)
|
||||||
.bindPopup(safePopup( < ? = json_encode(t('map.current'), JSON_UNESCAPED_UNICODE |
|
.bindPopup(safePopup( <?= json_encode(t('map.current'), JSON_UNESCAPED_UNICODE |
|
||||||
JSON_UNESCAPED_SLASHES) ? > , cur.addr), {
|
JSON_UNESCAPED_SLASHES) ?> , cur.addr), {
|
||||||
autoPan: false, // <-- stop le déplacement
|
autoPan: false, // <-- stop le déplacement
|
||||||
closeButton: false
|
closeButton: false
|
||||||
});
|
});
|
||||||
|
|
@ -169,8 +169,8 @@ if ($pageDescription === '') {
|
||||||
map.setView(fallback, 8);
|
map.setView(fallback, 8);
|
||||||
L.popup({
|
L.popup({
|
||||||
autoPan: false
|
autoPan: false
|
||||||
}).setLatLng(fallback).setContent( < ? = json_encode(t('map.missing_coordinates'),
|
}).setLatLng(fallback).setContent( <?= json_encode(t('map.missing_coordinates'),
|
||||||
JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ? > ).openOn(map);
|
JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ?> ).openOn(map);
|
||||||
} else if (pts.length === 1) {
|
} else if (pts.length === 1) {
|
||||||
map.setView(pts[0], 14);
|
map.setView(pts[0], 14);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -246,8 +246,8 @@ if ($pageDescription === '') {
|
||||||
settingsMenu.classList.add('settings-menu-wide');
|
settingsMenu.classList.add('settings-menu-wide');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const globinoursPermissions = < ? = json_encode(PermissionService::currentPermissions(),
|
const globinoursPermissions = <?= json_encode(PermissionService::currentPermissions(),
|
||||||
JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) ? > ;
|
JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) ?> ;
|
||||||
const permissionModuleForPath = path => {
|
const permissionModuleForPath = path => {
|
||||||
if (path === '/' || path.startsWith('/dashboard')) return 'dashboard';
|
if (path === '/' || path.startsWith('/dashboard')) return 'dashboard';
|
||||||
if (path.startsWith('/animal/documents')) return 'medical';
|
if (path.startsWith('/animal/documents')) return 'medical';
|
||||||
|
|
@ -323,11 +323,11 @@ if ($pageDescription === '') {
|
||||||
form.appendChild(input);
|
form.appendChild(input);
|
||||||
});
|
});
|
||||||
const validationMessages = {
|
const validationMessages = {
|
||||||
required: < ? = json_encode(t('validation.required'), JSON_UNESCAPED_UNICODE) ? > ,
|
required: <?= json_encode(t('validation.required'), JSON_UNESCAPED_UNICODE) ?> ,
|
||||||
passwordMin: count => < ? = json_encode(t('validation.password_min'), JSON_UNESCAPED_UNICODE) ? >
|
passwordMin: count => <?= json_encode(t('validation.password_min'), JSON_UNESCAPED_UNICODE) ?>
|
||||||
.replace(':count', count),
|
.replace(':count', count),
|
||||||
invalidFormat: < ? = json_encode(t('validation.invalid_format'), JSON_UNESCAPED_UNICODE) ? > ,
|
invalidFormat: <?= json_encode(t('validation.invalid_format'), JSON_UNESCAPED_UNICODE) ?> ,
|
||||||
checkField: < ? = json_encode(t('validation.check_field'), JSON_UNESCAPED_UNICODE) ? >
|
checkField: <?= json_encode(t('validation.check_field'), JSON_UNESCAPED_UNICODE) ?>
|
||||||
};
|
};
|
||||||
document.querySelectorAll('form').forEach(form => {
|
document.querySelectorAll('form').forEach(form => {
|
||||||
if (!form.querySelector('input[type="password"]')) return;
|
if (!form.querySelector('input[type="password"]')) return;
|
||||||
|
|
@ -358,7 +358,7 @@ if ($pageDescription === '') {
|
||||||
});
|
});
|
||||||
document.querySelectorAll('input[type="date"]').forEach(input => {
|
document.querySelectorAll('input[type="date"]').forEach(input => {
|
||||||
flatpickr(input, {
|
flatpickr(input, {
|
||||||
locale: < ? = json_encode(I18n::locale() === 'fr' ? 'fr' : 'default') ? > ,
|
locale: <?= json_encode(I18n::locale() === 'fr' ? 'fr' : 'default') ?> ,
|
||||||
altInput: true,
|
altInput: true,
|
||||||
altFormat: 'd/m/Y',
|
altFormat: 'd/m/Y',
|
||||||
dateFormat: 'Y-m-d',
|
dateFormat: 'Y-m-d',
|
||||||
|
|
|
||||||
|
|
@ -56,8 +56,8 @@ if (!empty($litter['birth_date'])) {
|
||||||
</form>
|
</form>
|
||||||
<script>
|
<script>
|
||||||
document.getElementById('litterAnimalSearch')?.addEventListener('input', event => {
|
document.getElementById('litterAnimalSearch')?.addEventListener('input', event => {
|
||||||
const query = event.target.value.trim().toLocaleLowerCase( < ? = json_encode(I18n::locale() === 'fr' ?
|
const query = event.target.value.trim().toLocaleLowerCase( <?= json_encode(I18n::locale() === 'fr' ?
|
||||||
'fr' : 'en') ? > );
|
'fr' : 'en') ?> );
|
||||||
document.querySelectorAll('.litter-animal-choice').forEach(choice => {
|
document.querySelectorAll('.litter-animal-choice').forEach(choice => {
|
||||||
choice.classList.toggle('d-none', query !== '' && !choice.dataset.search.includes(query));
|
choice.classList.toggle('d-none', query !== '' && !choice.dataset.search.includes(query));
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -170,8 +170,8 @@ $prefillCount = max(0, min(20, (int)($_GET['count'] ?? 4)));
|
||||||
if (target < list.children.length) {
|
if (target < list.children.length) {
|
||||||
const removedRows = [...list.children].slice(target);
|
const removedRows = [...list.children].slice(target);
|
||||||
if (confirmRemoval && removedRows.some(hasValues) &&
|
if (confirmRemoval && removedRows.some(hasValues) &&
|
||||||
!window.confirm( < ? = json_encode(t('litter.reduce_confirm'), JSON_UNESCAPED_UNICODE |
|
!window.confirm( <?= json_encode(t('litter.reduce_confirm'), JSON_UNESCAPED_UNICODE |
|
||||||
JSON_UNESCAPED_SLASHES) ? > )) {
|
JSON_UNESCAPED_SLASHES) ?> )) {
|
||||||
countInput.value = list.children.length;
|
countInput.value = list.children.length;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -190,8 +190,8 @@ $prefillCount = max(0, min(20, (int)($_GET['count'] ?? 4)));
|
||||||
const mother = document.getElementById('motherId');
|
const mother = document.getElementById('motherId');
|
||||||
const father = document.getElementById('fatherId');
|
const father = document.getElementById('fatherId');
|
||||||
const syncExistingChoices = () => {
|
const syncExistingChoices = () => {
|
||||||
const query = existingSearch?.value.trim().toLocaleLowerCase( < ? = json_encode(I18n::locale() ===
|
const query = existingSearch?.value.trim().toLocaleLowerCase( <?= json_encode(I18n::locale() ===
|
||||||
'fr' ? 'fr' : 'en') ? > ) || '';
|
'fr' ? 'fr' : 'en') ?> ) || '';
|
||||||
document.querySelectorAll('.existing-kitten-choice').forEach(choice => {
|
document.querySelectorAll('.existing-kitten-choice').forEach(choice => {
|
||||||
const isParent = choice.dataset.animalId === mother?.value || choice.dataset
|
const isParent = choice.dataset.animalId === mother?.value || choice.dataset
|
||||||
.animalId === father?.value;
|
.animalId === father?.value;
|
||||||
|
|
|
||||||
|
|
@ -32,17 +32,17 @@ $obfuscate = static fn (string$value): string => implode('', array_reverse(mb_st
|
||||||
(() => {
|
(() => {
|
||||||
const map = L.map('association-map', {
|
const map = L.map('association-map', {
|
||||||
scrollWheelZoom: false
|
scrollWheelZoom: false
|
||||||
}).setView([ < ? = json_encode($lat) ? > , < ? = json_encode($lng) ? > ], 15);
|
}).setView([ <?= json_encode($lat) ?> , <?= json_encode($lng) ?> ], 15);
|
||||||
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||||
maxZoom: 19,
|
maxZoom: 19,
|
||||||
attribution: '© OpenStreetMap'
|
attribution: '© OpenStreetMap'
|
||||||
}).addTo(map);
|
}).addTo(map);
|
||||||
const popup = document.createElement('div');
|
const popup = document.createElement('div');
|
||||||
const name = document.createElement('strong');
|
const name = document.createElement('strong');
|
||||||
name.textContent = < ? = json_encode($association, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ? > ;
|
name.textContent = <?= json_encode($association, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ?> ;
|
||||||
popup.append(name, document.createElement('br'), document.createTextNode( < ? = json_encode($fullAddress,
|
popup.append(name, document.createElement('br'), document.createTextNode( <?= json_encode($fullAddress,
|
||||||
JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ? > ));
|
JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ?> ));
|
||||||
L.marker([ < ? = json_encode($lat) ? > , < ? = json_encode($lng) ? > ]).addTo(map).bindPopup(popup)
|
L.marker([ <?= json_encode($lat) ?> , <?= json_encode($lng) ?> ]).addTo(map).bindPopup(popup)
|
||||||
.openPopup();
|
.openPopup();
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -79,13 +79,13 @@
|
||||||
document.querySelectorAll('#asm3Form<?= (int)$job['
|
document.querySelectorAll('#asm3Form<?= (int)$job['
|
||||||
id '] ?> input[name="mode"]').forEach(el => el.addEventListener('change', () => {
|
id '] ?> input[name="mode"]').forEach(el => el.addEventListener('change', () => {
|
||||||
const replace = el.form.mode.value === 'replace';
|
const replace = el.form.mode.value === 'replace';
|
||||||
el.form.confirmation.placeholder = replace ? < ? = json_encode(t('asm3.type_replace'),
|
el.form.confirmation.placeholder = replace ? <?= json_encode(t('asm3.type_replace'),
|
||||||
JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ? > : < ? = json_encode(t(
|
JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ?> : <?= json_encode(t(
|
||||||
'asm3.type_import'), JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ? > ;
|
'asm3.type_import'), JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ?> ;
|
||||||
el.form.querySelector('.confirmation-hint strong').textContent = replace ? < ? =
|
el.form.querySelector('.confirmation-hint strong').textContent = replace ? <?=
|
||||||
json_encode(t('asm3.confirm_replace_phrase'), JSON_UNESCAPED_UNICODE |
|
json_encode(t('asm3.confirm_replace_phrase'), JSON_UNESCAPED_UNICODE |
|
||||||
JSON_UNESCAPED_SLASHES) ? > : < ? = json_encode(t('asm3.confirm_import_phrase'),
|
JSON_UNESCAPED_SLASHES) ?> : <?= json_encode(t('asm3.confirm_import_phrase'),
|
||||||
JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ? > ;
|
JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ?> ;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
</script><?php elseif ($result):?><details>
|
</script><?php elseif ($result):?><details>
|
||||||
|
|
|
||||||
|
|
@ -334,29 +334,28 @@ if (empty($costs['by_clinic'])):?><span class="text-muted"><?= h(t('statistics.n
|
||||||
new Chart(canvas, {
|
new Chart(canvas, {
|
||||||
type: 'line',
|
type: 'line',
|
||||||
data: {
|
data: {
|
||||||
labels: < ? = json_encode(array_map('strval', array_keys($timeline)),
|
labels: <?= json_encode(array_map('strval', array_keys($timeline)),
|
||||||
JSON_UNESCAPED_UNICODE) ? > ,
|
JSON_UNESCAPED_UNICODE) ?> ,
|
||||||
datasets: [{
|
datasets: [{
|
||||||
label: < ? = json_encode(t('statistics.handled'), JSON_UNESCAPED_UNICODE) ?
|
label: <?= json_encode(t('statistics.handled'), JSON_UNESCAPED_UNICODE) ?> ,
|
||||||
> ,
|
data: <?= json_encode(array_values(array_map(static fn($s) => (int) $s[
|
||||||
data: < ? = json_encode(array_values(array_map(static fn($s) => (int) $s[
|
'handled'], $timeline))) ?> ,
|
||||||
'handled'], $timeline))) ? > ,
|
|
||||||
borderColor: '#0ca678',
|
borderColor: '#0ca678',
|
||||||
backgroundColor: 'rgba(12,166,120,.12)',
|
backgroundColor: 'rgba(12,166,120,.12)',
|
||||||
tension: .3
|
tension: .3
|
||||||
}, {
|
}, {
|
||||||
label: < ? = json_encode(t('statistics.adoptions'),
|
label: <?= json_encode(t('statistics.adoptions'),
|
||||||
JSON_UNESCAPED_UNICODE) ? > ,
|
JSON_UNESCAPED_UNICODE) ?> ,
|
||||||
data: < ? = json_encode(array_values(array_map(static fn($s) => (int) $s[
|
data: <?= json_encode(array_values(array_map(static fn($s) => (int) $s[
|
||||||
'adoptions'], $timeline))) ? > ,
|
'adoptions'], $timeline))) ?> ,
|
||||||
borderColor: '#206bc4',
|
borderColor: '#206bc4',
|
||||||
backgroundColor: 'rgba(32,107,196,.12)',
|
backgroundColor: 'rgba(32,107,196,.12)',
|
||||||
tension: .3
|
tension: .3
|
||||||
}, {
|
}, {
|
||||||
label: < ? = json_encode(t('statistics.deaths'), JSON_UNESCAPED_UNICODE) ? >
|
label: <?= json_encode(t('statistics.deaths'), JSON_UNESCAPED_UNICODE) ?>
|
||||||
,
|
,
|
||||||
data: < ? = json_encode(array_values(array_map(static fn($s) => (int) $s[
|
data: <?= json_encode(array_values(array_map(static fn($s) => (int) $s[
|
||||||
'deaths'], $timeline))) ? > ,
|
'deaths'], $timeline))) ?> ,
|
||||||
borderColor: '#343a40',
|
borderColor: '#343a40',
|
||||||
backgroundColor: 'rgba(52,58,64,.10)',
|
backgroundColor: 'rgba(52,58,64,.10)',
|
||||||
tension: .3
|
tension: .3
|
||||||
|
|
|
||||||
|
|
@ -414,6 +414,22 @@ try {
|
||||||
(bool) $db->query('SELECT revoked_at FROM trusted_devices WHERE id=' . (int) $device['id'])->fetchColumn(),
|
(bool) $db->query('SELECT revoked_at FROM trusted_devices WHERE id=' . (int) $device['id'])->fetchColumn(),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
$test('Les vues ne contiennent aucune balise PHP déformée', function () use ($root, $assert): void {
|
||||||
|
$views = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($root . '/app/Views'));
|
||||||
|
foreach ($views as $view) {
|
||||||
|
if (!$view->isFile() || $view->getExtension() !== 'php') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$contents = file_get_contents($view->getPathname());
|
||||||
|
$assert($contents !== false, 'Vue illisible : ' . $view->getFilename());
|
||||||
|
foreach (['< ? =', '? >', ' - > '] as $brokenToken) {
|
||||||
|
$assert(
|
||||||
|
!str_contains($contents, $brokenToken),
|
||||||
|
'Syntaxe déformée dans ' . $view->getFilename() . ' : ' . $brokenToken,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
$test('La démonstration installe une fiche Twix complète', function () use ($db, $root, $assert): void {
|
$test('La démonstration installe une fiche Twix complète', function () use ($db, $root, $assert): void {
|
||||||
DemoDataService::reset($db);
|
DemoDataService::reset($db);
|
||||||
$summary = DemoDataService::seed($db, Auth::id());
|
$summary = DemoDataService::seed($db, Auth::id());
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue