15#include <initializer_list>
36 "100%",
"80%",
"60%",
"50%",
"40%",
"30%",
"20%"};
37inline constexpr std::array<const char*, 5>
YEAR_LABELS = {
"1",
"2",
"3",
"4",
41inline constexpr std::array<std::uint16_t, 4>
GOAL_TARGETS = {5, 10, 15, 20};
45 "0%",
"5%",
"10%",
"15%",
"20%",
"25%",
"30%"};
47inline constexpr std::int64_t
FEE_STEP = 10'000;
50template <
typename T,
typename V>
56 if (std::abs(
static_cast<int>(options[
index]) -
static_cast<int>(value)) <
57 std::abs(
static_cast<int>(options[best]) -
static_cast<int>(value)))
60 return static_cast<int>(best);
63template <
typename T, std::
size_t N,
typename V>
66 return optionIndex(std::span<const T>(options), value);
70void formLabel(
const char* text);
81bool beginPanel(
const char*
id,
const char* title);
98 std::span<const UI::MoneyChip> fee_chips);
107 0, 5, 10, 15, 20, 25, 30};
119 std::uint32_t market_value);
Pieces shared by the transfer dialogs: the structured offer editor (fee, upfront share,...
Definition transfer_terms_editor.cpp:23
constexpr std::array< std::uint8_t, 7 > MIN_APPEARANCE_OPTIONS
Definition transfer_terms_editor.h:106
void alignActions(std::initializer_list< const char * > labels)
Definition transfer_terms_editor.cpp:31
void endPanel()
Definition transfer_terms_editor.cpp:67
bool editLoan(TransferNegotiation::LoanTerms &terms, std::uint32_t market_value)
Definition transfer_terms_editor.cpp:242
constexpr std::int64_t FEE_STEP
Definition transfer_terms_editor.h:47
bool snapToOptions(TransferNegotiation::OfferTerms &terms)
Definition transfer_terms_editor.cpp:111
int optionIndex(std::span< const T > options, V value)
Definition transfer_terms_editor.h:51
bool edit(TransferNegotiation::OfferTerms &terms, std::span< const UI::MoneyChip > fee_chips)
Definition transfer_terms_editor.cpp:132
constexpr std::array< std::uint16_t, 4 > APPEARANCE_TARGETS
Definition transfer_terms_editor.h:39
constexpr std::array< const char *, 7 > SELL_ON_LABELS
Definition transfer_terms_editor.h:44
constexpr std::uint8_t DEFAULT_INSTALMENT_YEARS
Definition transfer_terms_editor.h:46
constexpr std::array< const char *, 5 > YEAR_LABELS
Definition transfer_terms_editor.h:37
constexpr std::array< std::uint16_t, 4 > GOAL_TARGETS
Definition transfer_terms_editor.h:41
constexpr std::array< std::uint8_t, 7 > UPFRONT_OPTIONS
Definition transfer_terms_editor.h:33
std::string structureText(const TransferNegotiation::OfferTerms &terms)
Definition transfer_terms_editor.cpp:390
std::string loanTermsLine(const TransferNegotiation::LoanTerms &terms)
Definition transfer_terms_editor.cpp:369
constexpr std::array< std::uint8_t, 7 > SELL_ON_OPTIONS
Definition transfer_terms_editor.h:42
constexpr std::array< const char *, 7 > UPFRONT_LABELS
Definition transfer_terms_editor.h:35
bool snapLoanToOptions(TransferNegotiation::LoanTerms &terms)
Definition transfer_terms_editor.cpp:225
constexpr int LOAN_WAGE_SHARE_STEP
Definition transfer_terms_editor.h:105
int index
Definition runtime_editor.cpp:94
Definition transfer_negotiation.h:299
A club-to-club offer: fee, instalments, add-ons and sell-on.
Definition transfer_negotiation.h:100
std::array< const char *, 6 > labels
Definition transfer_terms_editor.cpp:77