feat(UI): Stock Items page added with getting, filtering, and saving data.
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -21,7 +21,7 @@ import lib.argument_validation as av
|
||||
from forms.forms import Form_Is_Included_VAT, Form_Delivery_Region, Form_Currency
|
||||
from datastores.datastore_base import DataStore_Base
|
||||
from datastores.datastore_user import DataStore_User
|
||||
from business_objects.store.store_base import Store_Base
|
||||
from business_objects.base import Base
|
||||
from business_objects.store.product_category import Product_Category
|
||||
from forms.access_level import Filters_Access_Level
|
||||
from forms.unit_measurement import Filters_Unit_Measurement
|
||||
@@ -37,20 +37,25 @@ from typing import ClassVar
|
||||
class Model_View_Base(BaseModel, ABC):
|
||||
# Global constants
|
||||
# ATTR_FOR: ClassVar[str] = 'for'
|
||||
ATTR_ID_ACCESS_LEVEL: ClassVar[str] = Store_Base.ATTR_ID_ACCESS_LEVEL
|
||||
ATTR_ID_ACCESS_LEVEL: ClassVar[str] = Base.ATTR_ID_ACCESS_LEVEL
|
||||
ATTR_ID_ADDRESS: ClassVar[str] = Base.ATTR_ID_ADDRESS
|
||||
ATTR_ID_CURRENCY: ClassVar[str] = Base.ATTR_ID_CURRENCY
|
||||
ATTR_ID_REGION: ClassVar[str] = Base.ATTR_ID_REGION
|
||||
ATTR_TEXT_COLLAPSED: ClassVar[str] = 'textCollapsed'
|
||||
ATTR_TEXT_EXPANDED: ClassVar[str] = 'textExpanded'
|
||||
ATTR_VALUE_CURRENT: ClassVar[str] = 'current-value'
|
||||
ATTR_VALUE_PREVIOUS: ClassVar[str] = 'previous-value'
|
||||
FLAG_ACCESS_LEVEL: ClassVar[str] = 'access_level'
|
||||
FLAG_ACCESS_LEVEL_REQUIRED: ClassVar[str] = Product_Category.FLAG_ACCESS_LEVEL_REQUIRED
|
||||
FLAG_ACTIVE: ClassVar[str] = Store_Base.FLAG_ACTIVE
|
||||
FLAG_ACTIVE: ClassVar[str] = Base.FLAG_ACTIVE
|
||||
FLAG_ADD: ClassVar[str] = 'add'
|
||||
FLAG_BOOL_FALSE: ClassVar[str] = 'false'
|
||||
FLAG_BOOL_TRUE: ClassVar[str] = 'true'
|
||||
FLAG_CANCEL: ClassVar[str] = 'button-cancel'
|
||||
# FLAG_CONTACT_US: ClassVar[str] = 'button-contact'
|
||||
FLAG_CLOSE_TEMPORARY_ELEMENT: ClassVar[str] = 'button-temporary-element-close'
|
||||
FLAG_CARD: ClassVar[str] = 'card'
|
||||
FLAG_CODE: ClassVar[str] = Store_Base.FLAG_CODE
|
||||
FLAG_CODE: ClassVar[str] = Base.FLAG_CODE
|
||||
FLAG_COLLAPSED: ClassVar[str] = 'collapsed'
|
||||
FLAG_COLLAPSIBLE: ClassVar[str] = 'collapsible'
|
||||
FLAG_COLUMN: ClassVar[str] = 'column'
|
||||
@@ -59,11 +64,11 @@ class Model_View_Base(BaseModel, ABC):
|
||||
FLAG_CONTAINER_INPUT: ClassVar[str] = FLAG_CONTAINER + '-input'
|
||||
FLAG_CURRENCY: ClassVar[str] = 'currency'
|
||||
FLAG_DELETE: ClassVar[str] = 'delete'
|
||||
FLAG_DESCRIPTION: ClassVar[str] = Store_Base.FLAG_DESCRIPTION
|
||||
FLAG_DESCRIPTION: ClassVar[str] = Base.FLAG_DESCRIPTION
|
||||
FLAG_DETAIL: ClassVar[str] = 'detail'
|
||||
FLAG_DIALOG: ClassVar[str] = 'dialog' # try <dialog> element
|
||||
FLAG_DIRTY: ClassVar[str] = 'dirty'
|
||||
FLAG_DISPLAY_ORDER: ClassVar[str] = Store_Base.FLAG_DISPLAY_ORDER
|
||||
FLAG_DISPLAY_ORDER: ClassVar[str] = Base.FLAG_DISPLAY_ORDER
|
||||
FLAG_ERROR: ClassVar[str] = 'error'
|
||||
FLAG_EXPANDED: ClassVar[str] = 'expanded'
|
||||
FLAG_FAILURE: ClassVar[str] = 'failure'
|
||||
@@ -75,9 +80,9 @@ class Model_View_Base(BaseModel, ABC):
|
||||
# FLAG_KEY_PRIMARY: ClassVar[str] = Store_Base.FLAG_KEY_PRIMARY
|
||||
FLAG_MESSAGE: ClassVar[str] = 'Message'
|
||||
FLAG_MODAL: ClassVar[str] = 'modal'
|
||||
FLAG_NAME: ClassVar[str] = Store_Base.FLAG_NAME
|
||||
FLAG_NAME_ATTR_OPTION_TEXT: ClassVar[str] = Store_Base.FLAG_NAME_ATTR_OPTION_TEXT
|
||||
FLAG_NAME_ATTR_OPTION_VALUE: ClassVar[str] = Store_Base.FLAG_NAME_ATTR_OPTION_VALUE
|
||||
FLAG_NAME: ClassVar[str] = Base.FLAG_NAME
|
||||
FLAG_NAME_ATTR_OPTION_TEXT: ClassVar[str] = Base.FLAG_NAME_ATTR_OPTION_TEXT
|
||||
FLAG_NAME_ATTR_OPTION_VALUE: ClassVar[str] = Base.FLAG_NAME_ATTR_OPTION_VALUE
|
||||
FLAG_NAV_ADMIN_HOME: ClassVar[str] = 'navAdminHome'
|
||||
FLAG_NAV_ADMIN_STORE_STRIPE_PRICES: ClassVar[str] = 'navAdminStoreStripePrices'
|
||||
FLAG_NAV_ADMIN_STORE_STRIPE_PRODUCTS: ClassVar[str] = 'navAdminStoreStripeProducts'
|
||||
@@ -96,11 +101,10 @@ class Model_View_Base(BaseModel, ABC):
|
||||
FLAG_NAV_USER_LOGIN: ClassVar[str] = 'navUserLogin'
|
||||
FLAG_NAV_USER_LOGOUT: ClassVar[str] = 'navUserLogout'
|
||||
FLAG_OVERLAY: ClassVar[str] = 'overlay'
|
||||
FLAG_TEMPORARY_ELEMENT: ClassVar[str] = 'temporary-element'
|
||||
FLAG_PAGE_BODY: ClassVar[str] = 'page-body'
|
||||
FLAG_ROW: ClassVar[str] = 'row'
|
||||
FLAG_ROW_NEW: ClassVar[str] = 'row-new'
|
||||
FLAG_ROWS: ClassVar[str] = Store_Base.FLAG_ROWS
|
||||
FLAG_ROWS: ClassVar[str] = Base.FLAG_ROWS
|
||||
FLAG_SAVE: ClassVar[str] = 'save'
|
||||
FLAG_SCROLLABLE: ClassVar[str] = 'scrollable'
|
||||
FLAG_SLIDER: ClassVar[str] = 'slider'
|
||||
@@ -108,6 +112,7 @@ class Model_View_Base(BaseModel, ABC):
|
||||
FLAG_SUBMIT: ClassVar[str] = 'submit'
|
||||
FLAG_SUBMITTED: ClassVar[str] = 'submitted'
|
||||
FLAG_SUCCESS: ClassVar[str] = 'success'
|
||||
FLAG_TEMPORARY_ELEMENT: ClassVar[str] = 'temporary-element'
|
||||
# flagIsDatePicker: ClassVar[str] = 'is-date-picker'
|
||||
HASH_APPLY_FILTERS_STORE_PRODUCT_PERMUTATION: ClassVar[str] = '/store/permutation_filter'
|
||||
HASH_CALLBACK_LOGIN: ClassVar[str] = '/callback-login'
|
||||
@@ -130,7 +135,7 @@ class Model_View_Base(BaseModel, ABC):
|
||||
HASH_PAGE_STORE_PRODUCT_PRICES: ClassVar[str] = '/store/prices'
|
||||
HASH_PAGE_STORE_PRODUCT_VARIATIONS: ClassVar[str] = '/store/variations'
|
||||
HASH_PAGE_STORE_STOCK_ITEMS: ClassVar[str] = '/store/stock_items'
|
||||
HASH_PAGE_STORE_SUPPLIER: ClassVar[str] = '/store/supplier'
|
||||
HASH_PAGE_STORE_SUPPLIERS: ClassVar[str] = '/store/suppliers'
|
||||
HASH_PAGE_USER_ACCOUNT: ClassVar[str] = '/user'
|
||||
HASH_PAGE_USER_ADMIN: ClassVar[str] = '/user/admin'
|
||||
HASH_PAGE_USER_LOGIN: ClassVar[str] = '/login'
|
||||
@@ -148,9 +153,9 @@ class Model_View_Base(BaseModel, ABC):
|
||||
ID_FORM_FILTERS: ClassVar[str] = 'formFilters'
|
||||
ID_FORM_IS_INCLUDED_VAT: ClassVar[str] = 'formIsIncludedVAT'
|
||||
ID_LABEL_ERROR: ClassVar[str] = 'labelError'
|
||||
"""
|
||||
ID_MODAL_SERVICES: ClassVar[str] = 'modalServices'
|
||||
ID_MODAL_TECHNOLOGIES: ClassVar[str] = 'modalTechnologies'
|
||||
"""
|
||||
ID_BUTTON_NAV_ADMIN_HOME: ClassVar[str] = 'navAdminHome'
|
||||
ID_BUTTON_NAV_ADMIN_STORE_STRIPE_PRICE: ClassVar[str] = 'navAdminStoreStripePrice'
|
||||
ID_BUTTON_NAV_ADMIN_STORE_STRIPE_PRODUCT: ClassVar[str] = 'navAdminStoreStripeProduct'
|
||||
@@ -179,8 +184,6 @@ class Model_View_Base(BaseModel, ABC):
|
||||
# KEY_CSRF_TOKEN: ClassVar[str] = 'X-CSRFToken'
|
||||
KEY_DATA: ClassVar[str] = 'data'
|
||||
KEY_FORM: ClassVar[str] = 'form'
|
||||
KEY_FORM_FILTERS: ClassVar[str] = KEY_FORM + 'Filters'
|
||||
KEY_USER: ClassVar[str] = User.KEY_USER
|
||||
NAME_COMPANY: ClassVar[str] = 'Precision And Research Technology Systems Limited'
|
||||
NAME_CSRF_TOKEN: ClassVar[str] = 'csrf-token'
|
||||
# URL_HOST: ClassVar[str] = os.env() 'http://127.0.0.1:5000' # 'https://www.partsltd.co.uk'
|
||||
@@ -311,7 +314,7 @@ class Model_View_Base(BaseModel, ABC):
|
||||
return [obj.to_json() for obj in list_objects]
|
||||
@staticmethod
|
||||
def convert_list_objects_to_list_options(list_objects):
|
||||
return Store_Base.convert_list_objects_to_list_options(list_objects)
|
||||
return Base.convert_list_objects_to_list_options(list_objects)
|
||||
@staticmethod
|
||||
def convert_list_objects_to_dict_by_attribute_key(list_objects, key):
|
||||
return {getattr(obj, key): obj for obj in list_objects}
|
||||
@@ -340,4 +343,14 @@ class Model_View_Base(BaseModel, ABC):
|
||||
if str_multiline != '':
|
||||
str_multiline += '\n'
|
||||
str_multiline += str
|
||||
return str_multiline
|
||||
return str_multiline
|
||||
@staticmethod
|
||||
def format_date(date):
|
||||
if date is None:
|
||||
return ''
|
||||
return date.strftime('%Y-%m-%d')
|
||||
@staticmethod
|
||||
def format_datetime(date_time):
|
||||
if date_time is None:
|
||||
return ''
|
||||
return date_time.strftime('%Y-%m-%dT%H:%M')
|
||||
@@ -24,6 +24,7 @@ from business_objects.store.image import Resolution_Level_Enum
|
||||
from business_objects.store.basket import Basket_Item, Basket
|
||||
from business_objects.store.product_category import Product_Category
|
||||
from business_objects.store.product_variation import Product_Variation_Filters, Product_Variation
|
||||
from business_objects.store.stock_item import Stock_Item
|
||||
from datastores.datastore_store_base import DataStore_Store_Base
|
||||
from datastores.datastore_user import DataStore_User
|
||||
from datastores.datastore_store_basket import DataStore_Store_Basket
|
||||
@@ -41,52 +42,63 @@ from abc import abstractmethod
|
||||
class Model_View_Store(Model_View_Base):
|
||||
# Global constants
|
||||
ATTR_FORM_TYPE: ClassVar[str] = 'form-type'
|
||||
ATTR_ID_DELIVERY_OPTION: ClassVar[str] = Store_Base.ATTR_ID_DELIVERY_OPTION
|
||||
ATTR_ID_DISCOUNT: ClassVar[str] = Store_Base.ATTR_ID_DISCOUNT
|
||||
ATTR_ID_PLANT: ClassVar[str] = 'id-plant'
|
||||
ATTR_ID_PRODUCT : ClassVar[str] = Product.ATTR_ID_PRODUCT # 'id-product'
|
||||
ATTR_ID_PRODUCT_CATEGORY: ClassVar[str] = Product.ATTR_ID_PRODUCT_CATEGORY
|
||||
ATTR_ID_PRODUCT_PERMUTATION : ClassVar[str] = Product.ATTR_ID_PRODUCT_PERMUTATION # 'id-permutation'
|
||||
ATTR_ID_PRODUCT_PRICE: ClassVar[str] = Product.ATTR_ID_PRODUCT_PRICE
|
||||
ATTR_ID_PRODUCT_VARIATION : ClassVar[str] = Product_Variation.ATTR_ID_PRODUCT_VARIATION # 'id-variation'
|
||||
ATTR_ID_PRODUCT_VARIATION_TYPE : ClassVar[str] = Product_Variation.ATTR_ID_PRODUCT_VARIATION_TYPE # 'id-variation-type'
|
||||
ATTR_ID_STOCK_ITEM: ClassVar[str] = Store_Base.ATTR_ID_STOCK_ITEM
|
||||
ATTR_ID_STORAGE_LOCATION: ClassVar[str] = Store_Base.ATTR_ID_STORAGE_LOCATION
|
||||
FLAG_BUTTON_BASKET_ADD : ClassVar[str] = Model_View_Base.FLAG_SUBMIT + '.buttonAddToBasket'
|
||||
FLAG_BUTTON_BUY_NOW : ClassVar[str] = 'buttonBuyNow'
|
||||
FLAG_COST_LOCAL: ClassVar[str] = Product_Permutation.FLAG_COST_LOCAL
|
||||
# FLAG_COST_LOCAL_VAT_INCL: ClassVar[str] = 'cost-local-VAT-incl'
|
||||
FLAG_COST_LOCAL: ClassVar[str] = Store_Base.FLAG_COST_LOCAL
|
||||
FLAG_COST_LOCAL_VAT_EXCL: ClassVar[str] = Store_Base.FLAG_COST_LOCAL_VAT_EXCL
|
||||
FLAG_COST_LOCAL_VAT_INCL: ClassVar[str] = Store_Base.FLAG_COST_LOCAL_VAT_INCL
|
||||
FLAG_COUNT_UNIT_MEASUREMENT_INTERVAL_EXPIRATION_UNSEALED: ClassVar[str] = Product_Permutation.FLAG_COUNT_UNIT_MEASUREMENT_INTERVAL_EXPIRATION_UNSEALED
|
||||
FLAG_COUNT_UNIT_MEASUREMENT_INTERVAL_RECURRENCE: ClassVar[str] = Product_Permutation.FLAG_COUNT_UNIT_MEASUREMENT_INTERVAL_RECURRENCE
|
||||
FLAG_COUNT_UNIT_MEASUREMENT_PER_QUANTITY_STEP: ClassVar[str] = Product_Permutation.FLAG_COUNT_UNIT_MEASUREMENT_PER_QUANTITY_STEP
|
||||
FLAG_CURRENCY_COST: ClassVar[str] = Product_Permutation.FLAG_CURRENCY_COST
|
||||
FLAG_DATE_CONSUMED: ClassVar[str] = 'date-consumed'
|
||||
FLAG_DATE_EXPIRATION: ClassVar[str] = 'date-expiration'
|
||||
FLAG_DATE_PURCHASED: ClassVar[str] = 'date-purchased'
|
||||
FLAG_DATE_RECEIVED: ClassVar[str] = 'date-received'
|
||||
FLAG_DATE_UNSEALED: ClassVar[str] = 'date-unsealed'
|
||||
FLAG_DATE_CONSUMED: ClassVar[str] = Stock_Item.FLAG_DATE_CONSUMED
|
||||
FLAG_DATE_EXPIRATION: ClassVar[str] = Stock_Item.FLAG_DATE_EXPIRATION
|
||||
FLAG_DATE_PURCHASED: ClassVar[str] = Stock_Item.FLAG_DATE_PURCHASED
|
||||
FLAG_DATE_RECEIVED: ClassVar[str] = Stock_Item.FLAG_DATE_RECEIVED
|
||||
FLAG_DATE_UNSEALED: ClassVar[str] = Stock_Item.FLAG_DATE_UNSEALED
|
||||
FLAG_DISCOUNT: ClassVar[str] = Store_Base.FLAG_DISCOUNT
|
||||
FLAG_DOES_EXPIRE_FASTER_ONCE_UNSEALED: ClassVar[str] = Product_Permutation.FLAG_DOES_EXPIRE_FASTER_ONCE_UNSEALED
|
||||
FLAG_HAS_VARIATIONS: ClassVar[str] = Product_Permutation.FLAG_HAS_VARIATIONS
|
||||
FLAG_ID_STRIPE_PRODUCT: ClassVar[str] = Product_Permutation.FLAG_ID_STRIPE_PRODUCT
|
||||
FLAG_IS_CONSUMED: ClassVar[str] = Stock_Item.FLAG_IS_CONSUMED
|
||||
FLAG_IS_NOT_EMPTY: ClassVar[str] = Store_Base.FLAG_IS_NOT_EMPTY
|
||||
FLAG_IS_OUT_OF_STOCK: ClassVar[str] = 'is-out-of-stock'
|
||||
FLAG_IS_OUT_OF_STOCK: ClassVar[str] = Store_Base.FLAG_IS_OUT_OF_STOCK
|
||||
FLAG_IS_SEALED: ClassVar[str] = Stock_Item.FLAG_IS_SEALED
|
||||
FLAG_IS_SUBSCRIPTION: ClassVar[str] = Product_Permutation.FLAG_IS_SUBSCRIPTION
|
||||
FLAG_LATENCY_MANUFACTURE_DAYS: ClassVar[str] = Product_Permutation.FLAG_LATENCY_MANUFACTURE_DAYS
|
||||
FLAG_LOCATION_STORAGE: ClassVar[str] = 'storage-location'
|
||||
FLAG_NAME_PLURAL_UNIT_MEASUREMENT_INTERVAL_EXPIRATION_UNSEALED: ClassVar[str] = Product_Permutation.FLAG_NAME_PLURAL_UNIT_MEASUREMENT_INTERVAL_EXPIRATION_UNSEALED
|
||||
FLAG_NAME_PLURAL_UNIT_MEASUREMENT_INTERVAL_RECURRENCE: ClassVar[str] = Product_Permutation.FLAG_NAME_PLURAL_UNIT_MEASUREMENT_INTERVAL_RECURRENCE
|
||||
FLAG_NAME_PLURAL_UNIT_MEASUREMENT_QUANTITY: ClassVar[str] = Product_Permutation.FLAG_NAME_PLURAL_UNIT_MEASUREMENT_QUANTITY
|
||||
FLAG_NAME_SINGULAR_UNIT_MEASUREMENT_INTERVAL_EXPIRATION_UNSEALED: ClassVar[str] = Product_Permutation.FLAG_NAME_SINGULAR_UNIT_MEASUREMENT_INTERVAL_EXPIRATION_UNSEALED
|
||||
FLAG_NAME_SINGULAR_UNIT_MEASUREMENT_INTERVAL_RECURRENCE: ClassVar[str] = Product_Permutation.FLAG_NAME_SINGULAR_UNIT_MEASUREMENT_INTERVAL_RECURRENCE
|
||||
FLAG_NAME_SINGULAR_UNIT_MEASUREMENT_QUANTITY: ClassVar[str] = Product_Permutation.FLAG_NAME_SINGULAR_UNIT_MEASUREMENT_QUANTITY
|
||||
FLAG_PLANT: ClassVar[str] = Store_Base.FLAG_PLANT
|
||||
FLAG_PRODUCT: ClassVar[str] = Store_Base.FLAG_PRODUCT
|
||||
FLAG_PRODUCT_CATEGORY: ClassVar[str] = Store_Base.FLAG_PRODUCT_CATEGORY
|
||||
FLAG_PRODUCT_PERMUTATION: ClassVar[str] = Store_Base.FLAG_PRODUCT_PERMUTATION
|
||||
FLAG_PRODUCT_PRICE: ClassVar[str] = Store_Base.FLAG_PRODUCT_PRICE
|
||||
FLAG_PRODUCT_VARIATION: ClassVar[str] = Store_Base.FLAG_PRODUCT_VARIATION
|
||||
FLAG_PRODUCT_VARIATIONS: ClassVar[str] = Store_Base.FLAG_PRODUCT_VARIATIONS
|
||||
FLAG_PRODUCT_VARIATION_TYPE: ClassVar[str] = Store_Base.FLAG_PRODUCT_VARIATION_TYPE
|
||||
FLAG_PROFIT_LOCAL_MIN: ClassVar[str] = Product_Permutation.FLAG_PROFIT_LOCAL_MIN
|
||||
FLAG_QUANTITY: ClassVar[str] = 'quantity'
|
||||
FLAG_QUANTITY_MAX: ClassVar[str] = Product_Permutation.FLAG_QUANTITY_MAX # 'quantity-max'
|
||||
FLAG_QUANTITY_MIN: ClassVar[str] = Product_Permutation.FLAG_QUANTITY_MIN # 'quantity-min'
|
||||
FLAG_QUANTITY_STOCK: ClassVar[str] = Product_Permutation.FLAG_QUANTITY_STOCK # 'quantity-stock'
|
||||
FLAG_PLANT_STORAGE: ClassVar[str] = 'plant-storage'
|
||||
FLAG_PRODUCT_CATEGORY: ClassVar[str] = 'category'
|
||||
FLAG_PROFIT_LOCAL_MIN: ClassVar[str] = Product_Permutation.FLAG_PROFIT_LOCAL_MIN
|
||||
FLAG_REGION_STORAGE: ClassVar[str] = 'region-storage'
|
||||
FLAG_REGION: ClassVar[str] = Store_Base.FLAG_REGION
|
||||
FLAG_STOCK_ITEM: ClassVar[str] = Store_Base.FLAG_STOCK_ITEM
|
||||
FLAG_STORAGE_LOCATION: ClassVar[str] = Store_Base.FLAG_STORAGE_LOCATION
|
||||
FLAG_SYMBOL_CURRENCY_COST: ClassVar[str] = Product_Permutation.FLAG_SYMBOL_CURRENCY_COST
|
||||
FLAG_SYMBOL_IS_SUFFIX_NOT_PREFIX_UNIT_MEASUREMENT_INTERVAL_EXPIRATION_UNSEALED: ClassVar[str] = Product_Permutation.FLAG_SYMBOL_IS_SUFFIX_NOT_PREFIX_UNIT_MEASUREMENT_INTERVAL_EXPIRATION_UNSEALED
|
||||
FLAG_SYMBOL_IS_SUFFIX_NOT_PREFIX_UNIT_MEASUREMENT_INTERVAL_RECURRENCE: ClassVar[str] = Product_Permutation.FLAG_SYMBOL_IS_SUFFIX_NOT_PREFIX_UNIT_MEASUREMENT_INTERVAL_RECURRENCE
|
||||
@@ -97,33 +109,32 @@ class Model_View_Store(Model_View_Base):
|
||||
FLAG_UNIT_MEASUREMENT_INTERVAL_EXPIRATION_UNSEALED: ClassVar[str] = Product_Permutation.FLAG_UNIT_MEASUREMENT_INTERVAL_EXPIRATION_UNSEALED
|
||||
FLAG_UNIT_MEASUREMENT_INTERVAL_RECURRENCE: ClassVar[str] = Product_Permutation.FLAG_UNIT_MEASUREMENT_INTERVAL_RECURRENCE
|
||||
FLAG_UNIT_MEASUREMENT_QUANTITY: ClassVar[str] = Product_Permutation.FLAG_UNIT_MEASUREMENT_QUANTITY
|
||||
HASH_PAGE_STORE_BASKET : ClassVar[str] = '/store/basket'
|
||||
HASH_STORE_BASKET_ADD : ClassVar[str] = '/store/basket_add'
|
||||
HASH_STORE_BASKET_DELETE : ClassVar[str] = '/store/basket_delete'
|
||||
HASH_STORE_BASKET_EDIT : ClassVar[str] = '/store/basket_edit'
|
||||
HASH_STORE_BASKET_LOAD : ClassVar[str] = '/store/basket_load'
|
||||
HASH_GET_STORE_PRODUCT: ClassVar[str] = '/store/product_get'
|
||||
HASH_GET_STORE_PRODUCT_CATEGORY: ClassVar[str] = '/store/category_get'
|
||||
HASH_GET_STORE_PRODUCT_PERMUTATION: ClassVar[str] = '/store/permutation_get'
|
||||
HASH_GET_STORE_STOCK_ITEM: ClassVar[str] = '/store/stock_item_get'
|
||||
HASH_PAGE_STORE_BASKET : ClassVar[str] = '/store/basket'
|
||||
HASH_SAVE_STORE_PRODUCT: ClassVar[str] = '/store/save_product'
|
||||
HASH_SAVE_STORE_PRODUCT_CATEGORY: ClassVar[str] = '/store/save_category'
|
||||
HASH_SAVE_STORE_PRODUCT_PERMUTATION: ClassVar[str] = '/store/save_permutation'
|
||||
HASH_SAVE_STORE_STOCK_ITEM: ClassVar[str] = '/store/save_stock_item'
|
||||
HASH_STORE_BASKET_ADD : ClassVar[str] = '/store/basket_add'
|
||||
HASH_STORE_BASKET_DELETE : ClassVar[str] = '/store/basket_delete'
|
||||
HASH_STORE_BASKET_EDIT : ClassVar[str] = '/store/basket_edit'
|
||||
HASH_STORE_BASKET_LOAD : ClassVar[str] = '/store/basket_load'
|
||||
HASH_STORE_SET_CURRENCY : ClassVar[str] = '/store/set_currency'
|
||||
HASH_STORE_SET_DELIVERY_REGION : ClassVar[str] = '/store/set_delivery_region'
|
||||
HASH_STORE_SET_IS_INCLUDED_VAT : ClassVar[str] = '/store/set_is_included_VAT'
|
||||
ID_BASKET : ClassVar[str] = 'basket'
|
||||
ID_BASKET_CONTAINER : ClassVar[str] = 'basketContainer'
|
||||
ID_BASKET_TOTAL : ClassVar[str] = 'basketTotal'
|
||||
ID_BUTTON_CHECKOUT : ClassVar[str] = 'buttonCheckout'
|
||||
ID_BUTTON_BASKET_ADD : ClassVar[str] = 'buttonBasketAdd'
|
||||
ID_BUTTON_BUY_NOW : ClassVar[str] = 'buttonBuyNow'
|
||||
ID_PRODUCT_CATEGORY_DEFAULT: ClassVar[str] = 1
|
||||
ID_BUTTON_CHECKOUT : ClassVar[str] = 'buttonCheckout'
|
||||
ID_CURRENCY : ClassVar[str] = Form_Currency.id_id_currency # 'id_currency'
|
||||
ID_CURRENCY_DEFAULT : ClassVar[str] = 1
|
||||
ID_LABEL_BASKET_EMPTY : ClassVar[str] = 'basketEmpty'
|
||||
ID_REGION_DELIVERY : ClassVar[str] = Form_Delivery_Region.id_id_region_delivery # 'id_region_delivery'
|
||||
ID_PRODUCT_CATEGORY_DEFAULT: ClassVar[str] = 1
|
||||
ID_REGION_DELIVERY_DEFAULT : ClassVar[str] = 1
|
||||
IS_INCLUDED_VAT_DEFAULT : ClassVar[str] = True
|
||||
"""
|
||||
|
||||
@@ -75,7 +75,7 @@ class Model_View_Store_Product(Model_View_Store):
|
||||
filters_product: Parameters_Product = None
|
||||
form_filters: Filters_Product
|
||||
list_options_product: list = None
|
||||
product_blank: Product = None
|
||||
# product_blank: Product = None
|
||||
units_measurement: list = None
|
||||
units_measurement_time: list = None
|
||||
# variation_container: Product_Variation_Container = None
|
||||
|
||||
@@ -42,7 +42,6 @@ class Model_View_Store_Product_Permutation(Model_View_Store):
|
||||
filters_product: Parameters_Product = None
|
||||
form_filters: Filters_Product_Permutation
|
||||
list_options_product: list = None
|
||||
permutation_blank: Product_Permutation = None
|
||||
units_measurement: list = None
|
||||
units_measurement_time: list = None
|
||||
# variation_container: Product_Variation_Container = None
|
||||
@@ -79,12 +78,11 @@ class Model_View_Store_Product_Permutation(Model_View_Store):
|
||||
)
|
||||
)
|
||||
print(f'category filters: {self.category_list_filters.categories}')
|
||||
self.form_filters.id_category.choices = [('0', 'All')] + [(str(category.id_category), category.name) for category in self.category_list_filters.categories]
|
||||
self.form_filters.id_category.choices += [(str(category.id_category), category.name) for category in self.category_list_filters.categories]
|
||||
print(f'category options: {self.form_filters.id_category.choices}')
|
||||
self.list_options_product = self.category_list_filters.to_product_option_list()
|
||||
print(f'product options: {self.list_options_product}')
|
||||
self.form_filters.id_product.choices = [('0', 'All')] + [(str(product['value']), product['text']) for product in self.list_options_product]
|
||||
self.permutation_blank = Product_Permutation()
|
||||
self.form_filters.id_product.choices += [(str(product['value']), product['text']) for product in self.list_options_product]
|
||||
self.variation_types, self.variations, errors = self.get_many_product_variation()
|
||||
self.units_measurement = self.get_many_unit_measurement()
|
||||
self.units_measurement_time = [unit_measurement for unit_measurement in self.units_measurement if unit_measurement.is_unit_of_time]
|
||||
|
||||
@@ -16,7 +16,7 @@ from datastores.datastore_store_stock_item import DataStore_Store_Stock_Item
|
||||
from business_objects.store.product_category import Product_Category_Container
|
||||
# from routes import bp_home
|
||||
from business_objects.store.product import Product, Parameters_Product, Product_Permutation
|
||||
from business_objects.store.stock_item import Stock_Item
|
||||
from business_objects.store.stock_item import Stock_Item, Parameters_Stock_Item
|
||||
from forms.store.stock_item import Filters_Stock_Item
|
||||
import lib.argument_validation as av
|
||||
|
||||
@@ -35,10 +35,17 @@ class Model_View_Store_Stock_Item(Model_View_Store):
|
||||
"""
|
||||
KEY_PERMUTATIONS: ClassVar[str] = 'permutations'
|
||||
|
||||
category_list: Product_Category_Container = None # (str)
|
||||
category_list: Product_Category_Container = None
|
||||
category_list_filters: Product_Category_Container = None
|
||||
currencies: list = None
|
||||
currency_options: list = None
|
||||
filters_stock_item: Filters_Stock_Item
|
||||
form_filters: Filters_Stock_Item = None
|
||||
permutation_blank: Product_Permutation = None
|
||||
list_options_product: list = None
|
||||
units_measurement: list = None
|
||||
units_measurement_time: list = None
|
||||
variations: list = None
|
||||
variation_types: list = None
|
||||
|
||||
@property
|
||||
def title(self):
|
||||
@@ -49,13 +56,11 @@ class Model_View_Store_Stock_Item(Model_View_Store):
|
||||
print(f'{_m}\nstarting...')
|
||||
super().__init__(hash_page_current=hash_page_current, filters_stock_item=filters_stock_item)
|
||||
# BaseModel.__init__(self, app=app, filters_stock_item=filters_stock_item, **kwargs)
|
||||
self.form_filters = Filters_Stock_Item()
|
||||
self.form_filters = Filters_Stock_Item.from_json(filters_stock_item.to_json()) # .from_form_stock_item(filters_stock_item)
|
||||
datastore_store = DataStore_Store_Stock_Item()
|
||||
tmp_category_list_stock_item, errors = datastore_store.get_many_product(Parameters_Product.from_filters_stock_item(filters_stock_item))
|
||||
self.category_list, errors = datastore_store.get_many_stock_item(filters_stock_item, tmp_category_list_stock_item)
|
||||
category_list_filters, errors_filters = datastore_store.get_many_stock_item(
|
||||
Filters_Stock_Item()
|
||||
)
|
||||
self.category_list, errors = datastore_store.get_many_stock_item(Parameters_Stock_Item.from_form_stock_item(filters_stock_item), tmp_category_list_stock_item)
|
||||
self.category_list_filters, errors_filters = datastore_store.get_many_product(Parameters_Product.get_default())
|
||||
"""
|
||||
Parameters_Stock_Item(
|
||||
# self.info_user['sub'],
|
||||
@@ -73,15 +78,26 @@ class Model_View_Store_Stock_Item(Model_View_Store):
|
||||
)
|
||||
"""
|
||||
|
||||
print(f'category_list_filters: {category_list_filters.categories}')
|
||||
self.form_filters.id_category.choices = [('0', 'All')] + [(str(category.id_category), category.name) for category in category_list_filters.categories]
|
||||
print(f'category options: {self.form_filters.id_category.choices}')
|
||||
product_list = category_list_filters.to_product_option_list()
|
||||
print(f'product_list: {product_list}')
|
||||
self.form_filters.id_product.choices = [('0', 'All')] + [(str(product['value']), product['text']) for product in product_list]
|
||||
self.permutation_blank = Product_Permutation()
|
||||
print(f'category_list_filters: {self.category_list_filters.categories}')
|
||||
self.form_filters.id_category.choices += [(str(category.id_category), category.name) for category in self.category_list_filters.categories] # [Filters_Stock_Item.get_choice_all()] +
|
||||
print(f'category options: {self.form_filters.id_category.choices}')
|
||||
product_list = self.category_list_filters.to_product_option_list()
|
||||
filtered_product_list = []
|
||||
if product_list is not None:
|
||||
for product in product_list:
|
||||
# print(f'product: {product}\n{product[Stock_Item.ATTR_ID_PRODUCT_CATEGORY]}\n{self.form_filters.id_category.data}\n{str(type(product[Stock_Item.ATTR_ID_PRODUCT_CATEGORY]))}\n{str(type(self.form_filters.id_category.data))}')
|
||||
if (self.form_filters.id_category.data == '' or str(product[Stock_Item.ATTR_ID_PRODUCT_CATEGORY]) == self.form_filters.id_category.data):
|
||||
filtered_product_list.append(product)
|
||||
print(f'product_list: {product_list}\nfiltered_product_list: {filtered_product_list}')
|
||||
self.form_filters.id_product.choices += [(str(product['value']), product['text']) for product in filtered_product_list] # [Filters_Stock_Item.get_choice_all()] +
|
||||
# self.form_filters.import_values(filters_stock_item)
|
||||
self.variation_types, self.variations, errors = self.get_many_product_variation()
|
||||
self.units_measurement = self.get_many_unit_measurement()
|
||||
self.units_measurement_time = [unit_measurement for unit_measurement in self.units_measurement if unit_measurement.is_unit_of_time]
|
||||
self.currencies = self.get_many_currency()
|
||||
self.currency_options = [currency.to_json_option() for currency in self.currencies]
|
||||
|
||||
def save_stock_item(self, comment, list_stock_items):
|
||||
_m = 'Model_View_Store_Stock_Item.save_stock_item'
|
||||
DataStore_Store_Stock_Item().save_stock_item(comment, list_stock_items)
|
||||
@classmethod
|
||||
def save_stock_items(cls, comment, list_stock_items):
|
||||
_m = f'{cls.__name__}.save_stock_items'
|
||||
return DataStore_Store_Stock_Item().save_stock_items(comment, list_stock_items)
|
||||
@@ -34,5 +34,5 @@ class Model_View_Store_Supplier(Model_View_Store):
|
||||
av.val_instance(form, 'form', _m, FlaskForm)
|
||||
return super(Model_View_Supplier, cls).__new__(cls, db, info_user, app)
|
||||
"""
|
||||
def __init__(self,form, hash_page_current=Model_View_Base.HASH_PAGE_STORE_SUPPLIER):
|
||||
def __init__(self,form, hash_page_current=Model_View_Base.HASH_PAGE_STORE_SUPPLIERS):
|
||||
super().__init__(hash_page_current=hash_page_current, form=form)
|
||||
|
||||
Reference in New Issue
Block a user