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

@@ -0,0 +1,22 @@
# Generated by Django 5.0.10 on 2025-11-20 08:08
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('inventory', '0003_showcase_reservation_showcase_and_more'),
]
operations = [
migrations.AddField(
model_name='showcase',
name='is_default',
field=models.BooleanField(default=False, verbose_name='По умолчанию'),
),
migrations.AddIndex(
model_name='showcase',
index=models.Index(fields=['is_default'], name='inventory_s_is_defa_bf9a7c_idx'),
),
]