Add full shop application: Go backend, PostgreSQL, Docker, Caddy and admin panel.

This commit is contained in:
shop
2026-06-25 16:39:33 +03:00
parent a150e4f8c6
commit ee5688f722
24 changed files with 1797 additions and 0 deletions
@@ -0,0 +1,67 @@
{{define "admin_dashboard.html"}}
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{.Title}}</title>
<link rel="stylesheet" href="/static/css/style.css">
<link rel="stylesheet" href="/static/css/admin.css">
</head>
<body class="admin-body">
<header class="admin-header">
<div class="container admin-header__inner">
<a href="/admin/" class="logo">
<span class="logo__icon"></span>
<span class="logo__text">Shop Admin</span>
</a>
<div class="admin-header__user">
<span>{{.Email}}</span>
<form method="POST" action="/admin/logout">
<button type="submit" class="btn btn--ghost btn--sm">Выйти</button>
</form>
</div>
</div>
</header>
<main class="admin-main container">
<h1 class="admin-page-title">Панель управления</h1>
<div class="admin-stats">
<div class="admin-stat">
<span class="admin-stat__value">{{.ProductCount}}</span>
<span class="admin-stat__label">Товаров в каталоге</span>
</div>
<div class="admin-stat">
<span class="admin-stat__value">{{len .Categories}}</span>
<span class="admin-stat__label">Категорий</span>
</div>
</div>
{{if .Categories}}
<section class="admin-section">
<h2 class="admin-section__title">Категории</h2>
<table class="admin-table">
<thead>
<tr>
<th>Название</th>
<th>Товаров</th>
</tr>
</thead>
<tbody>
{{range .Categories}}
<tr>
<td>{{.Name}}</td>
<td>{{.Count}}</td>
</tr>
{{end}}
</tbody>
</table>
</section>
{{end}}
<p class="admin-hint">Администратор создаётся автоматически из переменных <code>ADMIN_EMAIL</code> и <code>ADMIN_PASSWORD</code> в <code>.env</code>.</p>
</main>
</body>
</html>
{{end}}