Wtx ~ Wt Extension Library
WtxLib
ManagerWidget.cpp
1 
2 #include <Wt/WText.h>
3 #include <Wt/WTemplate.h>
4 #include <Wt/WMenu.h>
5 #include <Wt/WStackedWidget.h>
6 #include <Wt/WGridLayout.h>
7 #include <Wt/WVBoxLayout.h>
8 #include <Wt/WHBoxLayout.h>
9 #include <Wt/WFitLayout.h>
10 #include <Wt/WPushButton.h>
11 
12 #include <Wtx/Dbo/TableViewManager.h>
13 #include <Wtx/Dbo/TemplateFormView.h>
14 #include <Wtx/Dbo/DetailForm.h>
15 
16 #include "Item.h"
17 #include "ManagerWidget.h"
18 
20 : public Wt::WContainerWidget
21 {
22  public:
23 
25 
26  Wtx::Dbo::Session * session() const { return m_session; }
27 
28  private:
29 
30  Wtx::Dbo::Session * m_session = nullptr;
31 
32 }; // endclass BaseDesktop( Wtx::Dbo::Session * s )
33 
34 BaseDesktop::BaseDesktop( Wtx::Dbo::Session * s )
35 : Wt::WContainerWidget(),
36  m_session(s)
37 {
38 }
39 
41 : public Wtx::Dbo::DetailForm< Wtx::Crm::Company::Item >
42 {
43  public:
44 
45  CompanyDetail( Wt::Dbo::ptr< Wtx::Crm::Company::Item > & item )
47  (
48  "crmCompany.detailForm",
49  item
50  )
51  {
52  }
53 
54 };
55 
57 : public BaseDesktop
58 {
59  public:
60 
62 
63 }; // endclass CustomerDesktop( Wtx::Dbo::Session * s )
64 
65 CompanyDesktop::CompanyDesktop( Wtx::Dbo::Session * s )
66 : BaseDesktop( s )
67 {
68  auto layout = std::make_unique< Wt::WHBoxLayout >();
69 
70 #ifndef NEVER
71  {
73  {
74  /* title */ "Customers",
75  /* tip */ "",
76  /* headerCount */ 0,
77  /* selectionMode */ Wt::SelectionMode::Single,
78  /* columnResizeEnabled */ true,
79  /* alternatingRowColors */ true,
80  /* sql */ "",
81  /* filter */ "\"isActive\"",
82  /* subFilter */ "",
83  /* idin */ {},
84  /* doubleClick */ 0,
85  /* showHeader */ true,
86  /* showFooter */ true,
87  /* showPrevNext */ false,
88  /* hideSearch */ true,
89  /* allowFilter */ false,
90  /* allowAdd */ true,
91  /* allowChange */ true,
92  /* allowDelete */ true,
93  /* allowExport */ true,
94  /* allowSearch */ true,
95  /* allowPrint */ false,
96  /* allowUnlock */ false,
97  /* additional */ "",
98  /* itemDelegate */ nullptr,
99 
100 
101  /* sortFields */
102  {
103  "\"keyField\""
104  },
105 
106  /* search fields */
107  {
108  "city",
109  "state",
110  "zip",
111  "phone",
112  "buyer",
113  "buyerPhone",
114  "email",
115  "contact",
116  "contactPhone"
117  },
118 
119  /* column defs */
120  {
121 // { "id", "", 50, Wt::AlignmentFlag::Left, "", nullptr },
122 // { "isActive", "", 75, Wt::AlignmentFlag::Left, "", nullptr },
123 
124  { "custType", "type", 50, Wt::AlignmentFlag::Left, "", nullptr },
125  { "keyField", "", 100, Wt::AlignmentFlag::Left, "", nullptr },
126  { "cfyField", "", 300, Wt::AlignmentFlag::Left, "", nullptr },
127  { "addr", "", 150, Wt::AlignmentFlag::Left, "", nullptr },
128  { "city", "", 100, Wt::AlignmentFlag::Left, "", nullptr },
129  { "state", "", 100, Wt::AlignmentFlag::Left, "", nullptr },
130  { "zip", "", 100, Wt::AlignmentFlag::Left, "", nullptr },
131  { "contact", "", 100, Wt::AlignmentFlag::Left, "", nullptr },
132  { "contactPhone", "", 100, Wt::AlignmentFlag::Left, "", nullptr }
133 
134  },
135 
136  /* column names */
137  {
138  "id",
139  "keyField",
140  "cfyField",
141  "phone"
142  }
143  };
144 
145  layout-> addWidget( std::make_unique< Wtx::Dbo::TableViewManager< Wtx::Crm::Company::Item, CompanyDetail > >( viewDef, session() ) );
146 
147  }
148 #endif
149 
150 #ifdef NEVER
151  auto vlw = std::make_unique<Wt::WVBoxLayout>();
152 
153  {
155  {
156  /* title */ "Invoices for Account",
157  /* tip */ "",
158  /* headerCount */ 0,
159  /* selectionMode */ Wt::SelectionMode::Single,
160  /* columnResizeEnabled */ true,
161  /* alternatingRowColors */ true,
162  /* sql */ "",
163  /* filter */ "",
164  /* subFilter */ "",
165  /* idin */ {},
166  /* doubleClick */ 0,
167  /* showHeader */ true,
168  /* showFooter */ true,
169  /* hideSearch */ true,
170  /* allowFilter */ false,
171  /* allowAdd */ false,
172  /* allowChange */ false,
173  /* allowDelete */ false,
174  /* allowExport */ true,
175  /* allowSearch */ true,
176  /* itemDelegate */ nullptr,
177 
178 
179  /* sortFields */
180  {
181  "id DESC"
182  },
183 
184  /* search fields */
185  {
186  },
187 
188  /* column defs */
189  {
190  { "id", "", 50, Wt::AlignmentFlag::Left, "", nullptr },
191  { "keyField", "", 350, Wt::AlignmentFlag::Left, "", nullptr }
192  },
193 
194  /* column names */
195  {
196  "id",
197  "version",
198  "versionSync",
199  "isActive",
200  "isVisible",
201  "isDeleted",
202  "keyField",
203  "cfyField",
204  "varField",
205  "uidField",
206  "pMode",
207  "createdOn",
208  "changedOn",
209  "pUser",
210  "pGroup",
211  "sessionLock",
212  "datePosted",
213  "summary",
214  "thumbnail",
215  "body"
216  }
217  };
218 
219  vlw-> addWidget( std::make_unique< Wtx::Dbo::TableViewManager< Wtx::Fms::Invoice::Item, InvoiceDetail > >( viewDef, session() ) );
220 
221  }
222 
223  {
225  {
226  /* title */ "Activity for Account",
227  /* tip */ "",
228  /* headerCount */ 0,
229  /* selectionMode */ Wt::SelectionMode::Single,
230  /* columnResizeEnabled */ true,
231  /* alternatingRowColors */ true,
232  /* sql */ "",
233  /* filter */ "",
234  /* subFilter */ "",
235  /* idin */ {},
236  /* doubleClick */ 0,
237  /* showHeader */ true,
238  /* showFooter */ true,
239  /* hideSearch */ true,
240  /* allowFilter */ false,
241  /* allowAdd */ false,
242  /* allowChange */ false,
243  /* allowDelete */ false,
244  /* allowExport */ true,
245  /* allowSearch */ true,
246  /* itemDelegate */ nullptr,
247 
248 
249  /* sortFields */
250  {
251  "id DESC"
252  },
253 
254  /* search fields */
255  {
256  },
257 
258  /* column defs */
259  {
260  { "id", "", 50, Wt::AlignmentFlag::Left, "", nullptr },
261  { "keyField", "", 350, Wt::AlignmentFlag::Left, "", nullptr }
262  },
263 
264  /* column names */
265  {
266  "id",
267  "version",
268  "versionSync",
269  "isActive",
270  "isVisible",
271  "isDeleted",
272  "keyField",
273  "cfyField",
274  "varField",
275  "uidField",
276  "pMode",
277  "createdOn",
278  "changedOn",
279  "pUser",
280  "pGroup",
281  "sessionLock",
282  "datePosted",
283  "summary",
284  "thumbnail",
285  "body"
286  }
287  };
288 
289  vlw-> addWidget( std::make_unique< Wtx::Dbo::TableViewManager< Wtx::Fms::Activity::Item, ActivityDetail > >( viewDef, session() ) );
290  }
291 
292  {
294  {
295  /* title */ "Transactions for Activity",
296  /* tip */ "",
297  /* headerCount */ 0,
298  /* selectionMode */ Wt::SelectionMode::Single,
299  /* columnResizeEnabled */ true,
300  /* alternatingRowColors */ true,
301  /* sql */ "",
302  /* filter */ "",
303  /* subFilter */ "",
304  /* idin */ {},
305  /* doubleClick */ 0,
306  /* showHeader */ true,
307  /* showFooter */ true,
308  /* hideSearch */ true,
309  /* allowFilter */ false,
310  /* allowAdd */ false,
311  /* allowChange */ false,
312  /* allowDelete */ false,
313  /* allowExport */ true,
314  /* allowSearch */ true,
315  /* itemDelegate */ nullptr,
316 
317 
318  /* sortFields */
319  {
320  "id DESC"
321  },
322 
323  /* search fields */
324  {
325  },
326 
327  /* column defs */
328  {
329  { "id", "", 50, Wt::AlignmentFlag::Left, "", nullptr },
330  { "keyField", "", 350, Wt::AlignmentFlag::Left, "", nullptr }
331  },
332 
333  /* column names */
334  {
335  "id",
336  "version",
337  "versionSync",
338  "isActive",
339  "isVisible",
340  "isDeleted",
341  "keyField",
342  "cfyField",
343  "varField",
344  "uidField",
345  "pMode",
346  "createdOn",
347  "changedOn",
348  "pUser",
349  "pGroup",
350  "sessionLock",
351  "datePosted",
352  "summary",
353  "thumbnail",
354  "body"
355  }
356  };
357 
358  vlw-> addWidget( std::make_unique< Wtx::Dbo::TableViewManager< Wtx::Fms::Transaction::Item, TransactionDetail > >( viewDef, session() ) );
359  }
360 
361  vlw-> setResizable( 0 );
362  vlw-> setResizable( 1 );
363 
364  layout-> addLayout( std::move(vlw) );
365  layout-> setResizable( 0 );
366 #endif
367 
368  setLayout( std::move(layout) );
369 
370 } // endCompanyDesktop::CompanyDesktop( Wtx::Dbo::Session * s )
371 
372 
373 
374 Wtx::Crm::Company::ManagerWidget::ManagerWidget( Wtx::Dbo::Session * s )
375 : Wt::WContainerWidget(),
376  m_session(s)
377 {
378 
379  auto lw_u = std::make_unique<Wt::WHBoxLayout>();
380  auto lw = lw_u.get();
381  setLayout( std::move(lw_u) );
382 
383  lw-> addWidget( std::make_unique< CompanyDesktop >( s ) );
384 
385 } // endWarehouse::Customer::ManagerWidget::ManagerWidget( Wtx::Dbo::Session * s )
386 
387 
Table View Definition.
Definition: TableViewDef.h:171