|
1 | 1 | {% extends "events/base.html" %} |
| 2 | + |
2 | 3 | {% block content %} |
3 | | -<div> |
4 | | - <div class="row g-5"> |
5 | | - <div class="col-md-8"> |
6 | | - <article class="blog-post"> |
7 | | - <h2 class="display-5 link-body-emphasis mb-1">{{ event.name }}</h2> |
8 | | - <p class="blog-post-meta">{{ event.date }} by {{ event.organizer }}</p> |
| 4 | +<div class="row g-5"> |
| 5 | + <div class="col-md-8"> |
| 6 | + <article class="blog-post"> |
| 7 | + <h2 class="display-5 link-body-emphasis mb-1">{{ event.name }}</h2> |
| 8 | + <p class="blog-post-meta">{{ event.date }} by {{ event.organizer }}</p> |
9 | 9 |
|
10 | | - <p>{{ event.description }}</p> |
11 | | - <hr> |
| 10 | + <p>{{ event.description }}</p> |
| 11 | + <hr> |
12 | 12 |
|
13 | | - <h2>Location</h2> |
14 | | - <p>{{ event.location }}</p> |
| 13 | + <h2>Location</h2> |
| 14 | + <p>{{ event.location }}</p> |
15 | 15 |
|
16 | | - <h3>Number of Participants</h3> |
17 | | - <p>{{ event.max_participants }}</p> |
| 16 | + <h3>Number of Participants</h3> |
| 17 | + <p>{{ event.max_participants }}</p> |
18 | 18 |
|
19 | | - <h3>Venue Details</h3> |
20 | | - <dl> |
21 | | - <dt>Name</dt> |
22 | | - <dd>{{ event.venue.name }}</dd> |
23 | | - <dt>Address</dt> |
24 | | - <dd> |
25 | | - {% if event.venue.is_virtual %} |
26 | | - Virtual |
27 | | - {% else %} |
28 | | - {{ event.venue.address }} |
29 | | - {% endif %} |
30 | | - </dd> |
31 | | - </dl> |
32 | | - </article> |
33 | | - </div> |
| 19 | + <h3>Venue Details</h3> |
| 20 | + <dl> |
| 21 | + <dt>Name</dt> |
| 22 | + <dd>{{ event.venue.name }}</dd> |
| 23 | + <dt>Address</dt> |
| 24 | + <dd> |
| 25 | + {% if event.venue.is_virtual %} |
| 26 | + Virtual |
| 27 | + {% else %} |
| 28 | + {{ event.venue.address }} |
| 29 | + {% endif %} |
| 30 | + </dd> |
| 31 | + </dl> |
| 32 | + </article> |
| 33 | + </div> |
34 | 34 |
|
35 | | - <div class="col-md-4"> |
36 | | - <div class="position-sticky" style="top: 2rem;"> |
37 | | - <div class="p-4"> |
38 | | - <ol class="list-unstyled"> |
39 | | - {% if not past_event %} |
40 | | - <p class="my-2">Spots Left: {{ tickets }}</p> |
41 | | - {% endif %} |
| 35 | + <div class="col-md-4"> |
| 36 | + <div class="position-sticky" style="top: 2rem;"> |
| 37 | + <div class="p-4"> |
| 38 | + <ol class="list-unstyled"> |
| 39 | + {% if not past_event %} |
| 40 | + <p class="my-2">Spots Left: {{ tickets }}</p> |
| 41 | + {% endif %} |
42 | 42 |
|
43 | | - {% if user %} |
44 | | - {% if event.organizer != user %} |
45 | | - <li> |
46 | | - {% if tickets == 0 or past_event %} |
47 | | - Finished |
48 | | - {% else %} |
49 | | - <a class="w-100 btn my-2 btn-lg btn-primary" |
50 | | - href="{% url 'buy-ticket' event.id %}"> |
51 | | - {% if ticket %} |
52 | | - Registered |
53 | | - {% else %} |
54 | | - Get Spot |
55 | | - {% endif %} |
56 | | - </a> |
57 | | - {% endif %} |
58 | | - </li> |
59 | | - {% endif %} |
| 43 | + {% if user %} |
| 44 | + {% if event.organizer != user %} |
| 45 | + <li> |
| 46 | + {% if tickets == 0 or past_event %} |
| 47 | + Finished |
| 48 | + {% else %} |
| 49 | + <a class="w-100 btn btn-lg btn-primary my-2" href="{% url 'buy-ticket' event.id %}"> |
| 50 | + {% if ticket %} |
| 51 | + Registered |
| 52 | + {% else %} |
| 53 | + Get Spot |
| 54 | + {% endif %} |
| 55 | + </a> |
| 56 | + {% endif %} |
| 57 | + </li> |
| 58 | + {% endif %} |
60 | 59 |
|
61 | | - {% if event.organizer == user %} |
62 | | - <li> |
63 | | - <a class="w-100 btn my-2 btn-lg btn-primary" |
64 | | - href="{% url 'edit_event' event.id %}"> |
65 | | - Edit Event |
66 | | - </a> |
67 | | - </li> |
68 | | - <form action="{% url 'delete_event' event.id %}" method="POST" style="display: inline;"> |
69 | | - {% csrf_token %} |
70 | | - <button type="submit" class="w-100 btn my-2 btn-lg btn-danger" |
71 | | - onclick="return confirm('Are you sure you want to delete this event?');"> |
72 | | - Delete Event |
73 | | - </button> |
74 | | - </form> |
75 | | - {% endif %} |
76 | | - {% else %} |
77 | | - <li> |
78 | | - <a class="w-100 btn my-2 btn-lg btn-primary" |
79 | | - href="{% url 'buy-ticket' event.id %}" |
80 | | - {% if tickets == 0 %} disabled {% endif %}> |
81 | | - Get Spot |
82 | | - </a> |
83 | | - </li> |
84 | | - {% endif %} |
85 | | - </ol> |
86 | | - </div> |
87 | | - </div> |
88 | | - </div> |
| 60 | + {% if event.organizer == user %} |
| 61 | + <li> |
| 62 | + <a class="w-100 btn btn-lg btn-primary my-2" href="{% url 'edit_event' event.id %}"> |
| 63 | + Edit Event |
| 64 | + </a> |
| 65 | + </li> |
| 66 | + <form action="{% url 'delete_event' event.id %}" method="POST" style="display: inline;"> |
| 67 | + {% csrf_token %} |
| 68 | + <button type="submit" class="w-100 btn btn-lg btn-danger my-2" onclick="return confirm('Are you sure you want to delete this event?');"> |
| 69 | + Delete Event |
| 70 | + </button> |
| 71 | + </form> |
| 72 | + {% endif %} |
| 73 | + {% else %} |
| 74 | + <li> |
| 75 | + <a class="w-100 btn btn-lg btn-primary my-2" href="{% url 'buy-ticket' event.id %}" {% if tickets == 0 %} disabled {% endif %}> |
| 76 | + Get Spot |
| 77 | + </a> |
| 78 | + </li> |
| 79 | + {% endif %} |
| 80 | + </ol> |
| 81 | + </div> |
89 | 82 | </div> |
90 | | - |
91 | | - <hr/> |
| 83 | + </div> |
| 84 | +</div> |
92 | 85 |
|
93 | | - {% if past_event and ticket%} |
94 | | - {% include "events/components/reviews_event.html" with reviews=reviews rating=rating user=user%} |
95 | | - {% if not review%} |
96 | | - <form class="needs-validation my-4" method="post" action="{% url 'add-review' event.id %}?next={{ request.path }}"> |
97 | | - {% csrf_token %} |
| 86 | +<hr /> |
98 | 87 |
|
99 | | - <div> |
100 | | - <label class="form-label" for="review">Review:</label> |
101 | | - <textarea class="form-control" id="review" name="review" required></textarea> |
102 | | - </div> |
| 88 | +{% if past_event and ticket %} |
| 89 | + {% include "events/components/reviews_event.html" with reviews=reviews rating=rating user=user %} |
| 90 | +{% endif %} |
103 | 91 |
|
104 | | - |
105 | | - <div> |
106 | | - <label class="form-label" for="rating">Rating on 5:</label> |
107 | | - <input class="form-control" type="number" id="rating" name="rating" required min="1" max="5" /> |
108 | | - </div> |
| 92 | +{% if past_event %} |
| 93 | + {% if event.organizer != user %} |
| 94 | + {% if not review or review.reviewer != user %} |
| 95 | + <form class="needs-validation my-4" method="post" action="{% url 'add-review' event.id %}?next={{ request.path }}"> |
| 96 | + {% csrf_token %} |
109 | 97 |
|
110 | | - <button class="mt-4 w-100 btn btn-primary btn-sm" type="submit">Submit</button> |
111 | | - </form> |
112 | | - {% endif %} |
| 98 | + <div class="mb-3"> |
| 99 | + <label for="review" class="form-label">Review:</label> |
| 100 | + <textarea class="form-control" id="review" name="review" required></textarea> |
| 101 | + </div> |
| 102 | + |
| 103 | + <div class="mb-3"> |
| 104 | + <label for="rating" class="form-label">Rating on 5:</label> |
| 105 | + <input class="form-control" type="number" id="rating" name="rating" required min="1" max="5" /> |
| 106 | + </div> |
| 107 | + |
| 108 | + <button class="mt-4 w-100 btn btn-primary btn-sm" type="submit">Submit</button> |
| 109 | + </form> |
113 | 110 | {% endif %} |
114 | | -</div> |
| 111 | + {% endif %} |
| 112 | +{% endif %} |
| 113 | + |
115 | 114 | {% endblock %} |
0 commit comments