Merge josh features and sagar features #11

Closed
MassiveAtoms wants to merge 20 commits from billing4real into billing
Showing only changes of commit ef607e7ffc - Show all commits

View File

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