Commit Graph

119 Commits

Author SHA1 Message Date
062916d5ce Fix: CSV import now creates ProductVariants instead of ProductMultiBuys
CRITICAL BUG FIX: Orders were totaling £0 because imported products had:
- Base price set to £0
- Variants stored as ProductMultiBuys (not ProductVariants)
- Order creation couldn't find variant prices → used base price of £0

Changes:
- CSV import now detects format: semicolons (;) = variants, colons (:) = multi-buys
- Added ImportProductVariantsAsync() to handle pipe-delimited variant format
- Format: "value; price; stock|value; price; stock" (e.g., "10; 30.00; 100|25; 70.00; 50")
- Updated CSV export to prioritize ProductVariants over MultiBuys
- Updated CSV template with correct variant format examples
- Added comprehensive documentation in VARIANT_CSV_FORMAT.md

Migration Required:
- Existing products with incorrect MultiBuy data need re-import
- Convert format from "name:qty:price;name:qty:price" to "value; price; stock|value; price; stock"
- Ensure base price is 0 for variant-based products

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-08 18:31:46 +01:00
9f7b2840af Fix: Populate existing variant panels with imported ProductVariant data
**Previous Approach (WRONG):**
- Created a separate table section to display ProductVariants
- User wanted data in the EXISTING collapsible panels, not a new section

**Proper Fix:**
- ProductImportService creates records in ProductVariants table
- Edit page's collapsible panels read from VariantsJson field (different system)
- Solution: Convert ProductVariants → VariantsJson format on page load

**Changes:**

1. **ProductsController.cs (Lines 105-115):**
   - Load ProductVariants from database
   - If VariantsJson empty but ProductVariants exist, convert them
   - Format: `[{Weight: "28g", Price: 700, StockQty: 100}, ...]`
   - JavaScript reads Price and StockQty to populate collapsible panel fields

2. **Edit.cshtml:**
   - Removed the extra table section
   - Existing collapsible panels now display imported data automatically

**Result:**
When you open Edit page, expand "Product Variants" → "Price, Stock & Weight Details",
the fields will be PRE-FILLED with your imported values (700, 100, etc.)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-08 18:05:18 +01:00
2c5815510d Fix: Display variant price and stock directly in Product Edit page
**Problem:**
- Variant price overrides and stock quantities were hidden in collapsible
  panels in the Product Edit page
- The Edit page was showing the VariantCollections system (VariantsJson)
  instead of the actual ProductVariant records created by text import
- User had to expand each variant panel to see price and stock values

**Solution:**
1. **ProductsController.cs (Lines 101-103):**
   - Added call to GetProductVariantsAsync() to load actual variant records
   - Added ViewData["ProductVariants"] to pass data to view

2. **Edit.cshtml (Lines 320-413):**
   - Added new collapsible section "Product Variants"
   - Displays variants in a table with directly visible columns:
     * Name, Type, Price, Stock Level, Sort Order, Status
   - No hidden panels - all information visible at a glance
   - Added quick summary with total variants, stock, and price range
   - Includes helpful links to ProductVariants management page

**Technical Details:**
- Price displays in green with £ symbol when override exists
- Stock shows color-coded badges (green=in stock, red=out of stock)
- Section only appears if variants exist (conditional rendering)
- Expanded by default (aria-expanded="true") for immediate visibility

**Impact:**
- User can now see all variant prices and stock quantities immediately
- No need to click/expand individual variant panels
- Better UX for products imported via text import format
- Maintains separation between VariantCollections system and ProductVariants

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-08 17:48:05 +01:00
859dfd374d Debug: Add logging to variant import for troubleshooting
Added detailed logging to ParseAndImportVariantLine to output:
- Variant name/value
- Price override
- Stock quantity
- Variant type

This will help diagnose why variant price and stock aren't showing up

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-08 17:01:32 +01:00
77d29e14c1 Fix: Text import variant parsing now correctly handles value, price, and stock
- Fixed variant parsing to accept 3 fields: value, price override, stock quantity
- Removed invalid VariantTypes navigation property reference
- Auto-detect variant type (Weight for grams, Quantity for units)
- Format: - VariantValue; PriceOverride; StockQuantity

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-08 16:26:48 +01:00
daa59e3271 Enhance: Replace All now clears orders + Auto-creates categories
- Replace All option now deletes ALL sales data (orders, payments, customers, messages)
- Auto-create missing categories in text import (same as CSV import)
- Deletes in proper order: sales data → products → categories
- Ensures clean slate for complete catalog replacement
- Add formatted product import file with variant collections

Changes:
- ImportFromTextAsync: Delete sales + products when replaceAll=true
- ImportFromHumanTextAsync: Auto-create categories + delete sales data
- Regex parsing to extract category names before import
- Enhanced logging for deletion operations
2025-10-08 16:01:21 +01:00
4f591418df Add: Replace All option to text import UI
- Add replaceAll checkbox to ImportText view with warning
- Pass replaceAll parameter to import service
- Allows complete product catalog replacement via text import
- Enhanced documentation for unit types and variant collections
2025-10-08 15:36:04 +01:00
86e30d7203 Fix: Import concurrency errors + Add sales data cleanup
- Fix optimistic concurrency errors in product import by using ExecuteSqlRaw instead of EF tracking
- Add DeleteAllOrdersAndSalesDataAsync() method to clear orders, payments, customers, and messages
- Add DeleteAllSalesData endpoint to ProductsController for admin access
- Proper deletion order to avoid foreign key violations
- Enhanced logging for troubleshooting data cleanup operations

Resolves: Import errors with 'database operation expected to affect 1 row(s)'
2025-10-08 15:00:51 +01:00
sysadmin
6c8106ff90 Add: CSV import with Replace All feature and auto-create categories
- Added Replace All checkbox to import UI for clean slate imports
- Implemented DeleteAllProductsAndCategoriesAsync for complete data wipe
- Added auto-creation of categories during CSV import
- Created products_import.csv with 13 products across 4 categories
- Added comprehensive IMPORT_INSTRUCTIONS.md documentation

Technical changes:
- ProductImportService: Added replaceAll parameter to all import methods
- ProductImportService: Categories now auto-created if missing from CSV
- ProductsController: Added replaceAll parameter to Import action
- Import.cshtml: Added Replace All checkbox with danger warnings

Categories: Flour, Cereal, Vitamins, Herbal
Products: 13 products with full variant pricing structures

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-08 14:22:13 +01:00
be91b3efd7 Add: SignalR real-time notifications for admin panel
- Created NotificationHub for instant browser notifications
- Updated CryptoPaymentService to broadcast via SignalR
- Added JavaScript client with toast notifications
- Works with custom SSL certificates (no FCM dependency)
- Automatic reconnection with exponential backoff
- Notification sound and visual indicators
- Bypasses all Web Push SSL certificate issues
2025-10-06 17:57:10 +01:00
b8390162d9 Add: Enhanced push notification logging for debugging 2025-10-06 17:38:19 +01:00
b265c89a72 Fix: Refactor TeleBot messaging to use database queue 2025-10-06 17:22:06 +01:00
6c95ed3145 Fix: Add TeleBot integration and expired payment handling
TeleBot Configuration:
- Added TeleBot API URL and API key to docker-compose.yml
- Configured to connect to telebot-service:5000 internally
- Enables customer notifications via Telegram bot

Expired Payment Handling:
- Auto-cancel orders when payment status is Expired
- Only cancels orders in PendingPayment status
- Logs cancellation for audit trail

Customer View Improvements:
- Hide cancelled orders from customer order lists
- Filters applied to both GetOrdersByIdentityAsync and GetOrdersByCustomerIdAsync
- Prevents confusion from displaying cancelled/expired orders

This resolves:
- No notifications to customers (TeleBot not configured)
- No notifications to admin (TeleBot connection failed)
- Expired orders remaining visible to customers
- Orders not auto-cancelled when payment expires

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-06 16:55:19 +01:00
cede0e7c47 Fix: Update interface to match confirmations parameter
- Added confirmations parameter to ICryptoPaymentService.ProcessPaymentWebhookAsync
- Updated CryptoPaymentService implementation to pass confirmations parameter
- Fixes build error: interface member signature mismatch

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-06 16:35:09 +01:00
110ad5f956 Fix: Add confirmations support and fix notification logic
Webhook Improvements:
- Added Confirmations field to PaymentWebhookDto (default: 0)
- Updated webhook controller to pass confirmations to service layer
- Fixed notification logic to match order update conditions

Payment Confirmation Logic:
- Paid (2): Confirmed immediately regardless of confirmations
- Overpaid (3): Confirmed immediately regardless of confirmations
- Completed (7): Requires 3+ blockchain confirmations
- Notifications only sent when order is actually updated

This prevents premature notifications for unconfirmed 'Completed' status
while maintaining immediate processing for 'Paid' and 'Overpaid' statuses.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-06 16:26:39 +01:00
2ae44a3c56 Fix: Add Dispatch button for orders in Packing status
- Added quick action button on Packing tab to dispatch orders
- Created dispatch modal with tracking number input
- Modal includes tracking number, estimated days, and notes fields
- Button appears on both desktop table and mobile card views
- Fixes workflow gap where Packing orders had no quick action
- Orders now properly flow: Accepted → Packing → Dispatched

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-06 16:12:11 +01:00
a519284fd1 Fix: Include Overpaid status in payment notifications
- Added PaymentStatus.Overpaid to notification trigger conditions
- Overpaid payments now update order status to PaymentReceived
- Overpaid payments now send admin push notifications
- Overpaid payments now send TeleBot customer notifications
- Resolves issue where successful overpayments were silent

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-06 16:07:14 +01:00
81f781be48 Fix: Allow anonymous access to BTCPay webhook endpoint
- Added [AllowAnonymous] attribute to PaymentWebhook endpoint
- Resolves authentication errors preventing BTCPay Server callbacks
- Webhook endpoint now accepts unauthenticated POST requests

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-06 15:47:35 +01:00
c9afb760b8 Fix: PWA manifest warnings resolved
Fixed Issues:
1. Removed "maskable" purpose from icons (was causing padding warnings)
2. Added screenshots with form_factor for richer install UI
   - Desktop: form_factor: "wide"
   - Mobile: form_factor: "narrow"

Changes:
- Icons now use "purpose: any" only (no maskable)
- Added screenshots array with wide/narrow form factors
- This enables richer PWA install prompts on supported browsers

All PWA manifest warnings should now be resolved.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-06 12:20:34 +01:00
5f71f0bb2d Fix: Loading screen now shows on every page load
Problems Fixed:
1. Blank white screen on initial load (loading screen had display:none)
2. Only showed once (sessionStorage.blazorLoaded prevented repeat shows)
3. Fast connections meant users never saw it

Solution:
1. Removed display:none from HTML - screen visible immediately
2. Removed sessionStorage check - shows on every page load
3. Screen visible by default, hides when Blazor.start() completes

Behavior Now:
- Loading screen appears instantly (no blank white screen)
- Shows on every page load (full page refresh)
- Hides when SignalR connection established
- Works correctly with slow/throttled connections

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-06 12:07:40 +01:00
0a08d1a943 Fix: Loading screen now waits for Blazor.start() on all pages
Problem:
- Loading screen was hiding immediately without waiting for Blazor
- Page detection logic was too restrictive (only /blazor paths)
- Most admin pages don't have Blazor components, so screen hid instantly

Solution:
- Blazor Server is loaded on ALL admin pages via _Layout.cshtml
- Removed restrictive path checking (was checking for /blazor or components)
- Now always calls Blazor.start() and waits for SignalR connection
- Loading screen properly shows while SignalR establishes connection

Expected behavior:
- First load: Screen shows → Blazor connects → Screen fades out
- Console: "Starting Blazor Server..." → "Started successfully" → "Hiding"

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-06 11:54:53 +01:00
db2443c7ac Fix: Blazor Server loading screen now works correctly
Problem:
- Loading screen was getting stuck and not hiding properly
- Conflicting logic between pwa.js and inline scripts
- Blazor Server lifecycle not properly integrated with loading screen

Solution (Meziantou-inspired approach for Blazor Server):
1. **blazor-integration.js** - Now manages loading screen lifecycle:
   - Shows loading screen only on first load (sessionStorage check)
   - Hides screen when Blazor.start() promise resolves (SignalR connected)
   - Added reconnection UI for Blazor Server disconnections
   - Proper error handling if Blazor fails to start

2. **_Layout.cshtml** - Simplified loading screen management:
   - Removed inline script that was conflicting
   - Moved blazor-integration.js before pwa.js (load order critical)
   - Loading screen now controlled by Blazor lifecycle

3. **pwa.js** - Removed conflicting logic:
   - Removed hideLoadingScreen() method
   - Removed 5-second fallback timeout
   - PWA initialization no longer interferes with Blazor loading

Key Differences from WebAssembly Approach:
- WASM: Downloads .NET runtime + shows download progress
- Server: Establishes SignalR connection + shows spinner
- Loading screen hides when SignalR connection is ready

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-06 11:45:08 +01:00
9206067e9c Fix: TeleBot order deletion and bot activity tracking
**Fixes Applied:**

1. **Order Deletion Authorization (HTTP 401)**
   - Added [AllowAnonymous] to CancelOrder endpoint
   - Allows customers to cancel orders using IdentityReference
   - File: LittleShop/Controllers/OrdersController.cs:160

2. **Bot Activity Tracking Hostname**
   - Changed littleshop-admin:8080 → littleshop:5000
   - Fixed DNS resolution errors in production
   - Files: TeleBot/appsettings.json, BotActivityTracker.cs, docker-compose.hostinger.yml

3. **Tor Proxy Investigation**
   - Analyzed SOCKS connection failures
   - Tor is working correctly, API blocks exit nodes (expected)
   - Fallback to default currencies working as designed

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-06 11:16:32 +01:00
217de2a5ab Feature: Human-Readable Text Format Product Import
Implemented a new text-based import format for bulk product imports that is
easier to read, write, and version control compared to CSV format.

## New Features

### Import Service (ProductImportService.cs)
- Added `ImportFromHumanTextAsync()` - Main text format parser
- Added `GenerateTemplateAsHumanText()` - Template generator
- Parser supports:
  - Product blocks starting with `#`
  - Descriptions between `<text>` tags (optional)
  - Key-value properties (category, price, weight, unit, stock)
  - Variants (lines starting with `-`)
  - Multi-buy offers (lines starting with `+`)
  - Variant collections (optional, after product name)

### Admin UI
- New controller actions:
  - `ImportText()` - GET: Show import form
  - `ImportText(textContent, file)` - POST: Process import
  - `DownloadTextTemplate()` - Download .txt template
- New view: `ImportText.cshtml`
  - Textarea for pasting text
  - File upload for .txt files
  - Format documentation sidebar
  - Links to CSV import and template downloads
- Updated `Index.cshtml` with dropdown menu for import options

### Template & Documentation
- Created `docs/ProductImportTemplate.txt` with 7 example products
- Demonstrates all format features:
  - Products with/without descriptions
  - Variants with stock levels
  - Multi-buy pricing tiers
  - Multiple weight units

## Text Format Specification

```
# Product Name; OptionalVariantCollection
<text>
Multi-line description (optional)
</text>
category: CategoryName
price: 10.00
weight: 100
unit: Grams
stock: 50

- Variant1; 8.00; 50
- Variant2; 12.00; 30

+ Multi-buy1; 2; 19.00
+ Multi-buy2; 3; 25.00
```

## Benefits
-  Git-friendly (easy to diff and version)
-  Human-readable and editable
-  Supports all product features
-  Multi-line descriptions
-  Clear structure with # delimiters
-  Optional fields (description, variants, multi-buys)
-  Comprehensive error reporting

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-06 05:29:21 +01:00
a6f1c32461 Fix: Delete order now works for Customer-based orders
Root cause: Orders created with CustomerInfo had NULL IdentityReference
- CancelOrderAsync checked order.IdentityReference != identityReference
- NULL != "telegram:12345:username" → always returned false
- User saw "already processed" error even for pending orders

Fix implemented:
- Include Customer entity in CancelOrderAsync query
- Extract Telegram user ID from identity reference format
- Match against Customer.TelegramUserId for modern orders
- Fallback to IdentityReference matching for legacy orders
- Enhanced logging to debug ownership/status issues

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-06 04:56:32 +01:00
330116e315 Fix: Include ProductVariant in all order queries
Root cause: Order queries were missing .ThenInclude(oi => oi.ProductVariant)
which caused ProductVariantName to be null in order DTOs even though
ProductVariantId was stored correctly.

Fixed queries:
- GetAllOrdersAsync (admin panel order list)
- GetOrdersByIdentityAsync (TeleBot order lookup)
- GetOrdersByCustomerIdAsync (customer order history)
- UpdateOrderStatusAsync (order status updates)

Now both TeleBot and admin panel will show which product variation
was selected in order details and order lists.
2025-10-06 00:59:42 +01:00
76707eb565 Fix: Complete workaround for EF Core 9 + SQLite GUID parameter bug - load all variants then filter in-memory 2025-10-05 17:01:52 +01:00
45da991945 Debug: Enhanced logging for variant loading investigation 2025-10-05 17:00:04 +01:00
6f4befa188 Debug: Add logging to GetProductByIdAsync 2025-10-05 16:58:35 +01:00
0e8b53df01 Fix: Apply variant loading workaround to GetProductByIdAsync 2025-10-05 16:55:20 +01:00
7dbdc0d46f Fix: Work around EF Core 9 + SQLite json_each bug preventing variant loading 2025-10-05 16:41:42 +01:00
3a2ef481b0 Debug: Add console logging to variant loading 2025-10-05 16:39:46 +01:00
8d1e3d153c Fix: Manually load ProductVariants with separate query instead of Include
**Root Cause**: EF Core Include() was not properly materializing the Variants navigation
property despite correct SQL JOIN generation.

**Solution**: Load variants separately and manually group by ProductId for DTO mapping.
This bypasses EF Core's navigation property fixup issues.

🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-05 16:33:33 +01:00
53ba1f4079 Try: Use AsSplitQuery to force separate SQL queries for navigation properties
This may help EF Core properly materialize the Variants collection.

🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-05 16:31:40 +01:00
91bcdad9db Fix: Remove AsNoTracking to enable navigation property fixup
AsNoTracking() prevents EF Core from properly wiring up navigation properties.
Removing it allows Include() to populate Variants collection correctly.

🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-05 16:29:48 +01:00
b05645d526 Fix: Load navigation properties before projection to ensure variants are included
**Problem**: EF Core was not materializing Variants navigation property when using
.Select() projection directly in the query. The .Include() was being ignored.

**Solution**: Changed approach to:
1. Load entities with .Include() + .ToListAsync() first
2. Then project to DTO with in-memory .Select()

This ensures navigation properties are fully loaded before mapping to DTOs.

**Impact**: Variants will now properly appear in all product API responses.

🤖 Generated with Claude Code
https://claude.com/claude-code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-04 17:48:30 +01:00
22e910862a Fix: Remove filtered Include for variants in GetProductsByCategoryAsync
Previous commit (e931f77) only fixed GetAllProductsAsync and GetProductByIdAsync.
This commit fixes GetProductsByCategoryAsync which also had the broken filtered Include syntax.

**Impact**: Variants will now appear when browsing products by category in TeleBot.

🤖 Generated with Claude Code
https://claude.com/claude-code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-04 17:45:13 +01:00
e931f772fb Fix: Remove filtered Include for variants - EF Core not executing JOIN
Critical bug where ProductVariants were never loaded from database.

**Problem:**
`.Include(p => p.Variants.Where(v => v.IsActive))` syntax was NOT
generating SQL JOIN statements in EF Core 9.0, causing all products
to return empty variants array even when variants exist in database.

**Solution:**
- Changed to simple `.Include(p => p.Variants)`
- Filtering still happens in DTO mapping (Select statement)
- Only IsActive variants are returned to API consumers

**Impact:**
- TeleBot can now display product variants with selection UI
- Variant pricing and stock levels now visible to customers
- Multi-variant products (e.g., Size/Color) now functional

**Test Case:**
Product 131cc3ad-07f4-4ec9-89ca-b05a0b4cfb41 has 7 variants:
- Size: Small, Medium, Large, XL
- Color: Black, White, Navy Blue
These will now appear in API responses and TeleBot UI.

🤖 Generated with Claude Code
https://claude.com/claude-code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-04 15:23:43 +01:00
d8dcaa51c9 Migration: Add variant pricing support to database schema
Critical fix for production deployment issue where code changes were
deployed without corresponding database schema updates.

Changes:
- Add Price column to ProductVariants table (decimal 18,2, nullable)
- Add ProductVariantId column to OrderItems table (TEXT, nullable)
- Add index on OrderItems.ProductVariantId for query performance

This migration was manually applied to production on 2025-10-04 to
resolve "no such column: p2.Price" errors that broke the product
catalog API.

Future deployments must include database migration steps in CI/CD.

🤖 Generated with Claude Code
https://claude.com/claude-code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-04 14:46:32 +01:00
d4ab0230b4 Fix: Suppress EF Core PendingModelChangesWarning for ProductVariant schema mismatch 2025-10-03 21:08:36 +01:00
c33179f357 Fix: Remove Weight/WeightUnit from EF Core model snapshot for ProductVariant 2025-10-03 21:05:49 +01:00
454cd9bfd9 Fix: Remove Weight/WeightUnit from ProductVariant model - columns don't exist in DB 2025-10-03 21:00:21 +01:00
sysadmin
8075560877 Fix-variant-display-in-API 2025-10-03 20:20:25 +01:00
8385612bcd Fix: Add Price field to variant collection editor
Added Price override input field to the JavaScript variant collection editor on the product Edit page.

**Changes:**
- Added Price input field (with £ symbol) in variant details section
- Updated serialization to save Price to VariantsJson
- Excluded Price from variant label generation
- Updated button text: "Price, Stock & Weight Details"

**Location:**
Product Edit > Variants Collection > Toggle Details > Price Override

Now variant prices can be set through BOTH methods:
1. Individual variant management (CreateVariant/EditVariant)
2. Bulk variant collection editor (product Edit page)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-03 18:45:13 +01:00
d9efababa6 Feature: Add product variant price override support
Enables individual variants to have their own prices, overriding the base product price.

**Database Changes:**
- Added Price (decimal?, nullable) to ProductVariants table
- Added ProductVariantId to OrderItems table with foreign key relationship
- Created index on OrderItems.ProductVariantId for performance

**API Changes:**
- ProductVariantDto: Added Price field
- CreateProductVariantDto: Added Price field with validation
- UpdateProductVariantDto: Added Price field
- OrderItemDto: Added ProductVariantId and ProductVariantName
- CreateOrderItemDto: Added ProductVariantId

**Business Logic:**
- OrderService: Variant price overrides base price (but multi-buy takes precedence)
- ProductService: All variant CRUD operations support Price field

**Admin UI:**
- CreateVariant: Price input with £ symbol and base price placeholder
- EditVariant: Price editing with £ symbol
- ProductVariants list: Shows variant price or "(base)" indicator

**Client Library:**
- Updated all DTOs to match server-side changes
- Full support for variant pricing in order creation

**Migration:**
- EF Core migration: 20251003173458_AddVariantPricing
- Backward compatible: NULL values supported for existing data

**Use Case:**
Products with size/color variants can now have different prices:
- Small T-shirt: £15.00 (variant override)
- Medium T-shirt: £18.00 (uses base price)
- Large T-shirt: £20.00 (variant override)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-03 18:35:43 +01:00
68131b6549 Fix: Order creation validation - Support CustomerInfo without IdentityReference
## Issue
Order creation failing with 400 BadRequest when using CustomerInfo (Telegram users).
Validator required IdentityReference to always be populated, but it's null when using CustomerInfo.

## Root Cause
CreateOrderDtoValidator.cs:10-12 enforced NotEmpty() on IdentityReference unconditionally.
TeleBot sends CustomerInfo for identified users, leaving IdentityReference null.

## Solution
Updated validator to accept EITHER IdentityReference OR CustomerInfo:
- New rule: At least one must be provided
- IdentityReference validation only applies when it's provided (.When() condition)
- Maintains backward compatibility with anonymous orders

## Impact
 Telegram bot orders can now be created successfully
 Anonymous orders still require IdentityReference
 Proper validation error messages for both scenarios

## Testing Required
- Create order via Telegram bot (with CustomerInfo)
- Create anonymous order (with IdentityReference)
- Verify both scenarios work correctly

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-03 18:02:23 +01:00
sysadmin
c961dfa47a "Add-Multi-Buy-section-to-product-editor" 2025-10-03 14:41:00 +01:00
a9925cd61c Fix: Correct Variants menu to use VariantCollections controller
Fixed 404 error - the controller is named VariantCollectionsController,
not ProductVariantsController.

Changes:
- Updated desktop nav to use VariantCollections controller
- Updated mobile menu to use VariantCollections controller

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-03 14:34:27 +01:00
e84fad440d Restore: Add Variants menu option back to navigation
Re-added Variants menu item to both desktop and mobile navigation.
User needs access to ProductVariants management to create variant collections.

Changes:
- Desktop nav: Added Variants between Products and Orders
- Mobile drawer: Added Variants between Products and Shipping

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-03 14:26:27 +01:00
ec955e49d9 Fix: Categories Edit IsActive checkbox now works both ways
Fixed two issues preventing IsActive toggle:
1. Removed hidden field that was sending "false" even when checkbox checked
2. Updated CategoryService to always update IsActive, treating null as false

Checkbox behavior:
- Checked → sends "true" → IsActive = true
- Unchecked → sends nothing (null) → IsActive = false (via ?? operator)

This allows both setting inactive→active and active→inactive.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-03 13:48:56 +01:00