Koha/koha-tmpl/intranet-tmpl/prog/js/vue/composables/datatables.js
Jonathan Druart b9096fe7df
Bug 32030: Filter by expired agreements
This patch adds a checkbox and flatpickr input to filter agreements by
expiration date.

Signed-off-by: Jonathan Field <jonathan.field@ptfs-europe.com>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-08 09:44:21 -03:00

22 lines
628 B
JavaScript

import { onBeforeUnmount } from "vue";
export function useDataTable(table_id) {
onBeforeUnmount(() => {
if ($.fn.DataTable.isDataTable("#" + table_id)) {
$("#" + table_id)
.DataTable()
.destroy(true);
}
});
}
export function build_url_params(filters) {
return Object.entries(filters)
.map(([k, v]) => (v ? k + "=" + v : undefined))
.filter((e) => e !== undefined)
.join("&");
}
export function build_url(base_url, filters) {
let params = build_url_params(filters);
return base_url + (params.length ? "?" + params : "");
}