222 lines
6.8 KiB
Markdown
222 lines
6.8 KiB
Markdown
# Settings Usage Audit Report
|
|
|
|
## Summary
|
|
This document provides a comprehensive audit of how frontend pages use information from Settings (email, phone, address, currency, etc.) vs hardcoded values.
|
|
|
|
---
|
|
|
|
## ✅ Pages Using Settings Correctly
|
|
|
|
### 1. **Header Component** (`Frontend/src/shared/components/Header.tsx`)
|
|
**Status: ⚠️ Uses Settings with Hardcoded Fallbacks**
|
|
|
|
- ✅ Uses `useCompanySettings()` hook
|
|
- ✅ Uses `settings.company_phone` and `settings.company_email`
|
|
- ❌ **Hardcoded fallbacks:**
|
|
- Phone: `'+1 (234) 567-890'`
|
|
- Email: `'info@luxuryhotel.com'`
|
|
- ✅ Uses `settings.company_logo_url`
|
|
|
|
**Recommendation:** Remove hardcoded fallbacks or use empty string/null instead.
|
|
|
|
---
|
|
|
|
### 2. **Footer Component** (`Frontend/src/shared/components/Footer.tsx`)
|
|
**Status: ✅ Fully Uses Settings**
|
|
|
|
- ✅ Uses `useCompanySettings()` hook
|
|
- ✅ Uses `settings.company_phone`, `settings.company_email`, `settings.company_address`
|
|
- ✅ No hardcoded fallbacks (uses `null` if not available)
|
|
- ✅ Uses `settings.company_logo_url`
|
|
|
|
---
|
|
|
|
### 3. **ContactPage** (`Frontend/src/features/content/pages/ContactPage.tsx`)
|
|
**Status: ⚠️ Uses Settings with Hardcoded Fallback Text**
|
|
|
|
- ✅ Uses `useCompanySettings()` hook
|
|
- ✅ Uses `settings.company_phone`, `settings.company_email`, `settings.company_address`
|
|
- ❌ **Hardcoded fallback text:**
|
|
- Phone: `'Available 24/7 for your convenience'` (should be actual phone or null)
|
|
- Email: `"We'll respond within 24 hours"` (should be actual email or null)
|
|
- Address: `'Visit us at our hotel reception'` (should be actual address or null)
|
|
|
|
**Recommendation:** Use actual values from settings or show nothing if not available.
|
|
|
|
---
|
|
|
|
### 4. **AboutPage** (`Frontend/src/features/content/pages/AboutPage.tsx`)
|
|
**Status: ✅ Fully Uses Settings**
|
|
|
|
- ✅ Uses `useCompanySettings()` hook
|
|
- ✅ Uses `settings.company_phone`, `settings.company_email`, `settings.company_address`
|
|
- ✅ No hardcoded fallbacks (uses `null` if not available)
|
|
|
|
---
|
|
|
|
### 5. **Policy Pages** (Privacy, Terms, Refunds, Cancellation, Accessibility, FAQ)
|
|
**Status: ✅ Uses Settings for Email**
|
|
|
|
- ✅ All use `useCompanySettings()` hook
|
|
- ✅ Use `settings.company_email` for contact links
|
|
- ✅ Only show email link if `settings.company_email` exists
|
|
|
|
**Pages:**
|
|
- `PrivacyPolicyPage.tsx`
|
|
- `TermsPage.tsx`
|
|
- `RefundsPolicyPage.tsx`
|
|
- `CancellationPolicyPage.tsx`
|
|
- `AccessibilityPage.tsx`
|
|
- `FAQPage.tsx`
|
|
|
|
---
|
|
|
|
### 6. **Customer Pages - Currency Usage**
|
|
**Status: ✅ All Use Currency Context**
|
|
|
|
All customer pages use `useFormatCurrency()` hook which uses `CurrencyContext`:
|
|
- ✅ `BookingDetailPage.tsx`
|
|
- ✅ `BookingSuccessPage.tsx`
|
|
- ✅ `MyBookingsPage.tsx`
|
|
- ✅ `RoomDetailPage.tsx`
|
|
- ✅ `FullPaymentPage.tsx`
|
|
- ✅ `PaymentConfirmationPage.tsx`
|
|
- ✅ `InvoicePage.tsx`
|
|
- ✅ `GroupBookingPage.tsx`
|
|
- ✅ `DashboardPage.tsx`
|
|
|
|
**Currency Source:** `CurrencyContext` → `localStorage.getItem('currency')` → Falls back to 'VND'
|
|
|
|
---
|
|
|
|
### 7. **Content Pages - Currency Usage**
|
|
**Status: ✅ All Use Currency Context**
|
|
|
|
- ✅ `HomePage.tsx` - Uses `useFormatCurrency()` for service prices
|
|
- ✅ `ServicesPage.tsx` - Uses `useFormatCurrency()` for service prices
|
|
- ✅ `ServiceDetailPage.tsx` - Uses `useFormatCurrency()` for service prices
|
|
|
|
---
|
|
|
|
### 8. **PaymentResultPage** (`Frontend/src/pages/customer/PaymentResultPage.tsx`)
|
|
**Status: ⚠️ Uses Settings with Hardcoded Fallbacks**
|
|
|
|
- ✅ Uses `useCompanySettings()` hook
|
|
- ❌ **Hardcoded fallbacks:**
|
|
- Email: `'support@hotel.com'`
|
|
- Phone: `'1900 xxxx'`
|
|
|
|
**Recommendation:** Remove hardcoded fallbacks.
|
|
|
|
---
|
|
|
|
### 9. **Auth Components**
|
|
**Status: ⚠️ Mixed Usage**
|
|
|
|
**ForgotPasswordModal:**
|
|
- ✅ Uses `settings.company_email || 'support@hotel.com'` (has fallback)
|
|
|
|
**Other Auth Components:**
|
|
- ❌ Only use placeholder text in form fields (acceptable for UX)
|
|
|
|
---
|
|
|
|
## ❌ Pages with Hardcoded Values
|
|
|
|
### 1. **PaymentConfirmationPage** (`Frontend/src/pages/customer/PaymentConfirmationPage.tsx`)
|
|
**Status: ❌ Hardcoded Bank Details**
|
|
|
|
**Hardcoded Values:**
|
|
- Bank: `'Vietcombank (VCB)'`
|
|
- Account Number: `'0123456789'`
|
|
- Account Holder: `'KHACH SAN ABC'`
|
|
|
|
**Recommendation:** Add bank details to Settings and make them configurable from admin.
|
|
|
|
---
|
|
|
|
## 📊 Summary Statistics
|
|
|
|
| Category | Total | Uses Settings | Hardcoded Fallbacks | Hardcoded Values |
|
|
|----------|-------|---------------|---------------------|------------------|
|
|
| **Email/Phone/Address** | 15+ pages | 12 pages | 3 pages | 0 pages |
|
|
| **Currency** | 12+ pages | 12 pages | 0 pages | 0 pages |
|
|
| **Bank Details** | 1 page | 0 pages | 0 pages | 1 page |
|
|
| **Logo** | 2 components | 2 components | 0 | 0 |
|
|
|
|
---
|
|
|
|
## 🔧 Issues Found
|
|
|
|
### High Priority
|
|
1. **PaymentConfirmationPage** - Bank details are hardcoded
|
|
- Should be added to Settings
|
|
- Should be configurable from admin
|
|
|
|
### Medium Priority
|
|
2. **Header Component** - Hardcoded fallback phone/email
|
|
- Should use empty string or null instead of fake values
|
|
|
|
3. **ContactPage** - Hardcoded fallback text instead of actual values
|
|
- Should show actual phone/email/address or nothing
|
|
|
|
4. **PaymentResultPage** - Hardcoded fallback support contact
|
|
- Should use settings or show nothing
|
|
|
|
### Low Priority
|
|
5. **Auth Components** - Placeholder text in forms (acceptable for UX)
|
|
|
|
---
|
|
|
|
## ✅ What's Working Well
|
|
|
|
1. **Currency System** - Fully centralized via `CurrencyContext`
|
|
- All pages use `useFormatCurrency()` hook
|
|
- Currency stored in localStorage
|
|
- Falls back to 'VND' if not set
|
|
|
|
2. **Footer Component** - Perfect implementation
|
|
- Uses settings without hardcoded fallbacks
|
|
- Shows nothing if settings not available
|
|
|
|
3. **AboutPage** - Perfect implementation
|
|
- Uses settings without hardcoded fallbacks
|
|
|
|
4. **Policy Pages** - Good implementation
|
|
- Only show email link if available
|
|
|
|
---
|
|
|
|
## 🛠️ Recommendations
|
|
|
|
### Immediate Actions
|
|
1. **Add Bank Details to Settings**
|
|
- Add fields: `bank_name`, `bank_account_number`, `bank_account_holder`
|
|
- Update PaymentConfirmationPage to use settings
|
|
- Add admin controls for bank details
|
|
|
|
2. **Remove Hardcoded Fallbacks**
|
|
- Header: Remove `'+1 (234) 567-890'` and `'info@luxuryhotel.com'`
|
|
- ContactPage: Remove fallback text, show actual values or nothing
|
|
- PaymentResultPage: Remove `'support@hotel.com'` and `'1900 xxxx'`
|
|
|
|
### Future Enhancements
|
|
3. **Currency Settings Integration**
|
|
- Consider adding default currency to Company Settings
|
|
- Allow admin to set default currency for the platform
|
|
|
|
4. **Settings Validation**
|
|
- Add validation to ensure critical settings (email, phone) are set
|
|
- Show warnings in admin if settings are missing
|
|
|
|
---
|
|
|
|
## 📝 Notes
|
|
|
|
- Currency is well-implemented via CurrencyContext
|
|
- Most pages correctly use `useCompanySettings()` hook
|
|
- Main issues are hardcoded fallback values that should be removed
|
|
- Bank details need to be added to settings system
|
|
- Placeholder text in form fields is acceptable and doesn't need changes
|
|
|