highlight missing hours in restaurants
This commit is contained in:
parent
3b37a33c63
commit
7999ad078a
33
js/main.js
33
js/main.js
|
@ -986,11 +986,11 @@ function displayPointsFromApi(points) {
|
||||||
if (feature.properties.tags['name'] !== undefined) {
|
if (feature.properties.tags['name'] !== undefined) {
|
||||||
rest_name = feature.properties.tags['name'];
|
rest_name = feature.properties.tags['name'];
|
||||||
} else {
|
} else {
|
||||||
rest_name = '? ';
|
rest_name = 'nom ? ';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof feature.properties.tags['cuisine'] !== typeof undefined && feature.properties.tags['cuisine'].length) {
|
if (typeof feature.properties.tags['cuisine'] !== typeof undefined && feature.properties.tags['cuisine'].length) {
|
||||||
cuisine = ' - ' + feature.properties.tags['cuisine'];
|
cuisine = ' - cuisine: ' + (feature.properties.tags['cuisine'] | '');
|
||||||
}
|
}
|
||||||
|
|
||||||
let html = '<a href="https://www.openstreetmap.org/' + feature.id + '"> ' + rest_name + ' ' + cuisine + '</a>' +
|
let html = '<a href="https://www.openstreetmap.org/' + feature.id + '"> ' + rest_name + ' ' + cuisine + '</a>' +
|
||||||
|
@ -1048,9 +1048,38 @@ function makeCssClassFromTags(tags) {
|
||||||
listOfClasses.push('tag-' + element + '_' + tags[element].replace(':', '--'));
|
listOfClasses.push('tag-' + element + '_' + tags[element].replace(':', '--'));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
getIsOpenFromOpeningHours(tags)
|
||||||
|
|
||||||
|
if(tags['opening_hours']){
|
||||||
|
listOfClasses.push('tag-has-opening-hours')
|
||||||
|
}else{
|
||||||
|
listOfClasses.push('tag-no-opening-hours')
|
||||||
|
}
|
||||||
|
|
||||||
return listOfClasses.join(' ');
|
return listOfClasses.join(' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* trouver si un magasin est actuellement ouvert, ou si les infos de opening_hours sont absentes
|
||||||
|
* exemple: Mo 06:30-20:00; Tu 06:30-20:00; We off; Th 06:30-20:00;
|
||||||
|
* Fr 06:30-20:00; Sa 06:30-20:00; Su 06:30-13:30
|
||||||
|
* @param tags
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
function getIsOpenFromOpeningHours(tags){
|
||||||
|
let isOpen = 'has-no-opening-hours';
|
||||||
|
let currentDay = new Date();
|
||||||
|
let daysArray = ['Su','Mo','Tu','We','Th','Fr','Sa']
|
||||||
|
let todayInLetters = daysArray[currentDay.getDay()];
|
||||||
|
let todayInHour = daysArray[currentDay.getHours()];
|
||||||
|
|
||||||
|
if(tags['opening_hours'] ){
|
||||||
|
// trouver les sections séparées par des points virgule
|
||||||
|
// séparer les sections d'ouverture par un espace entre la plage de jour et les heures
|
||||||
|
}
|
||||||
|
console.log(tags['opening_hours'], isOpen )
|
||||||
|
return isOpen;
|
||||||
|
}
|
||||||
function getIconFromTags(tags) {
|
function getIconFromTags(tags) {
|
||||||
let iconFileName = 'icon_restaurant.png';
|
let iconFileName = 'icon_restaurant.png';
|
||||||
if (tags['man_made']) {
|
if (tags['man_made']) {
|
||||||
|
|
|
@ -133,7 +133,12 @@ img.leaflet-marker-icon.diet--vegetarian_yes{
|
||||||
.pull-left{
|
.pull-left{
|
||||||
float:left;
|
float:left;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
mettre en valeur les restaurants qui n'ont pas renseigné leurs horaires d'ouverture
|
||||||
|
*/
|
||||||
|
.tag-no-opening-hours.tag-amenity_restaurant{
|
||||||
|
background: #333333 !important;
|
||||||
|
}
|
||||||
@keyframes spin {
|
@keyframes spin {
|
||||||
0% { transform: rotate(0deg); }
|
0% { transform: rotate(0deg); }
|
||||||
100% { transform: rotate(359deg); }
|
100% { transform: rotate(359deg); }
|
||||||
|
|
Loading…
Reference in New Issue