From 5d34aff5888d3f0c624251f15bedb96c347978d6 Mon Sep 17 00:00:00 2001 From: Aldrik Ramaekers Date: Sat, 9 Aug 2025 08:33:08 +0200 Subject: refactors --- include/administration.hpp | 70 ++++++++++++++++++++++++++++++++++++++++++++++ include/config.hpp | 13 +++++++++ include/locales.hpp | 21 ++++++++++++++ include/strops.hpp | 3 ++ include/ui.hpp | 15 ++++++++++ 5 files changed, 122 insertions(+) create mode 100644 include/administration.hpp create mode 100644 include/config.hpp create mode 100644 include/locales.hpp create mode 100644 include/strops.hpp create mode 100644 include/ui.hpp (limited to 'include') diff --git a/include/administration.hpp b/include/administration.hpp new file mode 100644 index 0000000..9506246 --- /dev/null +++ b/include/administration.hpp @@ -0,0 +1,70 @@ +#pragma once + +#include "config.hpp" +#include "simclist.h" + +typedef struct +{ + char id[16]; + char name[64]; + char address1[128]; + char address2[128]; + char country[128]; + char taxid[32]; + char businessid[32]; + char email[64]; + char phone_number[16]; + char bank_account[32]; +} contact; + +typedef enum +{ + RUNNING, + PAUSED, + CANCELLED, +} project_state; + +typedef struct +{ + char id[16]; + char description[64]; + project_state state; + time_t start_date; + time_t end_date; +} project; + +typedef struct +{ + contact company_info; + s32 next_id; + char path[4096]; + char program_version[10]; + char country_code[2]; + list_t contacts; + list_t projects; + // invoices + char ai_service[16]; + char ai_key[32]; + char email_service[16]; + char email_key[32]; +} administration; + +void administration_create(); +void administration_destroy(); + +char* administration_get_file_path(); +s32 administration_create_id(); + +bool administration_remove_contact(contact data); +bool administration_create_contact(contact data); +bool administration_update_contact(contact data); +u32 administration_get_contact_count(); +u32 administration_get_contacts(u32 page_index, u32 page_size, contact* buffer); + +void administration_cancel_project(project data); +bool administration_remove_project(project data); +bool administration_create_project(project data); +bool administration_update_project(project data); +char* administration_project_get_status_string(project data); +u32 administration_get_project_count(); +u32 administration_get_projects(u32 page_index, u32 page_size, project* buffer); \ No newline at end of file diff --git a/include/config.hpp b/include/config.hpp new file mode 100644 index 0000000..3279e2e --- /dev/null +++ b/include/config.hpp @@ -0,0 +1,13 @@ +#pragma once + +#include "stdint.h" + +#define s8 int8_t +#define s16 int16_t +#define s32 int32_t +#define s64 int64_t + +#define u8 uint8_t +#define u16 uint16_t +#define u32 uint32_t +#define u64 uint64_t \ No newline at end of file diff --git a/include/locales.hpp b/include/locales.hpp new file mode 100644 index 0000000..78bb682 --- /dev/null +++ b/include/locales.hpp @@ -0,0 +1,21 @@ +#pragma once + +#include +#include + +typedef struct { + const char* key; + const char* value; +} locale_entry; + +typedef struct { + const char* lang_code; + locale_entry* entries; + int entry_count; +} locale_map; + +extern locale_entry en_locales[]; +extern const int en_locale_count; + +void set_locale(const char key[2]); +const char* localize(const char* key); \ No newline at end of file diff --git a/include/strops.hpp b/include/strops.hpp new file mode 100644 index 0000000..daa1d71 --- /dev/null +++ b/include/strops.hpp @@ -0,0 +1,3 @@ +#pragma once + +size_t strops_copy(char *dst, const char *src, size_t size); \ No newline at end of file diff --git a/include/ui.hpp b/include/ui.hpp new file mode 100644 index 0000000..827980c --- /dev/null +++ b/include/ui.hpp @@ -0,0 +1,15 @@ +#pragma once + +typedef enum +{ + LIST, + EDIT, + CREATE, + VIEW, +} view_state; + +void view_draw_required_tag(); + +void ui_draw_main(); +void ui_draw_contacts(); +void ui_draw_projects(); \ No newline at end of file -- cgit v1.2.3-70-g09d2