feat: подписка на уведомление о поступлении товара

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
shop
2026-05-17 13:38:03 +03:00
parent 561fbd22e0
commit e2a7c79245
11 changed files with 313 additions and 2 deletions
+27
View File
@@ -18,6 +18,8 @@
<p class="product-detail__stock">В наличии: <strong><%= product.stock %></strong> шт.</p>
<% if (error) { %><p class="alert alert--error"><%= error %></p><% } %>
<% if (notifySuccess) { %><p class="alert alert--success"><%= notifySuccess %></p><% } %>
<% if (notifyError) { %><p class="alert alert--error"><%= notifyError %></p><% } %>
<% if (reserved) { %><p class="alert alert--success">Товар успешно забронирован. Подробности на почте и в личном кабинете.</p><% } %>
<% if (userReservation) { %>
<p class="alert alert--success">
@@ -52,6 +54,31 @@
<% } %>
<% } else { %>
<p class="alert alert--warn">Нет в наличии</p>
<% if (typeof cookieConsent !== 'undefined' && !cookieConsent) { %>
<p class="muted">Примите cookies, чтобы подписаться на уведомление о поступлении.</p>
<% } else if (stockAlertSubscribed) { %>
<p class="stock-notify stock-notify--done">
Вы подписаны на уведомление<% if (notifyEmail) { %> — письмо придёт на <strong><%= notifyEmail %></strong><% } %>.
</p>
<% } else { %>
<section class="stock-notify card">
<h2 class="stock-notify__title">Сообщить о поступлении</h2>
<p class="muted stock-notify__hint">Будьте среди первых, кто узнает, когда товар снова появится в наличии.</p>
<form action="/product/<%= product.slug %>/notify-stock" method="post" class="form stock-notify__form">
<% if (user && notifyEmail) { %>
<p class="muted">Уведомление отправим на <strong><%= notifyEmail %></strong></p>
<input type="hidden" name="email" value="<%= notifyEmail %>">
<% } else { %>
<label class="label">
Email
<input type="email" name="email" class="input" required autocomplete="email" placeholder="you@example.com" value="<%= notifyEmail || '' %>">
</label>
<% } %>
<button type="submit" class="btn btn--primary">Подписаться</button>
</form>
</section>
<% } %>
<% } %>
<a href="/" class="link-back">← Назад в каталог</a>
</div>