8 Commits

Author SHA1 Message Date
khwezi 4470c2cdb2 Merge pull request 'Generalised datetime picker into component for reuse' (#21) from products into master
Reviewed-on: #21
2026-05-20 17:14:48 +02:00
Khwezi Mngoma 84a50e64bf Generalised datetime picker into component for reuse
continuous-integration/drone/pr Build is passing
2026-05-20 17:14:11 +02:00
khwezi 66081eead5 Merge pull request 'Added image deletion functionality to product creation' (#20) from products into master
Reviewed-on: #20
2026-05-20 16:12:55 +02:00
Khwezi Mngoma 530b8ffea2 Added image deletion functionality to product creation
continuous-integration/drone/pr Build is passing
2026-05-20 16:12:10 +02:00
khwezi b8a5d81856 Merge pull request 'Fixed manifest ev variable reference syntax' (#19) from products into master
Reviewed-on: #19
2026-05-20 13:42:27 +02:00
Khwezi Mngoma 5c34663617 Fixed manifest ev variable reference syntax
continuous-integration/drone/pr Build is passing
2026-05-20 13:41:31 +02:00
khwezi 184ce1854e Merge pull request 'Completed create product component' (#18) from products into master
Reviewed-on: #18
2026-05-20 12:02:14 +02:00
Khwezi Mngoma 8f26d5fbfa Completed create product component
continuous-integration/drone/pr Build is failing
2026-05-20 11:59:58 +02:00
9 changed files with 997 additions and 274 deletions
@@ -0,0 +1,100 @@
<div class="custom-date-trigger-box @(isCalendarOpen ? "focused" : "")" @onclick="ToggleCalendar">
<span>@Value.ToString("yyyy / MM / dd")</span>
<i class="bi bi-calendar3 calendar-icon"></i>
</div>
@if (isCalendarOpen)
{
<div class="brand-calendar-popup">
<div class="calendar-nav-header">
<button type="button" class="btn-cal-nav" @onclick="NavigateMonthPrevious">&lt;</button>
<span class="calendar-current-month">@currentMonthDisplay.ToString("MMMM yyyy")</span>
<button type="button" class="btn-cal-nav" @onclick="NavigateMonthNext">&gt;</button>
</div>
<div class="calendar-days-grid-header">
<div>Su</div><div>Mo</div><div>Tu</div><div>We</div><div>Th</div><div>Fr</div><div>Sa</div>
</div>
<div class="calendar-days-matrix">
@foreach (var day in paddingDays)
{
<div class="calendar-day-blank"></div>
}
@foreach (var day in currentMonthDays)
{
var loopDay = day;
<button type="button"
class="calendar-day-btn @(IsToday(loopDay) ? "is-today" : "") @(IsSelected(loopDay) ? "is-selected" : "")"
@onclick="() => SelectDate(loopDay)">
@loopDay.Day
</button>
}
</div>
</div>
}
@code {
[Parameter]
public DateTime Value { get; set; } = DateTime.Today;
[Parameter]
public EventCallback<DateTime> ValueChanged { get; set; }
private bool isCalendarOpen = false;
private DateTime currentMonthDisplay;
private List<DateTime> paddingDays = new();
private List<DateTime> currentMonthDays = new();
protected override void OnParametersSet()
{
if (currentMonthDisplay == DateTime.MinValue)
{
currentMonthDisplay = new DateTime(Value.Year, Value.Month, 1);
GenerateCalendarMatrix();
}
}
private void ToggleCalendar() => isCalendarOpen = !isCalendarOpen;
private async Task SelectDate(DateTime date)
{
Value = date;
isCalendarOpen = false;
await ValueChanged.InvokeAsync(Value);
}
private void NavigateMonthPrevious()
{
currentMonthDisplay = currentMonthDisplay.AddMonths(-1);
GenerateCalendarMatrix();
}
private void NavigateMonthNext()
{
currentMonthDisplay = currentMonthDisplay.AddMonths(1);
GenerateCalendarMatrix();
}
private void GenerateCalendarMatrix()
{
currentMonthDays.Clear();
paddingDays.Clear();
int daysInMonth = DateTime.DaysInMonth(currentMonthDisplay.Year, currentMonthDisplay.Month);
DayOfWeek firstDayOfWeek = currentMonthDisplay.DayOfWeek;
for (int i = 0; i < (int)firstDayOfWeek; i++)
{
paddingDays.Add(DateTime.MinValue);
}
for (int day = 1; day <= daysInMonth; day++)
{
currentMonthDays.Add(new DateTime(currentMonthDisplay.Year, currentMonthDisplay.Month, day));
}
}
private bool IsToday(DateTime date) => date.Date == DateTime.Today;
private bool IsSelected(DateTime date) => date.Date == Value.Date;
}
@@ -0,0 +1,124 @@
/* Custom Date Trigger and Box Engines only */
.custom-date-trigger-box {
width: 100%;
box-sizing: border-box;
background: #060b13 !important;
border: 1px solid #1e293b !important;
border-radius: 4px;
padding: 0.85rem 1rem;
color: #f8fafc !important;
font-size: 0.9rem;
outline: none;
transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
display: flex;
justify-content: space-between;
align-items: center;
cursor: pointer;
}
.custom-date-trigger-box.focused {
border-color: #00f2fe !important;
box-shadow: 0 0 0 1px rgba(0, 242, 254, 0.2), 0 0 12px rgba(0, 242, 254, 0.1) !important;
background: #02060d !important;
}
.calendar-icon {
color: #64748b;
flex-shrink: 0;
}
/* Floating Overlay Window Panel Layout */
.brand-calendar-popup {
position: absolute;
top: 100%;
left: 0;
z-index: 1000;
width: 100% !important;
box-sizing: border-box;
padding: 1rem;
background-color: #0b0f19;
border: 1px solid #1e293b;
border-radius: 6px;
box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
margin-top: 0.5rem;
}
.calendar-nav-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 0.75rem;
}
.calendar-current-month {
font-size: 0.85rem;
font-weight: 600;
color: #f1f5f9;
font-family: monospace;
}
.btn-cal-nav {
background: transparent;
border: none;
color: #94a3b8;
font-size: 0.9rem;
cursor: pointer;
padding: 0.2rem 0.5rem;
border-radius: 4px;
transition: background-color 0.1s;
}
.btn-cal-nav:hover {
background-color: #1e293b;
color: #f8fafc;
}
.calendar-days-grid-header {
display: grid;
grid-template-columns: repeat(7, 1fr);
text-align: center;
font-size: 0.7rem;
font-weight: 700;
color: #475569;
text-transform: uppercase;
margin-bottom: 0.5rem;
}
.calendar-days-matrix {
display: grid;
grid-template-columns: repeat(7, 1fr);
gap: 2px;
}
.calendar-day-blank {
padding: 0.4rem 0;
}
.calendar-day-btn {
background: transparent;
border: none;
color: #cbd5e1;
font-size: 0.8rem;
padding: 0.4rem 0;
text-align: center;
cursor: pointer;
border-radius: 4px;
font-family: monospace;
transition: all 0.1s ease;
}
.calendar-day-btn:hover {
background-color: #1e293b;
color: #ffffff;
}
.calendar-day-btn.is-today {
color: #00f2fe;
font-weight: 700;
}
.calendar-day-btn.is-selected {
background-color: #0284c7 !important;
color: #ffffff !important;
font-weight: 700;
}
+147 -94
View File
@@ -1,119 +1,172 @@
@using Microsoft.AspNetCore.Components.Forms @using Microsoft.AspNetCore.Components.Forms
<div class="create-product-container"> <div class="create-product-shell">
<EditForm Model="@ProductModel" OnValidSubmit="HandleValidSubmit" class="form-entry-canvas">
<DataAnnotationsValidator />
<div class="form-scroll-viewport"> <div class="book-preview-drawer @(string.IsNullOrEmpty(ActivePreviewUrl) ? "" : "is-open")">
<div class="form-section-header"> @if (!string.IsNullOrEmpty(ActivePreviewUrl))
<span class="panel-title-lbl field-accent-tag">Initialization Sequence</span> {
<p class="text-muted">Register a new asset node into the core product catalog matrix.</p> <button type="button" class="btn-close-preview-floating" title="Collapse Frame" @onclick="ClosePreviewDrawer">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<line x1="18" y1="6" x2="6" y2="18"></line>
<line x1="6" y1="6" x2="18" y2="18"></line>
</svg>
</button>
<div class="drawer-portrait-frame">
<img src="@ActivePreviewUrl" alt="Active Book Design Preview" />
</div> </div>
}
</div>
<div class="form-grid-layout"> <div class="create-product-container">
<EditForm Model="@ProductModel" OnValidSubmit="HandleValidSubmit" class="form-entry-canvas">
<DataAnnotationsValidator />
<div class="form-column"> <div class="form-scroll-viewport">
<div class="form-section-header">
<span class="field-accent-tag">PRODUCT MASTER LEDGER</span>
<p>Provision catalog items metadata, book cover assets, and supplementary chapter telemetry designs.</p>
</div>
<div class="form-text-inputs-section">
<div class="console-field-group"> <div class="console-field-group">
<label class="console-field-label">Product Name</label> <label class="console-field-label">Book Title</label>
<InputText @bind-Value="ProductModel.Name" placeholder="e.g., Quantum Link Core Subsystem" class="console-input" /> <InputText @bind-Value="ProductModel.Name" class="console-input" placeholder="e.g., Neuromancer" />
<ValidationMessage For="@(() => ProductModel.Name)" style="color: #ff5722; font-size: 0.75rem;" />
</div> </div>
<div class="console-field-group"> <div class="console-field-group">
<label class="console-field-label">Telemetry Short Summary</label> <label class="console-field-label">Short Summary</label>
<InputText @bind-Value="ProductModel.Summary" placeholder="Brief technical summary tooltip description..." class="console-input" /> <InputText @bind-Value="ProductModel.Summary" class="console-input" placeholder="Brief catchphrase description metadata line..." />
<ValidationMessage For="@(() => ProductModel.Summary)" style="color: #ff5722; font-size: 0.75rem;" />
</div>
<div class="console-field-row">
<div class="console-field-group">
<label class="console-field-label">Base Ledger Price (ZAR)</label>
<InputNumber @bind-Value="ProductModel.Price" class="console-input" placeholder="0.00" />
<ValidationMessage For="@(() => ProductModel.Price)" style="color: #ff5722; font-size: 0.75rem;" />
</div>
<div class="console-field-group">
<label class="console-field-label">ISBN Reference</label>
<InputText @bind-Value="ProductModel.Isbn" class="console-input" placeholder="e.g., 978-0393312836" />
<ValidationMessage For="@(() => ProductModel.Isbn)" style="color: #ff5722; font-size: 0.75rem;" />
</div>
</div>
<div class="console-field-row">
<div class="console-field-group">
<label class="console-field-label">Author / Creator</label>
<InputText @bind-Value="ProductModel.Author" class="console-input" placeholder="e.g., William Gibson" />
<ValidationMessage For="@(() => ProductModel.Author)" style="color: #ff5722; font-size: 0.75rem;" />
</div>
<div class="console-field-group">
<label class="console-field-label">Date of Publication</label>
<ConsoleDatePicker @bind-Value="ProductModel.PublishDate" />
</div>
</div> </div>
<div class="console-field-group"> <div class="console-field-group">
<label class="console-field-label">Deep System Description</label> <label class="console-field-label">Copyright Information</label>
<InputTextArea @bind-Value="ProductModel.Description" rows="5" placeholder="Provide raw configuration guidelines, catalog notes, or full logistical parameters..." class="console-textarea" /> <InputText @bind-Value="ProductModel.CopyrightInfo" class="console-input" placeholder="e.g., © 1984 William Gibson. All rights reserved." />
<ValidationMessage For="@(() => ProductModel.CopyrightInfo)" style="color: #ff5722; font-size: 0.75rem;" />
</div>
<div class="console-field-group">
<label class="console-field-label">Full Catalog Description</label>
<InputTextArea @bind-Value="ProductModel.Description" class="console-textarea" rows="4" placeholder="Enter extended markdown contents..." />
<ValidationMessage For="@(() => ProductModel.Description)" style="color: #ff5722; font-size: 0.75rem;" />
</div> </div>
</div> </div>
<div class="form-column"> <div class="form-media-deck-section">
<div class="console-field-group"> <div class="form-section-header" style="margin-bottom: 1rem; padding-bottom: 0.5rem;">
<label class="console-field-label">Primary Engine Asset (Image URL)</label> <p style="text-transform: uppercase; font-weight: 600; color: #cbd5e1; font-size: 0.8rem; letter-spacing: 0.05em;">Media Assets Node Array</p>
<div class="input-asset-addon"> </div>
<InputText @bind-Value="ProductModel.ImageUrl" placeholder="https://assets.litecharms.internal/nodes/primary.png" class="console-input asset-path-input" />
<div class="asset-preview-stub"> <div class="media-deck-row">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="18" height="18" rx="2" ry="2" /><circle cx="8.5" cy="8.5" r="1.5" /><polyline points="21 15 16 10 5 21" /></svg>
<div class="console-field-group">
<label class="console-field-label">Primary Cover</label>
<div class="book-cover-dropzone">
<InputFile OnChange="HandleMainImageUpload" accept=".png,.jpg,.jpeg,.webp" class="hidden-file-input" id="main-image-file" />
@if (string.IsNullOrEmpty(ProductModel.ImageUrl))
{
<label for="main-image-file" class="dropzone-interactive-layer">
<div class="empty-slot-blueprint">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
<line x1="12" y1="5" x2="12" y2="19"></line>
<line x1="5" y1="12" x2="19" y2="12"></line>
</svg>
<span style="font-size: 0.7rem; font-family: monospace; color: #475569; margin-top: 0.5rem;">UPLOAD COVER</span>
</div>
</label>
}
else
{
<div class="dropzone-active-preview">
<img src="@ProductModel.ImageUrl" alt="Main Book Cover" />
<div class="image-actions-overlay">
<button type="button" class="btn-micro-action" title="Preview Image" @onclick="() => SetPreviewActive(ProductModel.ImageUrl)">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"></path><circle cx="12" cy="12" r="3"></circle></svg>
</button>
<button type="button" class="btn-micro-action danger" title="Remove Asset" @onclick="ClearMainImage">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>
</button>
</div>
</div>
}
</div> </div>
</div> </div>
</div>
<div class="console-field-group spacing-top-modifier"> <div class="console-field-group">
<label class="console-field-label"> <label class="console-field-label">Additional Media Slots</label>
Telemetry Media Thumbnails <span class="text-mono node-dim-label">(Max 5 Slots)</span> <div class="thumbnail-deck-grid">
</label> @for (int i = 0; i < 5; i++)
{
var index = i;
<div class="thumbnail-slot-node @(HasAssetAt(index) ? "populated" : "empty")">
@if (HasAssetAt(index))
{
<img src="@ProductModel.Thumbnails[index]" alt="Slot @(index + 1)" />
<div class="thumbnail-deck-grid"> <div class="image-actions-overlay">
@for (int i = 0; i < 5; i++) <button type="button" class="btn-micro-action" title="Preview Image" @onclick="() => SetPreviewActive(ProductModel.Thumbnails[index])">
{ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"></path><circle cx="12" cy="12" r="3"></circle></svg>
var index = i; </button>
<div class="thumbnail-slot-node @(HasAssetAt(index) ? "populated" : "empty")"> <button type="button" class="btn-micro-action danger" title="Remove Asset" @onclick="() => RemoveThumbnailAt(index)">
@if (HasAssetAt(index)) <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>
{ </button>
<img src="@ProductModel.Thumbnails[index]" alt="Slot @(index + 1)" /> </div>
<button type="button" class="btn-clear-slot" @onclick="() => RemoveThumbnailAt(index)">✕</button> }
} else
else {
{ <InputFile OnChange="@(e => HandleThumbnailUpload(e, index))" accept=".png,.jpg,.jpeg,.webp" class="hidden-file-input" id="@($"thumb-file-{index}")" />
<div class="empty-slot-blueprint"> <label for="@($"thumb-file-{index}")" class="empty-slot-blueprint">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><line x1="12" y1="5" x2="12" y2="19"></line><line x1="5" y1="12" x2="19" y2="12"></line></svg> <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
<span class="text-mono">0@(index + 1)</span> <line x1="12" y1="5" x2="12" y2="19"></line>
</div> <line x1="5" y1="12" x2="19" y2="12"></line>
} </svg>
</div> <span style="font-size: 0.65rem; font-family: monospace; margin-top: 0.25rem;">0@(index + 1)</span>
} </label>
}
</div>
}
</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div>
<div class="form-action-footer"> <div class="form-action-footer">
<button type="button" class="btn-console-flat">Abort Registers</button> <button type="submit" class="btn-apply-filters">Commit Record Ledger</button>
<button type="submit" class="btn-apply-filters">Commit Node to Ledger</button> </div>
</div> </EditForm>
</EditForm> </div>
</div> </div>
@code {
private Product ProductModel { get; set; } = new();
protected override void OnInitialized()
{
ProductModel.Active = true;
ProductModel.Thumbnails ??= new string[0];
}
private bool HasAssetAt(int index) =>
ProductModel.Thumbnails != null && index < ProductModel.Thumbnails.Length && !string.IsNullOrWhiteSpace(ProductModel.Thumbnails[index]);
private void RemoveThumbnailAt(int index)
{
if (ProductModel.Thumbnails == null) return;
var list = ProductModel.Thumbnails.ToList();
if (index < list.Count)
{
list.RemoveAt(index);
ProductModel.Thumbnails = list.ToArray();
}
}
private void HandleValidSubmit()
{
// Save operation business logic goes here
}
public class Product
{
public Guid Id { get; set; } = Guid.NewGuid();
public string? Name { get; set; }
public string? Summary { get; set; }
public string? Description { get; set; }
public string? ImageUrl { get; set; }
public string[]? Thumbnails { get; set; }
public bool Active { get; set; }
}
}
+218 -2
View File
@@ -1,5 +1,221 @@
namespace ShopAdmin.Components; using LiteCharms.Features.S3.Abstractions;
using static LiteCharms.Features.S3.Constants;
public partial class CreateProduct namespace ShopAdmin.Components;
public partial class CreateProduct([FromKeyedServices(BookshopBucketName)] IS3Service s3Service)
{ {
private bool isCalendarOpen = false;
private DateTime calendarViewingMonth = DateTime.Today;
private List<DateTime?> calendarDays = new();
private string currentCalendarMonthYearText => calendarViewingMonth.ToString("MMMM yyyy");
private readonly CancellationTokenSource cancellationTokenSource = new();
private CancellationToken cancellationToken;
protected string? ActivePreviewUrl { get; set; }
protected CreateProductModel ProductModel { get; set; } = new();
private const long MaxAllowedFileSize = 1024 * 1024 * 5;
private readonly Func<string, string> GetFileKeyFromUrl = url => url.Split('/').Last();
protected override void OnInitialized()
{
base.OnInitialized();
cancellationToken = cancellationTokenSource.Token;
if (ProductModel.Thumbnails.Count == 0)
ProductModel.Thumbnails = [.. Enumerable.Repeat(string.Empty, 5)];
}
public Task HandleValidSubmit() => Task.CompletedTask;
public bool HasAssetAt(int index) => (ProductModel?.Thumbnails) != null && index < ProductModel.Thumbnails.Count &&
!string.IsNullOrWhiteSpace(ProductModel.Thumbnails[index]);
private async Task HandleMainImageUpload(InputFileChangeEventArgs e)
{
try
{
var file = e.File;
if (file == null) return;
using var stream = new MemoryStream();
await file.OpenReadStream(MaxAllowedFileSize).CopyToAsync(stream, cancellationToken);
stream.Seek(0, SeekOrigin.Begin);
var result = await s3Service.UploadFileAsync(file.Name, stream,
MimeTypes.GetMimeType(file.Name), cancellationToken);
if (result.IsSuccess)
{
ProductModel.ImageUrl = result.Value;
StateHasChanged();
}
}
catch (Exception ex)
{
Console.WriteLine($"Main Image Upload Exception: {ex.Message}");
}
}
public void SetPreviewActive(string? url)
{
if (string.IsNullOrWhiteSpace(url)) return;
ActivePreviewUrl = url;
StateHasChanged();
}
public void ClosePreviewDrawer()
{
ActivePreviewUrl = null;
StateHasChanged();
}
private async Task HandleThumbnailUpload(InputFileChangeEventArgs e, int index)
{
try
{
var file = e.File;
if (file == null) return;
using var stream = new MemoryStream();
await file.OpenReadStream(MaxAllowedFileSize, cancellationToken).CopyToAsync(stream, cancellationToken);
stream.Seek(0, SeekOrigin.Begin);
var result = await s3Service.UploadFileAsync(file.Name, stream,
MimeTypes.GetMimeType(file.Name), cancellationToken);
if (result.IsSuccess && index < ProductModel.Thumbnails.Count)
{
ProductModel.Thumbnails[index] = result.Value;
StateHasChanged();
}
}
catch (Exception ex)
{
Console.WriteLine($"Thumbnail Slot {index} Upload Exception: {ex.Message}");
}
}
public async Task ClearMainImage()
{
if (string.IsNullOrEmpty(ProductModel.ImageUrl)) return;
var targetUrl = ProductModel.ImageUrl;
if (ActivePreviewUrl == targetUrl) ActivePreviewUrl = null;
ProductModel.ImageUrl = null;
StateHasChanged();
var result = await s3Service.DeleteFileAsync(GetFileKeyFromUrl(targetUrl));
if (!result.IsSuccess)
Console.WriteLine($"[S3 Orphan Cleanup Failure]: {result.Errors[0].Message}");
}
public async Task RemoveThumbnailAt(int index)
{
if (index < 0 || index >= ProductModel.Thumbnails.Count) return;
var targetUrl = ProductModel.Thumbnails[index];
if (string.IsNullOrEmpty(targetUrl)) return;
if (ActivePreviewUrl == targetUrl) ActivePreviewUrl = null;
ProductModel.Thumbnails[index] = string.Empty;
StateHasChanged();
var result = await s3Service.DeleteFileAsync(GetFileKeyFromUrl(targetUrl));
if (result.IsFailed)
Console.WriteLine($"[S3 Thumbnail Cleanup Failure]: {result.Errors[0].Message}");
}
private void ToggleCalendar()
{
if (!isCalendarOpen)
{
// Default viewport context to currently selected value or fallback to today
calendarViewingMonth = ProductModel.PublishDate;
RebuildCalendarMatrix();
}
isCalendarOpen = !isCalendarOpen;
}
private void RebuildCalendarMatrix()
{
calendarDays.Clear();
var firstDayOfMonth = new DateTime(calendarViewingMonth.Year, calendarViewingMonth.Month, 1);
var totalDaysInMonth = DateTime.DaysInMonth(calendarViewingMonth.Year, calendarViewingMonth.Month);
// Offset leading days to align day positions correctly with day of week headers
int leadingOffsets = (int)firstDayOfMonth.DayOfWeek;
for (int i = 0; i < leadingOffsets; i++)
{
calendarDays.Add(null);
}
// Populate active dates
for (int day = 1; day <= totalDaysInMonth; day++)
{
calendarDays.Add(new DateTime(calendarViewingMonth.Year, calendarViewingMonth.Month, day));
}
}
private void NavigateToPreviousMonth()
{
calendarViewingMonth = calendarViewingMonth.AddMonths(-1);
RebuildCalendarMatrix();
}
private void NavigateToNextMonth()
{
calendarViewingMonth = calendarViewingMonth.AddMonths(1);
RebuildCalendarMatrix();
}
private void SelectCalendarDate(DateTime date)
{
ProductModel.PublishDate = date;
isCalendarOpen = false; // Collapse popup smoothly on successful selection
StateHasChanged();
}
} }
public class CreateProductModel
{
[Required(ErrorMessage = "Product name is required.")]
public string? Name { get; set; }
[Required(ErrorMessage = "Summary is required.")]
public string? Summary { get; set; }
[Required(ErrorMessage = "Description is required.")]
public string? Description { get; set; }
[Range(0.01, double.MaxValue, ErrorMessage = "Price must be greater than zero.")]
public decimal Price { get; set; }
[Required(ErrorMessage = "Author metadata is required.")]
public string? Author { get; set; }
[Required(ErrorMessage = "Publication Date is required.")]
public DateTime PublishDate { get; set; } = DateTime.Today;
[Required(ErrorMessage = "Copyright Information field is required.")]
public string? CopyrightInfo { get; set; }
[Required(ErrorMessage = "ISBN code is required.")]
[RegularExpression(@"^(?=(?:\D*\d){10}(?:(?:\D*\d){3})?$)[\d-]+$", ErrorMessage = "Please enter a valid ISBN-10 or ISBN-13 string.")]
public string? Isbn { get; set; }
[Required(ErrorMessage = "Primary image is required.")]
public string? ImageUrl { get; set; }
public List<string> Thumbnails { get; set; } = [];
}
+383 -177
View File
@@ -1,9 +1,21 @@
/* Core Structural Layout Space Configuration */ /* ==========================================================================
Shell & Outer Layout Container
========================================================================== */
.create-product-shell {
display: flex;
width: 100%;
height: 100%;
overflow: hidden;
position: relative;
background: #02060d;
}
.create-product-container { .create-product-container {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
height: 100%; height: 100%;
width: 100%; width: 100%;
box-sizing: border-box;
} }
.form-entry-canvas { .form-entry-canvas {
@@ -15,158 +27,300 @@
.form-scroll-viewport { .form-scroll-viewport {
padding: 2.5rem; padding: 2.5rem;
flex: 1; flex: 1 1 auto;
overflow-y: auto; overflow-y: auto;
} }
.form-section-header { .form-section-header {
margin-bottom: 2.5rem; margin-bottom: 2rem;
border-bottom: 1px solid rgba(255, 255, 255, 0.03); border-bottom: 1px solid rgba(255, 255, 255, 0.05);
padding-bottom: 1.25rem; padding-bottom: 1.25rem;
} }
.field-accent-tag { .field-accent-tag {
font-size: 1rem; font-size: 1.2rem;
letter-spacing: 0.02em; letter-spacing: 0.02em;
color: #ffffff !important; color: #ffffff;
font-weight: 600; font-weight: 600;
display: block;
} }
.form-section-header p { .form-section-header p {
margin-top: 0.4rem; margin-top: 0.5rem;
font-size: 0.85rem; font-size: 0.88rem;
color: #64748b; color: #64748b;
} }
/* Precise Balanced Grid Matrix Layout */ /* ==========================================================================
.form-grid-layout { Stacked Sub-Section Layout Blocks
display: grid; ========================================================================== */
grid-template-columns: repeat(2, minmax(0, 1fr)); .form-text-inputs-section {
gap: 3.5rem;
align-items: start;
}
.form-column {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 2rem; gap: 1.5rem;
}
/* Brand Metric Console Inputs Architecture */
.console-field-group {
display: flex;
flex-direction: column;
gap: 0.75rem;
width: 100%; width: 100%;
margin-bottom: 3rem;
}
.form-media-deck-section {
display: flex;
flex-direction: column;
gap: 1.5rem;
width: 100%;
}
.media-deck-row {
display: grid;
grid-template-columns: 240px 1fr;
gap: 2.5rem;
align-items: start;
width: 100%;
}
.console-field-group {
position: relative; /* Clamps absolute children to this specific slot's bounds */
display: flex;
flex-direction: column;
gap: 0.6rem;
width: 100%;
margin-bottom: 1.5rem;
} }
.console-field-label { .console-field-label {
font-size: 0.88rem; font-size: 0.85rem;
font-weight: 500; font-weight: 500;
color: #cbd5e1; color: #cbd5e1;
letter-spacing: 0.01em; letter-spacing: 0.03em;
text-transform: uppercase;
}
/* Handles responsive multi-column layout split blocks for form metrics */
.console-field-row {
display: flex;
gap: 1.5rem;
width: 100%;
}
.console-field-row .console-field-group {
flex: 1;
min-width: 0;
}
@media (max-width: 768px) {
.console-field-row {
flex-direction: column;
gap: 0;
}
}
/* ==========================================================================
Input Form Elements & Custom Date Trigger Matching
========================================================================== */
::deep .console-input,
::deep .console-textarea,
.custom-date-trigger-box {
width: 100%;
box-sizing: border-box;
background: #060b13 !important;
border: 1px solid #1e293b !important;
border-radius: 4px;
padding: 0.85rem 1rem; /* Matched exactly to snap row heights in line */
color: #f8fafc !important;
font-size: 0.9rem;
outline: none;
transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.custom-date-trigger-box {
display: flex;
justify-content: space-between;
align-items: center;
cursor: pointer;
}
::deep .console-input:focus,
::deep .console-textarea:focus,
.custom-date-trigger-box.focused {
border-color: #00f2fe !important;
box-shadow: 0 0 0 1px rgba(0, 242, 254, 0.2), 0 0 12px rgba(0, 242, 254, 0.1) !important;
background: #02060d !important;
}
::deep .console-textarea {
resize: none;
line-height: 1.5;
}
.calendar-icon {
color: #64748b;
flex-shrink: 0;
}
/* ==========================================================================
Deep Isolated Custom Popup Window
========================================================================== */
::deep .brand-calendar-popup,
.brand-calendar-popup {
position: absolute;
top: 100%;
left: 0;
z-index: 1000;
width: 100% !important; /* Force complete row span constraint */
box-sizing: border-box;
padding: 1rem;
background-color: #0b0f19;
border: 1px solid #1e293b;
border-radius: 6px;
box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
}
.calendar-nav-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 0.75rem;
}
.calendar-current-month {
font-size: 0.85rem;
font-weight: 600;
color: #f1f5f9;
font-family: monospace;
}
.btn-cal-nav {
background: transparent;
border: none;
color: #94a3b8;
font-size: 0.9rem;
cursor: pointer;
padding: 0.2rem 0.5rem;
border-radius: 4px;
transition: background-color 0.1s;
}
.btn-cal-nav:hover {
background-color: #1e293b;
color: #f8fafc;
}
.calendar-days-grid-header {
display: grid;
grid-template-columns: repeat(7, 1fr);
text-align: center;
font-size: 0.7rem;
font-weight: 700;
color: #475569;
text-transform: uppercase;
margin-bottom: 0.5rem;
}
.calendar-days-matrix {
display: grid;
grid-template-columns: repeat(7, 1fr);
gap: 2px;
}
.calendar-day-btn {
background: transparent;
border: none;
color: #cbd5e1;
font-size: 0.8rem;
padding: 0.4rem 0;
text-align: center;
cursor: pointer;
border-radius: 4px;
font-family: monospace;
transition: all 0.1s ease;
}
.calendar-day-btn:hover {
background-color: #1e293b;
color: #ffffff;
}
.calendar-day-btn.is-today {
color: #00f2fe; /* Aligned with your brand's primary neon cyan glow */
font-weight: 700;
}
.calendar-day-btn.is-selected {
background-color: #0284c7 !important;
color: #ffffff !important;
font-weight: 700;
}
/* ==========================================================================
Image Slots & Cloud Upload Dropzones
========================================================================== */
::deep .hidden-file-input,
.hidden-file-input {
display: none !important;
pointer-events: none !important;
}
.book-cover-dropzone {
width: 240px;
aspect-ratio: 2 / 3;
background: #060b13;
border: 1px dashed #1e293b;
border-radius: 4px;
position: relative;
overflow: hidden;
transition: all 0.25s ease;
}
.book-cover-dropzone:hover {
border-color: #00f2fe;
}
.dropzone-interactive-layer,
.thumbnail-slot-node.empty label {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
cursor: pointer;
margin: 0;
padding: 1rem;
box-sizing: border-box;
user-select: none; user-select: none;
} }
.node-dim-label {
color: #475569;
font-size: 0.75rem;
margin-left: 0.25rem;
}
/* High-Fidelity Branded Form Controls */
.console-input, .console-textarea {
width: 100%;
background: #060b13;
border: 1px solid #1e293b;
border-radius: 6px;
padding: 0.9rem 1.1rem;
color: #f8fafc;
font-size: 0.92rem;
font-family: inherit;
outline: none;
transition: border-color 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
/* Component Placeholder Styling */
.console-input::placeholder, .console-textarea::placeholder {
color: #334155;
font-size: 0.88rem;
}
/* Branded Interactive Focus Transitions */
.console-input:focus, .console-textarea:focus {
border-color: #00f2fe;
box-shadow: 0 0 0 1px #00f2fe;
}
.console-textarea {
resize: none;
line-height: 1.6;
}
/* Asset URL Composite Field Layout Extensions */
.input-asset-addon {
display: flex;
align-items: stretch;
width: 100%;
}
.asset-path-input {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
.asset-preview-stub {
background: #0b131f;
border: 1px solid #1e293b;
border-left: none;
border-top-right-radius: 6px;
border-bottom-right-radius: 6px;
display: flex;
align-items: center;
justify-content: center;
width: 54px;
color: #475569;
flex-shrink: 0;
transition: border-color 0.2s ease, color 0.2s ease;
}
/* Keep addon stub borders synced during primary field focus */
.input-asset-addon:focus-within .asset-path-input {
border-color: #00f2fe;
}
.input-asset-addon:focus-within .asset-preview-stub {
border-color: #00f2fe;
color: #00f2fe;
}
/* Layout Space Tuning Adjustments for Media Sections */
.spacing-top-modifier {
margin-top: 0.25rem;
}
/* 5-Item Array Asset Matrix Grid */
.thumbnail-deck-grid { .thumbnail-deck-grid {
display: grid; display: grid;
grid-template-columns: repeat(5, minmax(0, 1fr)); grid-template-columns: repeat(5, 1fr);
gap: 0.85rem; gap: 1rem;
width: 100%;
} }
.thumbnail-slot-node { .thumbnail-slot-node {
aspect-ratio: 1 / 1; aspect-ratio: 2 / 3;
background: #060b13; background: #060b13;
border: 1px dashed #1e293b; border: 1px solid #1e293b;
border-radius: 6px; border-radius: 4px;
position: relative; position: relative;
overflow: hidden; overflow: hidden;
transition: border-color 0.2s ease, background 0.2s ease;
} }
.thumbnail-slot-node.empty:hover { .thumbnail-slot-node.empty {
border-color: #ff5722; border: 1px dashed #1e293b;
background: rgba(255, 87, 34, 0.02); background: #060b13;
transition: all 0.2s ease;
}
.thumbnail-slot-node.empty:hover {
border-color: #00f2fe;
background: rgba(0, 242, 254, 0.02);
}
.thumbnail-slot-node img,
.dropzone-active-preview img {
width: 100%;
height: 100%;
object-fit: cover;
} }
.empty-slot-blueprint { .empty-slot-blueprint {
@@ -176,100 +330,152 @@
justify-content: center; justify-content: center;
height: 100%; height: 100%;
color: #334155; color: #334155;
gap: 0.35rem; gap: 0.5rem;
user-select: none; cursor: pointer;
} }
.empty-slot-blueprint svg { /* ==========================================================================
width: 16px; Minimalist Floating Action Micro-Icons
height: 16px; ========================================================================== */
} .image-actions-overlay {
position: absolute;
.empty-slot-blueprint span { inset: 0;
font-size: 0.65rem; background: rgba(4, 8, 15, 0.4);
font-family: monospace; backdrop-filter: blur(1px);
letter-spacing: 0.02em; display: flex;
} align-items: center;
justify-content: center;
.thumbnail-slot-node.populated { gap: 0.75rem;
border-style: solid; opacity: 0;
border-color: #1e293b; transition: opacity 0.2s ease;
} }
.thumbnail-slot-node.populated img { .book-cover-dropzone:hover .image-actions-overlay,
.thumbnail-slot-node:hover .image-actions-overlay {
opacity: 1;
}
.btn-micro-action {
background: #060b13;
border: 1px solid #1e293b;
color: #cbd5e1;
width: 32px;
height: 32px;
border-radius: 4px;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
transition: all 0.2s ease;
padding: 0;
}
.btn-micro-action:hover {
border-color: #00f2fe;
color: #00f2fe;
box-shadow: 0 0 8px rgba(0, 242, 254, 0.3);
}
.btn-micro-action.danger:hover {
border-color: #ff5722;
color: #ff5722;
box-shadow: 0 0 8px rgba(255, 87, 34, 0.3);
}
/* ==========================================================================
Sliding Preview System (Left Panel Drawer)
========================================================================== */
.book-preview-drawer {
width: 0px;
height: 100%;
background: #04080f;
border-right: 0 solid #1e293b;
overflow: hidden;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 0;
transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
flex-shrink: 0;
position: relative;
}
.book-preview-drawer.is-open {
width: 340px;
padding: 2rem;
border-right: 1px solid #1e293b;
}
.drawer-portrait-frame {
width: 100%;
aspect-ratio: 2 / 3;
background: #060b13;
border: 1px solid #1e293b;
border-radius: 4px;
box-shadow: 0 0 30px rgba(0, 0, 0, 0.6);
overflow: hidden;
position: relative;
}
.drawer-portrait-frame img {
width: 100%; width: 100%;
height: 100%; height: 100%;
object-fit: cover; object-fit: cover;
} }
.btn-clear-slot { .btn-close-preview-floating {
position: absolute; position: absolute;
top: 4px; top: 12px;
right: 4px; right: 12px;
background: #0f172a; background: rgba(6, 11, 19, 0.85);
border: 1px solid #334155; border: 1px solid #1e293b;
color: #cbd5e1; color: #64748b;
width: 28px;
height: 28px;
border-radius: 4px; border-radius: 4px;
width: 18px;
height: 18px;
font-size: 0.65rem;
cursor: pointer;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
opacity: 0; cursor: pointer;
transition: opacity 0.15s ease, border-color 0.15s ease; transition: all 0.2s ease;
z-index: 10;
} }
.btn-clear-slot:hover { .btn-close-preview-floating:hover {
border-color: #ff5722; border-color: #ff5722;
color: #ff5722; color: #ff5722;
} }
.thumbnail-slot-node.populated:hover .btn-clear-slot { /* ==========================================================================
opacity: 1; Footer Action Dashboard Bar
} ========================================================================== */
/* Form Action Control Bar Layout */
.form-action-footer { .form-action-footer {
padding: 1.5rem 2.5rem; padding: 0.85rem 2.5rem;
background: #04080f; background: #04080f;
border-top: 1px solid #1e293b; border-top: 1px solid #1e293b;
display: flex; display: flex;
justify-content: flex-end; justify-content: flex-end;
gap: 1.5rem; gap: 1.25rem;
align-items: center; align-items: center;
} }
.btn-console-flat {
background: transparent;
border: none;
color: #64748b;
font-size: 0.9rem;
font-weight: 500;
cursor: pointer;
padding: 0.6rem 1.2rem;
border-radius: 4px;
transition: color 0.2s ease;
}
.btn-console-flat:hover {
color: #f1f5f9;
}
/* Using your brand active cyan color for submission commits */
.btn-apply-filters { .btn-apply-filters {
background: #00f2fe; background: rgba(0, 242, 254, 0.05);
border: none; border: 1px solid #00f2fe;
color: #060b13; color: #00f2fe;
font-family: 'JetBrains Mono', monospace;
font-weight: 600; font-weight: 600;
font-size: 0.9rem; font-size: 0.85rem;
padding: 0.75rem 1.5rem; padding: 0.55rem 1.5rem;
border-radius: 4px; border-radius: 4px;
cursor: pointer; cursor: pointer;
transition: background-color 0.2s ease, opacity 0.2s ease; letter-spacing: 0.02em;
transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
} }
.btn-apply-filters:hover { .btn-apply-filters:hover {
background: #00d8e4; background: #00f2fe;
color: #060b13;
box-shadow: 0 0 15px rgba(0, 242, 254, 0.3);
} }
+1
View File
@@ -17,6 +17,7 @@ builder.Services.AddBlazoredToast();
builder.Services.AddEndpointsApiExplorer(); builder.Services.AddEndpointsApiExplorer();
builder.Services.AddMediator(); builder.Services.AddMediator();
builder.Services.AddGarageS3(builder.Configuration);
builder.Services.AddScoped(typeof(IPipelineBehavior<,>), typeof(TelemetryPipelineBehavior<,>)); builder.Services.AddScoped(typeof(IPipelineBehavior<,>), typeof(TelemetryPipelineBehavior<,>));
builder.Services.AddScoped(typeof(IPipelineBehavior<,>), typeof(LoggingPipelineBehavior<,>)); builder.Services.AddScoped(typeof(IPipelineBehavior<,>), typeof(LoggingPipelineBehavior<,>));
+4 -1
View File
@@ -16,7 +16,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="LiteCharms.Features" Version="1.34.0" /> <PackageReference Include="LiteCharms.Features" Version="1.40.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.QuickGrid" Version="10.0.8" /> <PackageReference Include="Microsoft.AspNetCore.Components.QuickGrid" Version="10.0.8" />
<PackageReference Include="Polly" Version="8.6.6" /> <PackageReference Include="Polly" Version="8.6.6" />
</ItemGroup> </ItemGroup>
@@ -58,6 +58,9 @@
<!-- Shared Global Usings --> <!-- Shared Global Usings -->
<ItemGroup> <ItemGroup>
<Using Include="MimeKit" />
<Using Include="System.ComponentModel.DataAnnotations" />
<Using Include="Microsoft.AspNetCore.Components.Forms" />
<Using Include="Microsoft.AspNetCore.Components.QuickGrid" /> <Using Include="Microsoft.AspNetCore.Components.QuickGrid" />
<Using Include="Microsoft.AspNetCore.HttpOverrides" /> <Using Include="Microsoft.AspNetCore.HttpOverrides" />
<Using Include="Microsoft.AspNetCore.Authentication" /> <Using Include="Microsoft.AspNetCore.Authentication" />
+6
View File
@@ -1,4 +1,10 @@
{ {
"BookshopS3Settings": {
"ServiceUrl": "http://192.168.1.177:30900",
"Region": "garage",
"BucketName": "bookshop",
"CdnBaseUrl": "https://bookshop.cdn.khongisa.co.za"
},
"IdKongisa": { "IdKongisa": {
"Authority": "https://id.khongisa.co.za/application/o/litecharms-shopadmin" "Authority": "https://id.khongisa.co.za/application/o/litecharms-shopadmin"
}, },
+14
View File
@@ -15,6 +15,8 @@ data:
Monitoring__Address: "http://aspire-dashboard-service.aspire.svc.cluster.local:18889" Monitoring__Address: "http://aspire-dashboard-service.aspire.svc.cluster.local:18889"
Monitoring__ServiceName: "LiteCharms.ShopAdmin.Uat" Monitoring__ServiceName: "LiteCharms.ShopAdmin.Uat"
IdKongisa__Authority: "https://id.khongisa.co.za/application/o/litecharms-shopadmin" IdKongisa__Authority: "https://id.khongisa.co.za/application/o/litecharms-shopadmin"
BooshopS3Settings__ServiceUrl: "http://garage.garage.svc.cluster.local:3900"
BooshopS3Settings__Region: "garage"
--- ---
apiVersion: v1 apiVersion: v1
kind: Secret kind: Secret
@@ -28,6 +30,8 @@ data:
aspire-apikey: bWMzRzYzSzJqNVpPRXNpMEFqTW9qTFRYbTFLRVpGY3R6SUlqU3dEaVRHdXQ4cUdTa1B1V3d4R1AxUmJzY0pVbw== aspire-apikey: bWMzRzYzSzJqNVpPRXNpMEFqTW9qTFRYbTFLRVpGY3R6SUlqU3dEaVRHdXQ4cUdTa1B1V3d4R1AxUmJzY0pVbw==
auth-clientid: NUxldE5hSERsUlhOWXo1N3FkMVV1RWN4R01uUDNmT3FXc0RHcWdjUg== auth-clientid: NUxldE5hSERsUlhOWXo1N3FkMVV1RWN4R01uUDNmT3FXc0RHcWdjUg==
auth-clientsecret: a3ZxN3k1anc0M0g4WDRjQW91eGRqRDhNNXdxVUhUQ2I4UjNSVjNVWjI4TUZjTk51NWxhM3g3V1ZZRzQ2QnJFMjVPMnhXRmhoeEk0VXNSaFlMTHRqSGRhWWVrUTBmdHpIQ3ZNczV5TXdRdERpcDBkM3QzTkNDa0RtN1JXeW1XSTg= auth-clientsecret: a3ZxN3k1anc0M0g4WDRjQW91eGRqRDhNNXdxVUhUQ2I4UjNSVjNVWjI4TUZjTk51NWxhM3g3V1ZZRzQ2QnJFMjVPMnhXRmhoeEk0VXNSaFlMTHRqSGRhWWVrUTBmdHpIQ3ZNczV5TXdRdERpcDBkM3QzTkNDa0RtN1JXeW1XSTg=
bookshop-s3-accesskey: R0s1MTRkMmNlOGRjNjkyMzdhMDVjMDFlZWY=
bookshop-s3-secretkey: ZWFhZmVkYTFhZWQ0MDllY2ZlNjA3MTRlY2RhNTQ5YjgyYmRmNWEzZGFmOWYxOGRkNjFmNjZiNDk3M2E2NDgyZQ==
--- ---
apiVersion: v1 apiVersion: v1
kind: PersistentVolumeClaim kind: PersistentVolumeClaim
@@ -80,6 +84,16 @@ spec:
- configMapRef: - configMapRef:
name: shopadmin-config name: shopadmin-config
env: env:
- name: BookshopS3Settings__AccessKey
valueFrom:
secretKeyRef:
name: shopadmin-secrets
key: bookshop-s3-accesskey
- name: BookshopS3Settings__SecretKey
valueFrom:
secretKeyRef:
name: shopadmin-secrets
key: bookshop-s3-secretkey
- name: ConnectionStrings__PostgresScheduler - name: ConnectionStrings__PostgresScheduler
valueFrom: valueFrom:
secretKeyRef: secretKeyRef: