summaryrefslogtreecommitdiff
path: root/src/views/dashboard.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/views/dashboard.cpp')
-rw-r--r--src/views/dashboard.cpp110
1 files changed, 0 insertions, 110 deletions
diff --git a/src/views/dashboard.cpp b/src/views/dashboard.cpp
deleted file mode 100644
index dcfd002..0000000
--- a/src/views/dashboard.cpp
+++ /dev/null
@@ -1,110 +0,0 @@
-#include "views.hpp"
-#include "imgui.h"
-#include "../administration.hpp"
-#include "../locales/locales.hpp"
-
-typedef enum
-{
- INVOICES = 0,
- EXPENSES = 1,
- CONTACTS = 2,
- REPORT_RESULTS = 3,
- REPORT_TAX = 4,
- PROJECTS = 5,
-
- END
-} dashboard_view_state;
-
-static dashboard_view_state dashboard_state = dashboard_view_state::INVOICES;
-void (*drawcalls[dashboard_view_state::END])(void) = {
- 0,
- 0,
- views_draw_contacts,
- 0,
- 0,
- views_draw_projects,
-};
-
-void views_draw_dashboard()
-{
- // @localize
- if (ImGui::BeginMainMenuBar())
- {
- if (ImGui::BeginMenu("File"))
- {
- if (ImGui::MenuItem("Open", "Ctrl+O")) { /* Handle Open */ }
- if (ImGui::MenuItem("Save", "Ctrl+S")) { /* Handle Save */ }
-
- ImGui::EndMenu();
- }
- ImGui::EndMainMenuBar();
- }
-
- ImGuiIO& io = ImGui::GetIO();
- float menuBarHeight = ImGui::GetFrameHeight();
- float statusBarHeight = 26.0f;
- float sidePanelWidth = 120.0f;
- ImGui::SetNextWindowPos(ImVec2(0, menuBarHeight));
- ImGui::SetNextWindowSize(ImVec2(sidePanelWidth, io.DisplaySize.y - menuBarHeight - statusBarHeight));
-
- // Side panel
- ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0, 0));
- ImGui::Begin("SidePanel", nullptr, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoCollapse);
- {
- // Navigation buttons with custom styling
- ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.0f, 0.0f, 0.0f, 0.0f)); // Transparent background
- ImGui::PushStyleVar(ImGuiStyleVar_ButtonTextAlign, ImVec2(0.0f, 0.5f));
- ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 0)); // Reduce spacing between buttons
- ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(10.0f, 0.0f));
-
- float buttonWidth = sidePanelWidth;
-
- 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))) 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))) dashboard_state = dashboard_view_state::PROJECTS;
-
- ImGui::PopStyleColor(1);
- ImGui::PopStyleVar(3);
- }
- ImGui::End();
- ImGui::PopStyleVar();
-
- ImGui::SetNextWindowPos(ImVec2(sidePanelWidth, menuBarHeight));
- ImGui::SetNextWindowSize(ImVec2(io.DisplaySize.x - sidePanelWidth, io.DisplaySize.y - menuBarHeight - statusBarHeight));
-
- // Main content
- ImGui::Begin("AccountingMainWindow", nullptr, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoCollapse);
- if (drawcalls[dashboard_state]) drawcalls[dashboard_state]();
- ImGui::End();
-
- // Status bar.
- ImGui::SetNextWindowPos(ImVec2(0, io.DisplaySize.y - statusBarHeight));
- ImGui::SetNextWindowSize(ImVec2(io.DisplaySize.x, statusBarHeight));
-
- ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(10, 3));
- ImGui::Begin("StatusBar", nullptr,
- ImGuiWindowFlags_NoTitleBar |
- ImGuiWindowFlags_NoResize |
- ImGuiWindowFlags_NoMove |
- ImGuiWindowFlags_NoScrollbar |
- ImGuiWindowFlags_NoSavedSettings |
- ImGuiWindowFlags_NoBringToFrontOnFocus |
- ImGuiWindowFlags_NoCollapse);
-
- ImGui::Text("Working on: %s", administration_get_file_path()); // @localize
-
- ImGui::End();
- ImGui::PopStyleVar();
-} \ No newline at end of file