2023-11-03 20:04:10 +01:00

167 lines
5.6 KiB
HTML

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="https://www.thymeleaf.org">
<textarea th:fragment="textarea(field, create, name, value)" placeholder="NULL"
th:name="${name}"
th:text="${value}"
class="form-control" th:id="|__id_${field.getName()}|"
th:required="${!field.isNullable() && !field.isPrimaryKey()}"
rows="5"
th:classAppend="|${field.isReadOnly() && !create ? 'disable' : ''}|"
></textarea>
<th:block th:fragment="char(field, create, name, value)">
<div class="input-group">
<span class="input-group-text font-monospace">
[[ ${field.getType()} ]]
</span>
<input placeholder="NULL"
type="text"
th:value="${value}"
th:name="${name}"
class="form-control " th:id="|__id_${field.getName()}|"
th:classAppend="|${(field.isPrimaryKey() && object != null) ||
(field.isReadOnly() && !create) ? 'disable' : ''}|"
maxlength="1"
th:required="${!field.isNullable() && !field.isPrimaryKey()}"
></input>
</div>
</th:block>
<th:block th:fragment="text(field, create, name, value)">
<div class="input-group">
<span class="input-group-text font-monospace">
[[ ${field.getType()} ]]
</span>
<input placeholder="NULL"
type="text"
th:value="${value}"
th:name="${name}"
class="form-control" th:id="|__id_${field.getName()}|"
th:classAppend="|${(field.isPrimaryKey() && object != null) ||
(field.isReadOnly() && !create) ? 'disable' : ''}|"
th:required="${!field.isNullable() && !field.isPrimaryKey()}"
></input>
</div>
</th:block>
<th:block th:fragment="number(field, create, name, value)">
<div class="input-group">
<span class="input-group-text font-monospace">
[[ ${field.getType()} ]]
</span>
<input placeholder="NULL"
type="number"
th:value="${value}"
th:name="${name}"
class="form-control " th:id="|__id_${field.getName()}|"
th:classAppend="|${(field.isPrimaryKey() && object != null) ||
(field.isReadOnly() && !create) ? 'disable' : ''}|"
th:required="${!field.isNullable() && !field.isPrimaryKey()}"
th:step="${field.getStep()}"
></input>
</div>
</th:block>
<th:block th:fragment="datetime(field, create, name, value)">
<div class="input-group">
<span class="input-group-text font-monospace">
[[ ${field.getType()} ]]
</span>
<input placeholder="NULL"
type="datetime-local"
th:value="${value}"
th:name="${name}"
class="form-control " th:id="|__id_${field.getName()}|"
th:classAppend="|${create != null && ((field.isPrimaryKey() && object != null) ||
(field.isReadOnly() && !create)) ? 'disable' : ''}|"
th:required="${!field.isNullable() && !field.isPrimaryKey()}"
></input>
</div>
</th:block>
<th:block th:fragment="select(field, create, name, value)">
<select th:name="${name}" class="form-select">
<option value=""
th:selected="${value == null}">NULL</option>
<option th:each="v : ${field.getType().getValues()}"
th:text="${v}"
th:value="${v}"
th:selected="${value == v}">
</option>
</select>
</th:block>
<!--
<th:block th:fragment="offset_datetime(field, create, name, value)">
<div class="form-group">
<input placeholder="NULL"
type="datetime-local"
th:value="${value}"
th:name="${name}"
class="form-control " th:id="|__id_${field.getName()}|"
th:classAppend="|${(field.isPrimaryKey() && object != null) ||
(field.isReadOnly() && !create) ? 'disable' : ''}|"
th:required="${!field.isNullable() && !field.isPrimaryKey()}"
>
</input>
<select name="offset" class="form-select">
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
</select>
</div>
</th:block>
-->
<th:block th:fragment="date(field, create, name, value)">
<div class="input-group">
<span class="input-group-text font-monospace">
[[ ${field.getType()} ]]
</span>
<input placeholder="NULL"
type="date"
th:value="${value}"
th:name="${name}"
class="form-control " th:id="|__id_${field.getName()}|"
th:classAppend="|${create != null && ((field.isPrimaryKey() && object != null) ||
(field.isReadOnly() && !create)) ? 'disable' : ''}|"
th:required="${!field.isNullable() && !field.isPrimaryKey()}"
></input>
</div>
</th:block>
<th:block th:if="${field.isBinary()}" th:fragment="file(field, create, name, value)" >
<!--/*--> Edit options <!--*/-->
<div th:if="${!create && object.get(field).getValue() != null}">
<input type="checkbox"
class="binary-field-checkbox"
th:data-fieldname="${field.getName()}"
th:id="|__keep_${name}|"
checked
th:classAppend="|${(field.isPrimaryKey() && object != null) ||
(field.isReadOnly() && !create) ? 'disable' : ''}|"
th:name="|__keep_${name}|">
<span>Keep current data</span>
<div th:if="${field.isImage()}" class="mb-2">
<img class="thumb-image"
th:id="|__thumb_${name}|"
th:src="|/${snapadmin_baseUrl}/download/${schema.getClassName()}/${field.getJavaName()}/${object.getPrimaryKeyValue()}/image|">
</div>
</div>
<!--/*--> File input <!--*/-->
<input
th:if="${field.isBinary()}" placeholder="NULL" type="file"
th:name="${name}"
th:class="|form-control mt-2|"
th:classAppend="|${(field.isPrimaryKey() && object != null) ||
(field.isReadOnly() && !create) ? 'disable' : ''}|"
th:id="|__id_${name}|"
th:required="${!field.isNullable()}"
></input>
</th:block>
</html>