Skip to content
15 changes: 15 additions & 0 deletions dt-assets/js/modular-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -1152,6 +1152,14 @@
favorite_edit_event();
};

window.SHAREDFUNCTIONS['empty_list'] = empty_list;

function empty_list() {
$('#table-content').html(
`<tr><td colspan="10">${window.SHAREDFUNCTIONS.escapeHTML(list_settings.translations.empty_list)}</td></tr>`,
);
}

function get_records(offset = 0, sort = null) {
loading_spinner.addClass('active');
let query = current_filter.query;
Expand Down Expand Up @@ -1245,6 +1253,9 @@
* Modal options
*/

// Promote as a shared function.
window.SHAREDFUNCTIONS['add_custom_filter'] = add_custom_filter;

//add the new filter in the filters list
function add_custom_filter(name, type, query, labels, load_records = true) {
query = query || current_filter.query;
Expand Down Expand Up @@ -1668,6 +1679,8 @@
return { newLabel: { id: key, name: value, field } };
}

// Promote as a shared function.
window.SHAREDFUNCTIONS['create_name_value_label'] = create_name_value_label;
function create_name_value_label(field, id, value, listSettings) {
let name = window.lodash.get(
listSettings,
Expand Down Expand Up @@ -3926,6 +3939,8 @@
return filter;
}

// Promote as a shared function.
window.SHAREDFUNCTIONS['reset_split_by_filters'] = reset_split_by_filters;
function reset_split_by_filters() {
let split_by_filter_select = $('#split_by_current_filter_select');
if (current_filter && current_filter['query']['fields'] !== undefined) {
Expand Down
6 changes: 6 additions & 0 deletions dt-assets/js/shared-functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,12 @@ window.API = {

search_users: (query) => makeRequest('GET', `users/get_users?s=${query}`),

search_location_grid_by_name: (query, filter = 'all') =>
makeRequest(
'GET',
`mapping_module/search_location_grid_by_name?s=${query}&filter=${filter}`,
),

get_filters: () => makeRequest('GET', 'users/get_filters'),

save_filters: (post_type, filter) =>
Expand Down