diff --git a/koha-tmpl/intranet-tmpl/prog/css/src/bookings.scss b/koha-tmpl/intranet-tmpl/prog/css/src/bookings.scss
new file mode 100644
index 0000000000..3f72fbf488
--- /dev/null
+++ b/koha-tmpl/intranet-tmpl/prog/css/src/bookings.scss
@@ -0,0 +1,13 @@
+#bookings-timeline {
+ .vis-item.vis-range {
+ &.cancelled {
+ background: repeating-linear-gradient(
+ 135deg,
+ rgba(211, 211, 211, 0.5) 0,
+ rgba(211, 211, 211, 0.5) 10px,
+ transparent 10px,
+ transparent 20px
+ );
+ }
+ }
+}
\ No newline at end of file
diff --git a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss b/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss
index a43aa86c15..6a12efefc6 100644
--- a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss
+++ b/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss
@@ -4894,3 +4894,17 @@ div .suggestion_note {
}
}
}
+
+[class*="filters-"] {
+ [data-filtered] span:nth-child(2) {
+ display: none;
+ }
+
+ a:not([data-filtered]) span:nth-child(1) {
+ display: none;
+ }
+
+ a {
+ cursor: pointer;
+ }
+}
diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/table-filters.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/table-filters.inc
new file mode 100644
index 0000000000..714ce3c1d7
--- /dev/null
+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/table-filters.inc
@@ -0,0 +1,30 @@
+[%# TABLE FILTER CONTROLS USAGE %]
+[%# [ INCLUDE 'table-filters.inc' %]
+[%# filters = [ %]
+[%# { id = 'expired', label_show = t('Show expired'), label_hide = t('Hide expired') }, %]
+[%# { id = 'cancelled', label_show = t('Show cancelled'), label_hide = t('Hide cancelled') }, %]
+[%# { id = 'completed', label_show = t('Show completed'), label_hide = t('Hide completed') } %]
+[%# ] %]
+[%# filter_class = 'bookings' # Optional, defaults to 'filters' %]
+[%# ] %]
+[%# %]
+[%# Parameters: %]
+[%# - filters: Array of filter objects with: %]
+[%# - id: Unique identifier for the filter %]
+[%# - label_show: Text when filter shows items %]
+[%# - label_hide: Text when filter hides items %]
+[%# - active: Boolean - filter starts active (optional, defaults to true) %]
+[%# - filter_class: CSS class prefix (optional, defaults to 'filters') %]
+
+[% IF filters && filters.size > 0 %]
+ [% filter_class = filter_class || 'filters' %]
+
+
+[% END %]
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/bookings/list.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/bookings/list.tt
index f9e4c19378..f3341d5b71 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/bookings/list.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/bookings/list.tt
@@ -12,13 +12,7 @@
[% END %]
[% INCLUDE 'doc-head-close.inc' %]
-
+[% Asset.css("css/bookings.css") | $raw %]
@@ -47,10 +41,14 @@
Bookings for [% INCLUDE 'biblio-title-head.inc' %]
-
+ [%
+ INCLUDE 'table-filters.inc'
+ filters = [
+ { id = 'expired', label_show = t('Include expired'), label_hide = t('Exclude expired') },
+ { id = 'cancelled', label_show = t('Include cancelled'), label_hide = t('Exclude cancelled') },
+ ]
+ filter_class = 'bookings'
+ %]
@@ -124,6 +122,7 @@
start: dayjs(booking.start_date).toDate(),
end: dayjs(booking.end_date).toDate(),
content: !isActive ? `${patronContent}` : patronContent,
+ className: booking.status === "cancelled" ? "cancelled" : "",
[% IF CAN_user_circulate_manage_bookings %]
editable: booking.status !== "cancelled" ? { remove: true, updateTime: true } : false,
[% ELSE %]
@@ -134,17 +133,6 @@
});
}
- const cancelledItems = document.querySelectorAll('#bookings-timeline .vis-item.vis-range.cancelled');
- cancelledItems.forEach(item => {
- item.style.background = 'repeating-linear-gradient(' +
- '135deg,' +
- 'rgba(211, 211, 211, 0.5) 0,' +
- 'rgba(211, 211, 211, 0.5) 10px,' +
- 'transparent 10px,' +
- 'transparent 20px' +
- ');';
- });
-
var container = document.getElementById('bookings-timeline');
var options = {
stack: true,
@@ -201,7 +189,9 @@
});
},
onRemove: function (item, callback) {
- $('#cancelBookingModal').modal('show', $('