Jonathan Druart
b9096fe7df
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>
22 lines
628 B
JavaScript
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 : "");
|
|
}
|