feat: force ASIN and SKU columns in Grid exports

This commit is contained in:
Christian Vidal Wolf
2026-02-23 18:18:02 +01:00
parent 24df5935cc
commit 69f4456942
+7 -3
View File
@@ -1541,14 +1541,18 @@ export const generateXLSX = (rows: PivotRow[], dimensions: string[], years: stri
const flatData = rows.map(row => { const flatData = rows.map(row => {
const flatRow: any = {}; const flatRow: any = {};
// Add Dimension Columns // Always ensure ASIN and SKU are exported as foundational identifiers
flatRow['ASIN'] = row.asin || '-';
flatRow['SKU'] = row.sku || '-';
// Add User Selected Dimension Columns
dimensions.forEach(dim => { dimensions.forEach(dim => {
if (dim.toLowerCase() === 'asin' || dim.toLowerCase() === 'sku') return; // Skip if already explicitly set
let header = dim; let header = dim;
if (dim === 'line') header = 'Product Line'; if (dim === 'line') header = 'Product Line';
if (dim === 'title') header = 'Title'; if (dim === 'title') header = 'Title';
if (dim === 'customer') header = 'Customer'; if (dim === 'customer') header = 'Customer';
if (dim === 'sku' || dim === 'SKU') header = 'SKU';
if (dim === 'asin' || dim === 'ASIN') header = 'ASIN';
flatRow[header] = row[dim as keyof PivotRow]; flatRow[header] = row[dim as keyof PivotRow];
}); });