2024-10-28 17:08:13 +00:00
|
|
|
from pydantic import TypeAdapter
|
|
|
|
|
2024-10-21 14:14:00 +00:00
|
|
|
from core.views.widgets.select import AutoCompleteSelect, AutoCompleteSelectMultiple
|
2024-10-20 18:55:05 +00:00
|
|
|
from counter.models import Counter, Product
|
|
|
|
from counter.schemas import ProductSchema, SimplifiedCounterSchema
|
|
|
|
|
2024-11-18 14:36:05 +00:00
|
|
|
_js = ["bundled/counter/components/ajax-select-index.ts"]
|
2024-10-20 18:55:05 +00:00
|
|
|
|
|
|
|
|
2024-10-21 14:14:00 +00:00
|
|
|
class AutoCompleteSelectCounter(AutoCompleteSelect):
|
2024-10-20 18:55:05 +00:00
|
|
|
component_name = "counter-ajax-select"
|
|
|
|
model = Counter
|
2024-10-28 17:08:13 +00:00
|
|
|
adapter = TypeAdapter(list[SimplifiedCounterSchema])
|
2024-10-21 14:14:00 +00:00
|
|
|
js = _js
|
2024-10-20 18:55:05 +00:00
|
|
|
|
|
|
|
|
2024-10-21 14:14:00 +00:00
|
|
|
class AutoCompleteSelectMultipleCounter(AutoCompleteSelectMultiple):
|
2024-10-20 18:55:05 +00:00
|
|
|
component_name = "counter-ajax-select"
|
|
|
|
model = Counter
|
2024-10-28 17:08:13 +00:00
|
|
|
adapter = TypeAdapter(list[SimplifiedCounterSchema])
|
2024-10-21 14:14:00 +00:00
|
|
|
js = _js
|
2024-10-20 18:55:05 +00:00
|
|
|
|
|
|
|
|
2024-10-21 14:14:00 +00:00
|
|
|
class AutoCompleteSelectProduct(AutoCompleteSelect):
|
2024-10-20 18:55:05 +00:00
|
|
|
component_name = "product-ajax-select"
|
|
|
|
model = Product
|
2024-10-28 17:08:13 +00:00
|
|
|
adapter = TypeAdapter(list[ProductSchema])
|
2024-10-21 14:14:00 +00:00
|
|
|
js = _js
|
2024-10-20 18:55:05 +00:00
|
|
|
|
|
|
|
|
2024-10-21 14:14:00 +00:00
|
|
|
class AutoCompleteSelectMultipleProduct(AutoCompleteSelectMultiple):
|
2024-10-20 18:55:05 +00:00
|
|
|
component_name = "product-ajax-select"
|
|
|
|
model = Product
|
2024-10-28 17:08:13 +00:00
|
|
|
adapter = TypeAdapter(list[ProductSchema])
|
2024-10-21 14:14:00 +00:00
|
|
|
js = _js
|