mirror of
https://github.com/christianvidalwolf-prog/Craze-Data-check.git
synced 2026-08-03 15:35:23 +02:00
UI: Add group verification for Dimensions inconsistencies and persist to DB
This commit is contained in:
@@ -101,13 +101,15 @@ export function DimensionsView({ data, headers, onEdit, onSaveRow, onCaptureStat
|
||||
|
||||
const parts = key.split('x').map(Number);
|
||||
const volume = parts[0] * parts[1] * parts[2];
|
||||
|
||||
const isVerified = rows.some(({ row }) => row[COLUMNS.VERIFIED_DIMS] === true);
|
||||
|
||||
result.push({
|
||||
key,
|
||||
innerDims: key,
|
||||
rows,
|
||||
volume,
|
||||
isInconsistent: !outerMatch || !unitsMatch || !moqMatch,
|
||||
isInconsistent: (!outerMatch || !unitsMatch || !moqMatch) && !isVerified,
|
||||
discrepancies: {
|
||||
outer: !outerMatch,
|
||||
units: !unitsMatch,
|
||||
@@ -221,6 +223,16 @@ export function DimensionsView({ data, headers, onEdit, onSaveRow, onCaptureStat
|
||||
setPendingAction({ group, sourceRow, fieldType: 'all' });
|
||||
};
|
||||
|
||||
const handleVerifyGroup = (e: React.MouseEvent, group: DimensionGroup) => {
|
||||
e.stopPropagation();
|
||||
group.rows.forEach(({ row, index }) => {
|
||||
const newRow = [...row];
|
||||
newRow[COLUMNS.VERIFIED_DIMS] = true;
|
||||
onSaveRow(index, newRow);
|
||||
});
|
||||
onCaptureState(`Verified dimensions for ${group.rows.length} products`);
|
||||
};
|
||||
|
||||
const executeNearDupSync = async () => {
|
||||
if (!pendingNearDupSync) return;
|
||||
const { clusterKey, targetGroupKey, selectedIndices } = pendingNearDupSync;
|
||||
@@ -584,6 +596,17 @@ export function DimensionsView({ data, headers, onEdit, onSaveRow, onCaptureStat
|
||||
)}
|
||||
</div>
|
||||
|
||||
{group.isInconsistent && (
|
||||
<button
|
||||
onClick={(e) => handleVerifyGroup(e, group)}
|
||||
className="px-2 py-1 bg-emerald-600/10 hover:bg-emerald-600 hover:text-white text-emerald-500 rounded border border-emerald-600/30 text-[10px] font-bold transition-colors flex items-center gap-1"
|
||||
title="Mark as correct to hide from inconsistent list"
|
||||
>
|
||||
<CheckCircle2 className="w-3 h-3" />
|
||||
Mark Correct
|
||||
</button>
|
||||
)}
|
||||
|
||||
{group.isInconsistent && !expandedGroups.has(group.key) && (
|
||||
<div className="text-[10px] font-bold text-blue-400 bg-blue-400/5 px-2 py-1 rounded border border-blue-400/20">
|
||||
OPEN TO SYNC FIELDS
|
||||
|
||||
Reference in New Issue
Block a user