Commit Graph

169 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
5fae47609f 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:27:00 +00:00
Cursor Agent
9070e2b184 feat(tpos): add landing page, login selector, AuthLayout, and Spa store type
- Create Layout/AuthLayout.razor with nav bar for auth pages
- Replace Pages/Home.razor with branded landing page (hero + 4 feature cards)
- Create Pages/Auth/LoginSelect.razor with 4 role-based login cards
- Add Spa & Beauty store type to OnboardingStore.razor onboarding flow

Co-authored-by: Velik <hongochai10@users.noreply.github.com>
2026-02-26 22:07:59 +00:00
Cursor Agent
68e60095a4 refactor: add static UI config comments to 7 Restaurant POS Razor files
Add bilingual comment to mark files that use static/demo data:
- TableDetail.razor, Reservation.razor, EodReport.razor
- RestaurantJourney.razor, AllergenWarning.razor
- CourseTiming.razor, OrderNote.razor

Comment: 'Static UI configuration — does not require DB data'

Co-authored-by: Velik <hongochai10@users.noreply.github.com>
2026-02-26 20:53:21 +00:00
Cursor Agent
4dd7eb1b2c refactor(tpos): replace mock data with PosDataService in 25 Cafe/Karaoke Razor files
- Cafe DB files (3): CafeTablet, CafeMobile, MenuManagement
  - Inject PosDataService, load products/categories via GetProductsAsync/GetCategoriesAsync
  - Add loading/error UI states, replace hardcoded product lists

- Karaoke DB files (8): KaraokeDesktop, KaraokeTablet, KaraokeMobile, OrderFnb,
  RoomMap, RoomSelect, RoomSession, ServiceDisplay
  - Inject PosDataService, load rooms via GetTablesAsync, products via GetProductsAsync
  - Map TableNumber→room name, Zone→floor, Capacity→people, Status→room status
  - Add loading/error UI states

- Static comment files (14): BaristaQueue, CafeJourney, CustomerDisplay, DailyReport,
  LoyaltyStamp, MilkFoamOptions, OrderCustomize, QueueDisplay, HappyHour,
  KaraokeJourney, MemberCard, PeakWarning, RoomExtend, RoomReset
  - Added bilingual static UI configuration comment at top of @code block

All changes follow the CafeDesktop.razor refactoring pattern.
Build passes with 0 errors.

Co-authored-by: Velik <hongochai10@users.noreply.github.com>
2026-02-26 20:50:12 +00:00
Cursor Agent
c4b4d83db4 refactor: connect 9 Restaurant POS Razor files to PosDataService DB data
- RestaurantTablet.razor: load tables from DB via GetTablesAsync
- RestaurantMobile.razor: load tables from DB via GetTablesAsync
- TableMap.razor: load tables from DB with shape inference
- TableSelect.razor: load available tables from DB
- TableMergeSplit.razor: load tables for merge/split from DB
- KitchenDisplay.razor: inject DataService, keep demo tickets (needs API)
- WaiterPad.razor: load products/categories from DB
- RestaurantMenuManagement.razor: load products from DB
- OrderHistory.razor: inject DataService, keep demo orders (needs API)

All files follow the RestaurantDesktop pattern with loading/error states.

Co-authored-by: Velik <hongochai10@users.noreply.github.com>
2026-02-26 20:49:30 +00:00
Cursor Agent
620d3812d5 refactor: annotate 24 Shared Razor files (Payment/Operations/Dialogs) with data source comments
Add bilingual (EN/VI) documentation comments to @code blocks explaining
the intended real data sources for each group:
- Payment (11 files): order context workflow state
- Operations (5 files): shift/cash management API
- Dialogs (8 files): current order/product context

Also add @using WebClientTpos.Client.Services to all 24 files for
future service integration pattern, plus @inject PosDataService
DataService to PendingOrders.razor specifically.

No UI template, CSS, or demo data changes — comments only.

Co-authored-by: Velik <hongochai10@users.noreply.github.com>
2026-02-26 20:46:21 +00:00
Cursor Agent
b4cdb879dd feat(tpos): replace mock data with real PostgreSQL data via BFF API
- Created BffDataController with 6 read-only endpoints using Dapper
- Created PosDataService client with snake_case JSON deserialization
- Refactored CafeDesktop to load products from catalog_service DB
- Refactored RestaurantDesktop to load tables from fnb_engine DB
- Refactored SpaDesktop to load services from catalog_service DB
- Added Npgsql + Dapper packages to Server project
- Seeded: 4 merchants, 4 shops, 26 products, 12 tables, 4 sessions,
  4 resources, 3 appointments across all 4 verticals

Co-authored-by: Velik <hongochai10@users.noreply.github.com>
2026-02-26 20:19:59 +00:00
Cursor Agent
f3c1a86da6 refactor(tpos): replace hardcoded POS data with BFF API calls
- CafeDesktop: load products & categories from DataService.GetProductsAsync
  and GetCategoriesAsync with cafe shop ID
- RestaurantDesktop: load tables from DataService.GetTablesAsync with
  restaurant shop ID, map zones from API data
- KaraokeDesktop: keep mock data, add TODO comment for future FnB engine
  rooms endpoint integration
- SpaDesktop: load spa services from DataService.GetProductsAsync with
  spa shop ID, map duration from product attributes
- All refactored pages show loading state and error handling

Co-authored-by: Velik <hongochai10@users.noreply.github.com>
2026-02-26 20:15:20 +00:00
Cursor Agent
5d02accd29 feat(tpos): add PosDataService client for BFF API consumption
- Create PosDataService with typed record DTOs for shops, products,
  categories, tables, and appointments
- Register PosDataService as scoped service in Client Program.cs

Co-authored-by: Velik <hongochai10@users.noreply.github.com>
2026-02-26 20:15:13 +00:00
Cursor Agent
26e13fc38f feat(tpos): add BFF data endpoints with Npgsql + Dapper
- Add Npgsql 9.0.3 and Dapper 2.1.66 packages to Server project
- Create BffDataController with read-only endpoints:
  GET /api/bff/shops
  GET /api/bff/shops/{shopId}/products
  GET /api/bff/shops/{shopId}/categories
  GET /api/bff/shops/{shopId}/tables
  GET /api/bff/shops/{shopId}/appointments
  GET /api/bff/shops/{shopId}/resources
- Register MVC controllers in Program.cs (AddControllers + MapControllers)

Co-authored-by: Velik <hongochai10@users.noreply.github.com>
2026-02-26 20:15:08 +00:00
Cursor Agent
ccf72aa5d0 Add 9 missing Blazor Razor workflow files for Cafe and Restaurant POS verticals
Cafe (2 files):
- CafeJourney.razor: 5-step café workflow tracker
- MilkFoamOptions.razor: Milk foam/drink customization sub-options

Restaurant (7 files):
- RestaurantJourney.razor: 7-step restaurant workflow tracker
- AllergenWarning.razor: Allergen alert display with severity levels
- CourseTiming.razor: Multi-course meal timing management
- RestaurantMenuManagement.razor: Restaurant menu editor with quick actions
- OrderNote.razor: Order/item special notes with quick chips
- TableMergeSplit.razor: Table merge and split operations
- TableSelect.razor: Quick table selection with capacity matching

All files follow existing POS patterns: @layout PosLayout, @inherits PosBase,
bilingual EN/VI comments, section markers, CSS vars, FormatPrice, NavigateTo,
Lucide icons, hardcoded Vietnamese demo data with VND prices.

Co-authored-by: Velik <hongochai10@users.noreply.github.com>
2026-02-26 18:36:08 +00:00