fix: show Ersätt befintlig import button for duplicate-file SIE uploads (#270)
The duplicate (file-hash) error path returned an importId but the UI only captured it for the duplicate_period branch, so users saw a misleading "ta bort under Bokföring" message with no way to act on it. The replace flow (and its BFL 5:5 audit trail) is identical in both cases, so expose the existing button for both. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
44082ff845
commit
d741c46d4e
@@ -20,12 +20,12 @@ interface SIEUploadStepProps {
|
||||
errorType?: 'duplicate' | 'duplicate_period' | 'validation' | 'parse'
|
||||
validationErrors?: string[]
|
||||
validationWarnings?: string[]
|
||||
duplicatePeriodImportId?: string | null
|
||||
duplicateImportId?: string | null
|
||||
onReplace?: (importId: string) => Promise<void>
|
||||
isReplacing?: boolean
|
||||
}
|
||||
|
||||
export default function SIEUploadStep({ onFileSelect, isLoading, error, errorType, validationErrors, validationWarnings, duplicatePeriodImportId, onReplace, isReplacing }: SIEUploadStepProps) {
|
||||
export default function SIEUploadStep({ onFileSelect, isLoading, error, errorType, validationErrors, validationWarnings, duplicateImportId, onReplace, isReplacing }: SIEUploadStepProps) {
|
||||
const [isDragging, setIsDragging] = useState(false)
|
||||
const [selectedFile, setSelectedFile] = useState<File | null>(null)
|
||||
const [loadingPhase, setLoadingPhase] = useState(0)
|
||||
@@ -192,13 +192,10 @@ export default function SIEUploadStep({ onFileSelect, isLoading, error, errorTyp
|
||||
|
||||
{/* Actionable guidance */}
|
||||
<div className="text-sm text-muted-foreground pt-1 border-t border-border/50 mt-2">
|
||||
{errorType === 'duplicate' && (
|
||||
<p>Om du vill importera om filen, ta först bort den tidigare importen under Bokföring.</p>
|
||||
)}
|
||||
{errorType === 'duplicate_period' && (
|
||||
{(errorType === 'duplicate' || errorType === 'duplicate_period') && (
|
||||
<div className="space-y-2">
|
||||
<p>Den befintliga importens verifikationer kommer att makuleras (status ändras till "makulerad"). De finns kvar som spårbar historik.</p>
|
||||
{duplicatePeriodImportId && onReplace && (
|
||||
{duplicateImportId && onReplace && (
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
@@ -206,7 +203,7 @@ export default function SIEUploadStep({ onFileSelect, isLoading, error, errorTyp
|
||||
disabled={isReplacing}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation()
|
||||
onReplace(duplicatePeriodImportId)
|
||||
onReplace(duplicateImportId)
|
||||
}}
|
||||
>
|
||||
{isReplacing ? (
|
||||
|
||||
Reference in New Issue
Block a user