From dd608022cda0181ef6deb49ad1930dc3980ab161 Mon Sep 17 00:00:00 2001 From: Teddy Middleton-Smith Date: Sun, 16 Mar 2025 16:56:15 +0000 Subject: [PATCH] Feat: \n 1. Contact Us page form submission success page created. \n 2. Contact Us page styling and CAPTCHA text content. \n 3. Removal of ERP, Google CAPTCHA, and ALTCHA API code and left over comments in JavaScript, Python. --- .gitignore | 1 + app.py | 2 - business_objects/access_level.py | 1 - business_objects/address.py | 1 - business_objects/api.py | 32 + business_objects/region.py | 1 - business_objects/unit_measurement.py | 1 - config.py | 1 - controllers/core.py | 161 ++--- controllers/store/store.py | 31 - controllers/user.py | 243 ------- datastores/datastore_base.py | 96 --- datastores/datastore_store_base.py | 351 ---------- datastores/datastore_store_stripe.py | 195 ------ datastores/datastore_user.py | 180 ++--- forms/contact.py | 6 +- lib/argument_validation.py | 62 +- models/model_view_base.py | 136 +--- models/model_view_contact_success.py | 31 + pay_stripe.py | 182 ----- static/css/main.css | 2 +- static/css/pages/core/contact.css | 45 +- static/dist/css/core_contact.bundle.css | 45 +- static/dist/css/main.bundle.css | 1 + static/dist/js/main.bundle.js | 645 +++++------------- static/js/api.js | 104 --- static/js/components/common/video.js | 6 +- static/js/dom.js | 24 +- .../lib/business_objects/business_objects.js | 10 +- static/js/lib/utils.js | 5 + static/js/pages/base.js | 18 +- static/js/pages/base_table.js | 453 +----------- static/js/pages/core/contact-success.js | 16 + static/js/router.js | 93 +-- templates/components/store/_body_home.html | 33 - .../store/_preview_DDL_currency.html | 17 - .../store/_preview_DDL_product.html | 15 - .../store/_preview_DDL_product_category.html | 15 - ...mutation_interval_expiration_unsealed.html | 17 - ...oduct_permutation_interval_recurrence.html | 19 - ...permutation_unit_measurement_quantity.html | 21 - ...eview_DDL_stock_item_storage_location.html | 13 - .../store/_preview_DDL_supplier.html | 17 - .../components/store/_preview_address.html | 13 - ...ew_manufacturing_purchase_order_items.html | 13 - .../store/_preview_order_items.html | 13 - ...review_product_permutation_variations.html | 14 - ...iew_product_variation_type_variations.html | 21 - .../_preview_product_variation_types.html | 15 - templates/components/store/_row_address.html | 79 --- templates/components/store/_row_basket.html | 18 - .../components/store/_row_basket_item.html | 42 -- .../_row_manufacturing_purchase_order.html | 84 --- templates/components/store/_row_product.html | 60 -- .../store/_row_product_category.html | 42 -- .../store/_row_product_permutation.html | 183 ----- .../store/_row_product_variation_type.html | 51 -- .../components/store/_row_stock_item.html | 147 ---- templates/components/store/_row_supplier.html | 67 -- .../store/_row_supplier_purchase_order.html | 66 -- templates/components/store/_td_active.html | 13 - templates/layouts/_shared_store.html | 31 - templates/layouts/layout.html | 41 +- templates/pages/core/_contact.html | 122 +--- templates/pages/core/_contact_success.html | 22 + .../pages/legal/_accessibility_statement.html | 7 +- .../pages/legal/_retention_schedule.html | 2 +- todo.txt | 4 +- 68 files changed, 597 insertions(+), 3921 deletions(-) create mode 100644 business_objects/api.py delete mode 100644 controllers/store/store.py delete mode 100644 controllers/user.py delete mode 100644 datastores/datastore_store_base.py delete mode 100644 datastores/datastore_store_stripe.py create mode 100644 models/model_view_contact_success.py delete mode 100644 pay_stripe.py create mode 100644 static/js/pages/core/contact-success.js delete mode 100644 templates/components/store/_body_home.html delete mode 100644 templates/components/store/_preview_DDL_currency.html delete mode 100644 templates/components/store/_preview_DDL_product.html delete mode 100644 templates/components/store/_preview_DDL_product_category.html delete mode 100644 templates/components/store/_preview_DDL_product_permutation_interval_expiration_unsealed.html delete mode 100644 templates/components/store/_preview_DDL_product_permutation_interval_recurrence.html delete mode 100644 templates/components/store/_preview_DDL_product_permutation_unit_measurement_quantity.html delete mode 100644 templates/components/store/_preview_DDL_stock_item_storage_location.html delete mode 100644 templates/components/store/_preview_DDL_supplier.html delete mode 100644 templates/components/store/_preview_address.html delete mode 100644 templates/components/store/_preview_manufacturing_purchase_order_items.html delete mode 100644 templates/components/store/_preview_order_items.html delete mode 100644 templates/components/store/_preview_product_permutation_variations.html delete mode 100644 templates/components/store/_preview_product_variation_type_variations.html delete mode 100644 templates/components/store/_preview_product_variation_types.html delete mode 100644 templates/components/store/_row_address.html delete mode 100644 templates/components/store/_row_basket.html delete mode 100644 templates/components/store/_row_basket_item.html delete mode 100644 templates/components/store/_row_manufacturing_purchase_order.html delete mode 100644 templates/components/store/_row_product.html delete mode 100644 templates/components/store/_row_product_category.html delete mode 100644 templates/components/store/_row_product_permutation.html delete mode 100644 templates/components/store/_row_product_variation_type.html delete mode 100644 templates/components/store/_row_stock_item.html delete mode 100644 templates/components/store/_row_supplier.html delete mode 100644 templates/components/store/_row_supplier_purchase_order.html delete mode 100644 templates/components/store/_td_active.html delete mode 100644 templates/layouts/_shared_store.html create mode 100644 templates/pages/core/_contact_success.html diff --git a/.gitignore b/.gitignore index 861528f2..39676460 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ __pycache__/ # Ignore logs and databases *.log +*.log.* # Ignore logs and databases # *.sql diff --git a/app.py b/app.py index bce9482c..dde2d44c 100644 --- a/app.py +++ b/app.py @@ -19,7 +19,6 @@ Initializes the Flask application, sets the configuration based on the environme from config import app_config, Config from controllers.core import routes_core from controllers.legal import routes_legal -from controllers.user import routes_user from extensions import db, csrf, mail, oauth from helpers.helper_app import Helper_App # external @@ -109,7 +108,6 @@ with app.app_context(): app.register_blueprint(routes_core) app.register_blueprint(routes_legal) -app.register_blueprint(routes_user) diff --git a/business_objects/access_level.py b/business_objects/access_level.py index 7d5fdc95..95828157 100644 --- a/business_objects/access_level.py +++ b/business_objects/access_level.py @@ -74,7 +74,6 @@ class Access_Level(db.Model, Base): } @classmethod def from_json(cls, json): - Helper_App.console_log(f'Access Level.from_json: {json}') access_level = cls() access_level.id_access_level = json[cls.ATTR_ID_ACCESS_LEVEL], access_level.code = json[cls.FLAG_CODE], diff --git a/business_objects/address.py b/business_objects/address.py index 6805fb66..572a6ff6 100644 --- a/business_objects/address.py +++ b/business_objects/address.py @@ -94,7 +94,6 @@ class Address(db.Model, Base): return jsonify(self.to_json()) @classmethod def from_json(cls, json): - Helper_App.console_log(f'{cls.__name__}.from_json: {json}') address = cls() address.id_address = json[cls.ATTR_ID_ADDRESS], address.region = Region.from_json(json[cls.FLAG_REGION]), diff --git a/business_objects/api.py b/business_objects/api.py new file mode 100644 index 00000000..4f004b84 --- /dev/null +++ b/business_objects/api.py @@ -0,0 +1,32 @@ +""" +Project: PARTS Website +Author: Edward Middleton-Smith + Precision And Research Technology Systems Limited + +Technology: Business Objects +Feature: Base Business Object + +Description: +Abstract business object +""" + +# internal +from extensions import db +import lib.argument_validation as av +# external +from typing import ClassVar +from flask import jsonify + + +class API(): + + @staticmethod + def get_standard_response(success: bool, status_code: int, message: str, data: any, errors: list, meta: dict): + return jsonify({ + "success": success, + "status_code": status_code, + "message": message, + "data": data, + "errors": errors, + "meta": meta + }) diff --git a/business_objects/region.py b/business_objects/region.py index b5029e06..dbecd0c5 100644 --- a/business_objects/region.py +++ b/business_objects/region.py @@ -62,7 +62,6 @@ class Region(db.Model, Base): } @classmethod def from_json(cls, json): - Helper_App.console_log(f'{cls.__name__}.from_json: {json}') plant = cls() plant.id_region = json[cls.ATTR_ID_REGION] plant.code = json[cls.FLAG_CODE] diff --git a/business_objects/unit_measurement.py b/business_objects/unit_measurement.py index 372026ff..2f5cc80e 100644 --- a/business_objects/unit_measurement.py +++ b/business_objects/unit_measurement.py @@ -79,7 +79,6 @@ class Unit_Measurement(SQLAlchemy_ABC, Base): } @classmethod def from_json(cls, json): - Helper_App.console_log(f' Unit_Measurement.from_json: {json}') unit = cls() unit.id_unit_measurement = json[cls.ATTR_ID_UNIT_MEASUREMENT] unit.name_singular = json[cls.FLAG_NAME_SINGULAR] diff --git a/config.py b/config.py index 2527a96a..88d7a3e4 100644 --- a/config.py +++ b/config.py @@ -11,7 +11,6 @@ Configuration variables """ # IMPORTS -from lib import argument_validation as av import os from dotenv import load_dotenv, find_dotenv from flask import current_app diff --git a/controllers/core.py b/controllers/core.py index 6a4bb3af..279513c7 100644 --- a/controllers/core.py +++ b/controllers/core.py @@ -12,10 +12,12 @@ Initializes the Flask application, sets the configuration based on the environme # IMPORTS # internal +from business_objects.api import API from datastores.datastore_base import DataStore_Base from forms.contact import Form_Contact from helpers.helper_app import Helper_App from models.model_view_contact import Model_View_Contact +from models.model_view_contact_success import Model_View_Contact_Success from models.model_view_home import Model_View_Home import lib.argument_validation as av # external @@ -51,49 +53,26 @@ def contact(): form = Form_Contact() model = Model_View_Contact(form) html_body = render_template('pages/core/_contact.html', model = model) + return html_body except Exception as e: - return jsonify(error=str(e)), 403 - return html_body + return API.get_standard_response( + success = False, + status_code = 500, + message = f"Error: {e}", + data = None, + errors = [str(e)], + meta = None + ) -@routes_core.route(Model_View_Contact.HASH_PAGE_CONTACT, methods=['POST']) -def contact_post(): - try: - form = Form_Contact() - Helper_App.console_log(f"Form submitted: {request.form}") - Helper_App.console_log(f"ALTCHA data in request: {request.form.get('altcha')}") - if form.validate_on_submit(): - try: - email = form.email.data - # CC = form.CC.data # not in use - contact_name = form.contact_name.data - company_name = form.company_name.data - message = form.message.data - receive_marketing = form.receive_marketing.data - receive_marketing_text = "I would like to receive marketing emails." if receive_marketing else "" - # send email - mailItem = Message("PARTS Website Contact Us Message", recipients=[current_app.config['MAIL_CONTACT_PUBLIC']]) - mailItem.body = f"Dear Lord Edward Middleton-Smith,\n\n{message}\n{receive_marketing_text}\nKind regards,\n{contact_name}\n{company_name}\n{email}" - mail.send(mailItem) - flash('Thank you for your message. We will get back to you soon!', 'success') - return "Submitted." - except Exception as e: - return f"Error: {e}" - print(f"Form validation errors: {form.errors}") - return "Invalid. Failed to submit." - # html_body = render_template('pages/core/_contact.html', model = model) - except Exception as e: - return jsonify(error=str(e)), 403 - -@routes_core.route(Model_View_Contact.HASH_ALTCHA_CREATE_CHALLENGE, methods=['GET']) +@routes_core.route(Model_View_Contact.HASH_GET_ALTCHA_CHALLENGE, methods=['GET']) def create_altcha_challenge(): - Helper_App.console_log(f'secret key: {current_app.app_config.ALTCHA_SECRET_KEY}') options = ChallengeOptions( expires = datetime.datetime.now() + datetime.timedelta(hours=1), max_number = 100000, # The maximum random number hmac_key = current_app.app_config.ALTCHA_SECRET_KEY, ) challenge = create_challenge(options) - print("Challenge created:", challenge) + Helper_App.console_log(f"Challenge created: {challenge}") # return jsonify({"challenge": challenge}) return jsonify({ "algorithm": challenge.algorithm, @@ -102,58 +81,64 @@ def create_altcha_challenge(): "signature": challenge.signature, }) -""" -def verify_altcha_signature(payload): - "" "Verify the ALTCHA signature"" " - if 'algorithm' not in payload or 'signature' not in payload or 'verificationData' not in payload: - return False - - algorithm = payload['algorithm'] - signature = payload['signature'] - verification_data = payload['verificationData'] - - # Calculate SHA hash of the verification data - if algorithm == 'SHA-256': - hash_func = hashlib.sha256 - else: - # Fallback to SHA-256 if algorithm not specified - hash_func = hashlib.sha256 - - # Calculate the hash of verification_data - data_hash = hash_func(verification_data.encode('utf-8')).digest() - - # Calculate the HMAC signature - calculated_signature = hmac.new( - current_app.config["ALTCHA_SECRET_KEY"].encode('utf-8'), - data_hash, - hash_func - ).hexdigest() - - # Compare the calculated signature with the provided signature - return hmac.compare_digest(calculated_signature, signature) +@routes_core.route(Model_View_Contact.HASH_PAGE_CONTACT, methods=['POST']) +def contact_post(): + try: + form = Form_Contact() + if form.validate_on_submit(): + try: + email = form.email.data + # CC = form.CC.data # not in use + contact_name = form.contact_name.data + company_name = form.company_name.data + message = form.message.data + receive_marketing = form.receive_marketing.data + receive_marketing_text = "I would like to receive marketing emails.\n" if receive_marketing else "" + # send email + mailItem = Message("PARTS Website Contact Us Message", recipients=[current_app.config['MAIL_CONTACT_PUBLIC']]) + mailItem.body = f"Dear Lord Edward Middleton-Smith,\n\n{message}\n{receive_marketing_text}\nKind regards,\n{contact_name}\n{company_name}\n{email}" + mail.send(mailItem) + return redirect(url_for(Model_View_Contact.ENDPOINT_PAGE_CONTACT_SUCCESS)) + except Exception as e: + return API.get_standard_response( + success = False, + status_code = 500, + message = f"Error: {e}", + data = None, + errors = [str(e)], + meta = None + ) + return API.get_standard_response( + success = False, + status_code = 500, + message = f"Error: {form.errors}", + data = None, + errors = [str(form.errors)], + meta = None + ) + # html_body = render_template('pages/core/_contact.html', model = model) + except Exception as e: + return API.get_standard_response( + success = False, + status_code = 500, + message = f"Error: {e}", + data = None, + errors = [str(e)], + meta = None + ) - - -def create_altcha_dummy_signature(challenge): - # Example payload to verify - payload = { - "algorithm": challenge.algorithm, - "challenge": challenge.challenge, - "number": 12345, # Example number - "salt": challenge.salt, - "signature": challenge.signature, - } - return payload - -@routes_core.route(Model_View_Contact.HASH_ALTCHA_VERIFY_SOLUTION, methods=['POST']) -def verify_altcha_challenge(): - payload = request.json - - ok, err = verify_solution(payload, current_app.config["ALTCHA_SECRET_KEY"], check_expires=True) - if err: - return jsonify({"error": err}), 400 - elif ok: - return jsonify({"verified": True}) - else: - return jsonify({"verified": False}), 403 -""" +@routes_core.route(Model_View_Contact.HASH_PAGE_CONTACT_SUCCESS, methods=['GET']) +def contact_success(): + try: + model = Model_View_Contact_Success() + html_body = render_template('pages/core/_contact_success.html', model = model) + return html_body + except Exception as e: + return API.get_standard_response( + success = False, + status_code = 500, + message = f"Error: {e}", + data = None, + errors = [str(e)], + meta = None + ) diff --git a/controllers/store/store.py b/controllers/store/store.py deleted file mode 100644 index 5dae6b13..00000000 --- a/controllers/store/store.py +++ /dev/null @@ -1,31 +0,0 @@ -""" -Project: PARTS Website -Author: Edward Middleton-Smith - Precision And Research Technology Systems Limited - -Technology: App Routing -Feature: Store Routes - -Description: -Initializes the Flask application, sets the configuration based on the environment, and defines two routes (/ and /about) that render templates with the specified titles. -""" - -# IMPORTS -# internal -from models.model_view_store import Model_View_Store -# external -from flask import Flask, render_template, jsonify, request, render_template_string, send_from_directory, redirect, url_for, session, Blueprint, current_app, Response -from extensions import db, oauth -from urllib.parse import quote_plus, urlencode -from authlib.integrations.flask_client import OAuth -from authlib.integrations.base_client import OAuthError -from urllib.parse import quote, urlparse, parse_qs - -routes_store = Blueprint('routes_store', __name__) - -@routes_store.route(Model_View_Store.HASH_SCRIPTS_SECTION_STORE, methods=['GET']) -def scripts_section_store(): - hash_page_current = request.args.get('hash_page_current', default = Model_View_Store.HASH_SCRIPTS_SECTION_STORE, type = str) - model = Model_View_Store(hash_page_current=hash_page_current) - template = render_template('js/sections/store.js', model = model) - return Response(template, mimetype='application/javascript') \ No newline at end of file diff --git a/controllers/user.py b/controllers/user.py deleted file mode 100644 index bc0bc673..00000000 --- a/controllers/user.py +++ /dev/null @@ -1,243 +0,0 @@ -""" -Project: PARTS Website -Author: Edward Middleton-Smith - Precision And Research Technology Systems Limited - -Technology: App Routing -Feature: User Routes - -Description: -Initializes the Flask application, sets the configuration based on the environment, and defines two routes (/ and /about) that render templates with the specified titles. -""" - -# IMPORTS -# internal -from models.model_view_base import Model_View_Base -from models.model_view_user import Model_View_User -from business_objects.user import User, Parameters_User -from datastores.datastore_user import DataStore_User -from helpers.helper_app import Helper_App -import lib.argument_validation as av -# external -from flask import Flask, render_template, jsonify, request, render_template_string, send_from_directory, redirect, url_for, session, Blueprint, current_app -from flask_sqlalchemy import SQLAlchemy -from sqlalchemy import exc -from flask_wtf.csrf import generate_csrf -from werkzeug.exceptions import BadRequest -from extensions import oauth # db, -from urllib.parse import quote_plus, urlencode -from authlib.integrations.flask_client import OAuth -from authlib.integrations.base_client import OAuthError -from urllib.parse import quote, urlparse, parse_qs -from functools import wraps - -db = SQLAlchemy() - -routes_user = Blueprint('routes_user', __name__) - -def handle_db_disconnect(f): - @wraps(f) - def decorated_function(*args, **kwargs): - try: - return f(*args, **kwargs) - except exc.OperationalError as e: - if "MySQL server has gone away" in str(e): - # Close the session and create a new connection - db.session.remove() - db.session.rollback() - # Retry the operation - return f(*args, **kwargs) - raise - return decorated_function - -# User authentication -@routes_user.route("/login", methods=['POST', 'OPTIONS']) -def login(): - try: - Helper_App.console_log('login') - Helper_App.console_log(f'method={request.method}') - try: - data = request.json - try: - data = request.get_json() - except: - data = {} - except: - data = {} - Helper_App.console_log(f'data={data}') - hash_callback = data.get(Model_View_Base.FLAG_CALLBACK, Model_View_Base.HASH_PAGE_HOME) - Helper_App.console_log(f'hash_callback: {hash_callback}') - - """ - # Verify CSRF token manually - Helper_App.console_log(f'request headers={request.headers}') - token = request.headers.get(Model_View_Base.FLAG_CSRF_TOKEN) - Helper_App.console_log(f'token={token}') - Helper_App.console_log(f'session={session}') - Helper_App.console_log(f'session token={session.get('csrf_token')}') - if not token or token != session.get('csrf_token'): - token = data.get(Model_View_Base.FLAG_CSRF_TOKEN, None) - Helper_App.console_log(f'token={token}') - if not token or token != session.get('csrf_token'): - raise BadRequest('Invalid or missing CSRF token') - """ - # OAuth login - # callback_login = F'{Model_View_Base.HASH_CALLBACK_LOGIN}{data.get(Model_View_Base.FLAG_CALLBACK, Model_View_Base.HASH_PAGE_HOME)}' - - # encoded_path = quote(data.get(Model_View_Base.FLAG_CALLBACK, Model_View_Base.HASH_PAGE_HOME)) - uri_redirect = url_for('routes_user.login_callback', _external=True) # , subpath=encoded_path - - # uri_redirect = f'{current_app.URL_HOST}/login_callback?subpath={data.get(Model_View_Base.FLAG_CALLBACK, Model_View_Base.HASH_PAGE_HOME)}' - Helper_App.console_log(f'redirect uri: {uri_redirect}') - - Helper_App.console_log(f'Before red') - - red = oauth.auth0.authorize_redirect( - redirect_uri = uri_redirect, - state = quote(hash_callback) - ) - Helper_App.console_log(f'redirect: {red}') - headers = red.headers['Location'] - Helper_App.console_log(f'headers: {headers}') - parsed_url = urlparse(headers) - query_params = parse_qs(parsed_url.query) - Helper_App.console_log(f""" - OAuth Authorize Redirect URL: - - Base URL: {parsed_url.scheme}://{parsed_url.netloc}{parsed_url.path} - {parsed_url} - - Query Parameters: {query_params} - """) - return jsonify({'Success': True, Model_View_Base.FLAG_STATUS: Model_View_Base.FLAG_SUCCESS, f'{Model_View_Base.FLAG_CALLBACK}': headers}) - - return jsonify({'status': 'success', 'redirect': callback}) - except Exception as e: - return jsonify({'status': 'error', 'message': str(e)}), 400 - - -@routes_user.route("/login_callback") # / -@handle_db_disconnect -def login_callback(): - Helper_App.console_log('login_callback') - try: - error_state = request.args.get(Model_View_User.FLAG_ERROR_OAUTH) - has_error = error_state is not None - if has_error: - error_description = request.args.get(Model_View_User.FLAG_ERROR_DESCRIPTION_OAUTH) - error_text = f'Error: {error_state}: {error_description}' - Helper_App.console_log(error_text) - return login() - # Helper_App.console_log(f'code: {code}') - token = None - try: - token = oauth.auth0.authorize_access_token() - except Exception as e: - # Log the error for debugging - Helper_App.console_log(f"Error: {str(e)}") - session[current_app.config['ID_TOKEN_USER']] = token - # import user id - """ - Helper_App.console_log(f'str(type(token)) = {str(type(token))}') - Helper_App.console_log(f'token = {token}') - userinfo = token.get('userinfo') - Helper_App.console_log(f'user info: {userinfo}') - # id_user = token.get('sub') - id_user = userinfo.get('sub') - Helper_App.console_log(f'user ID: {id_user}') - """ - user = User.from_json_auth0(token) # datastore_user.get_user_auth0() - Helper_App.console_log(f'user: {user}') - filters = Parameters_User.from_user(user) - datastore_user = DataStore_User() - users, errors = datastore_user.get_many_user(filters, user) - try: - user = users[0] - Helper_App.console_log('User logged in') - Helper_App.console_log(f'user ({str(type(user))}): {user}') - Helper_App.console_log(f'user key: {Model_View_Base.FLAG_USER}') - user_json = user.to_json() - session[Model_View_Base.FLAG_USER] = user_json - Helper_App.console_log(f'user stored on session') - except: - Helper_App.console_log(f'User not found: {Parameters_User}\nDatabase query error: {errors}') - - try: - hash_callback = token.get('hash_callback') - if hash_callback is None: - Helper_App.console_log('hash is none') - state = request.args.get('state') - Helper_App.console_log(f'state: {state}') - hash_callback = state # .get('hash_callback') - Helper_App.console_log(f'hash_callback: {hash_callback}') - except: - Helper_App.console_log("get hash callback failed") - # id_user = get_id_user() - # add user to database - # DataStore_Store().add_new_user(id_user) # this is part of get basket - should occur on page load - - Helper_App.console_log(f'user session: {session[Model_View_Base.FLAG_USER]}') - return redirect(f"{current_app.config['URL_HOST']}{hash_callback}") - except Exception as e: - return jsonify({Model_View_Base.FLAG_STATUS: Model_View_Base.FLAG_FAILURE, Model_View_Base.FLAG_MESSAGE: f'Controller error.\n{e}'}) - -@routes_user.route("/logout") -def logout(): - session.clear() - url_logout = f"https://{current_app.config['DOMAIN_AUTH0']}/v2/logout?" + urlencode( - { - "returnTo": url_for("routes_user.logout_callback", _external=True), - "client_id": current_app.config['ID_AUTH0_CLIENT'], - }# , - # quote_via=quote_plus, - ) - Helper_App.console_log(f"Redirecting to {url_logout}") - return redirect(url_logout) - -@routes_user.route("/logout_callback") # / -@handle_db_disconnect -def logout_callback(): - return redirect(url_for('routes_core.home')) - try: - session[current_app.ID_TOKEN_USER] = None - user = User() - try: - hash_callback = token.get('hash_callback') - if hash_callback is None: - Helper_App.console_log('hash is none') - state = request.args.get('state') - Helper_App.console_log(f'state: {state}') - hash_callback = state # .get('hash_callback') - Helper_App.console_log(f'hash_callback: {hash_callback}') - except: - Helper_App.console_log("get hash callback failed") - # id_user = get_id_user() - # add user to database - # DataStore_Store().add_new_user(id_user) # this is part of get basket - should occur on page load - - Helper_App.console_log(f'user session: {session[Model_View_Base.FLAG_USER]}') - return redirect(f'{current_app.URL_HOST}{hash_callback}') - except Exception as e: - return jsonify({Model_View_Base.FLAG_STATUS: Model_View_Base.FLAG_FAILURE, Model_View_Base.FLAG_MESSAGE: f'Controller error.\n{e}'}) - - -@routes_user.route("/user") -def user(): - try: - model = Model_View_User() - for currency in model.currencies: - if currency.id_currency == model.user.id_currency_default: - model.user.currency_default = currency - break - for region in model.regions: - if region.id_region == model.user.id_region_default: - model.user.region_default = region - break - model.users = [model.user] - if not model.is_user_logged_in: - # return redirect(url_for('routes_user.login', data = jsonify({ Model_View_User.FLAG_CALLBACK: Model_View_User.HASH_PAGE_USER_ACCOUNT }))) - return redirect(url_for('routes_core.home')) - html_body = render_template('pages/user/_user.html', model = model) - except Exception as e: - return str(e) - return html_body diff --git a/datastores/datastore_base.py b/datastores/datastore_base.py index 71d14323..97c00721 100644 --- a/datastores/datastore_base.py +++ b/datastores/datastore_base.py @@ -89,60 +89,11 @@ class DataStore_Base(BaseModel): Helper_App.console_log(f'result: {result}') # conn.session.remove() return result - cursor = result.cursor - result_set_1 = cursor.fetchall() - Helper_App.console_log(f'categories: {result_set_1}') - cursor.nextset() - result_set_2 = cursor.fetchall() - Helper_App.console_log(f'products: {result_set_2}') @staticmethod def db_cursor_clear(cursor): while cursor.nextset(): Helper_App.console_log(f'new result set: {cursor.fetchall()}') - @classmethod - def get_many_region_and_currency(cls): - _m = 'DataStore_Base.get_many_region_and_currency' - _m_db_currency = 'p_shop_get_many_currency' - _m_db_region = 'p_shop_get_many_region' - - argument_dict_list_currency = { - 'a_get_inactive_currency': 0 - } - argument_dict_list_region = { - 'a_get_inactive_currency': 0 - } - - Helper_App.console_log(f'executing {_m_db_currency}') - result = cls.db_procedure_execute(_m_db_currency, argument_dict_list_currency) - cursor = result.cursor - Helper_App.console_log('data received') - - # cursor.nextset() - result_set_1 = cursor.fetchall() - currencies = [] - for row in result_set_1: - currency = Currency.make_from_DB_currency(row) - currencies.append(currency) - Helper_App.console_log(f'currencies: {currencies}') - DataStore_Base.db_cursor_clear(cursor) - - Helper_App.console_log(f'executing {_m_db_region}') - result = cls.db_procedure_execute(_m_db_region, argument_dict_list_region) - cursor = result.cursor - Helper_App.console_log('data received') - - # cursor.nextset() - result_set_1 = cursor.fetchall() - regions = [] - for row in result_set_1: - region = Region.make_from_DB_region(row) - regions.append(region) - Helper_App.console_log(f'regions: {regions}') - DataStore_Base.db_cursor_clear(cursor) - cursor.close() - - return regions, currencies @staticmethod def get_user_session(): Helper_App.console_log('DataStore_Base.get_user_session') @@ -214,30 +165,6 @@ 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: - row_keys = set(row.keys()) - if row_keys != expected_columns: - Helper_App.console_log(f"Column mismatch in row: {row}") - 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) - "" - 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): @@ -271,17 +198,9 @@ class DataStore_Base(BaseModel): filters = Filters_Access_Level() av.val_instance(filters, 'filters', _m, Filters_Access_Level) argument_dict = filters.to_json() - # user = cls.get_user_session() - # argument_dict['a_id_user'] = 1 # 'auth0|6582b95c895d09a70ba10fef' # id_user - Helper_App.console_log(f'argument_dict: {argument_dict}') - Helper_App.console_log('executing p_shop_get_many_access_level') result = cls.db_procedure_execute('p_shop_get_many_access_level', argument_dict) cursor = result.cursor - Helper_App.console_log('data received') - - # access_levels result_set_1 = cursor.fetchall() - Helper_App.console_log(f'raw access levels: {result_set_1}') access_levels = [] for row in result_set_1: new_access_level = Access_Level.from_DB_access_level(row) @@ -290,7 +209,6 @@ class DataStore_Base(BaseModel): # Errors cursor.nextset() 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]) @@ -308,17 +226,9 @@ class DataStore_Base(BaseModel): filters = Filters_Unit_Measurement() av.val_instance(filters, 'filters', _m, Filters_Unit_Measurement) argument_dict = filters.to_json() - # user = cls.get_user_session() - # argument_dict['a_id_user'] = 1 # 'auth0|6582b95c895d09a70ba10fef' # id_user - Helper_App.console_log(f'argument_dict: {argument_dict}') - Helper_App.console_log('executing p_shop_get_many_unit_measurement') result = cls.db_procedure_execute('p_shop_get_many_unit_measurement', argument_dict) cursor = result.cursor - Helper_App.console_log('data received') - - # units of measurement result_set_1 = cursor.fetchall() - Helper_App.console_log(f'raw units of measurement: {result_set_1}') units = [] for row in result_set_1: new_unit = Unit_Measurement.from_DB_unit_measurement(row) @@ -327,7 +237,6 @@ class DataStore_Base(BaseModel): # Errors cursor.nextset() 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]) @@ -348,18 +257,13 @@ class DataStore_Base(BaseModel): 'a_get_inactive_region': 1 if get_inactive else 0 } - Helper_App.console_log(f'executing {_m_db_region}') result = cls.db_procedure_execute(_m_db_region, argument_dict_list_region) cursor = result.cursor - Helper_App.console_log('data received') - - # cursor.nextset() result_set_1 = cursor.fetchall() regions = [] for row in result_set_1: region = Region.from_DB_region(row) regions.append(region) - Helper_App.console_log(f'regions: {regions}') DataStore_Base.db_cursor_clear(cursor) cursor.close() diff --git a/datastores/datastore_store_base.py b/datastores/datastore_store_base.py deleted file mode 100644 index 235fd74e..00000000 --- a/datastores/datastore_store_base.py +++ /dev/null @@ -1,351 +0,0 @@ -""" -Project: PARTS Website -Author: Edward Middleton-Smith - Precision And Research Technology Systems Limited - -Technology: DataStores -Feature: Base Store DataStore - -Description: -Datastore for Store -""" - -# internal -# from routes import bp_home -from business_objects.store.basket import Basket, Basket_Item -from business_objects.store.product_category import Product_Category_Container, Product_Category -from business_objects.currency import Currency -from business_objects.store.image import Image -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.store.product_variation import Product_Variation, Parameters_Product_Variation -from business_objects.store.product_variation_type import Product_Variation_Type -from datastores.datastore_base import DataStore_Base -from extensions import db -from helpers.helper_app import Helper_App -from helpers.helper_db_mysql import Helper_DB_MySQL -import lib.argument_validation as av -# from models.model_view_store_checkout import Model_View_Store_Checkout # circular! -# external -# from abc import ABC, abstractmethod, abstractproperty -from flask_sqlalchemy import SQLAlchemy -from sqlalchemy import text -import stripe -import os -from flask import Flask, session, current_app -from pydantic import BaseModel, ConfigDict -from typing import ClassVar -from datetime import datetime - -# db = SQLAlchemy() - - -class DataStore_Store_Base(DataStore_Base): - # Global constants - KEY_BASKET: ClassVar[str] = Basket.KEY_BASKET - KEY_IS_INCLUDED_VAT: ClassVar[str] = Basket.KEY_IS_INCLUDED_VAT # 'is_included_VAT' - KEY_ID_CURRENCY: ClassVar[str] = Basket.KEY_ID_CURRENCY # 'id_currency' - KEY_ID_REGION_DELIVERY: ClassVar[str] = Basket.KEY_ID_REGION_DELIVERY # 'id_region_delivery' - # Attributes - - def __init__(self, **kwargs): - super().__init__(**kwargs) - @classmethod - def get_many_product(cls, product_filters): - # redundant argument validation? - _m = 'DataStore_Store_Base.get_many_product' - av.val_instance(product_filters, 'product_filters', _m, Parameters_Product) - argument_dict = product_filters.to_json() - user = cls.get_user_session() - """ - argument_dict['a_id_user'] = user.id_user # 'auth0|6582b95c895d09a70ba10fef' # id_user - argument_dict['a_debug'] = 0 - """ - argument_dict = { - 'a_id_user': user.id_user - , **argument_dict - , 'a_debug': 0 - } - Helper_App.console_log(f'argument_dict: {argument_dict}') - Helper_App.console_log('executing p_shop_get_many_product') - result = cls.db_procedure_execute('p_shop_get_many_product', argument_dict) - cursor = result.cursor - Helper_App.console_log('data received') - - - category_list = Product_Category_Container() - Helper_App.console_log(f'initial category_list: {category_list}') - - # Categories - result_set_1 = cursor.fetchall() - Helper_App.console_log(f'raw categories: {result_set_1}') - for row in result_set_1: - new_category = Product_Category.from_DB_get_many_product_catalogue(row) - Helper_App.console_log(f'new_category: {new_category}') - category_list.add_product_category(new_category) - - Helper_App.console_log(f'category-loaded category_list: {category_list}') - - # Products - cursor.nextset() - result_set_2 = cursor.fetchall() - Helper_App.console_log(f'raw products: {result_set_2}') - for row in result_set_2: - Helper_App.console_log(f'row: {row}') - new_product = Product.from_DB_get_many_product_catalogue(row) - Helper_App.console_log(f'new_product: {new_product}') - try: - category_list.add_product(new_product) - except Exception as e: - Helper_App.console_log(f'Error adding product: {e}') - - # Permutations - cursor.nextset() - result_set_3 = cursor.fetchall() - for row in result_set_3: - new_permutation = Product_Permutation.from_DB_get_many_product_catalogue(row) - try: - category_list.add_product_permutation(new_permutation) - except Exception as e: - Helper_App.console_log(f'Error adding permutation: {e}') - - # Product_Variations - cursor.nextset() - result_set_4 = cursor.fetchall() - for row in result_set_4: - new_variation_type = Product_Variation_Type.from_DB_get_many_product_catalogue(row) - try: - category_list.add_product_variation_type(new_variation_type) - except Exception as e: - Helper_App.console_log(f'Error adding variation: {e}') - - # Images - cursor.nextset() - result_set_5 = cursor.fetchall() - for row in result_set_5: - new_image = Image.from_DB_get_many_product_catalogue(row) - category_list.add_product_image(new_image) - - # Errors - cursor.nextset() - 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}") - - category_list.get_all_product_variation_trees() - """ - for category in category_list.categories: - Helper_App.console_log(f'category: {category.name}') - for product in category.products: - permutation = product.get_permutation_selected() - Helper_App.console_log(f'product: {product.name}\nselected permutation: {permutation}') - """ - - if len(errors) > 0: - for error in errors: - if error.code == 'PRODUCT_AVAILABILITY': - ids_permutation_unavailable = DataStore_Store_Base.get_ids_permutation_from_error_availability(error.msg) - for id_permutation in ids_permutation_unavailable: - index_category = category_list.get_index_category_from_id_permutation(id_permutation) - category = category_list.categories[index_category] - index_product = category.get_index_product_from_id_permutation(id_permutation) - product = category.products[index_product] - index_permutation = product.get_index_permutation_from_id(id_permutation) - permutation = product.permutations[index_permutation] - permutation.is_available = False - if 'region' in error.msg or 'currency' in error.msg: - permutation.is_unavailable_in_currency_or_region = True - - - DataStore_Store_Base.db_cursor_clear(cursor) - cursor.close() - - Helper_App.console_log(f'get many category_list: {category_list}') - return category_list, errors # categories, category_index - - """ - def get_many_id_price(self, product_ids): - _m = 'DataStore_Store_Base.get_many_id_price' - av.val_str(product_ids, 'product_ids', _m) - price_ids = [] - for product_id in product_ids.split(','): - if product_id == 'prod_PB0NUOSEs06ymG': - price_ids.append() # get price id - return price_ids - """ - @staticmethod - def get_ids_permutation_from_error_availability(msg_error_availability): - ids_permutation = [] - index_colon = msg_error_availability.find(':', msg_error_availability.find(':')) - msg_error_availability = msg_error_availability[index_colon + 1:] - index_comma = 0 - while index_comma > -1: - msg_error_availability = msg_error_availability[index_comma:] - index_comma = msg_error_availability.find(',') - ids_permutation.append(msg_error_availability[:index_comma]) - return ids_permutation - - @classmethod - 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': 1 if get_inactive else 0 - } - - Helper_App.console_log(f'executing {_m_db_currency}') - result = cls.db_procedure_execute(_m_db_currency, argument_dict_list_currency) - cursor = result.cursor - Helper_App.console_log('data received') - - # cursor.nextset() - result_set_1 = cursor.fetchall() - currencies = [] - for row in result_set_1: - currency = Currency.from_DB_currency(row) - currencies.append(currency) - Helper_App.console_log(f'currencies: {currencies}') - DataStore_Store_Base.db_cursor_clear(cursor) - - return currencies - - @classmethod - 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(get_inactive_currency) - regions = cls.get_many_region(get_inactive_region) - return regions, currencies - - @classmethod - def get_many_product_variation(cls, variation_filters): - _m = 'DataStore_Store_Base.get_many_product_variation' - Helper_App.console_log(_m) - av.val_instance(variation_filters, 'variation_filters', _m, Parameters_Product_Variation) - - guid = Helper_DB_MySQL.create_guid() - # now = datetime.now() - # user = self.get_user_session() - - """ - argument_dict_list = { - 'a_id_user': id_user, - 'a_comment': comment, - 'a_guid': guid - } - """ - user = cls.get_user_session() - argument_dict_list = { - # 'a_guid': guid - 'a_id_user': user.id_user - , **variation_filters.to_json() - , 'a_debug': 0 - } - # argument_dict_list['a_guid'] = guid - result = cls.db_procedure_execute('p_shop_get_many_product_variation', argument_dict_list) - - cursor = result.cursor - result_set_vt = cursor.fetchall() - - # Product_Variation Types - # variation_container = Product_Variation_Container() - variation_types = [] - index_variation_type = {} - for row in result_set_vt: - new_variation_type = Product_Variation_Type.from_DB_get_many_product_variation(row) - # variation_container.add_product_variation_type(new_variation_type) - index_variation_type[new_variation_type.id_type] = len(variation_types) - variation_types.append(new_variation_type) - - Helper_App.console_log(f'index_variation_type: {index_variation_type}') - - # Product_Variations - cursor.nextset() - result_set_v = cursor.fetchall() - # variations = Product_Variation_Container() - variations = [] - for row in result_set_v: - new_variation = Product_Variation.from_DB_get_many_product_variation(row) - # new_variation.variation_type = variation_types_dict[new_variation.id_type] - # variation_container.add_product_variation(new_variation) - variation_types[index_variation_type[new_variation.id_type]].variations.append(new_variation) - variations.append(new_variation) - - errors = [] - cursor.nextset() - result_set_e = cursor.fetchall() - Helper_App.console_log(f'raw errors: {result_set_e}') - if len(result_set_e) > 0: - errors = [SQL_Error.from_DB_record(row) for row in result_set_e] # [SQL_Error(row[0], row[1]) for row in result_set_e] - for error in errors: - Helper_App.console_log(f"Error [{error.code}]: {error.msg}") - - DataStore_Store_Base.db_cursor_clear(cursor) - - cursor.close() - - return variation_types, variations, errors - \ No newline at end of file diff --git a/datastores/datastore_store_stripe.py b/datastores/datastore_store_stripe.py deleted file mode 100644 index 93da1d13..00000000 --- a/datastores/datastore_store_stripe.py +++ /dev/null @@ -1,195 +0,0 @@ -""" -Project: PARTS Website -Author: Edward Middleton-Smith - Precision And Research Technology Systems Limited - -Technology: DataStores -Feature: Store Stripe DataStore - -Description: -Datastore for Store Stripe service -""" - -# internal -# from routes import bp_home -import lib.argument_validation as av -from business_objects.store.basket import Basket, Basket_Item -from business_objects.store.product import Product, Product_Permutation, Product_Price, Parameters_Product -from business_objects.sql_error import SQL_Error -from datastores.datastore_store_base import DataStore_Store_Base -# from helpers.helper_db_mysql import Helper_DB_MySQL -# from models.model_view_store_checkout import Model_View_Store_Checkout # circular! -from extensions import db -from helpers.helper_app import Helper_App -# external -# from abc import ABC, abstractmethod, abstractproperty -from flask_sqlalchemy import SQLAlchemy -from sqlalchemy import text -import stripe -import os -from flask import Flask, session, current_app -from pydantic import BaseModel, ConfigDict -from typing import ClassVar -from datetime import datetime - -# db = SQLAlchemy() - - -class DataStore_Store_Stripe(DataStore_Store_Base): - # Global constants - # Attributes - key_public_stripe: str = None - key_secret_stripe: str = None - - def __init__(self): - super().__init__() - self.key_secret_stripe = os.environ.get("KEY_SECRET_STRIPE") - self.key_public_stripe = os.environ.get("KEY_PUBLIC_STRIPE") - - # For sample support and debugging, not required for production: - stripe.set_app_info( - 'stripe-samples/checkout-one-time-payments', - version='0.0.1', - url='https://github.com/stripe-samples/checkout-one-time-payments') - stripe.api_key = self.key_secret_stripe - - def get_many_stripe_product_new(self): - _m = 'DataStore_Store_Stripe.get_many_stripe_product_new' - _m_db = 'p_shop_get_many_stripe_product_new' - # av.val_str(id_user) - # validation conducted by server - - argument_dict_list = { - 'a_id_user': self.info_user - } - - Helper_App.console_log(f'executing {_m_db}') - result = self.db_procedure_execute(_m_db, argument_dict_list) - cursor = result.cursor - Helper_App.console_log('data received') - - - # Products - cursor.nextset() - result_set_1 = cursor.fetchall() - products = [] - for row in result_set_1: - new_product = Product.from_DB_Stripe_product(row) # Product(row[0], row[1], row[2], row[3], row[4], row[5], row[6], row[7], row[8], row[9], row[10], row[11], row[12], row[13], row[14], row[15], row[16], row[17], row[18], row[19]) - products.append(new_product) - Helper_App.console_log(f'products: {products}') - - # Errors - cursor.nextset() - result_set_e = cursor.fetchall() - Helper_App.console_log(f'raw errors: {result_set_e}') - if len(result_set_e) > 0: - errors = [SQL_Error.from_DB_record(row) for row in result_set_e] # [SQL_Error(row[0], row[1]) for row in result_set_e] - for error in errors: - Helper_App.console_log(f"Error [{error.code}]: {error.msg}") - - DataStore_Store_Stripe.db_cursor_clear(cursor) - - return products - - def get_many_stripe_price_new(self): - _m = 'DataStore_Store_Stripe.get_many_stripe_price_new' - _m_db = 'p_shop_get_many_stripe_price_new' - # av.val_str(id_user) - # validation conducted by server - - argument_dict_list = { - 'a_id_user': self.info_user - } - - Helper_App.console_log(f'executing {_m_db}') - result = self.db_procedure_execute(_m_db, argument_dict_list) - cursor = result.cursor - Helper_App.console_log('data received') - - - # Products - cursor.nextset() - result_set_1 = cursor.fetchall() - products = [] - for row in result_set_1: - new_product = Product.from_DB_Stripe_price(row) # Product(row[0], row[1], row[2], row[3], row[4], row[5], row[6], row[7], row[8], row[9], row[10], row[11], row[12], row[13], row[14], row[15], row[16], row[17], row[18], row[19]) - products.append(new_product) - Helper_App.console_log(f'products: {products}') - - # Errors - cursor.nextset() - result_set_e = cursor.fetchall() - Helper_App.console_log(f'raw errors: {result_set_e}') - if len(result_set_e) > 0: - errors = [SQL_Error.from_DB_record(row) for row in result_set_e] # [SQL_Error(row[0], row[1]) for row in result_set_e] - for error in errors: - Helper_App.console_log(f"Error [{error.code}]: {error.msg}") - - DataStore_Store_Stripe.db_cursor_clear(cursor) - - return products - - def get_many_product_new(self): - _m = 'DataStore_Store_Stripe.get_many_product_new' - # Stripe - new_products = self.get_many_stripe_product_new() - for product in new_products: - product.id_stripe_product = self.create_stripe_product(product) - return new_products - - def get_many_price_new(self): - _m = 'DataStore_Store_Stripe.get_many_product_new' - # Stripe - new_products = self.get_many_stripe_price_new() - for product in new_products: - product.id_stripe_price = self.create_stripe_price(product) - return new_products - - # Stripe - def create_stripe_product(self, product): # _name, product_description): - _m = 'DataStore_Store_Stripe_Checkout.create_stripe_product' - # av.val_str(product_name, 'product_name', _m) - # av.val_str(product_description, 'product_description', _m) - av.val_instance(product, 'product', _m, Product) - - Helper_App.console_log(f'stripe.api_key = {stripe.api_key}') - new_product = stripe.Product.create( - name = product.name, - description = product.description, - ) - - # Save these identifiers - Helper_App.console_log(f"Success! Here is your new Stripe product id: {new_product.id}") - - return new_product.id - - def create_stripe_price(self, product, currency): # product_id, product_price, product_currency, product_is_subscription, product_recurring_interval = '', product_interval_count = 0): - _m = 'DataStore_Store_Stripe_Checkout.create_stripe_price' - """ - av.val_str(p_id, 'p_id', _m) - av.full_val_float(p_price, 'p_price', _m, 0.01) - p_price = round(p_price, 2) - av.val_str(p_currency, 'p_currency', _m) - av.full_val_bool(p_is_subscription, 'p_is_subscription', _m) - p_is_subscription = bool(p_is_subscription) - av.val_str(p_recurring_interval, 'p_recurring_interval', _m) - av.full_val_int(p_interval_count, 'p_interval_count', _m, 1 if p_is_subscription else 0) - p_interval_count = int(p_interval_count) - """ - av.val_instance(product, 'product', _m, Product) - av.val_str(currency, 'currency', _m) - - Helper_App.console_log(f'stripe.api_key = {stripe.api_key}') - - new_product_price = stripe.Price.create( - unit_amount = product.unit_price, - currency = currency, - recurring = { "interval": product.name_recurring_interval, "interval_count": product.count_recurring_interval } if product.is_subscription else None, - product = product.id_stripe_product - ) - - # Save these identifiers - Helper_App.console_log(f"Success! Here is your Stripe product price id: {new_product_price.id} for {product.name}") - - return new_product_price.id - \ No newline at end of file diff --git a/datastores/datastore_user.py b/datastores/datastore_user.py index f79b526a..3960c23c 100644 --- a/datastores/datastore_user.py +++ b/datastores/datastore_user.py @@ -42,9 +42,7 @@ class DataStore_User(DataStore_Base): super().__init__() def edit_user(self): - # redundant argument validation? _m = 'DataStore_User.edit_user' - # av.val_instance(filters, 'filters', _m, Filters_Product_Category) argument_dict_list = { 'a_id_user': self.info_user.get('sub'), @@ -57,12 +55,10 @@ class DataStore_User(DataStore_Base): cursor = result.cursor result_set_1 = cursor.fetchall() - Helper_App.console_log(f'raw user data: {result_set_1}') # Errors cursor.nextset() result_set_e = cursor.fetchall() - Helper_App.console_log(f'raw errors: {result_set_e}') if len(result_set_e) > 0: errors = [SQL_Error.from_DB_record(row) for row in result_set_e] # [SQL_Error(row[0], row[1]) for row in result_set_2] for error in errors: @@ -71,67 +67,12 @@ class DataStore_User(DataStore_Base): DataStore_User.db_cursor_clear(cursor) return (result_set_1[0][1] == b'\x01') - - """ - def get_many_user_order(self, id_user, ids_order, n_order_max, id_checkout_session): - _m = 'DataStore_User.get_many_user_order' - # av.val_str(id_user) - # validation conducted by server - - argument_dict_list = { - 'a_id_user': id_user, - 'a_ids_order': ids_order, - 'a_n_order_max': n_order_max, - 'a_id_checkout_session': id_checkout_session - } - - Helper_App.console_log('executing p_shop_get_many_user_order') - result = self.db_procedure_execute('p_shop_get_many_user_order', argument_dict_list) - cursor = result.cursor - Helper_App.console_log('data received') - - - # Discount Delivery Regions - cursor.nextset() - result_set_1 = cursor.fetchall() - orders = [] - for row in result_set_1: - new_order = Order(row[0], row[1], row[2], row[3], row[4], row[5], row[6]) - orders.append(new_order) - Helper_App.console_log(f'orders: {orders}') - - # Errors - cursor.nextset() - result_set_e = cursor.fetchall() - Helper_App.console_log(f'raw errors: {result_set_e}') - if len(result_set_e) > 0: - errors = [SQL_Error.from_DB_record(row) for row in result_set_e] # [SQL_Error(row[0], row[1]) for row in result_set_e] - for error in errors: - Helper_App.console_log(f"Error [{error.code}]: {error.msg}") - - DataStore_User.db_cursor_clear(cursor) - - return orders - """ def get_many_user(self, user_filters, user=None): _m = 'DataStore_User.get_many_user' - Helper_App.console_log(_m) - # av.val_str(user_filters, 'user_filters', _m) - # av.val_list(permutations, 'list_permutations', _m, Product_Permutation, 1) av.val_instance(user_filters, 'user_filters', _m, Parameters_User) guid = Helper_DB_MySQL.create_guid() - # now = datetime.now() - # user = self.get_user_session() - - """ - argument_dict_list = { - 'a_id_user': id_user, - 'a_comment': comment, - 'a_guid': guid - } - """ if user is None: user = self.get_user_session() argument_dict_list = { @@ -142,92 +83,47 @@ class DataStore_User(DataStore_Base): , 'a_debug': 0 } - # argument_dict_list['a_guid'] = guid result = self.db_procedure_execute('p_get_many_user', argument_dict_list) - """ - query = text(f"SELECT * FROM Shop_Calc_User_Temp UE_T WHERE UE_T.guid = '{guid}'") - result = self.db.session.execute(query) - """ cursor = result.cursor result_set = cursor.fetchall() - Helper_App.console_log(f'raw users: {result_set}') - Helper_App.console_log(f'type result set: {str(type(result_set))}') - Helper_App.console_log(f'len result set: {len(result_set)}') - """ - user_permission_evals = [] - for row in result_set: - user_permission_eval = User_Permission_Evaluation.from_DB_user_eval(row) - user_permission_evals.append(user_permission_eval) - Helper_App.console_log(f'user_permission_evals: {user_permission_evals}') - """ - users = [] - if len(result_set) > 0: - for row in result_set: - Helper_App.console_log(f'row: {row}') - user = User.from_DB_user(row) - users.append(user) - Helper_App.console_log(f'user {str(type(user))}: {user}') - Helper_App.console_log(f'type users: {str(type(users))}\n type user 0: {str(type(None if len(users) == 0 else users[0]))}') - # error_list, cursor = self.get_error_list_from_cursor(cursor) - errors = [] - cursor.nextset() - result_set_e = cursor.fetchall() - Helper_App.console_log(f'raw errors: {result_set_e}') - if len(result_set_e) > 0: - errors = [SQL_Error.from_DB_record(row) for row in result_set_e] # [SQL_Error(row[0], row[1]) for row in result_set_e] - for error in errors: - Helper_App.console_log(f"Error [{error.code}]: {error.msg}") - - DataStore_User.db_cursor_clear(cursor) - - return users, errors - - def get_many_user(self, user_filters, user=None): - _m = 'DataStore_User.get_many_user' - Helper_App.console_log(_m) - # av.val_str(user_filters, 'user_filters', _m) - # av.val_list(permutations, 'list_permutations', _m, Product_Permutation, 1) - av.val_instance(user_filters, 'user_filters', _m, Parameters_User) - - guid = Helper_DB_MySQL.create_guid() - # now = datetime.now() - # user = self.get_user_session() - - """ - argument_dict_list = { - 'a_id_user': id_user, - 'a_comment': comment, - 'a_guid': guid - } - """ - if user is None: - user = self.get_user_session() - argument_dict_list = { - # 'a_guid': guid - 'a_id_user': user.id_user - , 'a_id_user_auth0': user.id_user_auth0 - , **user_filters.to_json() - , 'a_debug': 0 - - } - # argument_dict_list['a_guid'] = guid - result = self.db_procedure_execute('p_get_many_user', argument_dict_list) - """ - query = text(f"SELECT * FROM Shop_Calc_User_Temp UE_T WHERE UE_T.guid = '{guid}'") - result = self.db.session.execute(query) - """ - cursor = result.cursor - result_set = cursor.fetchall() - Helper_App.console_log(f'raw users: {result_set}') - Helper_App.console_log(f'type result set: {str(type(result_set))}') - Helper_App.console_log(f'len result set: {len(result_set)}') - """ - user_permission_evals = [] - for row in result_set: - user_permission_eval = User_Permission_Evaluation.from_DB_user_eval(row) - user_permission_evals.append(user_permission_eval) - Helper_App.console_log(f'user_permission_evals: {user_permission_evals}') - """ + users = [] + if len(result_set) > 0: + for row in result_set: + Helper_App.console_log(f'row: {row}') + user = User.from_DB_user(row) + users.append(user) + Helper_App.console_log(f'user {str(type(user))}: {user}') + errors = [] + cursor.nextset() + result_set_e = cursor.fetchall() + Helper_App.console_log(f'raw errors: {result_set_e}') + if len(result_set_e) > 0: + errors = [SQL_Error.from_DB_record(row) for row in result_set_e] # [SQL_Error(row[0], row[1]) for row in result_set_e] + for error in errors: + Helper_App.console_log(f"Error [{error.code}]: {error.msg}") + + DataStore_User.db_cursor_clear(cursor) + + return users, errors + + def get_many_user(self, user_filters, user=None): + _m = 'DataStore_User.get_many_user' + av.val_instance(user_filters, 'user_filters', _m, Parameters_User) + + guid = Helper_DB_MySQL.create_guid() + if user is None: + user = self.get_user_session() + argument_dict_list = { + # 'a_guid': guid + 'a_id_user': user.id_user + , 'a_id_user_auth0': user.id_user_auth0 + , **user_filters.to_json() + , 'a_debug': 0 + + } + result = self.db_procedure_execute('p_get_many_user', argument_dict_list) + cursor = result.cursor + result_set = cursor.fetchall() users = [] if len(result_set) > 0: for row in result_set: diff --git a/forms/contact.py b/forms/contact.py index 38846128..7bb9e73a 100644 --- a/forms/contact.py +++ b/forms/contact.py @@ -19,7 +19,7 @@ from forms.base import Form_Base # external from flask import Flask, render_template, request, flash, redirect, url_for, current_app from flask_wtf import FlaskForm -from wtforms import StringField, TextAreaField, SubmitField, HiddenField, BooleanField, Field +from wtforms import StringField, TextAreaField, SubmitField, HiddenField, BooleanField, Field, EmailField from wtforms.validators import DataRequired, Email, ValidationError import markupsafe from flask_wtf.recaptcha import RecaptchaField @@ -76,12 +76,12 @@ class ALTCHAField(Field): class Form_Contact(FlaskForm): - email = StringField('Email') + email = EmailField('Email') contact_name = StringField('Name') company_name = StringField('Company') message = TextAreaField('Message') receive_marketing = BooleanField('I would like to receive marketing emails.') # recaptcha = RecaptchaField() # altcha = HiddenField('ALTCHA') # , validators=[validate_altcha] - altcha = ALTCHAField('Verification') + altcha = ALTCHAField('Verify you are human') submit = SubmitField('Send Message') diff --git a/lib/argument_validation.py b/lib/argument_validation.py index ba9e4e56..6a9081a9 100644 --- a/lib/argument_validation.py +++ b/lib/argument_validation.py @@ -31,7 +31,7 @@ def error_msg_str(v, v_name, method, v_type, suppress_errors = False, suppress_c if not val_bool(suppress_console_outputs, 'suppress_console_outputs', my_f, suppress_errors): error_msg = error_msg_str(suppress_console_outputs, 'suppress_console_outputs', my_f, "", suppress_errors) if suppress_errors: - print(error_msg) + Helper_App.console_log(error_msg) return error_msg else: raise ValueError(error_msg) @@ -40,7 +40,7 @@ def error_msg_str(v, v_name, method, v_type, suppress_errors = False, suppress_c error_msg = error_msg_str(method, 'method', my_f, "", suppress_errors, suppress_console_outputs) if suppress_errors: if not suppress_console_outputs: - print(error_msg) + Helper_App.console_log(error_msg) return error_msg else: raise ValueError(error_msg) @@ -50,7 +50,7 @@ def error_msg_str(v, v_name, method, v_type, suppress_errors = False, suppress_c error_msg = error_msg_str(v_name, 'v_name', my_f, "", suppress_errors, suppress_console_outputs) if suppress_errors: if not suppress_console_outputs: - print(error_msg) + Helper_App.console_log(error_msg) return error_msg else: raise ValueError(error_msg) @@ -61,7 +61,7 @@ def error_msg_str(v, v_name, method, v_type, suppress_errors = False, suppress_c error_msg = error_msg_str(v_type, 'v_type', my_f, "", suppress_errors, suppress_console_outputs) if suppress_errors: if not suppress_console_outputs: - print(error_msg) + Helper_App.console_log(error_msg) return error_msg else: raise ValueError(error_msg) @@ -70,7 +70,7 @@ def error_msg_str(v, v_name, method, v_type, suppress_errors = False, suppress_c error_msg = error_msg_str(v_arg_type, 'v_arg_type', my_f, "", suppress_errors, suppress_console_outputs) if suppress_errors: if not suppress_console_outputs: - print(error_msg) + Helper_App.console_log(error_msg) return error_msg else: raise ValueError(error_msg) @@ -96,7 +96,7 @@ def val_bool(v_input, v_name, method, suppress_errors = False, suppress_console_ if str(type(suppress_console_outputs)) != v_type: error_msg = error_msg_str(suppress_console_outputs, 'suppress_console_outputs', my_f, v_type, suppress_errors) if suppress_errors: - print(error_msg) + Helper_App.console_log(error_msg) return False raise ValueError(error_msg) v_type = "" @@ -111,7 +111,7 @@ def val_bool(v_input, v_name, method, suppress_errors = False, suppress_console_ error_msg = error_msg_str(method, 'method', my_f, v_type, suppress_errors, suppress_console_outputs) if suppress_errors: if not suppress_console_outputs: - print(error_msg) + Helper_App.console_log(error_msg) return False raise ValueError(error_msg) my_f = method + '.' + my_f @@ -126,7 +126,7 @@ def val_bool(v_input, v_name, method, suppress_errors = False, suppress_console_ error_msg = error_msg_str(v_name, 'v_name', my_f, v_type, suppress_errors, suppress_console_outputs) if suppress_errors: if not suppress_console_outputs: - print(error_msg) + Helper_App.console_log(error_msg) return False raise ValueError(error_msg) # v_arg_type @@ -140,7 +140,7 @@ def val_bool(v_input, v_name, method, suppress_errors = False, suppress_console_ error_msg = error_msg_str(v_arg_type, 'v_arg_type', my_f, v_type, suppress_errors, suppress_console_outputs) if suppress_errors: if not suppress_console_outputs: - print(error_msg) + Helper_App.console_log(error_msg) return False else: raise ValueError(error_msg) @@ -150,7 +150,7 @@ def val_bool(v_input, v_name, method, suppress_errors = False, suppress_console_ error_msg = error_msg_str(v_input, v_name, method, v_type, suppress_errors, suppress_console_outputs) if suppress_errors: if not suppress_console_outputs: - print(error_msg) + Helper_App.console_log(error_msg) return False raise ValueError(error_msg) # RETURNS @@ -176,7 +176,7 @@ def val_str(v_input, v_name, method, min_len = -1, max_len = -1, suppress_errors val_bool(suppress_errors, 'suppress_errors', my_f) # suppress_console_outputs if not val_bool(suppress_console_outputs, 'suppress_console_outputs', my_f, suppress_errors): - print(error_msg_str(suppress_console_outputs, 'suppress_console_outputs', my_f, "", suppress_errors)) + Helper_App.console_log(error_msg_str(suppress_console_outputs, 'suppress_console_outputs', my_f, "", suppress_errors)) return False # method valid = True @@ -189,7 +189,7 @@ def val_str(v_input, v_name, method, min_len = -1, max_len = -1, suppress_errors error_msg = error_msg_str(method, 'method', my_f, v_type) if suppress_errors: if not suppress_console_outputs: - print(error_msg) + Helper_App.console_log(error_msg) return False raise ValueError(error_msg) my_f = method + '.' + my_f @@ -204,7 +204,7 @@ def val_str(v_input, v_name, method, min_len = -1, max_len = -1, suppress_errors error_msg = error_msg_str(v_name, 'v_name', my_f, v_type) if suppress_errors: if not suppress_console_outputs: - print(error_msg) + Helper_App.console_log(error_msg) return False raise ValueError(error_msg) # v_arg_type @@ -218,7 +218,7 @@ def val_str(v_input, v_name, method, min_len = -1, max_len = -1, suppress_errors error_msg = error_msg_str(v_arg_type, 'v_arg_type', my_f, v_type) if suppress_errors: if not suppress_console_outputs: - print(error_msg) + Helper_App.console_log(error_msg) return False raise ValueError(error_msg) # min_len @@ -227,7 +227,7 @@ def val_str(v_input, v_name, method, min_len = -1, max_len = -1, suppress_errors error_msg = error_msg_str(min_len, 'min_len', my_f, v_type) if suppress_errors: if not suppress_console_outputs: - print(error_msg) + Helper_App.console_log(error_msg) return False raise ValueError(error_msg) # max_len @@ -242,7 +242,7 @@ def val_str(v_input, v_name, method, min_len = -1, max_len = -1, suppress_errors error_msg = error_msg_str(max_len, 'max_len', my_f, v_type) if suppress_errors: if not suppress_console_outputs: - print(error_msg) + Helper_App.console_log(error_msg) return False raise ValueError(error_msg) # v_input @@ -256,15 +256,15 @@ def val_str(v_input, v_name, method, min_len = -1, max_len = -1, suppress_errors L = len(v_input) if min_len != -1 and L < min_len: valid = False - print(f"Minimum str length {min_len} not met.") + Helper_App.console_log(f"Minimum str length {min_len} not met.") if max_len != -1 and L > max_len: - print(f"Maximum str length {max_len} not met.") + Helper_App.console_log(f"Maximum str length {max_len} not met.") valid = False if not valid: error_msg = error_msg_str(v_input, v_name, method, v_type, suppress_errors, suppress_console_outputs, v_arg_type) if suppress_errors: if not suppress_console_outputs: - print(error_msg) + Helper_App.console_log(error_msg) return False raise ValueError(error_msg) # RETURNS @@ -297,7 +297,7 @@ def val_int(v_input, v_name, method, v_min: Optional[int] = None, v_max: Optiona val_bool(suppress_errors, 'suppress_errors', my_f) # suppress_console_outputs if not val_bool(suppress_console_outputs, 'suppress_console_outputs', my_f, suppress_errors): - print(error_msg_str(suppress_console_outputs, 'suppress_console_outputs', my_f, "", suppress_errors)) + Helper_App.console_log(error_msg_str(suppress_console_outputs, 'suppress_console_outputs', my_f, "", suppress_errors)) return False # method if not val_str(method, 'method', my_f, 1, -1, suppress_errors, suppress_console_outputs): return False @@ -322,28 +322,28 @@ def val_int(v_input, v_name, method, v_min: Optional[int] = None, v_max: Optiona if not mytype == str(type(v_input)): if suppress_errors: if not suppress_console_outputs: - print(error_msg) + Helper_App.console_log(error_msg) return False raise ValueError(error_msg) if (v_min != None and v_max != None): if (v_min > v_max): if suppress_errors: if not suppress_console_outputs: - print(error_msg + f"\nInverted minimum and maximum values {v_min} and {v_max}.") + Helper_App.console_log(error_msg + f"\nInverted minimum and maximum values {v_min} and {v_max}.") return False raise ValueError(error_msg + f"\nInverted minimum and maximum values {v_min} and {v_max}.") if (v_min != None): if (v_input < v_min): if suppress_errors: if not suppress_console_outputs: - print(error_msg + f"\nValue less than minimum {v_min}.") + Helper_App.console_log(error_msg + f"\nValue less than minimum {v_min}.") return False raise ValueError(error_msg + f"\nValue less than minimum {v_min}.") if (v_max != None): if (v_input > v_max): if suppress_errors: if not suppress_console_outputs: - print(error_msg + f"\nValue greater than maximum {v_max}.") + Helper_App.console_log(error_msg + f"\nValue greater than maximum {v_max}.") return False raise ValueError(error_msg + f"\nValue greater than maximum {v_max}.") # RETURNS @@ -368,7 +368,7 @@ def val_float(v_input, v_name, method, v_min = None, v_max = None, suppress_erro val_bool(suppress_errors, 'suppress_errors', my_f) # suppress_console_outputs if not val_bool(suppress_console_outputs, 'suppress_console_outputs', my_f, suppress_errors): - print(error_msg_str(suppress_console_outputs, 'suppress_console_outputs', my_f, "", suppress_errors)) + Helper_App.console_log(error_msg_str(suppress_console_outputs, 'suppress_console_outputs', my_f, "", suppress_errors)) return False # v_name if not val_str(v_name, 'v_name', my_f, 1, -1, suppress_errors, suppress_console_outputs): return False @@ -393,28 +393,28 @@ def val_float(v_input, v_name, method, v_min = None, v_max = None, suppress_erro if not mytype == str(type(v_input)): if suppress_errors: if not suppress_console_outputs: - print(error_msg) + Helper_App.console_log(error_msg) return False raise ValueError(error_msg) if (v_min != None and v_max != None): if (v_min > v_max): if suppress_errors: if not suppress_console_outputs: - print(error_msg + f"\nInverted minimum and maximum values {v_min} and {v_max}.") + Helper_App.console_log(error_msg + f"\nInverted minimum and maximum values {v_min} and {v_max}.") return False raise ValueError(error_msg + f"\nInverted minimum and maximum values {v_min} and {v_max}.") if (v_min != None): if (v_input < v_min): if suppress_errors: if not suppress_console_outputs: - print(error_msg + f"\nValue less than minimum {v_min}.") + Helper_App.console_log(error_msg + f"\nValue less than minimum {v_min}.") return False raise ValueError(error_msg + f"\nValue less than minimum {v_min}.") if (v_max != None): if (v_input > v_max): if suppress_errors: if not suppress_console_outputs: - print(error_msg + f"\nValue greater than maximum {v_max}.") + Helper_App.console_log(error_msg + f"\nValue greater than maximum {v_max}.") return False raise ValueError(error_msg + f"\nValue greater than maximum {v_max}.") # RETURNS @@ -456,7 +456,7 @@ def input_bool(v_input, v_name, method, suppress_errors = False, suppress_consol if not val_str(v_input, v_name, my_f, suppress_errors=True, suppress_console_outputs=True): if suppress_errors: if not suppress_console_outputs: - print(error_msg) + Helper_App.console_log(error_msg) return None raise ValueError(error_msg) else: @@ -471,7 +471,7 @@ def input_bool(v_input, v_name, method, suppress_errors = False, suppress_consol return False if suppress_errors: if not suppress_console_outputs: - print(error_msg) + Helper_App.console_log(error_msg) return None raise ValueError(error_msg) else: diff --git a/models/model_view_base.py b/models/model_view_base.py index be918f87..62256e5b 100644 --- a/models/model_view_base.py +++ b/models/model_view_base.py @@ -47,6 +47,17 @@ class Model_View_Base(BaseModel, ABC): ATTR_VALUE_PREVIOUS: ClassVar[str] = 'previous-value' COMPANY_ADDRESS_SHORT: ClassVar[str] = '53 Alfred Green Close, Rugby, United Kingdom, CV22 6DN' COMPANY_NUMBER: ClassVar[str] = '13587499' + ENDPOINT_GET_ALTCHA_CHALLENGE: ClassVar[str] = 'routes_core.create_altcha_challenge' + ENDPOINT_PAGE_ACCESSIBILITY_REPORT: ClassVar[str] = 'routes_legal.accessibility_report' + ENDPOINT_PAGE_ACCESSIBILITY_STATEMENT: ClassVar[str] = 'routes_legal.accessibility_statement' + ENDPOINT_PAGE_CONTACT: ClassVar[str] = 'routes_core.contact' + ENDPOINT_PAGE_CONTACT_SUCCESS: ClassVar[str] = 'routes_core.contact_success' + ENDPOINT_PAGE_DATA_RETENTION_SCHEDULE: ClassVar[str] = 'routes_legal.retention_schedule' + ENDPOINT_PAGE_ERROR_NO_PERMISSION: ClassVar[str] = 'routes_core.error_no_permission' + ENDPOINT_PAGE_HOME: ClassVar[str] = 'routes_core.home' + ENDPOINT_PAGE_LICENSE: ClassVar[str] = 'routes_legal.license' + ENDPOINT_PAGE_PRIVACY_POLICY: ClassVar[str] = 'routes_legal.privacy_policy' + ENDPOINT_POST_CONTACT_FORM: ClassVar[str] = 'routes_core.contact_post' FLAG_ACCESS_LEVEL: ClassVar[str] = 'access_level' FLAG_ACCESS_LEVEL_REQUIRED: ClassVar[str] = Base.FLAG_ACCESS_LEVEL_REQUIRED FLAG_ACTIVE: ClassVar[str] = Base.FLAG_ACTIVE @@ -62,6 +73,7 @@ class Model_View_Base(BaseModel, ABC): FLAG_BUTTON_PRIMARY: ClassVar[str] = 'button-primary' FLAG_CANCEL: ClassVar[str] = 'button-cancel' FLAG_CALLBACK: ClassVar[str] = 'callback' + FLAG_CAPTCHA: ClassVar[str] = 'captcha' FLAG_CARD: ClassVar[str] = 'card' FLAG_CITY: ClassVar[str] = Base.FLAG_CITY FLAG_CLOSE_TEMPORARY_ELEMENT: ClassVar[str] = 'button-temporary-element-close' @@ -109,31 +121,12 @@ class Model_View_Base(BaseModel, ABC): FLAG_NAME_ATTR_OPTION_VALUE: ClassVar[str] = Base.FLAG_NAME_ATTR_OPTION_VALUE FLAG_NAME_PLURAL: ClassVar[str] = Base.FLAG_NAME_PLURAL # FLAG_NAME_SINGULAR: ClassVar[str] = Base.FLAG_NAME_SINGULAR - FLAG_NAV_ADMIN_HOME: ClassVar[str] = 'navAdminHome' - FLAG_NAV_ADMIN_STORE_STRIPE_PRICES: ClassVar[str] = 'navAdminStoreStripePrices' - FLAG_NAV_ADMIN_STORE_STRIPE_PRODUCTS: ClassVar[str] = 'navAdminStoreStripeProducts' FLAG_NAV_CONTACT: ClassVar[str] = 'navContact' FLAG_NAV_HOME: ClassVar[str] = 'navHome' - FLAG_NAV_SERVICES: ClassVar[str] = 'navServices' - FLAG_NAV_STORE_HOME: ClassVar[str] = 'navStoreHome' - FLAG_NAV_STORE_MANUFACTURING_PURCHASE_ORDERS: ClassVar[str] = 'navStoreManufacturingPurchaseOrders' - FLAG_NAV_STORE_PRODUCTS: ClassVar[str] = 'navStoreProducts' - FLAG_NAV_STORE_PRODUCT_CATEGORIES: ClassVar[str] = 'navStoreProductCategories' - FLAG_NAV_STORE_PRODUCT_PERMUTATIONS: ClassVar[str] = 'navStoreProductPermutations' - FLAG_NAV_STORE_PRODUCT_PRICES: ClassVar[str] = 'navStoreProductPrices' - FLAG_NAV_STORE_PRODUCT_VARIATIONS: ClassVar[str] = 'navStoreProductVariations' - FLAG_NAV_STORE_STOCK_ITEMS: ClassVar[str] = 'navStoreStockItems' - FLAG_NAV_STORE_SUPPLIERS: ClassVar[str] = 'navStoreSuppliers' - FLAG_NAV_STORE_SUPPLIER_PURCHASE_ORDERS: ClassVar[str] = 'navStoreSupplierPurchaseOrders' - FLAG_NAV_USER_ACCOUNT: ClassVar[str] = 'navUserAccount' - FLAG_NAV_USER_ADMIN: ClassVar[str] = 'navUserAdmin' - FLAG_NAV_USER_LOGIN: ClassVar[str] = 'navUserLogin' - FLAG_NAV_USER_LOGOUT: ClassVar[str] = 'navUserLogout' FLAG_OVERLAY: ClassVar[str] = 'overlay' FLAG_PAGE_BODY: ClassVar[str] = 'page-body' FLAG_PHONE_NUMBER: ClassVar[str] = Base.FLAG_PHONE_NUMBER FLAG_POSTCODE: ClassVar[str] = Base.FLAG_POSTCODE - FLAG_CAPTCHA: ClassVar[str] = 'recaptcha' FLAG_RIGHT_HAND_SIDE: ClassVar[str] = 'rhs' FLAG_ROW: ClassVar[str] = 'row' FLAG_ROW_NEW: ClassVar[str] = 'row-new' @@ -148,25 +141,16 @@ class Model_View_Base(BaseModel, ABC): FLAG_TEMPORARY_ELEMENT: ClassVar[str] = 'temporary-element' FLAG_USER: ClassVar[str] = User.FLAG_USER FLAG_WEBSITE: ClassVar[str] = Base.FLAG_WEBSITE - # flagIsDatePicker: ClassVar[str] = 'is-date-picker' - HASH_ALTCHA_CREATE_CHALLENGE: ClassVar[str] = '/altcha/create-challenge' - # HASH_ALTCHA_VERIFY_SOLUTION: ClassVar[str] = '/altcha/verify-solution' - HASH_APPLY_FILTERS_STORE_PRODUCT_PERMUTATION: ClassVar[str] = '/store/permutation_filter' - HASH_CALLBACK_LOGIN: ClassVar[str] = '/callback-login' + HASH_GET_ALTCHA_CHALLENGE: ClassVar[str] = '/altcha/create-challenge' HASH_PAGE_ACCESSIBILITY_REPORT: ClassVar[str] = '/accessibility-report' HASH_PAGE_ACCESSIBILITY_STATEMENT: ClassVar[str] = '/accessibility-statement' - HASH_PAGE_ADMIN_HOME: ClassVar[str] = '/admin' HASH_PAGE_CONTACT: ClassVar[str] = '/contact' + HASH_PAGE_CONTACT_SUCCESS: ClassVar[str] = '/contact-success' HASH_PAGE_DATA_RETENTION_SCHEDULE: ClassVar[str] = '/retention-schedule' HASH_PAGE_ERROR_NO_PERMISSION: ClassVar[str] = '/error' HASH_PAGE_HOME: ClassVar[str] = '/' HASH_PAGE_LICENSE: ClassVar[str] = '/license' HASH_PAGE_PRIVACY_POLICY: ClassVar[str] = '/privacy-policy' - HASH_PAGE_SERVICES: ClassVar[str] = '/services' - HASH_PAGE_USER_ACCOUNT: ClassVar[str] = '/user' - HASH_PAGE_USER_ADMIN: ClassVar[str] = '/user/admin' - HASH_PAGE_USER_LOGIN: ClassVar[str] = '/login' - HASH_PAGE_USER_LOGOUT: ClassVar[str] = '/logout' ID_BUTTON_ADD: ClassVar[str] = 'buttonAdd' ID_BUTTON_APPLY_FILTERS: ClassVar[str] = 'buttonApplyFilters' ID_BUTTON_CANCEL: ClassVar[str] = 'buttonCancel' @@ -174,24 +158,8 @@ class Model_View_Base(BaseModel, ABC): ID_BUTTON_SAVE: ClassVar[str] = 'buttonSave' ID_CSRF_TOKEN: ClassVar[str] = 'X-CSRFToken' ID_FORM_CONTACT: ClassVar[str] = 'formContact' - ID_FORM_CURRENCY: ClassVar[str] = 'formCurrency' - ID_FORM_DELIVERY_REGION: ClassVar[str] = 'formDeliveryRegion' ID_FORM_FILTERS: ClassVar[str] = 'formFilters' - ID_FORM_IS_INCLUDED_VAT: ClassVar[str] = 'formIsIncludedVAT' ID_LABEL_ERROR: ClassVar[str] = 'labelError' - """ - ID_MODAL_SERVICES: ClassVar[str] = 'modalServices' - ID_MODAL_TECHNOLOGIES: ClassVar[str] = 'modalTechnologies' - ID_BUTTON_NAV_ADMIN_HOME: ClassVar[str] = 'navAdminHome' - ID_BUTTON_NAV_ADMIN_STORE_STRIPE_PRICE: ClassVar[str] = 'navAdminStoreStripePrice' - ID_BUTTON_NAV_ADMIN_STORE_STRIPE_PRODUCT: ClassVar[str] = 'navAdminStoreStripeProduct' - # ID_BUTTON_NAV_CONTACT: ClassVar[str] = 'navContact' - ID_BUTTON_NAV_HOME: ClassVar[str] = 'navHome' - ID_BUTTON_NAV_SERVICES: ClassVar[str] = 'navServices' - ID_BUTTON_NAV_USER_ADMIN: ClassVar[str] = 'navUserAdmin' - ID_BUTTON_NAV_USER_LOGIN: ClassVar[str] = 'navUserLogin' - ID_BUTTON_NAV_USER_LOGOUT: ClassVar[str] = 'navUserLogout' - """ ID_OVERLAY_CONFIRM: ClassVar[str] = 'overlayConfirm' ID_OVERLAY_ERROR: ClassVar[str] = 'overlayError' ID_OVERLAY_HAMBURGER: ClassVar[str] = 'overlayHamburger' @@ -201,23 +169,10 @@ class Model_View_Base(BaseModel, ABC): NAME_COMPANY: ClassVar[str] = 'Precision And Research Technology Systems Limited' NAME_COMPANY_SHORT: ClassVar[str] = 'PARTS Ltd' NAME_CSRF_TOKEN: ClassVar[str] = 'csrf-token' - # URL_HOST: ClassVar[str] = os.env() 'http://127.0.0.1:5000' # 'https://www.partsltd.co.uk' URL_GITHUB: ClassVar[str] = 'https://github.com/Teddy-1024' - URL_LINKEDIN: ClassVar[str] = 'https://uk.linkedin.com/in/lordteddyms' + URL_LINKEDIN: ClassVar[str] = 'https://uk.linkedin.com/in/teddyms' - # Attributes - """ - is_user_logged_in: bool - id_user: str - form_is_included_VAT: Form_Is_Included_VAT - form_delivery_region: Form_Delivery_Region - form_currency: Form_Currency - # app: Flask - db: SQLAlchemy - """ - # """ hash_page_current: str - # """ app: Flask = None session: None = None is_page_store: bool = None @@ -232,48 +187,18 @@ class Model_View_Base(BaseModel, ABC): def title(self): pass - """ - def __new__(cls, db, info_user, app): # , *args, **kwargs - # Initialiser - validation - _m = 'Model_View_Base.__new__' - v_arg_type = 'class attribute' - Helper_App.console_log(f'{_m}\nstarting') - # return super().__new__(cls, *args, **kwargs) - av.val_instance(db, 'db', _m, SQLAlchemy, v_arg_type=v_arg_type) - return super(Model_View_Base, cls).__new__(cls) - """ def __init__(self, hash_page_current, **kwargs): - # Constructor - """ - _m = 'Model_View_Base.__init__' - v_arg_type = 'class attribute' - Helper_App.console_log(f'{_m}\nstarting') - av.val_instance(db, 'db', _m, SQLAlchemy, v_arg_type=v_arg_type) - """ BaseModel.__init__(self, hash_page_current=hash_page_current, **kwargs) - """ - self.db = db - self.session = session - info_user = self.get_info_user() - Helper_App.console_log(f'info_user: {info_user}\ntype: {str(type(info_user))}') - self.is_user_logged_in = ('sub' in list(info_user.keys()) and not info_user['sub'] == '' and not str(type(info_user['sub'])) == " div:first-child { margin-left: 15vw; + margin-right: 15vw; +} +.container.captcha > div:first-child > label:first-child { + display: flex; + justify-content: center; +} +.container.captcha > p:last-child{ + font-size: 0.9rem; + margin: 1vh 0; +} + +.container.captcha .altcha-main { + padding-left: 1rem; + padding-top: 0.75rem; + padding-bottom: 0; +} +.container.captcha .altcha-main > :last-child { + display: none; } input[type="submit"] { @@ -73,7 +96,17 @@ input[type="submit"]:hover { font-size: 1.1rem; } +.data-notice ul li { + list-style-position: inside; +} + @media (max-width: 768px) { + .contact-form { + max-width: 80vw; + } + .contact-form textarea { + max-width: 60vw; + } .form-grid { grid-template-columns: 1fr; gap: 0.5rem; diff --git a/static/dist/css/core_contact.bundle.css b/static/dist/css/core_contact.bundle.css index 0515256f..78e0462c 100644 --- a/static/dist/css/core_contact.bundle.css +++ b/static/dist/css/core_contact.bundle.css @@ -4,19 +4,23 @@ } .contact-form { - max-width: 800px; + max-width: 60vw; + width: fit-content; margin: 0 auto; background: #fff; padding: 2rem; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); } +.contact-form textarea { + max-width: 40vw; +} .form-grid { display: grid; grid-template-columns: 200px 1fr; gap: 1.5rem; - margin-bottom: 1.5rem; + margin-bottom: 1rem; } .form-label { @@ -36,13 +40,32 @@ textarea.form-input { min-height: 120px; } -.marketing-consent { - margin: 2rem 0; - padding-left: 200px; +.marketing-consent input { + display: inline-block; + margin-left: 18vw; + margin-bottom: 1.25rem; } -.container.recaptcha { +.container.captcha > div:first-child { margin-left: 15vw; + margin-right: 15vw; +} +.container.captcha > div:first-child > label:first-child { + display: flex; + justify-content: center; +} +.container.captcha > p:last-child{ + font-size: 0.9rem; + margin: 1vh 0; +} + +.container.captcha .altcha-main { + padding-left: 1rem; + padding-top: 0.75rem; + padding-bottom: 0; +} +.container.captcha .altcha-main > :last-child { + display: none; } input[type="submit"] { @@ -73,7 +96,17 @@ input[type="submit"]:hover { font-size: 1.1rem; } +.data-notice ul li { + list-style-position: inside; +} + @media (max-width: 768px) { + .contact-form { + max-width: 80vw; + } + .contact-form textarea { + max-width: 60vw; + } .form-grid { grid-template-columns: 1fr; gap: 0.5rem; diff --git a/static/dist/css/main.bundle.css b/static/dist/css/main.bundle.css index 72ffa405..3c1e8903 100644 --- a/static/dist/css/main.bundle.css +++ b/static/dist/css/main.bundle.css @@ -31,6 +31,7 @@ body { top: } */ + .button { display: inline-block; padding: 0.75rem 1.5rem; diff --git a/static/dist/js/main.bundle.js b/static/dist/js/main.bundle.js index f25a7e88..9aabd22f 100644 --- a/static/dist/js/main.bundle.js +++ b/static/dist/js/main.bundle.js @@ -167,6 +167,7 @@ function dom_createClass(e, r, t) { return r && dom_defineProperties(e.prototype function dom_toPropertyKey(t) { var i = dom_toPrimitive(t, "string"); return "symbol" == dom_typeof(i) ? i : i + ""; } function dom_toPrimitive(t, r) { if ("object" != dom_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != dom_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } + var DOM = /*#__PURE__*/function () { function DOM() { dom_classCallCheck(this, DOM); @@ -337,20 +338,12 @@ var DOM = /*#__PURE__*/function () { debugger; if (Validation.isEmpty(element)) return null; return element.getAttribute(attrValueCurrent); - if (!Validation.isEmpty(value) && element.type === "checkbox") { - value = value === 'true'; - } - return value; } }, { key: "getElementAttributeValuePrevious", value: function getElementAttributeValuePrevious(element) { if (Validation.isEmpty(element)) return null; return element.getAttribute(attrValuePrevious); - if (!Validation.isEmpty(value) && element.type === "checkbox") { - value = value === 'true'; - } - return value; } /* base_table.handleChangeElementCellTable static updateAndCheckIsTableElementDirty(element) { @@ -359,28 +352,17 @@ var DOM = /*#__PURE__*/function () { let wasDirtyRow = DOM.hasDirtyChildrenNotDeletedContainer(row); let isDirty = DOM.updateAndCheckIsElementDirty(element); let cell = DOM.getCellFromElement(element); - console.log({element, row, cell, isDirty, wasDirty}); + Utils.consoleLogIfNotProductionEnvironment({element, row, cell, isDirty, wasDirty}); if (isDirty != wasDirty) { DOM.handleDirtyElement(cell, isDirty); let isDirtyRow = DOM.hasDirtyChildrenNotDeletedContainer(row); - console.log({isDirtyRow, wasDirtyRow}); + Utils.consoleLogIfNotProductionEnvironment({isDirtyRow, wasDirtyRow}); if (isDirtyRow != wasDirtyRow) { DOM.handleDirtyElement(row, isDirtyRow); } } } */ - /* - static updateElement(id, data) { - const element = document.getElementById(id); - if (element) { - element.textContent = data; - } - } - */ - /* non-static method on page object to use - static handleChangeElement(element) {} - */ }, { key: "scrollToElement", value: function scrollToElement(parent, element) { @@ -523,6 +505,46 @@ var LocalStorage = /*#__PURE__*/function () { }]); }(); +;// ./static/js/lib/utils.js +function utils_typeof(o) { "@babel/helpers - typeof"; return utils_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; }, utils_typeof(o); } +function utils_classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } +function utils_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, utils_toPropertyKey(o.key), o); } } +function utils_createClass(e, r, t) { return r && utils_defineProperties(e.prototype, r), t && utils_defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } +function utils_toPropertyKey(t) { var i = utils_toPrimitive(t, "string"); return "symbol" == utils_typeof(i) ? i : i + ""; } +function utils_toPrimitive(t, r) { if ("object" != utils_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != utils_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } +// Utility functions +/* +function $(selector) { + return document.querySelector(selector); +} + +function $$(selector) { + return document.querySelectorAll(selector); +} +*/ +var Utils = /*#__PURE__*/function () { + function Utils() { + utils_classCallCheck(this, Utils); + } + return utils_createClass(Utils, null, [{ + key: "getListFromDict", + value: function getListFromDict(dict) { + var list = []; + for (var key in dict) { + list.push(dict[key]); + } + return list; + } + }, { + key: "consoleLogIfNotProductionEnvironment", + value: function consoleLogIfNotProductionEnvironment(message) { + if (!environment.is_production) { + console.log(message); + } + } + }]); +}(); + ;// ./static/js/components/common/temporary/overlay_confirm.js function overlay_confirm_typeof(o) { "@babel/helpers - typeof"; return overlay_confirm_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; }, overlay_confirm_typeof(o); } function overlay_confirm_classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } @@ -577,19 +599,17 @@ function base_toPrimitive(t, r) { if ("object" != base_typeof(t) || !t) return t + var BasePage = /*#__PURE__*/function () { function BasePage(router) { base_classCallCheck(this, BasePage); if (!router) { throw new Error("Router is required"); } else { - if (_verbose) { - console.log("initialising with router: ", router); - } + Utils.consoleLogIfNotProductionEnvironment("initialising with router: ", router); } this.router = router; this.title = titlePageCurrent; - // this.hash = hashPageCurrent; if (this.constructor === BasePage) { throw new Error("Cannot instantiate abstract class"); } @@ -611,9 +631,7 @@ var BasePage = /*#__PURE__*/function () { }, { key: "logInitialisation", value: function logInitialisation() { - if (_verbose) { - console.log('Initializing ' + this.title + ' page'); - } + Utils.consoleLogIfNotProductionEnvironment('Initializing ' + this.title + ' page'); } }, { key: "hookupCommonElements", @@ -637,9 +655,7 @@ var BasePage = /*#__PURE__*/function () { value: function hookupLogos() { var _this = this; this.hookupEventHandler("click", "." + flagImageLogo + "," + "." + flagLogo, function (event, element) { - if (_verbose) { - console.log('clicking logo'); - } + Utils.consoleLogIfNotProductionEnvironment('clicking logo'); _this.router.navigateToHash(hashPageHome); }); } @@ -666,20 +682,15 @@ var BasePage = /*#__PURE__*/function () { Events.initialiseEventHandler('form.' + flagFilter + ' button.' + flagSave, flagInitialised, function (button) { button.addEventListener("click", function (event) { event.stopPropagation(); - if (_verbose) { - console.log('saving page: ', _this2.title); - } + Utils.consoleLogIfNotProductionEnvironment('saving page: ', _this2.title); OverlayConfirm.show(); }); - // button.classList.add(flagCollapsed); }); } }, { key: "leave", value: function leave() { - if (_verbose) { - console.log('Leaving ' + this.title + ' page'); - } + Utils.consoleLogIfNotProductionEnvironment('Leaving ' + this.title + ' page'); if (this.constructor === BasePage) { throw new Error("Must implement leave() method."); } @@ -703,15 +714,11 @@ var BasePage = /*#__PURE__*/function () { if (show) { buttonCancel.classList.remove(flagCollapsed); buttonSave.classList.remove(flagCollapsed); - if (_verbose) { - console.log('showing buttons'); - } + Utils.consoleLogIfNotProductionEnvironment('showing buttons'); } else { buttonCancel.classList.add(flagCollapsed); buttonSave.classList.add(flagCollapsed); - if (_verbose) { - console.log('hiding buttons'); - } + Utils.consoleLogIfNotProductionEnvironment('hiding buttons'); } } }], [{ @@ -4384,6 +4391,40 @@ var PageContact = /*#__PURE__*/function (_BasePage) { }(BasePage); contact_defineProperty(PageContact, "hash", hashPageContact); +;// ./static/js/pages/core/contact-success.js +function contact_success_typeof(o) { "@babel/helpers - typeof"; return contact_success_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; }, contact_success_typeof(o); } +function contact_success_classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } +function contact_success_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, contact_success_toPropertyKey(o.key), o); } } +function contact_success_createClass(e, r, t) { return r && contact_success_defineProperties(e.prototype, r), t && contact_success_defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } +function contact_success_callSuper(t, o, e) { return o = contact_success_getPrototypeOf(o), contact_success_possibleConstructorReturn(t, contact_success_isNativeReflectConstruct() ? Reflect.construct(o, e || [], contact_success_getPrototypeOf(t).constructor) : o.apply(t, e)); } +function contact_success_possibleConstructorReturn(t, e) { if (e && ("object" == contact_success_typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return contact_success_assertThisInitialized(t); } +function contact_success_assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } +function contact_success_isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (contact_success_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } +function contact_success_getPrototypeOf(t) { return contact_success_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, contact_success_getPrototypeOf(t); } +function contact_success_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 && contact_success_setPrototypeOf(t, e); } +function contact_success_setPrototypeOf(t, e) { return contact_success_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, contact_success_setPrototypeOf(t, e); } +function contact_success_defineProperty(e, r, t) { return (r = contact_success_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; } +function contact_success_toPropertyKey(t) { var i = contact_success_toPrimitive(t, "string"); return "symbol" == contact_success_typeof(i) ? i : i + ""; } +function contact_success_toPrimitive(t, r) { if ("object" != contact_success_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != contact_success_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } +// internal + +// vendor + +var PageContactSuccess = /*#__PURE__*/function (_BasePage) { + function PageContactSuccess(router) { + contact_success_classCallCheck(this, PageContactSuccess); + return contact_success_callSuper(this, PageContactSuccess, [router]); + } + contact_success_inherits(PageContactSuccess, _BasePage); + return contact_success_createClass(PageContactSuccess, [{ + key: "initialize", + value: function initialize() { + this.sharedInitialize(); + } + }]); +}(BasePage); +contact_success_defineProperty(PageContactSuccess, "hash", hashPageContactSuccess); + ;// ./static/js/pages/legal/accessibility_report.js function accessibility_report_typeof(o) { "@babel/helpers - typeof"; return accessibility_report_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; }, accessibility_report_typeof(o); } function accessibility_report_classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } @@ -4501,6 +4542,84 @@ var PageLicense = /*#__PURE__*/function (_BasePage) { }(BasePage); license_defineProperty(PageLicense, "hash", hashPageLicense); +;// ./static/js/pages/legal/privacy_policy.js +function privacy_policy_typeof(o) { "@babel/helpers - typeof"; return privacy_policy_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; }, privacy_policy_typeof(o); } +function privacy_policy_classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } +function privacy_policy_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, privacy_policy_toPropertyKey(o.key), o); } } +function privacy_policy_createClass(e, r, t) { return r && privacy_policy_defineProperties(e.prototype, r), t && privacy_policy_defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } +function privacy_policy_callSuper(t, o, e) { return o = privacy_policy_getPrototypeOf(o), privacy_policy_possibleConstructorReturn(t, privacy_policy_isNativeReflectConstruct() ? Reflect.construct(o, e || [], privacy_policy_getPrototypeOf(t).constructor) : o.apply(t, e)); } +function privacy_policy_possibleConstructorReturn(t, e) { if (e && ("object" == privacy_policy_typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return privacy_policy_assertThisInitialized(t); } +function privacy_policy_assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } +function privacy_policy_isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (privacy_policy_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } +function privacy_policy_superPropGet(t, o, e, r) { var p = privacy_policy_get(privacy_policy_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; } +function privacy_policy_get() { return privacy_policy_get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = privacy_policy_superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, privacy_policy_get.apply(null, arguments); } +function privacy_policy_superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = privacy_policy_getPrototypeOf(t));); return t; } +function privacy_policy_getPrototypeOf(t) { return privacy_policy_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, privacy_policy_getPrototypeOf(t); } +function privacy_policy_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 && privacy_policy_setPrototypeOf(t, e); } +function privacy_policy_setPrototypeOf(t, e) { return privacy_policy_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, privacy_policy_setPrototypeOf(t, e); } +function privacy_policy_defineProperty(e, r, t) { return (r = privacy_policy_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; } +function privacy_policy_toPropertyKey(t) { var i = privacy_policy_toPrimitive(t, "string"); return "symbol" == privacy_policy_typeof(i) ? i : i + ""; } +function privacy_policy_toPrimitive(t, r) { if ("object" != privacy_policy_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != privacy_policy_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } + +var PagePrivacyPolicy = /*#__PURE__*/function (_BasePage) { + function PagePrivacyPolicy(router) { + privacy_policy_classCallCheck(this, PagePrivacyPolicy); + return privacy_policy_callSuper(this, PagePrivacyPolicy, [router]); + } + privacy_policy_inherits(PagePrivacyPolicy, _BasePage); + return privacy_policy_createClass(PagePrivacyPolicy, [{ + key: "initialize", + value: function initialize() { + this.sharedInitialize(); + } + }, { + key: "leave", + value: function leave() { + privacy_policy_superPropGet(PagePrivacyPolicy, "leave", this, 3)([]); + } + }]); +}(BasePage); +privacy_policy_defineProperty(PagePrivacyPolicy, "hash", hashPagePrivacyPolicy); + +;// ./static/js/pages/legal/retention_schedule.js +function retention_schedule_typeof(o) { "@babel/helpers - typeof"; return retention_schedule_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; }, retention_schedule_typeof(o); } +function retention_schedule_classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } +function retention_schedule_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, retention_schedule_toPropertyKey(o.key), o); } } +function retention_schedule_createClass(e, r, t) { return r && retention_schedule_defineProperties(e.prototype, r), t && retention_schedule_defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } +function retention_schedule_callSuper(t, o, e) { return o = retention_schedule_getPrototypeOf(o), retention_schedule_possibleConstructorReturn(t, retention_schedule_isNativeReflectConstruct() ? Reflect.construct(o, e || [], retention_schedule_getPrototypeOf(t).constructor) : o.apply(t, e)); } +function retention_schedule_possibleConstructorReturn(t, e) { if (e && ("object" == retention_schedule_typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return retention_schedule_assertThisInitialized(t); } +function retention_schedule_assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } +function retention_schedule_isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (retention_schedule_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } +function retention_schedule_superPropGet(t, o, e, r) { var p = retention_schedule_get(retention_schedule_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; } +function retention_schedule_get() { return retention_schedule_get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = retention_schedule_superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, retention_schedule_get.apply(null, arguments); } +function retention_schedule_superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = retention_schedule_getPrototypeOf(t));); return t; } +function retention_schedule_getPrototypeOf(t) { return retention_schedule_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, retention_schedule_getPrototypeOf(t); } +function retention_schedule_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 && retention_schedule_setPrototypeOf(t, e); } +function retention_schedule_setPrototypeOf(t, e) { return retention_schedule_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, retention_schedule_setPrototypeOf(t, e); } +function retention_schedule_defineProperty(e, r, t) { return (r = retention_schedule_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; } +function retention_schedule_toPropertyKey(t) { var i = retention_schedule_toPrimitive(t, "string"); return "symbol" == retention_schedule_typeof(i) ? i : i + ""; } +function retention_schedule_toPrimitive(t, r) { if ("object" != retention_schedule_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != retention_schedule_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } + +var PageRetentionSchedule = /*#__PURE__*/function (_BasePage) { + function PageRetentionSchedule(router) { + retention_schedule_classCallCheck(this, PageRetentionSchedule); + return retention_schedule_callSuper(this, PageRetentionSchedule, [router]); + } + retention_schedule_inherits(PageRetentionSchedule, _BasePage); + return retention_schedule_createClass(PageRetentionSchedule, [{ + key: "initialize", + value: function initialize() { + this.sharedInitialize(); + } + }, { + key: "leave", + value: function leave() { + retention_schedule_superPropGet(PageRetentionSchedule, "leave", this, 3)([]); + } + }]); +}(BasePage); +retention_schedule_defineProperty(PageRetentionSchedule, "hash", hashPageDataRetentionSchedule); + ;// ./static/js/api.js function api_typeof(o) { "@babel/helpers - typeof"; return api_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; }, api_typeof(o); } function api_regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ api_regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == api_typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(api_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; } @@ -4613,353 +4732,8 @@ var API = /*#__PURE__*/function () { var url = API.getUrlFromHash(hash, params); API.goToUrl(url); } - - // specific api calls - /* Example: - getUsers: () => request('/users'), - getUserById: (id) => request(`/users/${id}`), - createUser: (userData) => request('/users', 'POST', userData), - updateUser: (id, userData) => request(`/users/${id}`, 'PUT', userData), - deleteUser: (id) => request(`/users/${id}`, 'DELETE'), - */ - }, { - key: "loginUser", - value: function () { - var _loginUser = api_asyncToGenerator(/*#__PURE__*/api_regeneratorRuntime().mark(function _callee2() { - var callback; - return api_regeneratorRuntime().wrap(function _callee2$(_context2) { - while (1) switch (_context2.prev = _context2.next) { - case 0: - callback = {}; - callback[flagCallback] = DOM.getHashPageCurrent(); - _context2.next = 4; - return API.request(hashPageUserLogin, 'POST', callback); - case 4: - return _context2.abrupt("return", _context2.sent); - case 5: - case "end": - return _context2.stop(); - } - }, _callee2); - })); - function loginUser() { - return _loginUser.apply(this, arguments); - } - return loginUser; - }() // store - // product categories - }, { - key: "saveCategories", - value: function () { - var _saveCategories = api_asyncToGenerator(/*#__PURE__*/api_regeneratorRuntime().mark(function _callee3(categories, formFilters, comment) { - var dataRequest; - return api_regeneratorRuntime().wrap(function _callee3$(_context3) { - while (1) switch (_context3.prev = _context3.next) { - case 0: - dataRequest = {}; - dataRequest[flagFormFilters] = DOM.convertForm2JSON(formFilters); - dataRequest[flagProductCategory] = categories; - dataRequest[flagComment] = comment; - _context3.next = 6; - return API.request(hashSaveStoreProductCategory, 'POST', dataRequest); - case 6: - return _context3.abrupt("return", _context3.sent); - case 7: - case "end": - return _context3.stop(); - } - }, _callee3); - })); - function saveCategories(_x2, _x3, _x4) { - return _saveCategories.apply(this, arguments); - } - return saveCategories; - }() // products - }, { - key: "saveProducts", - value: function () { - var _saveProducts = api_asyncToGenerator(/*#__PURE__*/api_regeneratorRuntime().mark(function _callee4(products, formFilters, comment) { - var dataRequest; - return api_regeneratorRuntime().wrap(function _callee4$(_context4) { - while (1) switch (_context4.prev = _context4.next) { - case 0: - dataRequest = {}; - dataRequest[flagFormFilters] = DOM.convertForm2JSON(formFilters); - dataRequest[flagProduct] = products; - dataRequest[flagComment] = comment; - _context4.next = 6; - return API.request(hashSaveStoreProduct, 'POST', dataRequest); - case 6: - return _context4.abrupt("return", _context4.sent); - case 7: - case "end": - return _context4.stop(); - } - }, _callee4); - })); - function saveProducts(_x5, _x6, _x7) { - return _saveProducts.apply(this, arguments); - } - return saveProducts; - }() // product permutations - }, { - key: "saveProductPermutations", - value: function () { - var _saveProductPermutations = api_asyncToGenerator(/*#__PURE__*/api_regeneratorRuntime().mark(function _callee5(permutations, formFilters, comment) { - var dataRequest; - return api_regeneratorRuntime().wrap(function _callee5$(_context5) { - while (1) switch (_context5.prev = _context5.next) { - case 0: - dataRequest = {}; - dataRequest[flagFormFilters] = DOM.convertForm2JSON(formFilters); - dataRequest[flagProductPermutation] = permutations; - dataRequest[flagComment] = comment; - _context5.next = 6; - return API.request(hashSaveStoreProductPermutation, 'POST', dataRequest); - case 6: - return _context5.abrupt("return", _context5.sent); - case 7: - case "end": - return _context5.stop(); - } - }, _callee5); - })); - function saveProductPermutations(_x8, _x9, _x10) { - return _saveProductPermutations.apply(this, arguments); - } - return saveProductPermutations; - }() // product variations - }, { - key: "saveProductVariations", - value: function () { - var _saveProductVariations = api_asyncToGenerator(/*#__PURE__*/api_regeneratorRuntime().mark(function _callee6(variationTypes, formFilters, comment) { - var dataRequest; - return api_regeneratorRuntime().wrap(function _callee6$(_context6) { - while (1) switch (_context6.prev = _context6.next) { - case 0: - dataRequest = {}; - dataRequest[flagFormFilters] = DOM.convertForm2JSON(formFilters); - dataRequest[flagProductVariationType] = variationTypes; - dataRequest[flagComment] = comment; - _context6.next = 6; - return API.request(hashSaveStoreProductVariation, 'POST', dataRequest); - case 6: - return _context6.abrupt("return", _context6.sent); - case 7: - case "end": - return _context6.stop(); - } - }, _callee6); - })); - function saveProductVariations(_x11, _x12, _x13) { - return _saveProductVariations.apply(this, arguments); - } - return saveProductVariations; - }() // stock items - }, { - key: "saveStockItems", - value: function () { - var _saveStockItems = api_asyncToGenerator(/*#__PURE__*/api_regeneratorRuntime().mark(function _callee7(stockItems, formFilters, comment) { - var dataRequest; - return api_regeneratorRuntime().wrap(function _callee7$(_context7) { - while (1) switch (_context7.prev = _context7.next) { - case 0: - dataRequest = {}; - dataRequest[flagFormFilters] = DOM.convertForm2JSON(formFilters); - dataRequest[flagStockItem] = stockItems; - dataRequest[flagComment] = comment; - _context7.next = 6; - return API.request(hashSaveStoreStockItem, 'POST', dataRequest); - case 6: - return _context7.abrupt("return", _context7.sent); - case 7: - case "end": - return _context7.stop(); - } - }, _callee7); - })); - function saveStockItems(_x14, _x15, _x16) { - return _saveStockItems.apply(this, arguments); - } - return saveStockItems; - }() // suppliers - }, { - key: "saveSuppliers", - value: function () { - var _saveSuppliers = api_asyncToGenerator(/*#__PURE__*/api_regeneratorRuntime().mark(function _callee8(suppliers, formFilters, comment) { - var dataRequest; - return api_regeneratorRuntime().wrap(function _callee8$(_context8) { - while (1) switch (_context8.prev = _context8.next) { - case 0: - dataRequest = {}; - dataRequest[flagFormFilters] = DOM.convertForm2JSON(formFilters); - dataRequest[flagSupplier] = suppliers; - dataRequest[flagComment] = comment; - _context8.next = 6; - return API.request(hashSaveStoreSupplier, 'POST', dataRequest); - case 6: - return _context8.abrupt("return", _context8.sent); - case 7: - case "end": - return _context8.stop(); - } - }, _callee8); - })); - function saveSuppliers(_x17, _x18, _x19) { - return _saveSuppliers.apply(this, arguments); - } - return saveSuppliers; - }() // supplier purchase orders - }, { - key: "saveSupplierPurchaseOrders", - value: function () { - var _saveSupplierPurchaseOrders = api_asyncToGenerator(/*#__PURE__*/api_regeneratorRuntime().mark(function _callee9(supplierPurchaseOrders, formFilters, comment) { - var dataRequest; - return api_regeneratorRuntime().wrap(function _callee9$(_context9) { - while (1) switch (_context9.prev = _context9.next) { - case 0: - dataRequest = {}; - dataRequest[flagFormFilters] = DOM.convertForm2JSON(formFilters); - dataRequest[flagSupplierPurchaseOrder] = supplierPurchaseOrders; - dataRequest[flagComment] = comment; - _context9.next = 6; - return API.request(hashSaveStoreSupplierPurchaseOrder, 'POST', dataRequest); - case 6: - return _context9.abrupt("return", _context9.sent); - case 7: - case "end": - return _context9.stop(); - } - }, _callee9); - })); - function saveSupplierPurchaseOrders(_x20, _x21, _x22) { - return _saveSupplierPurchaseOrders.apply(this, arguments); - } - return saveSupplierPurchaseOrders; - }() // manufacturing purchase orders - }, { - key: "saveManufacturingPurchaseOrders", - value: function () { - var _saveManufacturingPurchaseOrders = api_asyncToGenerator(/*#__PURE__*/api_regeneratorRuntime().mark(function _callee10(manufacturingPurchaseOrders, formFilters, comment) { - var dataRequest; - return api_regeneratorRuntime().wrap(function _callee10$(_context10) { - while (1) switch (_context10.prev = _context10.next) { - case 0: - dataRequest = {}; - dataRequest[flagFormFilters] = DOM.convertForm2JSON(formFilters); - dataRequest[flagManufacturingPurchaseOrder] = manufacturingPurchaseOrders; - dataRequest[flagComment] = comment; - _context10.next = 6; - return API.request(hashSaveStoreManufacturingPurchaseOrder, 'POST', dataRequest); - case 6: - return _context10.abrupt("return", _context10.sent); - case 7: - case "end": - return _context10.stop(); - } - }, _callee10); - })); - function saveManufacturingPurchaseOrders(_x23, _x24, _x25) { - return _saveManufacturingPurchaseOrders.apply(this, arguments); - } - return saveManufacturingPurchaseOrders; - }() }]); }(); -/* - -const api = new API(); -export default api; - -document.addEventListener('DOMContentLoaded', () => { - initializeApp(); - setupEventListeners(); - initializeComponents(); - - // Example of using the API - API.getData('/some-endpoint') - .then(data => console.log('Data received:', data)) - .catch(error => console.error('Error:', error)); -}); -*/ - -;// ./static/js/pages/legal/privacy_policy.js -function privacy_policy_typeof(o) { "@babel/helpers - typeof"; return privacy_policy_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; }, privacy_policy_typeof(o); } -function privacy_policy_classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } -function privacy_policy_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, privacy_policy_toPropertyKey(o.key), o); } } -function privacy_policy_createClass(e, r, t) { return r && privacy_policy_defineProperties(e.prototype, r), t && privacy_policy_defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } -function privacy_policy_callSuper(t, o, e) { return o = privacy_policy_getPrototypeOf(o), privacy_policy_possibleConstructorReturn(t, privacy_policy_isNativeReflectConstruct() ? Reflect.construct(o, e || [], privacy_policy_getPrototypeOf(t).constructor) : o.apply(t, e)); } -function privacy_policy_possibleConstructorReturn(t, e) { if (e && ("object" == privacy_policy_typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return privacy_policy_assertThisInitialized(t); } -function privacy_policy_assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } -function privacy_policy_isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (privacy_policy_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } -function privacy_policy_superPropGet(t, o, e, r) { var p = privacy_policy_get(privacy_policy_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; } -function privacy_policy_get() { return privacy_policy_get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = privacy_policy_superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, privacy_policy_get.apply(null, arguments); } -function privacy_policy_superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = privacy_policy_getPrototypeOf(t));); return t; } -function privacy_policy_getPrototypeOf(t) { return privacy_policy_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, privacy_policy_getPrototypeOf(t); } -function privacy_policy_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 && privacy_policy_setPrototypeOf(t, e); } -function privacy_policy_setPrototypeOf(t, e) { return privacy_policy_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, privacy_policy_setPrototypeOf(t, e); } -function privacy_policy_defineProperty(e, r, t) { return (r = privacy_policy_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; } -function privacy_policy_toPropertyKey(t) { var i = privacy_policy_toPrimitive(t, "string"); return "symbol" == privacy_policy_typeof(i) ? i : i + ""; } -function privacy_policy_toPrimitive(t, r) { if ("object" != privacy_policy_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != privacy_policy_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } - -var PagePrivacyPolicy = /*#__PURE__*/function (_BasePage) { - function PagePrivacyPolicy(router) { - privacy_policy_classCallCheck(this, PagePrivacyPolicy); - return privacy_policy_callSuper(this, PagePrivacyPolicy, [router]); - } - privacy_policy_inherits(PagePrivacyPolicy, _BasePage); - return privacy_policy_createClass(PagePrivacyPolicy, [{ - key: "initialize", - value: function initialize() { - this.sharedInitialize(); - } - }, { - key: "leave", - value: function leave() { - privacy_policy_superPropGet(PagePrivacyPolicy, "leave", this, 3)([]); - } - }]); -}(BasePage); -privacy_policy_defineProperty(PagePrivacyPolicy, "hash", hashPagePrivacyPolicy); - -;// ./static/js/pages/legal/retention_schedule.js -function retention_schedule_typeof(o) { "@babel/helpers - typeof"; return retention_schedule_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; }, retention_schedule_typeof(o); } -function retention_schedule_classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } -function retention_schedule_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, retention_schedule_toPropertyKey(o.key), o); } } -function retention_schedule_createClass(e, r, t) { return r && retention_schedule_defineProperties(e.prototype, r), t && retention_schedule_defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } -function retention_schedule_callSuper(t, o, e) { return o = retention_schedule_getPrototypeOf(o), retention_schedule_possibleConstructorReturn(t, retention_schedule_isNativeReflectConstruct() ? Reflect.construct(o, e || [], retention_schedule_getPrototypeOf(t).constructor) : o.apply(t, e)); } -function retention_schedule_possibleConstructorReturn(t, e) { if (e && ("object" == retention_schedule_typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return retention_schedule_assertThisInitialized(t); } -function retention_schedule_assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } -function retention_schedule_isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (retention_schedule_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } -function retention_schedule_superPropGet(t, o, e, r) { var p = retention_schedule_get(retention_schedule_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; } -function retention_schedule_get() { return retention_schedule_get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = retention_schedule_superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, retention_schedule_get.apply(null, arguments); } -function retention_schedule_superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = retention_schedule_getPrototypeOf(t));); return t; } -function retention_schedule_getPrototypeOf(t) { return retention_schedule_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, retention_schedule_getPrototypeOf(t); } -function retention_schedule_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 && retention_schedule_setPrototypeOf(t, e); } -function retention_schedule_setPrototypeOf(t, e) { return retention_schedule_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, retention_schedule_setPrototypeOf(t, e); } -function retention_schedule_defineProperty(e, r, t) { return (r = retention_schedule_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; } -function retention_schedule_toPropertyKey(t) { var i = retention_schedule_toPrimitive(t, "string"); return "symbol" == retention_schedule_typeof(i) ? i : i + ""; } -function retention_schedule_toPrimitive(t, r) { if ("object" != retention_schedule_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != retention_schedule_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } - -var PageRetentionSchedule = /*#__PURE__*/function (_BasePage) { - function PageRetentionSchedule(router) { - retention_schedule_classCallCheck(this, PageRetentionSchedule); - return retention_schedule_callSuper(this, PageRetentionSchedule, [router]); - } - retention_schedule_inherits(PageRetentionSchedule, _BasePage); - return retention_schedule_createClass(PageRetentionSchedule, [{ - key: "initialize", - value: function initialize() { - this.sharedInitialize(); - } - }, { - key: "leave", - value: function leave() { - retention_schedule_superPropGet(PageRetentionSchedule, "leave", this, 3)([]); - } - }]); -}(BasePage); -retention_schedule_defineProperty(PageRetentionSchedule, "hash", hashPageDataRetentionSchedule); ;// ./static/js/router.js function router_typeof(o) { "@babel/helpers - typeof"; return router_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; }, router_typeof(o); } @@ -4972,14 +4746,11 @@ function router_toPrimitive(t, r) { if ("object" != router_typeof(t) || !t) retu // Core + // Legal -// User -// import PageUserLogin from './pages/user/login.js'; -// import PageUserLogout from './pages/user/logout.js'; -// import PageUserAccount from './pages/user/account.js'; @@ -4995,33 +4766,32 @@ var Router = /*#__PURE__*/function () { this.pages[hashPageHome] = { name: 'PageHome', module: PageHome - }; // importModule: () => import(/* webpackChunkName: "page_core_home" */ './pages/core/home.js') , pathModule: './pages/core/home.js' + }; this.pages[hashPageContact] = { name: 'PageContact', module: PageContact - }; // pathModule: './pages/core/contact.js' }; + }; + this.pages[hashPageContactSuccess] = { + name: 'PageContact', + module: PageContactSuccess + }; // Legal this.pages[hashPageAccessibilityStatement] = { name: 'PageAccessibilityStatement', module: PageAccessibilityStatement - }; // pathModule: '../../static/js/pages/legal/accessibility_statement.js' }; // , page: PageAccessibilityStatement + }; this.pages[hashPageDataRetentionSchedule] = { name: 'PageDataRetentionSchedule', module: PageRetentionSchedule - }; // pathModule: './pages/legal/data_retention_schedule.js' }; + }; this.pages[hashPageLicense] = { name: 'PageLicense', module: PageLicense - }; // pathModule: './pages/legal/license.js' }; + }; this.pages[hashPagePrivacyPolicy] = { name: 'PagePrivacyPolicy', module: PagePrivacyPolicy - }; // pathModule: './pages/legal/privacy_policy.js' }; // importModule: () => {return import(/* webpackChunkName: "page_privacy_policy" */ './pages/legal/privacy_policy.js'); } - // User - // this.pages[hashPageUserLogin] = { name: 'PageUserLogin', module: PageUserLogin }; // pathModule: './pages/user/login.js' }; - // this.pages[hashPageUserLogout] = { name: 'PageUserLogout', module: PageUserLogout }; // pathModule: './pages/user/logout.js' }; - // this.pages[hashPageUserAccount] = { name: 'PageUserAccount', module: PageUserAccount }; // pathModule: './pages/user/account.js' }; - + }; // Routes this.routes = {}; // Core @@ -5050,10 +4820,6 @@ var Router = /*#__PURE__*/function () { var isPopState = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; return _this.navigateToHash(hashPagePrivacyPolicy, isPopState); }; - // User - // this.routes[hashPageUserLogin] = (isPopState = false) => this.navigateToHash(hashPageUserLogin, isPopState); - // this.routes[hashPageUserLogout] = (isPopState = false) => this.navigateToHash(hashPageUserLogout, isPopState); - // this.routes[hashPageUserAccount] = (isPopState = false) => this.navigateToHash(hashPageUserAccount, isPopState); this.initialize(); } return router_createClass(Router, [{ @@ -5073,20 +4839,10 @@ var Router = /*#__PURE__*/function () { value: function getClassPageFromHash(hashPage) { var pageJson = this.pages[hashPage]; try { - /* - const module = await pagesContext(pageJson.pathModule); - console.log("module: ", module); - return module[pageJson.name]; - */ - // const module = await import(pageJson.pathModule); // pageJson.page; - // const module = () => import(pageJson.pathModule); - var module = pageJson.module; // importModule; - return module; // [pageJson.name]; + var module = pageJson.module; + return module; } catch (error) { - if (_verbose) { - console.log("this.pages: ", this.pages); - } - ; + Utils.consoleLogIfNotProductionEnvironment("this.pages: ", this.pages); console.error('Page not found:', hashPage); throw error; } @@ -5094,14 +4850,7 @@ var Router = /*#__PURE__*/function () { }, { key: "initialize", value: function initialize() { - /* - let pages = Router.getPages(); - for (const key of Object.keys(pages)) { - let page = pages[key]; - this.addRoute(page.hash, page.initialize); - } - */ - window.addEventListener('popstate', this.handlePopState.bind(this)); // page accessed by history navigation + window.addEventListener('popstate', this.handlePopState.bind(this)); } }, { key: "handlePopState", @@ -5120,29 +4869,13 @@ var Router = /*#__PURE__*/function () { var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; var params = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; var isPopState = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; - // this.beforeLeave(); - /* - if (this.routes[hash]) { - this.routes[hash](isPopState); - } else { - console.error(`Hash ${hash} not found`); - } - */ var url = API.getUrlFromHash(hash, params); - // if (!isPopState) history.pushState({ data: data, params: params }, '', hash); API.goToUrl(url, data); } - /* beforeunload listener - async beforeLeave() { - const ClassPageCurrent = await this.getClassPageFromHash(DOM.getHashPageCurrent()); - const pageCurrent = new ClassPageCurrent(this); - pageCurrent.leave(); - } - */ }, { key: "navigateToUrl", value: function navigateToUrl(url) { @@ -5162,28 +4895,6 @@ var Router = /*#__PURE__*/function () { }(); var router = new Router(); - -/* -router.addRoute('/', () => { - console.log('Home page'); - // Load home page content -}); - -router.addRoute('/about', () => { - console.log('About page'); - // Load about page content -}); - -export function setupNavigationEvents() { - document.querySelectorAll('a[data-nav]').forEach(link => { - link.addEventListener('click', (e) => { - e.preventDefault(); - const url = e.target.getAttribute('href'); - router.navigateToUrl(url); - }); - }); -} -*/ ;// ./static/js/app.js diff --git a/static/js/api.js b/static/js/api.js index 74857ebf..1a31ca0c 100644 --- a/static/js/api.js +++ b/static/js/api.js @@ -56,108 +56,4 @@ export default class API { API.goToUrl(url); } - - // specific api calls - /* Example: - getUsers: () => request('/users'), - getUserById: (id) => request(`/users/${id}`), - createUser: (userData) => request('/users', 'POST', userData), - updateUser: (id, userData) => request(`/users/${id}`, 'PUT', userData), - deleteUser: (id) => request(`/users/${id}`, 'DELETE'), - */ - static async loginUser() { - let callback = {}; - callback[flagCallback] = DOM.getHashPageCurrent(); - return await API.request(hashPageUserLogin, 'POST', callback); - } - - // store - // product categories - static async saveCategories(categories, formFilters, comment) { - let dataRequest = {}; - dataRequest[flagFormFilters] = DOM.convertForm2JSON(formFilters); - dataRequest[flagProductCategory] = categories; - dataRequest[flagComment] = comment; - return await API.request(hashSaveStoreProductCategory, 'POST', dataRequest); - } - - // products - static async saveProducts(products, formFilters, comment) { - let dataRequest = {}; - dataRequest[flagFormFilters] = DOM.convertForm2JSON(formFilters); - dataRequest[flagProduct] = products; - dataRequest[flagComment] = comment; - return await API.request(hashSaveStoreProduct, 'POST', dataRequest); - } - - // product permutations - static async saveProductPermutations(permutations, formFilters, comment) { - let dataRequest = {}; - dataRequest[flagFormFilters] = DOM.convertForm2JSON(formFilters); - dataRequest[flagProductPermutation] = permutations; - dataRequest[flagComment] = comment; - return await API.request(hashSaveStoreProductPermutation, 'POST', dataRequest); - } - - // product variations - static async saveProductVariations(variationTypes, formFilters, comment) { - let dataRequest = {}; - dataRequest[flagFormFilters] = DOM.convertForm2JSON(formFilters); - dataRequest[flagProductVariationType] = variationTypes; - dataRequest[flagComment] = comment; - return await API.request(hashSaveStoreProductVariation, 'POST', dataRequest); - } - - // stock items - static async saveStockItems(stockItems, formFilters, comment) { - let dataRequest = {}; - dataRequest[flagFormFilters] = DOM.convertForm2JSON(formFilters); - dataRequest[flagStockItem] = stockItems; - dataRequest[flagComment] = comment; - return await API.request(hashSaveStoreStockItem, 'POST', dataRequest); - } - - // suppliers - static async saveSuppliers(suppliers, formFilters, comment) { - let dataRequest = {}; - dataRequest[flagFormFilters] = DOM.convertForm2JSON(formFilters); - dataRequest[flagSupplier] = suppliers; - dataRequest[flagComment] = comment; - return await API.request(hashSaveStoreSupplier, 'POST', dataRequest); - } - - // supplier purchase orders - static async saveSupplierPurchaseOrders(supplierPurchaseOrders, formFilters, comment) { - let dataRequest = {}; - dataRequest[flagFormFilters] = DOM.convertForm2JSON(formFilters); - dataRequest[flagSupplierPurchaseOrder] = supplierPurchaseOrders; - dataRequest[flagComment] = comment; - return await API.request(hashSaveStoreSupplierPurchaseOrder, 'POST', dataRequest); - } - - // manufacturing purchase orders - static async saveManufacturingPurchaseOrders(manufacturingPurchaseOrders, formFilters, comment) { - let dataRequest = {}; - dataRequest[flagFormFilters] = DOM.convertForm2JSON(formFilters); - dataRequest[flagManufacturingPurchaseOrder] = manufacturingPurchaseOrders; - dataRequest[flagComment] = comment; - return await API.request(hashSaveStoreManufacturingPurchaseOrder, 'POST', dataRequest); - } } - -/* - -const api = new API(); -export default api; - -document.addEventListener('DOMContentLoaded', () => { - initializeApp(); - setupEventListeners(); - initializeComponents(); - - // Example of using the API - API.getData('/some-endpoint') - .then(data => console.log('Data received:', data)) - .catch(error => console.error('Error:', error)); -}); -*/ \ No newline at end of file diff --git a/static/js/components/common/video.js b/static/js/components/common/video.js index e6ed7ffa..b283f43b 100644 --- a/static/js/components/common/video.js +++ b/static/js/components/common/video.js @@ -1,13 +1,15 @@ +import Utils from '../../lib/utils.js'; + function videoPlay(elemVideo) { if (!_loading) { // elemVideo.paused && elemVideo.play(); - if (_verbose) { console.log("Playing video element: " + elemVideo.name)}; + Utils.consoleLogIfNotProductionEnvironment("Playing video element: " + elemVideo.name); } } function videoPause(elemVideo) { elemVideo.pause(); - if (_verbose) { console.log("Pausing video element: " + elemVideo.name)}; + Utils.consoleLogIfNotProductionEnvironment("Pausing video element: " + elemVideo.name); } diff --git a/static/js/dom.js b/static/js/dom.js index 95948f69..8907d400 100644 --- a/static/js/dom.js +++ b/static/js/dom.js @@ -1,4 +1,5 @@ +import Utils from "./lib/utils.js"; import Validation from "./lib/validation.js"; export default class DOM { @@ -138,18 +139,10 @@ export default class DOM { debugger; if (Validation.isEmpty(element)) return null; return element.getAttribute(attrValueCurrent); - if (!Validation.isEmpty(value) && element.type === "checkbox") { - value = (value === 'true'); - } - return value; } static getElementAttributeValuePrevious(element) { if (Validation.isEmpty(element)) return null; return element.getAttribute(attrValuePrevious); - if (!Validation.isEmpty(value) && element.type === "checkbox") { - value = (value === 'true'); - } - return value; } /* base_table.handleChangeElementCellTable static updateAndCheckIsTableElementDirty(element) { @@ -158,28 +151,17 @@ export default class DOM { let wasDirtyRow = DOM.hasDirtyChildrenNotDeletedContainer(row); let isDirty = DOM.updateAndCheckIsElementDirty(element); let cell = DOM.getCellFromElement(element); - console.log({element, row, cell, isDirty, wasDirty}); + Utils.consoleLogIfNotProductionEnvironment({element, row, cell, isDirty, wasDirty}); if (isDirty != wasDirty) { DOM.handleDirtyElement(cell, isDirty); let isDirtyRow = DOM.hasDirtyChildrenNotDeletedContainer(row); - console.log({isDirtyRow, wasDirtyRow}); + Utils.consoleLogIfNotProductionEnvironment({isDirtyRow, wasDirtyRow}); if (isDirtyRow != wasDirtyRow) { DOM.handleDirtyElement(row, isDirtyRow); } } } */ - /* - static updateElement(id, data) { - const element = document.getElementById(id); - if (element) { - element.textContent = data; - } - } - */ - /* non-static method on page object to use - static handleChangeElement(element) {} - */ static scrollToElement(parent, element) { // REQUIRED: parent has scroll-bar parent.scrollTop(parent.scrollTop() + (element.offset().top - parent.offset().top)); diff --git a/static/js/lib/business_objects/business_objects.js b/static/js/lib/business_objects/business_objects.js index 5fcd47c9..9566a18c 100644 --- a/static/js/lib/business_objects/business_objects.js +++ b/static/js/lib/business_objects/business_objects.js @@ -1,4 +1,5 @@ +import Utils from '../utils.js'; export default class BusinessObjects { static getOptionJsonFromObjectJsonAndKeys(objectJson, keyText, keyValue, valueSelected = null) { @@ -11,16 +12,9 @@ export default class BusinessObjects { static getOptionJsonFromObjectJson(objectJson, valueSelected = null) { let keyText = objectJson[flagNameAttrOptionText]; let keyValue = objectJson[flagNameAttrOptionValue]; - if (_verbose) { console.log({objectJson, keyText, keyValue}); }; + Utils.consoleLogIfNotProductionEnvironment({objectJson, keyText, keyValue}); return BusinessObjects.getOptionJsonFromObjectJsonAndKeys(objectJson, keyText, keyValue, valueSelected); } - /* - static getOptionJsonFromProductPermutation(permutation) { - return { - text: permutation - }; - } - */ static getObjectText(objectJson) { return objectJson == null ? '' : objectJson[objectJson[flagNameAttrOptionText]]; } diff --git a/static/js/lib/utils.js b/static/js/lib/utils.js index 9cedc5af..3c9ca2b1 100644 --- a/static/js/lib/utils.js +++ b/static/js/lib/utils.js @@ -16,4 +16,9 @@ export default class Utils { } return list; } + static consoleLogIfNotProductionEnvironment(message) { + if (!environment.is_production) { + console.log(message); + } + } } \ No newline at end of file diff --git a/static/js/pages/base.js b/static/js/pages/base.js index e5bc4985..e6e24f15 100644 --- a/static/js/pages/base.js +++ b/static/js/pages/base.js @@ -4,6 +4,7 @@ import Events from "../lib/events.js"; import LocalStorage from "../lib/local_storage.js"; import API from "../api.js"; import DOM from "../dom.js"; +import Utils from "../lib/utils.js"; import OverlayConfirm from "../components/common/temporary/overlay_confirm.js"; import OverlayError from "../components/common/temporary/overlay_error.js"; @@ -14,11 +15,10 @@ export default class BasePage { throw new Error("Router is required"); } else { - if (_verbose) { console.log("initialising with router: ", router); } + Utils.consoleLogIfNotProductionEnvironment("initialising with router: ", router); } this.router = router; this.title = titlePageCurrent; - // this.hash = hashPageCurrent; if (this.constructor === BasePage) { throw new Error("Cannot instantiate abstract class"); } @@ -38,7 +38,7 @@ export default class BasePage { } logInitialisation() { - if (_verbose) { console.log('Initializing ' + this.title + ' page'); } + Utils.consoleLogIfNotProductionEnvironment('Initializing ' + this.title + ' page'); } hookupCommonElements() { @@ -58,7 +58,7 @@ export default class BasePage { hookupLogos() { this.hookupEventHandler("click", "." + flagImageLogo + "," + "." + flagLogo, (event, element) => { - if (_verbose) { console.log('clicking logo'); } + Utils.consoleLogIfNotProductionEnvironment('clicking logo'); this.router.navigateToHash(hashPageHome); }); } @@ -81,15 +81,14 @@ export default class BasePage { Events.initialiseEventHandler('form.' + flagFilter + ' button.' + flagSave, flagInitialised, (button) => { button.addEventListener("click", (event) => { event.stopPropagation(); - if (_verbose) { console.log('saving page: ', this.title); } + Utils.consoleLogIfNotProductionEnvironment('saving page: ', this.title); OverlayConfirm.show(); }); - // button.classList.add(flagCollapsed); }); } leave() { - if (_verbose) { console.log('Leaving ' + this.title + ' page'); } + Utils.consoleLogIfNotProductionEnvironment('Leaving ' + this.title + ' page'); if (this.constructor === BasePage) { throw new Error("Must implement leave() method."); } @@ -107,11 +106,11 @@ export default class BasePage { if (show) { buttonCancel.classList.remove(flagCollapsed); buttonSave.classList.remove(flagCollapsed); - if (_verbose) { console.log('showing buttons'); } + Utils.consoleLogIfNotProductionEnvironment('showing buttons'); } else { buttonCancel.classList.add(flagCollapsed); buttonSave.classList.add(flagCollapsed); - if (_verbose) { console.log('hiding buttons'); } + Utils.consoleLogIfNotProductionEnvironment('hiding buttons'); } } @@ -120,4 +119,5 @@ export default class BasePage { if (isDirty) document.querySelectorAll(idTableMain + ' tbody tr').remove(); return isDirty; } + } \ No newline at end of file diff --git a/static/js/pages/base_table.js b/static/js/pages/base_table.js index 14f876d7..d1808b5c 100644 --- a/static/js/pages/base_table.js +++ b/static/js/pages/base_table.js @@ -122,7 +122,7 @@ export default class TableBasePage extends BasePage { getAndLoadFilteredTableContentSinglePageApp() { this.callFilterTableContent() .then(data => { - if (_verbose) { console.log('Table data received:', data); } + Utils.consoleLogIfNotProductionEnvironment('Table data received:', data); this.callbackLoadTableContent(data); }) .catch(error => console.error('Error:', error)); @@ -144,13 +144,13 @@ export default class TableBasePage extends BasePage { .then(data => { if (data[flagStatus] == flagSuccess) { if (_verbose) { - console.log('Records saved!'); - console.log('Data received:', data); + Utils.consoleLogIfNotProductionEnvironment('Records saved!'); + Utils.consoleLogIfNotProductionEnvironment('Data received:', data); } this.callFilterTableContent(); } else { - if (_verbose) { console.log("error: ", data[flagMessage]); } + Utils.consoleLogIfNotProductionEnvironment("error: ", data[flagMessage]); OverlayError.show(data[flagMessage]); } }) @@ -181,13 +181,13 @@ export default class TableBasePage extends BasePage { .then(data => { if (data[flagStatus] == flagSuccess) { if (_verbose) { - console.log('Records saved!'); - console.log('Data received:', data); + Utils.consoleLogIfNotProductionEnvironment('Records saved!'); + Utils.consoleLogIfNotProductionEnvironment('Data received:', data); } this.callbackLoadTableContent(data); } else { - if (_verbose) { console.log("error: ", data[flagMessage]); } + Utils.consoleLogIfNotProductionEnvironment("error: ", data[flagMessage]); OverlayError.show(data[flagMessage]); } }) @@ -236,7 +236,7 @@ export default class TableBasePage extends BasePage { cacheRowBlank() { let selectorRowNew = idTableMain + ' tbody tr.' + flagRowNew; let rowBlankTemp = document.querySelector(selectorRowNew); - if (_verbose) { console.log("row blank temp: ", rowBlankTemp); } + Utils.consoleLogIfNotProductionEnvironment("row blank temp: ", rowBlankTemp); let countRows = document.querySelectorAll(idTableMain + ' > tbody > tr').length; _rowBlank = rowBlankTemp.cloneNode(true); document.querySelectorAll(selectorRowNew).forEach(function(row) { @@ -257,23 +257,6 @@ export default class TableBasePage extends BasePage { } hookupSlidersDisplayOrderTable() { let selectorDisplayOrder = idTableMain + ' tbody tr td.' + flagDisplayOrder + ' input.' + flagSlider + '.' + flagDisplayOrder; - /* - Events.initialiseEventHandler(selectorDisplayOrder, flagInitialised, (sliderDisplayOrder) => { - /* - sliderDisplayOrder.setAttribute('draggable', true); - sliderDisplayOrder.addEventListener('dragstart', this.handleDragSliderStart.bind(this), false); - sliderDisplayOrder.addEventListener('dragenter', this.handleDragSliderEnter.bind(this), false); - sliderDisplayOrder.addEventListener('dragover', this.handleDragSliderOver.bind(this), false); - sliderDisplayOrder.addEventListener('dragleave', this.handleDragSliderLeave.bind(this), false); - sliderDisplayOrder.addEventListener('drop', this.handleDropSlider.bind(this), false); - sliderDisplayOrder.addEventListener('dragend', this.handleDragSliderEnd.bind(this), false); - * - sliderDisplayOrder.addEventListener('change', (event) => { - console.log("slider change event"); - this.handleChangeNestedElementCellTable(sliderDisplayOrder); - }); - }); - */ this.hookupChangeHandlerTableCells(selectorDisplayOrder); } hookupChangeHandlerTableCells(inputSelector, handler = (event, element) => { this.handleChangeNestedElementCellTable(event, element); }) { @@ -283,7 +266,6 @@ export default class TableBasePage extends BasePage { }); handler(null, input); }); - // this.hookupEventHandler("change", inputSelector, handler); } /* handleChangeElementCellTable(event, element) { @@ -339,15 +321,15 @@ export default class TableBasePage extends BasePage { let wasDirtyRowTable = DOM.hasDirtyChildrenContainer(rowTable); let wasDirtyElement = element.classList.contains(flagDirty); let isDirtyElement = DOM.updateAndCheckIsElementDirty(element); - console.log({isDirtyElement, wasDirtyElement}); + Utils.consoleLogIfNotProductionEnvironment({isDirtyElement, wasDirtyElement}); if (isDirtyElement != wasDirtyElement) { DOM.handleDirtyElement(td, isDirtyElement); let isNowDirtyRowSubtable = DOM.hasDirtyChildrenContainer(rowSubtable); - console.log({isNowDirtyRowSubtable, wasDirtyRowSubtable}); + Utils.consoleLogIfNotProductionEnvironment({isNowDirtyRowSubtable, wasDirtyRowSubtable}); if (isNowDirtyRowSubtable != wasDirtyRowSubtable) { DOM.handleDirtyElement(rowSubtable, isNowDirtyRowSubtable); let isNowDirtyRowTable = DOM.hasDirtyChildrenContainer(rowTable); - console.log({isNowDirtyRowTable, wasDirtyRowTable}); + Utils.consoleLogIfNotProductionEnvironment({isNowDirtyRowTable, wasDirtyRowTable}); if (isNowDirtyRowTable != wasDirtyRowTable) { DOM.handleDirtyElement(rowTable, isNowDirtyRowTable); let rows = this.getTableRecords(true); @@ -362,7 +344,7 @@ export default class TableBasePage extends BasePage { let wasDirtyParentRows = this.getAllIsDirtyRowsInParentTree(element); let wasDirtyElement = element.classList.contains(flagDirty); let isDirtyElement = DOM.updateAndCheckIsElementDirty(element); - if (_verbose) { console.log({isDirtyElement, wasDirtyElement, wasDirtyParentRows}); } + Utils.consoleLogIfNotProductionEnvironment({isDirtyElement, wasDirtyElement, wasDirtyParentRows}); let td = DOM.getCellFromElement(element); DOM.setElementAttributeValueCurrent(td, DOM.getElementAttributeValueCurrent(element)); if (isDirtyElement != wasDirtyElement) { @@ -392,7 +374,7 @@ export default class TableBasePage extends BasePage { let tr = DOM.getRowFromElement(td); let isDirtyRow = isDirtyTd || DOM.hasDirtyChildrenContainer(tr); let wasDirtyRow = wasDirtyParentRows.shift(); - if (_verbose) { console.log({isDirtyRow, wasDirtyRow}); } + Utils.consoleLogIfNotProductionEnvironment({isDirtyRow, wasDirtyRow}); if (isDirtyRow != wasDirtyRow) { DOM.handleDirtyElement(tr, isDirtyRow); this.updateAndToggleShowButtonsSaveCancel(); @@ -404,64 +386,6 @@ export default class TableBasePage extends BasePage { }) { this.hookupEventHandler("change", inputSelector, handler); } - /* ToDo: Fix this slider drag and drop functionality - handleDragSliderStart(event) { - this.dragSrcEl = event.target; - event.dataTransfer.effectAllowed = flagMove; - /* - console.log("setting outer html: ", this.dragSrcEl.outerHTML); - event.dataTransfer.setData('text/html', this.dragSrcEl.outerHTML); - * - this.dragSrcRow = DOM.getRowFromElement(this.dragSrcEl); - this.dragSrcEl.classList.add(flagDragging); - } - handleDragSliderOver(event) { - if (event.preventDefault) { - event.preventDefault(); - } - event.dataTransfer.dropEffect = flagMove; - return false; - } - handleDragSliderEnter(event) { - event.target.closest('tr').classList.add(flagDragOver); - } - handleDragSliderLeave(event) { - event.target.closest('tr').classList.remove(flagDragOver); - } - handleDropSlider(event) { - event.stopPropagation(); - let targetRow = DOM.getRowFromElement(event.target); - if (this.dragSourceRow != targetRow) { - targetRow.classList.remove(flagDragOver); - this.dragSrcEl.classList.remove(flagDragging); - let sourceRowClone = this.dragSrcRow.cloneNode(true); - let targetRowClone = targetRow.cloneNode(true); - console.log("sourceRowClone: ", sourceRowClone); - console.log("targetRowClone: ", targetRowClone); - let tbody = targetRow.closest('tbody'); - tbody.replaceChild(sourceRowClone, targetRow); - tbody.replaceChild(targetRowClone, this.dragSrcRow); - this.refreshDisplayOrders(); - } - return false; - } - handleDragSliderEnd(event) { - let table = TableBasePage.getTableMain(); - let rows = table.querySelectorAll('tr'); - rows.forEach(row => { - row.classList.remove(flagDragOver); - row.classList.remove(flagDragging); - }); - } - refreshDisplayOrders() { - console.log("updating display order values"); - let rows = document.querySelectorAll(idTableMain + 'tbody tr.' + flagRow); - rows.forEach((row, indexRow) => { - sliderDisplayOrder = row.querySelector('td.' + flagDisplayOrder + ' .' + flagSlider); - sliderDisplayOrder.setAttribute(attrValueCurrent, indexRow); - }); - } - */ hookupTextareasCodeTable() { this.hookupChangeHandlerTableCells(idTableMain + ' tbody tr td.' + flagCode + ' textarea'); } @@ -475,7 +399,7 @@ export default class TableBasePage extends BasePage { let selectorButton = 'table' + (Validation.isEmpty(flagTable) ? '' : '.' + flagTable) + ' > tbody > tr > td.' + flagActive + ' button'; let selectorButtonDelete = selectorButton + '.' + flagDelete; let selectorButtonUndelete = selectorButton + ':not(.' + flagDelete + ')'; - console.log("hookupFieldsActive: ", selectorButtonDelete, selectorButtonUndelete); + Utils.consoleLogIfNotProductionEnvironment("hookupFieldsActive: ", selectorButtonDelete, selectorButtonUndelete); this.hookupButtonsRowDelete(selectorButtonDelete, selectorButtonUndelete); this.hookupButtonsRowUndelete(selectorButtonDelete, selectorButtonUndelete); this.hookupEventHandler( @@ -549,7 +473,6 @@ export default class TableBasePage extends BasePage { } handleClickTableCellDdlPreview(event, td, optionObjectList, cellSelector, ddlHookup = (cellSelector) => { this.hookupTableCellDdls(cellSelector); }) { if (td.querySelector('select')) return; - // td.removeEventListener("click", ddlHookup); let tdNew = td.cloneNode(true); td.parentNode.replaceChild(tdNew, td); let idSelected = DOM.getElementAttributeValueCurrent(tdNew); @@ -558,8 +481,8 @@ export default class TableBasePage extends BasePage { DOM.setElementValuesCurrentAndPrevious(ddl, idSelected); let optionJson, option; if (_verbose) { - console.log("click table cell ddl preview"); - console.log({optionObjectList, cellSelector}); + Utils.consoleLogIfNotProductionEnvironment("click table cell ddl preview"); + Utils.consoleLogIfNotProductionEnvironment({optionObjectList, cellSelector}); } option = DOM.createOption(null); ddl.appendChild(option); @@ -572,34 +495,6 @@ export default class TableBasePage extends BasePage { let ddlSelector = cellSelector + ' select'; ddlHookup(ddlSelector); } - /* - handleChangeTableCellDdl(event, ddl) { - let row = DOM.getRowFromElement(ddl); - let td = DOM.getCellFromElement(ddl); - console.log("td: ", td); - let wasDirtyRow = DOM.hasDirtyChildrenContainer(row); - let wasDirtyElement = ddl.classList.contains(flagDirty); - let isDirtyElement = DOM.updateAndCheckIsElementDirty(ddl); - console.log("isDirtyElement: ", isDirtyElement); - console.log("wasDirtyElement: ", wasDirtyElement); - if (isDirtyElement != wasDirtyElement) { - DOM.handleDirtyElement(td, isDirtyElement); - let optionSelected = ddl.options[ddl.selectedIndex]; - DOM.setElementAttributeValueCurrent(td, optionSelected.value); - let isNowDirtyRow = DOM.hasDirtyChildrenContainer(row); - console.log("isNowDirtyRow: ", isNowDirtyRow); - console.log("wasDirtyRow: ", wasDirtyRow); - if (isNowDirtyRow != wasDirtyRow) { - DOM.handleDirtyElement(row, isNowDirtyRow); - let rows = this.getTableRecords(true); - let existsDirtyRecord = rows.length > 0; - console.log("dirty records:", rows); - console.log("existsDirtyRecord:", existsDirtyRecord); - this.toggleShowButtonsSaveCancel(existsDirtyRecord); - } - } - } - */ hookupTableCellDDlPreviewsWhenNotCollapsed(cellSelector, optionList, ddlHookup = (event, element) => { this.hookupTableCellDdls(event, element); }) { this.hookupEventHandler("click", cellSelector, (event, td) => { let div = td.querySelector('div'); @@ -607,299 +502,13 @@ export default class TableBasePage extends BasePage { this.handleClickTableCellDdlPreview(event, td, optionList, cellSelector, (event, element) => { ddlHookup(event, element); }); }); } - hookupProductCategoryDdls(ddlSelector) { - this.hookupChangeHandlerTableCells(ddlSelector, (event, element) => { this.handleChangeProductCategoryDdl(event, element); }); - } - handleChangeProductCategoryDdl(event, ddlCategory) { - this.handleChangeNestedElementCellTable(event, ddlCategory); - let idProductCategorySelected = DOM.getElementAttributeValueCurrent(ddlCategory); - let row = DOM.getRowFromElement(ddlCategory); - let tdProduct = row.querySelector('td.' + flagProduct); - tdProduct.dispatchEvent(new Event('click')); - let ddlProduct = row.querySelector('td.' + flagProduct + ' select'); - ddlProduct.innerHTML = ''; - ddlProduct.appendChild(DOM.createOption(null)); - let optionJson, option; - Utils.getListFromDict(products).forEach((product) => { - if (idProductCategorySelected != '0' && product[attrIdProductCategory] != idProductCategorySelected) return; - optionJson = BusinessObjects.getOptionJsonFromObjectJson(product); - option = DOM.createOption(optionJson); - ddlProduct.appendChild(option); - }); - this.handleChangeNestedElementCellTable(event, ddlProduct); - } - hookupFieldsProductPermutationVariation() { - this.hookupPreviewsProductPermutationVariation(); - this.hookupDdlsProductPermutationVariationType(); - this.hookupDdlsProductPermutationVariation(); - this.hookupButtonsProductPermutationVariationAddDelete(); - } - hookupPreviewsProductPermutationVariation() { - this.hookupEventHandler("click", idTableMain + ' td.' + flagProductVariations, (event, element) => this.handleClickProductPermutationVariationsPreview(event, element)); - } - handleClickProductPermutationVariationsPreview(event, element) { - let tblVariations = element.querySelector('table.' + flagProductVariations); - if (!Validation.isEmpty(tblVariations)) return; - this.toggleColumnCollapsed(flagProductVariations, false); - let permutationVariations = this.getElementProductVariations(element); - tblVariations = document.createElement("table"); - tblVariations.classList.add(flagProductVariations); - let thead = document.createElement("thead"); - let tr = document.createElement("tr"); - let thVariationType = document.createElement("th"); - thVariationType.classList.add(flagProductVariationType); - thVariationType.textContent = 'Type'; - let thNameVariation = document.createElement("th"); - thNameVariation.classList.add(flagProductVariation); - thNameVariation.textContent = 'Name'; - let buttonAdd = document.createElement("button"); - buttonAdd.classList.add(flagAdd); - buttonAdd.textContent = '+'; - let thAddDelete = document.createElement("th"); - thAddDelete.classList.add(flagAdd); - thAddDelete.appendChild(buttonAdd); - tr.appendChild(thVariationType); - tr.appendChild(thNameVariation); - tr.appendChild(thAddDelete); - thead.appendChild(tr); - tblVariations.appendChild(thead); - let tbody = document.createElement("tbody"); - if (!Validation.isEmpty(permutationVariations)) { - permutationVariations.forEach((permutationVariation, index) => { - this.addProductPermutationVariationRow(tbody, permutationVariation); - }); - } - tblVariations.appendChild(tbody); - if (_verbose) { - console.log("click product permutation variations preview"); - console.log('variations:', permutationVariations); - console.log("tblVariations: ", tblVariations); - } - - let cellParent = element.closest(idTableMain + ' tbody tr td.' + flagProductVariations); - cellParent.innerHTML = ''; - cellParent.appendChild(tblVariations); - - this.hookupFieldsProductPermutationVariation(); - } toggleColumnCollapsed(flagColumn, isCollapsed) { this.toggleColumnHasClassnameFlag(flagColumn, isCollapsed, flagCollapsed); } toggleColumnHeaderCollapsed(flagColumn, isCollapsed) { this.toggleColumnHasClassnameFlag(flagColumn, isCollapsed, flagCollapsed); } - getElementProductVariations(element) { - let permutationVariations = element.getAttribute(attrValueCurrent); - let objVariations = []; - let parts, new_variation, new_variation_type; - if (!Validation.isEmpty(permutationVariations)) { - permutationVariations = permutationVariations.split(','); - permutationVariations.forEach((variation) => { - parts = variation.split(':'); - if (parts.length == 2) { - if (_verbose) { console.log("parts: ", parts); } - new_variation_type = productVariationTypes[parts[0].trim()]; - new_variation = productVariations[parts[1].trim()]; - objVariations.push({ - [flagProductVariationType]: new_variation_type, - [flagProductVariation]: new_variation, - }); - } - else { - if (_verbose) { console.log("error: invalid variation: ", variation); } - } - }); - } - return objVariations; - } - static createOptionUnselectedProductVariation() { - return { - [flagProductVariationType]: { - [flagNameAttrOptionText]: [flagName], - [flagNameAttrOptionValue]: [attrIdProductVariationType], - [flagName]: 'Select Variation Type', - [attrIdProductVariationType]: 0, - }, - [flagProductVariation]: { - [flagNameAttrOptionText]: [flagName], - [flagNameAttrOptionValue]: [attrIdProductVariation], - [flagName]: 'Select Variation', - [attrIdProductVariation]: 0, - }, - }; - } - addProductPermutationVariationRow(tbody, permutationVariation) { - if (_verbose) { console.log("permutationVariation: ", permutationVariation); } - let productVariationType, optionProductVariationTypeJson, optionProductVariationType, productVariation, optionProductVariationJson, optionProductVariation; - /* - if (Validation.isEmpty(variations)) { - return; - } - */ - let productVariationKeys = Object.keys(productVariations); - let productVariationTypeKeys = Object.keys(productVariationTypes); - - let ddlsProductVariationType = tbody.querySelectorAll('select.' + flagProductVariationType); - let productVariationTypeKeysSelected = new Set(); - let valueSelected; - let doFilterProductVariationKeys = permutationVariation[attrIdProductVariationType] != 0; - ddlsProductVariationType.forEach((ddlProductVariationType) => { - valueSelected = DOM.getElementValueCurrent(ddlProductVariationType); - productVariationTypeKeysSelected.add(valueSelected); - }); - productVariationTypeKeys = productVariationTypeKeys.filter(typeKey => !productVariationTypeKeysSelected.has(typeKey)); - if (productVariationTypeKeys.length == 0) return; - if (doFilterProductVariationKeys) { - productVariationKeys = productVariationKeys.filter(variationKey => !productVariationTypeKeysSelected.has(productVariations[variationKey][attrIdProductVariationType])); - } - - let permutationVariationJson = permutationVariation[flagProductVariation]; - let permutationVariationTypeJson = permutationVariation[flagProductVariationType]; - - let tdVariationType = document.createElement("td"); - tdVariationType.classList.add(flagProductVariationType); - DOM.setElementAttributesValuesCurrentAndPrevious(tdVariationType, permutationVariationTypeJson[attrIdProductVariationType]); - - let ddlVariationType = document.createElement("select"); - ddlVariationType.classList.add(flagProductVariationType); - DOM.setElementAttributesValuesCurrentAndPrevious(ddlVariationType, permutationVariationTypeJson[attrIdProductVariationType]); - - optionProductVariationType = DOM.createOption(null); - if (_verbose) { console.log("optionProductVariationType: ", optionProductVariationType); } - ddlVariationType.appendChild(optionProductVariationType); - - productVariationTypeKeys.forEach((productVariationTypeKey) => { - /* - optionProductVariationType = document.createElement('option'); - optionProductVariationType.value = optionVariationType.value; - optionProductVariationType.text = optionVariationType.text; - */ - productVariationType = productVariationTypes[productVariationTypeKey]; - optionProductVariationTypeJson = BusinessObjects.getOptionJsonFromObjectJson(productVariationType, permutationVariationTypeJson[attrIdProductVariationType]); - optionProductVariationType = DOM.createOption(optionProductVariationTypeJson); - if (_verbose) { console.log("optionProductVariationType: ", optionProductVariationType); } - ddlVariationType.appendChild(optionProductVariationType); - }); - - let tdVariation = document.createElement("td"); - tdVariation.classList.add(flagProductVariation); - DOM.setElementAttributesValuesCurrentAndPrevious(tdVariation, permutationVariationJson[attrIdProductVariation]); - - let ddlVariation = document.createElement("select"); - ddlVariation.classList.add(flagProductVariation); - DOM.setElementAttributesValuesCurrentAndPrevious(ddlVariation, permutationVariationJson[attrIdProductVariation]); - - optionProductVariation = DOM.createOption(null); - if (_verbose) { console.log("optionProductVariation: ", optionProductVariation); } - ddlVariation.appendChild(optionProductVariation); - - productVariationKeys.forEach((productVariationKey) => { - productVariation = productVariations[productVariationKey]; - optionProductVariationJson = BusinessObjects.getOptionJsonFromObjectJson(productVariation, permutationVariationJson[attrIdProductVariation]); - optionProductVariation = DOM.createOption(optionProductVariationJson); - if (_verbose) { console.log("optionProductVariation: ", optionProductVariation); } - ddlVariation.appendChild(optionProductVariation); - }); - - let tdDelete = document.createElement("td"); - tdDelete.classList.add(flagDelete); - - let buttonDelete = document.createElement("button"); - buttonDelete.classList.add(flagActive); - buttonDelete.classList.add(flagDelete); - buttonDelete.textContent = 'x'; - DOM.setElementAttributesValuesCurrentAndPrevious(buttonDelete, true); - - let tr = document.createElement("tr"); - tr.classList.add(flagProductVariation); - tdVariationType.appendChild(ddlVariationType); - tr.appendChild(tdVariationType); - tdVariation.appendChild(ddlVariation); - tr.appendChild(tdVariation); - tdDelete.appendChild(buttonDelete); - tr.appendChild(tdDelete); - tbody.appendChild(tr); - } - hookupDdlsProductPermutationVariationType() { - this.hookupTableCellDdls( - idTableMain + ' td.' + flagProductVariations + ' td.' + flagProductVariationType + ' select' - , (event, ddlVariationType) => { - this.handleChangeProductVariationInput(event, ddlVariationType); - let idVariationTypeSelected = DOM.getElementValueCurrent(ddlVariationType); - let row = DOM.getRowFromElement(ddlVariationType); - let tdVariation = row.querySelector('td.' + flagProductVariation); - tdVariation.dispatchEvent(new Event('click')); - let ddlVariation = row.querySelector('td.' + flagProductVariation + ' select'); - ddlVariation.innerHTML = ''; - ddlVariation.appendChild(DOM.createOption(null)); - let optionJson, option; - let variationType = productVariationTypes[idVariationTypeSelected]; - if (variationType == null) variationType = { - [flagProductVariations]: [], - }; - variationType[flagProductVariations].forEach((variation) => { - optionJson = BusinessObjects.getOptionJsonFromObjectJson(variation); - option = DOM.createOption(optionJson); - ddlVariation.appendChild(option); - }); - this.handleChangeProductVariationInput(event, ddlVariation); - } - ); - } - handleChangeProductVariationInput(event, element) { - this.handleChangeNestedElementCellTable(event, element); - this.updateProductPermutationVariations(element); - } - hookupDdlsProductPermutationVariation() { - this.hookupTableCellDdls(idTableMain + ' td.' + flagProductVariations + ' td.' + flagProductVariation + ' select', (event, ddlVariation) => { this.handleChangeProductVariationInput(event, ddlVariation); }); - } - hookupButtonsProductPermutationVariationAddDelete() { - let selectorButton = idTableMain + ' td.' + flagProductVariations + ' tr.' + flagProductVariation + ' button'; - let selectorButtonDelete = selectorButton + '.' + flagDelete; - let selectorButtonUndelete = selectorButton + '.' + flagAdd; - this.hookupButtonsRowDelete(selectorButtonDelete, selectorButtonUndelete, (event, element) => { this.handleChangeProductVariationInput(event, element); }); - this.hookupButtonsRowUndelete(selectorButtonDelete, selectorButtonUndelete, (event, element) => { this.handleChangeProductVariationInput(event, element); }); - this.hookupButtonsProductPermutationVariationAdd(); - } - hookupButtonsProductPermutationVariationAdd() { - this.hookupEventHandler( - "click" - , idTableMain + ' td.' + flagProductVariations + ' button.' + flagAdd - , (event, element) => { this.handleClickButtonProductPermutationVariationAdd(event, element); } - ); - } - handleClickButtonProductPermutationVariationAdd(event, element) { - let variationsCell = element.closest('td.' + flagProductVariations); - let tbody = variationsCell.querySelector('tbody'); - let permutationVariation = TableBasePage.createOptionUnselectedProductVariation(); - this.addProductPermutationVariationRow(tbody, permutationVariation); - this.hookupFieldsProductPermutationVariation(); - } - updateProductPermutationVariations(element) { - let variationsCell = element.closest('td.' + flagProductVariations); - let variationPairsString = this.getProductPermutationVariationsText(variationsCell); - DOM.setElementAttributeValueCurrent(variationsCell, variationPairsString); - this.handleChangeNestedElementCellTable(null, variationsCell); - } - getProductPermutationVariationsText(variationsTd) { - let rows = variationsTd.querySelectorAll(':scope tbody tr:has(button.' + flagDelete + ')'); - let variationPairsString = ''; - let ddlVariationType, ddlVariation, idVariationType, idVariation; - rows.forEach((row, index) => { - ddlVariationType = row.querySelector(':scope td select.' + flagProductVariationType); - ddlVariation = row.querySelector(':scope td select.' + flagProductVariation); - idVariationType = DOM.getElementValueCurrent(ddlVariationType); - idVariation = DOM.getElementValueCurrent(ddlVariation); - if (variationPairsString != '') variationPairsString += ','; - variationPairsString += idVariationType + ':' + idVariation; - }); - return variationPairsString; - } - hookupCurrencyFields() { - this.hookupTableCellDdlPreviews(idTableMain + ' td.' + flagCurrency, Utils.getListFromDict(currencies)); - } - createTdActive(isActive) { let tdActive = document.createElement("td"); tdActive.classList.add(flagActive); @@ -921,7 +530,6 @@ export default class TableBasePage extends BasePage { let dataPage = {}; dataPage[flagFormFilters] = DOM.convertForm2JSON(formFilters); this.setLocalStoragePage(dataPage); - // _rowBlank = null; } toggleColumnHasClassnameFlag(columnFlag, isRequiredFlag, classnameFlag) { @@ -930,12 +538,6 @@ export default class TableBasePage extends BasePage { let columnThHasFlag = columnTh.classList.contains(classnameFlag); if (isRequiredFlag == columnThHasFlag) return; DOM.toggleElementHasClassnameFlag(columnTh, isRequiredFlag, classnameFlag); - /* - let columnTds = table.querySelectorAll('td.' + columnFlag); - columnTds.forEach((columnTd) => { - DOM.toggleElementHasClassnameFlag(columnTd, isRequiredFlag, classnameFlag); - }); - */ } toggleColumnHeaderHasClassnameFlag(columnFlag, isRequiredFlag, classnameFlag) { let table = TableBasePage.getTableMain(); @@ -949,26 +551,3 @@ export default class TableBasePage extends BasePage { this.toggleShowButtonsSaveCancel(existsDirtyRecord); } } - - -/* Example of a subclass of TableBasePage -import { TableBasePage } from "./page_table_base.js"; -import API from "../api.js"; -import DOM from "../dom.js"; - -export class PageStoreProductCategories extends TableBasePage { - static hash = hashPageStoreProductCategories; - static attrIdRowObject = attrIdProductCategory; - callSaveTableContent = API.saveCategories; - - constructor() {} - initialize() {} - hookupFilters() {} - loadRowTable(rowJson) {} - getJsonRow(row) {} - initialiseRowNew(tbody, row) {} - hookupTableMain() {} - isDirtyRow(row) {} - leave() {} -} -*/ \ No newline at end of file diff --git a/static/js/pages/core/contact-success.js b/static/js/pages/core/contact-success.js new file mode 100644 index 00000000..877be199 --- /dev/null +++ b/static/js/pages/core/contact-success.js @@ -0,0 +1,16 @@ +// internal +import BasePage from "../base.js"; +// vendor +import { Altcha } from "../../vendor/altcha.js"; + +export default class PageContactSuccess extends BasePage { + static hash = hashPageContactSuccess; + + constructor(router) { + super(router); + } + + initialize() { + this.sharedInitialize(); + } +} diff --git a/static/js/router.js b/static/js/router.js index 93f7281f..82a73fc9 100644 --- a/static/js/router.js +++ b/static/js/router.js @@ -3,19 +3,17 @@ // Core import PageHome from './pages/core/home.js'; import PageContact from './pages/core/contact.js'; +import PageContactSuccess from './pages/core/contact-success.js'; // Legal import PageAccessibilityReport from './pages/legal/accessibility_report.js'; import PageAccessibilityStatement from './pages/legal/accessibility_statement.js'; import PageLicense from './pages/legal/license.js'; -// User -// import PageUserLogin from './pages/user/login.js'; -// import PageUserLogout from './pages/user/logout.js'; -// import PageUserAccount from './pages/user/account.js'; +import PagePrivacyPolicy from './pages/legal/privacy_policy.js'; +import PageRetentionSchedule from './pages/legal/retention_schedule.js'; import API from './api.js'; import DOM from './dom.js'; -import PagePrivacyPolicy from './pages/legal/privacy_policy.js'; -import PageRetentionSchedule from './pages/legal/retention_schedule.js'; +import Utils from './lib/utils.js'; export default class Router { @@ -23,18 +21,14 @@ export default class Router { // Pages this.pages = {}; // Core - this.pages[hashPageHome] = { name: 'PageHome', module: PageHome }; // importModule: () => import(/* webpackChunkName: "page_core_home" */ './pages/core/home.js') , pathModule: './pages/core/home.js' - this.pages[hashPageContact] = { name: 'PageContact', module: PageContact }; // pathModule: './pages/core/contact.js' }; + this.pages[hashPageHome] = { name: 'PageHome', module: PageHome }; + this.pages[hashPageContact] = { name: 'PageContact', module: PageContact }; + this.pages[hashPageContactSuccess] = { name: 'PageContact', module: PageContactSuccess }; // Legal - this.pages[hashPageAccessibilityStatement] = { name: 'PageAccessibilityStatement', module: PageAccessibilityStatement }; // pathModule: '../../static/js/pages/legal/accessibility_statement.js' }; // , page: PageAccessibilityStatement - this.pages[hashPageDataRetentionSchedule] = { name: 'PageDataRetentionSchedule', module: PageRetentionSchedule }; // pathModule: './pages/legal/data_retention_schedule.js' }; - this.pages[hashPageLicense] = { name: 'PageLicense', module: PageLicense }; // pathModule: './pages/legal/license.js' }; - this.pages[hashPagePrivacyPolicy] = { name: 'PagePrivacyPolicy', module: PagePrivacyPolicy }; // pathModule: './pages/legal/privacy_policy.js' }; // importModule: () => {return import(/* webpackChunkName: "page_privacy_policy" */ './pages/legal/privacy_policy.js'); } - // User - // this.pages[hashPageUserLogin] = { name: 'PageUserLogin', module: PageUserLogin }; // pathModule: './pages/user/login.js' }; - // this.pages[hashPageUserLogout] = { name: 'PageUserLogout', module: PageUserLogout }; // pathModule: './pages/user/logout.js' }; - // this.pages[hashPageUserAccount] = { name: 'PageUserAccount', module: PageUserAccount }; // pathModule: './pages/user/account.js' }; - + this.pages[hashPageAccessibilityStatement] = { name: 'PageAccessibilityStatement', module: PageAccessibilityStatement }; + this.pages[hashPageDataRetentionSchedule] = { name: 'PageDataRetentionSchedule', module: PageRetentionSchedule }; + this.pages[hashPageLicense] = { name: 'PageLicense', module: PageLicense }; + this.pages[hashPagePrivacyPolicy] = { name: 'PagePrivacyPolicy', module: PagePrivacyPolicy }; // Routes this.routes = {}; // Core @@ -45,10 +39,6 @@ export default class Router { this.routes[hashPageDataRetentionSchedule] = (isPopState = false) => this.navigateToHash(hashPageDataRetentionSchedule, isPopState); this.routes[hashPageLicense] = (isPopState = false) => this.navigateToHash(hashPageLicense, isPopState); this.routes[hashPagePrivacyPolicy] = (isPopState = false) => this.navigateToHash(hashPagePrivacyPolicy, isPopState); - // User - // this.routes[hashPageUserLogin] = (isPopState = false) => this.navigateToHash(hashPageUserLogin, isPopState); - // this.routes[hashPageUserLogout] = (isPopState = false) => this.navigateToHash(hashPageUserLogout, isPopState); - // this.routes[hashPageUserAccount] = (isPopState = false) => this.navigateToHash(hashPageUserAccount, isPopState); this.initialize(); } loadPage(hashPage, isPopState = false) { @@ -61,31 +51,17 @@ export default class Router { let pageJson = this.pages[hashPage]; try { - /* - const module = await pagesContext(pageJson.pathModule); - console.log("module: ", module); - return module[pageJson.name]; - */ - // const module = await import(pageJson.pathModule); // pageJson.page; - // const module = () => import(pageJson.pathModule); - const module = pageJson.module; // importModule; - return module; // [pageJson.name]; + const module = pageJson.module; + return module; } catch (error) { - if (_verbose) { console.log("this.pages: ", this.pages); }; + Utils.consoleLogIfNotProductionEnvironment("this.pages: ", this.pages); console.error('Page not found:', hashPage); throw error; } } initialize() { - /* - let pages = Router.getPages(); - for (const key of Object.keys(pages)) { - let page = pages[key]; - this.addRoute(page.hash, page.initialize); - } - */ - window.addEventListener('popstate', this.handlePopState.bind(this)); // page accessed by history navigation + window.addEventListener('popstate', this.handlePopState.bind(this)); } handlePopState(event) { this.loadPageCurrent(); @@ -95,26 +71,11 @@ export default class Router { this.loadPage(hashPageCurrent); } navigateToHash(hash, data = null, params = null, isPopState = false) { - // this.beforeLeave(); - /* - if (this.routes[hash]) { - this.routes[hash](isPopState); - } else { - console.error(`Hash ${hash} not found`); - } - */ let url = API.getUrlFromHash(hash, params); - // if (!isPopState) history.pushState({data: data, params: params}, '', hash); API.goToUrl(url, data); } - /* beforeunload listener - async beforeLeave() { - const ClassPageCurrent = await this.getClassPageFromHash(DOM.getHashPageCurrent()); - const pageCurrent = new ClassPageCurrent(this); - pageCurrent.leave(); - } - */ + navigateToUrl(url, data = null, appendHistory = true) { // this.beforeLeave(); if (appendHistory) history.pushState(data, '', url); @@ -128,25 +89,3 @@ export default class Router { } export const router = new Router(); - -/* -router.addRoute('/', () => { - console.log('Home page'); - // Load home page content -}); - -router.addRoute('/about', () => { - console.log('About page'); - // Load about page content -}); - -export function setupNavigationEvents() { - document.querySelectorAll('a[data-nav]').forEach(link => { - link.addEventListener('click', (e) => { - e.preventDefault(); - const url = e.target.getAttribute('href'); - router.navigateToUrl(url); - }); - }); -} -*/ \ No newline at end of file diff --git a/templates/components/store/_body_home.html b/templates/components/store/_body_home.html deleted file mode 100644 index 36c1185f..00000000 --- a/templates/components/store/_body_home.html +++ /dev/null @@ -1,33 +0,0 @@ - - -{% set block_id = 'styles' %} -{% include 'layouts/_shared_store.html' %} - - - - - -
-
- {% for cat in model.category_list.categories %} - {% if cat.is_available() %} - {% include 'components/store/_product_category.html' %} - {% endif %} - {% endfor %} -
-
- {% include 'components/store/_basket.html' %} -
-
- -{% set block_id = 'scripts' %} -{% include 'layouts/_shared_store.html' %} - - - - - \ No newline at end of file diff --git a/templates/components/store/_preview_DDL_currency.html b/templates/components/store/_preview_DDL_currency.html deleted file mode 100644 index 0db9e407..00000000 --- a/templates/components/store/_preview_DDL_currency.html +++ /dev/null @@ -1,17 +0,0 @@ - - -{% with _is_blank_row = (is_blank_row or model.currencies | length == 0 or currency is not defined or currency is none) %} - {% if not _is_blank_row %} -
{{ currency.symbol }}
- {% else %} -
- {% endif %} -{% endwith %} \ No newline at end of file diff --git a/templates/components/store/_preview_DDL_product.html b/templates/components/store/_preview_DDL_product.html deleted file mode 100644 index 978abbbd..00000000 --- a/templates/components/store/_preview_DDL_product.html +++ /dev/null @@ -1,15 +0,0 @@ - -{% if not is_blank_row %} -
{{ product.name }}
-{% else %} - -{% endif %} \ No newline at end of file diff --git a/templates/components/store/_preview_DDL_product_category.html b/templates/components/store/_preview_DDL_product_category.html deleted file mode 100644 index 3d1796f8..00000000 --- a/templates/components/store/_preview_DDL_product_category.html +++ /dev/null @@ -1,15 +0,0 @@ - -{% if not is_blank_row %} -
{{ category.name }}
-{% else %} - -{% endif %} \ No newline at end of file diff --git a/templates/components/store/_preview_DDL_product_permutation_interval_expiration_unsealed.html b/templates/components/store/_preview_DDL_product_permutation_interval_expiration_unsealed.html deleted file mode 100644 index ca7b1c13..00000000 --- a/templates/components/store/_preview_DDL_product_permutation_interval_expiration_unsealed.html +++ /dev/null @@ -1,17 +0,0 @@ - -{% with _is_blank_row = (is_blank_row or units_measurement_time_dict | length == 0 or permutation.id_unit_measurement_interval_expiration_unsealed is none) %} - {% if not _is_blank_row %} - {% set interval_recurrence = units_measurement_time_dict[permutation.id_unit_measurement_interval_expiration_unsealed] %} -
{{ interval_recurrence.name_singular }}
- {% else %} -
- {% endif %} -{% endwith %} \ No newline at end of file diff --git a/templates/components/store/_preview_DDL_product_permutation_interval_recurrence.html b/templates/components/store/_preview_DDL_product_permutation_interval_recurrence.html deleted file mode 100644 index 08234309..00000000 --- a/templates/components/store/_preview_DDL_product_permutation_interval_recurrence.html +++ /dev/null @@ -1,19 +0,0 @@ -{# - -#} -{% with _is_blank_row = (is_blank_row or units_measurement_time | length == 0 or permutation.id_unit_measurement_interval_recurrence is none) %} - {% if not _is_blank_row %} - {% set interval_recurrence = units_measurement_time[permutation.id_unit_measurement_interval_recurrence] | console_log %} -
{{ interval_recurrence.name_singular }}
- {% else %} -
- {% endif %} -{% endwith %} \ No newline at end of file diff --git a/templates/components/store/_preview_DDL_product_permutation_unit_measurement_quantity.html b/templates/components/store/_preview_DDL_product_permutation_unit_measurement_quantity.html deleted file mode 100644 index 1f7a21e0..00000000 --- a/templates/components/store/_preview_DDL_product_permutation_unit_measurement_quantity.html +++ /dev/null @@ -1,21 +0,0 @@ - -{# - -#} - -{% with _is_blank_row = (is_blank_row or units_measurement_dict | length == 0 or permutation.id_unit_measurement_quantity is none) %} - {% if not _is_blank_row %} - {% set interval_recurrence = units_measurement_dict[permutation.id_unit_measurement_quantity] | console_log %} -
{{ interval_recurrence.name_singular }}
- {% else %} -
- {% endif %} -{% endwith %} \ No newline at end of file diff --git a/templates/components/store/_preview_DDL_stock_item_storage_location.html b/templates/components/store/_preview_DDL_stock_item_storage_location.html deleted file mode 100644 index 4069a681..00000000 --- a/templates/components/store/_preview_DDL_stock_item_storage_location.html +++ /dev/null @@ -1,13 +0,0 @@ - -{% with _is_blank_row = (is_blank_row or storage_location is not defined or storage_location is none or is_blank_row is not defined) %} - {% if not _is_blank_row %} - {% set name = storage_location.get_full_name() %} -
{{ name }}
- {% else %} -
- {% endif %} -{% endwith %} \ No newline at end of file diff --git a/templates/components/store/_preview_DDL_supplier.html b/templates/components/store/_preview_DDL_supplier.html deleted file mode 100644 index adc715d6..00000000 --- a/templates/components/store/_preview_DDL_supplier.html +++ /dev/null @@ -1,17 +0,0 @@ - - -{% with _is_blank_row = (is_blank_row or model.suppliers | length == 0 or supplier is not defined or supplier is none) %} - {% if not _is_blank_row %} -
{{ supplier.name_company }}
- {% else %} -
- {% endif %} -{% endwith %} \ No newline at end of file diff --git a/templates/components/store/_preview_address.html b/templates/components/store/_preview_address.html deleted file mode 100644 index 6ea751ee..00000000 --- a/templates/components/store/_preview_address.html +++ /dev/null @@ -1,13 +0,0 @@ - -{% with _is_blank_row = (is_blank_row or address is not defined or address is none or is_blank_row is not defined) %} - {% if not _is_blank_row %} - {% set json_str = address.to_json_str() %} -
{{ address.postcode }}
- {% else %} -
- {% endif %} -{% endwith %} \ No newline at end of file diff --git a/templates/components/store/_preview_manufacturing_purchase_order_items.html b/templates/components/store/_preview_manufacturing_purchase_order_items.html deleted file mode 100644 index 878d29ea..00000000 --- a/templates/components/store/_preview_manufacturing_purchase_order_items.html +++ /dev/null @@ -1,13 +0,0 @@ - -{% with _is_blank_row = (is_blank_row or order_items is not defined or order_items is none or is_blank_row is not defined) %} - {% if not _is_blank_row %} - {% set str_items = model.convert_list_objects_to_preview_str(order_items) %} -
{{ str_items }}
- {% else %} -
- {% endif %} -{% endwith %} \ No newline at end of file diff --git a/templates/components/store/_preview_order_items.html b/templates/components/store/_preview_order_items.html deleted file mode 100644 index fbba4abe..00000000 --- a/templates/components/store/_preview_order_items.html +++ /dev/null @@ -1,13 +0,0 @@ - -{% with _is_blank_row = (is_blank_row or order_items is not defined or order_items is none or is_blank_row is not defined) %} - {% if not _is_blank_row %} - {% set str_items = model.convert_list_objects_to_preview_str(order_items) %} -
{{ str_items }}
- {% else %} -
- {% endif %} -{% endwith %} \ No newline at end of file diff --git a/templates/components/store/_preview_product_permutation_variations.html b/templates/components/store/_preview_product_permutation_variations.html deleted file mode 100644 index cec0f001..00000000 --- a/templates/components/store/_preview_product_permutation_variations.html +++ /dev/null @@ -1,14 +0,0 @@ - -{% with _is_blank_row = (is_blank_row or variation_tree is not defined or variation_tree is none or is_blank_row is not defined) %} - {% if not _is_blank_row %} - {% set str_ids_variations = variation_tree.to_variation_id_pairs_str() %} - {% set str_variations = variation_tree.to_preview_str() %} -
{{ str_variations }}
- {% else %} -
- {% endif %} -{% endwith %} \ No newline at end of file diff --git a/templates/components/store/_preview_product_variation_type_variations.html b/templates/components/store/_preview_product_variation_type_variations.html deleted file mode 100644 index fce5fdcd..00000000 --- a/templates/components/store/_preview_product_variation_type_variations.html +++ /dev/null @@ -1,21 +0,0 @@ - -{% with _is_blank_row = (is_blank_row or variation_type is not defined or variation_type.variations is none or variation_type.variations == [] or is_blank_row is not defined) %} - {% if not _is_blank_row %} - {# {% set ids_variation = variation_type.get_str_list_ids_variation() %} #} -
- {# - {{ variation_type.get_preview_variations() }} - #} - {% for variation in variation_type.variations %} - {{ variation.name }}
- {% endfor %} -
- {% else %} -
- {% endif %} -{% endwith %} \ No newline at end of file diff --git a/templates/components/store/_preview_product_variation_types.html b/templates/components/store/_preview_product_variation_types.html deleted file mode 100644 index c24e8489..00000000 --- a/templates/components/store/_preview_product_variation_types.html +++ /dev/null @@ -1,15 +0,0 @@ - -{% with _is_blank_row = (is_blank_row or variation_tree is not defined or is_blank_row is not defined) %} - {% if not _is_blank_row %} - {# % set json_str_variation_types = product.get_json_str_types_variation_trees() % #} - {% set names_variation_type = product.get_variation_types_unique() %} - {% set json_str_variation_types = jsonify(names_variation_type) %} -
{{ model.join_with_linebreaks(names_variation_type) }}
- {% else %} -
- {% endif %} -{% endwith %} \ No newline at end of file diff --git a/templates/components/store/_row_address.html b/templates/components/store/_row_address.html deleted file mode 100644 index d5575ffc..00000000 --- a/templates/components/store/_row_address.html +++ /dev/null @@ -1,79 +0,0 @@ - - -
- {{ form.hidden_tag() }} - - {% if form.form_type_billing_not_delivery %} -
- {{ form.identical.label }} - {{ form.identical(checked=True) }} -
- {% endif %} - -
- {{ form.region.label }} - {{ form.region() }} - {% for error in form.region.errors %} -

{{ error }}

- {% endfor %} -
- -
- {{ form.name_full.label }} - {{ form.name_full(size=100) }} - {% for error in form.name_full.errors %} -

{{ error }}

- {% endfor %} -
- -
- {{ form.phone_number.label }} - {{ form.phone_number(size=20) }} - {% for error in form.phone_number.errors %} -

{{ error }}

- {% endfor %} -
- -
- {{ form.postcode.label }} - {{ form.postcode(size=10) }} - {% for error in form.postcode.errors %} -

{{ error }}

- {% endfor %} -
- -
- {{ form.address_1.label }} - {{ form.address_1(size=254) }} - {% for error in form.address_1.errors %} -

{{ error }}

- {% endfor %} -
- -
- {{ form.address_2.label }} - {{ form.address_2(size=254) }} -
- -
- {{ form.city.label }} - {{ form.city(size=100) }} - {% for error in form.city.errors %} -

{{ error }}

- {% endfor %} -
- -
- {{ form.county.label }} - {{ form.county(size=100) }} - {% for error in form.county.errors %} -

{{ error }}

- {% endfor %} -
- -
- {{ form.submit() }} -
-
- diff --git a/templates/components/store/_row_basket.html b/templates/components/store/_row_basket.html deleted file mode 100644 index 8db698c6..00000000 --- a/templates/components/store/_row_basket.html +++ /dev/null @@ -1,18 +0,0 @@ - -{% set show_delivery_option = False %} -
-
-
-

Basket

- Basket icon -
- {% for basket_item in model.basket.items %} - {% include 'components/store/_basket_item.html' %} - {% endfor %} -

Total: {{ model.output_basket_total() }}

{% if not model.app.is_included_VAT %}

+ VAT

{% endif %} -

Buy some shit dawg!

- - -
-
\ No newline at end of file diff --git a/templates/components/store/_row_basket_item.html b/templates/components/store/_row_basket_item.html deleted file mode 100644 index 471ad389..00000000 --- a/templates/components/store/_row_basket_item.html +++ /dev/null @@ -1,42 +0,0 @@ - - -
- {% set product = basket_item.product %} - {% set permutation = product.get_permutation_selected() %} -
- Basket icon -
- {% set form = product.form_basket_edit %} - -
- {{ form.hidden_tag() }} -

{{ product.name }}

- {% if permutation.is_available %} -

{{ basket_item.quantity }} x {{ product.output_price(model.app.is_included_VAT) }} = {{ basket_item.output_subtotal() }}

- {% set tmp_quantity = basket_item.quantity %} - {% include 'components/common/inputs/_input_number_plus_minus.html' %} - {% elif permutation.is_unavailable_in_currency_or_region %} -

Product not available in currency and region

- {% else %} -

Product not available

- {% endif %} - Delete - {% if show_delivery_option %} -
- {{ product.form_delivery_option.label }} - {{ product.form_delivery_option() }} -
- {% endif %} - -
-
\ No newline at end of file diff --git a/templates/components/store/_row_manufacturing_purchase_order.html b/templates/components/store/_row_manufacturing_purchase_order.html deleted file mode 100644 index 15dfdf19..00000000 --- a/templates/components/store/_row_manufacturing_purchase_order.html +++ /dev/null @@ -1,84 +0,0 @@ - -{% if is_blank_row %} - - - {% include 'components/store/_preview_order_items.html' %} - - - {% include 'components/store/_preview_DDL_currency.html' %} - - -
- - -
- - - -
- - - -
- - {% set active = true %} - {% include 'components/store/_td_active.html' %} - -{% else %} - - {% set order_items = order.items %} - {% set json_str_items = model.jsonify(model.convert_list_objects_to_list_options(order_items)) %} - - {# - {% include 'components/store/_preview_manufacturing_purchase_order_items.html' %} - #} - {% include 'components/store/_preview_order_items.html' %} - - {% set currency = order.currency %} - - {% include 'components/store/_preview_DDL_currency.html' %} - - -
- - -
- - -
- - -
- - {% set active = order.active %} - {% include 'components/store/_td_active.html' %} - -{% endif %} \ No newline at end of file diff --git a/templates/components/store/_row_product.html b/templates/components/store/_row_product.html deleted file mode 100644 index 12baad08..00000000 --- a/templates/components/store/_row_product.html +++ /dev/null @@ -1,60 +0,0 @@ -{% if is_blank_row %} - - - {% include 'components/common/buttons/_slider_display_order.html' %} - - - {% include 'components/store/_preview_DDL_product_category.html' %} - - - - - {# - - - - #} - - - - -
View
- - {% set active = true %} - {% include 'components/store/_td_active.html' %} - -{% else %} - - - {% set display_order = category.display_order %} - {% include 'components/common/buttons/_slider_display_order.html' %} - - - {% include 'components/store/_preview_DDL_product_category.html' %} - - - - - {# - - {% include 'components/common/inputs/_textarea_product_variation_types.html' %} - - - #} - - - - -
{{ product.name_access_level_required }}
- - {% set active = product.active %} - {% include 'components/store/_td_active.html' %} - -{% endif %} diff --git a/templates/components/store/_row_product_category.html b/templates/components/store/_row_product_category.html deleted file mode 100644 index 2ca036d5..00000000 --- a/templates/components/store/_row_product_category.html +++ /dev/null @@ -1,42 +0,0 @@ -{% if is_blank_row %} - - - {% include 'components/common/buttons/_slider_display_order.html' %} - - - - - - - - - - - -
View
- - {% set active = true %} - {% include 'components/store/_td_active.html' %} - -{% else %} - - - {% set display_order = category.display_order %} - {% include 'components/common/buttons/_slider_display_order.html' %} - - - - - - - - - - - -
{{ category.name_access_level_required }}
- - {% set active = category.active %} - {% include 'components/store/_td_active.html' %} - -{% endif %} \ No newline at end of file diff --git a/templates/components/store/_row_product_permutation.html b/templates/components/store/_row_product_permutation.html deleted file mode 100644 index e3b9eb13..00000000 --- a/templates/components/store/_row_product_permutation.html +++ /dev/null @@ -1,183 +0,0 @@ - -{% if is_blank_row %} - - - {% include 'components/store/_preview_DDL_product_category.html' %} - - - {% include 'components/store/_preview_DDL_product.html' %} - - - {% include 'components/store/_preview_product_permutation_variations.html' %} - - - - - - - - - - - - - - - - - - {% include 'components/store/_preview_DDL_product_permutation_unit_measurement_quantity.html' %} - - - - - - - - - {% include 'components/store/_preview_DDL_product_permutation_interval_recurrence.html' %} - - - - - - - - - - - - {% include 'components/store/_preview_DDL_product_permutation_interval_expiration_unsealed.html' %} - - - -
- 0 -
- - -
- 0 -
- - - {% include 'components/store/_preview_DDL_currency.html' %} - - - - - - - - {% set active = true %} - {% include 'components/store/_td_active.html' %} - -{% else %} - - - {% include 'components/store/_preview_DDL_product_category.html' %} - - - {% include 'components/store/_preview_DDL_product.html' %} - - - {% set variation_tree = permutation.variation_tree %} - {% set str_ids_variations = variation_tree.to_variation_id_pairs_str() if not (variation_tree is none) else '' %} - - {% include 'components/store/_preview_product_permutation_variations.html' %} - - - - - - - - - - - - - - - - - - {% include 'components/store/_preview_DDL_product_permutation_unit_measurement_quantity.html' %} - - - - - - {% set value = permutation.count_interval_recurrence if permutation.count_interval_recurrence is not none else 1 %} - - - - {% set value = permutation.id_unit_measurement_interval_recurrence if permutation.id_unit_measurement_interval_recurrence is not none else '' %} - - {% include 'components/store/_preview_DDL_product_permutation_interval_recurrence.html' %} - - - {% set value = permutation.id_stripe_product if permutation.id_stripe_product is not none else '' %} - - - - - - - {% set value = permutation.count_interval_expiration_unsealed if permutation.count_interval_expiration_unsealed is not none else 1 %} - - - - {% set value = permutation.id_unit_measurement_interval_expiration_unsealed if permutation.id_unit_measurement_interval_expiration_unsealed is not none else '' %} - - {% include 'components/store/_preview_DDL_product_permutation_interval_expiration_unsealed.html' %} - - -
- {{ permutation.cost_local_VAT_excl }} -
- - -
- {{ permutation.cost_local_VAT_incl }} -
- - - {% set currency = permutation.currency_cost %} - - {% include 'components/store/_preview_DDL_currency.html' %} - - - - - - - - {% set active = permutation.active %} - {% include 'components/store/_td_active.html' %} - -{% endif %} diff --git a/templates/components/store/_row_product_variation_type.html b/templates/components/store/_row_product_variation_type.html deleted file mode 100644 index 9017e0cb..00000000 --- a/templates/components/store/_row_product_variation_type.html +++ /dev/null @@ -1,51 +0,0 @@ -{% if is_blank_row %} - - - {% include 'components/common/buttons/_slider_display_order.html' %} - - - - - - - - - - - - {% include 'components/store/_preview_product_variation_type_variations.html' %} - - {% set active = true %} - {% include 'components/store/_td_active.html' %} - -{% else %} - - - {% set display_order = variation_type.display_order %} - {% include 'components/common/buttons/_slider_display_order.html' %} - - - - - - - - - - - - {% include 'components/store/_preview_product_variation_type_variations.html' %} - - {% set active = variation_type.active %} - {% include 'components/store/_td_active.html' %} - -{% endif %} diff --git a/templates/components/store/_row_stock_item.html b/templates/components/store/_row_stock_item.html deleted file mode 100644 index 80eab421..00000000 --- a/templates/components/store/_row_stock_item.html +++ /dev/null @@ -1,147 +0,0 @@ -{% if date_time_now is not defined %} - {% set date_time_now = model.format_date(datetime.now()) %} -{% endif %} -{% if is_blank_row %} - - - {% include 'components/store/_preview_DDL_product_category.html' %} - - - {% include 'components/store/_preview_DDL_product.html' %} - - - {% include 'components/store/_preview_product_permutation_variations.html' %} - - - {% include 'components/store/_preview_DDL_currency.html' %} - - - - - - - - - - - - - - - {% include 'components/store/_preview_DDL_stock_item_storage_location.html' %} - - - - - - - - - - - - - - - - - {% set active = true %} - {% include 'components/store/_td_active.html' %} - -{% else %} - - - {% include 'components/store/_preview_DDL_product_category.html' %} - - - {% include 'components/store/_preview_DDL_product.html' %} - - {% set variation_tree = permutation.variation_tree %} - {% set str_ids_variations = variation_tree.to_variation_id_pairs_str() if not (variation_tree is none) else '' %} - - {% include 'components/store/_preview_product_permutation_variations.html' %} - - {% set currency = stock_item.currency_cost %} - - {% include 'components/store/_preview_DDL_currency.html' %} - - - - - - - - - - - - - - - {% set storage_location = stock_item.storage_location %} - {% include 'components/store/_preview_DDL_stock_item_storage_location.html' %} - - - - - - - - - - - - - - - - - {% set active = stock_item.active %} - {% include 'components/store/_td_active.html' %} - -{% endif %} \ No newline at end of file diff --git a/templates/components/store/_row_supplier.html b/templates/components/store/_row_supplier.html deleted file mode 100644 index 0653c8fb..00000000 --- a/templates/components/store/_row_supplier.html +++ /dev/null @@ -1,67 +0,0 @@ -{% if is_blank_row %} - - - - - - - - - - - - {% include 'components/store/_preview_address.html' %} - - - - - - - - - - - - - - - {% include 'components/store/_preview_DDL_currency.html' %} - - {% set active = true %} - {% include 'components/store/_td_active.html' %} - -{% else %} - - - - - - - - - - - {% set address = supplier.get_address_active() %} - - {% include 'components/store/_preview_address.html' %} - - - - - - - - - - - - - - {% set currency = supplier.currency %} - - {% include 'components/store/_preview_DDL_currency.html' %} - - {% set active = supplier.active %} - {% include 'components/store/_td_active.html' %} - -{% endif %} \ No newline at end of file diff --git a/templates/components/store/_row_supplier_purchase_order.html b/templates/components/store/_row_supplier_purchase_order.html deleted file mode 100644 index f540fa20..00000000 --- a/templates/components/store/_row_supplier_purchase_order.html +++ /dev/null @@ -1,66 +0,0 @@ - -{% if is_blank_row %} - - - {% include 'components/store/_preview_DDL_supplier.html' %} - - - {% include 'components/store/_preview_order_items.html' %} - - - {% include 'components/store/_preview_DDL_currency.html' %} - - -
- - -
- - {% set active = true %} - {% include 'components/store/_td_active.html' %} - -{% else %} - - {% set supplier = order.supplier %} - - {% include 'components/store/_preview_DDL_supplier.html' %} - - {% set order_items = order.items %} - {% set json_str_items = model.jsonify(model.convert_list_objects_to_list_options(order_items)) %} - - {% include 'components/store/_preview_order_items.html' %} - - {% set currency = order.currency %} - - {% include 'components/store/_preview_DDL_currency.html' %} - - - {# - - #} -
- - - {# - - #} -
- - {% set active = order.active %} - {% include 'components/store/_td_active.html' %} - -{% endif %} \ No newline at end of file diff --git a/templates/components/store/_td_active.html b/templates/components/store/_td_active.html deleted file mode 100644 index 9f72e3e2..00000000 --- a/templates/components/store/_td_active.html +++ /dev/null @@ -1,13 +0,0 @@ - - -{% with _active = (active is not defined or active or active is none) %} - - {# - - #} - - -{% endwith %} \ No newline at end of file diff --git a/templates/layouts/_shared_store.html b/templates/layouts/_shared_store.html deleted file mode 100644 index 59908b32..00000000 --- a/templates/layouts/_shared_store.html +++ /dev/null @@ -1,31 +0,0 @@ -{% if block_id == 'block1' %} -
-

Feckin common block boi

-
-{% elif block_id == 'checkout' %} - - -{% endif %} \ No newline at end of file diff --git a/templates/layouts/layout.html b/templates/layouts/layout.html index e35b823c..60039446 100644 --- a/templates/layouts/layout.html +++ b/templates/layouts/layout.html @@ -47,6 +47,11 @@ var attrValueCurrent = "{{ model.ATTR_VALUE_CURRENT }}"; var attrValuePrevious = "{{ model.ATTR_VALUE_PREVIOUS }}"; var attrValueNew = "{{ model.ATTR_VALUE_NEW }}"; + var environment = { + "name": "{{ model.app.app_config.FLASK_ENV }}", + "is_production": "{{ model.app.app_config.is_production }}", + "is_development": "{{ model.app.app_config.is_development }}", + }; var flagAccessLevel = "{{ model.FLAG_ACCESS_LEVEL }}"; var flagAccessLevelRequired = "{{ model.FLAG_ACCESS_LEVEL_REQUIRED }}"; var flagActive = "{{ model.FLAG_ACTIVE }}"; @@ -132,23 +137,16 @@ var flagTemporaryElement = "{{ model.FLAG_TEMPORARY_ELEMENT }}"; var flagUser = "{{ model.FLAG_USER }}"; var flagWebsite = "{{ model.FLAG_WEBSITE }}"; - var hashALTCHACreateChallenge = "{{ model.HASH_ALTCHA_CREATE_CHALLENGE }}"; - var hashApplyFiltersStoreProductPermutation = "{{ model.HASH_APPLY_FILTERS_STORE_PRODUCT_PERMUTATION }}"; + var hashGetALTCHAChallenge = "{{ model.HASH_ALTCHA_CREATE_CHALLENGE }}"; var hashPageAccessibilityReport = "{{ model.HASH_PAGE_ACCESSIBILITY_REPORT }}"; var hashPageAccessibilityStatement = "{{ model.HASH_PAGE_ACCESSIBILITY_STATEMENT }}"; - var hashPageAdminHome = "{{ model.HASH_PAGE_ADMIN_HOME }}"; var hashPageContact = "{{ model.HASH_PAGE_CONTACT }}"; + var hashPageContactSuccess = "{{ model.HASH_PAGE_CONTACT_SUCCESS }}"; var hashPageDataRetentionSchedule = "{{ model.HASH_PAGE_DATA_RETENTION_SCHEDULE }}"; - // var hashPageCurrent = "{{ model.hash_page_current }}"; var hashPageErrorNoPermission = "{{ model.HASH_PAGE_ERROR_NO_PERMISSION }}"; var hashPageHome = "{{ model.HASH_PAGE_HOME }}"; var hashPageLicense = "{{ model.HASH_PAGE_LICENSE }}"; var hashPagePrivacyPolicy = "{{ model.HASH_PAGE_PRIVACY_POLICY }}"; - var hashPageServices = "{{ model.HASH_PAGE_SERVICES }}"; - var hashPageUserAccount = "{{ model.HASH_PAGE_USER_ACCOUNT }}"; - var hashPageUserAdmin = "{{ model.HASH_PAGE_USER_ADMIN }}"; - var hashPageUserLogin = "{{ model.HASH_PAGE_USER_LOGIN }}"; - var hashPageUserLogout = "{{ model.HASH_PAGE_USER_LOGOUT }}"; var idButtonApplyFilters = "#{{ model.ID_BUTTON_APPLY_FILTERS }}"; var idButtonHamburger = "#{{ model.ID_BUTTON_HAMBURGER }}"; var idCSRFToken = "#{{ model.ID_CSRF_TOKEN }}"; @@ -168,10 +166,6 @@ - @@ -182,7 +176,7 @@
- - - - diff --git a/templates/pages/core/_contact.html b/templates/pages/core/_contact.html index 452ae8e3..e3fc5990 100644 --- a/templates/pages/core/_contact.html +++ b/templates/pages/core/_contact.html @@ -2,25 +2,6 @@ {% block page_head %} - {# - - #} - {# with CDN - - - #} - {# with locally stored vendor project - this is imported into contact.js - - #} - {% endblock %} {% block page_nav_links %} @@ -31,36 +12,14 @@ {% endblock %} {% block page_body %} - {# - - #} {% set form = model.form_contact %}

Contact Us

Please fill in the form below and we'll get back to you as soon as possible.

- - {% with messages = get_flashed_messages() %} - {% if messages %} -
    - {% for message in messages %} -
  • {{ message }}
  • - {% endfor %} -
- {% endif %} - {% endwith %} -
+ {{ form.csrf_token }}
@@ -90,27 +49,17 @@ {{ model.form_contact.receive_marketing.label }}
- {# {{ model.form_contact.recaptcha() }} #} - {# - - #}
{{ form.altcha.label }} - {# - {{ form.altcha }} - {{ form.altcha.hidden() }} - #}
+

This CAPTCHA mechanism is fully GDPR-compliant with no cookies, no fingerprinting, no tracking, and runs in the background so you don't need to do anything!

{{ model.form_contact.submit() }} @@ -119,74 +68,13 @@

How we use your information

-

We will use the information you provide in this form to:

-
    -
  • Respond to your inquiry about our ERP implementation services
  • -
  • Create and send you a proposal if requested
  • -
  • Contact you regarding your interest in our services
  • -
-

If you opt in to marketing communications, we will also use your email address to send you updates about our services, ERPNext features, and relevant industry news. You can unsubscribe from these communications at any time.

- -

We retain contact form submissions for customer service purposes and retain marketing consent records as required by law. For details about how long we keep your information, please see our data retention schedule.

- -

For full details about how we handle your personal data, please read our Privacy Policy.

+

We retain contact form submissions for customer service purposes and retain marketing consent records as required by law. For details about how long we keep your information, please see our data retention schedule.

+

For full details about how we handle your personal data, please read our Privacy Policy.

- {# included in footer now -
-
-

Our contact details

-
- -
-
-
- #} - - {# with CDN - - #} - - {# with locally stored vendor project - this is now in contact.js - - #} +{% endblock %} \ No newline at end of file diff --git a/templates/pages/legal/_accessibility_statement.html b/templates/pages/legal/_accessibility_statement.html index 59124b24..086f6ddc 100644 --- a/templates/pages/legal/_accessibility_statement.html +++ b/templates/pages/legal/_accessibility_statement.html @@ -3,10 +3,6 @@ {% block title %}{{ model.title }}{% endblock %} {% block page_body %} - @@ -201,10 +197,9 @@ [Note: publishing the test report is optional but doing so may allow you to make your accessibility statement shorter and more focused.] https://www.w3.org/WAI/eval/report-tool/#/ --> -

You can read the full accessibility test report {{ model.URL_HOST }}{{ url_for('routes_legal.accessibility_report') }}.

+

You can read the full accessibility test report {{ model.URL_HOST }}{{ model.HASH_PAGE_ACCESSIBILITY_REPORT }}.

- {% endblock %} \ No newline at end of file diff --git a/templates/pages/legal/_retention_schedule.html b/templates/pages/legal/_retention_schedule.html index e12f650f..51a7f369 100644 --- a/templates/pages/legal/_retention_schedule.html +++ b/templates/pages/legal/_retention_schedule.html @@ -1955,7 +1955,7 @@