# Stock Dashboard - Multi-Filter Guide

## 🎯 New Filters Added!

The Stock Dashboard now has **THREE filters** to help you find exactly what you need:

### **1. Color Filter** 🎨
- Filter products by color
- Examples: Red, Blue, Black, White, Silver

### **2. Vehicle Model Filter** 🚗
- Filter products by vehicle model
- Examples: Model S, Model 3, Civic, Corolla, F-150

### **3. Variant Filter** ⚙️
- Filter products by variant/version
- Examples: LX, EX, Sport, Limited, Premium

---

## 📊 How to Use Filters

### **Single Filter:**
Select **Color = Red** → See all red products stock

### **Multiple Filters:**
Select **Color = Red** AND **Model = Civic** → See only Red Honda Civic products

Select **Color = Blue** AND **Model = F-150** AND **Variant = Sport** → See Blue Ford F-150 Sport products

### **Remove Filters:**
Click **"Remove Filter"** button to clear all filters

---

## 🔍 Filter Combinations Examples

### Example 1: Find All Red Products
```
Color: Red
Model: -- All Models --
Variant: -- All Variants --

Result: Shows stock for ALL red products
```

### Example 2: Find Red Civic Products
```
Color: Red
Model: Civic
Variant: -- All Variants --

Result: Shows stock for Red Honda Civics only
```

### Example 3: Find Specific Variant
```
Color: Black
Model: F-150
Variant: Sport

Result: Shows stock for Black Ford F-150 Sport only
```

---

## 📋 Setup Requirements

### You need to create these extrafields for products:

**1. Color Extrafield:**
- Code: `color`
- Label: `Color`
- Type: Varchar or List
- Size: 255

**2. Vehicle Model Extrafield:**
- Code: `vehicle_model`
- Label: `Vehicle Model`
- Type: Varchar or List
- Size: 255

**3. Variant Extrafield:**
- Code: `variant`
- Label: `Variant`
- Type: Varchar or List
- Size: 255

### How to Create Extrafields:

1. Go to **Setup → Products/Services → Extra fields**
2. Click **"New extrafield"**
3. Fill in the details above
4. Click **Create**
5. Repeat for all three fields

---

## 🌐 Access Dashboard

**URL:**
```
http://localhost/admin_crm/htdocs/product/stock_dashboard.php
```

---

## 📊 What You'll See

### **With No Filters:**
Shows ALL products stock summary

### **With Filters Applied:**

**Title shows active filters:**
```
Overall Stock Summary - Color: Red, Vehicle Model: Civic
```

**Summary shows filtered data:**
```
Total Stock (Red, Civic): 15 units
🟢 Available Stock: 10 units (66.7%)
🔴 Sold Stock: 5 units (33.3%)
```

**Product list shows matching products:**
```
Product        Color   Model    Variant   Stock   Status
Civic Red LX   Red     Civic    LX        5       On Sale
Civic Red EX   Red     Civic    EX        3       On Sale
Civic Red Sport Red    Civic    Sport     2       Sold
```

---

## 💡 Pro Tips

### **1. Use Consistent Names:**
Always use the same spelling:
- ✅ "Civic" (not sometimes "civic" or "CIVIC")
- ✅ "Red" (not sometimes "red" or "RED")

### **2. Combine Filters for Precision:**
- Broad search: Use 1 filter (e.g., Color only)
- Specific search: Use 2-3 filters (e.g., Color + Model + Variant)

### **3. Check Stock Quickly:**
Customer asks: "Do you have Red Civic in stock?"
→ Filter Color=Red, Model=Civic
→ Instantly see available stock!

### **4. Track Popular Variants:**
Filter by Model to see which variants sell best

---

## 🎨 Visual Example

### Filter Panel:
```
┌─────────────────────────────────────────────────────┐
│ Filter Options                                      │
├─────────────────────────────────────────────────────┤
│ Color:       [Red ▼]  Model:    [Civic ▼]          │
│ Variant:     [All ▼]  [Search] [Remove Filter]     │
└─────────────────────────────────────────────────────┘
```

### Results:
```
Overall Stock Summary - Color: Red, Vehicle Model: Civic

Description                    Quantity
──────────────────────────────────────
Total Stock in Warehouses:        15
🟢 Available Stock (For Sale):    10
🔴 Sold Stock (Not For Sale):     5
──────────────────────────────────────

Sales Balance Detail - Red, Civic

Summary              Quantity   Percentage
Total Stock (Red, Civic)  15     100%
🟢 Available Stock        10     66.7%
🔴 Sold Stock             5      33.3%
```

---

## 📁 Files Modified

- `htdocs/product/stock_dashboard.php` - Added Vehicle Model & Variant filters

---

**Updated:** 2026-04-29
**Version:** 2.0 (Multi-filter support)
