Website Summary Files Commits Branches @commit @diff @stats
path: root / src / VenueConsoleUI.cpp
diff options
context:
space:
mode:
Commitb391de42cd39e3dfe48544b0825bc1256f5577cc (patch)
Author
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-05-05 14:13:38 +0300
Committer
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-05-05 14:13:38 +0300
Files06b5c6a3c73ad1f8a8316a57df3a39fe306adc4c /src/VenueConsoleUI.cpp
FMI-OOP-P1_TicketSystem-b391de42cd39e3dfe48544b0825bc1256f5577cc.tar
FMI-OOP-P1_TicketSystem-b391de42cd39e3dfe48544b0825bc1256f5577cc.tar.gz
FMI-OOP-P1_TicketSystem-b391de42cd39e3dfe48544b0825bc1256f5577cc.zip
Parentce04174c09a20d9c28027095a0e5f1ab56d7d6ed (diff)
Autocommit at 05.05.2022 @ 14:13
1 files changed, 12 insertions, 5 deletions
-rw-r--r--src/VenueConsoleUI.cpp17
diff --git a/src/VenueConsoleUI.cpp b/src/VenueConsoleUI.cpp
index a4f63db..6b509ee 100644
--- a/src/VenueConsoleUI.cpp
+++ b/src/VenueConsoleUI.cpp
@@ -5,7 +5,7 @@
#include "ConsoleInterface/Menu.h"
#include "ConsoleInterface/Toolbox.hpp"
-Venue v;
+Venue* v;
void handleStatusCode(StatusCode sc) {
switch (sc) {
@@ -19,7 +19,7 @@ void command_newEvent() {
unsigned hallIndex;
inputBox("Enter hall index: ", &hallIndex);
- if (!v.hallExists(hallIndex)) {
+ if (!v->hallExists(hallIndex)) {
printError("Invalid hall index!");
return;
}
@@ -29,7 +29,7 @@ void command_newEvent() {
DateTime dt;
inputBox("Enter event date and time: ", &dt);
- handleStatusCode(v.get_es().createEvent(&v.get_halls()[hallIndex], name, dt));
+ handleStatusCode(v->get_es().createEvent(&v.get_halls()[hallIndex], name, dt));
}
void submenu_ticketManagement() {
@@ -43,8 +43,15 @@ void submenu_eventManagement() {
void submenu_reportManagement() {
}
-const Menu mainMenu({ submenu_ticketManagement, submenu_eventManagement, submenu_reportManagement }, 3);
+
+const Menu mainMenu, ticketManagementMenu, eventManagementMenu, reportsMenu;
+
+void init() {
+ mainMenu.add(Command("Ticket Management", submenu_ticketManagement));
+}
void runUI(Venue& venue) {
- v = venue;
+ v = &venue;
+ init();
+ mainMenu.navigate();
}