52 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			52 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
<!DOCTYPE html>
 | 
						|
<html lang="en">
 | 
						|
<head>
 | 
						|
    <meta charset="UTF-8">
 | 
						|
    <title>Update Item</title>
 | 
						|
</head>
 | 
						|
<body>
 | 
						|
    <h2 align="center">Update Item</h2>
 | 
						|
 | 
						|
    <form method="POST">
 | 
						|
        {% for attrib in item_attributes -%}
 | 
						|
        <p>
 | 
						|
            <label for="{{ attrib.attrib_name }}">{{ attrib.display_name }}:</label>
 | 
						|
            {%- if isinstance(attrib, selectAttribute) %}
 | 
						|
            <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>
 | 
						|
            {% else %}
 | 
						|
                <input
 | 
						|
                    id="{{ attrib.attrib_name }}"
 | 
						|
                    type="{{ attrib.html_input_type }}"
 | 
						|
                    name="{{ attrib.attrib_name }}"
 | 
						|
                    {%- if attrib.required %} required {% endif -%}
 | 
						|
                    {%- if hasattr(attrib, 'min_val') and attrib.min_val is not none %} min="{{ attrib.min_val }}" {% endif -%}
 | 
						|
                    {%- if hasattr(attrib, 'max_val') and attrib.max_val is not none %} max="{{ attrib.max_val }}" {% endif -%}
 | 
						|
                    {%- if item[attrib.attrib_name]  %} value="{{ item[attrib.attrib_name] }}" {% endif -%}
 | 
						|
                />
 | 
						|
            {% endif -%}
 | 
						|
        </p>
 | 
						|
        {% endfor %}
 | 
						|
        <p><input type="submit" value="Update" /></p>
 | 
						|
    </form>
 | 
						|
 | 
						|
    <p align="center">
 | 
						|
        {%- if exc == 'integrity' -%}
 | 
						|
            Item with the same assettag already exists
 | 
						|
        {%- endif -%}
 | 
						|
        {%- if exc == 'status' -%}
 | 
						|
            Data input error. Invalid status value
 | 
						|
        {%- endif -%}
 | 
						|
        {%- if exc == 'staffnum' -%}
 | 
						|
            Data input error. Staff number must be an integer
 | 
						|
        {%- endif -%}
 | 
						|
    </p>
 | 
						|
</body>
 | 
						|
</html> |