ORE Studio 0.0.4
Loading...
Searching...
No Matches
account_list_widget.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 *
3 * Copyright (C) 2025 Marco Craveiro <marco.craveiro@gmail.com>
4 *
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License as published by the Free Software
7 * Foundation; either version 3 of the License, or (at your option) any later
8 * version.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13 * details.
14 *
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc., 51
17 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 *
19 */
20#ifndef ORES_WT_SERVICE_APP_ACCOUNT_LIST_WIDGET_HPP
21#define ORES_WT_SERVICE_APP_ACCOUNT_LIST_WIDGET_HPP
22
23#include <Wt/WContainerWidget.h>
24#include <Wt/WTable.h>
25#include <Wt/WPushButton.h>
26#include <Wt/WText.h>
27#include <Wt/WSignal.h>
28#include <vector>
29#include <string>
30#include <boost/uuid/uuid.hpp>
31
32namespace ores::wt::service::app {
33
38 boost::uuids::uuid id;
39 std::string username;
40 std::string email;
41 bool locked = false;
42 bool online = false;
43 int failed_logins = 0;
44 int version = 0;
45};
46
50class account_list_widget : public Wt::WContainerWidget {
51public:
53
54 Wt::Signal<>& add_requested() { return add_requested_; }
55 Wt::Signal<boost::uuids::uuid>& edit_requested() { return edit_requested_; }
56 Wt::Signal<boost::uuids::uuid>& delete_requested() { return delete_requested_; }
57 Wt::Signal<boost::uuids::uuid>& lock_requested() { return lock_requested_; }
58 Wt::Signal<boost::uuids::uuid>& unlock_requested() { return unlock_requested_; }
59
60 void refresh();
61 void set_accounts(const std::vector<account_row>& accounts);
62
63private:
64 void setup_toolbar();
65 void setup_table();
66 void populate_table();
67
68 Wt::WTable* table_;
69 Wt::WText* status_text_;
70 Wt::WPushButton* add_button_;
71 Wt::WPushButton* refresh_button_;
72
73 std::vector<account_row> accounts_;
74 Wt::Signal<> add_requested_;
75 Wt::Signal<boost::uuids::uuid> edit_requested_;
76 Wt::Signal<boost::uuids::uuid> delete_requested_;
77 Wt::Signal<boost::uuids::uuid> lock_requested_;
78 Wt::Signal<boost::uuids::uuid> unlock_requested_;
79};
80
81}
82
83#endif
Account data for display.
Definition account_list_widget.hpp:37
Widget displaying list of user accounts with CRUD operations.
Definition account_list_widget.hpp:50