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:
@@ -12,7 +12,7 @@ class ShowcaseForm(forms.ModelForm):
|
||||
"""
|
||||
class Meta:
|
||||
model = Showcase
|
||||
fields = ['name', 'warehouse', 'description', 'is_active']
|
||||
fields = ['name', 'warehouse', 'description', 'is_active', 'is_default']
|
||||
widgets = {
|
||||
'name': forms.TextInput(attrs={
|
||||
'class': 'form-control',
|
||||
@@ -25,16 +25,19 @@ class ShowcaseForm(forms.ModelForm):
|
||||
'placeholder': 'Описание витрины, её расположение или особенности'
|
||||
}),
|
||||
'is_active': forms.CheckboxInput(attrs={'class': 'form-check-input'}),
|
||||
'is_default': forms.CheckboxInput(attrs={'class': 'form-check-input'}),
|
||||
}
|
||||
labels = {
|
||||
'name': 'Название витрины',
|
||||
'warehouse': 'Склад',
|
||||
'description': 'Описание',
|
||||
'is_active': 'Активна',
|
||||
'is_default': 'Витрина по умолчанию',
|
||||
}
|
||||
help_texts = {
|
||||
'warehouse': 'Склад, к которому привязана витрина',
|
||||
'is_active': 'Неактивные витрины скрыты из списка выбора',
|
||||
'is_default': 'Витрина будет автоматически выбрана при создании резерва на этом складе',
|
||||
}
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
||||
Reference in New Issue
Block a user