From 88ccfe592ac41d6bbb2ddab0ededae7d53166d48 Mon Sep 17 00:00:00 2001 From: teddy Date: Mon, 11 Nov 2024 14:56:55 +0000 Subject: [PATCH] Feat(MySQL): Database population with data for Kitchen project. --- app.log.1 | 133 ++++++++------- app.log.2 | 112 +++++-------- app.log.3 | 122 +++++++++----- business_objects/address.py | 3 +- business_objects/store/plant.py | 2 +- business_objects/store/storage_location.py | 6 +- .../datastore_store_base.cpython-312.pyc | Bin 14359 -> 16909 bytes datastores/datastore_store_base.py | 69 +++++++- .../model_view_store.cpython-312.pyc | Bin 26830 -> 27355 bytes ...odel_view_store_stock_item.cpython-312.pyc | Bin 6142 -> 6407 bytes models/model_view_store.py | 6 + models/model_view_store_stock_item.py | 4 + static/MySQL/0000_combine.sql | 158 +++++++++++++++--- .../7109_p_shop_get_many_storage_location.sql | 2 +- ...212_p_shop_save_product_variation_test.sql | 2 +- static/MySQL/9000_populate.sql | 72 ++++++++ static/css/layouts/table-main.css | 6 + static/css/main.css | 1 - static/css/pages/store/stock_items.css | 24 +-- static/dist/css/main.bundle.css | 7 +- static/dist/css/store_stock_items.bundle.css | 24 +-- static/dist/js/main.bundle.js | 68 ++++---- static/js/pages/base_table.js | 4 +- static/js/pages/store/product_permutations.js | 5 +- static/js/pages/store/stock_items.js | 39 +++-- templates/pages/store/_stock_items.html | 2 + 26 files changed, 591 insertions(+), 280 deletions(-) diff --git a/app.log.1 b/app.log.1 index bdcc17d9..c8827163 100644 --- a/app.log.1 +++ b/app.log.1 @@ -1,10 +1,9 @@ -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 +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/permutations +Referer: http://127.0.0.1:5000/store/stock_items Dnt: 1 Connection: keep-alive Cookie: session=.eJytVlnzokgS_yoTRsw8tTY3-I_omPUCRUFB5HohCgqkuOUQcba_-xba090PM3tErKFYVZlk_rLy_GMCujYua9SE8NKE9eTjj0kACg_AHBVe05Z1OPlo6y789NNx92J8n4Y5QNnkYxLCHtRwliMIs7AtiyZHbfyP60idBWU--TSJUN20BcixwIkRQjjgMwS9oKvrsAgGD4YR6LJ28lF0WfYi1eEVlcVfEN4AyO9rbzSCwHJf___kWIHy52wgzFlIzAFP-IAkojAaFTbeC7F3D2sUoRBOPiKQNeGLgoog62AIPXNh_ND6thOTm67Cqn42vunqbwYpf9o9PY-GT77i-2rqyGvLNCwwXRB4GvoszUOf8Sma4aM5iCDPBYAGfsBAjgwYBkQjxO6bG0AQhE3zXUI4yLEvBeiI5BTYO3RYyZmfK-N-qSQXSidUdYd6BGz1uUtKBLY6EWwV7jDMU9d2Wr-AMXjuejVxMzdxy6OUMT5iyWBgY2jrpbJiE58i7ruCmM2yYR07BymE20hQltPHzAY9BQ5hOOzkRxAuTpDfXPcBf1k5WqwkR7Pzbmia7hQa3oZpxisnehCEqiwqLNObAzdvJG9nZ-fl9rjyjuyFcKfF5tjXTqG5BwJJ0cUs_eXtcSMYLQMFeZUOmmYe2cUmhsxG7rWkCfa5LW7OMbewDZgF5Wmf7kuFAVAMH1YfXwGFhFt89_VrMqUV0hC0Y5prvM3Ep6FYnWMPLabZahk3tkPvXdJJ85vqhY7DlGtIOf0wn9bLpa4_uav0kM3W8LeOH9JFGCy1WFRvuju9IQSyA9_4oi2ea49doPVD3YBeXhUaH2e6mapphD8VEDtVX9erjXNMTnpJ80fBuSnlNmF4Mr1uzQXTi8fDvCr4mamrZsoB1ScEw7rtnXK7aOMrDoPwUaE6bDyAQ5DkaYKlBZ4hfpwjHBQCxxDEKwv-IkrOl-eOVNG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lKydDeVMVaxWf0uB15Stee5tbCFy_LOL8n_8sI8jetH5fUd41lBIFmxrHiz6LLsNT7oGmwgrhtq-bj82cY3qdFD1KK4Lgw4mIBPYpZ18xe08eo6jPW9W0w-M-gChSk_455ZCmLYKSb10elci6emOq2bhLpRho9JlcoaLtxUPuOsJlda3AHLahfcN7LzywN6YhiGIKHLMXykcBEFB8AgsedxYcc83vzhRGI3-ov1fU3-OUl61d68Ssl4m8Aix_24f1bZINXIZxVxcvjaHRYP92vSu1eP1B99N3-6nGi0ZqFkniVTEaHF2Pn_zezWldB0OJpbHTGhCIoZkqSU4I0iPkHSX1QxIyjGHfy9evXfwErYp4O.ZySbdA.IOzQ4B0k8HNh-01pbYKqF3sN8jI @@ -19,64 +18,86 @@ 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\sqlalchemy\engine\base.py", line 1967, in _exec_single_context + self.dialect.do_execute( + File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\default.py", line 924, in do_execute + cursor.execute(statement, parameters) + File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\MySQLdb\cursors.py", line 179, in execute + res = self._query(mogrified_query) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\MySQLdb\cursors.py", line 330, in _query + db.query(q) + File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\MySQLdb\connections.py", line 261, in query + _mysql.connection.query(self, query) +MySQLdb.OperationalError: (1054, "Unknown column 'SL.id_storage_location' in 'field list'") + +The above exception was the direct cause of the following exception: + +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\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' + 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 93, in __init__ + self.storage_locations = self.get_many_storage_location(False) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\models\model_view_store.py", line 499, in get_many_storage_location + storage_locations = DataStore_Store_Base().get_many_storage_location(get_inactive) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\datastores\datastore_store_base.py", line 236, in get_many_storage_location + result = self.db_procedure_execute(_m_db_storage_location, argument_dict_list_storage_location) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\datastores\datastore_base.py", line 95, in db_procedure_execute + result = db.session.execute(proc_string, argument_dict_list) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\orm\scoping.py", line 778, in execute + return self._proxied.execute( + ^^^^^^^^^^^^^^^^^^^^^^ + File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\orm\session.py", line 2351, in execute + return self._execute_internal( + ^^^^^^^^^^^^^^^^^^^^^^^ + File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\orm\session.py", line 2245, in _execute_internal + result = conn.execute( + ^^^^^^^^^^^^^ + File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 1418, in execute + return meth( + ^^^^^ + File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\sql\elements.py", line 515, in _execute_on_connection + return connection._execute_clauseelement( + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 1640, in _execute_clauseelement + ret = self._execute_context( + ^^^^^^^^^^^^^^^^^^^^^^ + File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 1846, in _execute_context + return self._exec_single_context( + ^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 1986, in _exec_single_context + self._handle_dbapi_exception( + File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 2353, in _handle_dbapi_exception + raise sqlalchemy_exception.with_traceback(exc_info[2]) from e + File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 1967, in _exec_single_context + self.dialect.do_execute( + File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\default.py", line 924, in do_execute + cursor.execute(statement, parameters) + File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\MySQLdb\cursors.py", line 179, in execute + res = self._query(mogrified_query) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\MySQLdb\cursors.py", line 330, in _query + db.query(q) + File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\MySQLdb\connections.py", line 261, in query + _mysql.connection.query(self, query) +sqlalchemy.exc.OperationalError: (MySQLdb.OperationalError) (1054, "Unknown column 'SL.id_storage_location' in 'field list'") +[SQL: CALL p_shop_get_many_storage_location(%s)] +[parameters: (0,)] +(Background on this error at: https://sqlalche.me/e/20/e3q8) 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 -Cookie: session=.eJytVlnzokgS_yoTRsw8tTY3-I_omPUCRUFB5HohCgqkuOUQcba_-xba090PM3tErKFYVZlk_rLy_GMCujYua9SE8NKE9eTjj0kACg_AHBVe05Z1OPlo6y789NNx92J8n4Y5QNnkYxLCHtRwliMIs7AtiyZHbfyP60idBWU--TSJUN20BcixwIkRQjjgMwS9oKvrsAgGD4YR6L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ldB0OJpbHTGhCIoZkqSU4I0iPkHSX1QxIyjGHfy9evXfwErYp4O.ZySbdA.IOzQ4B0k8HNh-01pbYKqF3sN8jI -Upgrade-Insecure-Requests: 1 -Sec-Fetch-Dest: document -Sec-Fetch-Mode: navigate -Sec-Fetch-Site: same-origin -Sec-Fetch-User: ?1 -Sec-Gpc: 1 -Priority: u=0, i - - -Request data: b'' +Server Error: (MySQLdb.OperationalError) (1054, "Unknown column 'SL.id_storage_location' in 'field list'") +[SQL: CALL p_shop_get_many_storage_location(%s)] +[parameters: (0,)] +(Background on this error at: https://sqlalche.me/e/20/e3q8) diff --git a/app.log.2 b/app.log.2 index a350eac3..419f8830 100644 --- a/app.log.2 +++ b/app.log.2 @@ -1,57 +1,10 @@ -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\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 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\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 -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 +Server Error: 'NoneType' object has no attribute 'to_json' +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/permutations +Referer: http://127.0.0.1:5000/store/stock_items Dnt: 1 Connection: keep-alive Cookie: session=.eJytVlnzokgS_yoTRsw8tTY3-I_omPUCRUFB5HohCgqkuOUQcba_-xba090PM3tErKFYVZlk_rLy_GMCujYua9SE8NKE9eTjj0kACg_AHBVe05Z1OPlo6y789NNx92J8n4Y5QNnkYxLCHtRwliMIs7AtiyZHbfyP60idBWU--TSJUN20BcixwIkRQjjgMwS9oKvrsAgGD4YR6LJ28lF0WfYi1eEVlcVfEN4AyO9rbzSCwHJf___kWIHy52wgzFlIzAFP-IAkojAaFTbeC7F3D2sUoRBOPiKQNeGLgoog62AIPXNh_ND6thOTm67Cqn42vunqbwYpf9o9PY-GT77i-2rqyGvLNCwwX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W6NiA9jxw3jim8pEzkxjW7PE7JxW3CVPxxJUObaGjsmGVp4LAvvgqa43I15mDDjFCJ7KWmOOa4VQMM6ANtGoA-siwHopqMmFUfIdq1oKczTMVFlnsfpcIsfY9G5u5q_YoLIXLjiQB42a67CQGWDLJyeraJcUKD3TCTNnVZDN-3Mi5gYOfoyrw3GZvOIpc4twuzyqWUUGhTzArfwEKXwopk6PpY5Y0ftSbp4N78ie3YpSRjuNtKF2REzu-ao-S_paR5vBH7RtqnJSdMYu4pfirlxCkzUXIHxKp1ogqelq6kVRcjuTlFzsiUQPs3XkWNJpfbBbfi8AckvkLmE0XlFFmtXpzVEn6bO5BzVdbC3y0TgU0THzm8F14uZeMqIBVHqeeO5GmhtHK6UYQyCHRcI30y6trekuue0HizkfdG5FMEkxZzyRmMY6cuim5S7DihrurFwXSb8ZiL1U-CIuyYfFpRZYjznQvtCtuRNvIunsOewRy3oKnV4fUL9cZXsqOxfafNke79Hl_mgAjFJyoWngXq7tYR-ZnPpQROoiOMF0X516m1tSJojP7F0HvGSO9asJymrsjPhZIPhLVZcRysJf3vPCp8mrYHnt8OJZhqDGTe_d-1ARla_-1-HmPLlKydDeVMVaxWf0uB15Stee5tbCFy_LOL8n_8sI8jetH5fUd41lBIFmxrHiz6LLsNT7oGmwgrhtq-bj82cY3qdFD1KK4Lgw4mIBPYpZ18xe08eo6jPW9W0w-M-gChSk_455ZCmLYKSb10elci6emOq2bhLpRho9JlcoaLtxUPuOsJlda3AHLahfcN7LzywN6YhiGIKHLMXykcBEFB8AgsedxYcc83vzhRGI3-ov1fU3-OUl61d68Ssl4m8Aix_24f1bZINXIZxVxcvjaHRYP92vSu1eP1B99N3-6nGi0ZqFkniVTEaHF2Pn_zezWldB0OJpbHTGhCIoZkqSU4I0iPkHSX1QxIyjGHfy9evXfwErYp4O.ZySbdA.IOzQ4B0k8HNh-01pbYKqF3sN8jI @@ -72,26 +25,45 @@ 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_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'? + File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\controllers\store\stock_item.py", line 45, in stock_items + return render_template('pages/store/_stock_items.html', model = model, datetime = datetime) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 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\_stock_items.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\_stock_items.html", line 119, in block 'page_body' + var plants = {{ model.convert_list_objects_to_dict_json_by_attribute_key_default(model.plants) | tojson | safe }}; + ^^^^^^^^^^^^^^^^^^^^^^^^^ + 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\plant.py", line 79, in to_json + self.FLAG_ADDRESS: None if self.address is None else self.address.to_json(), + ^^^^^^^^^^^^^^^^^^^^^^ + File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\business_objects\address.py", line 85, in to_json + self.FLAG_REGION: self.region.to_json(), + ^^^^^^^^^^^^^^^^^^^ +AttributeError: 'NoneType' object has no attribute 'to_json' config_env: development config_env: development -config_env: development +Server Error: (MySQLdb.OperationalError) (1054, "Unknown column 'SL.id_storage_location' in 'field list'") +[SQL: CALL p_shop_get_many_storage_location(%s)] +[parameters: (0,)] +(Background on this error at: https://sqlalche.me/e/20/e3q8) diff --git a/app.log.3 b/app.log.3 index 76228d2a..c7267aae 100644 --- a/app.log.3 +++ b/app.log.3 @@ -1,11 +1,60 @@ +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\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 134, 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 168, in top-level template code + {% set active = variation_type.active %} + ^^^^^^^^^^^^^^^^^^^^^^^^^ + 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: 'variation_type' is undefined + +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 +Server Error: 'NoneType' object has no attribute 'to_json' 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/stock_items 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-AMXjuejVxMzdxy6OUMT5iyWBgY2jrpbJiE58i7ruCmM2yYR07BymE20hQltPHzAY9BQ5hOOzkRx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WUUGhTzArfwEKXwopk6PpY5Y0ftSbp4N78ie3YpSRjuNtKF2REzu-ao-S_paR5vBH7RtqnJSdMYu4pfirlxCkzUXIHxKp1ogqelq6kVRcjuTlFzsiUQPs3XkWNJpfbBbfi8AckvkLmE0XlFFmtXpzVEn6bO5BzVdbC3y0TgU0THzm8F14uZeMqIBVHqeeO5GmhtHK6UYQyCHRcI30y6trekuue0HizkfdG5FMEkxZzyRmMY6cuim5S7DihrurFwXSb8ZiL1U-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 @@ -24,44 +73,37 @@ 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\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 + File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\controllers\store\stock_item.py", line 45, in stock_items + return render_template('pages/store/_stock_items.html', model = model, datetime = datetime) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 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\_stock_items.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\_stock_items.html", line 119, in block 'page_body' + var plants = {{ model.convert_list_objects_to_dict_json_by_attribute_key_default(model.plants) | tojson | safe }}; + ^^^^^^^^^^^^^^^^^^^^^^^^^ + 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\plant.py", line 79, in to_json + self.FLAG_ADDRESS: self.address.to_json(), + ^^^^^^^^^^^^^^^^^^^^ +AttributeError: 'NoneType' object has no attribute 'to_json' config_env: development -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/permutations -Dnt: 1 -Connection: keep-alive -Cookie: session=.eJytVlnzokgS_yoTRsw8tTY3-I_omPUCRUFB5HohCgqkuOUQcba_-xba090PM3tErKFYVZlk_rLy_GMCujYua9SE8NKE9eTjj0kACg_AHBVe05Z1OPlo6y789NNx92J8n4Y5QNnkYxLCHtRwliMIs7AtiyZHbfyP60idBWU--TSJUN20BcixwIkRQjjgMwS9oKvrsAgGD4YR6LJ28lF0WfYi1eEVlcVfEN4AyO9rbzSCwHJf___kWIHy52wgzFlIzAFP-IAkojAaFTbeC7F3D2sUoRBOPiKQNeGLgoog62AIPXNh_ND6thOTm67Cqn42vunqbwYpf9o9PY-GT77i-2rqyGvLNCwwXRB4GvoszUOf8Sma4aM5iCDPBYAGfsBAjgwYBkQjxO6bG0AQhE3zXUI4yLEvBeiI5BTYO3RYyZmfK-N-qSQXSidUdYd6BGz1uUtKBLY6EWwV7jDMU9d2Wr-AMXjuejVxMzdxy6OUMT5iyWBgY2jrpbJiE58i7ruCmM2yYR07BymE20hQltPHzAY9BQ5hOOzkRxAuTpDfXPcBf1k5WqwkR7Pzbmia7hQ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4N78ie3YpSRjuNtKF2REzu-ao-S_paR5vBH7RtqnJSdMYu4pfirlxCkzUXIHxKp1ogqelq6kVRcjuTlFzsiUQPs3XkWNJpfbBbfi8AckvkLmE0XlFFmtXpzVEn6bO5BzVdbC3y0TgU0THzm8F14uZeMqIBVHqeeO5GmhtHK6UYQyCHRcI30y6trekuue0HizkfdG5FMEkxZzyRmMY6cuim5S7DihrurFwXSb8ZiL1U-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 -Sec-Fetch-Mode: navigate -Sec-Fetch-Site: same-origin -Sec-Fetch-User: ?1 -Sec-Gpc: 1 -Priority: u=0, i - - -Request data: b'' diff --git a/business_objects/address.py b/business_objects/address.py index feda3839..6805fb66 100644 --- a/business_objects/address.py +++ b/business_objects/address.py @@ -54,6 +54,7 @@ class Address(db.Model, Base): address = cls() address.id_address = query_row[1] address.id_region = query_row[2] + return address @classmethod def from_DB_stock_item(cls, query_row): address = cls() @@ -81,7 +82,7 @@ class Address(db.Model, Base): return { **self.get_shared_json_attributes(self), self.ATTR_ID_ADDRESS: self.id_address, - self.FLAG_REGION: self.region.to_json(), + self.FLAG_REGION: None if self.region is None else self.region.to_json(), self.FLAG_POSTCODE: self.postcode, self.FLAG_ADDRESS_LINE_1: self.address_line_1, self.FLAG_ADDRESS_LINE_2: self.address_line_2, diff --git a/business_objects/store/plant.py b/business_objects/store/plant.py index d48cd297..17d506f9 100644 --- a/business_objects/store/plant.py +++ b/business_objects/store/plant.py @@ -76,7 +76,7 @@ class Plant(db.Model, Store_Base): self.ATTR_ID_PLANT: self.id_plant, self.FLAG_CODE: self.code, self.FLAG_NAME: self.name, - self.FLAG_ADDRESS: self.address.to_json(), + self.FLAG_ADDRESS: None if self.address is None else self.address.to_json(), self.ATTR_ID_USER_MANAGER: self.id_user_manager, self.FLAG_ACTIVE: 1 if av.input_bool(self.active, self.FLAG_ACTIVE, f'{self.__class__.__name__}.to_json') else 0 } diff --git a/business_objects/store/storage_location.py b/business_objects/store/storage_location.py index d1831f4e..61a3fb8f 100644 --- a/business_objects/store/storage_location.py +++ b/business_objects/store/storage_location.py @@ -43,9 +43,9 @@ class Storage_Location(db.Model, Store_Base): location.id_location = query_row[0] location.id_plant = query_row[1] location.plant = Plant.from_DB_storage_location(query_row) - location.code = query_row[2] - location.name = query_row[3] - location.active = query_row[4] + location.code = query_row[4] + location.name = query_row[5] + location.active = query_row[6] return location @classmethod def from_DB_stock_item(cls, query_row): diff --git a/datastores/__pycache__/datastore_store_base.cpython-312.pyc b/datastores/__pycache__/datastore_store_base.cpython-312.pyc index dad97b7c8292acbce38000847170b0fd429b9c67..1c69cf606ff9f96348c75cd106354e567534acca 100644 GIT binary patch delta 4115 zcmds4eP|o!8NZV(`K)hQ-;Ta5*;Z`Jj&0eAV>|wele9^iF6kJTjYH909C>$=^PZg6 znT!h!t40?}_Ck}5L6?6vhh!bWY=mymu|G!H3X^b(&5?AWWn+UeOw&OZ2HpFdWXD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yn*??YzzNVup=?QGDV3LmsX|7?JAobt*a7g!oVds-hkyQP3TIMzDjnVj z`NoVWYZX-Sp^A%t)bWmUKylNdHs=?t_-TPQOODGi_K zaxiS&U7ge5xu>VrDp;%C8s{>&);MadMu8*CBdtz2!dkIVvTPItF_#vEvTu3RRr+P5 z5s~K6pv49uc7Pi4+-Q*gjbumLw$)Lh%uN>5Ojc4=AvgK5l+LT+f+}HL55Zdi91zvM zJnAO)gpt^jW)^hEPU27Y?smaqgP6*v)O?QW65cR{$rP>QhIM*l=cTL)w*YPcqJCPE z=}A(AXqhzGc!_I zms86IEeHE4j{^Wfh%n8}im5D>3^xJS3>-_(GW`p|Ex4T diff --git a/datastores/datastore_store_base.py b/datastores/datastore_store_base.py index 30a1da23..d9a8e5b9 100644 --- a/datastores/datastore_store_base.py +++ b/datastores/datastore_store_base.py @@ -20,9 +20,11 @@ from business_objects.store.delivery_option import Delivery_Option from business_objects.region import Region from business_objects.store.discount import Discount from business_objects.store.order import Order +from business_objects.store.plant import Plant from business_objects.store.product import Product, Product_Permutation, Parameters_Product from business_objects.sql_error import SQL_Error from business_objects.store.stock_item import Stock_Item +from business_objects.store.storage_location import Storage_Location from business_objects.user import User, User_Filters, User_Permission_Evaluation from business_objects.store.product_variation import Product_Variation, Parameters_Product_Variation from business_objects.store.product_variation_type import Product_Variation_Type @@ -194,13 +196,66 @@ class DataStore_Store_Base(DataStore_Base): index_comma = msg_error_availability.find(',') ids_permutation.append(msg_error_availability[:index_comma]) return ids_permutation + @classmethod - def get_many_currency(cls): + def get_many_plant(cls, get_inactive = False): + _m = 'DataStore_Store_Base.get_many_plant' + _m_db_plant = 'p_shop_get_many_plant' + + argument_dict_list_plant = { + 'a_get_inactive_plant': 1 if get_inactive else 0 + } + + Helper_App.console_log(f'executing {_m_db_plant}') + result = cls.db_procedure_execute(_m_db_plant, argument_dict_list_plant) + cursor = result.cursor + Helper_App.console_log('data received') + + # cursor.nextset() + result_set_1 = cursor.fetchall() + plants = [] + for row in result_set_1: + plant = Plant.from_DB_plant(row) + plants.append(plant) + Helper_App.console_log(f'plants: {plants}') + DataStore_Store_Base.db_cursor_clear(cursor) + cursor.close() + + return plants + + @classmethod + def get_many_storage_location(self, get_inactive = False): + _m = 'DataStore_Store_Base.get_many_storage_location' + _m_db_storage_location = 'p_shop_get_many_storage_location' + + argument_dict_list_storage_location = { + 'a_get_inactive_storage_location': 1 if get_inactive else 0 + } + + Helper_App.console_log(f'executing {_m_db_storage_location}') + result = self.db_procedure_execute(_m_db_storage_location, argument_dict_list_storage_location) + cursor = result.cursor + Helper_App.console_log('data received') + + # cursor.nextset() + result_set_1 = cursor.fetchall() + storage_locations = [] + for row in result_set_1: + storage_location = Storage_Location.from_DB_storage_location(row) + storage_locations.append(storage_location) + Helper_App.console_log(f'storage_locations: {storage_locations}') + DataStore_Store_Base.db_cursor_clear(cursor) + cursor.close() + + return storage_locations + + @classmethod + def get_many_currency(cls, get_inactive = False): _m = 'DataStore_Store_Base.get_many_currency' _m_db_currency = 'p_shop_get_many_currency' argument_dict_list_currency = { - 'a_get_inactive_currency': 0 + 'a_get_inactive_currency': 1 if get_inactive else 0 } Helper_App.console_log(f'executing {_m_db_currency}') @@ -220,12 +275,12 @@ class DataStore_Store_Base(DataStore_Base): return currencies @classmethod - def get_many_region(cls): + def get_many_region(cls, get_inactive = False): _m = 'DataStore_Store_Base.get_many_region' _m_db_region = 'p_shop_get_many_region' argument_dict_list_region = { - 'a_get_inactive_currency': 0 + 'a_get_inactive_region': 1 if get_inactive else 0 } Helper_App.console_log(f'executing {_m_db_region}') @@ -246,10 +301,10 @@ class DataStore_Store_Base(DataStore_Base): return regions @classmethod - def get_many_region_and_currency(cls): + def get_many_region_and_currency(cls, get_inactive_currency = False, get_inactive_region = False): _m = 'DataStore_Store_Base.get_many_region_and_currency' - currencies = cls.get_many_currency() - regions = cls.get_many_region() + currencies = cls.get_many_currency(get_inactive_currency) + regions = cls.get_many_region(get_inactive_region) return regions, currencies @classmethod diff --git a/models/__pycache__/model_view_store.cpython-312.pyc b/models/__pycache__/model_view_store.cpython-312.pyc index 6ae5e9ecd4f7bbabf9bb6d1fe471bd524327c5c0..3497bac443cb903606fe0a6c1247aa3d39b842b5 100644 GIT binary patch delta 620 zcmX?ik@5CbM!wU$yj%=GV9aHdzOrs19}8pNW`34`f{e!}^NFeZo=Dl-!WgwMWnT+J z)S{IAKyq=)0U)^~2PtxTIu4SrW3T7yJ4|IVhQxPAKy2Y2CS`wd|m{%EJ zkdv5KqRCve86?aD63)y^OfJbROTEPgmMbo121+R?C=_i0(nY3>3=CEBllAqal|VY* z1G&XgK#2y1JA$g01=X($nq3q$+fZ{^(4~WIvb>%69}EyX4IMTzOD z@j3a)i6xo&c~EB+nE@@iC5SGI<}gc;!?b`7lQKnD`3dAm8Hgig3@*zUU6=8>DC2V? z=CVxG1rEs@{0bL16ee?qNKY;Zs${g8{3=MD@#|!v;0EhO!r>rURYyWAe-3 zjj|3v;UZg*sVHIN1X8UFQa$-%h%n>t%}+y|7+G9_qLTv*RVMp~aWej&92pkR!sw>C zX7kRl3T9D|tBY(v1jwo)kO@VulWn4m8KX8AMA>umeCAiq}Yp6(=+q)K25$Kx>42=C|qO)B#N1V zPEt@%DB1#~i>yJabwR2p9}g2|{JQyem=hzT-DJ541IC||{UhQTS8d)DQNhd&G8U}5 v$ZoQIj4@-t=HeK8Zl+H>oA;$}Vq%P+T$mLp7{tzKJfZ$81Bfo#1~eZ4nx0q_ diff --git a/models/__pycache__/model_view_store_stock_item.cpython-312.pyc b/models/__pycache__/model_view_store_stock_item.cpython-312.pyc index 4d82ac2c471c8ce4cbd921293f1ff6e5fd6b83e6..4e4b47d6fd94e7f753b6ef96f4296948f310bc70 100644 GIT binary patch delta 740 zcmZ8eO=uHA7~R?I#x?0~n&xM_oBky=)g{4{_L4(u1xt!TTUsfEfQ%toV``F(vs-AT zXpw?Bh)4&#dl985NDdynh@c14LrW|vd-dwU--8~+nGHzsJG_10_h#PvnEjKwHzBq} z(Zi6EJrkwQOYs%UdH{aUJ{d29oL?7oz9>!+nRISadjvm^KlAHj#N+p4=>$=58?_M4W0@+BQsj6&Wj8#S}J z%q0Ox;5+;oRyxsq#y@a#o6PDGek=qO?=I+uZZc5oGKL}Q3RT79Y67QvCb^!4Tc=3o z0KVJv$d%EOO;yYS_aM262JpHxEUSdtzOo6|YGn%=*PvCd>L`L=NaGi5sia%5ny+m@ zXIs=y4=ewM|F4b|qH8`hLOv)&A&x&wZ@p1U69l@uND!837)+6oxzhaPlU<3A!r)O@ z?S!?1u=X_G4v#mu``)8yyc3-{h|av>+tEyeI~0a~eT(k|hLuU-15oGFLTk)FKh3q$ z9KpTQ@&b#~ftE5$jX44%q>vN8OyiTzQ>25v0OE_mNnw->wFp|m+rfGm4Ui7er?G`P zGU__AHc)IQG&V<9x4nf*-ZZPab=@c;>Sl`&I=RyyyHW$OMLzf26@^j$JRlvCYUs;yVg6}Rue>fD4He=zN nKpm!jbZ5u@w=h*Tifa}99J+y@%hSOO09mjfoA}8%%sKfNjhel? delta 488 zcmZoS`lru(nwOW00SKn8R!CRa$h)11=^ex5V@%6LQUz0ZTNqY@(YJ!R8eL;>>JUIb?r+ zQk?usSYDEy;}oNmFAv9QH9=oNmeUq2K=O>bxUbk`C6Uu24j@e|KtcfsiomA%O=c7| zWQ?9{ENaZ52$a#3Eb^V4CtARBi=&_@zaX`!q_Rk1@)uDxcTJ$|E$-x;#Ny)I)RK(+ zlp;Tn2yc8mSS&d;Cnr8$ld;GfC|b-2Bpe_%2mqNyAVLNtv0-wenE&LXVxF=(tTBuq zVi+0N1V1t{u|_a{W(G39fSE;#o3+IY8Kq=FT0yP?oAisrCO1E&G$+-rD1Gua30n~- RM#c!n3ra>`8Ne*CN&tH=d3*o> diff --git a/models/model_view_store.py b/models/model_view_store.py index 73229dab..81ddc2e9 100644 --- a/models/model_view_store.py +++ b/models/model_view_store.py @@ -492,6 +492,12 @@ class Model_View_Store(Model_View_Base): # validation conducted by server return DataStore_User().get_many_user_order(self.info_user['sub'], ids_order, n_order_max, id_checkout_session) + def get_many_plant(self, get_inactive = False): + plants = DataStore_Store_Base().get_many_plant(get_inactive) + return plants + def get_many_storage_location(self, get_inactive = False): + storage_locations = DataStore_Store_Base().get_many_storage_location(get_inactive) + return storage_locations def get_many_currency(self): currencies = DataStore_Store_Base().get_many_currency() return currencies diff --git a/models/model_view_store_stock_item.py b/models/model_view_store_stock_item.py index 74b7b237..e79f38ec 100644 --- a/models/model_view_store_stock_item.py +++ b/models/model_view_store_stock_item.py @@ -33,6 +33,8 @@ class Model_View_Store_Stock_Item(Model_View_Store): filters_stock_item: Filters_Stock_Item form_filters: Filters_Stock_Item = None list_options_product: list = None + plants: list = None + storage_locations: list = None units_measurement: list = None units_measurement_time: list = None variations: list = None @@ -87,6 +89,8 @@ class Model_View_Store_Stock_Item(Model_View_Store): 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] + self.plants = self.get_many_plant(False) + self.storage_locations = self.get_many_storage_location(False) @classmethod def save_stock_items(cls, comment, list_stock_items): diff --git a/static/MySQL/0000_combine.sql b/static/MySQL/0000_combine.sql index 6f9ae521..9d4b5402 100644 --- a/static/MySQL/0000_combine.sql +++ b/static/MySQL/0000_combine.sql @@ -173,10 +173,14 @@ DROP TABLE IF EXISTS Shop_Variation_Audit; DROP TABLE IF EXISTS Shop_Variation; DROP TABLE IF EXISTS Shop_Product_Variation_Type_Link_Audit; DROP TABLE IF EXISTS Shop_Product_Variation_Type_Link; +DROP TABLE IF EXISTS Shop_Product_Variation_Temp; +DROP TABLE IF EXISTS Shop_Product_Variation; DROP TABLE IF EXISTS Shop_Variation_Type_Temp; DROP TABLE IF EXISTS Shop_Variation_Type_Audit; DROP TABLE IF EXISTS Shop_Variation_Type; +DROP TABLE IF EXISTS Shop_Product_Variation_Type_Temp; +DROP TABLE IF EXISTS Shop_Product_Variation_Type; DROP TABLE IF EXISTS Shop_Product_Permutation_Temp; DROP TABLE IF EXISTS Shop_Product_Permutation_Audit; @@ -1475,9 +1479,9 @@ CREATE TABLE IF NOT EXISTS Shop_Variation_Type_Audit ( SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Variation_Type_Temp'; CREATE TABLE IF NOT EXISTS Shop_Variation_Type_Temp ( - id_temp INT NOT NULL PRIMARY KEY + id_temp INT NOT NULL PRIMARY KEY AUTO_INCREMENT , id_type INT NOT NULL - , id_type_temp INT NOT NULL + -- , id_type_temp INT NOT NULL , code VARCHAR(50) , name VARCHAR(255) , name_plural VARCHAR(256) @@ -1536,10 +1540,12 @@ CREATE TABLE IF NOT EXISTS Shop_Variation_Audit ( # Variations Temp +-- DROP TABLE partsltd_prod.Shop_Variation_Temp; + SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Variation_Temp'; CREATE TABLE Shop_Variation_Temp ( - id_temp INT NOT NULL PRIMARY KEY + id_temp INT NOT NULL PRIMARY KEY AUTO_INCREMENT , id_variation INT NOT NULL , id_type INT NOT NULL , code VARCHAR(50) @@ -11219,10 +11225,10 @@ DELIMITER ;; CALL p_shop_get_many_product_variation ( 1 # 'auth0|6582b95c895d09a70ba10fef', # a_id_user , 1 # a_get_all_variation_type - , 0 # a_get_inactive_variation_type + , 1 # a_get_inactive_variation_type , '' # a_ids_variation_type , 1 # a_get_all_variation - , 0 # a_get_inactive_variation + , 1 # a_get_inactive_variation , '' # a_ids_variation , 0 # a_debug ); @@ -11613,6 +11619,8 @@ BEGIN ; END IF; + -- Duplicate Variation Type Ids + -- Duplicate Variation Ids -- Duplicate Variation Type Codes -- Duplicate Variation Codes @@ -11683,7 +11691,7 @@ BEGIN -- Transaction IF NOT EXISTS (SELECT * FROM tmp_Msg_Error) THEN START TRANSACTION; - INSERT INTO Shop_Sales_And_Purchasing_Change_Set ( + INSERT INTO Shop_Product_Change_Set ( comment , updated_last_by , updated_last_on @@ -11768,6 +11776,7 @@ BEGIN , VT.display_order = t_VT.display_order , VT.created_on = t_VT.created_on , VT.created_by = t_VT.created_by + , VT.id_change_set = v_id_change_set ; UPDATE partsltd_prod.Shop_Variation V @@ -11781,6 +11790,7 @@ BEGIN , V.display_order = t_V.display_order , V.created_on = t_V.created_on , V.created_by = t_V.created_by + , V.id_change_set = v_id_change_set ; DELETE VT_T @@ -11853,7 +11863,7 @@ BEGIN INSERT INTO partsltd_prod.Shop_Variation_Type_Temp ( id_type - , id_type_temp + -- , id_type_temp , code , name , name_plural @@ -11861,10 +11871,10 @@ BEGIN , active , GUID ) - /* Test 1 - Insert */ + /* Test 1 - Insert VALUES ( -1 - , -1 + -- , -1 , 'SIZE' , 'Size' , 'Sizes' @@ -11872,11 +11882,19 @@ BEGIN , 1 , v_guid ) - /* Test 2: Alter - SELECT - FROM partsltd_prod.Shop_Variation_Type - WHERE id_order = 6 */ + /* Test 2: Alter */ + SELECT + id_type + -- , id_type AS id_type_temp + , code + , name + , name_plural + , display_order + , active + , v_guid AS GUID + FROM partsltd_prod.Shop_Variation_Type + WHERE id_type = 1 ; INSERT INTO partsltd_prod.Shop_Variation_Temp ( @@ -11888,7 +11906,7 @@ BEGIN , active , GUID ) - /* Test 1 - Insert */ + /* Test 1 - Insert VALUES ( -1 -- id_variation , -1 -- id_type @@ -11898,11 +11916,38 @@ BEGIN , 1 -- active , v_guid -- ) - /* Test 2: Alter - SELECT - FROM partsltd_prod.Shop_Variation - WHERE id_order = 6 */ + /* Test 3 - Insert + VALUES ( + -1 -- id_variation + , 1 -- id_type + , 'SILVER' -- code + , 'Silver' -- name + , 10 -- display_order + , 1 -- active + , 'NIPS' -- v_guid -- + ); + */ + /* Test 2: Alter */ + SELECT + id_variation + , id_type + , code + , name + , display_order + , active + , v_guid AS GUID + FROM partsltd_prod.Shop_Variation + WHERE id_variation = 2 + UNION + SELECT + -1 -- id_variation + , 1 -- id_type + , 'GREEN' -- code + , 'Green' -- name + , 3 -- display_order + , 1 -- active + , v_guid -- ; COMMIT; @@ -11918,7 +11963,7 @@ BEGIN ; CALL partsltd_prod.p_shop_save_product_variation ( - 'Test save Variations' -- comment + 'Test save Variations - add + edit' -- comment , v_guid -- guid , 1 -- id_user , 1 -- debug @@ -11964,6 +12009,9 @@ delete from shop_variation_type where id_type = -1 ; + +Cannot add or update a child row: a foreign key constraint fails (`partsltd_prod`.`shop_variation_type`, CONSTRAINT `FK_Shop_Variation_Type_id_change_set` FOREIGN KEY (`id_change_set`) REFERENCES `shop_product_change_set` (`id_change_set`)) + */ -- Clear previous proc @@ -22403,6 +22451,78 @@ INSERT INTO Shop_Storage_Location ( ) VALUES (1, 'K-F-1', 'Kitchen Fridge 1') + , (1, 'K-AHL-M-B', 'Kitchen - Above Hob Left Medial - Bottom') + , (1, 'K-AHL-M-M', 'Kitchen - Above Hob Left Medial - Middle') + , (1, 'K-AHL-M-T', 'Kitchen - Above Hob Left Medial - Top') + , (1, 'K-AHL-L-B', 'Kitchen - Above Hob Left Lateral - Bottom') + , (1, 'K-AHL-L-M', 'Kitchen - Above Hob Left Lateral - Middle') + , (1, 'K-AHL-L-T', 'Kitchen - Above Hob Left Lateral - Top') + , (1, 'K-AHR-M-B', 'Kitchen - Above Hob Left Medial - Bottom') + , (1, 'K-AHR-M-M', 'Kitchen - Above Hob Left Medial - Middle') + , (1, 'K-AHR-M-T', 'Kitchen - Above Hob Left Medial - Top') + , (1, 'K-AHL-M-B', 'Kitchen - Above Hob Left Medial - Bottom') + , (1, 'K-AHL-M-M', 'Kitchen - Above Hob Left Medial - Middle') + , (1, 'K-AHL-M-T', 'Kitchen - Above Hob Left Medial - Top') + , (1, 'K-AHL-L-B', 'Kitchen - Above Hob Left Lateral - Bottom') + , (1, 'K-AHL-L-M', 'Kitchen - Above Hob Left Lateral - Middle') + , (1, 'K-AHL-L-T', 'Kitchen - Above Hob Left Lateral - Top') + , (1, 'K-AHL-XL-B', 'Kitchen - Above Hob Left Extra Lateral - Bottom') + , (1, 'K-AHL-XL-M', 'Kitchen - Above Hob Left Extra Lateral - Middle') + , (1, 'K-AHL-XL-T', 'Kitchen - Above Hob Left Extra Lateral - Top') + , (1, 'K-BS-B', 'Kitchen - Below Sink - Bottom') + , (1, 'K-BS-T', 'Kitchen - Below Sink - Top') + , (1, 'K-LO-B', 'Kitchen - Left of Oven - Bottom') + , (1, 'K-LO-T', 'Kitchen - Left of Oven - Top') + , (1, 'K-RO-M-B', 'Kitchen - Right of Oven - Medial - Bottom') + , (1, 'K-RO-M-M', 'Kitchen - Right of Oven - Medial - Middle') + , (1, 'K-RO-M-T', 'Kitchen - Right of Oven - Medial - Top') + , (1, 'K-RO-L-B', 'Kitchen - Right of Oven - Lateral - Bottom') + , (1, 'K-RO-L-T', 'Kitchen - Right of Oven - Lateral - Top') + , (1, 'K-BBB-B', 'Kitchen - Below Breakfast Bar - Bottom') + , (1, 'K-BBB-T', 'Kitchen - Below Breakfast Bar - Top') + , (1, 'K-BSL-M-B', 'Kitchen - Bekow Sink Left - Medial - Bottom') + , (1, 'K-BSL-M-T', 'Kitchen - Bekow Sink Left - Medial - Top') + , (1, 'K-BSL-L-B', 'Kitchen - Bekow Sink Left - Lateral - Bottom') + , (1, 'K-BSL-L-T', 'Kitchen - Bekow Sink Left - Lateral - Top') + , (1, 'K-ASL-M-B', 'Kitchen - Above Sink Left - Medial - Bottom') + , (1, 'K-ASL-M-M', 'Kitchen - Above Sink Left - Medial - Middle') + , (1, 'K-ASL-M-T', 'Kitchen - Above Sink Left - Medial - Top') + , (1, 'K-ASL-L-B', 'Kitchen - Above Sink Left - Lateral - Bottom') + , (1, 'K-ASL-L-M', 'Kitchen - Above Sink Left - Lateral - Middle') + , (1, 'K-ASL-L-T', 'Kitchen - Above Sink Left - Lateral - Top') + , (1, 'K-ASL-XL-B', 'Kitchen - Above Sink Left - Extra Lateral - Bottom') + , (1, 'K-ASL-XL-M', 'Kitchen - Above Sink Left - Extra Lateral - Middle') + , (1, 'K-ASL-XL-T', 'Kitchen - Above Sink Left - Extra Lateral - Top') + , (1, 'K-T-B', 'Kitchen - Tower - Bottom') + , (1, 'K-T-LM', 'Kitchen - Tower - Lower Middle') + , (1, 'K-T-UM', 'Kitchen - Tower - Upper Middle') + , (1, 'K-T-T', 'Kitchen - Tower - Top') + , (1, 'K-FJ-MEAT', 'Kitchen - Fridge - Meat Drawer') + , (1, 'K-FJ-VEG', 'Kitchen - Fridge - Vegetables Drawer') + , (1, 'K-FJ-CHEESE', 'Kitchen - Fridge - Cheese Drawer') + , (1, 'K-FJ-S-B', 'Kitchen - Fridge - Shelf - Bottom') + , (1, 'K-FJ-S-LM', 'Kitchen - Fridge - Shelf - Lower Middle') + , (1, 'K-FJ-S-UM', 'Kitchen - Fridge - Shelf - Upper Middle') + , (1, 'K-FJ-S-T', 'Kitchen - Fridge - Shelf - Top') + , (1, 'K-FJ-DG-B', 'Kitchen - Door Shelf (Guarded) - Bottom') + , (1, 'K-FJ-DG-LM', 'Kitchen - Door Shelf (Guarded) - Lower Middle') + , (1, 'K-FJ-DG-UM', 'Kitchen - Door Shelf (Guarded) - Upper Middle') + , (1, 'K-FJ-DG-T', 'Kitchen - Door Shelf (Guarded) - Top') + , (1, 'K-FJ-DU', 'Kitchen - Door Shelf (Unguarded)') + , (1, 'K-FZ-DRAWER-B', 'Kitchen - Freezer - Drawer - Bottom') + , (1, 'K-FZ-DRAWER-T', 'Kitchen - Freezer - Drawer - Top') + , (1, 'K-FZ-DRAWER-I', 'Kitchen - Freezer - Drawer - Ice') + , (1, 'K-FZ-S-B', 'Kitchen - Freezer - Shelf - Bottom') + , (1, 'K-FZ-S-M', 'Kitchen - Freezer - Shelf - Middle') + , (1, 'K-FZ-S-T', 'Kitchen - Freezer - Shelf - Top') + , (1, 'K-FZ-DOOR-XL', 'Kitchen - Freezer - Door - Extra Low') + , (1, 'K-FZ-DOOR-L', 'Kitchen - Freezer - Door - Lower') + , (1, 'K-FZ-DOOR-LM', 'Kitchen - Freezer - Door - Lower Middle') + , (1, 'K-FZ-DOOR-UM', 'Kitchen - Freezer - Door - Upper Middle') + , (1, 'K-FZ-DOOR-U', 'Kitchen - Freezer - Door - Upper') + , (1, 'K-FZ-DOOR-XU', 'Kitchen - Freezer - Door - Extra Up') + , (1, 'K-AFF', 'Kitchen - Above Fridge-Freezer') + , (1, 'K-CT', 'Kitchen - Counter Top') ; /* diff --git a/static/MySQL/7109_p_shop_get_many_storage_location.sql b/static/MySQL/7109_p_shop_get_many_storage_location.sql index d4de385e..35967c0e 100644 --- a/static/MySQL/7109_p_shop_get_many_storage_location.sql +++ b/static/MySQL/7109_p_shop_get_many_storage_location.sql @@ -12,7 +12,7 @@ BEGIN SET a_get_inactive_storage_location = IFNULL(a_get_inactive_storage_location, 0); SELECT - SL.id_storage_location + SL.id_location , P.id_plant , P.id_address , A.id_region diff --git a/static/MySQL/7212_p_shop_save_product_variation_test.sql b/static/MySQL/7212_p_shop_save_product_variation_test.sql index d211e8bb..45093ac4 100644 --- a/static/MySQL/7212_p_shop_save_product_variation_test.sql +++ b/static/MySQL/7212_p_shop_save_product_variation_test.sql @@ -157,6 +157,7 @@ BEGIN END // DELIMITER ;; +/* CALL partsltd_prod.p_shop_save_product_variation_test (); DELETE FROM partsltd_prod.Shop_Variation_Type_Temp; @@ -164,7 +165,6 @@ DELETE FROM partsltd_prod.Shop_Variation_Temp; DROP TABLE IF EXISTS tmp_Msg_Error; -/* delete from shop_variation_audit where id_variation = 3 diff --git a/static/MySQL/9000_populate.sql b/static/MySQL/9000_populate.sql index 75f21294..895ea9d4 100644 --- a/static/MySQL/9000_populate.sql +++ b/static/MySQL/9000_populate.sql @@ -109,6 +109,78 @@ INSERT INTO Shop_Storage_Location ( ) VALUES (1, 'K-F-1', 'Kitchen Fridge 1') + , (1, 'K-AHL-M-B', 'Kitchen - Above Hob Left Medial - Bottom') + , (1, 'K-AHL-M-M', 'Kitchen - Above Hob Left Medial - Middle') + , (1, 'K-AHL-M-T', 'Kitchen - Above Hob Left Medial - Top') + , (1, 'K-AHL-L-B', 'Kitchen - Above Hob Left Lateral - Bottom') + , (1, 'K-AHL-L-M', 'Kitchen - Above Hob Left Lateral - Middle') + , (1, 'K-AHL-L-T', 'Kitchen - Above Hob Left Lateral - Top') + , (1, 'K-AHR-M-B', 'Kitchen - Above Hob Left Medial - Bottom') + , (1, 'K-AHR-M-M', 'Kitchen - Above Hob Left Medial - Middle') + , (1, 'K-AHR-M-T', 'Kitchen - Above Hob Left Medial - Top') + , (1, 'K-AHL-M-B', 'Kitchen - Above Hob Left Medial - Bottom') + , (1, 'K-AHL-M-M', 'Kitchen - Above Hob Left Medial - Middle') + , (1, 'K-AHL-M-T', 'Kitchen - Above Hob Left Medial - Top') + , (1, 'K-AHL-L-B', 'Kitchen - Above Hob Left Lateral - Bottom') + , (1, 'K-AHL-L-M', 'Kitchen - Above Hob Left Lateral - Middle') + , (1, 'K-AHL-L-T', 'Kitchen - Above Hob Left Lateral - Top') + , (1, 'K-AHL-XL-B', 'Kitchen - Above Hob Left Extra Lateral - Bottom') + , (1, 'K-AHL-XL-M', 'Kitchen - Above Hob Left Extra Lateral - Middle') + , (1, 'K-AHL-XL-T', 'Kitchen - Above Hob Left Extra Lateral - Top') + , (1, 'K-BS-B', 'Kitchen - Below Sink - Bottom') + , (1, 'K-BS-T', 'Kitchen - Below Sink - Top') + , (1, 'K-LO-B', 'Kitchen - Left of Oven - Bottom') + , (1, 'K-LO-T', 'Kitchen - Left of Oven - Top') + , (1, 'K-RO-M-B', 'Kitchen - Right of Oven - Medial - Bottom') + , (1, 'K-RO-M-M', 'Kitchen - Right of Oven - Medial - Middle') + , (1, 'K-RO-M-T', 'Kitchen - Right of Oven - Medial - Top') + , (1, 'K-RO-L-B', 'Kitchen - Right of Oven - Lateral - Bottom') + , (1, 'K-RO-L-T', 'Kitchen - Right of Oven - Lateral - Top') + , (1, 'K-BBB-B', 'Kitchen - Below Breakfast Bar - Bottom') + , (1, 'K-BBB-T', 'Kitchen - Below Breakfast Bar - Top') + , (1, 'K-BSL-M-B', 'Kitchen - Bekow Sink Left - Medial - Bottom') + , (1, 'K-BSL-M-T', 'Kitchen - Bekow Sink Left - Medial - Top') + , (1, 'K-BSL-L-B', 'Kitchen - Bekow Sink Left - Lateral - Bottom') + , (1, 'K-BSL-L-T', 'Kitchen - Bekow Sink Left - Lateral - Top') + , (1, 'K-ASL-M-B', 'Kitchen - Above Sink Left - Medial - Bottom') + , (1, 'K-ASL-M-M', 'Kitchen - Above Sink Left - Medial - Middle') + , (1, 'K-ASL-M-T', 'Kitchen - Above Sink Left - Medial - Top') + , (1, 'K-ASL-L-B', 'Kitchen - Above Sink Left - Lateral - Bottom') + , (1, 'K-ASL-L-M', 'Kitchen - Above Sink Left - Lateral - Middle') + , (1, 'K-ASL-L-T', 'Kitchen - Above Sink Left - Lateral - Top') + , (1, 'K-ASL-XL-B', 'Kitchen - Above Sink Left - Extra Lateral - Bottom') + , (1, 'K-ASL-XL-M', 'Kitchen - Above Sink Left - Extra Lateral - Middle') + , (1, 'K-ASL-XL-T', 'Kitchen - Above Sink Left - Extra Lateral - Top') + , (1, 'K-T-B', 'Kitchen - Tower - Bottom') + , (1, 'K-T-LM', 'Kitchen - Tower - Lower Middle') + , (1, 'K-T-UM', 'Kitchen - Tower - Upper Middle') + , (1, 'K-T-T', 'Kitchen - Tower - Top') + , (1, 'K-FJ-MEAT', 'Kitchen - Fridge - Meat Drawer') + , (1, 'K-FJ-VEG', 'Kitchen - Fridge - Vegetables Drawer') + , (1, 'K-FJ-CHEESE', 'Kitchen - Fridge - Cheese Drawer') + , (1, 'K-FJ-S-B', 'Kitchen - Fridge - Shelf - Bottom') + , (1, 'K-FJ-S-LM', 'Kitchen - Fridge - Shelf - Lower Middle') + , (1, 'K-FJ-S-UM', 'Kitchen - Fridge - Shelf - Upper Middle') + , (1, 'K-FJ-S-T', 'Kitchen - Fridge - Shelf - Top') + , (1, 'K-FJ-DG-B', 'Kitchen - Door Shelf (Guarded) - Bottom') + , (1, 'K-FJ-DG-LM', 'Kitchen - Door Shelf (Guarded) - Lower Middle') + , (1, 'K-FJ-DG-UM', 'Kitchen - Door Shelf (Guarded) - Upper Middle') + , (1, 'K-FJ-DG-T', 'Kitchen - Door Shelf (Guarded) - Top') + , (1, 'K-FJ-DU', 'Kitchen - Door Shelf (Unguarded)') + , (1, 'K-FZ-DRAWER-B', 'Kitchen - Freezer - Drawer - Bottom') + , (1, 'K-FZ-DRAWER-T', 'Kitchen - Freezer - Drawer - Top') + , (1, 'K-FZ-DRAWER-I', 'Kitchen - Freezer - Drawer - Ice') + , (1, 'K-FZ-S-B', 'Kitchen - Freezer - Shelf - Bottom') + , (1, 'K-FZ-S-M', 'Kitchen - Freezer - Shelf - Middle') + , (1, 'K-FZ-S-T', 'Kitchen - Freezer - Shelf - Top') + , (1, 'K-FZ-DOOR-XL', 'Kitchen - Freezer - Door - Extra Low') + , (1, 'K-FZ-DOOR-L', 'Kitchen - Freezer - Door - Lower') + , (1, 'K-FZ-DOOR-LM', 'Kitchen - Freezer - Door - Lower Middle') + , (1, 'K-FZ-DOOR-UM', 'Kitchen - Freezer - Door - Upper Middle') + , (1, 'K-FZ-DOOR-U', 'Kitchen - Freezer - Door - Upper') + , (1, 'K-FZ-DOOR-XU', 'Kitchen - Freezer - Door - Extra Up') + , (1, 'K-AFF', 'Kitchen - Above Fridge-Freezer') + , (1, 'K-CT', 'Kitchen - Counter Top') ; /* diff --git a/static/css/layouts/table-main.css b/static/css/layouts/table-main.css index 097dfb26..dd8e72e0 100644 --- a/static/css/layouts/table-main.css +++ b/static/css/layouts/table-main.css @@ -9,6 +9,12 @@ justify-content: normal; } +#tableMain select, #tableMain input, #tableMain textarea, #tableMain div { + box-sizing: border-box; + width: 100%; + height: 100%; +} + #tableMain thead tr th, #tableMain tbody tr td { width: 20vh; min-width: 20vh; diff --git a/static/css/main.css b/static/css/main.css index d01cbda5..34ad825c 100644 --- a/static/css/main.css +++ b/static/css/main.css @@ -68,7 +68,6 @@ body { } *{ - /*box-sizing: border-box; */ margin: 0; } diff --git a/static/css/pages/store/stock_items.css b/static/css/pages/store/stock_items.css index ec4eb4b4..f8330705 100644 --- a/static/css/pages/store/stock_items.css +++ b/static/css/pages/store/stock_items.css @@ -20,16 +20,18 @@ th, td { #tableMain thead tr th.product_variations.collapsed, #tableMain tbody tr td.product_variations.collapsed { width: 10vh; min-width: 10vh; + display: table-cell !important; } #tableMain thead tr th.product_variations, #tableMain tbody tr td.product_variations { - width: 20vh; - min-width: 20vh; + width: 24vh; + min-width: 24vh; } -#tableMain tbody tr td.product_variations table thead tr th, #tableMain tbody tr td.product_variations table tbody tr td { +#tableMain tbody tr td.product_variations table thead tr th.product_variation_type, #tableMain tbody tr td.product_variations table tbody tr td.product_variation_type, +#tableMain tbody tr td.product_variations table thead tr th.product_variation, #tableMain tbody tr td.product_variations table tbody tr td.product_variation { width: 8vh; min-width: 8vh; } -#tableMain tbody tr td.product_variations table thead tr th:last-of-type, #tableMain tbody tr td.product_variations table tbody tr td:last-of-type { +#tableMain tbody tr td.product_variations table thead tr th.add, #tableMain tbody tr td.product_variations table tbody tr td.delete { width: 4vh; min-width: 4vh; } @@ -43,25 +45,27 @@ th, td { min-width: 11vh; } -#tableMain thead tr th.cost_local_vat_excl, #tableMain tbody tr td.cost_local_vat_excl, -#tableMain thead tr th.cost_local_vat_incl, #tableMain tbody tr td.cost_local_vat_incl { +#tableMain thead tr th.cost_unit_local_vat_excl, #tableMain tbody tr td.cost_unit_local_vat_excl, +#tableMain thead tr th.cost_unit_local_vat_incl, #tableMain tbody tr td.cost_unit_local_vat_incl { width: 9vh; min-width: 9vh; } -#tableMain thead tr th.storage-location.collapsed, #tableMain tbody tr td.storage-location.collapsed { +#tableMain thead tr th.storage_location.collapsed, #tableMain tbody tr td.storage_location.collapsed { width: 10vh; min-width: 10vh; } -#tableMain thead tr th.storage-location, #tableMain tbody tr td.storage-location { +#tableMain thead tr th.storage_location, #tableMain tbody tr td.storage_location { width: 20vh; min-width: 20vh; } -#tableMain tbody tr td.storage-location table thead tr th, #tableMain tbody tr td.storage-location table tbody tr td { +#tableMain tbody tr td.storage_location table thead tr th, +#tableMain tbody tr td.storage_location table tbody tr td { width: 8vh; min-width: 8vh; } -#tableMain tbody tr td.storage-location table thead tr th:last-of-type, #tableMain tbody tr td.storage-location table tbody tr td:last-of-type { +#tableMain tbody tr td.storage_location table thead tr th:last-of-type, +#tableMain tbody tr td.storage_location table tbody tr td:last-of-type { width: 4vh; min-width: 4vh; } diff --git a/static/dist/css/main.bundle.css b/static/dist/css/main.bundle.css index 94f9e664..471dd7fb 100644 --- a/static/dist/css/main.bundle.css +++ b/static/dist/css/main.bundle.css @@ -68,7 +68,6 @@ body { } *{ - /*box-sizing: border-box; */ margin: 0; } @@ -708,6 +707,12 @@ form.filter button.save, form.filter button.button-cancel { justify-content: normal; } +#tableMain select, #tableMain input, #tableMain textarea { + box-sizing: border-box; + width: 100%; + height: 100%; +} + #tableMain thead tr th, #tableMain tbody tr td { width: 20vh; min-width: 20vh; diff --git a/static/dist/css/store_stock_items.bundle.css b/static/dist/css/store_stock_items.bundle.css index 0fb18fe6..593ab181 100644 --- a/static/dist/css/store_stock_items.bundle.css +++ b/static/dist/css/store_stock_items.bundle.css @@ -77,16 +77,18 @@ th, td { #tableMain thead tr th.product_variations.collapsed, #tableMain tbody tr td.product_variations.collapsed { width: 10vh; min-width: 10vh; + display: table-cell !important; } #tableMain thead tr th.product_variations, #tableMain tbody tr td.product_variations { - width: 20vh; - min-width: 20vh; + width: 24vh; + min-width: 24vh; } -#tableMain tbody tr td.product_variations table thead tr th, #tableMain tbody tr td.product_variations table tbody tr td { +#tableMain tbody tr td.product_variations table thead tr th.product_variation_type, #tableMain tbody tr td.product_variations table tbody tr td.product_variation_type, +#tableMain tbody tr td.product_variations table thead tr th.product_variation, #tableMain tbody tr td.product_variations table tbody tr td.product_variation { width: 8vh; min-width: 8vh; } -#tableMain tbody tr td.product_variations table thead tr th:last-of-type, #tableMain tbody tr td.product_variations table tbody tr td:last-of-type { +#tableMain tbody tr td.product_variations table thead tr th.add, #tableMain tbody tr td.product_variations table tbody tr td.delete { width: 4vh; min-width: 4vh; } @@ -100,25 +102,27 @@ th, td { min-width: 11vh; } -#tableMain thead tr th.cost_local_vat_excl, #tableMain tbody tr td.cost_local_vat_excl, -#tableMain thead tr th.cost_local_vat_incl, #tableMain tbody tr td.cost_local_vat_incl { +#tableMain thead tr th.cost_unit_local_vat_excl, #tableMain tbody tr td.cost_unit_local_vat_excl, +#tableMain thead tr th.cost_unit_local_vat_incl, #tableMain tbody tr td.cost_unit_local_vat_incl { width: 9vh; min-width: 9vh; } -#tableMain thead tr th.storage-location.collapsed, #tableMain tbody tr td.storage-location.collapsed { +#tableMain thead tr th.storage_location.collapsed, #tableMain tbody tr td.storage_location.collapsed { width: 10vh; min-width: 10vh; } -#tableMain thead tr th.storage-location, #tableMain tbody tr td.storage-location { +#tableMain thead tr th.storage_location, #tableMain tbody tr td.storage_location { width: 20vh; min-width: 20vh; } -#tableMain tbody tr td.storage-location table thead tr th, #tableMain tbody tr td.storage-location table tbody tr td { +#tableMain tbody tr td.storage_location table thead tr th, +#tableMain tbody tr td.storage_location table tbody tr td { width: 8vh; min-width: 8vh; } -#tableMain tbody tr td.storage-location table thead tr th:last-of-type, #tableMain tbody tr td.storage-location table tbody tr td:last-of-type { +#tableMain tbody tr td.storage_location table thead tr th:last-of-type, +#tableMain tbody tr td.storage_location table tbody tr td:last-of-type { width: 4vh; min-width: 4vh; } diff --git a/static/dist/js/main.bundle.js b/static/dist/js/main.bundle.js index 53962296..0bafad5f 100644 --- a/static/dist/js/main.bundle.js +++ b/static/dist/js/main.bundle.js @@ -2347,7 +2347,7 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) { if (!isPopState) { base_table_superPropGet(TableBasePage, "sharedInitialize", this, 3)([]); this.hookupFilters(); - this.hookupButtonsAddSaveCancel(); + this.hookupButtonsSaveCancel(); this.hookupTableMain(); OverlayConfirm.hookup(function () { if (isSinglePageApp) { @@ -2461,8 +2461,8 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) { }); } }, { - key: "hookupButtonsAddSaveCancel", - value: function hookupButtonsAddSaveCancel() { + key: "hookupButtonsSaveCancel", + value: function hookupButtonsSaveCancel() { this.hookupButtonSave(); this.hookupButtonCancel(); this.toggleShowButtonsSaveCancel(false); @@ -4969,7 +4969,7 @@ var PageStoreProductPermutations = /*#__PURE__*/function (_TableBasePage) { this.hookupSubscriptionFields(); this.hookupIdStripeProductInputs(); this.hookupExpirationFields(); - this.hookupActiveCheckboxes(); + this.hookupFieldsActive(); } }, { key: "hookupFieldsProductCategory", @@ -5144,11 +5144,6 @@ var PageStoreProductPermutations = /*#__PURE__*/function (_TableBasePage) { value: function hookupCountIntervalExpirationUnsealedInputs() { this.hookupChangeHandlerTableCellsWhenNotCollapsed("change", idTableMain + ' td.' + flagCountUnitMeasurementIntervalExpirationUnsealed + ' input'); } - }, { - key: "hookupActiveCheckboxes", - value: function hookupActiveCheckboxes() { - this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagActive + ' input'); - } }, { key: "leave", value: function leave() { @@ -5811,7 +5806,7 @@ var PageStoreStockItems = /*#__PURE__*/function (_TableBasePage) { this.hookupSealingInputs(); this.hookupExpirationDateInputs(); this.hookupConsumationInputs(); - this.hookupActiveCheckboxes(); + this.hookupFieldsActive(); } }, { key: "hookupProductCategoryFields", @@ -5826,16 +5821,17 @@ var PageStoreStockItems = /*#__PURE__*/function (_TableBasePage) { value: function hookupProductFields() { this.hookupTableCellDdlPreviews(idTableMain + ' td.' + flagProduct, Utils.getListFromDict(products)); } - }, { - key: "handleClickProductPermutationVariationsPreview", - value: function handleClickProductPermutationVariationsPreview(event, element) { - var row = DOM.getRowFromElement(element); - var tdProduct = row.querySelector('td.' + flagProduct); - var idProduct = DOM.getElementValueCurrent(tdProduct); - var product = products[idProduct]; - if (!product[flagHasVariations]) return; - stock_items_superPropGet(PageStoreStockItems, "handleClickProductPermutationVariationsPreview", this, 3)([event, element]); + + /* + handleClickProductPermutationVariationsPreview(event, element) { + let row = DOM.getRowFromElement(element); + let tdProduct = row.querySelector('td.' + flagProduct); + let idProduct = DOM.getElementValueCurrent(tdProduct); + let product = products[idProduct]; + if (!product[flagHasVariations]) return; + super.handleClickProductPermutationVariationsPreview(event, element); } + */ }, { key: "handleClickButtonProductPermutationVariationsAdd", value: function handleClickButtonProductPermutationVariationsAdd(event, element) { @@ -5865,7 +5861,7 @@ var PageStoreStockItems = /*#__PURE__*/function (_TableBasePage) { key: "hookupStorageLocationFields", value: function hookupStorageLocationFields() { var _this3 = this; - this.hookupEventHandler("click", idTableMain + ' td.' + flagStorageLocation, function (event, element) { + this.hookupEventHandler("click", idTableMain + ' td.' + flagStorageLocation + ' div', function (event, element) { return _this3.handleClickStorageLocationPreview(event, element); }); } @@ -5877,7 +5873,7 @@ var PageStoreStockItems = /*#__PURE__*/function (_TableBasePage) { var idPlant = element.getAttribute(attrIdPlant); var idStorageLocation = element.getAttribute(attrIdStorageLocation); var tblStorageLocation = document.createElement("table"); - tblStorageLocation.classList.add(flagProductVariations); + tblStorageLocation.classList.add(flagStorageLocation); var thead = document.createElement("thead"); var thPlant = document.createElement("th"); thPlant.textContent = 'Plant'; @@ -5892,8 +5888,9 @@ var PageStoreStockItems = /*#__PURE__*/function (_TableBasePage) { var plant, optionPlantJson, optionPlant, storageLocation, optionStorageLocationJson, optionStorageLocation; var plantKeys = Object.keys(plants); var storageLocationKeys = Object.keys(storageLocations); - var plantJson = plants[idPlant]; - var storageLocationJson = storageLocations[idStorageLocation]; + debugger; + var plantJson = idPlant != null ? plants[idPlant] : stock_items_defineProperty({}, attrIdPlant, null); + var storageLocationJson = idStorageLocation != null ? storageLocations[idStorageLocation] : stock_items_defineProperty({}, attrIdStorageLocation, null); var tdPlant = document.createElement("td"); tdPlant.classList.add(flagPlant); DOM.setElementAttributesValuesCurrentAndPrevious(tdPlant, plantJson[attrIdPlant]); @@ -5907,7 +5904,10 @@ var PageStoreStockItems = /*#__PURE__*/function (_TableBasePage) { ddlPlant.appendChild(optionPlant); plantKeys.forEach(function (plantKey) { plant = plants[plantKey]; - optionPlantJson = BusinessObjects.getOptionJsonFromObjectJson(objectJson = plant, valueSelected = plantJson[attrIdPlant]); + optionPlantJson = BusinessObjects.getOptionJsonFromObjectJson(plant, + // objectJson + plantJson[attrIdPlant] // valueSelected + ); optionPlant = DOM.createOption(optionPlantJson); if (_verbose) { console.log("optionPlant: ", optionPlant); @@ -5925,9 +5925,12 @@ var PageStoreStockItems = /*#__PURE__*/function (_TableBasePage) { console.log("optionStorageLocation: ", optionStorageLocation); } ddlStorageLocation.appendChild(optionStorageLocation); - StorageLocationKeys.forEach(function (StorageLocationKey) { - storageLocation = StorageLocations[StorageLocationKey]; - optionStorageLocationJson = BusinessObjects.getOptionJsonFromObjectJson(objectJson = storageLocation, valueSelected = storageLocationJson[attrIdStorageLocation]); + storageLocationKeys.forEach(function (StorageLocationKey) { + storageLocation = storageLocations[StorageLocationKey]; + optionStorageLocationJson = BusinessObjects.getOptionJsonFromObjectJson(storageLocation, + // objectJson + storageLocationJson[attrIdStorageLocation] // valueSelected + ); optionStorageLocation = DOM.createOption(optionStorageLocationJson); if (_verbose) { console.log("optionStorageLocation: ", optionStorageLocation); @@ -5941,9 +5944,9 @@ var PageStoreStockItems = /*#__PURE__*/function (_TableBasePage) { trBody.appendChild(tdStorageLocation); tbody.appendChild(trBody); tblStorageLocation.appendChild(tbody); - var parent = element.parentElement; - parent.innerHTML = ''; - parent.appendChild(tblStorageLocation); + var tdParent = DOM.getCellFromElement(element); + tdParent.innerHTML = ''; + tdParent.appendChild(tblStorageLocation); if (_verbose) { console.log("tblStorageLocation: ", tblStorageLocation); } @@ -6036,11 +6039,6 @@ var PageStoreStockItems = /*#__PURE__*/function (_TableBasePage) { value: function hookupDateConsumedInputs() { this.hookupChangeHandlerTableCellsWhenNotCollapsed("change", idTableMain + ' td.' + flagDateConsumed + ' input'); } - }, { - key: "hookupActiveCheckboxes", - value: function hookupActiveCheckboxes() { - this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagActive + ' input'); - } }, { key: "leave", value: function leave() { diff --git a/static/js/pages/base_table.js b/static/js/pages/base_table.js index 3cbcfacd..21d89139 100644 --- a/static/js/pages/base_table.js +++ b/static/js/pages/base_table.js @@ -49,7 +49,7 @@ export default class TableBasePage extends BasePage { if (!isPopState) { super.sharedInitialize(); this.hookupFilters(); - this.hookupButtonsAddSaveCancel(); + this.hookupButtonsSaveCancel(); this.hookupTableMain(); OverlayConfirm.hookup(() => { if (isSinglePageApp) { @@ -139,7 +139,7 @@ export default class TableBasePage extends BasePage { }) .catch(error => console.error('Error:', error)); } - hookupButtonsAddSaveCancel() { + hookupButtonsSaveCancel() { this.hookupButtonSave(); this.hookupButtonCancel(); this.toggleShowButtonsSaveCancel(false); diff --git a/static/js/pages/store/product_permutations.js b/static/js/pages/store/product_permutations.js index 7c9de399..ba40e094 100644 --- a/static/js/pages/store/product_permutations.js +++ b/static/js/pages/store/product_permutations.js @@ -211,7 +211,7 @@ export default class PageStoreProductPermutations extends TableBasePage { this.hookupSubscriptionFields(); this.hookupIdStripeProductInputs(); this.hookupExpirationFields(); - this.hookupActiveCheckboxes(); + this.hookupFieldsActive(); } hookupFieldsProductCategory() { this.hookupTableCellDdlPreviews( @@ -338,9 +338,6 @@ export default class PageStoreProductPermutations extends TableBasePage { hookupCountIntervalExpirationUnsealedInputs(){ this.hookupChangeHandlerTableCellsWhenNotCollapsed("change", idTableMain + ' td.' + flagCountUnitMeasurementIntervalExpirationUnsealed + ' input'); } - hookupActiveCheckboxes(){ - this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagActive + ' input'); - } leave() { super.leave(); diff --git a/static/js/pages/store/stock_items.js b/static/js/pages/store/stock_items.js index bad199a9..3791249b 100644 --- a/static/js/pages/store/stock_items.js +++ b/static/js/pages/store/stock_items.js @@ -143,7 +143,7 @@ export default class PageStoreStockItems extends TableBasePage { this.hookupSealingInputs(); this.hookupExpirationDateInputs(); this.hookupConsumationInputs(); - this.hookupActiveCheckboxes(); + this.hookupFieldsActive(); } hookupProductCategoryFields() { this.hookupTableCellDdlPreviews( @@ -156,6 +156,7 @@ export default class PageStoreStockItems extends TableBasePage { this.hookupTableCellDdlPreviews(idTableMain + ' td.' + flagProduct, Utils.getListFromDict(products)); } + /* handleClickProductPermutationVariationsPreview(event, element) { let row = DOM.getRowFromElement(element); let tdProduct = row.querySelector('td.' + flagProduct); @@ -164,6 +165,7 @@ export default class PageStoreStockItems extends TableBasePage { if (!product[flagHasVariations]) return; super.handleClickProductPermutationVariationsPreview(event, element); } + */ handleClickButtonProductPermutationVariationsAdd(event, element) { let row = DOM.getRowFromElement(element); let tbody = row.querySelector('tbody'); @@ -186,7 +188,7 @@ export default class PageStoreStockItems extends TableBasePage { hookupStorageLocationFields(){ this.hookupEventHandler( "click", - idTableMain + ' td.' + flagStorageLocation, + idTableMain + ' td.' + flagStorageLocation + ' div', (event, element) => this.handleClickStorageLocationPreview(event, element) ); } @@ -195,7 +197,7 @@ export default class PageStoreStockItems extends TableBasePage { let idPlant = element.getAttribute(attrIdPlant); let idStorageLocation = element.getAttribute(attrIdStorageLocation); let tblStorageLocation = document.createElement("table"); - tblStorageLocation.classList.add(flagProductVariations); + tblStorageLocation.classList.add(flagStorageLocation); let thead = document.createElement("thead"); let thPlant = document.createElement("th"); thPlant.textContent = 'Plant'; @@ -212,8 +214,13 @@ export default class PageStoreStockItems extends TableBasePage { let plantKeys = Object.keys(plants); let storageLocationKeys = Object.keys(storageLocations); - let plantJson = plants[idPlant]; - let storageLocationJson = storageLocations[idStorageLocation]; + debugger; + let plantJson = idPlant != null ? plants[idPlant] : { + [attrIdPlant]: null, + }; + let storageLocationJson = idStorageLocation != null ? storageLocations[idStorageLocation] : { + [attrIdStorageLocation]: null, + }; let tdPlant = document.createElement("td"); tdPlant.classList.add(flagPlant); @@ -230,8 +237,8 @@ export default class PageStoreStockItems extends TableBasePage { plantKeys.forEach((plantKey) => { plant = plants[plantKey]; optionPlantJson = BusinessObjects.getOptionJsonFromObjectJson( - objectJson = plant, - valueSelected = plantJson[attrIdPlant] + plant, // objectJson + plantJson[attrIdPlant] // valueSelected ); optionPlant = DOM.createOption(optionPlantJson); if (_verbose) { console.log("optionPlant: ", optionPlant); } @@ -250,11 +257,11 @@ export default class PageStoreStockItems extends TableBasePage { if (_verbose) { console.log("optionStorageLocation: ", optionStorageLocation); } ddlStorageLocation.appendChild(optionStorageLocation); - StorageLocationKeys.forEach((StorageLocationKey) => { - storageLocation = StorageLocations[StorageLocationKey]; + storageLocationKeys.forEach((StorageLocationKey) => { + storageLocation = storageLocations[StorageLocationKey]; optionStorageLocationJson = BusinessObjects.getOptionJsonFromObjectJson( - objectJson = storageLocation, - valueSelected = storageLocationJson[attrIdStorageLocation] + storageLocation, // objectJson + storageLocationJson[attrIdStorageLocation] // valueSelected ); optionStorageLocation = DOM.createOption(optionStorageLocationJson); if (_verbose) { console.log("optionStorageLocation: ", optionStorageLocation); } @@ -269,9 +276,9 @@ export default class PageStoreStockItems extends TableBasePage { tbody.appendChild(trBody); tblStorageLocation.appendChild(tbody); - let parent = element.parentElement; - parent.innerHTML = ''; - parent.appendChild(tblStorageLocation); + let tdParent = DOM.getCellFromElement(element); + tdParent.innerHTML = ''; + tdParent.appendChild(tblStorageLocation); if (_verbose) { console.log("tblStorageLocation: ", tblStorageLocation); } this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagPlant + ' select', (event, element) => { this.handleChangeStoragePlantDdl(event, element); }); this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagStorageLocation + ' select', (event, element) => { this.handleChangeStorageLocationDdl(event, element); }); @@ -342,10 +349,6 @@ export default class PageStoreStockItems extends TableBasePage { this.hookupChangeHandlerTableCellsWhenNotCollapsed("change", idTableMain + ' td.' + flagDateConsumed + ' input'); } - hookupActiveCheckboxes(){ - this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagActive + ' input'); - } - leave() { super.leave(); } diff --git a/templates/pages/store/_stock_items.html b/templates/pages/store/_stock_items.html index 7ff12aa4..d1051322 100644 --- a/templates/pages/store/_stock_items.html +++ b/templates/pages/store/_stock_items.html @@ -116,10 +116,12 @@ #} var currencies = {{ model.convert_list_objects_to_dict_json_by_attribute_key_default(model.currencies) | tojson | safe }}; + var plants = {{ model.convert_list_objects_to_dict_json_by_attribute_key_default(model.plants) | tojson | safe }}; var products = {{ model.convert_list_objects_to_dict_json_by_attribute_key_default(model.category_list_filters.get_list_products()) | tojson | safe }}; var productCategories = {{ model.convert_list_objects_to_dict_json_by_attribute_key_default(model.category_list_filters.categories) | tojson | safe }}; var productVariations = {{ model.convert_list_objects_to_dict_json_by_attribute_key_default(model.variations) | tojson | safe }}; var productVariationTypes = {{ model.convert_list_objects_to_dict_json_by_attribute_key_default(model.variation_types) | tojson | safe }}; + var storageLocations = {{ model.convert_list_objects_to_dict_json_by_attribute_key_default(model.storage_locations) | tojson | safe }}; {# var unitMeasurements = {{ units_measurement_dict | tojson | safe }}; var unitMeasurementsTime = {{ units_measurement_time_dict | tojson | safe }};