1. View, filter, and save Product Permutation. \n 2. Synchronised with Product Category page and all common functionality moved into base and base table css, js, and python files.

This commit is contained in:
2024-09-24 23:25:52 +01:00
parent 2954b2050c
commit 45ac0405b4
243 changed files with 6596 additions and 4460 deletions

View File

@@ -11,4 +11,38 @@
{% 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' %}
{% elif block_id == 'buttons_table_default' %}
<div class="{{ model.FLAG_CONTAINER }} {{ model.FLAG_COLUMN }}">
<div class="{{ model.FLAG_ROW }}">
<div class="{{ model.FLAG_CONTAINER_INPUT }} {{ model.FLAG_COLUMN }}">
{% set block_id = 'button_apply_filters' %}
{% include 'components/common/buttons/_buttons_save_cancel.html' %}
</div>
<div class="{{ model.FLAG_CONTAINER_INPUT }} {{ model.FLAG_COLUMN }}">
{% set block_id = 'button_add' %}
{% include 'components/common/buttons/_buttons_save_cancel.html' %}
</div>
<div class="{{ model.FLAG_COLUMN }}">
<div class="{{ model.FLAG_CONTAINER_INPUT }}">
{% set block_id = 'button_save' %}
{% include 'components/common/buttons/_buttons_save_cancel.html' %}
</div>
<div class="{{ model.FLAG_CONTAINER_INPUT }}">
{% set block_id = 'button_cancel' %}
{% include 'components/common/buttons/_buttons_save_cancel.html' %}
</div>
</div>
</div>
</div>
{% elif block_id == 'container_buttons_save_cancel' %}
<div class="{{ model.FLAG_CONTAINER }} {{ model.FLAG_COLUMN }}">
<div class="{{ model.FLAG_CONTAINER_INPUT }}">
{% set block_id = 'button_save' %}
{% include 'components/common/buttons/_buttons_save_cancel.html' %}
</div>
<div class="{{ model.FLAG_CONTAINER_INPUT }}">
{% set block_id = 'button_cancel' %}
{% include 'components/common/buttons/_buttons_save_cancel.html' %}
</div>
</div>
{% endif %}

View File

@@ -1,8 +1,13 @@
{% if display_order is defined %}
<!-- Fix this
{# 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 }}">
#}
<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>
<input type="number" class="{{ model.FLAG_SLIDER }} {{ model.FLAG_DISPLAY_ORDER }}"
{{ model.ATTR_VALUE_CURRENT }} {{ model.ATTR_VALUE_PREVIOUS }}>
{#
<div class="{{ model.FLAG_SLIDER }} {{ model.FLAG_DISPLAY_ORDER }}" {{ model.ATTR_VALUE_CURRENT }} {{ model.ATTR_VALUE_PREVIOUS }}></div>
#}
{% endif %}

View File

@@ -0,0 +1 @@
<option value="0">Select</option>

View File

@@ -1,18 +0,0 @@
{% 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

@@ -1,20 +0,0 @@
{% 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

@@ -12,41 +12,3 @@
{% include 'components/common/buttons/_buttons_save_cancel.html' %}
</div>
</div>
<script type="module">
import Events from "{{ url_for('static', filename='js/lib/events.js') }}";
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;
Events.initialiseEventHandler(selectorButtonCancel, flagInitialised, function(buttonCancel) {
buttonCancel.addEventListener('click', function() {
let overlay = document.querySelector(idOverlayConfirm);
overlay.style.visibility = 'hidden';
});
});
Events.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

@@ -8,27 +8,3 @@
{% include 'components/common/buttons/_buttons_save_cancel.html' %}
</div>
</div>
<script type="module">
import Events from "{{ url_for('static', filename='js/lib/events.js') }}";
var idOverlayError = "#{{ model.ID_OVERLAY_ERROR}}";
function hookupOverlayError() {
let overlay = document.querySelector(idOverlayError);
let selectorButtonCancel = idOverlayError + ' button.' + flagCancel;
Events.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>