Feat: Product Variations page get, filter, and save. \n Fix: Active column changed to Add / Delete / Undelete column - this change has only been applied to Product Variations page
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
|
||||
{% 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() %} #}
|
||||
<div class="{{ model.FLAG_PRODUCT_VARIATIONS }}"
|
||||
{#
|
||||
{{ model.ATTR_VALUE_CURRENT }}="{{ ids_variation }}"
|
||||
{{ model.ATTR_VALUE_PREVIOUS }}="{{ ids_variation }}"
|
||||
#}
|
||||
>
|
||||
{#
|
||||
{{ variation_type.get_preview_variations() }}
|
||||
#}
|
||||
{% for variation in variation_type.variations %}
|
||||
{{ variation.name }}<br>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="{{ model.FLAG_PRODUCT_VARIATIONS }}"></div>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
{% 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 %}
|
||||
{% 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) %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{% if is_blank_row %}
|
||||
<tr class="{{ model.FLAG_ROW_NEW }} {{ model.FLAG_PRODUCT }}" {{ model.ATTR_ID_PRODUCT_CATEGORY }}>
|
||||
<tr class="{{ model.FLAG_ROW_NEW }} {{ model.FLAG_PRODUCT }}" {{ model.ATTR_ID_PRODUCT }}>
|
||||
<td class="{{ model.FLAG_DISPLAY_ORDER }}">
|
||||
{% include 'components/common/buttons/_slider_display_order.html' %}
|
||||
</td>
|
||||
|
||||
65
templates/components/store/_row_product_variation_type.html
Normal file
65
templates/components/store/_row_product_variation_type.html
Normal file
@@ -0,0 +1,65 @@
|
||||
{% if is_blank_row %}
|
||||
<tr class="{{ model.FLAG_ROW_NEW }} {{ model.FLAG_PRODUCT_VARIATION_TYPE }}" {{ model.ATTR_ID_PRODUCT_VARIATION_TYPE }}>
|
||||
<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_NAME_PLURAL }}">
|
||||
<textarea class="{{ model.FLAG_NAME_PLURAL }}" {{ model.ATTR_VALUE_CURRENT }} {{ model.ATTR_VALUE_PREVIOUS }}></textarea>
|
||||
</td>
|
||||
<td class="{{ model.FLAG_PRODUCT_VARIATIONS}} {{ model.FLAG_COLLAPSED }}">
|
||||
{% include 'components/store/_preview_product_variation_type_variations.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 }}">
|
||||
#}
|
||||
<button type="button" class="{{ model.FLAG_ACTIVE }} {{ model.FLAG_DELETE }}"
|
||||
{{ model.ATTR_VALUE_CURRENT }}="{{ model.FLAG_BOOL_TRUE }}"
|
||||
{{ model.ATTR_VALUE_PREVIOUS }}="{{ model.FLAG_BOOL_TRUE }}"
|
||||
>x</button>
|
||||
</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr class="{{ model.FLAG_PRODUCT_VARIATION_TYPE }}" {{ model.ATTR_ID_PRODUCT_VARIATION_TYPE }}="{{ variation_type.id_type }}">
|
||||
<td class="{{ model.FLAG_DISPLAY_ORDER }}">
|
||||
{% set display_order = variation_type.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 }}="{{ variation_type.code }}"
|
||||
{{ model.ATTR_VALUE_PREVIOUS }}="{{ variation_type.code }}"
|
||||
>{{ variation_type.code }}</textarea>
|
||||
</td>
|
||||
<td class="{{ model.FLAG_NAME }}">
|
||||
<textarea class="{{ model.FLAG_NAME }}"
|
||||
{{ model.ATTR_VALUE_CURRENT }}="{{ variation_type.name_singular }}"
|
||||
{{ model.ATTR_VALUE_PREVIOUS }}="{{ variation_type.name_singular }}"
|
||||
>{{ variation_type.name_singular }}</textarea>
|
||||
</td>
|
||||
<td class="{{ model.FLAG_NAME_PLURAL }}">
|
||||
<textarea class="{{ model.FLAG_NAME_PLURAL }}"
|
||||
{{ model.ATTR_VALUE_CURRENT }}="{{ variation_type.name_plural }}"
|
||||
{{ model.ATTR_VALUE_PREVIOUS }}="{{ variation_type.name_plural }}"
|
||||
>{{ variation_type.name_plural }}</textarea>
|
||||
</td>
|
||||
<td class="{{ model.FLAG_PRODUCT_VARIATIONS}} {{ model.FLAG_COLLAPSED }}">
|
||||
{% include 'components/store/_preview_product_variation_type_variations.html' %}
|
||||
</td>
|
||||
<td class="{{ model.FLAG_ACTIVE }}">
|
||||
{#
|
||||
<input class="{{ model.FLAG_ACTIVE }}" type="checkbox" {% if variation_type.active %}checked{% endif %} {{ model.ATTR_VALUE_CURRENT }}="{{ variation_type.active | lower }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ variation_type.active | lower }}">
|
||||
#}
|
||||
<button type="button" class="{{ model.FLAG_ACTIVE }} {% if variation_type.active %}{{ model.FLAG_DELETE }}{% endif %}"
|
||||
{{ model.ATTR_VALUE_CURRENT }}="{{ variation_type.active | lower }}"
|
||||
{{ model.ATTR_VALUE_PREVIOUS }}="{{ variation_type.active | lower }}"
|
||||
>{% if variation_type.active %}x{% else %}+{% endif %}</button>
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
@@ -108,6 +108,7 @@ var hashGetStoreManufacturingPurchaseOrder = "{{ model.HASH_GET_STORE_MANUFACTUR
|
||||
var hashGetStoreProduct = "{{ model.HASH_GET_STORE_PRODUCT }}";
|
||||
var hashGetStoreProductCategory = "{{ model.HASH_GET_STORE_PRODUCT_CATEGORY }}";
|
||||
var hashGetStoreProductPermutation = "{{ model.HASH_GET_STORE_PRODUCT_PERMUTATION }}";
|
||||
var hashGetStoreProductVariation = "{{ model.HASH_GET_STORE_PRODUCT_VARIATION }}";
|
||||
var hashGetStoreStockItem = "{{ model.HASH_GET_STORE_STOCK_ITEM }}";
|
||||
var hashGetStoreSupplier = "{{ model.HASH_GET_STORE_SUPPLIER }}";
|
||||
var hashGetStoreSupplierPurchaseOrder = "{{ model.HASH_GET_STORE_SUPPLIER_PURCHASE_ORDER }}";
|
||||
@@ -116,6 +117,7 @@ var hashSaveStoreManufacturingPurchaseOrder = "{{ model.HASH_SAVE_STORE_MANUFACT
|
||||
var hashSaveStoreProduct = "{{ model.HASH_SAVE_STORE_PRODUCT }}";
|
||||
var hashSaveStoreProductCategory = "{{ model.HASH_SAVE_STORE_PRODUCT_CATEGORY }}";
|
||||
var hashSaveStoreProductPermutation = "{{ model.HASH_SAVE_STORE_PRODUCT_PERMUTATION }}";
|
||||
var hashSaveStoreProductVariation = "{{ model.HASH_SAVE_STORE_PRODUCT_VARIATION }}";
|
||||
var hashSaveStoreStockItem = "{{ model.HASH_SAVE_STORE_STOCK_ITEM }}";
|
||||
var hashSaveStoreSupplier = "{{ model.HASH_SAVE_STORE_SUPPLIER }}";
|
||||
var hashSaveStoreSupplierPurchaseOrder = "{{ model.HASH_SAVE_STORE_SUPPLIER_PURCHASE_ORDER }}";
|
||||
|
||||
@@ -126,6 +126,7 @@
|
||||
var flagName = "{{ model.FLAG_NAME }}";
|
||||
var flagNameAttrOptionText = "{{ model.FLAG_NAME_ATTR_OPTION_TEXT}}";
|
||||
var flagNameAttrOptionValue = "{{ model.FLAG_NAME_ATTR_OPTION_VALUE }}";
|
||||
var flagNamePlural = "{{ model.FLAG_NAME_PLURAL }}";
|
||||
var flagNavAdminHome = "{{ model.FLAG_NAV_ADMIN_HOME }}";
|
||||
var flagNavAdminStoreStripePrices = "{{ model.FLAG_NAV_ADMIN_STORE_STRIPE_PRICES }}";
|
||||
var flagNavAdminStoreStripeProducts = "{{ model.FLAG_NAV_ADMIN_STORE_STRIPE_PRODUCTS }}";
|
||||
|
||||
70
templates/pages/store/_product_variations.html
Normal file
70
templates/pages/store/_product_variations.html
Normal file
@@ -0,0 +1,70 @@
|
||||
{% extends 'layouts/layout.html' %}
|
||||
|
||||
{% block page_body %}
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='dist/css/store_product_variations.bundle.css') }}">
|
||||
|
||||
<form id="{{ model.ID_FORM_FILTERS }}" class="{{ model.FLAG_FILTER }} {{ model.FLAG_ROW }} {{ model.FLAG_CARD }}" action="{{ url_for('routes_store_product_variation.filter_product_variation') }}" method="POST">
|
||||
{{ model.form_filters.hidden_tag() }}
|
||||
<div class="{{ model.FLAG_CONTAINER }} {{ model.FLAG_COLUMN }}">
|
||||
<div class="{{ model.FLAG_CONTAINER_INPUT }} {{ model.FLAG_ROW }} {{ model.FLAG_FILTER }}">
|
||||
{{ model.form_filters.is_not_empty.label }}
|
||||
{{ model.form_filters.is_not_empty() }}
|
||||
{% for error in model.form_filters.is_not_empty.errors %}
|
||||
<p class="error">{{ error }}</p>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="{{ model.FLAG_CONTAINER }} {{ model.FLAG_COLUMN }}">
|
||||
<div class="{{ model.FLAG_CONTAINER_INPUT }} {{ model.FLAG_ROW }} {{ model.FLAG_FILTER }}">
|
||||
{{ model.form_filters.active.label }}
|
||||
{{ model.form_filters.active() }}
|
||||
{% for error in model.form_filters.active.errors %}
|
||||
<p class="error">{{ error }}</p>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="{{ model.FLAG_CONTAINER }} {{ model.FLAG_COLUMN }}">
|
||||
<div class="{{ model.FLAG_CONTAINER_INPUT }} {{ model.FLAG_ROW }}">
|
||||
{% set block_id = 'button_apply_filters' %}
|
||||
{% include 'components/common/buttons/_buttons_save_cancel.html' %}
|
||||
</div>
|
||||
</div>
|
||||
{% set block_id = 'buttons_table_default' %}
|
||||
{% include 'components/common/buttons/_buttons_save_cancel.html' %}
|
||||
</form>
|
||||
|
||||
|
||||
<table id="{{ model.ID_TABLE_MAIN }}" class="{{ model.FLAG_ROW }} {{ model.FLAG_CARD }}">
|
||||
<thead>
|
||||
<tr class="{{ model.FLAG_PRODUCT_VARIATION_TYPE }}">
|
||||
<th class="{{ model.FLAG_DISPLAY_ORDER }}">Display Order</th>
|
||||
<th class="{{ model.FLAG_CODE }}">Code</th>
|
||||
<th class="{{ model.FLAG_NAME }}">Name</th>
|
||||
<th class="{{ model.FLAG_NAME_PLURAL }}">Name Plural</th>
|
||||
<th class="{{ model.FLAG_PRODUCT_VARIATIONS }} {{ model.FLAG_COLLAPSED }}">Variations</th>
|
||||
<th class="{{ model.FLAG_ACTIVE}}">
|
||||
<button type="button" class="{{ model.FLAG_ACTIVE }} {{ model.FLAG_ADD }}">+</button>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% set is_blank_row = False %}
|
||||
{% for variation_type in model.variation_types %}
|
||||
{% include 'components/store/_row_product_variation_type.html' %}
|
||||
{% endfor %}
|
||||
|
||||
{% set is_blank_row = True %}
|
||||
{% include 'components/store/_row_product_variation_type.html' %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{% include 'components/common/temporary/_overlay_confirm.html' %}
|
||||
{% include 'components/common/temporary/_overlay_error.html' %}
|
||||
|
||||
<!-- Include JavaScript -->
|
||||
<script src="{{ url_for('routes_store.scripts_section_store') }}"></script>
|
||||
|
||||
<script>
|
||||
var productVariationTypes = {{ model.convert_list_objects_to_dict_json_by_attribute_key_default(model.variation_types) | tojson | safe }};
|
||||
</script>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user