Commit Graph

275 Commits

Author SHA1 Message Date
Claude Agent
4397027f36 feat(service-auto): multi-tenant + tier 3 lookups + D1 partener + AsyncAutoComplete
Refactor izolare multi-tenant:
- Schema Oracle rezolvată din id_firma via CONTAFIN_ORACLE.V_NOM_FIRME (cached 24h)
- server_id propagat din JWT (request.state.server_id) la oracle_pool.get_connection
- Elimină _SCHEMA='MARIUSM_AUTO' și literal 'mariusm_test' din toate query-urile
- Autorizare firmă la router (_company_id): 403 dacă id_firma nu e în JWT companies[]

Tier 3 — lookup endpoints cached 24h:
- GET /asiguratori (DEV_NOM_ASIGURATORI ← NOM_PARTENERI)
- GET /inspectori?id_asigurator=N (DEV_NOM_INSPECTORI per asig)
- GET /operatii (DEV_NOM_NORME)
- GET /parteneri?q=... (typeahead LIKE escape)
- GET /masini/{id}/detalii (VIN, cilindree, putere)
- POST /comenzi: PACK_SERII_NUMERE.aloca_numar + compensating dezaloca;
  pc_nr VFP-format prefix+seq/nrinmat; ORA-06512 stripped din detail

D1 PartnerCreateDialog (nou):
- POST /api/service-auto/parteneri → PartnerCreateRequest; 409 pe CUI
  duplicat (NOM_PARTENERI fără UNIQUE constraint — check manual);
  id_part = MAX+1 cu retry pe ORA-00001 (fără sequence în schema VFP legacy)
- Frontend PartnerCreateDialog.vue — PrimeVue, design tokens, dark-mode safe
- Integrat în ComandaNoua.vue via AutoComplete empty-action hook

Shared AsyncAutoComplete (nou):
- src/shared/components/AsyncAutoComplete.vue — typeahead async debounced
  cu emptyAction slot, force-selection, keyboard (Enter/Esc), design tokens
- ComandaNoua.vue refactorizat să folosească shared component
- SupplierDualField (data-entry) skipped — documentat în
  docs/service-auto/autocomplete-dual-decision.md (pattern diferit)

Mobile chrome (CLAUDE.md):
- ComandaNoua.vue + ComenziBrowseView.vue: MobileTopBar, BottomSheet
  filtre, MobileBottomNav, card list, isMobile resize listener

Migrații grant-uri idempotente:
- ff_2026_04_13_01_AUTO.sql — SELECT/EXECUTE pe tabele Tier 3 + index
  IX_NOM_PARTENERI_DEN_UPPER
- ff_2026_04_13_02_AUTO.sql — INSERT pe NOM_PARTENERI pentru D1

Live smoke pe MARIUSM_AUTO: /ping 1ms, /tip-deviz 7, /masini 261,
POST /parteneri id_part=70241, firma neautorizată → 403.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-06-05 09:37:10 +00:00
Claude Agent
ee6d857e9d feat(service-auto): phase 3 — PACK_AUTO callproc + câmpuri extinse formular
Migrare completă de la SP_CREEAZA_COMANDA_PROTOTIP la PACK_AUTO.dev_adauga_lucrare (18 params).
Formular ComandaNoua extins cu toate câmpurile din SP: observații, defecțiuni, km, ore motor, termen, nr. dosar.

- schema: solicitari → observatii (opțional); adăugat defectiuni, km_int, ore_functionare, nr_dosar, termen
- service: callproc cablat pe câmpurile noi; pc_nr cu milisecunde (evită colizii sub-secundă)
- error mapper: range 20001→20000 (ORA-20000 era neacoperit → 500 în loc de 422)
- onboarding_roa_web.sql: grant pe PACK_AUTO (înlocuiește SP prototip)
- ComandaNoua.vue: InputNumber km/ore, Calendar termen, Textarea defecțiuni, InputText nr_dosar

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-05 09:37:10 +00:00
Claude Agent
31d1f511c3 fix(service-auto): mapare ORA-01438 → 422 pentru ID invalid
ORA-01438 (value larger than column precision) apare când
id_masiniclient depășește precizia coloanei Oracle. Este eroare
de input, nu server error — mapăm la 422 Unprocessable.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-05 09:37:10 +00:00
Claude Agent
cc24aacfdf fix(service-auto): adaugă secțiunea Service Auto în hamburger menu
Linkurile Comenzi + Comandă Nouă lipseau din menu.js — adăugate în
secțiunea dedicată 'Service Auto' (înainte de Sistem).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-05 09:37:10 +00:00
Claude Agent
3cbf947d84 fix(service-auto): flatten routes — parent fără component bloca randarea
Vue Router 4 cu rută parent fără `component` nu știe în ce <router-view>
să randeze copiii. Soluție: ComenziBrowse și ComandaNoua devin rute
top-level (același pattern ca /dashboard).

Descoperit în QA P2.5: URL-ul era corect (/service-auto/comenzi) dar
conținutul era blank — PWA service worker servea cache vechi, ascunzând
bug-ul de router.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-05 09:37:10 +00:00
Claude Agent
0a880baef9 feat(service-auto): phase 2 — comenzi browse, id_sucursala, cache, migrare SQL
Backend:
- GET /api/service-auto/comenzi cu paginare server-side, filtre dată/status
- ComandaRequest.id_sucursala (Optional) + FirmaItem.id_mama
- get_firme() expune id_mama din V_NOM_FIRME
- callproc SP_CREEAZA_COMANDA_PROTOTIP cu 7 argumente (+ p_id_sucursala)
- Cache TTL in-process: tip_deviz 24h, masini 5min

Frontend:
- ComenziBrowseView.vue — DataTable lazy + filtre + status badges
- ComandaNoua.vue — company store integration, idSucursala computed
- service-auto/stores/sharedStores.js (createCompaniesStore factory)
- HamburgerMenu: secțiune Service Auto (Comenzi + Comandă Nouă)
- router: /service-auto/comenzi

SQL:
- migrations/ff_2026_04_12_01_AUTO.sql — idempotent (COLUMNEXIST guard + CREATE OR REPLACE SP)
- onboarding_roa_web.sql — versioned, parametrizat cu :SCHEMA_NAME
- .claude/rules/oracle-migrations.md — convenție ff_YYYY_MM_DD_NN_MODULE.sql

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-06-05 09:37:09 +00:00
Claude Agent
574aca31e4 fix(service-auto): PrimeVue Dropdown + document CALENDAR grant for ROA_WEB
ComandaNoua.vue folosea `primevue/select` (PrimeVue v4+), dar proiectul rulează
pe v3.48.0 unde componenta se numește `Dropdown`. Cauză a erorii 500 la load-ul
rutei /service-auto/comanda-noua: "Failed to resolve import primevue/select".

grants-audit.md: adăugat `GRANT SELECT ON {SCHEMA}.CALENDAR TO ROA_WEB` în
template-ul de onboarding §4.1 și în tabelul sumar §4.5. CALENDAR e accesat de
`shared/routes/calendar.py` pentru period selector-ul din AppHeader — necesar
pe orice server unde userul poate face login, nu doar service-auto.

DBA action separată: `GRANT SELECT ON MARIUSM_AUTO.CALENDAR TO ROA_WEB`.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-06-05 09:37:09 +00:00
Claude Agent
32aca55c78 feat(service-auto): săpt 3-phase2 — toate ipotezele confirmate + modul funcțional
Backend:
- service_auto module complet: router, service, schemas, 5 teste suites (22/22 passed)
- 5 endpoints: GET /ping, /firme, /tip-deviz, /masini, POST /comenzi
- SP_CREEAZA_COMANDA_PROTOTIP creat în MARIUSM_AUTO (VALID, 5.9ms)
- oracle_pool.py: session_callback backward-compat patch
- ROA_WEB user: grants SP-only confirmate (H3), mariusm_test pool switchat
- pyproject.toml: integration pytest marker înregistrat

Frontend:
- ComandaNoua.vue: date reale din Oracle (firme/tip-deviz/masini), nu hardcodate
- src/modules/service-auto/services/api.js: axios service cu Bearer token
- src/router/index.js: rută /service-auto/comanda-noua

Docs:
- decision-log.md: verdict MERGE, toate 6 ipoteze CONFIRMED
- learnings.md: 7 patterns reutilizabile
- grants-audit.md: arhitectura multi-tenant + proxy auth analysis + V_NOM_FIRME loop
- template-modul-oracle.md: rețetă completă pentru module Oracle noi
- TODO-phase2.md: 7 items concrete

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-05 09:37:09 +00:00
Claude Agent
4162e0711c feat(service-auto): săpt 1 POC Oracle + module scaffold
- poc/hello_oracle.py: sync connect 33ms, DEV_TIP_DEVIZ enum verified live
- poc/hello_oracle_async.py: async 22ms, gate Correction 9 → sync-facade
- backend/modules/service_auto/{routers,services,schemas,models}: scaffold
- docs/service-auto/week1-notes.md: DX latency + gate decision
- docs/service-auto/TODO-phase2.md: phase 2+ backlog (empty header)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-05 09:37:09 +00:00
Claude Agent
43484db45e docs(service-auto): ground truth audit v3 from MARIUSM_AUTO production
Add real production sources as authoritative reference (supersedes
vfp_roaauto/Scripturi_instalare/packages.sql which is for a different
product — devize producție, not service auto):

- mariusm_ddl_export.sql: 5127 lines DDL from DBMS_METADATA (tables,
  views, triggers) of MARIUSM_AUTO schema
- pack_auto.pck: main business package (17 procedures)
- PACK_FACTURARE.pck, PACK_SESIUNE.pck, PACK_CONTAFIN.pck,
  PACK_COMENZI.pck: dependency packages
- export_ddl.sql: SQL export helper using DBMS_METADATA + DBMS_OUTPUT
  with discovery via ALL_OBJECTS LIKE patterns

Rewrite tabele-service-auto.md v3 (~600 lines) fully grounded in
production sources. Map all flows end-to-end:

- Create (pack_auto.dev_adauga_lucrare) → NOM_LUCRARI + DEV_ORDL
- Normare (dev_adauga_operatie) → DEV_OPER + DEV_OPER_MECANICI
- Validate ops (dev_valideaza_operatii) → DEV_OPER.VALIDAT
- Validate order (dev_valideaza_comanda) → DEV_ORDL.VALIDAT + CALENDAR
- Archive (dev_arhiveaza_comanda) → DEV_ORDL.INCHIS_FORTAT
- Bonuri consum: generic ROA (ointroduceri.prg tip=3) → RUL.id_lucrare
- Facturare: pack_facturare.* + pack_auto.actualizeaza_deviz

Key business semantics confirmed by Marius 2026-04-11:

- DEV_TIP_DEVIZ.inch_validare = 1 means validation alone closes the
  order (no closing note). inch_validare = 0 means additional closing
  required (via invoice for billable types, or 711=332 journal entry
  for internal types). View AUTO_LISTARE_MAN_TOT_COM has the exact
  "closed" condition as (validat=1 AND inch_validare=1) OR
  (facturat=1 AND inch_validare=0).
- Live DEV_TIP_DEVIZ values: 1=POST GARANTIE, 2=GARANTIE, 3=REGIE,
  4=PREGATIRE, 5=REGIE 2, 6=PRODUCTIE, 7=CONSTATARE. REGIE/PRODUCTIE/
  CONSTATARE have inch_validare=1 (internal, closed at validation).
- DEV_OPER for service auto contains only manopera (id_norme). The
  id_articol/id_rul_aux columns exist in DDL for another product that
  shares the table but are not populated by pack_auto.
- Real materials consumed on an order live in RUL tagged by id_lucrare,
  not in DEV_OPER. DEV_ESTIMARI_REP is a separate pre-sale estimate
  (both manopera and materiale lines) given to the client, independent
  of the real manopera (DEV_OPER) and real materials (RUL).

Plan Correction 13 (claude-main-design-20260411-rethink.md):

- Invalidate Scripturi_instalare references
- Confirm NOM_LUCRARI ← DEV_ORDL inheritance pattern
- Confirm pack_sesiune.dev_idLucrare/dev_idOrdl populated by triggers
- Refine prototype SP (Option 3) template based on real schema
- Timeline unchanged, scope wall reconfirmed

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-06-05 09:37:09 +00:00
Claude Agent
6aceb85bf1 docs(service-auto): design review + VFP audit (Correction 12)
plan-design-review pass: 6/10 → 9/10. Added interaction-states table
(6-state PrimeVue spec matching ReceiptCreateUnifiedView.vue toast
conventions), design-system inheritance clause (DESIGN.md/TOKENS/
CSS_PATTERNS), a11y one-liner, week-3 subtask for enum+labels
extraction from VFP source.

Cloned gitea.romfast.ro/romfast/vfp_roaauto and wrote a 300+ line
ground-truth audit (docs/service-auto/tabele-service-auto.md)
covering: DEV_ORDL parent/child inheritance with NOM_LUCRARI,
DEV_TIP_DEVIZ enum (1-7, including user-confirmed Productie/
Constatare for 6/7), dev_adauga_lucrare v1 (pack_devize, 12+1
params, body visible in packages.sql) vs v2 (pack_auto, 17+1,
body only in MARIUSM_AUTO), and the pack_sesiune.dev_idLucrare
trigger/session-state pattern (ROA ERP convention from pre-
RETURNING era, not a bug).

Plan Correction 12 added: the prototype needs a ~40-line SP doing
two INSERTs parent→child with RETURNING id_lucrare (bypassing
pack_sesiune), targeting dev_ordl via nom_lucrari. Original
assumption of a 4-param new SP was wrong. Week 3 subtask updated
to reference the audit draft. ACT/RUL untouched at creation time
— Correction 3 still valid.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-06-05 09:37:09 +00:00
Claude Agent
f79a03062c docs(service-auto): add v2 design doc for learning prototype
CEO review output: rethink of scrapped 2026-04-10 product plan,
reframed as learning probe + talent-risk hedge. 24-week timeline,
1 screen + 1 SP + MARIUSM_AUTO test schema. Scope wall absolute:
zero touch on 4 existing VFP clients.

Document includes 8 review corrections vs first draft:
register_server over MarciusLabPool, SP targets dedicated orders
table not ACT ledger, explicit connection.commit(), Oracle error
code range classification, file handler logging, kill criterion,
integration checkpoints at weeks 6+12, template+decision-log as
week-24 deliverable.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-06-05 09:37:09 +00:00
b0f4800e5f docs: update README and Telegram bot documentation
- README: updated Telegram integration description to mention OCR bonuri
- docs/telegram/README.md: rewrote in Romanian, added bonuri fiscale
  workflow (PDF/foto → OCR → preview → Oracle)
- .claude/settings.json: fix statusline path for current user

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-05 09:30:00 +00:00
e257fa5d5f feat(telegram): bot bonuri fiscale — OCR → preview → Oracle write
- US-001: mută queue_client.py în data_entry/services/ocr/
- US-002/003/004: oracle_receipt_writer + oracle_server_id în DB
- US-005: receipt_handlers.py (PDF/photo/callback flow)
- US-006: wire handlers în main.py, per-schema connect, seq_cod.nextval
- US-007: .gitignore secrets/*.oracle_pass
- US-008/009/010: teste unit + integration + E2E
- setup-secrets.sh helper + template
- docs/telegram/README.md actualizat cu arhitectura nouă

Testat E2E pe DB live (MARIUSM_AUTO). COD din seq_cod.nextval.
pypdfium2 fallback pentru PDF decode (fără poppler).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-05 09:26:58 +00:00
Claude Agent
8234103884 fix(design): mobile receipt form layout + confidence badges + DESIGN.md
Fix mobile layout issues on /data-entry/create after OCR upload:
- CompactUploadZone action bar forced horizontal on mobile (was stacking
  vertically due to global .action-bar column rule in containers.css)
- TOTAL input stretches full width on mobile (was fixed 140px)
- Card/Cash/Alte payment inputs equal width via flex: 1 1 0%
- Extra-small (≤360px) fallback stacks payments vertically
- OCR confidence badges: fixed width (icon-only), hidden percentage text,
  hover opacity effect — prevents input misalignment
- OCRConfidenceIndicator: replace hardcoded colors with design tokens
  (green-100/800, yellow-100/800, red-100/800), add three-tier dark mode
- Smaller size-small badge variant (border-radius-sm, line-height: 1)

Create docs/DESIGN.md as design source of truth for /design-review,
/plan-design-review, and /frontend-design skills.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 09:40:42 +00:00
Claude Agent
c5cfe3467c fix(design): standardize mobile breakpoint to <= 768 across all views
Align remaining 12 files with the corrected breakpoint from FINDING-005.
Using < 768 caused a 1px inconsistency at exactly 768px where CSS media
queries (max-width: 768px) triggered mobile but JS did not.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 22:41:17 +00:00
Claude Agent
f05f862a7a style(design): FINDING-010 — remove ALL CAPS from dashboard card labels
Remove text-transform: uppercase and letter-spacing: 0.05em from
CollapsibleCard and SolduriCompactCard labels. Labels now render
in Title Case as written in source ("Trezorerie" not "TREZORERIE").

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 22:15:20 +00:00
Claude Agent
7153d87f6a style(design): FINDING-005 — fix tablet 1px gap where no header shows
At exactly 768px, CSS hides desktop header (max-width: 768px) but JS
isMobile used < 768 (strict), so MobileTopBar didn't show either.
Fix: change < 768 to <= 768 across all 5 views (App, Dashboard,
MaturityAnalysis, SettingsHub, DetailedInvoices).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 22:13:59 +00:00
Claude Agent
655f813b9b style(design): FINDING-007 — fix mobile label inconsistency
"DATORII BUGET" → "DATORII LA BUGET" to match desktop text.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 21:54:11 +00:00
Claude Agent
64a9a4aa99 style(design): FINDING-003 — fix heading hierarchy (h3 → h2)
Sidebar section headings were h3 while page titles are h1, skipping h2.
Change to h2 for proper heading hierarchy (h1 → h2, no skip).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 21:53:10 +00:00
Claude Agent
3269037f50 style(design): FINDING-004 — add tabular-nums to financial numbers
Add font-variant-numeric: tabular-nums to .metric-value and .stats-value
so financial figures align properly when values change.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 21:52:13 +00:00
Claude Agent
41e40c1a37 style(design): FINDING-001 — increase touch targets to 44px minimum
Hamburger button: 32x32 → 44x44px
Theme toggle: 36x36 → 44x44px
Sidebar nav links: add min-height: 44px

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 21:49:38 +00:00
Claude Agent
be7e97796d fix(qa): ISSUE-004 — show receipt ID in title immediately after save
Set receipt.value = savedReceipt before router.push() so modeTitle
computes 'Bon #123' even when Vue Router reuses the component instance
and onMounted does not re-run.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-20 14:32:45 +00:00
Claude Agent
6eb88c8730 fix(qa): ISSUE-003 — widen Nr., Total, and Card/Cash payment fields
- .nr-input: 90px → 120px (fits 7-digit receipt numbers)
- .total-input: 80px → 105px (fits 5-digit amounts with decimals)
- .pay-input: 80px → 105px (PaymentCompactFields Card/Cash columns)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-20 14:32:38 +00:00
Claude Agent
67d6871176 chore: exclude .gstack/ directory from version control
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-20 14:32:30 +00:00
Claude Agent
23080aec46 fix(ocr,gitignore): fix charmap encoding in OCR workers and ignore SQLite WAL files
- Fix UnicodeEncodeError in OCR worker subprocesses on Windows: spawned processes
  with 'spawn' context inherit charmap (CP1252) encoding, causing crashes when
  printing Romanian diacritics (ș, ț, ă) from OCR-extracted text.
  Fix: reconfigure sys.stdout/sys.stderr to UTF-8 in _worker_initializer().

- Add *.db-wal and *.db-shm to .gitignore for SQLite WAL mode auxiliary files.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-20 12:52:50 +00:00
Claude Agent
a1a47eeb7f ssh tunnels 2026-03-13 22:24:54 +00:00
3e2b7fcc0f curatare 2026-03-13 16:40:10 +02:00
Claude Agent
74dff2d17d feat(reports,mobile): add FinancialIndicators page and refactor dashboard layout
- Add dedicated FinancialIndicatorsView with its own route
- Refactor FinancialIndicatorsCard: simplified collapsible card (no period picker)
- Dashboard mobile: reduce swipeable pages from 2 to 1, embed indicators in card-0
- Dashboard desktop: wrap indicators in CollapsibleCard
- Update MobileBottomNav defaults: reports-centric nav (Facturi/Banca/Casa/Indicatori)
- BankView/CashView: date format DD/MM/YY, remove amount color classes, CSS tweaks

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-01 08:55:11 +00:00
Claude Agent
06cbf8fb9d feat(auth,dashboard): 2FA mobile session persistence and sparkline cards
- Persist 2FA state in sessionStorage to survive mobile page reloads
- Reuse existing valid OTP on re-login to avoid rate limiting and duplicate emails
- Add embedded sparkline charts to SolduriCompactCard with expand toggle
- Mobile dashboard redesigned: 2 pages with enriched compact cards + cashflow type
- Login UI simplified: remove gradient bg, subtitle, icon; use design tokens
- Focus OTP input when session is restored from 2FA state

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-26 14:36:22 +00:00
Claude Agent
cbcd5fe8e7 curatare 2026-02-26 08:41:34 +00:00
Claude Agent
0459b3feaf fix(reports): neutralize totals color and fix dark mode button contrast
- Remove green/red/blue coloring from summary totals on all report pages
  (Facturi, Facturi pe Parteneri, Casă, Bancă) — mobile and desktop,
  light and dark mode; totals now use --text-color like TrialBalance
- Fix SplitButton (Export) dark mode: was blue (--color-primary), now
  matches secondary outlined style (--text-color / --surface-border)
- Update button syntax: severity="secondary" outlined instead of legacy
  class="p-button-outlined p-button-secondary"
- DetailedInvoices: partner-meta (8 facturi) inline with partner name
  via flex-direction row instead of column
- TrialBalance: mobile flat-row list layout replacing card layout
- Dashboard mobile title: shows company name + period instead of static "Dashboard"
- Navigation: move Facturi pe Parteneri to RAPOARTE section;
  update MobileBottomNav default items (Detalii replaces Facturi)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-26 08:40:59 +00:00
Claude Agent
1839285ac3 feat(auth): add 2FA with OTP, backup codes and trusted devices
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-24 17:25:00 +00:00
Claude Agent
b001b94e37 fix deploy 2026-02-24 10:09:19 +00:00
Claude Agent
1e2516e022 fix(telegram): use BASE_URL prefix for IIS sub-app compatibility
Replace hardcoded '/api/telegram' with import.meta.env.BASE_URL + 'api/telegram'
to match the reports API pattern. In production the base is '/roa2web/' so absolute
paths bypassed IIS sub-app routing, causing 404 on generate-code endpoint.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-24 10:02:48 +00:00
Claude Agent
24aba7e0b3 curatare 2026-02-23 15:26:07 +00:00
Claude Agent
8bc567a9c5 fix telegram 2026-02-23 15:12:33 +00:00
Claude Agent
6c78fec8a7 feat(dashboard): add datorat/achitat/sold breakdown for budget debts
Replaces "luna prec / luna curentă" columns with a clearer accounting
reconciliation flow: Datorat (owed) → Achitat (paid) → Sold (remaining).
Backend models gain 3 new fields per sub-account and group. Frontend
shows ✓ when a debt is fully cleared. Mobile TVA card now shows both
total and remaining sold. SwipeableCards gains fixedDots/fillHeight props
for better layout above MobileBottomNav. Telegram formatter updated to
use new fields and drops redundant RON suffix from amounts.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-23 15:05:41 +00:00
Claude Agent
aac49542e4 fix(telegram): edit messages in-place during server switch flow
Server switch flow now edits the original message at each step
(progress, error, company list) instead of sending separate messages.
"Server schimbat" notice is folded into the company selection header.
Also adds budget debt breakdown to dashboard formatter.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-23 09:18:59 +00:00
Claude Agent
30f55cf18b feat: Add A-Z filter for clients/suppliers in Telegram bot
- Add A-Z alphabetical filter keyboard for clients and suppliers lists
  (same pattern as company selection, without emoji)
- Increase clients/suppliers list pagination from 10 to 20 items per page
- Remove emoji from company A-Z filter button for consistency
- Add 6 new callback handlers: clients_alpha_menu, clients_alpha:LETTER,
  clients_alpha_page:PAGE:LETTER, and supplier equivalents
- Dashboard service and models updates
- Telegram bot: email handlers, auth, DB operations, internal API improvements
- Frontend: dashboard cards updates (CashFlow, Clienti, Furnizori, Treasury)
- Frontend: SolduriCompactCard and CollapsibleCard improvements
- DashboardView enhancements
- start.sh and run-with-restart.sh script updates
- IIS web.config and service worker updates

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-21 14:34:15 +00:00
Claude Agent
1366dbc11c feat: Add WhatsApp import scripts for receipt processing
- OCR client for SQLite queue
- WhatsApp flow: PDF -> OCR -> SQLite -> Oracle
- PACK_CONTAFIN integration for Oracle save
- README with flux documentation
2026-02-03 15:33:22 +00:00
Claude Agent
2e1ead69e1 refactor: simplify Oracle pool to use only ORACLE_SERVERS format
- Remove legacy pool support (DSN, env vars fallback)
- Use first registered server when server_id not specified
- Show server dropdown even with single server in ORACLE_SERVERS
- Email login only available for 2+ servers

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 15:15:57 +00:00
Claude Agent
6718c956f7 feat: [US-004] Add SSH tunnel auto-start for Windows services
- Add ssh-tunnel.ps1: Windows SSH tunnel manager (equivalent to ssh-tunnel.sh)
  - Supports password auth via plink.exe (PuTTY)
  - Supports ssh_hostkey for non-interactive batch mode
  - Commands: start, stop, restart, status

- Add start-backend-service.ps1: NSSM service wrapper
  - Starts SSH tunnels before uvicorn
  - Waits for tunnel ports to be accessible (30s timeout)
  - Configured by Install-ROA2WEB.ps1

- Add start.ps1: Windows equivalent of start.sh
  - Orchestrates SSH tunnel + backend + frontend startup

- Add backend/shared/ssh_tunnel_manager.py: Python monitoring
  - Background asyncio task monitors tunnel health every 30s
  - Auto-restarts tunnels after 2 consecutive failures
  - Exposes status to /health endpoint

- Update ROA2WEB-Console.ps1:
  - Add Deploy-Scripts function
  - Update Update-ServiceToUseVenv to use wrapper script

- Fix PowerShell reserved variable ($PID -> $tunnelPid)
- Fix script path detection (scripts/ vs deployment/windows/scripts/)
- Update README.md with ssh_hostkey documentation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 19:04:26 +00:00
Claude Agent
dc1711acd0 feat: [US-001] Add automatic Alembic migrations at backend startup
- Add alembic.ini config for data_entry module
- Add migrations.py helper with:
  - run_migrations(): runs pending migrations at startup (returns True/False)
  - get_current_revision(): returns current schema version for /health
- Integrate migrations in main.py startup_event() BEFORE init_data_entry_db()
- Add data_entry_schema_version to /health endpoint

If migrations fail, backend continues with WARNING (not crash).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 18:00:01 +00:00
Claude Agent
8567f893bc feat: [US-003] Audit and document deploy script data preservation
- Add detailed logging in Deploy-Backend function for data/ preservation
- Update deployment/windows/README.md with "Data Preserved During Deploy" section
- Document data/ directory structure (receipts/, telegram/, cache/)
- Explain preservation mechanism (backup → deploy → restore)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 23:41:55 +00:00
Claude Agent
752858182d feat: [US-002] Fix UTF-8 encoding for Windows console
Add UTF-8 encoding setup at the top of backend/main.py to fix
'charmap' codec encoding errors when logging Romanian diacritics
(ă, î, ș, ț) on Windows console.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 23:36:47 +00:00
Claude Agent
b137e80b71 feat: multi-Oracle server support with runtime switching
Complete implementation of multi-server Oracle database support:

Backend:
- Multi-pool Oracle with lazy loading per server
- Email-to-server cache for automatic server discovery
- JWT tokens include server_id claim
- /auth/check-identity and /auth/check-email endpoints
- /auth/my-servers endpoint for listing user's accessible servers
- Server switch with password re-authentication

Frontend:
- New ServerSelector component for header dropdown
- Multi-step login flow (identity → server → password)
- Server switching from header with password modal
- Mobile drawer menu with server selection
- Dark mode support for all new components
- URL bookmark support with ?server= query param

Scripts:
- Unified start.sh replacing start-prod.sh/start-test.sh
- Unified ssh-tunnel.sh with multi-server support
- Updated status.sh for new architecture

Tests:
- E2E tests for multi-server and single-server login flows
- Backend unit tests for all new endpoints
- Oracle multi-pool integration tests

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 22:39:06 +00:00
Claude Agent
5f99ee2fd0 curatare 2026-01-22 13:41:48 +00:00
Claude Agent
fcf2722974 refactor(docs): create troubleshooting folder, cleanup OCR docs
- Create docs/troubleshooting/ for debugging guides
- Move OCR_MEMORY_SOLUTIONS_RESEARCH.md → troubleshooting/OCR_MEMORY_LEAKS.md
- Delete outdated docs/data-entry/OCR_PROFILE_TEST_RESULTS.md
- Update CLAUDE.md documentation index with troubleshooting reference

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 09:21:07 +00:00
Claude Agent
625fdcef5e chore: delete outdated OCR benchmark results
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 09:16:47 +00:00