summaryrefslogtreecommitdiff
path: root/src/views/dashboard.cpp
diff options
context:
space:
mode:
authorAldrik Ramaekers <aldrikboy@gmail.com>2025-08-08 22:04:47 +0200
committerAldrik Ramaekers <aldrikboy@gmail.com>2025-08-08 22:04:47 +0200
commitb94a7ae06b20d550c727d5192cea8baf3e8fb641 (patch)
tree3258eb27e2e3f266f8c220662ebb24ebe3071b79 /src/views/dashboard.cpp
parent21496e32695744d4679fc11105352c61522ce601 (diff)
project crud
Diffstat (limited to 'src/views/dashboard.cpp')
-rw-r--r--src/views/dashboard.cpp23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/views/dashboard.cpp b/src/views/dashboard.cpp
index 86dc18f..dcfd002 100644
--- a/src/views/dashboard.cpp
+++ b/src/views/dashboard.cpp
@@ -1,6 +1,7 @@
#include "views.hpp"
#include "imgui.h"
#include "../administration.hpp"
+#include "../locales/locales.hpp"
typedef enum
{
@@ -14,14 +15,14 @@ typedef enum
END
} dashboard_view_state;
-static dashboard_view_state view_state = dashboard_view_state::INVOICES;
+static dashboard_view_state dashboard_state = dashboard_view_state::INVOICES;
void (*drawcalls[dashboard_view_state::END])(void) = {
0,
0,
views_draw_contacts,
0,
0,
- 0,
+ views_draw_projects,
};
void views_draw_dashboard()
@@ -58,21 +59,21 @@ void views_draw_dashboard()
float buttonWidth = sidePanelWidth;
- if (ImGui::Button(localize("nav.invoices"), ImVec2(buttonWidth, 24))) view_state = dashboard_view_state::INVOICES;
- if (ImGui::Button(localize("nav.expenses"), ImVec2(buttonWidth, 24))) view_state = dashboard_view_state::EXPENSES;
- if (ImGui::Button(localize("nav.contacts"), ImVec2(buttonWidth, 24))) view_state = dashboard_view_state::CONTACTS;
+ if (ImGui::Button(localize("nav.invoices"), ImVec2(buttonWidth, 24))) dashboard_state = dashboard_view_state::INVOICES;
+ if (ImGui::Button(localize("nav.expenses"), ImVec2(buttonWidth, 24))) dashboard_state = dashboard_view_state::EXPENSES;
+ if (ImGui::Button(localize("nav.contacts"), ImVec2(buttonWidth, 24))) dashboard_state = dashboard_view_state::CONTACTS;
static bool reports_opened = false;
if (ImGui::Button(localize("nav.reports"), ImVec2(buttonWidth, 24))) reports_opened = !reports_opened;
if (reports_opened)
{
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(20.0f, 0.0f));
- if (ImGui::Button(localize("nav.reports.results"), ImVec2(buttonWidth, 24))) view_state = dashboard_view_state::REPORT_RESULTS;
- if (ImGui::Button(localize("nav.reports.tax"), ImVec2(buttonWidth, 24))) view_state = dashboard_view_state::REPORT_TAX;
+ if (ImGui::Button(localize("nav.reports.results"), ImVec2(buttonWidth, 24))) dashboard_state = dashboard_view_state::REPORT_RESULTS;
+ if (ImGui::Button(localize("nav.reports.tax"), ImVec2(buttonWidth, 24))) dashboard_state = dashboard_view_state::REPORT_TAX;
ImGui::PopStyleVar();
}
- if (ImGui::Button(localize("nav.Projects"), ImVec2(buttonWidth, 24))) view_state = dashboard_view_state::PROJECTS;
+ if (ImGui::Button(localize("nav.Projects"), ImVec2(buttonWidth, 24))) dashboard_state = dashboard_view_state::PROJECTS;
ImGui::PopStyleColor(1);
ImGui::PopStyleVar(3);
@@ -85,7 +86,7 @@ void views_draw_dashboard()
// Main content
ImGui::Begin("AccountingMainWindow", nullptr, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoCollapse);
- if (drawcalls[view_state]) drawcalls[view_state]();
+ if (drawcalls[dashboard_state]) drawcalls[dashboard_state]();
ImGui::End();
// Status bar.
@@ -102,9 +103,7 @@ void views_draw_dashboard()
ImGuiWindowFlags_NoBringToFrontOnFocus |
ImGuiWindowFlags_NoCollapse);
- ImGui::Text("Working on: %s", administration_get_file_path());
- ImGui::SameLine();
- ImGui::Text("Status: []");
+ ImGui::Text("Working on: %s", administration_get_file_path()); // @localize
ImGui::End();
ImGui::PopStyleVar();