Skip to content

Commit

Permalink
Moved showoptions and invalid option
Browse files Browse the repository at this point in the history
  • Loading branch information
gbenziv committed Jan 14, 2021
1 parent a90a325 commit c331293
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 42 deletions.
10 changes: 10 additions & 0 deletions orchestra/application/screen/backoffice/backofficescreenbase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
**************************************************************************************************/
#ifndef ORCHESTRA_APPLICATION_SCREEN_BACKOFFICE_BACKOFFICESCREENBASE_HPP_
#define ORCHESTRA_APPLICATION_SCREEN_BACKOFFICE_BACKOFFICESCREENBASE_HPP_
#include <iostream>
#include <screencommon.hpp>
#include <tablehelper.hpp>

namespace screen {
Expand All @@ -31,6 +33,14 @@ class BackOfficeScreenBase {
virtual ~BackOfficeScreenBase() = default;

protected:
virtual void invalidOptionSelected() const {
std::cout << "Sorry, that option is not yet available." << std::endl;
}
virtual void showOptions() const {
std::cout << std::endl << std::endl;
SCREENCOMMON().printColumns({"[b] - Back", "[c] - Create", "[0] - Logout"}, true, false);
std::cout << std::endl;
}
// Screen options - this represents the buttons in a GUI
enum class Options {
LANDING,
Expand Down
10 changes: 0 additions & 10 deletions orchestra/application/screen/backoffice/customermgmtscreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,6 @@ void CustomerMgmtScreen::showLandingScreen() const {
showOptions();
}

void CustomerMgmtScreen::showOptions() const {
std::cout << std::endl << std::endl;
SCREENCOMMON().printColumns({"[b] - Back", "[c] - Create", "[0] - Logout"}, true, false);
std::cout << std::endl;
}

void CustomerMgmtScreen::queryCustomersList() {
mTableHelper.setData(mCoreController->list());
}
Expand Down Expand Up @@ -316,10 +310,6 @@ bool CustomerMgmtScreen::action(Options option, std::promise<defines::display>*
return !switchScreenIsRequired;
}

void CustomerMgmtScreen::invalidOptionSelected() const {
std::cout << "Sorry, that option is not yet available." << std::endl;
}

void CustomerMgmtScreen::showListIsEmptyPopup() {
std::cout << "Customer record is empty." << std::endl;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,9 @@ class CustomerMgmtScreen : public screen::ScreenInterface,
void createCustomer();
void updateCustomer();
void removeCustomer();
void showOptions() const;
Options getUserSelection();
bool action(Options option, std::promise<defines::display>* nextScreen);
void invalidOptionSelected() const;

void fillCustomerInformation(entity::Customer* customer,
const std::vector<std::string>& requiredFields) const;

Expand Down
4 changes: 0 additions & 4 deletions orchestra/application/screen/backoffice/dashboardscreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,6 @@ void DashboardScreen::showUserInformation() const {
std::cout << "Enter [b] to go back." << std::endl;
}

void DashboardScreen::invalidOptionSelected() const {
std::cout << "Invalid option! Please select a choice from the menu." << std::endl;
}

DashboardScreen::Options DashboardScreen::getUserSelection() const {
std::string userInput;
std::cout << std::endl << "> "; std::cin >> userInput;
Expand Down
3 changes: 1 addition & 2 deletions orchestra/application/screen/backoffice/dashboardscreen.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,8 @@ class DashboardScreen : public ScreenInterface,
entity::User mCurrentUser;
void menuSelection(std::promise<defines::display>* promise) const;
void showLandingScreen() const;
void showOptions() const;
void showOptions() const override;
void showUserInformation() const;
void invalidOptionSelected() const;
Options getUserSelection() const;
bool action(Options option, std::promise<defines::display>* nextScreen) const;
};
Expand Down
10 changes: 0 additions & 10 deletions orchestra/application/screen/backoffice/empmgmtscreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,6 @@ void EmployeeMgmtScreen::showEmployees() const {
SCREENCOMMON().printHorizontalBorder(defines::BORDER_CHARACTER_2);
}

void EmployeeMgmtScreen::showOptions() const {
std::cout << std::endl << std::endl;
SCREENCOMMON().printColumns({"[b] - Back", "[c] - Create", "[0] - Logout"}, true, false);
std::cout << std::endl;
}

void EmployeeMgmtScreen::showEmployeeInformation(bool showIndex) const {
/*!
* Get the employeeID from employee GUI table
Expand Down Expand Up @@ -379,10 +373,6 @@ bool EmployeeMgmtScreen::action(Options option, std::promise<defines::display>*
return !switchScreenIsRequired;
}

void EmployeeMgmtScreen::invalidOptionSelected() const {
std::cout << "Sorry, that option is not yet available." << std::endl;
}

void EmployeeMgmtScreen::showEmployeesEmptyPopup() {
std::cout << "Employees record is empty." << std::endl;
}
Expand Down
2 changes: 0 additions & 2 deletions orchestra/application/screen/backoffice/empmgmtscreen.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,8 @@ class EmployeeMgmtScreen : public ScreenInterface,
private:
void showLandingScreen() const;
void showEmployees() const;
void showOptions() const;
Options getUserSelection();
bool action(Options option, std::promise<defines::display>* nextScreen);
void invalidOptionSelected() const;
void showEmployeeInformation(bool showIndex = false) const;
void queryEmployeesList();
void createEmployee();
Expand Down
10 changes: 0 additions & 10 deletions orchestra/application/screen/backoffice/inventoryscreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,6 @@ void InventoryScreen::showProducts() const {
SCREENCOMMON().printHorizontalBorder(defines::BORDER_CHARACTER_2);
}

void InventoryScreen::showOptions() const {
std::cout << std::endl << std::endl;
SCREENCOMMON().printColumns({"[b] - Back", "[c] - Create", "[0] - Logout"}, true, false);
std::cout << std::endl;
}

void InventoryScreen::showProductDetails(bool showIndex) const {
const entity::Product& selectedProduct = mTableHelper.getSelectedData();
SCREENCOMMON().showTopBanner("Product Information");
Expand Down Expand Up @@ -268,10 +262,6 @@ bool InventoryScreen::action(Options option, std::promise<defines::display>* nex
return !switchScreenIsRequired;
}

void InventoryScreen::invalidOptionSelected() const {
std::cout << "Sorry, that option is not yet available." << std::endl;
}

void InventoryScreen::showProductsEmptyPopup() {
std::cout << "Products record is empty." << std::endl;
}
Expand Down
2 changes: 0 additions & 2 deletions orchestra/application/screen/backoffice/inventoryscreen.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,8 @@ class InventoryScreen : public screen::ScreenInterface,
void showLandingScreen() const;
void queryProductsList();
void showProducts() const;
void showOptions() const;
Options getUserSelection();
bool action(Options option, std::promise<defines::display>* nextScreen);
void invalidOptionSelected() const;
void showProductDetails(bool showIndex = false) const;
const std::string getEntityField(unsigned int index) const;
void removeProduct();
Expand Down

0 comments on commit c331293

Please sign in to comment.