Website Summary Files Commits Branches @commit @diff @stats
path: root / src / VenueConsoleUI.cpp
blob: 6b509ee10986522dceac561af882784631dceb4f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include "VenueConsoleUI.h"
#include "String/String.h"
#include "DateTime/DateTime.h"
#include "EventSystem/StatusCodes.h"
#include "ConsoleInterface/Menu.h"
#include "ConsoleInterface/Toolbox.hpp"

Venue* v;

void handleStatusCode(StatusCode sc) {
	switch (sc) {
		case Success: printSuccess("Success!"); break;
		default: break;
	}
}

void command_newEvent() {
	printTitle("Creating new event");

	unsigned hallIndex;
	inputBox("Enter hall index: ", &hallIndex);
	if (!v->hallExists(hallIndex)) {
		printError("Invalid hall index!");
		return;
	}
	
	char name[MAX_LINE_WIDTH];
	inputLineBox("Enter event name: ", name, MAX_LINE_WIDTH);
	DateTime dt;
	inputBox("Enter event date and time: ", &dt);
	
	handleStatusCode(v->get_es().createEvent(&v.get_halls()[hallIndex], name, dt));
}

void submenu_ticketManagement() {

}

void submenu_eventManagement() {

}

void submenu_reportManagement() {

}

const Menu mainMenu, ticketManagementMenu, eventManagementMenu, reportsMenu;

void init() {
	mainMenu.add(Command("Ticket Management", submenu_ticketManagement));
}

void runUI(Venue& venue) {
	v = &venue;
	init();
	mainMenu.navigate();
}