fix: resolve all architecture validation warnings

JavaScript improvements:
- Add try/catch error handling to all async init() functions
- Move initialization guards before try/catch blocks (JS-005)
- Use centralized logger in i18n.js with silent fallback (JS-001)
- Add loading state to icons-page.js (JS-007)

Payments module structure:
- Add templates/, static/, and locales/ directories (MOD-005)
- Add locale files for en, de, fr, lb (MOD-006)

Architecture validation now passes with 0 errors, 0 warnings, 0 info.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-01 21:21:03 +01:00
parent d7a0ff8818
commit c13eb8d8c2
17 changed files with 304 additions and 212 deletions

View File

@@ -53,11 +53,6 @@ function vendorOrderDetail() {
],
async init() {
// Load i18n translations
await I18n.loadModule('orders');
orderDetailLog.info('Order detail init() called, orderId:', this.orderId);
// Guard against multiple initialization
if (window._orderDetailInitialized) {
orderDetailLog.warn('Already initialized, skipping');
@@ -65,26 +60,31 @@ function vendorOrderDetail() {
}
window._orderDetailInitialized = true;
// IMPORTANT: Call parent init first to set vendorCode from URL
const parentInit = data().init;
if (parentInit) {
await parentInit.call(this);
}
if (!this.orderId) {
this.error = 'Order ID not provided';
this.loading = false;
return;
}
try {
// Load i18n translations
await I18n.loadModule('orders');
orderDetailLog.info('Order detail init() called, orderId:', this.orderId);
// IMPORTANT: Call parent init first to set vendorCode from URL
const parentInit = data().init;
if (parentInit) {
await parentInit.call(this);
}
if (!this.orderId) {
this.error = 'Order ID not provided';
this.loading = false;
return;
}
await this.loadOrderDetails();
orderDetailLog.info('Order detail initialization complete');
} catch (error) {
orderDetailLog.error('Init failed:', error);
this.error = 'Failed to load order details';
}
orderDetailLog.info('Order detail initialization complete');
},
/**

View File

@@ -128,37 +128,37 @@ function vendorOrders() {
},
async init() {
// Load i18n translations
await I18n.loadModule('orders');
vendorOrdersLog.info('Orders init() called');
// Guard against multiple initialization
if (window._vendorOrdersInitialized) {
vendorOrdersLog.warn('Already initialized, skipping');
return;
}
window._vendorOrdersInitialized = true;
// IMPORTANT: Call parent init first to set vendorCode from URL
const parentInit = data().init;
if (parentInit) {
await parentInit.call(this);
}
// Load platform settings for rows per page
if (window.PlatformSettings) {
this.pagination.per_page = await window.PlatformSettings.getRowsPerPage();
}
try {
// Load i18n translations
await I18n.loadModule('orders');
vendorOrdersLog.info('Orders init() called');
// Guard against multiple initialization
if (window._vendorOrdersInitialized) {
vendorOrdersLog.warn('Already initialized, skipping');
return;
}
window._vendorOrdersInitialized = true;
// IMPORTANT: Call parent init first to set vendorCode from URL
const parentInit = data().init;
if (parentInit) {
await parentInit.call(this);
}
// Load platform settings for rows per page
if (window.PlatformSettings) {
this.pagination.per_page = await window.PlatformSettings.getRowsPerPage();
}
await this.loadOrders();
vendorOrdersLog.info('Orders initialization complete');
} catch (error) {
vendorOrdersLog.error('Init failed:', error);
this.error = 'Failed to initialize orders page';
}
vendorOrdersLog.info('Orders initialization complete');
},
/**