From 214852f61cd3b9fda257044e9d822b94b4be7e5d Mon Sep 17 00:00:00 2001 From: Aldrik Ramaekers Date: Sat, 20 Sep 2025 19:16:15 +0200 Subject: refactor ui widgets --- include/administration.hpp | 1 + include/config.hpp | 7 ++++++- include/file_templates.hpp | 8 +------- include/ui.hpp | 18 +++++++++++++++--- 4 files changed, 23 insertions(+), 11 deletions(-) (limited to 'include') diff --git a/include/administration.hpp b/include/administration.hpp index cfdb293..0d15195 100644 --- a/include/administration.hpp +++ b/include/administration.hpp @@ -367,6 +367,7 @@ typedef struct #define A_ERR_MISSING_BUSINESSID (1ULL << 14) #define A_ERR_MAX_ITEMS_REACHED (1ULL << 15) #define A_ERR_MISSING_CODE (1ULL << 16) +#define A_ERR_MISSING_EMAIL (1ULL << 17) typedef uint32_t a_err; diff --git a/include/config.hpp b/include/config.hpp index 2284c8a..9598841 100644 --- a/include/config.hpp +++ b/include/config.hpp @@ -29,4 +29,9 @@ #define u8 uint8_t #define u16 uint16_t #define u32 uint32_t -#define u64 uint64_t \ No newline at end of file +#define u64 uint64_t + +extern const char* country_codes[]; +extern s32 country_count; + +#define COLOR_ERROR_OUTLINE IM_COL32(255, 0, 0, 80) \ No newline at end of file diff --git a/include/file_templates.hpp b/include/file_templates.hpp index 1980d97..9064abf 100644 --- a/include/file_templates.hpp +++ b/include/file_templates.hpp @@ -84,14 +84,10 @@ const char* peppol_invoice_line_template = " {{QUANTITY}}\n" " {{LINE_AMOUNT}}\n" -" \n" -" {{TAX_BRACKET_ID}}\n" -" \n" - " \n" " false\n" " Discount\n" -" {{ALLOWANCE_IS_PERCENTAGE}}\n" +" {{DISCOUNT_TOTAL_PERCENTAGE}}\n" " {{DISCOUNT_TOTAL}}\n" " {{DISCOUNT_BASE_AMOUNT}}\n" " \n" @@ -168,7 +164,6 @@ const char *peppol_invoice_template = "\n" " \n" " {{SUPPLIER_LEGAL_NAME}}\n" -" {{SUPPLIER_BUSINESS_ID}}\n" " \n" "\n" " \n" @@ -208,7 +203,6 @@ const char *peppol_invoice_template = "\n" " \n" " {{CUSTOMER_LEGAL_NAME}}\n" -" {{CUSTOMER_BUSINESS_ID}}\n" " \n" "\n" " \n" diff --git a/include/ui.hpp b/include/ui.hpp index cdffa58..d6c5fad 100644 --- a/include/ui.hpp +++ b/include/ui.hpp @@ -17,6 +17,7 @@ #pragma once #include "imgui.h" +#include "administration.hpp" #define STATUS_TEXT_LEN 64 #define STATUS_DURATION 4.0f @@ -61,8 +62,6 @@ typedef struct extern ImFont* fontBold; extern ImFont* fontBig; -void ui_helper_draw_required_tag(); - ui_status ui_get_status(); void ui_set_status_loading(bool loading); void ui_set_status_error(const char* txt); @@ -94,4 +93,17 @@ void ui_destroy_expenses(); void ui_destroy_earnings(); // Custom imgui widgets. -int TextInputWithAutocomplete(const char* label, const char* hint, char* buffer, size_t buf_size, char** suggestions, int suggestion_count); \ No newline at end of file +namespace ImGui +{ + int TextInputWithAutocomplete(const char* hint, char* buffer, size_t buf_size, char** suggestions, int suggestion_count, bool has_error); + + void FormContactAutocomplete(contact* buffer, bool has_error); + void FormInputTextWithErrorHint(const char* hint, void* data, char* buffer, size_t buf_size, bool has_error); + void FormCountryCombo(void* data, char* buffer, size_t buf_size); + void FormContactTypeCombo(contact_type* type); + void FormCostCenterCombo(char* costcenter_id); + void FormProjectCombo(char* project_id); + void FormTaxRateCombo(char* tax_rate_id, char* orig_country, char* dest_country); + bool FormCurrencyCombo(char* currency); + void FormToggleCombo(bool *buffer, char* option1, char* option2); +} \ No newline at end of file -- cgit v1.2.3-70-g09d2