1. Refactoring form objects and database objects to use inheritance and abstract base class for consistency and reduced redundancy.\n2. Contact us page button links updated to resolve error of missing link causing page refresh instead of expected functionality.

This commit is contained in:
2024-09-10 12:09:50 +01:00
parent c9dda91dc9
commit 6b730bf8e7
709 changed files with 5158 additions and 1512 deletions

View File

@@ -0,0 +1,14 @@
{% if block_id == 'button_save' %}
<button id="{{ model.ID_BUTTON_SAVE }}" type="button" class="{{ model.FLAG_SUBMIT }} {{ model.FLAG_SAVE }}">Save</button>
{% elif block_id == 'button_cancel' %}
<button id="{{ model.ID_BUTTON_CANCEL }}" type="button" class="{{ model.FLAG_CANCEL }}">Cancel</button>
{% elif block_id == 'button_add' %}
<button id="{{ model.ID_BUTTON_ADD }}" type="button" class="{{ model.FLAG_ADD }}">Add new</button>
{% elif block_id == 'button_confirm' %}
<button id="{{ model.ID_BUTTON_CONFIRM }}" type="button" class="{{ model.FLAG_SUBMIT }}">Confirm</button>
{% elif block_id == 'button_get_in_touch' %}
<button class="{{ model.FLAG_NAV_CONTACT_US }}" alt="Get in touch" aria-label="Get in touch">Get in touch</button>
{% elif block_id == 'button_apply_filters' %}
<button id="{{ model.ID_BUTTON_APPLY_FILTERS }}" type="button" class="{{ model.FLAG_SUBMIT }}">Apply filters</button>
{% elif block_id == 'button_clear_filters' %}
{% endif %}

View File

@@ -0,0 +1,8 @@
{% if display_order is defined %}
<!-- Fix this
<div class="{{ model.FLAG_SLIDER }} {{ model.FLAG_DISPLAY_ORDER }}" {{ model.ATTR_VALUE_CURRENT }}="{{ display_order }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ display_order }}">☰</div>
-->
<input type="number" class="{{ model.FLAG_SLIDER }} {{ model.FLAG_DISPLAY_ORDER }}" {{ model.ATTR_VALUE_CURRENT }}="{{ display_order }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ display_order }}" value="{{ display_order }}">
{% else %}
<div class="{{ model.FLAG_SLIDER }} {{ model.FLAG_DISPLAY_ORDER }}" {{ model.ATTR_VALUE_CURRENT }} {{ model.ATTR_VALUE_PREVIOUS }}></div>
{% endif %}

View File

@@ -0,0 +1,17 @@
<!-- Input Number with +/- buttons -->
<!-- requires:
Product product
Form_Product form - with product id attribute for accessing input element attribute
int tmp_quantity - placeholder
-->
<div class="{{ model.FLAG_CONTAINER }} {{ model.FLAG_ROW }}">
<div class="{{ model.FLAG_CONTAINER }} {{ model.FLAG_COLUMN }}" style="flex: none;">
<div class="btn-decrement" {{ model.ATTR_ID_PRODUCT }}="{{ product.id_product }}" {{ model.ATTR_ID_PERMUTATION }}="{{ permutation.id_permutation }}" {{ model.ATTR_FORM_TYPE }}="{{ form.form_type }}">-</div>
</div>
<div class="{{ model.FLAG_CONTAINER }}-input {{ model.FLAG_COLUMN }}" style="flex: none;">
{{ form.quantity(value=tmp_quantity) }} <!-- model.attr_id_product=product.id -->
</div>
<div class="{{ model.FLAG_CONTAINER }} {{ model.FLAG_COLUMN }}" style="flex: none;">
<div class="btn-increment" {{ model.ATTR_ID_PRODUCT }}="{{ product.id_product }}" {{ model.ATTR_ID_PERMUTATION }}="{{ permutation.id_permutation }}" {{ model.ATTR_FORM_TYPE }}="{{ form.form_type }}">+</div>
</div>
</div>

View File

@@ -0,0 +1,18 @@
{% if variation_tree is not defined %}
{% set is_blank_row = True %}
{% endif %}
{% if is_blank_row is not defined %}
{% set is_blank_row = True %}
{% endif %}
{% if not is_blank_row %}
{% set json_str_variations = permutation.variation_tree.to_json_str() %}
<textarea
class="{{ model.FLAG_VARIATIONS }}"
{{ model.ATTR_VALUE_CURRENT }}="{{ json_str_variations }}"
{{ model.ATTR_VALUE_PREVIOUS }}="{{ json_str_variations }}"
>{{ permutation.variation_tree.to_str_textarea() }}</textarea>
{% else %}
<textarea class="{{ model.FLAG_VARIATIONS }}" {{ model.ATTR_VALUE_CURRENT }} {{ model.ATTR_VALUE_PREVIOUS }}></textarea>
{% endif %}

View File

@@ -0,0 +1,20 @@
{% if variation_tree is not defined %}
{% set is_blank_row = True %}
{% endif %}
{% if is_blank_row is not defined %}
{% set is_blank_row = True %}
{% endif %}
{% 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) %}
<textarea
class="{{ model.FLAG_VARIATIONS }}"
{{ model.ATTR_VALUE_CURRENT }}="{{ json_str_variation_types }}"
{{ model.ATTR_VALUE_PREVIOUS }}="{{ json_str_variation_types }}"
>{{ model.join_with_linebreaks(names_variation_type) }}</textarea>
{% else %}
<textarea class="{{ model.FLAG_VARIATIONS }}" {{ model.ATTR_VALUE_CURRENT }} {{ model.ATTR_VALUE_PREVIOUS }}></textarea>
{% endif %}

View File

@@ -0,0 +1,10 @@
{% extends '_template_overlay.html' %}
<!-- Requirements
Form_Billing form
string overlay_id
string overlay_title
-->
{% block overlay_body %}
{% include 'components/store/_address.html' %}
{% endblock %}

View File

@@ -0,0 +1,50 @@
<div class="{{ model.FLAG_OVERLAY }} {{ model.FLAG_COLLAPSED }} {{ model.FLAG_CARD }}" id="{{ model.ID_OVERLAY_CONFIRM }}" style="visibility: hidden;" z-index="2">
<div class="{{ model.FLAG_CONTAINER }} {{ model.FLAG_ROW }}">
<h2>Are you sure?</h2>
</div>
<div class="{{ model.FLAG_CONTAINER }} {{ model.FLAG_ROW }}">
<textarea id="{{ model.ID_TEXTAREA_CONFIRM }}" rows="4" cols="50"></textarea>
</div>
<div class="{{ model.FLAG_CONTAINER }} {{ model.FLAG_ROW }}">
{% set block_id = 'button_cancel' %}
{% include 'components/common/buttons/_buttons_save_cancel.html' %}
{% set block_id = 'button_confirm' %}
{% include 'components/common/buttons/_buttons_save_cancel.html' %}
</div>
</div>
<script>
var idOverlayConfirm = "#{{ model.ID_OVERLAY_CONFIRM }}";
function hookupOverlayConfirm(callbackSuccess) {
/*
let overlay = document.querySelector("#{{ model.ID_OVERLAY_CONFIRM }}");
let textarea = overlay.querySelector('#{{ model.ID_TEXTAREA_CONFIRM }}');
let buttonCancel = overlay.querySelector('#{{ model.ID_BUTTON_CANCEL }}');
let buttonConfirm = overlay.querySelector('#{{ model.ID_BUTTON_CONFIRM }}');
*/
let selectorTextarea = idOverlayConfirm + ' textarea';
let selectorButtonCancel = idOverlayConfirm + ' button.' + flagCancel;
let selectorButtonConfirm = idOverlayConfirm + ' button.' + flagSubmit;
initialiseEventHandler(selectorButtonCancel, flagInitialised, function(buttonCancel) {
buttonCancel.addEventListener('click', function() {
let overlay = document.querySelector(idOverlayConfirm);
overlay.style.visibility = 'hidden';
});
});
initialiseEventHandler(selectorButtonConfirm, flagInitialised, function(buttonConfirm) {
buttonConfirm.addEventListener('click', function() {
let overlay = document.querySelector(idOverlayConfirm);
let textarea = overlay.querySelector('textarea');
overlay.style.visibility = 'hidden';
callbackSuccess(textarea.value);
});
});
}
function showOverlayConfirm() {
let overlay = document.querySelector(idOverlayConfirm);
overlay.classList.remove(flagCollapsed);
overlay.style.visibility = 'visible';
}
</script>

View File

@@ -0,0 +1,32 @@
<div class="{{ model.FLAG_OVERLAY }} {{ model.FLAG_COLLAPSED }} {{ model.FLAG_CARD }}" id="{{ model.ID_OVERLAY_ERROR }}" style="visibility: hidden;" z-index="2">
<div class="{{ model.FLAG_CONTAINER }} {{ model.FLAG_ROW }}">
<h2>Error:</h2>
<div id="{{ model.ID_LABEL_ERROR }}"></div>
</div>
<div class="{{ model.FLAG_CONTAINER }} {{ model.FLAG_ROW }}">
{% set block_id = 'button_cancel' %}
{% include 'components/common/buttons/_buttons_save_cancel.html' %}
</div>
</div>
<script>
var idOverlayError = "#{{ model.ID_OVERLAY_ERROR}}";
function hookupOverlayError() {
let overlay = document.querySelector(idOverlayError);
let selectorButtonCancel = idOverlayError + ' button.' + flagCancel;
initialiseEventHandler(selectorButtonCancel, flagInitialised, function(buttonCancel) {
buttonCancel.onclick = function() {
overlay.style.visibility = 'hidden';
};
});
}
hookupOverlayError();
function showOverlayError(msgError) {
let overlay = document.querySelector("#{{ model.ID_OVERLAY_ERROR }}");
let labelError = overlay.querySelector('#{{ model.ID_LABEL_ERROR }}');
labelError.innerText = msgError;
overlay.style.visibility = 'visible';
}
</script>

View File

@@ -0,0 +1,23 @@
<!-- Overlay -->
<!-- Requires
string overlay_id
string overlay_title
-->
<div id="{{ overlay_id }}" class="overlay">
<div class="{{ model.flag_card }}">
<div class="{{ model.flag_container }} {{ model.flag_row }}">
<div class="{{ model.flag_container }} {{ model.flag_column }}">
<h2>{{ overlay_title }}</h2>
</div>
<div class="{{ model.flag_container }} {{ model.flag_column }}">
<button class="{{ model.flag_btn_overlay_close }}">Close</button>
</div>
</div>
<div class="{{ model.flag_container }} {{ model.flag_row }}">
{% block overlay_body %}{% endblock %}
</div>
</div>
</div>