diff --git a/app.log.1 b/app.log.1 index 0bd63758..bdcc17d9 100644 --- a/app.log.1 +++ b/app.log.1 @@ -1,12 +1,12 @@ -Server Error: name 'Parameters_Product' is not defined -Request: 127.0.0.1 GET http /store/categories? Host: 127.0.0.1:5000 +Server Error: 'Product_Variation_Type' object has no attribute 'name' +Request: 127.0.0.1 GET http /store/permutations? Host: 127.0.0.1:5000 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:131.0) Gecko/20100101 Firefox/131.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/png,image/svg+xml,*/*;q=0.8 Accept-Language: en-GB,en;q=0.5 Accept-Encoding: gzip, deflate, br, zstd +Referer: http://127.0.0.1:5000/store/permutations Dnt: 1 Connection: keep-alive -Referer: http://127.0.0.1:5000/store/categories Cookie: session=.eJytVlnzokgS_yoTRsw8tTY3-I_omPUCRUFB5HohCgqkuOUQcba_-xba090PM3tErKFYVZlk_rLy_GMCujYua9SE8NKE9eTjj0kACg_AHBVe05Z1OPlo6y789NNx92J8n4Y5QNnkYxLCHtRwliMIs7AtiyZHbfyP60idBWU--TSJUN20BcixwIkRQjjgMwS9oKvrsAgGD4YR6LJ28lF0WfYi1eEVlcVfEN4AyO9rbzSCwHJf___kWIHy52wgzFlIzAFP-IAkojAaFTbeC7F3D2sUoRBOPiKQNeGLgoog62AIPXNh_ND6thOTm67Cqn42vunqbwYpf9o9PY-GT77i-2rqyGvLNCwwXRB4GvoszUOf8Sma4aM5iCDPBYAGfsBAjgwYBkQjxO6bG0AQhE3zXUI4yLEvBeiI5BTYO3RYyZmfK-N-qSQXSidUdYd6BGz1uUtKBLY6EWwV7jDMU9d2Wr-AMXjuejVxMzdxy6OUMT5iyWBgY2jrpbJiE58i7ruCmM2yYR07BymE20hQltPHzAY9BQ5hOOzkRxAuTpDfXPcBf1k5WqwkR7Pzbmia7hQa3oZpxisnehCEqiwqLNObAzdvJG9nZ-fl9rjyjuyFcKfF5tjXTqG5Bw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XIHxKp1ogqelq6kVRcjuTlFzsiUQPs3XkWNJpfbBbfi8AckvkLmE0XlFFmtXpzVEn6bO5BzVdbC3y0TgU0THzm8F14uZeMqIBVHqeeO5GmhtHK6UYQyCHRcI30y6trekuue0HizkfdG5FMEkxZzyRmMY6cuim5S7DihrurFwXSb8ZiL1U-CIuyYfFpRZYjznQvtCtuRNvIunsOewRy3oKnV4fUL9cZXsqOxfafNke79Hl_mgAjFJyoWngXq7tYR-ZnPpQROoiOMF0X516m1tSJojP7F0HvGSO9asJymrsjPhZIPhLVZcRysJf3vPCp8mrYHnt8OJZhqDGTe_d-1ARla_-1-HmPLlKydDeVMVaxWf0uB15Stee5tbCFy_LOL8n_8sI8jetH5fUd41lBIFmxrHiz6LLsNT7oGmwgrhtq-bj82cY3qdFD1KK4Lgw4mIBPYpZ18xe08eo6jPW9W0w-M-gChSk_455ZCmLYKSb10elci6emOq2bhLpRho9JlcoaLtxUPuOsJlda3AHLahfcN7LzywN6YhiGIKHLMXykcBEFB8AgsedxYcc83vzhRGI3-ov1fU3-OUl61d68Ssl4m8Aix_24f1bZINXIZxVxcvjaHRYP92vSu1eP1B99N3-6nGi0ZqFkniVTEaHF2Pn_zezWldB0OJpbHTGhCIoZkqSU4I0iPkHSX1QxIyjGHfy9evXfwErYp4O.ZySbdA.IOzQ4B0k8HNh-01pbYKqF3sN8jI Upgrade-Insecure-Requests: 1 Sec-Fetch-Dest: document @@ -25,23 +25,50 @@ Traceback: Traceback (most recent call last): File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 865, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\controllers\store\product_category.py", line 56, in categories - model = Model_View_Store_Product_Category(form_filters) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\models\model_view_store_product_category.py", line 48, in __init__ - filters_product = Parameters_Product.from_filters_product_category(self.form_filters) - ^^^^^^^^^^^^^^^^^^ -NameError: name 'Parameters_Product' is not defined + File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\controllers\store\product_permutation.py", line 47, in permutations + return render_template('pages/store/_product_permutations.html', model = model) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\templating.py", line 150, in render_template + return _render(app, template, context) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\templating.py", line 131, in _render + rv = template.render(context) + ^^^^^^^^^^^^^^^^^^^^^^^^ + File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\jinja2\environment.py", line 1304, in render + self.environment.handle_exception() + File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\jinja2\environment.py", line 939, in handle_exception + raise rewrite_traceback_stack(source=source) + File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\templates\pages\store\_product_permutations.html", line 1, in top-level template code + {% extends 'layouts/layout.html' %} + ^^^^^^^^^^^^^^^^^^^^^^^^^ + File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\templates\layouts\layout.html", line 354, in top-level template code + {% block page_body %}{% endblock %} + ^^^^^^^^^^^^^^^^^^^^^^^^^ + File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\templates\pages\store\_product_permutations.html", line 131, in block 'page_body' + {% include 'components/store/_row_product_permutation.html' %} + ^^^^^^^^^^^^^^^^^^^^^^^^^ + File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\templates\components\store\_row_product_permutation.html", line 94, in top-level template code + {% include 'components/store/_preview_product_permutation_variations.html' %} + ^^^^^^^^^^^^^^^^^^^^^^^^^ + File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\templates\components\store\_preview_product_permutation_variations.html", line 5, in top-level template code + {% set str_variations = variation_tree.to_preview_str() %} + ^^^^^^^^^^^^^^^^^^^^^^^^^ + File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\business_objects\store\product_variation_tree.py", line 145, in to_preview_str + preview_str += f'{variation_type.name}: {variation_type.variations[0].name}' + ^^^^^^^^^^^^^^^^^^^ +AttributeError: 'Product_Variation_Type' object has no attribute 'name' -Server Error: 1 -Request: 127.0.0.1 GET http /store/stock_items? Host: 127.0.0.1:5000 +config_env: development +config_env: development +Server Error: 'variation_type' is undefined +Request: 127.0.0.1 GET http /store/permutations? Host: 127.0.0.1:5000 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:131.0) Gecko/20100101 Firefox/131.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/png,image/svg+xml,*/*;q=0.8 Accept-Language: en-GB,en;q=0.5 Accept-Encoding: gzip, deflate, br, zstd +Referer: http://127.0.0.1:5000/store/permutations Dnt: 1 Connection: keep-alive -Referer: http://127.0.0.1:5000/store/stock_items Cookie: session=.eJytVlnzokgS_yoTRsw8tTY3-I_omPUCRUFB5HohCgqkuOUQcba_-xba090PM3tErKFYVZlk_rLy_GMCujYua9SE8NKE9eTjj0kACg_AHBVe05Z1OPlo6y789NNx92J8n4Y5QNnkYxLCHtRwliMIs7AtiyZHbfyP60idBWU--TSJUN20BcixwIkRQjjgMwS9oKvrsAgGD4YR6LJ28lF0WfYi1eEVlcVfEN4AyO9rbzSCwHJf___kWI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9evXfwErYp4O.ZySbdA.IOzQ4B0k8HNh-01pbYKqF3sN8jI Upgrade-Insecure-Requests: 1 Sec-Fetch-Dest: document @@ -53,28 +80,3 @@ Priority: u=0, i Request data: b'' -Traceback: Traceback (most recent call last): - File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 880, in full_dispatch_request - rv = self.dispatch_request() - ^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 865, in dispatch_request - return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return] - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\controllers\store\stock_item.py", line 40, in stock_items - model = Model_View_Store_Stock_Item(form_filters) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\models\model_view_store_stock_item.py", line 54, in __init__ - self.category_list_filters, errors_filters = datastore_store.get_many_product(Parameters_Product.get_default()) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\datastores\datastore_store_base.py", line 133, in get_many_product - category_list.add_product_image(new_image) - File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\business_objects\store\product_category.py", line 366, in add_product_image - self.categories[index_category].add_product_image(image) - File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\business_objects\store\product_category.py", line 129, in add_product_image - self.products[index_product].add_product_image(image) - File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\business_objects\store\product.py", line 286, in add_product_image - index_permutation = self.permutation_index[image.id_permutation] # self.get_index_permutation_from_id(image.id_permutation) - ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^ -KeyError: 1 - -Server Error: 1 diff --git a/app.log.2 b/app.log.2 index f5c479ad..a350eac3 100644 --- a/app.log.2 +++ b/app.log.2 @@ -5,9 +5,9 @@ Traceback: Traceback (most recent call last): File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 865, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\controllers\store\product_variation.py", line 45, in product_variations - return render_template('pages/store/_product_variations.html', model = model) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\controllers\store\product_permutation.py", line 47, in permutations + return render_template('pages/store/_product_permutations.html', model = model) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\templating.py", line 150, in render_template return _render(app, template, context) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -18,31 +18,40 @@ Traceback: Traceback (most recent call last): self.environment.handle_exception() File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\jinja2\environment.py", line 939, in handle_exception raise rewrite_traceback_stack(source=source) - File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\templates\pages\store\_product_variations.html", line 1, in top-level template code + File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\templates\pages\store\_product_permutations.html", line 1, in top-level template code {% extends 'layouts/layout.html' %} ^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\templates\layouts\layout.html", line 353, in top-level template code + File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\templates\layouts\layout.html", line 354, in top-level template code {% block page_body %}{% endblock %} ^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\templates\pages\store\_product_variations.html", line 51, in block 'page_body' - {% include 'components/store/_row_product_variation_type.html' %} + File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\templates\pages\store\_product_permutations.html", line 149, in block 'page_body' + var products = {{ model.convert_list_objects_to_dict_json_by_attribute_key_default(model.category_list.get_list_products()) | tojson | safe }}; ^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\templates\components\store\_row_product_variation_type.html", line 50, in top-level template code - - ^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\jinja2\environment.py", line 487, in getattr - return getattr(obj, attribute) - ^^^^^^^^^^^^^^^^^^^^^^^ -jinja2.exceptions.UndefinedError: 'product' is undefined + File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\models\model_view_base.py", line 358, in convert_list_objects_to_dict_json_by_attribute_key_default + return Model_View_Base.convert_list_objects_to_dict_json_by_attribute_key(list_objects, getattr(obj_class, obj_class.FLAG_NAME_ATTR_OPTION_VALUE)) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\models\model_view_base.py", line 346, in convert_list_objects_to_dict_json_by_attribute_key + return {getattr(obj, key): obj.to_json() for obj in list_objects} + ^^^^^^^^^^^^^ + File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\business_objects\store\product.py", line 347, in to_json + self.ATTR_ID_PRODUCT_PERMUTATION: [permutation.to_json() for permutation in self.permutations], + ^^^^^^^^^^^^^^^^^^^^^ + File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\business_objects\store\product_permutation.py", line 305, in to_json + self.FLAG_PRODUCT_VARIATIONS: [variation_type.to_json() for variation_type in self.variation_tree.get_product_variation_types()], + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +AttributeError: 'NoneType' object has no attribute 'get_product_variation_types' config_env: development -Server Error: 'models.model_view_store_product_variation.Model_View_Store_Product_Variation object' has no attribute 'category_list_filters' -Request: 127.0.0.1 GET http /store/variations? Host: 127.0.0.1:5000 +config_env: development +config_env: development +config_env: development +Server Error: 'Product_Variation_Tree' object has no attribute 'get_product_variations' +Request: 127.0.0.1 GET http /store/permutations? Host: 127.0.0.1:5000 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:131.0) Gecko/20100101 Firefox/131.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/png,image/svg+xml,*/*;q=0.8 Accept-Language: en-GB,en;q=0.5 Accept-Encoding: gzip, deflate, br, zstd -Referer: http://127.0.0.1:5000/store/variations +Referer: http://127.0.0.1:5000/store/permutations Dnt: 1 Connection: keep-alive Cookie: session=.eJytVlnzokgS_yoTRsw8tTY3-I_omPUCRUFB5HohCgqkuOUQcba_-xba090PM3tErKFYVZlk_rLy_GMCujYua9SE8NKE9e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EFB8AgsedxYcc83vzhRGI3-ov1fU3-OUl61d68Ssl4m8Aix_24f1bZINXIZxVxcvjaHRYP92vSu1eP1B99N3-6nGi0ZqFkniVTEaHF2Pn_zezWldB0OJpbHTGhCIoZkqSU4I0iPkHSX1QxIyjGHfy9evXfwErYp4O.ZySbdA.IOzQ4B0k8HNh-01pbYKqF3sN8jI @@ -63,114 +72,26 @@ Traceback: Traceback (most recent call last): File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 865, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\controllers\store\product_variation.py", line 45, in product_variations - return render_template('pages/store/_product_variations.html', model = model) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\templating.py", line 150, in render_template - return _render(app, template, context) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\templating.py", line 131, in _render - rv = template.render(context) - ^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\jinja2\environment.py", line 1304, in render - self.environment.handle_exception() - File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\jinja2\environment.py", line 939, in handle_exception - raise rewrite_traceback_stack(source=source) - File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\templates\pages\store\_product_variations.html", line 1, in top-level template code - {% extends 'layouts/layout.html' %} - ^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\templates\layouts\layout.html", line 353, in top-level template code - {% block page_body %}{% endblock %} - ^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\templates\pages\store\_product_variations.html", line 69, in block 'page_body' - var productCategories = {{ model.convert_list_objects_to_dict_json_by_attribute_key_default(model.category_list_filters.categories) | tojson | safe }}; - ^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\jinja2\environment.py", line 487, in getattr - return getattr(obj, attribute) - ^^^^^^^^^^^^^^^^^^^^^^^ -jinja2.exceptions.UndefinedError: 'models.model_view_store_product_variation.Model_View_Store_Product_Variation object' has no attribute 'category_list_filters' + File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\controllers\store\product_permutation.py", line 43, in permutations + model = Model_View_Store_Product_Permutation(form_filters) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\models\model_view_store_product_permutation.py", line 51, in __init__ + self.category_list, errors = datastore_store.get_many_product(filters_product) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\datastores\datastore_store_base.py", line 145, in get_many_product + category_list.get_all_product_variation_trees() + File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\business_objects\store\product_category.py", line 396, in get_all_product_variation_trees + category.get_all_product_variation_trees() + File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\business_objects\store\product_category.py", line 154, in get_all_product_variation_trees + product.get_variation_trees() + File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\business_objects\store\product.py", line 176, in get_variation_trees + if self.variation_trees[index_tree].is_equal(variation_tree): + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\business_objects\store\product_variation_tree.py", line 52, in is_equal + my_type_list = self.get_product_variations() + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +AttributeError: 'Product_Variation_Tree' object has no attribute 'get_product_variations'. Did you mean: 'get_product_variation_types'? config_env: development config_env: development config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development -config_env: development diff --git a/app.log.3 b/app.log.3 index dcb68d7c..76228d2a 100644 --- a/app.log.3 +++ b/app.log.3 @@ -1,11 +1,11 @@ -Request: 127.0.0.1 GET http /store/variations? Host: 127.0.0.1:5000 +Request: 127.0.0.1 GET http /store/stock_items? Host: 127.0.0.1:5000 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:131.0) Gecko/20100101 Firefox/131.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/png,image/svg+xml,*/*;q=0.8 Accept-Language: en-GB,en;q=0.5 Accept-Encoding: gzip, deflate, br, zstd -Referer: http://127.0.0.1:5000/store/variations Dnt: 1 Connection: keep-alive +Referer: http://127.0.0.1:5000/store/stock_items Cookie: session=.eJytVlnzokgS_yoTRsw8tTY3-I_omPUCRUFB5HohCgqkuOUQcba_-xba090PM3tErKFYVZlk_rLy_GMCujYua9SE8NKE9eTjj0kACg_AHBVe05Z1OPlo6y789NNx92J8n4Y5QNnkYxLCHtRwliMIs7AtiyZHbfyP60idBWU--TSJUN20BcixwIkRQjjgMwS9oKvrsAgGD4YR6LJ28lF0WfYi1eEVlcVfEN4AyO9rbzSCwHJf___kWIHy52wgzFlIzAFP-IAkojAaFTbeC7F3D2sUoRBOPiKQNeGLgoog62AIPXNh_ND6thOTm67Cqn42vunqbwYpf9o9PY-GT77i-2rqyGvLNCwwXRB4GvoszUOf8Sma4aM5iCDPBYAGfsBAjgwYBkQjxO6bG0AQhE3zXUI4yLEvBeiI5BTYO3RYyZmfK-N-qSQXSidUdYd6BGz1uUtKBLY6EWwV7jDMU9d2Wr-AMXjuejVxMzdxy6OUMT5iyWBgY2jrpbJiE58i7ruCmM2yYR07BymE20hQltPHzAY9BQ5hOOzkRxAuTpDfXPcBf1k5WqwkR7Pzbmia7hQa3oZpxisnehCEqiwqLNObAzdvJG9nZ-fl9rjyjuyFcKfF5tjXTqG5BwJJ0cUs_eXtcSMYLQMFeZUOmmYe2cUmhsxG7rWkCfa5LW7OMbewDZgF5Wmf7kuFAVAMH1YfXwGFhFt89_VrMqUV0hC0Y5prvM3Ep6FYnWMPLabZahk3tkPvXdJJ85vqhY7DlGtIOf0wn9bLpa4_uav0kM3W8LeOH9JFGCy1WFRvuju9IQSyA9_4oi2ea49doPVD3YBeXhUaH2e6mapphD8VEDtVX9erjXNMTnpJ80fBuSnlNmF4Mr1uzQXTi8fDvCr4mamrZsoB1ScEw7rtnXK7aOMrDoPwUaE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hLVZcRysJf3vPCp8mrYHnt8OJZhqDGTe_d-1ARla_-1-HmPLlKydDeVMVaxWf0uB15Stee5tbCFy_LOL8n_8sI8jetH5fUd41lBIFmxrHiz6LLsNT7oGmwgrhtq-bj82cY3qdFD1KK4Lgw4mIBPYpZ18xe08eo6jPW9W0w-M-gChSk_455ZCmLYKSb10elci6emOq2bhLpRho9JlcoaLtxUPuOsJlda3AHLahfcN7LzywN6YhiGIKHLMXykcBEFB8AgsedxYcc83vzhRGI3-ov1fU3-OUl61d68Ssl4m8Aix_24f1bZINXIZxVxcvjaHRYP92vSu1eP1B99N3-6nGi0ZqFkniVTEaHF2Pn_zezWldB0OJpbHTGhCIoZkqSU4I0iPkHSX1QxIyjGHfy9evXfwErYp4O.ZySbdA.IOzQ4B0k8HNh-01pbYKqF3sN8jI Upgrade-Insecure-Requests: 1 Sec-Fetch-Dest: document @@ -24,47 +24,34 @@ Traceback: Traceback (most recent call last): File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 865, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\controllers\store\product_variation.py", line 45, in product_variations - return render_template('pages/store/_product_variations.html', model = model) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\templating.py", line 150, in render_template - return _render(app, template, context) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\templating.py", line 131, in _render - rv = template.render(context) - ^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\jinja2\environment.py", line 1304, in render - self.environment.handle_exception() - File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\jinja2\environment.py", line 939, in handle_exception - raise rewrite_traceback_stack(source=source) - File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\templates\pages\store\_product_variations.html", line 1, in top-level template code - {% extends 'layouts/layout.html' %} - ^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\templates\layouts\layout.html", line 353, in top-level template code - {% block page_body %}{% endblock %} - ^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\templates\pages\store\_product_variations.html", line 51, in block 'page_body' - {% include 'components/store/_row_product_variation_type.html' %} - ^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\templates\components\store\_row_product_variation_type.html", line 47, in top-level template code - {% include 'components/store/_preview_product_variation_type_variations.html' %} - ^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\templates\components\store\_preview_product_variation_type_variations.html", line 5, in top-level template code - {{ variation_type.get_preview_variations() }} - ^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\business_objects\store\product_variation_type.py", line 112, in get_preview_variations - preview = '\n'.join([variation.name_singular for variation in self.variations]) - ^^^^^^^^^^^^^^^^^^^^^^^ -AttributeError: 'Product_Variation' object has no attribute 'name_singular' + File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\controllers\store\stock_item.py", line 40, in stock_items + model = Model_View_Store_Stock_Item(form_filters) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\models\model_view_store_stock_item.py", line 54, in __init__ + self.category_list_filters, errors_filters = datastore_store.get_many_product(Parameters_Product.get_default()) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\datastores\datastore_store_base.py", line 133, in get_many_product + category_list.add_product_image(new_image) + File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\business_objects\store\product_category.py", line 366, in add_product_image + self.categories[index_category].add_product_image(image) + File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\business_objects\store\product_category.py", line 129, in add_product_image + self.products[index_product].add_product_image(image) + File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\business_objects\store\product.py", line 286, in add_product_image + index_permutation = self.permutation_index[image.id_permutation] # self.get_index_permutation_from_id(image.id_permutation) + ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^ +KeyError: 1 config_env: development -Server Error: 'product' is undefined -Request: 127.0.0.1 GET http /store/variations? Host: 127.0.0.1:5000 +config_env: development +config_env: development +config_env: development +Server Error: 'NoneType' object has no attribute 'get_product_variation_types' +Request: 127.0.0.1 GET http /store/permutations? Host: 127.0.0.1:5000 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:131.0) Gecko/20100101 Firefox/131.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/png,image/svg+xml,*/*;q=0.8 Accept-Language: en-GB,en;q=0.5 Accept-Encoding: gzip, deflate, br, zstd -Referer: http://127.0.0.1:5000/store/variations +Referer: http://127.0.0.1:5000/store/permutations Dnt: 1 Connection: keep-alive Cookie: session=.eJytVlnzokgS_yoTRs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ZCmLYKSb10elci6emOq2bhLpRho9JlcoaLtxUPuOsJlda3AHLahfcN7LzywN6YhiGIKHLMXykcBEFB8AgsedxYcc83vzhRGI3-ov1fU3-OUl61d68Ssl4m8Aix_24f1bZINXIZxVxcvjaHRYP92vSu1eP1B99N3-6nGi0ZqFkniVTEaHF2Pn_zezWldB0OJpbHTGhCIoZkqSU4I0iPkHSX1QxIyjGHfy9evXfwErYp4O.ZySbdA.IOzQ4B0k8HNh-01pbYKqF3sN8jI diff --git a/business_objects/store/__pycache__/product.cpython-312.pyc b/business_objects/store/__pycache__/product.cpython-312.pyc index bb53bb78..1cc13db5 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 b0ba31d7..aeefa5fa 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/__pycache__/product_permutation.cpython-312.pyc b/business_objects/store/__pycache__/product_permutation.cpython-312.pyc index cf3c42de..f6e02b54 100644 Binary files a/business_objects/store/__pycache__/product_permutation.cpython-312.pyc and b/business_objects/store/__pycache__/product_permutation.cpython-312.pyc differ diff --git a/business_objects/store/__pycache__/product_variation_tree.cpython-312.pyc b/business_objects/store/__pycache__/product_variation_tree.cpython-312.pyc index 9181d1ab..caf47456 100644 Binary files a/business_objects/store/__pycache__/product_variation_tree.cpython-312.pyc and b/business_objects/store/__pycache__/product_variation_tree.cpython-312.pyc differ diff --git a/business_objects/store/__pycache__/product_variation_type.cpython-312.pyc b/business_objects/store/__pycache__/product_variation_type.cpython-312.pyc index 9826dda2..e41f32dd 100644 Binary files a/business_objects/store/__pycache__/product_variation_type.cpython-312.pyc and b/business_objects/store/__pycache__/product_variation_type.cpython-312.pyc differ diff --git a/business_objects/store/product.py b/business_objects/store/product.py index 63dffd15..6ec5aa30 100644 --- a/business_objects/store/product.py +++ b/business_objects/store/product.py @@ -272,11 +272,17 @@ class Product(SQLAlchemy_ABC, Store_Base): return index_permutation raise ValueError(f"{av.error_msg_str(id_permutation, 'id_permutation', 'Product.get_index_permutation_from_id', int)}\nPermutation ID not found.") """ + """ def add_product_variation(self, variation): av.val_instance(variation, 'variation', 'Product.add_product_variation', Product_Variation) # Helper_App.console_log(f'variation: {variation}') index_permutation = self.permutation_index[variation.id_permutation] # self.get_index_permutation_from_id(variation.id_permutation) self.permutations[index_permutation].add_product_variation(variation) + """ + def add_product_variation_type(self, variation_type): + variation = variation_type.variations[0] + index_permutation = self.permutation_index[variation.id_permutation] + self.permutations[index_permutation].add_product_variation_type(variation_type) def add_product_price(self, price): av.val_instance(price, 'price', 'Product.add_product_price', Product_Price) index_permutation = self.permutation_index[price.id_permutation] # self.get_index_permutation_from_id(price.id_permutation) diff --git a/business_objects/store/product_category.py b/business_objects/store/product_category.py index 61fc908a..d7e1baa4 100644 --- a/business_objects/store/product_category.py +++ b/business_objects/store/product_category.py @@ -14,7 +14,8 @@ Business object for product category import lib.argument_validation as av from business_objects.db_base import SQLAlchemy_ABC, Get_Many_Parameters_Base from business_objects.store.product import Product, Product_Permutation, Product_Price -from business_objects.store.product_variation import Product_Variation +# from business_objects.store.product_variation import Product_Variation +from business_objects.store.product_variation_type import Product_Variation_Type from business_objects.store.image import Image from business_objects.store.delivery_option import Delivery_Option from business_objects.store.discount import Discount @@ -115,10 +116,17 @@ class Product_Category(SQLAlchemy_ABC, Store_Base): index_product = self.get_index_product_from_id(permutation.id_product) # index_product = self.product_index[permutation.id_product] self.products[index_product].add_product_permutation(permutation) + """ def add_product_variation(self, variation): av.val_instance(variation, 'variation', 'Category.add_product_variation', Product_Variation) index_product = self.get_index_product_from_id(variation.id_product) self.products[index_product].add_product_variation(variation) + """ + def add_product_variation_type(self, variation_type): + av.val_instance(variation_type, 'variation_type', 'Category.add_product_variation_type', Product_Variation_Type) + variation = variation_type.variations[0] + index_product = self.get_index_product_from_id(variation.id_product) + self.products[index_product].add_product_variation_type(variation_type) def add_product_price(self, price): av.val_instance(price, 'price', 'Category.add_product_price', Product_Price) index_product = self.get_index_product_from_id(price.id_product) @@ -352,10 +360,17 @@ class Product_Category_Container(Store_Base): av.val_instance(permutation, 'permutation', 'Container_Product_Categories.add_product_permutation', Product_Permutation) index_category = self.get_index_category_from_id(permutation.id_category) self.categories[index_category].add_product_permutation(permutation) + """ def add_product_variation(self, variation): av.val_instance(variation, 'variation', 'Container_Product_Categories.add_product_variation', Product_Variation) index_category = self.get_index_category_from_id(variation.id_category) self.categories[index_category].add_product_variation(variation) + """ + def add_product_variation_type(self, variation_type): + av.val_instance(variation_type, 'variation_type', 'Container_Product_Categories.add_product_variation_type', Product_Variation_Type) + variation = variation_type.variations[0] + index_category = self.get_index_category_from_id(variation.id_category) + self.categories[index_category].add_product_variation_type(variation_type) def add_product_price(self, price): av.val_instance(price, 'price', 'Container_Product_Categories.add_product_price', Product_Price) index_category = self.get_index_category_from_id(price.id_category) diff --git a/business_objects/store/product_permutation.py b/business_objects/store/product_permutation.py index b0ad66fe..dbf71e81 100644 --- a/business_objects/store/product_permutation.py +++ b/business_objects/store/product_permutation.py @@ -302,7 +302,7 @@ class Product_Permutation(db.Model, Store_Base): self.FLAG_CAN_VIEW: self.can_view, self.FLAG_CAN_EDIT: self.can_edit, self.FLAG_CAN_ADMIN: self.can_admin, - self.FLAG_PRODUCT_VARIATIONS: [variation_type.to_json() for variation_type in self.variation_tree.get_product_variation_types()], + self.FLAG_PRODUCT_VARIATIONS: [] if self.variation_tree is None else [variation_type.to_json() for variation_type in self.variation_tree.get_product_variation_types()], self.FLAG_PRODUCT_IMAGE: [image.to_json() for image in self.images], self.FLAG_DELIVERY_OPTION: [option.to_json() for option in self.delivery_options], self.FLAG_PRODUCT_PRICE: [price.to_json() for price in self.prices], @@ -395,10 +395,10 @@ class Product_Permutation(db.Model, Store_Base): price_GBP_full: {self.price_GBP_full} price_GBP_min: {self.price_GBP_min} """ - + """ def add_product_variation(self, variation): _m = 'Product_Permutation.add_product_variation' - """ + "" av.val_instance(variation, 'variation', _m, Product_Variation) try: self.variation_index[variation.id_variation] @@ -406,11 +406,18 @@ class Product_Permutation(db.Model, Store_Base): except KeyError: self.variation_index[variation.id_variation] = len(self.variations) self.variations.append(variation) - """ + "" if self.variation_tree is None: self.variation_tree = Product_Variation_Tree.from_product_variation(variation) else: self.variation_tree.add_product_variation(variation) + """ + def add_product_variation_type(self, variation_type): + _m = 'Product_Permutation.add_product_variation_type' + if self.variation_tree is None: + self.variation_tree = Product_Variation_Tree.from_product_variation_type(variation_type) + else: + self.variation_tree.add_product_variation_type(variation_type) def add_product_price(self, price): _m = 'Product_Permutation.add_product_price' av.val_instance(price, 'price', _m, Product_Price) diff --git a/business_objects/store/product_variation_tree.py b/business_objects/store/product_variation_tree.py index 3f18a3a1..00a3647e 100644 --- a/business_objects/store/product_variation_tree.py +++ b/business_objects/store/product_variation_tree.py @@ -11,6 +11,7 @@ Business object for product """ # internal +from business_objects.store.product_variation import Product_Variation from business_objects.store.product_variation_type import Product_Variation_Type from extensions import db from helpers.helper_app import Helper_App @@ -49,9 +50,9 @@ class Product_Variation_Tree(): node_root = Product_Variation_Tree_Node.from_variation_type_and_node_parent(variation_type_root, None) return cls.from_node_root(node_root) def is_equal(self, tree): - my_type_list = self.get_product_variations() + my_type_list = self.get_product_variation_types() sz_me = len(my_type_list) - other_type_list = tree.get_product_variations() + other_type_list = tree.get_product_variation_types() sz_other = len(other_type_list) is_equal = (sz_me == sz_other) if is_equal: @@ -120,6 +121,7 @@ class Product_Variation_Tree(): types.append(node.variation_type) node = node.nodes_child[0] at_leaf_node = node.is_leaf() + types.append(node.variation_type) return types """ def get_product_variations(self): @@ -140,7 +142,7 @@ class Product_Variation_Tree(): preview_str = '' for variation_type in variation_types: is_first = (preview_str == '') - preview_str += f'{variation_type.name}: {variation_type.variations[0].name}' + preview_str += f'{variation_type.name_singular}: {variation_type.variations[0].name}' if is_first: preview_str += '\n' Helper_App.console_log(f'preview_str: {preview_str}') diff --git a/business_objects/store/product_variation_type.py b/business_objects/store/product_variation_type.py index d07a6199..7e799893 100644 --- a/business_objects/store/product_variation_type.py +++ b/business_objects/store/product_variation_type.py @@ -30,7 +30,7 @@ from operator import attrgetter class Product_Variation_Type(db.Model, Store_Base): NAME_ATTR_OPTION_VALUE: ClassVar[str] = Store_Base.ATTR_ID_PRODUCT_VARIATION_TYPE - NAME_ATTR_OPTION_TEXT = Store_Base.FLAG_NAME_SINGULAR + NAME_ATTR_OPTION_TEXT = Store_Base.FLAG_NAME id_type = db.Column(db.Integer, primary_key=True) code = db.Column(db.String(50)) diff --git a/datastores/__pycache__/datastore_store_base.cpython-312.pyc b/datastores/__pycache__/datastore_store_base.cpython-312.pyc index 00118c7b..dad97b7c 100644 Binary files a/datastores/__pycache__/datastore_store_base.cpython-312.pyc and b/datastores/__pycache__/datastore_store_base.cpython-312.pyc differ diff --git a/datastores/datastore_store_base.py b/datastores/datastore_store_base.py index 576d2975..30a1da23 100644 --- a/datastores/datastore_store_base.py +++ b/datastores/datastore_store_base.py @@ -119,9 +119,9 @@ class DataStore_Store_Base(DataStore_Base): cursor.nextset() result_set_4 = cursor.fetchall() for row in result_set_4: - new_variation = Product_Variation.from_DB_get_many_product_catalogue(row) + new_variation_type = Product_Variation_Type.from_DB_get_many_product_catalogue(row) try: - category_list.add_product_variation(new_variation) + category_list.add_product_variation_type(new_variation_type) except Exception as e: Helper_App.console_log(f'Error adding variation: {e}') diff --git a/static/css/pages/store/product_categories.css b/static/css/pages/store/product_categories.css index 6d2d635e..7d80d358 100644 --- a/static/css/pages/store/product_categories.css +++ b/static/css/pages/store/product_categories.css @@ -50,47 +50,13 @@ width: 5vh; min-width: 5vh; } -/* -nips -*/ - -/* -.row-new { - visibility: hidden; -} -*/ - -textarea { - width: 95%; -} - -select { - width: 100%; -} - -input { - width: 90%; -} td > input, td > select, td > textarea, .container-input > input, .container-input > select, .container-input > textarea { border: 2px solid var(--c_purple); border-radius: 0.5vh; } -#tableMain tbody tr td button { - padding: 0; - border: 0; - margin: 0; - text-decoration: none; -} - #tableMain tbody tr td table thead tr th.id_variation_type, #tableMain tbody tr td table tbody tr td.id_variation_type, #tableMain tbody tr td table thead tr th.id_variation, #tableMain tbody tr td table tbody tr td.id_variation { width: 47.5%; } - -/* -select.id_variation, select.id_variation_type { - max-width: 40% !important; -} -*/ diff --git a/static/css/pages/store/product_permutations.css b/static/css/pages/store/product_permutations.css index ed9fcd28..2be740e6 100644 --- a/static/css/pages/store/product_permutations.css +++ b/static/css/pages/store/product_permutations.css @@ -114,13 +114,6 @@ td > input, td > select, td > textarea, .container-input > input, .container-inp border-radius: 0.5vh; } -#tableMain tbody tr td button { - padding: 0; - border: 0; - margin: 0; - text-decoration: none; -} - #tableMain tbody tr td table thead tr th.id_variation_type, #tableMain tbody tr td table tbody tr td.id_variation_type, #tableMain tbody tr td table thead tr th.id_variation, #tableMain tbody tr td table tbody tr td.id_variation { width: 47.5%; } diff --git a/static/css/pages/store/products.css b/static/css/pages/store/products.css index fcdadac8..2a0c688e 100644 --- a/static/css/pages/store/products.css +++ b/static/css/pages/store/products.css @@ -46,30 +46,11 @@ min-width: 5vh; } -textarea { - width: 95%; -} - -select { - width: 100%; -} - -input { - width: 90%; -} - td > input, td > select, td > textarea, .container-input > input, .container-input > select, .container-input > textarea { border: 2px solid var(--c_purple); border-radius: 0.5vh; } -#tableMain tbody tr td button { - padding: 0; - border: 0; - margin: 0; - text-decoration: none; -} - #tableMain tbody tr td table thead tr th.id_variation_type, #tableMain tbody tr td table tbody tr td.id_variation_type, #tableMain tbody tr td table thead tr th.id_variation, #tableMain tbody tr td table tbody tr td.id_variation { width: 47.5%; } diff --git a/static/dist/css/store_product_categories.bundle.css b/static/dist/css/store_product_categories.bundle.css index de1b2157..4ace60b7 100644 --- a/static/dist/css/store_product_categories.bundle.css +++ b/static/dist/css/store_product_categories.bundle.css @@ -107,50 +107,16 @@ width: 5vh; min-width: 5vh; } -/* -nips -*/ - -/* -.row-new { - visibility: hidden; -} -*/ - -textarea { - width: 95%; -} - -select { - width: 100%; -} - -input { - width: 90%; -} td > input, td > select, td > textarea, .container-input > input, .container-input > select, .container-input > textarea { border: 2px solid var(--c_purple); border-radius: 0.5vh; } -#tableMain tbody tr td button { - padding: 0; - border: 0; - margin: 0; - text-decoration: none; -} - #tableMain tbody tr td table thead tr th.id_variation_type, #tableMain tbody tr td table tbody tr td.id_variation_type, #tableMain tbody tr td table thead tr th.id_variation, #tableMain tbody tr td table tbody tr td.id_variation { width: 47.5%; } -/* -select.id_variation, select.id_variation_type { - max-width: 40% !important; -} -*/ - /*# sourceMappingURL=store_product_categories.bundle.css.map*/ \ No newline at end of file diff --git a/static/dist/css/store_product_permutations.bundle.css b/static/dist/css/store_product_permutations.bundle.css index 6eeae342..3aa1b12e 100644 --- a/static/dist/css/store_product_permutations.bundle.css +++ b/static/dist/css/store_product_permutations.bundle.css @@ -171,13 +171,6 @@ td > input, td > select, td > textarea, .container-input > input, .container-inp border-radius: 0.5vh; } -#tableMain tbody tr td button { - padding: 0; - border: 0; - margin: 0; - text-decoration: none; -} - #tableMain tbody tr td table thead tr th.id_variation_type, #tableMain tbody tr td table tbody tr td.id_variation_type, #tableMain tbody tr td table thead tr th.id_variation, #tableMain tbody tr td table tbody tr td.id_variation { width: 47.5%; } diff --git a/static/dist/js/main.bundle.js b/static/dist/js/main.bundle.js index 62315d28..53962296 100644 --- a/static/dist/js/main.bundle.js +++ b/static/dist/js/main.bundle.js @@ -2463,7 +2463,6 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) { }, { key: "hookupButtonsAddSaveCancel", value: function hookupButtonsAddSaveCancel() { - this.hookupButtonAddRowTable(); this.hookupButtonSave(); this.hookupButtonCancel(); this.toggleShowButtonsSaveCancel(false); @@ -2555,14 +2554,6 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) { button.classList.add(flagCollapsed); }); } - }, { - key: "hookupButtonAddRowTable", - value: function hookupButtonAddRowTable() { - var _this8 = this; - this.hookupEventHandler("click", idFormFilters + ' button.' + flagAdd, function (event, button) { - _this8.handleClickAddRowTable(event, button); - }); - } }, { key: "handleClickAddRowTable", value: function handleClickAddRowTable(event, button) { @@ -2591,14 +2582,14 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) { }, { key: "hookupTableMain", value: function hookupTableMain() { - var _this9 = this; + var _this8 = this; if (this.constructor === TableBasePage) { throw new Error("Must implement hookupTableMain() method."); } if (true) { // _rowBlank == null) { Events.initialiseEventHandler(idTableMain, flagInitialised, function (table) { - _this9.cacheRowBlank(); + _this8.cacheRowBlank(); }); } } @@ -2643,9 +2634,9 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) { }, { key: "hookupChangeHandlerTableCells", value: function hookupChangeHandlerTableCells(inputSelector) { - var _this10 = this; + var _this9 = this; var handler = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (event, element) { - _this10.handleChangeNestedElementCellTable(event, element); + _this9.handleChangeNestedElementCellTable(event, element); }; Events.initialiseEventHandler(inputSelector, flagInitialised, function (input) { input.addEventListener("change", function (event) { @@ -2789,9 +2780,9 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) { }, { key: "hookupChangeHandlerTableCellsWhenNotCollapsed", value: function hookupChangeHandlerTableCellsWhenNotCollapsed(inputSelector) { - var _this11 = this; + var _this10 = this; var handler = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (event, element) { - if (!element.classList.contains(flagCollapsed)) _this11.handleChangeNestedElementCellTable(event, element); + if (!element.classList.contains(flagCollapsed)) _this10.handleChangeNestedElementCellTable(event, element); }; this.hookupEventHandler("change", inputSelector, handler); } @@ -2871,10 +2862,10 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) { }, { key: "hookupFieldsActive", value: function hookupFieldsActive() { - var _this12 = this; + var _this11 = this; var flagTable = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; var handleClickRowNew = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (event, element) { - _this12.handleClickAddRowTable(event, element); + _this11.handleClickAddRowTable(event, element); }; var selectorButton = 'table' + (Validation.isEmpty(flagTable) ? '' : '.' + flagTable) + ' > tbody > tr > td.' + flagActive + ' button'; var selectorButtonDelete = selectorButton + '.' + flagDelete; @@ -2889,16 +2880,19 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) { }, { key: "hookupButtonsRowDelete", value: function hookupButtonsRowDelete(selectorButtonDelete, selectorButtonUndelete) { - var _this13 = this; + var _this12 = this; this.hookupEventHandler("click", selectorButtonDelete, function (event, element) { - _this13.handleClickButtonRowDelete(event, element, selectorButtonDelete, selectorButtonUndelete); + _this12.handleClickButtonRowDelete(event, element, selectorButtonDelete, selectorButtonUndelete); }); } }, { key: "handleClickButtonRowDelete", value: function handleClickButtonRowDelete(event, element, selectorButtonDelete, selectorButtonUndelete) { - // let row = DOM.getRowFromElement(element); + var row = DOM.getRowFromElement(element); // row.classList.add(flagDelete); + if (row.classList.contains(flagRowNew) && !DOM.hasDirtyChildrenContainer(row)) { + row.parentNode.removeChild(row); + } var buttonAdd = element.cloneNode(false); // document.createElement("button"); buttonAdd.classList.remove(flagInitialised); buttonAdd.classList.remove(flagDelete); @@ -2913,9 +2907,9 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) { }, { key: "hookupButtonsRowUndelete", value: function hookupButtonsRowUndelete(selectorButtonDelete, selectorButtonUndelete) { - var _this14 = this; + var _this13 = this; this.hookupEventHandler("click", selectorButtonUndelete, function (event, element) { - _this14.handleClickButtonRowUndelete(event, element, selectorButtonDelete, selectorButtonUndelete); + _this13.handleClickButtonRowUndelete(event, element, selectorButtonDelete, selectorButtonUndelete); }); } }, { @@ -2943,15 +2937,15 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) { }, { key: "hookupTableCellDdlPreviews", value: function hookupTableCellDdlPreviews(cellSelector, optionList) { - var _this15 = this; + var _this14 = this; var ddlHookup = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function (cellSelector) { - _this15.hookupTableCellDdls(cellSelector); + _this14.hookupTableCellDdls(cellSelector); }; var changeHandler = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : function (event, element) { - _this15.handleChangeNestedElementCellTable(event, element); + _this14.handleChangeNestedElementCellTable(event, element); }; this.hookupEventHandler("click", cellSelector, function (event, td) { - _this15.handleClickTableCellDdlPreview(event, td, optionList, cellSelector, function (cellSelector) { + _this14.handleClickTableCellDdlPreview(event, td, optionList, cellSelector, function (cellSelector) { ddlHookup(cellSelector, function (event, element) { changeHandler(event, element); }); @@ -2962,9 +2956,9 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) { }, { key: "hookupTableCellDdls", value: function hookupTableCellDdls(ddlSelector) { - var _this16 = this; + var _this15 = this; var changeHandler = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (event, element) { - _this16.handleChangeNestedElementCellTable(event, element); + _this15.handleChangeNestedElementCellTable(event, element); }; this.hookupEventHandler("change", ddlSelector, function (event, element) { changeHandler(event, element); @@ -2973,9 +2967,9 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) { }, { key: "handleClickTableCellDdlPreview", value: function handleClickTableCellDdlPreview(event, td, optionObjectList, cellSelector) { - var _this17 = this; + var _this16 = this; var ddlHookup = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : function (cellSelector) { - _this17.hookupTableCellDdls(cellSelector); + _this16.hookupTableCellDdls(cellSelector); }; if (td.querySelector('select')) return; // td.removeEventListener("click", ddlHookup); @@ -3036,14 +3030,14 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) { }, { key: "hookupTableCellDDlPreviewsWhenNotCollapsed", value: function hookupTableCellDDlPreviewsWhenNotCollapsed(cellSelector, optionList) { - var _this18 = this; + var _this17 = this; var ddlHookup = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function (event, element) { - _this18.hookupTableCellDdls(event, element); + _this17.hookupTableCellDdls(event, element); }; this.hookupEventHandler("click", cellSelector, function (event, td) { var div = td.querySelector('div'); if (!div || div.classList.contains(flagCollapsed)) return; - _this18.handleClickTableCellDdlPreview(event, td, optionList, cellSelector, function (event, element) { + _this17.handleClickTableCellDdlPreview(event, td, optionList, cellSelector, function (event, element) { ddlHookup(event, element); }); }); @@ -3051,9 +3045,9 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) { }, { key: "hookupProductCategoryDdls", value: function hookupProductCategoryDdls(ddlSelector) { - var _this19 = this; + var _this18 = this; this.hookupChangeHandlerTableCells(ddlSelector, function (event, element) { - _this19.handleChangeProductCategoryDdl(event, element); + _this18.handleChangeProductCategoryDdl(event, element); }); } }, { @@ -3087,15 +3081,15 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) { }, { key: "hookupPreviewsProductPermutationVariation", value: function hookupPreviewsProductPermutationVariation() { - var _this20 = this; + var _this19 = this; this.hookupEventHandler("click", idTableMain + ' td.' + flagProductVariations, function (event, element) { - return _this20.handleClickProductPermutationVariationsPreview(event, element); + return _this19.handleClickProductPermutationVariationsPreview(event, element); }); } }, { key: "handleClickProductPermutationVariationsPreview", value: function handleClickProductPermutationVariationsPreview(event, element) { - var _this21 = this; + var _this20 = this; var tblVariations = element.querySelector('table.' + flagProductVariations); if (!Validation.isEmpty(tblVariations)) return; this.toggleColumnCollapsed(flagProductVariations, false); @@ -3124,7 +3118,7 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) { var tbody = document.createElement("tbody"); if (!Validation.isEmpty(permutationVariations)) { permutationVariations.forEach(function (permutationVariation, index) { - _this21.addProductPermutationVariationRow(tbody, permutationVariation); + _this20.addProductPermutationVariationRow(tbody, permutationVariation); }); } tblVariations.appendChild(tbody); @@ -3280,13 +3274,13 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) { }, { key: "hookupButtonsProductPermutationVariationAddDelete", value: function hookupButtonsProductPermutationVariationAddDelete() { - var _this22 = this; + var _this21 = this; var selectorButton = idTableMain + ' td.' + flagProductVariations + ' tr.' + flagProductVariation + ' button'; var selectorButtonDelete = selectorButton + '.' + flagDelete; var selectorButtonUndelete = selectorButton + '.' + flagAdd; this.hookupButtonsRowDelete(selectorButtonDelete, selectorButtonUndelete, function (event, element) { - _this22.handleClickButtonRowDelete(event, element); - _this22.updateProductPermutationVariations(element); + _this21.handleClickButtonRowDelete(event, element); + _this21.updateProductPermutationVariations(element); }); this.hookupButtonsRowUndelete(selectorButtonDelete, selectorButtonUndelete); this.hookupButtonsProductPermutationVariationAdd(); @@ -3294,9 +3288,9 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) { }, { key: "hookupButtonsProductPermutationVariationAdd", value: function hookupButtonsProductPermutationVariationAdd() { - var _this23 = this; + var _this22 = this; this.hookupEventHandler("click", idTableMain + ' td.' + flagProductVariations + ' button.' + flagAdd, function (event, element) { - _this23.handleClickButtonProductPermutationVariationAdd(event, element); + _this22.handleClickButtonProductPermutationVariationAdd(event, element); }); } }, { diff --git a/static/js/pages/base_table.js b/static/js/pages/base_table.js index 01f89518..3cbcfacd 100644 --- a/static/js/pages/base_table.js +++ b/static/js/pages/base_table.js @@ -140,7 +140,6 @@ export default class TableBasePage extends BasePage { .catch(error => console.error('Error:', error)); } hookupButtonsAddSaveCancel() { - this.hookupButtonAddRowTable(); this.hookupButtonSave(); this.hookupButtonCancel(); this.toggleShowButtonsSaveCancel(false); @@ -216,9 +215,6 @@ export default class TableBasePage extends BasePage { button.classList.add(flagCollapsed); }); } - hookupButtonAddRowTable() { - this.hookupEventHandler("click", idFormFilters + ' button.' + flagAdd, (event, button) => { this.handleClickAddRowTable(event, button); }); - } handleClickAddRowTable(event, button) { event.stopPropagation(); _rowBlank.setAttribute(this.constructor.attrIdRowObject, -1 - _rowBlank.getAttribute(this.constructor.attrIdRowObject)); @@ -496,8 +492,11 @@ export default class TableBasePage extends BasePage { }); } handleClickButtonRowDelete(event, element, selectorButtonDelete, selectorButtonUndelete) { - // let row = DOM.getRowFromElement(element); + let row = DOM.getRowFromElement(element); // row.classList.add(flagDelete); + if (row.classList.contains(flagRowNew) && !DOM.hasDirtyChildrenContainer(row)) { + row.parentNode.removeChild(row); + } let buttonAdd = element.cloneNode(false); // document.createElement("button"); buttonAdd.classList.remove(flagInitialised); buttonAdd.classList.remove(flagDelete); diff --git a/templates/components/common/buttons/_buttons_save_cancel.html b/templates/components/common/buttons/_buttons_save_cancel.html index aa1383ab..512d65bb 100644 --- a/templates/components/common/buttons/_buttons_save_cancel.html +++ b/templates/components/common/buttons/_buttons_save_cancel.html @@ -3,7 +3,7 @@ {% elif block_id == 'button_cancel' %} {% elif block_id == 'button_add' %} - + {% elif block_id == 'button_confirm' %} {% elif block_id == 'button_get_in_touch' %} @@ -18,10 +18,12 @@ {% set block_id = 'button_apply_filters' %} {% include 'components/common/buttons/_buttons_save_cancel.html' %} -