|
#include "Home.h"
|
|
#include <Wt/WBootstrapTheme>
|
|
#include <Wt/WNavigationBar>
|
|
#include <Wt/WStackedWidget>
|
|
#include <Wt/WTemplate>
|
|
#include <Wt/WAnchor>
|
|
#include <Wt/WLink>
|
|
#include <Wt/WText>
|
|
#include <Wt/WMenu>
|
|
#include <Wt/WPushButton>
|
|
#include <Wt/Auth/AuthModel>
|
|
#include <Wt/Auth/AuthWidget>
|
|
#include "../Session.h"
|
|
#include "../Account/AuthWidget.h"
|
|
#include "../View/EducationLevelModelFormView.h"
|
|
#include "../View/FamilySizeModelFormView.h"
|
|
#include "../View/GenderModelFormView.h"
|
|
#include "../View/IncomeLevelModelFormView.h"
|
|
#include "../View/OccupationModelFormView.h"
|
|
#include "../View/MaritalStatusModelFormView.h"
|
|
#include "../View/CountryModelFormView.h"
|
|
#include "../View/SkuCategoryModelFormView.h"
|
|
#include "../View/SkuBrandModelFormView.h"
|
|
#include "../View/SkuPackageModelFormView.h"
|
|
#include "../View/SkuMakeModelFormView.h"
|
|
#include "../View/SeasonModelFormView.h"
|
|
#include "../View/RegionModelFormView.h"
|
|
#include "../View/CountyModelFormView.h"
|
|
#include "../View/SubcountyModelFormView.h"
|
|
#include "../View/TownModelFormView.h"
|
|
#include "../View/EntreprenuerModelFormView.h"
|
|
#include "../View/EnterpriseModelFormView.h"
|
|
#include "../View/PersonnelModelFormView.h"
|
|
#include "../View/SkuModelFormView.h"
|
|
#include "../View/StoreModelFormView.h"
|
|
#include "../View/YesNoModelFormView.h"
|
|
#include "../View/AgentTypeModelFormView.h"
|
|
#include "../View/AgentStatusModelFormView.h"
|
|
#include "../View/AssignmentTypeModelFormView.h"
|
|
#include "../View/AgentModelFormView.h"
|
|
#include "../View/OrderStatusModelFormView.h"
|
|
#include "../View/OrderItemStatusModelFormView.h"
|
|
#include "../View/OrderModelFormView.h"
|
|
#include "../View/OrderItemModelFormView.h"
|
|
#include "../View/AgentAssignmentStatusModelFormView.h"
|
|
#include "../View/AgentAssignmentModelFormView.h"
|
|
#include "../View/AgentAssignmentTaskModelFormView.h"
|
|
#include "../View/WishlistModelFormView.h"
|
|
#include "../View/CartModelFormView.h"
|
|
#include "../View/MessageModelFormView.h"
|
|
#include "../View/Seller/SellerDsModelFormView.h"
|
|
#include "../View/Seller/SellerEntreprenuerModelFormView.h"
|
|
#include "../View/Seller/SellerEnterpriseModelFormView.h"
|
|
#include "../View/Seller/SellerPersonnelModelFormView.h"
|
|
#include "../View/Seller/SellerAgentModelFormView.h"
|
|
#include "../View/Seller/SellerStoreModelFormView.h"
|
|
#include "../View/Buyer/BuyerDsModelFormView.h"
|
|
#include "../View/HomePageModelFormView.h"
|
|
|
|
Home::Home(const Wt::WEnvironment& env, Session& session) : Wt::WApplication(env), session_(session)
|
|
{
|
|
Wt::WBootstrapTheme * p_wtTheme = new Wt::WBootstrapTheme();
|
|
p_wtTheme->setVersion(Wt::WBootstrapTheme::Version3);
|
|
setTheme(p_wtTheme);
|
|
setTitle("The BiZKiT");
|
|
messageResourceBundle().use("strings");
|
|
messageResourceBundle().use("templates");
|
|
useStyleSheet("resources/themes/bootstrap/3/ie10-viewport-bug-workaround.css");
|
|
useStyleSheet("resources/themes/bootstrap/3/navbar-fixed-top.css");
|
|
useStyleSheet("resources/themes/bootstrap/3/bootstrap.css");
|
|
useStyleSheet("resources/themes/bootstrap/3/chatwidget.css");
|
|
useStyleSheet("resources/themes/bootstrap/3/chatwidget_ie6.css", "lt IE 7", "all");
|
|
setLocale("");
|
|
language_ = 0;
|
|
|
|
}
|
|
|
|
void Home::init()
|
|
{
|
|
internalPathChanged().connect(this, &Home::setup);
|
|
internalPathChanged().connect(this, &Home::setLanguageFromPath);
|
|
//internalPathChanged().connect(this, &Home::logInternalPath);
|
|
|
|
createHome();
|
|
|
|
setLanguageFromPath();
|
|
}
|
|
|
|
void Home::setup()
|
|
{
|
|
/*if (!homePage_) {
|
|
std::cerr << this->internalPath() << " BLAH BLAH";
|
|
root()->clear();
|
|
createHome();
|
|
root()->addWidget(homePage_);
|
|
}*/
|
|
|
|
//if (this->internalPath() == "/sellerds")
|
|
//{
|
|
// root()->clear();
|
|
// createHome();
|
|
// /*root()->clear();
|
|
// WTemplate *result = new WTemplate(tr("template.homepage"), root());
|
|
// homePage_ = result;
|
|
// result->bindWidget("contents", createSellerds());*/
|
|
//}
|
|
//else if (this->internalPath() == "/buyerds")
|
|
//{
|
|
// root()->clear();
|
|
// createHome();
|
|
// /*root()->clear();
|
|
// WTemplate *result = new WTemplate(tr("template.homepage"), root());
|
|
// homePage_ = result;
|
|
// result->bindWidget("contents", createSellerds());*/
|
|
//}
|
|
//else
|
|
//{
|
|
// createHome();
|
|
//}
|
|
root()->clear();
|
|
createHome();
|
|
root()->addWidget(homePage_);
|
|
}
|
|
|
|
void Home::createHome()
|
|
{
|
|
try{
|
|
WTemplate *result = new WTemplate(tr("template.homepage"), root());
|
|
homePage_ = result;
|
|
|
|
//std::cerr << std::endl << this->internalPath() << " BLAH BLAH" << std::endl;
|
|
|
|
WContainerWidget *languagesDiv = new WContainerWidget();
|
|
languagesDiv->setId("top_languages");
|
|
|
|
for (unsigned i = 0; i < languages.size(); ++i) {
|
|
if (i != 0)
|
|
new WText("- ", languagesDiv);
|
|
|
|
const Lang& l = languages[i];
|
|
|
|
WAnchor *langAnchor = new WAnchor(WLink(WLink::InternalPath, l.path_),
|
|
WString::fromUTF8(l.longDescription_), languagesDiv);
|
|
langAnchor->addStyleClass("txtwhite");
|
|
}
|
|
|
|
Wt::WNavigationBar *navigationBar = new Wt::WNavigationBar();
|
|
navigationBar->addStyleClass(Wt::WString::fromUTF8("navbar navbar-default"));
|
|
navigationBar->setInline(0);
|
|
navigationBar->setResponsive("1");
|
|
|
|
WStackedWidget *contents = new WStackedWidget();
|
|
WAnimation fade(WAnimation::Fade, WAnimation::Linear, 250);
|
|
contents->setTransitionAnimation(fade);
|
|
contents->setId("main_page");
|
|
contents->addStyleClass("contents spacermargin bgwhite");
|
|
|
|
mainMenu_ = new WMenu(contents, Horizontal);
|
|
|
|
//mainMenu_->addItem(tr("home"), new WText(tr("product-sample")))->setPathComponent("");
|
|
mainMenu_->addItem(tr("home"), showHomePage())->setPathComponent("");
|
|
mainMenu_->addItem(tr("shop-collection"), status(),
|
|
WMenuItem::PreLoading)->setPathComponent("shop-collection");
|
|
mainMenu_->addItem(tr("seasons-theme"), status(),
|
|
WMenuItem::PreLoading)->setPathComponent("seasons-theme");
|
|
mainMenu_->addItem(tr("tech-discovery"), status(),
|
|
WMenuItem::PreLoading)->setPathComponent("tech-discovery");
|
|
mainMenu_->addItem(tr("faqs"), status(),
|
|
WMenuItem::PreLoading)->setPathComponent("faqs");
|
|
|
|
mainMenu_->setInternalPathEnabled("/");
|
|
//mainMenu_->setInternalBasePath("/");
|
|
|
|
navigationBar->addMenu(mainMenu_, Wt::AlignLeft);
|
|
|
|
session_.login().changed().connect(this, &Home::AuthEvent);
|
|
accountMenu_ = new WMenu(contents, Horizontal);
|
|
usermenu_ = new Wt::WMenuItem(tr("menu-account"));
|
|
accountpopup_ = new Wt::WPopupMenu(contents);
|
|
|
|
signin_ = new Wt::WMenuItem(tr("menu-signin"), createLogin(), WMenuItem::LazyLoading);
|
|
//signin_->setPathComponent(tr("path-signin").toUTF8());
|
|
signin_->setLink(Wt::WLink(Wt::WLink::InternalPath, tr("path-signin").toUTF8()));
|
|
|
|
buyerds_ = new Wt::WMenuItem(tr("menu-buyerds"), createBuyerds(), WMenuItem::LazyLoading);
|
|
//buyerds_->setPathComponent("buyerds");
|
|
buyerds_->setLink(Wt::WLink(Wt::WLink::InternalPath, tr("path-buyerds").toUTF8()));
|
|
|
|
sellerds_ = new Wt::WMenuItem(tr("menu-sellerds"), createSellerds(), WMenuItem::LazyLoading);
|
|
//sellerds_->setPathComponent("sellerds");
|
|
sellerds_->setLink(Wt::WLink(Wt::WLink::InternalPath, tr("path-sellerds").toUTF8()));
|
|
|
|
profile_ = new Wt::WMenuItem(tr("menu-profile"), new WText("Profile"), WMenuItem::LazyLoading);
|
|
//profile_->setPathComponent("profile");
|
|
profile_->setLink(Wt::WLink(Wt::WLink::InternalPath, tr("path-profile").toUTF8()));
|
|
|
|
signout_ = new Wt::WMenuItem(tr("menu-signout"));
|
|
signout_->clicked().connect(this, &Home::SignedOut);
|
|
//signout_->setPathComponent("");
|
|
signout_->setLink(Wt::WLink(Wt::WLink::InternalPath, ""));
|
|
|
|
register_ = new Wt::WMenuItem(tr("menu-register"), new WText("Register"), WMenuItem::PreLoading);
|
|
//register_->setPathComponent("register");
|
|
//register_->setLink(Wt::WLink(Wt::WLink::InternalPath, tr("path-register"));
|
|
|
|
accountpopup_->addItem(signin_);
|
|
accountpopup_->addItem(profile_);
|
|
accountpopup_->addItem(buyerds_);
|
|
accountpopup_->addItem(sellerds_);
|
|
accountpopup_->addSeparator();
|
|
accountpopup_->addItem(register_);
|
|
accountpopup_->addItem(signout_);
|
|
usermenu_->setMenu(accountpopup_);
|
|
accountMenu_->addItem(usermenu_);
|
|
//accountMenu_->setInternalPathEnabled("").toUTF8());
|
|
|
|
AuthAction();
|
|
|
|
accountpopup_->itemSelected().connect(std::bind([=](Wt::WMenuItem *item)
|
|
{
|
|
if (session_.login().loggedIn() && item->text() == tr("path-signout").toUTF8())
|
|
{
|
|
session_.login().logout();
|
|
}
|
|
|
|
}, std::placeholders::_1));
|
|
|
|
result->bindWidget("languages", languagesDiv);
|
|
result->bindWidget("menu", navigationBar);
|
|
result->bindWidget("accountmenu", accountMenu_);
|
|
|
|
if (this->internalPath() == tr("path-sellerds").toUTF8())
|
|
{
|
|
result->bindWidget("contents", createSellerds());
|
|
}
|
|
else if (this->internalPath() == tr("path-buyerds").toUTF8())
|
|
{
|
|
result->bindWidget("contents", createBuyerds());
|
|
}
|
|
else if (this->internalPath() == tr("path-adminds").toUTF8())
|
|
{
|
|
result->bindWidget("contents", createAdminds());
|
|
}
|
|
else if (this->internalPath() == tr("path-educationlevel").toUTF8())
|
|
{
|
|
result->bindWidget("contents", showEducationLevel());
|
|
}
|
|
else if (this->internalPath() == tr("path-familysize").toUTF8())
|
|
{
|
|
result->bindWidget("contents", showFamilySize());
|
|
}
|
|
else if (this->internalPath() == tr("path-gender").toUTF8())
|
|
{
|
|
result->bindWidget("contents", showGender());
|
|
}
|
|
else if (this->internalPath() == tr("path-incomelevel").toUTF8())
|
|
{
|
|
result->bindWidget("contents", showIncomeLevel());
|
|
}
|
|
else if (this->internalPath() == tr("path-occupation").toUTF8())
|
|
{
|
|
result->bindWidget("contents", showOccupation());
|
|
}
|
|
else if (this->internalPath() == tr("path-maritalstatus").toUTF8())
|
|
{
|
|
result->bindWidget("contents", showMaritalStatus());
|
|
}
|
|
else if (this->internalPath() == tr("path-country").toUTF8())
|
|
{
|
|
result->bindWidget("contents", showCountry());
|
|
}
|
|
else if (this->internalPath() == tr("path-skucategory").toUTF8())
|
|
{
|
|
result->bindWidget("contents", showSkuCategory());
|
|
}
|
|
else if (this->internalPath() == tr("path-skubrand").toUTF8())
|
|
{
|
|
result->bindWidget("contents", showSkuBrand());
|
|
}
|
|
else if (this->internalPath() == tr("path-skupackage").toUTF8())
|
|
{
|
|
result->bindWidget("contents", showSkuPackage());
|
|
}
|
|
else if (this->internalPath() == tr("path-skumake").toUTF8())
|
|
{
|
|
result->bindWidget("contents", showSkuMake());
|
|
}
|
|
else if (this->internalPath() == tr("path-season").toUTF8())
|
|
{
|
|
result->bindWidget("contents", showSeason());
|
|
}
|
|
else if (this->internalPath() == tr("path-region").toUTF8())
|
|
{
|
|
result->bindWidget("contents", showRegion());
|
|
}
|
|
else if (this->internalPath() == tr("path-county").toUTF8())
|
|
{
|
|
result->bindWidget("contents", showCounty());
|
|
}
|
|
else if (this->internalPath() == tr("path-subcounty").toUTF8())
|
|
{
|
|
result->bindWidget("contents", showSubcounty());
|
|
}
|
|
else if (this->internalPath() == tr("path-town").toUTF8())
|
|
{
|
|
result->bindWidget("contents", showTown());
|
|
}
|
|
else if (this->internalPath() == tr("path-entreprenuer").toUTF8())
|
|
{
|
|
result->bindWidget("contents", showEntreprenuer());
|
|
}
|
|
else if (this->internalPath() == tr("path-enterprise").toUTF8())
|
|
{
|
|
result->bindWidget("contents", showEnterprise());
|
|
}
|
|
else if (this->internalPath() == tr("path-personnel").toUTF8())
|
|
{
|
|
result->bindWidget("contents", showPersonnel());
|
|
}
|
|
else if (this->internalPath() == tr("path-sku").toUTF8())
|
|
{
|
|
result->bindWidget("contents", showSku());
|
|
}
|
|
else if (this->internalPath() == tr("path-store").toUTF8())
|
|
{
|
|
result->bindWidget("contents", showStore());
|
|
}
|
|
else if (this->internalPath() == tr("path-yesno").toUTF8())
|
|
{
|
|
result->bindWidget("contents", showYesNo());
|
|
}
|
|
else if (this->internalPath() == tr("path-agenttype").toUTF8())
|
|
{
|
|
result->bindWidget("contents", showAgentType());
|
|
}
|
|
else if (this->internalPath() == tr("path-agentstatus").toUTF8())
|
|
{
|
|
result->bindWidget("contents", showAgentStatus());
|
|
}
|
|
else if (this->internalPath() == tr("path-assignmenttype").toUTF8())
|
|
{
|
|
result->bindWidget("contents", showAssignmentType());
|
|
}
|
|
else if (this->internalPath() == tr("path-agent").toUTF8())
|
|
{
|
|
result->bindWidget("contents", showAgent());
|
|
}
|
|
else if (this->internalPath() == tr("path-orderstatus").toUTF8())
|
|
{
|
|
result->bindWidget("contents", showOrderStatus());
|
|
}
|
|
else if (this->internalPath() == tr("path-orderitemstatus").toUTF8())
|
|
{
|
|
result->bindWidget("contents", showOrderItemStatus());
|
|
}
|
|
else if (this->internalPath() == tr("path-order").toUTF8())
|
|
{
|
|
result->bindWidget("contents", showOrder());
|
|
}
|
|
else if (this->internalPath() == tr("path-orderitem").toUTF8())
|
|
{
|
|
result->bindWidget("contents", showOrderItem());
|
|
}
|
|
else if (this->internalPath() == tr("path-agentassignmentstatus").toUTF8())
|
|
{
|
|
result->bindWidget("contents", showAgentAssignmentStatus());
|
|
}
|
|
else if (this->internalPath() == tr("path-agentassignment").toUTF8())
|
|
{
|
|
result->bindWidget("contents", showAgentAssignment());
|
|
}
|
|
else if (this->internalPath() == tr("path-agentassignmenttask").toUTF8())
|
|
{
|
|
result->bindWidget("contents", showAgentAssignmentTask());
|
|
}
|
|
else if (this->internalPath() == tr("path-wishlist").toUTF8())
|
|
{
|
|
result->bindWidget("contents", showWishlist());
|
|
}
|
|
else if (this->internalPath() == tr("path-cart").toUTF8())
|
|
{
|
|
result->bindWidget("contents", showCart());
|
|
}
|
|
else if (this->internalPath() == tr("path-message").toUTF8())
|
|
{
|
|
result->bindWidget("contents", showMessage());
|
|
}
|
|
else if (this->internalPath() == tr("path-sellerentreprenuer").toUTF8())
|
|
{
|
|
result->bindWidget("contents", showSellerEntreprenuer());
|
|
}
|
|
else if (this->internalPath() == tr("path-sellerenterprise").toUTF8())
|
|
{
|
|
result->bindWidget("contents", showSellerEnterprise());
|
|
}
|
|
else if (this->internalPath() == tr("path-sellerpersonnel").toUTF8())
|
|
{
|
|
result->bindWidget("contents", showSellerPersonnel());
|
|
}
|
|
else if (this->internalPath() == tr("path-selleragent").toUTF8())
|
|
{
|
|
result->bindWidget("contents", showSellerAgent());
|
|
}
|
|
else if (this->internalPath() == tr("path-sellerstore").toUTF8())
|
|
{
|
|
result->bindWidget("contents", showSellerStore());
|
|
}
|
|
else if (this->internalPath() == tr("path-home").toUTF8())
|
|
{
|
|
result->bindWidget("contents", showHomePage());
|
|
}
|
|
else if (this->internalPath() == tr("path-signin").toUTF8())
|
|
{
|
|
result->bindWidget("contents", createLogin());
|
|
}
|
|
else
|
|
{
|
|
result->bindWidget("contents", contents);
|
|
}
|
|
|
|
}
|
|
catch (Wt::Dbo::Exception &e) {
|
|
std::cerr << "Dbo exception: " << e.what() << std::endl;
|
|
}
|
|
catch (std::exception &e) {
|
|
std::cerr << "exception: " << e.what() << std::endl;
|
|
}
|
|
|
|
doJavaScript("setTimeout(function() { loadScript('http://127.0.0.1:8082/chat.js?div=chat', null); }, 0); ");
|
|
}
|
|
|
|
void Home::setLanguage(int index)
|
|
{
|
|
/*if (homePage_) {
|
|
const Lang& l = languages[index];
|
|
|
|
setLocale(l.code_);
|
|
|
|
std::string langPath = l.path_;
|
|
mainMenu_->setInternalBasePath(langPath);
|
|
examplesMenu_->setInternalBasePath(langPath + "examples");
|
|
BlogView *blog = dynamic_cast<BlogView *>(findWidget("blog"));
|
|
if (blog)
|
|
blog->setInternalBasePath(langPath + "blog/");
|
|
updateTitle();
|
|
|
|
language_ = index;
|
|
}*/
|
|
}
|
|
|
|
void Home::setLanguageFromPath()
|
|
{
|
|
/*std::string langPath = internalPathNextPart("/");
|
|
|
|
if (langPath.empty())
|
|
langPath = '/';
|
|
else
|
|
langPath = '/' + langPath + '/';
|
|
|
|
int newLanguage = 0;
|
|
|
|
for (unsigned i = 0; i < languages.size(); ++i) {
|
|
if (languages[i].path_ == langPath) {
|
|
newLanguage = i;
|
|
break;
|
|
}
|
|
}
|
|
|
|
if (newLanguage != language_)
|
|
setLanguage(newLanguage);*/
|
|
}
|
|
|
|
void Home::chatSetUser(const WString& userName)
|
|
{
|
|
WApplication::instance()->doJavaScript
|
|
("if (window.chat && window.chat.emit) {"
|
|
"""try {"
|
|
"" "window.chat.emit(window.chat, 'login', "
|
|
"" "" + userName.jsStringLiteral() + "); "
|
|
"""} catch (e) {"
|
|
"" "window.chatUser=" + userName.jsStringLiteral() + ";"
|
|
"""}"
|
|
"} else "
|
|
"""window.chatUser=" + userName.jsStringLiteral() + ";");
|
|
}
|
|
|
|
WString Home::tr(const char *key)
|
|
{
|
|
return WString::tr(key);
|
|
}
|
|
|
|
WWidget *Home::status()
|
|
{
|
|
return new WText("Status");
|
|
}
|
|
|
|
WWidget *Home::createLogin()
|
|
{
|
|
AuthWidget *authWidget = new AuthWidget(session_);
|
|
|
|
authWidget->model()->addPasswordAuth(&Session::passwordAuth());
|
|
authWidget->model()->addOAuth(Session::oAuth());
|
|
authWidget->setRegistrationEnabled(true);
|
|
|
|
authWidget->processEnvironment();
|
|
return authWidget;
|
|
|
|
}
|
|
|
|
WWidget *Home::createSellerds()
|
|
{
|
|
SellerDsModelFormView *view = new SellerDsModelFormView(session_);
|
|
|
|
return view;
|
|
/*WTemplate *result = new WTemplate(tr("template.sellerds"));
|
|
Wt::WPushButton *btnbuyerds = new Wt::WPushButton(Wt::WString::fromUTF8("<span>Switch to buyer dashboard</span> <span class = 'glyphicon glyphicon-share-alt'> </span>"), Wt::TextFormat::XHTMLUnsafeText);
|
|
btnbuyerds->addStyleClass("btn btn-info productblock spacerpadding");
|
|
result->bindWidget("btnbuyerds", btnbuyerds);
|
|
|
|
btnbuyerds->setLink(Wt::WLink(Wt::WLink::InternalPath, "/buyerds"));
|
|
return result;*/
|
|
|
|
}
|
|
|
|
WWidget *Home::createBuyerds()
|
|
{
|
|
BuyerDsModelFormView *view = new BuyerDsModelFormView(session_);
|
|
|
|
return view;
|
|
/*WTemplate *result = new WTemplate(tr("Wt.Auth.template.logged-in"));
|
|
Wt::WPushButton *btnsellerds = new Wt::WPushButton(Wt::WString::fromUTF8("<span>Switch to seller dashboard</span> <span class = 'glyphicon glyphicon-share-alt'> </span>"), Wt::TextFormat::XHTMLUnsafeText);
|
|
btnsellerds->addStyleClass("btn btn-info productblock spacerpadding");
|
|
result->bindWidget("btnsellerds", btnsellerds);
|
|
|
|
btnsellerds->setLink(Wt::WLink(Wt::WLink::InternalPath, "/sellerds"));
|
|
|
|
return result;*/
|
|
|
|
}
|
|
|
|
WWidget *Home::createAdminds()
|
|
{
|
|
WTemplate *result = new WTemplate(tr("template.adminds"));
|
|
Wt::WAnchor *lnkEducationLevel = new Wt::WAnchor(Wt::WLink(Wt::WLink::InternalPath, tr("path-educationlevel").toUTF8()));
|
|
lnkEducationLevel->setText("Education");
|
|
result->bindWidget("lnkEducationLevel", lnkEducationLevel);
|
|
|
|
Wt::WAnchor *lnkFamilySize = new Wt::WAnchor(Wt::WLink(Wt::WLink::InternalPath, tr("path-familysize").toUTF8()));
|
|
lnkFamilySize->setText("Family Size");
|
|
result->bindWidget("lnkFamilySize", lnkFamilySize);
|
|
|
|
Wt::WAnchor *lnkGender = new Wt::WAnchor(Wt::WLink(Wt::WLink::InternalPath, tr("path-gender").toUTF8()));
|
|
lnkGender->setText("Gender");
|
|
result->bindWidget("lnkGender", lnkGender);
|
|
|
|
Wt::WAnchor *lnkIncomeLevel = new Wt::WAnchor(Wt::WLink(Wt::WLink::InternalPath, tr("path-incomelevel").toUTF8()));
|
|
lnkIncomeLevel->setText("Income Level");
|
|
result->bindWidget("lnkIncomeLevel", lnkIncomeLevel);
|
|
|
|
Wt::WAnchor *lnkOccupation = new Wt::WAnchor(Wt::WLink(Wt::WLink::InternalPath, tr("path-occupation").toUTF8()));
|
|
lnkOccupation->setText("Occupation");
|
|
result->bindWidget("lnkOccupation", lnkOccupation);
|
|
|
|
Wt::WAnchor *lnkMaritalStatus = new Wt::WAnchor(Wt::WLink(Wt::WLink::InternalPath, tr("path-maritalstatus").toUTF8()));
|
|
lnkMaritalStatus->setText("Marital Status");
|
|
result->bindWidget("lnkMaritalStatus", lnkMaritalStatus);
|
|
|
|
Wt::WAnchor *lnkSeason = new Wt::WAnchor(Wt::WLink(Wt::WLink::InternalPath, tr("path-season").toUTF8()));
|
|
lnkSeason->setText("Season");
|
|
result->bindWidget("lnkSeason", lnkSeason);
|
|
|
|
Wt::WAnchor *lnkCountry = new Wt::WAnchor(Wt::WLink(Wt::WLink::InternalPath, tr("path-country").toUTF8()));
|
|
lnkCountry->setText("Country");
|
|
result->bindWidget("lnkCountry", lnkCountry);
|
|
|
|
Wt::WAnchor *lnkRegion = new Wt::WAnchor(Wt::WLink(Wt::WLink::InternalPath, tr("path-region").toUTF8()));
|
|
lnkRegion->setText("Region");
|
|
result->bindWidget("lnkRegion", lnkRegion);
|
|
|
|
Wt::WAnchor *lnkCounty = new Wt::WAnchor(Wt::WLink(Wt::WLink::InternalPath, tr("path-county").toUTF8()));
|
|
lnkCounty->setText("County");
|
|
result->bindWidget("lnkCounty", lnkCounty);
|
|
|
|
Wt::WAnchor *lnkSubcounty = new Wt::WAnchor(Wt::WLink(Wt::WLink::InternalPath, tr("path-subcounty").toUTF8()));
|
|
lnkSubcounty->setText("Subcounty");
|
|
result->bindWidget("lnkSubcounty", lnkSubcounty);
|
|
|
|
Wt::WAnchor *lnkTown = new Wt::WAnchor(Wt::WLink(Wt::WLink::InternalPath, tr("path-town").toUTF8()));
|
|
lnkTown->setText("Town");
|
|
result->bindWidget("lnkTown", lnkTown);
|
|
|
|
Wt::WAnchor *lnkEntreprenuer = new Wt::WAnchor(Wt::WLink(Wt::WLink::InternalPath, tr("path-entreprenuer").toUTF8()));
|
|
lnkEntreprenuer->setText("Entreprenuer");
|
|
result->bindWidget("lnkEntreprenuer", lnkEntreprenuer);
|
|
|
|
Wt::WAnchor *lnkEnterprise = new Wt::WAnchor(Wt::WLink(Wt::WLink::InternalPath, tr("path-enterprise").toUTF8()));
|
|
lnkEnterprise->setText("Enterprise");
|
|
result->bindWidget("lnkEnterprise", lnkEnterprise);
|
|
|
|
Wt::WAnchor *lnkPersonnel = new Wt::WAnchor(Wt::WLink(Wt::WLink::InternalPath, tr("path-personnel").toUTF8()));
|
|
lnkPersonnel->setText("Personnel");
|
|
result->bindWidget("lnkPersonnel", lnkPersonnel);
|
|
|
|
Wt::WAnchor *lnkStore = new Wt::WAnchor(Wt::WLink(Wt::WLink::InternalPath, tr("path-store").toUTF8()));
|
|
lnkStore->setText("Store");
|
|
result->bindWidget("lnkStore", lnkStore);
|
|
|
|
Wt::WAnchor *lnkSkuCategory = new Wt::WAnchor(Wt::WLink(Wt::WLink::InternalPath, tr("path-skucategory").toUTF8()));
|
|
lnkSkuCategory->setText("Category");
|
|
result->bindWidget("lnkSkuCategory", lnkSkuCategory);
|
|
|
|
Wt::WAnchor *lnkSkuBrand = new Wt::WAnchor(Wt::WLink(Wt::WLink::InternalPath, tr("path-skubrand").toUTF8()));
|
|
lnkSkuBrand->setText("Brand");
|
|
result->bindWidget("lnkSkuBrand", lnkSkuBrand);
|
|
|
|
Wt::WAnchor *lnkSkuPackage = new Wt::WAnchor(Wt::WLink(Wt::WLink::InternalPath, tr("path-skupackage").toUTF8()));
|
|
lnkSkuPackage->setText("Package");
|
|
result->bindWidget("lnkSkuPackage", lnkSkuPackage);
|
|
|
|
Wt::WAnchor *lnkSkuMake = new Wt::WAnchor(Wt::WLink(Wt::WLink::InternalPath, tr("path-skumake").toUTF8()));
|
|
lnkSkuMake->setText("Make");
|
|
result->bindWidget("lnkSkuMake", lnkSkuMake);
|
|
|
|
Wt::WAnchor *lnkSku = new Wt::WAnchor(Wt::WLink(Wt::WLink::InternalPath, tr("path-sku").toUTF8()));
|
|
lnkSku->setText("SKUs");
|
|
result->bindWidget("lnkSku", lnkSku);
|
|
|
|
Wt::WAnchor *lnkAgent = new Wt::WAnchor(Wt::WLink(Wt::WLink::InternalPath, tr("path-agent").toUTF8()));
|
|
lnkAgent->setText("Agent");
|
|
result->bindWidget("lnkAgent", lnkAgent);
|
|
|
|
Wt::WAnchor *lnkAgentAssignment = new Wt::WAnchor(Wt::WLink(Wt::WLink::InternalPath, tr("path-agentassignment").toUTF8()));
|
|
lnkAgentAssignment->setText("Agent Assignment");
|
|
result->bindWidget("lnkAgentAssignment", lnkAgentAssignment);
|
|
|
|
Wt::WAnchor *lnkAgentAssignmentTask = new Wt::WAnchor(Wt::WLink(Wt::WLink::InternalPath, tr("path-agentassignmenttask").toUTF8()));
|
|
lnkAgentAssignmentTask->setText("Agent Assignment Task");
|
|
result->bindWidget("lnkAgentAssignmentTask", lnkAgentAssignmentTask);
|
|
|
|
Wt::WAnchor *lnkWishlist = new Wt::WAnchor(Wt::WLink(Wt::WLink::InternalPath, tr("path-wishlist").toUTF8()));
|
|
lnkWishlist->setText("Wishlist");
|
|
result->bindWidget("lnkWishlist", lnkWishlist);
|
|
|
|
Wt::WAnchor *lnkCart = new Wt::WAnchor(Wt::WLink(Wt::WLink::InternalPath, tr("path-cart").toUTF8()));
|
|
lnkCart->setText("Cart");
|
|
result->bindWidget("lnkCart", lnkCart);
|
|
|
|
Wt::WAnchor *lnkOrder = new Wt::WAnchor(Wt::WLink(Wt::WLink::InternalPath, tr("path-order").toUTF8()));
|
|
lnkOrder->setText("Orders");
|
|
result->bindWidget("lnkOrder", lnkOrder);
|
|
|
|
Wt::WAnchor *lnkOrderItem = new Wt::WAnchor(Wt::WLink(Wt::WLink::InternalPath, tr("path-orderitem").toUTF8()));
|
|
lnkOrderItem->setText("Order Items");
|
|
result->bindWidget("lnkOrderItem", lnkOrderItem);
|
|
|
|
Wt::WAnchor *lnkMessage = new Wt::WAnchor(Wt::WLink(Wt::WLink::InternalPath, tr("path-message").toUTF8()));
|
|
lnkMessage->setText("Message");
|
|
result->bindWidget("lnkMessage", lnkMessage);
|
|
|
|
Wt::WAnchor *lnkYesNo = new Wt::WAnchor(Wt::WLink(Wt::WLink::InternalPath, tr("path-yesno").toUTF8()));
|
|
lnkYesNo->setText("Yes/No");
|
|
result->bindWidget("lnkYesNo", lnkYesNo);
|
|
|
|
Wt::WAnchor *lnkAgentType = new Wt::WAnchor(Wt::WLink(Wt::WLink::InternalPath, tr("path-agenttype").toUTF8()));
|
|
lnkAgentType->setText("Agent Type");
|
|
result->bindWidget("lnkAgentType", lnkAgentType);
|
|
|
|
Wt::WAnchor *lnkAgentStatus = new Wt::WAnchor(Wt::WLink(Wt::WLink::InternalPath, tr("path-agentstatus").toUTF8()));
|
|
lnkAgentStatus->setText("Agent Status");
|
|
result->bindWidget("lnkAgentStatus", lnkAgentStatus);
|
|
|
|
Wt::WAnchor *lnkAssignmentType = new Wt::WAnchor(Wt::WLink(Wt::WLink::InternalPath, tr("path-assignmenttype").toUTF8()));
|
|
lnkAssignmentType->setText("Assignment Type");
|
|
result->bindWidget("lnkAssignmentType", lnkAssignmentType);
|
|
|
|
Wt::WAnchor *lnkAgentAssignmentStatus = new Wt::WAnchor(Wt::WLink(Wt::WLink::InternalPath, tr("path-agentassignmentstatus").toUTF8()));
|
|
lnkAgentAssignmentStatus->setText("Agent Assignment Status");
|
|
result->bindWidget("lnkAgentAssignmentStatus", lnkAgentAssignmentStatus);
|
|
|
|
Wt::WAnchor *lnkOrderStatus = new Wt::WAnchor(Wt::WLink(Wt::WLink::InternalPath, tr("path-orderstatus").toUTF8()));
|
|
lnkOrderStatus->setText("Order Status");
|
|
result->bindWidget("lnkOrderStatus", lnkOrderStatus);
|
|
|
|
Wt::WAnchor *lnkOrderItemStatus = new Wt::WAnchor(Wt::WLink(Wt::WLink::InternalPath, tr("path-orderitemstatus").toUTF8()));
|
|
lnkOrderItemStatus->setText("Order Item Status");
|
|
result->bindWidget("lnkOrderItemStatus", lnkOrderItemStatus);
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
WWidget *Home::showEducationLevel()
|
|
{
|
|
EducationLevelModelFormView *view = new EducationLevelModelFormView(session_);
|
|
|
|
return view;
|
|
|
|
}
|
|
|
|
WWidget *Home::showFamilySize()
|
|
{
|
|
FamilySizeModelFormView *view = new FamilySizeModelFormView(session_);
|
|
|
|
return view;
|
|
|
|
}
|
|
|
|
WWidget *Home::showGender()
|
|
{
|
|
GenderModelFormView *view = new GenderModelFormView(session_);
|
|
|
|
return view;
|
|
|
|
}
|
|
|
|
WWidget *Home::showIncomeLevel()
|
|
{
|
|
IncomeLevelModelFormView *view = new IncomeLevelModelFormView(session_);
|
|
|
|
return view;
|
|
|
|
}
|
|
|
|
WWidget *Home::showOccupation()
|
|
{
|
|
OccupationModelFormView *view = new OccupationModelFormView(session_);
|
|
|
|
return view;
|
|
|
|
}
|
|
|
|
WWidget *Home::showMaritalStatus()
|
|
{
|
|
MaritalStatusModelFormView *view = new MaritalStatusModelFormView(session_);
|
|
|
|
return view;
|
|
|
|
}
|
|
|
|
WWidget *Home::showCountry()
|
|
{
|
|
CountryModelFormView *view = new CountryModelFormView(session_);
|
|
|
|
return view;
|
|
|
|
}
|
|
|
|
WWidget *Home::showSkuCategory()
|
|
{
|
|
SkuCategoryModelFormView *view = new SkuCategoryModelFormView(session_);
|
|
|
|
return view;
|
|
|
|
}
|
|
|
|
WWidget *Home::showSkuBrand()
|
|
{
|
|
SkuBrandModelFormView *view = new SkuBrandModelFormView(session_);
|
|
|
|
return view;
|
|
|
|
}
|
|
|
|
WWidget *Home::showSkuPackage()
|
|
{
|
|
SkuPackageModelFormView *view = new SkuPackageModelFormView(session_);
|
|
|
|
return view;
|
|
|
|
}
|
|
|
|
WWidget *Home::showSkuMake()
|
|
{
|
|
SkuMakeModelFormView *view = new SkuMakeModelFormView(session_);
|
|
|
|
return view;
|
|
|
|
}
|
|
|
|
WWidget *Home::showSeason()
|
|
{
|
|
SeasonModelFormView *view = new SeasonModelFormView(session_);
|
|
|
|
return view;
|
|
|
|
}
|
|
|
|
WWidget *Home::showRegion()
|
|
{
|
|
RegionModelFormView *view = new RegionModelFormView(session_);
|
|
|
|
return view;
|
|
|
|
}
|
|
|
|
WWidget *Home::showCounty()
|
|
{
|
|
CountyModelFormView *view = new CountyModelFormView(session_);
|
|
|
|
return view;
|
|
|
|
}
|
|
|
|
WWidget *Home::showSubcounty()
|
|
{
|
|
SubcountyModelFormView *view = new SubcountyModelFormView(session_);
|
|
|
|
return view;
|
|
|
|
}
|
|
|
|
WWidget *Home::showTown()
|
|
{
|
|
TownModelFormView *view = new TownModelFormView(session_);
|
|
|
|
return view;
|
|
|
|
}
|
|
|
|
WWidget *Home::showEntreprenuer()
|
|
{
|
|
EntreprenuerModelFormView *view = new EntreprenuerModelFormView(session_);
|
|
|
|
return view;
|
|
|
|
}
|
|
|
|
WWidget *Home::showEnterprise()
|
|
{
|
|
EnterpriseModelFormView *view = new EnterpriseModelFormView(session_);
|
|
|
|
return view;
|
|
}
|
|
|
|
WWidget *Home::showPersonnel()
|
|
{
|
|
PersonnelModelFormView *view = new PersonnelModelFormView(session_);
|
|
|
|
return view;
|
|
}
|
|
|
|
WWidget *Home::showSku()
|
|
{
|
|
SkuModelFormView *view = new SkuModelFormView(session_);
|
|
|
|
return view;
|
|
}
|
|
|
|
WWidget *Home::showStore()
|
|
{
|
|
StoreModelFormView *view = new StoreModelFormView(session_);
|
|
|
|
return view;
|
|
}
|
|
|
|
WWidget *Home::showYesNo()
|
|
{
|
|
YesNoModelFormView *view = new YesNoModelFormView(session_);
|
|
|
|
return view;
|
|
}
|
|
|
|
WWidget *Home::showAgentType()
|
|
{
|
|
AgentTypeModelFormView *view = new AgentTypeModelFormView(session_);
|
|
|
|
return view;
|
|
}
|
|
|
|
WWidget *Home::showAssignmentType()
|
|
{
|
|
AssignmentTypeModelFormView *view = new AssignmentTypeModelFormView(session_);
|
|
|
|
return view;
|
|
}
|
|
|
|
WWidget * Home::showAgent()
|
|
{
|
|
AgentModelFormView *view = new AgentModelFormView(session_);
|
|
|
|
return view;
|
|
}
|
|
|
|
WWidget * Home::showAgentAssignment()
|
|
{
|
|
AgentAssignmentModelFormView *view = new AgentAssignmentModelFormView(session_);
|
|
|
|
return view;
|
|
}
|
|
|
|
WWidget * Home::showAgentAssignmentTask()
|
|
{
|
|
AgentAssignmentTaskModelFormView *view = new AgentAssignmentTaskModelFormView(session_);
|
|
|
|
return view;
|
|
}
|
|
|
|
WWidget *Home::showWishlist()
|
|
{
|
|
WishlistModelFormView *view = new WishlistModelFormView(session_);
|
|
|
|
return view;
|
|
}
|
|
|
|
WWidget *Home::showCart()
|
|
{
|
|
CartModelFormView *view = new CartModelFormView(session_);
|
|
|
|
return view;
|
|
}
|
|
|
|
WWidget *Home::showAgentStatus()
|
|
{
|
|
AgentStatusModelFormView *view = new AgentStatusModelFormView(session_);
|
|
|
|
return view;
|
|
}
|
|
|
|
WWidget *Home::showOrderStatus()
|
|
{
|
|
OrderStatusModelFormView *view = new OrderStatusModelFormView(session_);
|
|
|
|
return view;
|
|
}
|
|
|
|
WWidget *Home::showOrderItemStatus()
|
|
{
|
|
OrderItemStatusModelFormView *view = new OrderItemStatusModelFormView(session_);
|
|
|
|
return view;
|
|
}
|
|
|
|
WWidget *Home::showOrder()
|
|
{
|
|
OrderModelFormView *view = new OrderModelFormView(session_);
|
|
|
|
return view;
|
|
}
|
|
|
|
WWidget *Home::showOrderItem()
|
|
{
|
|
OrderItemModelFormView *view = new OrderItemModelFormView(session_);
|
|
|
|
return view;
|
|
}
|
|
|
|
WWidget *Home::showMessage()
|
|
{
|
|
MessageModelFormView *view = new MessageModelFormView(session_);
|
|
|
|
return view;
|
|
}
|
|
WWidget *Home::showAgentAssignmentStatus()
|
|
{
|
|
AgentAssignmentStatusModelFormView *view = new AgentAssignmentStatusModelFormView(session_);
|
|
|
|
return view;
|
|
}
|
|
|
|
WWidget *Home::showSellerEntreprenuer()
|
|
{
|
|
SellerEntreprenuerModelFormView *view = new SellerEntreprenuerModelFormView(session_);
|
|
|
|
return view;
|
|
}
|
|
|
|
WWidget *Home::showSellerEnterprise()
|
|
{
|
|
SellerEnterpriseModelFormView *view = new SellerEnterpriseModelFormView(session_);
|
|
|
|
return view;
|
|
}
|
|
|
|
WWidget *Home::showSellerPersonnel()
|
|
{
|
|
SellerPersonnelModelFormView *view = new SellerPersonnelModelFormView(session_);
|
|
|
|
return view;
|
|
}
|
|
|
|
WWidget *Home::showSellerAgent()
|
|
{
|
|
SellerAgentModelFormView *view = new SellerAgentModelFormView(session_);
|
|
|
|
return view;
|
|
}
|
|
|
|
WWidget *Home::showSellerStore()
|
|
{
|
|
SellerStoreModelFormView *view = new SellerStoreModelFormView(session_);
|
|
|
|
return view;
|
|
}
|
|
|
|
WWidget *Home::showHomePage()
|
|
{
|
|
HomePageModelFormView *view = new HomePageModelFormView(session_);
|
|
|
|
return view;
|
|
}
|
|
|
|
//WWidget *Home::createLogout()
|
|
//{
|
|
// if (session_.login().loggedIn() && item->text() == tr("path-signout").toUTF8())
|
|
// {
|
|
// session_.login().logout();
|
|
// }
|
|
//
|
|
//}
|
|
|
|
void Home::AuthEvent()
|
|
{
|
|
|
|
if (session_.login().loggedIn())
|
|
{
|
|
const Wt::Auth::User& u = session_.login().user();
|
|
std::cerr << "User " << u.id() << std::endl;
|
|
std::cerr << " (" << u.identity(Wt::Auth::Identity::LoginName) << ")" << std::endl;
|
|
std::cerr << " logged in." << std::endl;
|
|
}
|
|
else
|
|
{
|
|
std::cerr << "User logged out.";
|
|
}
|
|
|
|
AuthAction();
|
|
}
|
|
|
|
void Home::AuthAction()
|
|
{
|
|
if (session_.login().loggedIn())
|
|
{
|
|
const Wt::Auth::User& u = session_.login().user();
|
|
usermenu_->setText(u.identity(Wt::Auth::Identity::LoginName));
|
|
signin_->hide();
|
|
profile_->show();
|
|
buyerds_->show();
|
|
sellerds_->show();
|
|
signout_->show();
|
|
register_->hide();
|
|
usermenu_->setText(tr("hello-user") + u.identity(Wt::Auth::Identity::LoginName));
|
|
}
|
|
else
|
|
{
|
|
usermenu_->setText(tr("hello-guest"));
|
|
signin_->show();
|
|
profile_->hide();
|
|
buyerds_->hide();
|
|
sellerds_->hide();
|
|
signout_->hide();
|
|
register_->show();
|
|
usermenu_->setText(tr("hello-guest"));
|
|
}
|
|
}
|
|
|
|
void Home::SignedOut()
|
|
{
|
|
if (session_.login().loggedIn())
|
|
{
|
|
session_.login().logout();
|
|
}
|
|
|
|
setup();
|
|
//AuthAction();
|
|
}
|