From a54f265e29cd2192d0b96c7e23d7c4206da87f9b Mon Sep 17 00:00:00 2001 From: Ondur Date: Fri, 30 Oct 2026 13:58:21 +0100 Subject: [PATCH] =?UTF-8?q?pred=C4=9Bl=C3=A1n=C3=AD=20admin?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/Pages/Admin/Admin.razor | 143 ++++++++- Web-Jarmark/Web-Jarmark/wwwroot/app.css | 278 +++++++++++++++++- 2 files changed, 419 insertions(+), 2 deletions(-) diff --git a/Web-Jarmark/Web-Jarmark/Components/Pages/Admin/Admin.razor b/Web-Jarmark/Web-Jarmark/Components/Pages/Admin/Admin.razor index 8b6e3bb..badbbad 100644 --- a/Web-Jarmark/Web-Jarmark/Components/Pages/Admin/Admin.razor +++ b/Web-Jarmark/Web-Jarmark/Components/Pages/Admin/Admin.razor @@ -1,4 +1,145 @@  @page "/admin" +@rendermode InteractiveServer +@using Microsoft.EntityFrameworkCore +@using Microsoft.AspNetCore.Authorization +@using Web_Jarmark.Data +@using Web_Jarmark.Data.Models +@attribute [Authorize] +@inject ApplicationDbContext Db -Admin \ No newline at end of file +Administrace | Jarmark + +
+ +
+
+ ADMINISTRACE JARMARKU +

Vítej v administraci 👋

+

Všechno důležité pro správu tvého obchodu na jednom místě.

+
+
+ +
+
+

Rychlý přehled

+

Aktuální stav tvého obchodu

+
+
+ + @if (loading) + { +
Načítám údaje...
+ } + else + { +
+ +
+
▦
+
+ Celkem kategorií + @categoryCount + Všechny kategorie +
+
+ +
+
□
+
+ Celkem produktů + @productCount + @visibleCount viditelných produktů +
+
+ +
+
!
+
+ Nízké zásoby + @lowStockCount + Produkty s 5 a méně kusy +
+
+
+ } + + + + + +
+ 💡 +
+ Tip pro rychlejší správu +

Chceš upravit produkty v konkrétní kategorii? Otevři Kategorie a pokračuj odtud. V dalším kroku přidáme přímé filtrování produktů podle kategorie.

+
+
+ +
+ +@code { + private int categoryCount; + private int productCount; + private int visibleCount; + private int lowStockCount; + private bool loading = true; + + protected override async Task OnInitializedAsync() + { + categoryCount = await Db.Set().CountAsync(); + + productCount = await Db.Set().CountAsync(); + + visibleCount = await Db.Set() + .CountAsync(p => p.IsVisible); + + lowStockCount = await Db.Set() + .CountAsync(p => p.StockQuantity <= 5); + + loading = false; + } +} diff --git a/Web-Jarmark/Web-Jarmark/wwwroot/app.css b/Web-Jarmark/Web-Jarmark/wwwroot/app.css index 73a69d6..dcd556b 100644 --- a/Web-Jarmark/Web-Jarmark/wwwroot/app.css +++ b/Web-Jarmark/Web-Jarmark/wwwroot/app.css @@ -57,4 +57,280 @@ h1:focus { .form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder { text-align: start; -} \ No newline at end of file +} + +/* ===== ADMINISTRACE JARMARKU ===== */ + +.admin-dashboard { + max-width: 1250px; + margin: 0 auto; + padding: 28px 12px 48px; + color: #202638; +} + +.admin-welcome { + padding: 34px; + margin-bottom: 32px; + border-radius: 22px; + background: linear-gradient(120deg, #f0edff, #f7f8ff 65%, #e8f5ff); + border: 1px solid #e7e5f7; +} + +.admin-eyebrow { + display: inline-block; + margin-bottom: 12px; + color: #6c55c7; + font-size: 12px; + font-weight: 800; + letter-spacing: 1.5px; +} + +.admin-welcome h1 { + margin: 0 0 10px; + font-size: clamp(27px, 4vw, 38px); + font-weight: 800; + letter-spacing: -1px; +} + +.admin-welcome p, +.admin-section-heading p { + margin: 0; + color: #737b8d; +} + +.admin-section-heading { + display: flex; + align-items: center; + justify-content: space-between; + margin: 0 0 18px; +} + + .admin-section-heading h2 { + margin: 0 0 5px; + font-size: 22px; + font-weight: 750; + } + + .admin-section-heading p { + font-size: 14px; + } + +.admin-stats { + display: grid; + grid-template-columns: repeat(3, minmax(0, 1fr)); + gap: 18px; + margin-bottom: 38px; +} + +.admin-stat-card { + display: flex; + align-items: center; + gap: 17px; + min-width: 0; + padding: 23px; + background: #fff; + border: 1px solid #e9ebf1; + border-radius: 18px; + box-shadow: 0 5px 20px rgba(30, 40, 70, .035); +} + + .admin-stat-card > div:last-child { + display: flex; + flex-direction: column; + gap: 4px; + } + + .admin-stat-card span { + color: #737b8d; + font-size: 13px; + } + + .admin-stat-card strong { + font-size: 30px; + line-height: 1.2; + font-weight: 800; + } + + .admin-stat-card small { + color: #9299a8; + font-size: 12px; + } + +.admin-stat-icon, +.admin-navigation-icon { + display: flex; + align-items: center; + justify-content: center; + flex-shrink: 0; + font-size: 25px; + font-weight: 700; + border-radius: 14px; +} + +.admin-stat-icon { + width: 56px; + height: 56px; +} + +.purple { + color: #7155d9; + background: #efebff; +} + +.blue { + color: #3478d4; + background: #e8f2ff; +} + +.green { + color: #168765; + background: #e3f7ef; +} + +.orange { + color: #d17b22; + background: #fff1df; +} + +.admin-links-heading { + margin-bottom: 18px; +} + +.admin-navigation-cards { + display: grid; + grid-template-columns: repeat(2, minmax(0, 1fr)); + gap: 18px; +} + +.admin-navigation-card { + display: flex; + align-items: flex-start; + gap: 19px; + padding: 25px; + color: inherit; + text-decoration: none; + background: #fff; + border: 1px solid #e8eaf0; + border-radius: 19px; + box-shadow: 0 5px 20px rgba(30, 40, 70, .035); + transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; +} + + .admin-navigation-card:hover { + color: inherit; + text-decoration: none; + transform: translateY(-3px); + border-color: #cfc5ff; + box-shadow: 0 12px 28px rgba(30, 40, 70, .09); + } + +.admin-navigation-icon { + width: 58px; + height: 58px; + font-size: 28px; +} + +.admin-navigation-content { + flex: 1; + min-width: 0; +} + + .admin-navigation-content h3 { + margin: 2px 0 9px; + font-size: 19px; + font-weight: 750; + } + + .admin-navigation-content p { + min-height: 44px; + margin: 0 0 17px; + color: #737b8d; + font-size: 14px; + line-height: 1.6; + } + +.admin-card-link { + display: inline-flex; + align-items: center; + gap: 8px; + color: #6951c7; + font-size: 14px; + font-weight: 750; +} + + .admin-card-link span { + font-size: 19px; + transition: transform .2s ease; + } + +.admin-navigation-card:hover .admin-card-link span { + transform: translateX(4px); +} + +.admin-tip { + display: flex; + align-items: flex-start; + gap: 14px; + margin-top: 28px; + padding: 20px 23px; + border: 1px solid #f0e4c9; + border-radius: 16px; + background: #fffaf0; +} + +.admin-tip-icon { + font-size: 23px; +} + +.admin-tip strong { + display: block; + margin-bottom: 5px; +} + +.admin-tip p { + margin: 0; + color: #77705f; + font-size: 14px; + line-height: 1.6; +} + +.admin-loading { + padding: 25px; + color: #737b8d; + text-align: center; +} + +@media (max-width: 800px) { + .admin-stats { + grid-template-columns: 1fr; + } + + .admin-navigation-cards { + grid-template-columns: 1fr; + } + + .admin-welcome { + padding: 25px 21px; + } + + .admin-stat-card { + padding: 19px; + } +} + +@media (max-width: 480px) { + .admin-dashboard { + padding: 18px 4px 32px; + } + + .admin-navigation-card { + gap: 13px; + padding: 19px 15px; + } + + .admin-navigation-icon { + width: 46px; + height: 46px; + font-size: 23px; + } +}