Compare commits
35 Commits
1d546191c1
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e476e36855 | ||
|
|
69a8138226 | ||
|
|
b6f81a12ea | ||
|
|
28316b58ab | ||
|
|
2c593a53a1 | ||
|
|
fe1487a1f5 | ||
|
|
26c82eca08 | ||
|
|
217adaba63 | ||
|
|
083da573e0 | ||
|
|
e212712cac | ||
|
|
e5bc6cfbc0 | ||
|
|
dc74a416d0 | ||
|
|
bfd3b54154 | ||
|
|
31de50c40a | ||
|
|
acce73329a | ||
|
|
8e6a4db0ad | ||
|
|
1dad6cc160 | ||
|
|
89fd7a2f46 | ||
|
|
f583062d54 | ||
|
|
257fd7481a | ||
|
|
1506bfcf09 | ||
|
|
b3a5f42980 | ||
|
|
66489a918f | ||
|
|
4dcec14dac | ||
|
|
7e77301838 | ||
|
|
2ad874af33 | ||
|
|
ec94b0320d | ||
|
|
2d1ee8338e | ||
|
|
ce3fa4f689 | ||
|
|
2a2baba4a4 | ||
|
|
83488e97a9 | ||
|
|
fcaf17eacd | ||
|
|
59c47f2b03 | ||
|
|
1a8a3ee563 | ||
|
|
962aad7c86 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -414,3 +414,5 @@ FodyWeavers.xsd
|
|||||||
# Built Visual Studio Code Extensions
|
# Built Visual Studio Code Extensions
|
||||||
*.vsix
|
*.vsix
|
||||||
|
|
||||||
|
/Web-Jarmark/Web-Jarmark/jarmark.db-shm
|
||||||
|
/Web-Jarmark/Web-Jarmark/jarmark.db-wal
|
||||||
|
|||||||
@@ -127,7 +127,7 @@
|
|||||||
if (result.Succeeded)
|
if (result.Succeeded)
|
||||||
{
|
{
|
||||||
Logger.LogInformation("User logged in.");
|
Logger.LogInformation("User logged in.");
|
||||||
RedirectManager.RedirectTo(ReturnUrl);
|
RedirectManager.RedirectTo(string.IsNullOrWhiteSpace(ReturnUrl) ? "admin" : ReturnUrl);
|
||||||
}
|
}
|
||||||
else if (result.RequiresTwoFactor)
|
else if (result.RequiresTwoFactor)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,37 +6,21 @@
|
|||||||
@inject UserManager<ApplicationUser> UserManager
|
@inject UserManager<ApplicationUser> UserManager
|
||||||
@inject IdentityRedirectManager RedirectManager
|
@inject IdentityRedirectManager RedirectManager
|
||||||
|
|
||||||
<PageTitle>Personal Data</PageTitle>
|
<PageTitle>Osobní údaje</PageTitle>
|
||||||
|
|
||||||
<StatusMessage />
|
<h3>Osobní údaje</h3>
|
||||||
<h3>Personal Data</h3>
|
<p>
|
||||||
|
V účtu jsou uložené osobní údaje, které jsi zadal. Tady si je můžeš stáhnout nebo účet smazat.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<strong>Smazání údajů trvale odstraní účet a nelze to vrátit zpět.</strong>
|
||||||
|
</p>
|
||||||
|
|
||||||
<div class="row">
|
<div class="manage-actions">
|
||||||
<div class="col-md-6">
|
<form method="post" action="Account/Manage/DownloadPersonalData">
|
||||||
<p>Your account contains personal data that you have given us. This page allows you to download or delete that data.</p>
|
|
||||||
<p>
|
|
||||||
<strong>Deleting this data will permanently remove your account, and this cannot be recovered.</strong>
|
|
||||||
</p>
|
|
||||||
<form action="Account/Manage/DownloadPersonalData" method="post">
|
|
||||||
<AntiforgeryToken />
|
<AntiforgeryToken />
|
||||||
<button class="btn btn-primary" type="submit">Download</button>
|
<button type="submit" class="btn btn-primary">Stáhnout data</button>
|
||||||
</form>
|
</form>
|
||||||
<p>
|
|
||||||
<a href="Account/Manage/DeletePersonalData" class="btn btn-danger">Delete</a>
|
<a class="btn btn-primary" href="Account/Manage/DeletePersonalData">Smazat účet</a>
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@code {
|
|
||||||
[CascadingParameter]
|
|
||||||
private HttpContext HttpContext { get; set; } = default!;
|
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
|
||||||
{
|
|
||||||
var user = await UserManager.GetUserAsync(HttpContext.User);
|
|
||||||
if (user is null)
|
|
||||||
{
|
|
||||||
RedirectManager.RedirectToInvalidUser(UserManager, HttpContext);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,17 +1,23 @@
|
|||||||
@inherits LayoutComponentBase
|
@inherits LayoutComponentBase
|
||||||
@layout Web_Jarmark.Components.Layout.MainLayout
|
@layout Web_Jarmark.Components.Layout.Admin.AdminLayout
|
||||||
|
@using Microsoft.AspNetCore.Authorization
|
||||||
|
|
||||||
<h1>Manage your account</h1>
|
@attribute [Authorize(Roles = "Admin")]
|
||||||
|
|
||||||
<div>
|
<div class="ap ao manage-shell">
|
||||||
<h2>Change your account settings</h2>
|
<header class="ao-hero">
|
||||||
<hr />
|
<p class="ao-eyebrow">Účet</p>
|
||||||
<div class="row">
|
<h1>Správa účtu</h1>
|
||||||
<div class="col-lg-3">
|
<p class="ao-sub">Profil, heslo a zabezpečení.</p>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div class="manage-grid">
|
||||||
|
<aside class="manage-nav-card">
|
||||||
|
<p class="manage-nav-title">Nastavení</p>
|
||||||
<ManageNavMenu />
|
<ManageNavMenu />
|
||||||
</div>
|
</aside>
|
||||||
<div class="col-lg-9">
|
<section class="manage-content-card">
|
||||||
@Body
|
@Body
|
||||||
</div>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -1,34 +1,23 @@
|
|||||||
@using Microsoft.AspNetCore.Identity
|
@using Microsoft.AspNetCore.Identity
|
||||||
@using Web_Jarmark.Data
|
@using Web_Jarmark.Data
|
||||||
|
|
||||||
@inject SignInManager<ApplicationUser> SignInManager
|
@inject SignInManager<ApplicationUser> SignInManager
|
||||||
|
|
||||||
<ul class="nav nav-pills flex-column">
|
<nav class="manage-nav">
|
||||||
<li class="nav-item">
|
<NavLink class="manage-nav-link" href="Account/Manage" Match="NavLinkMatch.All">Profil</NavLink>
|
||||||
<NavLink class="nav-link" href="Account/Manage" Match="NavLinkMatch.All">Profile</NavLink>
|
<NavLink class="manage-nav-link" href="Account/Manage/Email">E-mail</NavLink>
|
||||||
</li>
|
<NavLink class="manage-nav-link" href="Account/Manage/ChangePassword">Heslo</NavLink>
|
||||||
<li class="nav-item">
|
|
||||||
<NavLink class="nav-link" href="Account/Manage/Email">Email</NavLink>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item">
|
|
||||||
<NavLink class="nav-link" href="Account/Manage/ChangePassword">Password</NavLink>
|
|
||||||
</li>
|
|
||||||
@if (hasExternalLogins)
|
@if (hasExternalLogins)
|
||||||
{
|
{
|
||||||
<li class="nav-item">
|
<NavLink class="manage-nav-link" href="Account/Manage/ExternalLogins">Externí přihlášení</NavLink>
|
||||||
<NavLink class="nav-link" href="Account/Manage/ExternalLogins">External logins</NavLink>
|
|
||||||
</li>
|
|
||||||
}
|
}
|
||||||
<li class="nav-item">
|
|
||||||
<NavLink class="nav-link" href="Account/Manage/TwoFactorAuthentication">Two-factor authentication</NavLink>
|
<NavLink class="manage-nav-link" href="Account/Manage/TwoFactorAuthentication">2FA</NavLink>
|
||||||
</li>
|
<NavLink class="manage-nav-link" href="Account/Manage/Passkeys">Passkeys</NavLink>
|
||||||
<li class="nav-item">
|
<NavLink class="manage-nav-link" href="Account/Manage/PersonalData">Osobní údaje</NavLink>
|
||||||
<NavLink class="nav-link" href="Account/Manage/Passkeys">Passkeys</NavLink>
|
|
||||||
</li>
|
<a class="manage-nav-link manage-nav-back" href="/admin">← Admin</a>
|
||||||
<li class="nav-item">
|
</nav>
|
||||||
<NavLink class="nav-link" href="Account/Manage/PersonalData">Personal data</NavLink>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
private bool hasExternalLogins;
|
private bool hasExternalLogins;
|
||||||
|
|||||||
@@ -21,10 +21,12 @@
|
|||||||
<AdminNavMenu />
|
<AdminNavMenu />
|
||||||
|
|
||||||
<div class="admin-sidebar-foot">
|
<div class="admin-sidebar-foot">
|
||||||
|
<div class="admin-foot-card">
|
||||||
<span class="admin-logo-mark small">W</span>
|
<span class="admin-logo-mark small">W</span>
|
||||||
<div class="admin-foot-text">
|
<div class="admin-foot-text">
|
||||||
<strong>Web-Jarmark</strong>
|
<strong>Web-Jarmark</strong>
|
||||||
<small>Administrace e-shopu</small>
|
<small>Administrace</small>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</aside>
|
</aside>
|
||||||
@@ -34,7 +36,7 @@
|
|||||||
<div class="admin-topbar-title">@SectionTitle</div>
|
<div class="admin-topbar-title">@SectionTitle</div>
|
||||||
<div class="admin-topbar-user">
|
<div class="admin-topbar-user">
|
||||||
<span class="admin-dot"></span>
|
<span class="admin-dot"></span>
|
||||||
Administrátor
|
<span>Administrátor</span>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
@@ -48,6 +50,8 @@
|
|||||||
private bool collapsed;
|
private bool collapsed;
|
||||||
private string SectionTitle = "Přehled";
|
private string SectionTitle = "Přehled";
|
||||||
|
|
||||||
|
private void Toggle() => collapsed = !collapsed;
|
||||||
|
|
||||||
protected override void OnInitialized()
|
protected override void OnInitialized()
|
||||||
{
|
{
|
||||||
UpdateTitle();
|
UpdateTitle();
|
||||||
@@ -71,7 +75,6 @@
|
|||||||
var p when p.StartsWith("/admin/zbozi") => "Zboží",
|
var p when p.StartsWith("/admin/zbozi") => "Zboží",
|
||||||
var p when p.StartsWith("/admin/objednavky") => "Objednávky",
|
var p when p.StartsWith("/admin/objednavky") => "Objednávky",
|
||||||
var p when p.StartsWith("/admin/administratori") => "Administrátoři",
|
var p when p.StartsWith("/admin/administratori") => "Administrátoři",
|
||||||
var p when p.StartsWith("/admin/zakaznici") => "Administrátoři",
|
|
||||||
var p when p.StartsWith("/admin/sklad") => "Sklad",
|
var p when p.StartsWith("/admin/sklad") => "Sklad",
|
||||||
var p when p.StartsWith("/admin/statistiky") => "Statistiky",
|
var p when p.StartsWith("/admin/statistiky") => "Statistiky",
|
||||||
var p when p.StartsWith("/admin/nastaveni") => "Nastavení",
|
var p when p.StartsWith("/admin/nastaveni") => "Nastavení",
|
||||||
@@ -79,7 +82,8 @@
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Toggle() => collapsed = !collapsed;
|
public void Dispose()
|
||||||
|
{
|
||||||
public void Dispose() => Nav.LocationChanged -= OnLocationChanged;
|
Nav.LocationChanged -= OnLocationChanged;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,200 +1,141 @@
|
|||||||
/* Nový admin shell – třídy admin-*, ať se nesráží se starým app.css */
|
/* Apple-like admin – plovoucí, hodně zaoblené */
|
||||||
|
|
||||||
.admin-shell {
|
.admin-shell {
|
||||||
--bg: #f3f3f3;
|
--bg: #f5f5f7;
|
||||||
--surface: #ffffff;
|
--ink: #1d1d1f;
|
||||||
--ink: #111111;
|
--muted: #6e6e73;
|
||||||
--muted: #6b6b6b;
|
--line: rgba(0, 0, 0, 0.06);
|
||||||
--line: #e4e4e4;
|
--sidebar-w: 280px;
|
||||||
--hover: #f0f0f0;
|
--sidebar-w-collapsed: 92px;
|
||||||
--active: #111111;
|
|
||||||
--sidebar: 250px;
|
|
||||||
--sidebar-collapsed: 78px;
|
|
||||||
--radius: 12px;
|
|
||||||
display: flex;
|
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
|
display: flex;
|
||||||
|
gap: 14px;
|
||||||
|
padding: 14px;
|
||||||
|
box-sizing: border-box;
|
||||||
background: var(--bg);
|
background: var(--bg);
|
||||||
color: var(--ink);
|
color: var(--ink);
|
||||||
font-family: Inter, "Segoe UI", system-ui, sans-serif;
|
font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
|
||||||
font-size: 14px;
|
-webkit-font-smoothing: antialiased;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* SIDEBAR */
|
/* ===== SIDEBAR CARD ===== */
|
||||||
.admin-sidebar {
|
.admin-sidebar {
|
||||||
width: var(--sidebar);
|
width: var(--sidebar-w);
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
position: sticky;
|
position: sticky;
|
||||||
top: 0;
|
top: 14px;
|
||||||
height: 100vh;
|
height: calc(100vh - 28px);
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
background: var(--surface);
|
background: rgba(255, 255, 255, 0.86);
|
||||||
border-right: 1px solid var(--line);
|
border: 1px solid rgba(0, 0, 0, 0.04);
|
||||||
transition: width 0.25s ease;
|
border-radius: 28px;
|
||||||
|
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.05);
|
||||||
|
backdrop-filter: blur(18px);
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
transition: width 0.3s cubic-bezier(0.22, 1, 0.36, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
.admin-shell.is-collapsed .admin-sidebar {
|
.admin-shell.is-collapsed .admin-sidebar {
|
||||||
width: var(--sidebar-collapsed);
|
width: var(--sidebar-w-collapsed);
|
||||||
}
|
}
|
||||||
|
|
||||||
.admin-sidebar-head {
|
.admin-sidebar-head {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
gap: 8px;
|
gap: 10px;
|
||||||
padding: 18px 14px 10px;
|
padding: 18px 16px 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.admin-logo {
|
.admin-logo {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 10px;
|
gap: 12px;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
color: var(--ink);
|
color: var(--ink);
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.admin-logo-mark {
|
.admin-logo-mark {
|
||||||
width: 36px;
|
width: 40px;
|
||||||
height: 36px;
|
height: 40px;
|
||||||
|
border-radius: 14px;
|
||||||
|
background: #1d1d1f;
|
||||||
|
color: #fff;
|
||||||
display: grid;
|
display: grid;
|
||||||
place-items: center;
|
place-items: center;
|
||||||
background: #111;
|
|
||||||
color: #fff;
|
|
||||||
border-radius: 10px;
|
|
||||||
font-weight: 800;
|
font-weight: 800;
|
||||||
|
font-size: 15px;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
|
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
|
||||||
}
|
}
|
||||||
|
|
||||||
.admin-logo-mark.small {
|
.admin-logo-mark.small {
|
||||||
width: 30px;
|
width: 32px;
|
||||||
height: 30px;
|
height: 32px;
|
||||||
|
border-radius: 11px;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
border-radius: 8px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.admin-logo-text {
|
.admin-logo-text {
|
||||||
font-weight: 750;
|
font-weight: 700;
|
||||||
font-size: 15px;
|
font-size: 16px;
|
||||||
|
letter-spacing: -0.03em;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.admin-shell.is-collapsed .admin-logo-text,
|
|
||||||
.admin-shell.is-collapsed .admin-foot-text {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.admin-toggle {
|
.admin-toggle {
|
||||||
width: 34px;
|
width: 38px;
|
||||||
height: 34px;
|
height: 38px;
|
||||||
border: 1px solid var(--line);
|
border: 0;
|
||||||
border-radius: 10px;
|
border-radius: 13px;
|
||||||
background: #fff;
|
background: #f0f0f2;
|
||||||
|
color: var(--ink);
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
|
transition: background 0.2s ease, transform 0.15s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
.admin-toggle:hover {
|
.admin-toggle:hover {
|
||||||
background: var(--hover);
|
background: #e6e6ea;
|
||||||
|
transform: scale(1.03);
|
||||||
}
|
}
|
||||||
|
|
||||||
.admin-sidebar-foot {
|
/* NAV */
|
||||||
margin-top: auto;
|
|
||||||
padding: 12px;
|
|
||||||
border-top: 1px solid var(--line);
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.admin-foot-text strong {
|
|
||||||
display: block;
|
|
||||||
font-size: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.admin-foot-text small {
|
|
||||||
display: block;
|
|
||||||
color: var(--muted);
|
|
||||||
font-size: 11px;
|
|
||||||
margin-top: 2px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* MAIN */
|
|
||||||
.admin-main {
|
|
||||||
flex: 1;
|
|
||||||
min-width: 0;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
|
|
||||||
.admin-topbar {
|
|
||||||
height: 64px;
|
|
||||||
padding: 0 28px;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: space-between;
|
|
||||||
background: rgba(255, 255, 255, 0.92);
|
|
||||||
border-bottom: 1px solid var(--line);
|
|
||||||
position: sticky;
|
|
||||||
top: 0;
|
|
||||||
z-index: 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
.admin-topbar-title {
|
|
||||||
font-size: 17px;
|
|
||||||
font-weight: 700;
|
|
||||||
}
|
|
||||||
|
|
||||||
.admin-topbar-user {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 8px;
|
|
||||||
font-weight: 600;
|
|
||||||
font-size: 13px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.admin-dot {
|
|
||||||
width: 8px;
|
|
||||||
height: 8px;
|
|
||||||
border-radius: 50%;
|
|
||||||
background: #111;
|
|
||||||
box-shadow: 0 0 0 3px #ececec;
|
|
||||||
}
|
|
||||||
|
|
||||||
.admin-content {
|
|
||||||
padding: 28px 32px 40px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* MENU uvnitř sidebaru (přes ::deep, protože je v child komponentě) */
|
|
||||||
::deep .admin-nav {
|
::deep .admin-nav {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 4px;
|
gap: 6px;
|
||||||
padding: 8px 10px 16px;
|
padding: 8px 12px 12px;
|
||||||
|
flex: 1;
|
||||||
|
overflow-y: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
::deep .admin-nav-link {
|
::deep .admin-nav-link {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 12px;
|
gap: 12px;
|
||||||
padding: 11px 12px;
|
padding: 13px 14px;
|
||||||
border-radius: 10px;
|
border-radius: 16px;
|
||||||
color: #444;
|
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
|
color: var(--muted);
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
transition: background 0.15s ease, color 0.15s ease;
|
font-size: 14px;
|
||||||
|
letter-spacing: -0.01em;
|
||||||
|
transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
::deep .admin-nav-link:hover {
|
::deep .admin-nav-link:hover {
|
||||||
background: var(--hover);
|
background: rgba(0, 0, 0, 0.04);
|
||||||
color: #111;
|
color: var(--ink);
|
||||||
}
|
}
|
||||||
|
|
||||||
::deep .admin-nav-link.active {
|
::deep .admin-nav-link.active {
|
||||||
background: #111;
|
background: #1d1d1f;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
|
box-shadow: 0 10px 24px rgba(0, 0, 0, 0.14);
|
||||||
}
|
}
|
||||||
|
|
||||||
::deep .admin-nav-ico {
|
::deep .admin-nav-ico {
|
||||||
@@ -202,10 +143,104 @@
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
opacity: 0.9;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.admin-shell.is-collapsed ::deep .admin-nav-label {
|
::deep .admin-nav-label {
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* FOOT */
|
||||||
|
.admin-sidebar-foot {
|
||||||
|
padding: 10px 12px 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-foot-card {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
padding: 12px;
|
||||||
|
border-radius: 18px;
|
||||||
|
background: #f5f5f7;
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-foot-text {
|
||||||
|
min-width: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-foot-text strong {
|
||||||
|
display: block;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 700;
|
||||||
|
letter-spacing: -0.02em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-foot-text small {
|
||||||
|
display: block;
|
||||||
|
font-size: 11px;
|
||||||
|
color: var(--muted);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== MAIN CARD ===== */
|
||||||
|
.admin-main {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
background: rgba(255, 255, 255, 0.72);
|
||||||
|
border: 1px solid rgba(0, 0, 0, 0.04);
|
||||||
|
border-radius: 28px;
|
||||||
|
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.04);
|
||||||
|
backdrop-filter: blur(18px);
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-topbar {
|
||||||
|
height: 68px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 16px;
|
||||||
|
padding: 0 28px;
|
||||||
|
border-bottom: 1px solid rgba(0, 0, 0, 0.05);
|
||||||
|
background: rgba(255, 255, 255, 0.55);
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-topbar-title {
|
||||||
|
font-size: 20px;
|
||||||
|
font-weight: 700;
|
||||||
|
letter-spacing: -0.03em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-topbar-user {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
padding: 8px 12px;
|
||||||
|
border-radius: 999px;
|
||||||
|
background: #f5f5f7;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: var(--muted);
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-dot {
|
||||||
|
width: 8px;
|
||||||
|
height: 8px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: #1d1d1f;
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-content {
|
||||||
|
padding: 22px 28px 36px;
|
||||||
|
flex: 1;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Collapsed */
|
||||||
|
.admin-shell.is-collapsed .admin-logo-text,
|
||||||
|
.admin-shell.is-collapsed ::deep .admin-nav-label,
|
||||||
|
.admin-shell.is-collapsed .admin-foot-text {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -214,3 +249,31 @@
|
|||||||
padding-left: 0;
|
padding-left: 0;
|
||||||
padding-right: 0;
|
padding-right: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.admin-shell.is-collapsed .admin-sidebar-head {
|
||||||
|
justify-content: center;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-shell.is-collapsed .admin-foot-card {
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-shell.is-collapsed .admin-logo {
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
/* SVG ikony v menu */
|
||||||
|
::deep .admin-nav-ico {
|
||||||
|
width: 22px;
|
||||||
|
height: 22px;
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
::deep .admin-nav-ico svg {
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
@@ -2,43 +2,92 @@
|
|||||||
@inject NavigationManager Nav
|
@inject NavigationManager Nav
|
||||||
|
|
||||||
<nav class="admin-nav">
|
<nav class="admin-nav">
|
||||||
|
<a href="/" class="admin-nav-link">
|
||||||
|
<span class="admin-nav-ico" aria-hidden="true">
|
||||||
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
|
||||||
|
<path d="M15 18 9 12l6-6" />
|
||||||
|
</svg>
|
||||||
|
</span>
|
||||||
|
<span class="admin-nav-label">E-shop</span>
|
||||||
|
</a>
|
||||||
|
|
||||||
<a href="/admin" class="admin-nav-link @(IsCurrent("/admin", true) ? "active" : null)">
|
<a href="/admin" class="admin-nav-link @(IsCurrent("/admin", true) ? "active" : null)">
|
||||||
<span class="admin-nav-ico">⌂</span>
|
<span class="admin-nav-ico" aria-hidden="true">
|
||||||
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
|
||||||
|
<path d="M4 10.5 12 4l8 6.5V20a1 1 0 0 1-1 1h-5v-6H10v6H5a1 1 0 0 1-1-1v-9.5Z" />
|
||||||
|
</svg>
|
||||||
|
</span>
|
||||||
<span class="admin-nav-label">Přehled</span>
|
<span class="admin-nav-label">Přehled</span>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<a href="/admin/kategorie" class="admin-nav-link @(IsCurrent("/admin/kategorie") ? "active" : null)">
|
<a href="/admin/kategorie" class="admin-nav-link @(IsCurrent("/admin/kategorie") ? "active" : null)">
|
||||||
<span class="admin-nav-ico">▤</span>
|
<span class="admin-nav-ico" aria-hidden="true">
|
||||||
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
|
||||||
|
<rect x="4" y="4" width="7" height="7" rx="1.5" />
|
||||||
|
<rect x="13" y="4" width="7" height="7" rx="1.5" />
|
||||||
|
<rect x="4" y="13" width="7" height="7" rx="1.5" />
|
||||||
|
<rect x="13" y="13" width="7" height="7" rx="1.5" />
|
||||||
|
</svg>
|
||||||
|
</span>
|
||||||
<span class="admin-nav-label">Kategorie</span>
|
<span class="admin-nav-label">Kategorie</span>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<a href="/admin/zbozi" class="admin-nav-link @(IsCurrent("/admin/zbozi") ? "active" : null)">
|
<a href="/admin/zbozi" class="admin-nav-link @(IsCurrent("/admin/zbozi") ? "active" : null)">
|
||||||
<span class="admin-nav-ico">◇</span>
|
<span class="admin-nav-ico" aria-hidden="true">
|
||||||
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
|
||||||
|
<path d="M7 7h10l1.2 12.2a1.5 1.5 0 0 1-1.5 1.6H7.3a1.5 1.5 0 0 1-1.5-1.6L7 7Z" />
|
||||||
|
<path d="M9 7a3 3 0 0 1 6 0" />
|
||||||
|
</svg>
|
||||||
|
</span>
|
||||||
<span class="admin-nav-label">Zboží</span>
|
<span class="admin-nav-label">Zboží</span>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<a href="/admin/objednavky" class="admin-nav-link @(IsCurrent("/admin/objednavky") ? "active" : null)">
|
<a href="/admin/objednavky" class="admin-nav-link @(IsCurrent("/admin/objednavky") ? "active" : null)">
|
||||||
<span class="admin-nav-ico">▣</span>
|
<span class="admin-nav-ico" aria-hidden="true">
|
||||||
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
|
||||||
|
<path d="M7 4h10a2 2 0 0 1 2 2v14l-3-2-3 2-3-2-3 2V6a2 2 0 0 1 2-2Z" />
|
||||||
|
<path d="M9 9h6M9 13h6" />
|
||||||
|
</svg>
|
||||||
|
</span>
|
||||||
<span class="admin-nav-label">Objednávky</span>
|
<span class="admin-nav-label">Objednávky</span>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<a href="/admin/administratori" class="admin-nav-link @(IsCurrent("/admin/administratori") ? "active" : null)">
|
<a href="/admin/administratori" class="admin-nav-link @(IsCurrent("/admin/administratori") ? "active" : null)">
|
||||||
<span class="admin-nav-ico">👤</span>
|
<span class="admin-nav-ico" aria-hidden="true">
|
||||||
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
|
||||||
|
<circle cx="12" cy="8" r="3.5" />
|
||||||
|
<path d="M5.5 19a6.5 6.5 0 0 1 13 0" />
|
||||||
|
</svg>
|
||||||
|
</span>
|
||||||
<span class="admin-nav-label">Administrátoři</span>
|
<span class="admin-nav-label">Administrátoři</span>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<a href="/admin/sklad" class="admin-nav-link @(IsCurrent("/admin/sklad") ? "active" : null)">
|
<a href="/admin/sklad" class="admin-nav-link @(IsCurrent("/admin/sklad") ? "active" : null)">
|
||||||
<span class="admin-nav-ico">▥</span>
|
<span class="admin-nav-ico" aria-hidden="true">
|
||||||
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
|
||||||
|
<path d="M4 8.5 12 4l8 4.5V19a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V8.5Z" />
|
||||||
|
<path d="M12 12v8M8 10.5 12 12l4-1.5" />
|
||||||
|
</svg>
|
||||||
|
</span>
|
||||||
<span class="admin-nav-label">Sklad</span>
|
<span class="admin-nav-label">Sklad</span>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<a href="/admin/statistiky" class="admin-nav-link @(IsCurrent("/admin/statistiky") ? "active" : null)">
|
<a href="/admin/statistiky" class="admin-nav-link @(IsCurrent("/admin/statistiky") ? "active" : null)">
|
||||||
<span class="admin-nav-ico">▦</span>
|
<span class="admin-nav-ico" aria-hidden="true">
|
||||||
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
|
||||||
|
<path d="M5 19V11M12 19V5M19 19v-7" />
|
||||||
|
</svg>
|
||||||
|
</span>
|
||||||
<span class="admin-nav-label">Statistiky</span>
|
<span class="admin-nav-label">Statistiky</span>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<a href="/admin/nastaveni" class="admin-nav-link @(IsCurrent("/admin/nastaveni") ? "active" : null)">
|
<a href="/admin/nastaveni" class="admin-nav-link @(IsCurrent("/admin/nastaveni") ? "active" : null)">
|
||||||
<span class="admin-nav-ico">⚙</span>
|
<span class="admin-nav-ico" aria-hidden="true">
|
||||||
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
|
||||||
|
<circle cx="12" cy="12" r="3" />
|
||||||
|
<path d="M12 3.5v2.2M12 18.3v2.2M4.9 6.4l1.6 1.6M17.5 16l1.6 1.6M3.5 12h2.2M18.3 12h2.2M4.9 17.6l1.6-1.6M17.5 8l1.6-1.6" />
|
||||||
|
</svg>
|
||||||
|
</span>
|
||||||
<span class="admin-nav-label">Nastavení</span>
|
<span class="admin-nav-label">Nastavení</span>
|
||||||
</a>
|
</a>
|
||||||
</nav>
|
</nav>
|
||||||
|
|||||||
@@ -1,23 +1,41 @@
|
|||||||
@inherits LayoutComponentBase
|
@inherits LayoutComponentBase
|
||||||
|
|
||||||
<div class="page">
|
<div class="page public-layout">
|
||||||
<div class="sidebar">
|
|
||||||
|
<a href="#public-main-content"
|
||||||
|
class="public-skip-link visually-hidden-focusable">
|
||||||
|
Přeskočit na hlavní obsah
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<header class="sidebar public-header">
|
||||||
<NavMenu />
|
<NavMenu />
|
||||||
</div>
|
</header>
|
||||||
|
|
||||||
<main>
|
<main id="public-main-content"
|
||||||
<div class="top-row px-4">
|
class="main-content public-main"
|
||||||
<a href="https://learn.microsoft.com/aspnet/core/" target="_blank">About</a>
|
tabindex="-1">
|
||||||
</div>
|
|
||||||
|
|
||||||
<article class="content px-4">
|
<article class="content public-container">
|
||||||
@Body
|
@Body
|
||||||
</article>
|
</article>
|
||||||
|
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="blazor-error-ui" data-nosnippet>
|
<div id="blazor-error-ui" data-nosnippet>
|
||||||
An unhandled error has occurred.
|
<span role="alert">
|
||||||
<a href="." class="reload">Reload</a>
|
Nastala neočekávaná chyba.
|
||||||
<span class="dismiss">🗙</span>
|
</span>
|
||||||
|
|
||||||
|
<a href="." class="reload">
|
||||||
|
Obnovit stránku
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<button type="button"
|
||||||
|
class="dismiss"
|
||||||
|
aria-label="Zavřít chybové hlášení"
|
||||||
|
style="background: none; border: none; color: inherit;">
|
||||||
|
×
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,98 +1,406 @@
|
|||||||
.page {
|
|
||||||
|
/* ========================================
|
||||||
|
SKOLNI JARMARK - PUBLIC LAYOUT
|
||||||
|
======================================== */
|
||||||
|
|
||||||
|
.page.public-layout {
|
||||||
|
--public-primary: #244b36;
|
||||||
|
--public-primary-hover: #193b29;
|
||||||
|
--public-secondary: #e6eddf;
|
||||||
|
--public-background: #f7f7f2;
|
||||||
|
--public-surface: #ffffff;
|
||||||
|
--public-text: #26372b;
|
||||||
|
--public-muted: #59665b;
|
||||||
|
--public-border: #dce3d9;
|
||||||
|
--public-radius-sm: 4px;
|
||||||
|
--public-radius-md: 8px;
|
||||||
|
--public-radius-lg: 12px;
|
||||||
|
--public-space-1: 4px;
|
||||||
|
--public-space-2: 8px;
|
||||||
|
--public-space-3: 12px;
|
||||||
|
--public-space-4: 16px;
|
||||||
|
--public-space-5: 20px;
|
||||||
|
--public-space-6: 24px;
|
||||||
|
--public-space-8: 32px;
|
||||||
|
--public-space-12: 48px;
|
||||||
|
--public-space-16: 64px;
|
||||||
position: relative;
|
position: relative;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
align-items: stretch;
|
||||||
|
width: 100%;
|
||||||
|
min-width: 0;
|
||||||
|
min-height: 100vh;
|
||||||
|
min-height: 100dvh;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
background: var(--public-background);
|
||||||
|
color: var(--public-text);
|
||||||
|
font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
|
||||||
|
font-size: 16px;
|
||||||
|
line-height: 1.6;
|
||||||
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
main {
|
|
||||||
flex: 1;
|
/* ========================================
|
||||||
|
BOX SIZING
|
||||||
|
======================================== */
|
||||||
|
|
||||||
|
.public-layout,
|
||||||
|
.public-layout ::deep *,
|
||||||
|
.public-layout ::deep *::before,
|
||||||
|
.public-layout ::deep *::after {
|
||||||
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sidebar {
|
|
||||||
background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%);
|
|
||||||
}
|
|
||||||
|
|
||||||
.top-row {
|
/* ========================================
|
||||||
background-color: #f7f7f7;
|
PUBLIC HEADER - OVERLAP FIX
|
||||||
border-bottom: 1px solid #d6d5d5;
|
======================================== */
|
||||||
justify-content: flex-end;
|
|
||||||
height: 3.5rem;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.top-row ::deep a, .top-row ::deep .btn-link {
|
.public-layout > .sidebar.public-header {
|
||||||
white-space: nowrap;
|
position: relative !important;
|
||||||
margin-left: 1.5rem;
|
top: auto !important;
|
||||||
text-decoration: none;
|
right: auto !important;
|
||||||
|
bottom: auto !important;
|
||||||
|
left: auto !important;
|
||||||
|
display: block;
|
||||||
|
flex: 0 0 auto;
|
||||||
|
align-self: stretch;
|
||||||
|
width: 100% !important;
|
||||||
|
min-width: 0 !important;
|
||||||
|
max-width: 100%;
|
||||||
|
height: auto !important;
|
||||||
|
min-height: 0 !important;
|
||||||
|
max-height: none;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
background: var(--public-surface);
|
||||||
|
border-right: none !important;
|
||||||
|
border-bottom: 1px solid var(--public-border);
|
||||||
|
transform: none;
|
||||||
|
z-index: 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
.top-row ::deep a:hover, .top-row ::deep .btn-link:hover {
|
|
||||||
|
/* ========================================
|
||||||
|
NAVIGATION CONTAINER
|
||||||
|
======================================== */
|
||||||
|
|
||||||
|
.public-header ::deep .nav-panel {
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
min-width: 0;
|
||||||
|
height: auto;
|
||||||
|
min-height: 68px;
|
||||||
|
max-height: none;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.public-header ::deep .nav-scrollable {
|
||||||
|
position: static;
|
||||||
|
height: auto;
|
||||||
|
min-height: 0;
|
||||||
|
max-height: none;
|
||||||
|
overflow: visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ========================================
|
||||||
|
MAIN CONTENT - OVERLAP FIX
|
||||||
|
======================================== */
|
||||||
|
|
||||||
|
.public-layout > .main-content.public-main {
|
||||||
|
position: relative !important;
|
||||||
|
top: auto;
|
||||||
|
left: auto;
|
||||||
|
right: auto;
|
||||||
|
bottom: auto;
|
||||||
|
display: block;
|
||||||
|
flex: 1 0 auto;
|
||||||
|
width: 100% !important;
|
||||||
|
min-width: 0;
|
||||||
|
max-width: 100%;
|
||||||
|
height: auto;
|
||||||
|
min-height: 0;
|
||||||
|
margin: 0 !important;
|
||||||
|
padding: 0 !important;
|
||||||
|
background: var(--public-background);
|
||||||
|
transform: none;
|
||||||
|
scroll-margin-top: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ========================================
|
||||||
|
CONTENT CONTAINER
|
||||||
|
======================================== */
|
||||||
|
|
||||||
|
.public-main > .content.public-container {
|
||||||
|
position: relative;
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
max-width: 1440px;
|
||||||
|
min-width: 0;
|
||||||
|
margin: 0 auto !important;
|
||||||
|
padding: 32px 32px 64px !important;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ========================================
|
||||||
|
TYPOGRAPHY
|
||||||
|
======================================== */
|
||||||
|
|
||||||
|
.public-container ::deep h1,
|
||||||
|
.public-container ::deep h2,
|
||||||
|
.public-container ::deep h3 {
|
||||||
|
color: var(--public-text);
|
||||||
|
font-family: Georgia, "Times New Roman", serif;
|
||||||
|
font-weight: 700;
|
||||||
|
line-height: 1.2;
|
||||||
|
letter-spacing: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
.public-container ::deep h1 {
|
||||||
|
font-size: clamp(28px, 4vw, 44px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.public-container ::deep h2 {
|
||||||
|
font-size: clamp(24px, 3vw, 32px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.public-container ::deep h3 {
|
||||||
|
font-size: clamp(18px, 2vw, 24px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.public-container ::deep p {
|
||||||
|
line-height: 1.6;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ========================================
|
||||||
|
LINKS
|
||||||
|
======================================== */
|
||||||
|
|
||||||
|
.public-container ::deep a {
|
||||||
|
text-underline-offset: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ========================================
|
||||||
|
KEYBOARD ACCESSIBILITY
|
||||||
|
======================================== */
|
||||||
|
|
||||||
|
.public-layout ::deep a:focus-visible,
|
||||||
|
.public-layout ::deep button:focus-visible,
|
||||||
|
.public-layout ::deep input:focus-visible,
|
||||||
|
.public-layout ::deep select:focus-visible,
|
||||||
|
.public-layout ::deep textarea:focus-visible,
|
||||||
|
.public-layout ::deep [tabindex]:focus-visible {
|
||||||
|
outline: 3px solid #527b49;
|
||||||
|
outline-offset: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.public-main:focus-visible {
|
||||||
|
outline: 3px solid #527b49;
|
||||||
|
outline-offset: -3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ========================================
|
||||||
|
SKIP NAVIGATION LINK
|
||||||
|
======================================== */
|
||||||
|
|
||||||
|
.public-skip-link {
|
||||||
|
position: absolute;
|
||||||
|
top: 12px;
|
||||||
|
left: 12px;
|
||||||
|
z-index: 1100;
|
||||||
|
width: 1px;
|
||||||
|
height: 1px;
|
||||||
|
padding: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
clip-path: inset(50%);
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.public-skip-link:focus {
|
||||||
|
width: auto;
|
||||||
|
height: auto;
|
||||||
|
padding: 12px 16px;
|
||||||
|
overflow: visible;
|
||||||
|
clip-path: none;
|
||||||
|
background: var(--public-primary);
|
||||||
|
color: #ffffff;
|
||||||
|
border-radius: var(--public-radius-md);
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 600;
|
||||||
|
text-decoration: none;
|
||||||
|
white-space: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ========================================
|
||||||
|
BLAZOR ERROR MESSAGE
|
||||||
|
======================================== */
|
||||||
|
|
||||||
|
#blazor-error-ui {
|
||||||
|
display: none;
|
||||||
|
position: fixed;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
z-index: 1000;
|
||||||
|
width: 100%;
|
||||||
|
padding: 16px 56px 16px 24px;
|
||||||
|
background: #fff4d6;
|
||||||
|
color: #58451b;
|
||||||
|
border-top: 1px solid #e5d4a1;
|
||||||
|
box-sizing: border-box;
|
||||||
|
color-scheme: light;
|
||||||
|
font-size: 14px;
|
||||||
|
line-height: 1.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
#blazor-error-ui .reload {
|
||||||
|
display: inline-block;
|
||||||
|
margin-left: 8px;
|
||||||
|
color: #244b36;
|
||||||
|
font-weight: 700;
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
|
|
||||||
.top-row ::deep a:first-child {
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 640.98px) {
|
|
||||||
.top-row {
|
|
||||||
justify-content: space-between;
|
|
||||||
}
|
|
||||||
|
|
||||||
.top-row ::deep a, .top-row ::deep .btn-link {
|
|
||||||
margin-left: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (min-width: 641px) {
|
|
||||||
.page {
|
|
||||||
flex-direction: row;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sidebar {
|
|
||||||
width: 250px;
|
|
||||||
height: 100vh;
|
|
||||||
position: sticky;
|
|
||||||
top: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.top-row {
|
|
||||||
position: sticky;
|
|
||||||
top: 0;
|
|
||||||
z-index: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.top-row.auth ::deep a:first-child {
|
|
||||||
flex: 1;
|
|
||||||
text-align: right;
|
|
||||||
width: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.top-row, article {
|
|
||||||
padding-left: 2rem !important;
|
|
||||||
padding-right: 1.5rem !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#blazor-error-ui {
|
|
||||||
color-scheme: light only;
|
|
||||||
background: lightyellow;
|
|
||||||
bottom: 0;
|
|
||||||
box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
|
|
||||||
box-sizing: border-box;
|
|
||||||
display: none;
|
|
||||||
left: 0;
|
|
||||||
padding: 0.6rem 1.25rem 0.7rem 1.25rem;
|
|
||||||
position: fixed;
|
|
||||||
width: 100%;
|
|
||||||
z-index: 1000;
|
|
||||||
}
|
|
||||||
|
|
||||||
#blazor-error-ui .dismiss {
|
#blazor-error-ui .dismiss {
|
||||||
cursor: pointer;
|
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 0.75rem;
|
top: 50%;
|
||||||
top: 0.5rem;
|
right: 8px;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 44px;
|
||||||
|
height: 44px;
|
||||||
|
padding: 0;
|
||||||
|
background: transparent;
|
||||||
|
color: #58451b;
|
||||||
|
border: none;
|
||||||
|
border-radius: 4px;
|
||||||
|
font-size: 24px;
|
||||||
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#blazor-error-ui .dismiss:focus-visible,
|
||||||
|
#blazor-error-ui .reload:focus-visible {
|
||||||
|
outline: 3px solid #527b49;
|
||||||
|
outline-offset: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ========================================
|
||||||
|
TABLET - MAX 1024 PX
|
||||||
|
======================================== */
|
||||||
|
|
||||||
|
@media (max-width: 1024px) {
|
||||||
|
|
||||||
|
.public-main > .content.public-container {
|
||||||
|
padding: 24px 24px 48px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.public-layout > .sidebar.public-header {
|
||||||
|
position: relative !important;
|
||||||
|
width: 100% !important;
|
||||||
|
height: auto !important;
|
||||||
|
min-height: 0 !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ========================================
|
||||||
|
MOBILE - MAX 640 PX
|
||||||
|
======================================== */
|
||||||
|
|
||||||
|
@media (max-width: 640px) {
|
||||||
|
|
||||||
|
.page.public-layout {
|
||||||
|
flex-direction: column;
|
||||||
|
width: 100%;
|
||||||
|
font-size: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.public-layout > .sidebar.public-header {
|
||||||
|
position: relative !important;
|
||||||
|
top: auto !important;
|
||||||
|
width: 100% !important;
|
||||||
|
min-width: 0 !important;
|
||||||
|
height: auto !important;
|
||||||
|
min-height: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.public-layout > .main-content.public-main {
|
||||||
|
width: 100% !important;
|
||||||
|
min-width: 0;
|
||||||
|
margin: 0 !important;
|
||||||
|
padding: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.public-main > .content.public-container {
|
||||||
|
width: 100%;
|
||||||
|
padding: 16px 16px 32px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.public-container ::deep h1 {
|
||||||
|
font-size: 28px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.public-container ::deep h2 {
|
||||||
|
font-size: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.public-container ::deep h3 {
|
||||||
|
font-size: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#blazor-error-ui {
|
||||||
|
padding: 12px 56px 12px 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#blazor-error-ui .reload {
|
||||||
|
margin-left: 0;
|
||||||
|
margin-top: 4px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ========================================
|
||||||
|
SMALL MOBILE - MAX 360 PX
|
||||||
|
======================================== */
|
||||||
|
|
||||||
|
@media (max-width: 360px) {
|
||||||
|
|
||||||
|
.public-main > .content.public-container {
|
||||||
|
padding: 12px 12px 24px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.public-container ::deep h1 {
|
||||||
|
font-size: 26px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ========================================
|
||||||
|
REDUCED MOTION
|
||||||
|
======================================== */
|
||||||
|
|
||||||
|
@media (prefers-reduced-motion: reduce) {
|
||||||
|
|
||||||
|
.public-layout,
|
||||||
|
.public-layout ::deep *,
|
||||||
|
.public-layout ::deep *::before,
|
||||||
|
.public-layout ::deep *::after {
|
||||||
|
scroll-behavior: auto !important;
|
||||||
|
animation-duration: 0.01ms !important;
|
||||||
|
animation-iteration-count: 1 !important;
|
||||||
|
transition-duration: 0.01ms !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,82 +1,212 @@
|
|||||||
|
@implements IDisposable
|
||||||
@implements IDisposable
|
|
||||||
|
|
||||||
@inject NavigationManager NavigationManager
|
@inject NavigationManager NavigationManager
|
||||||
|
|
||||||
<div class="top-row ps-3 navbar navbar-dark">
|
<div class="nav-panel">
|
||||||
<div class="container-fluid">
|
|
||||||
<a class="navbar-brand" href="">Web-Jarmark</a>
|
<div class="nav-brand-area">
|
||||||
|
<a class="navbar-brand" href="/">
|
||||||
|
|
||||||
|
<svg class="brand-symbol"
|
||||||
|
width="32"
|
||||||
|
height="32"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
fill="none"
|
||||||
|
stroke="currentColor"
|
||||||
|
stroke-width="1.6"
|
||||||
|
stroke-linecap="round"
|
||||||
|
stroke-linejoin="round"
|
||||||
|
aria-hidden="true">
|
||||||
|
|
||||||
|
<path d="M20 4C10 4 5 8 5 15
|
||||||
|
c0 3 2 5 5 5
|
||||||
|
C17 20 20 12 20 4Z" />
|
||||||
|
|
||||||
|
<path d="M3 22L15 10" />
|
||||||
|
|
||||||
|
</svg>
|
||||||
|
|
||||||
|
<span class="brand-text">
|
||||||
|
<strong>Školní jarmark</strong>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<input type="checkbox" title="Navigation menu" class="navbar-toggler" />
|
<input type="checkbox"
|
||||||
|
id="public-menu-toggle"
|
||||||
|
title="Navigační menu"
|
||||||
|
aria-label="Rozbalit nebo sbalit navigační menu"
|
||||||
|
aria-controls="public-navigation"
|
||||||
|
class="navbar-toggler" />
|
||||||
|
|
||||||
|
<div class="nav-scrollable"
|
||||||
|
id="public-navigation">
|
||||||
|
|
||||||
|
<nav class="nav public-nav-links"
|
||||||
|
aria-label="Hlavní navigace">
|
||||||
|
|
||||||
|
<div class="nav-item">
|
||||||
|
<NavLink class="nav-link"
|
||||||
|
href=""
|
||||||
|
Match="NavLinkMatch.All"
|
||||||
|
onclick="document.getElementById('public-menu-toggle').checked = false">
|
||||||
|
|
||||||
|
<span>Katalog</span>
|
||||||
|
|
||||||
<div class="nav-scrollable" onclick="document.querySelector('.navbar-toggler').click()">
|
|
||||||
<nav class="nav flex-column">
|
|
||||||
<div class="nav-item px-3">
|
|
||||||
<NavLink class="nav-link" href="" Match="NavLinkMatch.All">
|
|
||||||
<span class="bi bi-house-door-fill-nav-menu" aria-hidden="true"></span> Home
|
|
||||||
</NavLink>
|
</NavLink>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="nav-item px-3">
|
<AuthorizeView Roles="Admin">
|
||||||
<NavLink class="nav-link" href="kosik">
|
|
||||||
<span class="bi bi-plus-square-fill-nav-menu" aria-hidden="true"></span> Kosik
|
|
||||||
</NavLink>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="nav-item px-3">
|
|
||||||
<NavLink class="nav-link" href="FF">
|
|
||||||
<span class="bi bi-list-nested-nav-menu" aria-hidden="true"></span> FF
|
|
||||||
</NavLink>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="nav-item px-3">
|
|
||||||
<NavLink class="nav-link" href="NovaObjednavka">
|
|
||||||
<span class="bi bi-lock-nav-menu" aria-hidden="true"></span> Nova objednavka
|
|
||||||
</NavLink>
|
|
||||||
</div>
|
|
||||||
<div class="nav-item px-3">
|
|
||||||
<NavLink class="nav-link" href="DetailObjednavky">
|
|
||||||
<span class="bi bi-lock-nav-menu" aria-hidden="true"></span> Detail objednavky
|
|
||||||
</NavLink>
|
|
||||||
</div>
|
|
||||||
<AuthorizeView>
|
|
||||||
<Authorized>
|
<Authorized>
|
||||||
<div class="nav-item px-3">
|
|
||||||
<NavLink class="nav-link" href="Account/Manage">
|
<div class="nav-item">
|
||||||
<span class="bi bi-person-fill-nav-menu" aria-hidden="true"></span> @context.User.Identity?.Name
|
<NavLink class="nav-link"
|
||||||
|
href="admin"
|
||||||
|
onclick="document.getElementById('public-menu-toggle').checked = false">
|
||||||
|
|
||||||
|
<span>Administrace</span>
|
||||||
|
|
||||||
</NavLink>
|
</NavLink>
|
||||||
</div>
|
</div>
|
||||||
<div class="nav-item px-3">
|
|
||||||
<form action="Account/Logout" method="post">
|
|
||||||
<AntiforgeryToken />
|
|
||||||
<input type="hidden" name="ReturnUrl" value="@currentUrl" />
|
|
||||||
<button type="submit" class="nav-link">
|
|
||||||
<span class="bi bi-arrow-bar-left-nav-menu" aria-hidden="true"></span> Logout
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</Authorized>
|
</Authorized>
|
||||||
<NotAuthorized>
|
|
||||||
<div class="nav-item px-3">
|
|
||||||
<NavLink class="nav-link" href="Account/Register">
|
|
||||||
<span class="bi bi-person-nav-menu" aria-hidden="true"></span> Register
|
|
||||||
</NavLink>
|
|
||||||
</div>
|
|
||||||
<div class="nav-item px-3">
|
|
||||||
<NavLink class="nav-link" href="Account/Login">
|
|
||||||
<span class="bi bi-person-badge-nav-menu" aria-hidden="true"></span> Login
|
|
||||||
</NavLink>
|
|
||||||
</div>
|
|
||||||
<div class="nav-item px-3">
|
|
||||||
<NavLink class="nav-link" href="admin">
|
|
||||||
<span class="bi bi-gear-nav-menu" aria-hidden="true"></span> Admin
|
|
||||||
</NavLink>
|
|
||||||
</div>
|
|
||||||
</NotAuthorized>
|
|
||||||
</AuthorizeView>
|
</AuthorizeView>
|
||||||
|
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
|
<div class="nav-bottom public-account-links">
|
||||||
|
|
||||||
|
<AuthorizeView>
|
||||||
|
|
||||||
|
<Authorized>
|
||||||
|
|
||||||
|
<div class="nav-item account-item">
|
||||||
|
<NavLink class="nav-link"
|
||||||
|
href="Account/Manage"
|
||||||
|
onclick="document.getElementById('public-menu-toggle').checked = false">
|
||||||
|
|
||||||
|
<svg class="nav-icon"
|
||||||
|
width="20"
|
||||||
|
height="20"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
fill="none"
|
||||||
|
stroke="currentColor"
|
||||||
|
stroke-width="1.7"
|
||||||
|
stroke-linecap="round"
|
||||||
|
stroke-linejoin="round"
|
||||||
|
aria-hidden="true">
|
||||||
|
|
||||||
|
<circle cx="12"
|
||||||
|
cy="8"
|
||||||
|
r="4" />
|
||||||
|
|
||||||
|
<path d="M4 21v-2
|
||||||
|
a8 8 0 0 1 16 0
|
||||||
|
v2" />
|
||||||
|
|
||||||
|
</svg>
|
||||||
|
|
||||||
|
<span class="user-name">
|
||||||
|
@context.User.Identity?.Name
|
||||||
|
</span>
|
||||||
|
|
||||||
|
</NavLink>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="nav-item">
|
||||||
|
|
||||||
|
<form action="Account/Logout"
|
||||||
|
method="post">
|
||||||
|
|
||||||
|
<AntiforgeryToken />
|
||||||
|
|
||||||
|
<input type="hidden"
|
||||||
|
name="ReturnUrl"
|
||||||
|
value="@currentUrl" />
|
||||||
|
|
||||||
|
<button type="submit"
|
||||||
|
class="nav-link logout-link">
|
||||||
|
|
||||||
|
<span>Odhlásit</span>
|
||||||
|
|
||||||
|
</button>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</Authorized>
|
||||||
|
|
||||||
|
<NotAuthorized>
|
||||||
|
|
||||||
|
<div class="nav-item">
|
||||||
|
|
||||||
|
<NavLink class="nav-link"
|
||||||
|
href="Account/Login"
|
||||||
|
onclick="document.getElementById('public-menu-toggle').checked = false">
|
||||||
|
|
||||||
|
<span>Přihlášení</span>
|
||||||
|
|
||||||
|
</NavLink>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="nav-item">
|
||||||
|
|
||||||
|
<NavLink class="nav-link"
|
||||||
|
href="Account/Register"
|
||||||
|
onclick="document.getElementById('public-menu-toggle').checked = false">
|
||||||
|
|
||||||
|
<span>Registrace</span>
|
||||||
|
|
||||||
|
</NavLink>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</NotAuthorized>
|
||||||
|
|
||||||
|
</AuthorizeView>
|
||||||
|
|
||||||
|
<div class="nav-item cart-item">
|
||||||
|
|
||||||
|
<NavLink class="nav-link public-cart-link"
|
||||||
|
href="kosik"
|
||||||
|
onclick="document.getElementById('public-menu-toggle').checked = false">
|
||||||
|
|
||||||
|
<svg class="nav-icon"
|
||||||
|
width="20"
|
||||||
|
height="20"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
fill="none"
|
||||||
|
stroke="currentColor"
|
||||||
|
stroke-width="1.7"
|
||||||
|
stroke-linecap="round"
|
||||||
|
stroke-linejoin="round"
|
||||||
|
aria-hidden="true">
|
||||||
|
|
||||||
|
<path d="M3 3h2l3.5 13h10
|
||||||
|
l3-10H6" />
|
||||||
|
|
||||||
|
<circle cx="10"
|
||||||
|
cy="20"
|
||||||
|
r="1" />
|
||||||
|
|
||||||
|
<circle cx="18"
|
||||||
|
cy="20"
|
||||||
|
r="1" />
|
||||||
|
|
||||||
|
</svg>
|
||||||
|
|
||||||
|
<span>Košík</span>
|
||||||
|
|
||||||
|
</NavLink>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
@@ -84,14 +214,20 @@
|
|||||||
|
|
||||||
protected override void OnInitialized()
|
protected override void OnInitialized()
|
||||||
{
|
{
|
||||||
currentUrl = NavigationManager.ToBaseRelativePath(NavigationManager.Uri);
|
currentUrl = NavigationManager.ToBaseRelativePath(
|
||||||
|
NavigationManager.Uri);
|
||||||
|
|
||||||
NavigationManager.LocationChanged += OnLocationChanged;
|
NavigationManager.LocationChanged += OnLocationChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnLocationChanged(object? sender, LocationChangedEventArgs e)
|
private void OnLocationChanged(
|
||||||
|
object? sender,
|
||||||
|
LocationChangedEventArgs e)
|
||||||
{
|
{
|
||||||
currentUrl = NavigationManager.ToBaseRelativePath(e.Location);
|
currentUrl = NavigationManager.ToBaseRelativePath(
|
||||||
StateHasChanged();
|
e.Location);
|
||||||
|
|
||||||
|
_ = InvokeAsync(StateHasChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
|
|||||||
@@ -1,211 +1,522 @@
|
|||||||
|
|
||||||
/* ==========================================
|
/* ========================================
|
||||||
WEB JARMARK – MODERNÍ BOČNÍ NAVIGACE
|
SKOLNI JARMARK - PUBLIC NAVIGATION
|
||||||
========================================== */
|
======================================== */
|
||||||
|
|
||||||
.top-row {
|
.nav-panel {
|
||||||
min-height: 76px;
|
--nav-primary: #244b36;
|
||||||
|
--nav-primary-hover: #193b29;
|
||||||
|
--nav-secondary: #e6eddf;
|
||||||
|
--nav-text: #26372b;
|
||||||
|
--nav-muted: #59665b;
|
||||||
|
--nav-border: #dce3d9;
|
||||||
|
--nav-surface: #ffffff;
|
||||||
|
position: relative;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 0 24px !important;
|
gap: 32px;
|
||||||
background: linear-gradient(135deg, #10233f, #183d68);
|
width: 100%;
|
||||||
border-bottom: 1px solid rgba(255, 255, 255, .08);
|
max-width: 1440px;
|
||||||
|
min-width: 0;
|
||||||
|
min-height: 76px;
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 12px 32px;
|
||||||
|
background: var(--nav-surface);
|
||||||
|
color: var(--nav-text);
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ========================================
|
||||||
|
BRAND
|
||||||
|
======================================== */
|
||||||
|
|
||||||
|
.nav-brand-area {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
flex-shrink: 0;
|
||||||
|
min-width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.navbar-brand {
|
.navbar-brand {
|
||||||
color: #ffffff !important;
|
display: inline-flex;
|
||||||
font-size: 21px;
|
align-items: center;
|
||||||
font-weight: 800;
|
gap: 8px;
|
||||||
letter-spacing: -.5px;
|
min-height: 44px;
|
||||||
transition: color .25s ease;
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
color: var(--nav-primary);
|
||||||
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.navbar-brand:hover {
|
.navbar-brand:hover {
|
||||||
color: #8fc5ff !important;
|
color: var(--nav-primary-hover);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Pozadí navigace */
|
.brand-symbol {
|
||||||
.nav-scrollable {
|
display: block;
|
||||||
background: linear-gradient(180deg, #142b4a 0%, #10223b 100%);
|
width: 32px;
|
||||||
min-height: calc(100vh - 76px);
|
height: 32px;
|
||||||
padding: 22px 13px;
|
flex-shrink: 0;
|
||||||
|
color: var(--nav-primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.brand-text {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.brand-text strong {
|
||||||
|
font-family: Georgia, "Times New Roman", serif;
|
||||||
|
font-size: 23px;
|
||||||
|
font-weight: 700;
|
||||||
|
line-height: 1.2;
|
||||||
|
letter-spacing: normal;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ========================================
|
||||||
|
NAVIGATION STRUCTURE
|
||||||
|
======================================== */
|
||||||
|
|
||||||
|
.nav-scrollable {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
flex: 1;
|
||||||
|
gap: 16px;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.public-nav-links {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 4px;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.public-account-links {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: flex-end;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 8px;
|
||||||
|
min-width: 0;
|
||||||
|
margin: 0 0 0 auto;
|
||||||
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Položky menu */
|
|
||||||
.nav-item {
|
.nav-item {
|
||||||
|
display: block;
|
||||||
|
min-width: 0;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
margin-bottom: 7px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Odkazy */
|
|
||||||
|
/* ========================================
|
||||||
|
NAVIGATION LINKS
|
||||||
|
======================================== */
|
||||||
|
|
||||||
.nav-item ::deep .nav-link {
|
.nav-item ::deep .nav-link {
|
||||||
position: relative;
|
position: relative;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
width: 100%;
|
justify-content: flex-start;
|
||||||
min-height: 49px;
|
gap: 8px;
|
||||||
padding: 0 16px;
|
min-height: 44px;
|
||||||
|
margin: 0;
|
||||||
|
padding: 8px 12px;
|
||||||
border: 1px solid transparent;
|
border: 1px solid transparent;
|
||||||
border-radius: 12px;
|
border-radius: 6px;
|
||||||
background: transparent;
|
background: transparent;
|
||||||
color: #b9c9dc;
|
color: var(--nav-muted);
|
||||||
|
font-family: inherit;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 600;
|
||||||
|
line-height: 1.4;
|
||||||
|
text-align: left;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
line-height: normal;
|
white-space: nowrap;
|
||||||
transition: background .25s ease, color .25s ease, border-color .25s ease, transform .25s ease, box-shadow .25s ease;
|
transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Hover efekt */
|
|
||||||
.nav-item ::deep .nav-link:hover {
|
.nav-item ::deep .nav-link:hover {
|
||||||
color: #ffffff;
|
background: #f1f4ef;
|
||||||
background: rgba(255, 255, 255, .09);
|
color: var(--nav-primary);
|
||||||
border-color: rgba(255, 255, 255, .08);
|
text-decoration: none;
|
||||||
transform: translateX(4px);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Aktivní stránka */
|
.nav-item ::deep a.nav-link.active {
|
||||||
.nav-item ::deep a.active {
|
background: var(--nav-secondary);
|
||||||
color: #ffffff;
|
color: var(--nav-primary);
|
||||||
background: linear-gradient( 100deg, rgba(40, 130, 235, .32), rgba(40, 130, 235, .12) );
|
border-color: #dce5d7;
|
||||||
border-color: rgba(105, 175, 255, .25);
|
font-weight: 700;
|
||||||
box-shadow: 0 4px 14px rgba(0, 0, 0, .12);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Modrý indikátor aktivní stránky */
|
|
||||||
.nav-item ::deep a.active::before {
|
/* ========================================
|
||||||
|
ICONS
|
||||||
|
======================================== */
|
||||||
|
|
||||||
|
.nav-icon {
|
||||||
|
display: block;
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ========================================
|
||||||
|
USER ACCOUNT
|
||||||
|
======================================== */
|
||||||
|
|
||||||
|
.account-item {
|
||||||
|
min-width: 0;
|
||||||
|
max-width: 200px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-name {
|
||||||
|
display: block;
|
||||||
|
min-width: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-item ::deep form {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-item ::deep button.nav-link {
|
||||||
|
width: 100%;
|
||||||
|
font-family: inherit;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-item ::deep .logout-link {
|
||||||
|
color: #8b4038;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-item ::deep .logout-link:hover {
|
||||||
|
background: #fbefed;
|
||||||
|
color: #74342d;
|
||||||
|
border-color: #efd8d4;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ========================================
|
||||||
|
SHOPPING CART - PRIMARY ACTION
|
||||||
|
======================================== */
|
||||||
|
|
||||||
|
.cart-item {
|
||||||
|
margin-left: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cart-item ::deep .public-cart-link {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 8px;
|
||||||
|
min-height: 44px;
|
||||||
|
padding: 10px 20px;
|
||||||
|
border: 1px solid var(--nav-primary);
|
||||||
|
border-radius: 6px;
|
||||||
|
background: var(--nav-primary);
|
||||||
|
color: #ffffff;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cart-item ::deep .public-cart-link:hover {
|
||||||
|
background: var(--nav-primary-hover);
|
||||||
|
border-color: var(--nav-primary-hover);
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cart-item ::deep a.public-cart-link.active {
|
||||||
|
background: var(--nav-primary-hover);
|
||||||
|
border-color: var(--nav-primary-hover);
|
||||||
|
color: #ffffff;
|
||||||
|
text-decoration: underline;
|
||||||
|
text-underline-offset: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ========================================
|
||||||
|
KEYBOARD ACCESSIBILITY
|
||||||
|
======================================== */
|
||||||
|
|
||||||
|
.navbar-brand:focus-visible,
|
||||||
|
.navbar-toggler:focus-visible,
|
||||||
|
.nav-panel ::deep .nav-link:focus-visible {
|
||||||
|
outline: 3px solid #527b49;
|
||||||
|
outline-offset: 3px;
|
||||||
|
box-shadow: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ========================================
|
||||||
|
MOBILE MENU TOGGLE
|
||||||
|
======================================== */
|
||||||
|
|
||||||
|
.navbar-toggler {
|
||||||
|
display: none;
|
||||||
|
appearance: none;
|
||||||
|
-webkit-appearance: none;
|
||||||
|
position: absolute;
|
||||||
|
top: 12px;
|
||||||
|
right: 24px;
|
||||||
|
width: 44px;
|
||||||
|
height: 44px;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
border: 1px solid var(--nav-border);
|
||||||
|
border-radius: 6px;
|
||||||
|
background: var(--nav-surface);
|
||||||
|
color: var(--nav-primary);
|
||||||
|
cursor: pointer;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.navbar-toggler::before,
|
||||||
|
.navbar-toggler::after {
|
||||||
content: "";
|
content: "";
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: -13px;
|
left: 11px;
|
||||||
top: 10px;
|
width: 20px;
|
||||||
bottom: 10px;
|
height: 2px;
|
||||||
width: 3px;
|
background: currentColor;
|
||||||
border-radius: 0 5px 5px 0;
|
border-radius: 1px;
|
||||||
background: #58a6ff;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ikony */
|
.navbar-toggler::before {
|
||||||
.nav-item ::deep .bi {
|
top: 14px;
|
||||||
width: 21px;
|
box-shadow: 0 6px 0 currentColor;
|
||||||
height: 21px;
|
|
||||||
margin-right: 13px;
|
|
||||||
flex-shrink: 0;
|
|
||||||
background-size: contain;
|
|
||||||
background-repeat: no-repeat;
|
|
||||||
background-position: center;
|
|
||||||
opacity: .85;
|
|
||||||
transition: transform .25s ease, opacity .25s ease;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.nav-item ::deep .nav-link:hover .bi,
|
.navbar-toggler::after {
|
||||||
.nav-item ::deep a.active .bi {
|
top: 26px;
|
||||||
opacity: 1;
|
|
||||||
transform: scale(1.08);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Odhlášení */
|
|
||||||
.nav-item ::deep form {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.nav-item ::deep button.nav-link {
|
|
||||||
text-align: left;
|
|
||||||
font-family: inherit;
|
|
||||||
font-size: inherit;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Mobilní tlačítko */
|
|
||||||
.navbar-toggler {
|
|
||||||
appearance: none;
|
|
||||||
width: 43px;
|
|
||||||
height: 39px;
|
|
||||||
position: absolute;
|
|
||||||
top: 18px;
|
|
||||||
right: 16px;
|
|
||||||
border: 1px solid rgba(255, 255, 255, .2);
|
|
||||||
border-radius: 10px;
|
|
||||||
background-color: rgba(255, 255, 255, .08);
|
|
||||||
cursor: pointer;
|
|
||||||
transition: background .2s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
.navbar-toggler:hover,
|
|
||||||
.navbar-toggler:checked {
|
.navbar-toggler:checked {
|
||||||
background-color: rgba(255, 255, 255, .18);
|
background: var(--nav-secondary);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Plynulé otevření menu na mobilu */
|
.navbar-toggler:checked::before {
|
||||||
.nav-scrollable {
|
top: 20px;
|
||||||
overflow: hidden;
|
transform: rotate(45deg);
|
||||||
}
|
box-shadow: none;
|
||||||
|
|
||||||
.navbar-toggler:not(:checked) ~ .nav-scrollable {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.navbar-toggler:checked ~ .nav-scrollable {
|
|
||||||
display: block;
|
|
||||||
animation: menuEnter .28s ease both;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes menuEnter {
|
|
||||||
from {
|
|
||||||
opacity: 0;
|
|
||||||
transform: translateY(-8px);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
to {
|
.navbar-toggler:checked::after {
|
||||||
opacity: 1;
|
top: 20px;
|
||||||
transform: translateY(0);
|
transform: rotate(-45deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.navbar-toggler:hover {
|
||||||
|
background-color: var(--nav-secondary);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ========================================
|
||||||
|
COMPACT DESKTOP
|
||||||
|
======================================== */
|
||||||
|
|
||||||
|
@media (max-width: 1200px) {
|
||||||
|
|
||||||
|
.nav-panel {
|
||||||
|
gap: 16px;
|
||||||
|
padding: 12px 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.brand-text strong {
|
||||||
|
font-size: 21px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.public-account-links {
|
||||||
|
gap: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-item ::deep .nav-link {
|
||||||
|
padding: 8px 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cart-item ::deep .public-cart-link {
|
||||||
|
padding: 10px 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.account-item {
|
||||||
|
max-width: 160px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Scrollbar */
|
|
||||||
.nav-scrollable::-webkit-scrollbar {
|
|
||||||
width: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.nav-scrollable::-webkit-scrollbar-thumb {
|
/* ========================================
|
||||||
background: rgba(255, 255, 255, .2);
|
TABLET AND MOBILE
|
||||||
border-radius: 10px;
|
======================================== */
|
||||||
}
|
|
||||||
|
@media (max-width: 1024px) {
|
||||||
|
|
||||||
|
.nav-panel {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: stretch;
|
||||||
|
gap: 0;
|
||||||
|
min-height: 68px;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-brand-area {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
min-height: 68px;
|
||||||
|
padding: 12px 84px 12px 24px;
|
||||||
|
}
|
||||||
|
|
||||||
/* Desktop */
|
|
||||||
@media (min-width: 641px) {
|
|
||||||
.navbar-toggler {
|
.navbar-toggler {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-scrollable {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
flex-direction: column;
|
||||||
|
align-items: stretch;
|
||||||
.nav-scrollable {
|
gap: 16px;
|
||||||
display: block !important;
|
width: 100%;
|
||||||
height: calc(100vh - 76px);
|
padding: 16px 24px 24px;
|
||||||
overflow-y: auto;
|
border-top: 1px solid var(--nav-border);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Menší displeje */
|
|
||||||
@media (max-width: 640px) {
|
|
||||||
.top-row {
|
|
||||||
min-height: 70px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.nav-scrollable {
|
|
||||||
min-height: auto;
|
|
||||||
padding: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.nav-item {
|
|
||||||
margin-bottom: 5px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (prefers-reduced-motion: reduce) {
|
|
||||||
.nav-item ::deep .nav-link,
|
|
||||||
.nav-item ::deep .bi {
|
|
||||||
transition: none;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.navbar-toggler:checked ~ .nav-scrollable {
|
.navbar-toggler:checked ~ .nav-scrollable {
|
||||||
animation: none;
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.public-nav-links {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: stretch;
|
||||||
|
gap: 4px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.public-account-links {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: stretch;
|
||||||
|
gap: 4px;
|
||||||
|
width: 100%;
|
||||||
|
margin: 0;
|
||||||
|
padding-top: 16px;
|
||||||
|
border-top: 1px solid var(--nav-border);
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-item {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-item ::deep .nav-link {
|
||||||
|
width: 100%;
|
||||||
|
min-height: 48px;
|
||||||
|
padding: 12px 16px;
|
||||||
|
font-size: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.account-item {
|
||||||
|
max-width: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cart-item {
|
||||||
|
margin: 12px 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cart-item ::deep .public-cart-link {
|
||||||
|
width: 100%;
|
||||||
|
min-height: 48px;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ========================================
|
||||||
|
MOBILE - MAX 640 PX
|
||||||
|
======================================== */
|
||||||
|
|
||||||
|
@media (max-width: 640px) {
|
||||||
|
|
||||||
|
.nav-brand-area {
|
||||||
|
padding: 12px 76px 12px 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.navbar-toggler {
|
||||||
|
right: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.brand-symbol {
|
||||||
|
width: 28px;
|
||||||
|
height: 28px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.brand-text strong {
|
||||||
|
font-size: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-scrollable {
|
||||||
|
padding: 12px 16px 20px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ========================================
|
||||||
|
SMALL MOBILE
|
||||||
|
======================================== */
|
||||||
|
|
||||||
|
@media (max-width: 360px) {
|
||||||
|
|
||||||
|
.brand-text strong {
|
||||||
|
font-size: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.brand-symbol {
|
||||||
|
width: 24px;
|
||||||
|
height: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.navbar-brand {
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-brand-area {
|
||||||
|
padding-left: 12px;
|
||||||
|
padding-right: 68px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.navbar-toggler {
|
||||||
|
right: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-scrollable {
|
||||||
|
padding: 12px 12px 16px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ========================================
|
||||||
|
REDUCED MOTION
|
||||||
|
======================================== */
|
||||||
|
|
||||||
|
@media (prefers-reduced-motion: reduce) {
|
||||||
|
|
||||||
|
.navbar-brand,
|
||||||
|
.navbar-toggler,
|
||||||
|
.nav-panel ::deep .nav-link {
|
||||||
|
transition: none !important;
|
||||||
|
animation: none !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,379 +7,350 @@
|
|||||||
@using Web_Jarmark.Data.Models
|
@using Web_Jarmark.Data.Models
|
||||||
@inject ApplicationDbContext Db
|
@inject ApplicationDbContext Db
|
||||||
|
|
||||||
@attribute [Authorize]
|
@attribute [Authorize(Roles = "Admin")]
|
||||||
|
|
||||||
<PageTitle>Přehled administrace</PageTitle>
|
<PageTitle>Přehled administrace</PageTitle>
|
||||||
|
|
||||||
@if (loading)
|
<div class="dash">
|
||||||
{
|
@if (loading)
|
||||||
<div class="ap-loading">Načítám…</div>
|
{
|
||||||
}
|
<div class="ao-loading">Načítám přehled…</div>
|
||||||
else
|
}
|
||||||
{
|
else if (!string.IsNullOrEmpty(error))
|
||||||
<div class="ap">
|
{
|
||||||
<header class="ap-hero">
|
<div class="ao-alert">@error</div>
|
||||||
<p class="ap-eyebrow">Web-Jarmark</p>
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<header class="dash-hero">
|
||||||
|
<div>
|
||||||
|
<p class="dash-eyebrow">Web-Jarmark</p>
|
||||||
<h1>Přehled</h1>
|
<h1>Přehled</h1>
|
||||||
<p class="ap-sub">Aktuální stav vašeho obchodu na jednom místě.</p>
|
<p class="dash-sub">Aktuální stav obchodu na jednom místě.</p>
|
||||||
|
</div>
|
||||||
|
<div class="dash-hero-actions">
|
||||||
|
<a class="ap-btn ap-btn-primary" href="/admin/objednavky">Objednávky</a>
|
||||||
|
<a class="ap-btn" href="/admin/zbozi">Zboží</a>
|
||||||
|
<a class="ap-btn" href="/admin/sklad">Sklad</a>
|
||||||
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<section class="ap-metrics">
|
<section class="dash-kpis">
|
||||||
<article class="ap-metric">
|
<article class="dash-kpi" style="--i:0">
|
||||||
<span class="ap-metric-label">Produkty</span>
|
<span>Objednávky</span>
|
||||||
<strong class="ap-metric-value">@productCount</strong>
|
<strong class="dash-count">@orderCount</strong>
|
||||||
<span class="ap-metric-hint">celkem v katalogu</span>
|
<small>@pendingCount čeká na platbu</small>
|
||||||
</article>
|
</article>
|
||||||
<article class="ap-metric">
|
<article class="dash-kpi" style="--i:1">
|
||||||
<span class="ap-metric-label">Kategorie</span>
|
<span>Tržby</span>
|
||||||
<strong class="ap-metric-value">@categoryCount</strong>
|
<strong class="dash-count">@revenue.ToString("N0")</strong>
|
||||||
<span class="ap-metric-hint">v sortimentu</span>
|
<small>Kč uhrazené / dokončené</small>
|
||||||
</article>
|
</article>
|
||||||
<article class="ap-metric">
|
<article class="dash-kpi" style="--i:2">
|
||||||
<span class="ap-metric-label">Viditelné</span>
|
<span>Produkty</span>
|
||||||
<strong class="ap-metric-value">@visibleCount</strong>
|
<strong class="dash-count">@productCount</strong>
|
||||||
<span class="ap-metric-hint">v e-shopu</span>
|
<small>@visibleCount viditelných</small>
|
||||||
</article>
|
</article>
|
||||||
<article class="ap-metric">
|
<article class="dash-kpi" style="--i:3">
|
||||||
<span class="ap-metric-label">Nízký sklad</span>
|
<span>Sklad</span>
|
||||||
<strong class="ap-metric-value">@lowStockCount</strong>
|
<strong class="dash-count">@stockUnits</strong>
|
||||||
<span class="ap-metric-hint">≤ 5 kusů</span>
|
<small>@stockValue.ToString("N0") Kč hodnota</small>
|
||||||
|
</article>
|
||||||
|
<article class="dash-kpi" style="--i:4">
|
||||||
|
<span>Nízký sklad</span>
|
||||||
|
<strong class="dash-count">@lowStockCount</strong>
|
||||||
|
<small>≤ 5 ks</small>
|
||||||
|
</article>
|
||||||
|
<article class="dash-kpi" style="--i:5">
|
||||||
|
<span>Kategorie</span>
|
||||||
|
<strong class="dash-count">@categoryCount</strong>
|
||||||
|
<small>@activeCategoryCount aktivních</small>
|
||||||
</article>
|
</article>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
@* Řada grafů *@
|
<section class="dash-row-3">
|
||||||
<section class="ap-charts">
|
<article class="dash-card" style="--i:6">
|
||||||
<article class="ap-panel">
|
<div class="dash-card-head">
|
||||||
<div class="ap-panel-head">
|
|
||||||
<h2>Viditelnost</h2>
|
<h2>Viditelnost</h2>
|
||||||
|
<p>Katalog v e-shopu</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="ap-donut-block">
|
<div class="dash-stack">
|
||||||
<div class="ap-donut" style="@visibilityDonutStyle">
|
<div class="dash-stack-top">
|
||||||
<div class="ap-donut-hole">
|
|
||||||
<strong>@productCount</strong>
|
<strong>@productCount</strong>
|
||||||
<small>celkem</small>
|
<span>produktů celkem</span>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="dash-progress">
|
||||||
|
<div class="dash-progress-fill is-dark" style="width:@visPercent%"></div>
|
||||||
</div>
|
</div>
|
||||||
<ul class="ap-legend">
|
<div class="dash-split">
|
||||||
<li>
|
<div class="dash-split-item">
|
||||||
<span class="ap-swatch is-dark"></span>
|
<span class="dash-dot is-on"></span>
|
||||||
Viditelné
|
<div>
|
||||||
<strong>@visibleCount</strong>
|
<strong>@visibleCount</strong>
|
||||||
</li>
|
<small>Viditelné</small>
|
||||||
<li>
|
</div>
|
||||||
<span class="ap-swatch is-mid"></span>
|
</div>
|
||||||
Skryté
|
<div class="dash-split-item">
|
||||||
|
<span class="dash-dot is-off"></span>
|
||||||
|
<div>
|
||||||
<strong>@hiddenCount</strong>
|
<strong>@hiddenCount</strong>
|
||||||
</li>
|
<small>Skryté</small>
|
||||||
</ul>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</article>
|
</article>
|
||||||
|
|
||||||
<article class="ap-panel">
|
<article class="dash-card" style="--i:7">
|
||||||
<div class="ap-panel-head">
|
<div class="dash-card-head">
|
||||||
<h2>Stav skladu</h2>
|
<h2>Stav skladu</h2>
|
||||||
|
<p>Produkty podle zásob</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="ap-stack-chart">
|
<div class="dash-stack">
|
||||||
<div class="ap-stack-bar">
|
<div class="dash-stack-top">
|
||||||
<div class="ap-stack-seg is-ok" style="@($"width:{stockOkPct}%")" title="V pořádku"></div>
|
<strong>@stockUnits</strong>
|
||||||
<div class="ap-stack-seg is-low" style="@($"width:{stockLowPct}%")" title="Nízký"></div>
|
<span>ks na skladě · @stockValue.ToString("N0") Kč</span>
|
||||||
<div class="ap-stack-seg is-out" style="@($"width:{stockOutPct}%")" title="Vyprodané"></div>
|
|
||||||
</div>
|
</div>
|
||||||
<ul class="ap-legend">
|
<div class="dash-progress dash-progress-multi">
|
||||||
<li>
|
<div class="dash-progress-fill is-dark" style="width:@okPercent%"></div>
|
||||||
<span class="ap-swatch is-dark"></span>
|
<div class="dash-progress-fill is-mid" style="width:@lowPercent%"></div>
|
||||||
V pořádku
|
<div class="dash-progress-fill is-light" style="width:@outPercent%"></div>
|
||||||
<strong>@stockOkCount</strong>
|
</div>
|
||||||
</li>
|
<div class="dash-split three">
|
||||||
<li>
|
<div class="dash-split-item">
|
||||||
<span class="ap-swatch is-mid"></span>
|
<span class="dash-dot is-on"></span>
|
||||||
Nízký (1–5)
|
<div>
|
||||||
<strong>@lowStockPositiveCount</strong>
|
<strong>@okStockCount</strong>
|
||||||
</li>
|
<small>V pořádku</small>
|
||||||
<li>
|
</div>
|
||||||
<span class="ap-swatch is-light"></span>
|
</div>
|
||||||
Vyprodané
|
<div class="dash-split-item">
|
||||||
|
<span class="dash-dot is-mid"></span>
|
||||||
|
<div>
|
||||||
|
<strong>@lowStockCount</strong>
|
||||||
|
<small>Nízký</small>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="dash-split-item">
|
||||||
|
<span class="dash-dot is-off"></span>
|
||||||
|
<div>
|
||||||
<strong>@outOfStockCount</strong>
|
<strong>@outOfStockCount</strong>
|
||||||
</li>
|
<small>Prázdný</small>
|
||||||
</ul>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</article>
|
</article>
|
||||||
|
|
||||||
<article class="ap-panel">
|
<article class="dash-card" style="--i:8">
|
||||||
<div class="ap-panel-head">
|
<div class="dash-card-head">
|
||||||
<h2>Katalog</h2>
|
<h2>Objednávky</h2>
|
||||||
|
<p>Podle stavu</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="ap-stat-list">
|
<div class="dash-bars">
|
||||||
<div class="ap-stat-line">
|
@foreach (var b in orderBars)
|
||||||
<span>Průměrná cena</span>
|
{
|
||||||
<strong>@avgPrice.ToString("N0") Kč</strong>
|
<div class="dash-bar-row">
|
||||||
|
<div class="dash-bar-label">
|
||||||
|
<span>@b.Label</span>
|
||||||
|
<strong>@b.Count</strong>
|
||||||
</div>
|
</div>
|
||||||
<div class="ap-stat-line">
|
<div class="dash-bar-track">
|
||||||
<span>Nejvyšší cena</span>
|
<div class="dash-bar-fill" style="width:@b.Percent%"></div>
|
||||||
<strong>@maxPrice.ToString("N0") Kč</strong>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="ap-stat-line">
|
|
||||||
<span>Kusů skladem</span>
|
|
||||||
<strong>@totalStock</strong>
|
|
||||||
</div>
|
|
||||||
<div class="ap-stat-line">
|
|
||||||
<span>Hodnota skladu</span>
|
|
||||||
<strong>@stockValue.ToString("N0") Kč</strong>
|
|
||||||
</div>
|
</div>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
</article>
|
</article>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="ap-grid">
|
<section class="dash-row-2">
|
||||||
<article class="ap-panel ap-panel-wide">
|
<article class="dash-card" style="--i:9">
|
||||||
<div class="ap-panel-head">
|
<div class="dash-card-head">
|
||||||
<h2>Produkty podle kategorií</h2>
|
|
||||||
<a href="/admin/kategorie">Spravovat</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
@if (categoryStats.Count == 0)
|
|
||||||
{
|
|
||||||
<p class="ap-empty">Zatím žádné kategorie.</p>
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
<div class="ap-rows">
|
|
||||||
@foreach (var cat in categoryStats)
|
|
||||||
{
|
|
||||||
<div class="ap-row">
|
|
||||||
<div class="ap-row-top">
|
|
||||||
<span>@cat.Name</span>
|
|
||||||
<span class="ap-row-num">@cat.ProductCount</span>
|
|
||||||
</div>
|
|
||||||
<div class="ap-track">
|
|
||||||
<div class="ap-fill" style="@($"width:{GetWidth(cat.ProductCount)}%")"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
</article>
|
|
||||||
|
|
||||||
<article class="ap-panel">
|
|
||||||
<div class="ap-panel-head">
|
|
||||||
<h2>Rychlé akce</h2>
|
<h2>Rychlé akce</h2>
|
||||||
|
<p>Nejčastější správa</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="ap-actions">
|
<div class="dash-actions">
|
||||||
<a class="ap-action" href="/admin/zbozi/edit">
|
<a class="dash-action" href="/admin/objednavky"><strong>Objednávky</strong><span>@pendingCount čeká</span></a>
|
||||||
<span class="ap-action-title">Nové zboží</span>
|
<a class="dash-action" href="/admin/zbozi"><strong>Zboží</strong><span>@productCount produktů</span></a>
|
||||||
<span class="ap-action-sub">Přidat produkt</span>
|
<a class="dash-action" href="/admin/sklad"><strong>Sklad</strong><span>@lowStockCount nízký</span></a>
|
||||||
</a>
|
<a class="dash-action" href="/admin/kategorie"><strong>Kategorie</strong><span>@categoryCount položek</span></a>
|
||||||
<a class="ap-action" href="/admin/kategorie/edit">
|
<a class="dash-action" href="/admin/statistiky"><strong>Statistiky</strong><span>detailní přehled</span></a>
|
||||||
<span class="ap-action-title">Nová kategorie</span>
|
<a class="dash-action" href="/admin/administratori"><strong>Uživatelé</strong><span>správa účtů</span></a>
|
||||||
<span class="ap-action-sub">Rozšířit sortiment</span>
|
|
||||||
</a>
|
|
||||||
<a class="ap-action" href="/admin/zbozi">
|
|
||||||
<span class="ap-action-title">Správa zboží</span>
|
|
||||||
<span class="ap-action-sub">Upravit katalog</span>
|
|
||||||
</a>
|
|
||||||
</div>
|
</div>
|
||||||
</article>
|
</article>
|
||||||
|
|
||||||
|
<article class="dash-card" style="--i:10">
|
||||||
|
<div class="dash-card-head">
|
||||||
|
<h2>Pozor na sklad</h2>
|
||||||
|
<p>Nízký stav a vyprodané</p>
|
||||||
|
</div>
|
||||||
|
@if (attentionProducts.Count == 0)
|
||||||
|
{
|
||||||
|
<div class="dash-empty">Všechny produkty mají dostatek kusů.</div>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<div class="dash-mini-list">
|
||||||
|
@foreach (var p in attentionProducts)
|
||||||
|
{
|
||||||
|
<a class="dash-mini-item" href="@($"/admin/zbozi/edit/{p.Id}")">
|
||||||
|
<div>
|
||||||
|
<strong>@p.Name</strong>
|
||||||
|
<span>@p.CategoryName</span>
|
||||||
|
</div>
|
||||||
|
<span class="ao-badge @(p.StockQuantity <= 0 ? "is-cancel" : "is-pending")">
|
||||||
|
@p.StockQuantity ks
|
||||||
|
</span>
|
||||||
|
</a>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</article>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
@* Mini sloupcový graf skladu u produktů *@
|
<section class="dash-card" style="--i:11">
|
||||||
<section class="ap-panel">
|
<div class="dash-card-head row">
|
||||||
<div class="ap-panel-head">
|
<div>
|
||||||
<h2>Sklad u produktů</h2>
|
<h2>Poslední objednávky</h2>
|
||||||
<a href="/admin/zbozi">Katalog</a>
|
<p>Nejnovějších 8</p>
|
||||||
|
</div>
|
||||||
|
<a class="ap-btn ap-btn-ghost" href="/admin/objednavky">Všechny</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@if (stockBars.Count == 0)
|
@if (recentOrders.Count == 0)
|
||||||
{
|
{
|
||||||
<p class="ap-empty">Zatím žádné produkty.</p>
|
<div class="dash-empty">Zatím žádné objednávky.</div>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<div class="ap-columns">
|
<div class="dash-orders">
|
||||||
@foreach (var item in stockBars)
|
@foreach (var o in recentOrders)
|
||||||
{
|
{
|
||||||
<div class="ap-col">
|
<article class="dash-order" style="--i:@o.Index">
|
||||||
<div class="ap-col-bar-wrap">
|
<div>
|
||||||
<div class="ap-col-bar" style="@($"height:{item.HeightPct}%")"></div>
|
<strong>#@o.Code</strong>
|
||||||
|
<span>@o.CreatedAt.ToLocalTime().ToString("d. M. yyyy HH:mm")</span>
|
||||||
</div>
|
</div>
|
||||||
<span class="ap-col-val">@item.Stock</span>
|
<div class="dash-order-mid">
|
||||||
<span class="ap-col-label" title="@item.Name">@Truncate(item.Name, 10)</span>
|
@(string.IsNullOrWhiteSpace(o.CustomerName) ? "—" : o.CustomerName)
|
||||||
</div>
|
</div>
|
||||||
|
<div class="dash-order-right">
|
||||||
|
<strong>@o.TotalAmount.ToString("N0") Kč</strong>
|
||||||
|
<span class="ao-badge @StatusBadge(o.Status)">@StatusText(o.Status)</span>
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="ap-panel ap-panel-table">
|
|
||||||
<div class="ap-panel-head">
|
|
||||||
<h2>Produkty</h2>
|
|
||||||
<a href="/admin/zbozi">Zobrazit vše</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
@if (productPreview.Count == 0)
|
|
||||||
{
|
|
||||||
<p class="ap-empty">Zatím žádné produkty.</p>
|
|
||||||
}
|
}
|
||||||
else
|
</div>
|
||||||
{
|
|
||||||
<div class="ap-table-wrap">
|
|
||||||
<table class="ap-table">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>Název</th>
|
|
||||||
<th>Kategorie</th>
|
|
||||||
<th>Cena</th>
|
|
||||||
<th>Sklad</th>
|
|
||||||
<th>Stav</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
@foreach (var p in productPreview)
|
|
||||||
{
|
|
||||||
<tr>
|
|
||||||
<td class="ap-name">@p.Name</td>
|
|
||||||
<td>@p.CategoryName</td>
|
|
||||||
<td>@p.Price.ToString("N0") Kč</td>
|
|
||||||
<td>@p.StockQuantity</td>
|
|
||||||
<td>
|
|
||||||
<span class="ap-status @(p.IsVisible ? "is-on" : "is-off")">
|
|
||||||
@(p.IsVisible ? "Viditelné" : "Skryté")
|
|
||||||
</span>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
</section>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
private bool loading = true;
|
private bool loading = true;
|
||||||
|
private string? error;
|
||||||
|
|
||||||
private int productCount;
|
private int productCount, visibleCount, hiddenCount, categoryCount, activeCategoryCount;
|
||||||
private int categoryCount;
|
private int stockUnits, lowStockCount, outOfStockCount, okStockCount;
|
||||||
private int visibleCount;
|
private int orderCount, pendingCount, paidCount, shippedCount, deliveredCount, cancelledCount;
|
||||||
private int hiddenCount;
|
private decimal revenue, stockValue;
|
||||||
private int lowStockCount;
|
|
||||||
private int lowStockPositiveCount;
|
|
||||||
private int outOfStockCount;
|
|
||||||
private int stockOkCount;
|
|
||||||
private int totalStock;
|
|
||||||
|
|
||||||
private decimal avgPrice;
|
private int visPercent, okPercent, lowPercent, outPercent;
|
||||||
private decimal maxPrice;
|
|
||||||
private decimal stockValue;
|
|
||||||
|
|
||||||
private double stockOkPct;
|
private List<BarItem> orderBars = new();
|
||||||
private double stockLowPct;
|
private List<RecentOrder> recentOrders = new();
|
||||||
private double stockOutPct;
|
private List<AttentionProduct> attentionProducts = new();
|
||||||
|
|
||||||
private string visibilityDonutStyle = "background: conic-gradient(#1d1d1f 0 100%);";
|
|
||||||
|
|
||||||
private List<CategoryStat> categoryStats = new();
|
|
||||||
private List<ProductPreview> productPreview = new();
|
|
||||||
private List<StockBar> stockBars = new();
|
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
var products = await Db.Set<Product>()
|
try
|
||||||
.AsNoTracking()
|
|
||||||
.Select(p => new
|
|
||||||
{
|
{
|
||||||
p.Name,
|
var products = await Db.Products.AsNoTracking().Include(p => p.Category).ToListAsync();
|
||||||
p.Price,
|
|
||||||
p.StockQuantity,
|
|
||||||
p.IsVisible,
|
|
||||||
CategoryName = p.Category.Name
|
|
||||||
})
|
|
||||||
.ToListAsync();
|
|
||||||
|
|
||||||
productCount = products.Count;
|
productCount = products.Count;
|
||||||
visibleCount = products.Count(p => p.IsVisible);
|
visibleCount = products.Count(p => p.IsVisible);
|
||||||
hiddenCount = productCount - visibleCount;
|
hiddenCount = productCount - visibleCount;
|
||||||
outOfStockCount = products.Count(p => p.StockQuantity <= 0);
|
stockUnits = products.Sum(p => p.StockQuantity);
|
||||||
lowStockPositiveCount = products.Count(p => p.StockQuantity > 0 && p.StockQuantity <= 5);
|
|
||||||
lowStockCount = products.Count(p => p.StockQuantity <= 5);
|
|
||||||
stockOkCount = products.Count(p => p.StockQuantity > 5);
|
|
||||||
totalStock = products.Sum(p => p.StockQuantity);
|
|
||||||
|
|
||||||
avgPrice = productCount == 0 ? 0 : products.Average(p => p.Price);
|
|
||||||
maxPrice = productCount == 0 ? 0 : products.Max(p => p.Price);
|
|
||||||
stockValue = products.Sum(p => p.Price * p.StockQuantity);
|
stockValue = products.Sum(p => p.Price * p.StockQuantity);
|
||||||
|
lowStockCount = products.Count(p => p.StockQuantity > 0 && p.StockQuantity <= 5);
|
||||||
|
outOfStockCount = products.Count(p => p.StockQuantity <= 0);
|
||||||
|
okStockCount = products.Count(p => p.StockQuantity > 5);
|
||||||
|
|
||||||
if (productCount > 0)
|
categoryCount = await Db.Categories.CountAsync();
|
||||||
|
activeCategoryCount = await Db.Categories.CountAsync(c => c.IsActive);
|
||||||
|
|
||||||
|
var orders = await Db.Orders.AsNoTracking().ToListAsync();
|
||||||
|
orderCount = orders.Count;
|
||||||
|
pendingCount = orders.Count(o => o.Status == OrderStatus.Pending);
|
||||||
|
paidCount = orders.Count(o => o.Status == OrderStatus.Paid);
|
||||||
|
shippedCount = orders.Count(o => o.Status == OrderStatus.Shipped);
|
||||||
|
deliveredCount = orders.Count(o => o.Status == OrderStatus.Delivered);
|
||||||
|
cancelledCount = orders.Count(o => o.Status == OrderStatus.Cancelled);
|
||||||
|
|
||||||
|
revenue = orders
|
||||||
|
.Where(o => o.Status is OrderStatus.Paid or OrderStatus.Shipped or OrderStatus.Delivered)
|
||||||
|
.Sum(o => o.TotalAmount);
|
||||||
|
|
||||||
|
visPercent = productCount == 0 ? 0 : (int)Math.Round(100.0 * visibleCount / productCount);
|
||||||
|
okPercent = productCount == 0 ? 0 : (int)Math.Round(100.0 * okStockCount / productCount);
|
||||||
|
lowPercent = productCount == 0 ? 0 : (int)Math.Round(100.0 * lowStockCount / productCount);
|
||||||
|
outPercent = productCount == 0 ? 0 : Math.Max(0, 100 - okPercent - lowPercent);
|
||||||
|
|
||||||
|
var total = Math.Max(orderCount, 1);
|
||||||
|
orderBars = new List<BarItem>
|
||||||
{
|
{
|
||||||
stockOkPct = stockOkCount * 100.0 / productCount;
|
new("Čeká na zaplacení", pendingCount, pendingCount * 100 / total),
|
||||||
stockLowPct = lowStockPositiveCount * 100.0 / productCount;
|
new("Zaplaceno", paidCount, paidCount * 100 / total),
|
||||||
stockOutPct = outOfStockCount * 100.0 / productCount;
|
new("Odesláno", shippedCount, shippedCount * 100 / total),
|
||||||
|
new("Dokončeno", deliveredCount, deliveredCount * 100 / total),
|
||||||
|
new("Zrušeno", cancelledCount, cancelledCount * 100 / total),
|
||||||
|
};
|
||||||
|
|
||||||
var visPct = visibleCount * 100.0 / productCount;
|
recentOrders = orders
|
||||||
visibilityDonutStyle =
|
.OrderByDescending(o => o.CreatedAt)
|
||||||
$"background: conic-gradient(#1d1d1f 0 {visPct.ToString("0.##", System.Globalization.CultureInfo.InvariantCulture)}%, #d2d2d7 0 100%);";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
stockOkPct = stockLowPct = stockOutPct = 0;
|
|
||||||
visibilityDonutStyle = "background: conic-gradient(#e8e8ed 0 100%);";
|
|
||||||
}
|
|
||||||
|
|
||||||
categoryCount = await Db.Set<Category>().CountAsync();
|
|
||||||
|
|
||||||
var categories = await Db.Set<Category>()
|
|
||||||
.AsNoTracking()
|
|
||||||
.Include(c => c.Products)
|
|
||||||
.OrderBy(c => c.Name)
|
|
||||||
.ToListAsync();
|
|
||||||
|
|
||||||
categoryStats = categories
|
|
||||||
.Select(c => new CategoryStat(c.Name, c.Products.Count))
|
|
||||||
.ToList();
|
|
||||||
|
|
||||||
productPreview = products
|
|
||||||
.OrderBy(p => p.Name)
|
|
||||||
.Take(6)
|
|
||||||
.Select(p => new ProductPreview(
|
|
||||||
p.Name,
|
|
||||||
p.CategoryName,
|
|
||||||
p.Price,
|
|
||||||
p.StockQuantity,
|
|
||||||
p.IsVisible))
|
|
||||||
.ToList();
|
|
||||||
|
|
||||||
var maxStock = products.Count == 0 ? 1 : Math.Max(1, products.Max(p => p.StockQuantity));
|
|
||||||
stockBars = products
|
|
||||||
.OrderByDescending(p => p.StockQuantity)
|
|
||||||
.Take(8)
|
.Take(8)
|
||||||
.Select(p => new StockBar(
|
.Select((o, idx) => new RecentOrder(o.Code, o.CustomerName, o.TotalAmount, o.Status, o.CreatedAt, idx))
|
||||||
p.Name,
|
|
||||||
p.StockQuantity,
|
|
||||||
Math.Max(8, (int)Math.Round(p.StockQuantity * 100.0 / maxStock))))
|
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
|
attentionProducts = products
|
||||||
|
.Where(p => p.StockQuantity <= 5)
|
||||||
|
.OrderBy(p => p.StockQuantity)
|
||||||
|
.ThenBy(p => p.Name)
|
||||||
|
.Take(8)
|
||||||
|
.Select(p => new AttentionProduct(p.Id, p.Name, p.Category?.Name ?? "—", p.StockQuantity))
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
error = "Přehled se nepodařilo načíst: " + ex.Message;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
loading = false;
|
loading = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int GetWidth(int count)
|
|
||||||
{
|
|
||||||
var max = categoryStats.Count == 0 ? 1 : Math.Max(1, categoryStats.Max(c => c.ProductCount));
|
|
||||||
return count == 0 ? 0 : Math.Max(8, (int)Math.Round(count * 100.0 / max));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string Truncate(string value, int max)
|
private static string StatusText(OrderStatus s) => s switch
|
||||||
=> string.IsNullOrEmpty(value) || value.Length <= max
|
{
|
||||||
? value
|
OrderStatus.Pending => "Čeká",
|
||||||
: value[..(max - 1)] + "…";
|
OrderStatus.Paid => "Zaplaceno",
|
||||||
|
OrderStatus.Shipped => "Odesláno",
|
||||||
|
OrderStatus.Delivered => "Dokončeno",
|
||||||
|
OrderStatus.Cancelled => "Zrušeno",
|
||||||
|
_ => "?"
|
||||||
|
};
|
||||||
|
|
||||||
private record CategoryStat(string Name, int ProductCount);
|
private static string StatusBadge(OrderStatus s) => s switch
|
||||||
|
{
|
||||||
|
OrderStatus.Pending => "is-pending",
|
||||||
|
OrderStatus.Paid => "is-paid",
|
||||||
|
OrderStatus.Shipped => "is-shipped",
|
||||||
|
OrderStatus.Delivered => "is-done",
|
||||||
|
OrderStatus.Cancelled => "is-cancel",
|
||||||
|
_ => ""
|
||||||
|
};
|
||||||
|
|
||||||
private record ProductPreview(
|
private sealed record BarItem(string Label, int Count, int Percent);
|
||||||
string Name,
|
private sealed record RecentOrder(string Code, string CustomerName, decimal TotalAmount, OrderStatus Status, DateTime CreatedAt, int Index);
|
||||||
string CategoryName,
|
private sealed record AttentionProduct(int Id, string Name, string CategoryName, int StockQuantity);
|
||||||
decimal Price,
|
|
||||||
int StockQuantity,
|
|
||||||
bool IsVisible);
|
|
||||||
|
|
||||||
private record StockBar(string Name, int Stock, int HeightPct);
|
|
||||||
}
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
321
Web-Jarmark/Web-Jarmark/Components/Pages/Admin/AdminUsers.razor
Normal file
321
Web-Jarmark/Web-Jarmark/Components/Pages/Admin/AdminUsers.razor
Normal file
@@ -0,0 +1,321 @@
|
|||||||
|
@page "/admin/administratori"
|
||||||
|
@layout Web_Jarmark.Components.Layout.Admin.AdminLayout
|
||||||
|
@rendermode InteractiveServer
|
||||||
|
|
||||||
|
@using Microsoft.AspNetCore.Authorization
|
||||||
|
@using Microsoft.AspNetCore.Identity
|
||||||
|
@using Microsoft.AspNetCore.Components.Authorization
|
||||||
|
@using Microsoft.EntityFrameworkCore
|
||||||
|
@using Web_Jarmark.Data
|
||||||
|
|
||||||
|
@inject UserManager<ApplicationUser> UserManager
|
||||||
|
@inject RoleManager<IdentityRole> RoleManager
|
||||||
|
@inject AuthenticationStateProvider AuthenticationStateProvider
|
||||||
|
|
||||||
|
@attribute [Authorize(Roles = "Admin")]
|
||||||
|
|
||||||
|
<PageTitle>Registrovaní uživatelé</PageTitle>
|
||||||
|
|
||||||
|
<div class="ap">
|
||||||
|
<header class="ap-hero ap-hero-left">
|
||||||
|
<p class="ap-eyebrow">Administrace</p>
|
||||||
|
<div class="ap-hero-row">
|
||||||
|
<div>
|
||||||
|
<h1>Uživatelé</h1>
|
||||||
|
<p class="ap-sub">Správa registrovaných účtů a administrátorských oprávnění.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
@if (!string.IsNullOrEmpty(message))
|
||||||
|
{
|
||||||
|
<div class="ap-alert">@message</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
@if (loading)
|
||||||
|
{
|
||||||
|
<div class="ap-loading">Načítám uživatele…</div>
|
||||||
|
}
|
||||||
|
else if (users.Count == 0)
|
||||||
|
{
|
||||||
|
<section class="ap-panel">
|
||||||
|
<p class="ap-empty">Zatím žádní registrovaní uživatelé.</p>
|
||||||
|
</section>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<section class="ap-panel ap-panel-table">
|
||||||
|
<div class="ap-panel-head">
|
||||||
|
<h2>Registrované účty</h2>
|
||||||
|
<span class="ap-muted">@users.Count účtů</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="ap-table-wrap">
|
||||||
|
<table class="ap-table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>E-mail</th>
|
||||||
|
<th>Potvrzený</th>
|
||||||
|
<th>Admin</th>
|
||||||
|
<th>Stav</th>
|
||||||
|
<th>Akce</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach (var u in users)
|
||||||
|
{
|
||||||
|
<tr @key="u.Id">
|
||||||
|
<td class="ap-name">@u.Email</td>
|
||||||
|
<td>
|
||||||
|
<span class="ap-status @(u.EmailConfirmed ? "is-on" : "is-off")">
|
||||||
|
@(u.EmailConfirmed ? "Ano" : "Ne")
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<span class="ap-status @(u.IsAdmin ? "is-on" : "is-off")">
|
||||||
|
@(u.IsAdmin ? "Admin" : "Uživatel")
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<span class="ap-status @(u.IsLocked ? "is-off" : "is-on")">
|
||||||
|
@(u.IsLocked ? "Zamčený" : "Aktivní")
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
<td class="ap-actions-cell">
|
||||||
|
<button type="button"
|
||||||
|
class="ap-btn ap-btn-ghost"
|
||||||
|
disabled="@busy"
|
||||||
|
@onclick="() => ToggleAdminAsync(u)">
|
||||||
|
@(u.IsAdmin ? "Odebrat admin" : "Udělat admin")
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<button type="button"
|
||||||
|
class="ap-btn ap-btn-ghost"
|
||||||
|
disabled="@busy"
|
||||||
|
@onclick="() => ToggleLockAsync(u)">
|
||||||
|
@(u.IsLocked ? "Odemknout" : "Zamknout")
|
||||||
|
</button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
private List<UserRow> users = new();
|
||||||
|
private bool loading = true;
|
||||||
|
private bool busy;
|
||||||
|
private string? message;
|
||||||
|
|
||||||
|
private const string AdminRole = "Admin";
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
await EnsureAdminRoleAsync();
|
||||||
|
await LoadUsersAsync();
|
||||||
|
loading = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task EnsureAdminRoleAsync()
|
||||||
|
{
|
||||||
|
if (!await RoleManager.RoleExistsAsync(AdminRole))
|
||||||
|
{
|
||||||
|
var result = await RoleManager.CreateAsync(
|
||||||
|
new IdentityRole(AdminRole));
|
||||||
|
|
||||||
|
if (!result.Succeeded)
|
||||||
|
{
|
||||||
|
message = "Nepodařilo se vytvořit roli Admin: "
|
||||||
|
+ string.Join(", ", result.Errors.Select(e => e.Description));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task LoadUsersAsync()
|
||||||
|
{
|
||||||
|
var list = await UserManager.Users
|
||||||
|
.AsNoTracking()
|
||||||
|
.OrderBy(u => u.Email)
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
users = new List<UserRow>();
|
||||||
|
|
||||||
|
foreach (var user in list)
|
||||||
|
{
|
||||||
|
var roles = await UserManager.GetRolesAsync(user);
|
||||||
|
|
||||||
|
var isLocked = user.LockoutEnd.HasValue
|
||||||
|
&& user.LockoutEnd > DateTimeOffset.UtcNow;
|
||||||
|
|
||||||
|
users.Add(new UserRow(
|
||||||
|
user.Id,
|
||||||
|
user.Email ?? "(bez e-mailu)",
|
||||||
|
user.EmailConfirmed,
|
||||||
|
roles.Contains(AdminRole),
|
||||||
|
isLocked));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task ToggleAdminAsync(UserRow row)
|
||||||
|
{
|
||||||
|
if (busy)
|
||||||
|
return;
|
||||||
|
|
||||||
|
busy = true;
|
||||||
|
message = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var user = await UserManager.FindByIdAsync(row.Id);
|
||||||
|
|
||||||
|
if (user is null)
|
||||||
|
{
|
||||||
|
message = "Uživatel nebyl nalezen.";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!await RoleManager.RoleExistsAsync(AdminRole))
|
||||||
|
{
|
||||||
|
var createRoleResult = await RoleManager.CreateAsync(
|
||||||
|
new IdentityRole(AdminRole));
|
||||||
|
|
||||||
|
if (!createRoleResult.Succeeded)
|
||||||
|
{
|
||||||
|
message = "Nepodařilo se vytvořit roli Admin: "
|
||||||
|
+ string.Join(", ", createRoleResult.Errors.Select(e => e.Description));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (row.IsAdmin)
|
||||||
|
{
|
||||||
|
var admins = await UserManager.GetUsersInRoleAsync(AdminRole);
|
||||||
|
|
||||||
|
if (admins.Count <= 1)
|
||||||
|
{
|
||||||
|
message = "Nelze odebrat roli poslednímu administrátorovi.";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
|
||||||
|
var currentUserId = UserManager.GetUserId(authState.User);
|
||||||
|
|
||||||
|
if (currentUserId == user.Id)
|
||||||
|
{
|
||||||
|
message = "Nemůžeš odebrat administrátorskou roli sám sobě.";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
IdentityResult result;
|
||||||
|
|
||||||
|
if (row.IsAdmin)
|
||||||
|
{
|
||||||
|
result = await UserManager.RemoveFromRoleAsync(user, AdminRole);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = await UserManager.AddToRoleAsync(user, AdminRole);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!result.Succeeded)
|
||||||
|
{
|
||||||
|
message = "Změna role se nepodařila: "
|
||||||
|
+ string.Join(", ", result.Errors.Select(e => e.Description));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
message = row.IsAdmin
|
||||||
|
? $"Administrátorská role byla odebrána: {row.Email}"
|
||||||
|
: $"Administrátorská role byla přidána: {row.Email}";
|
||||||
|
|
||||||
|
await LoadUsersAsync();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
message = "Chyba při změně role: " + ex.Message;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
busy = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task ToggleLockAsync(UserRow row)
|
||||||
|
{
|
||||||
|
if (busy)
|
||||||
|
return;
|
||||||
|
|
||||||
|
busy = true;
|
||||||
|
message = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var user = await UserManager.FindByIdAsync(row.Id);
|
||||||
|
|
||||||
|
if (user is null)
|
||||||
|
{
|
||||||
|
message = "Uživatel nebyl nalezen.";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
|
||||||
|
var currentUserId = UserManager.GetUserId(authState.User);
|
||||||
|
|
||||||
|
if (currentUserId == user.Id)
|
||||||
|
{
|
||||||
|
message = "Nemůžeš zamknout vlastní účet.";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
IdentityResult result;
|
||||||
|
|
||||||
|
if (row.IsLocked)
|
||||||
|
{
|
||||||
|
result = await UserManager.SetLockoutEndDateAsync(user, null);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = await UserManager.SetLockoutEnabledAsync(user, true);
|
||||||
|
|
||||||
|
if (result.Succeeded)
|
||||||
|
{
|
||||||
|
result = await UserManager.SetLockoutEndDateAsync(
|
||||||
|
user, DateTimeOffset.UtcNow.AddYears(100));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!result.Succeeded)
|
||||||
|
{
|
||||||
|
message = "Změna stavu účtu se nepodařila: "
|
||||||
|
+ string.Join(", ", result.Errors.Select(e => e.Description));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
message = row.IsLocked
|
||||||
|
? $"Účet byl odemčen: {row.Email}"
|
||||||
|
: $"Účet byl zamčen: {row.Email}";
|
||||||
|
|
||||||
|
await LoadUsersAsync();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
message = "Chyba: " + ex.Message;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
busy = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private sealed record UserRow(
|
||||||
|
string Id,
|
||||||
|
string Email,
|
||||||
|
bool EmailConfirmed,
|
||||||
|
bool IsAdmin,
|
||||||
|
bool IsLocked);
|
||||||
|
}
|
||||||
@@ -9,45 +9,45 @@
|
|||||||
@inject ApplicationDbContext Db
|
@inject ApplicationDbContext Db
|
||||||
@inject NavigationManager Nav
|
@inject NavigationManager Nav
|
||||||
|
|
||||||
@attribute [Authorize]
|
@attribute [Authorize(Roles = "Admin")]
|
||||||
|
|
||||||
<PageTitle>@(IsNew ? "Nová kategorie" : "Upravit kategorii")</PageTitle>
|
<PageTitle>@(IsNew ? "Nová kategorie" : "Upravit kategorii")</PageTitle>
|
||||||
|
|
||||||
<div class="ap">
|
<div class="ap ao">
|
||||||
<header class="ap-hero ap-hero-left">
|
<header class="ao-hero">
|
||||||
<p class="ap-eyebrow">Kategorie</p>
|
<p class="ao-eyebrow">Kategorie</p>
|
||||||
<h1>@(IsNew ? "Nová kategorie" : "Upravit kategorii")</h1>
|
<h1>@(IsNew ? "Nová kategorie" : "Upravit kategorii")</h1>
|
||||||
<p class="ap-sub">Název a stav kategorie v katalogu.</p>
|
<p class="ao-sub">Název a stav kategorie.</p>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
@if (!string.IsNullOrEmpty(error))
|
@if (!string.IsNullOrEmpty(error))
|
||||||
{
|
{
|
||||||
<div class="ap-alert">@error</div>
|
<div class="ao-alert">@error</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
@if (notFound)
|
@if (notFound)
|
||||||
{
|
{
|
||||||
<section class="ap-panel">
|
<div class="ao-empty">Kategorie nebyla nalezena.</div>
|
||||||
<p class="ap-empty">Kategorie nebyla nalezena.</p>
|
<div style="text-align:center;margin-top:12px">
|
||||||
<a class="ap-btn" href="/admin/kategorie">Zpět na seznam</a>
|
<a class="ap-btn" href="/admin/kategorie">Zpět</a>
|
||||||
</section>
|
</div>
|
||||||
}
|
}
|
||||||
else if (loading)
|
else if (loading)
|
||||||
{
|
{
|
||||||
<div class="ap-loading">Načítám…</div>
|
<div class="ao-loading">Načítám…</div>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<section class="ap-panel ap-form-panel">
|
<section class="ao-panel" style="max-width:560px;margin:0 auto">
|
||||||
<div class="ap-field">
|
<div class="ap-field">
|
||||||
<label>Název</label>
|
<label>Název</label>
|
||||||
<input class="ap-input" @bind="name" />
|
<input class="ao-input" @bind="name" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="ap-field">
|
<div class="ap-field">
|
||||||
<label>Slug</label>
|
<label>Slug</label>
|
||||||
<input class="ap-input" @bind="categorySlug" />
|
<input class="ao-input" @bind="categorySlug" />
|
||||||
<small class="ap-help">URL identifikátor, např. domaci-vyrobky</small>
|
<small class="ap-help">Když necháš prázdné, vytvoří se z názvu.</small>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<label class="ap-switch">
|
<label class="ap-switch">
|
||||||
|
|||||||
@@ -7,82 +7,70 @@
|
|||||||
@using Web_Jarmark.Data.Models
|
@using Web_Jarmark.Data.Models
|
||||||
@inject ApplicationDbContext Db
|
@inject ApplicationDbContext Db
|
||||||
|
|
||||||
@attribute [Authorize]
|
@attribute [Authorize(Roles = "Admin")]
|
||||||
|
|
||||||
<AuthorizeView>
|
<PageTitle>Kategorie</PageTitle>
|
||||||
<PageTitle>Kategorie</PageTitle>
|
|
||||||
|
|
||||||
<div class="ap">
|
<div class="ap ao">
|
||||||
<header class="ap-hero ap-hero-left">
|
<header class="ao-hero">
|
||||||
<p class="ap-eyebrow">Administrace</p>
|
<p class="ao-eyebrow">Administrace</p>
|
||||||
<div class="ap-hero-row">
|
|
||||||
<div>
|
|
||||||
<h1>Kategorie</h1>
|
<h1>Kategorie</h1>
|
||||||
<p class="ap-sub">Správa kategorií sortimentu.</p>
|
<p class="ao-sub">Správa kategorií sortimentu.</p>
|
||||||
</div>
|
<div style="margin-top:16px">
|
||||||
<a class="ap-btn ap-btn-primary" href="/admin/kategorie/edit">Nová kategorie</a>
|
<a class="ap-btn ap-btn-primary" href="/admin/kategorie/edit">Nová kategorie</a>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
@if (!string.IsNullOrEmpty(error))
|
@if (!string.IsNullOrEmpty(error))
|
||||||
{
|
{
|
||||||
<div class="ap-alert">@error</div>
|
<div class="ao-alert">@error</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
@if (items is null)
|
@if (items is null)
|
||||||
{
|
{
|
||||||
<div class="ap-loading">Načítám kategorie…</div>
|
<div class="ao-loading">Načítám kategorie…</div>
|
||||||
}
|
}
|
||||||
else if (items.Count == 0)
|
else if (items.Count == 0)
|
||||||
{
|
{
|
||||||
<section class="ap-panel">
|
<div class="ao-empty">Zatím žádné kategorie.</div>
|
||||||
<p class="ap-empty">Zatím nemáte žádné kategorie.</p>
|
|
||||||
<a class="ap-btn ap-btn-primary" href="/admin/kategorie/edit">Vytvořit první kategorii</a>
|
|
||||||
</section>
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<section class="ap-panel ap-panel-table">
|
<section class="ao-panel">
|
||||||
<div class="ap-panel-head">
|
<div class="ao-panel-head">
|
||||||
|
<div>
|
||||||
<h2>Seznam kategorií</h2>
|
<h2>Seznam kategorií</h2>
|
||||||
<span class="ap-muted">@items.Count položek</span>
|
<p>@items.Count položek</p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="ap-table-wrap">
|
<div class="ao-list">
|
||||||
<table class="ap-table">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>Název</th>
|
|
||||||
<th>Slug</th>
|
|
||||||
<th>Produkty</th>
|
|
||||||
<th>Stav</th>
|
|
||||||
<th></th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
@foreach (var c in items)
|
@foreach (var c in items)
|
||||||
{
|
{
|
||||||
<tr>
|
<article class="ao-card" @key="c.Id">
|
||||||
<td class="ap-name">@c.Name</td>
|
<div class="ao-card-main" style="cursor:default">
|
||||||
<td class="ap-muted">@c.CategorySlug</td>
|
<div class="ao-card-left">
|
||||||
<td>@c.ProductCount</td>
|
<span class="ao-code">@c.Name</span>
|
||||||
<td>
|
<span class="ao-date">@c.Slug</span>
|
||||||
<span class="ap-status @(c.IsActive ? "is-on" : "is-off")">
|
</div>
|
||||||
|
<div class="ao-card-mid">
|
||||||
|
<span class="ao-pay">@c.ProductCount produktů</span>
|
||||||
|
</div>
|
||||||
|
<div class="ao-card-right">
|
||||||
|
<span class="ao-badge @(c.IsActive ? "is-paid" : "is-cancel")">
|
||||||
@(c.IsActive ? "Aktivní" : "Neaktivní")
|
@(c.IsActive ? "Aktivní" : "Neaktivní")
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</div>
|
||||||
<td class="ap-actions-cell">
|
</div>
|
||||||
|
<div class="sklad-row">
|
||||||
<a class="ap-btn ap-btn-ghost" href="@($"/admin/kategorie/edit/{c.Id}")">Upravit</a>
|
<a class="ap-btn ap-btn-ghost" href="@($"/admin/kategorie/edit/{c.Id}")">Upravit</a>
|
||||||
</td>
|
</div>
|
||||||
</tr>
|
</article>
|
||||||
}
|
}
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</AuthorizeView>
|
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
private List<Row>? items;
|
private List<Row>? items;
|
||||||
@@ -113,7 +101,7 @@
|
|||||||
private sealed record Row(
|
private sealed record Row(
|
||||||
int Id,
|
int Id,
|
||||||
string Name,
|
string Name,
|
||||||
string CategorySlug,
|
string Slug,
|
||||||
bool IsActive,
|
bool IsActive,
|
||||||
int ProductCount);
|
int ProductCount);
|
||||||
}
|
}
|
||||||
130
Web-Jarmark/Web-Jarmark/Components/Pages/Admin/Nastaveni.razor
Normal file
130
Web-Jarmark/Web-Jarmark/Components/Pages/Admin/Nastaveni.razor
Normal file
@@ -0,0 +1,130 @@
|
|||||||
|
@page "/admin/nastaveni"
|
||||||
|
@layout Web_Jarmark.Components.Layout.Admin.AdminLayout
|
||||||
|
@rendermode InteractiveServer
|
||||||
|
@using Microsoft.AspNetCore.Authorization
|
||||||
|
@using Microsoft.AspNetCore.Identity
|
||||||
|
@using Microsoft.EntityFrameworkCore
|
||||||
|
@using Microsoft.AspNetCore.Components.Authorization
|
||||||
|
@using Web_Jarmark.Data
|
||||||
|
@using Web_Jarmark.Data.Models
|
||||||
|
@inject ApplicationDbContext Db
|
||||||
|
@inject UserManager<ApplicationUser> UserManager
|
||||||
|
@inject AuthenticationStateProvider AuthState
|
||||||
|
|
||||||
|
@attribute [Authorize(Roles = "Admin")]
|
||||||
|
|
||||||
|
<PageTitle>Nastavení</PageTitle>
|
||||||
|
|
||||||
|
<div class="ap ao">
|
||||||
|
<header class="ao-hero">
|
||||||
|
<p class="ao-eyebrow">Administrace</p>
|
||||||
|
<h1>Nastavení</h1>
|
||||||
|
<p class="ao-sub">Účet, e-shop a rychlé odkazy.</p>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
@if (loading)
|
||||||
|
{
|
||||||
|
<div class="ao-loading">Načítám…</div>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<section class="ao-stats">
|
||||||
|
<article class="ao-stat">
|
||||||
|
<span>Uživatelé</span>
|
||||||
|
<strong>@userCount</strong>
|
||||||
|
<small>registrovaných</small>
|
||||||
|
</article>
|
||||||
|
<article class="ao-stat">
|
||||||
|
<span>Administrátoři</span>
|
||||||
|
<strong>@adminCount</strong>
|
||||||
|
<small>role Admin</small>
|
||||||
|
</article>
|
||||||
|
<article class="ao-stat">
|
||||||
|
<span>Produkty</span>
|
||||||
|
<strong>@productCount</strong>
|
||||||
|
<small>v katalogu</small>
|
||||||
|
</article>
|
||||||
|
<article class="ao-stat">
|
||||||
|
<span>Objednávky</span>
|
||||||
|
<strong>@orderCount</strong>
|
||||||
|
<small>celkem</small>
|
||||||
|
</article>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="ao-panel">
|
||||||
|
<div class="ao-panel-head">
|
||||||
|
<div>
|
||||||
|
<h2>Tvůj účet</h2>
|
||||||
|
<p>Přihlášený administrátor</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="ao-list">
|
||||||
|
<div class="ao-item">
|
||||||
|
<div><strong>E-mail</strong><span>přihlášení</span></div>
|
||||||
|
<strong>@currentEmail</strong>
|
||||||
|
</div>
|
||||||
|
<div class="ao-item">
|
||||||
|
<div><strong>Role</strong><span>oprávnění</span></div>
|
||||||
|
<strong>@currentRoles</strong>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="sklad-row">
|
||||||
|
<a class="ap-btn ap-btn-ghost" href="/Account/Manage">Správa účtu</a>
|
||||||
|
<a class="ap-btn ap-btn-ghost" href="/Account/Manage/ChangePassword">Změna hesla</a>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="ao-panel" style="margin-top:14px">
|
||||||
|
<div class="ao-panel-head">
|
||||||
|
<div>
|
||||||
|
<h2>Rychlé odkazy</h2>
|
||||||
|
<p>Administrace e-shopu</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="sklad-row">
|
||||||
|
<a class="ap-btn" href="/">E-shop</a>
|
||||||
|
<a class="ap-btn" href="/admin">Přehled</a>
|
||||||
|
<a class="ap-btn" href="/admin/administratori">Uživatelé</a>
|
||||||
|
<a class="ap-btn" href="/admin/sklad">Sklad</a>
|
||||||
|
<a class="ap-btn" href="/admin/objednavky">Objednávky</a>
|
||||||
|
<a class="ap-btn" href="/admin/statistiky">Statistiky</a>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
private bool loading = true;
|
||||||
|
private int userCount, adminCount, productCount, orderCount;
|
||||||
|
private string currentEmail = "—";
|
||||||
|
private string currentRoles = "—";
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
userCount = await UserManager.Users.CountAsync();
|
||||||
|
var admins = await UserManager.GetUsersInRoleAsync("Admin");
|
||||||
|
adminCount = admins.Count;
|
||||||
|
productCount = await Db.Products.CountAsync();
|
||||||
|
orderCount = await Db.Orders.CountAsync();
|
||||||
|
|
||||||
|
var state = await AuthState.GetAuthenticationStateAsync();
|
||||||
|
var user = state.User;
|
||||||
|
if (user.Identity?.IsAuthenticated == true)
|
||||||
|
{
|
||||||
|
currentEmail = user.Identity?.Name ?? "—";
|
||||||
|
var appUser = await UserManager.FindByEmailAsync(currentEmail);
|
||||||
|
if (appUser is not null)
|
||||||
|
{
|
||||||
|
var roles = await UserManager.GetRolesAsync(appUser);
|
||||||
|
currentRoles = roles.Count == 0 ? "bez role" : string.Join(", ", roles);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
loading = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
231
Web-Jarmark/Web-Jarmark/Components/Pages/Admin/Objednavky.razor
Normal file
231
Web-Jarmark/Web-Jarmark/Components/Pages/Admin/Objednavky.razor
Normal file
@@ -0,0 +1,231 @@
|
|||||||
|
@page "/admin/objednavky"
|
||||||
|
@layout Web_Jarmark.Components.Layout.Admin.AdminLayout
|
||||||
|
@rendermode InteractiveServer
|
||||||
|
@using Microsoft.EntityFrameworkCore
|
||||||
|
@using Microsoft.AspNetCore.Authorization
|
||||||
|
@using Web_Jarmark.Data
|
||||||
|
@using Web_Jarmark.Data.Models
|
||||||
|
@inject ApplicationDbContext Db
|
||||||
|
|
||||||
|
@attribute [Authorize(Roles = "Admin")]
|
||||||
|
|
||||||
|
<PageTitle>Objednávky</PageTitle>
|
||||||
|
|
||||||
|
<div class="ap ao">
|
||||||
|
<header class="ao-hero">
|
||||||
|
<p class="ao-eyebrow">Administrace</p>
|
||||||
|
<h1>Objednávky</h1>
|
||||||
|
<p class="ao-sub">Přehled všech objednávek a jejich aktuálního stavu.</p>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
@if (isLoading)
|
||||||
|
{
|
||||||
|
<div class="ao-loading">Načítám objednávky…</div>
|
||||||
|
}
|
||||||
|
else if (!string.IsNullOrEmpty(errorMessage))
|
||||||
|
{
|
||||||
|
<div class="ao-alert">@errorMessage</div>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<section class="ao-stats">
|
||||||
|
<article class="ao-stat" style="--i:0">
|
||||||
|
<span>Celkem</span>
|
||||||
|
<strong>@orders.Count</strong>
|
||||||
|
<small>objednávek</small>
|
||||||
|
</article>
|
||||||
|
<article class="ao-stat" style="--i:1">
|
||||||
|
<span>Čeká na zaplacení</span>
|
||||||
|
<strong>@orders.Count(o => o.Status == OrderStatus.Pending)</strong>
|
||||||
|
<small>k vyřízení</small>
|
||||||
|
</article>
|
||||||
|
<article class="ao-stat" style="--i:2">
|
||||||
|
<span>Zaplaceno</span>
|
||||||
|
<strong>@orders.Count(o => o.Status == OrderStatus.Paid)</strong>
|
||||||
|
<small>uhrazeno</small>
|
||||||
|
</article>
|
||||||
|
<article class="ao-stat" style="--i:3">
|
||||||
|
<span>Hodnota</span>
|
||||||
|
<strong>@orders.Sum(o => o.TotalAmount).ToString("N0")</strong>
|
||||||
|
<small>Kč celkem</small>
|
||||||
|
</article>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="ao-panel" style="--i:4">
|
||||||
|
<div class="ao-panel-head">
|
||||||
|
<div>
|
||||||
|
<h2>Seznam objednávek</h2>
|
||||||
|
<p>@FilteredOrders.Count zobrazených</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="ao-filters">
|
||||||
|
<input class="ao-input"
|
||||||
|
placeholder="Hledat podle kódu…"
|
||||||
|
@bind="searchText"
|
||||||
|
@bind:event="oninput" />
|
||||||
|
|
||||||
|
<select class="ao-select" @bind="statusFilter">
|
||||||
|
<option value="Vše">Všechny stavy</option>
|
||||||
|
<option value="Čeká na zaplacení">Čeká na zaplacení</option>
|
||||||
|
<option value="Zaplaceno">Zaplaceno</option>
|
||||||
|
<option value="Odesláno">Odesláno</option>
|
||||||
|
<option value="Dokončeno">Dokončeno</option>
|
||||||
|
<option value="Zrušeno">Zrušeno</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@if (FilteredOrders.Count == 0)
|
||||||
|
{
|
||||||
|
<div class="ao-empty">Žádné objednávky k zobrazení.</div>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<div class="ao-list">
|
||||||
|
@foreach (var order in FilteredOrders)
|
||||||
|
{
|
||||||
|
var open = selectedOrderId == order.Id;
|
||||||
|
|
||||||
|
<article class="ao-card @(open ? "is-open" : null)" @key="order.Id">
|
||||||
|
<button type="button" class="ao-card-main" @onclick="() => ToggleDetail(order.Id)">
|
||||||
|
<div class="ao-card-left">
|
||||||
|
<span class="ao-code">#@order.Code</span>
|
||||||
|
<span class="ao-date">@order.CreatedAt.ToLocalTime().ToString("d. M. yyyy HH:mm")</span>
|
||||||
|
</div>
|
||||||
|
<div class="ao-card-mid">
|
||||||
|
<span class="ao-pay">@GetPaymentText(order.PreferredPayment)</span>
|
||||||
|
<span class="ao-qty">@order.OrderItems.Sum(i => i.Quantity) ks</span>
|
||||||
|
</div>
|
||||||
|
<div class="ao-card-right">
|
||||||
|
<span class="ao-price">@order.TotalAmount.ToString("N0") Kč</span>
|
||||||
|
<span class="ao-badge @GetBadgeClass(order.Status)">@GetStatusText(order.Status)</span>
|
||||||
|
</div>
|
||||||
|
<span class="ao-chevron @(open ? "is-open" : null)">›</span>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
@if (open)
|
||||||
|
{
|
||||||
|
<div class="ao-detail">
|
||||||
|
<div class="ao-detail-grid">
|
||||||
|
<div>
|
||||||
|
<span>Zákazník</span>
|
||||||
|
<strong>@(string.IsNullOrWhiteSpace(order.CustomerName) ? "—" : order.CustomerName)</strong>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<span>E-mail</span>
|
||||||
|
<strong>@(string.IsNullOrWhiteSpace(order.Email) ? "—" : order.Email)</strong>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<span>Telefon</span>
|
||||||
|
<strong>@(string.IsNullOrWhiteSpace(order.Phone) ? "—" : order.Phone)</strong>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<span>Stav</span>
|
||||||
|
<strong>@GetStatusText(order.Status)</strong>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@if (!string.IsNullOrWhiteSpace(order.Note))
|
||||||
|
{
|
||||||
|
<p class="ao-note">@order.Note</p>
|
||||||
|
}
|
||||||
|
|
||||||
|
<div class="ao-items">
|
||||||
|
@foreach (var item in order.OrderItems)
|
||||||
|
{
|
||||||
|
<div class="ao-item">
|
||||||
|
<div>
|
||||||
|
<strong>@item.ProductName</strong>
|
||||||
|
<span>@item.Quantity ks × @item.UnitPrice.ToString("N0") Kč</span>
|
||||||
|
</div>
|
||||||
|
<strong>@((item.Quantity * item.UnitPrice).ToString("N0")) Kč</strong>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="ao-total">
|
||||||
|
<span>Celkem</span>
|
||||||
|
<strong>@order.TotalAmount.ToString("N0") Kč</strong>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</article>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</section>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
private List<Order> orders = new();
|
||||||
|
private bool isLoading = true;
|
||||||
|
private string? errorMessage;
|
||||||
|
private string searchText = "";
|
||||||
|
private string statusFilter = "Vše";
|
||||||
|
private int? selectedOrderId;
|
||||||
|
|
||||||
|
private List<Order> FilteredOrders =>
|
||||||
|
orders
|
||||||
|
.Where(o =>
|
||||||
|
string.IsNullOrWhiteSpace(searchText) ||
|
||||||
|
o.Code.Contains(searchText.Trim(), StringComparison.OrdinalIgnoreCase))
|
||||||
|
.Where(o =>
|
||||||
|
statusFilter == "Vše" ||
|
||||||
|
GetStatusText(o.Status) == statusFilter)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
orders = await Db.Orders
|
||||||
|
.AsNoTracking()
|
||||||
|
.Include(o => o.OrderItems)
|
||||||
|
.OrderByDescending(o => o.CreatedAt)
|
||||||
|
.ToListAsync();
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
errorMessage = "Objednávky se nepodařilo načíst.";
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
isLoading = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ToggleDetail(int orderId)
|
||||||
|
{
|
||||||
|
selectedOrderId = selectedOrderId == orderId ? null : orderId;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string GetStatusText(OrderStatus status) => status switch
|
||||||
|
{
|
||||||
|
OrderStatus.Pending => "Čeká na zaplacení",
|
||||||
|
OrderStatus.Paid => "Zaplaceno",
|
||||||
|
OrderStatus.Shipped => "Odesláno",
|
||||||
|
OrderStatus.Delivered => "Dokončeno",
|
||||||
|
OrderStatus.Cancelled => "Zrušeno",
|
||||||
|
_ => "Neznámý stav"
|
||||||
|
};
|
||||||
|
|
||||||
|
private static string GetBadgeClass(OrderStatus status) => status switch
|
||||||
|
{
|
||||||
|
OrderStatus.Pending => "is-pending",
|
||||||
|
OrderStatus.Paid => "is-paid",
|
||||||
|
OrderStatus.Shipped => "is-shipped",
|
||||||
|
OrderStatus.Delivered => "is-done",
|
||||||
|
OrderStatus.Cancelled => "is-cancel",
|
||||||
|
_ => ""
|
||||||
|
};
|
||||||
|
|
||||||
|
private static string GetPaymentText(PaymentMethod method) => method switch
|
||||||
|
{
|
||||||
|
PaymentMethod.BankTransfer => "Bankovní převod",
|
||||||
|
PaymentMethod.Cash => "Hotově",
|
||||||
|
PaymentMethod.CreditCard => "Karta",
|
||||||
|
PaymentMethod.PayPal => "PayPal",
|
||||||
|
_ => "—"
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,426 @@
|
|||||||
|
/* Apple-like objednávky */
|
||||||
|
|
||||||
|
.ao {
|
||||||
|
max-width: 980px;
|
||||||
|
margin: 0 auto;
|
||||||
|
color: #1d1d1f;
|
||||||
|
font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ao-hero {
|
||||||
|
text-align: center;
|
||||||
|
padding: 18px 8px 28px;
|
||||||
|
animation: ao-in 0.45s ease both;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ao-eyebrow {
|
||||||
|
margin: 0 0 8px;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: 0.08em;
|
||||||
|
text-transform: uppercase;
|
||||||
|
color: #6e6e73;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ao-hero h1 {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 36px;
|
||||||
|
font-weight: 700;
|
||||||
|
letter-spacing: -0.03em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ao-sub {
|
||||||
|
margin: 10px auto 0;
|
||||||
|
max-width: 420px;
|
||||||
|
color: #6e6e73;
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ao-loading,
|
||||||
|
.ao-empty,
|
||||||
|
.ao-alert {
|
||||||
|
padding: 20px;
|
||||||
|
border-radius: 20px;
|
||||||
|
background: #fff;
|
||||||
|
border: 1px solid rgba(0, 0, 0, 0.05);
|
||||||
|
color: #6e6e73;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ao-alert {
|
||||||
|
color: #1d1d1f;
|
||||||
|
margin-bottom: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Stats */
|
||||||
|
.ao-stats {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||||
|
gap: 12px;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ao-stat {
|
||||||
|
background: rgba(255, 255, 255, 0.9);
|
||||||
|
border: 1px solid rgba(0, 0, 0, 0.04);
|
||||||
|
border-radius: 22px;
|
||||||
|
padding: 18px 16px;
|
||||||
|
box-shadow: 0 10px 28px rgba(0, 0, 0, 0.04);
|
||||||
|
animation: ao-rise 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
|
||||||
|
animation-delay: calc(var(--i, 0) * 0.06s);
|
||||||
|
transition: transform 0.25s ease, box-shadow 0.25s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ao-stat:hover {
|
||||||
|
transform: translateY(-3px);
|
||||||
|
box-shadow: 0 14px 34px rgba(0, 0, 0, 0.07);
|
||||||
|
}
|
||||||
|
|
||||||
|
.ao-stat span {
|
||||||
|
display: block;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #6e6e73;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ao-stat strong {
|
||||||
|
display: block;
|
||||||
|
margin-top: 8px;
|
||||||
|
font-size: 28px;
|
||||||
|
font-weight: 750;
|
||||||
|
letter-spacing: -0.03em;
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ao-stat small {
|
||||||
|
display: block;
|
||||||
|
margin-top: 8px;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #86868b;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Panel */
|
||||||
|
.ao-panel {
|
||||||
|
background: rgba(255, 255, 255, 0.92);
|
||||||
|
border: 1px solid rgba(0, 0, 0, 0.045);
|
||||||
|
border-radius: 26px;
|
||||||
|
padding: 18px 18px 12px;
|
||||||
|
box-shadow: 0 12px 36px rgba(0, 0, 0, 0.04);
|
||||||
|
animation: ao-rise 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
|
||||||
|
animation-delay: calc(var(--i, 0) * 0.06s);
|
||||||
|
}
|
||||||
|
|
||||||
|
.ao-panel-head {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: flex-start;
|
||||||
|
padding: 4px 6px 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ao-panel-head h2 {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: 700;
|
||||||
|
letter-spacing: -0.02em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ao-panel-head p {
|
||||||
|
margin: 4px 0 0;
|
||||||
|
color: #6e6e73;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ao-filters {
|
||||||
|
display: flex;
|
||||||
|
gap: 10px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
padding: 0 6px 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ao-input,
|
||||||
|
.ao-select {
|
||||||
|
border: 1px solid #d2d2d7;
|
||||||
|
border-radius: 14px;
|
||||||
|
padding: 12px 14px;
|
||||||
|
font-size: 14px;
|
||||||
|
background: #fff;
|
||||||
|
color: #1d1d1f;
|
||||||
|
outline: none;
|
||||||
|
transition: border-color 0.2s ease, box-shadow 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ao-input {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 180px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ao-select {
|
||||||
|
min-width: 190px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ao-input:focus,
|
||||||
|
.ao-select:focus {
|
||||||
|
border-color: #1d1d1f;
|
||||||
|
box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.06);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Cards list */
|
||||||
|
.ao-list {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ao-card {
|
||||||
|
border: 1px solid rgba(0, 0, 0, 0.05);
|
||||||
|
border-radius: 20px;
|
||||||
|
background: #fafafa;
|
||||||
|
overflow: hidden;
|
||||||
|
transition: background 0.2s ease, box-shadow 0.25s ease, transform 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ao-card:hover {
|
||||||
|
background: #f5f5f7;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ao-card.is-open {
|
||||||
|
background: #fff;
|
||||||
|
box-shadow: 0 12px 30px rgba(0, 0, 0, 0.06);
|
||||||
|
}
|
||||||
|
|
||||||
|
.ao-card-main {
|
||||||
|
width: 100%;
|
||||||
|
border: 0;
|
||||||
|
background: transparent;
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1.2fr 1fr 1fr auto;
|
||||||
|
gap: 12px;
|
||||||
|
align-items: center;
|
||||||
|
padding: 16px 16px;
|
||||||
|
text-align: left;
|
||||||
|
cursor: pointer;
|
||||||
|
color: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ao-card-left,
|
||||||
|
.ao-card-mid,
|
||||||
|
.ao-card-right {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 4px;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ao-card-right {
|
||||||
|
align-items: flex-end;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ao-code {
|
||||||
|
font-weight: 750;
|
||||||
|
font-size: 15px;
|
||||||
|
letter-spacing: -0.02em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ao-date,
|
||||||
|
.ao-pay,
|
||||||
|
.ao-qty {
|
||||||
|
font-size: 12px;
|
||||||
|
color: #6e6e73;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ao-price {
|
||||||
|
font-weight: 750;
|
||||||
|
font-size: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ao-badge {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 4px 10px;
|
||||||
|
border-radius: 999px;
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: 700;
|
||||||
|
background: #f0f0f2;
|
||||||
|
color: #6e6e73;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ao-badge.is-pending {
|
||||||
|
background: #f0f0f2;
|
||||||
|
color: #1d1d1f;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ao-badge.is-paid {
|
||||||
|
background: #1d1d1f;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ao-badge.is-shipped {
|
||||||
|
background: #3a3a3c;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ao-badge.is-done {
|
||||||
|
background: #1d1d1f;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ao-badge.is-cancel {
|
||||||
|
background: #e8e8ed;
|
||||||
|
color: #6e6e73;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ao-chevron {
|
||||||
|
font-size: 22px;
|
||||||
|
color: #aeaeb2;
|
||||||
|
transform: rotate(0deg);
|
||||||
|
transition: transform 0.25s ease;
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ao-chevron.is-open {
|
||||||
|
transform: rotate(90deg);
|
||||||
|
color: #1d1d1f;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Detail */
|
||||||
|
.ao-detail {
|
||||||
|
padding: 0 16px 16px;
|
||||||
|
animation: ao-detail 0.28s ease both;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ao-detail-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||||
|
gap: 10px;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ao-detail-grid span {
|
||||||
|
display: block;
|
||||||
|
font-size: 11px;
|
||||||
|
color: #6e6e73;
|
||||||
|
margin-bottom: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ao-detail-grid strong {
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 650;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ao-note {
|
||||||
|
margin: 0 0 12px;
|
||||||
|
padding: 12px 14px;
|
||||||
|
border-radius: 14px;
|
||||||
|
background: #f5f5f7;
|
||||||
|
color: #6e6e73;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ao-items {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ao-item {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 12px;
|
||||||
|
padding: 12px 14px;
|
||||||
|
border-radius: 14px;
|
||||||
|
background: #f5f5f7;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ao-item span {
|
||||||
|
display: block;
|
||||||
|
margin-top: 2px;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #6e6e73;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ao-total {
|
||||||
|
margin-top: 12px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
padding: 4px 4px 0;
|
||||||
|
font-size: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ao-total strong {
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: 750;
|
||||||
|
letter-spacing: -0.02em;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes ao-in {
|
||||||
|
from {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateY(8px);
|
||||||
|
}
|
||||||
|
|
||||||
|
to {
|
||||||
|
opacity: 1;
|
||||||
|
transform: translateY(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes ao-rise {
|
||||||
|
from {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateY(14px);
|
||||||
|
}
|
||||||
|
|
||||||
|
to {
|
||||||
|
opacity: 1;
|
||||||
|
transform: translateY(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes ao-detail {
|
||||||
|
from {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateY(-6px);
|
||||||
|
}
|
||||||
|
|
||||||
|
to {
|
||||||
|
opacity: 1;
|
||||||
|
transform: translateY(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 900px) {
|
||||||
|
.ao-stats {
|
||||||
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||||
|
}
|
||||||
|
|
||||||
|
.ao-card-main {
|
||||||
|
grid-template-columns: 1fr auto;
|
||||||
|
grid-template-areas:
|
||||||
|
"left chev"
|
||||||
|
"mid chev"
|
||||||
|
"right chev";
|
||||||
|
}
|
||||||
|
|
||||||
|
.ao-card-left {
|
||||||
|
grid-area: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ao-card-mid {
|
||||||
|
grid-area: mid;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ao-card-right {
|
||||||
|
grid-area: right;
|
||||||
|
align-items: flex-start;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ao-chevron {
|
||||||
|
grid-area: chev;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ao-detail-grid {
|
||||||
|
grid-template-columns: 1fr 1fr;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,52 +1,55 @@
|
|||||||
@page "/admin/zbozi/edit"
|
```razor
|
||||||
|
@page "/admin/zbozi/edit"
|
||||||
@page "/admin/zbozi/edit/{Id:int}"
|
@page "/admin/zbozi/edit/{Id:int}"
|
||||||
@layout Web_Jarmark.Components.Layout.Admin.AdminLayout
|
@layout Web_Jarmark.Components.Layout.Admin.AdminLayout
|
||||||
@rendermode InteractiveServer
|
@rendermode InteractiveServer
|
||||||
|
|
||||||
@using Microsoft.EntityFrameworkCore
|
@using Microsoft.EntityFrameworkCore
|
||||||
@using Microsoft.AspNetCore.Authorization
|
@using Microsoft.AspNetCore.Authorization
|
||||||
@using Web_Jarmark.Data
|
@using Web_Jarmark.Data
|
||||||
@using Web_Jarmark.Data.Models
|
@using Web_Jarmark.Data.Models
|
||||||
|
|
||||||
@inject ApplicationDbContext Db
|
@inject ApplicationDbContext Db
|
||||||
@inject NavigationManager Nav
|
@inject NavigationManager Nav
|
||||||
|
|
||||||
@attribute [Authorize]
|
@attribute [Authorize(Roles = "Admin")]
|
||||||
|
|
||||||
<PageTitle>@(IsNew ? "Nové zboží" : "Upravit zboží")</PageTitle>
|
<PageTitle>@(IsNew ? "Nové zboží" : "Upravit zboží")</PageTitle>
|
||||||
|
|
||||||
<div class="ap">
|
<div class="ap ao">
|
||||||
<header class="ap-hero ap-hero-left">
|
<header class="ao-hero">
|
||||||
<p class="ap-eyebrow">Zboží</p>
|
<p class="ao-eyebrow">Zboží</p>
|
||||||
<h1>@(IsNew ? "Nové zboží" : "Upravit zboží")</h1>
|
<h1>@(IsNew ? "Nové zboží" : "Upravit zboží")</h1>
|
||||||
<p class="ap-sub">Údaje produktu v katalogu.</p>
|
<p class="ao-sub">Údaje produktu v katalogu.</p>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
@if (!string.IsNullOrEmpty(error))
|
@if (!string.IsNullOrEmpty(error))
|
||||||
{
|
{
|
||||||
<div class="ap-alert">@error</div>
|
<div class="ao-alert">@error</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
@if (notFound)
|
@if (notFound)
|
||||||
{
|
{
|
||||||
<section class="ap-panel">
|
<div class="ao-empty">Produkt nebyl nalezen.</div>
|
||||||
<p class="ap-empty">Produkt nebyl nalezen.</p>
|
<div style="text-align:center;margin-top:12px">
|
||||||
<a class="ap-btn" href="/admin/zbozi">Zpět na seznam</a>
|
<a class="ap-btn" href="/admin/zbozi">Zpět</a>
|
||||||
</section>
|
</div>
|
||||||
}
|
}
|
||||||
else if (loading)
|
else if (loading)
|
||||||
{
|
{
|
||||||
<div class="ap-loading">Načítám…</div>
|
<div class="ao-loading">Načítám…</div>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<section class="ap-panel ap-form-panel">
|
<section class="ao-panel" style="max-width:560px;margin:0 auto">
|
||||||
<div class="ap-field">
|
<div class="ap-field">
|
||||||
<label>Název</label>
|
<label>Název</label>
|
||||||
<input class="ap-input" @bind="name" />
|
<input class="ao-input" maxlength="150" @bind="name" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="ap-field">
|
<div class="ap-field">
|
||||||
<label>Kategorie</label>
|
<label>Kategorie</label>
|
||||||
<select class="ap-select" @bind="categoryId">
|
<select class="ao-select" style="width:100%" @bind="categoryId">
|
||||||
<option value="0">— vyberte —</option>
|
<option value="0">— vyberte —</option>
|
||||||
@foreach (var c in categories)
|
@foreach (var c in categories)
|
||||||
{
|
{
|
||||||
@@ -57,22 +60,35 @@
|
|||||||
|
|
||||||
<div class="ap-field">
|
<div class="ap-field">
|
||||||
<label>Popis</label>
|
<label>Popis</label>
|
||||||
<textarea class="ap-textarea" @bind="description"></textarea>
|
<textarea class="ao-input"
|
||||||
|
maxlength="5000"
|
||||||
|
style="min-height:110px;resize:vertical"
|
||||||
|
@bind="description"></textarea>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="ap-field">
|
<div class="ap-field">
|
||||||
<label>Cena (Kč)</label>
|
<label>Cena (Kč)</label>
|
||||||
<input type="number" step="0.01" class="ap-input" @bind="price" />
|
<input type="number"
|
||||||
|
min="0"
|
||||||
|
step="0.01"
|
||||||
|
class="ao-input"
|
||||||
|
@bind="price" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="ap-field">
|
<div class="ap-field">
|
||||||
<label>Sklad (ks)</label>
|
<label>Sklad (ks)</label>
|
||||||
<input type="number" class="ap-input" @bind="stockQuantity" />
|
<input type="number"
|
||||||
|
min="0"
|
||||||
|
step="1"
|
||||||
|
class="ao-input"
|
||||||
|
@bind="stockQuantity" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="ap-field">
|
<div class="ap-field">
|
||||||
<label>URL obrázku</label>
|
<label>URL obrázku</label>
|
||||||
<input class="ap-input" @bind="imageUrl" />
|
<input class="ao-input"
|
||||||
|
maxlength="2048"
|
||||||
|
@bind="imageUrl" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<label class="ap-switch">
|
<label class="ap-switch">
|
||||||
@@ -81,9 +97,13 @@
|
|||||||
</label>
|
</label>
|
||||||
|
|
||||||
<div class="ap-form-actions">
|
<div class="ap-form-actions">
|
||||||
<button type="button" class="ap-btn ap-btn-primary" disabled="@saving" @onclick="SaveAsync">
|
<button type="button"
|
||||||
|
class="ap-btn ap-btn-primary"
|
||||||
|
disabled="@saving"
|
||||||
|
@onclick="SaveAsync">
|
||||||
@(saving ? "Ukládám…" : "Uložit")
|
@(saving ? "Ukládám…" : "Uložit")
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<a class="ap-btn" href="/admin/zbozi">Zrušit</a>
|
<a class="ap-btn" href="/admin/zbozi">Zrušit</a>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
@@ -136,7 +156,10 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var entity = await Db.Products.AsNoTracking().FirstOrDefaultAsync(p => p.Id == Id!.Value);
|
var entity = await Db.Products
|
||||||
|
.AsNoTracking()
|
||||||
|
.FirstOrDefaultAsync(p => p.Id == Id!.Value);
|
||||||
|
|
||||||
if (entity is null)
|
if (entity is null)
|
||||||
{
|
{
|
||||||
notFound = true;
|
notFound = true;
|
||||||
@@ -151,29 +174,75 @@
|
|||||||
stockQuantity = entity.StockQuantity;
|
stockQuantity = entity.StockQuantity;
|
||||||
imageUrl = entity.ImageUrl ?? "";
|
imageUrl = entity.ImageUrl ?? "";
|
||||||
isVisible = entity.IsVisible;
|
isVisible = entity.IsVisible;
|
||||||
|
|
||||||
loading = false;
|
loading = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task SaveAsync()
|
private async Task SaveAsync()
|
||||||
{
|
{
|
||||||
|
if (saving)
|
||||||
|
return;
|
||||||
|
|
||||||
saving = true;
|
saving = true;
|
||||||
error = null;
|
error = null;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
name = name?.Trim() ?? "";
|
||||||
|
description = description?.Trim() ?? "";
|
||||||
|
imageUrl = imageUrl?.Trim() ?? "";
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(name))
|
if (string.IsNullOrWhiteSpace(name))
|
||||||
{
|
{
|
||||||
error = "Zadejte název produktu.";
|
error = "Zadejte název produktu.";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (categoryId <= 0)
|
if (name.Length > 150)
|
||||||
{
|
{
|
||||||
error = "Vyberte kategorii.";
|
error = "Název může mít maximálně 150 znaků.";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (description.Length > 5000)
|
||||||
|
{
|
||||||
|
error = "Popis může mít maximálně 5000 znaků.";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (price < 0 || price > 100000000)
|
||||||
|
{
|
||||||
|
error = "Cena musí být mezi 0 a 100 000 000 Kč.";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (decimal.Round(price, 2) != price)
|
||||||
|
{
|
||||||
|
error = "Cena může mít maximálně dvě desetinná místa.";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stockQuantity < 0)
|
||||||
|
{
|
||||||
|
error = "Počet kusů na skladě nemůže být záporný.";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (categoryId <= 0 ||
|
||||||
|
!await Db.Categories.AnyAsync(c => c.Id == categoryId))
|
||||||
|
{
|
||||||
|
error = "Vyberte platnou kategorii.";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!IsValidImageUrl(imageUrl))
|
||||||
|
{
|
||||||
|
error = "Obrázek musí mít platnou HTTPS adresu nebo bezpečnou relativní cestu.";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Product entity;
|
Product entity;
|
||||||
|
|
||||||
if (IsNew)
|
if (IsNew)
|
||||||
{
|
{
|
||||||
entity = new Product();
|
entity = new Product();
|
||||||
@@ -181,24 +250,37 @@
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
entity = await Db.Products.FirstAsync(p => p.Id == Id!.Value);
|
entity = await Db.Products
|
||||||
|
.FirstOrDefaultAsync(p => p.Id == Id!.Value);
|
||||||
|
|
||||||
|
if (entity is null)
|
||||||
|
{
|
||||||
|
notFound = true;
|
||||||
|
error = "Produkt již neexistuje.";
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
entity.Name = name.Trim();
|
entity.Name = name;
|
||||||
entity.Description = description?.Trim() ?? "";
|
entity.Description = description;
|
||||||
entity.CategoryId = categoryId;
|
entity.CategoryId = categoryId;
|
||||||
entity.Price = price;
|
entity.Price = price;
|
||||||
entity.StockQuantity = stockQuantity;
|
entity.StockQuantity = stockQuantity;
|
||||||
entity.ImageUrl = imageUrl?.Trim() ?? "";
|
entity.ImageUrl = imageUrl;
|
||||||
entity.IsVisible = isVisible;
|
entity.IsVisible = isVisible;
|
||||||
entity.UpdatedAt = DateTime.UtcNow;
|
entity.UpdatedAt = DateTime.UtcNow;
|
||||||
|
|
||||||
await Db.SaveChangesAsync();
|
await Db.SaveChangesAsync();
|
||||||
|
|
||||||
Nav.NavigateTo("/admin/zbozi");
|
Nav.NavigateTo("/admin/zbozi");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (DbUpdateException)
|
||||||
{
|
{
|
||||||
error = "Uložení se nezdařilo: " + ex.Message;
|
error = "Produkt se nepodařilo uložit. Zkontrolujte zadané údaje.";
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
error = "Při ukládání nastala neočekávaná chyba.";
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
@@ -206,5 +288,30 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static bool IsValidImageUrl(string value)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(value))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (value.Length > 2048)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (value.StartsWith("//") ||
|
||||||
|
value.Contains('\\') ||
|
||||||
|
value.Any(char.IsControl))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (Uri.TryCreate(value, UriKind.Absolute, out var uri))
|
||||||
|
{
|
||||||
|
return uri.Scheme == Uri.UriSchemeHttps &&
|
||||||
|
!string.IsNullOrWhiteSpace(uri.Host);
|
||||||
|
}
|
||||||
|
|
||||||
|
return value.StartsWith('/') &&
|
||||||
|
!value.StartsWith("//") &&
|
||||||
|
!value.Contains("..");
|
||||||
|
}
|
||||||
|
|
||||||
private sealed record CatOption(int Id, string Name);
|
private sealed record CatOption(int Id, string Name);
|
||||||
}
|
}
|
||||||
|
```
|
||||||
@@ -7,91 +7,75 @@
|
|||||||
@using Web_Jarmark.Data.Models
|
@using Web_Jarmark.Data.Models
|
||||||
@inject ApplicationDbContext Db
|
@inject ApplicationDbContext Db
|
||||||
|
|
||||||
@attribute [Authorize]
|
@attribute [Authorize(Roles = "Admin")]
|
||||||
|
|
||||||
<AuthorizeView>
|
<PageTitle>Zboží</PageTitle>
|
||||||
<PageTitle>Zboží</PageTitle>
|
|
||||||
|
|
||||||
<div class="ap">
|
<div class="ap ao">
|
||||||
<header class="ap-hero ap-hero-left">
|
<header class="ao-hero">
|
||||||
<p class="ap-eyebrow">Administrace</p>
|
<p class="ao-eyebrow">Administrace</p>
|
||||||
<div class="ap-hero-row">
|
|
||||||
<div>
|
|
||||||
<h1>Zboží</h1>
|
<h1>Zboží</h1>
|
||||||
<p class="ap-sub">Přehled a správa produktů.</p>
|
<p class="ao-sub">Přehled a správa produktů.</p>
|
||||||
</div>
|
<div style="margin-top:16px">
|
||||||
<a class="ap-btn ap-btn-primary" href="/admin/zbozi/edit">Nové zboží</a>
|
<a class="ap-btn ap-btn-primary" href="/admin/zbozi/edit">Nové zboží</a>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<div class="ap-toolbar">
|
|
||||||
<input class="ap-input"
|
|
||||||
placeholder="Hledat produkt…"
|
|
||||||
@bind="search"
|
|
||||||
@bind:event="oninput" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
@if (!string.IsNullOrEmpty(error))
|
@if (!string.IsNullOrEmpty(error))
|
||||||
{
|
{
|
||||||
<div class="ap-alert">@error</div>
|
<div class="ao-alert">@error</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<div class="ao-filters">
|
||||||
|
<input class="ao-input" placeholder="Hledat produkt…" @bind="search" @bind:event="oninput" />
|
||||||
|
</div>
|
||||||
|
|
||||||
@if (items is null)
|
@if (items is null)
|
||||||
{
|
{
|
||||||
<div class="ap-loading">Načítám zboží…</div>
|
<div class="ao-loading">Načítám zboží…</div>
|
||||||
}
|
}
|
||||||
else if (Filtered.Count == 0)
|
else if (Filtered.Count == 0)
|
||||||
{
|
{
|
||||||
<section class="ap-panel">
|
<div class="ao-empty">Žádné produkty.</div>
|
||||||
<p class="ap-empty">Žádné produkty k zobrazení.</p>
|
|
||||||
<a class="ap-btn ap-btn-primary" href="/admin/zbozi/edit">Přidat produkt</a>
|
|
||||||
</section>
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<section class="ap-panel ap-panel-table">
|
<section class="ao-panel">
|
||||||
<div class="ap-panel-head">
|
<div class="ao-panel-head">
|
||||||
|
<div>
|
||||||
<h2>Katalog</h2>
|
<h2>Katalog</h2>
|
||||||
<span class="ap-muted">@Filtered.Count položek</span>
|
<p>@Filtered.Count položek</p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="ap-table-wrap">
|
<div class="ao-list">
|
||||||
<table class="ap-table">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>Produkt</th>
|
|
||||||
<th>Kategorie</th>
|
|
||||||
<th>Cena</th>
|
|
||||||
<th>Sklad</th>
|
|
||||||
<th>Stav</th>
|
|
||||||
<th></th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
@foreach (var p in Filtered)
|
@foreach (var p in Filtered)
|
||||||
{
|
{
|
||||||
<tr>
|
<article class="ao-card" @key="p.Id">
|
||||||
<td class="ap-name">@p.Name</td>
|
<div class="ao-card-main" style="cursor:default">
|
||||||
<td>@p.CategoryName</td>
|
<div class="ao-card-left">
|
||||||
<td>@p.Price.ToString("N0") Kč</td>
|
<span class="ao-code">@p.Name</span>
|
||||||
<td>@p.StockQuantity</td>
|
<span class="ao-date">@p.CategoryName</span>
|
||||||
<td>
|
</div>
|
||||||
<span class="ap-status @(p.IsVisible ? "is-on" : "is-off")">
|
<div class="ao-card-mid">
|
||||||
|
<span class="ao-pay">@p.Price.ToString("N0") Kč</span>
|
||||||
|
<span class="ao-qty">@p.StockQuantity ks</span>
|
||||||
|
</div>
|
||||||
|
<div class="ao-card-right">
|
||||||
|
<span class="ao-badge @(p.IsVisible ? "is-paid" : "is-cancel")">
|
||||||
@(p.IsVisible ? "Viditelné" : "Skryté")
|
@(p.IsVisible ? "Viditelné" : "Skryté")
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</div>
|
||||||
<td class="ap-actions-cell">
|
</div>
|
||||||
|
<div class="sklad-row">
|
||||||
<a class="ap-btn ap-btn-ghost" href="@($"/admin/zbozi/edit/{p.Id}")">Upravit</a>
|
<a class="ap-btn ap-btn-ghost" href="@($"/admin/zbozi/edit/{p.Id}")">Upravit</a>
|
||||||
</td>
|
</div>
|
||||||
</tr>
|
</article>
|
||||||
}
|
}
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</AuthorizeView>
|
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
private List<Row>? items;
|
private List<Row>? items;
|
||||||
@@ -102,16 +86,8 @@
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (items is null)
|
if (items is null) return new();
|
||||||
{
|
if (string.IsNullOrWhiteSpace(search)) return items;
|
||||||
return new List<Row>();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(search))
|
|
||||||
{
|
|
||||||
return items;
|
|
||||||
}
|
|
||||||
|
|
||||||
return items.Where(p =>
|
return items.Where(p =>
|
||||||
p.Name.Contains(search, StringComparison.OrdinalIgnoreCase) ||
|
p.Name.Contains(search, StringComparison.OrdinalIgnoreCase) ||
|
||||||
p.CategoryName.Contains(search, StringComparison.OrdinalIgnoreCase)).ToList();
|
p.CategoryName.Contains(search, StringComparison.OrdinalIgnoreCase)).ToList();
|
||||||
|
|||||||
419
Web-Jarmark/Web-Jarmark/Components/Pages/Admin/Sklad.razor
Normal file
419
Web-Jarmark/Web-Jarmark/Components/Pages/Admin/Sklad.razor
Normal file
@@ -0,0 +1,419 @@
|
|||||||
|
@page "/admin/sklad"
|
||||||
|
@layout Web_Jarmark.Components.Layout.Admin.AdminLayout
|
||||||
|
@rendermode InteractiveServer
|
||||||
|
@using Microsoft.EntityFrameworkCore
|
||||||
|
@using Microsoft.AspNetCore.Authorization
|
||||||
|
@using Web_Jarmark.Data
|
||||||
|
@using Web_Jarmark.Data.Models
|
||||||
|
@inject ApplicationDbContext Db
|
||||||
|
|
||||||
|
@attribute [Authorize(Roles = "Admin")]
|
||||||
|
|
||||||
|
<PageTitle>Sklad</PageTitle>
|
||||||
|
|
||||||
|
<div class="ap ao">
|
||||||
|
<header class="ao-hero">
|
||||||
|
<p class="ao-eyebrow">Administrace</p>
|
||||||
|
<h1>Sklad</h1>
|
||||||
|
<p class="ao-sub">Sledování zásob, rychlé úpravy a upozornění na nízký stav.</p>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
@if (!string.IsNullOrEmpty(message))
|
||||||
|
{
|
||||||
|
<div class="ao-alert">@message</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
@if (loading)
|
||||||
|
{
|
||||||
|
<div class="ao-loading">Načítám sklad…</div>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<section class="ao-stats">
|
||||||
|
<article class="ao-stat" style="--i:0">
|
||||||
|
<span>Produktů</span>
|
||||||
|
<strong>@items.Count</strong>
|
||||||
|
<small>ve skladu</small>
|
||||||
|
</article>
|
||||||
|
<article class="ao-stat" style="--i:1">
|
||||||
|
<span>Nízký sklad</span>
|
||||||
|
<strong>@items.Count(i => i.StockQuantity > 0 && i.StockQuantity <= LowThreshold)</strong>
|
||||||
|
<small>≤ @LowThreshold ks</small>
|
||||||
|
</article>
|
||||||
|
<article class="ao-stat" style="--i:2">
|
||||||
|
<span>Vyprodané</span>
|
||||||
|
<strong>@items.Count(i => i.StockQuantity <= 0)</strong>
|
||||||
|
<small>0 ks</small>
|
||||||
|
</article>
|
||||||
|
<article class="ao-stat" style="--i:3">
|
||||||
|
<span>Hodnota skladu</span>
|
||||||
|
<strong>@items.Sum(i => i.Price * i.StockQuantity).ToString("N0")</strong>
|
||||||
|
<small>@items.Sum(i => i.StockQuantity) ks celkem</small>
|
||||||
|
</article>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<div class="ao-filters">
|
||||||
|
<input class="ao-input" placeholder="Hledat produkt nebo kategorii…"
|
||||||
|
@bind="search" @bind:event="oninput" />
|
||||||
|
|
||||||
|
<select class="ao-select" @bind="stockFilter">
|
||||||
|
<option value="all">Stav: vše</option>
|
||||||
|
<option value="ok">V pořádku (>@LowThreshold)</option>
|
||||||
|
<option value="low">Nízký (1–@LowThreshold)</option>
|
||||||
|
<option value="out">Vyprodané (0)</option>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select class="ao-select" @bind="categoryFilter">
|
||||||
|
<option value="all">Kategorie: vše</option>
|
||||||
|
@foreach (var c in categoryNames)
|
||||||
|
{
|
||||||
|
<option value="@c">@c</option>
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select class="ao-select" @bind="sortBy">
|
||||||
|
<option value="stock_asc">Řadit: nejméně kusů</option>
|
||||||
|
<option value="stock_desc">Řadit: nejvíce kusů</option>
|
||||||
|
<option value="name">Řadit: název</option>
|
||||||
|
<option value="value">Řadit: hodnota</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="sklad-row" style="padding-left:0;padding-right:0">
|
||||||
|
<button type="button" class="ap-btn ap-btn-ghost" disabled="@busy" @onclick="ReloadAsync">Obnovit</button>
|
||||||
|
<button type="button" class="ap-btn ap-btn-ghost" disabled="@busy || !HasPending" @onclick="SaveAllAsync">
|
||||||
|
Uložit všechny změny @(HasPending ? $"({PendingCount})" : "")
|
||||||
|
</button>
|
||||||
|
<button type="button" class="ap-btn ap-btn-ghost" disabled="@busy" @onclick="() => QuickFilterOut()">
|
||||||
|
Jen vyprodané
|
||||||
|
</button>
|
||||||
|
<button type="button" class="ap-btn ap-btn-ghost" disabled="@busy" @onclick="() => QuickFilterLow()">
|
||||||
|
Jen nízký sklad
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<section class="ao-panel">
|
||||||
|
<div class="ao-panel-head">
|
||||||
|
<div>
|
||||||
|
<h2>Zásoby</h2>
|
||||||
|
<p>@Filtered.Count položek</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@if (Filtered.Count == 0)
|
||||||
|
{
|
||||||
|
<div class="ao-empty">Nic nenalezeno.</div>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<div class="ao-list">
|
||||||
|
@foreach (var p in Filtered)
|
||||||
|
{
|
||||||
|
var qty = GetEditQty(p.Id);
|
||||||
|
var dirty = IsDirty(p.Id, p.StockQuantity);
|
||||||
|
|
||||||
|
<article class="ao-card @(dirty ? "is-open" : null)" @key="p.Id">
|
||||||
|
<div class="ao-card-main" style="cursor:default">
|
||||||
|
<div class="ao-card-left">
|
||||||
|
<span class="ao-code">@p.Name</span>
|
||||||
|
<span class="ao-date">@p.CategoryName</span>
|
||||||
|
</div>
|
||||||
|
<div class="ao-card-mid">
|
||||||
|
<span class="ao-pay">@p.Price.ToString("N0") Kč / ks</span>
|
||||||
|
<span class="ao-qty">hodnota @((p.Price * qty).ToString("N0")) Kč</span>
|
||||||
|
</div>
|
||||||
|
<div class="ao-card-right">
|
||||||
|
<span class="ao-badge @StockBadge(qty)">
|
||||||
|
@StockLabel(qty)
|
||||||
|
</span>
|
||||||
|
@if (dirty)
|
||||||
|
{
|
||||||
|
<span class="ao-date">neuloženo</span>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="sklad-row">
|
||||||
|
<button type="button" class="ap-btn ap-btn-ghost" disabled="@busy"
|
||||||
|
@onclick="() => Adjust(p.Id, -5)">
|
||||||
|
−5
|
||||||
|
</button>
|
||||||
|
<button type="button" class="ap-btn ap-btn-ghost" disabled="@busy"
|
||||||
|
@onclick="() => Adjust(p.Id, -1)">
|
||||||
|
−
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<input type="number" min="0" class="ao-input sklad-input"
|
||||||
|
value="@qty"
|
||||||
|
@onchange="e => OnStockInput(p.Id, e)" />
|
||||||
|
|
||||||
|
<button type="button" class="ap-btn ap-btn-ghost" disabled="@busy"
|
||||||
|
@onclick="() => Adjust(p.Id, 1)">
|
||||||
|
+
|
||||||
|
</button>
|
||||||
|
<button type="button" class="ap-btn ap-btn-ghost" disabled="@busy"
|
||||||
|
@onclick="() => Adjust(p.Id, 5)">
|
||||||
|
+5
|
||||||
|
</button>
|
||||||
|
<button type="button" class="ap-btn ap-btn-ghost" disabled="@busy"
|
||||||
|
@onclick="() => Adjust(p.Id, 10)">
|
||||||
|
+10
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<button type="button" class="ap-btn ap-btn-primary" disabled="@busy"
|
||||||
|
@onclick="() => SaveOneAsync(p.Id)">
|
||||||
|
Uložit
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<button type="button" class="ap-btn ap-btn-ghost" disabled="@busy"
|
||||||
|
@onclick="() => SetQty(p.Id, 0)">
|
||||||
|
Na 0
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<button type="button" class="ap-btn ap-btn-ghost" disabled="@busy"
|
||||||
|
@onclick="() => ToggleVisibleAsync(p)">
|
||||||
|
@(p.IsVisible ? "Skrýt" : "Zobrazit")
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<a class="ap-btn ap-btn-ghost" href="@($"/admin/zbozi/edit/{p.Id}")">Upravit</a>
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</section>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
private const int LowThreshold = 5;
|
||||||
|
|
||||||
|
private List<StockRow> items = new();
|
||||||
|
private readonly Dictionary<int, int> edits = new();
|
||||||
|
private List<string> categoryNames = new();
|
||||||
|
|
||||||
|
private bool loading = true;
|
||||||
|
private bool busy;
|
||||||
|
private string? message;
|
||||||
|
|
||||||
|
private string search = "";
|
||||||
|
private string stockFilter = "all";
|
||||||
|
private string categoryFilter = "all";
|
||||||
|
private string sortBy = "stock_asc";
|
||||||
|
|
||||||
|
private bool HasPending => items.Any(i => IsDirty(i.Id, i.StockQuantity));
|
||||||
|
private int PendingCount => items.Count(i => IsDirty(i.Id, i.StockQuantity));
|
||||||
|
|
||||||
|
private List<StockRow> Filtered
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
IEnumerable<StockRow> q = items;
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(search))
|
||||||
|
{
|
||||||
|
q = q.Where(p =>
|
||||||
|
p.Name.Contains(search, StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
p.CategoryName.Contains(search, StringComparison.OrdinalIgnoreCase));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (categoryFilter != "all")
|
||||||
|
{
|
||||||
|
q = q.Where(p => p.CategoryName == categoryFilter);
|
||||||
|
}
|
||||||
|
|
||||||
|
q = stockFilter switch
|
||||||
|
{
|
||||||
|
"ok" => q.Where(p => GetEditQty(p.Id) > LowThreshold),
|
||||||
|
"low" => q.Where(p =>
|
||||||
|
{
|
||||||
|
var n = GetEditQty(p.Id);
|
||||||
|
return n > 0 && n <= LowThreshold;
|
||||||
|
}),
|
||||||
|
"out" => q.Where(p => GetEditQty(p.Id) <= 0),
|
||||||
|
_ => q
|
||||||
|
};
|
||||||
|
|
||||||
|
q = sortBy switch
|
||||||
|
{
|
||||||
|
"stock_desc" => q.OrderByDescending(p => GetEditQty(p.Id)).ThenBy(p => p.Name),
|
||||||
|
"name" => q.OrderBy(p => p.Name),
|
||||||
|
"value" => q.OrderByDescending(p => p.Price * GetEditQty(p.Id)),
|
||||||
|
_ => q.OrderBy(p => GetEditQty(p.Id)).ThenBy(p => p.Name)
|
||||||
|
};
|
||||||
|
|
||||||
|
return q.ToList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
await ReloadAsync();
|
||||||
|
loading = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task ReloadAsync()
|
||||||
|
{
|
||||||
|
items = await Db.Products
|
||||||
|
.AsNoTracking()
|
||||||
|
.OrderBy(p => p.Name)
|
||||||
|
.Select(p => new StockRow(
|
||||||
|
p.Id,
|
||||||
|
p.Name,
|
||||||
|
p.Category.Name,
|
||||||
|
p.Price,
|
||||||
|
p.StockQuantity,
|
||||||
|
p.IsVisible))
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
categoryNames = items
|
||||||
|
.Select(i => i.CategoryName)
|
||||||
|
.Distinct()
|
||||||
|
.OrderBy(x => x)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
edits.Clear();
|
||||||
|
foreach (var i in items)
|
||||||
|
edits[i.Id] = i.StockQuantity;
|
||||||
|
|
||||||
|
message = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int GetEditQty(int id) =>
|
||||||
|
edits.TryGetValue(id, out var v) ? v : 0;
|
||||||
|
|
||||||
|
private bool IsDirty(int id, int original) =>
|
||||||
|
edits.TryGetValue(id, out var v) && v != original;
|
||||||
|
|
||||||
|
private void OnStockInput(int id, ChangeEventArgs e)
|
||||||
|
{
|
||||||
|
if (int.TryParse(e.Value?.ToString(), out var val))
|
||||||
|
edits[id] = Math.Max(0, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Adjust(int id, int delta)
|
||||||
|
{
|
||||||
|
edits[id] = Math.Max(0, GetEditQty(id) + delta);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetQty(int id, int qty)
|
||||||
|
{
|
||||||
|
edits[id] = Math.Max(0, qty);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void QuickFilterOut()
|
||||||
|
{
|
||||||
|
stockFilter = "out";
|
||||||
|
sortBy = "name";
|
||||||
|
}
|
||||||
|
|
||||||
|
private void QuickFilterLow()
|
||||||
|
{
|
||||||
|
stockFilter = "low";
|
||||||
|
sortBy = "stock_asc";
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task SaveOneAsync(int id)
|
||||||
|
{
|
||||||
|
busy = true;
|
||||||
|
message = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var entity = await Db.Products.FirstOrDefaultAsync(p => p.Id == id);
|
||||||
|
if (entity is null)
|
||||||
|
{
|
||||||
|
message = "Produkt nebyl nalezen.";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var qty = GetEditQty(id);
|
||||||
|
entity.StockQuantity = qty;
|
||||||
|
entity.UpdatedAt = DateTime.UtcNow;
|
||||||
|
await Db.SaveChangesAsync();
|
||||||
|
|
||||||
|
message = $"Uloženo: {entity.Name} → {qty} ks";
|
||||||
|
await ReloadAsync();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
message = "Chyba: " + ex.Message;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
busy = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task SaveAllAsync()
|
||||||
|
{
|
||||||
|
busy = true;
|
||||||
|
message = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var changed = items.Where(i => IsDirty(i.Id, i.StockQuantity)).ToList();
|
||||||
|
if (changed.Count == 0)
|
||||||
|
{
|
||||||
|
message = "Žádné změny k uložení.";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var ids = changed.Select(c => c.Id).ToList();
|
||||||
|
var entities = await Db.Products.Where(p => ids.Contains(p.Id)).ToListAsync();
|
||||||
|
|
||||||
|
foreach (var entity in entities)
|
||||||
|
{
|
||||||
|
entity.StockQuantity = GetEditQty(entity.Id);
|
||||||
|
entity.UpdatedAt = DateTime.UtcNow;
|
||||||
|
}
|
||||||
|
|
||||||
|
await Db.SaveChangesAsync();
|
||||||
|
message = $"Uloženo změn: {entities.Count}";
|
||||||
|
await ReloadAsync();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
message = "Hromadné uložení selhalo: " + ex.Message;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
busy = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task ToggleVisibleAsync(StockRow row)
|
||||||
|
{
|
||||||
|
busy = true;
|
||||||
|
message = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var entity = await Db.Products.FirstAsync(p => p.Id == row.Id);
|
||||||
|
entity.IsVisible = !entity.IsVisible;
|
||||||
|
entity.UpdatedAt = DateTime.UtcNow;
|
||||||
|
await Db.SaveChangesAsync();
|
||||||
|
message = entity.IsVisible ? $"Zobrazeno: {entity.Name}" : $"Skryto v e-shopu: {entity.Name}";
|
||||||
|
await ReloadAsync();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
message = ex.Message;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
busy = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string StockLabel(int q) =>
|
||||||
|
q <= 0 ? "Vyprodané" : q <= LowThreshold ? "Nízký sklad" : "V pořádku";
|
||||||
|
|
||||||
|
private static string StockBadge(int q) =>
|
||||||
|
q <= 0 ? "is-cancel" : q <= LowThreshold ? "is-pending" : "is-paid";
|
||||||
|
|
||||||
|
private sealed record StockRow(
|
||||||
|
int Id,
|
||||||
|
string Name,
|
||||||
|
string CategoryName,
|
||||||
|
decimal Price,
|
||||||
|
int StockQuantity,
|
||||||
|
bool IsVisible);
|
||||||
|
}
|
||||||
200
Web-Jarmark/Web-Jarmark/Components/Pages/Admin/Statistiky.razor
Normal file
200
Web-Jarmark/Web-Jarmark/Components/Pages/Admin/Statistiky.razor
Normal file
@@ -0,0 +1,200 @@
|
|||||||
|
@page "/admin/statistiky"
|
||||||
|
@layout Web_Jarmark.Components.Layout.Admin.AdminLayout
|
||||||
|
@rendermode InteractiveServer
|
||||||
|
@using Microsoft.EntityFrameworkCore
|
||||||
|
@using Microsoft.AspNetCore.Authorization
|
||||||
|
@using Web_Jarmark.Data
|
||||||
|
@using Web_Jarmark.Data.Models
|
||||||
|
@inject ApplicationDbContext Db
|
||||||
|
|
||||||
|
@attribute [Authorize(Roles = "Admin")]
|
||||||
|
|
||||||
|
<PageTitle>Statistiky</PageTitle>
|
||||||
|
|
||||||
|
<div class="ap ao">
|
||||||
|
<header class="ao-hero">
|
||||||
|
<p class="ao-eyebrow">Administrace</p>
|
||||||
|
<h1>Statistiky</h1>
|
||||||
|
<p class="ao-sub">Přehled e-shopu ze skutečných dat.</p>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
@if (loading)
|
||||||
|
{
|
||||||
|
<div class="ao-loading">Načítám statistiky…</div>
|
||||||
|
}
|
||||||
|
else if (!string.IsNullOrEmpty(error))
|
||||||
|
{
|
||||||
|
<div class="ao-alert">@error</div>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<section class="ao-stats">
|
||||||
|
<article class="ao-stat">
|
||||||
|
<span>Objednávky</span>
|
||||||
|
<strong>@orderCount</strong>
|
||||||
|
<small>celkem</small>
|
||||||
|
</article>
|
||||||
|
<article class="ao-stat">
|
||||||
|
<span>Tržby</span>
|
||||||
|
<strong>@revenue.ToString("N0")</strong>
|
||||||
|
<small>Kč</small>
|
||||||
|
</article>
|
||||||
|
<article class="ao-stat">
|
||||||
|
<span>Produkty</span>
|
||||||
|
<strong>@productCount</strong>
|
||||||
|
<small>@visibleCount viditelných</small>
|
||||||
|
</article>
|
||||||
|
<article class="ao-stat">
|
||||||
|
<span>Sklad</span>
|
||||||
|
<strong>@stockUnits</strong>
|
||||||
|
<small>@stockValue.ToString("N0") Kč</small>
|
||||||
|
</article>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="ao-stats">
|
||||||
|
<article class="ao-stat">
|
||||||
|
<span>Čeká na zaplacení</span>
|
||||||
|
<strong>@pendingCount</strong>
|
||||||
|
<small>objednávek</small>
|
||||||
|
</article>
|
||||||
|
<article class="ao-stat">
|
||||||
|
<span>Zaplaceno</span>
|
||||||
|
<strong>@paidCount</strong>
|
||||||
|
<small>objednávek</small>
|
||||||
|
</article>
|
||||||
|
<article class="ao-stat">
|
||||||
|
<span>Odesláno / dokončeno</span>
|
||||||
|
<strong>@(shippedCount + deliveredCount)</strong>
|
||||||
|
<small>objednávek</small>
|
||||||
|
</article>
|
||||||
|
<article class="ao-stat">
|
||||||
|
<span>Zrušeno</span>
|
||||||
|
<strong>@cancelledCount</strong>
|
||||||
|
<small>objednávek</small>
|
||||||
|
</article>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="ao-panel">
|
||||||
|
<div class="ao-panel-head">
|
||||||
|
<div>
|
||||||
|
<h2>Katalog a sklad</h2>
|
||||||
|
<p>Aktuální stav</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="ao-list">
|
||||||
|
<div class="ao-item">
|
||||||
|
<div><strong>Kategorie</strong><span>celkem</span></div>
|
||||||
|
<strong>@categoryCount</strong>
|
||||||
|
</div>
|
||||||
|
<div class="ao-item">
|
||||||
|
<div><strong>Aktivní kategorie</strong><span>v e-shopu</span></div>
|
||||||
|
<strong>@activeCategoryCount</strong>
|
||||||
|
</div>
|
||||||
|
<div class="ao-item">
|
||||||
|
<div><strong>Nízký sklad</strong><span>≤ 5 ks</span></div>
|
||||||
|
<strong>@lowStockCount</strong>
|
||||||
|
</div>
|
||||||
|
<div class="ao-item">
|
||||||
|
<div><strong>Vyprodané</strong><span>0 ks</span></div>
|
||||||
|
<strong>@outOfStockCount</strong>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="ao-panel" style="margin-top:14px">
|
||||||
|
<div class="ao-panel-head">
|
||||||
|
<div>
|
||||||
|
<h2>Poslední objednávky</h2>
|
||||||
|
<p>Nejnovějších 8</p>
|
||||||
|
</div>
|
||||||
|
<a class="ap-btn ap-btn-ghost" href="/admin/objednavky">Všechny</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@if (recentOrders.Count == 0)
|
||||||
|
{
|
||||||
|
<div class="ao-empty">Žádné objednávky.</div>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<div class="ao-list">
|
||||||
|
@foreach (var o in recentOrders)
|
||||||
|
{
|
||||||
|
<article class="ao-card">
|
||||||
|
<div class="ao-card-main" style="cursor:default">
|
||||||
|
<div class="ao-card-left">
|
||||||
|
<span class="ao-code">#@o.Code</span>
|
||||||
|
<span class="ao-date">@o.CreatedAt.ToLocalTime().ToString("d. M. yyyy HH:mm")</span>
|
||||||
|
</div>
|
||||||
|
<div class="ao-card-mid">
|
||||||
|
<span class="ao-pay">@(string.IsNullOrWhiteSpace(o.CustomerName) ? "—" : o.CustomerName)</span>
|
||||||
|
</div>
|
||||||
|
<div class="ao-card-right">
|
||||||
|
<span class="ao-price">@o.TotalAmount.ToString("N0") Kč</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</section>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
private bool loading = true;
|
||||||
|
private string? error;
|
||||||
|
|
||||||
|
private int orderCount, pendingCount, paidCount, shippedCount, deliveredCount, cancelledCount;
|
||||||
|
private int productCount, visibleCount, categoryCount, activeCategoryCount;
|
||||||
|
private int stockUnits, lowStockCount, outOfStockCount;
|
||||||
|
private decimal revenue, stockValue;
|
||||||
|
|
||||||
|
private List<RecentOrder> recentOrders = new();
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var orders = await Db.Orders.AsNoTracking().ToListAsync();
|
||||||
|
orderCount = orders.Count;
|
||||||
|
pendingCount = orders.Count(o => o.Status == OrderStatus.Pending);
|
||||||
|
paidCount = orders.Count(o => o.Status == OrderStatus.Paid);
|
||||||
|
shippedCount = orders.Count(o => o.Status == OrderStatus.Shipped);
|
||||||
|
deliveredCount = orders.Count(o => o.Status == OrderStatus.Delivered);
|
||||||
|
cancelledCount = orders.Count(o => o.Status == OrderStatus.Cancelled);
|
||||||
|
|
||||||
|
revenue = orders
|
||||||
|
.Where(o => o.Status == OrderStatus.Paid
|
||||||
|
|| o.Status == OrderStatus.Shipped
|
||||||
|
|| o.Status == OrderStatus.Delivered)
|
||||||
|
.Sum(o => o.TotalAmount);
|
||||||
|
|
||||||
|
var products = await Db.Products.AsNoTracking().ToListAsync();
|
||||||
|
productCount = products.Count;
|
||||||
|
visibleCount = products.Count(p => p.IsVisible);
|
||||||
|
stockUnits = products.Sum(p => p.StockQuantity);
|
||||||
|
stockValue = products.Sum(p => p.Price * p.StockQuantity);
|
||||||
|
lowStockCount = products.Count(p => p.StockQuantity > 0 && p.StockQuantity <= 5);
|
||||||
|
outOfStockCount = products.Count(p => p.StockQuantity <= 0);
|
||||||
|
|
||||||
|
categoryCount = await Db.Categories.CountAsync();
|
||||||
|
activeCategoryCount = await Db.Categories.CountAsync(c => c.IsActive);
|
||||||
|
|
||||||
|
recentOrders = orders
|
||||||
|
.OrderByDescending(o => o.CreatedAt)
|
||||||
|
.Take(8)
|
||||||
|
.Select(o => new RecentOrder(o.Code, o.CustomerName, o.TotalAmount, o.CreatedAt))
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
error = "Statistiky se nepodařilo načíst: " + ex.Message;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
loading = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private sealed record RecentOrder(string Code, string CustomerName, decimal TotalAmount, DateTime CreatedAt);
|
||||||
|
}
|
||||||
@@ -8,67 +8,799 @@
|
|||||||
@inject IHttpContextAccessor HttpContextAccessor
|
@inject IHttpContextAccessor HttpContextAccessor
|
||||||
@inject PersistentComponentState ApplicationState
|
@inject PersistentComponentState ApplicationState
|
||||||
|
|
||||||
<PageTitle>Detail produktu</PageTitle>
|
@implements IDisposable
|
||||||
|
|
||||||
@if (loading)
|
<PageTitle>Detail produktu | Školní jarmark</PageTitle>
|
||||||
{
|
|
||||||
<p>Načítám produkt...</p>
|
|
||||||
}
|
|
||||||
else if (product == null)
|
|
||||||
{
|
|
||||||
<h3>Produkt nebyl nalezen.</h3>
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
|
<div class="jarmark-product-detail">
|
||||||
|
|
||||||
|
<!-- NOTIFIKACE -->
|
||||||
|
@if (showNotification)
|
||||||
{
|
{
|
||||||
<div class="detail-container">
|
<div class="jarmark-detail-notification"
|
||||||
<a href="/katalog" class="back-link">← Zpět do katalogu</a>
|
role="status"
|
||||||
|
aria-live="polite">
|
||||||
|
|
||||||
<div class="detail-card">
|
<svg width="24"
|
||||||
<div class="detail-image">
|
height="24"
|
||||||
<img src="@product.ImageUrl" alt="@product.Name" />
|
viewBox="0 0 24 24"
|
||||||
</div>
|
fill="none"
|
||||||
|
stroke="currentColor"
|
||||||
|
stroke-width="1.8"
|
||||||
|
stroke-linecap="round"
|
||||||
|
stroke-linejoin="round"
|
||||||
|
aria-hidden="true">
|
||||||
|
|
||||||
<div class="detail-info">
|
<circle cx="12" cy="12" r="9" />
|
||||||
<span class="detail-category">
|
<path d="m8 12 3 3 5-6" />
|
||||||
@product.Category?.Name
|
|
||||||
</span>
|
|
||||||
|
|
||||||
<h1>@product.Name</h1>
|
</svg>
|
||||||
|
|
||||||
<p class="detail-description">
|
<span>@notificationMessage</span>
|
||||||
@product.Description
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<div class="detail-stock">
|
|
||||||
<span class="stock-dot"></span>
|
|
||||||
Skladem: @product.StockQuantity ks
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="detail-divider"></div>
|
|
||||||
|
|
||||||
<div class="detail-bottom">
|
|
||||||
<div>
|
|
||||||
<span class="price-label">Cena produktu</span>
|
|
||||||
<div class="detail-price">
|
|
||||||
@product.Price.ToString("N0") Kč
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<button class="detail-cart-button"
|
|
||||||
disabled="@(product.StockQuantity <= 0)"
|
|
||||||
@onclick="() => HandleAddToCart(product)">
|
|
||||||
🛒 Přidat do košíku
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
<!-- NÁVRAT DO KATALOGU -->
|
||||||
|
|
||||||
|
<a href="/" class="jarmark-detail-back">
|
||||||
|
|
||||||
|
<svg width="20"
|
||||||
|
height="20"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
fill="none"
|
||||||
|
stroke="currentColor"
|
||||||
|
stroke-width="1.8"
|
||||||
|
stroke-linecap="round"
|
||||||
|
stroke-linejoin="round"
|
||||||
|
aria-hidden="true">
|
||||||
|
|
||||||
|
<path d="M19 12H5M12 19l-7-7 7-7" />
|
||||||
|
|
||||||
|
</svg>
|
||||||
|
|
||||||
|
<span>Zpět do katalogu</span>
|
||||||
|
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- NAČÍTÁNÍ -->
|
||||||
|
@if (loading)
|
||||||
|
{
|
||||||
|
<div class="jarmark-detail-empty"
|
||||||
|
role="status"
|
||||||
|
aria-live="polite">
|
||||||
|
|
||||||
|
<h2>Načítáme výrobek</h2>
|
||||||
|
|
||||||
|
<p>Informace o výrobku se právě načítají.</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
else if (product == null)
|
||||||
|
{
|
||||||
|
<div class="jarmark-detail-empty">
|
||||||
|
|
||||||
|
<svg width="48"
|
||||||
|
height="48"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
fill="none"
|
||||||
|
stroke="currentColor"
|
||||||
|
stroke-width="1.4"
|
||||||
|
stroke-linecap="round"
|
||||||
|
stroke-linejoin="round"
|
||||||
|
aria-hidden="true">
|
||||||
|
|
||||||
|
<circle cx="11" cy="11" r="7" />
|
||||||
|
<path d="m20 20-4-4" />
|
||||||
|
|
||||||
|
</svg>
|
||||||
|
|
||||||
|
<h2>Výrobek nebyl nalezen</h2>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Tento výrobek již nemusí být dostupný.
|
||||||
|
Další výrobky najdete v katalogu.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<a href="/"
|
||||||
|
class="jarmark-detail-button">
|
||||||
|
|
||||||
|
Prohlédnout nabídku
|
||||||
|
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<article class="jarmark-detail-card">
|
||||||
|
|
||||||
|
<!-- FOTOGRAFIE -->
|
||||||
|
|
||||||
|
<div class="jarmark-detail-image">
|
||||||
|
|
||||||
|
@if (!string.IsNullOrWhiteSpace(product.ImageUrl)
|
||||||
|
&& !imageFailed)
|
||||||
|
{
|
||||||
|
<img src="@product.ImageUrl"
|
||||||
|
alt="@product.Name"
|
||||||
|
decoding="async"
|
||||||
|
@onerror="HandleImageError" />
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<div class="jarmark-detail-placeholder">
|
||||||
|
|
||||||
|
<svg width="80"
|
||||||
|
height="80"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
fill="none"
|
||||||
|
stroke="currentColor"
|
||||||
|
stroke-width="1"
|
||||||
|
stroke-linecap="round"
|
||||||
|
stroke-linejoin="round"
|
||||||
|
aria-hidden="true">
|
||||||
|
|
||||||
|
<rect x="3"
|
||||||
|
y="3"
|
||||||
|
width="18"
|
||||||
|
height="18"
|
||||||
|
rx="2" />
|
||||||
|
|
||||||
|
<circle cx="8.5"
|
||||||
|
cy="8.5"
|
||||||
|
r="1.5" />
|
||||||
|
|
||||||
|
<path d="m21 15-5-5L5 21" />
|
||||||
|
|
||||||
|
</svg>
|
||||||
|
|
||||||
|
<span>Fotografie není dostupná</span>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- INFORMACE O VÝROBKU -->
|
||||||
|
|
||||||
|
<div class="jarmark-detail-info">
|
||||||
|
|
||||||
|
@if (product.Category is not null)
|
||||||
|
{
|
||||||
|
<span class="jarmark-detail-category">
|
||||||
|
|
||||||
|
@product.Category.Name
|
||||||
|
|
||||||
|
</span>
|
||||||
|
}
|
||||||
|
|
||||||
|
<h1 class="jarmark-detail-title">
|
||||||
|
|
||||||
|
@product.Name
|
||||||
|
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
@if (!string.IsNullOrWhiteSpace(product.Description))
|
||||||
|
{
|
||||||
|
<p class="jarmark-detail-description">
|
||||||
|
|
||||||
|
@product.Description
|
||||||
|
|
||||||
|
</p>
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
<!-- SKLADOVÁ DOSTUPNOST -->
|
||||||
|
|
||||||
|
<div class="jarmark-detail-stock @(product.StockQuantity > 0 ? "is-available" : "is-unavailable")">
|
||||||
|
|
||||||
|
<span class="jarmark-detail-stock-dot"
|
||||||
|
aria-hidden="true">
|
||||||
|
</span>
|
||||||
|
|
||||||
|
@if (product.StockQuantity > 0)
|
||||||
|
{
|
||||||
|
<span>
|
||||||
|
Skladem: @product.StockQuantity ks
|
||||||
|
</span>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<span>Není skladem</span>
|
||||||
|
}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- CENA A NÁKUP -->
|
||||||
|
|
||||||
|
<div class="jarmark-detail-purchase">
|
||||||
|
|
||||||
|
<div class="jarmark-detail-price-area">
|
||||||
|
|
||||||
|
<span class="jarmark-detail-price-label">
|
||||||
|
|
||||||
|
Cena produktu
|
||||||
|
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<strong class="jarmark-detail-price">
|
||||||
|
|
||||||
|
@product.Price.ToString("N0") Kč
|
||||||
|
|
||||||
|
</strong>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button type="button"
|
||||||
|
class="jarmark-detail-button"
|
||||||
|
disabled="@(product.StockQuantity <= 0)"
|
||||||
|
@onclick="() => HandleAddToCart(product)">
|
||||||
|
|
||||||
|
@if (product.StockQuantity > 0)
|
||||||
|
{
|
||||||
|
<svg width="22"
|
||||||
|
height="22"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
fill="none"
|
||||||
|
stroke="currentColor"
|
||||||
|
stroke-width="1.7"
|
||||||
|
stroke-linecap="round"
|
||||||
|
stroke-linejoin="round"
|
||||||
|
aria-hidden="true">
|
||||||
|
|
||||||
|
<path d="M3 3h2l3.5 13h10l3-10H6" />
|
||||||
|
|
||||||
|
<circle cx="10"
|
||||||
|
cy="20"
|
||||||
|
r="1" />
|
||||||
|
|
||||||
|
<circle cx="18"
|
||||||
|
cy="20"
|
||||||
|
r="1" />
|
||||||
|
|
||||||
|
</svg>
|
||||||
|
|
||||||
|
<span>Přidat do košíku</span>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<span>Vyprodáno</span>
|
||||||
|
}
|
||||||
|
|
||||||
|
</button>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</article>
|
||||||
|
}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<style>
|
||||||
|
|
||||||
|
/* ========================================
|
||||||
|
PUBLIC PRODUCT DETAIL
|
||||||
|
======================================== */
|
||||||
|
|
||||||
|
.jarmark-product-detail {
|
||||||
|
--detail-primary: #244b36;
|
||||||
|
--detail-primary-hover: #193b29;
|
||||||
|
--detail-secondary: #e6eddf;
|
||||||
|
--detail-surface: #ffffff;
|
||||||
|
--detail-text: #26372b;
|
||||||
|
--detail-muted: #59665b;
|
||||||
|
--detail-border: #dce3d9;
|
||||||
|
width: 100%;
|
||||||
|
max-width: 1200px;
|
||||||
|
min-width: 0;
|
||||||
|
margin: 0 auto;
|
||||||
|
color: var(--detail-text);
|
||||||
|
font-family: inherit;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ========================================
|
||||||
|
BACK LINK
|
||||||
|
======================================== */
|
||||||
|
|
||||||
|
.jarmark-product-detail .jarmark-detail-back {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
min-height: 44px;
|
||||||
|
margin: 0 0 20px;
|
||||||
|
padding: 8px 0;
|
||||||
|
color: var(--detail-primary);
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 600;
|
||||||
|
line-height: 1.4;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-detail .jarmark-detail-back svg {
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-detail .jarmark-detail-back:hover {
|
||||||
|
color: var(--detail-primary-hover);
|
||||||
|
text-decoration: underline;
|
||||||
|
text-underline-offset: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ========================================
|
||||||
|
PRODUCT CARD
|
||||||
|
======================================== */
|
||||||
|
|
||||||
|
.jarmark-product-detail .jarmark-detail-card {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
|
||||||
|
align-items: start;
|
||||||
|
gap: 40px;
|
||||||
|
width: 100%;
|
||||||
|
min-width: 0;
|
||||||
|
padding: 32px;
|
||||||
|
background: var(--detail-surface);
|
||||||
|
border: 1px solid var(--detail-border);
|
||||||
|
border-radius: 12px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ========================================
|
||||||
|
PRODUCT IMAGE
|
||||||
|
======================================== */
|
||||||
|
|
||||||
|
.jarmark-product-detail .jarmark-detail-image {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 100%;
|
||||||
|
min-width: 0;
|
||||||
|
aspect-ratio: 1 / 1;
|
||||||
|
background: #edf0e9;
|
||||||
|
border: 1px solid var(--detail-border);
|
||||||
|
border-radius: 8px;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-detail .jarmark-detail-image img {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
max-width: 100%;
|
||||||
|
padding: 20px;
|
||||||
|
object-fit: contain;
|
||||||
|
object-position: center;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ========================================
|
||||||
|
IMAGE PLACEHOLDER
|
||||||
|
======================================== */
|
||||||
|
|
||||||
|
.jarmark-product-detail .jarmark-detail-placeholder {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 16px;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
padding: 24px;
|
||||||
|
background: var(--detail-secondary);
|
||||||
|
color: #64815d;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-detail .jarmark-detail-placeholder span {
|
||||||
|
color: var(--detail-muted);
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ========================================
|
||||||
|
PRODUCT INFORMATION
|
||||||
|
======================================== */
|
||||||
|
|
||||||
|
.jarmark-product-detail .jarmark-detail-info {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 16px;
|
||||||
|
width: 100%;
|
||||||
|
min-width: 0;
|
||||||
|
padding: 12px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-detail .jarmark-detail-category {
|
||||||
|
display: block;
|
||||||
|
color: var(--detail-muted);
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 500;
|
||||||
|
line-height: 1.5;
|
||||||
|
letter-spacing: normal;
|
||||||
|
text-transform: none;
|
||||||
|
overflow-wrap: anywhere;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-detail .jarmark-detail-title {
|
||||||
|
margin: 0;
|
||||||
|
color: var(--detail-text);
|
||||||
|
font-family: Georgia, "Times New Roman", serif;
|
||||||
|
font-size: clamp(30px, 4vw, 44px);
|
||||||
|
font-weight: 700;
|
||||||
|
line-height: 1.2;
|
||||||
|
letter-spacing: normal;
|
||||||
|
overflow-wrap: anywhere;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-detail .jarmark-detail-description {
|
||||||
|
margin: 0;
|
||||||
|
color: var(--detail-muted);
|
||||||
|
font-size: 16px;
|
||||||
|
line-height: 1.8;
|
||||||
|
white-space: pre-line;
|
||||||
|
overflow-wrap: anywhere;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ========================================
|
||||||
|
STOCK AVAILABILITY
|
||||||
|
======================================== */
|
||||||
|
|
||||||
|
.jarmark-product-detail .jarmark-detail-stock {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
align-self: flex-start;
|
||||||
|
margin-top: 8px;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 600;
|
||||||
|
line-height: 1.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-detail .jarmark-detail-stock-dot {
|
||||||
|
display: inline-block;
|
||||||
|
flex-shrink: 0;
|
||||||
|
width: 8px;
|
||||||
|
height: 8px;
|
||||||
|
background: currentColor;
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-detail .is-available {
|
||||||
|
color: #34754b;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-detail .is-unavailable {
|
||||||
|
color: #93483e;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ========================================
|
||||||
|
PURCHASE SECTION
|
||||||
|
======================================== */
|
||||||
|
|
||||||
|
.jarmark-product-detail .jarmark-detail-purchase {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 24px;
|
||||||
|
width: 100%;
|
||||||
|
margin-top: 12px;
|
||||||
|
padding-top: 24px;
|
||||||
|
border-top: 1px solid var(--detail-border);
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-detail .jarmark-detail-price-area {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-detail .jarmark-detail-price-label {
|
||||||
|
color: var(--detail-muted);
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-detail .jarmark-detail-price {
|
||||||
|
color: var(--detail-primary);
|
||||||
|
font-size: clamp(32px, 4vw, 44px);
|
||||||
|
font-weight: 750;
|
||||||
|
line-height: 1.2;
|
||||||
|
font-variant-numeric: tabular-nums;
|
||||||
|
overflow-wrap: anywhere;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ========================================
|
||||||
|
ADD TO CART BUTTON
|
||||||
|
======================================== */
|
||||||
|
|
||||||
|
.jarmark-product-detail .jarmark-detail-button {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 12px;
|
||||||
|
width: 100%;
|
||||||
|
min-height: 52px;
|
||||||
|
margin: 0;
|
||||||
|
padding: 12px 24px;
|
||||||
|
background: var(--detail-primary);
|
||||||
|
color: #ffffff;
|
||||||
|
border: 1px solid var(--detail-primary);
|
||||||
|
border-radius: 6px;
|
||||||
|
font-family: inherit;
|
||||||
|
font-size: 15px;
|
||||||
|
font-weight: 650;
|
||||||
|
line-height: 1.5;
|
||||||
|
text-align: center;
|
||||||
|
text-decoration: none;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: background-color 150ms ease, border-color 150ms ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-detail .jarmark-detail-button svg {
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-detail .jarmark-detail-button:not(:disabled):hover {
|
||||||
|
background: var(--detail-primary-hover);
|
||||||
|
border-color: var(--detail-primary-hover);
|
||||||
|
color: #ffffff;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-detail .jarmark-detail-button:disabled {
|
||||||
|
background: #e9ece7;
|
||||||
|
color: #59665b;
|
||||||
|
border-color: var(--detail-border);
|
||||||
|
opacity: 1;
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ========================================
|
||||||
|
EMPTY AND LOADING STATES
|
||||||
|
======================================== */
|
||||||
|
|
||||||
|
.jarmark-product-detail .jarmark-detail-empty {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: flex-start;
|
||||||
|
gap: 16px;
|
||||||
|
min-height: 220px;
|
||||||
|
padding: 32px;
|
||||||
|
background: var(--detail-surface);
|
||||||
|
border: 1px solid var(--detail-border);
|
||||||
|
border-radius: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-detail .jarmark-detail-empty svg {
|
||||||
|
color: #64815d;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-detail .jarmark-detail-empty h2 {
|
||||||
|
margin: 0;
|
||||||
|
color: var(--detail-text);
|
||||||
|
font-size: 28px;
|
||||||
|
line-height: 1.3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-detail .jarmark-detail-empty p {
|
||||||
|
margin: 0;
|
||||||
|
color: var(--detail-muted);
|
||||||
|
font-size: 15px;
|
||||||
|
line-height: 1.6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-detail .jarmark-detail-empty .jarmark-detail-button {
|
||||||
|
width: auto;
|
||||||
|
margin-top: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ========================================
|
||||||
|
CART NOTIFICATION
|
||||||
|
======================================== */
|
||||||
|
|
||||||
|
.jarmark-product-detail .jarmark-detail-notification {
|
||||||
|
position: fixed;
|
||||||
|
top: 96px;
|
||||||
|
right: 24px;
|
||||||
|
z-index: 500;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12px;
|
||||||
|
max-width: 420px;
|
||||||
|
padding: 16px 20px;
|
||||||
|
background: var(--detail-surface);
|
||||||
|
color: var(--detail-text);
|
||||||
|
border: 1px solid #c7d6c2;
|
||||||
|
border-left: 4px solid var(--detail-primary);
|
||||||
|
border-radius: 8px;
|
||||||
|
box-shadow: 0 4px 16px rgba(0, 0, 0, .08);
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 500;
|
||||||
|
line-height: 1.5;
|
||||||
|
overflow-wrap: anywhere;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-detail .jarmark-detail-notification svg {
|
||||||
|
flex-shrink: 0;
|
||||||
|
color: var(--detail-primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ========================================
|
||||||
|
KEYBOARD ACCESSIBILITY
|
||||||
|
======================================== */
|
||||||
|
|
||||||
|
.jarmark-product-detail .jarmark-detail-back:focus-visible,
|
||||||
|
.jarmark-product-detail .jarmark-detail-button:focus-visible {
|
||||||
|
outline: 3px solid #527b49;
|
||||||
|
outline-offset: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ========================================
|
||||||
|
TABLET
|
||||||
|
======================================== */
|
||||||
|
|
||||||
|
@@media (max-width: 1024px) {
|
||||||
|
|
||||||
|
.jarmark-product-detail .jarmark-detail-card {
|
||||||
|
gap: 24px;
|
||||||
|
padding: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-detail .jarmark-detail-title {
|
||||||
|
font-size: 32px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-detail .jarmark-detail-info {
|
||||||
|
padding: 4px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-detail .jarmark-detail-description {
|
||||||
|
font-size: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-detail .jarmark-detail-image img {
|
||||||
|
padding: 16px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ========================================
|
||||||
|
MOBILE
|
||||||
|
======================================== */
|
||||||
|
|
||||||
|
@@media (max-width: 768px) {
|
||||||
|
|
||||||
|
.jarmark-product-detail .jarmark-detail-card {
|
||||||
|
grid-template-columns: minmax(0, 1fr);
|
||||||
|
gap: 24px;
|
||||||
|
padding: 16px;
|
||||||
|
border-radius: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-detail .jarmark-detail-back {
|
||||||
|
margin-bottom: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-detail .jarmark-detail-image {
|
||||||
|
aspect-ratio: 4 / 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-detail .jarmark-detail-info {
|
||||||
|
gap: 12px;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-detail .jarmark-detail-title {
|
||||||
|
font-size: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-detail .jarmark-detail-description {
|
||||||
|
font-size: 15px;
|
||||||
|
line-height: 1.7;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-detail .jarmark-detail-purchase {
|
||||||
|
gap: 16px;
|
||||||
|
margin-top: 8px;
|
||||||
|
padding-top: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-detail .jarmark-detail-price {
|
||||||
|
font-size: 34px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-detail .jarmark-detail-button {
|
||||||
|
min-height: 52px;
|
||||||
|
padding: 12px 16px;
|
||||||
|
font-size: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-detail .jarmark-detail-notification {
|
||||||
|
top: auto;
|
||||||
|
right: 12px;
|
||||||
|
bottom: 16px;
|
||||||
|
left: 12px;
|
||||||
|
max-width: none;
|
||||||
|
padding: 16px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ========================================
|
||||||
|
SMALL MOBILE
|
||||||
|
======================================== */
|
||||||
|
|
||||||
|
@@media (max-width: 480px) {
|
||||||
|
|
||||||
|
.jarmark-product-detail .jarmark-detail-card {
|
||||||
|
gap: 20px;
|
||||||
|
padding: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-detail .jarmark-detail-image {
|
||||||
|
aspect-ratio: 1 / 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-detail .jarmark-detail-image img {
|
||||||
|
padding: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-detail .jarmark-detail-title {
|
||||||
|
font-size: 28px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-detail .jarmark-detail-category {
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-detail .jarmark-detail-empty {
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-detail .jarmark-detail-empty h2 {
|
||||||
|
font-size: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-detail .jarmark-detail-empty .jarmark-detail-button {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ========================================
|
||||||
|
REDUCED MOTION
|
||||||
|
======================================== */
|
||||||
|
|
||||||
|
@@media (prefers-reduced-motion: reduce) {
|
||||||
|
|
||||||
|
.jarmark-product-detail,
|
||||||
|
.jarmark-product-detail * {
|
||||||
|
animation: none !important;
|
||||||
|
transition: none !important;
|
||||||
|
scroll-behavior: auto !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
[Parameter]
|
[Parameter]
|
||||||
@@ -76,21 +808,24 @@ else
|
|||||||
|
|
||||||
private Product? product;
|
private Product? product;
|
||||||
private bool loading = true;
|
private bool loading = true;
|
||||||
|
|
||||||
protected override async Task OnParametersSetAsync()
|
|
||||||
{
|
|
||||||
loading = true;
|
|
||||||
|
|
||||||
product = await DbContext.Products
|
|
||||||
.Include(p => p.Category)
|
|
||||||
.FirstOrDefaultAsync(p => p.Id == Id);
|
|
||||||
|
|
||||||
loading = false;
|
|
||||||
}
|
|
||||||
private string? cartToken;
|
private string? cartToken;
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
private bool showNotification;
|
||||||
{
|
private string notificationMessage = "";
|
||||||
|
|
||||||
|
private CancellationTokenSource? notificationCts;
|
||||||
|
|
||||||
|
private bool imageFailed;
|
||||||
|
|
||||||
|
|
||||||
|
private void HandleImageError()
|
||||||
|
{
|
||||||
|
imageFailed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
if (!ApplicationState.TryTakeFromJson<string>(
|
if (!ApplicationState.TryTakeFromJson<string>(
|
||||||
"CartToken", out cartToken)
|
"CartToken", out cartToken)
|
||||||
|| string.IsNullOrWhiteSpace(cartToken))
|
|| string.IsNullOrWhiteSpace(cartToken))
|
||||||
@@ -100,10 +835,22 @@ protected override async Task OnInitializedAsync()
|
|||||||
cartToken = context?.Items["CartToken"] as string
|
cartToken = context?.Items["CartToken"] as string
|
||||||
?? context?.Request.Cookies["CartToken"];
|
?? context?.Request.Cookies["CartToken"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task HandleAddToCart(Product product)
|
protected override async Task OnParametersSetAsync()
|
||||||
{
|
{
|
||||||
|
loading = true;
|
||||||
|
imageFailed = false;
|
||||||
|
|
||||||
|
product = await DbContext.Products
|
||||||
|
.Include(p => p.Category)
|
||||||
|
.FirstOrDefaultAsync(p => p.Id == Id);
|
||||||
|
|
||||||
|
loading = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task HandleAddToCart(Product product)
|
||||||
|
{
|
||||||
if (string.IsNullOrWhiteSpace(cartToken))
|
if (string.IsNullOrWhiteSpace(cartToken))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -147,5 +894,49 @@ private async Task HandleAddToCart(Product product)
|
|||||||
cart.UpdatedAt = DateTime.UtcNow;
|
cart.UpdatedAt = DateTime.UtcNow;
|
||||||
|
|
||||||
await DbContext.SaveChangesAsync();
|
await DbContext.SaveChangesAsync();
|
||||||
}
|
|
||||||
|
await ShowCartNotification(product.Name);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task ShowCartNotification(string productName)
|
||||||
|
{
|
||||||
|
notificationCts?.Cancel();
|
||||||
|
|
||||||
|
var currentCts = new CancellationTokenSource();
|
||||||
|
notificationCts = currentCts;
|
||||||
|
|
||||||
|
notificationMessage = $"{productName} byl přidán do košíku.";
|
||||||
|
showNotification = true;
|
||||||
|
|
||||||
|
await InvokeAsync(StateHasChanged);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await Task.Delay(3500, currentCts.Token);
|
||||||
|
|
||||||
|
if (!currentCts.Token.IsCancellationRequested)
|
||||||
|
{
|
||||||
|
showNotification = false;
|
||||||
|
await InvokeAsync(StateHasChanged);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (OperationCanceledException)
|
||||||
|
{
|
||||||
|
// Nové přidání produktu restartovalo čas notifikace.
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (ReferenceEquals(notificationCts, currentCts))
|
||||||
|
{
|
||||||
|
notificationCts = null;
|
||||||
|
currentCts.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
notificationCts?.Cancel();
|
||||||
|
notificationCts?.Dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,41 +1,75 @@
|
|||||||
@using Web_Jarmark.Data.Models
|
@using Web_Jarmark.Data.Models
|
||||||
|
@using Microsoft.AspNetCore.Components.Web
|
||||||
|
@inject NavigationManager NavigationManager
|
||||||
|
|
||||||
|
<article class="jarmark-product-card">
|
||||||
|
|
||||||
|
<!-- FOTOGRAFIE PRODUKTU -->
|
||||||
|
|
||||||
|
<div class="jarmark-card-picture">
|
||||||
|
|
||||||
<article class="market-card">
|
|
||||||
<div class="market-product-picture">
|
|
||||||
@if (!string.IsNullOrWhiteSpace(Product.ImageUrl) && !imageFailed)
|
@if (!string.IsNullOrWhiteSpace(Product.ImageUrl) && !imageFailed)
|
||||||
{
|
{
|
||||||
<img src="@Product.ImageUrl.Trim()"
|
<img src="@Product.ImageUrl.Trim()"
|
||||||
alt="@Product.Name"
|
alt="@Product.Name"
|
||||||
loading="lazy"
|
loading="lazy"
|
||||||
|
decoding="async"
|
||||||
@onerror="HandleImageError" />
|
@onerror="HandleImageError" />
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<span class="product-icon">@ProductIcon</span>
|
<div class="jarmark-card-placeholder"
|
||||||
|
aria-hidden="true">
|
||||||
|
|
||||||
|
<span>@ProductIcon</span>
|
||||||
|
|
||||||
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- INFORMACE O PRODUKTU -->
|
||||||
|
|
||||||
|
<div class="jarmark-card-body">
|
||||||
|
|
||||||
@if (Product.Category is not null)
|
@if (Product.Category is not null)
|
||||||
{
|
{
|
||||||
<span class="market-product-tag">
|
<div class="jarmark-card-category">
|
||||||
@Product.Category.Name
|
|
||||||
</span>
|
@Product.Category.Name
|
||||||
}
|
|
||||||
</div>
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
<h3 class="jarmark-card-title">
|
||||||
|
|
||||||
|
<a href="@($"/produkt/{Product.Id}")"
|
||||||
|
class="jarmark-card-detail">
|
||||||
|
|
||||||
|
@Product.Name
|
||||||
|
|
||||||
<div class="market-card-content">
|
|
||||||
<a href="@($"/produkt/{Product.Id}")" class="product-detail-link">
|
|
||||||
<h3>@Product.Name</h3>
|
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
</h3>
|
||||||
|
|
||||||
@if (!string.IsNullOrWhiteSpace(Product.Description))
|
@if (!string.IsNullOrWhiteSpace(Product.Description))
|
||||||
{
|
{
|
||||||
<p class="market-description">
|
<p class="jarmark-card-description">
|
||||||
|
|
||||||
@Product.Description
|
@Product.Description
|
||||||
|
|
||||||
</p>
|
</p>
|
||||||
}
|
}
|
||||||
|
|
||||||
<div class="market-stock">
|
|
||||||
<span class="market-stock-dot @(Product.StockQuantity <= 0 ? "out-of-stock" : "")"></span>
|
<!-- DOSTUPNOST -->
|
||||||
|
|
||||||
|
<div class="jarmark-card-stock @(Product.StockQuantity <= 0 ? "is-unavailable" : "is-available")">
|
||||||
|
|
||||||
|
<span class="jarmark-stock-indicator"
|
||||||
|
aria-hidden="true">
|
||||||
|
</span>
|
||||||
|
|
||||||
@if (Product.StockQuantity > 0)
|
@if (Product.StockQuantity > 0)
|
||||||
{
|
{
|
||||||
@@ -45,25 +79,488 @@
|
|||||||
{
|
{
|
||||||
<span>Není skladem</span>
|
<span>Není skladem</span>
|
||||||
}
|
}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="market-card-bottom">
|
|
||||||
|
<!-- CENA A AKCE -->
|
||||||
|
|
||||||
|
<div class="jarmark-card-actions">
|
||||||
|
|
||||||
|
<div class="jarmark-card-price">
|
||||||
|
|
||||||
<strong>@Product.Price.ToString("N0") Kč</strong>
|
<strong>@Product.Price.ToString("N0") Kč</strong>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@if (OnAddToCart.HasDelegate)
|
@if (OnAddToCart.HasDelegate)
|
||||||
{
|
{
|
||||||
<button type="button"
|
<button type="button"
|
||||||
class="product-cart-button"
|
class="jarmark-card-cart"
|
||||||
disabled="@(Product.StockQuantity <= 0)"
|
disabled="@(Product.StockQuantity <= 0)"
|
||||||
@onclick="AddToCart">
|
aria-label="@($"Přidat do košíku: {Product.Name}")"
|
||||||
🛒 Do košíku
|
@onclick="AddToCart"
|
||||||
|
@onclick:stopPropagation="true">
|
||||||
|
|
||||||
|
@if (Product.StockQuantity > 0)
|
||||||
|
{
|
||||||
|
<svg width="20"
|
||||||
|
height="20"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
fill="none"
|
||||||
|
stroke="currentColor"
|
||||||
|
stroke-width="1.7"
|
||||||
|
stroke-linecap="round"
|
||||||
|
stroke-linejoin="round"
|
||||||
|
aria-hidden="true">
|
||||||
|
|
||||||
|
<path d="M3 3h2l3.5 13h10l3-10H6" />
|
||||||
|
|
||||||
|
<circle cx="10"
|
||||||
|
cy="20"
|
||||||
|
r="1" />
|
||||||
|
|
||||||
|
<circle cx="18"
|
||||||
|
cy="20"
|
||||||
|
r="1" />
|
||||||
|
|
||||||
|
</svg>
|
||||||
|
|
||||||
|
<span>Do košíku</span>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<span>Vyprodáno</span>
|
||||||
|
}
|
||||||
|
|
||||||
</button>
|
</button>
|
||||||
}
|
}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
</article>
|
</article>
|
||||||
|
|
||||||
|
|
||||||
|
<style>
|
||||||
|
|
||||||
|
/* ========================================
|
||||||
|
PUBLIC PRODUCT CARD
|
||||||
|
======================================== */
|
||||||
|
|
||||||
|
.jarmark-product-card {
|
||||||
|
--card-primary: #244b36;
|
||||||
|
--card-primary-hover: #193b29;
|
||||||
|
--card-surface: #ffffff;
|
||||||
|
--card-text: #26372b;
|
||||||
|
--card-muted: #59665b;
|
||||||
|
--card-border: #dce3d9;
|
||||||
|
position: relative;
|
||||||
|
isolation: isolate;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
width: 100%;
|
||||||
|
min-width: 0;
|
||||||
|
height: 100%;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
background: var(--card-surface);
|
||||||
|
color: var(--card-text);
|
||||||
|
border: 1px solid var(--card-border);
|
||||||
|
border-radius: 8px;
|
||||||
|
overflow: hidden;
|
||||||
|
box-sizing: border-box;
|
||||||
|
font-family: inherit;
|
||||||
|
transition: border-color 150ms ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-card:hover {
|
||||||
|
border-color: #9aad96;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ========================================
|
||||||
|
PRODUCT IMAGE
|
||||||
|
======================================== */
|
||||||
|
|
||||||
|
.jarmark-product-card .jarmark-card-picture {
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 100%;
|
||||||
|
aspect-ratio: 4 / 3;
|
||||||
|
overflow: hidden;
|
||||||
|
background: #edf0e9;
|
||||||
|
border-bottom: 1px solid var(--card-border);
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-card .jarmark-card-picture img {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
max-width: 100%;
|
||||||
|
object-fit: contain;
|
||||||
|
object-position: center;
|
||||||
|
margin: 0;
|
||||||
|
padding: 12px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ========================================
|
||||||
|
IMAGE FALLBACK
|
||||||
|
======================================== */
|
||||||
|
|
||||||
|
.jarmark-product-card .jarmark-card-placeholder {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
min-height: 120px;
|
||||||
|
background: #e6eddf;
|
||||||
|
color: var(--card-primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-card .jarmark-card-placeholder span {
|
||||||
|
display: block;
|
||||||
|
font-size: 48px;
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ========================================
|
||||||
|
CARD CONTENT
|
||||||
|
======================================== */
|
||||||
|
|
||||||
|
.jarmark-product-card .jarmark-card-body {
|
||||||
|
display: flex;
|
||||||
|
flex: 1;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 12px;
|
||||||
|
min-width: 0;
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ========================================
|
||||||
|
CATEGORY
|
||||||
|
======================================== */
|
||||||
|
|
||||||
|
.jarmark-product-card .jarmark-card-category {
|
||||||
|
margin: 0;
|
||||||
|
color: var(--card-muted);
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 500;
|
||||||
|
line-height: 1.4;
|
||||||
|
letter-spacing: normal;
|
||||||
|
text-transform: none;
|
||||||
|
overflow-wrap: anywhere;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ========================================
|
||||||
|
PRODUCT NAME AND DETAIL LINK
|
||||||
|
======================================== */
|
||||||
|
|
||||||
|
.jarmark-product-card .jarmark-card-title {
|
||||||
|
margin: 0;
|
||||||
|
color: var(--card-text);
|
||||||
|
font-family: Georgia, "Times New Roman", serif;
|
||||||
|
font-size: 21px;
|
||||||
|
font-weight: 700;
|
||||||
|
line-height: 1.3;
|
||||||
|
letter-spacing: normal;
|
||||||
|
overflow-wrap: anywhere;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-card .jarmark-card-detail {
|
||||||
|
color: inherit;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-card .jarmark-card-detail:hover {
|
||||||
|
color: var(--card-primary);
|
||||||
|
text-decoration: underline;
|
||||||
|
text-underline-offset: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Celá karta zůstává kliknutelná.
|
||||||
|
Tlačítko košíku má vlastní vrstvu.
|
||||||
|
*/
|
||||||
|
|
||||||
|
.jarmark-product-card .jarmark-card-detail::after {
|
||||||
|
content: "";
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
z-index: 1;
|
||||||
|
border-radius: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-card .jarmark-card-detail:focus-visible::after {
|
||||||
|
outline: 3px solid #527b49;
|
||||||
|
outline-offset: -3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ========================================
|
||||||
|
DESCRIPTION
|
||||||
|
======================================== */
|
||||||
|
|
||||||
|
.jarmark-product-card .jarmark-card-description {
|
||||||
|
display: -webkit-box;
|
||||||
|
-webkit-box-orient: vertical;
|
||||||
|
-webkit-line-clamp: 3;
|
||||||
|
overflow: hidden;
|
||||||
|
overflow-wrap: anywhere;
|
||||||
|
margin: 0;
|
||||||
|
color: var(--card-muted);
|
||||||
|
font-size: 14px;
|
||||||
|
line-height: 1.6;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ========================================
|
||||||
|
STOCK AVAILABILITY
|
||||||
|
======================================== */
|
||||||
|
|
||||||
|
.jarmark-product-card .jarmark-card-stock {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
margin: 4px 0 0;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 600;
|
||||||
|
line-height: 1.4;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-card .jarmark-stock-indicator {
|
||||||
|
display: inline-block;
|
||||||
|
flex-shrink: 0;
|
||||||
|
width: 8px;
|
||||||
|
height: 8px;
|
||||||
|
background: currentColor;
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-card .is-available {
|
||||||
|
color: #34754b;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-card .is-unavailable {
|
||||||
|
color: #93483e;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ========================================
|
||||||
|
PRICE AND ACTIONS
|
||||||
|
======================================== */
|
||||||
|
|
||||||
|
.jarmark-product-card .jarmark-card-actions {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 12px;
|
||||||
|
margin-top: auto;
|
||||||
|
padding-top: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-card .jarmark-card-price {
|
||||||
|
display: flex;
|
||||||
|
align-items: baseline;
|
||||||
|
margin: 0;
|
||||||
|
color: var(--card-primary);
|
||||||
|
font-size: 26px;
|
||||||
|
line-height: 1.2;
|
||||||
|
font-variant-numeric: tabular-nums;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-card .jarmark-card-price strong {
|
||||||
|
font-weight: 750;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ========================================
|
||||||
|
ADD TO CART BUTTON
|
||||||
|
======================================== */
|
||||||
|
|
||||||
|
.jarmark-product-card .jarmark-card-cart {
|
||||||
|
position: relative;
|
||||||
|
z-index: 2;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 8px;
|
||||||
|
width: 100%;
|
||||||
|
min-height: 48px;
|
||||||
|
margin: 0;
|
||||||
|
padding: 12px 16px;
|
||||||
|
background: var(--card-primary);
|
||||||
|
color: #ffffff;
|
||||||
|
border: 1px solid var(--card-primary);
|
||||||
|
border-radius: 6px;
|
||||||
|
font-family: inherit;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 650;
|
||||||
|
line-height: 1.4;
|
||||||
|
text-align: center;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: background-color 150ms ease, border-color 150ms ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-card .jarmark-card-cart svg {
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-card .jarmark-card-cart:not(:disabled):hover {
|
||||||
|
background: var(--card-primary-hover);
|
||||||
|
border-color: var(--card-primary-hover);
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-card .jarmark-card-cart:disabled {
|
||||||
|
background: #e9ece7;
|
||||||
|
color: #59665b;
|
||||||
|
border-color: #dce3d9;
|
||||||
|
opacity: 1;
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-card .jarmark-card-cart:focus-visible {
|
||||||
|
outline: 3px solid #527b49;
|
||||||
|
outline-offset: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ========================================
|
||||||
|
TABLET
|
||||||
|
======================================== */
|
||||||
|
|
||||||
|
@@media (max-width: 1024px) {
|
||||||
|
|
||||||
|
.jarmark-product-card .jarmark-card-body {
|
||||||
|
padding: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-card .jarmark-card-title {
|
||||||
|
font-size: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-card .jarmark-card-price {
|
||||||
|
font-size: 24px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ========================================
|
||||||
|
MOBILE
|
||||||
|
======================================== */
|
||||||
|
|
||||||
|
@@media (max-width: 640px) {
|
||||||
|
|
||||||
|
.jarmark-product-card .jarmark-card-body {
|
||||||
|
gap: 8px;
|
||||||
|
padding: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-card .jarmark-card-title {
|
||||||
|
font-size: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-card .jarmark-card-category {
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-card .jarmark-card-description {
|
||||||
|
font-size: 13px;
|
||||||
|
-webkit-line-clamp: 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-card .jarmark-card-stock {
|
||||||
|
gap: 4px;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-card .jarmark-card-price {
|
||||||
|
font-size: 22px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-card .jarmark-card-cart {
|
||||||
|
min-height: 48px;
|
||||||
|
padding: 12px 8px;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-card .jarmark-card-cart svg {
|
||||||
|
width: 18px;
|
||||||
|
height: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-card .jarmark-card-placeholder span {
|
||||||
|
font-size: 40px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ========================================
|
||||||
|
SINGLE COLUMN MOBILE
|
||||||
|
======================================== */
|
||||||
|
|
||||||
|
@@media (max-width: 480px) {
|
||||||
|
|
||||||
|
.jarmark-product-card .jarmark-card-body {
|
||||||
|
gap: 12px;
|
||||||
|
padding: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-card .jarmark-card-title {
|
||||||
|
font-size: 22px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-card .jarmark-card-description {
|
||||||
|
font-size: 14px;
|
||||||
|
-webkit-line-clamp: 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-card .jarmark-card-category {
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-card .jarmark-card-stock {
|
||||||
|
gap: 8px;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-card .jarmark-card-price {
|
||||||
|
font-size: 26px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jarmark-product-card .jarmark-card-cart {
|
||||||
|
font-size: 15px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ========================================
|
||||||
|
REDUCED MOTION
|
||||||
|
======================================== */
|
||||||
|
|
||||||
|
@@media (prefers-reduced-motion: reduce) {
|
||||||
|
|
||||||
|
.jarmark-product-card,
|
||||||
|
.jarmark-product-card * {
|
||||||
|
animation: none !important;
|
||||||
|
transition: none !important;
|
||||||
|
scroll-behavior: auto !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
|
|
||||||
[Parameter, EditorRequired]
|
[Parameter, EditorRequired]
|
||||||
public Product Product { get; set; } = default!;
|
public Product Product { get; set; } = default!;
|
||||||
|
|
||||||
@@ -72,30 +569,38 @@
|
|||||||
|
|
||||||
private bool imageFailed;
|
private bool imageFailed;
|
||||||
|
|
||||||
|
|
||||||
protected override void OnParametersSet()
|
protected override void OnParametersSet()
|
||||||
{
|
{
|
||||||
imageFailed = false;
|
imageFailed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void HandleImageError()
|
private void HandleImageError()
|
||||||
{
|
{
|
||||||
imageFailed = true;
|
imageFailed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private string ProductIcon =>
|
private string ProductIcon =>
|
||||||
Product.Category?.Name.Contains(
|
Product.Category?.Name.Contains(
|
||||||
"med",
|
"med",
|
||||||
StringComparison.OrdinalIgnoreCase) == true ? "🍯" :
|
StringComparison.OrdinalIgnoreCase) == true ? "🍯" :
|
||||||
|
|
||||||
Product.Category?.Name.Contains(
|
Product.Category?.Name.Contains(
|
||||||
"cuk",
|
"cuk",
|
||||||
StringComparison.OrdinalIgnoreCase) == true ? "🍪" :
|
StringComparison.OrdinalIgnoreCase) == true ? "🍪" :
|
||||||
|
|
||||||
Product.Category?.Name.Contains(
|
Product.Category?.Name.Contains(
|
||||||
"dřev",
|
"dřev",
|
||||||
StringComparison.OrdinalIgnoreCase) == true ? "🪵" :
|
StringComparison.OrdinalIgnoreCase) == true ? "🪵" :
|
||||||
|
|
||||||
"🎁";
|
"🎁";
|
||||||
|
|
||||||
|
|
||||||
private async Task AddToCart()
|
private async Task AddToCart()
|
||||||
{
|
{
|
||||||
await OnAddToCart.InvokeAsync(Product);
|
await OnAddToCart.InvokeAsync(Product);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,39 +1,45 @@
|
|||||||
|
|
||||||
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
|
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Web_Jarmark.Data;
|
|
||||||
using Web_Jarmark.Data.Models;
|
using Web_Jarmark.Data.Models;
|
||||||
|
|
||||||
namespace Web_Jarmark.Data
|
namespace Web_Jarmark.Data
|
||||||
{
|
{
|
||||||
public class ApplicationDbContext(DbContextOptions<ApplicationDbContext> options) : IdentityDbContext<ApplicationUser>(options)
|
public class ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)
|
||||||
|
: IdentityDbContext<ApplicationUser>(options)
|
||||||
{
|
{
|
||||||
public DbSet<Category> Categories { get; set; }
|
public DbSet<Category> Categories { get; set; }
|
||||||
public DbSet<Product> Products { get; set; }
|
public DbSet<Product> Products { get; set; }
|
||||||
public DbSet<Cart> Carts { get; set; }
|
public DbSet<Cart> Carts { get; set; }
|
||||||
public DbSet<CartItem> CartItems { get; set; }
|
public DbSet<CartItem> CartItems { get; set; }
|
||||||
|
|
||||||
|
// Objednávky
|
||||||
|
public DbSet<Order> Orders { get; set; }
|
||||||
|
public DbSet<OrderItem> OrderItems { get; set; }
|
||||||
|
|
||||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||||
{
|
{
|
||||||
base.OnModelCreating(modelBuilder);
|
base.OnModelCreating(modelBuilder);
|
||||||
|
|
||||||
// Nastavení vazby 1:N mezi Category a Product
|
// Kategorie a produkty
|
||||||
modelBuilder.Entity<Category>()
|
modelBuilder.Entity<Category>()
|
||||||
.HasMany(c => c.Products) // Jedna kategorie obsahuje mnoho produktů
|
.HasMany(c => c.Products)
|
||||||
.WithOne(p => p.Category) // Každý produkt patří ke jedné kategorii
|
.WithOne(p => p.Category)
|
||||||
.HasForeignKey(p => p.CategoryId); // Cizí klíč v tabulce Product
|
.HasForeignKey(p => p.CategoryId);
|
||||||
|
|
||||||
// Jeden košík obsahuje více položek
|
// Košík a položky košíku
|
||||||
modelBuilder.Entity<Cart>()
|
modelBuilder.Entity<Cart>()
|
||||||
.HasMany(c => c.CartItems)
|
.HasMany(c => c.CartItems)
|
||||||
.WithOne(ci => ci.Cart)
|
.WithOne(ci => ci.Cart)
|
||||||
.HasForeignKey(ci => ci.CartId);
|
.HasForeignKey(ci => ci.CartId);
|
||||||
|
|
||||||
// Každá položka odkazuje na jeden produkt
|
// Položka košíku odkazuje na produkt
|
||||||
modelBuilder.Entity<CartItem>()
|
modelBuilder.Entity<CartItem>()
|
||||||
.HasOne(ci => ci.Product)
|
.HasOne(ci => ci.Product)
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey(ci => ci.ProductId);
|
.HasForeignKey(ci => ci.ProductId);
|
||||||
|
|
||||||
// Jeden produkt může být v košíku pouze jednou
|
// Produkt může být v košíku pouze jednou
|
||||||
modelBuilder.Entity<CartItem>()
|
modelBuilder.Entity<CartItem>()
|
||||||
.HasIndex(ci => new { ci.CartId, ci.ProductId })
|
.HasIndex(ci => new { ci.CartId, ci.ProductId })
|
||||||
.IsUnique();
|
.IsUnique();
|
||||||
@@ -42,7 +48,25 @@ namespace Web_Jarmark.Data
|
|||||||
modelBuilder.Entity<Cart>()
|
modelBuilder.Entity<Cart>()
|
||||||
.HasIndex(c => c.Token)
|
.HasIndex(c => c.Token)
|
||||||
.IsUnique();
|
.IsUnique();
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// Zachování původních názvů tabulek objednávek
|
||||||
|
modelBuilder.Entity<Order>()
|
||||||
|
.ToTable("Order");
|
||||||
|
|
||||||
|
modelBuilder.Entity<OrderItem>()
|
||||||
|
.ToTable("OrderItem");
|
||||||
|
|
||||||
|
// Objednávka a její položky
|
||||||
|
modelBuilder.Entity<Order>()
|
||||||
|
.HasMany(o => o.OrderItems)
|
||||||
|
.WithOne(oi => oi.Order)
|
||||||
|
.HasForeignKey(oi => oi.OrderId);
|
||||||
|
|
||||||
|
// Položka objednávky odkazuje na produkt
|
||||||
|
modelBuilder.Entity<OrderItem>()
|
||||||
|
.HasOne(oi => oi.Product)
|
||||||
|
.WithMany(p => p.OrderItems)
|
||||||
|
.HasForeignKey(oi => oi.ProductId);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,17 @@
|
|||||||
|
|
||||||
using Microsoft.AspNetCore.Identity;
|
using Microsoft.AspNetCore.Identity;
|
||||||
|
|
||||||
namespace Web_Jarmark.Data
|
namespace Web_Jarmark.Data
|
||||||
{
|
{
|
||||||
// Add profile data for application users by adding properties to the ApplicationUser class
|
|
||||||
public class ApplicationUser : IdentityUser
|
public class ApplicationUser : IdentityUser
|
||||||
{
|
{
|
||||||
}
|
// Jméno uživatele
|
||||||
|
public string? FirstName { get; set; }
|
||||||
|
|
||||||
|
// Příjmení uživatele
|
||||||
|
public string? LastName { get; set; }
|
||||||
|
|
||||||
|
// Datum registrace
|
||||||
|
public DateTime? CreatedAt { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
namespace Web_Jarmark.Data.Models
|
|
||||||
|
namespace Web_Jarmark.Data.Models
|
||||||
{
|
{
|
||||||
public enum OrderStatus
|
public enum OrderStatus
|
||||||
{
|
{
|
||||||
@@ -8,6 +9,7 @@
|
|||||||
Delivered,
|
Delivered,
|
||||||
Cancelled
|
Cancelled
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum PaymentMethod
|
public enum PaymentMethod
|
||||||
{
|
{
|
||||||
CreditCard,
|
CreditCard,
|
||||||
@@ -19,23 +21,36 @@
|
|||||||
public class Order
|
public class Order
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public string Code { get; set; }
|
|
||||||
public OrderStatus Status { get; set; }
|
public string Code { get; set; } =
|
||||||
public string CustomerName { get; set; }
|
Guid.NewGuid().ToString("N")[..8].ToUpper();
|
||||||
public string Email { get; set; }
|
|
||||||
public string Phone { get; set; }
|
// Bezpečný přístup k detailu objednávky
|
||||||
public string Note { get; set; }
|
public string AccessTokenHash { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public OrderStatus Status { get; set; } = OrderStatus.Pending;
|
||||||
|
|
||||||
|
// Původní údaje zachované kvůli databázi
|
||||||
|
public string CustomerName { get; set; } = string.Empty;
|
||||||
|
public string Email { get; set; } = string.Empty;
|
||||||
|
public string Phone { get; set; } = string.Empty;
|
||||||
|
public string Note { get; set; } = string.Empty;
|
||||||
|
|
||||||
public PaymentMethod PreferredPayment { get; set; }
|
public PaymentMethod PreferredPayment { get; set; }
|
||||||
public string PaymentReference { get; set; }
|
|
||||||
|
public string PaymentReference { get; set; } = string.Empty;
|
||||||
|
|
||||||
public decimal TotalAmount { get; set; }
|
public decimal TotalAmount { get; set; }
|
||||||
public DateTime CreatedAt { get; set; }
|
|
||||||
|
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||||
|
|
||||||
public DateTime? ExpiresAt { get; set; }
|
public DateTime? ExpiresAt { get; set; }
|
||||||
public DateTime? PaidAt { get; set; }
|
public DateTime? PaidAt { get; set; }
|
||||||
public DateTime? IssuedAt { get; set; }
|
public DateTime? IssuedAt { get; set; }
|
||||||
public string IssuedByUserId { get; set; }
|
public string IssuedByUserId { get; set; } = string.Empty;
|
||||||
public DateTime? CancelledAt { get; set; }
|
public DateTime? CancelledAt { get; set; }
|
||||||
|
|
||||||
// Navigační vlastnost pro objednávací položky
|
public ICollection<OrderItem> OrderItems { get; set; }
|
||||||
public ICollection<OrderItem> OrderItems { get; set; } = new List<OrderItem>();
|
= new List<OrderItem>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
624
Web-Jarmark/Web-Jarmark/Migrations/20261104173931_AddCreatedAtToUsers.Designer.cs
generated
Normal file
624
Web-Jarmark/Web-Jarmark/Migrations/20261104173931_AddCreatedAtToUsers.Designer.cs
generated
Normal file
@@ -0,0 +1,624 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
using Web_Jarmark.Data;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Web_Jarmark.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(ApplicationDbContext))]
|
||||||
|
[Migration("20261104173931_AddCreatedAtToUsers")]
|
||||||
|
partial class AddCreatedAtToUsers
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder.HasAnnotation("ProductVersion", "10.0.13");
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
|
||||||
|
{
|
||||||
|
b.Property<string>("Id")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("ConcurrencyStamp")
|
||||||
|
.IsConcurrencyToken()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.HasMaxLength(256)
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("NormalizedName")
|
||||||
|
.HasMaxLength(256)
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("NormalizedName")
|
||||||
|
.IsUnique()
|
||||||
|
.HasDatabaseName("RoleNameIndex");
|
||||||
|
|
||||||
|
b.ToTable("AspNetRoles", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("ClaimType")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("ClaimValue")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("RoleId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("RoleId");
|
||||||
|
|
||||||
|
b.ToTable("AspNetRoleClaims", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("ClaimType")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("ClaimValue")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("UserId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("UserId");
|
||||||
|
|
||||||
|
b.ToTable("AspNetUserClaims", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
|
||||||
|
{
|
||||||
|
b.Property<string>("LoginProvider")
|
||||||
|
.HasMaxLength(128)
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("ProviderKey")
|
||||||
|
.HasMaxLength(128)
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("ProviderDisplayName")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("UserId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("LoginProvider", "ProviderKey");
|
||||||
|
|
||||||
|
b.HasIndex("UserId");
|
||||||
|
|
||||||
|
b.ToTable("AspNetUserLogins", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserPasskey<string>", b =>
|
||||||
|
{
|
||||||
|
b.Property<byte[]>("CredentialId")
|
||||||
|
.HasMaxLength(1024)
|
||||||
|
.HasColumnType("BLOB");
|
||||||
|
|
||||||
|
b.Property<string>("UserId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("CredentialId");
|
||||||
|
|
||||||
|
b.HasIndex("UserId");
|
||||||
|
|
||||||
|
b.ToTable("AspNetUserPasskeys", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
|
||||||
|
{
|
||||||
|
b.Property<string>("UserId")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("RoleId")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("UserId", "RoleId");
|
||||||
|
|
||||||
|
b.HasIndex("RoleId");
|
||||||
|
|
||||||
|
b.ToTable("AspNetUserRoles", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
|
||||||
|
{
|
||||||
|
b.Property<string>("UserId")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("LoginProvider")
|
||||||
|
.HasMaxLength(128)
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.HasMaxLength(128)
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Value")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("UserId", "LoginProvider", "Name");
|
||||||
|
|
||||||
|
b.ToTable("AspNetUserTokens", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Web_Jarmark.Data.ApplicationUser", b =>
|
||||||
|
{
|
||||||
|
b.Property<string>("Id")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int>("AccessFailedCount")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("ConcurrencyStamp")
|
||||||
|
.IsConcurrencyToken()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("CreatedAt")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Email")
|
||||||
|
.HasMaxLength(256)
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<bool>("EmailConfirmed")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("FirstName")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("LastName")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<bool>("LockoutEnabled")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<DateTimeOffset?>("LockoutEnd")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("NormalizedEmail")
|
||||||
|
.HasMaxLength(256)
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("NormalizedUserName")
|
||||||
|
.HasMaxLength(256)
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("PasswordHash")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("PhoneNumber")
|
||||||
|
.HasMaxLength(256)
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<bool>("PhoneNumberConfirmed")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("SecurityStamp")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<bool>("TwoFactorEnabled")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("UserName")
|
||||||
|
.HasMaxLength(256)
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("NormalizedEmail")
|
||||||
|
.HasDatabaseName("EmailIndex");
|
||||||
|
|
||||||
|
b.HasIndex("NormalizedUserName")
|
||||||
|
.IsUnique()
|
||||||
|
.HasDatabaseName("UserNameIndex");
|
||||||
|
|
||||||
|
b.ToTable("AspNetUsers", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Web_Jarmark.Data.Models.Cart", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreatedAt")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Token")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<DateTime>("UpdatedAt")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("Token")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
|
b.ToTable("Carts");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Web_Jarmark.Data.Models.CartItem", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("CartId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("ProductId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("Quantity")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ProductId");
|
||||||
|
|
||||||
|
b.HasIndex("CartId", "ProductId")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
|
b.ToTable("CartItems");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Web_Jarmark.Data.Models.Category", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<bool>("IsActive")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Slug")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Categories");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Web_Jarmark.Data.Models.Order", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("CancelledAt")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Code")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreatedAt")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("CustomerName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Email")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("ExpiresAt")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("IssuedAt")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("IssuedByUserId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Note")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("PaidAt")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("PaymentReference")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Phone")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int>("PreferredPayment")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("Status")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<decimal>("TotalAmount")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Order");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Web_Jarmark.Data.Models.OrderItem", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("OrderId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("ProductId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("ProductName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int>("Quantity")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<decimal>("UnitPrice")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("OrderId");
|
||||||
|
|
||||||
|
b.HasIndex("ProductId");
|
||||||
|
|
||||||
|
b.ToTable("OrderItem");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Web_Jarmark.Data.Models.Product", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("CategoryId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Description")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("ImageUrl")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<bool>("IsVisible")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<decimal>("Price")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int>("StockQuantity")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<DateTime>("UpdatedAt")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("CategoryId");
|
||||||
|
|
||||||
|
b.ToTable("Products");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("RoleId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Web_Jarmark.Data.ApplicationUser", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("UserId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Web_Jarmark.Data.ApplicationUser", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("UserId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserPasskey<string>", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Web_Jarmark.Data.ApplicationUser", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("UserId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.OwnsOne("Microsoft.AspNetCore.Identity.IdentityPasskeyData", "Data", b1 =>
|
||||||
|
{
|
||||||
|
b1.Property<byte[]>("IdentityUserPasskeyCredentialId");
|
||||||
|
|
||||||
|
b1.Property<byte[]>("AttestationObject")
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b1.Property<byte[]>("ClientDataJson")
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b1.Property<DateTimeOffset>("CreatedAt");
|
||||||
|
|
||||||
|
b1.Property<bool>("IsBackedUp");
|
||||||
|
|
||||||
|
b1.Property<bool>("IsBackupEligible");
|
||||||
|
|
||||||
|
b1.Property<bool>("IsUserVerified");
|
||||||
|
|
||||||
|
b1.Property<string>("Name");
|
||||||
|
|
||||||
|
b1.Property<byte[]>("PublicKey")
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b1.Property<uint>("SignCount");
|
||||||
|
|
||||||
|
b1.PrimitiveCollection<string>("Transports");
|
||||||
|
|
||||||
|
b1.HasKey("IdentityUserPasskeyCredentialId");
|
||||||
|
|
||||||
|
b1.ToTable("AspNetUserPasskeys");
|
||||||
|
|
||||||
|
b1
|
||||||
|
.ToJson("Data")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b1.WithOwner()
|
||||||
|
.HasForeignKey("IdentityUserPasskeyCredentialId");
|
||||||
|
});
|
||||||
|
|
||||||
|
b.Navigation("Data")
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("RoleId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("Web_Jarmark.Data.ApplicationUser", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("UserId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Web_Jarmark.Data.ApplicationUser", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("UserId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Web_Jarmark.Data.Models.CartItem", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Web_Jarmark.Data.Models.Cart", "Cart")
|
||||||
|
.WithMany("CartItems")
|
||||||
|
.HasForeignKey("CartId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("Web_Jarmark.Data.Models.Product", "Product")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ProductId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Cart");
|
||||||
|
|
||||||
|
b.Navigation("Product");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Web_Jarmark.Data.Models.OrderItem", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Web_Jarmark.Data.Models.Order", "Order")
|
||||||
|
.WithMany("OrderItems")
|
||||||
|
.HasForeignKey("OrderId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("Web_Jarmark.Data.Models.Product", "Product")
|
||||||
|
.WithMany("OrderItems")
|
||||||
|
.HasForeignKey("ProductId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Order");
|
||||||
|
|
||||||
|
b.Navigation("Product");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Web_Jarmark.Data.Models.Product", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Web_Jarmark.Data.Models.Category", "Category")
|
||||||
|
.WithMany("Products")
|
||||||
|
.HasForeignKey("CategoryId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Category");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Web_Jarmark.Data.Models.Cart", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("CartItems");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Web_Jarmark.Data.Models.Category", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Products");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Web_Jarmark.Data.Models.Order", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("OrderItems");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Web_Jarmark.Data.Models.Product", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("OrderItems");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Web_Jarmark.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class AddCreatedAtToUsers : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<DateTime>(
|
||||||
|
name: "CreatedAt",
|
||||||
|
table: "AspNetUsers",
|
||||||
|
type: "TEXT",
|
||||||
|
nullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "FirstName",
|
||||||
|
table: "AspNetUsers",
|
||||||
|
type: "TEXT",
|
||||||
|
nullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "LastName",
|
||||||
|
table: "AspNetUsers",
|
||||||
|
type: "TEXT",
|
||||||
|
nullable: true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "CreatedAt",
|
||||||
|
table: "AspNetUsers");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "FirstName",
|
||||||
|
table: "AspNetUsers");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "LastName",
|
||||||
|
table: "AspNetUsers");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
628
Web-Jarmark/Web-Jarmark/Migrations/20261106180726_AddOrderAccessTokenHash.Designer.cs
generated
Normal file
628
Web-Jarmark/Web-Jarmark/Migrations/20261106180726_AddOrderAccessTokenHash.Designer.cs
generated
Normal file
@@ -0,0 +1,628 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
using Web_Jarmark.Data;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Web_Jarmark.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(ApplicationDbContext))]
|
||||||
|
[Migration("20261106180726_AddOrderAccessTokenHash")]
|
||||||
|
partial class AddOrderAccessTokenHash
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder.HasAnnotation("ProductVersion", "10.0.13");
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
|
||||||
|
{
|
||||||
|
b.Property<string>("Id")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("ConcurrencyStamp")
|
||||||
|
.IsConcurrencyToken()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.HasMaxLength(256)
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("NormalizedName")
|
||||||
|
.HasMaxLength(256)
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("NormalizedName")
|
||||||
|
.IsUnique()
|
||||||
|
.HasDatabaseName("RoleNameIndex");
|
||||||
|
|
||||||
|
b.ToTable("AspNetRoles", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("ClaimType")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("ClaimValue")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("RoleId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("RoleId");
|
||||||
|
|
||||||
|
b.ToTable("AspNetRoleClaims", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("ClaimType")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("ClaimValue")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("UserId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("UserId");
|
||||||
|
|
||||||
|
b.ToTable("AspNetUserClaims", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
|
||||||
|
{
|
||||||
|
b.Property<string>("LoginProvider")
|
||||||
|
.HasMaxLength(128)
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("ProviderKey")
|
||||||
|
.HasMaxLength(128)
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("ProviderDisplayName")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("UserId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("LoginProvider", "ProviderKey");
|
||||||
|
|
||||||
|
b.HasIndex("UserId");
|
||||||
|
|
||||||
|
b.ToTable("AspNetUserLogins", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserPasskey<string>", b =>
|
||||||
|
{
|
||||||
|
b.Property<byte[]>("CredentialId")
|
||||||
|
.HasMaxLength(1024)
|
||||||
|
.HasColumnType("BLOB");
|
||||||
|
|
||||||
|
b.Property<string>("UserId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("CredentialId");
|
||||||
|
|
||||||
|
b.HasIndex("UserId");
|
||||||
|
|
||||||
|
b.ToTable("AspNetUserPasskeys", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
|
||||||
|
{
|
||||||
|
b.Property<string>("UserId")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("RoleId")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("UserId", "RoleId");
|
||||||
|
|
||||||
|
b.HasIndex("RoleId");
|
||||||
|
|
||||||
|
b.ToTable("AspNetUserRoles", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
|
||||||
|
{
|
||||||
|
b.Property<string>("UserId")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("LoginProvider")
|
||||||
|
.HasMaxLength(128)
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.HasMaxLength(128)
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Value")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("UserId", "LoginProvider", "Name");
|
||||||
|
|
||||||
|
b.ToTable("AspNetUserTokens", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Web_Jarmark.Data.ApplicationUser", b =>
|
||||||
|
{
|
||||||
|
b.Property<string>("Id")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int>("AccessFailedCount")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("ConcurrencyStamp")
|
||||||
|
.IsConcurrencyToken()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("CreatedAt")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Email")
|
||||||
|
.HasMaxLength(256)
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<bool>("EmailConfirmed")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("FirstName")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("LastName")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<bool>("LockoutEnabled")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<DateTimeOffset?>("LockoutEnd")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("NormalizedEmail")
|
||||||
|
.HasMaxLength(256)
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("NormalizedUserName")
|
||||||
|
.HasMaxLength(256)
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("PasswordHash")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("PhoneNumber")
|
||||||
|
.HasMaxLength(256)
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<bool>("PhoneNumberConfirmed")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("SecurityStamp")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<bool>("TwoFactorEnabled")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("UserName")
|
||||||
|
.HasMaxLength(256)
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("NormalizedEmail")
|
||||||
|
.HasDatabaseName("EmailIndex");
|
||||||
|
|
||||||
|
b.HasIndex("NormalizedUserName")
|
||||||
|
.IsUnique()
|
||||||
|
.HasDatabaseName("UserNameIndex");
|
||||||
|
|
||||||
|
b.ToTable("AspNetUsers", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Web_Jarmark.Data.Models.Cart", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreatedAt")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Token")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<DateTime>("UpdatedAt")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("Token")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
|
b.ToTable("Carts");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Web_Jarmark.Data.Models.CartItem", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("CartId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("ProductId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("Quantity")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ProductId");
|
||||||
|
|
||||||
|
b.HasIndex("CartId", "ProductId")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
|
b.ToTable("CartItems");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Web_Jarmark.Data.Models.Category", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<bool>("IsActive")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Slug")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Categories");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Web_Jarmark.Data.Models.Order", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("AccessTokenHash")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("CancelledAt")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Code")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreatedAt")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("CustomerName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Email")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("ExpiresAt")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("IssuedAt")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("IssuedByUserId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Note")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("PaidAt")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("PaymentReference")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Phone")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int>("PreferredPayment")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("Status")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<decimal>("TotalAmount")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Order", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Web_Jarmark.Data.Models.OrderItem", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("OrderId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("ProductId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("ProductName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int>("Quantity")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<decimal>("UnitPrice")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("OrderId");
|
||||||
|
|
||||||
|
b.HasIndex("ProductId");
|
||||||
|
|
||||||
|
b.ToTable("OrderItem", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Web_Jarmark.Data.Models.Product", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("CategoryId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Description")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("ImageUrl")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<bool>("IsVisible")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<decimal>("Price")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int>("StockQuantity")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<DateTime>("UpdatedAt")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("CategoryId");
|
||||||
|
|
||||||
|
b.ToTable("Products");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("RoleId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Web_Jarmark.Data.ApplicationUser", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("UserId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Web_Jarmark.Data.ApplicationUser", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("UserId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserPasskey<string>", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Web_Jarmark.Data.ApplicationUser", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("UserId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.OwnsOne("Microsoft.AspNetCore.Identity.IdentityPasskeyData", "Data", b1 =>
|
||||||
|
{
|
||||||
|
b1.Property<byte[]>("IdentityUserPasskeyCredentialId");
|
||||||
|
|
||||||
|
b1.Property<byte[]>("AttestationObject")
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b1.Property<byte[]>("ClientDataJson")
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b1.Property<DateTimeOffset>("CreatedAt");
|
||||||
|
|
||||||
|
b1.Property<bool>("IsBackedUp");
|
||||||
|
|
||||||
|
b1.Property<bool>("IsBackupEligible");
|
||||||
|
|
||||||
|
b1.Property<bool>("IsUserVerified");
|
||||||
|
|
||||||
|
b1.Property<string>("Name");
|
||||||
|
|
||||||
|
b1.Property<byte[]>("PublicKey")
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b1.Property<uint>("SignCount");
|
||||||
|
|
||||||
|
b1.PrimitiveCollection<string>("Transports");
|
||||||
|
|
||||||
|
b1.HasKey("IdentityUserPasskeyCredentialId");
|
||||||
|
|
||||||
|
b1.ToTable("AspNetUserPasskeys");
|
||||||
|
|
||||||
|
b1
|
||||||
|
.ToJson("Data")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b1.WithOwner()
|
||||||
|
.HasForeignKey("IdentityUserPasskeyCredentialId");
|
||||||
|
});
|
||||||
|
|
||||||
|
b.Navigation("Data")
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("RoleId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("Web_Jarmark.Data.ApplicationUser", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("UserId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Web_Jarmark.Data.ApplicationUser", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("UserId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Web_Jarmark.Data.Models.CartItem", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Web_Jarmark.Data.Models.Cart", "Cart")
|
||||||
|
.WithMany("CartItems")
|
||||||
|
.HasForeignKey("CartId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("Web_Jarmark.Data.Models.Product", "Product")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ProductId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Cart");
|
||||||
|
|
||||||
|
b.Navigation("Product");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Web_Jarmark.Data.Models.OrderItem", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Web_Jarmark.Data.Models.Order", "Order")
|
||||||
|
.WithMany("OrderItems")
|
||||||
|
.HasForeignKey("OrderId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("Web_Jarmark.Data.Models.Product", "Product")
|
||||||
|
.WithMany("OrderItems")
|
||||||
|
.HasForeignKey("ProductId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Order");
|
||||||
|
|
||||||
|
b.Navigation("Product");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Web_Jarmark.Data.Models.Product", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Web_Jarmark.Data.Models.Category", "Category")
|
||||||
|
.WithMany("Products")
|
||||||
|
.HasForeignKey("CategoryId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Category");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Web_Jarmark.Data.Models.Cart", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("CartItems");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Web_Jarmark.Data.Models.Category", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Products");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Web_Jarmark.Data.Models.Order", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("OrderItems");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Web_Jarmark.Data.Models.Product", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("OrderItems");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Web_Jarmark.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class AddOrderAccessTokenHash : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "AccessTokenHash",
|
||||||
|
table: "Order",
|
||||||
|
type: "TEXT",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: "");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "AccessTokenHash",
|
||||||
|
table: "Order");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -178,6 +178,9 @@ namespace Web_Jarmark.Migrations
|
|||||||
.IsConcurrencyToken()
|
.IsConcurrencyToken()
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("CreatedAt")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
b.Property<string>("Email")
|
b.Property<string>("Email")
|
||||||
.HasMaxLength(256)
|
.HasMaxLength(256)
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
@@ -185,6 +188,12 @@ namespace Web_Jarmark.Migrations
|
|||||||
b.Property<bool>("EmailConfirmed")
|
b.Property<bool>("EmailConfirmed")
|
||||||
.HasColumnType("INTEGER");
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("FirstName")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("LastName")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
b.Property<bool>("LockoutEnabled")
|
b.Property<bool>("LockoutEnabled")
|
||||||
.HasColumnType("INTEGER");
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
@@ -308,6 +317,10 @@ namespace Web_Jarmark.Migrations
|
|||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("INTEGER");
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("AccessTokenHash")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
b.Property<DateTime?>("CancelledAt")
|
b.Property<DateTime?>("CancelledAt")
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
@@ -362,7 +375,7 @@ namespace Web_Jarmark.Migrations
|
|||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.ToTable("Order");
|
b.ToTable("Order", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Web_Jarmark.Data.Models.OrderItem", b =>
|
modelBuilder.Entity("Web_Jarmark.Data.Models.OrderItem", b =>
|
||||||
@@ -393,7 +406,7 @@ namespace Web_Jarmark.Migrations
|
|||||||
|
|
||||||
b.HasIndex("ProductId");
|
b.HasIndex("ProductId");
|
||||||
|
|
||||||
b.ToTable("OrderItem");
|
b.ToTable("OrderItem", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Web_Jarmark.Data.Models.Product", b =>
|
modelBuilder.Entity("Web_Jarmark.Data.Models.Product", b =>
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
using Microsoft.AspNetCore.Components.Authorization;
|
using Microsoft.AspNetCore.Components.Authorization;
|
||||||
using Microsoft.AspNetCore.Identity;
|
using Microsoft.AspNetCore.Identity;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
@@ -7,40 +8,64 @@ using Web_Jarmark.Data;
|
|||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
|
||||||
// Add services to the container.
|
|
||||||
builder.Services.AddRazorComponents()
|
builder.Services.AddRazorComponents()
|
||||||
.AddInteractiveServerComponents();
|
.AddInteractiveServerComponents();
|
||||||
|
|
||||||
|
builder.Services.AddAuthorization();
|
||||||
builder.Services.AddCascadingAuthenticationState();
|
builder.Services.AddCascadingAuthenticationState();
|
||||||
|
|
||||||
builder.Services.AddScoped<IdentityRedirectManager>();
|
builder.Services.AddScoped<IdentityRedirectManager>();
|
||||||
builder.Services.AddScoped<AuthenticationStateProvider, IdentityRevalidatingAuthenticationStateProvider>();
|
builder.Services.AddScoped<AuthenticationStateProvider, IdentityRevalidatingAuthenticationStateProvider>();
|
||||||
|
|
||||||
builder.Services.AddAuthentication(options =>
|
builder.Services.AddAuthentication(options =>
|
||||||
{
|
{
|
||||||
options.DefaultScheme = IdentityConstants.ApplicationScheme;
|
options.DefaultScheme = IdentityConstants.ApplicationScheme;
|
||||||
options.DefaultSignInScheme = IdentityConstants.ExternalScheme;
|
options.DefaultSignInScheme = IdentityConstants.ExternalScheme;
|
||||||
})
|
})
|
||||||
.AddIdentityCookies();
|
.AddIdentityCookies();
|
||||||
|
|
||||||
|
var connectionString = builder.Configuration.GetConnectionString("DefaultConnection")
|
||||||
|
?? throw new InvalidOperationException("Connection string 'DefaultConnection' not found.");
|
||||||
|
|
||||||
var connectionString = builder.Configuration.GetConnectionString("DefaultConnection") ?? throw new InvalidOperationException("Connection string 'DefaultConnection' not found.");
|
|
||||||
builder.Services.AddDbContext<ApplicationDbContext>(options =>
|
builder.Services.AddDbContext<ApplicationDbContext>(options =>
|
||||||
options.UseSqlite(connectionString));
|
options.UseSqlite(connectionString));
|
||||||
|
|
||||||
builder.Services.AddDatabaseDeveloperPageExceptionFilter();
|
builder.Services.AddDatabaseDeveloperPageExceptionFilter();
|
||||||
|
|
||||||
builder.Services.AddIdentityCore<ApplicationUser>(options =>
|
builder.Services.AddIdentityCore<ApplicationUser>(options =>
|
||||||
{
|
{
|
||||||
options.SignIn.RequireConfirmedAccount = true;
|
options.SignIn.RequireConfirmedAccount = true;
|
||||||
options.Stores.SchemaVersion = IdentitySchemaVersions.Version3;
|
options.Stores.SchemaVersion = IdentitySchemaVersions.Version3;
|
||||||
})
|
})
|
||||||
|
.AddRoles<IdentityRole>()
|
||||||
.AddEntityFrameworkStores<ApplicationDbContext>()
|
.AddEntityFrameworkStores<ApplicationDbContext>()
|
||||||
.AddSignInManager()
|
.AddSignInManager()
|
||||||
.AddDefaultTokenProviders();
|
.AddDefaultTokenProviders();
|
||||||
|
|
||||||
builder.Services.AddSingleton<IEmailSender<ApplicationUser>, IdentityNoOpEmailSender>();
|
builder.Services.AddSingleton<IEmailSender<ApplicationUser>, IdentityNoOpEmailSender>();
|
||||||
builder.Services.AddHttpContextAccessor();
|
builder.Services.AddHttpContextAccessor();
|
||||||
|
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
|
|
||||||
// Configure the HTTP request pipeline.
|
// Vytvoření role Admin, pokud ještě neexistuje
|
||||||
|
using (var scope = app.Services.CreateScope())
|
||||||
|
{
|
||||||
|
var roleManager = scope.ServiceProvider
|
||||||
|
.GetRequiredService<RoleManager<IdentityRole>>();
|
||||||
|
|
||||||
|
if (!await roleManager.RoleExistsAsync("Admin"))
|
||||||
|
{
|
||||||
|
var result = await roleManager.CreateAsync(new IdentityRole("Admin"));
|
||||||
|
|
||||||
|
if (!result.Succeeded)
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException(
|
||||||
|
"Nepodařilo se vytvořit roli Admin: "
|
||||||
|
+ string.Join(", ", result.Errors.Select(e => e.Description)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (app.Environment.IsDevelopment())
|
if (app.Environment.IsDevelopment())
|
||||||
{
|
{
|
||||||
app.UseMigrationsEndPoint();
|
app.UseMigrationsEndPoint();
|
||||||
@@ -48,12 +73,15 @@ if (app.Environment.IsDevelopment())
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
app.UseExceptionHandler("/Error", createScopeForErrors: true);
|
app.UseExceptionHandler("/Error", createScopeForErrors: true);
|
||||||
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
|
|
||||||
app.UseHsts();
|
app.UseHsts();
|
||||||
}
|
}
|
||||||
|
|
||||||
app.UseStatusCodePagesWithReExecute("/not-found", createScopeForStatusCodePages: true);
|
app.UseStatusCodePagesWithReExecute("/not-found", createScopeForStatusCodePages: true);
|
||||||
app.UseHttpsRedirection();
|
app.UseHttpsRedirection();
|
||||||
|
|
||||||
|
app.UseAuthentication();
|
||||||
|
app.UseAuthorization();
|
||||||
|
|
||||||
app.Use(async (context, next) =>
|
app.Use(async (context, next) =>
|
||||||
{
|
{
|
||||||
const string cookieName = "CartToken";
|
const string cookieName = "CartToken";
|
||||||
@@ -73,16 +101,18 @@ app.Use(async (context, next) =>
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
context.Items["CartToken"] = token;
|
||||||
|
|
||||||
await next();
|
await next();
|
||||||
});
|
});
|
||||||
|
|
||||||
app.UseAntiforgery();
|
app.UseAntiforgery();
|
||||||
|
|
||||||
app.MapStaticAssets();
|
app.MapStaticAssets();
|
||||||
|
|
||||||
app.MapRazorComponents<App>()
|
app.MapRazorComponents<App>()
|
||||||
.AddInteractiveServerRenderMode();
|
.AddInteractiveServerRenderMode();
|
||||||
|
|
||||||
// Add additional endpoints required by the Identity /Account Razor components.
|
|
||||||
app.MapAdditionalIdentityEndpoints();
|
app.MapAdditionalIdentityEndpoints();
|
||||||
|
|
||||||
app.Run();
|
app.Run();
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user