Module: reservations

Contains the functionalities related to the reservations page.
Author:
  • Joonas Konki
  • Anu Koskela
  • Mikko Kuhno
  • Henrik Paananen
  • Atte Räty
License:
  • BSD 3-clause, see LICENSE for more details.
Source:

Methods

(static) calendarCancelBtn click()

Checks if the user is on the right view and if correct event is selected. Then deletes the selected event and refreshes the calendar and the list.
Source:

(static) calendarClick()

Gets the selected timeslot id and sends it to the reservation.
Source:

(static) calendarEventRender()

Calls wanted events to be rendered in the calendar.
Source:

(static) doc_ready()

This is executed after the HTML page has been loaded. This is a common procedure of all of the client-side modules to initialise the page content.
Source:

(static) initCalendar()

Initialises the calendar with the wanted parameters.
Source:

(static) initReservationTable()

Creates a list element for each reservation. Creates a toggleable list for each reservation, which includes the information of the reservation.
Source:

(static) make_cancelReservation(reservationId, reservationInfo)

An utility function that creates a click event to a button. Returns a function that shows a modal with the correct information and can cancel a reservation. If the reservation is canceled, it updates the view.
Parameters:
Name Type Description
reservationId string The ID of the reservation to be canceled.
reservationInfo string The information of the reservation to be canceled.
Source:
Returns:
A function that shows a modal with the correct information and can cancel a reservation.

(static) make_listArrowTurn(icon, open)

Returns an event handler for turning the list arrow icon.
Parameters:
Name Type Description
icon The icon jQuery element.
open boolean Specifies if the arrow should be turned to opened or closed position.
Source:

(static) reloadReservations()

Fetches the information from the database and updates the list of user's current reservations.
Source:

(static) selectReservation()

Stores the reservation ID and reservation information to their own variables.
Source:

(static) updateCalendar()

Empties the calendar and refetches the events from all calendar sources.
Source:

(static) updateReservationTable()

Shows the wanted reservations based on which options (past, present, future) are checked and hides the rest. If no reservations match the selected time frame, shows a notification.
Source:

(inner) calendarCancelBtn click()

Toggles between the calendar and the list view buttons.
Source:

(inner) modalButtonYes click()

Makes a call to cancel the selected reservation.
Source: