-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWCardView.h
58 lines (52 loc) · 1.46 KB
/
WCardView.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#pragma once
#include <Wt/WTemplate>
#include <Wt/WSelectionBox>
#include <Wt/WDateTime>
#include <Wt/WTime>
#include <Wt/WTableView>
#include <Wt/WStandardItemModel>
#include <boost/any.hpp>
#include "MyApplication.h"
#include "WPageBase.h"
#include "Wt/WStringStream"
using namespace Wt;
class WCardView : public WPageBase
{
public:
public:
WCardView(){
WTemplate *templ = new WTemplate(tr("card-templ"), this);
m_table = new Wt::WTableView();
templ->bindWidget("cards-lv", m_table);
m_snextbase = "/0";
}
void update(){
int pid = 0;
if(m_params.find("pid") != m_params.end()){
pid = boost::lexical_cast<int>(boost::any_cast<string>(m_params["pid"]));
}
if(!pid)
return;
vector<card> cards;
GetDM().get_patient_cards(pid, cards);
WStandardItemModel* _model = new WStandardItemModel();
for (int i = 0; i < cards.size(); i++)
{
WStandardItem* _item1 = new WStandardItem(boost::lexical_cast<string>(cards[i].id()));
//äîáàâèòü èìÿ âðà÷à, âðåìÿ è äåíü ïðèåìà
//WStandardItem* _item2= new WStandardItem(boost::lexical_cast<string>(cards[i].()));
// WStandardItem* _item3 = new WStandardItem(boost::lexical_cast<string>(cards[i].id()));
//WStandardItem* _item4 = new WStandardItem(boost::lexical_cast<string>(cards[i].id()));
_model->appendRow(_item1);
}
m_table->setModel(_model);
m_table->resize(200, 300);
}
bool onleave(){
GetDM().save(".");
m_params.clear();
return true;
}
private:
WTableView* m_table;
};