1 #line 2 "src/Gui/AccountEditor.cpp"
4 #include <Wt/WTextArea.h>
5 #include <Wt/WVBoxLayout.h>
6 #include <Wt/WFitLayout.h>
7 #include <Wt/WGridLayout.h>
8 #include <Wt/WPushButton.h>
9 #include <Wt/WComboBox.h>
10 #include <Wt/WCheckBox.h>
15 :
public Wt::WComboBox
27 addItem( Wt::WString::tr( Wt::WString(
"gcw.AccountsType.{1}").arg( def.backendName ).toUTF8() ) );
37 if( def.backendName == _initialValue )
41 setCurrentIndex( index );
48 :
public Wt::WComboBox
59 :
public Wt::WComboBox
65 addItem(
TR(
"gcw.AccountEditor.usecommodity" ) );
71 addItem(
"1/100000" );
72 addItem(
"1/1000000" );
73 addItem(
"1/10000000" );
74 addItem(
"1/100000000" );
75 addItem(
"1/1000000000" );
81 Tab1(
const std::string & _accountGuid )
82 : m_accountGuid( _accountGuid )
90 auto lw = setLayout( std::make_unique< Wt::WVBoxLayout >() );
91 auto at1 = std::make_unique< Wt::WTemplate >(
TR(
"gcw_gui.accounteditor.form.tab1" ) );
93 lw-> addWidget( std::move( at1 ) );
95 t1-> bindString(
"name-label" ,
TR(
"gcw.AccountEditor.name" ) );
96 t1-> bindString(
"code-label" ,
TR(
"gcw.AccountEditor.code" ) );
97 t1-> bindString(
"desc-label" ,
TR(
"gcw.AccountEditor.desc" ) );
98 t1-> bindString(
"parent-label" ,
TR(
"gcw.AccountEditor.parent" ) );
99 t1-> bindString(
"accountType-label" ,
TR(
"gcw.AccountEditor.accountType" ) );
100 t1-> bindString(
"security-label" ,
TR(
"gcw.AccountEditor.security" ) );
101 t1-> bindString(
"fraction-label" ,
TR(
"gcw.AccountEditor.fraction" ) );
102 t1-> bindString(
"color-label" ,
TR(
"gcw.AccountEditor.color" ) );
103 t1-> bindString(
"notes-label" ,
TR(
"gcw.AccountEditor.notes" ) );
105 std::cout << __FILE__ <<
":" << __LINE__ <<
" this:" << accountItem->
guid() << std::endl;
106 std::cout << __FILE__ <<
":" << __LINE__ <<
" parn:" << accountItem->
parent_guid() << std::endl;
108 auto name =
t1-> bindNew< Wt::WLineEdit >(
"name" , accountItem->
name() );
109 auto code =
t1-> bindNew< Wt::WLineEdit >(
"code" , accountItem->
code() );
110 auto desc =
t1-> bindNew< Wt::WLineEdit >(
"desc" , accountItem->
description() );
111 auto parent =
t1-> bindNew< GCW::Gui::AccountsTreeView >(
"parent" , accountItem->
parent_guid() , 7 );
112 auto accountType =
t1-> bindNew< AccountTypeCombo >(
"accountType" , accountItem-> accountTypeName() );
113 auto security =
t1-> bindNew< SecurityCombo >(
"security" );
114 auto fraction =
t1-> bindNew< SmallestFractionCombo >(
"fraction" );
115 auto color =
t1-> bindNew< Wt::WPushButton >(
"color" ,
TR(
"gcw.AccountEditor.colorpicker" ) );
116 auto colordefault =
t1-> bindNew< Wt::WPushButton >(
"colordefault" ,
TR(
"gcw.AccountEditor.colordefault" ) );
117 auto notes =
t1-> bindNew< Wt::WTextArea >(
"notes" );
118 auto placeholder =
t1-> bindNew< Wt::WCheckBox >(
"placeholder" ,
TR(
"gcw.AccountEditor.placeholder" ) );
119 auto hidden =
t1-> bindNew< Wt::WCheckBox >(
"hidden" ,
TR(
"gcw.AccountEditor.hidden" ) );
120 auto autoTransfer =
t1-> bindNew< Wt::WCheckBox >(
"autoTransfer" ,
TR(
"gcw.AccountEditor.autoTransfer" ) );
121 auto taxRelated =
t1-> bindNew< Wt::WCheckBox >(
"taxRelated" ,
TR(
"gcw.AccountEditor.taxRelated" ) );
122 auto openingBalance =
t1-> bindNew< Wt::WCheckBox >(
"openingBalance" ,
TR(
"gcw.AccountEditor.openingBalance" ) );
124 color -> setWidth(
"100%" );
125 colordefault -> setWidth(
"100%" );
127 parent-> setMaximumSize( Wt::WLength::Auto, Wt::WLength(
"220px") );
132 Tab2(
const std::string & _accountGuid )
135 auto lw = setLayout( std::make_unique< Wt::WFitLayout >() );
136 auto at2 = std::make_unique< Wt::WTemplate >(
TR(
"gcw_gui.accounteditor.form.tab2" ) );
138 lw-> addWidget( std::move( at2 ) );
147 addStyleClass(
"AccountEditor" );
155 auto lw = setLayout( std::make_unique< Wt::WVBoxLayout >() );
157 lw-> addWidget( std::make_unique< Wt::WText >(
TR(
"gcw.AccountEditor.editaccount").arg( accountItem->
fullName() ) ) )->
158 setAttributeValue(
"style",
"margin-bottom:5px" );
168 m_tabWidget = lw-> addWidget( std::make_unique< Wt::WTabWidget >(), 1 );
169 auto twt1 =
tabWidget()-> addTab( std::move( at1 ),
"General" );
170 auto twt2 =
tabWidget()-> addTab( std::move( at2 ),
"More Properties" );
172 auto model = std::make_shared< Wt::WFormModel >();
175 auto footer = lw-> addWidget( std::make_unique< Wt::WTemplate >(
TR(
"gcw_gui.accounteditor.form.footer" ) ) );
177 footer-> bindNew< Wt::WPushButton >(
"help" ,
"help" )-> clicked().connect(
this, &
AccountEditor::do_help );
179 footer-> bindNew< Wt::WPushButton >(
"ok" ,
"ok" )-> clicked().connect(
this, &
AccountEditor::do_ok );
193 wApp-> doJavaScript(
"window.open( '/dox/html/AccountEditor.html', '_blank' )" );
209 std::cout << __FILE__ <<
":" << __LINE__ <<
" " << std::endl;
215 :
Wt::WDialog(
"Edit Account" )
217 rejectWhenEscapePressed(
true );
218 setResizable(
true );
220 setMinimumSize(
"800px",
"600px" );
222 contents()-> addNew< GCW::Gui::AccountEditor >( _accountGuid );
AccountTypeCombo(const std::string &_initialValue)
AccountEditorDialog(const std::string &_accountGuid)
std::string m_accountGuid
Tab1(const std::string &_accountGuid)
Tab2(const std::string &_accountGuid)
std::string m_accountGuid
Wt::WTabWidget * m_tabWidget
AccountEditor(const std::string &_accountGuid)
Wt::WTabWidget * tabWidget()
const Wt::WFormModel::Field name
const Wt::WFormModel::Field guid
const Wt::WFormModel::Field description
const Wt::WFormModel::Field code
const Wt::WFormModel::Field hidden
const Wt::WFormModel::Field parent_guid
auto load(const std::string &_guid) -> Item::Ptr
Load Account by GUID.
const std::vector< AccountDef_t > s_accountDefs
auto fullName(const std::string &_guid) -> std::string
Account Fullname via GUID.
const Wt::WFormModel::Field parent
const Wt::WFormModel::Field fraction
const Wt::WFormModel::Field notes