# CLAUDE.md - Data Entry App ## Scop Aplicatie pentru introducere date in ERP (bonuri fiscale, chitante) cu workflow de aprobare. ## Documentatie de Referinta - **Cerinte**: `docs/data-entry/REQUIREMENTS.md` - **Arhitectura**: `docs/data-entry/ARCHITECTURE.md` - **Quick Start**: `README.md` ## Decizii Tehnice - **ORM**: SQLModel (Pydantic + SQLAlchemy) - **Migrari**: Alembic - **Database**: SQLite (Faza 1) → Oracle (Faza 2) - **Frontend**: Vue.js 3 + PrimeVue (consistent cu reports-app) ## Workflow Bonuri ``` 1. DRAFT → utilizator completeaza + upload poza 2. PENDING_REVIEW → sistem genereaza note contabile 3. APPROVED/REJECTED → contabil aproba sau respinge 4. SYNCED → (Faza 2) date in Oracle ``` ## Structura Directoare ``` data-entry-app/ ├── backend/ # FastAPI API (port 8003) │ ├── app/ │ │ ├── db/ # SQLModel models + CRUD │ │ ├── schemas/ # Pydantic schemas │ │ ├── services/ # Business logic │ │ └── routers/ # API endpoints │ ├── migrations/ # Alembic migrations │ └── data/ # SQLite DB + uploads ├── frontend/ # Vue.js UI (port 3010) │ └── src/ │ ├── views/ # Page components │ ├── components/ # Reusable components │ └── stores/ # Pinia stores └── docs/ # Documentatie specifica ``` ## Componente Partajate ### Backend - `shared/database/oracle_pool.py` - Conexiune Oracle pentru nomenclatoare si autentificare - `shared/auth/` - JWT authentication (middleware, routes, service) ### Frontend - `shared/frontend/components/LoginView.vue` - Componenta login partajata - `shared/frontend/stores/auth.js` - Pinia auth store factory - `shared/frontend/styles/login.css` - Stiluri login ## Comenzi Dezvoltare ```bash # Backend cd data-entry-app/backend pip install -r requirements.txt alembic upgrade head uvicorn app.main:app --reload --port 8003 # Frontend cd data-entry-app/frontend npm install npm run dev -- --port 3010 # Migrari cd data-entry-app/backend alembic revision --autogenerate -m "description" alembic upgrade head ``` ## Tipuri Cheltuieli (hardcoded in Faza 1) | Cod | Tip | Cont | TVA | |-----|-----|------|-----| | FUEL | Combustibil | 6022 | 19% | | MATERIALS | Materiale | 6028 | 19% | | OFFICE | Rechizite | 6024 | 19% | | PHONE | Telefonie | 626 | 19% | | PARKING | Parcare | 6022 | 19% | | FOOD | Alimentatie | 6028 | 0% | | TRANSPORT | Transport | 624 | 19% | | OTHER | Altele | 628 | 19% | ## Integrare Oracle (Faza 2) Vezi `docs/PACK_CONTAFIN.pck` pentru procedurile stocate: - `pack_contafin.init_scriere_act_rul_local()` - `INSERT INTO ACT_TEMP (...)` - `pack_contafin.finalizeaza_scriere_act_rul()` ## API Endpoints Summary ### Receipts CRUD - `POST /api/receipts/` - Create - `GET /api/receipts/` - List (filterable) - `GET /api/receipts/{id}` - Detail - `PUT /api/receipts/{id}` - Update (DRAFT only) - `DELETE /api/receipts/{id}` - Delete (DRAFT only) ### Workflow - `POST /api/receipts/{id}/submit` - Send for review - `POST /api/receipts/{id}/approve` - Approve - `POST /api/receipts/{id}/reject` - Reject - `POST /api/receipts/{id}/resubmit` - Resubmit after rejection ### Attachments - `POST /api/receipts/{id}/attachments` - Upload - `GET /api/attachments/{id}/download` - Download - `DELETE /api/attachments/{id}` - Delete ### Nomenclatures - `GET /api/receipts/partners` - Partners from Oracle - `GET /api/receipts/accounts` - Accounts from Oracle - `GET /api/receipts/cash-registers` - Cash registers from Oracle - `GET /api/receipts/expense-types` - Expense types (hardcoded) ## Testing ```bash # Backend tests cd backend && pytest # Frontend tests cd frontend && npm run test ``` ## Common Issues ### SQLite locked - Asigura-te ca nu ai multiple procese care acceseaza DB-ul ### Upload fails - Verifica permisiuni pe `data/uploads/` - Verifica MIME type (doar image/*, application/pdf) ### Migration errors - `alembic downgrade -1` pentru rollback - Sterge migration file si regenereaza