Francesco 234f3d94c8 WIP
2023-09-19 18:02:40 +02:00

96 lines
3.8 KiB
HTML

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="https://www.thymeleaf.org">
<head></head>
<body>
<div class="autocomplete-input position-relative" th:fragment="input_autocomplete(field, value)">
<input class="autocomplete form-control" type="text" th:name="${field.getName()}"
th:data-classname="${field.getConnectedType().getName()}"
autocomplete="off"
th:value="${value}"
placeholder="NULL">
</input>
<div class="suggestions d-none">
</div>
</div>
<div class="autocomplete-multi-input position-relative" th:fragment="input_autocomplete_multi(field, values)">
<div class="position-relative">
<input class="autocomplete form-control" type="text"
autocomplete="off"
th:name="|${field.getName()}[]|"
th:data-fieldname="|${field.getName()}[]|"
th:data-classname="${field.getConnectedType().getName()}">
</input>
<div class="suggestions d-none">
</div>
</div>
<span class="badge bg-danger mb-0 mt-2 value-badge clear-all-badge"
th:classAppend="${values == null || values.isEmpty() ? 'd-none' : ''}">Clear all <i class="bi bi-trash"></i></span>
<div class="mt-0 mb-2 selected-values">
<th:block th:each="value : ${values}" th:if="${values}">
<span class="value-badge">
<input type="checkbox" checked="checked" class="badge-checkbox"
th:name="|${field.getName()}[]|" th:value="${value.getPrimaryKeyValue()}">
<span class="badge bg-primary me-2" th:text="${value.getDisplayName()}">
</span>
</span>
</th:block>
</div>
</div>
<div class="card mb-3 filterable-field" th:fragment="filter_field(field)">
<div class="card-header noselect cursor-pointer">
<i class="bi bi-caret-right filter-icon align-middle"></i>
<span class="fw-bold align-middle" th:text="${field.getName()}"></span>
</div>
<div class="card-body d-none">
<form action="" method="GET">
<!-- Reset page when applying filter to start back at page 1 -->
<!-- <input type="hidden" name="page" value="1">
<input type="hidden" name="pageSize" value="50"> -->
<th:block th:each="p : ${queryParams.keySet()}">
<input th:each="v : ${queryParams.get(p)}" th:name="${p}" th:value="${v}" type="hidden">
</th:block>
<div class="input-group pe-2">
<th:block th:if="${field.isForeignKey()}">
<div th:replace="~{fragments/forms :: input_autocomplete(field=${field}, value='')}">
</div>
<input type="hidden" th:value="${field.getType()}" th:name="|__dbadmin_${field.getName()}_type|">
</th:block>
<th:block th:unless="${field.isForeignKey()}">
<div class="container w-25">
<select class="form-select w-auto" name="filter_op">
<option th:value="${op}" th:each="op : ${field.getType().getCompareOperators()}" th:text="${op}">
</select>
</div>
<input type="hidden" name="filter_field" th:value="${field.getJavaName()}">
<input placeholder="NULL" th:type="${field.getType().getHTMLName()}"
name="filter_value"
class="form-control" th:id="|__id_${field.getName()}|"
th:classAppend="${field.isPrimaryKey() && object != null ? 'disable' : ''}"
th:required="${!field.isNullable() && !field.isPrimaryKey()}"
step="any"
oninvalid="this.setCustomValidity('This field is not nullable.')"
oninput="this.setCustomValidity('')">
<input type="hidden" th:value="${field.getType()}" th:name="|__dbadmin_${field.getName()}_type|">
</th:block>
<button class="ui-btn btn btn-primary">Filter</button>
</div>
</form>
<!--
<th:block th:if="${field.getConnectedType() != null}">
<div th:each="val : ${schema.getFieldValues(field)}">
<span th:text="${val}"></span>
</div>
</th:block>
-->
</div>
</div>
</body>
</html>