feat(JavaScript): Updated architecture for TableBasePage object with static row ID attribute attached for adding ID against each row added to DOM

This commit is contained in:
2024-10-18 22:25:07 +01:00
parent 8fcfcf0ef4
commit 002551c0a9
112 changed files with 7280 additions and 3608 deletions

View File

@@ -1,6 +1,6 @@
{% with _is_blank_row = (is_blank_row or model.currencies | length == 0 or currency is none) %}
{% 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 %}
<div
class="{{ model.FLAG_CURRENCY }}"

View File

@@ -0,0 +1,13 @@
{% 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() %}
<div
class="{{ model.FLAG_ADDRESS }}"
{{ model.ATTR_VALUE_CURRENT }}="{{ json_str }}"
{{ model.ATTR_VALUE_PREVIOUS }}="{{ json_str }}"
>{{ address.postcode }}</div>
{% else %}
<div class="{{ model.FLAG_ADDRESS }}" {{ model.ATTR_VALUE_CURRENT }} {{ model.ATTR_VALUE_PREVIOUS }}></div>
{% endif %}
{% endwith %}

View File

@@ -0,0 +1,13 @@
{% 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 = order_items.to_preview_str() %}
<div
class="{{ model.FLAG_ITEMS }}"
{{ model.ATTR_VALUE_CURRENT }}="{{ json_str_items }}"
{{ model.ATTR_VALUE_PREVIOUS }}="{{ json_str_items }}"
>{{ str_items }}</div>
{% else %}
<div class="{{ model.FLAG_ITEMS }}" {{ model.ATTR_VALUE_CURRENT }} {{ model.ATTR_VALUE_PREVIOUS }}></div>
{% endif %}
{% endwith %}

View File

@@ -0,0 +1,13 @@
{% 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 = order_items.to_preview_str() %}
<div
class="{{ model.FLAG_ITEMS }}"
{{ model.ATTR_VALUE_CURRENT }}="{{ json_str_items }}"
{{ model.ATTR_VALUE_PREVIOUS }}="{{ json_str_items }}"
>{{ str_items }}</div>
{% else %}
<div class="{{ model.FLAG_ITEMS }}" {{ model.ATTR_VALUE_CURRENT }} {{ model.ATTR_VALUE_PREVIOUS }}></div>
{% endif %}
{% endwith %}

View File

@@ -1,13 +1,5 @@
{#
{% 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 %}
#}
{% 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 or is_blank_row) %}
{% 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() %}

View File

@@ -0,0 +1,72 @@
{% if is_blank_row %}
<tr class="{{ model.FLAG_ROW_NEW }}" {{ model.ATTR_ID_MANUFACTURING_PURCHASE_ORDER }}>
<td class="{{ model.FLAG_CURRENCY }}" {{ model.ATTR_VALUE_CURRENT }}="" {{ model.ATTR_VALUE_PREVIOUS }}="">
{% include 'components/store/_preview_DDL_currency.html' %}
</td>
<td class="{{ model.FLAG_COST_TOTAL_LOCAL_VAT_EXCL }}">
<input type="number" min="0" step="0.001" class="{{ model.FLAG_COST_TOTAL_LOCAL_VAT_EXCL }}" {{ model.ATTR_VALUE_CURRENT }}="" {{ model.ATTR_VALUE_PREVIOUS }}=""/>
</td>
<td class="{{ model.FLAG_COST_TOTAL_LOCAL_VAT_INCL }}">
<input type="number" min="0" step="0.001" class="{{ model.FLAG_COST_TOTAL_LOCAL_VAT_INCL }}" {{ model.ATTR_VALUE_CURRENT }}="" {{ model.ATTR_VALUE_PREVIOUS }}=""/>
</td>
<td class="{{ model.FLAG_PRICE_TOTAL_LOCAL_VAT_EXCL }}">
<input type="number" min="0" step="0.001" class="{{ model.FLAG_PRICE_TOTAL_LOCAL_VAT_EXCL }}" {{ model.ATTR_VALUE_CURRENT }}="" {{ model.ATTR_VALUE_PREVIOUS }}=""/>
</td>
<td class="{{ model.FLAG_PRICE_TOTAL_LOCAL_VAT_INCL }}">
<input type="number" min="0" step="0.001" class="{{ model.FLAG_PRICE_TOTAL_LOCAL_VAT_INCL }}" {{ model.ATTR_VALUE_CURRENT }}="" {{ model.ATTR_VALUE_PREVIOUS }}=""/>
</td>
<td class="{{ model.FLAG_ITEMS }}" {{ model.ATTR_VALUE_CURRENT }}="" {{ model.ATTR_VALUE_PREVIOUS }}="">
{% include 'components/store/_preview_order_items.html' %}
</td>
<td class="{{ model.FLAG_ACTIVE }}">
<input class="{{ model.FLAG_ACTIVE }}" type="checkbox" checked {{ model.ATTR_VALUE_CURRENT }}="{{ model.FLAG_BOOL_TRUE }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ model.FLAG_BOOL_TRUE }}">
</td>
</tr>
{% else %}
<tr {{ model.ATTR_ID_MANUFACTURING_PURCHASE_ORDER }}="{{ order.id_order }}">
{% set currency = order.currency %}
<td class="{{ model.FLAG_CURRENCY }}" {{ model.ATTR_VALUE_CURRENT }}="{{ currency.id_currency }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ currency.id_currency }}">
{% include 'components/store/_preview_DDL_currency.html' %}
</td>
<td class="{{ model.FLAG_COST_TOTAL_LOCAL_VAT_EXCL }}">
<input type="number" min="0" step="0.001"
class="{{ model.FLAG_COST_TOTAL_LOCAL_VAT_EXCL }}"
{{ model.ATTR_VALUE_CURRENT }}="{{ order.cost_total_local_VAT_excl }}"
{{ model.ATTR_VALUE_PREVIOUS }}="{{ order.cost_total_local_VAT_excl }}"
/>
</td>
<td class="{{ model.FLAG_COST_TOTAL_LOCAL_VAT_INCL }}">
<input type="number" min="0" step="0.001"
class="{{ model.FLAG_COST_TOTAL_LOCAL_VAT_INCL }}"
{{ model.ATTR_VALUE_CURRENT }}="{{ order.cost_total_local_VAT_incl }}"
{{ model.ATTR_VALUE_PREVIOUS }}="{{ order.cost_total_local_VAT_incl }}"
/>
</td>
<td class="{{ model.FLAG_PRICE_TOTAL_LOCAL_VAT_EXCL }}">
<input type="number" min="0" step="0.001"
class="{{ model.FLAG_PRICE_TOTAL_LOCAL_VAT_EXCL }}"
{{ model.ATTR_VALUE_CURRENT }}="{{ order.price_total_local_VAT_excl }}"
{{ model.ATTR_VALUE_PREVIOUS }}="{{ order.price_total_local_VAT_excl }}"
/>
</td>
<td class="{{ model.FLAG_PRICE_TOTAL_LOCAL_VAT_INCL }}">
<input type="number" min="0" step="0.001"
class="{{ model.FLAG_PRICE_TOTAL_LOCAL_VAT_INCL }}"
{{ model.ATTR_VALUE_CURRENT }}="{{ order.price_total_local_VAT_incl }}"
{{ model.ATTR_VALUE_PREVIOUS }}="{{ order.price_total_local_VAT_incl }}"
/>
</td>
{% set order_items = order.order_items %}
{% set json_str_items = jsonify(order_items.to_json_list()) %}
<td class="{{ model.FLAG_ITEMS }}" {{ model.ATTR_VALUE_CURRENT }}="{{ json_str_items }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ json_str_items }}">
{#
{% include 'components/store/_preview_manufacturing_purchase_order_items.html' %}
#}
{% include 'components/store/_preview_order_items.html' %}
</td>
<td class="{{ model.FLAG_ACTIVE }}">
<input class="{{ model.FLAG_ACTIVE }}" type="checkbox" {% if order.active %}checked{% endif %} {{ model.ATTR_VALUE_CURRENT }}="{{ order.active | lower }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ order.active | lower }}">
</td>
</tr>
{% endif %}

View File

@@ -15,11 +15,11 @@
<td class="{{ model.FLAG_CURRENCY_COST }}">
{% include 'components/store/_preview_DDL_currency.html' %}
</td>
<td class="{{ model.FLAG_COST_LOCAL_VAT_EXCL }}">
<input class="{{ model.FLAG_COST_LOCAL_VAT_EXCL }}" type="number" min="0" value="" {{ model.ATTR_VALUE_CURRENT }}="" {{ model.ATTR_VALUE_PREVIOUS }}>
<td class="{{ model.FLAG_COST_UNIT_LOCAL_VAT_EXCL }}">
<input class="{{ model.FLAG_COST_UNIT_LOCAL_VAT_EXCL }}" type="number" min="0" value="" {{ model.ATTR_VALUE_CURRENT }}="" {{ model.ATTR_VALUE_PREVIOUS }}>
</td>
<td class="{{ model.FLAG_COST_LOCAL_VAT_INCL }}">
<input class="{{ model.FLAG_COST_LOCAL_VAT_INCL }}" type="number" min="0" value="" {{ model.ATTR_VALUE_CURRENT }}="" {{ model.ATTR_VALUE_PREVIOUS }}>
<td class="{{ model.FLAG_COST_UNIT_LOCAL_VAT_INCL }}">
<input class="{{ model.FLAG_COST_UNIT_LOCAL_VAT_INCL }}" type="number" min="0" value="" {{ model.ATTR_VALUE_CURRENT }}="" {{ model.ATTR_VALUE_PREVIOUS }}>
</td>
<td class="{{ model.FLAG_DATE_PURCHASED }}">
<input class="{{ model.FLAG_DATE_PURCHASED }}" type="datetime-local" {{ model.ATTR_VALUE_CURRENT }} {{ model.ATTR_VALUE_PREVIOUS }} />
@@ -82,15 +82,15 @@
>
{% include 'components/store/_preview_DDL_currency.html' %}
</td>
<td class="{{ model.FLAG_COST_LOCAL_VAT_EXCL }}">
<input class="{{ model.FLAG_COST_LOCAL_VAT_EXCL }}" type="number" step="0.001"
<td class="{{ model.FLAG_COST_UNIT_LOCAL_VAT_EXCL }}">
<input class="{{ model.FLAG_COST_UNIT_LOCAL_VAT_EXCL }}" type="number" step="0.001"
value="{{ stock_item.cost_local_VAT_excl }}"
{{ model.ATTR_VALUE_CURRENT }}="{{ stock_item.cost_local_VAT_excl }}"
{{ model.ATTR_VALUE_PREVIOUS }}="{{ stock_item.cost_local_VAT_excl }}"
>
</td>
<td class="{{ model.FLAG_COST_LOCAL_VAT_INCL }}">
<input class="{{ model.FLAG_COST_LOCAL_VAT_INCL }}" type="number" step="0.001"
<td class="{{ model.FLAG_COST_UNIT_LOCAL_VAT_INCL }}">
<input class="{{ model.FLAG_COST_UNIT_LOCAL_VAT_INCL }}" 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 }}"

View File

@@ -0,0 +1,69 @@
{% if is_blank_row %}
<tr class="{{ model.FLAG_ROW_NEW }}" {{ model.ATTR_ID_SUPPLIER }}>
<td class="{{ model.FLAG_NAME_COMPANY }}">
<textarea class="{{ model.FLAG_NAME_COMPANY }}" {{ model.ATTR_VALUE_CURRENT }} {{ model.ATTR_VALUE_PREVIOUS }}></textarea>
</td>
<td class="{{ model.FLAG_NAME_CONTACT }}">
<textarea class="{{ model.FLAG_NAME_CONTACT }}" {{ model.ATTR_VALUE_CURRENT }} {{ model.ATTR_VALUE_PREVIOUS }}></textarea>
</td>
<td class="{{ model.FLAG_DEPARTMENT_CONTACT }}">
<textarea class="{{ model.FLAG_DEPARTMENT_CONTACT }}" {{ model.ATTR_VALUE_CURRENT }} {{ model.ATTR_VALUE_PREVIOUS }}></textarea>
</td>
<td class="{{ model.FLAG_ADDRESS }} {{ model.FLAG_COLLAPSED }}" {{ model.ATTR_VALUE_CURRENT }}="" {{ model.ATTR_VALUE_PREVIOUS }}="">
{% include 'components/store/_preview_address.html' %}
</td>
<td class="{{ model.FLAG_PHONE_NUMBER }}">
<textarea class="{{ model.FLAG_PHONE_NUMBER }}" {{ model.ATTR_VALUE_CURRENT }} {{ model.ATTR_VALUE_PREVIOUS }}></textarea>
</td>
<td class="{{ model.FLAG_FAX }}">
<textarea class="{{ model.FLAG_FAX }}" {{ model.ATTR_VALUE_CURRENT }} {{ model.ATTR_VALUE_PREVIOUS }}></textarea>
</td>
<td class="{{ model.FLAG_EMAIL }}">
<textarea class="{{ model.FLAG_EMAIL }}" {{ model.ATTR_VALUE_CURRENT }} {{ model.ATTR_VALUE_PREVIOUS }}></textarea>
</td>
<td class="{{ model.FLAG_WEBSITE }}">
<textarea class="{{ model.FLAG_WEBSITE }}" {{ model.ATTR_VALUE_CURRENT }} {{ model.ATTR_VALUE_PREVIOUS }}></textarea>
</td>
<td class="{{ model.FLAG_CURRENCY }}" {{ model.ATTR_VALUE_CURRENT }}="" {{ model.ATTR_VALUE_PREVIOUS }}="">
{% include 'components/store/_preview_DDL_currency.html' %}
</td>
<td class="{{ model.FLAG_ACTIVE }}">
<input class="{{ model.FLAG_ACTIVE }}" type="checkbox" checked {{ model.ATTR_VALUE_CURRENT }}="{{ model.FLAG_BOOL_TRUE }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ model.FLAG_BOOL_TRUE }}">
</td>
</tr>
{% else %}
<tr {{ model.ATTR_ID_SUPPLIER }}="{{ supplier.id_supplier }}">
<td class="{{ model.FLAG_NAME_COMPANY }}">
<textarea class="{{ model.FLAG_NAME_COMPANY }}" {{ model.ATTR_VALUE_CURRENT }}="{{ supplier.name_company }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ supplier.name_company }}">{{ supplier.name_company }}</textarea>
</td>
<td class="{{ model.FLAG_NAME_CONTACT }}">
<textarea class="{{ model.FLAG_NAME_CONTACT }}" {{ model.ATTR_VALUE_CURRENT }}="{{ supplier.name_contact }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ supplier.name_contact }}">{{ supplier.name_contact }}</textarea>
</td>
<td class="{{ model.FLAG_DEPARTMENT_CONTACT }}">
<textarea class="{{ model.FLAG_DEPARTMENT_CONTACT }}" {{ model.ATTR_VALUE_CURRENT }}="{{ supplier.department_contact }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ supplier.department_contact }}">{{ supplier.department_contact }}</textarea>
</td>
{% set address = supplier.get_address_active() %}
<td class="{{ model.FLAG_ADDRESS }} {{ model.FLAG_COLLAPSED }}" {{ model.ATTR_VALUE_CURRENT }}="{{ address.id_address }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ address.id_address }}">
{% include 'components/store/_preview_address.html' %}
</td>
<td class="{{ model.FLAG_PHONE_NUMBER }}">
<textarea class="{{ model.FLAG_PHONE_NUMBER }}" {{ model.ATTR_VALUE_CURRENT }}="{{ supplier.name_company }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ supplier.phone_number }}">{{ supplier.phone_number }}</textarea>
</td>
<td class="{{ model.FLAG_FAX }}">
<textarea class="{{ model.FLAG_FAX }}" {{ model.ATTR_VALUE_CURRENT }}="{{ supplier.name_company }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ supplier.fax }}">{{ supplier.fax }}</textarea>
</td>
<td class="{{ model.FLAG_EMAIL }}">
<textarea class="{{ model.FLAG_EMAIL }}" {{ model.ATTR_VALUE_CURRENT }}="{{ supplier.name_company }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ supplier.email }}">{{ supplier.email }}</textarea>
</td>
<td class="{{ model.FLAG_WEBSITE }}">
<textarea class="{{ model.FLAG_WEBSITE }}" {{ model.ATTR_VALUE_CURRENT }}="{{ supplier.website }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ supplier.website }}">{{ supplier.website }}</textarea>
</td>
{% set currency = supplier.currency %}
<td class="{{ model.FLAG_CURRENCY }}" {{ model.ATTR_VALUE_CURRENT }}="{{ currency.id_currency }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ currency.id_currency }}">
{% include 'components/store/_preview_DDL_currency.html' %}
</td>
<td class="{{ model.FLAG_ACTIVE }}">
<input class="{{ model.FLAG_ACTIVE }}" type="checkbox" checked {{ model.ATTR_VALUE_CURRENT }}="{{ supplier.active | lower }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ supplier.active | lower }}">
</td>
</tr>
{% endif %}

View File

@@ -0,0 +1,64 @@
{% if is_blank_row %}
<tr class="{{ model.FLAG_ROW_NEW }}" {{ model.ATTR_ID_SUPPLIER_PURCHASE_ORDER }}>
<td class="{{ model.FLAG_SUPPLIER }}">
<textarea class="{{ model.FLAG_SUPPLIER }}" {{ model.ATTR_VALUE_CURRENT }} {{ model.ATTR_VALUE_PREVIOUS }}></textarea>
</td>
<td class="{{ model.FLAG_CURRENCY }}" {{ model.ATTR_VALUE_CURRENT }}="" {{ model.ATTR_VALUE_PREVIOUS }}="">
{% include 'components/store/_preview_DDL_currency.html' %}
</td>
<td class="{{ model.FLAG_COST_TOTAL_LOCAL_VAT_EXCL }}">
<input type="number" min="0" step="0.001"
class="{{ model.FLAG_COST_TOTAL_LOCAL_VAT_EXCL }}"
{{ model.ATTR_VALUE_CURRENT }}=""
{{ model.ATTR_VALUE_PREVIOUS }}=""
/>
</td>
<td class="{{ model.FLAG_COST_TOTAL_LOCAL_VAT_INCL }}">
<input type="number" min="0" step="0.001"
class="{{ model.FLAG_COST_TOTAL_LOCAL_VAT_INCL }}"
{{ model.ATTR_VALUE_CURRENT }}=""
{{ model.ATTR_VALUE_PREVIOUS }}=""
/>
</td>
<td class="{{ model.FLAG_ITEMS }}" {{ model.ATTR_VALUE_CURRENT }}="" {{ model.ATTR_VALUE_PREVIOUS }}="">
{% include 'components/store/_preview_order_items.html' %}
</td>
<td class="{{ model.FLAG_ACTIVE }}">
<input class="{{ model.FLAG_ACTIVE }}" type="checkbox" checked {{ model.ATTR_VALUE_CURRENT }}="{{ model.FLAG_BOOL_TRUE }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ model.FLAG_BOOL_TRUE }}">
</td>
</tr>
{% else %}
<tr {{ model.ATTR_ID_SUPPLIER_PURCHASE_ORDER }}="{{ order.id_order }}">
{% set supplier = order.supplier %}
<td class="{{ model.FLAG_SUPPLIER }}" {{ model.ATTR_VALUE_CURRENT }}="{{ supplier.id_supplier }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ supplier.id_supplier }}">
{% include 'components/store/_preview_DDL_supplier.html' %}
</td>
{% set currency = order.currency %}
<td class="{{ model.FLAG_CURRENCY }}" {{ model.ATTR_VALUE_CURRENT }}="{{ currency.id_currency }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ currency.id_currency }}">
{% include 'components/store/_preview_DDL_currency.html' %}
</td>
<td class="{{ model.FLAG_COST_TOTAL_LOCAL_VAT_EXCL }}">
<input type="number" min="0" step="0.001"
class="{{ model.FLAG_COST_TOTAL_LOCAL_VAT_EXCL }}"
{{ model.ATTR_VALUE_CURRENT }}="{{ order.cost_total_local_VAT_excl }}"
{{ model.ATTR_VALUE_PREVIOUS }}="{{ order.cost_total_local_VAT_excl }}"
/>
</td>
<td class="{{ model.FLAG_COST_TOTAL_LOCAL_VAT_INCL }}">
<input type="number" min="0" step="0.001"
class="{{ model.FLAG_COST_TOTAL_LOCAL_VAT_INCL }}"
{{ model.ATTR_VALUE_CURRENT }}="{{ order.cost_total_local_VAT_incl }}"
{{ model.ATTR_VALUE_PREVIOUS }}="{{ order.cost_total_local_VAT_incl }}"
/>
</td>
{% set order_items = supplier_purchase_order.order_items %}
{% set json_str_items = jsonify(order_items.to_json_list()) %}
<td class="{{ model.FLAG_ITEMS }}" {{ model.ATTR_VALUE_CURRENT }}="{{ json_str_items }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ json_str_items }}">
{% include 'components/store/_preview_order_items.html' %}
</td>
<td class="{{ model.FLAG_ACTIVE }}">
<input class="{{ model.FLAG_ACTIVE }}" type="checkbox" checked {{ model.ATTR_VALUE_CURRENT }}="{{ order.active | lower }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ order.active | lower }}">
</td>
</tr>
{% endif %}