2025-01-29 05:27:19 +00:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="en">
|
|
|
|
<head>
|
|
|
|
<meta charset="UTF-8">
|
|
|
|
<title>Update Item</title>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<h2 align="center">Update Item</h2>
|
|
|
|
|
2025-02-23 17:39:52 +00:00
|
|
|
<!-- Display error message if any -->
|
|
|
|
{% if error %}
|
|
|
|
<p>{{ error }}</p>
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
<!-- Form for updating an item -->
|
2025-02-22 18:58:10 +00:00
|
|
|
<form method="POST">
|
|
|
|
{% for attrib in item_attributes -%}
|
2025-01-29 05:27:19 +00:00
|
|
|
<p>
|
2025-02-22 18:58:10 +00:00
|
|
|
<label for="{{ attrib.attrib_name }}">{{ attrib.display_name }}:</label>
|
2025-02-23 17:39:52 +00:00
|
|
|
{% if attrib.html_input_type == "select" %}
|
|
|
|
<!-- Render a dropdown for select attributes -->
|
|
|
|
<select
|
|
|
|
id="{{ attrib.attrib_name }}"
|
|
|
|
name="{{ attrib.attrib_name }}"
|
|
|
|
{% if attrib.required %} required {% endif %}
|
|
|
|
>
|
|
|
|
{% for option in attrib.options -%}
|
|
|
|
<option value="{{ option }}" {% if item[attrib.attrib_name] == option %}selected{% endif %}>{{ option }}</option>
|
|
|
|
{% endfor %}
|
|
|
|
</select>
|
2025-02-06 10:43:09 +00:00
|
|
|
{% else %}
|
2025-02-23 17:39:52 +00:00
|
|
|
<!-- Render an input field for other attributes -->
|
2025-02-06 10:43:09 +00:00
|
|
|
<input
|
2025-02-22 18:58:10 +00:00
|
|
|
id="{{ attrib.attrib_name }}"
|
|
|
|
type="{{ attrib.html_input_type }}"
|
|
|
|
name="{{ attrib.attrib_name }}"
|
2025-02-23 17:39:52 +00:00
|
|
|
{% if attrib.required %} required {% endif %}
|
|
|
|
{% if attrib.html_input_type == "number" %}
|
|
|
|
{% if attrib.min_val is not none %} min="{{ attrib.min_val }}" {% endif %}
|
|
|
|
{% if attrib.max_val is not none %} max="{{ attrib.max_val }}" {% endif %}
|
|
|
|
{% endif %}
|
|
|
|
{% if item[attrib.attrib_name] %} value="{{ item[attrib.attrib_name] }}" {% endif %}
|
2025-02-06 10:43:09 +00:00
|
|
|
/>
|
2025-02-23 17:39:52 +00:00
|
|
|
{% endif %}
|
2025-01-29 05:27:19 +00:00
|
|
|
</p>
|
2025-02-06 10:43:09 +00:00
|
|
|
{% endfor %}
|
2025-02-22 18:58:10 +00:00
|
|
|
<p><input type="submit" value="Update" /></p>
|
2025-01-29 05:27:19 +00:00
|
|
|
</form>
|
|
|
|
</body>
|
|
|
|
</html>
|