highlight missing hours in restaurants

This commit is contained in:
Tykayn 2022-12-11 16:14:20 +01:00 committed by tykayn
parent 3b37a33c63
commit 7999ad078a
2 changed files with 37 additions and 3 deletions

View File

@ -986,11 +986,11 @@ function displayPointsFromApi(points) {
if (feature.properties.tags['name'] !== undefined) {
rest_name = feature.properties.tags['name'];
} else {
rest_name = '? ';
rest_name = 'nom ? ';
}
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>' +
@ -1048,9 +1048,38 @@ function makeCssClassFromTags(tags) {
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(' ');
}
/**
* 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) {
let iconFileName = 'icon_restaurant.png';
if (tags['man_made']) {

View File

@ -133,7 +133,12 @@ img.leaflet-marker-icon.diet--vegetarian_yes{
.pull-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 {
0% { transform: rotate(0deg); }
100% { transform: rotate(359deg); }