157 lines
7.5 KiB
HTML
157 lines
7.5 KiB
HTML
{% extends 'layout.html' %}
|
|
|
|
{% block page_body %}
|
|
<!--
|
|
{ % set product = model.product %}
|
|
{ % set permutation = product.get_permutation_selected() %}
|
|
-->
|
|
{% set block_id = 'styles' %}
|
|
{% include '_shared_store.html' %}
|
|
<script>console.log("test 1");</script>
|
|
<link rel="stylesheet" href="{{ url_for('static', filename='css/pages/page_store_product_permutations.css') }}">
|
|
|
|
<!-- HTML content -->
|
|
<form id="{{ model.ID_FORM_FILTERS_PERMUTATIONS }}" class="{{ model.FLAG_ROW }} {{ model.FLAG_CARD }}" action="{{ url_for('routes_store_product_permutation.permutation_save') }}" method="POST"> <!-- {{ model.FLAG_CONTAINER }} -->
|
|
{{ model.form_filters.hidden_tag() }}
|
|
<div class="{{ model.FLAG_CONTAINER }} {{ model.FLAG_COLUMN }}">
|
|
<div class="{{ model.FLAG_CONTAINER_INPUT }}">
|
|
{{ model.form_filters.id_category.label }}
|
|
{{ model.form_filters.id_category() }}
|
|
{% for error in model.form_filters.id_category.errors %}
|
|
<p class="error">{{ error }}</p>
|
|
{% endfor %}
|
|
</div>
|
|
</div>
|
|
<div class="{{ model.FLAG_CONTAINER }} {{ model.FLAG_COLUMN }}">
|
|
<div class="{{ model.FLAG_CONTAINER_INPUT }}">
|
|
{{ model.form_filters.id_product.label }}
|
|
{{ model.form_filters.id_product() }}
|
|
{% for error in model.form_filters.id_product.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.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>
|
|
<div class="{{ model.FLAG_CONTAINER }} {{ model.FLAG_COLUMN }}">
|
|
<div class="{{ model.FLAG_CONTAINER_INPUT }} {{ model.FLAG_ROW }}">
|
|
{{ 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>
|
|
<div class="{{ model.FLAG_CONTAINER }} {{ model.FLAG_COLUMN }}">
|
|
<div class="{{ model.FLAG_CONTAINER_INPUT }} {{ model.FLAG_ROW }}">
|
|
{{ model.form_filters.quantity_max.label }}
|
|
{{ model.form_filters.quantity_max() }}
|
|
{% for error in model.form_filters.quantity_max.errors %}
|
|
<p class="error">{{ error }}</p>
|
|
{% endfor %}
|
|
</div>
|
|
</div>
|
|
<!--
|
|
<div class="{{ model.FLAG_CONTAINER }} {{ model.FLAG_COLUMN }} {{ model.FLAG_CONTAINER_INPUT }}">
|
|
{ { model.form_filters.submit() }}
|
|
</div>
|
|
-->
|
|
<div class="{{ model.FLAG_CONTAINER }} {{ model.FLAG_COLUMN }}">
|
|
<div class="{{ model.FLAG_CONTAINER_INPUT }}">
|
|
{% set block_id = 'button_add' %}
|
|
{% include '_blocks_button_save_cancel.html' %}
|
|
</div>
|
|
</div>
|
|
<div class="{{ model.FLAG_CONTAINER }} {{ model.FLAG_COLUMN }}">
|
|
<div class="{{ model.FLAG_CONTAINER_INPUT }}">
|
|
{% set block_id = 'button_save' %}
|
|
{% include '_blocks_button_save_cancel.html' %}
|
|
</div>
|
|
</div>
|
|
<div class="{{ model.FLAG_CONTAINER }} {{ model.FLAG_COLUMN }}">
|
|
<div class="{{ model.FLAG_CONTAINER_INPUT }}">
|
|
{% set block_id = 'button_cancel' %}
|
|
{% include '_blocks_button_save_cancel.html' %}
|
|
</div>
|
|
</div>
|
|
<!--
|
|
<div class="{{ model.FLAG_ROW }} {{ model.FLAG_CARD }}">
|
|
<div class="{{ model.FLAG_CONTAINER }} {{ model.FLAG_COLUMN }}">
|
|
</div>
|
|
</div>
|
|
-->
|
|
</form>
|
|
<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_VARIATIONS }}">Variations</th>
|
|
<th class="{{ model.FLAG_QUANTITY_STOCK }}">Quantity Stock</th>
|
|
<th class="{{ model.FLAG_QUANTITY_MIN }}">Quantity Min</th>
|
|
<th class="{{ model.FLAG_QUANTITY_MAX }}">Quantity Max</th>
|
|
<th class="{{ model.FLAG_COST_LOCAL }}">Cost</th>
|
|
<!-- <th>Price</th> -->
|
|
<th class="{{ model.FLAG_DETAIL }}">Link</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% set is_blank_row = False %}
|
|
{% for category in model.category_list.categories %}
|
|
{% for product in category.products %}
|
|
{% for permutation in product.permutations %}
|
|
{% include '_block_store_permutation.html' %}
|
|
{% endfor %}
|
|
{% endfor %}
|
|
{% endfor %}
|
|
|
|
{% set is_blank_row = True %}
|
|
{% include '_block_store_permutation.html' %}
|
|
</tbody>
|
|
</table>
|
|
|
|
{% include '_block_overlay_confirm.html' %}
|
|
{% include '_block_overlay_error.html' %}
|
|
|
|
{% set block_id = 'scripts' %}
|
|
{% include '_shared_store.html' %}
|
|
<!-- Include JavaScript -->
|
|
<script type="module" src="{{ url_for('static', filename='js/pages/page_store_product_permutations.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 productsByCategory = {{ model.category_list.to_dict_lists_products() | tojson | safe }};
|
|
var listCategories = {{ model.category_list.to_list_categories() | tojson | safe }};
|
|
var listProducts = {{ model.category_list.to_list_products() | tojson | safe }};
|
|
var listVariations = {{ model.variations.to_list_variations() | tojson | safe }};
|
|
var listVariationTypes = {{ model.variations.to_list_variation_types() | tojson | safe }};
|
|
var dictVariations = Object.fromEntries(listVariations.map((variation, index) => [variation[attrIdVariation], variation]));
|
|
var dictVariationTypes = Object.fromEntries(listVariationTypes.map((variationType, index) => [variationType[attrIdVariationType], variationType]));
|
|
listVariations = listVariations.map((variation, index) => { return variation[attrIdVariation]; });
|
|
listVariationTypes = listVariationTypes.map((variationType, index) => { return variationType[attrIdVariationType]; });
|
|
|
|
/*
|
|
// hookup elements
|
|
$(document).ready(function() {
|
|
console.log('Hooking up store product permutation page...');
|
|
hookupStorePageProductPermutation();
|
|
});
|
|
*/
|
|
</script>
|
|
{% endblock %} |