Bug 29002: Ensure bookings stash is up to date

This patch adds the edited/added booking to the bookings stash such that
subsequent triggers of the place/edit booking modal will reflect the
change in thier picker.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Janet McGowan <janet.mcgowan@ptfs-europe.com>
Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
Signed-off-by: Laurence Rault <laurence.rault@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Martin Renvoize 2023-10-11 17:20:42 +01:00 committed by Tomas Cohen Arazi
parent 0bf474a338
commit 14afa1318c
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F

View file

@ -450,6 +450,9 @@ $("#placeBookingForm").on('submit', function(e) {
);
posting.done(function(data) {
// Update bookings store for subsequent bookings
bookings.push(data);
// Update bookings page as required
if (typeof bookings_table !== 'undefined' && bookings_table !== null) {
bookings_table.api().ajax.reload();
@ -500,6 +503,10 @@ $("#placeBookingForm").on('submit', function(e) {
putting.done(function(data) {
update_success = 1;
// Update bookings store for subsequent bookings
let target = bookings.find((obj) => obj.booking_id === data.booking_id);
Object.assign(target,data);
// Update bookings page as required
if (typeof bookings_table !== 'undefined' && bookings_table !== null) {
bookings_table.api().ajax.reload();