feat(UI): Stock Items page added with getting, filtering, and saving data.
This commit is contained in:
@@ -1,108 +1,149 @@
|
||||
|
||||
{% if date_time_now is not defined %}
|
||||
{% set date_time_now = model.format_date(datetime.now()) %}
|
||||
{% endif %}
|
||||
{% if is_blank_row %}
|
||||
<tr class="{{ model.FLAG_ROW_NEW }}" {{ model.ATTR_ID_STOCK_ITEM }}>
|
||||
<td class="{{ model.FLAG_PRODUCT_CATEGORY }}">
|
||||
<select class="{{ model.FLAG_PRODUCT_CATEGORY}}" {{ model.ATTR_VALUE_CURRENT }} {{ model.ATTR_VALUE_PREVIOUS }}>
|
||||
{% for cat in model.category_list.categories %}
|
||||
<option value="{{ cat.id_category }}">{{ cat.name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<td class="{{ model.FLAG_PRODUCT_CATEGORY }}" {{ model.ATTR_VALUE_CURRENT }}="0" {{ model.ATTR_VALUE_PREVIOUS }}="0">
|
||||
{% include 'components/store/_preview_DDL_product_category.html' %}
|
||||
</td>
|
||||
<td class="{{ model.FLAG_PRODUCT }}">
|
||||
<select class="{{ model.FLAG_PRODUCT }}" {{ model.ATTR_VALUE_CURRENT }} {{ model.ATTR_VALUE_PREVIOUS }}></select>
|
||||
<td class="{{ model.FLAG_PRODUCT }}" {{ model.ATTR_VALUE_CURRENT }}="0" {{ model.ATTR_VALUE_PREVIOUS }}="0">
|
||||
{% include 'components/store/_preview_DDL_product.html' %}
|
||||
</td>
|
||||
<td class="{{ model.FLAG_PRODUCT_VARIATIONS }}">
|
||||
<textarea class="{{ model.FLAG_PRODUCT_VARIATIONS }}" {{ model.ATTR_VALUE_CURRENT }} {{ model.ATTR_VALUE_PREVIOUS }}></textarea>
|
||||
<td class="{{ model.FLAG_PRODUCT_VARIATIONS }} {{ model.FLAG_COLLAPSED }}" {{ model.ATTR_ID_PRODUCT_PERMUTATION }}="0">
|
||||
{% include 'components/store/_preview_product_permutation_variations.html' %}
|
||||
</td>
|
||||
<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>
|
||||
<td class="{{ model.FLAG_COST_LOCAL_VAT_INCL }}">
|
||||
<input class="{{ model.FLAG_COST_LOCAL_VAT_INCL }}" type="number" min="0" value="0" {{ model.ATTR_VALUE_CURRENT }}="0" {{ model.ATTR_VALUE_PREVIOUS }}>
|
||||
<input class="{{ model.FLAG_COST_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="date" {{ model.ATTR_VALUE_CURRENT }} {{ model.ATTR_VALUE_PREVIOUS }} />
|
||||
<input class="{{ model.FLAG_DATE_PURCHASED }}" type="datetime-local" {{ model.ATTR_VALUE_CURRENT }} {{ model.ATTR_VALUE_PREVIOUS }} />
|
||||
</td>
|
||||
<td class="{{ model.FLAG_DATE_RECEIVED }}">
|
||||
<input type="date" class="{{ model.FLAG_DATE_RECEIVED }}" {{ model.ATTR_VALUE_CURRENT }} {{ model.ATTR_VALUE_PREVIOUS }} />
|
||||
<input type="datetime-local" class="{{ model.FLAG_DATE_RECEIVED }} {{ model.FLAG_COLLAPSED }}" {{ model.ATTR_VALUE_CURRENT }} {{ model.ATTR_VALUE_PREVIOUS }} />
|
||||
</td>
|
||||
<td class="{{ model.FLAG_STORAGE_LOCATION }}">
|
||||
{% include 'components/store/_preview_DDL_stock_item_storage_location.html' %}
|
||||
</td>
|
||||
<!--
|
||||
<td class="{{ model.FLAG_IS_SEALED }}">
|
||||
<input type="checkbox" class="{{ model.FLAG_IS_SEALED }}" "checked" {{ model.ATTR_VALUE_CURRENT }}="{{ model.FLAG_BOOL_TRUE }}" {{ model.ATTR_VALUE_PREVIOUS }} />
|
||||
<input type="checkbox" class="{{ model.FLAG_IS_SEALED }}" checked
|
||||
{{ model.ATTR_VALUE_CURRENT }}="{{ model.FLAG_BOOL_TRUE }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ model.FLAG_BOOL_TRUE }}" />
|
||||
</td>
|
||||
-->
|
||||
<td class="{{ model.FLAG_DATE_UNSEALED }}">
|
||||
<input type="date" class="{{ model.FLAG_DATE_UNSEALED }}" {{ model.ATTR_VALUE_CURRENT }} {{ model.ATTR_VALUE_PREVIOUS }} />
|
||||
<input type="datetime-local" class="{{ model.FLAG_DATE_UNSEALED }} {{ model.FLAG_COLLAPSED }}"
|
||||
value = "{{ date_time_now }}"
|
||||
{{ model.ATTR_VALUE_CURRENT }} = "{{ date_time_now }}"
|
||||
{{ model.ATTR_VALUE_PREVIOUS }}
|
||||
/>
|
||||
</td>
|
||||
<td class="{{ model.FLAG_DATE_EXPIRATION }}">
|
||||
<input type="date" class="{{ model.FLAG_DATE_EXPIRATION }}" {{ model.ATTR_VALUE_CURRENT }} {{ model.ATTR_VALUE_PREVIOUS }} />
|
||||
<input type="datetime-local" class="{{ model.FLAG_DATE_EXPIRATION }}" {{ model.ATTR_VALUE_CURRENT }} {{ model.ATTR_VALUE_PREVIOUS }} />
|
||||
</td>
|
||||
<!--
|
||||
<td class="{{ model.FLAG_IS_CONSUMED }}">
|
||||
<input type="checkbox" class="{{ model.FLAG_IS_CONSUMED }}" {{ model.ATTR_VALUE_CURRENT }}="{{ model.FLAG_BOOL_FALSE }}" {{ model.ATTR_VALUE_PREVIOUS }} />
|
||||
<input type="checkbox" class="{{ model.FLAG_IS_CONSUMED }}" {{ model.ATTR_VALUE_CURRENT }}="{{ model.FLAG_BOOL_FALSE }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ model.FLAG_BOOL_FALSE }}" />
|
||||
</td>
|
||||
-->
|
||||
<td class="{{ model.FLAG_DATE_CONSUMED }}">
|
||||
<input type="date" class="{{ model.FLAG_DATE_CONSUMED }}" {{ model.ATTR_VALUE_CURRENT }} {{ model.ATTR_VALUE_PREVIOUS }} />
|
||||
<input type="datetime-local" class="{{ model.FLAG_DATE_CONSUMED }} {{ model.FLAG_COLLAPSED }}"
|
||||
value = "{{ date_time_now }}"
|
||||
{{ model.ATTR_VALUE_CURRENT }} = "{{ date_time_now }}"
|
||||
{{ model.ATTR_VALUE_PREVIOUS }}
|
||||
/>
|
||||
</td>
|
||||
<td class="{{ model.FLAG_ACTIVE }}">
|
||||
<input type="checkbox" class="{{ model.FLAG_ACTIVE }}" "checked" {{ model.ATTR_VALUE_CURRENT }}="{{ model.FLAG_BOOL_TRUE }}" {{ model.ATTR_VALUE_PREVIOUS }} />
|
||||
<input type="checkbox" class="{{ model.FLAG_ACTIVE }}" checked {{ model.ATTR_VALUE_CURRENT }}="{{ model.FLAG_BOOL_TRUE }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ model.FLAG_BOOL_TRUE }}" />
|
||||
</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr {{ model.ATTR_ID_STOCK_ITEM }}="{{ stock_item.id_stock_item }}">
|
||||
<td class="{{ model.FLAG_PRODUCT_CATEGORY }}">
|
||||
<select class="{{ model.FLAG_PRODUCT_CATEGORY }}" {{ model.ATTR_VALUE_CURRENT }}="{{ category.id_category }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ category.id_category }}"> <!-- {{ model.ATTR_ID_PRODUCT_CATEGORY }}="{{ category.id_category }}" -->
|
||||
{% for c in model.category_list.categories %}
|
||||
<option value="{{ c.id_category }}" {% if c.id_category == category.id_category %}selected{% endif %}>{{ c.name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<tr {{ model.ATTR_ID_STOCK_ITEM }}="{{ stock_item.id_stock }}">
|
||||
<td class="{{ model.FLAG_PRODUCT_CATEGORY }}" {{ model.ATTR_VALUE_CURRENT }}="{{ permutation.id_category }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ permutation.id_category }}">
|
||||
{% include 'components/store/_preview_DDL_product_category.html' %}
|
||||
</td>
|
||||
<td class="{{ model.FLAG_PRODUCT }}">
|
||||
<select class="{{ model.FLAG_PRODUCT }}" {{ model.ATTR_VALUE_CURRENT }}="{{ product.id_product }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ product.id_product }}"> <!-- {{ model.ATTR_ID_PRODUCT }}="{{ product.id_product }} -->
|
||||
{% for p in model.category_list.categories[model.category_list.get_index_category_from_id(category.id_category)].products %}
|
||||
<option value="{{ p.id_product }}" {% if p.id_product == product.id_product %}selected{% endif %}>{{ p.name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<td class="{{ model.FLAG_PRODUCT }}" {{ model.ATTR_VALUE_CURRENT }}="{{ permutation.id_product }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ permutation.id_product }}">
|
||||
{% include 'components/store/_preview_DDL_product.html' %}
|
||||
</td>
|
||||
<td class="{{ model.FLAG_PRODUCT_VARIATIONS }}">
|
||||
{% set variation_tree = permutation.variation_tree %}
|
||||
{% set str_ids_variations = variation_tree.to_variation_id_pairs_str() if not (variation_tree is none) else '' %}
|
||||
<td class="{{ model.FLAG_PRODUCT_VARIATIONS }} {{ model.FLAG_COLLAPSED }}"
|
||||
{{ model.ATTR_VALUE_CURRENT }}="{{ str_ids_variations }}"
|
||||
{{ model.ATTR_VALUE_PREVIOUS }}="{{ str_ids_variations }}"
|
||||
{{ model.ATTR_ID_PRODUCT_PERMUTATION }}="{{ permutation.id_permutation }}"
|
||||
>
|
||||
{% include 'components/store/_preview_product_permutation_variations.html' %}
|
||||
</td>
|
||||
<td class="{{ model.FLAG_CURRENCY }}">
|
||||
{{ permutation.output_currency() }}
|
||||
<select class="{{ model.FLAG_CURRENCY }}" {{ model.ATTR_VALUE_CURRENT }}="{{ permutation.id_currency }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ permutation.id_currency }}">
|
||||
{% for currency in model.currency_list.currencies %}
|
||||
<option value="{{ currency.id_currency }}" {% if currency.id_currency == permutation.id_currency %}selected{% endif %}>{{ currency.name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
{% set currency = stock_item.currency_cost %}
|
||||
<td class="{{ model.FLAG_CURRENCY_COST }}"
|
||||
{{ 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_LOCAL_VAT_EXCL }}">
|
||||
<input class="{{ model.FLAG_COST_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 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 }}" >
|
||||
<input class="{{ model.FLAG_COST_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 }}"
|
||||
>
|
||||
</td>
|
||||
<td class="{{ model.FLAG_DATE_PURCHASED }}">
|
||||
<input type="date" value="{{ stock_item.date_purchased }}" {{ model.ATTR_VALUE_CURRENT }}="{{ stock_item.date_purchased }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ stock_item.date_purchased }}" />
|
||||
<input type="datetime-local" value="{{ model.format_datetime(stock_item.date_purchased) }}" {{ model.ATTR_VALUE_CURRENT }}="{{ model.format_datetime(stock_item.date_purchased) }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ model.format_datetime(stock_item.date_purchased) }}" />
|
||||
</td>
|
||||
<td class="{{ model.FLAG_DATE_RECEIVED }}">
|
||||
<input type="date" value="{{ stock_item.date_received }}" {{ model.ATTR_VALUE_CURRENT }}="{{ stock_item.date_received }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ stock_item.date_received }}" />
|
||||
<input type="datetime-local"
|
||||
class="{{ model.FLAG_DATE_RECEIVED }} {% if stock_item.date_purchased is none %}{{ model.FLAG_COLLAPSED }}{% endif %}"
|
||||
value="{{ model.format_datetime(stock_item.date_received) }}"
|
||||
{{ model.ATTR_VALUE_CURRENT }}="{{ model.format_datetime(stock_item.date_received) }}"
|
||||
{{ model.ATTR_VALUE_PREVIOUS }}="{{ model.format_datetime(stock_item.date_received) }}"
|
||||
/>
|
||||
</td>
|
||||
<td class="{{ model.FLAG_STORAGE_LOCATION }}"
|
||||
{{ model.ATTR_VALUE_CURRENT }}="{{ stock_item.id_location_storage }}"
|
||||
{{ model.ATTR_VALUE_PREVIOUS }}="{{ stock_item.id_location_storage }}"
|
||||
>
|
||||
{% set storage_location = stock_item.storage_location %}
|
||||
{% include 'components/store/_preview_DDL_stock_item_storage_location.html' %}
|
||||
</td>
|
||||
<!--
|
||||
<td class="{{ model.FLAG_IS_SEALED }}">
|
||||
<input type="checkbox" {{ "checked" if stock_item.is_sealed else "" }} {{ model.ATTR_VALUE_CURRENT }}="{{ stock_item.is_sealed }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ stock_item.is_sealed }}" />
|
||||
<input type="checkbox" {{ "checked" if stock_item.is_sealed else "" }}
|
||||
{{ model.ATTR_VALUE_CURRENT }}="{{ stock_item.is_sealed | lower }}"
|
||||
{{ model.ATTR_VALUE_PREVIOUS }}="{{ stock_item.is_sealed | lower }}"
|
||||
/>
|
||||
</td>
|
||||
-->
|
||||
<td class="{{ model.FLAG_DATE_UNSEALED }}">
|
||||
<input type="date" value="{{ stock_item.date_unsealed }}" {{ model.ATTR_VALUE_CURRENT }}="{{ stock_item.date_unsealed }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ stock_item.date_unsealed }}" />
|
||||
<input type="datetime-local"
|
||||
class="{{ model.FLAG_DATE_UNSEALED }} {% if stock_item.is_sealed %}{{ model.FLAG_COLLAPSED }}{% endif %}"
|
||||
value="{{ model.format_datetime(stock_item.date_unsealed) }}"
|
||||
{{ model.ATTR_VALUE_CURRENT }}="{{ model.format_datetime(stock_item.date_unsealed) }}"
|
||||
{{ model.ATTR_VALUE_PREVIOUS }}="{{ model.format_datetime(stock_item.date_unsealed) }}"
|
||||
/>
|
||||
</td>
|
||||
<td class="{{ model.FLAG_DATE_EXPIRATION }}">
|
||||
<input type="date" value="{{ stock_item.date_expiration }}" {{ model.ATTR_VALUE_CURRENT }}="{{ stock_item.date_expiration }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ stock_item.date_expiration }}" />
|
||||
<input type="datetime-local" value="{{ model.format_datetime(stock_item.date_expiration) }}" {{ model.ATTR_VALUE_CURRENT }}="{{ model.format_datetime(stock_item.date_expiration) }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ model.format_datetime(stock_item.date_expiration) }}" />
|
||||
</td>
|
||||
<!--
|
||||
<td class="{{ model.FLAG_IS_CONSUMED }}">
|
||||
<input type="checkbox" {{ "checked" if stock_item.is_consumed else "" }} {{ model.ATTR_VALUE_CURRENT }}="{{ stock_item.is_consumed }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ stock_item.is_consumed }}" />
|
||||
<input type="checkbox" {{ "checked" if stock_item.is_consumed else "" }} {{ model.ATTR_VALUE_CURRENT }}="{{ stock_item.is_consumed | lower }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ stock_item.is_consumed | lower }}" />
|
||||
</td>
|
||||
-->
|
||||
<td class="{{ model.FLAG_DATE_CONSUMED }}">
|
||||
<input type="date" value="{{ stock_item.date_consumed }}" {{ model.ATTR_VALUE_CURRENT }}="{{ stock_item.date_consumed }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ stock_item.date_consumed }}" />
|
||||
<input type="datetime-local"
|
||||
class="{{ model.FLAG_DATE_CONSUMED }} {% if not stock_item.is_consumed %}{{ model.FLAG_COLLAPSED }}{% endif %}"
|
||||
value="{{ model.format_datetime(stock_item.date_consumed) }}"
|
||||
{{ model.ATTR_VALUE_CURRENT }}="{{ model.format_datetime(stock_item.date_consumed) }}"
|
||||
{{ model.ATTR_VALUE_PREVIOUS }}="{{ model.format_datetime(stock_item.date_consumed) }}"
|
||||
/>
|
||||
</td>
|
||||
<td class="{{ model.FLAG_ACTIVE }}">
|
||||
<input type="checkbox" {{ "checked" if stock_item.active else "" }} {{ model.ATTR_VALUE_CURRENT }}="{{ stock_item.active }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ stock_item.active }}" />
|
||||
<input type="checkbox" {{ "checked" if stock_item.active else "" }} {{ model.ATTR_VALUE_CURRENT }}="{{ stock_item.active | lower }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ stock_item.active | lower }}" />
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
Reference in New Issue
Block a user