сделал страницу отображения заказов

This commit is contained in:
Андрей Дувакин 2024-04-22 20:44:54 +05:00
parent dbabe3d818
commit bb6d57cf17
9 changed files with 195 additions and 12 deletions

View File

@ -39,12 +39,7 @@
margin-top: 5vw;
}
.description_card::-webkit-scrollbar {
width: 7px;
}
.description_card::-webkit-scrollbar-thumb {
background-color: #0d1d3a;
border-radius: 5vw;
border: 1px solid #eaeaea;
display: none;
}
.session_title_block {
margin-top: 1vw;

View File

@ -71,11 +71,9 @@
.countries_block {
max-width: 15vw;
overflow-x: auto;
margin-left: 0.8vw;
display: flex;
flex-wrap: nowrap;
flex-direction: row;
padding: 0.2vw;
border-radius: 0.5vw;
}
.countries {
@ -85,10 +83,11 @@
margin-left: 0.1vw;
flex-direction: row;
}
.countries span {
.countries span, .film_duration {
color: #aaaaaa;
font-weight: bold;
padding: 0.4vw;
margin-left: 0.6vw;
}
.countries_block::-webkit-scrollbar {
height: 5px;

View File

@ -0,0 +1,130 @@
.my_order_card {
width: 100%;
background-color: #eaeaea;
margin-top: 1vw;
margin-bottom: 1vw;
border-radius: 3vw;
display: flex;
flex-direction: row;
flex-wrap: nowrap;
align-items: center;
justify-content: flex-start;
}
.age_limit {
margin-left: 1vw;
padding: 0.1vw;
padding-left: 0.25vw;
padding-right: 0.25vw;
border: 0.15vw solid #aaaaaa;
color: #aaaaaa;
font-weight: bold;
border-radius: 0.5vw;
font-size: 0.7vw;
}
.film_card_image {
object-fit: cover;
height: 15vw !important;
width: 10vw !important;
border-radius: 3vw;
}
.film_card_column {
display: flex;
flex-direction: column;
align-items: flex-start;
justify-content: space-around;
height: 13vw;
margin-left: 2vw;
overflow-x: scroll;
}
.film_card_column::-webkit-scrollbar {
height: 7px;
}
.film_card_column::-webkit-scrollbar-thumb {
background-color: #0d1d3a;
border-radius: 5vw;
border: 1px solid #eaeaea;
}
.film_card_title_row {
height: 17%;
margin-top: 0.5vw;
margin-bottom: 0.5vw;
display: flex;
flex-direction: row;
flex-wrap: nowrap;
align-items: center;
justify-content: space-evenly;
}
.film_card_row {
height: 66%;
display: flex;
align-items: center;
flex-direction: row;
flex-wrap: nowrap;
}
.film_card_footer {
height: 17%;
display: flex;
align-items: flex-start;
flex-direction: row;
flex-wrap: nowrap;
}
.countries_block {
max-width: 15vw;
overflow-x: auto;
display: flex;
flex-wrap: nowrap;
flex-direction: row;
border-radius: 0.5vw;
}
.countries {
display: flex;
flex-wrap: nowrap;
align-items: center;
margin-left: 0.1vw;
flex-direction: row;
}
.countries span, .film_duration {
color: #aaaaaa;
font-weight: bold;
padding: 0.4vw;
margin-left: 0.6vw;
}
.countries_block::-webkit-scrollbar {
height: 5px;
}
.countries_block::-webkit-scrollbar-thumb {
background-color: #0d1d3a;
border-radius: 5vw;
border: 2px solid #eaeaea;
}
.film_title {
font-size: 1.5vw;
max-width: 40vw;
text-wrap: nowrap;
overflow-x: auto;
}
.film_title::-webkit-scrollbar {
height: 7px;
}
.film_title::-webkit-scrollbar-thumb {
background-color: #0d1d3a;
border-radius: 5vw;
border: 1px solid #eaeaea;
}
.ticket {
background-color: #0d1d3a;
padding: 0.5vw;
color: #eaeaea;
margin: 1vw;
display: flex;
flex-direction: column;
flex-wrap: nowrap;
justify-content: center;
align-items: flex-start;
font-weight: bold;
border-radius: 1vw;
width: 5vw;
}
.column {
width: 18vw;
}

View File

@ -1,3 +1,8 @@
.header_title {
margin-top: 5vw;
}
.my_orders_block {
width: 80%;
margin-left: 10%;
margin-right: 10%;
}

View File

@ -1,6 +1,7 @@
{% load static %}
<link href="{% static 'css/includes/film_timtable_card.css' %}" rel="stylesheet">
<div class="film_card">
{% if film.image %}
<img src="{{ film.image.url }}" class="d-block w-100 film_card_image film_card_item"
alt="Фотография фильма не найдена">
@ -9,8 +10,9 @@
{% endif %}
<div class="film_card_column">
<div class="film_card_title_row">
<label class="film_title">{{film.name}}</label>
<label class="film_title">{{ film.name }}</label>
<span class="age_limit">{{ film.age_limit }}</span>
<span class="film_duration">{{ film.duration }}мин.</span>
<div class="countries_block">
{% for country in film.countries.all %}
<div class="countries">

View File

@ -0,0 +1,42 @@
{% load static %}
<link href="{% static 'css/includes/my_order_card.css' %}" rel="stylesheet">
<div class="my_order_card">
{% if order.session.film.image %}
<img src="{{ order.session.film.image.url }}" class="d-block w-100 film_card_image film_card_item"
alt="Фотография фильма не найдена">
{% else %}
<p class="no-image-msg">Картинки нет :( {{order.session.film}}</p>
{% endif %}
<div class="film_card_column">
<div class="film_card_title_row">
<label class="film_title">{{ order.session.film.name }}</label>
<span class="age_limit">{{ order.session.film.age_limit }}</span>
<span class="film_duration">{{ order.session.film.duration }}мин.</span>
<div class="countries_block">
{% for country in order.session.film.countries.all %}
<div class="countries">
<span>{{ country }}</span>
</div>
{% endfor %}
</div>
</div>
<div class="film_card_row">
<div class="column">
<p class="film_info_text">{{ order.session.auditorium.number }}</p>
<p class="film_info_text">{{ order.session.start_datetime }}</p>
<p class="film_info_text">Заказ от: {{ order.datetime_order }}</p>
</div>
{% for ticket in order.tickets.all %}
<div class="ticket">
<label>Ряд - {{ticket.row_number}}</label>
<label>Место - {{ticket.column_number}}</label>
</div>
{% endfor %}
</div>
<div class="film_card_footer">
{% for genre in order.session.film.genres.all %}
<div class="badge text-bg-secondary genre">{{genre.name}}</div>
{% endfor %}
</div>
</div>
</div>

View File

@ -9,6 +9,8 @@
<link href="{% static 'css/tickets/my_orders.css' %}" rel="stylesheet">
<h1 class="header_title">Мои заказы</h1>
<div class="my_orders_block">
{% for order in my_orders %}
{% include "includes/my_order_card.html" %}
{% endfor %}
</div>
{% endblock %}

View File

@ -31,6 +31,9 @@ class Order(Model):
help_text='Дата и время оформления заказа',
)
def __str__(self):
return f'{self.profile} {self.session}'
class Meta:
db_table = 'tickets_orders'
verbose_name = 'Заказ'

View File

@ -18,12 +18,17 @@ def my_orders(request):
orders = get_list_or_404(
Order.objects.filter(
profile__id=user.profile.id,
).select_related(
'session',
'session__film',
).prefetch_related(
'tickets',
).order_by(
'-datetime_order'
)
)
context = {
'orders': orders,
'my_orders': orders,
}
template = 'tickets/my_orders.html'