feat: бронирование товаров и сброс пароля по email
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -17,6 +17,15 @@
|
||||
<p class="product-detail__desc"><%= product.description %></p>
|
||||
<p class="product-detail__stock">В наличии: <strong><%= product.stock %></strong> шт.</p>
|
||||
|
||||
<% if (error) { %><p class="alert alert--error"><%= error %></p><% } %>
|
||||
<% if (reserved) { %><p class="alert alert--success">Товар успешно забронирован. Подробности на почте и в личном кабинете.</p><% } %>
|
||||
<% if (userReservation) { %>
|
||||
<p class="alert alert--success">
|
||||
У вас активная бронь: <%= userReservation.quantity %> шт. до <%= new Date(userReservation.expires_at).toLocaleString('ru-RU') %>.
|
||||
<a href="/account?tab=reservations">Мои бронирования</a>
|
||||
</p>
|
||||
<% } %>
|
||||
|
||||
<% if (product.stock > 0) { %>
|
||||
<form action="/cart/add" method="post" class="product-detail__form">
|
||||
<input type="hidden" name="product_id" value="<%= product.id %>">
|
||||
@@ -27,6 +36,20 @@
|
||||
<input type="hidden" name="redirect" value="/cart">
|
||||
<button type="submit" class="btn btn--primary btn--lg">Добавить в корзину</button>
|
||||
</form>
|
||||
|
||||
<% if (user && !userReservation) { %>
|
||||
<form action="/reservations" method="post" class="product-detail__form">
|
||||
<input type="hidden" name="product_id" value="<%= product.id %>">
|
||||
<input type="hidden" name="slug" value="<%= product.slug %>">
|
||||
<label class="label">
|
||||
Бронь (48 ч)
|
||||
<input type="number" name="quantity" value="1" min="1" max="<%= product.stock %>" class="input input--qty">
|
||||
</label>
|
||||
<button type="submit" class="btn btn--ghost btn--lg">Забронировать</button>
|
||||
</form>
|
||||
<% } else if (!user) { %>
|
||||
<p class="muted">Для бронирования <a href="/login">войдите</a> в аккаунт.</p>
|
||||
<% } %>
|
||||
<% } else { %>
|
||||
<p class="alert alert--warn">Нет в наличии</p>
|
||||
<% } %>
|
||||
|
||||
Reference in New Issue
Block a user