This commit is contained in:
Francesco
2023-09-20 11:21:48 +02:00
parent 3bd17e6e84
commit 154bb1fcb8
13 changed files with 193 additions and 78 deletions

View File

@@ -50,31 +50,40 @@
<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" th:value="${queryParams.getOrDefault('pageSize', ['50'])[0]}">
<input type="hidden" name="pageSize" th:value="${page.getPagination().getPageSize()}">
<input type="hidden" name="query" th:value="${query}">
<input type="hidden" name="filter_field" th:value="${field.getJavaName()}">
<div class="input-group pe-2">
<th:block th:if="${field.isForeignKey()}">
<div th:replace="~{fragments/forms :: input_autocomplete(field=${field}, value='')}">
<span class="input-group-text w-25">
<input type="hidden" name="filter_op" value="string_eq">
Equals
</span>
<div class="autocomplete-input position-relative w-50">
<input class="autocomplete form-control" type="text" name="filter_value"
th:data-classname="${field.getConnectedType().getName()}"
autocomplete="off"
placeholder="NULL">
</input>
<div class="suggestions d-none">
</div>
</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()}">
<select class="form-select w-25" name="filter_op">
<option th:value="${op}" th:each="op : ${field.getType().getCompareOperators()}"
th:text="${op.getDisplayName()}">
</select>
<input placeholder="NULL" th:type="${field.getType().getHTMLName()}"
name="filter_value"
class="form-control" th:id="|__id_${field.getName()}|"
class="form-control w-50" 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>
<th:block th:each="p : ${queryParams.keySet()}">
@@ -84,7 +93,7 @@
</th:block>
<button class="ui-btn btn btn-primary">Filter</button>
<button class="ui-btn btn btn-primary"><i class="bi bi-search text-white"></i></button>
</div>
</form>

View File

@@ -27,21 +27,18 @@
</div>
<div class="align-items-center">
<h4 class="m-0" th:if="${page}">
<th:block th:if="${sortKey != field.getName()}" >
<a th:href="@{|/dbadmin/model/${schema.getClassName()}|(page=${page.getPagination().getCurrentPage()},
pageSize=${page.getPagination().getPageSize()},sortKey=${field.getName()},sortOrder=DESC)}">
<th:block th:if="${sortKey != field.getJavaName()}" >
<a th:href="@{|/dbadmin/model/${schema.getClassName()}${page.getPagination().getSortedPageLink(field.getJavaName(), 'DESC')}|}">
<i title="Sort" class="bi bi-caret-up"></i>
</a>
</th:block>
<th:block th:unless="${sortKey != field.getName()}">
<th:block th:unless="${sortKey != field.getJavaName()}">
<a th:if="${sortOrder == 'DESC'}"
th:href="@{|/dbadmin/model/${schema.getClassName()}|(page=${page.getPagination().getCurrentPage()},
pageSize=${page.getPagination().getPageSize()},sortKey=${field.getName()},sortOrder=ASC)}">
th:href="@{|/dbadmin/model/${schema.getClassName()}${page.getPagination().getSortedPageLink(field.getJavaName(), 'ASC')}|}">
<i title="Sort" class="bi bi-caret-down-fill"></i>
</a>
<a th:if="${sortOrder == 'ASC'}"
th:href="@{|/dbadmin/model/${schema.getClassName()}|(page=${page.getPagination().getCurrentPage()},
pageSize=${page.getPagination().getPageSize()},sortKey=${field.getName()},sortOrder=DESC)}">
th:href="@{|/dbadmin/model/${schema.getClassName()}${page.getPagination().getSortedPageLink(field.getJavaName(), 'DESC')}|}">
<i title="Sort" class="bi bi-caret-up-fill"></i>
</a>
</th:block>

View File

@@ -47,7 +47,7 @@
<input type="hidden" name="page" value="1">
<input type="hidden" name="pageSize"
th:value="${queryParams.getOrDefault('pageSize', ['50'])[0]}">
th:value="${page.getPagination().getPageSize()}">
</form>
<div class="separator mb-4 mt-4"></div>