diff --git a/js/main.js b/js/main.js index d81547b..2b6348f 100644 --- a/js/main.js +++ b/js/main.js @@ -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 = ' ' + rest_name + ' ' + cuisine + '' + @@ -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']) { diff --git a/styles/style.css b/styles/style.css index 8df5139..511ddbe 100644 --- a/styles/style.css +++ b/styles/style.css @@ -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); }