feat: Add shared components, refactor stores, improve data-entry workflow

Shared Components:
- Add CompanySelector.vue and PeriodSelector.vue components
- Add AppHeader.vue and SlideMenu.vue layout components
- Add shared stores factories (companies.js, accountingPeriod.js)
- Add shared routes factories (companies.py, calendar.py)
- Add shared models (company.py, calendar.py)
- Add shared layout styles (header.css, navigation.css)

Data Entry App:
- Update CLAUDE.md with prod/test server documentation
- Improve nomenclature sync service with better error handling
- Update receipts router and CRUD operations
- Add company/period stores using shared factories
- Update App.vue layout with shared components
- Fix OCRUploadZone file handling

Reports App:
- Refactor stores to use shared factories
- Update App.vue to use shared layout components

Infrastructure:
- Replace start-data-entry.sh with separate dev/test scripts
- Add .claude/rules for authentication, backend patterns, etc.
- Add implementation plan for OCR receipt improvements
- Clean up old documentation files

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-15 15:00:45 +02:00
parent c5fde510a8
commit 1a6e9b17d2
47 changed files with 4079 additions and 2595 deletions

View File

@@ -57,6 +57,89 @@ data-entry-app/
- `shared/frontend/stores/auth.js` - Pinia auth store factory
- `shared/frontend/styles/login.css` - Stiluri login
## Servere Oracle (Producție vs Test)
**IMPORTANT**: Există două servere Oracle separate. Verifică întotdeauna la care ești conectat!
| Server | IP Oracle | Tunel SSH | Schema Verificare | Company ID |
|--------|-----------|-----------|-------------------|------------|
| **PRODUCȚIE** | `10.0.20.36` | `./ssh_tunnel.sh` | `ROMFAST` | 114 |
| **TEST** | `10.0.20.121` | `./ssh-tunnel-test.sh` | `MARIUSM_AUTO` | 110 |
### Scripturi de Pornire
**IMPORTANT**: Folosește scriptul corespunzător mediului dorit!
```bash
# Pentru PRODUCȚIE (10.0.20.36)
./start-data-entry-dev.sh # Pornește tot (tunel + backend + frontend)
./start-data-entry-dev.sh stop # Oprește tot
./start-data-entry-dev.sh status # Verifică status
# Pentru TEST (10.0.20.121)
./start-data-entry-test.sh # Pornește tot (tunel + backend + frontend)
./start-data-entry-test.sh stop # Oprește tot
./start-data-entry-test.sh status # Verifică status
```
Scripturile fac automat:
1. Opresc tunelul celuilalt mediu (dacă rulează)
2. Pornesc tunelul corect
3. Copiază `.env.prod` sau `.env.test` în `.env`
4. Rulează migrările pe baza de date corectă
5. Pornesc frontend și backend
### Fișiere .env
| Fișier | Server | Database | Schema Test |
|--------|--------|----------|-------------|
| `.env.prod` | PRODUCȚIE (10.0.20.36) | `receipts_prod.db` | ROMFAST (id=114) |
| `.env.test` | TEST (10.0.20.121) | `receipts_test.db` | MARIUSM_AUTO (id=110) |
### Verificare conexiune
```bash
# Verifică la ce server ești conectat
./ssh_tunnel.sh status # Dacă rulează = PRODUCȚIE
./ssh-tunnel-test.sh status # Dacă rulează = TEST
# Verifică schema disponibilă (din backend/)
python3 -c "
import asyncio
from dotenv import load_dotenv
load_dotenv()
import sys; sys.path.insert(0, '../../shared')
from database.oracle_pool import oracle_pool
async def check():
await oracle_pool.initialize()
async with oracle_pool.get_connection() as conn:
with conn.cursor() as cur:
cur.execute('SELECT SCHEMA, NUME FROM CONTAFIN_ORACLE.V_NOM_FIRME ORDER BY NUME')
for row in cur.fetchall()[:10]:
print(f'{row[0]}: {row[1]}')
asyncio.run(check())
"
```
### Sincronizare Nomenclatoare
Query-ul pentru furnizori folosește `CORESP_TIP_PART`:
- `id_tip_part = 17` → Furnizori
- `id_tip_part = 22` → Casa LEI
- `id_tip_part = 23` → Casa Valută
- `id_tip_part = 24` → Bancă LEI
- `id_tip_part = 25` → Bancă Valută
```sql
-- Exemplu query furnizori pentru schema MARIUSM_AUTO (TEST)
SELECT B.ID_PART, B.DENUMIRE, B.COD_FISCAL, B.ADRESA
FROM MARIUSM_AUTO.CORESP_TIP_PART A
INNER JOIN MARIUSM_AUTO.VNOM_PARTENERI B ON A.ID_PART = B.ID_PART
WHERE A.ID_TIP_PART = 17 AND (B.INACTIV = 0 OR B.INACTIV IS NULL)
ORDER BY B.DENUMIRE;
```
## Comenzi Dezvoltare
```bash
@@ -135,6 +218,15 @@ cd frontend && npm run test
## Common Issues
### Nomenclatoare goale / furnizori lipsă
- Verifică la ce server Oracle ești conectat: `./ssh_tunnel.sh status`
- Verifică dacă schema firmei selectate există pe acel server
- Sincronizează manual: `POST /api/nomenclature/sync/all`
### Conectat la serverul greșit
- PRODUCȚIE are schema `ROMFAST`, TEST are schema `MARIUSM_AUTO`
- Oprește tunelul curent și pornește cel corect (vezi secțiunea "Servere Oracle")
### SQLite locked
- Asigura-te ca nu ai multiple procese care acceseaza DB-ul