diff --git a/business_objects/__pycache__/base.cpython-312.pyc b/business_objects/__pycache__/base.cpython-312.pyc index 5f33a95b..ad5c69b4 100644 Binary files a/business_objects/__pycache__/base.cpython-312.pyc and b/business_objects/__pycache__/base.cpython-312.pyc differ diff --git a/business_objects/base.py b/business_objects/base.py index 6d6c9a9a..6a2ee579 100644 --- a/business_objects/base.py +++ b/business_objects/base.py @@ -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): diff --git a/business_objects/store/__pycache__/image.cpython-312.pyc b/business_objects/store/__pycache__/image.cpython-312.pyc index 1ecc355a..0dfe173d 100644 Binary files a/business_objects/store/__pycache__/image.cpython-312.pyc and b/business_objects/store/__pycache__/image.cpython-312.pyc differ diff --git a/business_objects/store/__pycache__/product.cpython-312.pyc b/business_objects/store/__pycache__/product.cpython-312.pyc index 3f2fa807..b4aa8f7b 100644 Binary files a/business_objects/store/__pycache__/product.cpython-312.pyc and b/business_objects/store/__pycache__/product.cpython-312.pyc differ diff --git a/business_objects/store/__pycache__/product_category.cpython-312.pyc b/business_objects/store/__pycache__/product_category.cpython-312.pyc index 88c29724..e13292a4 100644 Binary files a/business_objects/store/__pycache__/product_category.cpython-312.pyc and b/business_objects/store/__pycache__/product_category.cpython-312.pyc differ diff --git a/business_objects/store/image.py b/business_objects/store/image.py index be364066..376c052a 100644 --- a/business_objects/store/image.py +++ b/business_objects/store/image.py @@ -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) diff --git a/business_objects/store/product.py b/business_objects/store/product.py index b04362ad..96b87743 100644 --- a/business_objects/store/product.py +++ b/business_objects/store/product.py @@ -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 = '', diff --git a/business_objects/store/product_category.py b/business_objects/store/product_category.py index a025347a..fc2d5cb7 100644 --- a/business_objects/store/product_category.py +++ b/business_objects/store/product_category.py @@ -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 = [] diff --git a/forms/store/__pycache__/product.cpython-312.pyc b/forms/store/__pycache__/product.cpython-312.pyc index 2e89a74c..73c5e222 100644 Binary files a/forms/store/__pycache__/product.cpython-312.pyc and b/forms/store/__pycache__/product.cpython-312.pyc differ diff --git a/forms/store/__pycache__/product_permutation.cpython-312.pyc b/forms/store/__pycache__/product_permutation.cpython-312.pyc index 78ec6a34..a03cfe0f 100644 Binary files a/forms/store/__pycache__/product_permutation.cpython-312.pyc and b/forms/store/__pycache__/product_permutation.cpython-312.pyc differ diff --git a/forms/store/product.py b/forms/store/product.py index b1c7c6da..702e2fcf 100644 --- a/forms/store/product.py +++ b/forms/store/product.py @@ -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 diff --git a/forms/store/product_permutation.py b/forms/store/product_permutation.py index c859782b..f32abac3 100644 --- a/forms/store/product_permutation.py +++ b/forms/store/product_permutation.py @@ -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') diff --git a/static/css/pages/store/stock_items.css b/static/css/pages/store/stock_items.css index 3f980784..07fc5c2f 100644 --- a/static/css/pages/store/stock_items.css +++ b/static/css/pages/store/stock_items.css @@ -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; } \ No newline at end of file diff --git a/static/dist/css/store_stock_items.bundle.css b/static/dist/css/store_stock_items.bundle.css index 8ca65b65..ecdb2197 100644 --- a/static/dist/css/store_stock_items.bundle.css +++ b/static/dist/css/store_stock_items.bundle.css @@ -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; }