cosmetic merge

This commit is contained in:
MassiveAtoms 2019-07-22 10:19:52 -03:00
parent aa52f96beb
commit ef607e7ffc

View File

@ -12,6 +12,7 @@ void interface(vector<Park_spot>& spots) {
text_animation(introduction, 50); text_animation(introduction, 50);
*/ */
__label__ exit; __label__ exit;
system("CLS");
cout << "\nWelcome to the parking system. Please login..."; cout << "\nWelcome to the parking system. Please login...";
int id; int id;
string password; string password;
@ -43,6 +44,7 @@ void interface_member(vector<Park_spot>& spots, Customer& c) {
cout << "\nLogged in succesfully!\n"; cout << "\nLogged in succesfully!\n";
begin: begin:
system("CLS");
cout << "Hello! " << c.name cout << "Hello! " << c.name
<< ", please select an option:\n[1]Parking\n[2]Monthly report\n" << ", please select an option:\n[1]Parking\n[2]Monthly report\n"
"[3]Edit information\n[4]Exit\n"; "[3]Edit information\n[4]Exit\n";
@ -55,17 +57,21 @@ begin:
break; break;
} }
case 2: { case 2: {
cout << "Has not been implemented yet\n"; report_customer(c.id);
string lol;
std::cout<<"Enter any character to continue...";
std::cin>>lol;
break; break;
} }
case 3: { case 3: {
cout << "Has not been implemented yet\n"; edit_information(c);
break; break;
} }
case 4: { case 4: {
cout << "Exiting...\n"; cout << "Exiting...\n";
Sleep(2000);
goto exit; goto exit;
break; break;
} }
@ -80,6 +86,7 @@ exit:;
void interface_admin(vector<Park_spot>& spots) { void interface_admin(vector<Park_spot>& spots) {
__label__ begin, exit; __label__ begin, exit;
begin: begin:
system("CLS");
cout << "\nWelcome to the admin interface\n"; cout << "\nWelcome to the admin interface\n";
cout << "\n[1] Reports & analytics"; cout << "\n[1] Reports & analytics";
cout << "\n[2] Parking spots"; cout << "\n[2] Parking spots";
@ -97,6 +104,7 @@ begin:
cout << "[4] See weekly report of a specific parking spot\n"; cout << "[4] See weekly report of a specific parking spot\n";
cout << "[5] See monthly report of a specific customer\n"; cout << "[5] See monthly report of a specific customer\n";
cout << "[6] See weekly report of a specific customer\n"; cout << "[6] See weekly report of a specific customer\n";
cout << "[7] Return\n";
cout << "Enter option number: "; cout << "Enter option number: ";
int option_1; int option_1;
cin >> option_1; cin >> option_1;
@ -126,9 +134,17 @@ begin:
report_customer(0, true); report_customer(0, true);
break; break;
} }
case 7: {
goto begin;
break;
}
default: default:
break; break;
} }
string lol;
std::cout<<"Enter any character to continue...";
std::cin>>lol;
break;
} }
case 2: { case 2: {
cout << "[1] See current status of parking spots\n"; cout << "[1] See current status of parking spots\n";
@ -141,6 +157,9 @@ begin:
switch (option_2) { switch (option_2) {
case 1: { case 1: {
current_status_parkspots(spots); current_status_parkspots(spots);
string lol;
std::cout<<"Enter any character to continue...";
std::cin>>lol;
break; break;
} }
case 2: { case 2: {
@ -154,9 +173,11 @@ begin:
default: default:
break; break;
} }
break; break;
} }
case 3: { case 3: {
system("CLS");
cout << "[1] Make new customer\n"; cout << "[1] Make new customer\n";
cout << "[2] Make new admin\n"; cout << "[2] Make new admin\n";
cout << "[3] Return\n"; cout << "[3] Return\n";
@ -181,6 +202,8 @@ begin:
break; break;
} }
case 4: { case 4: {
std::cout<<"Exiting...";
Sleep(2000);
goto exit; goto exit;
break; break;
} break; } break;
@ -191,6 +214,7 @@ begin:
} }
goto begin; goto begin;
exit:; exit:;
} }
// --------- individual things. // --------- individual things.
@ -231,7 +255,7 @@ void park(Customer& c, vector<Park_spot>& spots) {
query_parkspot_with_id(c.parked_at(), spots).clock(c); query_parkspot_with_id(c.parked_at(), spots).clock(c);
cout << "You have sucessfully clocked out."; cout << "You have sucessfully clocked out.";
} else { } else {
cout << "OK, have a nice day."; // exit to customer login cout << "OK, have a nice day.";
} }
} }
exit:; exit:;
@ -277,7 +301,7 @@ void new_admin() {
} }
void new_parkspot(vector<Park_spot>& spots) { void new_parkspot(vector<Park_spot>& spots) {
cout << "What type of parking spot? \n[1] Twowheeler\n[2] Fourwheeler\n"; cout << "What type of parking spot? \n[1] Two-wheeler\n[2] Four-wheeler\n";
int vtype; int vtype;
cin >> vtype; cin >> vtype;
cin.ignore(10000, '\n'); cin.ignore(10000, '\n');
@ -288,6 +312,33 @@ void new_parkspot(vector<Park_spot>& spots) {
} }
} }
void edit_information(Customer& c)
{
string string0; int int0;
/*std::cout<<"\nInput to update name or press [0] to keep name:\n";
std::getline(cin,string0);
if (string0=="0");
else c.name=string0;*/
std::cout<<"\n Input to update vehicle to [1]Two-Wheeler,"
"[2]Four-Wheeler or press [0] to keep vehicle type:\n";
std::cin>>int0;
if (!int0);
else c.vehicle=Vehicle_type(int0);
cin.ignore();
std::cout<<"\n Input to update password or press [0] to keep current password:\n";
std::getline(cin,string0);
if (string0=="0");
else c.password=hash_password(string0);
std::cout<<"\n Input to update phone number or press [0] to keep current number:\n";
std::getline(cin,string0);
if (string0=="0");
else c.telephone=string0;
c.role=0;
if(confirm()){c.update_db();}
}
// time stuff----------------------------------------------------- // time stuff-----------------------------------------------------
pair<int, int> create_month_period() { pair<int, int> create_month_period() {
@ -330,10 +381,18 @@ bool confirm(void) {
"\n[Yes] Commit."; "\n[Yes] Commit.";
std::cin >> ver; std::cin >> ver;
if (ver == "YES" | ver == "Yes" | ver == "yes") if (ver == "YES" | ver == "Yes" | ver == "yes")
{
std::cout<<"Succes! Changes Saved.";
Sleep(1000);
return true; return true;
}
else else
{
std::cout<<"No changes committed.";
Sleep(1000);
return false; return false;
} }
}
// ------------------------------ report stuff // ------------------------------ report stuff