fix: adjust EOL logic to include 0 or negative stock

This commit is contained in:
christian.vidal
2026-03-27 13:32:54 +01:00
parent 2af4b62c85
commit 079db15f46
+6 -6
View File
@@ -76,11 +76,11 @@ export function ProductDescriptions({ data, onEdit }: ProductDescriptionsProps)
}; };
const getRowColor = (row: ExcelRow) => { const getRowColor = (row: ExcelRow) => {
// EOL Rule: OOC Classification and 0 stock (Item Available) // EOL Rule: OOC Classification and 0 or negative stock (Item Available)
const classification = String(row[COLUMNS.CLASSIFICATION] || '').toUpperCase(); const classification = String(row[COLUMNS.CLASSIFICATION] || '').toUpperCase().trim();
const stock = Number(row[COLUMNS.ITEM_AVAILABLE] || 0); const stock = Number(row[COLUMNS.ITEM_AVAILABLE] || 0);
if (classification === 'OOC' && stock === 0) { if (classification === 'OOC' && stock <= 0) {
return 'bg-yellow-500/10 hover:bg-yellow-500/20'; // EOL Highlight return 'bg-yellow-500/10 hover:bg-yellow-500/20'; // EOL Highlight
} }
@@ -94,11 +94,11 @@ export function ProductDescriptions({ data, onEdit }: ProductDescriptionsProps)
const Badge = ({ content, row }: { content: any, row: ExcelRow }) => { const Badge = ({ content, row }: { content: any, row: ExcelRow }) => {
if (content) return <span className="inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-green-500/20 text-green-400 border border-green-500/30"></span>; if (content) return <span className="inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-green-500/20 text-green-400 border border-green-500/30"></span>;
// EOL Exception // EOL Exception: OOC and stock <= 0
const classification = String(row[COLUMNS.CLASSIFICATION] || '').toUpperCase(); const classification = String(row[COLUMNS.CLASSIFICATION] || '').toUpperCase().trim();
const stock = Number(row[COLUMNS.ITEM_AVAILABLE] || 0); const stock = Number(row[COLUMNS.ITEM_AVAILABLE] || 0);
if (classification === 'OOC' && stock === 0) { if (classification === 'OOC' && stock <= 0) {
return <span className="inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-yellow-500/20 text-yellow-400 border border-yellow-500/30">EOL not neccessary</span>; return <span className="inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-yellow-500/20 text-yellow-400 border border-yellow-500/30">EOL not neccessary</span>;
} }