Fix: Product Category save + filter debugging.

This commit is contained in:
2024-11-18 14:02:23 +00:00
parent 3f47af3b02
commit fd4dae0f8f
36 changed files with 47125 additions and 331 deletions

View File

@@ -14,28 +14,12 @@ user:
can_admin_store: True
can_admin_user: True
User.from_json
json: {'can_admin_store': True, 'can_admin_user': True, 'email': 'edward.middletonsmith@gmail.com', 'firstname': 'Teddy', 'id_currency_default': None, 'id_region_default': None, 'id_user': 1, 'id_user_auth0': 'auth0|6582b95c895d09a70ba10fef', 'is_email_verified': False, 'is_included_VAT_default': True, 'is_super_user': True, 'surname': 'Middleton-Smith'}
user:
id_user: 1
id_user_auth0: auth0|6582b95c895d09a70ba10fef
firstname: Teddy
surname: Middleton-Smith
email: edward.middletonsmith@gmail.com
is_email_verified: False
is_super_user: True
id_currency_default: None
id_region_default: None
is_included_VAT_default: True
can_admin_store: True
can_admin_user: True
argument_dict: {'a_id_user': 1, 'a_id_user_auth0': 'auth0|6582b95c895d09a70ba10fef', 'get_all_user': False, 'get_inactive_user': False, 'ids_user': 1, 'ids_user_auth0': '', 'a_debug': 0}
executing p_get_many_user
DataStore_Base.db_procedure_execute
proc_string: CALL p_get_many_user(:a_id_user, :a_id_user_auth0, :get_all_user, :get_inactive_user, :ids_user, :ids_user_auth0, :a_debug)
args: {'a_id_user': 1, 'a_id_user_auth0': 'auth0|6582b95c895d09a70ba10fef', 'get_all_user': False, 'get_inactive_user': False, 'ids_user': 1, 'ids_user_auth0': '', 'a_debug': 0}
result: <sqlalchemy.engine.cursor.CursorResult object at 0x0000028DEA5ADFD0>
result: <sqlalchemy.engine.cursor.CursorResult object at 0x000001721A32A270>
data received
raw users: ((1, 'auth0|6582b95c895d09a70ba10fef', 'Teddy', 'Middleton-Smith', 'edward.middletonsmith@gmail.com', b'\x00', None, None, b'\x01', b'\x01', b'\x01', b'\x01', b'\x00'),)
raw errors: ()
@@ -59,7 +43,7 @@ executing p_shop_get_many_access_level
DataStore_Base.db_procedure_execute
proc_string: CALL p_shop_get_many_access_level(:active)
args: {'active': 1}
result: <sqlalchemy.engine.cursor.CursorResult object at 0x0000028DEA5ADFD0>
result: <sqlalchemy.engine.cursor.CursorResult object at 0x000001721A32A270>
data received
raw access levels: ((1, 'VIEW', 'View', 3, 1, b'\x01'), (2, 'EDIT', 'Edit', 2, 2, b'\x01'), (3, 'ADMIN', 'Admin', 1, 3, b'\x01'))
raw errors: ()
@@ -101,78 +85,26 @@ executing p_get_many_user
DataStore_Base.db_procedure_execute
proc_string: CALL p_get_many_user(:a_id_user, :a_id_user_auth0, :get_all_user, :get_inactive_user, :ids_user, :ids_user_auth0, :a_debug)
args: {'a_id_user': 1, 'a_id_user_auth0': 'auth0|6582b95c895d09a70ba10fef', 'get_all_user': False, 'get_inactive_user': False, 'ids_user': 1, 'ids_user_auth0': '', 'a_debug': 0}
result: <sqlalchemy.engine.cursor.CursorResult object at 0x0000028DEA5ADF60>
result: <sqlalchemy.engine.cursor.CursorResult object at 0x000001721A32A200>
data received
raw users: ((1, 'auth0|6582b95c895d09a70ba10fef', 'Teddy', 'Middleton-Smith', 'edward.middletonsmith@gmail.com', b'\x00', None, None, b'\x01', b'\x01', b'\x01', b'\x01', b'\x00'),)
raw errors: ()
new result set: ()
argument_dict: {'a_id_user': 1, 'a_get_all_product_category': True, 'a_get_inactive_product_category': True, 'a_ids_product_category': '', 'a_get_all_product': True, 'a_get_inactive_product': False, 'a_ids_product': '', 'a_get_all_permutation': True, 'a_get_inactive_permutation': False, 'a_ids_permutation': '', 'a_get_all_image': False, 'a_get_inactive_image': False, 'a_ids_image': '', 'a_get_products_quantity_stock_below_min': False, 'a_debug': 0}
argument_dict: {'a_id_user': 1, 'a_get_all_product_category': True, 'a_get_inactive_product_category': False, 'a_ids_product_category': '', 'a_get_all_product': True, 'a_get_inactive_product': False, 'a_ids_product': '', 'a_get_all_permutation': True, 'a_get_inactive_permutation': False, 'a_ids_permutation': '', 'a_get_all_image': False, 'a_get_inactive_image': False, 'a_ids_image': '', 'a_get_products_quantity_stock_below_min': False, 'a_debug': 0}
executing p_shop_get_many_product
DataStore_Base.db_procedure_execute
proc_string: CALL p_shop_get_many_product(:a_id_user, :a_get_all_product_category, :a_get_inactive_product_category, :a_ids_product_category, :a_get_all_product, :a_get_inactive_product, :a_ids_product, :a_get_all_permutation, :a_get_inactive_permutation, :a_ids_permutation, :a_get_all_image, :a_get_inactive_image, :a_ids_image, :a_get_products_quantity_stock_below_min, :a_debug)
args: {'a_id_user': 1, 'a_get_all_product_category': True, 'a_get_inactive_product_category': True, 'a_ids_product_category': '', 'a_get_all_product': True, 'a_get_inactive_product': False, 'a_ids_product': '', 'a_get_all_permutation': True, 'a_get_inactive_permutation': False, 'a_ids_permutation': '', 'a_get_all_image': False, 'a_get_inactive_image': False, 'a_ids_image': '', 'a_get_products_quantity_stock_below_min': False, 'a_debug': 0}
result: <sqlalchemy.engine.cursor.CursorResult object at 0x0000028DEA5ADF60>
args: {'a_id_user': 1, 'a_get_all_product_category': True, 'a_get_inactive_product_category': False, 'a_ids_product_category': '', 'a_get_all_product': True, 'a_get_inactive_product': False, 'a_ids_product': '', 'a_get_all_permutation': True, 'a_get_inactive_permutation': False, 'a_ids_permutation': '', 'a_get_all_image': False, 'a_get_inactive_image': False, 'a_ids_image': '', 'a_get_products_quantity_stock_below_min': False, 'a_debug': 0}
result: <sqlalchemy.engine.cursor.CursorResult object at 0x000001721A32A200>
data received
initial category_list: categories: []
raw categories: ((1, 'ASS', 'Assistive Devices', 'Braille product line and other assistive devices', 1, 'View', 1, b'\x01', None, None, None), (3, 'TECH', 'Technology', 'Technological devices', 1, 'View', 2, b'\x01', None, None, None), (2, 'MISC', 'Miscellaneous', 'Not category allocated products', 1, 'View', 99, b'\x01', None, None, None))
new_category:
id: 1
code: ASS
name: Assistive Devices
description: Braille product line and other assistive devices
access_level: View
display_order: 1
active: True
products: []
new_category:
id: 3
code: TECH
name: Technology
description: Technological devices
access_level: View
display_order: 2
active: True
products: []
new_category:
id: 2
code: MISC
name: Miscellaneous
description: Not category allocated products
access_level: View
display_order: 99
active: True
products: []
category-loaded category_list: categories: [
id: 1
code: ASS
name: Assistive Devices
description: Braille product line and other assistive devices
access_level: View
display_order: 1
active: True
products: []
,
id: 3
code: TECH
name: Technology
description: Technological devices
access_level: View
display_order: 2
active: True
products: []
,
id: 2
code: MISC
name: Miscellaneous
description: Not category allocated products
access_level: View
display_order: 99
active: True
products: []
]
raw categories: ()
category-loaded category_list: categories: []
raw products: ()
raw errors: ()
new result set: ()
get many category_list: categories: []
Model_View_Store.__init__
starting
session: <SecureCookieSession {'_permanent': True, 'authorisedUser': {'can_admin_store': True, 'can_admin_user': True, 'email': 'edward.middletonsmith@gmail.com', 'firstname': 'Teddy', 'id_currency_default': None, 'id_region_default': None, 'id_user': 1, 'id_user_auth0': 'auth0|6582b95c895d09a70ba10fef', 'is_email_verified': False, 'is_included_VAT_default': True, 'is_super_user': True, 'surname': 'Middleton-Smith'}, 'csrf_token': '62a72bf881c6405d538a3e29f81249c4b05b8139', 'user': {'access_token': 'eyJhbGciOiJkaXIiLCJlbmMiOiJBMjU2R0NNIiwiaXNzIjoiaHR0cHM6Ly9kZXYtbndhazIwNjZlZjZoOGl4bi51cy5hdXRoMC5jb20vIn0..U5ygDcfqoeoGTLgA.CSpBOxXywtwjmGGVQH9h2MDcYueJhBoblhO0MBYMk120anymk-mioySgkGJBiIRGWM_7P4-AMf-7bxlO1mMQBG84-da_XziygHVTHtZdi5hD0tp7osa6RNjUpHG4CAnZ3q0Hj_EaSMPTz3-XhWsR5izqOALDsBp69kliXzjbHBkvnzJGPgeQZcP1-FkXlTQYkCm-A9oOzdCqI9mbGaQVzvxDWfYeSnW5BAtEkhXCy_eMEOnKY0y9mlYs-koIhF-dT2WA_c_K8reOq1NjIZBjJLAJ88xr7AVd5jsEMsPr-aEIW7wHcUOeawa3Kfnh9NfNMZaHoBjFAv6g4aP3y9bkbMpK.3-McrmK7ITgjpNPlJefLNQ', 'expires_at': 1731923381, 'expires_in': 86400, 'id_token': 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qum_E35mZyJtwJMyNFzRj3kJHcpMKJH5qAZ2CTMbGLh5iHrUA9_KgOyMRGZTcooHSQnwemq_Sh3lNXJE0fUXzf99FMfaBw', 'scope': 'openid profile email', 'token_type': 'Bearer', 'userinfo': {'aud': 'gGjytqNMWChSixqO72RQzVHWAaeJJzRi', 'email': 'edward.middletonsmith@gmail.com', 'email_verified': False, 'exp': 1731872982, 'iat': 1731836982, 'iss': 'https://dev-nwak2066ef6h8ixn.us.auth0.com/', 'name': 'edward.middletonsmith@gmail.com', 'nickname': 'edward.middletonsmith', 'nonce': 'lIQSHKYseol25a7sELPO', 'picture': 'https://s.gravatar.com/avatar/53d3f24407d5257f84f27ca07874bd64?s=480&r=pg&d=https%3A%2F%2Fcdn.auth0.com%2Favatars%2Fed.png', 'sid': 'MpelQ8pKR9hN9X4mIlfBq3RZGzxXLAxi', 'sub': 'auth0|6582b95c895d09a70ba10fef', 'updated_at': '2024-11-17T09:49:41.722Z'}}}>
DataStore_Base.get_user_session

150
app.log.2
View File

@@ -1,67 +1,83 @@
Request: 127.0.0.1 GET http /store/categories?is_not_empty=false&active=true Host: 127.0.0.1:5000
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:132.0) Gecko/20100101 Firefox/132.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;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/categories
Dnt: 1
Connection: keep-alive
Cookie: session=.eJytVmnPozgS_iujSDOfOmnOBF6pNZuTIwHCEa4vyGAIN4QjCcz2f1-T9DErzV7SSjjBLlP1lOupcv0x8-qwKUAZlt3so2v68NMM9F1cNUkbwksbNrOPP2YBKD0Ai6T02q5qwu8bfy73r43v1bAAST77mIXwARq4KBII87CryrZIuvhv10m6CKpi9mkWJU3blaBACmdGCOGA1hLoBX3ThGUweDCMQJ8jXGWf5y9RE16TqvwLwRsA_uPdm5zAkN7X_9-XNEP4LB0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nXr1__Ach1prI.ZzoIQw.xndonm9ds59sRFhipIbusmAFFXM
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''
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_category.py", line 60, in categories
return render_template('pages/store/_product_categories.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_categories.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 357, 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_categories.html", line 10, in block 'page_body'
<form id="{{ model.ID_FORM_FILTERS }}" class="{{ model.FLAG_FILTER }} {{ model.FLAG_ROW }} {{ model.FLAG_CARD }}" action="{{ url_for('routes_store_product_category.filter_category') }}" method="POST"> <!-- {{ model.FLAG_CONTAINER }} -->
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 1084, in url_for
return self.handle_url_build_error(error, endpoint, values)
session: <SecureCookieSession {'_permanent': True, 'authorisedUser': {'can_admin_store': True, 'can_admin_user': True, 'email': 'edward.middletonsmith@gmail.com', 'firstname': 'Teddy', 'id_currency_default': None, 'id_region_default': None, 'id_user': 1, 'id_user_auth0': 'auth0|6582b95c895d09a70ba10fef', 'is_email_verified': False, 'is_included_VAT_default': True, 'is_super_user': True, 'surname': 'Middleton-Smith'}, 'csrf_token': '62a72bf881c6405d538a3e29f81249c4b05b8139', 'user': {'access_token': 'eyJhbGciOiJkaXIiLCJlbmMiOiJBMjU2R0NNIiwiaXNzIjoiaHR0cHM6Ly9kZXYtbndhazIwNjZlZjZoOGl4bi51cy5hdXRoMC5jb20vIn0..U5ygDcfqoeoGTLgA.CSpBOxXywtwjmGGVQH9h2MDcYueJhBoblhO0MBYMk120anymk-mioySgkGJBiIRGWM_7P4-AMf-7bxlO1mMQBG84-da_XziygHVTHtZdi5hD0tp7osa6RNjUpHG4CAnZ3q0Hj_EaSMPTz3-XhWsR5izqOALDsBp69kliXzjbHBkvnzJGPgeQZcP1-FkXlTQYkCm-A9oOzdCqI9mbGaQVzvxDWfYeSnW5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8ik7jXiNGgAI3XpXQH5Ieud8h_TGsh3jNfmVIp4zjxO45Y39kaNHZQgnU2N6ckKD1W0pONirwKLD2Drdj9zVvdcYywQHPmhPHXoz06P8k4UvkdjST_AGgt-RAfpT-j5Nnbh3vqadv95ZGzJPHy3_q0lFS1PRUksYG9YGIMSrSpevC_sVgD3Qum_E35mZyJtwJMyNFzRj3kJHcpMKJH5qAZ2CTMbGLh5iHrUA9_KgOyMRGZTcooHSQnwemq_Sh3lNXJE0fUXzf99FMfaBw', 'scope': 'openid profile email', 'token_type': 'Bearer', 'userinfo': {'aud': 'gGjytqNMWChSixqO72RQzVHWAaeJJzRi', 'email': 'edward.middletonsmith@gmail.com', 'email_verified': False, 'exp': 1731872982, 'iat': 1731836982, 'iss': 'https://dev-nwak2066ef6h8ixn.us.auth0.com/', 'name': 'edward.middletonsmith@gmail.com', 'nickname': 'edward.middletonsmith', 'nonce': 'lIQSHKYseol25a7sELPO', 'picture': 'https://s.gravatar.com/avatar/53d3f24407d5257f84f27ca07874bd64?s=480&r=pg&d=https%3A%2F%2Fcdn.auth0.com%2Favatars%2Fed.png', 'sid': 'MpelQ8pKR9hN9X4mIlfBq3RZGzxXLAxi', 'sub': 'auth0|6582b95c895d09a70ba10fef', 'updated_at': '2024-11-17T09:49:41.722Z'}}}>
DataStore_Base.get_user_session
User.from_json
json: {'can_admin_store': True, 'can_admin_user': True, 'email': 'edward.middletonsmith@gmail.com', 'firstname': 'Teddy', 'id_currency_default': None, 'id_region_default': None, 'id_user': 1, 'id_user_auth0': 'auth0|6582b95c895d09a70ba10fef', 'is_email_verified': False, 'is_included_VAT_default': True, 'is_super_user': True, 'surname': 'Middleton-Smith'}
user:
id_user: 1
id_user_auth0: auth0|6582b95c895d09a70ba10fef
firstname: Teddy
surname: Middleton-Smith
email: edward.middletonsmith@gmail.com
is_email_verified: False
is_super_user: True
id_currency_default: None
id_region_default: None
is_included_VAT_default: True
can_admin_store: True
can_admin_user: True
User.from_json
json: {'can_admin_store': True, 'can_admin_user': True, 'email': 'edward.middletonsmith@gmail.com', 'firstname': 'Teddy', 'id_currency_default': None, 'id_region_default': None, 'id_user': 1, 'id_user_auth0': 'auth0|6582b95c895d09a70ba10fef', 'is_email_verified': False, 'is_included_VAT_default': True, 'is_super_user': True, 'surname': 'Middleton-Smith'}
user:
id_user: 1
id_user_auth0: auth0|6582b95c895d09a70ba10fef
firstname: Teddy
surname: Middleton-Smith
email: edward.middletonsmith@gmail.com
is_email_verified: False
is_super_user: True
id_currency_default: None
id_region_default: None
is_included_VAT_default: True
can_admin_store: True
can_admin_user: True
argument_dict: {'a_id_user': 1, 'a_id_user_auth0': 'auth0|6582b95c895d09a70ba10fef', 'get_all_user': False, 'get_inactive_user': False, 'ids_user': 1, 'ids_user_auth0': '', 'a_debug': 0}
executing p_get_many_user
DataStore_Base.db_procedure_execute
proc_string: CALL p_get_many_user(:a_id_user, :a_id_user_auth0, :get_all_user, :get_inactive_user, :ids_user, :ids_user_auth0, :a_debug)
args: {'a_id_user': 1, 'a_id_user_auth0': 'auth0|6582b95c895d09a70ba10fef', 'get_all_user': False, 'get_inactive_user': False, 'ids_user': 1, 'ids_user_auth0': '', 'a_debug': 0}
result: <sqlalchemy.engine.cursor.CursorResult object at 0x0000020ABF3919B0>
data received
raw users: ((1, 'auth0|6582b95c895d09a70ba10fef', 'Teddy', 'Middleton-Smith', 'edward.middletonsmith@gmail.com', b'\x00', None, None, b'\x01', b'\x01', b'\x01', b'\x01', b'\x00'),)
raw errors: ()
new result set: ()
model_view_base init end - model.user:
id_user: 1
id_user_auth0: auth0|6582b95c895d09a70ba10fef
firstname: Teddy
surname: Middleton-Smith
email: edward.middletonsmith@gmail.com
is_email_verified: False
is_super_user: True
id_currency_default: None
id_region_default: None
is_included_VAT_default: True
can_admin_store: True
can_admin_user: True
config_env: development
categories
form_filters=Filters_Product_Category(is_not_empty=False, active=True)
Model_View_Store_Product_Category.__init__
starting...
Model_View_Store.__init__
starting
session: <SecureCookieSession {'_permanent': True, 'authorisedUser': {'can_admin_store': True, 'can_admin_user': True, 'email': 'edward.middletonsmith@gmail.com', 'firstname': 'Teddy', 'id_currency_default': None, 'id_region_default': None, 'id_user': 1, 'id_user_auth0': 'auth0|6582b95c895d09a70ba10fef', 'is_email_verified': False, 'is_included_VAT_default': True, 'is_super_user': True, 'surname': 'Middleton-Smith'}, 'csrf_token': '62a72bf881c6405d538a3e29f81249c4b05b8139', 'user': {'access_token': 'eyJhbGciOiJkaXIiLCJlbmMiOiJBMjU2R0NNIiwiaXNzIjoiaHR0cHM6Ly9kZXYtbndhazIwNjZlZjZoOGl4bi51cy5hdXRoMC5jb20vIn0..U5ygDcfqoeoGTLgA.CSpBOxXywtwjmGGVQH9h2MDcYueJhBoblhO0MBYMk120anymk-mioySgkGJBiIRGWM_7P4-AMf-7bxlO1mMQBG84-da_XziygHVTHtZdi5hD0tp7osa6RNjUpHG4CAnZ3q0Hj_EaSMPTz3-XhWsR5izqOALDsBp69kliXzjbHBkvnzJGPgeQZcP1-FkXlTQYkCm-A9oOzdCqI9mbGaQVzvxDWfYeSnW5BAtEkhXCy_eMEOnKY0y9mlYs-koIhF-dT2WA_c_K8reOq1NjIZBjJLAJ88xr7AVd5jsEMsPr-aEIW7wHcUOeawa3Kfnh9NfNMZaHoBjFAv6g4aP3y9bkbMpK.3-McrmK7ITgjpNPlJefLNQ', 'expires_at': 1731923381, 'expires_in': 86400, 'id_token': 'eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6InVveXZURk44bjJvZHg1VkFLMFh1RyJ9.eyJuaWNrbmFtZSI6ImVkd2FyZC5taWRkbGV0b25zbWl0aCIsIm5hbWUiOiJlZHdhcmQubWlkZGxldG9uc21pdGhAZ21haWwuY29tIiwicGljdHVyZSI6Imh0dHBzOi8vcy5ncmF2YXRhci5jb20vYXZhdGFyLzUzZDNmMjQ0MDdkNTI1N2Y4NGYyN2NhMDc4NzRiZDY0P3M9NDgwJnI9cGcmZD1odHRwcyUzQSUyRiUyRmNkbi5hdXRoMC5jb20lMkZhdmF0YXJzJTJGZWQucG5nIiwidXBkYXRlZF9hdCI6IjIwMjQtMTEtMTdUMDk6NDk6NDEuNzIyWiIsImVtYWlsIjoiZWR3YXJkLm1pZGRsZXRvbnNtaXRoQGdtYWlsLmNvbSIsImVtYWlsX3ZlcmlmaWVkIjpmYWxzZSwiaXNzIjoiaHR0cHM6Ly9kZXYtbndhazIwNjZlZjZoOGl4bi51cy5hdXRoMC5jb20vIiwiYXVkIjoiZ0dqeXRxTk1XQ2hTaXhxTzcyUlF6VkhXQWFlSkp6UmkiLCJpYXQiOjE3MzE4MzY5ODIsImV4cCI6MTczMTg3Mjk4Miwic3ViIjoiYXV0aDB8NjU4MmI5NWM4OTVkMDlhNzBiYTEwZmVmIiwic2lkIjoiTXBlbFE4cEtSOWhOOVg0bUlsZkJxM1JaR3p4WExBeGkiLCJub25jZSI6ImxJUVNIS1lzZW9sMjVhN3NFTFBPIn0.oB687ksKRtGbZQYXO4GS5GskJq0SmKofO-BaQftxowZmqIYMwzFumG8mVfm4l7-YI19tc8ik7jXiNGgAI3XpXQH5Ieud8h_TGsh3jNfmVIp4zjxO45Y39kaNHZQgnU2N6ckKD1W0pONirwKLD2Drdj9zVvdcYywQHPmhPHXoz06P8k4UvkdjST_AGgt-RAfpT-j5Nnbh3vqadv95ZGzJPHy3_q0lFS1PRUksYG9YGIMSrSpevC_sVgD3Qum_E35mZyJtwJMyNFzRj3kJHcpMKJH5qAZ2CTMbGLh5iHrUA9_KgOyMRGZTcooHSQnwemq_Sh3lNXJE0fUXzf99FMfaBw', 'scope': 'openid profile email', 'token_type': 'Bearer', 'userinfo': {'aud': 'gGjytqNMWChSixqO72RQzVHWAaeJJzRi', 'email': 'edward.middletonsmith@gmail.com', 'email_verified': False, 'exp': 1731872982, 'iat': 1731836982, 'iss': 'https://dev-nwak2066ef6h8ixn.us.auth0.com/', 'name': 'edward.middletonsmith@gmail.com', 'nickname': 'edward.middletonsmith', 'nonce': 'lIQSHKYseol25a7sELPO', 'picture': 'https://s.gravatar.com/avatar/53d3f24407d5257f84f27ca07874bd64?s=480&r=pg&d=https%3A%2F%2Fcdn.auth0.com%2Favatars%2Fed.png', 'sid': 'MpelQ8pKR9hN9X4mIlfBq3RZGzxXLAxi', 'sub': 'auth0|6582b95c895d09a70ba10fef', 'updated_at': '2024-11-17T09:49:41.722Z'}}}>
DataStore_Base.get_user_session
User.from_json
json: {'can_admin_store': True, 'can_admin_user': True, 'email': 'edward.middletonsmith@gmail.com', 'firstname': 'Teddy', 'id_currency_default': None, 'id_region_default': None, 'id_user': 1, 'id_user_auth0': 'auth0|6582b95c895d09a70ba10fef', 'is_email_verified': False, 'is_included_VAT_default': True, 'is_super_user': True, 'surname': 'Middleton-Smith'}
user:
id_user: 1
id_user_auth0: auth0|6582b95c895d09a70ba10fef
firstname: Teddy
surname: Middleton-Smith
email: edward.middletonsmith@gmail.com
is_email_verified: False
is_super_user: True
id_currency_default: None
id_region_default: None
is_included_VAT_default: True
can_admin_store: True
can_admin_user: True

View File

@@ -19,7 +19,7 @@ executing p_get_many_user
DataStore_Base.db_procedure_execute
proc_string: CALL p_get_many_user(:a_id_user, :a_id_user_auth0, :get_all_user, :get_inactive_user, :ids_user, :ids_user_auth0, :a_debug)
args: {'a_id_user': 1, 'a_id_user_auth0': 'auth0|6582b95c895d09a70ba10fef', 'get_all_user': False, 'get_inactive_user': False, 'ids_user': 1, 'ids_user_auth0': '', 'a_debug': 0}
result: <sqlalchemy.engine.cursor.CursorResult object at 0x00000146F6E4DFD0>
result: <sqlalchemy.engine.cursor.CursorResult object at 0x0000020ABF85E0B0>
data received
raw users: ((1, 'auth0|6582b95c895d09a70ba10fef', 'Teddy', 'Middleton-Smith', 'edward.middletonsmith@gmail.com', b'\x00', None, None, b'\x01', b'\x01', b'\x01', b'\x01', b'\x00'),)
raw errors: ()
@@ -43,7 +43,7 @@ executing p_shop_get_many_access_level
DataStore_Base.db_procedure_execute
proc_string: CALL p_shop_get_many_access_level(:active)
args: {'active': 1}
result: <sqlalchemy.engine.cursor.CursorResult object at 0x00000146F6E4DFD0>
result: <sqlalchemy.engine.cursor.CursorResult object at 0x0000020ABF85E0B0>
data received
raw access levels: ((1, 'VIEW', 'View', 3, 1, b'\x01'), (2, 'EDIT', 'Edit', 2, 2, b'\x01'), (3, 'ADMIN', 'Admin', 1, 3, b'\x01'))
raw errors: ()
@@ -85,7 +85,7 @@ executing p_get_many_user
DataStore_Base.db_procedure_execute
proc_string: CALL p_get_many_user(:a_id_user, :a_id_user_auth0, :get_all_user, :get_inactive_user, :ids_user, :ids_user_auth0, :a_debug)
args: {'a_id_user': 1, 'a_id_user_auth0': 'auth0|6582b95c895d09a70ba10fef', 'get_all_user': False, 'get_inactive_user': False, 'ids_user': 1, 'ids_user_auth0': '', 'a_debug': 0}
result: <sqlalchemy.engine.cursor.CursorResult object at 0x00000146F6E4DF60>
result: <sqlalchemy.engine.cursor.CursorResult object at 0x0000020ABF85E040>
data received
raw users: ((1, 'auth0|6582b95c895d09a70ba10fef', 'Teddy', 'Middleton-Smith', 'edward.middletonsmith@gmail.com', b'\x00', None, None, b'\x01', b'\x01', b'\x01', b'\x01', b'\x00'),)
raw errors: ()
@@ -95,10 +95,10 @@ executing p_shop_get_many_product
DataStore_Base.db_procedure_execute
proc_string: CALL p_shop_get_many_product(:a_id_user, :a_get_all_product_category, :a_get_inactive_product_category, :a_ids_product_category, :a_get_all_product, :a_get_inactive_product, :a_ids_product, :a_get_all_permutation, :a_get_inactive_permutation, :a_ids_permutation, :a_get_all_image, :a_get_inactive_image, :a_ids_image, :a_get_products_quantity_stock_below_min, :a_debug)
args: {'a_id_user': 1, 'a_get_all_product_category': True, 'a_get_inactive_product_category': True, 'a_ids_product_category': '', 'a_get_all_product': True, 'a_get_inactive_product': False, 'a_ids_product': '', 'a_get_all_permutation': True, 'a_get_inactive_permutation': False, 'a_ids_permutation': '', 'a_get_all_image': False, 'a_get_inactive_image': False, 'a_ids_image': '', 'a_get_products_quantity_stock_below_min': False, 'a_debug': 0}
result: <sqlalchemy.engine.cursor.CursorResult object at 0x00000146F6E4DF60>
result: <sqlalchemy.engine.cursor.CursorResult object at 0x0000020ABF85E040>
data received
initial category_list: categories: []
raw categories: ((1, 'ASS', 'Assistive Devices', 'Braille product line and other assistive devices', 1, 'View', 1, b'\x01', None, None, None), (3, 'TECH', 'Technology', 'Technological devices', 1, 'View', 2, b'\x01', None, None, None), (2, 'MISC', 'Miscellaneous', 'Not category allocated products', 1, 'View', 99, b'\x01', None, None, None))
raw categories: ((1, 'ASS', 'Assistive Devices', 'Braille product line and other assistive devices', 1, 'View', 1, b'\x00', None, None, None), (3, 'TECH', 'Technology', 'Technological devices', 1, 'View', 2, b'\x00', None, None, None), (2, 'MISC', 'Miscellaneous', 'Not category allocated products', 1, 'View', 99, b'\x00', None, None, None))
new_category:
id: 1
code: ASS
@@ -106,7 +106,7 @@ new_category:
description: Braille product line and other assistive devices
access_level: View
display_order: 1
active: True
active: False
products: []
new_category:
@@ -116,7 +116,7 @@ new_category:
description: Technological devices
access_level: View
display_order: 2
active: True
active: False
products: []
new_category:
@@ -126,7 +126,7 @@ new_category:
description: Not category allocated products
access_level: View
display_order: 99
active: True
active: False
products: []
category-loaded category_list: categories: [
@@ -136,7 +136,7 @@ category-loaded category_list: categories: [
description: Braille product line and other assistive devices
access_level: View
display_order: 1
active: True
active: False
products: []
,
id: 3
@@ -145,7 +145,7 @@ category-loaded category_list: categories: [
description: Technological devices
access_level: View
display_order: 2
active: True
active: False
products: []
,
id: 2
@@ -154,7 +154,7 @@ category-loaded category_list: categories: [
description: Not category allocated products
access_level: View
display_order: 99
active: True
active: False
products: []
]
raw products: ()
@@ -167,7 +167,7 @@ get many category_list: categories: [
description: Braille product line and other assistive devices
access_level: View
display_order: 1
active: True
active: False
products: []
,
id: 3
@@ -176,7 +176,7 @@ get many category_list: categories: [
description: Technological devices
access_level: View
display_order: 2
active: True
active: False
products: []
,
id: 2
@@ -185,7 +185,8 @@ get many category_list: categories: [
description: Not category allocated products
access_level: View
display_order: 99
active: True
active: False
products: []
]
Server Error: Could not build url for endpoint 'routes_store_product_category.filter_category'. Did you mean 'routes_store_product_category.save_category' instead?
Model_View_Store.__init__
starting

View File

@@ -21,6 +21,7 @@ class Base():
ATTR_ID_ACCESS_LEVEL: ClassVar[str] = 'id_access_level'
ATTR_ID_ADDRESS: ClassVar[str] = 'id_address'
ATTR_ID_CURRENCY: ClassVar[str] = 'id_currency'
ATTR_ID_MSG_ERROR_TYPE: ClassVar[str] = 'id_type'
ATTR_ID_REGION: ClassVar[str] = 'id_region'
ATTR_ID_USER: ClassVar[str] = 'id_user'
ATTR_ID_USER_MANAGER: ClassVar[str] = 'id_user_manager'
@@ -49,6 +50,7 @@ class Base():
FLAG_GUID: ClassVar[str] = 'guid'
FLAG_IS_NOT_EMPTY: ClassVar[str] = 'is_not_empty'
# FLAG_KEY_PRIMARY: ClassVar[str] = 'key_primary'
FLAG_MESSAGE: ClassVar[str] = 'message'
FLAG_NAME: ClassVar[str] = 'name'
FLAG_NAME_ATTR_OPTION_TEXT: ClassVar[str] = 'NAME_ATTR_OPTION_TEXT'
FLAG_NAME_ATTR_OPTION_VALUE: ClassVar[str] = 'NAME_ATTR_OPTION_VALUE'

View File

@@ -10,13 +10,8 @@ Description:
Business object for SQL errors
"""
# IMPORTS
# VARIABLE INSTANTIATION
# CLASSES
# METHODS
# IMPORTS
# internal
from business_objects.base import Base
import lib.argument_validation as av
from lib import data_types
from forms.forms import Form_Basket_Add, Form_Basket_Edit # Form_Product
@@ -64,4 +59,13 @@ class SQL_Error(db.Model):
error.msg = record[3]
error.name = record[4]
error.description = record[5]
return error
return error
def to_json(self):
return {
Base.FLAG_DISPLAY_ORDER: self.display_order,
Base.ATTR_ID_MSG_ERROR_TYPE: self.id_type,
Base.FLAG_CODE: self.code,
Base.FLAG_MESSAGE: self.msg,
Base.FLAG_NAME: self.name,
Base.FLAG_DESCRIPTION: self.description,
}

View File

@@ -603,7 +603,7 @@ class Parameters_Product(Get_Many_Parameters_Base):
def from_filters_product_category(cls, filters_category):
return cls(
get_all_product_category = True,
get_inactive_product_category = filters_category.active.data,
get_inactive_product_category = not filters_category.active.data,
ids_product_category = '',
get_all_product = True,
get_inactive_product = False,

View File

@@ -524,3 +524,6 @@ class Product_Category_Temp(db.Model, Store_Base):
'created_on': self.created_on,
'created_by': self.created_by
"""
def __repr__(self):
return str(self.__dict__)

View File

@@ -124,4 +124,6 @@ class Store_Base(Base):
FLAG_UNIT_MEASUREMENT_LATENCY_MANUFACTURE: ClassVar[str] = 'unit_measurement_latency_manufacture'
FLAG_UNIT_MEASUREMENT_QUANTITY: ClassVar[str] = 'unit_measurement_quantity'
FLAG_VALUE_TEXT: ClassVar[str] = 'value_text'
def __repr__(self):
return str(self.__dict__)

View File

@@ -82,11 +82,16 @@ def save_category():
objsCategory.append(Product_Category.from_json(category))
# model_save = Model_View_Store_Product_Category() # filters_product=filters_form)
Helper_App.console_log(f'objsCategory={objsCategory}')
Model_View_Store_Product_Category.save_categories(data.get('comment', 'No comment'), objsCategory)
errors = Model_View_Store_Product_Category.save_categories(data.get('comment', 'No comment'), objsCategory)
model_return = Model_View_Store_Product_Category(form_filters_old=form_filters)
if not model_return.is_user_logged_in:
raise Exception('User not logged in')
if (len(errors) > 0):
return jsonify({
Model_View_Store_Product_Category.FLAG_STATUS: Model_View_Store_Product_Category.FLAG_FAILURE,
Model_View_Store_Product_Category.FLAG_MESSAGE: f'Error saving categories.\n{model_return.convert_list_objects_to_json(errors)}'
})
return jsonify({
Model_View_Store_Product_Category.FLAG_STATUS: Model_View_Store_Product_Category.FLAG_SUCCESS,
Model_View_Store_Product_Category.FLAG_DATA: model_return.category_list.to_json()

View File

@@ -45,6 +45,8 @@ from flask import Flask, session, current_app
from pydantic import BaseModel, ConfigDict
from typing import ClassVar
from datetime import datetime
import time
from sqlalchemy.exc import OperationalError
# db = SQLAlchemy()
@@ -206,6 +208,7 @@ class DataStore_Base(BaseModel):
cursor.close()
return users, errors
@staticmethod
def upload_bulk(permanent_table_name, records, batch_size):
_m = 'DataStore_Base.upload_bulk'
@@ -222,12 +225,15 @@ class DataStore_Base(BaseModel):
else:
expected_columns = set(column.name for column in db.inspect(table_object).columns)
Helper_App.console_log(f'expected_columns: {expected_columns}')
""" v1, v2
try:
for i in range(0, len(records), batch_size):
"" v1
batch = records[i:i+batch_size]
Helper_App.console_log(f'batch: {batch}')
db.session.bulk_save_objects(batch)
"""
""
""
data = [object.to_json() for object in batch]
Helper_App.console_log(f'data: {data}')
for row in data:
@@ -237,12 +243,38 @@ class DataStore_Base(BaseModel):
Helper_App.console_log(f'missing columns: {expected_columns - row_keys}')
Helper_App.console_log(f'extra columns: {row_keys - expected_columns}')
# db.session.bulk_insert_mappings(permanent_table_name, data)
"""
db.session.commit()
""
except Exception as e:
Helper_App.console_log(f'{_m}\n{e}')
db.session.rollback()
raise e
"""
max_retries = 3
initial_backoff = 1
for i in range(0, len(records), batch_size):
batch = records[i:i + batch_size]
try:
retries = 0
while retries < max_retries:
try:
db.session.bulk_save_objects(batch)
db.session.commit()
break
except OperationalError as e:
if "Lock wait timeout exceeded" not in str(e) or retries == max_retries - 1:
raise
wait_time = initial_backoff * (2 ** retries)
current_app.logger.warning(f"Lock timeout encountered. Retrying in {wait_time} seconds... (Attempt {retries + 1}/{max_retries})")
time.sleep(wait_time)
retries += 1
# Ensure the session is clean for the retry
db.session.rollback()
except Exception as e:
db.session.rollback()
raise e
@classmethod
def get_many_access_level(cls, filters=None):
_m = 'DataStore_Store_Base.get_many_access_level'

View File

@@ -85,6 +85,19 @@ class DataStore_Store_Product_Category(DataStore_Store_Base):
'a_debug': 0,
}
save_result = cls.db_procedure_execute('p_shop_save_product_category', argument_dict_list)
# Errors
cursor = save_result.cursor
result_set_e = cursor.fetchall()
Helper_App.console_log(f'raw errors: {result_set_e}')
errors = []
if len(result_set_e) > 0:
errors = [SQL_Error.from_DB_record(row) for row in result_set_e] # (row[0], row[1])
for error in errors:
Helper_App.console_log(f"Error [{error.code}]: {error.msg}")
DataStore_Store_Product_Category.db_cursor_clear(cursor)
save_result.close()
Helper_App.console_log('save procedure executed')
return errors

View File

@@ -55,4 +55,4 @@ class Model_View_Store_Product_Category(Model_View_Store):
@classmethod
def save_categories(cls, comment, list_categories):
_m = f'{cls.__name__}.save_categories'
DataStore_Store_Product_Category().save_categories(comment, list_categories)
return DataStore_Store_Product_Category().save_categories(comment, list_categories)

21301
static/MySQL/0000_combine.sql Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -100,7 +100,7 @@ BEGIN
, is_new
)
SELECT
IFNULL(PC_T.id_category, PC.id_category) AS id_category
PC_T.id_category AS id_category
, IFNULL(PC_T.code, PC.code) AS code
, IFNULL(PC_T.name, PC.code) AS name
, IFNULL(PC_T.description, PC.description) AS description
@@ -109,8 +109,8 @@ BEGIN
, IFNULL(PC_T.display_order, PC.display_order) AS display_order
, IFNULL(PC_T.name, IFNULL(PC.name, IFNULL(PC_T.code, IFNULL(PC.code, IFNULL(PC_T.id_category, '(No Product Category)'))))) AS name_error
, CASE WHEN IFNULL(PC_T.id_category, 0) < 1 THEN 1 ELSE 0 END AS is_new
FROM Shop_Product_Category_Temp PC_T
LEFT JOIN Shop_Product_Category PC ON PC_T.id_category = PC.id_category
FROM partsltd_prod.Shop_Product_Category_Temp PC_T
LEFT JOIN partsltd_prod.Shop_Product_Category PC ON PC_T.id_category = PC.id_category
WHERE PC_T.guid = a_guid
;
@@ -163,59 +163,79 @@ BEGIN
END IF;
-- Permissions
IF NOT EXISTS (SELECT * FROM tmp_Msg_Error LIMIT 1) THEN -- (SELECT * FROM tmp_Product WHERE is_new = 0 LIMIT 1) THEN
SET v_ids_product_permission := (
SELECT GROUP_CONCAT(P.id_product SEPARATOR ',')
FROM Shop_Product P
INNER JOIN tmp_Category t_C
ON P.id_category = t_C.id_category
AND t_C.is_new = 0
);
IF NOT ISNULL(v_ids_product_permission) THEN
SET v_id_permission_product = (SELECT id_permission FROM Shop_Permission WHERE code = 'STORE_PRODUCT' LIMIT 1);
CALL p_shop_calc_user(a_guid, a_id_user, FALSE, v_id_permission_product, v_id_access_level_edit, v_ids_product_permission);
UPDATE tmp_Category t_C
INNER JOIN Shop_Product P ON t_C.id_category = P.id_product
INNER JOIN Shop_Calc_User_Temp UE_T
ON P.id_product = UE_T.id_product
AND UE_T.GUID = a_guid
SET
t_C.can_view = UE_T.can_view
, t_C.can_edit = UE_T.can_edit
, t_C.can_admin = UE_T.can_admin
;
CALL p_shop_clear_calc_user(a_guid);
END IF;
SET v_ids_product_permission := (
SELECT GROUP_CONCAT(P.id_product SEPARATOR ',')
FROM Shop_Product P
INNER JOIN tmp_Category t_C
ON P.id_category = t_C.id_category
AND t_C.is_new = 0
WHERE P.active = 1
);
SET v_id_permission_product = (SELECT id_permission FROM Shop_Permission WHERE code = 'STORE_PRODUCT' LIMIT 1);
IF a_debug = 1 THEN
SELECT
a_guid
, a_id_user
, FALSE -- a_get_inactive_user
, v_id_permission_product
, v_id_access_level_edit
, v_ids_product_permission
, 0 -- a_debug
;
END IF;
CALL p_shop_calc_user(
a_guid
, a_id_user
, FALSE -- a_get_inactive_user
, v_id_permission_product
, v_id_access_level_edit
, v_ids_product_permission
, 0 -- a_debug
);
UPDATE tmp_Category t_C
INNER JOIN Shop_Product P ON t_C.id_category = P.id_product
INNER JOIN Shop_Calc_User_Temp UE_T
ON P.id_product = UE_T.id_product
AND UE_T.GUID = a_guid
SET
t_C.can_view = UE_T.can_view
, t_C.can_edit = UE_T.can_edit
, t_C.can_admin = UE_T.can_admin
;
CALL p_shop_clear_calc_user(
a_guid
, 0 -- a_debug
);
IF NOT EXISTS (SELECT * FROM tmp_Msg_Error LIMIT 1) THEN
START TRANSACTION;
INSERT INTO partsltd_prod.Shop_Product_Change_Set ( comment )
VALUES ( a_comment )
;
IF NOT ISNULL(v_ids_product_permission) THEN
INSERT INTO Shop_Product_Change_Set ( comment )
VALUES ( a_comment )
;
SET v_id_change_set := LAST_INSERT_ID();
UPDATE Shop_Product_Category PC
INNER JOIN tmp_Category t_C ON PC.id_category = t_C.id_category
SET
PC.id_category = t_C.id_category
, PC.code = t_C.code
, PC.name = t_C.name
, PC.description = t_C.description
, PC.id_access_level_required = t_C.id_access_level_required
, PC.active = t_C.active
, PC.display_order = t_C.display_order
, PC.id_change_set = v_id_change_set
;
END IF;
SET v_id_change_set := LAST_INSERT_ID();
INSERT INTO Shop_Product_Category (
UPDATE partsltd_prod.Shop_Product_Category PC
INNER JOIN tmp_Category t_C
ON PC.id_category = t_C.id_category
AND t_C.is_new = 0
SET
PC.id_category = t_C.id_category
, PC.code = t_C.code
, PC.name = t_C.name
, PC.description = t_C.description
, PC.id_access_level_required = t_C.id_access_level_required
, PC.active = t_C.active
, PC.display_order = t_C.display_order
, PC.id_change_set = v_id_change_set
;
INSERT INTO partsltd_prod.Shop_Product_Category (
code
, name
, description
@@ -236,15 +256,20 @@ BEGIN
, a_id_user AS created_by
, v_time_start AS created_on
FROM tmp_Category t_C
WHERE is_new = 1
AND active = 1
WHERE
t_C.is_new = 1
AND t_C.active = 1
;
DELETE FROM Shop_Product_Category_Temp
WHERE GUID = a_guid;
COMMIT;
END IF;
START TRANSACTION;
DELETE FROM partsltd_prod.Shop_Product_Category_Temp
WHERE GUID = a_guid;
COMMIT;
# Errors
SELECT *
@@ -253,10 +278,10 @@ BEGIN
;
IF a_debug = 1 THEN
SELECT * from tmp_Catgory;
SELECT * from tmp_Category;
END IF;
DROP TEMPORARY TABLE tmp_Catgory;
DROP TEMPORARY TABLE tmp_Category;
DROP TEMPORARY TABLE tmp_Msg_Error;
IF a_debug = 1 THEN
@@ -265,3 +290,27 @@ BEGIN
END //
DELIMITER ;;
/*
select
*
-- COUNT(*)
-- delete
from partsltd_prod.Shop_Product_Category_Temp
;
CALL partsltd_prod.p_shop_save_product_category (
'nipples'
, (SELECT GUID FROM partsltd_prod.Shop_Product_Category_Temp ORDER BY id_temp DESC LIMIT 1)
, 1
, 1
);
select
*
-- COUNT(*)
-- delete
from partsltd_prod.Shop_Product_Category_Temp
;
*/

View File

@@ -291,11 +291,16 @@ BEGIN
FROM tmp_Product t_P
WHERE is_new = 1
;
DELETE FROM partsltd_prod.Shop_Product_Category_Temp
WHERE GUID = a_guid;
COMMIT;
END IF;
START TRANSACTION;
DELETE FROM partsltd_prod.Shop_Product_Category_Temp
WHERE GUID = a_guid;
COMMIT;
SELECT *
FROM tmp_Msg_Error t_ME

View File

@@ -604,8 +604,11 @@ BEGIN
, PPVL.active = t_PPVL.active
, PPVL.id_change_set = v_id_change_set
;
END IF;
COMMIT;
END IF;
START TRANSACTION;
DELETE FROM Shop_Product_Permutation_Temp
WHERE GUID = a_guid

View File

@@ -511,18 +511,22 @@ BEGIN
, V.id_change_set = v_id_change_set
;
DELETE VT_T
FROM partsltd_prod.Shop_Variation_Type_Temp VT_T
WHERE VT_T.GUID = a_guid
;
DELETE V_T
FROM partsltd_prod.Shop_Variation_Temp V_T
WHERE V_T.GUID = a_guid
;
COMMIT;
END IF;
START TRANSACTION;
DELETE VT_T
FROM partsltd_prod.Shop_Variation_Type_Temp VT_T
WHERE VT_T.GUID = a_guid
;
DELETE V_T
FROM partsltd_prod.Shop_Variation_Temp V_T
WHERE V_T.GUID = a_guid
;
COMMIT;
# Errors
SELECT *
FROM tmp_Msg_Error t_ME

View File

@@ -590,12 +590,16 @@ BEGIN
AND active = 1
;
DELETE FROM partsltd_prod.Shop_Stock_Item_Temp
WHERE GUID = a_guid;
COMMIT;
END IF;
START TRANSACTION;
DELETE FROM partsltd_prod.Shop_Stock_Item_Temp
WHERE GUID = a_guid;
COMMIT;
# Errors
SELECT *
FROM tmp_Msg_Error t_ME

View File

@@ -247,13 +247,17 @@ BEGIN
, U.active = t_U.active
, U.id_change_set = v_id_change_set
;
DELETE FROM Shop_User_Temp
WHERE GUID = a_guid;
COMMIT;
END IF;
START TRANSACTION;
DELETE FROM Shop_User_Temp
WHERE GUID = a_guid;
COMMIT;
# Errors
SELECT *
FROM tmp_Msg_Error t_ME

View File

@@ -558,6 +558,13 @@ BEGIN
COMMIT;
END IF;
START TRANSACTION;
DELETE FROM partsltd_prod.Shop_Supplier_Temp
WHERE GUID = a_guid;
DELETE FROM partsltd_prod.Shop_Supplier_Address_Temp
WHERE GUID = a_guid;
COMMIT;
# Errors
SELECT *
FROM tmp_Msg_Error t_ME

View File

@@ -755,19 +755,23 @@ BEGIN
, SPOPL.cost_unit_local_VAT_incl = t_SPOPL.cost_unit_local_VAT_incl
, SPOPL.id_change_set = v_id_change_set
;
DELETE SPO_T
FROM Shop_Supplier_Purchase_Order_Temp SPO_T
WHERE SPO_T.GUID = a_guid
;
DELETE SPOPL_T
FROM Shop_Supplier_Purchase_Order_Product_Link_Temp SPOPL_T
WHERE SPOPL_T.GUID = a_guid
;
COMMIT;
END IF;
START TRANSACTION;
DELETE SPO_T
FROM Shop_Supplier_Purchase_Order_Temp SPO_T
WHERE SPO_T.GUID = a_guid
;
DELETE SPOPL_T
FROM Shop_Supplier_Purchase_Order_Product_Link_Temp SPOPL_T
WHERE SPOPL_T.GUID = a_guid
;
COMMIT;
# Errors
SELECT *
FROM tmp_Msg_Error t_ME

View File

@@ -920,19 +920,23 @@ BEGIN
, MPOPL.price_unit_local_VAT_incl = t_MPOPL.price_unit_local_VAT_incl
, MPOPL.id_change_set = v_id_change_set
;
DELETE MPO_T
FROM partsltd_prod.Shop_Manufacturing_Purchase_Order_Temp MPO_T
WHERE MPO_T.GUID = a_guid
;
DELETE MPOPL_T
FROM partsltd_prod.Shop_Manufacturing_Purchase_Order_Product_Link_Temp MPOPL_T
WHERE MPOPL_T.GUID = a_guid
;
COMMIT;
END IF;
START TRANSACTION;
DELETE MPO_T
FROM partsltd_prod.Shop_Manufacturing_Purchase_Order_Temp MPO_T
WHERE MPO_T.GUID = a_guid
;
DELETE MPOPL_T
FROM partsltd_prod.Shop_Manufacturing_Purchase_Order_Product_Link_Temp MPOPL_T
WHERE MPOPL_T.GUID = a_guid
;
COMMIT;
# Errors
SELECT *
FROM tmp_Msg_Error t_ME

221
static/MySQL/temp.txt Normal file
View File

@@ -0,0 +1,221 @@
0001_destroy.sql
1000_tbl_Shop_Product_Change_Set.sql
1000_tbl_Split_Temp.sql
1001_tbl_Shop_User_Change_Set.sql
1001_tbl_Split_Key_Value_Pair_Csv_Temp.sql
1002_tbl_Shop_Sales_And_Purchasing_Change_Set.sql
1003_tbl_Shop_Access_Level.sql
1004_tbl_Shop_Access_Level_Audit.sql
1005_tbl_Msg_Error_Type.sql
1010_tbl_File_Type.sql
1011_tbl_File_Type_Audit.sql
1012_tbl_Shop_General.sql
1013_tbl_Shop_General_Audit.sql
1014_tbl_Shop_Image_Type.sql
1015_tbl_Shop_Image_Type_Audit.sql
1100_tbl_Shop_Region.sql
1101_tbl_Shop_Region_Audit.sql
1102_tbl_Shop_Region_Temp.sql
1103_tbl_Shop_Region_Branch.sql
1104_tbl_Shop_Region_Branch_Audit.sql
1105_tbl_Shop_Region_Branch_Temp.sql
1106_tbl_Shop_Address.sql
1106_tbl_Shop_Plant.sql
1107_tbl_Shop_Address_Audit.sql
1107_tbl_Shop_Plant_Audit.sql
1108_tbl_Shop_Plant_Temp.sql
1109_tbl_Shop_Storage_Location.sql
1110_tbl_Shop_Storage_Location_Audit.sql
1111_tbl_Shop_Storage_Location_Temp.sql
1112_tbl_Shop_Storage_Location_Branch.sql
1113_tbl_Shop_Storage_Location_Branch_Audit.sql
1114_tbl_Shop_Storage_Location_Branch_Temp.sql
1115_tbl_Shop_Currency.sql
1116_tbl_Shop_Currency_Audit.sql
1117_tbl_Shop_Currency_Temp.sql
1118_tbl_Shop_Tax_Or_Surcharge.sql
1119_tbl_Shop_Tax_Or_Surcharge_Audit.sql
1120_tbl_Shop_Tax_Or_Surcharge_Temp.sql
1121_tbl_Shop_Unit_Measurement.sql
1122_tbl_Shop_Unit_Measurement_Audit.sql
1124_tbl_Shop_Unit_Measurement_Conversion.sql
1125_tbl_Shop_Unit_Measurement_Conversion_Audit.sql
1200_tbl_Shop_Product_Category.sql
1201_tbl_Shop_Product_Category_Audit.sql
1202_tbl_Shop_Product_Category_Temp.sql
1203_tbl_Shop_Product.sql
1204_tbl_Shop_Product_Audit.sql
1205_tbl_Shop_Product_Temp.sql
1206_tbl_Shop_Product_Permutation.sql
1207_tbl_Shop_Product_Permutation_Audit.sql
1208_tbl_Shop_Product_Permutation_Temp.sql
1209_tbl_Shop_Variation_Type.sql
1210_tbl_Shop_Variation_Type_Audit.sql
1211_tbl_Shop_Variation_Type_Temp.sql
1212_tbl_Shop_Variation.sql
1213_tbl_Shop_Variation_Audit.sql
1214_tbl_Shop_Variation_Temp.sql
1215_tbl_Shop_Product_Permutation_Variation_Link.sql
1216_tbl_Shop_Product_Permutation_Variation_Link_Audit.sql
1217_tbl_Shop_Product_Permutation_Variation_Link_Temp.sql
1218_tbl_Shop_Stock_Item.sql
1219_tbl_Shop_Stock_Item_Audit.sql
1220_tbl_Shop_Stock_Item_Temp.sql
1221_tbl_Shop_Product_Price.sql
1222_tbl_Shop_Product_Price_Audit.sql
1223_tbl_Shop_Product_Price_Temp.sql
1224_tbl_Shop_Product_Image.sql
1225_tbl_Shop_Product_Image_Audit.sql
1227_tbl_Shop_Delivery_Option.sql
1228_tbl_Shop_Delivery_Option_Audit.sql
1230_tbl_Shop_Product_Permutation_Delivery_Option_Link.sql
1231_tbl_Shop_Product_Permutation_Delivery_Option_Link_Audit.sql
1233_tbl_Shop_Discount.sql
1234_tbl_Shop_Discount_Audit.sql
1236_tbl_Shop_Discount_Region_Currency_Link.sql
1237_tbl_Shop_Discount_Region_Currency_Link_Audit.sql
1300_tbl_Shop_Permission_Group.sql
1301_tbl_Shop_Permission_Group_Audit.sql
1303_tbl_Shop_Permission.sql
1304_tbl_Shop_Permission_Audit.sql
1306_tbl_Shop_Role.sql
1307_tbl_Shop_Role_Audit.sql
1309_tbl_Shop_Role_Permission_Link.sql
1310_tbl_Shop_Role_Permission_Link_Audit.sql
1312_tbl_Shop_User.sql
1313_tbl_Shop_User_Audit.sql
1315_tbl_Shop_User_Role_Link.sql
1316_tbl_Shop_User_Role_Link_Audit.sql
1318_tbl_Shop_User_Address.sql
1319_tbl_Shop_User_Address_Audit.sql
1321_tbl_Shop_User_Basket.sql
1322_tbl_Shop_User_Basket_Audit.sql
1397_tbl_Shop_Order_Status.sql
1398_tbl_Shop_Order_Status_Audit.sql
1400_tbl_Shop_Supplier.sql
1401_tbl_Shop_Supplier_Audit.sql
1402_tbl_Shop_Supplier_Temp.sql
1403_tbl_Shop_Supplier_Address.sql
1404_tbl_Shop_Supplier_Address_Audit.sql
1405_tbl_Shop_Supplier_Address_Temp.sql
1409_tbl_Shop_Supplier_Purchase_Order.sql
1410_tbl_Shop_Supplier_Purchase_Order_Audit.sql
1411_tbl_Shop_Supplier_Purchase_Order_Temp.sql
1412_tbl_Shop_Supplier_Purchase_Order_Product_Link.sql
1413_tbl_Shop_Supplier_Purchase_Order_Product_Link_Audit.sql
1414_tbl_Shop_Supplier_Purchase_Order_Product_Link_Temp.sql
1415_tbl_Shop_Manufacturing_Purchase_Order.sql
1416_tbl_Shop_Manufacturing_Purchase_Order_Audit.sql
1417_tbl_Shop_Manufacturing_Purchase_Order_Temp.sql
1418_tbl_Shop_Manufacturing_Purchase_Order_Product_Link.sql
1419_tbl_Shop_Manufacturing_Purchase_Order_Product_Link_Audit.sql
1420_tbl_Shop_Manufacturing_Purchase_Order_Product_Link_Temp.sql
1421_tbl_Shop_Customer.sql
1422_tbl_Shop_Customer_Audit.sql
1424_tbl_Shop_Customer_Sales_Order.sql
1425_tbl_Shop_Customer_Sales_Order_Audit.sql
1427_tbl_Shop_Customer_Sales_Order_Product_Link.sql
1428_tbl_Shop_Customer_Sales_Order_Product_Link_Audit.sql
1429_tbl_Shop_Customer_Sales_Order_Product_Link_Temp.sql
1500_tbl_Shop_Calc_User_Temp.sql
3000_tri_Shop_Access_Level.sql
3000_tri_Shop_Product_Change_Set.sql
3001_tri_Shop_User_Change_Set.sql
3002_tri_Shop_Sales_And_Purchasing_Change_Set.sql
3010_tri_File_Type.sql
3011_tri_File_Type_Audit.sql
3012_tri_Shop_General.sql
3014_tri_Shop_Image_Type.sql
3100_tri_Shop_Region.sql
3103_tri_Shop_Region_Branch.sql
3106_tri_Shop_Address.sql
3109_tri_Shop_Storage_Location.sql
3115_tri_Shop_Currency.sql
3118_tri_Shop_Tax_Or_Surcharge.sql
3200_tri_Shop_Category.sql
3203_tri_Shop_Product.sql
3206_tri_Shop_Product_Permutation.sql
3209_tri_Shop_Variation_Type.sql
3212_tri_Shop_Variation.sql
3215_tri_Shop_Product_Permutation_Variation_Link.sql
3218_tri_Shop_Stock_Item.sql
3221_tri_Shop_Product_Price.sql
3224_tri_Shop_Product_Image.sql
3227_tri_Shop_Delivery_Option.sql
3230_tri_Shop_Product_Permutation_Delivery_Option_Link.sql
3233_tri_Shop_Discount.sql
3236_tri_Shop_Discount_Region_Currency_Link.sql
3300_tri_Shop_Permission_Group.sql
3303_tri_Shop_Permission.sql
3306_tri_Shop_Role.sql
3309_tri_Shop_Role_Permission_Link.sql
3312_tri_Shop_User.sql
3315_tri_Shop_User_Role_Link.sql
3318_tri_Shop_User_Address.sql
3321_tri_Shop_User_Basket.sql
3324_tri_Shop_User_Order_Status.sql
3400_tri_Shop_Supplier.sql
3403_tri_Shop_Supplier_Address.sql
3403_tri_Shop_Unit_Measurement.sql
3406_tri_Shop_Unit_Of_Measurement_Conversion.sql
3409_tri_Shop_Supplier_Purchase_Order.sql
3412_tri_Shop_Supplier_Purchase_Order_Product_Link.sql
3415_tri_Shop_Manufacturing_Purchase_Order.sql
3418_tri_Shop_Manufacturing_Purchase_Order_Product_Link.sql
3421_tri_Shop_Customer.sql
3424_tri_Shop_Customer_Sales_Order.sql
3427_tri_Shop_Customer_Sales_Order_Product_Link.sql
6000_p_debug_timing_reporting.sql
6000_p_split.sql
6001_p_clear_split_temp.sql
6001_p_validate_guid.sql
6003_p_split_key_value_pair_csv.sql
6004_p_clear_split_key_value_pair_csv_temp.sql
6206_fn_shop_get_product_permutation_name.sql
6210_fn_shop_get_id_product_permutation_from_variation_csv_list.sql
6211_fn_shop_get_product_variations_from_id_csv_list.sql
6500_p_shop_calc_user.sql
6501_p_shop_clear_calc_user.sql
7003_p_shop_get_many_access_level.sql
7101_p_shop_get_many_region.sql
7106_p_shop_get_many_plant.sql
7109_p_shop_get_many_storage_location.sql
7116_p_shop_get_many_currency.sql
7122_p_shop_get_many_unit_measurement.sql
7200_p_shop_save_product_category.sql
7200_p_shop_save_product_category_test.sql
7202_p_shop_clear_calc_product_permutation.sql
7203_p_shop_save_product.sql
7203_p_shop_save_product_test.sql
7204_p_shop_calc_product_permutation.sql
7204_p_shop_get_many_product.sql
7205_p_shop_get_many_stripe_product_new.sql
7206_p_shop_save_product_permutation.sql
7206_p_shop_save_product_permutation_test.sql
7210_p_shop_get_many_product_variation.sql
7212_p_shop_save_product_variation.sql
7212_p_shop_save_product_variation_test.sql
7219_p_shop_get_many_stock_item.sql
7220_p_shop_save_stock_item.sql
7220_p_shop_save_stock_item_test.sql
7221_p_get_many_shop_product_price_and_discount_and_delivery_option.sql
7223_p_shop_get_many_stripe_price_new.sql
7312_p_shop_save_user.sql
7313_p_get_many_user.sql
7321_p_shop_save_user_basket.sql
7400_p_shop_save_supplier.sql
7400_p_shop_save_supplier_temp.sql
7401_p_shop_get_many_supplier.sql
7403_p_shop_save_supplier_purchase_order.sql
7403_p_shop_save_supplier_purchase_order_test.sql
7404_p_shop_get_many_supplier_purchase_order.sql
7415_p_shop_save_manufacturing_purchase_order.sql
7415_p_shop_save_Manufacturing_purchase_order_test.sql
7416_p_shop_get_many_manufacturing_purchase_order.sql
7421_p_shop_save_customer.sql
7422_p_shop_get_many_customer.sql
7424_p_shop_save_customer_sales_order.sql
7425_p_shop_get_many_customer_sales_order.sql
9000_populate.sql
9001_view.sql
9010_anal.sql

25170
static/batch/0000_combined.sql Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,6 @@
-- File: combined.sql
GO

View File

@@ -2018,9 +2018,12 @@ var OverlayError = /*#__PURE__*/function () {
;// CONCATENATED MODULE: ./static/js/pages/base_table.js
function base_table_typeof(o) { "@babel/helpers - typeof"; return base_table_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, base_table_typeof(o); }
function base_table_defineProperty(e, r, t) { return (r = base_table_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
function base_table_classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
function base_table_defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, base_table_toPropertyKey(o.key), o); } }
function base_table_createClass(e, r, t) { return r && base_table_defineProperties(e.prototype, r), t && base_table_defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
function base_table_toPropertyKey(t) { var i = base_table_toPrimitive(t, "string"); return "symbol" == base_table_typeof(i) ? i : i + ""; }
function base_table_toPrimitive(t, r) { if ("object" != base_table_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != base_table_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
function base_table_callSuper(t, o, e) { return o = base_table_getPrototypeOf(o), base_table_possibleConstructorReturn(t, base_table_isNativeReflectConstruct() ? Reflect.construct(o, e || [], base_table_getPrototypeOf(t).constructor) : o.apply(t, e)); }
function base_table_possibleConstructorReturn(t, e) { if (e && ("object" == base_table_typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return base_table_assertThisInitialized(t); }
function base_table_assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
@@ -2031,9 +2034,6 @@ function base_table_superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) &
function base_table_getPrototypeOf(t) { return base_table_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, base_table_getPrototypeOf(t); }
function base_table_inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && base_table_setPrototypeOf(t, e); }
function base_table_setPrototypeOf(t, e) { return base_table_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, base_table_setPrototypeOf(t, e); }
function base_table_defineProperty(e, r, t) { return (r = base_table_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
function base_table_toPropertyKey(t) { var i = base_table_toPrimitive(t, "string"); return "symbol" == base_table_typeof(i) ? i : i + ""; }
function base_table_toPrimitive(t, r) { if ("object" != base_table_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != base_table_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
@@ -2053,18 +2053,12 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) {
var _this;
base_table_classCallCheck(this, TableBasePage);
_this = base_table_callSuper(this, TableBasePage, [router]);
base_table_defineProperty(_this, "getAndLoadFilteredTableContent", function () {
_this.callFilterTableContent()["catch"](function (error) {
return console.error('Error:', error);
});
});
_this.cursorYInitial = null;
_this.rowInitial = null;
_this.placeholder = null;
_this.dragSrcEl = null;
_this.dragSrcRow = null;
_this.hookupTableCellDdls = _this.hookupTableCellDdls.bind(_this);
_this.getAndLoadFilteredTableContent = _this.getAndLoadFilteredTableContent.bind(_this);
return _this;
}
base_table_inherits(TableBasePage, _BasePage);
@@ -2139,9 +2133,15 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) {
var _this3 = this;
this.hookupEventHandler("click", idButtonApplyFilters, function (event, button) {
event.stopPropagation();
_this3.getAndLoadFilteredTableContent();
_this3.callFilterTableContent();
});
}
/*
getAndLoadFilteredTableContent = () => {
this.callFilterTableContent()
.catch(error => console.error('Error:', error));
}
*/
}, {
key: "getFormFilters",
value: function getFormFilters() {
@@ -2216,7 +2216,7 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) {
console.log('Records saved!');
console.log('Data received:', data);
}
_this5.getAndLoadFilteredTableContent();
_this5.callFilterTableContent();
} else {
if (_verbose) {
console.log("error: ", data[flagMessage]);
@@ -2277,10 +2277,11 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) {
}, {
key: "hookupButtonCancel",
value: function hookupButtonCancel() {
var _this8 = this;
Events.initialiseEventHandler(idFormFilters + ' button.' + flagCancel, flagInitialised, function (button) {
button.addEventListener("click", function (event) {
event.stopPropagation();
this.getAndLoadFilteredTableContent();
_this8.callFilterTableContent();
});
button.classList.add(flagCollapsed);
});
@@ -2313,14 +2314,14 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) {
}, {
key: "hookupTableMain",
value: function hookupTableMain() {
var _this8 = this;
var _this9 = this;
if (this.constructor === TableBasePage) {
throw new Error("Must implement hookupTableMain() method.");
}
if (true) {
// _rowBlank == null) {
Events.initialiseEventHandler(idTableMain, flagInitialised, function (table) {
_this8.cacheRowBlank();
_this9.cacheRowBlank();
});
}
}
@@ -2378,9 +2379,9 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) {
}, {
key: "hookupChangeHandlerTableCells",
value: function hookupChangeHandlerTableCells(inputSelector) {
var _this9 = this;
var _this10 = this;
var handler = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (event, element) {
_this9.handleChangeNestedElementCellTable(event, element);
_this10.handleChangeNestedElementCellTable(event, element);
};
Events.initialiseEventHandler(inputSelector, flagInitialised, function (input) {
input.addEventListener("change", function (event) {
@@ -2524,9 +2525,9 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) {
}, {
key: "hookupChangeHandlerTableCellsWhenNotCollapsed",
value: function hookupChangeHandlerTableCellsWhenNotCollapsed(inputSelector) {
var _this10 = this;
var _this11 = this;
var handler = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (event, element) {
if (!element.classList.contains(flagCollapsed)) _this10.handleChangeNestedElementCellTable(event, element);
if (!element.classList.contains(flagCollapsed)) _this11.handleChangeNestedElementCellTable(event, element);
};
this.hookupEventHandler("change", inputSelector, handler);
}
@@ -2606,10 +2607,10 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) {
}, {
key: "hookupFieldsActive",
value: function hookupFieldsActive() {
var _this11 = this;
var _this12 = this;
var flagTable = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
var handleClickRowNew = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (event, element) {
_this11.handleClickAddRowTable(event, element);
_this12.handleClickAddRowTable(event, element);
};
var selectorButton = 'table' + (validation_Validation.isEmpty(flagTable) ? '' : '.' + flagTable) + ' > tbody > tr > td.' + flagActive + ' button';
var selectorButtonDelete = selectorButton + '.' + flagDelete;
@@ -2624,9 +2625,9 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) {
}, {
key: "hookupButtonsRowDelete",
value: function hookupButtonsRowDelete(selectorButtonDelete, selectorButtonUndelete) {
var _this12 = this;
var _this13 = this;
this.hookupEventHandler("click", selectorButtonDelete, function (event, element) {
_this12.handleClickButtonRowDelete(event, element, selectorButtonDelete, selectorButtonUndelete);
_this13.handleClickButtonRowDelete(event, element, selectorButtonDelete, selectorButtonUndelete);
});
}
}, {
@@ -2651,9 +2652,9 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) {
}, {
key: "hookupButtonsRowUndelete",
value: function hookupButtonsRowUndelete(selectorButtonDelete, selectorButtonUndelete) {
var _this13 = this;
var _this14 = this;
this.hookupEventHandler("click", selectorButtonUndelete, function (event, element) {
_this13.handleClickButtonRowUndelete(event, element, selectorButtonDelete, selectorButtonUndelete);
_this14.handleClickButtonRowUndelete(event, element, selectorButtonDelete, selectorButtonUndelete);
});
}
}, {
@@ -2681,15 +2682,15 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) {
}, {
key: "hookupTableCellDdlPreviews",
value: function hookupTableCellDdlPreviews(cellSelector, optionList) {
var _this14 = this;
var _this15 = this;
var ddlHookup = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function (cellSelector) {
_this14.hookupTableCellDdls(cellSelector);
_this15.hookupTableCellDdls(cellSelector);
};
var changeHandler = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : function (event, element) {
_this14.handleChangeNestedElementCellTable(event, element);
_this15.handleChangeNestedElementCellTable(event, element);
};
this.hookupEventHandler("click", cellSelector, function (event, td) {
_this14.handleClickTableCellDdlPreview(event, td, optionList, cellSelector, function (cellSelector) {
_this15.handleClickTableCellDdlPreview(event, td, optionList, cellSelector, function (cellSelector) {
ddlHookup(cellSelector, function (event, element) {
changeHandler(event, element);
});
@@ -2700,9 +2701,9 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) {
}, {
key: "hookupTableCellDdls",
value: function hookupTableCellDdls(ddlSelector) {
var _this15 = this;
var _this16 = this;
var changeHandler = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (event, element) {
_this15.handleChangeNestedElementCellTable(event, element);
_this16.handleChangeNestedElementCellTable(event, element);
};
this.hookupEventHandler("change", ddlSelector, function (event, element) {
changeHandler(event, element);
@@ -2711,9 +2712,9 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) {
}, {
key: "handleClickTableCellDdlPreview",
value: function handleClickTableCellDdlPreview(event, td, optionObjectList, cellSelector) {
var _this16 = this;
var _this17 = this;
var ddlHookup = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : function (cellSelector) {
_this16.hookupTableCellDdls(cellSelector);
_this17.hookupTableCellDdls(cellSelector);
};
if (td.querySelector('select')) return;
// td.removeEventListener("click", ddlHookup);
@@ -2773,14 +2774,14 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) {
}, {
key: "hookupTableCellDDlPreviewsWhenNotCollapsed",
value: function hookupTableCellDDlPreviewsWhenNotCollapsed(cellSelector, optionList) {
var _this17 = this;
var _this18 = this;
var ddlHookup = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function (event, element) {
_this17.hookupTableCellDdls(event, element);
_this18.hookupTableCellDdls(event, element);
};
this.hookupEventHandler("click", cellSelector, function (event, td) {
var div = td.querySelector('div');
if (!div || div.classList.contains(flagCollapsed)) return;
_this17.handleClickTableCellDdlPreview(event, td, optionList, cellSelector, function (event, element) {
_this18.handleClickTableCellDdlPreview(event, td, optionList, cellSelector, function (event, element) {
ddlHookup(event, element);
});
});
@@ -2788,9 +2789,9 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) {
}, {
key: "hookupProductCategoryDdls",
value: function hookupProductCategoryDdls(ddlSelector) {
var _this18 = this;
var _this19 = this;
this.hookupChangeHandlerTableCells(ddlSelector, function (event, element) {
_this18.handleChangeProductCategoryDdl(event, element);
_this19.handleChangeProductCategoryDdl(event, element);
});
}
}, {
@@ -2824,15 +2825,15 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) {
}, {
key: "hookupPreviewsProductPermutationVariation",
value: function hookupPreviewsProductPermutationVariation() {
var _this19 = this;
var _this20 = this;
this.hookupEventHandler("click", idTableMain + ' td.' + flagProductVariations, function (event, element) {
return _this19.handleClickProductPermutationVariationsPreview(event, element);
return _this20.handleClickProductPermutationVariationsPreview(event, element);
});
}
}, {
key: "handleClickProductPermutationVariationsPreview",
value: function handleClickProductPermutationVariationsPreview(event, element) {
var _this20 = this;
var _this21 = this;
var tblVariations = element.querySelector('table.' + flagProductVariations);
if (!validation_Validation.isEmpty(tblVariations)) return;
this.toggleColumnCollapsed(flagProductVariations, false);
@@ -2861,7 +2862,7 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) {
var tbody = document.createElement("tbody");
if (!validation_Validation.isEmpty(permutationVariations)) {
permutationVariations.forEach(function (permutationVariation, index) {
_this20.addProductPermutationVariationRow(tbody, permutationVariation);
_this21.addProductPermutationVariationRow(tbody, permutationVariation);
});
}
tblVariations.appendChild(tbody);
@@ -3007,9 +3008,9 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) {
}, {
key: "hookupDdlsProductPermutationVariationType",
value: function hookupDdlsProductPermutationVariationType() {
var _this21 = this;
var _this22 = this;
this.hookupTableCellDdls(idTableMain + ' td.' + flagProductVariations + ' td.' + flagProductVariationType + ' select', function (event, ddlVariationType) {
_this21.handleChangeDdlProductVariationOrVariationType(event, ddlVariationType);
_this22.handleChangeDdlProductVariationOrVariationType(event, ddlVariationType);
var idVariationTypeSelected = DOM.getElementValueCurrent(ddlVariationType);
var row = DOM.getRowFromElement(ddlVariationType);
var tdVariation = row.querySelector('td.' + flagProductVariation);
@@ -3025,7 +3026,7 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) {
option = DOM.createOption(optionJson);
ddlVariation.appendChild(option);
});
_this21.handleChangeDdlProductVariationOrVariationType(event, ddlVariation);
_this22.handleChangeDdlProductVariationOrVariationType(event, ddlVariation);
});
}
}, {
@@ -3037,21 +3038,21 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) {
}, {
key: "hookupDdlsProductPermutationVariation",
value: function hookupDdlsProductPermutationVariation() {
var _this22 = this;
var _this23 = this;
this.hookupTableCellDdls(idTableMain + ' td.' + flagProductVariations + ' td.' + flagProductVariation + ' select', function (event, ddlVariation) {
_this22.handleChangeDdlProductVariationOrVariationType(event, ddlVariation);
_this23.handleChangeDdlProductVariationOrVariationType(event, ddlVariation);
});
}
}, {
key: "hookupButtonsProductPermutationVariationAddDelete",
value: function hookupButtonsProductPermutationVariationAddDelete() {
var _this23 = this;
var _this24 = this;
var selectorButton = idTableMain + ' td.' + flagProductVariations + ' tr.' + flagProductVariation + ' button';
var selectorButtonDelete = selectorButton + '.' + flagDelete;
var selectorButtonUndelete = selectorButton + '.' + flagAdd;
this.hookupButtonsRowDelete(selectorButtonDelete, selectorButtonUndelete, function (event, element) {
_this23.handleClickButtonRowDelete(event, element);
_this23.updateProductPermutationVariations(element);
_this24.handleClickButtonRowDelete(event, element);
_this24.updateProductPermutationVariations(element);
});
this.hookupButtonsRowUndelete(selectorButtonDelete, selectorButtonUndelete);
this.hookupButtonsProductPermutationVariationAdd();
@@ -3059,9 +3060,9 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) {
}, {
key: "hookupButtonsProductPermutationVariationAdd",
value: function hookupButtonsProductPermutationVariationAdd() {
var _this24 = this;
var _this25 = this;
this.hookupEventHandler("click", idTableMain + ' td.' + flagProductVariations + ' button.' + flagAdd, function (event, element) {
_this24.handleClickButtonProductPermutationVariationAdd(event, element);
_this25.handleClickButtonProductPermutationVariationAdd(event, element);
});
}
}, {

View File

@@ -25,7 +25,6 @@ export default class TableBasePage extends BasePage {
this.dragSrcRow = null;
this.hookupTableCellDdls = this.hookupTableCellDdls.bind(this);
this.getAndLoadFilteredTableContent = this.getAndLoadFilteredTableContent.bind(this);
}
initialize(isPopState = false) {
@@ -85,13 +84,15 @@ export default class TableBasePage extends BasePage {
hookupButtonApplyFilters() {
this.hookupEventHandler("click", idButtonApplyFilters, (event, button) => {
event.stopPropagation();
this.getAndLoadFilteredTableContent();
this.callFilterTableContent();
});
}
/*
getAndLoadFilteredTableContent = () => {
this.callFilterTableContent()
.catch(error => console.error('Error:', error));
}
*/
getFormFilters() {
return document.querySelector(idFormFilters);
}
@@ -146,7 +147,7 @@ export default class TableBasePage extends BasePage {
console.log('Records saved!');
console.log('Data received:', data);
}
this.getAndLoadFilteredTableContent();
this.callFilterTableContent();
}
else {
if (_verbose) { console.log("error: ", data[flagMessage]); }
@@ -193,10 +194,10 @@ export default class TableBasePage extends BasePage {
.catch(error => console.error('Error:', error));
}
hookupButtonCancel() {
Events.initialiseEventHandler(idFormFilters + ' button.' + flagCancel, flagInitialised, function(button) {
button.addEventListener("click", function(event) {
Events.initialiseEventHandler(idFormFilters + ' button.' + flagCancel, flagInitialised, (button) => {
button.addEventListener("click", (event) => {
event.stopPropagation();
this.getAndLoadFilteredTableContent();
this.callFilterTableContent();
});
button.classList.add(flagCollapsed);
});