aboutsummaryrefslogtreecommitdiff
path: root/core/src/UI
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/UI')
-rw-r--r--core/src/UI/Localization.hpp1
-rw-r--r--core/src/UI/UI.hpp2
-rw-r--r--core/src/UI/UI_DatabaseView.cpp18
-rw-r--r--core/src/UI/UI_Items.cpp2
-rw-r--r--core/src/UI/UI_MainWindow.cpp5
-rw-r--r--core/src/UI/UI_Workflows.cpp (renamed from core/src/UI/UI_Export.cpp)2
6 files changed, 22 insertions, 8 deletions
diff --git a/core/src/UI/Localization.hpp b/core/src/UI/Localization.hpp
index f476458..3f09fb2 100644
--- a/core/src/UI/Localization.hpp
+++ b/core/src/UI/Localization.hpp
@@ -27,6 +27,7 @@ public:
BasicTranslation ProjectTab{ "MainWindow.Tab.Project"sv };
BasicTranslation DatabaseViewTab{ "MainWindow.Tab.DatabaseView"sv };
BasicTranslation ItemsTab{ "MainWindow.Tab.Items"sv };
+ BasicTranslation WorkflowsTab{ "MainWindow.Tab.Workflows"sv };
/* Project tab */
diff --git a/core/src/UI/UI.hpp b/core/src/UI/UI.hpp
index ab35321..9e97118 100644
--- a/core/src/UI/UI.hpp
+++ b/core/src/UI/UI.hpp
@@ -27,6 +27,6 @@ void MainWindow();
void SettingsTab();
void DatabaseViewTab();
void ItemsTab();
-void ExportTab();
+void WorkflowsTab();
} // namespace UI
diff --git a/core/src/UI/UI_DatabaseView.cpp b/core/src/UI/UI_DatabaseView.cpp
index 8791c5b..884ab51 100644
--- a/core/src/UI/UI_DatabaseView.cpp
+++ b/core/src/UI/UI_DatabaseView.cpp
@@ -10,6 +10,7 @@
#include <IconsFontAwesome.h>
#include <SQLiteCpp/Statement.h>
#include <imgui.h>
+#include <chrono>
#include <cstdint>
#include <ctime>
#include <memory>
@@ -196,7 +197,7 @@ private:
void UpdateLastPage() {
mLastPage = mActiveEntries.empty()
- ? 0
+ ? 0 // TODO calc page
: CalcPageForRowId(mActiveEntries.back());
}
@@ -258,10 +259,17 @@ private:
return "";
}
- auto t = static_cast<time_t>(epoch);
- std::string str(29, '\0');
- std::strftime(str.data(), 21, "%Y-%m-%dT%H:%M:%S.", std::localtime(&t));
- return str;
+ namespace chrono = std::chrono;
+ using Clock = chrono::system_clock;
+
+ chrono::milliseconds d{ epoch };
+ chrono::time_point<chrono::system_clock> tp{ d };
+ auto t = chrono::system_clock::to_time_t(tp);
+
+ char data[32];
+ std::strftime(data, sizeof(data), "%Y-%m-%d %H:%M:%S", std::localtime(&t));
+
+ return std::string(data);
};
int customerCol = stmt.getColumnIndex("Customer");
diff --git a/core/src/UI/UI_Items.cpp b/core/src/UI/UI_Items.cpp
index a094f76..56d6c2a 100644
--- a/core/src/UI/UI_Items.cpp
+++ b/core/src/UI/UI_Items.cpp
@@ -93,7 +93,7 @@ void ItemListEntries(ItemList<T>& list, int& selectedIdx) {
constexpr bool kHasEmail = requires(T t) { t.GetEmail(); };
constexpr bool kHasStock = requires(T t) { t.GetPrice(); };
constexpr bool kHasPrice = requires(T t) { t.GetPrice(); };
- constexpr int kColumns = 1 /* Name column */ + kHasDescription + kHasEmail;
+ constexpr int kColumns = 1 /* Name column */ + kHasDescription + kHasEmail + kHasStock + kHasPrice;
auto ls = LocaleStrings::Instance.get();
auto& uis = UIState::GetInstance();
diff --git a/core/src/UI/UI_MainWindow.cpp b/core/src/UI/UI_MainWindow.cpp
index 30505d6..f1d1e5e 100644
--- a/core/src/UI/UI_MainWindow.cpp
+++ b/core/src/UI/UI_MainWindow.cpp
@@ -223,6 +223,11 @@ void UI::MainWindow() {
ImGui::EndTabItem();
}
+ if (ImGui::BeginTabItem()) {
+ UI::WorkflowsTab();
+ ImGui::EndTabItem();
+ }
+
endTab:
ImGui::EndTabBar();
}
diff --git a/core/src/UI/UI_Export.cpp b/core/src/UI/UI_Workflows.cpp
index 06b49f5..2b0368e 100644
--- a/core/src/UI/UI_Export.cpp
+++ b/core/src/UI/UI_Workflows.cpp
@@ -4,6 +4,6 @@
#include <imgui.h>
-void UI::ExportTab() {
+void UI::WorkflowsTab() {
// TODO
}