# Construction & Real Estate CRM

Dual CRM system built with **Laravel 12** + **Filament 3** — Real Estate aur Construction dono ek hi system mein, alag panels aur role-based permissions ke sath.

## Panels

| Panel | URL | Purpose |
|-------|-----|---------|
| Admin | `/admin` | Users, roles, permissions |
| Real Estate CRM | `/real-estate` | Leads, clients, properties, bookings, finance |
| Construction CRM | `/construction` | Projects, materials, vendors, DPR, finance |

## Quick Start

```bash
composer install
cp .env.example .env
php artisan key:generate
php artisan migrate --seed
php artisan storage:link
php artisan serve
```

Open: http://localhost:8000

## Demo Accounts

| Email | Role | Panel |
|-------|------|-------|
| admin@crm.com | Super Admin | All panels |
| realestate@crm.com | RE Admin | Real Estate |
| sales@crm.com | Sales Agent | Real Estate |
| construction@crm.com | Construction Admin | Construction |

Password: `password`

## Modules

### Real Estate CRM
- Lead & Client Management (sales)
- Property inventory (Available / Sold / On-Hold)
- Booking & allotment
- Installment & payment plans
- Property transfers
- Invoices, receipts, expenses
- Document vault

### Construction CRM
- Project milestones (Excavation → Finishing)
- Material inventory & consumption
- Vendors & contractors
- Daily Progress Reports (DPR)
- Project expenses & finance

### Admin
- Role-Based Access Control (RBAC)
- User management with panel assignment
- Permission control per module

## Performance

- Database indexes on frequently queried columns
- Table `deferLoading()` for faster page loads
- Dashboard stats cached for 60 seconds
- Eager loading on relationship-heavy queries

### Production optimization

```bash
php artisan config:cache
php artisan route:cache
php artisan view:cache
php artisan optimize
```

For maximum speed, use **Redis** cache, **MySQL** (instead of SQLite), and enable PHP `intl` extension.

## Scheduled Reminders

```bash
php artisan crm:send-reminders
```

Add to cron: `* * * * * php artisan schedule:run`

## Tech Stack

- Laravel 12
- Filament 3 (Admin UI)
- Spatie Laravel Permission (RBAC)
- SQLite (dev) / MySQL (production)
