1. View, filter, and save Product Permutation. \n 2. Synchronised with Product Category page and all common functionality moved into base and base table css, js, and python files.

This commit is contained in:
2024-09-24 23:25:52 +01:00
parent d37f632c92
commit cf78e4b3bc
239 changed files with 6371 additions and 4336 deletions

View File

@@ -20,6 +20,8 @@ from typing import ClassVar
class Access_Level(db.Model, Store_Base):
NAME_ATTR_OPTION_VALUE: ClassVar[str] = Store_Base.ATTR_ID_ACCESS_LEVEL
NAME_ATTR_OPTION_TEXT: ClassVar[str] = Store_Base.FLAG_NAME
__tablename__ = 'Shop_Access_Level_Temp'
id_access_level = db.Column(db.Integer, primary_key=True)
code = db.Column(db.String(50))
@@ -33,8 +35,9 @@ class Access_Level(db.Model, Store_Base):
def __init__(self):
super().__init__()
Store_Base.__init__(self)
def from_DB_access_level(query_row):
access_level = Access_Level()
@classmethod
def from_DB_access_level(cls, query_row):
access_level = cls()
access_level.id_access_level = query_row[0]
access_level.code = query_row[1]
access_level.name = query_row[2]
@@ -54,13 +57,14 @@ class Access_Level(db.Model, Store_Base):
'''
def to_json(self):
return {
**self.get_shared_json_attributes(self),
self.ATTR_ID_ACCESS_LEVEL: self.id_access_level[0] if isinstance(self.id_access_level, tuple) else self.id_access_level,
self.FLAG_CODE: self.code[0] if isinstance(self.code, tuple) else self.code,
self.FLAG_NAME: self.name[0] if isinstance(self.name, tuple) else self.name,
self.FLAG_DESCRIPTION: self.description[0] if isinstance(self.description, tuple) else self.description,
self.FLAG_PRIORITY: self.priority[0] if isinstance(self.priority, tuple) else self.priority,
self.FLAG_DISPLAY_ORDER: self.display_order,
self.FLAG_ACTIVE: self.active
self.FLAG_ACTIVE: av.input_bool(self.active, self.FLAG_ACTIVE, f'{self.__class__.__name__}.to_json')
}
def to_json_option(self):
return {
@@ -79,17 +83,3 @@ class Access_Level(db.Model, Store_Base):
access_level.display_order = json[cls.FLAG_DISPLAY_ORDER]
access_level.active = json[cls.FLAG_ACTIVE]
return access_level
class Filters_Access_Level(BaseModel):
get_inactive_access_level: bool
def __init__(self, get_inactive_access_level = False):
super().__init__(get_inactive_access_level = get_inactive_access_level)
def to_json(self):
return {
'a_get_inactive_access_level': self.get_inactive_access_level
}
@classmethod
def from_json(cls, json):
filters = cls()
filters.get_inactive_access_level = json['a_get_inactive_access_level']
return filters