fillReviewsHTML() {
    const container = document.getElementById('reviews-container');
    const title = document.createElement('h3');
    title.innerHTML = 'Reviews';
    container.appendChild(title);

    DBHelper.fetchReviewsByRestaurantId(this.restaurant.id, (error, reviews) => {
      if (error) {
        const noReviews = document.createElement('p');
        noReviews.innerHTML = 'No reviews yet!';
        container.appendChild(noReviews);
        return;
      } else {
        const ul = document.getElementById('reviews-list');
        const reviewsSortedByDate = this.sortReviewsByDate(reviews);
        reviewsSortedByDate.forEach(review => {
          ul.appendChild(this.createReviewHTML(review));
        });
        container.appendChild(ul);
      }

    });

    this.handleOnlineStatus();

  }
/**
   * Create all reviews HTML and add them to the webpage.
   */
Create all reviews HTML and add them to the webpage.
Create all reviews HTML and add them to the webpage .
fillReviewsHTML() {
    const container = document.getElementById('reviews-container');
    const title = document.createElement('h3');
    title.innerHTML = 'Reviews';
    container.appendChild(title);
    DBHelper.fetchReviewsByRestaurantId(this.restaurant.id, (error, reviews) => {
      if (error) {
        const noReviews = document.createElement('p');
        noReviews.innerHTML = 'No reviews yet!';
        container.appendChild(noReviews);
        return;
      } else {
        const ul = document.getElementById('reviews-list');
        const reviewsSortedByDate = this.sortReviewsByDate(reviews);
        reviewsSortedByDate.forEach(review => {
          ul.appendChild(this.createReviewHTML(review));
        });
        container.appendChild(ul);
      }
    });
    this.handleOnlineStatus();
  }
fillReviewsHTML ( ) { const container = document . getElementById ( 'reviews-container' ) ; const title = document . createElement ( 'h3' ) ; title . innerHTML = 'Reviews' ; container . appendChild ( title ) ; DBHelper . fetchReviewsByRestaurantId ( this . restaurant . id , ( error , reviews ) => { if ( error ) { const noReviews = document . createElement ( 'p' ) ; noReviews . innerHTML = 'No reviews yet!' ; container . appendChild ( noReviews ) ; return ; } else { const ul = document . getElementById ( 'reviews-list' ) ; const reviewsSortedByDate = this . sortReviewsByDate ( reviews ) ; reviewsSortedByDate . forEach ( review => { ul . appendChild ( this . createReviewHTML ( review ) ) ; } ) ; container . appendChild ( ul ) ; } } ) ; this . handleOnlineStatus ( ) ; }
Create all reviews HTML and add them to the webpage.
Create all reviews HTML and add them to the webpage .