feat(web): Store Product UI created and hooked up for viewing, editing, and saving.

This commit is contained in:
2024-10-05 21:16:42 +01:00
parent 9c2cfac948
commit 651a404ba3
72 changed files with 873 additions and 992 deletions

View File

@@ -3,15 +3,25 @@
<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_PRODUCT_CATEGORY }} {{ model.ATTR_VALUE_CURRENT }} {{ model.ATTR_VALUE_PREVIOUS }}></textarea>
<td class="{{ model.FLAG_PRODUCT_CATEGORY }}" {{ model.ATTR_VALUE_CURRENT }}="0" {{ model.ATTR_VALUE_PREVIOUS }}="0">
<select class="{{ model.FLAG_PRODUCT_CATEGORY}}" {{ model.ATTR_VALUE_CURRENT }}="0" {{ model.ATTR_VALUE_PREVIOUS }}="0">
{% include 'components/common/inputs/_option_blank.html' %}
{% for cat in model.category_list_filters.categories %}
<option value="{{ cat.id_category }}">{{ cat.name }}</option>
{% endfor %}
</select>
</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_PRODUCT_VARIATIONS }}">
<textarea class="{{ model.FLAG_PRODUCT_VARIATIONS }}" {{ model.ATTR_VALUE_CURRENT }} {{ model.ATTR_VALUE_PREVIOUS }}></textarea>
</td>
#}
<td class="{{ model.FLAG_HAS_VARIATIONS }}">
<input class="{{ model.FLAG_HAS_VARIATIONS }}" type="checkbox" {{ model.ATTR_VALUE_CURRENT }}="false" {{ model.ATTR_VALUE_PREVIOUS }}="false">
</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>
@@ -25,16 +35,22 @@
{% 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 class="{{ model.FLAG_PRODUCT_CATEGORY }}" {{ model.ATTR_VALUE_CURRENT }}="{{ product.id_category }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ product.id_category }}">
{% include 'components/store/_preview_DDL_product_category.html' %}
</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_PRODUCT_VARIATIONS }}">
{% include 'components/common/inputs/_textarea_product_variation_types.html' %}
<textarea class="{{ model.FLAG_PRODUCT_VARIATIONS }}" {{ model.ATTR_VALUE_CURRENT }}="{{ product.description }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ product.description }}">{{ product.description }}</textarea>
</td>
#}
<td class="{{ model.FLAG_HAS_VARIATIONS }}">
<input class="{{ model.FLAG_HAS_VARIATIONS }}" type="checkbox" {% if product.has_variations %}checked{% endif %}
{{ model.ATTR_VALUE_CURRENT }}="{{ product.has_variations | lower }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ product.has_variations | lower }}">
</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>

View File

@@ -7,7 +7,6 @@ var attrIdProductVariation = "{{ model.ATTR_ID_PRODUCT_VARIATION }}";
var attrIdProductVariationType = "{{ model.ATTR_ID_PRODUCT_VARIATION_TYPE }}";
var flagButtonBasketAdd = "{{ model.FLAG_BUTTON_BASKET_ADD }}";
var flagButtonBuyNow = "{{ model.FLAG_BUTTON_BUY_NOW }}";
var flagProductCategory = "{{ model.FLAG_PRODUCT_CATEGORY }}";
var flagCostLocal = "{{ model.FLAG_COST_LOCAL }}";
var flagCountUnitMeasurementIntervalExpirationUnsealed = "{{ model.FLAG_COUNT_UNIT_MEASUREMENT_INTERVAL_EXPIRATION_UNSEALED }}";
var flagCountUnitMeasurementIntervalRecurrence = "{{ model.FLAG_COUNT_UNIT_MEASUREMENT_INTERVAL_RECURRENCE }}";
@@ -49,10 +48,14 @@ var flagUnitMeasurementIntervalExpirationUnsealed = "{{ model.FLAG_UNIT_MEASUREM
var flagUnitMeasurementIntervalRecurrence = "{{ model.FLAG_UNIT_MEASUREMENT_INTERVAL_RECURRENCE }}";
var flagUnitMeasurementQuantity = "{{ model.FLAG_UNIT_MEASUREMENT_QUANTITY }}";
var flagProductVariations = "{{ model.FLAG_PRODUCT_VARIATIONS }}";
var hashGetStoreProduct = "{{ model.HASH_GET_STORE_PRODUCT }}";
var hashGetStoreProductCategory = "{{ model.HASH_GET_STORE_PRODUCT_CATEGORY }}";
var hashGetStoreProductPermutation = "{{ model.HASH_GET_STORE_PRODUCT_PERMUTATION }}";
var hashGetStoreStockItem = "{{ model.HASH_GET_STORE_STOCK_ITEM }}";
var hashSaveStoreProduct = "{{ model.HASH_SAVE_STORE_PRODUCT }}";
var hashSaveStoreProductCategory = "{{ model.HASH_SAVE_STORE_PRODUCT_CATEGORY }}";
var hashSaveStoreProductPermutation = "{{ model.HASH_SAVE_STORE_PRODUCT_PERMUTATION }}";
var hashSaveStoreStockItem = "{{ model.HASH_SAVE_STORE_STOCK_ITEM }}";
var hashStoreBasketAdd = "{{ model.HASH_STORE_BASKET_ADD }}";
var hashStoreBasketDelete = "{{ model.HASH_STORE_BASKET_DELETE }}";
var hashStoreBasketEdit = "{{ model.HASH_STORE_BASKET_EDIT }}";

View File

@@ -5,12 +5,12 @@
<link rel="stylesheet" href="{{ url_for('static', filename='css/sections/store.css') }}">
<link rel="stylesheet" href="{{ url_for('static', filename='css/pages/store/products.css') }}">
-->
<link rel="stylesheet" href="{{ url_for('static', filename='dist/css/store_products.css') }}">
<link rel="stylesheet" href="{{ url_for('static', filename='dist/css/store_products.bundle.css') }}">
<form id="{{ model.ID_FORM_FILTERS }}" class="{{ model.FLAG_FILTER }} {{ model.FLAG_ROW }} {{ model.FLAG_CARD }}" action="{{ url_for('routes_store_product.save_product') }}" method="POST"> <!-- {{ model.FLAG_CONTAINER }} -->
{{ model.form_filters.hidden_tag() }}
<div class="{{ model.FLAG_CONTAINER }} {{ model.FLAG_COLUMN }}">
<div class="{{ model.FLAG_CONTAINER_INPUT }}">
<div class="{{ model.FLAG_CONTAINER_INPUT }} {{ model.FLAG_FILTER }}">
{{ model.form_filters.id_category.label }}
{{ model.form_filters.id_category() }}
{% for error in model.form_filters.id_category.errors %}
@@ -77,7 +77,7 @@
<th class="{{ model.FLAG_DISPLAY_ORDER }}">Display Order</th>
<th class="{{ model.FLAG_PRODUCT_CATEGORY }}">Category</th>
<th class="{{ model.FLAG_NAME }}">Name</th>
<th class="{{ model.FLAG_PRODUCT_VARIATIONS }}">Variations</th>
<th class="{{ model.FLAG_HAS_VARIATIONS }}">Has Variations?</th>
<th class="{{ model.FLAG_ACCESS_LEVEL }}">Access Level Required</th>
<th class="{{ model.FLAG_ACTIVE}}">Active</th>
</tr>
@@ -102,10 +102,12 @@
<script src="{{ url_for('routes_store.scripts_section_store') }}"></script>
<script type="module" src="{{ url_for('static', filename='js/pages/store/products.js') }}"></script>
-->
<script src="{{ url_for('routes_store.scripts_section_store') }}"></script>
<script>
// pass arguments from model to JS
var flagIsNotEmpty = "{{ model.FLAG_IS_NOT_EMPTY }}";
var accessLevels = {{ model.convert_list_objects_to_dict_json_by_attribute_key_default(model.access_levels) | tojson | safe }};
{# var products = {{ model.convert_list_objects_to_dict_json_by_attribute_key_default(model.category_list.get_list_products()) | tojson | safe }}; #}
var productCategories = {{ model.convert_list_objects_to_dict_json_by_attribute_key_default(model.category_list_filters.categories) | tojson | safe }};
</script>
{% endblock %}