1 #line 2 "src/Gui/CentralWidget.cpp"
3 #include <Wt/WMenuItem.h>
4 #include <Wt/WTabWidget.h>
9 #include "../Dbo/Accounts/Accounts.h"
10 #include "../Dbo/BillTerms/BillTerms.h"
11 #include "../Dbo/Books/Books.h"
12 #include "../Dbo/Customers/Customers.h"
13 #include "../Dbo/Commodities/Commodities.h"
14 #include "../Dbo/Entries/Entries.h"
15 #include "../Dbo/GncLock/GncLock.h"
16 #include "../Dbo/Invoices/Invoices.h"
17 #include "../Dbo/Slots/Slots.h"
18 #include "../Dbo/Splits/Splits.h"
19 #include "../Dbo/Transactions/Transactions.h"
20 #include "../Dbo/Versions/Versions.h"
42 addStyleClass(
"CentralWidget" );
48 m_gridLayout = setLayout( std::make_unique< Wt::WGridLayout >() );
65 tabClosed().connect( [=](
int tabIndex )
76 auto widget = std::make_unique< GCW::Gui::AccountsTreeView >( 7 );
78 tabWidget()-> addTab( std::move( widget ),
TR(
"gcw.AccountsTreeView.tabName" ) );
87 tabIndex(
const std::string & _text )->
int
89 for(
int i=0; i< tabWidget()-> count(); i++ )
90 if( tabWidget()-> tabText( i ) == _text )
101 Wt::Dbo::Transaction t(
GCW::app()-> gnucashew_session() );
123 if( tabIndex( accountItem->
name() ) == -1 )
125 auto u_ = std::make_unique< GCW::Gui::AccountRegister >( _accountGuid );
126 auto accountRegister = u_.get();
140 tabWidget()-> setTabToolTip( 1,
fullName( accountItem ) );
142 tab-> setCloseable(
true );
144 accountRegister-> setAccountGuid( _accountGuid );
152 tabWidget()-> setCurrentIndex( tabIndex( accountItem->
name() ) );
179 auto tabName =
TR8(
"gcw.cw.tabName.Customer" ) +
": " + customerItem->
name();
185 if( tabIndex( tabName ) == -1 )
197 ( tabWidget()-> currentIndex() + 1,
198 std::make_unique< GCW::Gui::CustomerReportWidget >( _customerGuid ),
202 tab-> setCloseable(
true );
211 tabWidget()-> setCurrentIndex( tabIndex( tabName ) );
219 auto tabName =
TR8(
"gcw.cw.tabName.Customers" );
225 if( tabIndex( tabName ) == -1 )
231 auto widget = std::make_unique< GCW::Gui::Customer::MainWidget >();
232 auto w = widget.get();
240 doubleClicked().connect( [=](
const std::string & _customerGuid )
242 open_CustomerReportWidget( _customerGuid );
253 tab-> setCloseable(
true );
261 tabWidget()-> setCurrentIndex( tabIndex( tabName ) );
269 auto tabName =
TR8(
"gcw.cw.tabName.Employees" );
275 if( tabIndex( tabName ) == -1 )
281 auto widget = std::make_unique< GCW::Gui::EmployeesWidget >();
282 auto w = widget.get();
290 doubleClicked().connect( [=](
const std::string & _customerGuid )
292 open_EmployeesWidget();
303 tab-> setCloseable(
true );
311 tabWidget()-> setCurrentIndex( tabIndex( tabName ) );
319 auto tabName =
TR8(
"gcw.cw.tabName.BillPay" );
325 if( tabIndex( tabName ) == -1 )
331 auto widget = std::make_unique< GCW::Gui::BillPay::MainWidget >();
332 auto w = widget.get();
342 tab-> setCloseable(
true );
350 tabWidget()-> setCurrentIndex( tabIndex( tabName ) );
358 auto tabName =
"RawTables";
364 if( tabIndex( tabName ) == -1 )
366 auto widget = std::make_unique< Wt::WTabWidget >();
368 auto tw = widget.get();
378 tab-> setCloseable(
true );
400 tabWidget()-> setCurrentIndex( tabIndex( tabName ) );
408 if(
auto registerWidget =
dynamic_cast< GCW::Gui::AccountRegister*
>( tabWidget()-> widget( tabWidget()-> currentIndex() ) ) )
410 registerWidget-> test();
const Wt::WFormModel::Field name
auto byGuid(const std::string &_guid) -> Item::Ptr
Load Account by GUID.
auto fullName(const std::string &_guid) -> std::string
Account Fullname via GUID.
Item::Ptr byGuid(const std::string &_guid)
Load Customer by Guid.