Files
octopus/myproject/orders/static
Andrey Smakotin 5de1ae9bb9 refactor(orders): extract form cleanup to reusable module
Moved empty order items cleanup logic from order_form.html to a dedicated
order_form_cleanup.js module for better code organization.

Changes:
- Created order_form_cleanup.js with initOrderFormCleanup() function (~136 lines)
  - Automatically removes empty order item forms before submit
  - Handles both new and saved forms differently
  - Updates TOTAL_FORMS and reindexes remaining forms
  - Compatible with Django formsets

- Updated order_form.html:
  - Added order_form_cleanup.js include
  - Added initialization call for #order-form
  - Removed inline cleanup code (~111 lines)

Benefits:
- Cleaner template (111 lines removed)
- Reusable across other formset-based forms
- Easier to test and maintain
- Consistent with other extracted modules

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-23 16:10:57 +03:00
..