Commit ee2bd4d2 authored by Moreau Elise's avatar Moreau Elise
Browse files

add map on user's profile

parent b1e7823c
......@@ -56845,7 +56845,7 @@ var parent = module.bundle.parent;
if ((!parent || !parent.isParcelRequire) && typeof WebSocket !== 'undefined') {
var hostname = "" || location.hostname;
var protocol = location.protocol === 'https:' ? 'wss' : 'ws';
var ws = new WebSocket(protocol + '://' + hostname + ':' + "45785" + '/');
var ws = new WebSocket(protocol + '://' + hostname + ':' + "34989" + '/');
 
ws.onmessage = function (event) {
checkedAssets = {};
......@@ -39,23 +39,26 @@ class NearContaminatedUsers extends UserAction
$currentUser = $this->userRepository->find($_SESSION['userId']);
$location = $this->locationRepository->find($currentUser->getLocationId());
$location = $currentUser->getLocation();
// $location = $this->locationRepository->find($location->getId());
$userLatitude = $location->getLatitude();
$userLongitude = $location->getLongitude();
$latitude_min = $userLatitude - 1 ;
$latitude_max = $userLatitude + 1 ;
$longitude_min = $userLongitude - 1 ;
$longitude_max = $userLongitude + 1 ;
$latitude_min = $userLatitude - 0.01;
$latitude_max = $userLatitude + 0.01;
$longitude_min = $userLongitude - 0.01;
$longitude_max = $userLongitude + 0.01;
$qb = $this->em->createQueryBuilder()
->select('u')
->from('App\Domain\User\User', 'u')
->join('u.location', 'l')
->where('u.contaminated = 1')
->andWhere('u.location.latitude >= :latitude_min')
->andWhere('u.location.latitude <= :latitude_max')
->andWhere('u.location.longitude >= :longitude_min')
->andWhere('u.location.longitude <= :longitude_max')
->andWhere('l.latitude >= :latitude_min')
->andWhere('l.latitude <= :latitude_max')
->andWhere('l.longitude >= :longitude_min')
->andWhere('l.longitude <= :longitude_max')
->setParameter('latitude_min', $latitude_min)
->setParameter('latitude_max', $latitude_max)
->setParameter('longitude_min', $longitude_min)
......
......@@ -26,7 +26,9 @@
</div>
</div>
</div>
{% if session.userId == user.getId %}
<div id="map" class="col s10 m10 l10 xl10"></div>
{% endif %}
</div>
<div class="col s12 m12 l12 xl12 ">
......@@ -72,4 +74,20 @@
<script type="text/javascript" src="/assets/js/users-search.js"></script>
{% if session.userId == user.getId %}
<script>
window.addEventListener('load', function(){
const { viewMap } = parcelRequire('map.js');
$.ajax({
type: 'GET',
url: '/api/nearcontaminatedusers',
dataType: 'json',
success: function (body) {
viewMap({ lat: 48.6833, long: 6.2 }, body.data);
}
});
});
</script>
{% endif %}
{% endblock %}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment