Commit Graph

540 Commits

Author SHA1 Message Date
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
Ho Ngoc Hai
d703109096 refactor(web-client): audit shop sidebar — fix bugs, DRY code, enhance UX
P1 Bug Fixes:
- Fix Finance stat spacing (0₫ → 0 ₫)
- Replace 3 empty catch blocks with error state UI + logging
- Make POS button functional (navigate to /pos)
- Add @implements IDisposable to AdminLayout

P2 Code Quality:
- Create ShopVerticalHelper.cs (DRY icon/label/normalize)
- Remove dead overview case from ShopPage.razor
- Delete 15 orphaned admin pages (moved to shop-scope)
- ShopSidebarConfig delegates to ShopVerticalHelper

P3 UX Enhancement:
- Add CTA buttons to all empty states
- Real KPIs in ShopOverview (orders, products, revenue)
- User role from auth token (Admin/Khách)
- Responsive CSS for stat cards, tables, mobile sidebar
2026-02-28 06:36:41 +07:00
Ho Ngoc Hai
f7e431fd01 refactor(web-client-tpos): move business pages to shop-scoped sidebar
- AdminLayout: removed Sản phẩm, Kho hàng, Tài chính, Nhân sự, Khách hàng from admin sidebar
- ShopSidebarConfig: added Finance to all 4 verticals (Café, Restaurant, Karaoke, Spa)
- ShopPage: rewritten with real API data for menu/inventory/finance/staff/customers sections
- Each section filtered by shopId, loads only required data
2026-02-28 06:19:41 +07:00
Ho Ngoc Hai
545bc1f519 feat(web-client-tpos): connect all remaining admin pages to real backend APIs
- BFF: Added 10 new endpoints (staff roles/schedules, orders, wallets, devices, promotions, inventory transactions, membership levels)
- PosDataService: Added 14 new client methods with DTOs
- Rewrote 19 admin pages from hardcoded to real API:
  Staff: Create, Schedule, Attendance, Payroll
  Finance: Overview, Revenue, Expenses, Tax
  Inventory: PurchaseOrders, StockTransfer, SupplierMgmt
  Product: MenuBuilder, ModifierGroups, PricingRules
  Customer: Feedback, LoyaltyProgram
  System: DeviceManagement, NotificationCenter, IntegrationHub
2026-02-28 06:05:50 +07:00
Ho Ngoc Hai
e0d7567cf0 feat(web-client-tpos): connect inventory and customer pages to real API data 2026-02-28 05:48:54 +07:00
Ho Ngoc Hai
5a81fee85a feat(web-client-tpos): connect product catalog and create to catalog-service API 2026-02-28 05:42:52 +07:00
Ho Ngoc Hai
51cc8b249c feat(web-client-tpos): add shop-level pages and per-vertical sidebar switching 2026-02-28 05:24:07 +07:00
Ho Ngoc Hai
fa0efbd669 refactor(web-client-tpos): restructure sidebar from 5 to 12 items across 4 logical groups 2026-02-28 05:07:28 +07:00
Ho Ngoc Hai
0379de323c feat(web-client-tpos): rewrite staff, roles, audit, settings pages with real API data 2026-02-28 04:51:28 +07:00
Ho Ngoc Hai
1f0d11490e feat(web-client-tpos): add IamApiService, StaffInfo DTO, and DI registration 2026-02-28 04:51:21 +07:00
Ho Ngoc Hai
53fda4935c feat(web-client-tpos): add BFF staff endpoint for admin staff directory 2026-02-28 04:51:11 +07:00
Ho Ngoc Hai
12be9737d9 feat(web-client-tpos): replace hardcoded store pages with real API data
- Rewrite StoreList.razor with real data from PosDataService
- Rewrite StoreDetail.razor with real shop data from BFF
- Rewrite StoreSettings.razor with editable form bound to real data
- Add GetShopByIdAsync to PosDataService and BFF endpoint
- Add UpdateShopAsync to MerchantApiService
- Add ShopUpdateDto to MerchantDtos
- Fix BFF DB connection: configurable via env vars (BFF_DB_HOST)
- Add BFF_DB env vars to docker-compose.yml
2026-02-28 04:23:11 +07:00
Ho Ngoc Hai
1e211dec27 fix(web-client): split DisplayName into FirstName/LastName for registration 2026-02-28 04:03:04 +07:00
Ho Ngoc Hai
1caaf5e1e4 fix(web-client-tpos): auto-register merchant before shop creation 2026-02-28 04:00:09 +07:00
Ho Ngoc Hai
a1e27aca46 refactor(web-client-tpos): dashboard data-driven, 2-level sidebar, fix YARP 502 in Docker 2026-02-28 03:51:51 +07:00
Ho Ngoc Hai
07dc82ad49 feat(web-client-tpos): integrate UI with backend APIs for register, login, and shop creation flows 2026-02-28 03:28:21 +07:00
Ho Ngoc Hai
57afe213e4 fix(merchant-service): fix EF Core unmapped property errors in repositories
- Changed repository LINQ queries to use EF.Property<T>() for backing fields
- Expression-bodied properties cannot be auto-mapped by EF Core
- Fixed StatusId comparison in CreateShopCommandHandler (Status nav is null)
- Updated EntityTypeConfiguration comments explaining Ignore pattern
2026-02-28 03:12:42 +07:00
Ho Ngoc Hai
68a6c4a81e fix(iam-service): add custom ResourceOwnerPasswordValidator for Duende password grant
- Created ResourceOwnerPasswordValidator using UserManager.CheckPasswordAsync
- Registered with .AddResourceOwnerValidator<ResourceOwnerPasswordValidator>()
- Added comments explaining EF.Property pattern for DDD backing fields
2026-02-28 03:12:31 +07:00
Ho Ngoc Hai
b9e5c4e31e fix(merchant_service): PendingModelChangesWarning 2026-02-28 02:04:03 +07:00
Ho Ngoc Hai
751f90c365 feat: Log EF Core migration errors instead of crashing the application at startup across all services. 2026-02-28 01:03:43 +07:00
Ho Ngoc Hai
be86e48de6 feat: automatically apply EF Core database migrations on service startup across all services 2026-02-28 00:51:35 +07:00
Ho Ngoc Hai
f521cc0a91 chore: Remove the web-client application, add a local database initialization script, and update service Dockerfiles. 2026-02-28 00:41:17 +07:00
Ho Ngoc Hai
c9894c5e9d feat: remove Eggymon Landing Page application and its associated design files. 2026-02-27 23:48:01 +07:00
Cursor Agent
d0f05328a2 fix(ux): landing page + login selector fully working
- Landing Page at /home renders correctly (GoodGo POS branding)
- Server middleware redirects / → /home (302)
- Login Type Selector at /login with 4 role cards
- All navbar links point to /login
- Simplified Home.razor (removed @layout override that caused routing issue)
- Fixed /auth/login route conflict

Co-authored-by: Velik <hongochai10@users.noreply.github.com>
2026-02-27 09:39:57 +00:00
Cursor Agent
592e02a76b Merge: auth workflow fixes into master
Co-authored-by: Velik <hongochai10@users.noreply.github.com>
2026-02-27 08:36:41 +00:00
Cursor Agent
783d95cbcc fix(ux): auth workflow fixes — customer login, dashboard, auth service, YARP ports
Some checks failed
IAM Service CI / build-and-test (push) Failing after 33s
Mobile Apps CI / dotnet-client-apps (apps/web-client-base-net/src/WebClientBase.Server/WebClientBase.Server.csproj) (push) Failing after 5s
Mobile Apps CI / dotnet-client-apps (apps/web-client-eggymon-landipage-net/src/EggymonLandingPage.Server/EggymonLandingPage.Server.csproj) (push) Failing after 9s
Mobile Apps CI / dotnet-client-apps (apps/web-client-tpos-net/src/WebClientTpos.Server/WebClientTpos.Server.csproj) (push) Failing after 8s
Mobile Apps CI / dotnet-client-app-tests (apps/app-client-base-net/tests/AppClientBase.UnitTests/AppClientBase.UnitTests.csproj) (push) Failing after 7s
Mobile Apps CI / dotnet-client-app-tests (apps/web-client-base-net/tests/WebClientBase.SmokeTests/WebClientBase.SmokeTests.csproj) (push) Failing after 11s
Mobile Apps CI / dotnet-client-app-tests (apps/web-client-eggymon-landipage-net/tests/EggymonLandingPage.SmokeTests/EggymonLandingPage.SmokeTests.csproj) (push) Failing after 9s
Mobile Apps CI / dotnet-client-app-tests (apps/web-client-tpos-net/tests/WebClientTpos.SmokeTests/WebClientTpos.SmokeTests.csproj) (push) Failing after 5s
Mobile Apps CI / maui-project-validation (push) Failing after 3s
Mobile Apps CI / swift-client-app (push) Has been cancelled
Phase 1 fixes:
- Fixed Customer Login route (/auth/login/customer now renders correctly)
- Fixed YARP proxy ports for all microservices
- Fixed login links across all auth pages (/login → /auth/login)
- Created AuthStateService for role-based portal redirects
- Dashboard loads real shop data from BFF API
- Reverted UseBlazorFrameworkFiles (breaks .NET 10 MapStaticAssets)
- Created Home.razor landing page and LoginSelect.razor (compiled in DLL,
  Blazor client routing needs investigation for / and /auth/login routes)

Verified working:
- Customer Login: phone/OTP with social login
- Staff Login: green theme with role hints
- Admin Login: blue theme with security warning
- Branch Login: orange theme with stats
- Registration: form + API via YARP proxy
- Store Onboarding: 5 types (Café/Nhà hàng/Karaoke/Spa/Bán lẻ)

Co-authored-by: Velik <hongochai10@users.noreply.github.com>
2026-02-27 08:35:07 +00:00
Cursor Agent
c1bb68859e fix(admin): dashboard loads shops from BFF API, shows onboarding when empty
- Inject PosDataService and load shops in OnInitializedAsync
- Show 'Welcome! Tạo cửa hàng đầu tiên' with onboarding link when no shops
- Render dynamic shop cards from DB data when shops exist
- Keep existing KPI cards and alerts/activity panels unchanged

Co-authored-by: Velik <hongochai10@users.noreply.github.com>
2026-02-27 07:55:29 +00:00
Cursor Agent
dffda6d618 feat(auth): add AuthStateService for role-based redirects
- Create Services/AuthStateService.cs with Login/Logout/GetPortalUrl
- Register as singleton in Program.cs

Co-authored-by: Velik <hongochai10@users.noreply.github.com>
2026-02-27 07:55:23 +00:00
Cursor Agent
1a0bbf5338 fix(auth): fix LoginCustomer routing and stale /login links
- Remove @page "/login" from LoginCustomer.razor (stale duplicate route)
- Add @layout AuthLayout to LoginCustomer.razor for correct layout
- Fix href="/login" -> href="/auth/login" in VerifyEmail.razor
- Fix href="/login" -> href="/auth/login" in ForgotPassword.razor

Co-authored-by: Velik <hongochai10@users.noreply.github.com>
2026-02-27 07:55:18 +00:00
Cursor Agent
dba704a877 fix(ux): landing page, login selector, YARP ports, Spa store type
- Created Home.razor landing page at / with GoodGo POS branding
- Created LoginSelect.razor role selector at /auth/login
- Created AuthLayout.razor for auth/marketing pages
- Fixed YARP proxy ports: IAM→5001, Merchant→5005, Catalog→5016, Order→5017
- Added Spa & Beauty store type to onboarding (5th option)
- Registration API now works through YARP proxy

Co-authored-by: Velik <hongochai10@users.noreply.github.com>
2026-02-26 22:51:57 +00:00