feat(entities): ajout champ description (édition + persistance) pour personnes/adresses/entreprises
This commit is contained in:
parent
99b799306b
commit
db2de72ad7
@ -458,8 +458,9 @@ export const FilePreview: React.FC<FilePreviewProps> = ({ document, onClose }) =
|
||||
fullResult.extraction.entities.persons.map((p: any, i: number) => (
|
||||
<Box key={`p-${i}`} display="flex" alignItems="center" justifyContent="space-between" sx={{ py: 0.5, gap: 1 }}>
|
||||
<Box display="flex" alignItems="center" gap={1}>
|
||||
<input style={{ padding: 4 }} defaultValue={p.firstName} onChange={(e) => (p.firstName = e.target.value)} />
|
||||
<input style={{ padding: 4 }} defaultValue={p.lastName} onChange={(e) => (p.lastName = e.target.value)} />
|
||||
<input style={{ padding: 4 }} placeholder="Prénom" defaultValue={p.firstName} onChange={(e) => (p.firstName = e.target.value)} />
|
||||
<input style={{ padding: 4 }} placeholder="Nom" defaultValue={p.lastName} onChange={(e) => (p.lastName = e.target.value)} />
|
||||
<input style={{ padding: 4, width: 220 }} placeholder="Description" defaultValue={p.description || ''} onChange={(e) => (p.description = e.target.value)} />
|
||||
</Box>
|
||||
<Box display="flex" gap={1}>
|
||||
<Button
|
||||
@ -470,7 +471,7 @@ export const FilePreview: React.FC<FilePreviewProps> = ({ document, onClose }) =
|
||||
if (!currentFolderHash) return
|
||||
try {
|
||||
setSavingKey(`p-${i}`)
|
||||
await updateEntity(currentFolderHash, document.id, 'person', { index: i, id: p.id, patch: { firstName: p.firstName, lastName: p.lastName } })
|
||||
await updateEntity(currentFolderHash, document.id, 'person', { index: i, id: p.id, patch: { firstName: p.firstName, lastName: p.lastName, description: p.description || '' } })
|
||||
await dispatch(loadFolderResults(currentFolderHash)).unwrap()
|
||||
} finally {
|
||||
setSavingKey(null)
|
||||
@ -511,10 +512,11 @@ export const FilePreview: React.FC<FilePreviewProps> = ({ document, onClose }) =
|
||||
fullResult.extraction.entities.addresses.map((a: any, i: number) => (
|
||||
<Box key={`a-${i}`} display="flex" alignItems="center" justifyContent="space-between" sx={{ py: 0.5, gap: 1 }}>
|
||||
<Box display="flex" alignItems="center" gap={1}>
|
||||
<input style={{ padding: 4, width: 220 }} defaultValue={a.street} onChange={(e) => (a.street = e.target.value)} />
|
||||
<input style={{ padding: 4, width: 100 }} defaultValue={a.postalCode} onChange={(e) => (a.postalCode = e.target.value)} />
|
||||
<input style={{ padding: 4, width: 160 }} defaultValue={a.city} onChange={(e) => (a.city = e.target.value)} />
|
||||
<input style={{ padding: 4, width: 120 }} defaultValue={a.country || ''} onChange={(e) => (a.country = e.target.value)} />
|
||||
<input style={{ padding: 4, width: 220 }} placeholder="Rue" defaultValue={a.street} onChange={(e) => (a.street = e.target.value)} />
|
||||
<input style={{ padding: 4, width: 100 }} placeholder="CP" defaultValue={a.postalCode} onChange={(e) => (a.postalCode = e.target.value)} />
|
||||
<input style={{ padding: 4, width: 160 }} placeholder="Ville" defaultValue={a.city} onChange={(e) => (a.city = e.target.value)} />
|
||||
<input style={{ padding: 4, width: 120 }} placeholder="Pays" defaultValue={a.country || ''} onChange={(e) => (a.country = e.target.value)} />
|
||||
<input style={{ padding: 4, width: 220 }} placeholder="Description" defaultValue={a.description || ''} onChange={(e) => (a.description = e.target.value)} />
|
||||
</Box>
|
||||
<Box display="flex" gap={1}>
|
||||
<Button
|
||||
@ -525,7 +527,7 @@ export const FilePreview: React.FC<FilePreviewProps> = ({ document, onClose }) =
|
||||
if (!currentFolderHash) return
|
||||
try {
|
||||
setSavingKey(`a-${i}`)
|
||||
await updateEntity(currentFolderHash, document.id, 'address', { index: i, id: a.id, patch: { street: a.street, city: a.city, postalCode: a.postalCode, country: a.country } })
|
||||
await updateEntity(currentFolderHash, document.id, 'address', { index: i, id: a.id, patch: { street: a.street, city: a.city, postalCode: a.postalCode, country: a.country, description: a.description || '' } })
|
||||
await dispatch(loadFolderResults(currentFolderHash)).unwrap()
|
||||
} finally {
|
||||
setSavingKey(null)
|
||||
@ -565,7 +567,8 @@ export const FilePreview: React.FC<FilePreviewProps> = ({ document, onClose }) =
|
||||
fullResult.extraction.entities.companies.map((c: any, i: number) => (
|
||||
<Box key={`c-${i}`} display="flex" alignItems="center" justifyContent="space-between" sx={{ py: 0.5, gap: 1 }}>
|
||||
<Box display="flex" alignItems="center" gap={1}>
|
||||
<input style={{ padding: 4, width: 260 }} defaultValue={c.name} onChange={(e) => (c.name = e.target.value)} />
|
||||
<input style={{ padding: 4, width: 260 }} placeholder="Raison sociale" defaultValue={c.name} onChange={(e) => (c.name = e.target.value)} />
|
||||
<input style={{ padding: 4, width: 240 }} placeholder="Description" defaultValue={c.description || ''} onChange={(e) => (c.description = e.target.value)} />
|
||||
</Box>
|
||||
<Box display="flex" gap={1}>
|
||||
<Button
|
||||
@ -576,7 +579,7 @@ export const FilePreview: React.FC<FilePreviewProps> = ({ document, onClose }) =
|
||||
if (!currentFolderHash) return
|
||||
try {
|
||||
setSavingKey(`c-${i}`)
|
||||
await updateEntity(currentFolderHash, document.id, 'company', { index: i, id: c.id, patch: { name: c.name } })
|
||||
await updateEntity(currentFolderHash, document.id, 'company', { index: i, id: c.id, patch: { name: c.name, description: c.description || '' } })
|
||||
await dispatch(loadFolderResults(currentFolderHash)).unwrap()
|
||||
} finally {
|
||||
setSavingKey(null)
|
||||
|
||||
@ -199,16 +199,17 @@ export default function ExtractionView() {
|
||||
{extraction.extraction.entities.persons.map((p: any, i: number) => (
|
||||
<ListItem key={`p-${i}`} disableGutters sx={{ py: 0.5 }}>
|
||||
<Box sx={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 2, width: '100%', flexWrap: 'wrap' }}>
|
||||
<Box sx={{ display: 'flex', alignItems: 'center', gap: 1, flex: '1 1 auto', minWidth: 0 }}>
|
||||
<input style={{ padding: 4, width: 140 }} defaultValue={p.firstName} onChange={(e)=> (p.firstName=e.target.value)} />
|
||||
<input style={{ padding: 4, width: 160 }} defaultValue={p.lastName} onChange={(e)=> (p.lastName=e.target.value)} />
|
||||
<Box sx={{ display: 'flex', alignItems: 'center', gap: 1, flex: '1 1 auto', minWidth: 0, flexWrap: 'wrap' }}>
|
||||
<input style={{ padding: 4, width: 140 }} placeholder="Prénom" defaultValue={p.firstName} onChange={(e)=> (p.firstName=e.target.value)} />
|
||||
<input style={{ padding: 4, width: 160 }} placeholder="Nom" defaultValue={p.lastName} onChange={(e)=> (p.lastName=e.target.value)} />
|
||||
<input style={{ padding: 4, width: 260 }} placeholder="Description" defaultValue={p.description || ''} onChange={(e)=> (p.description=e.target.value)} />
|
||||
</Box>
|
||||
<Box sx={{ display: 'flex', alignItems: 'center', gap: 1, flexShrink: 0, whiteSpace: 'nowrap' }}>
|
||||
<Button size="small" variant="outlined" disabled={savingKey===`p-${i}`}
|
||||
onClick={async ()=>{
|
||||
try{
|
||||
setSavingKey(`p-${i}`)
|
||||
await updateEntity(currentFolderHash!, extraction.fileHash, 'person', { index: i, id: p.id, patch: { firstName: p.firstName, lastName: p.lastName } })
|
||||
await updateEntity(currentFolderHash!, extraction.fileHash, 'person', { index: i, id: p.id, patch: { firstName: p.firstName, lastName: p.lastName, description: p.description || '' } })
|
||||
} finally { setSavingKey(null) }
|
||||
}}>Enregistrer</Button>
|
||||
<Button size="small" color="error"
|
||||
@ -237,17 +238,18 @@ export default function ExtractionView() {
|
||||
<ListItem key={`a-${i}`} disableGutters sx={{ py: 0.5 }}>
|
||||
<Box sx={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 2, width: '100%', flexWrap: 'wrap' }}>
|
||||
<Box sx={{ display: 'flex', alignItems: 'center', gap: 1, flex: '1 1 auto', minWidth: 0, flexWrap: 'wrap' }}>
|
||||
<input style={{ padding: 4, width: 240 }} defaultValue={a.street} onChange={(e)=> (a.street=e.target.value)} />
|
||||
<input style={{ padding: 4, width: 100 }} defaultValue={a.postalCode} onChange={(e)=> (a.postalCode=e.target.value)} />
|
||||
<input style={{ padding: 4, width: 180 }} defaultValue={a.city} onChange={(e)=> (a.city=e.target.value)} />
|
||||
<input style={{ padding: 4, width: 140 }} defaultValue={a.country||''} onChange={(e)=> (a.country=e.target.value)} />
|
||||
<input style={{ padding: 4, width: 240 }} placeholder="Rue" defaultValue={a.street} onChange={(e)=> (a.street=e.target.value)} />
|
||||
<input style={{ padding: 4, width: 100 }} placeholder="CP" defaultValue={a.postalCode} onChange={(e)=> (a.postalCode=e.target.value)} />
|
||||
<input style={{ padding: 4, width: 180 }} placeholder="Ville" defaultValue={a.city} onChange={(e)=> (a.city=e.target.value)} />
|
||||
<input style={{ padding: 4, width: 140 }} placeholder="Pays" defaultValue={a.country||''} onChange={(e)=> (a.country=e.target.value)} />
|
||||
<input style={{ padding: 4, width: 260 }} placeholder="Description" defaultValue={a.description || ''} onChange={(e)=> (a.description=e.target.value)} />
|
||||
</Box>
|
||||
<Box sx={{ display: 'flex', alignItems: 'center', gap: 1, flexShrink: 0, whiteSpace: 'nowrap' }}>
|
||||
<Button size="small" variant="outlined" disabled={savingKey===`a-${i}`}
|
||||
onClick={async ()=>{
|
||||
try{
|
||||
setSavingKey(`a-${i}`)
|
||||
await updateEntity(currentFolderHash!, extraction.fileHash, 'address', { index: i, id: a.id, patch: { street: a.street, city: a.city, postalCode: a.postalCode, country: a.country } })
|
||||
await updateEntity(currentFolderHash!, extraction.fileHash, 'address', { index: i, id: a.id, patch: { street: a.street, city: a.city, postalCode: a.postalCode, country: a.country, description: a.description || '' } })
|
||||
} finally { setSavingKey(null) }
|
||||
}}>Enregistrer</Button>
|
||||
<Button size="small" color="error"
|
||||
@ -275,15 +277,16 @@ export default function ExtractionView() {
|
||||
{extraction.extraction.entities.companies.map((c: any, i: number) => (
|
||||
<ListItem key={`c-${i}`} disableGutters sx={{ py: 0.5 }}>
|
||||
<Box sx={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 2, width: '100%', flexWrap: 'wrap' }}>
|
||||
<Box sx={{ display: 'flex', alignItems: 'center', gap: 1, flex: '1 1 auto', minWidth: 0 }}>
|
||||
<input style={{ padding: 4, width: 300 }} defaultValue={c.name} onChange={(e)=> (c.name=e.target.value)} />
|
||||
<Box sx={{ display: 'flex', alignItems: 'center', gap: 1, flex: '1 1 auto', minWidth: 0, flexWrap: 'wrap' }}>
|
||||
<input style={{ padding: 4, width: 300 }} placeholder="Raison sociale" defaultValue={c.name} onChange={(e)=> (c.name=e.target.value)} />
|
||||
<input style={{ padding: 4, width: 260 }} placeholder="Description" defaultValue={c.description || ''} onChange={(e)=> (c.description=e.target.value)} />
|
||||
</Box>
|
||||
<Box sx={{ display: 'flex', alignItems: 'center', gap: 1, flexShrink: 0, whiteSpace: 'nowrap' }}>
|
||||
<Button size="small" variant="outlined" disabled={savingKey===`c-${i}`}
|
||||
onClick={async ()=>{
|
||||
try{
|
||||
setSavingKey(`c-${i}`)
|
||||
await updateEntity(currentFolderHash!, extraction.fileHash, 'company', { index: i, id: c.id, patch: { name: c.name } })
|
||||
await updateEntity(currentFolderHash!, extraction.fileHash, 'company', { index: i, id: c.id, patch: { name: c.name, description: c.description || '' } })
|
||||
} finally { setSavingKey(null) }
|
||||
}}>Enregistrer</Button>
|
||||
<Button size="small" color="error"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user