## Основные изменения:
### 1. Исправлена логика выбора режима адреса
- Переместил функцию initAddressModeToggle() из jQuery блока в отдельную функцию
- Теперь инициализация адреса работает независимо от jQuery
- Добавлены подробные логи в консоль для отладки ([ADDRESS MODE] префикс)
### 2. Добавлены CSS классы для управления видимостью
- address-history-mode: display: none !important (по умолчанию скрыт)
- address-new-mode: display: none !important (по умолчанию скрыт)
- .visible класс переводит элементы на display: block !important
- Использование classList.add/remove вместо inline styles
### 3. Исправлены стили полей формы (OrderForm)
- Добавлена явная обработка для Select полей - получают form-select
- Поле "Статус" и другие Select теперь имеют правильные стили Bootstrap
- Разделена логика для RadioSelect, Select и остальных полей
### 4. Улучшена отладка
- Добавлены console.log сообщения на каждом этапе инициализации
- Префикс [ADDRESS MODE] помогает отличить логи системы адреса от других
## Технические детали:
- Address сервис использует метод format_address_for_display() для красивого вывода
- AJAX endpoint get_customer_address_history() загружает адреса клиента
- Три режима адреса: history (из истории), new (новый адрес), empty (без адреса)
- Режим empty выбирается по умолчанию
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
PROBLEM ANALYSIS:
- SQL script created orders bypassing Django ORM
- Django signals (post_save) didn't trigger
- No reservations were created automatically
- Found 51 orders with 102 items and 0 reservations
SOLUTION IMPLEMENTED:
1. Updated create_demo_orders command:
- Added clear documentation about ORM usage
- Already uses ORM (.save()) which triggers signals
- Added informative messages about automatic reservations
2. Created fix_missing_reservations command:
- Finds OrderItems without reservations
- Creates missing Reservation records
- Supports --dry-run mode for safety
- Handles missing warehouses gracefully
3. Created SQL fix script:
- Direct SQL approach for existing data
- Creates reservations for all 102 items
- Status: 'reserved'
- Verified: All items now have reservations
4. Added verification scripts:
- check_orders.py: Shows orders/items/reservations count
- run_fix_reservations.py: Executes SQL fix
RESULTS:
- ✓ 102 reservations created for existing orders
- ✓ Future orders will use ORM and create reservations automatically
- ✓ System now works correctly
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Created management command for generating demo orders
- Added SQL script to create 25 orders with random dates (±15 days)
- Added Python runner script for executing SQL
- Demo orders include varied statuses, payment methods, and delivery types
- Orders distributed across different dates for testing date filter
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>