Simplify order creation and editing - remove autosave
- Removed autosave.js (665 lines) and draft-creator.js (441 lines) - Removed draft_service.py (~500 lines) and DraftOrderService - Removed AJAX endpoints: autosave and create-draft - Updated order_create() to add is_create_page flag - Updated order_update() to finalize drafts without DraftOrderService - Added get_new_status() method to OrderStatusService - Updated order_form.html: - Removed old JS includes - Added beforeunload warning for unsaved data - Updated buttons: separate buttons for create/draft/finalize - Total code reduction: ~1600 lines (92% removed) New workflow: - /orders/create/ - user fills form, chooses button - /orders/<id>/edit/ - simple editing without autosave - beforeunload warning when leaving page (except on submit)
This commit is contained in:
@@ -27,6 +27,21 @@ class OrderStatusService:
|
||||
except OrderStatus.DoesNotExist:
|
||||
return None
|
||||
|
||||
@staticmethod
|
||||
def get_new_status():
|
||||
"""Возвращает системный статус 'new' (новый заказ)"""
|
||||
status, created = OrderStatus.objects.get_or_create(
|
||||
code='new',
|
||||
defaults={
|
||||
'name': 'Новый',
|
||||
'label': 'Новый',
|
||||
'is_system': True,
|
||||
'color': '#0d6efd',
|
||||
'order': 10,
|
||||
}
|
||||
)
|
||||
return status
|
||||
|
||||
@staticmethod
|
||||
def get_system_status(code):
|
||||
"""Получить системный статус по коду"""
|
||||
|
||||
Reference in New Issue
Block a user