Bugzilla – Attachment 170159 Details for
Bug 37574
Add visual indicator that bookings are expired
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37574: Add visual indicator that bookings are expired
Bug-37574-Add-visual-indicator-that-bookings-are-e.patch (text/plain), 5.69 KB, created by
Owen Leonard
on 2024-08-08 14:01:13 UTC
(
hide
)
Description:
Bug 37574: Add visual indicator that bookings are expired
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2024-08-08 14:01:13 UTC
Size:
5.69 KB
patch
obsolete
>From cad81d268198f4f122367dc7e75c08b74e7c2c3b Mon Sep 17 00:00:00 2001 >From: Paul Derscheid <paul.derscheid@lmscloud.de> >Date: Wed, 7 Aug 2024 10:51:31 +0000 >Subject: [PATCH] Bug 37574: Add visual indicator that bookings are expired > >Adds a status column to the table configuration that displays whether a >booking is active or expired (at the moment). >This column is conditionally shown in the 'Show Expired' state, meaning >after expired bookings are loaded into the table. > >To test: >1) Create a couple booking for any item for a single patron. >2) Open a db shell with `koha-mysql <INSTANCE>` >3) Update one or two of the created bookings with: > update bookings set start_date = '<date in the past>', end_date = '<date also in the past'> where booking_id = '<booking id of the booking you just created>'. >4) Go the the bookings tab of said item. >5) Click the 'Show Expired' option in the top left of the table. >6) Note that bookings are tagged with 'Expired' and 'Active'. >7) Repeat 5 and 6 for the bookings tab in the patron's details view. >8) Sign off. > >Note: the bootstrap classes for v5 are already included so they become >colored once the patch is in. > >Signed-off-by: Owen Leonard <oleonard@myacpl.org> >--- > admin/columns_settings.yml | 3 ++ > .../prog/en/modules/bookings/list.tt | 24 +++++++++++++- > .../intranet-tmpl/prog/js/tables/bookings.js | 33 ++++++++++++++++++- > 3 files changed, 58 insertions(+), 2 deletions(-) > >diff --git a/admin/columns_settings.yml b/admin/columns_settings.yml >index e50980bbd8..e669cf8741 100644 >--- a/admin/columns_settings.yml >+++ b/admin/columns_settings.yml >@@ -1195,6 +1195,9 @@ modules: > - > columnname: booking_id > is_hidden: 1 >+ - >+ columnname: status >+ is_hidden: 1 > - > columnname: title > - >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 619397a1f6..120fe0b320 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/bookings/list.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/bookings/list.tt >@@ -229,6 +229,22 @@ > "title": _("Booking ID"), > "visible": false > }, >+ { >+ data: "", >+ title: __("Status"), >+ name: "status", >+ searchable: true, >+ orderable: true, >+ visible: false, >+ render: function (data, type, row, meta) { >+ let is_expired = dayjs(row.end_date).isBefore(new Date()); >+ if (is_expired) { >+ return '<span class="badge rounded-pill bg-secondary">' + __("Expired") + '</span>'; >+ } >+ >+ return '<span class="badge rounded-pill bg-success">' + __("Active") + '</span>'; >+ } >+ }, > { > "data": "item.external_id", > "title": _("Item"), >@@ -309,7 +325,13 @@ > filter_expired = true; > $(this).html('<i class="fa fa-bars"></i> '+txtActivefilter); > } >- bookings_table.DataTable().draw(); >+ >+ bookings_table.DataTable().ajax.reload(() => { >+ bookings_table >+ .DataTable() >+ .column("status:name") >+ .visible(!filter_expired, false); >+ }); > $(this).toggleClass('filtered'); > }); > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/tables/bookings.js b/koha-tmpl/intranet-tmpl/prog/js/tables/bookings.js >index 73d105dcf4..089c723113 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/tables/bookings.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/tables/bookings.js >@@ -32,6 +32,31 @@ $(document).ready(function () { > data: "booking_id", > title: __("Booking ID"), > }, >+ { >+ data: "", >+ title: __("Status"), >+ name: "status", >+ searchable: true, >+ orderable: true, >+ render: function (data, type, row, meta) { >+ let is_expired = dayjs(row.end_date).isBefore( >+ new Date() >+ ); >+ if (is_expired) { >+ return ( >+ '<span class="badge rounded-pill bg-secondary">' + >+ __("Expired") + >+ "</span>" >+ ); >+ } >+ >+ return ( >+ '<span class="badge rounded-pill bg-success">' + >+ __("Active") + >+ "</span>" >+ ); >+ }, >+ }, > { > data: "biblio.title", > title: __("Title"), >@@ -118,7 +143,13 @@ $(document).ready(function () { > filter_expired = true; > $(this).html('<i class="fa fa-bars"></i> ' + txtActivefilter); > } >- bookings_table.DataTable().draw(); >+ >+ bookings_table.DataTable().ajax.reload(() => { >+ bookings_table >+ .DataTable() >+ .column("status:name") >+ .visible(!filter_expired, false); >+ }); > $(this).toggleClass("filtered"); > }); > }); >-- >2.39.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 37574
:
170132
|
170151
|
170159
|
170160
|
170382
|
170383