-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuser_pages.cpp
More file actions
46 lines (32 loc) · 1.86 KB
/
user_pages.cpp
File metadata and controls
46 lines (32 loc) · 1.86 KB
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
//=======================================================================
// Copyright (c) 2013-2020 Baptiste Wicht.
// Distributed under the terms of the MIT License.
// (See accompanying file LICENSE or copy at
// http://opensource.org/licenses/MIT)
//=======================================================================
#include "config.hpp"
#include "accounts.hpp"
#include "pages/html_writer.hpp"
#include "pages/user_pages.hpp"
#include "http.hpp"
using namespace budget;
void budget::user_config_page(html_writer& w) {
w << title_begin << "Configuration" << title_end;
form_begin(w, "/api/user/config/", "/user/config/");
add_yes_no_picker(w, "Enable fortune module", "input_enable_fortune", !budget::is_fortune_disabled());
add_yes_no_picker(w, "Enable debts module", "input_enable_debts", !budget::is_debts_disabled());
const budget::date today = budget::local_day();
const std::string def = has_default_account() ? default_account().name : "";
add_account_picker_by_name(w, today, "Default account", def, "input_default_account");
const std::string taxes = has_taxes_account() ? taxes_account().name : "";
add_account_picker_by_name(w, today, "Taxes account", taxes, "input_taxes_account", true);
const std::string sh_account = user_config_value("side_category", "");
add_account_picker_by_name(w, today, "Side Hustle Account", sh_account, "input_sh_account", true);
const std::string sh_prefix = user_config_value("side_prefix", "");
add_text_picker(w, "Side Hustle Prefix", "input_sh_prefix", sh_prefix, false);
const std::string fi_expenses = user_config_value("fi_expenses", "");
add_text_picker(w, "FI Expenses", "input_fi_expenses", fi_expenses);
add_text_picker(w, "User", "input_user", get_web_user());
add_password_picker(w, "Password", "input_password", get_web_password());
form_end(w);
}