1 #line 2 "src/Gui/BillPay/MainWidget.cpp"
3 #include <Wt/WVBoxLayout.h>
4 #include <Wt/WHBoxLayout.h>
6 #include <Wt/WPushButton.h>
24 addStyleClass(
"BillPay" );
27 m_hlw = setLayout( std::make_unique< Wt::WHBoxLayout >() );
28 auto cw = m_hlw-> addWidget( std::make_unique< Wt::WContainerWidget >() );
33 auto u_ = std::make_unique< ToolBar >();
35 cw-> addWidget( std::move( u_ ) );
47 m_selectedMonth =
configItem()-> getVarInt(
"selectedMonth" );
48 if( m_selectedMonth < 1 )
65 auto u_ = std::make_unique< Table >( m_selectedMonth,
Status::Unpaid );
66 m_unpaidView = u_.get();
67 cw-> addWidget( std::move( u_ ) );
69 doubleClicked().connect( [&]( Wt::WModelIndex _index, Wt::WMouseEvent _event )
71 editClicked( m_unpaidView, _index );
84 auto u_ = std::make_unique< Table >( m_selectedMonth,
Status::Paid );
85 m_paidView = u_.get();
86 cw-> addWidget( std::move( u_ ) );
88 doubleClicked().connect( [&]( Wt::WModelIndex _index, Wt::WMouseEvent _event )
90 editClicked( m_paidView, _index );
95 if( m_toolBar-> showDisabled() )
98 m_disabledView = u_.get();
99 cw-> addWidget( std::move( u_ ) );
101 doubleClicked().connect( [&]( Wt::WModelIndex _index, Wt::WMouseEvent _event )
103 editClicked( m_disabledView, _index );
115 openEditor(
const std::string & _bpGuid )->
void
128 auto u_ = std::make_unique< GCW::Gui::BillPay::EditWidget >( _bpGuid );
129 m_editWidget = u_.get();
140 m_hlw-> addWidget( std::move( u_ ) );
141 m_hlw-> setResizable( 0,
true, Wt::WLength( 20, Wt::LengthUnit::Percentage ) );
144 save().connect( [=]()
147 m_hlw-> removeWidget( m_editWidget.get() );
151 cancel().connect( [=]()
154 m_hlw-> removeWidget( m_editWidget.get() );
163 Wt::Dbo::Transaction t(
GCW::app()-> gnucashew_session() );
178 auto zcolIndex = _index.model()-> index( _index.row(), 0 );
179 auto bpGuid =
Wt::asString( zcolIndex.data( Wt::ItemDataRole::User ) ).toUTF8();
180 openEditor( bpGuid );
204 setMonth( std::stoi( _button-> text().toUTF8() ) );
220 if( m_unpaidView ) m_unpaidView -> setMonth( _month );
221 if( m_paidView ) m_paidView -> setMonth( _month );
222 if( m_disabledView ) m_disabledView -> setMonth( _month );
224 m_selectedMonth = _month;
226 Wt::Dbo::Transaction t(
GCW::app()-> gnucashew_session() );
227 configItem().modify()-> setVar(
"selectedMonth", m_selectedMonth );
235 setMonth( m_selectedMonth );
243 std::cout << __FILE__ <<
":" << __LINE__ <<
" " << std::endl;
251 std::cout << __FILE__ <<
":" << __LINE__ <<
" " << std::endl;
260 setMonth( _col - 8 );
auto buttonChanged(Wt::WRadioButton *_button) -> void
auto openEditor(const std::string &_bpGuid) -> void
auto editClicked(Table *_table, Wt::WModelIndex _index) -> void
auto buildContent() -> void
auto refreshViews() -> void
auto exportClicked() -> void
auto setMonth(int _month) -> void
auto on_headerClicked(int _col, const Wt::WMouseEvent _me) -> void
auto addClicked() -> void
auto disabledClicked() -> void
auto importClicked() -> void
std::string asString(Status _status)
Get Status as String.
@ Disabled
Disabled Status.
auto configItem() -> GCW::Dbo::Vars::Item::Ptr
Config Item.