- fixed issues with jumpy actions for item view

- added AFLOW-23 support for categories and rewrote interface
This commit is contained in:
2023-07-10 17:50:31 +02:00
parent 94186a3a18
commit ea80b4bf2b
5 changed files with 137 additions and 49 deletions

View File

@ -1,3 +1,5 @@
const FLAG_supports_new_data_loader = true;
function getDataForEdit(name) {
$.ajax({
type: 'get',
@ -37,3 +39,42 @@ function primeEdit() {
form.setAttribute('method', 'PATCH');
return true;
}
const itemList = $('#itemList');
// itemList.empty();
itemList.bootstrapTable({ url: '/api/v1/categories', search: true, showRefresh: true, responseHandler: dataResponseHandler, sidePagination: 'server', serverSort: true, silentSort: false });
setTimeout(() => {
activateTooltips();
}, 1000);
function loadPageData() {
itemList.bootstrapTable('refresh')
setTimeout(() => {
activateTooltips();
}, 1000);
}
function dataResponseHandler(json) {
// console.log(json)
totalNotFiltered = json.totalNotFiltered;
total = json.total;
json = json.items;
json.forEach((item) => {
item.actions = `
<button class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#editCategoryModal" onclick="primeEdit(); getDataForEdit('${item.name}')">
<i class="bi bi-pencil"></i>
</button>
<button class="btn btn-danger" onclick="preFillDeleteModalNxt('${item.name}','categories','Category','name')" data-bs-toggle="modal" data-bs-target="#staticBackdrop">
<i class="bi bi-trash"></i>
</button>`
});
///// --------------------------------- /////
setTimeout(() => {
activateTooltips();
}, 200);
return {"rows": json, total: total, totalNotFiltered: totalNotFiltered, totalRows: total};
}
loadPageData()

View File

@ -7,15 +7,12 @@ const FLAG_supports_new_data_loader = true;
// Inital thing
const itemList = $('#itemList');
// itemList.empty();
itemList.bootstrapTable({url: "/api/v1/items", search: true, showRefresh: true, responseHandler: dataResponseHandler, sidePagination: 'server', serverSort: true, silentSort: false})
setTimeout(() => {
activateTooltips();
}, 1000);
itemList.bootstrapTable({ url: '/api/v1/items', search: true, showRefresh: true, responseHandler: dataResponseHandler, sidePagination: 'server', serverSort: true, silentSort: false });
setTimeout(() => {
activateTooltips();
}, 1000);
function loadPageData() {
const itemList = $('#itemList');
// itemList.empty();
itemList.bootstrapTable('refresh')
setTimeout(() => {