dwindown
9c31b4ce6c
feat: Mobile chart optimization + VIP customer settings
## Task 4: Mobile Chart Optimization ✅
**Problem:** Too many data points = tight/crowded lines on mobile
**Solution:** Horizontal scroll container
**Implementation:**
- ChartCard component enhanced with mobile scroll
- Calculates minimum width based on data points (40px per point)
- Desktop: Full width responsive
- Mobile: Fixed width chart in scrollable container
```tsx
// ChartCard.tsx
const mobileMinWidth = Math.max(600, dataPoints * 40);
<div className="overflow-x-auto -mx-6 px-6 md:mx-0 md:px-0">
<div style={{ minWidth: `${mobileMinWidth}px` }}>
{children}
</div>
</div>
```
**Benefits:**
- ✅ All data visible (no loss)
- ✅ Natural swipe gesture
- ✅ Readable spacing
- ✅ Works for all chart types
- ✅ No data aggregation needed
---
## Task 5: VIP Customer Settings ✅
**New Feature:** Configure VIP customer qualification criteria
### Backend (PHP)
**Files Created:**
- `includes/Compat/CustomerSettingsProvider.php`
- VIP settings management
- VIP detection logic
- Customer stats calculation
**API Endpoints:**
- `GET /store/customer-settings` - Fetch settings
- `POST /store/customer-settings` - Save settings
**Settings:**
```php
woonoow_vip_min_spent = 1000
woonoow_vip_min_orders = 10
woonoow_vip_timeframe = 'all' | '30' | '90' | '365'
woonoow_vip_require_both = true
woonoow_vip_exclude_refunded = true
```
**VIP Detection:**
```php
CustomerSettingsProvider::is_vip_customer($customer_id)
CustomerSettingsProvider::get_vip_stats($customer_id)
```
### Frontend (React)
**Files Created:**
- `admin-spa/src/routes/Settings/Customers.tsx`
**Features:**
- 💰 Minimum total spent (currency input)
- �� Minimum order count (number input)
- 📅 Timeframe selector (all-time, 30/90/365 days)
- ⚙️ Require both criteria toggle
- 🚫 Exclude refunded orders toggle
- 👑 Live preview of VIP qualification
**Navigation:**
- Added to Settings menu
- Route: `/settings/customers`
- Position: After Tax, before Notifications
---
## Summary
✅ **Mobile Charts:** Horizontal scroll for readable spacing
✅ **VIP Settings:** Complete backend + frontend implementation
**Mobile Chart Strategy:**
- Minimum 600px width
- 40px per data point
- Smooth horizontal scroll
- Desktop remains responsive
**VIP Customer System:**
- Flexible qualification criteria
- Multiple timeframes
- AND/OR logic support
- Refunded order exclusion
- Ready for customer list integration
**All tasks complete!** 🎉
2025-11-11 00:49:07 +07:00
..
2025-11-10 23:44:18 +07:00
2025-11-11 00:49:07 +07:00
2025-11-11 00:49:07 +07:00
2025-11-10 22:41:18 +07:00
2025-11-10 23:18:56 +07:00