# Testing Checklist for Retail Order Create Page

## Page Access
- [ ] Navigate to `/admin/retail_orders`
- [ ] Click "Tạo đơn mới" button
- [ ] Page loads at `/admin/retail_orders/create`
- [ ] No encoding errors (Vietnamese displays correctly)

## Visual Appearance
- [ ] Black headers on cards
- [ ] White backgrounds
- [ ] Gray table headers
- [ ] Black buttons (not green)
- [ ] Clean, professional design
- [ ] No gradients or bright colors

## Form Fields
- [ ] Order code displays (auto-generated)
- [ ] Order parser textarea visible
- [ ] "Xác nhận" button works
- [ ] "Hỏa tốc" checkbox toggles
- [ ] Product table displays
- [ ] "Thêm sản phẩm" button works
- [ ] Customer info fields visible
- [ ] Address fields (street, ward, district, city)
- [ ] Sale dropdown populated
- [ ] Notes textarea visible
- [ ] Payment section visible

## Modals - Bootstrap 5 Compatibility

### Customer Selection Modal (`#staticBackdrop`)
- [ ] Click "Chọn KH" button
- [ ] Modal opens correctly
- [ ] Search field visible
- [ ] "Tìm kiếm" button works
- [ ] Customer list displays
- [ ] "Chọn" button on each row
- [ ] Close button (X) works
- [ ] Modal closes when selecting customer
- [ ] Customer data fills form fields

### Create Product Modal (`#modal_create`)
- [ ] Click "Tạo sản phẩm" button
- [ ] Modal opens correctly
- [ ] Product name field visible
- [ ] Category dropdown populated
- [ ] Image upload field visible
- [ ] "Lưu sản phẩm" button works
- [ ] "Đóng" button works
- [ ] Close button (X) works

### Create Customer Modal (`#modalCreateCustomer`)
- [ ] Click "Thêm mới KH" button
- [ ] Modal opens correctly
- [ ] Name field visible
- [ ] Phone field visible
- [ ] Address field visible
- [ ] "Lưu" button works
- [ ] "Đóng" button works
- [ ] Close button (X) works

## JavaScript Functionality

### Product Management
- [ ] Add product row works
- [ ] Product dropdown populates
- [ ] Product selection updates image
- [ ] Product selection updates price
- [ ] Custom price applies if available
- [ ] Quantity input formats numbers
- [ ] Price input formats numbers
- [ ] Remove product button works
- [ ] Total amount calculates correctly
- [ ] Total updates on quantity change
- [ ] Total updates on price change

### Customer Search
- [ ] Search by phone number works
- [ ] Search by name works
- [ ] Results display in table
- [ ] Custom prices load for selected customer
- [ ] Customer selection fills form fields:
  - [ ] Name
  - [ ] Phone
  - [ ] Address
  - [ ] Customer ID (hidden field)

### Image Upload
- [ ] "Thêm ảnh" button adds new file input
- [ ] Multiple images can be added
- [ ] File inputs accept images

### Order Parser (Bulk Input)
- [ ] Paste order text in textarea
- [ ] Click "Xác nhận"
- [ ] Products auto-populate
- [ ] Quantities auto-fill
- [ ] Customer info auto-fills
- [ ] Address auto-fills

## Form Submission
- [ ] Fill all required fields (marked with *)
- [ ] Click "Gửi đơn hàng" button
- [ ] Form submits to `/admin/retail_orders` (POST)
- [ ] Success message displays
- [ ] Redirects to order list
- [ ] Order appears in list
- [ ] Order data saved correctly

## Error Handling
- [ ] Submit without required fields shows validation
- [ ] Invalid phone number shows error
- [ ] Product not found shows warning
- [ ] Network errors handled gracefully

## Browser Compatibility
- [ ] Chrome/Edge (latest)
- [ ] Firefox (latest)
- [ ] Safari (latest)

## Mobile Responsiveness
- [ ] Layout adapts to mobile
- [ ] Modals work on mobile
- [ ] Forms usable on mobile
- [ ] Buttons accessible on mobile

## Performance
- [ ] Page loads quickly
- [ ] Modals open smoothly
- [ ] No console errors
- [ ] No JavaScript errors
- [ ] AJAX requests complete

## Data Validation
- [ ] Required fields enforced
- [ ] Phone format validated
- [ ] Number fields accept only numbers
- [ ] Date/time picker works
- [ ] File upload accepts images only

## Integration
- [ ] Routes work correctly
- [ ] Controller methods execute
- [ ] Database saves data
- [ ] Relationships created (order details, payments)
- [ ] Images stored correctly
- [ ] Custom prices applied

## Known Issues to Check
- [ ] Vietnamese characters display (not garbled)
- [ ] Bootstrap 5 modals open (not Bootstrap 4 syntax)
- [ ] Black/white theme applied (not green)
- [ ] All JavaScript functions work
- [ ] No encoding errors

## Success Criteria
✅ All modals open correctly with Bootstrap 5
✅ Vietnamese text displays properly
✅ Black and white theme applied
✅ All JavaScript preserved and working
✅ Form submits and saves data
✅ No console errors
✅ Professional appearance

---

## Quick Test Commands

```bash
# Check file encoding
file resources/views/admin/retail_orders/create.blade.php

# Check for syntax errors
php artisan view:clear
php artisan view:cache

# Test route
php artisan route:list | grep retail_orders

# Check controller
php artisan tinker
>>> app(App\Http\Controllers\Admin\RetailOrderController::class)->create();
```

## If Issues Found

1. **Modal not opening:**
   - Check browser console for errors
   - Verify Bootstrap 5 JS is loaded
   - Check data-bs-* attributes

2. **Encoding issues:**
   - File should be UTF-8 with BOM
   - Check browser encoding settings

3. **JavaScript errors:**
   - Check jQuery is loaded
   - Check Select2 is loaded
   - Check Toastr is loaded
   - Verify all dependencies

4. **Form not submitting:**
   - Check CSRF token
   - Check route exists
   - Check controller method
   - Check validation rules
