View Route

<<Back to Main Menu

Description:
Shows the details of a route, including flights flying on that route, revenue information for the route. There are options to delete the Route (if there are no flights associated with it) or set its status to 'inactive'.

Accessible by:
Managers

Accessed from:
View Routes
Route Search
View Airport
Add Route
Itself if manager changes active status of the route or delete it.

Input parameters:
route ID action

Output
Route details, flights travelling on the Route (with links to View Flight and revenue information. Link to set to 'active' if it's 'inactive' and vice versa. Link to delete the Route if there are no flights associated with it.

Pseudo Code:
get/create session
if ('usertype' param in the session == 'm') {
   get parameters from the form
   if (there is a 'route ID' param) {
      if (there is an 'action' param) {
         if ('action' param == 'active') {
            set 'status' field in database to 'a' (denoting active)
         }
         else if ('action' param == 'inactive') {
            set 'status' field in database to 'i'
            get all bookings for future Flights on that Route
            send email to all users telling them their flight is cancelled
            delete all future flights on the Route
         }
         else if ('action' param == 'delete') {
            check that there are no flights associated with the route
            if (there are such flights) {
               display error message
            }
            else {
               delete the Route from the database
               delete any Complex Route that has this Route as a Route Part
            }
         }
         else {
            display error message
         }
      }
      else {
         get flight, booking, airport and route data from the database
         display general Route information (from and to (with links to View Airport), revenue information.
         display list of flights on the Route (with links to View Flight)
         if (there are no flights in the database associated with the Route) {
            display link to delete
         }
         if ('status' field in the Routes table == 'inactive') {
            display link to set to active
         }
         else if ('status' field in the Routes table == 'active') {
            display link to set to inactive with warning that this will cancel all flights on the Route
         }
      }
   }
   else {
      display an error message
   }
}
else {
   error message to say user must be a manager
}