Implement Vendor Stock Filtering across Weekly Sales, Ads, and Forecast views

This commit is contained in:
Christian Vidal Wolf
2026-01-28 10:18:08 +01:00
parent 97071c7b62
commit 5915bb4c0e
7 changed files with 182 additions and 33 deletions
+34 -14
View File
@@ -12,18 +12,10 @@ import {
LineChart, Line, Legend, ComposedChart, Area
} from 'recharts';
interface ForecastViewProps {
data: ProductForecastData[];
filters: FilterState; // Restored filters prop
top50Ranking?: {
eu: Map<string, number>;
uk: Map<string, number>;
};
stockMap?: Map<string, number>;
vendorStockMap?: Map<string, { eu: number; uk: number }>;
stockFilter: string[];
onStockFilterChange: (newFilters: string[]) => void;
top50Mode: 'eu' | 'uk';
top50Mode: 'eu' | 'uk';
vendorStockMap ?: Map<string, { eu: number; uk: number }>;
vendorStockFilter: string[];
onVendorStockFilterChange: (newFilters: string[]) => void;
}
const MONTH_ORDER = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
@@ -116,7 +108,18 @@ const ForecastRow: React.FC<{
);
});
const ForecastView: React.FC<ForecastViewProps> = ({ data, filters, top50Ranking, stockMap, vendorStockMap, stockFilter, onStockFilterChange, top50Mode }) => {
const ForecastView: React.FC<ForecastViewProps> = ({
data,
filters,
top50Ranking,
stockMap,
vendorStockMap,
stockFilter,
onStockFilterChange,
vendorStockFilter,
onVendorStockFilterChange,
top50Mode
}) => {
const [searchTerm, setSearchTerm] = useState('');
const [showOnlyTop50, setShowOnlyTop50] = useState(false);
const [displayCount, setDisplayCount] = useState(50);
@@ -231,7 +234,24 @@ const ForecastView: React.FC<ForecastViewProps> = ({ data, filters, top50Ranking
<th className="px-6 py-4 font-black text-slate-400 uppercase tracking-widest text-[10px] min-w-[300px]">
<div className="flex items-center gap-2">
<span>Product Details</span>
<InColumnStockFilter currentFilters={stockFilter} onFilterChange={onStockFilterChange} />
<div className="flex items-center gap-1 scale-75 origin-left">
<InColumnStockFilter
currentFilters={stockFilter}
onFilterChange={onStockFilterChange}
title="Warehouse Stock"
/>
<InColumnStockFilter
currentFilters={vendorStockFilter}
onFilterChange={onVendorStockFilterChange}
title="Vendor Stock"
options={[
'Out of Stock (0)',
'In Stock (>0)',
'In Stock (>20)',
'Low Stock (<10)',
]}
/>
</div>
</div>
</th>
<th className="px-6 py-4 font-black text-slate-400 uppercase tracking-widest text-[10px] text-center">Actuals</th>