fix: Updated Store for Product Categories, Products, and Product Permutations pages for tweaked architecture for controllers, datastores, and python data objects.
This commit is contained in:
Binary file not shown.
@@ -51,8 +51,10 @@ class Base():
|
||||
FLAG_URL: ClassVar[str] = 'url'
|
||||
FLAG_VALUE_LOCAL_VAT_EXCL: ClassVar[str] = 'value_local_vat_excl'
|
||||
FLAG_VALUE_LOCAL_VAT_INCL: ClassVar[str] = 'value_local_vat_incl'
|
||||
"""
|
||||
NAME_ATTR_OPTION_TEXT: ClassVar[str] = 'name-attribute-option-text'
|
||||
NAME_ATTR_OPTION_VALUE: ClassVar[str] = 'name-attribute-option-value'
|
||||
"""
|
||||
|
||||
@classmethod
|
||||
def output_bool(cls, value):
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -16,6 +16,7 @@ from extensions import db
|
||||
import lib.argument_validation as av
|
||||
# external
|
||||
from enum import Enum
|
||||
from typing import ClassVar
|
||||
|
||||
|
||||
class Resolution_Level_Enum(Enum):
|
||||
@@ -48,6 +49,8 @@ class Resolution_Level_Enum(Enum):
|
||||
|
||||
|
||||
class Image(db.Model, Store_Base):
|
||||
NAME_ATTR_OPTION_TEXT: ClassVar[str] = 'url'
|
||||
NAME_ATTR_OPTION_VALUE: ClassVar[str] = 'id_image'
|
||||
id_image = db.Column(db.Integer, primary_key=True)
|
||||
id_product = db.Column(db.Integer)
|
||||
id_permutation = db.Column(db.Integer)
|
||||
|
||||
@@ -490,10 +490,10 @@ class Parameters_Product(Get_Many_Parameters_Base):
|
||||
def from_form_filters_product_permutation(form):
|
||||
# if not (form is Filters_Product_Permutation): raise ValueError(f'Invalid form type: {type(form)}')
|
||||
# av.val_instance(form, 'form', 'Parameters_Product.from_form', Filters_Product_Permutation)
|
||||
has_category_filter = not (form.id_category.data == '0' or form.id_category.data == '')
|
||||
has_product_filter = not (form.id_product.data == '0' or form.id_product.data == '')
|
||||
has_category_filter = not (form.id_category.data == '0' or form.id_category.data == '' or form.id_category.data is None)
|
||||
has_product_filter = not (form.id_product.data == '0' or form.id_product.data == '' or form.id_product.data is None)
|
||||
get_permutations_stock_below_min = av.input_bool(form.is_out_of_stock.data, "is_out_of_stock", "Parameters_Product.from_form")
|
||||
print(f'form question: {type(form.is_out_of_stock)}\nbool interpretted: {get_permutations_stock_below_min}\type form: {type(form)}')
|
||||
print(f'form question: {type(form.is_out_of_stock)}\nbool interpretted: {get_permutations_stock_below_min}\ntype form: {type(form)}')
|
||||
return Parameters_Product(
|
||||
get_all_product_category = not has_category_filter,
|
||||
get_inactive_product_category = False,
|
||||
@@ -595,11 +595,11 @@ class Parameters_Product(Get_Many_Parameters_Base):
|
||||
def from_filters_product_category(cls, filters_category):
|
||||
return cls(
|
||||
get_all_product_category = True,
|
||||
get_inactive_product_category = filters_category.active,
|
||||
get_inactive_product_category = filters_category.active.data,
|
||||
ids_product_category = '',
|
||||
get_all_product = True,
|
||||
get_inactive_product = False,
|
||||
ids_product = False,
|
||||
ids_product = '',
|
||||
get_all_permutation = True,
|
||||
get_inactive_permutation = False,
|
||||
ids_permutation = '',
|
||||
|
||||
@@ -320,6 +320,8 @@ class Filters_Product_Category(Get_Many_Parameters_Base):
|
||||
"""
|
||||
|
||||
class Product_Category_Container(Store_Base):
|
||||
NAME_ATTR_OPTION_TEXT: ClassVar[str] = ''
|
||||
NAME_ATTR_OPTION_VALUE: ClassVar[str] = Store_Base.FLAG_ROWS
|
||||
categories: list
|
||||
def __init__(self):
|
||||
self.categories = []
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -22,7 +22,7 @@ from flask_wtf.recaptcha import RecaptchaField
|
||||
|
||||
|
||||
class Filters_Product(FlaskForm):
|
||||
id_category = SelectField('Category', validators=[Optional()], choices=[('', 'All')])
|
||||
id_category = SelectField('Category', validators=[Optional()], choices=[('', 'All')], default='')
|
||||
is_not_empty = BooleanField('Not empty only?')
|
||||
active = BooleanField("Active only?", default = True)
|
||||
@classmethod
|
||||
|
||||
@@ -26,8 +26,8 @@ from abc import ABCMeta, abstractmethod
|
||||
|
||||
|
||||
class Filters_Product_Permutation(Form_Base):
|
||||
id_category = SelectField('Category', validators=[Optional()], choices=[('', 'All')])
|
||||
id_product = SelectField('Product', validators=[Optional()], choices=[('', 'All')])
|
||||
id_category = SelectField('Category', validators=[Optional()], choices=[('', 'All')], default='')
|
||||
id_product = SelectField('Product', validators=[Optional()], choices=[('', 'All')], default='')
|
||||
is_out_of_stock = BooleanField('Out of stock only?')
|
||||
quantity_min = FloatField('Min stock')
|
||||
quantity_max = FloatField('Max stock')
|
||||
|
||||
@@ -7,9 +7,9 @@ th, td {
|
||||
#tableMain {
|
||||
max-width: 90vw;
|
||||
}
|
||||
#tableMain thead tr th.category, #tableMain tbody tr td.category {
|
||||
width: 8vh;
|
||||
min-width: 8vh;
|
||||
#tableMain thead tr th.product_category, #tableMain tbody tr td.product_category {
|
||||
width: 12vh;
|
||||
min-width: 12vh;
|
||||
}
|
||||
#tableMain thead tr th.product, #tableMain tbody tr td.product,
|
||||
#tableMain thead tr th.storage_location, #tableMain tbody tr td.storage_location {
|
||||
@@ -80,6 +80,6 @@ th, td {
|
||||
#tableMain thead tr th.date_unsealed, #tableMain tbody tr td.date_unsealed,
|
||||
#tableMain thead tr th.date_expiration, #tableMain tbody tr td.date_expiration,
|
||||
#tableMain thead tr th.date_consumed, #tableMain tbody tr td.date_consumed {
|
||||
width: 17vh;
|
||||
min-width: 17vh;
|
||||
width: 15vh;
|
||||
min-width: 15vh;
|
||||
}
|
||||
10
static/dist/css/store_stock_items.bundle.css
vendored
10
static/dist/css/store_stock_items.bundle.css
vendored
@@ -60,9 +60,9 @@ th, td {
|
||||
#tableMain {
|
||||
max-width: 90vw;
|
||||
}
|
||||
#tableMain thead tr th.category, #tableMain tbody tr td.category {
|
||||
width: 8vh;
|
||||
min-width: 8vh;
|
||||
#tableMain thead tr th.product_category, #tableMain tbody tr td.product_category {
|
||||
width: 12vh;
|
||||
min-width: 12vh;
|
||||
}
|
||||
#tableMain thead tr th.product, #tableMain tbody tr td.product,
|
||||
#tableMain thead tr th.storage_location, #tableMain tbody tr td.storage_location {
|
||||
@@ -133,6 +133,6 @@ th, td {
|
||||
#tableMain thead tr th.date_unsealed, #tableMain tbody tr td.date_unsealed,
|
||||
#tableMain thead tr th.date_expiration, #tableMain tbody tr td.date_expiration,
|
||||
#tableMain thead tr th.date_consumed, #tableMain tbody tr td.date_consumed {
|
||||
width: 17vh;
|
||||
min-width: 17vh;
|
||||
width: 15vh;
|
||||
min-width: 15vh;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user