feat: reorganize tabs, add Article Details, and enhance filters/search

This commit is contained in:
Christian Vidal Wolf
2026-04-08 16:10:14 +02:00
parent 935cd5b510
commit 24042a6aed
7 changed files with 397 additions and 61 deletions
+39
View File
@@ -41,6 +41,13 @@ export function DimensionsView({ data, headers, onEdit, onSaveRow, onCaptureStat
sourceRow: ExcelRow,
fieldType: 'outer' | 'units' | 'moq' | 'all'
} | null>(null);
const [clusterSelections, setClusterSelections] = useState<Record<number, Set<number>>>({});
const [clusterSyncTargets, setClusterSyncTargets] = useState<Record<number, string>>({});
const [pendingNearDupSync, setPendingNearDupSync] = useState<{
clusterIndex: number;
targetGroupKey: string;
selectedIndices: number[];
} | null>(null);
const groups = useMemo(() => {
const groupMap = new Map<string, { row: ExcelRow; index: number }[]>();
@@ -177,6 +184,38 @@ export function DimensionsView({ data, headers, onEdit, onSaveRow, onCaptureStat
setPendingAction({ group, sourceRow, fieldType: 'all' });
};
const executeNearDupSync = async () => {
if (!pendingNearDupSync) return;
const { clusterIndex, targetGroupKey, selectedIndices } = pendingNearDupSync;
const cluster = nearDuplicateClusters[clusterIndex];
const targetGroup = cluster.groups.find(g => g.key === targetGroupKey);
if (!targetGroup) return;
const sourceRow = targetGroup.rows[0].row;
const innerL = sourceRow[COLUMNS.INNER_L];
const innerW = sourceRow[COLUMNS.INNER_W];
const innerH = sourceRow[COLUMNS.INNER_H];
onCaptureState(`Synced inner dimensions to ${targetGroupKey} cm for ${selectedIndices.length} products`);
setPendingNearDupSync(null);
for (const idx of selectedIndices) {
const row = data[idx];
const updatedRow = [...row];
updatedRow[COLUMNS.INNER_L] = innerL;
updatedRow[COLUMNS.INNER_W] = innerW;
updatedRow[COLUMNS.INNER_H] = innerH;
await onSaveRow(idx, updatedRow);
}
setClusterSelections(prev => {
const next = { ...prev };
delete next[clusterIndex];
return next;
});
};
const executeSync = async () => {
if (!pendingAction) return;
const { group, sourceRow, fieldType } = pendingAction;