Extracted customer selection and creation functionality from order_form.html
to a reusable customer_select2.js module for better maintainability.
Changes:
- Created customer_select2.js (~450 lines) with IIFE pattern
- AJAX customer search with Select2 integration
- Smart parsing of email/phone/name from search input
- Modal-based customer creation with validation
- Toast notifications system
- Auto-initialization via data-attributes
- Global function exports for backward compatibility
- Updated order_form.html:
- Added CSRF meta-tag for token access
- Added data-attributes to customer select element
- Included customer_select2.js script
- Removed ~370 lines of inline JavaScript
Benefits:
- Improved code organization and readability
- Reusable across other pages requiring customer selection
- Better browser caching for static JS
- Consistent with existing select2-product-search.js pattern
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>