feat(UI): Stock Items page added with getting, filtering, and saving data.

This commit is contained in:
2024-10-13 19:40:25 +01:00
parent 8e1651d9d7
commit fdcf448bb1
187 changed files with 5939 additions and 8825 deletions

View File

@@ -6,13 +6,13 @@
<link rel="stylesheet" href="{{ url_for('static', filename='css/sections/store.css') }}">
<link rel="stylesheet" href="{{ url_for('static', filename='css/pages/store/stock_items.css') }}">
-->
<link rel="stylesheet" href="{{ url_for('static', filename='dist/css/store_stock_items.css') }}">
<link rel="stylesheet" href="{{ url_for('static', filename='dist/css/store_stock_items.bundle.css') }}">
<!-- HTML content -->
<form id="{{ model.ID_FORM_FILTERS_STOCK }}" class="{{ model.FLAG_ROW }} {{ model.FLAG_CARD }}" action="{{ url_for('routes_store.stock_filter') }}" method="POST"> <!-- {{ model.FLAG_CONTAINER }} -->
<form id="{{ model.ID_FORM_FILTERS }}" class="{{ model.FLAG_FILTER }} {{ model.FLAG_ROW }} {{ model.FLAG_CARD }}" action="{{ url_for('routes_store_stock_item.filter_stock_item') }}" 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_ROW }} {{ model.FLAG_FILTER }}">
{{ model.form_filters.id_category.label }}
{{ model.form_filters.id_category() }}
{% for error in model.form_filters.id_category.errors %}
@@ -21,7 +21,7 @@
</div>
</div>
<div class="{{ model.FLAG_CONTAINER }} {{ model.FLAG_COLUMN }}">
<div class="{{ model.FLAG_CONTAINER_INPUT }}">
<div class="{{ model.FLAG_CONTAINER_INPUT }} {{ model.FLAG_ROW }} {{ model.FLAG_FILTER }}">
{{ model.form_filters.id_product.label }}
{{ model.form_filters.id_product() }}
{% for error in model.form_filters.id_product.errors %}
@@ -30,21 +30,25 @@
</div>
</div>
<div class="{{ model.FLAG_CONTAINER }} {{ model.FLAG_COLUMN }}">
<div class="{{ model.FLAG_CONTAINER_INPUT }}">
<div class="{{ model.FLAG_CONTAINER_INPUT }} {{ model.FLAG_ROW }} {{ model.FLAG_FILTER }}">
{{ model.form_filters.is_out_of_stock.label }}
{{ model.form_filters.is_out_of_stock() }}
{% for error in model.form_filters.is_out_of_stock.errors %}
<p class="error">{{ error }}</p>
{% endfor %}
</div>
<div class="{{ model.FLAG_CONTAINER_INPUT }}">
</div>
<div class="{{ model.FLAG_CONTAINER }} {{ model.FLAG_COLUMN }}">
<div class="{{ model.FLAG_CONTAINER_INPUT }} {{ model.FLAG_ROW }} {{ model.FLAG_FILTER }}">
{{ model.form_filters.quantity_min.label }}
{{ model.form_filters.quantity_min() }}
{% for error in model.form_filters.quantity_min.errors %}
<p class="error">{{ error }}</p>
{% endfor %}
</div>
<div class="{{ model.FLAG_CONTAINER_INPUT }}">
</div>
<div class="{{ model.FLAG_CONTAINER }} {{ model.FLAG_COLUMN }}">
<div class="{{ model.FLAG_CONTAINER_INPUT }} {{ model.FLAG_ROW }} {{ model.FLAG_FILTER }}">
{{ model.form_filters.quantity_max.label }}
{{ model.form_filters.quantity_max() }}
{% for error in model.form_filters.quantity_max.errors %}
@@ -57,89 +61,79 @@
{ { model.form_filters.submit() }}
</div>
-->
<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' %}
{% set block_id = 'button_cancel' %}
{% include 'components/common/buttons/_buttons_save_cancel.html' %}
{% set block_id = 'button_add' %}
{% include 'components/common/buttons/_buttons_save_cancel.html' %}
{% set block_id = 'buttons_table_default' %}
{% include 'components/common/buttons/_buttons_save_cancel.html' %}
<!--
<div class="{{ model.FLAG_ROW }} {{ model.FLAG_CARD }}">
<div class="{{ model.FLAG_CONTAINER }} {{ model.FLAG_COLUMN }}">
</div>
</div>
-->
</form>
<!--
<div class="{{ model.FLAG_ROW }} {{ model.FLAG_CARD }}">
<div class="{{ model.FLAG_CONTAINER }} {{ model.FLAG_COLUMN }}">
</div>
</div>
-->
<table id="{{ model.ID_TABLE_MAIN }}" class="{{ model.FLAG_ROW }} {{ model.FLAG_CARD }}">
<thead>
<tr>
<th class="{{ model.FLAG_PRODUCT_CATEGORY }}">Category</th>
<th class="{{ model.FLAG_PRODUCT }}">Product</th>
<th class="{{ model.FLAG_PRODUCT_VARIATIONS }}">Variations</th>
<th class="{{ model.FLAG_CURRENCY }}">Currency</th>
<th class="{{ model.FLAG_PRODUCT_VARIATIONS }} {{ model.FLAG_COLLAPSED }}">Variations</th>
<th class="{{ model.FLAG_CURRENCY_COST }}">Currency</th>
<th class="{{ model.FLAG_COST_LOCAL_VAT_EXCL }}">Cost Local (VAT excl.)</th>
<th class="{{ model.FLAG_COST_LOCAL_VAT_INCL }}">Cost Local (VAT incl.)</th>
<th class="{{ model.FLAG_DATE_PURCHASED}}">Date Purchased</th>
<th class="{{ model.FLAG_DATE_RECEIVED }}">Date Received</th>
<th class="{{ model.FLAG_LOCATION_STORAGE }}">Storage Location</th>
<!--<th class="{{ model.FLAG_IS_SEALED }}">Is Sealed</th>-->
<th class="{{ model.FLAG_STORAGE_LOCATION }}">Storage Location</th>
<th class="{{ model.FLAG_IS_SEALED }}">Is Sealed</th>
<th class="{{ model.FLAG_DATE_UNSEALED }}">Date Unsealed</th>
<th class="{{ model.FLAG_DATE_EXPIRATION }}">Date Expiration</th>
<!--<th class="{{ model.FLAG_IS_CONSUMED }}">Is Consumed</th>-->
<th class="{{ model.FLAG_IS_CONSUMED }}">Is Consumed</th>
<th class="{{ model.FLAG_DATE_CONSUMED }}">Date Consumed</th>
<th class="{{ model.FLAG_ACTIVE }}">Active</th>
</tr>
</thead>
<tbody>
{% set date_time_now = model.format_date(datetime.now()) %}
{% set is_blank_row = False %}
{% for category in model.category_list.categories %}
{% for product in category.products %}
{% for permutation in product.permutations %}
{% for stock_item in permutation.stock_items %}
{% set is_blank_row = False %}
{% include 'components/store/_stock_item.html' %}
{% include 'components/store/_row_stock_item.html' %}
{% endfor %}
{% endfor %}
{% endfor %}
{% endfor %}
{% set is_blank_row = True %}
{% include 'components/store/_stock_item.html' %}
{% include 'components/store/_row_stock_item.html' %}
</tbody>
</table>
{% include 'components/common/temporary/_overlay_confirm.html' %}
{% include 'components/common/temporary/_overlay_error.html' %}
<!-- Include JavaScript
<!-- Include JavaScript -->
<script src="{{ url_for('routes_store.scripts_section_store') }}"></script>
<script type="module" src="{{ url_for('static', filename='js/pages/store/stock_items.js') }}"></script>
-->
<script>
// pass arguments from model to JS
/*
var idFilterCategory = "#{{ model.ID_FILTER_CATEGORY }}";
var idFilterProduct = "#{{ model.ID_FILTER_PRODUCT }}";
var idFilterIsOutOfStock = "#{{ model.ID_FILTER_IS_OUT_OF_STOCK }}";
var idFilterQuantityMin = "#{{ model.ID_FILTER_QUANTITY_MIN }}";
var idFilterQuantityMax = "#{{ model.ID_FILTER_QUANTITY_MAX }}";
*/
var idFormFiltersPermutations = "#{{ model.ID_FORM_FILTERS_PERMUTATIONS }}";
var keyPermutations = "{{ model.KEY_PERMUTATIONS }}";
var dictListsProducts = {{ model.category_list.get_product_option_lists_by_category() | tojson | safe }};
var listCategories = {{ model.category_list.to_list_categories() | tojson | safe }};
var listProducts = {{ model.category_list.to_product_option_list() | tojson | safe }};
{#
var dictListsProducts = {{ model.category_list.get_product_option_lists_by_category() | tojson | safe }};
var listCategories = {{ model.category_list.to_category_option_list() | tojson | safe }};
{{ model.convert_list_objects_to_dict_json_by_attribute_key_default(model.category_list.categories) | tojson | safe }};
var listProducts = {{ model.category_list.to_product_option_list() | tojson | safe }};
#}
/*
// hookup elements
$(document).ready(function() {
console.log('Hooking up store stock page...');
hookupStorePageStockItem();
});
*/
var currencies = {{ model.convert_list_objects_to_dict_json_by_attribute_key_default(model.currencies) | tojson | safe }};
var products = {{ model.convert_list_objects_to_dict_json_by_attribute_key_default(model.category_list_filters.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 }};
var productVariations = {{ model.convert_list_objects_to_dict_json_by_attribute_key_default(model.variations) | tojson | safe }};
var productVariationTypes = {{ model.convert_list_objects_to_dict_json_by_attribute_key_default(model.variation_types) | tojson | safe }};
{#
var unitMeasurements = {{ units_measurement_dict | tojson | safe }};
var unitMeasurementsTime = {{ units_measurement_time_dict | tojson | safe }};
#}
var unitMeasurements = {{ model.convert_list_objects_to_dict_json_by_attribute_key_default(model.units_measurement) | tojson | safe }};
var unitMeasurementsTime = {{ model.convert_list_objects_to_dict_json_by_attribute_key_default(model.units_measurement_time) | tojson | safe }};
var _rowBlankProductVariation = null;
</script>
{% endblock %}