` and the editing section. The block at lines 185-207 becomes:
```tsx
{editing ? (
```
This inserts a single line after line 186.
- [ ] **Step 3: Verify build**
```bash
npx tsc --noEmit && npx vite build 2>&1 | tail -5
```
Expected: no errors, build succeeds.
- [ ] **Step 4: Commit**
```bash
git add src/features/prozess/components/process-stepper.tsx
git commit -m "integrate DokumentListe into ErstgespraechCard expanded view"
```
---
## Chunk 3: Cleanup Integration & Verification
### Task 6: Wire up document cleanup on delete
**Files:**
- Modify: `src/features/prozess/hooks.ts:208-210`
- Modify: `src/features/kontakte/hooks.ts:131-137`
- [ ] **Step 1: Update deleteErstgespraech**
In `src/features/prozess/hooks.ts`, add import at top:
```ts
import { deleteDokumenteForSprechstunde } from "@/shared/hooks/dokument-store";
```
Replace the `deleteErstgespraech` function (lines 208-210):
```ts
export async function deleteErstgespraech(id: number) {
await deleteDokumenteForSprechstunde(id);
await dbExec("DELETE FROM sprechstunde WHERE id = $1", [id]);
}
```
- [ ] **Step 2: Update deleteAllData**
In `src/features/kontakte/hooks.ts`, add import at top:
```ts
import { deleteAllDokumente } from "@/shared/hooks/dokument-store";
```
Add `await deleteAllDokumente();` as the first line inside `deleteAllData()`:
```ts
export async function deleteAllData() {
await deleteAllDokumente();
await dbExec("DELETE FROM sitzung");
await dbExec("DELETE FROM kontakt");
await dbExec("DELETE FROM sprechstunde");
await dbExec("DELETE FROM therapeut");
await dbExec("DELETE FROM nutzer");
}
```
- [ ] **Step 3: Verify types and tests**
```bash
npx tsc --noEmit && npx vitest run
```
Expected: no type errors, all tests pass.
- [ ] **Step 4: Commit**
```bash
git add src/features/prozess/hooks.ts src/features/kontakte/hooks.ts
git commit -m "wire up document cleanup in deleteErstgespraech, deleteAllData"
```
---
### Task 7: Final verification
- [ ] **Step 1: Lint**
```bash
npx biome check src/shared/hooks/dokument-store.ts src/shared/hooks/dokument-store.test.ts src/features/prozess/components/dokument-liste.tsx src/features/prozess/components/process-stepper.tsx src/features/prozess/hooks.ts src/features/kontakte/hooks.ts
```
If issues, run `npx biome check --write` on affected files, then commit the fix.
- [ ] **Step 2: Full build**
```bash
npx vite build 2>&1 | tail -5
```
Expected: build succeeds with PWA output.
- [ ] **Step 3: Full test suite**
```bash
npx vitest run
```
Expected: all tests pass (existing + 5 new dokument-store tests).
- [ ] **Step 4: Deploy and post Gitea comment**
```bash
bash scripts/deploy.sh serve
```
Post comment on issue #2:
```bash
echo '## Sub-project 4: Document Scanning
Users can now capture/upload PTV11 documents per Erstgespräch.
- IndexedDB-based blob storage (separate from PGlite)
- Upload via native file picker (triggers document scanner on mobile)
- Image thumbnails with full-size modal viewer
- PDF opens in new tab via native viewer
- Cleanup wired into deleteErstgespraech and deleteAllData
Deployed and ready for testing.' | tea api -X POST repos/felixfoertsch/tpf/issues/2/comments -F "body=@-"
```