54 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			54 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
<!DOCTYPE html>
 | 
						|
<html lang="en">
 | 
						|
<head>
 | 
						|
    <meta charset="UTF-8">
 | 
						|
    <title>Add an Item</title>
 | 
						|
</head>
 | 
						|
<body>
 | 
						|
    <h2 align="center">Add new Item</h2>
 | 
						|
 | 
						|
    <form method = "POST">
 | 
						|
        {% for attrib, properties in item_attributes.items() -%}
 | 
						|
        <p>
 | 
						|
            <label for="{{ attrib }}">{{ properties.display_name }}:</label>
 | 
						|
            {%- if properties.html_input_type == "select" %}
 | 
						|
            <select
 | 
						|
                id="{{ attrib }}"
 | 
						|
                name="{{ attrib }}"
 | 
						|
                {%- if properties.required %} required {% endif -%}
 | 
						|
            >
 | 
						|
                {% for option in properties.options -%}
 | 
						|
                <option value="{{ option }}">{{ option }}</option>
 | 
						|
                {% endfor -%}
 | 
						|
            </select>
 | 
						|
            {% else %}
 | 
						|
                <input
 | 
						|
                    id="{{ attrib }}"
 | 
						|
                    type="{{ properties.html_input_type }}"
 | 
						|
                    name="{{ attrib }}"
 | 
						|
                    {%- if properties.required %} required {% endif -%}
 | 
						|
                    {%- if properties.min is not none %} min="{{ properties.min }}" {% endif -%}
 | 
						|
                    {%- if properties.max is not none %} max="{{ properties.max }}" {% endif -%}
 | 
						|
                    {%- if properties.default_val  %} value="{{ properties.default_val }}" {% endif -%}
 | 
						|
                />
 | 
						|
            {% endif -%}
 | 
						|
        </p>
 | 
						|
        {% endfor %}
 | 
						|
        <p><input type = "submit" value = "Submit" /></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>
 | 
						|
 |