Moved payment/refund form logic from order_form.html to a dedicated
unified_transaction_form.js module for better code organization.
Changes:
- Created unified_transaction_form.js with initUnifiedTransactionForm() (~233 lines)
- Dual mode: payment and refund switching
- Dynamic form action and field names
- Payment method selection with validation
- Wallet balance limits for account_balance method
- Amount constraints based on mode
- Real-time UI updates and validation
- Updated order_form.html:
- Added unified_transaction_form.js include
- Added initialization call with Django template data
- Removed inline transaction form code (~175 lines)
- Passes URLs and amounts via options
Benefits:
- Cleaner template (175 lines removed)
- Reusable transaction form logic
- Easier to test and maintain
- Configurable via options or data-attributes
- No duplication between payment/refund modes
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>