Commit Graph

569 Commits

Author SHA1 Message Date
Ho Ngoc Hai
d9fda3f54f fix(web-client-tpos): add missing kitchen/recipes data loading in ShopPage
ShopPage LoadSectionData switch was missing cases for kitchen and recipes sections. Added data fetch calls for GetKitchenTicketsAsync and GetRecipesAsync on section navigation.
2026-03-04 07:49:26 +07:00
Ho Ngoc Hai
d95e80f274 feat(web-client-tpos): tables, appointments, resources, schedules, kitchen, recipes CRUD
DB Migration:
- Created recipes + recipe_ingredients tables in catalog_service

BFF Endpoints (18 new):
- POST/PUT/DELETE tables — F&B table management (fnb_engine)
- POST/PUT/DELETE appointments — booking CRUD (booking_service)
- POST/PUT/DELETE resources — room/equipment CRUD (booking_service)
- POST/PUT/DELETE schedules — staff schedules (booking_service)
- GET/PUT kitchen/tickets — KDS ticket management (fnb_engine)
- GET/POST/PUT/DELETE recipes — recipe + ingredients CRUD (catalog_service)

PosDataService (12 new methods + DTOs)
ShopPage UI (325 lines): real UI for all 6 sections replacing placeholders
2026-03-04 05:12:48 +07:00
Ho Ngoc Hai
33047afa75 feat(web-client-tpos): Phase C-E — shop settings, top products report, enhanced placeholders
BFF Endpoints (3 new):
- GET/PUT shops/{id}/settings — shop features config, hours, days
- GET reports/top-products — bestselling products by quantity + revenue

PosDataService (3 new methods):
- GetShopSettings, UpdateShopSettings, GetTopProducts

ShopPage UI (149 lines):
- Settings tab: opening hours, business days, features config form
- Reports tab: top products table alongside revenue report
- Enhanced default placeholder for sections without DB tables
2026-03-03 21:36:52 +07:00
Ho Ngoc Hai
96301831f1 feat(web-client-tpos): Phase B — campaigns CRUD, customer CRUD, fixed promotions query
BFF Endpoints (6 new):
- POST/PUT/DELETE campaigns — CRUD with merchant ownership validation
- POST/PUT/DELETE members — customer CRUD with soft-delete
- Fixed GetPromotions: promotions → campaigns table

PosDataService (6 new methods):
- CreateCampaign, UpdateCampaign, DeleteCampaign
- CreateMember, UpdateMember, DeleteMember

ShopPage UI (191 lines):
- Promotions tab: campaign table with add/edit/delete + form
- Customers tab: add/edit/delete buttons on member rows
2026-03-03 21:30:27 +07:00
Ho Ngoc Hai
14d6c4012c feat(web-client-tpos): Phase A — categories CRUD, order management, shop update, reports
BFF Endpoints (6 new):
- POST/PUT/DELETE categories — full CRUD with shop ownership validation
- GET orders/{id} — order detail with items
- PUT orders/{id}/cancel — cancel non-completed orders (status=6)
- PUT shops/{id} — update name, phone, email, hours
- GET reports/revenue — daily/weekly/monthly revenue aggregation

PosDataService (8 new methods):
- CreateCategory, UpdateCategory, DeleteCategory
- GetOrderDetail, CancelOrder
- UpdateShop
- GetRevenueReport

ShopPage UI (222 lines):
- Menu tab: categories table with add/edit/delete
- Finance tab: expandable order rows with items + cancel button
- Overview tab: shop info edit form
- Reports tab: period selector (Ngày/Tuần/Tháng) + revenue table
2026-03-03 21:22:25 +07:00
Ho Ngoc Hai
aab80fd697 fix(web-client-tpos): add permissions and user_id to CreateStaff INSERT
Fix NOT NULL constraint violations in merchant_staff table:
- Add permissions = 0 (default no permissions)
- Add user_id = Guid.Empty (placeholder until linked)
- Verified: CREATE→UPDATE→DELETE all working
2026-03-03 20:46:49 +07:00
Ho Ngoc Hai
15b17f54ca feat(web-client-tpos): add staff update/delete and inventory update CRUD
BFF Endpoints:
- PUT /api/bff/staff/{id} — update employee code, role, phone, email
- DELETE /api/bff/staff/{id} — soft-delete (set status=Terminated)
- PUT /api/bff/inventory/{id} — update quantity and reorder level
- Fix CreateStaff: Forbid→Unauthorized, add created_at to INSERT

PosDataService Methods:
- UpdateStaffAsync(Guid, CreateStaffRequest)
- DeleteStaffAsync(Guid)
- UpdateInventoryAsync(Guid, UpdateInventoryRequest)

ShopPage.razor UI:
- Staff table: new Hành động column with edit/delete buttons
- Staff form: switches between Thêm/Chỉnh sửa mode
- EditStaff, SaveStaffEdit, DeleteStaffMember methods
2026-03-03 20:34:56 +07:00
Ho Ngoc Hai
8cba9021d0 feat(web-client-tpos): add product update (PUT) endpoint and edit UI
- Add PUT /api/bff/products/{id} endpoint with ownership validation
- Add UpdateProductAsync to PosDataService
- Add edit button (pencil icon) on each product card
- Form supports edit mode: title/button text changes, pre-fills values
- Add EditProduct and SaveProduct methods in ShopPage.razor
- Full CRUD: Create, Read, Update, Delete all functional
2026-03-03 20:18:09 +07:00
Ho Ngoc Hai
a791830012 feat(web-client-tpos): add date filter to order history and payment method display
- Add filter param (today/week/month) to BFF GetOrders endpoint
- Update PosDataService.GetOrdersAsync with filter parameter
- Wire History tab filter buttons to reload API with date range
- Add payment_method and notes to OrderInfo DTO
- Add MapPaymentMethodLabel helper for Vietnamese labels
- Include payment_method in API order history cards
2026-03-03 20:08:30 +07:00
Ho Ngoc Hai
7562fc1e1f feat(web-client-tpos): add receipt print with thermal 80mm layout
- Create pos-helpers.js with printPosReceipt JS function
- Add PrintReceipt method to CafeDesktop.razor (thermal receipt HTML)
- Save receipt items/payment data before cart reset
- Register pos-helpers.js in index.html
- Inject IJSRuntime for print popup
2026-03-03 20:02:15 +07:00
Ho Ngoc Hai
e74527dc8f feat(web-client-tpos): implement POS order creation via BFF API
- Add POST /api/bff/pos/orders endpoint (Dapper, order+items+payment_method)
- Add CreatePosOrderAsync to PosDataService with camelCase JSON serialization
- Wire CafeDesktop ConfirmPayment to API (async, ProductId tracking, fallback)
- Add TryRestoreSessionAsync to POS page init for JWT auth
- Replace Forbid() with Unauthorized() + diagnostic logging
2026-03-03 15:23:12 +07:00
Ho Ngoc Hai
d969f3dda8 feat(web-client-tpos): replace hardcoded POS data with API-driven endpoints 2026-03-03 11:27:34 +07:00
Ho Ngoc Hai
fe6e14ce85 feat(web-client-tpos): unify POS with inline payment and tabs (path fix) 2026-03-03 11:13:27 +07:00
Ho Ngoc Hai
15404a859f feat(web-client-tpos): unify POS page with tabs and inline payment 2026-03-03 11:12:48 +07:00
Ho Ngoc Hai
617a7caf81 fix(iam-service): resolve 500 error on GET /api/v1/users endpoint 2026-03-03 10:48:13 +07:00
Ho Ngoc Hai
ad6fe03b70 feat(web-client): add users management page and enhance roles CRUD
- Expand IamApiService with Users CRUD, Role mutations, role assignment methods
- Create UserManagement.razor page at /admin/users with user list + role assignment
- Enhance RolePermissions.razor with create/edit/delete role dialogs
- Add Users nav item to AdminLayout sidebar
- Add localization keys (vi-VN, en-US) for Users navigation
2026-03-03 10:19:22 +07:00
Ho Ngoc Hai
f3bfcc87f8 fix(web-client-tpos): fix roles API response parsing and property mapping 2026-03-01 06:31:47 +07:00
Ho Ngoc Hai
ea59326658 fix(iam-service): add try-catch to role seeding for visible error logging 2026-03-01 06:17:08 +07:00
Ho Ngoc Hai
f353f8843e feat(web-client-tpos): redesign Home/NotFound pages, localize Dashboard 2026-03-01 06:02:20 +07:00
Ho Ngoc Hai
33e0bab4f7 refactor(web-client-tpos): centralize theme, fix layout bugs, cleanup dead code 2026-03-01 05:58:58 +07:00
Ho Ngoc Hai
cb6337cb7c test(merchant-service): add 38 unit tests for Shop aggregate and ShopFeatures 2026-03-01 05:50:58 +07:00
Ho Ngoc Hai
9c51d268c6 feat(web-client-tpos): internationalize sidebar and admin labels with i18n keys 2026-03-01 05:44:10 +07:00
Ho Ngoc Hai
1acc0c399b fix(merchant-service): add vertical-specific categories to ShopFeatures.ForCategory() 2026-03-01 05:39:16 +07:00
Ho Ngoc Hai
cc0e642c43 feat(admin): P6 — Zones, Combo services, Shift management
- R4: Zone management (Restaurant) — 4 zones with table counts, status, actions
- S6: Combo services (Spa) — 3 combo cards with pricing, duration, sold count
- C5: Shift management (Café) — weekly shift grid (S/C/—) with legend + stats
2026-03-01 05:22:32 +07:00
Ho Ngoc Hai
8ec9e2a45a feat(admin): P5 — Recipes, Reservations, Happy Hour, Packages, Consent, Doctors, Follow-up
- C2: Ingredient/recipe management (Café) — 8 demo items with stock status
- R3: Reservation management (Restaurant) — booking table with 5 demo entries
- K3: Happy Hour config (Karaoke) — time slots, discounts, day picker, combos
- S4: Service packages (Spa) — 3 package cards with pricing/savings
- B5: Consent forms (Beauty) — 4 template cards with field counts
- B6: Doctor management (Beauty) — 4 specialist cards with credentials
- B7: Follow-up scheduler (Beauty) — re-exam table with status tracking
2026-03-01 05:01:57 +07:00
Ho Ngoc Hai
81e357d226 feat(admin): P4 — Notifications, Customer detail, Photo upload
- G9: Notification bell with dropdown panel (4 demo alerts)
- G6+: Customer detail expandable rows + action buttons
- B4: Before/After photo upload with dual dropzones + history grid
2026-03-01 04:43:18 +07:00
Ho Ngoc Hai
644751be7b feat(admin): P3 — Karaoke hourly pricing + product type badges
- K2+K5: Room hourly rate (VIP 200k, Party 350k, Standard 120k/h)
- K2+K5: Active session billing calculator (elapsed hours × rate)
- C3-C4: Product type badge (Đồ uống/Dịch vụ/Vật lý)
- C3-C4: Variant/topping tag parsing from product description
2026-03-01 04:32:13 +07:00
Ho Ngoc Hai
8ea22b22b9 feat(admin): P2 features — Calendar, KDS, Room types, Medical, Receipt
- S5: Appointment calendar view (7-day grid, week nav, today highlight)
- R2: Kitchen Display demo with station tabs (Bếp/Bar/Nướng)
- K4: Room type badges (VIP/Standard/Party) from zone field
- B2: Treatments tabbed view (Liệu trình/Hồ sơ y tế/Ảnh Before-After)
- G10: Receipt settings panel (header/footer, paper size, logo, QR code)
- Added _calendarWeekOffset, _kdsStation, _treatmentTab state vars
2026-03-01 04:24:47 +07:00
Ho Ngoc Hai
0959f594bd fix(bff): add try-catch to GetWallets and GetWalletTransactions
- Prevent 500 errors when wallet_service tables are missing
- Return empty arrays on failure for graceful Finance page display
- Now 7 total BFF endpoints hardened against missing tables
2026-03-01 04:14:36 +07:00
Ho Ngoc Hai
f045dbf5ed feat(admin): enhance Customer search + Finance date filter (G6, G8)
- Customers: add search bar (filter by ID, membership level)
- Customers: membership level displays as badge
- Customers: show count header with search input
- Finance: add date range tabs (7 ngày / 30 ngày / Tất cả)
- Finance: revenue/order stats update based on selected period
2026-03-01 04:08:38 +07:00
Ho Ngoc Hai
a6e85d0451 feat(admin): add Staff Schedule UI for Spa/Beauty (S3)
- Add "Lịch làm việc" menu item to Spa & Beauty sidebars
- Add case "schedule": section with stat cards + weekly table
- Display employee code, role, day (T2-CN), start/end time
- Add DayLabel helper for Vietnamese day names
- Add LoadData case + section title config
2026-03-01 04:02:55 +07:00
Ho Ngoc Hai
e5b3aa58fb fix(admin-layout): fix Guest display, error bar, empty shops
- Subscribe to AuthState.OnChange to refresh user info after login
- Call TryRestoreSessionAsync on first render to restore from localStorage
- Wrap Body in ErrorBoundary with custom UI (replaces red error bar)
- Properly unsubscribe OnChange in Dispose to prevent memory leaks
2026-03-01 00:11:23 +07:00
Ho Ngoc Hai
59521f6fd6 fix(bff): add try-catch to prevent 500 on missing DB tables
- Members, MembershipLevels: membership_service tables
- Promotions: promotion_service campaigns table
- StaffRoles, StaffSchedules: booking_service tables
- All return empty array instead of 500 Internal Server Error
2026-02-28 23:52:18 +07:00
Ho Ngoc Hai
d8b65a368f feat(multi-vertical): P2 — resources real data, treatments enhanced, inv txns
- Resources: real table from booking_service (stats + capacity + status)
- Treatments: enhanced UI with Before/After, tái khám, hồ sơ y tế chips
- Inventory: transactions loading wired to GetInventoryTransactionsAsync
- PosDataService: added GetResourcesAsync for booking resources
- LoadData: resources, inventory txns cases added
2026-02-28 23:35:47 +07:00
Ho Ngoc Hai
549bfcb038 feat(multi-vertical): P1 — promotions real data, finance wallets, customer levels
- Promotions: real table from GetPromotionsAsync (stats: total, active, vouchers, used)
- Finance: wallet balance + recent wallet transactions from GetWalletsAsync
- Customers: membership levels table from GetMembershipLevelsAsync
- Staff: schedules data wired from GetStaffSchedulesAsync
- Data vars: wallets, walletTxns, promotions, memberLevels, staffSchedules, invTxns
2026-02-28 23:18:12 +07:00
Ho Ngoc Hai
6d6d6a9f3b feat(multi-vertical): staff CRUD, enhanced reports, ShopInfo MerchantId
- G5: Staff CRUD — add form (employee code, role, phone, email) + AddStaff method
- G7: Reports enhanced with Top Products table (ranked by price)
- Added MerchantId to ShopInfo record for staff creation
- Staff table shows SĐT column instead of Cửa hàng
2026-02-28 23:08:38 +07:00
Ho Ngoc Hai
36da982386 fix(merchant-service): resolve MapToDetailDto NullRef on shop detail API
- Add null-safe access for Type, Category, Status, ContactInfo, Branches
- Fixes 500 error when loading shop details in admin UI
2026-02-28 22:53:38 +07:00
Ho Ngoc Hai
3f89e1b490 feat(multi-vertical): phases 1-3 — overview dashboard, product CRUD, beauty vertical, settings
- G1: Overview Dashboard with vertical-specific KPIs (tables/rooms/appointments)
- G2: Settings page (shop info, business hours, tax/VAT config)
- G3: Promotions placeholder section
- G4: Product CRUD (add form + delete button per product)
- B1: Beauty separated as its own vertical (icon: scissors, color: #A855F7)
- B3: Treatments placeholder for beauty liệu trình
- S2: Resources placeholder for spa/beauty
- All verticals now have Settings + Khuyến mãi in sidebar
2026-02-28 22:41:06 +07:00
Ho Ngoc Hai
4e91c96c97 feat(multi-vertical): phase 0 — seed data script + fix GetShopsQueryHandler NullRef
- Add scripts/seed-demo-data.sh: creates user, merchant, 5 shops, 47 products, 15 categories, 18 tables/rooms, 13 booking resources
- Fix NullReferenceException in GetShopsQueryHandler (null-safe Enumeration access)
- Default account: hongochai10@icloud.com / Velik@2026
2026-02-28 22:32:51 +07:00
Ho Ngoc Hai
cd553a1497 fix(web-client-tpos): fix Lucide icon rendering and setup button navigation
- Add MutationObserver to auto-call lucide.createIcons() when Blazor adds DOM nodes
- Pin Lucide CDN to v0.468.0 for stability (was @latest)
- Fix "Hoàn tất thiết lập" button: navigate to /admin/shop/{id}/overview (was non-existent /admin/stores/{id}/settings)
- All sidebar, dashboard, store list, and store create icons now render correctly
2026-02-28 22:06:32 +07:00
Ho Ngoc Hai
b3c962f3d8 chore: delete temporary notes and agent documentation files 2026-02-28 21:52:05 +07:00
Ho Ngoc Hai
f52813d9cd chore(agent-prompts): remove old agent prompt files 2026-02-28 21:48:36 +07:00
Ho Ngoc Hai
c838d3627b fix(web-client-tpos): add multi-tenant data isolation to BFF controller
- Implement manual JWT parsing from Authorization header in BffDataController
- Add GetUserIdFromToken() and GetCurrentMerchantIdAsync() helpers
- Scope all 15 BFF endpoints by merchant ownership (shops, products, orders, staff, inventory, wallets, stats)
- Validate ownership on write operations (CreateProduct, CreateStaff, DeleteProduct)
- Add AttachToken() to all 23 PosDataService methods to forward auth token to BFF
- Add JwtSecurityTokenHandler NuGet package for token decoding
2026-02-28 12:20:17 +07:00
Ho Ngoc Hai
f8c2e65d2b fix(admin): update remaining hardcoded /pos links to use dynamic ShopId in ShopOverview and ShopPage 2026-02-28 11:39:39 +07:00
Ho Ngoc Hai
75bcff209b refactor(pos): replace hardcoded shop IDs with dynamic ShopId route parameter across all POS files 2026-02-28 11:22:46 +07:00
Ho Ngoc Hai
364ba541ea feat(web-client): fix category mapping for multi-vertical sidebars
- StoreCreate: use vertical names (Cafe/Restaurant/Karaoke/Spa/Beauty)
- StoreCreate: add 5th store type (Thẩm mỹ viện), 3-column grid
- NormalizeVertical: handle Services category for Spa vertical
- Categories now properly distinguish each vertical type
2026-02-28 08:50:08 +07:00
Ho Ngoc Hai
fd9173237f feat(merchant-service): add Cafe/Restaurant/Karaoke/Spa business categories
Add vertical-specific BusinessCategory enum values:
- Cafe (11), Restaurant (12), Karaoke (13), Spa (14)
Update CreateShopCommandHandler to map vertical names to new categories
Update EF Core seed data with new categories
2026-02-28 08:49:58 +07:00
Ho Ngoc Hai
ee33075ada feat(web-client): implement all vertical-specific sections in ShopPage
- Tables (Restaurant): grid UI with status colors and session info
- Rooms (Karaoke): reuses tables structure with purple theme
- Appointments (Spa): KPI cards + calendar list with status colors
- Services (Spa): products filtered by type=Service
- POS: redirect prompt to /pos page
- Reports: aggregate KPIs (revenue, orders, avg value, products)
- Kitchen: KDS placeholder with description
2026-02-28 07:12:40 +07:00
Ho Ngoc Hai
ceed3b7def chore(web-client): delete 9 orphaned pages replaced by ShopPage sections 2026-02-28 07:04:32 +07:00
Ho Ngoc Hai
abd709d31c fix(web-client): audit fixes — real shop stats, dynamic CTA links, shared helpers
- C1: StoreList shows real per-shop stats (revenue/orders/staff/products) via new BFF endpoint
- C2: RenderEmpty CTA links now route to correct section (finance→/pos, inventory→/menu, etc.)
- C3+M5: ShopOverview right column shows real recent orders instead of always-empty
- C4: AdminSettings expanded from 5 hardcoded services to 11 with icons
- M1-M3: Consolidated duplicate helpers (GetShopIcon, GetStatusBadgeClass, GetStatusLabel) into ShopVerticalHelper
- M2: Added proper error state UI for StoreList data loading failures
- Added GET /api/bff/shops/stats BFF endpoint for aggregated per-shop statistics
2026-02-28 06:56:27 +07:00