diff --git a/Web-Jarmark/Web-Jarmark/Components/Pages/Admin/Admin.razor b/Web-Jarmark/Web-Jarmark/Components/Pages/Admin/Admin.razor index badbbad..eaaeb00 100644 --- a/Web-Jarmark/Web-Jarmark/Components/Pages/Admin/Admin.razor +++ b/Web-Jarmark/Web-Jarmark/Components/Pages/Admin/Admin.razor @@ -1,145 +1,307 @@ - -@page "/admin" +@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 -Administrace | Jarmark +@attribute [Authorize] -
+Přehled administrace -
-
- 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 - { -
+
+
ADMINISTRACE
+
+ + Administrátor +
+
-
-
▦
+
+ +
- Celkem kategorií - @categoryCount - Všechny kategorie +
VÁŠ OBCHOD NA JEDNOM MÍSTĚ
+

Přehled administrace

+

Rychlý přehled o aktuálním stavu vašeho obchodu.

+
+ +
+ ◷ + @DateTime.Now.ToString("d. M. yyyy")
-
-
□
-
- Celkem produktů - @productCount - @visibleCount viditelných produktů + @if (loading) + { +
Načítám data obchodu…
+ } + else + { +
+ +
+
+ ↗ + KATALOG +
+
Celkem produktů
+
@productCount
+
Všechny produkty v obchodě
+
+ +
+
+ ▤ + SORTIMENT +
+
Počet kategorií
+
@categoryCount
+
Kategorie vašeho zboží
+
+ +
+
+ ◉ + E-SHOP +
+
Viditelné produkty
+
@visibleCount
+
Produkty dostupné v katalogu
+
+ +
+
+ ! + SKLAD +
+
Dochází skladem
+
@lowStockCount
+
Produkty s 5 nebo méně kusy
+
+
-
-
-
!
-
- Nízké zásoby - @lowStockCount - Produkty s 5 a méně kusy +
+ +
+
+
+

Produkty podle kategorií

+

Rozložení vašeho sortimentu

+
+ Kategorie ↗ +
+ + @if (categoryStats.Count == 0) + { +
Zatím nemáte žádné kategorie.
+ } + else + { +
+ @foreach (var category in categoryStats) + { +
+
+ @category.Name + @category.ProductCount +
+
+
+
+
+
+ } +
+ } +
+ +
+
+
+

Rychlé akce

+

Nejčastější úkony v administraci

+
+
+ + +
+
-
-
- } - +
+
+
+

Přehled produktů

+

Ukázka produktů z vašeho katalogu

+
+ Zobrazit vše → +
- - -
- 💡 -
- 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.

-
-
+ @if (productPreview.Count == 0) + { +
Zatím nemáte žádné produkty.
+ } + else + { +
+ + + + + + + + + + + + @foreach (var product in productPreview) + { + + + + + + + + } + +
ProduktKategorieCenaSklademStav
@product.Name@product.CategoryName@product.Price.ToString("N2") Kč@product.StockQuantity ks + @if (product.IsVisible) + { + Viditelné + } + else + { + Skryté + } +
+
+ } +
+ } +
+
@code { - private int categoryCount; + private bool loading = true; + private int productCount; + private int categoryCount; private int visibleCount; private int lowStockCount; - private bool loading = true; + + private List categoryStats = new(); + private List productPreview = new(); protected override async Task OnInitializedAsync() { - categoryCount = await Db.Set().CountAsync(); - productCount = await Db.Set().CountAsync(); + categoryCount = await Db.Set().CountAsync(); + visibleCount = await Db.Set().CountAsync(p => p.IsVisible); + lowStockCount = await Db.Set().CountAsync(p => p.StockQuantity <= 5); - visibleCount = await Db.Set() - .CountAsync(p => p.IsVisible); + var categories = await Db.Set() + .AsNoTracking() + .Include(c => c.Products) + .OrderBy(c => c.Name) + .ToListAsync(); - lowStockCount = await Db.Set() - .CountAsync(p => p.StockQuantity <= 5); + categoryStats = categories + .Select(c => new CategoryStat(c.Name, c.Products.Count)) + .ToList(); + + productPreview = await Db.Set() + .AsNoTracking() + .OrderBy(p => p.Name) + .Take(5) + .Select(p => new ProductPreview( + p.Name, + p.Category.Name, + p.Price, + p.StockQuantity, + p.IsVisible)) + .ToListAsync(); loading = false; } + + private int GetWidth(int count) + { + var max = categoryStats.Count == 0 ? 1 : categoryStats.Max(c => c.ProductCount); + return count == 0 ? 0 : Math.Max(5, (int)Math.Round(count * 100.0 / Math.Max(1, max))); + } + + private record CategoryStat(string Name, int ProductCount); + + private record ProductPreview( + string Name, + string CategoryName, + decimal Price, + int StockQuantity, + bool IsVisible); } diff --git a/Web-Jarmark/Web-Jarmark/jarmark.db-shm b/Web-Jarmark/Web-Jarmark/jarmark.db-shm index e400789..c94fe22 100644 Binary files a/Web-Jarmark/Web-Jarmark/jarmark.db-shm and b/Web-Jarmark/Web-Jarmark/jarmark.db-shm differ diff --git a/Web-Jarmark/Web-Jarmark/wwwroot/app.css b/Web-Jarmark/Web-Jarmark/wwwroot/app.css index 3632c0a..96e1bc7 100644 --- a/Web-Jarmark/Web-Jarmark/wwwroot/app.css +++ b/Web-Jarmark/Web-Jarmark/wwwroot/app.css @@ -358,3 +358,635 @@ h1:focus { background: #aab3bd; cursor: not-allowed; } + +/* ========================================== + WEB-JARMARK – MODERNÍ ADMINISTRACE + Èernobílý, zaoblený a jemný vzhled + ========================================== */ + +.wj-dashboard { + --wj-bg: #f5f5f6; + --wj-white: #ffffff; + --wj-text: #171717; + --wj-muted: #85858d; + --wj-border: #ededee; + --wj-black: #171717; + display: grid; + grid-template-columns: 245px minmax(0, 1fr); + min-height: 100vh; + background: var(--wj-bg); + color: var(--wj-text); + font-family: Inter, "Segoe UI", Arial, sans-serif; + font-size: 14px; +} + +/* Boèní menu */ + +.wj-sidebar { + position: sticky; + top: 0; + height: 100vh; + display: flex; + flex-direction: column; + padding: 27px 18px; + background: #fff; + border-right: 1px solid var(--wj-border); + z-index: 5; +} + +.wj-brand { + display: flex; + align-items: center; + gap: 12px; + padding: 5px 9px 38px; + color: var(--wj-text); + text-decoration: none; + font-size: 19px; + font-weight: 750; + letter-spacing: -0.6px; +} + + .wj-brand:hover { + color: #000; + } + +.wj-brand-icon, +.wj-sidebar-mark { + width: 37px; + height: 37px; + display: grid; + place-items: center; + background: #171717; + color: white; + border-radius: 13px; + font-weight: 800; + font-size: 17px; +} + +.wj-nav { + display: flex; + flex-direction: column; + gap: 7px; +} + +.wj-nav-link { + display: flex; + align-items: center; + gap: 13px; + padding: 13px 15px; + border-radius: 13px; + color: #55555b; + text-decoration: none; + font-weight: 550; + transition: background .22s ease, color .22s ease, transform .22s ease; +} + + .wj-nav-link span { + width: 22px; + font-size: 20px; + text-align: center; + } + + .wj-nav-link:hover { + background: #f2f2f3; + color: #111; + transform: translateX(3px); + } + + .wj-nav-link.active { + background: #191919; + color: #fff; + box-shadow: 0 5px 15px rgba(0, 0, 0, .12); + } + +.wj-sidebar-bottom { + margin-top: auto; + padding: 15px 10px; + border: 1px solid var(--wj-border); + border-radius: 17px; + display: flex; + align-items: center; + gap: 11px; +} + + .wj-sidebar-bottom strong, + .wj-sidebar-bottom small { + display: block; + } + + .wj-sidebar-bottom strong { + font-size: 12px; + } + + .wj-sidebar-bottom small { + color: var(--wj-muted); + font-size: 10px; + margin-top: 4px; + } + +.wj-sidebar-mark { + width: 34px; + height: 34px; + border-radius: 11px; + flex-shrink: 0; +} + +/* Hlavní èást */ + +.wj-main { + min-width: 0; +} + +.wj-topbar { + height: 70px; + padding: 0 36px; + display: flex; + justify-content: space-between; + align-items: center; + background: rgba(255, 255, 255, .88); + border-bottom: 1px solid var(--wj-border); +} + +.wj-topbar-label { + color: var(--wj-muted); + font-size: 11px; + font-weight: 700; + letter-spacing: 1.3px; +} + +.wj-topbar-right { + display: flex; + align-items: center; + gap: 9px; + font-weight: 600; + font-size: 13px; +} + +.wj-status-dot { + width: 8px; + height: 8px; + background: #222; + border-radius: 50%; + box-shadow: 0 0 0 4px #eeeeef; +} + +.wj-content { + max-width: 1600px; + margin: 0 auto; + padding: 36px; + animation: wj-enter .5s ease both; +} + +@keyframes wj-enter { + from { + opacity: 0; + transform: translateY(9px); + } + + to { + opacity: 1; + transform: translateY(0); + } +} + +.wj-page-heading { + display: flex; + justify-content: space-between; + align-items: center; + gap: 20px; + margin-bottom: 27px; +} + +.wj-eyebrow { + color: var(--wj-muted); + font-size: 10px; + letter-spacing: 1.4px; + font-weight: 700; + margin-bottom: 9px; +} + +.wj-page-heading h1 { + margin: 0; + font-size: clamp(25px, 3vw, 32px); + font-weight: 750; + letter-spacing: -1.1px; +} + +.wj-page-heading p { + color: var(--wj-muted); + margin: 8px 0 0; +} + +.wj-date { + background: #fff; + border: 1px solid var(--wj-border); + border-radius: 13px; + padding: 12px 16px; + color: #555; + white-space: nowrap; + box-shadow: 0 3px 12px rgba(0, 0, 0, .025); +} + + .wj-date span { + margin-right: 8px; + color: #111; + } + +/* Statistiky */ + +.wj-stats-grid { + display: grid; + grid-template-columns: repeat(4, minmax(0, 1fr)); + gap: 16px; + margin-bottom: 18px; +} + +.wj-stat-card { + background: var(--wj-white); + border: 1px solid var(--wj-border); + border-radius: 21px; + padding: 22px; + min-height: 177px; + box-shadow: 0 4px 15px rgba(0, 0, 0, .025); + transition: transform .25s ease, box-shadow .25s ease; +} + + .wj-stat-card:hover { + transform: translateY(-4px); + box-shadow: 0 12px 28px rgba(0, 0, 0, .07); + } + +.wj-stat-top { + display: flex; + justify-content: space-between; + align-items: center; + margin-bottom: 19px; +} + +.wj-stat-icon { + display: grid; + place-items: center; + width: 39px; + height: 39px; + border: 1px solid #e7e7e9; + border-radius: 50%; + font-size: 19px; +} + +.wj-stat-caption { + color: #aaaab0; + font-size: 9px; + font-weight: 700; + letter-spacing: 1px; +} + +.wj-stat-label { + color: #777780; + font-size: 12px; +} + +.wj-stat-value { + font-size: 30px; + font-weight: 750; + letter-spacing: -1.2px; + margin: 4px 0; +} + +.wj-stat-foot { + color: #a0a0a6; + font-size: 11px; +} + +/* Panely */ + +.wj-middle-grid { + display: grid; + grid-template-columns: 1.15fr .85fr; + gap: 17px; + margin-bottom: 18px; +} + +.wj-panel { + min-width: 0; + background: #fff; + border: 1px solid var(--wj-border); + border-radius: 21px; + padding: 23px; + box-shadow: 0 4px 15px rgba(0, 0, 0, .025); + transition: box-shadow .25s ease; +} + + .wj-panel:hover { + box-shadow: 0 8px 23px rgba(0, 0, 0, .045); + } + +.wj-panel-heading { + display: flex; + align-items: center; + justify-content: space-between; + gap: 12px; + margin-bottom: 25px; +} + + .wj-panel-heading h2 { + font-size: 16px; + font-weight: 750; + letter-spacing: -.3px; + margin: 0; + } + + .wj-panel-heading p { + color: var(--wj-muted); + font-size: 11px; + margin: 6px 0 0; + } + +.wj-text-link { + color: #555; + font-size: 11px; + font-weight: 650; + text-decoration: none; + white-space: nowrap; + transition: color .2s ease; +} + + .wj-text-link:hover { + color: #000; + text-decoration: underline; + } + +/* Kategorie */ + +.wj-category-list { + display: flex; + flex-direction: column; + gap: 21px; +} + +.wj-category-info { + display: flex; + justify-content: space-between; + gap: 12px; + font-size: 12px; + margin-bottom: 9px; +} + + .wj-category-info span { + color: #55555d; + } + + .wj-category-info strong { + font-weight: 700; + } + +.wj-progress { + height: 8px; + background: #eeeeef; + border-radius: 20px; + overflow: hidden; +} + +.wj-progress-fill { + height: 100%; + background: #222; + border-radius: 20px; + transition: width .7s cubic-bezier(.2, .8, .2, 1); +} + +/* Rychlé akce */ + +.wj-actions { + display: flex; + flex-direction: column; + gap: 9px; +} + +.wj-action { + display: flex; + align-items: center; + gap: 12px; + padding: 12px; + border: 1px solid #eeeeef; + border-radius: 14px; + color: var(--wj-text); + text-decoration: none; + transition: background .2s ease, border-color .2s ease, transform .2s ease; +} + + .wj-action:hover { + background: #f7f7f8; + border-color: #d9d9dc; + color: #000; + transform: translateX(3px); + } + +.wj-action-icon { + width: 37px; + height: 37px; + display: grid; + place-items: center; + border-radius: 12px; + background: #f0f0f1; + font-size: 18px; + flex-shrink: 0; +} + +.wj-action strong, +.wj-action small { + display: block; +} + +.wj-action strong { + font-size: 12px; +} + +.wj-action small { + color: var(--wj-muted); + font-size: 10px; + margin-top: 4px; +} + +.wj-action-arrow { + margin-left: auto; + color: #999; + font-size: 17px; +} + +/* Tabulka */ + +.wj-products-panel { + padding-bottom: 8px; +} + +.wj-table-wrap { + width: 100%; + overflow-x: auto; +} + +.wj-table { + width: 100%; + border-collapse: collapse; + white-space: nowrap; +} + + .wj-table th { + padding: 12px 14px; + color: #9999a0; + font-size: 10px; + font-weight: 650; + text-align: left; + border-bottom: 1px solid var(--wj-border); + } + + .wj-table td { + padding: 15px 14px; + font-size: 11px; + color: #62626a; + border-bottom: 1px solid #f0f0f1; + } + + .wj-table tbody tr { + transition: background .2s ease; + } + + .wj-table tbody tr:hover { + background: #fafafa; + } + + .wj-table tbody tr:last-child td { + border-bottom: 0; + } + + .wj-table .wj-product-name { + color: #222; + font-weight: 650; + } + +.wj-price { + color: #222 !important; + font-weight: 700; +} + +.wj-pill { + display: inline-block; + padding: 6px 11px; + background: #eeeeef; + color: #292929; + border-radius: 30px; + font-size: 10px; + font-weight: 650; +} + +.wj-pill-muted { + background: #f6f6f6; + color: #999; +} + +.wj-empty { + padding: 25px 10px; + color: var(--wj-muted); + text-align: center; + font-size: 12px; +} + +/* Responzivní zobrazení */ + +@media (max-width: 1150px) { + .wj-dashboard { + grid-template-columns: 205px minmax(0, 1fr); + } + + .wj-content { + padding: 25px; + } + + .wj-stats-grid { + grid-template-columns: repeat(2, minmax(0, 1fr)); + } +} + +@media (max-width: 850px) { + .wj-dashboard { + grid-template-columns: 1fr; + } + + .wj-sidebar { + position: relative; + height: auto; + padding: 14px; + border-right: 0; + border-bottom: 1px solid var(--wj-border); + } + + .wj-brand { + padding: 0 5px 13px; + } + + .wj-nav { + flex-direction: row; + overflow-x: auto; + padding-bottom: 3px; + } + + .wj-nav-link { + white-space: nowrap; + padding: 10px 13px; + } + + .wj-sidebar-bottom { + display: none; + } + + .wj-topbar { + display: none; + } + + .wj-middle-grid { + grid-template-columns: 1fr; + } +} + +@media (max-width: 560px) { + .wj-content { + padding: 18px 13px; + } + + .wj-page-heading { + align-items: flex-start; + flex-direction: column; + } + + .wj-stats-grid { + grid-template-columns: 1fr 1fr; + gap: 10px; + } + + .wj-stat-card { + min-height: 155px; + padding: 15px; + border-radius: 17px; + } + + .wj-stat-value { + font-size: 25px; + } + + .wj-panel { + padding: 17px; + border-radius: 17px; + } + + .wj-panel-heading { + align-items: flex-start; + } +} + +@media (prefers-reduced-motion: reduce) { + .wj-dashboard *, + .wj-dashboard *::before, + .wj-dashboard *::after { + animation-duration: .01ms !important; + transition-duration: .01ms !important; + scroll-behavior: auto !important; + } +}