A full-stack enterprise application for managing and printing Lettres de Change (Bills of Exchange) — financial instruments used in Tunisian banking and commercial operations.
# 📄 Cambiale — Lettre de Change Management & Print System
A full-stack enterprise application for managing and printing **Lettres de Change** (Bills of Exchange) — financial instruments used in Tunisian banking and commercial operations.
---
## 📌 Overview
This system digitizes and automates the complete lifecycle of a Lettre de Change: from issuing and managing bank/subsidiary/account structures, to creating cambiale records with full relational data, previewing them overlaid on the official PDF template, and triggering a tracked one-time print.
---
## 🧩 Features
### 🏦 Bank Hierarchy Management
- Full CRUD for **Banks**, **Subsidiary Banks**, and **Comptes (Accounts)**
- Hierarchical drill-down: Bank → Subsidiary → Compte, navigated via full-screen sidebars
- Code-immutability enforcement on edit (bank codes and subsidiary codes are locked after creation)
- **RIB validation** with modulo-97 checksum verification during compte creation
### 👥 Beneficiary Management
- Manage drawer / pay-to-order-of pairs used on cambiale documents
- Live search/filter across all beneficiaries
### 📋 Cambiale Management
- Create cambiales with: amount, operation date, protestable flag, creation location (Tunisian governorate), donor account, and beneficiary
- Full detail view with collapsible panels: Bank Info, Subsidiary Info, Beneficiary Info, Donor Info
- Soft-delete protection: printed cambiales cannot be deleted
- Governorate-aware autocomplete for creation location
### 🖨️ PDF Generation & Print
- **Preview mode**: loads the official *Lettre de Change* PDF template and overlays all dynamic fields (RIB, names, dates, amounts, locations) using `pdf-lib` — no server round-trip
- **Print mode**: generates a data-only PDF and sends it to the browser print dialog
- **Amount in letters** field auto-populated by the backend
- Print tracking: once printed, the cambiale is marked `isPrinted = true`, locking further prints and deletion
- Zoom and page navigation controls in the PDF …