feat: add configurable currency locale and fix vendor JS init
Currency Locale Configuration: - Add platform-level storefront settings (locale, currency) - Create PlatformSettingsService with resolution chain: vendor → AdminSetting → environment → hardcoded fallback - Add storefront_locale nullable field to Vendor model - Update shop routes to resolve and pass locale to templates - Add window.SHOP_CONFIG for frontend JavaScript access - Centralize formatPrice() in shop-layout.js using SHOP_CONFIG - Remove local formatPrice functions from shop templates Vendor JS Bug Fix: - Fix vendorCode being null on all vendor pages - Root cause: page components overriding init() without calling parent - Add parent init call to 14 vendor JS files - Add JS-013 architecture rule to prevent future regressions - Validator now checks vendor JS files for parent init pattern Files changed: - New: app/services/platform_settings_service.py - New: alembic/versions/s7a8b9c0d1e2_add_storefront_locale_to_vendors.py - Modified: 14 vendor JS files, shop templates, validation scripts 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -54,6 +54,7 @@ The OMS is nearly production ready with core order processing, invoicing, invent
|
||||
| Customer profile | Complete | Full profile management |
|
||||
| Customer addresses | Complete | Multiple addresses, address book |
|
||||
| Customer messages | Complete | Conversation-based messaging |
|
||||
| Currency locale | Complete | Configurable platform/vendor locale |
|
||||
|
||||
### Vendor Dashboard (90% Complete)
|
||||
|
||||
@@ -123,6 +124,18 @@ The OMS is nearly production ready with core order processing, invoicing, invent
|
||||
- Integration tests for shop addresses API
|
||||
- All validation scripts fixed and passing
|
||||
|
||||
### Configurable Currency Locale
|
||||
- **Two-tier settings architecture**: Platform defaults with vendor overrides
|
||||
- **Resolution chain**: Vendor setting → AdminSetting → Environment → Hardcoded fallback
|
||||
- **Platform settings service**: New `PlatformSettingsService` for setting resolution
|
||||
- **Configuration options**:
|
||||
- Environment: `DEFAULT_STOREFRONT_LOCALE`, `DEFAULT_CURRENCY` in `.env`
|
||||
- Admin: `default_storefront_locale`, `default_currency` in AdminSetting table
|
||||
- Vendor: `storefront_locale` field on Vendor model (nullable = inherit)
|
||||
- **Supported locales**: fr-LU, de-DE, de-LU, en-GB, nl-BE, etc.
|
||||
- **Frontend**: `window.SHOP_CONFIG` provides locale/currency to JavaScript
|
||||
- **Shared formatPrice()**: Single implementation in `shop-layout.js`
|
||||
|
||||
---
|
||||
|
||||
## Remaining Gaps
|
||||
|
||||
Reference in New Issue
Block a user