1#line 2 "src/Gui/BillPay/TableModel.cpp"
3#include <Wt/WStandardItem.h>
6#include "../../Glb/Core.h"
7#include "../Dbo/Vars/Vars.h"
15 {
"accountKey" ,
"120px" , Wt::AlignmentFlag::Left },
16 {
"last4" ,
"60px" , Wt::AlignmentFlag::Center },
17 {
"Nickname" ,
"100px" , Wt::AlignmentFlag::Left },
18 {
"Gp" ,
"50px" , Wt::AlignmentFlag::Center },
19 {
"Dy" ,
"50px" , Wt::AlignmentFlag::Center },
20 {
"Min" ,
"50px" , Wt::AlignmentFlag::Right },
21 {
"Bgt" ,
"50px" , Wt::AlignmentFlag::Right },
22 {
"Actual" ,
"75px" , Wt::AlignmentFlag::Right },
23 {
"Au" ,
"50px" , Wt::AlignmentFlag::Center },
24 {
"01" ,
"35px" , Wt::AlignmentFlag::Center },
25 {
"02" ,
"35px" , Wt::AlignmentFlag::Center },
26 {
"03" ,
"35px" , Wt::AlignmentFlag::Center },
27 {
"04" ,
"35px" , Wt::AlignmentFlag::Center },
28 {
"05" ,
"35px" , Wt::AlignmentFlag::Center },
29 {
"06" ,
"35px" , Wt::AlignmentFlag::Center },
30 {
"07" ,
"35px" , Wt::AlignmentFlag::Center },
31 {
"08" ,
"35px" , Wt::AlignmentFlag::Center },
32 {
"09" ,
"35px" , Wt::AlignmentFlag::Center },
33 {
"10" ,
"35px" , Wt::AlignmentFlag::Center },
34 {
"11" ,
"35px" , Wt::AlignmentFlag::Center },
35 {
"12" ,
"35px" , Wt::AlignmentFlag::Center },
38#define COLUMN_COUNT (sizeof(columns)/sizeof(GCW::Gui::BillPay::ColumnDef_t))
48 auto _toolTip = [&](
int _col )
50 return TR( std::string(
"gcw.billPay.ttp." ) + columns[ _col ].name );
76 loadData( _selectedMonth, _selectedYear );
88 if( m_filter.length() == 0 )
91 auto _foundIn = [
this](
const std::string & _a )
99 if( a.find( b ) == std::string::npos )
114 if( _foundIn( _bpItem.accountFullName() ) ) retVal =
false;
115 if( _foundIn( _bpItem.nickname() ) ) retVal =
false;
116 if( _foundIn( _bpItem.url() ) ) retVal =
false;
117 if( _foundIn( _bpItem.last4() ) ) retVal =
false;
118 if( _foundIn( _bpItem.note() ) ) retVal =
false;
127loadData(
int _selectedMonth,
int _selectedYear )->
void
129 m_selectedMonth = _selectedMonth;
130 m_selectedYear = _selectedYear;
147 Wt::Orientation::Horizontal,
155 while( rowCount() > 0 )
173 std::string yesNo =
"yes";
184 std::vector< GCW::Gui::BillPay::Item >
bpItems;
185 for(
auto item : items )
193 if( filteredOut(
bpItem ) )
199 auto isActive =
bpItem.isActive () ==
"yes";
200 auto isVisible =
bpItem.isVisible() ==
"yes";
213 if( isActive && isVisible )
221 if(
bpItem.cb( _selectedMonth ) == yesNo )
238 if( !isActive || !isVisible )
261 auto accountName = std::make_unique< Wt::WStandardItem >();
262 auto accountGuid =
bpItem.accountGuid();
264 if( accountGuid !=
"" )
305 std::vector< std::unique_ptr< Wt::WStandardItem > > columns;
306 columns.push_back( std::move( accountName ) );
307 columns.push_back( std::make_unique< Wt::WStandardItem >(
bpItem.last4 () ) );
308 columns.push_back( std::make_unique< Wt::WStandardItem >(
bpItem.nickname () ) );
309 columns.push_back( std::make_unique< Wt::WStandardItem >(
bpItem.group () ) );
310 columns.push_back( std::make_unique< Wt::WStandardItem >(
bpItem.dueDay () ) );
311 columns.push_back( std::make_unique< Wt::WStandardItem >(
bpItem.minimum () ) );
312 columns.push_back( std::make_unique< Wt::WStandardItem >(
bpItem.budget () ) );
313 columns.push_back( std::make_unique< Wt::WStandardItem >(
bpItem.actual () ) );
314 columns.push_back( std::make_unique< Wt::WStandardItem >(
bpItem.autoPay () ) );
319 for(
int month=1; month<= 12; month++ )
321 auto cb = std::make_unique< Wt::WStandardItem >(
bpItem.cbtr( month ) );
331 if( _selectedMonth == month )
332 cb-> setStyleClass(
"colsel" );
334 columns.push_back( std::move( cb ) );
341 appendRow( std::move( columns ) );
356sort( std::vector< GCW::Gui::BillPay::Item > & _bpItems )->
void
380 return item1.sortValue()
390setFilter(
const std::string & _filter )->
void
403 loadData( m_selectedMonth, m_selectedYear );
#define GCW_GUI_BILLPAY_ITEM_CFY
auto loadData(int _selectedMonth, int _selectedYear) -> void
Reload the data based on the selected month.
TableModel(int _selectedMonth, int _selectedYear, Status _status)
ctor
auto columnDef(int _col) -> ColumnDef_t
Column Definition.
auto setFilter(const std::string &_filter) -> void
Status m_status
Model Status.
auto filteredOut(const GCW::Gui::BillPay::Item &_bpItem) -> bool
auto sort(std::vector< GCW::Gui::BillPay::Item > &_bpItems) -> void
Sorter.
static constexpr const int User
static constexpr const int ToolTip
static constexpr const int Display
static constexpr const int StyleClass
virtual bool setHeaderData(int section, Orientation orientation, const cpp17::any &value, ItemDataRole role=ItemDataRole::Edit)
std::string tolower(const std::string &s)
auto byGuid(const std::string &_guid) -> Item::Ptr
Load Account by GUID.
auto fullName(const std::string &_guid) -> std::string
Account Fullname via GUID.
auto getByCfy(const std::string &_cfyValue) -> GCW::Dbo::Vars::Item::Vector
auto bpItem(const std::string &_guid) -> GCW::Gui::BillPay::Item
Bill Pay Item.
auto bpItems() -> std::vector< GCW::Gui::BillPay::Item >
Bill Pay Items.
@ Inactive
Disabled Status.
auto asString(Status _status) -> std::string
Get Status as String.
auto toString(int _value) -> std::string
Convert Integer to String.