File: details.html

package info (click to toggle)
python-azure 20250603%2Bgit-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 851,724 kB
  • sloc: python: 7,362,925; ansic: 804; javascript: 287; makefile: 195; sh: 145; xml: 109
file content (117 lines) | stat: -rw-r--r-- 4,790 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
{% extends "base.html" %}
{% block title %}Restaurant Details{% endblock %}
{% block head %}
    {{ super() }}
    <style>
      body {
          min-height: 75rem;
          padding-top: 4.5rem;
      }
  </style>
{% endblock %}
{% block content %}
  <h1>{{ restaurant.name }}</h1> 
  <div class="row">
      <div class="col-md-2 fw-bold">Street address:</div>
      <div class="col">{{ restaurant.street_address }}</div>
  </div>
  <div class="row">
      <div class="col-md-2 fw-bold">Description:</div>
      <div class="col">{{ restaurant.description }}</div>                
  </div>
  <div class="row">
      <div class="col-md-2 fw-bold">Rating:</div>
      <div class="col"></div>                
  </div>

  <h4 class="mt-5">Reviews</h4>

  <p>
      <button type="button" class="btn btn-success" data-bs-toggle="modal" data-bs-target="#addReviewModal">
          Add new review
      </button>
  </p>

<!-- Button trigger modal -->
    {% if reviews %}
        <table class="table">
            <thead>
                <tr>
                    <th>Date</th>
                    <th>User</th>
                    <th>Rating</th>
                    <th>Review</th>
                </tr>
            </thead>
            <tbody>
                {% for review in reviews %}
                    <tr>
                        <td>{{ review.review_date }}</td>
                        <td>{{ review.user_name }}</td>
                        <td>{{ review.rating }}</td>
                        <td>{{ review.review_text }}</td>
                    </tr>
                {% endfor %}
            </tbody>
        </table>
    {% else %}
        <p>No reviews of this restaurant yet.</p>
    {% endif %}

    <!-- Modal -->
    <div class="modal fade" id="addReviewModal" tabindex="-1" aria-labelledby="addReviewModalLabel" aria-hidden="true">
      <div class="modal-dialog">
        <div class="modal-content">
          <div class="modal-header">
            <h5 class="modal-title" id="addReviewModalLabel">Add Review</h5>
            <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
          </div>
            {% if error %}
              <p class=error><strong>Error:</strong> {{ error }}
            {% endif %}
              <form method="POST" action="{{ url_for('add_review', id=restaurant.id) }}">

              <div class="modal-body">

                <div class="mb-3">                        
                    <label for="user_name" class="form-label fw-bold">Your name</label>
                    <input type="text" class="form-control" id="user_name" name="user_name">
                  </div>
                  <div class="mb-3">
                    <label class="form-label fw-bold">Rating</label>

                    <div class="form-check form-check-inline">
                        <input class="form-check-input" type="radio" name="rating" id="rating1" value="1">
                        <label class="form-check-label" for="rating1">1</label>
                      </div>
                      <div class="form-check form-check-inline">
                        <input class="form-check-input" type="radio" name="rating" id="rating2" value="2">
                        <label class="form-check-label" for="rating2">2</label>
                      </div>
                      <div class="form-check form-check-inline">
                        <input class="form-check-input" type="radio" name="rating" id="rating3" value="3">
                        <label class="form-check-label" for="rating3">3</label>
                      </div>
                      <div class="form-check form-check-inline">
                        <input class="form-check-input" type="radio" name="rating" id="rating4" value="4">
                        <label class="form-check-label" for="rating3">4</label>
                      </div>
                      <div class="form-check form-check-inline">
                        <input class="form-check-input" type="radio" name="rating" id="rating5" value="5">
                        <label class="form-check-label" for="rating3">5</label>
                      </div>
                  </div>
                  <div class="mb-3">
                      <label for="review_text" class="form-label fw-bold">Comments</label>
                      <input type="text" class="form-control" id="review_text" name="review_text">
                  </div>
              </div>
              <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
                <button type="submit" class="btn btn-primary">Save changes</button>
              </div>
        </form>
        </div>
      </div>
    </div>
{% endblock %}