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
|
|
@ -81,15 +81,15 @@ if ($pageDescription === '') {
|
|||
<script>
|
||||
(function() {
|
||||
const rescue = {
|
||||
lat: < ? = $hasRescue ? (float) $rescueLat : 'null' ? > ,
|
||||
lng: < ? = $hasRescue ? (float) $rescueLng : 'null' ? > ,
|
||||
addr: < ? = json_encode($rescueAddr, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ? >
|
||||
lat: <?= $hasRescue ? (float) $rescueLat : 'null' ?> ,
|
||||
lng: <?= $hasRescue ? (float) $rescueLng : 'null' ?> ,
|
||||
addr: <?= json_encode($rescueAddr, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ?>
|
||||
};
|
||||
|
||||
const cur = {
|
||||
lat: < ? = $hasCurrent ? (float) $currentLat : 'null' ? > ,
|
||||
lng: < ? = $hasCurrent ? (float) $currentLng : 'null' ? > ,
|
||||
addr: < ? = json_encode($currentAddr, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ? >
|
||||
lat: <?= $hasCurrent ? (float) $currentLat : 'null' ?> ,
|
||||
lng: <?= $hasCurrent ? (float) $currentLng : 'null' ?> ,
|
||||
addr: <?= json_encode($currentAddr, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ?>
|
||||
};
|
||||
|
||||
const el = document.getElementById('mapJourney');
|
||||
|
|
@ -102,16 +102,16 @@ if ($pageDescription === '') {
|
|||
className: '',
|
||||
iconSize: [18, 18],
|
||||
iconAnchor: [9, 9],
|
||||
html: '<div class="twix-pin rescue" title="' + < ? = json_encode(t('map.rescue'),
|
||||
JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ? > +'"></div>'
|
||||
html: '<div class="twix-pin rescue" title="' + <?= json_encode(t('map.rescue'),
|
||||
JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ?> +'"></div>'
|
||||
});
|
||||
|
||||
const iconCurrent = L.divIcon({
|
||||
className: '',
|
||||
iconSize: [18, 18],
|
||||
iconAnchor: [9, 9],
|
||||
html: '<div class="twix-pin current" title="' + < ? = json_encode(t('map.current'),
|
||||
JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ? > +'"></div>'
|
||||
html: '<div class="twix-pin current" title="' + <?= json_encode(t('map.current'),
|
||||
JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ?> +'"></div>'
|
||||
});
|
||||
|
||||
const map = L.map('mapJourney', {
|
||||
|
|
@ -144,8 +144,8 @@ if ($pageDescription === '') {
|
|||
icon: iconRescue
|
||||
})
|
||||
.addTo(map)
|
||||
.bindPopup(safePopup( < ? = json_encode(t('map.rescue'), JSON_UNESCAPED_UNICODE |
|
||||
JSON_UNESCAPED_SLASHES) ? > , rescue.addr), {
|
||||
.bindPopup(safePopup( <?= json_encode(t('map.rescue'), JSON_UNESCAPED_UNICODE |
|
||||
JSON_UNESCAPED_SLASHES) ?> , rescue.addr), {
|
||||
autoPan: false, // <-- stop le déplacement
|
||||
closeButton: false
|
||||
});
|
||||
|
|
@ -158,8 +158,8 @@ if ($pageDescription === '') {
|
|||
icon: iconCurrent
|
||||
})
|
||||
.addTo(map)
|
||||
.bindPopup(safePopup( < ? = json_encode(t('map.current'), JSON_UNESCAPED_UNICODE |
|
||||
JSON_UNESCAPED_SLASHES) ? > , cur.addr), {
|
||||
.bindPopup(safePopup( <?= json_encode(t('map.current'), JSON_UNESCAPED_UNICODE |
|
||||
JSON_UNESCAPED_SLASHES) ?> , cur.addr), {
|
||||
autoPan: false, // <-- stop le déplacement
|
||||
closeButton: false
|
||||
});
|
||||
|
|
@ -169,8 +169,8 @@ if ($pageDescription === '') {
|
|||
map.setView(fallback, 8);
|
||||
L.popup({
|
||||
autoPan: false
|
||||
}).setLatLng(fallback).setContent( < ? = json_encode(t('map.missing_coordinates'),
|
||||
JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ? > ).openOn(map);
|
||||
}).setLatLng(fallback).setContent( <?= json_encode(t('map.missing_coordinates'),
|
||||
JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ?> ).openOn(map);
|
||||
} else if (pts.length === 1) {
|
||||
map.setView(pts[0], 14);
|
||||
} else {
|
||||
|
|
@ -246,8 +246,8 @@ if ($pageDescription === '') {
|
|||
settingsMenu.classList.add('settings-menu-wide');
|
||||
}
|
||||
}
|
||||
const globinoursPermissions = < ? = json_encode(PermissionService::currentPermissions(),
|
||||
JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) ? > ;
|
||||
const globinoursPermissions = <?= json_encode(PermissionService::currentPermissions(),
|
||||
JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) ?> ;
|
||||
const permissionModuleForPath = path => {
|
||||
if (path === '/' || path.startsWith('/dashboard')) return 'dashboard';
|
||||
if (path.startsWith('/animal/documents')) return 'medical';
|
||||
|
|
@ -323,11 +323,11 @@ if ($pageDescription === '') {
|
|||
form.appendChild(input);
|
||||
});
|
||||
const validationMessages = {
|
||||
required: < ? = json_encode(t('validation.required'), JSON_UNESCAPED_UNICODE) ? > ,
|
||||
passwordMin: count => < ? = json_encode(t('validation.password_min'), JSON_UNESCAPED_UNICODE) ? >
|
||||
required: <?= json_encode(t('validation.required'), JSON_UNESCAPED_UNICODE) ?> ,
|
||||
passwordMin: count => <?= json_encode(t('validation.password_min'), JSON_UNESCAPED_UNICODE) ?>
|
||||
.replace(':count', count),
|
||||
invalidFormat: < ? = json_encode(t('validation.invalid_format'), JSON_UNESCAPED_UNICODE) ? > ,
|
||||
checkField: < ? = json_encode(t('validation.check_field'), JSON_UNESCAPED_UNICODE) ? >
|
||||
invalidFormat: <?= json_encode(t('validation.invalid_format'), JSON_UNESCAPED_UNICODE) ?> ,
|
||||
checkField: <?= json_encode(t('validation.check_field'), JSON_UNESCAPED_UNICODE) ?>
|
||||
};
|
||||
document.querySelectorAll('form').forEach(form => {
|
||||
if (!form.querySelector('input[type="password"]')) return;
|
||||
|
|
@ -358,7 +358,7 @@ if ($pageDescription === '') {
|
|||
});
|
||||
document.querySelectorAll('input[type="date"]').forEach(input => {
|
||||
flatpickr(input, {
|
||||
locale: < ? = json_encode(I18n::locale() === 'fr' ? 'fr' : 'default') ? > ,
|
||||
locale: <?= json_encode(I18n::locale() === 'fr' ? 'fr' : 'default') ?> ,
|
||||
altInput: true,
|
||||
altFormat: 'd/m/Y',
|
||||
dateFormat: 'Y-m-d',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue