diff --git a/app/modules/cms/routes/pages/store.py b/app/modules/cms/routes/pages/store.py index c685ea07..cd086067 100644 --- a/app/modules/cms/routes/pages/store.py +++ b/app/modules/cms/routes/pages/store.py @@ -20,7 +20,8 @@ from app.modules.cms.services import content_page_service from app.modules.core.services.platform_settings_service import ( platform_settings_service, # MOD-004 - shared platform service ) -from app.modules.tenancy.models import Store, User +from app.modules.core.utils.page_context import get_store_context +from app.modules.tenancy.models import User from app.templates_config import templates logger = logging.getLogger(__name__) @@ -33,54 +34,6 @@ ROUTE_CONFIG = { } -# ============================================================================ -# HELPER: Build Store Dashboard Context -# ============================================================================ - - -def get_store_context( - request: Request, - db: Session, - current_user: User, - store_code: str, - **extra_context, -) -> dict: - """ - Build template context for store dashboard pages. - - Resolves locale/currency using the platform settings service with - store override support. - """ - # Load store from database - store = db.query(Store).filter(Store.subdomain == store_code).first() - - # Get platform defaults - platform_config = platform_settings_service.get_storefront_config(db) - - # Resolve with store override - storefront_locale = platform_config["locale"] - storefront_currency = platform_config["currency"] - - if store and store.storefront_locale: - storefront_locale = store.storefront_locale - - context = { - "request": request, - "user": current_user, - "store": store, - "store_code": store_code, - "storefront_locale": storefront_locale, - "storefront_currency": storefront_currency, - "dashboard_language": store.dashboard_language if store else "en", - } - - # Add any extra context - if extra_context: - context.update(extra_context) - - return context - - # ============================================================================ # CONTENT PAGES MANAGEMENT # ============================================================================ diff --git a/app/modules/core/locales/de.json b/app/modules/core/locales/de.json index 37efd140..8d16cdc6 100644 --- a/app/modules/core/locales/de.json +++ b/app/modules/core/locales/de.json @@ -65,8 +65,16 @@ "profile_updated": "Profil erfolgreich aktualisiert" }, "messages": { - "failed_to_load_dashboard_data": "Failed to load dashboard data", - "dashboard_refreshed": "Dashboard refreshed" + "failed_to_load_dashboard_data": "Dashboard-Daten konnten nicht geladen werden", + "dashboard_refreshed": "Dashboard aktualisiert", + "item_removed_from_cart": "Artikel aus dem Warenkorb entfernt", + "cart_cleared": "Warenkorb geleert" + }, + "confirmations": { + "show_all_menu_items": "Alle Menüpunkte werden angezeigt. Fortfahren?", + "hide_all_menu_items": "Alle Menüpunkte werden ausgeblendet (außer obligatorische). Sie können dann die gewünschten aktivieren. Fortfahren?", + "reset_email_settings": "Alle E-Mail-Einstellungen werden auf .env-Standardwerte zurückgesetzt. Fortfahren?", + "cleanup_logs": "Alle Protokolle, die älter als {days} Tage sind, werden gelöscht. Fortfahren?" }, "menu": { "dashboard": "Dashboard", diff --git a/app/modules/core/locales/fr.json b/app/modules/core/locales/fr.json index 98dac978..2bd2b9c9 100644 --- a/app/modules/core/locales/fr.json +++ b/app/modules/core/locales/fr.json @@ -65,8 +65,16 @@ "profile_updated": "Profil mis à jour avec succès" }, "messages": { - "failed_to_load_dashboard_data": "Failed to load dashboard data", - "dashboard_refreshed": "Dashboard refreshed" + "failed_to_load_dashboard_data": "Échec du chargement des données du tableau de bord", + "dashboard_refreshed": "Tableau de bord actualisé", + "item_removed_from_cart": "Article retiré du panier", + "cart_cleared": "Panier vidé" + }, + "confirmations": { + "show_all_menu_items": "Ceci affichera tous les éléments de menu. Continuer ?", + "hide_all_menu_items": "Ceci masquera tous les éléments de menu (sauf les obligatoires). Vous pourrez ensuite activer ceux que vous souhaitez. Continuer ?", + "reset_email_settings": "Ceci réinitialisera tous les paramètres e-mail aux valeurs par défaut .env. Continuer ?", + "cleanup_logs": "Ceci supprimera tous les journaux de plus de {days} jours. Continuer ?" }, "menu": { "dashboard": "Tableau de bord", diff --git a/app/modules/core/locales/lb.json b/app/modules/core/locales/lb.json index 69d46f0e..53ac3843 100644 --- a/app/modules/core/locales/lb.json +++ b/app/modules/core/locales/lb.json @@ -65,8 +65,16 @@ "profile_updated": "Profil erfollegräich aktualiséiert" }, "messages": { - "failed_to_load_dashboard_data": "Failed to load dashboard data", - "dashboard_refreshed": "Dashboard refreshed" + "failed_to_load_dashboard_data": "Dashboard-Donnéeë konnten net geluede ginn", + "dashboard_refreshed": "Dashboard aktualiséiert", + "item_removed_from_cart": "Artikel aus dem Kuerf ewechgeholl", + "cart_cleared": "Kuerf eidel gemaach" + }, + "confirmations": { + "show_all_menu_items": "All Menüpunkten ginn ugewisen. Weidermaachen?", + "hide_all_menu_items": "All Menüpunkten ginn verstopp (ausser obligatoresch). Dir kënnt dann déi gewënscht aktivéieren. Weidermaachen?", + "reset_email_settings": "All E-Mail-Astellunge ginn op .env-Standardwäerter zréckgesat. Weidermaachen?", + "cleanup_logs": "All Protokoller, déi méi al wéi {days} Deeg sinn, ginn geläscht. Weidermaachen?" }, "menu": { "dashboard": "Dashboard", diff --git a/app/modules/customers/locales/de.json b/app/modules/customers/locales/de.json index f3e0629a..95a3733d 100644 --- a/app/modules/customers/locales/de.json +++ b/app/modules/customers/locales/de.json @@ -32,6 +32,11 @@ "description": "Nachrichten an Kunden senden" } }, + "messages": { + "failed_to_toggle_customer_status": "Kundenstatus konnte nicht geändert werden", + "failed_to_load_customer_details": "Kundendetails konnten nicht geladen werden", + "failed_to_load_customer_orders": "Kundenbestellungen konnten nicht geladen werden" + }, "menu": { "store_operations": "Shop-Betrieb", "customers_section": "Kunden", diff --git a/app/modules/customers/locales/fr.json b/app/modules/customers/locales/fr.json index cd2dedb5..93f11095 100644 --- a/app/modules/customers/locales/fr.json +++ b/app/modules/customers/locales/fr.json @@ -32,6 +32,11 @@ "description": "Envoyer des messages aux clients" } }, + "messages": { + "failed_to_toggle_customer_status": "Échec du changement de statut du client", + "failed_to_load_customer_details": "Échec du chargement des détails du client", + "failed_to_load_customer_orders": "Échec du chargement des commandes du client" + }, "menu": { "store_operations": "Opérations du magasin", "customers_section": "Clients", diff --git a/app/modules/customers/locales/lb.json b/app/modules/customers/locales/lb.json index 9bce5bd6..83350438 100644 --- a/app/modules/customers/locales/lb.json +++ b/app/modules/customers/locales/lb.json @@ -32,6 +32,11 @@ "description": "Noriichten u Clienten schécken" } }, + "messages": { + "failed_to_toggle_customer_status": "Clientestatus konnt net geännert ginn", + "failed_to_load_customer_details": "Clientedetailer konnten net geluede ginn", + "failed_to_load_customer_orders": "Clientebestellunge konnten net geluede ginn" + }, "menu": { "store_operations": "Buttek-Operatiounen", "customers_section": "Clienten", diff --git a/app/modules/loyalty/locales/de.json b/app/modules/loyalty/locales/de.json index 3e0aa0d7..a6377713 100644 --- a/app/modules/loyalty/locales/de.json +++ b/app/modules/loyalty/locales/de.json @@ -78,6 +78,7 @@ "terminal": "Terminal", "customer_cards": "Kundenkarten", "statistics": "Statistiken", + "program": "Programm", "overview": "Übersicht", "settings": "Einstellungen" }, diff --git a/app/modules/loyalty/locales/lb.json b/app/modules/loyalty/locales/lb.json index 683d8f3a..b46fbf59 100644 --- a/app/modules/loyalty/locales/lb.json +++ b/app/modules/loyalty/locales/lb.json @@ -78,6 +78,7 @@ "terminal": "Terminal", "customer_cards": "Clientekaarten", "statistics": "Statistiken", + "program": "Programm", "overview": "Iwwersiicht", "settings": "Astellungen" }, diff --git a/app/modules/loyalty/templates/loyalty/admin/merchant-detail.html b/app/modules/loyalty/templates/loyalty/admin/merchant-detail.html index 59f4a4e9..82c979c3 100644 --- a/app/modules/loyalty/templates/loyalty/admin/merchant-detail.html +++ b/app/modules/loyalty/templates/loyalty/admin/merchant-detail.html @@ -13,7 +13,7 @@ {% block content %} {% call detail_page_header("merchant?.name || 'Merchant Loyalty'", '/admin/loyalty/programs', subtitle_show='merchant') %} - + {% endcall %} {{ loading_state(_('loyalty.admin.merchant_detail.loading')) }} @@ -205,14 +205,14 @@

{{ _('loyalty.admin.merchant_detail.self_enrollment') }}

- +

{{ _('loyalty.admin.merchant_detail.cross_location_redemption') }}

- +
diff --git a/app/modules/loyalty/templates/loyalty/admin/merchant-settings.html b/app/modules/loyalty/templates/loyalty/admin/merchant-settings.html index a478ab18..8685bcc8 100644 --- a/app/modules/loyalty/templates/loyalty/admin/merchant-settings.html +++ b/app/modules/loyalty/templates/loyalty/admin/merchant-settings.html @@ -170,7 +170,7 @@ :disabled="saving" class="flex items-center px-4 py-2 text-sm font-medium text-white bg-purple-600 border border-transparent rounded-lg hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple disabled:opacity-50"> - + diff --git a/app/modules/loyalty/templates/loyalty/admin/program-edit.html b/app/modules/loyalty/templates/loyalty/admin/program-edit.html index 80b6c52f..5b7fef63 100644 --- a/app/modules/loyalty/templates/loyalty/admin/program-edit.html +++ b/app/modules/loyalty/templates/loyalty/admin/program-edit.html @@ -12,7 +12,7 @@ {% block content %} {% call detail_page_header("isNewProgram ? 'Create Program: ' + (merchant?.name || '') : 'Edit Program: ' + (merchant?.name || '')", '/admin/loyalty/merchants/' ~ merchant_id, subtitle_show='merchant') %} - + {% endcall %} {{ loading_state(_('loyalty.admin.program_edit.loading')) }} diff --git a/app/modules/loyalty/templates/loyalty/admin/programs.html b/app/modules/loyalty/templates/loyalty/admin/programs.html index e797ea61..23fcffd6 100644 --- a/app/modules/loyalty/templates/loyalty/admin/programs.html +++ b/app/modules/loyalty/templates/loyalty/admin/programs.html @@ -139,7 +139,7 @@

{{ _('loyalty.admin.programs.no_programs') }}

-

+

@@ -177,7 +177,7 @@

- + {{ _('loyalty.admin.programs.pt_per_eur') }}

@@ -201,7 +201,7 @@ - + diff --git a/app/modules/loyalty/templates/loyalty/shared/program-form.html b/app/modules/loyalty/templates/loyalty/shared/program-form.html index 0152c845..b8167cef 100644 --- a/app/modules/loyalty/templates/loyalty/shared/program-form.html +++ b/app/modules/loyalty/templates/loyalty/shared/program-form.html @@ -305,7 +305,7 @@ diff --git a/app/modules/loyalty/templates/loyalty/shared/program-view.html b/app/modules/loyalty/templates/loyalty/shared/program-view.html index 9e853c5b..f87dc9b5 100644 --- a/app/modules/loyalty/templates/loyalty/shared/program-view.html +++ b/app/modules/loyalty/templates/loyalty/shared/program-view.html @@ -163,7 +163,7 @@

{{ _('loyalty.shared.program_view.staff_pin_required') }}

- + diff --git a/app/modules/loyalty/templates/loyalty/store/cards.html b/app/modules/loyalty/templates/loyalty/store/cards.html index 57f11aa6..9e8f9543 100644 --- a/app/modules/loyalty/templates/loyalty/store/cards.html +++ b/app/modules/loyalty/templates/loyalty/store/cards.html @@ -122,8 +122,8 @@
-

-

+

{{ _('loyalty.store.cards.no_members') }}

+

@@ -150,13 +150,12 @@ + x-text="card.is_active ? '{{ _('loyalty.common.active')|replace("'", "\\'") }}' : '{{ _('loyalty.common.inactive')|replace("'", "\\'") }}'"> - + >{{ _('loyalty.common.view') }} diff --git a/app/modules/loyalty/templates/loyalty/store/enroll.html b/app/modules/loyalty/templates/loyalty/store/enroll.html index edf5dee0..be852735 100644 --- a/app/modules/loyalty/templates/loyalty/store/enroll.html +++ b/app/modules/loyalty/templates/loyalty/store/enroll.html @@ -108,7 +108,7 @@ diff --git a/app/modules/loyalty/templates/loyalty/store/terminal.html b/app/modules/loyalty/templates/loyalty/store/terminal.html index b6347430..53bc4153 100644 --- a/app/modules/loyalty/templates/loyalty/store/terminal.html +++ b/app/modules/loyalty/templates/loyalty/store/terminal.html @@ -82,7 +82,7 @@ class="w-full flex items-center justify-center px-4 py-3 text-sm font-medium text-white bg-purple-600 rounded-lg hover:bg-purple-700 focus:outline-none disabled:opacity-50" > - + @@ -137,7 +137,7 @@