-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
92 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#include "check_in.h" | ||
#include "status.h" | ||
#include "../status.h" | ||
|
||
#include <math.h> | ||
#include <stdio.h> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#include "exit_menu.h" | ||
#include <stdlib.h> | ||
#include <libui/io.h> | ||
#include <status.h> | ||
|
||
#define MENU_STATIC \ | ||
"EXIT\n"\ | ||
"----\n\n" | ||
|
||
#define MENU_CHOICES \ | ||
"Save and exit\n" \ | ||
"Discard all session data and exit\n" \ | ||
"Return to Main Menu\n" | ||
|
||
static void save(LoginSession *login_session, HotelSession *hotel_session) | ||
{ | ||
/* Unload user objects */ | ||
terminate_login_session(login_session); | ||
/* Serialize and unload reservation, rooms and customer objects */ | ||
terminate_management_session(hotel_session); | ||
} | ||
|
||
static void discard(LoginSession *login_session, HotelSession *hotel_session) | ||
{ | ||
terminate_login_session(login_session); | ||
discard_management_session(hotel_session); | ||
} | ||
|
||
int exit_menu(LoginSession *login_session, HotelSession *hotel_session) | ||
{ | ||
while (1) { | ||
display_menu(MENU_STATIC); | ||
int choice = choices(MENU_CHOICES); | ||
switch (choice) { | ||
case 1: | ||
save(login_session, hotel_session); | ||
exit(0); | ||
case 2: | ||
case IO_STATUS_EXIT: | ||
discard(login_session, hotel_session); | ||
exit(0); | ||
case 3: | ||
case IO_STATUS_ESC: | ||
return MENU_SIGNAL_CANCEL; | ||
case IO_STATUS_UNDO: | ||
continue; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#pragma once | ||
|
||
#include <management.h> | ||
#include <login.h> | ||
|
||
int exit_menu(LoginSession *login_session, HotelSession *hotel_session); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#include "login.h" | ||
#include "status.h" | ||
#include "../status.h" | ||
#include <libui/io.h> | ||
|
||
#define MENU_STATIC\ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#pragma once | ||
|
||
typedef enum { MENU_SIGNAL_EXIT = -4, MENU_SIGNAL_CANCEL, MENU_SIGNAL_PROCEED, MENU_SIGNAL_EXIT_ABRUPT } MenuSignal; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
#pragma once | ||
|
||
#include "menus/root.h" | ||
#include "menus/login.h" | ||
#include "menus/main.h" | ||
#include "menus/availability.h" | ||
#include "menus/reservation.h" | ||
#include "menus/check_in.h" | ||
#include "menus/cancel_reservation.h" | ||
#include "menus/status.h" | ||
#include "menus/view_customer_details.h" | ||
#include "menus/query.h" | ||
#include "menus/reservation_report.h" | ||
#include <menus/root.h> | ||
#include <menus/login.h> | ||
#include <menus/main.h> | ||
#include <menus/availability.h> | ||
#include <menus/reservation.h> | ||
#include <menus/check_in.h> | ||
#include <menus/cancel_reservation.h> | ||
#include <status.h> | ||
#include <menus/view_customer_details.h> | ||
#include <menus/query.h> | ||
#include <menus/reservation_report.h> | ||
#include <menus/exit_menu.h> |