Skip to content

Commit

Permalink
BOOKING-285: Fixed issue with pending bookings
Browse files Browse the repository at this point in the history
  • Loading branch information
tuj authored and jekuaitk committed Nov 2, 2023
1 parent 9ffead6 commit 2733c0f
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 16 deletions.
3 changes: 3 additions & 0 deletions web/modules/custom/itkdev_booking/assets/create-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
npm run build
cp -v build/static/js/main.*.js dist/main.js
cp -v build/static/css/main.*.css dist/main.css
6 changes: 3 additions & 3 deletions web/modules/custom/itkdev_booking/assets/dist/main.js

Large diffs are not rendered by default.

16 changes: 9 additions & 7 deletions web/modules/custom/itkdev_booking/assets/src/user-panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ function UserPanel({ config }) {
const newLoadedUserBookings = { ...loadedUserBookings };

newLoadedUserBookings["hydra:member"] = newLoadedUserBookings["hydra:member"].map((booking) => {
const newBooking = booking;
const newBooking = { ...booking };

if (newBooking.status === "AWAITING_APPROVAL") {
newBooking.status = <LoadingSpinner size="small" />;
Expand All @@ -83,7 +83,7 @@ function UserPanel({ config }) {
return newBooking;
});

setUserBookings(loadedUserBookings);
setUserBookings(newLoadedUserBookings);

return pending;
})
Expand Down Expand Up @@ -209,15 +209,17 @@ function UserPanel({ config }) {
useEffect(() => {
if (pendingBookings.length > 0) {
Api.fetchBookingStatus(config.api_endpoint, pendingBookings)
.then((element) => {
.then((response) => {
const newUserBookings = { ...userBookings };

newUserBookings["hydra:member"] = newUserBookings["hydra:member"].map((booking) => {
const newBooking = booking;
const newBooking = { ...booking };

if (element.exchangeId === newBooking.exchangeId) {
newBooking.status = element.status;
}
response.forEach((element) => {
if (element.exchangeId === booking.exchangeId) {
newBooking.status = getStatus(element.status);
}
});

return newBooking;
});
Expand Down
3 changes: 0 additions & 3 deletions web/modules/custom/itkdev_booking/create-build.sh

This file was deleted.

4 changes: 2 additions & 2 deletions web/modules/custom/itkdev_booking/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ services:
- '80'
volumes:
- ${PWD}/.docker/vhost.conf:/etc/nginx/conf.d/default.conf:ro
- .:/app:delegated
- .:/app
labels:
- "traefik.enable=true"
- "traefik.docker.network=frontend"
Expand All @@ -35,4 +35,4 @@ services:
environment:
- NODE_ENV=development
volumes:
- ./assets:/app:delegated
- ./assets:/app
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ To build the code for use in the drupal module.
This will copy the compiled css and js to the library that drupal expects.

```shell
./create-build.sh
docker compose run --rm node bash -c './create-build.sh'
```

## Configuration within a drupal environment
Expand Down

0 comments on commit 2733c0f

Please sign in to comment.