# Balorp Ventures Database ERD

## Core entities
- `users` — application users with roles and login credentials.
- `roles` — RBAC roles: Super Admin, Admin, Staff.
- `customers` — customer contact records for quotes, invoices and projects.
- `leads` — CRM lead tracking from the project request wizard.
- `quotations` — quotation records with VAT, discount and totals.
- `projects` — project management records with status and progress.
- `invoices` — invoices for payment tracking.

## Relationships
- `users.role_id` -> `roles.id`
- `leads.customer_id` -> `customers.id`
- `leads.assigned_to` -> `users.id`
- `quotations.customer_id` -> `customers.id`
- `quotations.created_by` -> `users.id`
- `quotation_items.quotation_id` -> `quotations.id`
- `projects.customer_id` -> `customers.id`
- `projects.project_manager` -> `users.id`
- `project_photos.project_id` -> `projects.id`
- `site_visits.project_id` -> `projects.id`
- `site_visits.lead_id` -> `leads.id`
- `site_visits.inspector_id` -> `users.id`
- `inventory_items.supplier_id` -> `suppliers.id`
- `tasks.assigned_to` -> `users.id`
- `customer_portal_users.customer_id` -> `customers.id`
- `galleries.project_id` -> `projects.id`
- `invoices.customer_id` -> `customers.id`
- `invoices.quotation_id` -> `quotations.id`
- `invoice_items.invoice_id` -> `invoices.id`

## Additional CMS entities
- `cms_slides` — hero slides for homepage.
- `cms_services` — service content blocks.
- `cms_projects` — website project portfolio.
- `cms_blog_posts` — blog content.
- `cms_testimonials` — display testimonials on the site.

## Notes
- The schema is designed for phpMyAdmin compatibility and shared hosting.
- All tables use InnoDB for referential integrity and foreign key support.
- `leads`, `projects`, `quotations`, and `invoices` support future expansion for CRM, reporting, and customer portal features.
