# Phase 19.1: LookupModal Dual-Mode - Discussion Log

> **Audit trail only.** Do not use as input to planning, research, or execution agents.
> Decisions are captured in CONTEXT.md — this log preserves the alternatives considered.

**Date:** 2026-04-07
**Phase:** 19.1-lookupmodal-dual-mode-parent-product-adds-and-serial-unit-picks
**Areas discussed:** Unification strategy, Modal modes & entry points, Search + results display, Create New flow

---

## Unification Strategy

| Option | Description | Selected |
|--------|-------------|----------|
| Replace LookupModal internals | Keep LookupModal as single shell, replace flat list with hierarchical tree. ProductAddToCardPicker removed. | ✓ |
| Embed picker inside modal | Keep both .slint files, embed ProductAddToCardPicker as child component of LookupModal. | |
| Side-by-side dual panel | Wider modal with left product panel and right unit panel. | |

**User's choice:** Replace LookupModal internals
**Notes:** None — clean selection of recommended option.

---

## Modal Modes & Entry Points

| Option | Description | Selected |
|--------|-------------|----------|
| Always unified | Every open shows full tree. Click row to expand, click [+] to add. | ✓ |
| Context-determined mode | Different behavior based on which button opened the modal. | |
| Tabs inside modal | Products tab and Units tab at top of modal. | |

**User's choice:** Always unified
**Notes:** User specified precise interaction model:
- Clicking parent product row → expands/collapses (NOT adds product)
- Clicking right-aligned '+' button in parent product row → adds parent product
- Clicking unit row → does nothing
- Clicking right-aligned '+' button in unit row → adds unit

---

## Search + Results Display

| Option | Description | Selected |
|--------|-------------|----------|
| Auto-expand matching parent | Search matches both products and serial numbers. Matching parent auto-expands with highlighted unit. | ✓ (modified) |
| Flat mixed results | Search returns flat list mixing products and units with indent hierarchy. | |
| Product-only filter | Search only filters parent products. Serial numbers not searchable. | |

**User's choice:** Auto-expand matching parent (with modifications)
**Notes:** User refined the approach significantly:
- Do NOT auto-expand parents with matching units
- Instead show a "match count" pill on parents that have matching units
- If parent itself matches by name but no children match, no pill
- When expanding a parent, only show units matching the current search
- Parent forced visible in results when its units match, even if parent name doesn't match

---

## Create New Flow

| Option | Description | Selected |
|--------|-------------|----------|
| Per-product inline creation | Each expanded product has '+ New unit' row at bottom with inline SN input. | ✓ (modified) |
| Create form page | Page-switch pattern like current Create New Product form. | |
| You decide | Claude's discretion on create-unit UX. | |

**User's choice:** Per-product inline creation (with modifications)
**Notes:** User clarified:
- NOT a '+' symbol (confusing with [+] add-to-card buttons)
- Use "Create New Unit" as button text at bottom of expanded unit list
- Clicking reveals inline textbox for SN entry with auto-focus
- Enter or clicking 'OK' button creates the unit

---

## Additional Notes

- User requested `/gsd:ui-phase 19.1` be run during planning for this phase
- Parent visibility rule: parent forced visible when its units match search even if parent name doesn't match

## Claude's Discretion

- Migration strategy for Rust callback wiring
- Highlight style for search-matched units
- Match count pill styling
- Struct consolidation (PickerProductData/PickerUnitData vs LookupResultEntry)

## Deferred Ideas

- Centralized modular search modal with shared UX patterns (broader initiative)
- Serial unit search box seeds new unit SN field (related but not folded)
- Product unit ownership audit trail (separate concern)
