Compare commits
3 Commits
billing5re
...
ec089c66e7
Author | SHA1 | Date | |
---|---|---|---|
ec089c66e7 | |||
ef607e7ffc | |||
aa52f96beb |
@ -13,13 +13,14 @@ Customer::Customer(string name_, string password_, Vehicle_type vehicle_, string
|
|||||||
}
|
}
|
||||||
|
|
||||||
Customer::Customer(int id_, string name_, string password_, Vehicle_type vehicle_,
|
Customer::Customer(int id_, string name_, string password_, Vehicle_type vehicle_,
|
||||||
vector<Park_time> instances, string telephone_)
|
vector<Park_time> instances, string telephone_, int role_)
|
||||||
: id{id_},
|
: id{id_},
|
||||||
name{name_},
|
name{name_},
|
||||||
password{password_},
|
password{password_},
|
||||||
vehicle{vehicle_},
|
vehicle{vehicle_},
|
||||||
park_instances{instances},
|
park_instances{instances},
|
||||||
telephone{telephone_} {}
|
telephone{telephone_},
|
||||||
|
role{role_} {}
|
||||||
|
|
||||||
// clock in/out methods
|
// clock in/out methods
|
||||||
// ====================================================================================
|
// ====================================================================================
|
||||||
|
@ -57,8 +57,8 @@ begin:
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 2: {
|
case 2: {
|
||||||
string lol;
|
|
||||||
report_customer(c.id);
|
report_customer(c.id);
|
||||||
|
string lol;
|
||||||
std::cout<<"Enter any character to continue...";
|
std::cout<<"Enter any character to continue...";
|
||||||
std::cin>>lol;
|
std::cin>>lol;
|
||||||
break;
|
break;
|
||||||
@ -86,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";
|
||||||
@ -103,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;
|
||||||
@ -132,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";
|
||||||
@ -147,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: {
|
||||||
@ -160,6 +173,7 @@ begin:
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 3: {
|
case 3: {
|
||||||
@ -263,7 +277,7 @@ void new_customer() {
|
|||||||
cout << "\nWhat's the password? ";
|
cout << "\nWhat's the password? ";
|
||||||
std::getline(cin, password);
|
std::getline(cin, password);
|
||||||
Customer newcustomer{name, password, Vehicle_type(vtype), telephone, role};
|
Customer newcustomer{name, password, Vehicle_type(vtype), telephone, role};
|
||||||
cout << "\nNew customer sucessfully created\n";
|
cout << "\nNew customer sucessfully created with ID:" << newcustomer.id << "\n";
|
||||||
if (confirm())
|
if (confirm())
|
||||||
newcustomer.update_db();
|
newcustomer.update_db();
|
||||||
}
|
}
|
||||||
@ -280,10 +294,10 @@ void new_admin() {
|
|||||||
std::getline(cin, telephone);
|
std::getline(cin, telephone);
|
||||||
cout << "\nWhat's the password?";
|
cout << "\nWhat's the password?";
|
||||||
std::getline(cin, password);
|
std::getline(cin, password);
|
||||||
Customer newcustomer{name, password, Vehicle_type(vtype), telephone, role};
|
Customer newadmin{name, password, Vehicle_type(vtype), telephone, role};
|
||||||
cout << "\nNew customer sucessfully created\n";
|
cout << "\nNew customer sucessfully created with ID=" << newadmin.id << "\n";
|
||||||
if (confirm())
|
if (confirm())
|
||||||
newcustomer.update_db();
|
newadmin.update_db();
|
||||||
}
|
}
|
||||||
|
|
||||||
void new_parkspot(vector<Park_spot>& spots) {
|
void new_parkspot(vector<Park_spot>& spots) {
|
||||||
|
@ -41,9 +41,10 @@ vector<Customer> query_customer_with_name(string name) {
|
|||||||
string password = query.getColumn(2);
|
string password = query.getColumn(2);
|
||||||
int vehicle = query.getColumn(3); // cast to vehicle
|
int vehicle = query.getColumn(3); // cast to vehicle
|
||||||
string telephone = query.getColumn(4);
|
string telephone = query.getColumn(4);
|
||||||
|
int role = query.getColumn(5);
|
||||||
vector<Park_time> park_instances = query_parktimes_for_customer(id);
|
vector<Park_time> park_instances = query_parktimes_for_customer(id);
|
||||||
result.push_back(
|
result.push_back(
|
||||||
Customer{id, name_, password, Vehicle_type(vehicle), park_instances, telephone});
|
Customer{id, name_, password, Vehicle_type(vehicle), park_instances, telephone, role});
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -63,8 +64,10 @@ Customer query_customer_with_id(int id) {
|
|||||||
string password = query.getColumn(2);
|
string password = query.getColumn(2);
|
||||||
int vehicle = query.getColumn(3); // cast to vehicle
|
int vehicle = query.getColumn(3); // cast to vehicle
|
||||||
string telephone = query.getColumn(4);
|
string telephone = query.getColumn(4);
|
||||||
|
int role = query.getColumn(5);
|
||||||
|
|
||||||
vector<Park_time> park_instances = query_parktimes_for_customer(id);
|
vector<Park_time> park_instances = query_parktimes_for_customer(id);
|
||||||
Customer result{id, name, password, Vehicle_type(vehicle), park_instances, telephone};
|
Customer result{id, name, password, Vehicle_type(vehicle), park_instances, telephone, role};
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,9 +41,9 @@ class Customer {
|
|||||||
Vehicle_type vehicle;
|
Vehicle_type vehicle;
|
||||||
string telephone;
|
string telephone;
|
||||||
int role;
|
int role;
|
||||||
Customer(string name_, string password_, Vehicle_type vehicle_, string telephone_, int role);
|
Customer(string name_, string password_, Vehicle_type vehicle_, string telephone_, int role_);
|
||||||
Customer(int id_, string name_, string password_, Vehicle_type vehicle_,
|
Customer(int id_, string name_, string password_, Vehicle_type vehicle_,
|
||||||
vector<Park_time> instances, string telephone_);
|
vector<Park_time> instances, string telephone_, int role_);
|
||||||
void clock_in(int s_id);
|
void clock_in(int s_id);
|
||||||
void clock_out(int s_id);
|
void clock_out(int s_id);
|
||||||
bool parked();
|
bool parked();
|
||||||
|
Reference in New Issue
Block a user