predělání admin
This commit is contained in:
@@ -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
|
||||
|
||||
<PageTitle>Admin</PageTitle>
|
||||
<PageTitle>Administrace | Jarmark</PageTitle>
|
||||
|
||||
<div class="admin-dashboard">
|
||||
|
||||
<div class="admin-welcome">
|
||||
<div>
|
||||
<span class="admin-eyebrow">ADMINISTRACE JARMARKU</span>
|
||||
<h1>Vítej v administraci 👋</h1>
|
||||
<p>Všechno důležité pro správu tvého obchodu na jednom místě.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="admin-section-heading">
|
||||
<div>
|
||||
<h2>Rychlý přehled</h2>
|
||||
<p>Aktuální stav tvého obchodu</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if (loading)
|
||||
{
|
||||
<div class="admin-loading">Načítám údaje...</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="admin-stats">
|
||||
|
||||
<div class="admin-stat-card">
|
||||
<div class="admin-stat-icon purple">▦</div>
|
||||
<div>
|
||||
<span>Celkem kategorií</span>
|
||||
<strong>@categoryCount</strong>
|
||||
<small>Všechny kategorie</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="admin-stat-card">
|
||||
<div class="admin-stat-icon blue">□</div>
|
||||
<div>
|
||||
<span>Celkem produktů</span>
|
||||
<strong>@productCount</strong>
|
||||
<small>@visibleCount viditelných produktů</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="admin-stat-card">
|
||||
<div class="admin-stat-icon orange">!</div>
|
||||
<div>
|
||||
<span>Nízké zásoby</span>
|
||||
<strong>@lowStockCount</strong>
|
||||
<small>Produkty s 5 a méně kusy</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
<div class="admin-section-heading admin-links-heading">
|
||||
<div>
|
||||
<h2>Správa obchodu</h2>
|
||||
<p>Vyber, co chceš právě upravit</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="admin-navigation-cards">
|
||||
|
||||
<a href="/admin/kategorie" class="admin-navigation-card">
|
||||
<div class="admin-navigation-icon purple">▤</div>
|
||||
<div class="admin-navigation-content">
|
||||
<h3>Kategorie</h3>
|
||||
<p>Vytvářej kategorie, upravuj jejich názvy a spravuj jejich aktivitu.</p>
|
||||
<span class="admin-card-link">Otevřít kategorie <span>→</span></span>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
<a href="/admin/zbozi" class="admin-navigation-card">
|
||||
<div class="admin-navigation-icon green">□</div>
|
||||
<div class="admin-navigation-content">
|
||||
<h3>Zboží a produkty</h3>
|
||||
<p>Spravuj produkty, ceny, skladové zásoby a viditelnost v obchodě.</p>
|
||||
<span class="admin-card-link">Otevřít zboží <span>→</span></span>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
<a href="/admin/kategorie/edit" class="admin-navigation-card">
|
||||
<div class="admin-navigation-icon orange">+</div>
|
||||
<div class="admin-navigation-content">
|
||||
<h3>Nová kategorie</h3>
|
||||
<p>Vytvoř novou kategorii a zařaď do ní své produkty.</p>
|
||||
<span class="admin-card-link">Vytvořit kategorii <span>→</span></span>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
<a href="/admin/zbozi/edit" class="admin-navigation-card">
|
||||
<div class="admin-navigation-icon blue">+</div>
|
||||
<div class="admin-navigation-content">
|
||||
<h3>Nové zboží</h3>
|
||||
<p>Přidej produkt, nastav cenu, popis a skladovou zásobu.</p>
|
||||
<span class="admin-card-link">Přidat produkt <span>→</span></span>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="admin-tip">
|
||||
<span class="admin-tip-icon">💡</span>
|
||||
<div>
|
||||
<strong>Tip pro rychlejší správu</strong>
|
||||
<p>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.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@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<Category>().CountAsync();
|
||||
|
||||
productCount = await Db.Set<Product>().CountAsync();
|
||||
|
||||
visibleCount = await Db.Set<Product>()
|
||||
.CountAsync(p => p.IsVisible);
|
||||
|
||||
lowStockCount = await Db.Set<Product>()
|
||||
.CountAsync(p => p.StockQuantity <= 5);
|
||||
|
||||
loading = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,4 +57,280 @@ h1:focus {
|
||||
|
||||
.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
|
||||
text-align: start;
|
||||
}
|
||||
}
|
||||
|
||||
/* ===== 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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user