diff --git a/components/AdsPerformance.tsx b/components/AdsPerformance.tsx index b8a03bb..fbeba1d 100644 --- a/components/AdsPerformance.tsx +++ b/components/AdsPerformance.tsx @@ -406,12 +406,14 @@ const AdsPerformance: React.FC = ({ data, filters, top50Ran ))} {row.asin} + + SKU: {row.sku} +
+ {row.title} {stockMap && ( )}
- SKU: {row.sku} - {row.title} diff --git a/components/DataGrid.tsx b/components/DataGrid.tsx index 31fa4df..3cd8636 100644 --- a/components/DataGrid.tsx +++ b/components/DataGrid.tsx @@ -1078,19 +1078,16 @@ const DataGrid: React.FC = ({ data, hasCustomerFilter, adsData, s {paginatedRows.map((row) => ( - {/* Dimension Values */} {effectiveDimensions.map(dim => ( {dim === 'title' - ?
{row.title || '-'}
- : (dim === 'sku' || dim === 'asin') - ?
- {(row[dim as keyof PivotRow] as string) || '-'} - {stockMap && dim === 'sku' && ( - - )} -
- : (row[dim as keyof PivotRow] as string) || '-' + ?
+ {row.title || '-'} + {stockMap && ( + + )} +
+ : (row[dim as keyof PivotRow] as string) || '-' } ))} diff --git a/components/ForecastView.tsx b/components/ForecastView.tsx index ce94673..d3694c6 100644 --- a/components/ForecastView.tsx +++ b/components/ForecastView.tsx @@ -3,7 +3,6 @@ import * as XLSX from 'xlsx'; import { ProductForecastData, FilterState } from '../types'; import { DownloadIcon } from './Icons'; import { StockBadge } from './StockBadge'; -import { StockBadge } from './StockBadge'; import { BarChart, Bar, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContainer, LineChart, Line, Legend, ComposedChart, Area @@ -15,7 +14,6 @@ interface ForecastViewProps { top50Ranking?: { eu: Map; uk: Map; - stockMap?: Map; }; stockMap?: Map; } @@ -33,7 +31,7 @@ const Top50Badge: React.FC<{ rank: number; label: string; theme?: 'amber' | 'ind ); }; -const ForecastView: React.FC = ({ data, filters, top50Ranking, stockMap, stockMap }) => { +const ForecastView: React.FC = ({ data, filters, top50Ranking, stockMap }) => { const [searchTerm, setSearchTerm] = useState(''); const [showOnlyTop50, setShowOnlyTop50] = useState(false); const [top50Mode, setTop50Mode] = useState<'eu' | 'uk'>('eu'); @@ -411,8 +409,11 @@ const ForecastView: React.FC = ({ data, filters, top50Ranking {/* Title Row */} -
- {p.title} +
+ {p.title} + {stockMap && ( + + )}
{/* Line Row */}
diff --git a/components/StockBadge.tsx b/components/StockBadge.tsx index e74720f..d4fc92d 100644 --- a/components/StockBadge.tsx +++ b/components/StockBadge.tsx @@ -11,24 +11,27 @@ export const StockBadge: React.FC = ({ stock }) => { const isLow = stock < 50; const isOut = stock <= 0; - let colorClass = "bg-emerald-500/20 text-emerald-400 border-emerald-500/30"; + let themeClasses = "from-indigo-600 to-purple-600 border-indigo-400/50"; let icon = "📦"; if (isOut) { - colorClass = "bg-rose-500/20 text-rose-400 border-rose-500/30"; + themeClasses = "from-rose-600 to-red-700 border-rose-400/50"; icon = "❌"; } else if (isLow) { - colorClass = "bg-amber-500/20 text-amber-400 border-amber-500/30"; + themeClasses = "from-amber-500 to-orange-600 border-amber-400/50"; icon = "⚠️"; } return (
- {icon} - {stock.toLocaleString('de-DE')} + {icon} +
+ Stock + {stock.toLocaleString('de-DE')} +
); }; diff --git a/components/WeeklyGrid.tsx b/components/WeeklyGrid.tsx index 9aa9b84..f79e203 100644 --- a/components/WeeklyGrid.tsx +++ b/components/WeeklyGrid.tsx @@ -517,11 +517,13 @@ const WeeklyGrid: React.FC = ({ data, top50Ranking, onDrillDown {row.sku || '-'} {row.asin} +
+
+ {row.title} {stockMap && ( )}
- {row.title} {row.line}
diff --git a/inspect_forecast.cjs b/inspect_forecast.cjs new file mode 100644 index 0000000..ea00986 --- /dev/null +++ b/inspect_forecast.cjs @@ -0,0 +1,25 @@ +const XLSX = require('xlsx'); +const path = require('path'); + +function inspectForecast(filename, targetSku) { + const filePath = path.join(process.cwd(), 'public', filename); + const workbook = XLSX.readFile(filePath); + const sheetName = workbook.SheetNames[0]; + const sheet = workbook.Sheets[sheetName]; + const data = XLSX.utils.sheet_to_json(sheet); + + console.log(`Searching for SKU: ${targetSku} in ${filename}`); + const results = data.filter(row => + String(row['SKU'] || row['sku'] || '').includes(targetSku) || + String(row['ASIN'] || row['asin'] || '').includes(targetSku) + ); + + if (results.length === 0) { + console.log('No results found.'); + } else { + results.forEach(r => console.log(JSON.stringify(r, null, 2))); + } +} + +const targetSku = process.argv[2] || '46234'; +inspectForecast('fc UK 26.xlsx', targetSku); diff --git a/inspect_stock.cjs b/inspect_stock.cjs new file mode 100644 index 0000000..6b9fb52 --- /dev/null +++ b/inspect_stock.cjs @@ -0,0 +1,16 @@ + +const XLSX = require('xlsx'); + +async function inspect() { + const workbook = XLSX.readFile('Item Availability.xlsx'); + const sheet = workbook.Sheets[workbook.SheetNames[0]]; + const data = XLSX.utils.sheet_to_json(sheet, { header: 1 }); + + console.log('--- HEADERS ---'); + console.log(data[0]); + + console.log('\n--- DATA (Top 5) ---'); + console.log(data.slice(1, 6)); +} + +inspect(); diff --git a/inspect_stock.xlsx b/inspect_stock.xlsx new file mode 100644 index 0000000..652a997 Binary files /dev/null and b/inspect_stock.xlsx differ