# Quickstart: Manual Verification — General CRM Backlog Fixes

No automated test suite exists for this codebase (Constitution Principle VIII) — this is the actual acceptance bar. Run all 5 scenarios below against a local/dev environment before considering this feature done. Each scenario maps to one user story in `spec.md` and references the endpoints/files in `contracts/` and `data-model.md` rather than repeating their detail.

## Prerequisites

- Local `sistema/new` stack running under Docker Compose (per Constitution's Technology Constraints), with a dev DB seeded with at least one `Empresa新` and one `Profissional新` you can freely edit.
- Logged in as a normal internal user (any role — none of these fixes are permission-gated).
- Browser dev tools open to Network + Console tabs, to directly observe ajax responses and confirm no uncaught JS errors.

## US1 — Save a non-effective interaction without a Profissional

1. Open a company's record → "Nova Interação".
2. Mark **Não Efetivo**. Leave "Profissionais" empty. Fill the other required fields (Data e Hora, Produtos).
3. Save.
   - **Expected**: save succeeds (no client-side validation block), `includes/ajax/interacoes/create.php` returns 200 with the empresa id, and the new interaction appears in the company's history timeline with no Profissional/cargo shown — specifically, the timeline entry does **not** render the literal text "null" where the profissional/cargo would otherwise appear.
4. Repeat with **Efetivo** selected and Profissionais left empty.
   - **Expected**: client-side validation still blocks the save (existing behavior preserved, FR-002).
5. Repeat step 1–3 in `pages/interacoes/sucesso.php` ("Sucesso do Cliente" flow) — it has its own duplicate form and must behave identically.

## US2 — Empty list shows "no results," not an endless spinner

1. Open any record list backed by the shared `showPagina()`/`pagination()` helpers (e.g. Profissionais tab on a company with a search box).
2. Type a search term guaranteed to match nothing (e.g. `zzzzzznomatch`).
   - **Expected**: the loading indicator clears within the same time a normal search would take; a "no results" state is shown; no uncaught exception appears in the browser console.
3. Clear the search / type a term that does match.
   - **Expected**: the table repopulates normally, loading behaves as before.
4. Repeat against at least one list rendered via each of the three shared files (`cadastro.js`, `bd.js`, `inicio.js`) if reachable from the UI, since `cadastro.js` was the one missing the guard — confirming the fix there is the priority, the other two are regression checks.
5. Force a request to fail instead of returning zero rows (e.g. temporarily block the ajax endpoint in dev tools, or point it at a bad URL).
   - **Expected**: an error state is shown (or the existing error handling fires) — the failure must **not** be silently rendered as the new "no results" empty state (spec.md Edge Cases).

## US3 — Partial-term select search

1. Open any form with a searchable select driven by `choices-select.js` (e.g. Profissionais select on the interaction form, or Produtos).
2. Type a substring from the **middle** of a known option's label (not the first characters).
   - **Expected**: the option appears in the filtered dropdown list.
3. Repeat on a select using the server-side "search" module (e.g. Empresa search on the Eficiência page) with a partial term.
   - **Expected**: matching results still return (this path already worked — regression check only).

## US4 — "Não sei" + multiple children on Profissional

1. Open a Profissional's edit form.
2. On "Sexo" (or "Estado civil"), select **Não sei** and save. Reopen the record.
   - **Expected**: "Não sei" is shown as the saved value.
3. Mark "Possui filho" = Sim, set número de filhos to 3, fill each child's nome/sexo/ano de nascimento (try "Não sei" on one child's sexo too).
4. Save, then reopen the record.
   - **Expected**: all 3 children reappear with their individual data intact.
5. Edit the record again, reduce número de filhos to 1.
6. Save, then reopen.
   - **Expected**: only 1 child remains; the other 2 are gone (confirms the wipe-and-reinsert behavior, and the intentionally-destructive edge case in the spec).
7. Check the qualification indicator for a Profissional with "Não sei" set on a tracked field.
   - **Expected**: that field does not count as "filled" in the qualification percentage (per `includes/ajax/indicadores/qualificacao.php`).

## US5 — Cellphone shown before landline

1. On a Profissional with no phone numbers yet, add a landline number first (e.g. `1134567890`, 10 digits: DDD + 8-digit number), then add a cellphone number second (e.g. `11987654321`, 11 digits: DDD + 9-digit number starting with 9).
2. Save, then reopen the record / view it in the Profissionais list.
   - **Expected**: the cellphone number is shown before the landline number, in the list column, the info panel, and the edit form's phone list — even though it was entered second.
3. Add a second cellphone number.
   - **Expected**: the two cellphone numbers keep their original relative order to each other, both still ahead of the landline.

## Sign-off

All 5 sections above pass with no uncaught console errors ⇒ feature is manually verified per Constitution Principle VIII.
