Add default showcase selection per warehouse

- Add is_default field to Showcase model with unique constraint per warehouse
- Implement Showcase.save() to ensure only one default per warehouse
- Add SetDefaultShowcaseView for AJAX-based default selection
- Update ShowcaseForm to include is_default checkbox
- Add interactive checkbox UI in showcase list with AJAX functionality
- Update POS API to return showcase.is_default instead of warehouse.is_default
- Update terminal.js to auto-select showcase based on its is_default flag
- Add migration for is_default field

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-20 11:40:08 +03:00
parent 766ca3c87c
commit dd184265ee
9 changed files with 253 additions and 15 deletions

View File

@@ -27,7 +27,7 @@ from .views import (
StockMovementListView,
)
# Showcase views
from .views.showcase import ShowcaseListView, ShowcaseCreateView, ShowcaseUpdateView, ShowcaseDeleteView
from .views.showcase import ShowcaseListView, ShowcaseCreateView, ShowcaseUpdateView, ShowcaseDeleteView, SetDefaultShowcaseView
from . import views
app_name = 'inventory'
@@ -103,4 +103,5 @@ urlpatterns = [
path('showcases/create/', ShowcaseCreateView.as_view(), name='showcase-create'),
path('showcases/<int:pk>/edit/', ShowcaseUpdateView.as_view(), name='showcase-update'),
path('showcases/<int:pk>/delete/', ShowcaseDeleteView.as_view(), name='showcase-delete'),
path('showcases/<int:pk>/set-default/', SetDefaultShowcaseView.as_view(), name='showcase-set-default'),
]