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 b3e801e1ec
commit 2d55fe6239
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>

View File

@@ -0,0 +1,37 @@
{% set block_id = 'styles' %}
{% include 'layouts/_shared_store.html' %}
<!-- Include Stylesheet -->
<link rel="stylesheet" href="{{ url_for('static', filename='css/sections/store.css') }}">
<link rel="stylesheet" href="{{ url_for('static', filename='css/store/home.css') }}">
<!-- HTML content -->
<div class="model.FLAG_ROW">
<div class="leftcolumn">
{% for cat in model.category_list.categories %}
{% if cat.is_available() %}
{% include 'components/store/_product_category.html' %}
{% endif %}
{% endfor %}
</div>
<div id="{{ model.ID_BASKET_CONTAINER}}" class="rightcolumn">
{% include 'components/store/_basket.html' %}
</div>
</div>
{% set block_id = 'scripts' %}
{% include 'layouts/_shared_store.html' %}
<!-- Include JavaScript -->
<script src="{{ url_for('routes_store.scripts_section_store') }}"></script>
<script src="{{ url_for('static', filename='js/store/home.js') }}"></script>
<script>
var hashPageCurrent = "{{ model.HASH_PAGE_STORE_HOME }}";
$(document).ready(function() {
console.log('Hooking up home page...');
hookupStorePageHome();
// hookupStore(); // in _shared_store.html
});
</script>

View File

@@ -0,0 +1,79 @@
<!-- Address form
<div class="card"> -->
<form id="{{ form.output_id() }}" class="{{ model.flag_container }}">
{{ form.hidden_tag() }}
{% if form.form_type_billing_not_delivery %}
<div class="{{ model.flag_container_input }}">
{{ form.identical.label }}
{{ form.identical(checked=True) }}
</div>
{% endif %}
<div class="{{ model.flag_container_input }}">
{{ form.region.label }}
{{ form.region() }}
{% for error in form.region.errors %}
<p class="error">{{ error }}</p>
{% endfor %}
</div>
<div class="{{ model.flag_container_input }}">
{{ form.name_full.label }}
{{ form.name_full(size=100) }}
{% for error in form.name_full.errors %}
<p class="error">{{ error }}</p>
{% endfor %}
</div>
<div class="{{ model.flag_container_input }}">
{{ form.phone_number.label }}
{{ form.phone_number(size=20) }}
{% for error in form.phone_number.errors %}
<p class="error">{{ error }}</p>
{% endfor %}
</div>
<div class="{{ model.flag_container_input }}">
{{ form.postcode.label }}
{{ form.postcode(size=10) }}
{% for error in form.postcode.errors %}
<p class="error">{{ error }}</p>
{% endfor %}
</div>
<div class="{{ model.flag_container_input }}">
{{ form.address_1.label }}
{{ form.address_1(size=254) }}
{% for error in form.address_1.errors %}
<p class="error">{{ error }}</p>
{% endfor %}
</div>
<div class="{{ model.flag_container_input }}">
{{ form.address_2.label }}
{{ form.address_2(size=254) }}
</div>
<div class="{{ model.flag_container_input }}">
{{ form.city.label }}
{{ form.city(size=100) }}
{% for error in form.city.errors %}
<p class="error">{{ error }}</p>
{% endfor %}
</div>
<div class="{{ model.flag_container_input }}">
{{ form.county.label }}
{{ form.county(size=100) }}
{% for error in form.county.errors %}
<p class="error">{{ error }}</p>
{% endfor %}
</div>
<div class="{{ model.flag_container_input }}">
{{ form.submit() }}
</div>
</form>
<!--</div>-->

View File

@@ -0,0 +1,18 @@
<!-- Basket -->
{% set show_delivery_option = False %}
<div id="{{ model.ID_BASKET }}" class="{{ model.FLAG_CARD }} {{ model.FLAG_SCROLLABLE }}">
<div class="container column">
<div class="container row">
<h2>Basket</h2>
<img class="img-icon" src="{{ url_for('static', filename='images/icon_basket.png')}}" alt="Basket icon">
</div>
{% for basket_item in model.basket.items %}
{% include 'components/store/_basket_item.html' %}
{% endfor %}
<h3 id="{{ model.ID_BASKET_TOTAL }}">Total: {{ model.output_basket_total() }}</h3>{% if not model.app.is_included_VAT %}<h4> + VAT </h4>{% endif %}
<p id="{{ model.ID_LABEL_BASKET_EMPTY }}" style="margin: 1vh;">Buy some shit dawg!</p>
<!-- <div id="{{ model.id_basket_notices }}"> include line above
</div> -->
<button id="{{ model.ID_BUTTON_CHECKOUT }}" type="submit">Checkout</button>
</div>
</div>

View File

@@ -0,0 +1,35 @@
<!-- Basket Item -->
<!-- requires:
Basket_Item basket_item
bool show_delivery_option
-->
<div class="container row">
{% set product = basket_item.product %}
{% set permutation = product.get_permutation_selected() %}
<div class="container">
<img class="img-thumbnail" src="{{ product.get_image_from_index(0).url }}" alt="Basket icon"> <!-- model.get_many_product_image_src(product.id_product, '', True, 'THUMBNAIL') -->
</div>
{% set form = product.form_basket_edit %}
<!-- <form {{ model.attr_form_type }}="{{ form.form_type }}" {{ model.attr_id_product }}="{{ product.id }}" class="container column" action="{{ url_for('basket_add') }}" method="POST"> -->
<form {{ model.attr_form_type }}="{{ form.form_type }}" class="{{ model.flag_container }} {{ model.flag_column }}" {{ model.attr_id_product }}="{{ product.id_product}}" {{ model.attr_id_permutation }}="{{ permutation.id_permutation }}"> <!-- id="form_basket_item_id_{{ basket_item.product.id }}" -->
{{ form.hidden_tag() }}
<h2>{{ product.name }}</h2>
{% if permutation.is_available %}
<h3 style="white-space: nowrap;">{{ basket_item.quantity }} x {{ product.output_price(model.app.is_included_VAT) }} = {{ basket_item.output_subtotal() }}</h3>
{% set tmp_quantity = basket_item.quantity %}
{% include 'components/common/inputs/_input_number_plus_minus.html' %}
{% elif permutation.is_unavailable_in_currency_or_region %}
<h3 style="white-space: nowrap;">Product not available in currency and region</h3>
{% else %}
<h3 style="white-space: nowrap;">Product not available</h3>
{% endif %}
<a class="{{ model.FLAG_DELETE }}">Delete</a>
{% if show_delivery_option %}
<div class="{{ model.flag_container_input }}">
{{ product.form_delivery_option.label }}
{{ product.form_delivery_option() }}
</div>
{% endif %}
<script>console.log('creating basket item for:');console.log('product id: {{ product.id_product }}');console.log('permutation id: {{ product.get_id_permutation() }}');console.log('quantity: {{ basket_item.quantity }}');</script>
</form>
</div>

View File

@@ -0,0 +1,70 @@
{% if is_blank_row %}
<tr class="{{ model.FLAG_ROW_NEW }}" {{ model.ATTR_ID_PERMUTATION }}>
<td class="{{ model.FLAG_PRODUCT_CATEGORY }}">
<select class="{{ model.FLAG_PRODUCT_CATEGORY}}" {{ model.ATTR_VALUE_CURRENT }} {{ model.ATTR_VALUE_PREVIOUS }}>
{% for cat in model.category_list.categories %}
<option value="{{ cat.id_category }}">{{ cat.name }}</option>
{% endfor %}
</select>
</td>
<td class="{{ model.FLAG_PRODUCT }}">
<select class="{{ model.FLAG_PRODUCT }}" {{ model.ATTR_VALUE_CURRENT }} {{ model.ATTR_VALUE_PREVIOUS }}></select>
</td>
<td class="{{ model.FLAG_VARIATIONS }}">
<textarea class="{{ model.FLAG_VARIATIONS }}" {{ model.ATTR_VALUE_CURRENT }} {{ model.ATTR_VALUE_PREVIOUS }}></textarea>
</td>
<td class="{{ model.FLAG_QUANTITY_STOCK }}">
<input class="{{ model.FLAG_QUANTITY_STOCK }}" type="number" min="0" value="0" {{ model.ATTR_VALUE_CURRENT }}="0" {{ model.ATTR_VALUE_PREVIOUS }}>
</td>
<td class="{{ model.FLAG_QUANTITY_MIN }}">
<input class="{{ model.FLAG_QUANTITY_MIN }}" type="number" min="0" value="0" {{ model.ATTR_VALUE_CURRENT }}="0" {{ model.ATTR_VALUE_PREVIOUS }}>
</td>
<td class="{{ model.FLAG_QUANTITY_MAX }}">
<input class="{{ model.FLAG_QUANTITY_MAX }}" type="number" min="0" value="0" {{ model.ATTR_VALUE_CURRENT }}="0" {{ model.ATTR_VALUE_PREVIOUS }}>
</td>
<td class="{{ model.FLAG_COST_LOCAL_VAT_INCL }}">
</td>
<!-- <td><strong>{ { permutation.output_currency() }}</strong>{ { permutation.get_price_local() }}</td> -->
<td class="{{ model.FLAG_DETAIL }}">
<a>Detail</a>
</td>
</tr>
{% else %}
<tr {{ model.ATTR_ID_PERMUTATION }}="{{ permutation.id_permutation }}">
<td class="{{ model.FLAG_PRODUCT_CATEGORY }}">
<select class="{{ model.FLAG_PRODUCT_CATEGORY }}" {{ model.ATTR_VALUE_CURRENT }}="{{ category.id_category }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ category.id_category }}"> <!-- {{ model.ATTR_ID_CATEGORY }}="{{ category.id_category }}" -->
{% for c in model.category_list.categories %}
<option value="{{ c.id_category }}" {% if c.id_category == category.id_category %}{% endif %}>{{ c.name }}</option>
{% endfor %}
</select>
</td>
<td class="{{ model.FLAG_PRODUCT }}">
<select class="{{ model.FLAG_PRODUCT }}" {{ model.ATTR_VALUE_CURRENT }}="{{ product.id_product }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ product.id_product }}"> <!-- {{ model.ATTR_ID_PRODUCT }}="{{ product.id_product }} -->
{% for p in model.category_list.categories[model.category_list.get_index_category_from_id(category.id_category)].products %}
<option value="{{ p.id_product }}" {% if p.id_product == product.id_product %}{% endif %}>{{ p.name }}</option>
{% endfor %}
</select>
</td>
<td class="{{ model.FLAG_VARIATIONS }}">
{% set block_id = 'Textarea_Product_Permutation_Variations' %}
{% include 'layouts/_shared_store.html' %}
</td>
<td class="{{ model.FLAG_QUANTITY_STOCK }}">
<input class="{{ model.FLAG_QUANTITY_STOCK }}" type="number" min="0" value="{{ permutation.quantity_stock }}" {{ model.ATTR_VALUE_CURRENT }}="{{ permutation.quantity_stock }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ permutation.quantity_stock }}">
</td>
<td class="{{ model.FLAG_QUANTITY_MIN }}">
<input class="{{ model.FLAG_QUANTITY_MIN }}" type="number" min="0" value="{{ permutation.quantity_min }}" {{ model.ATTR_VALUE_CURRENT }}="{{ permutation.quantity_min }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ permutation.quantity_min }}">
</td>
<td class="{{ model.FLAG_QUANTITY_MAX }}">
<input class="{{ model.FLAG_QUANTITY_MAX }}" type="number" min="0" value="{{ permutation.quantity_max }}" {{ model.ATTR_VALUE_CURRENT }}="{{ permutation.quantity_max }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ permutation.quantity_max }}">
</td>
<td class="{{ model.FLAG_COST_LOCAL_VAT_INCL }}">
<strong>{{ permutation.output_currency() }}</strong>{{ permutation.cost_local }}
</td>
<!-- <td><strong>{{ permutation.output_currency() }}</strong>{ { permutation.get_price_local() }}</td> -->
<td class="{{ model.FLAG_DETAIL }}">
<a>Detail</a>
</td>
</tr>
{% endif %}

View File

@@ -0,0 +1,45 @@
{% if is_blank_row %}
<tr class="{{ model.FLAG_ROW_NEW }}" {{ model.ATTR_ID_CATEGORY }}>
<td class="{{ model.FLAG_DISPLAY_ORDER }}">
{% include 'components/common/buttons/_slider_display_order.html' %}
</td>
<td class="{{ model.FLAG_PRODUCT_CATEGORY }}">
<textarea class="{{ model.FLAG_PRODUCT_CATEGORY }}" {{ model.ATTR_ID_CATEGORY }} {{ model.ATTR_VALUE_CURRENT }} {{ model.ATTR_VALUE_PREVIOUS }}></textarea>
</td>
<td class="{{ model.FLAG_NAME }}">
<textarea class="{{ model.FLAG_NAME }}" {{ model.ATTR_VALUE_CURRENT }} {{ model.ATTR_VALUE_PREVIOUS }}></textarea>
</td>
<td class="{{ model.FLAG_VARIATIONS }}">
<textarea class="{{ model.FLAG_VARIATIONS }}" {{ model.ATTR_VALUE_CURRENT }} {{ model.ATTR_VALUE_PREVIOUS }}></textarea>
</td>
<td class="{{ model.FLAG_ACCESS_LEVEL }}" {{ model.ATTR_ID_ACCESS_LEVEL }}="1" {{ model.FLAG_ACCESS_LEVEL_REQUIRED }}="View">
<div class="{{ model.FLAG_ACCESS_LEVEL}}" {{ model.ATTR_ID_ACCESS_LEVEL }}="1">View</div>
</td>
<td class="{{ model.FLAG_ACTIVE }}">
<input class="{{ model.FLAG_ACTIVE }}" type="checkbox" checked {{ model.ATTR_VALUE_CURRENT }}="true" {{ model.ATTR_VALUE_PREVIOUS }}="true">
</td>
</tr>
{% else %}
<tr {{ model.ATTR_ID_PRODUCT }}="{{ product.id_product }}">
<td class="{{ model.FLAG_DISPLAY_ORDER }}">
{% set display_order = category.display_order %}
{% include 'components/common/buttons/_slider_display_order.html' %}
</td>
<td class="{{ model.FLAG_CODE }}">
<textarea class="{{ model.FLAG_CODE }}" {{ model.ATTR_VALUE_CURRENT }}="{{ product.code }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ product.code }}">{{ product.code }}</textarea>
</td>
<td class="{{ model.FLAG_NAME }}">
<textarea class="{{ model.FLAG_NAME }}" {{ model.ATTR_VALUE_CURRENT }}="{{ product.name }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ product.name }}">{{ product.name }}</textarea>
</td>
<td class="{{ model.FLAG_VARIATIONS }}">
{% include 'components/common/inputs/_textarea_product_variation_types.html' %}
<textarea class="{{ model.FLAG_VARIATIONS }}" {{ model.ATTR_VALUE_CURRENT }}="{{ product.description }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ product.description }}">{{ product.description }}</textarea>
</td>
<td class="{{ model.FLAG_ACCESS_LEVEL }}" {{ model.ATTR_ID_ACCESS_LEVEL }}="1" {{ model.FLAG_ACCESS_LEVEL_REQUIRED }}="{{ product.name_access_level_required }}">
<div class="{{ model.FLAG_ACCESS_LEVEL}}" {{ model.ATTR_ID_ACCESS_LEVEL }}="{{ product.id_access_level_required }}" {{ model.ATTR_VALUE_CURRENT }}="{{ product.id_access_level_required }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ product.id_access_level_required }}">{{ product.name_access_level_required }}</div>
</td>
<td class="{{ model.FLAG_ACTIVE }}">
<input class="{{ model.FLAG_ACTIVE }}" type="checkbox" {% if product.active %}checked{% endif %} {{ model.ATTR_VALUE_CURRENT }}="{{ product.active | lower }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ product.active | lower }}">
</td>
</tr>
{% endif %}

View File

@@ -0,0 +1,44 @@
{% if is_blank_row %}
<tr class="{{ model.FLAG_ROW_NEW }}" {{ model.ATTR_ID_CATEGORY }}>
<td class="{{ model.FLAG_DISPLAY_ORDER }}">
{% include 'components/common/buttons/_slider_display_order.html' %}
</td>
<td class="{{ model.FLAG_CODE }}">
<textarea class="{{ model.FLAG_CODE }}" {{ model.ATTR_VALUE_CURRENT }} {{ model.ATTR_VALUE_PREVIOUS }}></textarea>
</td>
<td class="{{ model.FLAG_NAME }}">
<textarea class="{{ model.FLAG_NAME }}" {{ model.ATTR_VALUE_CURRENT }} {{ model.ATTR_VALUE_PREVIOUS }}></textarea>
</td>
<td class="{{ model.FLAG_DESCRIPTION }}">
<textarea class="{{ model.FLAG_DESCRIPTION }}" {{ model.ATTR_VALUE_CURRENT }} {{ model.ATTR_VALUE_PREVIOUS }}></textarea>
</td>
<td class="{{ model.FLAG_ACCESS_LEVEL }}" {{ model.ATTR_ID_ACCESS_LEVEL }}="1" {{ model.FLAG_ACCESS_LEVEL_REQUIRED }}="View">
<div class="{{ model.FLAG_ACCESS_LEVEL}}" {{ model.ATTR_ID_ACCESS_LEVEL }}="1">View</div>
</td>
<td class="{{ model.FLAG_ACTIVE }}">
<input class="{{ model.FLAG_ACTIVE }}" type="checkbox" checked {{ model.ATTR_VALUE_CURRENT }}="true" {{ model.ATTR_VALUE_PREVIOUS }}="true">
</td>
</tr>
{% else %}
<tr {{ model.ATTR_ID_PRODUCT_CATEGORY }}="{{ category.id_category }}">
<td class="{{ model.FLAG_DISPLAY_ORDER }}">
{% set display_order = category.display_order %}
{% include 'components/common/buttons/_slider_display_order.html' %}
</td>
<td class="{{ model.FLAG_CODE }}">
<textarea class="{{ model.FLAG_CODE }}" {{ model.ATTR_VALUE_CURRENT }}="{{ category.code }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ category.code }}">{{ category.code }}</textarea>
</td>
<td class="{{ model.FLAG_NAME }}">
<textarea class="{{ model.FLAG_NAME }}" {{ model.ATTR_VALUE_CURRENT }}="{{ category.name }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ category.name }}">{{ category.name }}</textarea>
</td>
<td class="{{ model.FLAG_DESCRIPTION }}">
<textarea class="{{ model.FLAG_DESCRIPTION }}" {{ model.ATTR_VALUE_CURRENT }}="{{ category.description }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ category.description }}">{{ category.description }}</textarea>
</td>
<td class="{{ model.FLAG_ACCESS_LEVEL }}" {{ model.ATTR_ID_ACCESS_LEVEL }}="1" {{ model.FLAG_ACCESS_LEVEL_REQUIRED }}="{{ category.name_access_level_required }}">
<div class="{{ model.FLAG_ACCESS_LEVEL}}" {{ model.ATTR_ID_ACCESS_LEVEL }}="{{ category.id_access_level_required }}" {{ model.ATTR_VALUE_CURRENT }}="{{ category.id_access_level_required }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ category.id_access_level_required }}">{{ category.name_access_level_required }}</div>
</td>
<td class="{{ model.FLAG_ACTIVE }}">
<input class="{{ model.FLAG_ACTIVE }}" type="checkbox" {% if category.active %}checked{% endif %} {{ model.ATTR_VALUE_CURRENT }}="{{ category.active | lower }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ category.active | lower }}">
</td>
</tr>
{% endif %}

View File

@@ -0,0 +1,109 @@
{% if is_blank_row %}
<tr class="{{ model.FLAG_ROW_NEW }}" {{ model.ATTR_ID_STOCK_ITEM }}>
<td class="{{ model.FLAG_PRODUCT_CATEGORY }}">
<select class="{{ model.FLAG_PRODUCT_CATEGORY}}" {{ model.ATTR_VALUE_CURRENT }} {{ model.ATTR_VALUE_PREVIOUS }}>
{% for cat in model.category_list.categories %}
<option value="{{ cat.id_category }}">{{ cat.name }}</option>
{% endfor %}
</select>
</td>
<td class="{{ model.FLAG_PRODUCT }}">
<select class="{{ model.FLAG_PRODUCT }}" {{ model.ATTR_VALUE_CURRENT }} {{ model.ATTR_VALUE_PREVIOUS }}></select>
</td>
<td class="{{ model.FLAG_VARIATIONS }}">
<textarea class="{{ model.FLAG_VARIATIONS }}" {{ model.ATTR_VALUE_CURRENT }} {{ model.ATTR_VALUE_PREVIOUS }}></textarea>
</td>
<td class="{{ model.FLAG_COST_LOCAL_VAT_INCL }}">
<input class="{{ model.FLAG_COST_LOCAL_VAT_INCL }}" type="number" min="0" value="0" {{ model.ATTR_VALUE_CURRENT }}="0" {{ model.ATTR_VALUE_PREVIOUS }}>
</td>
<td class="{{ model.FLAG_DATE_PURCHASED }}">
<input class="{{ model.FLAG_DATE_PURCHASED }}" type="date" {{ model.ATTR_VALUE_CURRENT }} {{ model.ATTR_VALUE_PREVIOUS }} />
</td>
<td class="{{ model.FLAG_DATE_RECEIVED }}">
<input type="date" class="{{ model.FLAG_DATE_RECEIVED }}" {{ model.ATTR_VALUE_CURRENT }} {{ model.ATTR_VALUE_PREVIOUS }} />
</td>
<!--
<td class="{{ model.FLAG_IS_SEALED }}">
<input type="checkbox" class="{{ model.FLAG_IS_SEALED }}" "checked" {{ model.ATTR_VALUE_CURRENT }}="{{ model.FLAG_BOOL_TRUE }}" {{ model.ATTR_VALUE_PREVIOUS }} />
</td>
-->
<td class="{{ model.FLAG_DATE_UNSEALED }}">
<input type="date" class="{{ model.FLAG_DATE_UNSEALED }}" {{ model.ATTR_VALUE_CURRENT }} {{ model.ATTR_VALUE_PREVIOUS }} />
</td>
<td class="{{ model.FLAG_DATE_EXPIRATION }}">
<input type="date" class="{{ model.FLAG_DATE_EXPIRATION }}" {{ model.ATTR_VALUE_CURRENT }} {{ model.ATTR_VALUE_PREVIOUS }} />
</td>
<!--
<td class="{{ model.FLAG_IS_CONSUMED }}">
<input type="checkbox" class="{{ model.FLAG_IS_CONSUMED }}" {{ model.ATTR_VALUE_CURRENT }}="{{ model.FLAG_BOOL_FALSE }}" {{ model.ATTR_VALUE_PREVIOUS }} />
</td>
-->
<td class="{{ model.FLAG_DATE_CONSUMED }}">
<input type="date" class="{{ model.FLAG_DATE_CONSUMED }}" {{ model.ATTR_VALUE_CURRENT }} {{ model.ATTR_VALUE_PREVIOUS }} />
</td>
<td class="{{ model.FLAG_ACTIVE }}">
<input type="checkbox" class="{{ model.FLAG_ACTIVE }}" "checked" {{ model.ATTR_VALUE_CURRENT }}="{{ model.FLAG_BOOL_TRUE }}" {{ model.ATTR_VALUE_PREVIOUS }} />
</td>
</tr>
{% else %}
<tr {{ model.ATTR_ID_STOCK_ITEM }}="{{ stock_item.id_stock_item }}">
<td class="{{ model.FLAG_PRODUCT_CATEGORY }}">
<select class="{{ model.FLAG_PRODUCT_CATEGORY }}" {{ model.ATTR_VALUE_CURRENT }}="{{ category.id_category }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ category.id_category }}"> <!-- {{ model.ATTR_ID_CATEGORY }}="{{ category.id_category }}" -->
{% for c in model.category_list.categories %}
<option value="{{ c.id_category }}" {% if c.id_category == category.id_category %}selected{% endif %}>{{ c.name }}</option>
{% endfor %}
</select>
</td>
<td class="{{ model.FLAG_PRODUCT }}">
<select class="{{ model.FLAG_PRODUCT }}" {{ model.ATTR_VALUE_CURRENT }}="{{ product.id_product }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ product.id_product }}"> <!-- {{ model.ATTR_ID_PRODUCT }}="{{ product.id_product }} -->
{% for p in model.category_list.categories[model.category_list.get_index_category_from_id(category.id_category)].products %}
<option value="{{ p.id_product }}" {% if p.id_product == product.id_product %}selected{% endif %}>{{ p.name }}</option>
{% endfor %}
</select>
</td>
<td class="{{ model.FLAG_VARIATIONS }}">
{% set block_id = 'Textarea_Product_Permutation_Variations' %}
{% include 'layouts/_shared_store.html' %}
</td>
<td class="{{ model.FLAG_CURRENCY }}">
{{ permutation.output_currency() }}
<select class="{{ model.FLAG_CURRENCY }}" {{ model.ATTR_VALUE_CURRENT }}="{{ permutation.id_currency }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ permutation.id_currency }}">
{% for currency in model.currency_list.currencies %}
<option value="{{ currency.id_currency }}" {% if currency.id_currency == permutation.id_currency %}selected{% endif %}>{{ currency.name }}</option>
{% endfor %}
</select>
</td>
<td class="{{ model.FLAG_COST_LOCAL_VAT_INCL }}">
<input type="number" step="0.001" value="{{ stock_item.cost_local_VAT_incl }}" {{ model.ATTR_VALUE_CURRENT }}="{{ stock_item.cost_local_VAT_incl }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ stock_item.cost_local_VAT_incl }}" >
</td>
<td class="{{ model.FLAG_DATE_PURCHASED }}">
<input type="date" value="{{ stock_item.date_purchased }}" {{ model.ATTR_VALUE_CURRENT }}="{{ stock_item.date_purchased }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ stock_item.date_purchased }}" />
</td>
<td class="{{ model.FLAG_DATE_RECEIVED }}">
<input type="date" value="{{ stock_item.date_received }}" {{ model.ATTR_VALUE_CURRENT }}="{{ stock_item.date_received }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ stock_item.date_received }}" />
</td>
<!--
<td class="{{ model.FLAG_IS_SEALED }}">
<input type="checkbox" {{ "checked" if stock_item.is_sealed else "" }} {{ model.ATTR_VALUE_CURRENT }}="{{ stock_item.is_sealed }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ stock_item.is_sealed }}" />
</td>
-->
<td class="{{ model.FLAG_DATE_UNSEALED }}">
<input type="date" value="{{ stock_item.date_unsealed }}" {{ model.ATTR_VALUE_CURRENT }}="{{ stock_item.date_unsealed }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ stock_item.date_unsealed }}" />
</td>
<td class="{{ model.FLAG_DATE_EXPIRATION }}">
<input type="date" value="{{ stock_item.date_expiration }}" {{ model.ATTR_VALUE_CURRENT }}="{{ stock_item.date_expiration }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ stock_item.date_expiration }}" />
</td>
<!--
<td class="{{ model.FLAG_IS_CONSUMED }}">
<input type="checkbox" {{ "checked" if stock_item.is_consumed else "" }} {{ model.ATTR_VALUE_CURRENT }}="{{ stock_item.is_consumed }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ stock_item.is_consumed }}" />
</td>
-->
<td class="{{ model.FLAG_DATE_CONSUMED }}">
<input type="date" value="{{ stock_item.date_consumed }}" {{ model.ATTR_VALUE_CURRENT }}="{{ stock_item.date_consumed }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ stock_item.date_consumed }}" />
</td>
<td class="{{ model.FLAG_ACTIVE }}">
<input type="checkbox" {{ "checked" if stock_item.active else "" }} {{ model.ATTR_VALUE_CURRENT }}="{{ stock_item.active }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ stock_item.active }}" />
</td>
</tr>
{% endif %}