Files
pcinv/src/main/resources/templates/create_asset.html

50 lines
2.8 KiB
HTML

<body th:replace="~{fragments :: base(title='Create '+${descriptor.displayName}, content=~{::content})}">
<div th:fragment="content">
Create a <span th:text="${descriptor.displayName}"></span>
<form th:action="'/'+${action}+'/'+${asset != null ? asset.getQr() : descriptor.getType()}" method="post">
<div th:each="d : ${descriptors}">
<h2 th:text="${d.displayName}"></h2>
<table border="1" cellpadding="4">
<tr th:each="p : ${d.getProperties()}">
<td bgcolor="#d3d3d3"><b><label th:text="${p.displayName}" th:for="${d.asString(p)}" th:title="${p.description}"></label></b></td>
<td th:switch="${p.type.nameOrEnum()}">
<span th:case="STRING">
<select th:if="${p.inputList}" th:id="${d.asString(p)+'-list'}" th:name="${d.asString(p)+'-list'}">
<option value="__new__">New...</option>
<option th:each="e : ${inputLists.get(d.asString(p))}" th:text="${e}" th:value="${e}"></option>
</select>
<span th:if="${p.inputList}"> or </span>
<input type="text" th:id="${d.asString(p)}" th:name="${d.asString(p)}" th:value="${p.getValue(asset)}" th:placeholder="${p.displayName}" th:required="${p.required}"/>
</span>
<input th:case="STRING" type="text" th:id="${d.asString(p)}" th:name="${d.asString(p)}" th:value="${p.getValue(asset)}" th:placeholder="${p.displayName}" th:required="${p.required}"/>
<input th:case="INTEGER" type="number" th:id="${d.asString(p)}" th:name="${d.asString(p)}" th:value="${p.getValue(asset)}" th:required="${p.required}"/>
<select th:case="enum" th:id="${d.asString(p)}" th:name="${d.asString(p)}">
<option th:each="o : ${p.options}" th:value="${o.value}" th:text="${o.displayName}" th:selected="${asset != null ? (p.getValue(asset) == o.enumConstant) : o.defaultValue}">Good</option>
</select>
<span th:case="CAPACITY">
<input type="number" th:id="${d.asString(p)+'-value'}" th:name="${d.asString(p)+'-value'}" th:required="${p.required}"/>
<select th:id="${d.asString(p)}+'-unit'" th:name="${d.asString(p)}+'-unit'">
<option value="1">Bytes</option>
<option th:if="${p.capacityAsSI}">kB</option>
<option th:if="${p.capacityAsIEC}">KiB</option>
<option th:if="${p.capacityAsSI}">MB</option>
<option th:if="${p.capacityAsIEC}">MiB</option>
<option th:if="${p.capacityAsSI}">GB</option>
<option th:if="${p.capacityAsIEC}">GiB</option>
<option th:if="${p.capacityAsSI}">TB</option>
<option th:if="${p.capacityAsIEC}">TiB</option>
</select>
</span>
<b th:case="*">Bad input type for <span th:text="${d.type}+'-'+${p.type}"></span></b>
</td>
</tr>
</table>
</div>
<p>
<input th:if="${action == 'create'}" type="submit" value="Create">
<input th:if="${action == 'edit'}" type="submit" value="Save Changes">
</p>
</form>
</div>
</body>